[rkward/work/preview_with_menu] rkward: Further trim down preview menus

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Tue Feb 9 13:53:19 UTC 2016


Git commit 78710ef978d1c37664869043425cba8fcbd0bb1a by Thomas Friedrichsmeier.
Committed on 09/02/2016 at 12:42.
Pushed by tfry into branch 'work/preview_with_menu'.

Further trim down preview menus

M  +6    -2    rkward/misc/rkxmlguipreviewarea.cpp
M  +9    -1    rkward/windows/rkmdiwindow.cpp
M  +1    -0    rkward/windows/rkwindowcatcher.cpp

http://commits.kde.org/rkward/78710ef978d1c37664869043425cba8fcbd0bb1a

diff --git a/rkward/misc/rkxmlguipreviewarea.cpp b/rkward/misc/rkxmlguipreviewarea.cpp
index 6956853..d15741d 100644
--- a/rkward/misc/rkxmlguipreviewarea.cpp
+++ b/rkward/misc/rkxmlguipreviewarea.cpp
@@ -97,7 +97,7 @@ void RKXMLGUIPreviewArea::prepareMenu () {
 		bool menu_empty = true;
 		for (int j = 0; j < subentries.size (); ++j) {
 			QAction *act = subentries[j];
-			if (act->isVisible () && act) {
+			if (act->isVisible () && act->isEnabled () && act) {
 				entries_to_add.append (act);
 				if (!act->isSeparator ()) menu_empty = false;  // Copy separators, but purge menus with only separators in them.
 			}
@@ -110,8 +110,12 @@ void RKXMLGUIPreviewArea::prepareMenu () {
 		act->setDefaultWidget (lab);
 		menu->addAction (act);
 
+		QMenu *where_to_add = menu;
+		if (entries_to_add.size () >= 8) {                     // if there are really many entries in the menu don't flatten it, keep it as a (shortened) submenu
+			where_to_add = menu->addMenu (entries[i]->text ());
+		}
 		for (int j = 0; j < entries_to_add.size (); ++j) {
-			menu->addAction (entries_to_add[j]);
+			where_to_add->addAction (entries_to_add[j]);
 		}
 	}
 }
diff --git a/rkward/windows/rkmdiwindow.cpp b/rkward/windows/rkmdiwindow.cpp
index f287c15..356afe2 100644
--- a/rkward/windows/rkmdiwindow.cpp
+++ b/rkward/windows/rkmdiwindow.cpp
@@ -363,7 +363,15 @@ void RKMDIWindow::showEvent (QShowEvent* ev) {
 void RKMDIWindow::setWindowStyleHint (const QString& hint) {
 	RK_TRACE (APP);
 
-	if (hint == "preview") no_border_when_active = true;
+	if (hint == "preview") {
+		if (standard_client) {
+			QAction *act = standardActionCollection ()->action ("window_help");
+			if (act) act->setVisible (false);
+			act = standardActionCollection ()->action ("window_configure");
+			if (act) act->setVisible (false);
+		}
+		no_border_when_active = true;
+	}
 }
 
 void RKMDIWindow::setMetaInfo (const QString& _generic_window_name, const QString& _help_url, RKSettings::SettingsPage _settings_page) {
diff --git a/rkward/windows/rkwindowcatcher.cpp b/rkward/windows/rkwindowcatcher.cpp
index 86820f5..fc2f5f4 100644
--- a/rkward/windows/rkwindowcatcher.cpp
+++ b/rkward/windows/rkwindowcatcher.cpp
@@ -279,6 +279,7 @@ void RKCaughtX11Window::setWindowStyleHint (const QString& hint) {
 			actions_not_for_preview[i]->setVisible (false);
 		}
 	}
+	RKMDIWindow::setWindowStyleHint (hint);
 }
 
 void RKCaughtX11Window::forceClose () {



More information about the rkward-tracker mailing list