]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Have "Add to Places" in the context menu for the trash too.
authorKevin Ottens <ervin@kde.org>
Tue, 6 Nov 2007 17:09:00 +0000 (17:09 +0000)
committerKevin Ottens <ervin@kde.org>
Tue, 6 Nov 2007 17:09:00 +0000 (17:09 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=733548

src/dolphincontextmenu.cpp

index 388819eecc2cd7ed5391e13c70b44076f23c7beb..1daf9be483fd91aae98eb7704678437c5797dd67 100644 (file)
@@ -106,10 +106,17 @@ void DolphinContextMenu::openTrashContextMenu()
     emptyTrashAction->setEnabled(!trashConfig.group("Status").readEntry("Empty", true));
     popup->addAction(emptyTrashAction);
 
     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);
 
     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,
         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);
         }
         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();
     }
 
     popup->deleteLater();