From: Peter Penz Date: Sun, 19 Dec 2010 12:48:24 +0000 (+0000) Subject: Fix regression introduced in 4.5 and allow to add the menu actions "Show Information... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/f7bbe21b5b2d3bc85dcba1d03494879aac9e37c7?ds=inline Fix regression introduced in 4.5 and allow to add the menu actions "Show Information Panel", "Show Folders Panel", "Show Terminal Panel", "Show Places Panel" and "Show Places Panel" to the toolbar like in KDE SC 4.4. BUG: 250847 FIXED-IN: 4.6.0 svn path=/trunk/KDE/kdebase/apps/; revision=1207728 --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 3ee891f41..46b28cada 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1591,6 +1591,7 @@ void DolphinMainWindow::setupDockWidgets() QAction* infoAction = infoDock->toggleViewAction(); infoAction->setIcon(KIcon("dialog-information")); infoAction->setShortcut(Qt::Key_F11); + addActionCloneToCollection(infoAction, "show_information_panel"); addDockWidget(Qt::RightDockWidgetArea, infoDock); connect(this, SIGNAL(urlChanged(KUrl)), @@ -1610,6 +1611,7 @@ void DolphinMainWindow::setupDockWidgets() QAction* foldersAction = foldersDock->toggleViewAction(); foldersAction->setShortcut(Qt::Key_F7); foldersAction->setIcon(KIcon("folder")); + addActionCloneToCollection(foldersAction, "show_folders_panel"); addDockWidget(Qt::LeftDockWidgetArea, foldersDock); connect(this, SIGNAL(urlChanged(KUrl)), @@ -1630,6 +1632,7 @@ void DolphinMainWindow::setupDockWidgets() QAction* terminalAction = terminalDock->toggleViewAction(); terminalAction->setShortcut(Qt::Key_F4); terminalAction->setIcon(KIcon("utilities-terminal")); + addActionCloneToCollection(terminalAction, "show_terminal_panel"); addDockWidget(Qt::BottomDockWidgetArea, terminalDock); connect(this, SIGNAL(urlChanged(KUrl)), @@ -1648,6 +1651,7 @@ void DolphinMainWindow::setupDockWidgets() QAction* filterAction = filterDock->toggleViewAction(); filterAction->setShortcut(Qt::Key_F12); filterAction->setIcon(KIcon("view-filter")); + addActionCloneToCollection(filterAction, "show_filter_panel"); addDockWidget(Qt::RightDockWidgetArea, filterDock); connect(this, SIGNAL(urlChanged(KUrl)), filterPanel, SLOT(setUrl(KUrl))); @@ -1678,6 +1682,7 @@ void DolphinMainWindow::setupDockWidgets() QAction* placesAction = placesDock->toggleViewAction(); placesAction->setShortcut(Qt::Key_F9); placesAction->setIcon(KIcon("bookmarks")); + addActionCloneToCollection(placesAction, "show_places_panel"); addDockWidget(Qt::LeftDockWidgetArea, placesDock); connect(placesPanel, SIGNAL(urlChanged(KUrl, Qt::MouseButtons)), @@ -1919,6 +1924,14 @@ QString DolphinMainWindow::squeezedText(const QString& text) const return fm.elidedText(text, Qt::ElideMiddle, fm.maxWidth() * 10); } +void DolphinMainWindow::addActionCloneToCollection(QAction* action, const QString& actionName) +{ + KAction* actionClone = actionCollection()->addAction(actionName); + actionClone->setText(action->text()); + actionClone->setIcon(action->icon()); + connect(actionClone, SIGNAL(triggered()), action, SLOT(trigger())); +} + DolphinMainWindow::UndoUiInterface::UndoUiInterface() : KIO::FileUndoManager::UiInterface() { diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index fdfa93144..9a57b5452 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -503,6 +503,15 @@ private: QString squeezedText(const QString& text) const; + /** + * Adds a clone of the action \a action to the action-collection with + * the name \a actionName, so that the action \a action also can be + * added to the toolbar by the user. This is useful if the creation of + * \a action is e.g. done in Qt and hence cannot be added directly + * to the action-collection. + */ + void addActionCloneToCollection(QAction* action, const QString& actionName); + private: /** * Implements a custom error handling for the undo manager. This