]> cloud.milkyroute.net Git - dolphin.git/commitdiff
dolphin: convert views/ to qt5 signal/slot syntax
authorAlex Richardson <arichardson.kde@gmail.com>
Thu, 10 Apr 2014 00:59:39 +0000 (02:59 +0200)
committerAlex Richardson <arichardson.kde@gmail.com>
Mon, 5 May 2014 21:05:34 +0000 (23:05 +0200)
Removed arguments from DolphinViewActionHandler::slotTrashActivated since
they were unused and made the connection fail.

Also fixed a bad connection in dolphinview.cpp, there is no signal
KFileItemModel::loadingCompleted

src/views/dolphinnewfilemenuobserver.cpp
src/views/dolphinnewfilemenuobserver.h
src/views/dolphinremoteencoding.cpp
src/views/dolphinview.cpp
src/views/dolphinviewactionhandler.cpp
src/views/dolphinviewactionhandler.h
src/views/renamedialog.cpp
src/views/tooltips/filemetadatatooltip.cpp
src/views/tooltips/tooltipmanager.cpp
src/views/versioncontrol/versioncontrolobserver.cpp

index 7669f15616d0615fa4f7fae58fb9c336a3340cab..353f1f33ce59cb7bf6075952db48bec3637ee09f 100644 (file)
@@ -36,22 +36,22 @@ DolphinNewFileMenuObserver& DolphinNewFileMenuObserver::instance()
 
 void DolphinNewFileMenuObserver::attach(const DolphinNewFileMenu* menu)
 {
-    connect(menu, SIGNAL(fileCreated(KUrl)),
-            this, SIGNAL(itemCreated(KUrl)));
-    connect(menu, SIGNAL(directoryCreated(KUrl)),
-            this, SIGNAL(itemCreated(KUrl)));
-    connect(menu, SIGNAL(errorMessage(QString)),
-            this, SIGNAL(errorMessage(QString)));
+    connect(menu, &DolphinNewFileMenu::fileCreated,
+            this, &DolphinNewFileMenuObserver::itemCreated);
+    connect(menu, &DolphinNewFileMenu::directoryCreated,
+            this, &DolphinNewFileMenuObserver::itemCreated);
+    connect(menu, &DolphinNewFileMenu::errorMessage,
+            this, &DolphinNewFileMenuObserver::errorMessage);
 }
 
 void DolphinNewFileMenuObserver::detach(const DolphinNewFileMenu* menu)
 {
-    disconnect(menu, SIGNAL(fileCreated(KUrl)),
-               this, SIGNAL(itemCreated(KUrl)));
-    disconnect(menu, SIGNAL(directoryCreated(KUrl)),
-               this, SIGNAL(itemCreated(KUrl)));
-    disconnect(menu, SIGNAL(errorMessage(QString)),
-               this, SIGNAL(errorMessage(QString)));
+    disconnect(menu, &DolphinNewFileMenu::fileCreated,
+               this, &DolphinNewFileMenuObserver::itemCreated);
+    disconnect(menu, &DolphinNewFileMenu::directoryCreated,
+               this, &DolphinNewFileMenuObserver::itemCreated);
+    disconnect(menu, &DolphinNewFileMenu::errorMessage,
+               this, &DolphinNewFileMenuObserver::errorMessage);
 }
 
 DolphinNewFileMenuObserver::DolphinNewFileMenuObserver() :
index 239476eb9d2193d6f058fdc8be77011b6e88e096..3b5014ae9fbfcabf7b102abafe779404c296d862 100644 (file)
@@ -44,7 +44,7 @@ public:
     void detach(const DolphinNewFileMenu* menu);
 
 signals:
-    void itemCreated(const KUrl& url);
+    void itemCreated(const QUrl& url);
     void errorMessage(const QString& error);
 
 private:
index 6de5e3e93e69125a19630b222494acf91684a02a..bf00e33fe540d1755bf6255a0d745fc95c5112e2 100644 (file)
@@ -51,8 +51,8 @@ DolphinRemoteEncoding::DolphinRemoteEncoding(QObject* parent, DolphinViewActionH
 {
     m_menu = new KActionMenu(KIcon("character-set"), i18n("Select Remote Charset"), this);
     m_actionHandler->actionCollection()->addAction("change_remote_encoding", m_menu);
-    connect(m_menu->menu(), SIGNAL(aboutToShow()),
-          this, SLOT(slotAboutToShow()));
+    connect(m_menu->menu(), &QMenu::aboutToShow,
+          this, &DolphinRemoteEncoding::slotAboutToShow);
 
     m_menu->setEnabled(false);
     m_menu->setDelayed(false);
@@ -117,7 +117,7 @@ void DolphinRemoteEncoding::fillMenu()
     menu->addAction(i18n("Default"), this, SLOT(slotDefault()), 0)->setCheckable(true);
     m_idDefault = m_encodingDescriptions.size() + 2;
 
-    connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(slotItemSelected(QAction*)));
+    connect(menu, &QMenu::triggered, this, &DolphinRemoteEncoding::slotItemSelected);
 }
 
 void DolphinRemoteEncoding::updateMenu()
index 02a844c2bb8e23c7baabe39bf546a1ae61308a0f..247b10bc83e631e1327042fa8596cc2e46aa95b0 100644 (file)
@@ -118,14 +118,14 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
     // When a new item has been created by the "Create New..." menu, the item should
     // get selected and it must be assured that the item will get visible. As the
     // creation is done asynchronously, several signals must be checked:
-    connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(itemCreated(KUrl)),
-            this, SLOT(observeCreatedItem(KUrl)));
+    connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::itemCreated,
+            this, &DolphinView::observeCreatedItem);
 
     m_selectionChangedTimer = new QTimer(this);
     m_selectionChangedTimer->setSingleShot(true);
     m_selectionChangedTimer->setInterval(300);
-    connect(m_selectionChangedTimer, SIGNAL(timeout()),
-            this, SLOT(emitSelectionChangedSignal()));
+    connect(m_selectionChangedTimer, &QTimer::timeout,
+            this, &DolphinView::emitSelectionChangedSignal);
 
     m_model = new KFileItemModel(this);
     m_view = new DolphinItemListView();
@@ -144,60 +144,60 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
     m_container = new KItemListContainer(controller, this);
     m_container->installEventFilter(this);
     setFocusProxy(m_container);
-    connect(m_container->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(hideToolTip()));
-    connect(m_container->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(hideToolTip()));
+    connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip);
+    connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip);
 
     controller->setSelectionBehavior(KItemListController::MultiSelection);
-    connect(controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int)));
-    connect(controller, SIGNAL(itemsActivated(KItemSet)), this, SLOT(slotItemsActivated(KItemSet)));
-    connect(controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int)));
-    connect(controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF)));
-    connect(controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF)));
-    connect(controller, SIGNAL(headerContextMenuRequested(QPointF)), this, SLOT(slotHeaderContextMenuRequested(QPointF)));
-    connect(controller, SIGNAL(mouseButtonPressed(int,Qt::MouseButtons)), this, SLOT(slotMouseButtonPressed(int,Qt::MouseButtons)));
-    connect(controller, SIGNAL(itemHovered(int)), this, SLOT(slotItemHovered(int)));
-    connect(controller, SIGNAL(itemUnhovered(int)), this, SLOT(slotItemUnhovered(int)));
-    connect(controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*)));
-    connect(controller, SIGNAL(escapePressed()), this, SLOT(stopLoading()));
-    connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*)));
-
-    connect(m_model, SIGNAL(directoryLoadingStarted()),       this, SLOT(slotDirectoryLoadingStarted()));
-    connect(m_model, SIGNAL(directoryLoadingCompleted()),     this, SLOT(slotDirectoryLoadingCompleted()));
-    connect(m_model, SIGNAL(directoryLoadingCanceled()),      this, SIGNAL(directoryLoadingCanceled()));
-    connect(m_model, SIGNAL(directoryLoadingProgress(int)),   this, SIGNAL(directoryLoadingProgress(int)));
-    connect(m_model, SIGNAL(directorySortingProgress(int)),   this, SIGNAL(directorySortingProgress(int)));
-    connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
-            this, SLOT(slotItemsChanged()));
-    connect(m_model, SIGNAL(itemsRemoved(KItemRangeList)),    this, SIGNAL(itemCountChanged()));
-    connect(m_model, SIGNAL(itemsInserted(KItemRangeList)),   this, SIGNAL(itemCountChanged()));
-    connect(m_model, SIGNAL(infoMessage(QString)),            this, SIGNAL(infoMessage(QString)));
-    connect(m_model, SIGNAL(errorMessage(QString)),           this, SIGNAL(errorMessage(QString)));
-    connect(m_model, SIGNAL(directoryRedirection(KUrl,KUrl)), this, SLOT(slotDirectoryRedirection(KUrl,KUrl)));
-    connect(m_model, SIGNAL(urlIsFileError(KUrl)),            this, SIGNAL(urlIsFileError(KUrl)));
+    connect(controller, &KItemListController::itemActivated, this, &DolphinView::slotItemActivated);
+    connect(controller, &KItemListController::itemsActivated, this, &DolphinView::slotItemsActivated);
+    connect(controller, &KItemListController::itemMiddleClicked, this, &DolphinView::slotItemMiddleClicked);
+    connect(controller, &KItemListController::itemContextMenuRequested, this, &DolphinView::slotItemContextMenuRequested);
+    connect(controller, &KItemListController::viewContextMenuRequested, this, &DolphinView::slotViewContextMenuRequested);
+    connect(controller, &KItemListController::headerContextMenuRequested, this, &DolphinView::slotHeaderContextMenuRequested);
+    connect(controller, &KItemListController::mouseButtonPressed, this, &DolphinView::slotMouseButtonPressed);
+    connect(controller, &KItemListController::itemHovered, this, &DolphinView::slotItemHovered);
+    connect(controller, &KItemListController::itemUnhovered, this, &DolphinView::slotItemUnhovered);
+    connect(controller, &KItemListController::itemDropEvent, this, &DolphinView::slotItemDropEvent);
+    connect(controller, &KItemListController::escapePressed, this, &DolphinView::stopLoading);
+    connect(controller, &KItemListController::modelChanged, this, &DolphinView::slotModelChanged);
+
+    connect(m_model, &KFileItemModel::directoryLoadingStarted,       this, &DolphinView::slotDirectoryLoadingStarted);
+    connect(m_model, &KFileItemModel::directoryLoadingCompleted,     this, &DolphinView::slotDirectoryLoadingCompleted);
+    connect(m_model, &KFileItemModel::directoryLoadingCanceled,      this, &DolphinView::directoryLoadingCanceled);
+    connect(m_model, &KFileItemModel::directoryLoadingProgress,   this, &DolphinView::directoryLoadingProgress);
+    connect(m_model, &KFileItemModel::directorySortingProgress,   this, &DolphinView::directorySortingProgress);
+    connect(m_model, &KFileItemModel::itemsChanged,
+            this, &DolphinView::slotItemsChanged);
+    connect(m_model, &KFileItemModel::itemsRemoved,    this, &DolphinView::itemCountChanged);
+    connect(m_model, &KFileItemModel::itemsInserted,   this, &DolphinView::itemCountChanged);
+    connect(m_model, &KFileItemModel::infoMessage,            this, &DolphinView::infoMessage);
+    connect(m_model, &KFileItemModel::errorMessage,           this, &DolphinView::errorMessage);
+    connect(m_model, &KFileItemModel::directoryRedirection, this, &DolphinView::slotDirectoryRedirection);
+    connect(m_model, &KFileItemModel::urlIsFileError,            this, &DolphinView::urlIsFileError);
 
     m_view->installEventFilter(this);
-    connect(m_view, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
-            this, SLOT(slotSortOrderChangedByHeader(Qt::SortOrder,Qt::SortOrder)));
-    connect(m_view, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
-            this, SLOT(slotSortRoleChangedByHeader(QByteArray,QByteArray)));
-    connect(m_view, SIGNAL(visibleRolesChanged(QList<QByteArray>,QList<QByteArray>)),
-            this, SLOT(slotVisibleRolesChangedByHeader(QList<QByteArray>,QList<QByteArray>)));
-    connect(m_view, SIGNAL(roleEditingCanceled(int,QByteArray,QVariant)),
-            this, SLOT(slotRoleEditingCanceled()));
-    connect(m_view->header(), SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)),
-            this, SLOT(slotHeaderColumnWidthChanged(QByteArray,qreal,qreal)));
+    connect(m_view, &DolphinItemListView::sortOrderChanged,
+            this, &DolphinView::slotSortOrderChangedByHeader);
+    connect(m_view, &DolphinItemListView::sortRoleChanged,
+            this, &DolphinView::slotSortRoleChangedByHeader);
+    connect(m_view, &DolphinItemListView::visibleRolesChanged,
+            this, &DolphinView::slotVisibleRolesChangedByHeader);
+    connect(m_view, &DolphinItemListView::roleEditingCanceled,
+            this, &DolphinView::slotRoleEditingCanceled);
+    connect(m_view->header(), &KItemListHeader::columnWidthChanged,
+            this, &DolphinView::slotHeaderColumnWidthChanged);
 
     KItemListSelectionManager* selectionManager = controller->selectionManager();
-    connect(selectionManager, SIGNAL(selectionChanged(KItemSet,KItemSet)),
-            this, SLOT(slotSelectionChanged(KItemSet,KItemSet)));
+    connect(selectionManager, &KItemListSelectionManager::selectionChanged,
+            this, &DolphinView::slotSelectionChanged);
 
     m_toolTipManager = new ToolTipManager(this);
 
     m_versionControlObserver = new VersionControlObserver(this);
     m_versionControlObserver->setModel(m_model);
-    connect(m_versionControlObserver, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
-    connect(m_versionControlObserver, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
-    connect(m_versionControlObserver, SIGNAL(operationCompletedMessage(QString)), this, SIGNAL(operationCompletedMessage(QString)));
+    connect(m_versionControlObserver, &VersionControlObserver::infoMessage, this, &DolphinView::infoMessage);
+    connect(m_versionControlObserver, &VersionControlObserver::errorMessage, this, &DolphinView::errorMessage);
+    connect(m_versionControlObserver, &VersionControlObserver::operationCompletedMessage, this, &DolphinView::operationCompletedMessage);
 
     applyViewProperties();
     m_topLayout->addWidget(m_container);
@@ -610,8 +610,8 @@ void DolphinView::setUrl(const KUrl& url)
 
     hideToolTip();
 
-    disconnect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)),
-               this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant)));
+    disconnect(m_view, &DolphinItemListView::roleEditingFinished,
+               this, &DolphinView::slotRoleEditingFinished);
 
     // It is important to clear the items from the model before
     // applying the view properties, otherwise expensive operations
@@ -655,8 +655,8 @@ void DolphinView::renameSelectedItems()
 
         hideToolTip();
 
-        connect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)),
-                this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant)));
+        connect(m_view, &DolphinItemListView::roleEditingFinished,
+                this, &DolphinView::slotRoleEditingFinished);
     } else {
         RenameDialog* dialog = new RenameDialog(this, items);
         dialog->setAttribute(Qt::WA_DeleteOnClose);
@@ -690,8 +690,8 @@ void DolphinView::deleteSelectedItems()
         if (job->ui()) {
             KJobWidgets::setWindow(job, this);
         }
-        connect(job, SIGNAL(result(KJob*)),
-                this, SLOT(slotDeleteFileFinished(KJob*)));
+        connect(job, &KIO::Job::result,
+                this, &DolphinView::slotDeleteFileFinished);
     }
 }
 
@@ -1050,7 +1050,7 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
     if (op && destUrl == url()) {
         // Mark the dropped urls as selected.
         m_clearSelectionBeforeSelectingNewItems = true;
-        connect(op, SIGNAL(aboutToCreate(KUrl::List)), this, SLOT(slotAboutToCreate(KUrl::List)));
+        connect(op, static_cast<void(KonqOperations::*)(const KUrl::List&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
     }
 
     setActive(true);
@@ -1059,15 +1059,16 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
 void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous)
 {
     if (previous != 0) {
-        disconnect(previous, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
+        Q_ASSERT(qobject_cast<KFileItemModel*>(previous));
+        KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(previous);
+        disconnect(fileItemModel, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted);
         m_versionControlObserver->setModel(0);
     }
 
     if (current) {
         Q_ASSERT(qobject_cast<KFileItemModel*>(current));
-        connect(current, SIGNAL(loadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
-
         KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(current);
+        connect(fileItemModel, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted);
         m_versionControlObserver->setModel(fileItemModel);
     }
 }
@@ -1455,14 +1456,14 @@ void DolphinView::slotVisibleRolesChangedByHeader(const QList<QByteArray>& curre
 
 void DolphinView::slotRoleEditingCanceled()
 {
-    disconnect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)),
-               this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant)));
+    disconnect(m_view, &DolphinItemListView::roleEditingFinished,
+               this, &DolphinView::slotRoleEditingFinished);
 }
 
 void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value)
 {
-    disconnect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)),
-               this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant)));
+    disconnect(m_view, &DolphinItemListView::roleEditingFinished,
+               this, &DolphinView::slotRoleEditingFinished);
 
     if (index < 0 || index >= m_model->count()) {
         return;
@@ -1491,7 +1492,7 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
             if (op && !newNameExistsAlready) {
                 // Only connect the renamingFailed signal if there is no item with the new name
                 // in the model yet, see bug 328262.
-                connect(op, SIGNAL(renamingFailed(KUrl,KUrl)), SLOT(slotRenamingFailed(KUrl,KUrl)));
+                connect(op, &KonqOperations::renamingFailed, this, &DolphinView::slotRenamingFailed);
             }
         }
     }
@@ -1632,7 +1633,7 @@ void DolphinView::pasteToUrl(const KUrl& url)
     if (op) {
         m_clearSelectionBeforeSelectingNewItems = true;
         m_markFirstNewlySelectedItemAsCurrent = true;
-        connect(op, SIGNAL(aboutToCreate(KUrl::List)), this, SLOT(slotAboutToCreate(KUrl::List)));
+        connect(op, static_cast<void(KonqOperations::*)(const KUrl::List&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
     }
 }
 
index aebb215e5ba748693221eac988d5182c83103e43..3955f250d09df36a3541ddc5c167b8b84ad2764a 100644 (file)
@@ -68,26 +68,26 @@ void DolphinViewActionHandler::setCurrentView(DolphinView* view)
 
     m_currentView = view;
 
-    connect(view, SIGNAL(modeChanged(DolphinView::Mode,DolphinView::Mode)),
-            this, SLOT(updateViewActions()));
-    connect(view, SIGNAL(previewsShownChanged(bool)),
-            this, SLOT(slotPreviewsShownChanged(bool)));
-    connect(view, SIGNAL(sortOrderChanged(Qt::SortOrder)),
-            this, SLOT(slotSortOrderChanged(Qt::SortOrder)));
-    connect(view, SIGNAL(sortFoldersFirstChanged(bool)),
-            this, SLOT(slotSortFoldersFirstChanged(bool)));
-    connect(view, SIGNAL(visibleRolesChanged(QList<QByteArray>,QList<QByteArray>)),
-            this, SLOT(slotVisibleRolesChanged(QList<QByteArray>,QList<QByteArray>)));
-    connect(view, SIGNAL(groupedSortingChanged(bool)),
-            this, SLOT(slotGroupedSortingChanged(bool)));
-    connect(view, SIGNAL(hiddenFilesShownChanged(bool)),
-            this, SLOT(slotHiddenFilesShownChanged(bool)));
-    connect(view, SIGNAL(sortRoleChanged(QByteArray)),
-            this, SLOT(slotSortRoleChanged(QByteArray)));
-    connect(view, SIGNAL(zoomLevelChanged(int,int)),
-            this, SLOT(slotZoomLevelChanged(int,int)));
-    connect(view, SIGNAL(writeStateChanged(bool)),
-            this, SLOT(slotWriteStateChanged(bool)));
+    connect(view, &DolphinView::modeChanged,
+            this, &DolphinViewActionHandler::updateViewActions);
+    connect(view, &DolphinView::previewsShownChanged,
+            this, &DolphinViewActionHandler::slotPreviewsShownChanged);
+    connect(view, &DolphinView::sortOrderChanged,
+            this, &DolphinViewActionHandler::slotSortOrderChanged);
+    connect(view, &DolphinView::sortFoldersFirstChanged,
+            this, &DolphinViewActionHandler::slotSortFoldersFirstChanged);
+    connect(view, &DolphinView::visibleRolesChanged,
+            this, &DolphinViewActionHandler::slotVisibleRolesChanged);
+    connect(view, &DolphinView::groupedSortingChanged,
+            this, &DolphinViewActionHandler::slotGroupedSortingChanged);
+    connect(view, &DolphinView::hiddenFilesShownChanged,
+            this, &DolphinViewActionHandler::slotHiddenFilesShownChanged);
+    connect(view, &DolphinView::sortRoleChanged,
+            this, &DolphinViewActionHandler::slotSortRoleChanged);
+    connect(view, &DolphinView::zoomLevelChanged,
+            this, &DolphinViewActionHandler::slotZoomLevelChanged);
+    connect(view, &DolphinView::writeStateChanged,
+            this, &DolphinViewActionHandler::slotWriteStateChanged);
 }
 
 DolphinView* DolphinViewActionHandler::currentView()
@@ -104,7 +104,7 @@ void DolphinViewActionHandler::createActions()
     newDirAction->setShortcut(Qt::Key_F10);
     newDirAction->setIcon(KIcon("folder-new"));
     newDirAction->setEnabled(false);    // Will be enabled in slotWriteStateChanged(bool) if the current URL is writable
-    connect(newDirAction, SIGNAL(triggered()), this, SIGNAL(createDirectory()));
+    connect(newDirAction, &QAction::triggered, this, &DolphinViewActionHandler::createDirectory);
 
     // File menu
 
@@ -112,20 +112,20 @@ void DolphinViewActionHandler::createActions()
     rename->setText(i18nc("@action:inmenu File", "Rename..."));
     rename->setShortcut(Qt::Key_F2);
     rename->setIcon(KIcon("edit-rename"));
-    connect(rename, SIGNAL(triggered()), this, SLOT(slotRename()));
+    connect(rename, &QAction::triggered, this, &DolphinViewActionHandler::slotRename);
 
     QAction* moveToTrash = m_actionCollection->addAction("move_to_trash");
     moveToTrash->setText(i18nc("@action:inmenu File", "Move to Trash"));
     moveToTrash->setIcon(KIcon("user-trash"));
     moveToTrash->setShortcut(QKeySequence::Delete);
-    connect(moveToTrash, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)),
-            this, SLOT(slotTrashActivated(Qt::MouseButtons,Qt::KeyboardModifiers)));
+    connect(moveToTrash, &QAction::triggered,
+            this, &DolphinViewActionHandler::slotTrashActivated);
 
     QAction* deleteAction = m_actionCollection->addAction("delete");
     deleteAction->setIcon(KIcon("edit-delete"));
     deleteAction->setText(i18nc("@action:inmenu File", "Delete"));
     deleteAction->setShortcut(Qt::SHIFT | Qt::Key_Delete);
-    connect(deleteAction, SIGNAL(triggered()), this, SLOT(slotDeleteItems()));
+    connect(deleteAction, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems);
 
     // This action is useful for being enabled when "move_to_trash" should be
     // disabled and "delete" is enabled (e.g. non-local files), so that Key_Del
@@ -136,14 +136,14 @@ void DolphinViewActionHandler::createActions()
     deleteWithTrashShortcut->setText(i18nc("@action \"Move to Trash\" for non-local files, etc.", "Delete (using shortcut for Trash)"));
     deleteWithTrashShortcut->setShortcut(QKeySequence::Delete);
     deleteWithTrashShortcut->setEnabled(false);
-    connect(deleteWithTrashShortcut, SIGNAL(triggered()), this, SLOT(slotDeleteItems()));
+    connect(deleteWithTrashShortcut, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems);
 
     QAction *propertiesAction = m_actionCollection->addAction( "properties" );
     // Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :)
     propertiesAction->setText( i18nc("@action:inmenu File", "Properties") );
     propertiesAction->setIcon(KIcon("document-properties"));
     propertiesAction->setShortcuts(QList<QKeySequence>() << Qt::ALT + Qt::Key_Return << Qt::ALT + Qt::Key_Enter);
-    connect(propertiesAction, SIGNAL(triggered()), SLOT(slotProperties()));
+    connect(propertiesAction, &QAction::triggered, this, &DolphinViewActionHandler::slotProperties);
 
     // View menu
     KToggleAction* iconsAction = iconsModeAction();
@@ -156,7 +156,7 @@ void DolphinViewActionHandler::createActions()
     viewModeActions->addAction(compactAction);
     viewModeActions->addAction(detailsAction);
     viewModeActions->setToolBarMode(KSelectAction::MenuMode);
-    connect(viewModeActions, SIGNAL(triggered(QAction*)), this, SLOT(slotViewModeActionTriggered(QAction*)));
+    connect(viewModeActions, static_cast<void(KSelectAction::*)(QAction*)>(&KSelectAction::triggered), this, &DolphinViewActionHandler::slotViewModeActionTriggered);
 
     KStandardAction::zoomIn(this,
                             SLOT(zoomIn()),
@@ -170,15 +170,15 @@ void DolphinViewActionHandler::createActions()
     showPreview->setText(i18nc("@action:intoolbar", "Preview"));
     showPreview->setToolTip(i18nc("@info", "Show preview of files and folders"));
     showPreview->setIcon(KIcon("view-preview"));
-    connect(showPreview, SIGNAL(triggered(bool)), this, SLOT(togglePreview(bool)));
+    connect(showPreview, &KToggleAction::triggered, this, &DolphinViewActionHandler::togglePreview);
 
     KToggleAction* sortDescending = m_actionCollection->add<KToggleAction>("descending");
     sortDescending->setText(i18nc("@action:inmenu Sort", "Descending"));
-    connect(sortDescending, SIGNAL(triggered()), this, SLOT(toggleSortOrder()));
+    connect(sortDescending, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortOrder);
 
     KToggleAction* sortFoldersFirst = m_actionCollection->add<KToggleAction>("folders_first");
     sortFoldersFirst->setText(i18nc("@action:inmenu Sort", "Folders First"));
-    connect(sortFoldersFirst, SIGNAL(triggered()), this, SLOT(toggleSortFoldersFirst()));
+    connect(sortFoldersFirst, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortFoldersFirst);
 
     // View -> Sort By
     QActionGroup* sortByActionGroup = createFileItemRolesActionGroup("sort_by_");
@@ -208,16 +208,16 @@ void DolphinViewActionHandler::createActions()
     KToggleAction* showInGroups = m_actionCollection->add<KToggleAction>("show_in_groups");
     showInGroups->setIcon(KIcon("view-group"));
     showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups"));
-    connect(showInGroups, SIGNAL(triggered(bool)), this, SLOT(toggleGroupedSorting(bool)));
+    connect(showInGroups, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleGroupedSorting);
 
     KToggleAction* showHiddenFiles = m_actionCollection->add<KToggleAction>("show_hidden_files");
     showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files"));
     showHiddenFiles->setShortcuts(QList<QKeySequence>() << Qt::ALT + Qt::Key_Period << Qt::Key_F8);
-    connect(showHiddenFiles, SIGNAL(triggered(bool)), this, SLOT(toggleShowHiddenFiles(bool)));
+    connect(showHiddenFiles, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleShowHiddenFiles);
 
     QAction* adjustViewProps = m_actionCollection->addAction("view_properties");
     adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Properties..."));
-    connect(adjustViewProps, SIGNAL(triggered()), this, SLOT(slotAdjustViewProperties()));
+    connect(adjustViewProps, &QAction::triggered, this, &DolphinViewActionHandler::slotAdjustViewProperties);
 }
 
 QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QString& groupPrefix)
@@ -228,11 +228,11 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt
     QActionGroup* rolesActionGroup = new QActionGroup(m_actionCollection);
     rolesActionGroup->setExclusive(isSortGroup);
     if (isSortGroup) {
-        connect(rolesActionGroup, SIGNAL(triggered(QAction*)),
-                this, SLOT(slotSortTriggered(QAction*)));
+        connect(rolesActionGroup, &QActionGroup::triggered,
+                this, &DolphinViewActionHandler::slotSortTriggered);
     } else {
-        connect(rolesActionGroup, SIGNAL(triggered(QAction*)),
-                this, SLOT(toggleVisibleRole(QAction*)));
+        connect(rolesActionGroup, &QActionGroup::triggered,
+                this, &DolphinViewActionHandler::toggleVisibleRole);
     }
 
     QString groupName;
@@ -267,11 +267,11 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt
                 groupMenuGroup = new QActionGroup(groupMenu);
                 groupMenuGroup->setExclusive(isSortGroup);
                 if (isSortGroup) {
-                    connect(groupMenuGroup, SIGNAL(triggered(QAction*)),
-                            this, SLOT(slotSortTriggered(QAction*)));
+                    connect(groupMenuGroup, &QActionGroup::triggered,
+                            this, &DolphinViewActionHandler::slotSortTriggered);
                 } else {
-                    connect(groupMenuGroup, SIGNAL(triggered(QAction*)),
-                            this, SLOT(toggleVisibleRole(QAction*)));
+                    connect(groupMenuGroup, &QActionGroup::triggered,
+                            this, &DolphinViewActionHandler::toggleVisibleRole);
                 }
             }
 
@@ -312,7 +312,7 @@ void DolphinViewActionHandler::slotRename()
     m_currentView->renameSelectedItems();
 }
 
-void DolphinViewActionHandler::slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers modifiers)
+void DolphinViewActionHandler::slotTrashActivated()
 {
     emit actionBeingHandled();
     m_currentView->trashSelectedItems();
index e80ffc0dffb426b1882ec302aca99cc90fce6bc3..58cdb5416068d423e1421201c5b82071781a06f0 100644 (file)
@@ -112,7 +112,7 @@ private Q_SLOTS:
      * Moves the selected items of the active view to the trash.
      * This methods adds "shift means del" handling.
      */
-    void slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers);
+    void slotTrashActivated();
 
     /**
      * Deletes the selected items of the active view.
index a2fc7d20cabca5bc5a78eb5be898b3002303e270..67f90a5da3f51fcbbfe0ce66f6e1863ea31150cc 100644 (file)
@@ -84,7 +84,7 @@ RenameDialog::RenameDialog(QWidget *parent, const KFileItemList& items) :
     }
 
     m_lineEdit = new KLineEdit(page);
-    connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged(QString)));
+    connect(m_lineEdit, &KLineEdit::textChanged, this, &RenameDialog::slotTextChanged);
 
     int selectionLength = m_newName.length();
     if (m_renameOneItem) {
index b4102d136dbd1ac7f222513731711960fbafde58..bc2cbf981fffd0d69a55e188d7ce4467d72478e2 100644 (file)
@@ -76,8 +76,8 @@ FileMetaDataToolTip::FileMetaDataToolTip(QWidget* parent) :
 #endif
     m_fileMetaDataWidget->setForegroundRole(QPalette::ToolTipText);
     m_fileMetaDataWidget->setReadOnly(true);
-    connect(m_fileMetaDataWidget, SIGNAL(metaDataRequestFinished(KFileItemList)),
-            this, SIGNAL(metaDataRequestFinished(KFileItemList)));
+    connect(m_fileMetaDataWidget, &KFileMetaDataWidget::metaDataRequestFinished,
+            this, &FileMetaDataToolTip::metaDataRequestFinished);
 
     QVBoxLayout* textLayout = new QVBoxLayout();
     textLayout->addWidget(m_name);
index 0463f62c71be8e2f28e019a0f5d284794c8275b9..1f213dc5c2efbe319805713e90a9da7f9c3485cc 100644 (file)
@@ -52,12 +52,12 @@ ToolTipManager::ToolTipManager(QWidget* parent) :
     m_showToolTipTimer = new QTimer(this);
     m_showToolTipTimer->setSingleShot(true);
     m_showToolTipTimer->setInterval(500);
-    connect(m_showToolTipTimer, SIGNAL(timeout()), this, SLOT(showToolTip()));
+    connect(m_showToolTipTimer, &QTimer::timeout, this, static_cast<void(ToolTipManager::*)()>(&ToolTipManager::showToolTip));
 
     m_contentRetrievalTimer = new QTimer(this);
     m_contentRetrievalTimer->setSingleShot(true);
     m_contentRetrievalTimer->setInterval(200);
-    connect(m_contentRetrievalTimer, SIGNAL(timeout()), this, SLOT(startContentRetrieval()));
+    connect(m_contentRetrievalTimer, &QTimer::timeout, this, &ToolTipManager::startContentRetrieval);
 
     Q_ASSERT(m_contentRetrievalTimer->interval() < m_showToolTipTimer->interval());
 }
@@ -82,8 +82,8 @@ void ToolTipManager::showToolTip(const KFileItem& item, const QRectF& itemRect)
     // meta data retrieval, when passing rapidly over a lot of items.
     Q_ASSERT(!m_fileMetaDataToolTip);
     m_fileMetaDataToolTip = new FileMetaDataToolTip();
-    connect(m_fileMetaDataToolTip, SIGNAL(metaDataRequestFinished(KFileItemList)),
-            this, SLOT(slotMetaDataRequestFinished()));
+    connect(m_fileMetaDataToolTip, &FileMetaDataToolTip::metaDataRequestFinished,
+            this, &ToolTipManager::slotMetaDataRequestFinished);
 
     m_contentRetrievalTimer->start();
     m_showToolTipTimer->start();
@@ -136,10 +136,10 @@ void ToolTipManager::startContentRetrieval()
         KJobWidgets::setWindow(job, qApp->activeWindow());
     }
 
-    connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)),
-            this, SLOT(setPreviewPix(KFileItem,QPixmap)));
-    connect(job, SIGNAL(failed(KFileItem)),
-            this, SLOT(previewFailed()));
+    connect(job, &KIO::PreviewJob::gotPreview,
+            this, &ToolTipManager::setPreviewPix);
+    connect(job, &KIO::PreviewJob::failed,
+            this, &ToolTipManager::previewFailed);
 }
 
 
index 51502398cffb6e9a806ba494e6c4417a858bd640..2c966e18659f9fdff790e29b954c057f66638e2a 100644 (file)
@@ -52,8 +52,8 @@ VersionControlObserver::VersionControlObserver(QObject* parent) :
     m_dirVerificationTimer = new QTimer(this);
     m_dirVerificationTimer->setSingleShot(true);
     m_dirVerificationTimer->setInterval(500);
-    connect(m_dirVerificationTimer, SIGNAL(timeout()),
-            this, SLOT(verifyDirectory()));
+    connect(m_dirVerificationTimer, &QTimer::timeout,
+            this, &VersionControlObserver::verifyDirectory);
 }
 
 VersionControlObserver::~VersionControlObserver()
@@ -67,19 +67,19 @@ VersionControlObserver::~VersionControlObserver()
 void VersionControlObserver::setModel(KFileItemModel* model)
 {
     if (m_model) {
-        disconnect(m_model, SIGNAL(itemsInserted(KItemRangeList)),
-                   this, SLOT(delayedDirectoryVerification()));
-        disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
-                   this, SLOT(delayedDirectoryVerification()));
+        disconnect(m_model, &KFileItemModel::itemsInserted,
+                   this, &VersionControlObserver::delayedDirectoryVerification);
+        disconnect(m_model, &KFileItemModel::itemsChanged,
+                   this, &VersionControlObserver::delayedDirectoryVerification);
     }
 
     m_model = model;
 
     if (model) {
-        connect(m_model, SIGNAL(itemsInserted(KItemRangeList)),
-                this, SLOT(delayedDirectoryVerification()));
-        connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
-                this, SLOT(delayedDirectoryVerification()));
+        connect(m_model, &KFileItemModel::itemsInserted,
+                this, &VersionControlObserver::delayedDirectoryVerification);
+        connect(m_model, &KFileItemModel::itemsChanged,
+                this, &VersionControlObserver::delayedDirectoryVerification);
     }
 }
 
@@ -159,18 +159,18 @@ void VersionControlObserver::verifyDirectory()
     if (m_plugin) {
         KVersionControlPlugin2* pluginV2 = qobject_cast<KVersionControlPlugin2*>(m_plugin);
         if (pluginV2) {
-            connect(pluginV2, SIGNAL(itemVersionsChanged()),
-                    this, SLOT(silentDirectoryVerification()));
+            connect(pluginV2, &KVersionControlPlugin2::itemVersionsChanged,
+                    this, &VersionControlObserver::silentDirectoryVerification);
         } else {
-            connect(m_plugin, SIGNAL(versionStatesChanged()),
-                    this, SLOT(silentDirectoryVerification()));
+            connect(m_plugin, &KVersionControlPlugin::versionStatesChanged,
+                    this, &VersionControlObserver::silentDirectoryVerification);
         }
-        connect(m_plugin, SIGNAL(infoMessage(QString)),
-                this, SIGNAL(infoMessage(QString)));
-        connect(m_plugin, SIGNAL(errorMessage(QString)),
-                this, SIGNAL(errorMessage(QString)));
-        connect(m_plugin, SIGNAL(operationCompletedMessage(QString)),
-                this, SIGNAL(operationCompletedMessage(QString)));
+        connect(m_plugin, &KVersionControlPlugin::infoMessage,
+                this, &VersionControlObserver::infoMessage);
+        connect(m_plugin, &KVersionControlPlugin::errorMessage,
+                this, &VersionControlObserver::errorMessage);
+        connect(m_plugin, &KVersionControlPlugin::operationCompletedMessage,
+                this, &VersionControlObserver::operationCompletedMessage);
 
         if (!m_versionedDirectory) {
             m_versionedDirectory = true;
@@ -242,10 +242,10 @@ void VersionControlObserver::updateItemStates()
             emit infoMessage(i18nc("@info:status", "Updating version information..."));
         }
         m_updateItemStatesThread = new UpdateItemStatesThread(m_plugin, itemStates);
-        connect(m_updateItemStatesThread, SIGNAL(finished()),
-                this, SLOT(slotThreadFinished()));
-        connect(m_updateItemStatesThread, SIGNAL(finished()),
-                m_updateItemStatesThread, SLOT(deleteLater()));
+        connect(m_updateItemStatesThread, &UpdateItemStatesThread::finished,
+                this, &VersionControlObserver::slotThreadFinished);
+        connect(m_updateItemStatesThread, &UpdateItemStatesThread::finished,
+                m_updateItemStatesThread, &UpdateItemStatesThread::deleteLater);
 
         m_updateItemStatesThread->start(); // slotThreadFinished() is called when finished
     }