]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Remember the position and size of the docks by using QMainWindow::saveState() and...
authorPeter Penz <peter.penz19@gmail.com>
Sun, 7 Jan 2007 21:10:52 +0000 (21:10 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sun, 7 Jan 2007 21:10:52 +0000 (21:10 +0000)
svn path=/trunk/playground/utils/dolphin/; revision=620954

src/dolphinmainwindow.cpp
src/dolphinui.rc

index 7d0e0992624a31bdb9cf9aac33efd2a504901efb..081960df07546c2c4bba6e389070db542c124405 100644 (file)
@@ -307,17 +307,23 @@ void DolphinMainWindow::linkDroppedItems()
 
 void DolphinMainWindow::closeEvent(QCloseEvent* event)
 {
-    // KDE4-TODO
-    //KConfig* config = KGlobal::config();
-    //config->setGroup("General");
-    //config->writeEntry("First Run", false);
-
     DolphinSettings& settings = DolphinSettings::instance();
     GeneralSettings* generalSettings = settings.generalSettings();
     generalSettings->setFirstRun(false);
 
     settings.save();
 
+    // TODO: I assume there will be a generic way in KDE 4 to store the docks
+    // of the main window. In the meantime they are stored manually:
+    QString filename = KStandardDirs::locateLocal("data", KGlobal::instance()->instanceName());
+    filename.append("/panels_layout");
+    QFile file(filename);
+    if (file.open(QIODevice::WriteOnly)) {
+        QByteArray data = saveState();
+        file.write(data);
+        file.close();
+    }
+
     KMainWindow::closeEvent(event);
 }
 
@@ -1138,6 +1144,18 @@ void DolphinMainWindow::loadSettings()
     }
 
     updateViewActions();
+
+    // TODO: I assume there will be a generic way in KDE 4 to restore the docks
+    // of the main window. In the meantime they are restored manually (see also
+    // DolphinMainWindow::closeEvent() for more details):
+    QString filename = KStandardDirs::locateLocal("data", KGlobal::instance()->instanceName());
+    filename.append("/panels_layout");
+    QFile file(filename);
+    if (file.open(QIODevice::ReadOnly)) {
+        QByteArray data = file.readAll();
+        restoreState(data);
+        file.close();
+    }
 }
 
 void DolphinMainWindow::setupActions()
@@ -1306,17 +1324,19 @@ void DolphinMainWindow::setupActions()
 
 void DolphinMainWindow::setupDockWidgets()
 {
-    QDockWidget* shortcutsDock = new QDockWidget(i18n("Shortcuts"));
+    QDockWidget* shortcutsDock = new QDockWidget(i18n("Bookmarks"));
+    shortcutsDock->setObjectName("bookmarksDock");
     shortcutsDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
     shortcutsDock->setWidget(new BookmarksSidebarPage(this));
 
-    shortcutsDock->toggleViewAction()->setObjectName("show_shortcuts_panel");
-    shortcutsDock->toggleViewAction()->setText(i18n("Show Shortcuts Panel"));
+    shortcutsDock->toggleViewAction()->setObjectName("show_bookmarks_panel");
+    shortcutsDock->toggleViewAction()->setText(i18n("Show Bookmarks Panel"));
     actionCollection()->insert(shortcutsDock->toggleViewAction());
 
     addDockWidget(Qt::LeftDockWidgetArea, shortcutsDock);
 
     QDockWidget* infoDock = new QDockWidget(i18n("Information"));
+    infoDock->setObjectName("infoDock");
     infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
     infoDock->setWidget(new InfoSidebarPage(this));
 
index 22bfe909ec7bb9bcefb09989500c7f5aa0188b2c..a090a1d2f96a98d9bdc3a699781ecaebe1ee6a22 100644 (file)
@@ -43,7 +43,7 @@
    <Separator/>
    <Menu name="panels">
     <text>Panels</text>
-    <Action name="show_shortcuts_panel" />
+    <Action name="show_bookmarks_panel" />
     <Action name="show_info_panel" />
    </Menu>
    <Menu name="navigation_bar">