r15261 by cbradney - #9058: Re-eanble saving of toolbar visibility

scribus-commit scribus-commit at lists.scribus.net
Wed Jun 23 23:10:54 CEST 2010


Revision: 15261
Author: cbradney
Date: 2010-06-23T21:04:08.430537Z
Commit message: #9058: Re-eanble saving of toolbar visibility

Changeset: 
M  /branches/Version135/Scribus/scribus/sctoolbar.cpp
M  /branches/Version135/Scribus/scribus/scribus.cpp
M  /branches/Version135/Scribus/scribus/sctoolbar.h

Diffs:
Index: scribus/sctoolbar.cpp
===================================================================
--- scribus/sctoolbar.cpp	(revision 15260)
+++ scribus/sctoolbar.cpp	(revision 15261)
@@ -105,22 +105,33 @@
 
 // 	connect(this, SIGNAL(placeChanged(Q3DockWindow::Place)), this, SLOT(slotPlaceChanged(Q3DockWindow::Place)));
 }
-/*
+
 void ScToolBar::initVisibility()
 {
 	if (m_prefs->getBool("IsVisible", true))
 	{
 		show();
+/*
 		if (place() == InDock)
 			setOrientation(area()->orientation());
 		else
 			setOrientation(floatOrientation);
+*/
 	}
 	else
 		hide();
-	connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(slotVisibilityChanged(bool)));
+	connectPrefsSlot(true);
 }
 
+void ScToolBar::connectPrefsSlot(bool b)
+{
+	if (b)
+		connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(slotVisibilityChanged(bool)));
+	else
+		disconnect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(slotVisibilityChanged(bool)));
+}
+
+/*
 int ScToolBar::position()
 {
 	if (place() == Q3DockWindow::OutsideDock)
@@ -191,12 +202,12 @@
 		setOrientation(floatOrientation);
 	}
 }
-
+*/
 void ScToolBar::slotVisibilityChanged(bool visible)
 {
 	m_prefs->set("IsVisible", visible);
 }
-
+/*
 void ScToolBar::slotTop()
 {
 	dockTop = !dockTop;
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 15260)
+++ scribus/scribus.cpp	(revision 15261)
@@ -1952,6 +1952,10 @@
 			}
 		}
 	}
+	fileToolBar->connectPrefsSlot(false);
+	editToolBar->connectPrefsSlot(false);
+	modeToolBar->connectPrefsSlot(false);
+	pdfToolBar->connectPrefsSlot(false);
 	propertiesPalette->hide();
 	outlinePalette->hide();
 	scrapbookPalette->hide();
@@ -4883,6 +4887,10 @@
 {
 	propertiesPalette->unsetDoc();
 	ScCore->pluginManager->savePreferences();
+	fileToolBar->connectPrefsSlot(false);
+	editToolBar->connectPrefsSlot(false);
+	modeToolBar->connectPrefsSlot(false);
+	pdfToolBar->connectPrefsSlot(false);
 	close();
 }
 
Index: scribus/sctoolbar.h
===================================================================
--- scribus/sctoolbar.h	(revision 15260)
+++ scribus/sctoolbar.h	(revision 15261)
@@ -46,11 +46,13 @@
 	// if using name settings depend on the language
 	ScToolBar(const QString& name, const QString &prefName, QMainWindow *parent, Qt::Orientation o = Qt::Horizontal);
 	virtual ~ScToolBar();
+	//bit of a hack as saving prefs seems to happen on shutdown and prefs is already in the process of being destroyed
+	void connectPrefsSlot(bool b);
 
 // 	int position();
 // 	void storeDockPosition();
 // 	void moveDock();
-// 	void initVisibility();
+ 	void initVisibility();
 	
 signals:
 	void visibilityChanged(bool);
@@ -60,7 +62,7 @@
 
 protected slots:
 // 	void slotPlaceChanged(Q3DockWindow::Place p);
-// 	void slotVisibilityChanged(bool visible);
+ 	void slotVisibilityChanged(bool visible);
 // 	void slotTop();
 // 	void slotRight();
 // 	void slotBottom();




More information about the scribus-commit mailing list