┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinmainwindow.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-01-07 21:10:52 +0000
committerPeter Penz <[email protected]>2007-01-07 21:10:52 +0000
commitb4543ce1708dc0e59cb1dd54e1c53648c5959b24 (patch)
treee82b2aadb91e799fed7ba21bf8d4ef0fde9bbacb /src/dolphinmainwindow.cpp
parent445f0b64bdd34e39f0565ef870937ebd3d5dfa61 (diff)
Remember the position and size of the docks by using QMainWindow::saveState() and QMainWindow::restoreState(). I assume that in KDE 4 there will be a generic mechanism to store the position and size of docks like done for toolbars -> this is only a temporary solution to have a usable version of Dolphin in the meantime.
svn path=/trunk/playground/utils/dolphin/; revision=620954
Diffstat (limited to 'src/dolphinmainwindow.cpp')
-rw-r--r--src/dolphinmainwindow.cpp36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 7d0e09926..081960df0 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -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));