]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincontextmenu.cpp
SVN_SILENT made messages (.desktop file) - always resolve ours
[dolphin.git] / src / dolphincontextmenu.cpp
index d4cf196b7cd05e3d7d5a5ff7919d534a6dec14b6..de40d7eaa0356df55495d295774ffc818ea548f5 100644 (file)
@@ -66,14 +66,14 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent,
     m_mainWindow(parent),
     m_fileInfo(fileInfo),
     m_baseUrl(baseUrl),
-    m_baseFileItem(0),
+    m_baseFileItem(nullptr),
     m_selectedItems(),
     m_selectedItemsProperties(nullptr),
     m_context(NoContext),
     m_copyToMenu(parent),
     m_customActions(),
     m_command(None),
-    m_removeAction(0)
+    m_removeAction(nullptr)
 {
     // The context menu either accesses the URLs of the selected items
     // or the items itself. To increase the performance both lists are cached.
@@ -306,9 +306,7 @@ void DolphinContextMenu::openItemContextMenu()
             if (selectedUrl.isValid()) {
                 PlacesItemModel model;
                 const QString text = selectedUrl.fileName();
-                PlacesItem* item = model.createPlacesItem(text, selectedUrl, KIO::iconNameForUrl(selectedUrl));
-                model.appendItemToGroup(item);
-                model.saveBookmarks();
+                model.createPlacesItem(text, selectedUrl, KIO::iconNameForUrl(selectedUrl));
             }
         } else if (activatedAction == openParentAction) {
             m_command = OpenParentFolder;
@@ -337,7 +335,7 @@ void DolphinContextMenu::openViewportContextMenu()
     addAction(m_mainWindow->actionCollection()->action(QStringLiteral("new_tab")));
 
     // Insert 'Add to Places' entry if exactly one item is selected
-    QAction* addToPlacesAction = 0;
+    QAction* addToPlacesAction = nullptr;
     if (!placeExists(m_mainWindow->activeViewContainer()->url())) {
         addToPlacesAction = addAction(QIcon::fromTheme(QStringLiteral("bookmark-new")),
                                              i18nc("@action:inmenu Add current folder to places", "Add to Places"));
@@ -378,9 +376,7 @@ void DolphinContextMenu::openViewportContextMenu()
             } else {
                 icon = KIO::iconNameForUrl(url);
             }
-            PlacesItem* item = model.createPlacesItem(container->placesText(), url, icon);
-            model.appendItemToGroup(item);
-            model.saveBookmarks();
+            model.createPlacesItem(container->placesText(), url, icon);
         }
     }
 }
@@ -408,7 +404,7 @@ void DolphinContextMenu::insertDefaultItemActions(const KFileItemListProperties&
 
         if (showDeleteAction && showMoveToTrashAction) {
             delete m_removeAction;
-            m_removeAction = 0;
+            m_removeAction = nullptr;
             addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::MoveToTrash)));
             addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile)));
         } else if (showDeleteAction && !showMoveToTrashAction) {
@@ -445,7 +441,7 @@ bool DolphinContextMenu::placeExists(const QUrl& url) const
 
 QAction* DolphinContextMenu::createPasteAction()
 {
-    QAction* action = 0;
+    QAction* action = nullptr;
     const bool isDir = !m_fileInfo.isNull() && m_fileInfo.isDir();
     if (isDir && (m_selectedItems.count() == 1)) {
         const QMimeData *mimeData = QApplication::clipboard()->mimeData();