]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Merge remote-tracking branch 'origin/master' into frameworks
authorFrank Reininghaus <frank78ac@googlemail.com>
Thu, 12 Jun 2014 06:51:50 +0000 (08:51 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Thu, 12 Jun 2014 06:51:50 +0000 (08:51 +0200)
Conflicts:
dolphin/src/dolphincontextmenu.cpp
dolphin/src/panels/folders/treeviewcontextmenu.cpp

1  2 
src/dolphincontextmenu.cpp
src/kitemviews/private/kfileitemclipboard.cpp
src/panels/folders/treeviewcontextmenu.cpp

index 51351f0413e581e9c515f66504fa7eaf47e7399b,e692c8fa9a0cd8c9ef3f53cc5c6ff71d04043a9c..952ffcc99097f89a632bfc760ce43c1411451f01
@@@ -39,7 -39,6 +39,7 @@@
  #include <KMenuBar>
  #include <KMessageBox>
  #include <KMimeTypeTrader>
 +#include <KMimeType>
  #include <KNewFileMenu>
  #include <konqmimedata.h>
  #include <konq_operations.h>
@@@ -144,7 -143,7 +144,7 @@@ void DolphinContextMenu::openTrashConte
  {
      Q_ASSERT(m_context & TrashContext);
  
 -    QAction* emptyTrashAction = new QAction(KIcon("trash-empty"), i18nc("@action:inmenu", "Empty Trash"), this);
 +    QAction* emptyTrashAction = new QAction(QIcon::fromTheme("trash-empty"), i18nc("@action:inmenu", "Empty Trash"), this);
      KConfig trashConfig("trashrc", KConfig::SimpleConfig);
      emptyTrashAction->setEnabled(!trashConfig.group("Status").readEntry("Empty", true));
      addAction(emptyTrashAction);
@@@ -203,12 -202,12 +203,12 @@@ void DolphinContextMenu::openItemContex
              newFileMenu->checkUpToDate();
              newFileMenu->setPopupFiles(m_fileInfo.url());
              newFileMenu->setEnabled(selectedItemsProps.supportsWriting());
 -            connect(newFileMenu, SIGNAL(fileCreated(KUrl)), newFileMenu, SLOT(deleteLater()));
 -            connect(newFileMenu, SIGNAL(directoryCreated(KUrl)), newFileMenu, SLOT(deleteLater()));
 +            connect(newFileMenu, &DolphinNewFileMenu::fileCreated, newFileMenu, &DolphinNewFileMenu::deleteLater);
 +            connect(newFileMenu, &DolphinNewFileMenu::directoryCreated, newFileMenu, &DolphinNewFileMenu::deleteLater);
  
 -            KMenu* menu = newFileMenu->menu();
 +            QMenu* menu = newFileMenu->menu();
              menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
 -            menu->setIcon(KIcon("document-new"));
 +            menu->setIcon(QIcon::fromTheme("document-new"));
              addMenu(menu);
              addSeparator();
  
  
              // insert 'Add to Places' entry
              if (!placeExists(m_fileInfo.url())) {
 -                addToPlacesAction = addAction(KIcon("bookmark-new"),
 +                addToPlacesAction = addAction(QIcon::fromTheme("bookmark-new"),
                                                         i18nc("@action:inmenu Add selected folder to places",
                                                               "Add to Places"));
              }
  
              addSeparator();
          } else if (m_baseUrl.protocol().contains("search")) {
 -            openParentInNewWindowAction = new QAction(KIcon("window-new"),
 +            openParentInNewWindowAction = new QAction(QIcon::fromTheme("window-new"),
                                                      i18nc("@action:inmenu",
                                                            "Open Path in New Window"),
                                                      this);
              addAction(openParentInNewWindowAction);
  
 -            openParentInNewTabAction = new QAction(KIcon("tab-new"),
 +            openParentInNewTabAction = new QAction(QIcon::fromTheme("tab-new"),
                                                     i18nc("@action:inmenu",
                                                           "Open Path in New Tab"),
                                                     this);
@@@ -322,7 -321,7 +322,7 @@@ void DolphinContextMenu::openViewportCo
      // Insert 'Add to Places' entry if exactly one item is selected
      QAction* addToPlacesAction = 0;
      if (!placeExists(m_mainWindow->activeViewContainer()->url())) {
 -        addToPlacesAction = addAction(KIcon("bookmark-new"),
 +        addToPlacesAction = addAction(QIcon::fromTheme("bookmark-new"),
                                               i18nc("@action:inmenu Add current folder to places", "Add to Places"));
      }
  
@@@ -430,11 -429,10 +430,10 @@@ QAction* DolphinContextMenu::createPast
      QAction* action = 0;
      const bool isDir = !m_fileInfo.isNull() && m_fileInfo.isDir();
      if (isDir && (m_selectedItems.count() == 1)) {
 -        action = new QAction(KIcon("edit-paste"), i18nc("@action:inmenu", "Paste Into Folder"), this);
+         const QPair<bool, QString> pasteInfo = KonqOperations::pasteInfo(m_fileInfo.url());
-         const QMimeData* mimeData = QApplication::clipboard()->mimeData();
-         const KUrl::List pasteData = KUrl::List::fromMimeData(mimeData);
-         action->setEnabled(!pasteData.isEmpty() && selectedItemsProperties().supportsWriting());
 +        action = new QAction(QIcon::fromTheme("edit-paste"), i18nc("@action:inmenu", "Paste Into Folder"), this);
 -        connect(action, SIGNAL(triggered()), m_mainWindow, SLOT(pasteIntoFolder()));
+         action->setEnabled(pasteInfo.first);
 +        connect(action, &QAction::triggered, m_mainWindow, &DolphinMainWindow::pasteIntoFolder);
      } else {
          action = m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::Paste));
      }
@@@ -491,7 -489,7 +490,7 @@@ void DolphinContextMenu::addFileItemPlu
      const KConfig config("kservicemenurc", KConfig::NoGlobals);
      const KConfigGroup showGroup = config.group("Show");
  
 -    foreach (const KSharedPtr<KService>& service, pluginServices) {
 +    foreach (const KService::Ptr& service, pluginServices) {
          if (!showGroup.readEntry(service->desktopEntryName(), true)) {
              // The plugin has been disabled
              continue;
index ebf50e215491a7859811dee7d3cbb04cdcd8990f,0dcc81f4fb2746d7c6c354c120859192759b7aea..69df5dee7ece9504109094807ad5cd759bbd8164
@@@ -55,6 -55,14 +55,14 @@@ KFileItemClipboard::~KFileItemClipboard
  void KFileItemClipboard::updateCutItems()
  {
      const QMimeData* mimeData = QApplication::clipboard()->mimeData();
+     // mimeData can be 0 according to https://bugs.kde.org/show_bug.cgi?id=335053
+     if (!mimeData) {
+         m_cutItems.clear();
+         emit cutItemsChanged();
+         return;
+     }
      const QByteArray data = mimeData->data("application/x-kde-cutselection");
      const bool isCutSelection = (!data.isEmpty() && data.at(0) == QLatin1Char('1'));
      if (isCutSelection) {
@@@ -71,8 -79,8 +79,8 @@@ KFileItemClipboard::KFileItemClipboard(
  {
      updateCutItems();
  
 -    connect(QApplication::clipboard(), SIGNAL(dataChanged()),
 -            this, SLOT(updateCutItems()));
 +    connect(QApplication::clipboard(), &QClipboard::dataChanged,
 +            this, &KFileItemClipboard::updateCutItems);
  }
  
  #include "kfileitemclipboard.moc"
index 2e59ae833ad53a2b3053cf3822ed849185802cf6,83ffa87a7173fc3dfef12821ed5ebd0c53704d4c..3f69ac22a3bd415880b9b0f04f6c5076703d83cb
@@@ -24,9 -24,6 +24,9 @@@
  #include <KIconLoader>
  #include <KIO/DeleteJob>
  #include <KMenu>
 +#include <KIcon>
 +#include <KSharedConfig>
 +#include <KConfigGroup>
  #include <konqmimedata.h>
  #include <KFileItemListProperties>
  #include <konq_operations.h>
@@@ -37,7 -34,6 +37,7 @@@
  
  #include <QApplication>
  #include <QClipboard>
 +#include <QMimeData>
  
  TreeViewContextMenu::TreeViewContextMenu(FoldersPanel* parent,
                                           const KFileItem& fileInfo) :
@@@ -61,16 -57,15 +61,15 @@@ void TreeViewContextMenu::open(
          // insert 'Cut', 'Copy' and 'Paste'
          QAction* cutAction = new QAction(KIcon("edit-cut"), i18nc("@action:inmenu", "Cut"), this);
          cutAction->setEnabled(capabilities.supportsMoving());
 -        connect(cutAction, SIGNAL(triggered()), this, SLOT(cut()));
 +        connect(cutAction, &QAction::triggered, this, &TreeViewContextMenu::cut);
  
          QAction* copyAction = new QAction(KIcon("edit-copy"), i18nc("@action:inmenu", "Copy"), this);
 -        connect(copyAction, SIGNAL(triggered()), this, SLOT(copy()));
 +        connect(copyAction, &QAction::triggered, this, &TreeViewContextMenu::copy);
  
-         QAction* pasteAction = new QAction(KIcon("edit-paste"), i18nc("@action:inmenu", "Paste"), this);
-         const QMimeData* mimeData = QApplication::clipboard()->mimeData();
-         const KUrl::List pasteData = KUrl::List::fromMimeData(mimeData);
+         const QPair<bool, QString> pasteInfo = KonqOperations::pasteInfo(m_fileItem.url());
+         QAction* pasteAction = new QAction(KIcon("edit-paste"), pasteInfo.second, this);
 -        connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste()));
 +        connect(pasteAction, &QAction::triggered, this, &TreeViewContextMenu::paste);
-         pasteAction->setEnabled(!pasteData.isEmpty() && capabilities.supportsWriting());
+         pasteAction->setEnabled(pasteInfo.first);
  
          popup->addAction(cutAction);
          popup->addAction(copyAction);
@@@ -81,7 -76,7 +80,7 @@@
          QAction* renameAction = new QAction(i18nc("@action:inmenu", "Rename..."), this);
          renameAction->setEnabled(capabilities.supportsMoving());
          renameAction->setIcon(KIcon("edit-rename"));
 -        connect(renameAction, SIGNAL(triggered()), this, SLOT(rename()));
 +        connect(renameAction, &QAction::triggered, this, &TreeViewContextMenu::rename);
          popup->addAction(renameAction);
  
          // insert 'Move to Trash' and (optionally) 'Delete'
@@@ -95,7 -90,7 +94,7 @@@
                                                      i18nc("@action:inmenu", "Move to Trash"), this);
              const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving();
              moveToTrashAction->setEnabled(enableMoveToTrash);
 -            connect(moveToTrashAction, SIGNAL(triggered()), this, SLOT(moveToTrash()));
 +            connect(moveToTrashAction, &QAction::triggered, this, &TreeViewContextMenu::moveToTrash);
              popup->addAction(moveToTrashAction);
          } else {
              showDeleteCommand = true;
          if (showDeleteCommand) {
              QAction* deleteAction = new QAction(KIcon("edit-delete"), i18nc("@action:inmenu", "Delete"), this);
              deleteAction->setEnabled(capabilities.supportsDeleting());
 -            connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteItem()));
 +            connect(deleteAction, &QAction::triggered, this, &TreeViewContextMenu::deleteItem);
              popup->addAction(deleteAction);
          }
  
      showHiddenFilesAction->setCheckable(true);
      showHiddenFilesAction->setChecked(m_parent->showHiddenFiles());
      popup->addAction(showHiddenFilesAction);
 -    connect(showHiddenFilesAction, SIGNAL(toggled(bool)), this, SLOT(setShowHiddenFiles(bool)));
 +    connect(showHiddenFilesAction, &QAction::toggled, this, &TreeViewContextMenu::setShowHiddenFiles);
  
      // insert 'Automatic Scrolling'
      QAction* autoScrollingAction = new QAction(i18nc("@action:inmenu", "Automatic Scrolling"), this);
      // TODO: Temporary disabled. Horizontal autoscrolling will be implemented later either
      // in KItemViews or manually as part of the FoldersPanel
      //popup->addAction(autoScrollingAction);
 -    connect(autoScrollingAction, SIGNAL(toggled(bool)), this, SLOT(setAutoScrolling(bool)));
 +    connect(autoScrollingAction, &QAction::toggled, this, &TreeViewContextMenu::setAutoScrolling);
  
      if (!m_fileItem.isNull()) {
          // insert 'Properties' entry
          QAction* propertiesAction = new QAction(i18nc("@action:inmenu", "Properties"), this);
          propertiesAction->setIcon(KIcon("document-properties"));
 -        connect(propertiesAction, SIGNAL(triggered()), this, SLOT(showProperties()));
 +        connect(propertiesAction, &QAction::triggered, this, &TreeViewContextMenu::showProperties);
          popup->addAction(propertiesAction);
      }
  
@@@ -176,17 -171,7 +175,7 @@@ void TreeViewContextMenu::copy(
  
  void TreeViewContextMenu::paste()
  {
-     QClipboard* clipboard = QApplication::clipboard();
-     const QMimeData* mimeData = clipboard->mimeData();
-     const KUrl::List source = KUrl::List::fromMimeData(mimeData);
-     const KUrl& dest = m_fileItem.url();
-     if (KonqMimeData::decodeIsCutSelection(mimeData)) {
-         KonqOperations::copy(m_parent, KonqOperations::MOVE, source, dest);
-         clipboard->clear();
-     } else {
-         KonqOperations::copy(m_parent, KonqOperations::COPY, source, dest);
-     }
+     KonqOperations::doPaste(m_parent, m_fileItem.url());
  }
  
  void TreeViewContextMenu::rename()
  
  void TreeViewContextMenu::moveToTrash()
  {
 -    KonqOperations::del(m_parent, KonqOperations::TRASH, m_fileItem.url());
 +    KonqOperations::del(m_parent, KonqOperations::TRASH, KUrl::List() << m_fileItem.url());
  }
  
  void TreeViewContextMenu::deleteItem()
  {
 -    KonqOperations::del(m_parent, KonqOperations::DEL, m_fileItem.url());
 +    KonqOperations::del(m_parent, KonqOperations::DEL, KUrl::List() << m_fileItem.url());
  }
  
  void TreeViewContextMenu::showProperties()