]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincontextmenu.cpp
Remove not necessary check pointer
[dolphin.git] / src / dolphincontextmenu.cpp
index 7ee9562ae4f82e38f6ed8a15c0bf8c80f561c98c..881ef34b410d8befa000e7e4f5f163d242f50467 100644 (file)
@@ -124,7 +124,7 @@ DolphinContextMenu::Command DolphinContextMenu::open()
 void DolphinContextMenu::keyPressEvent(QKeyEvent *ev)
 {
     if (m_removeAction && ev->key() == Qt::Key_Shift) {
-        m_removeAction->update();
+        m_removeAction->update(DolphinRemoveAction::ShiftState::Pressed);
     }
     QMenu::keyPressEvent(ev);
 }
@@ -132,7 +132,7 @@ void DolphinContextMenu::keyPressEvent(QKeyEvent *ev)
 void DolphinContextMenu::keyReleaseEvent(QKeyEvent *ev)
 {
     if (m_removeAction && ev->key() == Qt::Key_Shift) {
-        m_removeAction->update();
+        m_removeAction->update(DolphinRemoveAction::ShiftState::Released);
     }
     QMenu::keyReleaseEvent(ev);
 }
@@ -369,11 +369,16 @@ void DolphinContextMenu::openViewportContextMenu()
     QAction* action = exec(m_pos);
     if (addToPlacesAction && (action == addToPlacesAction)) {
         const DolphinViewContainer* container =  m_mainWindow->activeViewContainer();
-        if (container->url().isValid()) {
+        const QUrl url = container->url();
+        if (url.isValid()) {
             PlacesItemModel model;
-            PlacesItem* item = model.createPlacesItem(container->placesText(),
-                                                      container->url(),
-                                                      KIO::iconNameForUrl(container->url()));
+            QString icon;
+            if (container->isSearchModeEnabled()) {
+                icon = QStringLiteral("folder-saved-search-symbolic");
+            } else {
+                icon = KIO::iconNameForUrl(url);
+            }
+            PlacesItem* item = model.createPlacesItem(container->placesText(), url, icon);
             model.appendItemToGroup(item);
             model.saveBookmarks();
         }
@@ -392,8 +397,7 @@ void DolphinContextMenu::insertDefaultItemActions(const KFileItemListProperties&
     addSeparator();
 
     // Insert 'Rename'
-    QAction* renameAction = collection->action(QStringLiteral("rename"));
-    addAction(renameAction);
+    addAction(collection->action(KStandardAction::name(KStandardAction::RenameFile)));
 
     // Insert 'Move to Trash' and/or 'Delete'
     if (properties.supportsDeleting()) {