]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincontextmenu.cpp
Fix scrolling during inline renaming causes rename of wrong file
[dolphin.git] / src / dolphincontextmenu.cpp
index b4d249d761420d468248f6f9ec0b16d5bf13c8ff..d4cf196b7cd05e3d7d5a5ff7919d534a6dec14b6 100644 (file)
@@ -68,7 +68,7 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent,
     m_baseUrl(baseUrl),
     m_baseFileItem(0),
     m_selectedItems(),
-    m_selectedItemsProperties(0),
+    m_selectedItemsProperties(nullptr),
     m_context(NoContext),
     m_copyToMenu(parent),
     m_customActions(),
@@ -84,7 +84,7 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent,
 DolphinContextMenu::~DolphinContextMenu()
 {
     delete m_selectedItemsProperties;
-    m_selectedItemsProperties = 0;
+    m_selectedItemsProperties = nullptr;
 }
 
 void DolphinContextMenu::setCustomActions(const QList<QAction*>& actions)
@@ -195,10 +195,10 @@ void DolphinContextMenu::openItemContextMenu()
 {
     Q_ASSERT(!m_fileInfo.isNull());
 
-    QAction* openParentAction = 0;
-    QAction* openParentInNewWindowAction = 0;
-    QAction* openParentInNewTabAction = 0;
-    QAction* addToPlacesAction = 0;
+    QAction* openParentAction = nullptr;
+    QAction* openParentInNewWindowAction = nullptr;
+    QAction* openParentInNewTabAction = nullptr;
+    QAction* addToPlacesAction = nullptr;
     const KFileItemListProperties& selectedItemsProps = selectedItemsProperties();
 
     if (m_selectedItems.count() == 1) {
@@ -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();
         }