r19525 by craig - #12705: Don't allow context menus in the About window

scribus-commit scribus-commit at lists.scribus.net
Mon Sep 22 21:05:42 UTC 2014


Author: craig
Date: Mon Sep 22 21:05:42 2014
New Revision: 19525

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19525
Log:
#12705: Don't allow context menus in the About window

Modified:
    trunk/Scribus/scribus/ui/about.cpp
    trunk/Scribus/scribus/ui/sctextbrowser.cpp
    trunk/Scribus/scribus/ui/sctextbrowser.h

Modified: trunk/Scribus/scribus/ui/about.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19525&path=/trunk/Scribus/scribus/ui/about.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/about.cpp (original)
+++ trunk/Scribus/scribus/ui/about.cpp Mon Sep 22 21:05:42 2014
@@ -194,7 +194,7 @@
 	// /usr/local/scribus14/share/doc/scribus-1.3.5svn/AUTHORS
 	textView1 = new ScTextBrowser( tab_2 );
 	textView1->setHtml(About::parseAuthorFile(ScPaths::instance().docDir() + "AUTHORS"));
-
+	textView1->swallowContextMenus(true);
 	tabLayout->addWidget( textView1 );
 	tabWidget2->addTab( tab_2, tr( "A&uthors" ) );
 	tab_3 = new QWidget( tabWidget2 );
@@ -208,7 +208,7 @@
 	/*! TRANSLATION tab */
 	// /usr/local/scribus14/share/doc/scribus-1.3.5svn/TRANSLATION
 	textView2->setHtml(About::parseTranslationFile(ScPaths::instance().docDir() + "TRANSLATION"));
-
+	textView2->swallowContextMenus(true);
 	tabLayout_2->addWidget( textView2 );
 	tabWidget2->addTab( tab_3, tr( "&Translations" ) );
 
@@ -217,6 +217,7 @@
 	tab_4 = new QWidget( tabWidget2 );
 	textView4 = new ScTextBrowser( tab_4 );
 	textView4->setHtml(About::parseLinksFile(ScPaths::instance().docDir() + "LINKS"));
+	textView4->swallowContextMenus(true);
 	tabLayout_4 = new QHBoxLayout( tab_4 );
 	tabLayout_4->setSpacing( 6 );
 	tabLayout_4->setMargin( 10 );
@@ -253,7 +254,7 @@
 		QString licenceText = inTS.readAll();
 		textViewLicence->setSimpleText(licenceText);
 	} 
-	
+	textViewLicence->swallowContextMenus(true);
 	//Add tab widget to about window
 	aboutLayout->addWidget( tabWidget2 );
 

Modified: trunk/Scribus/scribus/ui/sctextbrowser.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19525&path=/trunk/Scribus/scribus/ui/sctextbrowser.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/sctextbrowser.cpp (original)
+++ trunk/Scribus/scribus/ui/sctextbrowser.cpp Mon Sep 22 21:05:42 2014
@@ -21,6 +21,7 @@
 ScTextBrowser::ScTextBrowser( QWidget * parent )
 	 : QWebView(parent)
 {
+	hideContextMenus=false;
 	// Questionable - e.g. I would like to browse only through help browser (a pref?)
 	page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
 	connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(catchHome(QUrl)));
@@ -43,6 +44,11 @@
 void ScTextBrowser::find(const QString& txt, const int& options)
 {
 	findText(txt, QWebPage::FindFlag(options));
+}
+
+void ScTextBrowser::swallowContextMenus(bool b)
+{
+	hideContextMenus=b;
 }
 
 
@@ -84,3 +90,11 @@
 //	return ret;
 	return QWebView::event(e);
 }
+
+void ScTextBrowser::contextMenuEvent(QContextMenuEvent* e)
+{
+	if (hideContextMenus)
+		page()->swallowContextMenuEvent(e);
+	else
+		QWebView::contextMenuEvent(e);
+}

Modified: trunk/Scribus/scribus/ui/sctextbrowser.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19525&path=/trunk/Scribus/scribus/ui/sctextbrowser.h
==============================================================================
--- trunk/Scribus/scribus/ui/sctextbrowser.h (original)
+++ trunk/Scribus/scribus/ui/sctextbrowser.h Mon Sep 22 21:05:42 2014
@@ -23,10 +23,13 @@
 		void clear();
 		void setSimpleText(const QString& str);
 		void find(const QString& txt, const int& options = 0);
+		void swallowContextMenus(bool b);
 		QString toPlainText();
 
 	protected:
 		bool event(QEvent *e);
+		void contextMenuEvent(QContextMenuEvent *e);
+		bool hideContextMenus;
 
 	public slots:
 		void home();




More information about the scribus-commit mailing list