X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/b5eca6dc2aaa6f90d7dc2fe27ab9ccc45aee77f2..da8dc77c53c5cd604645768a1dacc6497cd58838:/src/dolphincontextmenu.cpp diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index ce315eb57..1daf9be48 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -101,15 +101,22 @@ void DolphinContextMenu::openTrashContextMenu() KMenu* popup = new KMenu(m_mainWindow); - QAction* emptyTrashAction = new QAction(KIcon("emptytrash"), i18nc("@action:inmenu", "Empty Trash"), popup); - KConfig trashConfig("trashrc", KConfig::OnlyLocal); + QAction* emptyTrashAction = new QAction(KIcon("trash-empty"), i18nc("@action:inmenu", "Empty Trash"), popup); + KConfig trashConfig("trashrc", KConfig::SimpleConfig); emptyTrashAction->setEnabled(!trashConfig.group("Status").readEntry("Empty", true)); popup->addAction(emptyTrashAction); + popup->addSeparator(); + + QAction* addToPlacesAction = popup->addAction(KIcon("folder-bookmarks"), + i18nc("@action:inmenu Add current folder to places", "Add to Places")); + popup->addSeparator(); + QAction* propertiesAction = m_mainWindow->actionCollection()->action("properties"); popup->addAction(propertiesAction); - if (popup->exec(QCursor::pos()) == emptyTrashAction) { + QAction *action = popup->exec(QCursor::pos()); + if (action == emptyTrashAction) { const QString text(i18nc("@info", "Do you really want to empty the Trash? All items will get deleted.")); const bool del = KMessageBox::warningContinueCancel(m_mainWindow, text, @@ -120,6 +127,11 @@ void DolphinContextMenu::openTrashContextMenu() if (del) { KonqOperations::emptyTrash(m_mainWindow); } + } else if (action == addToPlacesAction) { + const KUrl& url = m_mainWindow->activeViewContainer()->url(); + if (url.isValid()) { + DolphinSettings::instance().placesModel()->addPlace(i18n("Trash"), url); + } } popup->deleteLater(); @@ -160,7 +172,7 @@ void DolphinContextMenu::openItemContextMenu() // insert 'Bookmark This Folder' entry if exactly one item is selected QAction* addToPlacesAction = 0; if (m_fileInfo.isDir() && (m_selectedUrls.count() == 1)) { - addToPlacesAction = popup->addAction(KIcon("bookmark-folder"), + addToPlacesAction = popup->addAction(KIcon("folder-bookmarks"), i18nc("@action:inmenu Add selected folder to places", "Add to Places")); } @@ -236,7 +248,7 @@ void DolphinContextMenu::openViewportContextMenu() popup->addSeparator(); - QAction* addToPlacesAction = popup->addAction(KIcon("bookmark-folder"), + QAction* addToPlacesAction = popup->addAction(KIcon("folder-bookmarks"), i18nc("@action:inmenu Add current folder to places", "Add to Places")); popup->addSeparator(); @@ -277,8 +289,7 @@ void DolphinContextMenu::insertDefaultItemActions(KMenu* popup) popup->addAction(renameAction); // insert 'Move to Trash' and (optionally) 'Delete' - const KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::NoGlobals); - const KConfigGroup kdeConfig(globalConfig, "KDE"); + KConfigGroup kdeConfig(KGlobal::config(), "KDE"); bool showDeleteCommand = kdeConfig.readEntry("ShowDeleteCommand", false); const KUrl& url = m_mainWindow->activeViewContainer()->url(); if (url.isLocalFile()) {