[rkward/work/preview_with_menu] rkward/plugin: Fix saving preview area size / state.

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Wed Feb 3 19:38:36 UTC 2016


Git commit c69972a512d7618e514a943ea8fb2ba261cf75b0 by Thomas Friedrichsmeier.
Committed on 03/02/2016 at 19:38.
Pushed by tfry into branch 'work/preview_with_menu'.

Fix saving preview area size / state.

M  +4    -14   rkward/plugin/rkstandardcomponentgui.cpp

http://commits.kde.org/rkward/c69972a512d7618e514a943ea8fb2ba261cf75b0

diff --git a/rkward/plugin/rkstandardcomponentgui.cpp b/rkward/plugin/rkstandardcomponentgui.cpp
index bcfef44..d3aeed4 100644
--- a/rkward/plugin/rkstandardcomponentgui.cpp
+++ b/rkward/plugin/rkstandardcomponentgui.cpp
@@ -81,20 +81,6 @@ RKStandardComponentGUI::RKStandardComponentGUI (RKStandardComponent *component,
 
 RKStandardComponentGUI::~RKStandardComponentGUI () {
 	RK_TRACE (PLUGIN);
-
-	if (!enslaved && toggle_code_box && splitter) {  // A top-level dialog-style UI
-		for (int i = 0; i < previews.size (); ++i) {
-			bool visible = previews[i].controller->boolValue ();
-			int size = preview_splitter->width ();
-			if (i == previews.size () - 1) {  // code preview
-				RKSettingsModulePlugins::setShowCodeByDefault (visible);
-				if (visible) RKSettingsModulePlugins::setDefaultCodeHeight (size);
-			} else {
-#warning cleanup!
-				if (visible) RKSettingsModulePlugins::setDefaultOtherPreviewHeight (size);
-			}
-		}
-	}
 }
 
 void RKStandardComponentGUI::createDialog (bool switchable) {
@@ -279,6 +265,10 @@ void RKStandardComponentGUI::ok () {
 void RKStandardComponentGUI::cancel () {
 	RK_TRACE (PLUGIN);
 
+	if (!enslaved && toggle_code_box && splitter) {  // A top-level dialog-style UI. Save state of preview area
+		RKSettingsModulePlugins::setShowCodeByDefault (code_display_visibility.boolValue ());
+		if (preview_splitter->isVisible ()) RKSettingsModulePlugins::setDefaultCodeHeight (preview_splitter->width ());
+	}
 	hide ();
 	if (!enslaved) {
 		component->deleteLater ();



More information about the rkward-tracker mailing list