mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
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
This commit is contained in:
parent
6ad83c09bd
commit
5a3a5f5135
3 changed files with 60 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dolphinpart.h"
|
#include "dolphinpart.h"
|
||||||
|
#include <kglobalsettings.h>
|
||||||
#include "dolphinsortfilterproxymodel.h"
|
#include "dolphinsortfilterproxymodel.h"
|
||||||
#include "dolphinview.h"
|
#include "dolphinview.h"
|
||||||
#include "dolphinmodel.h"
|
#include "dolphinmodel.h"
|
||||||
|
@ -136,6 +137,45 @@ void DolphinPart::createActions()
|
||||||
connect(newDirAction, SIGNAL(triggered()), SLOT(slotNewDir()));
|
connect(newDirAction, SIGNAL(triggered()), SLOT(slotNewDir()));
|
||||||
newDirAction->setShortcut(Qt::Key_F10);
|
newDirAction->setShortcut(Qt::Key_F10);
|
||||||
widget()->addAction(newDirAction);
|
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)
|
void DolphinPart::slotSelectionChanged(const KFileItemList& selection)
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <kparts/part.h>
|
#include <kparts/part.h>
|
||||||
#include <kparts/browserextension.h>
|
#include <kparts/browserextension.h>
|
||||||
|
class QActionGroup;
|
||||||
class KAction;
|
class KAction;
|
||||||
class KFileItemList;
|
class KFileItemList;
|
||||||
class KFileItem;
|
class KFileItem;
|
||||||
|
@ -114,10 +115,21 @@ private Q_SLOTS:
|
||||||
*/
|
*/
|
||||||
void slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers);
|
void slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connected to the key shortcut for "new directory" (F10)
|
||||||
|
*/
|
||||||
void slotNewDir();
|
void slotNewDir();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connected to all "Go" menu actions provided by DolphinPart
|
||||||
|
*/
|
||||||
|
void slotGoTriggered(QAction* action);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createActions();
|
void createActions();
|
||||||
|
void createGoAction(const char* name, const char* iconName,
|
||||||
|
const QString& text, const QString& url,
|
||||||
|
QActionGroup* actionGroup);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DolphinView* m_view;
|
DolphinView* m_view;
|
||||||
|
|
|
@ -39,6 +39,14 @@
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<Action name="view_properties" />
|
<Action name="view_properties" />
|
||||||
</Menu>
|
</Menu>
|
||||||
|
<Menu name="go">
|
||||||
|
<Action name="go_applications"/>
|
||||||
|
<Action name="go_network_folders"/>
|
||||||
|
<Action name="go_settings"/>
|
||||||
|
<Action name="go_media"/>
|
||||||
|
<Action name="go_trash"/>
|
||||||
|
<Action name="go_autostart"/>
|
||||||
|
</Menu>
|
||||||
<Menu name="tools">
|
<Menu name="tools">
|
||||||
<Action name="find_file" />
|
<Action name="find_file" />
|
||||||
<Action name="show_filter_bar" />
|
<Action name="show_filter_bar" />
|
||||||
|
|
Loading…
Reference in a new issue