┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinpart.cpp
diff options
context:
space:
mode:
authorDavid Faure <[email protected]>2007-12-24 11:17:16 +0000
committerDavid Faure <[email protected]>2007-12-24 11:17:16 +0000
commit5a3a5f513515dd2a260fdea3b148e38339c41e57 (patch)
treedc4c2e9907749834463c3ad904ec904c46a2e6b5 /src/dolphinpart.cpp
parent6ad83c09bd68e6651243af35a55609f56d785baa (diff)
Move a bunch of Go menu actions from konqueror to dolphinpart, so that they don't clutter the Go menu when using other parts. As posted on k-c-d.
svn path=/trunk/KDE/kdebase/apps/; revision=752408
Diffstat (limited to 'src/dolphinpart.cpp')
-rw-r--r--src/dolphinpart.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp
index 981bb7028..bd986dcf5 100644
--- a/src/dolphinpart.cpp
+++ b/src/dolphinpart.cpp
@@ -18,6 +18,7 @@
*/
#include "dolphinpart.h"
+#include <kglobalsettings.h>
#include "dolphinsortfilterproxymodel.h"
#include "dolphinview.h"
#include "dolphinmodel.h"
@@ -136,6 +137,45 @@ void DolphinPart::createActions()
connect(newDirAction, SIGNAL(triggered()), SLOT(slotNewDir()));
newDirAction->setShortcut(Qt::Key_F10);
widget()->addAction(newDirAction);
+
+ // Go menu
+
+ QActionGroup* goActionGroup = new QActionGroup(this);
+ connect(goActionGroup, SIGNAL(triggered(QAction*)),
+ this, SLOT(slotGoTriggered(QAction*)));
+
+ createGoAction("go_applications", "start-here",
+ i18nc("@action:inmenu Go", "App&lications"), QString("programs:/"),
+ goActionGroup);
+ createGoAction("go_network_folders", "drive-remote",
+ i18nc("@action:inmenu Go", "&Network Folders"), QString("remote:/"),
+ goActionGroup);
+ createGoAction("go_settings", "preferences-system",
+ i18nc("@action:inmenu Go", "Sett&ings"), QString("settings:/"),
+ goActionGroup);
+ createGoAction("go_trash", "user-trash",
+ i18nc("@action:inmenu Go", "Trash"), QString("trash:/"),
+ goActionGroup);
+ createGoAction("go_autostart", "",
+ i18nc("@action:inmenu Go", "Autostart"), KGlobalSettings::autostartPath(),
+ goActionGroup);
+}
+
+void DolphinPart::createGoAction(const char* name, const char* iconName,
+ const QString& text, const QString& url,
+ QActionGroup* actionGroup)
+{
+ KAction* action = actionCollection()->addAction(name);
+ action->setIcon(KIcon(iconName));
+ action->setText(text);
+ action->setData(url);
+ action->setActionGroup(actionGroup);
+}
+
+void DolphinPart::slotGoTriggered(QAction* action)
+{
+ const QString url = action->data().toString();
+ emit m_extension->openUrlRequest(KUrl(url));
}
void DolphinPart::slotSelectionChanged(const KFileItemList& selection)