dolphin: convert views/ to qt5 signal/slot syntax

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
This commit is contained in:
Alex Richardson 2014-04-10 02:59:39 +02:00
parent b069fb9b43
commit 05f2c9c320
10 changed files with 158 additions and 157 deletions

View file

@ -36,22 +36,22 @@ DolphinNewFileMenuObserver& DolphinNewFileMenuObserver::instance()
void DolphinNewFileMenuObserver::attach(const DolphinNewFileMenu* menu) void DolphinNewFileMenuObserver::attach(const DolphinNewFileMenu* menu)
{ {
connect(menu, SIGNAL(fileCreated(KUrl)), connect(menu, &DolphinNewFileMenu::fileCreated,
this, SIGNAL(itemCreated(KUrl))); this, &DolphinNewFileMenuObserver::itemCreated);
connect(menu, SIGNAL(directoryCreated(KUrl)), connect(menu, &DolphinNewFileMenu::directoryCreated,
this, SIGNAL(itemCreated(KUrl))); this, &DolphinNewFileMenuObserver::itemCreated);
connect(menu, SIGNAL(errorMessage(QString)), connect(menu, &DolphinNewFileMenu::errorMessage,
this, SIGNAL(errorMessage(QString))); this, &DolphinNewFileMenuObserver::errorMessage);
} }
void DolphinNewFileMenuObserver::detach(const DolphinNewFileMenu* menu) void DolphinNewFileMenuObserver::detach(const DolphinNewFileMenu* menu)
{ {
disconnect(menu, SIGNAL(fileCreated(KUrl)), disconnect(menu, &DolphinNewFileMenu::fileCreated,
this, SIGNAL(itemCreated(KUrl))); this, &DolphinNewFileMenuObserver::itemCreated);
disconnect(menu, SIGNAL(directoryCreated(KUrl)), disconnect(menu, &DolphinNewFileMenu::directoryCreated,
this, SIGNAL(itemCreated(KUrl))); this, &DolphinNewFileMenuObserver::itemCreated);
disconnect(menu, SIGNAL(errorMessage(QString)), disconnect(menu, &DolphinNewFileMenu::errorMessage,
this, SIGNAL(errorMessage(QString))); this, &DolphinNewFileMenuObserver::errorMessage);
} }
DolphinNewFileMenuObserver::DolphinNewFileMenuObserver() : DolphinNewFileMenuObserver::DolphinNewFileMenuObserver() :

View file

@ -44,7 +44,7 @@ public:
void detach(const DolphinNewFileMenu* menu); void detach(const DolphinNewFileMenu* menu);
signals: signals:
void itemCreated(const KUrl& url); void itemCreated(const QUrl& url);
void errorMessage(const QString& error); void errorMessage(const QString& error);
private: private:

View file

@ -51,8 +51,8 @@ DolphinRemoteEncoding::DolphinRemoteEncoding(QObject* parent, DolphinViewActionH
{ {
m_menu = new KActionMenu(KIcon("character-set"), i18n("Select Remote Charset"), this); m_menu = new KActionMenu(KIcon("character-set"), i18n("Select Remote Charset"), this);
m_actionHandler->actionCollection()->addAction("change_remote_encoding", m_menu); m_actionHandler->actionCollection()->addAction("change_remote_encoding", m_menu);
connect(m_menu->menu(), SIGNAL(aboutToShow()), connect(m_menu->menu(), &QMenu::aboutToShow,
this, SLOT(slotAboutToShow())); this, &DolphinRemoteEncoding::slotAboutToShow);
m_menu->setEnabled(false); m_menu->setEnabled(false);
m_menu->setDelayed(false); m_menu->setDelayed(false);
@ -117,7 +117,7 @@ void DolphinRemoteEncoding::fillMenu()
menu->addAction(i18n("Default"), this, SLOT(slotDefault()), 0)->setCheckable(true); menu->addAction(i18n("Default"), this, SLOT(slotDefault()), 0)->setCheckable(true);
m_idDefault = m_encodingDescriptions.size() + 2; 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() void DolphinRemoteEncoding::updateMenu()

View 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 // 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 // get selected and it must be assured that the item will get visible. As the
// creation is done asynchronously, several signals must be checked: // creation is done asynchronously, several signals must be checked:
connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(itemCreated(KUrl)), connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::itemCreated,
this, SLOT(observeCreatedItem(KUrl))); this, &DolphinView::observeCreatedItem);
m_selectionChangedTimer = new QTimer(this); m_selectionChangedTimer = new QTimer(this);
m_selectionChangedTimer->setSingleShot(true); m_selectionChangedTimer->setSingleShot(true);
m_selectionChangedTimer->setInterval(300); m_selectionChangedTimer->setInterval(300);
connect(m_selectionChangedTimer, SIGNAL(timeout()), connect(m_selectionChangedTimer, &QTimer::timeout,
this, SLOT(emitSelectionChangedSignal())); this, &DolphinView::emitSelectionChangedSignal);
m_model = new KFileItemModel(this); m_model = new KFileItemModel(this);
m_view = new DolphinItemListView(); m_view = new DolphinItemListView();
@ -144,60 +144,60 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
m_container = new KItemListContainer(controller, this); m_container = new KItemListContainer(controller, this);
m_container->installEventFilter(this); m_container->installEventFilter(this);
setFocusProxy(m_container); setFocusProxy(m_container);
connect(m_container->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(hideToolTip())); connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip);
connect(m_container->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(hideToolTip())); connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip);
controller->setSelectionBehavior(KItemListController::MultiSelection); controller->setSelectionBehavior(KItemListController::MultiSelection);
connect(controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int))); connect(controller, &KItemListController::itemActivated, this, &DolphinView::slotItemActivated);
connect(controller, SIGNAL(itemsActivated(KItemSet)), this, SLOT(slotItemsActivated(KItemSet))); connect(controller, &KItemListController::itemsActivated, this, &DolphinView::slotItemsActivated);
connect(controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int))); connect(controller, &KItemListController::itemMiddleClicked, this, &DolphinView::slotItemMiddleClicked);
connect(controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF))); connect(controller, &KItemListController::itemContextMenuRequested, this, &DolphinView::slotItemContextMenuRequested);
connect(controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF))); connect(controller, &KItemListController::viewContextMenuRequested, this, &DolphinView::slotViewContextMenuRequested);
connect(controller, SIGNAL(headerContextMenuRequested(QPointF)), this, SLOT(slotHeaderContextMenuRequested(QPointF))); connect(controller, &KItemListController::headerContextMenuRequested, this, &DolphinView::slotHeaderContextMenuRequested);
connect(controller, SIGNAL(mouseButtonPressed(int,Qt::MouseButtons)), this, SLOT(slotMouseButtonPressed(int,Qt::MouseButtons))); connect(controller, &KItemListController::mouseButtonPressed, this, &DolphinView::slotMouseButtonPressed);
connect(controller, SIGNAL(itemHovered(int)), this, SLOT(slotItemHovered(int))); connect(controller, &KItemListController::itemHovered, this, &DolphinView::slotItemHovered);
connect(controller, SIGNAL(itemUnhovered(int)), this, SLOT(slotItemUnhovered(int))); connect(controller, &KItemListController::itemUnhovered, this, &DolphinView::slotItemUnhovered);
connect(controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*))); connect(controller, &KItemListController::itemDropEvent, this, &DolphinView::slotItemDropEvent);
connect(controller, SIGNAL(escapePressed()), this, SLOT(stopLoading())); connect(controller, &KItemListController::escapePressed, this, &DolphinView::stopLoading);
connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*))); connect(controller, &KItemListController::modelChanged, this, &DolphinView::slotModelChanged);
connect(m_model, SIGNAL(directoryLoadingStarted()), this, SLOT(slotDirectoryLoadingStarted())); connect(m_model, &KFileItemModel::directoryLoadingStarted, this, &DolphinView::slotDirectoryLoadingStarted);
connect(m_model, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted())); connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted);
connect(m_model, SIGNAL(directoryLoadingCanceled()), this, SIGNAL(directoryLoadingCanceled())); connect(m_model, &KFileItemModel::directoryLoadingCanceled, this, &DolphinView::directoryLoadingCanceled);
connect(m_model, SIGNAL(directoryLoadingProgress(int)), this, SIGNAL(directoryLoadingProgress(int))); connect(m_model, &KFileItemModel::directoryLoadingProgress, this, &DolphinView::directoryLoadingProgress);
connect(m_model, SIGNAL(directorySortingProgress(int)), this, SIGNAL(directorySortingProgress(int))); connect(m_model, &KFileItemModel::directorySortingProgress, this, &DolphinView::directorySortingProgress);
connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)), connect(m_model, &KFileItemModel::itemsChanged,
this, SLOT(slotItemsChanged())); this, &DolphinView::slotItemsChanged);
connect(m_model, SIGNAL(itemsRemoved(KItemRangeList)), this, SIGNAL(itemCountChanged())); connect(m_model, &KFileItemModel::itemsRemoved, this, &DolphinView::itemCountChanged);
connect(m_model, SIGNAL(itemsInserted(KItemRangeList)), this, SIGNAL(itemCountChanged())); connect(m_model, &KFileItemModel::itemsInserted, this, &DolphinView::itemCountChanged);
connect(m_model, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString))); connect(m_model, &KFileItemModel::infoMessage, this, &DolphinView::infoMessage);
connect(m_model, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString))); connect(m_model, &KFileItemModel::errorMessage, this, &DolphinView::errorMessage);
connect(m_model, SIGNAL(directoryRedirection(KUrl,KUrl)), this, SLOT(slotDirectoryRedirection(KUrl,KUrl))); connect(m_model, &KFileItemModel::directoryRedirection, this, &DolphinView::slotDirectoryRedirection);
connect(m_model, SIGNAL(urlIsFileError(KUrl)), this, SIGNAL(urlIsFileError(KUrl))); connect(m_model, &KFileItemModel::urlIsFileError, this, &DolphinView::urlIsFileError);
m_view->installEventFilter(this); m_view->installEventFilter(this);
connect(m_view, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)), connect(m_view, &DolphinItemListView::sortOrderChanged,
this, SLOT(slotSortOrderChangedByHeader(Qt::SortOrder,Qt::SortOrder))); this, &DolphinView::slotSortOrderChangedByHeader);
connect(m_view, SIGNAL(sortRoleChanged(QByteArray,QByteArray)), connect(m_view, &DolphinItemListView::sortRoleChanged,
this, SLOT(slotSortRoleChangedByHeader(QByteArray,QByteArray))); this, &DolphinView::slotSortRoleChangedByHeader);
connect(m_view, SIGNAL(visibleRolesChanged(QList<QByteArray>,QList<QByteArray>)), connect(m_view, &DolphinItemListView::visibleRolesChanged,
this, SLOT(slotVisibleRolesChangedByHeader(QList<QByteArray>,QList<QByteArray>))); this, &DolphinView::slotVisibleRolesChangedByHeader);
connect(m_view, SIGNAL(roleEditingCanceled(int,QByteArray,QVariant)), connect(m_view, &DolphinItemListView::roleEditingCanceled,
this, SLOT(slotRoleEditingCanceled())); this, &DolphinView::slotRoleEditingCanceled);
connect(m_view->header(), SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)), connect(m_view->header(), &KItemListHeader::columnWidthChanged,
this, SLOT(slotHeaderColumnWidthChanged(QByteArray,qreal,qreal))); this, &DolphinView::slotHeaderColumnWidthChanged);
KItemListSelectionManager* selectionManager = controller->selectionManager(); KItemListSelectionManager* selectionManager = controller->selectionManager();
connect(selectionManager, SIGNAL(selectionChanged(KItemSet,KItemSet)), connect(selectionManager, &KItemListSelectionManager::selectionChanged,
this, SLOT(slotSelectionChanged(KItemSet,KItemSet))); this, &DolphinView::slotSelectionChanged);
m_toolTipManager = new ToolTipManager(this); m_toolTipManager = new ToolTipManager(this);
m_versionControlObserver = new VersionControlObserver(this); m_versionControlObserver = new VersionControlObserver(this);
m_versionControlObserver->setModel(m_model); m_versionControlObserver->setModel(m_model);
connect(m_versionControlObserver, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString))); connect(m_versionControlObserver, &VersionControlObserver::infoMessage, this, &DolphinView::infoMessage);
connect(m_versionControlObserver, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString))); connect(m_versionControlObserver, &VersionControlObserver::errorMessage, this, &DolphinView::errorMessage);
connect(m_versionControlObserver, SIGNAL(operationCompletedMessage(QString)), this, SIGNAL(operationCompletedMessage(QString))); connect(m_versionControlObserver, &VersionControlObserver::operationCompletedMessage, this, &DolphinView::operationCompletedMessage);
applyViewProperties(); applyViewProperties();
m_topLayout->addWidget(m_container); m_topLayout->addWidget(m_container);
@ -610,8 +610,8 @@ void DolphinView::setUrl(const KUrl& url)
hideToolTip(); hideToolTip();
disconnect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), disconnect(m_view, &DolphinItemListView::roleEditingFinished,
this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant))); this, &DolphinView::slotRoleEditingFinished);
// It is important to clear the items from the model before // It is important to clear the items from the model before
// applying the view properties, otherwise expensive operations // applying the view properties, otherwise expensive operations
@ -655,8 +655,8 @@ void DolphinView::renameSelectedItems()
hideToolTip(); hideToolTip();
connect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), connect(m_view, &DolphinItemListView::roleEditingFinished,
this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant))); this, &DolphinView::slotRoleEditingFinished);
} else { } else {
RenameDialog* dialog = new RenameDialog(this, items); RenameDialog* dialog = new RenameDialog(this, items);
dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setAttribute(Qt::WA_DeleteOnClose);
@ -690,8 +690,8 @@ void DolphinView::deleteSelectedItems()
if (job->ui()) { if (job->ui()) {
KJobWidgets::setWindow(job, this); KJobWidgets::setWindow(job, this);
} }
connect(job, SIGNAL(result(KJob*)), connect(job, &KIO::Job::result,
this, SLOT(slotDeleteFileFinished(KJob*))); this, &DolphinView::slotDeleteFileFinished);
} }
} }
@ -1050,7 +1050,7 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
if (op && destUrl == url()) { if (op && destUrl == url()) {
// Mark the dropped urls as selected. // Mark the dropped urls as selected.
m_clearSelectionBeforeSelectingNewItems = true; 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); setActive(true);
@ -1059,15 +1059,16 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous) void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous)
{ {
if (previous != 0) { 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); m_versionControlObserver->setModel(0);
} }
if (current) { if (current) {
Q_ASSERT(qobject_cast<KFileItemModel*>(current)); Q_ASSERT(qobject_cast<KFileItemModel*>(current));
connect(current, SIGNAL(loadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(current); KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(current);
connect(fileItemModel, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted);
m_versionControlObserver->setModel(fileItemModel); m_versionControlObserver->setModel(fileItemModel);
} }
} }
@ -1455,14 +1456,14 @@ void DolphinView::slotVisibleRolesChangedByHeader(const QList<QByteArray>& curre
void DolphinView::slotRoleEditingCanceled() void DolphinView::slotRoleEditingCanceled()
{ {
disconnect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), disconnect(m_view, &DolphinItemListView::roleEditingFinished,
this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant))); this, &DolphinView::slotRoleEditingFinished);
} }
void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value) void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value)
{ {
disconnect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), disconnect(m_view, &DolphinItemListView::roleEditingFinished,
this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant))); this, &DolphinView::slotRoleEditingFinished);
if (index < 0 || index >= m_model->count()) { if (index < 0 || index >= m_model->count()) {
return; return;
@ -1491,7 +1492,7 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
if (op && !newNameExistsAlready) { if (op && !newNameExistsAlready) {
// Only connect the renamingFailed signal if there is no item with the new name // Only connect the renamingFailed signal if there is no item with the new name
// in the model yet, see bug 328262. // 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) { if (op) {
m_clearSelectionBeforeSelectingNewItems = true; m_clearSelectionBeforeSelectingNewItems = true;
m_markFirstNewlySelectedItemAsCurrent = 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);
} }
} }

View file

@ -68,26 +68,26 @@ void DolphinViewActionHandler::setCurrentView(DolphinView* view)
m_currentView = view; m_currentView = view;
connect(view, SIGNAL(modeChanged(DolphinView::Mode,DolphinView::Mode)), connect(view, &DolphinView::modeChanged,
this, SLOT(updateViewActions())); this, &DolphinViewActionHandler::updateViewActions);
connect(view, SIGNAL(previewsShownChanged(bool)), connect(view, &DolphinView::previewsShownChanged,
this, SLOT(slotPreviewsShownChanged(bool))); this, &DolphinViewActionHandler::slotPreviewsShownChanged);
connect(view, SIGNAL(sortOrderChanged(Qt::SortOrder)), connect(view, &DolphinView::sortOrderChanged,
this, SLOT(slotSortOrderChanged(Qt::SortOrder))); this, &DolphinViewActionHandler::slotSortOrderChanged);
connect(view, SIGNAL(sortFoldersFirstChanged(bool)), connect(view, &DolphinView::sortFoldersFirstChanged,
this, SLOT(slotSortFoldersFirstChanged(bool))); this, &DolphinViewActionHandler::slotSortFoldersFirstChanged);
connect(view, SIGNAL(visibleRolesChanged(QList<QByteArray>,QList<QByteArray>)), connect(view, &DolphinView::visibleRolesChanged,
this, SLOT(slotVisibleRolesChanged(QList<QByteArray>,QList<QByteArray>))); this, &DolphinViewActionHandler::slotVisibleRolesChanged);
connect(view, SIGNAL(groupedSortingChanged(bool)), connect(view, &DolphinView::groupedSortingChanged,
this, SLOT(slotGroupedSortingChanged(bool))); this, &DolphinViewActionHandler::slotGroupedSortingChanged);
connect(view, SIGNAL(hiddenFilesShownChanged(bool)), connect(view, &DolphinView::hiddenFilesShownChanged,
this, SLOT(slotHiddenFilesShownChanged(bool))); this, &DolphinViewActionHandler::slotHiddenFilesShownChanged);
connect(view, SIGNAL(sortRoleChanged(QByteArray)), connect(view, &DolphinView::sortRoleChanged,
this, SLOT(slotSortRoleChanged(QByteArray))); this, &DolphinViewActionHandler::slotSortRoleChanged);
connect(view, SIGNAL(zoomLevelChanged(int,int)), connect(view, &DolphinView::zoomLevelChanged,
this, SLOT(slotZoomLevelChanged(int,int))); this, &DolphinViewActionHandler::slotZoomLevelChanged);
connect(view, SIGNAL(writeStateChanged(bool)), connect(view, &DolphinView::writeStateChanged,
this, SLOT(slotWriteStateChanged(bool))); this, &DolphinViewActionHandler::slotWriteStateChanged);
} }
DolphinView* DolphinViewActionHandler::currentView() DolphinView* DolphinViewActionHandler::currentView()
@ -104,7 +104,7 @@ void DolphinViewActionHandler::createActions()
newDirAction->setShortcut(Qt::Key_F10); newDirAction->setShortcut(Qt::Key_F10);
newDirAction->setIcon(KIcon("folder-new")); newDirAction->setIcon(KIcon("folder-new"));
newDirAction->setEnabled(false); // Will be enabled in slotWriteStateChanged(bool) if the current URL is writable 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 // File menu
@ -112,20 +112,20 @@ void DolphinViewActionHandler::createActions()
rename->setText(i18nc("@action:inmenu File", "Rename...")); rename->setText(i18nc("@action:inmenu File", "Rename..."));
rename->setShortcut(Qt::Key_F2); rename->setShortcut(Qt::Key_F2);
rename->setIcon(KIcon("edit-rename")); 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"); QAction* moveToTrash = m_actionCollection->addAction("move_to_trash");
moveToTrash->setText(i18nc("@action:inmenu File", "Move to Trash")); moveToTrash->setText(i18nc("@action:inmenu File", "Move to Trash"));
moveToTrash->setIcon(KIcon("user-trash")); moveToTrash->setIcon(KIcon("user-trash"));
moveToTrash->setShortcut(QKeySequence::Delete); moveToTrash->setShortcut(QKeySequence::Delete);
connect(moveToTrash, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), connect(moveToTrash, &QAction::triggered,
this, SLOT(slotTrashActivated(Qt::MouseButtons,Qt::KeyboardModifiers))); this, &DolphinViewActionHandler::slotTrashActivated);
QAction* deleteAction = m_actionCollection->addAction("delete"); QAction* deleteAction = m_actionCollection->addAction("delete");
deleteAction->setIcon(KIcon("edit-delete")); deleteAction->setIcon(KIcon("edit-delete"));
deleteAction->setText(i18nc("@action:inmenu File", "Delete")); deleteAction->setText(i18nc("@action:inmenu File", "Delete"));
deleteAction->setShortcut(Qt::SHIFT | Qt::Key_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 // 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 // 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->setText(i18nc("@action \"Move to Trash\" for non-local files, etc.", "Delete (using shortcut for Trash)"));
deleteWithTrashShortcut->setShortcut(QKeySequence::Delete); deleteWithTrashShortcut->setShortcut(QKeySequence::Delete);
deleteWithTrashShortcut->setEnabled(false); deleteWithTrashShortcut->setEnabled(false);
connect(deleteWithTrashShortcut, SIGNAL(triggered()), this, SLOT(slotDeleteItems())); connect(deleteWithTrashShortcut, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems);
QAction *propertiesAction = m_actionCollection->addAction( "properties" ); QAction *propertiesAction = m_actionCollection->addAction( "properties" );
// Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :) // Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :)
propertiesAction->setText( i18nc("@action:inmenu File", "Properties") ); propertiesAction->setText( i18nc("@action:inmenu File", "Properties") );
propertiesAction->setIcon(KIcon("document-properties")); propertiesAction->setIcon(KIcon("document-properties"));
propertiesAction->setShortcuts(QList<QKeySequence>() << Qt::ALT + Qt::Key_Return << Qt::ALT + Qt::Key_Enter); 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 // View menu
KToggleAction* iconsAction = iconsModeAction(); KToggleAction* iconsAction = iconsModeAction();
@ -156,7 +156,7 @@ void DolphinViewActionHandler::createActions()
viewModeActions->addAction(compactAction); viewModeActions->addAction(compactAction);
viewModeActions->addAction(detailsAction); viewModeActions->addAction(detailsAction);
viewModeActions->setToolBarMode(KSelectAction::MenuMode); 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, KStandardAction::zoomIn(this,
SLOT(zoomIn()), SLOT(zoomIn()),
@ -170,15 +170,15 @@ void DolphinViewActionHandler::createActions()
showPreview->setText(i18nc("@action:intoolbar", "Preview")); showPreview->setText(i18nc("@action:intoolbar", "Preview"));
showPreview->setToolTip(i18nc("@info", "Show preview of files and folders")); showPreview->setToolTip(i18nc("@info", "Show preview of files and folders"));
showPreview->setIcon(KIcon("view-preview")); 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"); KToggleAction* sortDescending = m_actionCollection->add<KToggleAction>("descending");
sortDescending->setText(i18nc("@action:inmenu Sort", "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"); KToggleAction* sortFoldersFirst = m_actionCollection->add<KToggleAction>("folders_first");
sortFoldersFirst->setText(i18nc("@action:inmenu Sort", "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 // View -> Sort By
QActionGroup* sortByActionGroup = createFileItemRolesActionGroup("sort_by_"); QActionGroup* sortByActionGroup = createFileItemRolesActionGroup("sort_by_");
@ -208,16 +208,16 @@ void DolphinViewActionHandler::createActions()
KToggleAction* showInGroups = m_actionCollection->add<KToggleAction>("show_in_groups"); KToggleAction* showInGroups = m_actionCollection->add<KToggleAction>("show_in_groups");
showInGroups->setIcon(KIcon("view-group")); showInGroups->setIcon(KIcon("view-group"));
showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups")); 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"); KToggleAction* showHiddenFiles = m_actionCollection->add<KToggleAction>("show_hidden_files");
showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files")); showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files"));
showHiddenFiles->setShortcuts(QList<QKeySequence>() << Qt::ALT + Qt::Key_Period << Qt::Key_F8); 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"); QAction* adjustViewProps = m_actionCollection->addAction("view_properties");
adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust 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) QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QString& groupPrefix)
@ -228,11 +228,11 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt
QActionGroup* rolesActionGroup = new QActionGroup(m_actionCollection); QActionGroup* rolesActionGroup = new QActionGroup(m_actionCollection);
rolesActionGroup->setExclusive(isSortGroup); rolesActionGroup->setExclusive(isSortGroup);
if (isSortGroup) { if (isSortGroup) {
connect(rolesActionGroup, SIGNAL(triggered(QAction*)), connect(rolesActionGroup, &QActionGroup::triggered,
this, SLOT(slotSortTriggered(QAction*))); this, &DolphinViewActionHandler::slotSortTriggered);
} else { } else {
connect(rolesActionGroup, SIGNAL(triggered(QAction*)), connect(rolesActionGroup, &QActionGroup::triggered,
this, SLOT(toggleVisibleRole(QAction*))); this, &DolphinViewActionHandler::toggleVisibleRole);
} }
QString groupName; QString groupName;
@ -267,11 +267,11 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt
groupMenuGroup = new QActionGroup(groupMenu); groupMenuGroup = new QActionGroup(groupMenu);
groupMenuGroup->setExclusive(isSortGroup); groupMenuGroup->setExclusive(isSortGroup);
if (isSortGroup) { if (isSortGroup) {
connect(groupMenuGroup, SIGNAL(triggered(QAction*)), connect(groupMenuGroup, &QActionGroup::triggered,
this, SLOT(slotSortTriggered(QAction*))); this, &DolphinViewActionHandler::slotSortTriggered);
} else { } else {
connect(groupMenuGroup, SIGNAL(triggered(QAction*)), connect(groupMenuGroup, &QActionGroup::triggered,
this, SLOT(toggleVisibleRole(QAction*))); this, &DolphinViewActionHandler::toggleVisibleRole);
} }
} }
@ -312,7 +312,7 @@ void DolphinViewActionHandler::slotRename()
m_currentView->renameSelectedItems(); m_currentView->renameSelectedItems();
} }
void DolphinViewActionHandler::slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers modifiers) void DolphinViewActionHandler::slotTrashActivated()
{ {
emit actionBeingHandled(); emit actionBeingHandled();
m_currentView->trashSelectedItems(); m_currentView->trashSelectedItems();

View file

@ -112,7 +112,7 @@ private Q_SLOTS:
* Moves the selected items of the active view to the trash. * Moves the selected items of the active view to the trash.
* This methods adds "shift means del" handling. * This methods adds "shift means del" handling.
*/ */
void slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers); void slotTrashActivated();
/** /**
* Deletes the selected items of the active view. * Deletes the selected items of the active view.

View file

@ -84,7 +84,7 @@ RenameDialog::RenameDialog(QWidget *parent, const KFileItemList& items) :
} }
m_lineEdit = new KLineEdit(page); 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(); int selectionLength = m_newName.length();
if (m_renameOneItem) { if (m_renameOneItem) {

View file

@ -76,8 +76,8 @@ FileMetaDataToolTip::FileMetaDataToolTip(QWidget* parent) :
#endif #endif
m_fileMetaDataWidget->setForegroundRole(QPalette::ToolTipText); m_fileMetaDataWidget->setForegroundRole(QPalette::ToolTipText);
m_fileMetaDataWidget->setReadOnly(true); m_fileMetaDataWidget->setReadOnly(true);
connect(m_fileMetaDataWidget, SIGNAL(metaDataRequestFinished(KFileItemList)), connect(m_fileMetaDataWidget, &KFileMetaDataWidget::metaDataRequestFinished,
this, SIGNAL(metaDataRequestFinished(KFileItemList))); this, &FileMetaDataToolTip::metaDataRequestFinished);
QVBoxLayout* textLayout = new QVBoxLayout(); QVBoxLayout* textLayout = new QVBoxLayout();
textLayout->addWidget(m_name); textLayout->addWidget(m_name);

View file

@ -52,12 +52,12 @@ ToolTipManager::ToolTipManager(QWidget* parent) :
m_showToolTipTimer = new QTimer(this); m_showToolTipTimer = new QTimer(this);
m_showToolTipTimer->setSingleShot(true); m_showToolTipTimer->setSingleShot(true);
m_showToolTipTimer->setInterval(500); 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 = new QTimer(this);
m_contentRetrievalTimer->setSingleShot(true); m_contentRetrievalTimer->setSingleShot(true);
m_contentRetrievalTimer->setInterval(200); 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()); 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. // meta data retrieval, when passing rapidly over a lot of items.
Q_ASSERT(!m_fileMetaDataToolTip); Q_ASSERT(!m_fileMetaDataToolTip);
m_fileMetaDataToolTip = new FileMetaDataToolTip(); m_fileMetaDataToolTip = new FileMetaDataToolTip();
connect(m_fileMetaDataToolTip, SIGNAL(metaDataRequestFinished(KFileItemList)), connect(m_fileMetaDataToolTip, &FileMetaDataToolTip::metaDataRequestFinished,
this, SLOT(slotMetaDataRequestFinished())); this, &ToolTipManager::slotMetaDataRequestFinished);
m_contentRetrievalTimer->start(); m_contentRetrievalTimer->start();
m_showToolTipTimer->start(); m_showToolTipTimer->start();
@ -136,10 +136,10 @@ void ToolTipManager::startContentRetrieval()
KJobWidgets::setWindow(job, qApp->activeWindow()); KJobWidgets::setWindow(job, qApp->activeWindow());
} }
connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)), connect(job, &KIO::PreviewJob::gotPreview,
this, SLOT(setPreviewPix(KFileItem,QPixmap))); this, &ToolTipManager::setPreviewPix);
connect(job, SIGNAL(failed(KFileItem)), connect(job, &KIO::PreviewJob::failed,
this, SLOT(previewFailed())); this, &ToolTipManager::previewFailed);
} }

View file

@ -52,8 +52,8 @@ VersionControlObserver::VersionControlObserver(QObject* parent) :
m_dirVerificationTimer = new QTimer(this); m_dirVerificationTimer = new QTimer(this);
m_dirVerificationTimer->setSingleShot(true); m_dirVerificationTimer->setSingleShot(true);
m_dirVerificationTimer->setInterval(500); m_dirVerificationTimer->setInterval(500);
connect(m_dirVerificationTimer, SIGNAL(timeout()), connect(m_dirVerificationTimer, &QTimer::timeout,
this, SLOT(verifyDirectory())); this, &VersionControlObserver::verifyDirectory);
} }
VersionControlObserver::~VersionControlObserver() VersionControlObserver::~VersionControlObserver()
@ -67,19 +67,19 @@ VersionControlObserver::~VersionControlObserver()
void VersionControlObserver::setModel(KFileItemModel* model) void VersionControlObserver::setModel(KFileItemModel* model)
{ {
if (m_model) { if (m_model) {
disconnect(m_model, SIGNAL(itemsInserted(KItemRangeList)), disconnect(m_model, &KFileItemModel::itemsInserted,
this, SLOT(delayedDirectoryVerification())); this, &VersionControlObserver::delayedDirectoryVerification);
disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)), disconnect(m_model, &KFileItemModel::itemsChanged,
this, SLOT(delayedDirectoryVerification())); this, &VersionControlObserver::delayedDirectoryVerification);
} }
m_model = model; m_model = model;
if (model) { if (model) {
connect(m_model, SIGNAL(itemsInserted(KItemRangeList)), connect(m_model, &KFileItemModel::itemsInserted,
this, SLOT(delayedDirectoryVerification())); this, &VersionControlObserver::delayedDirectoryVerification);
connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)), connect(m_model, &KFileItemModel::itemsChanged,
this, SLOT(delayedDirectoryVerification())); this, &VersionControlObserver::delayedDirectoryVerification);
} }
} }
@ -159,18 +159,18 @@ void VersionControlObserver::verifyDirectory()
if (m_plugin) { if (m_plugin) {
KVersionControlPlugin2* pluginV2 = qobject_cast<KVersionControlPlugin2*>(m_plugin); KVersionControlPlugin2* pluginV2 = qobject_cast<KVersionControlPlugin2*>(m_plugin);
if (pluginV2) { if (pluginV2) {
connect(pluginV2, SIGNAL(itemVersionsChanged()), connect(pluginV2, &KVersionControlPlugin2::itemVersionsChanged,
this, SLOT(silentDirectoryVerification())); this, &VersionControlObserver::silentDirectoryVerification);
} else { } else {
connect(m_plugin, SIGNAL(versionStatesChanged()), connect(m_plugin, &KVersionControlPlugin::versionStatesChanged,
this, SLOT(silentDirectoryVerification())); this, &VersionControlObserver::silentDirectoryVerification);
} }
connect(m_plugin, SIGNAL(infoMessage(QString)), connect(m_plugin, &KVersionControlPlugin::infoMessage,
this, SIGNAL(infoMessage(QString))); this, &VersionControlObserver::infoMessage);
connect(m_plugin, SIGNAL(errorMessage(QString)), connect(m_plugin, &KVersionControlPlugin::errorMessage,
this, SIGNAL(errorMessage(QString))); this, &VersionControlObserver::errorMessage);
connect(m_plugin, SIGNAL(operationCompletedMessage(QString)), connect(m_plugin, &KVersionControlPlugin::operationCompletedMessage,
this, SIGNAL(operationCompletedMessage(QString))); this, &VersionControlObserver::operationCompletedMessage);
if (!m_versionedDirectory) { if (!m_versionedDirectory) {
m_versionedDirectory = true; m_versionedDirectory = true;
@ -242,10 +242,10 @@ void VersionControlObserver::updateItemStates()
emit infoMessage(i18nc("@info:status", "Updating version information...")); emit infoMessage(i18nc("@info:status", "Updating version information..."));
} }
m_updateItemStatesThread = new UpdateItemStatesThread(m_plugin, itemStates); m_updateItemStatesThread = new UpdateItemStatesThread(m_plugin, itemStates);
connect(m_updateItemStatesThread, SIGNAL(finished()), connect(m_updateItemStatesThread, &UpdateItemStatesThread::finished,
this, SLOT(slotThreadFinished())); this, &VersionControlObserver::slotThreadFinished);
connect(m_updateItemStatesThread, SIGNAL(finished()), connect(m_updateItemStatesThread, &UpdateItemStatesThread::finished,
m_updateItemStatesThread, SLOT(deleteLater())); m_updateItemStatesThread, &UpdateItemStatesThread::deleteLater);
m_updateItemStatesThread->start(); // slotThreadFinished() is called when finished m_updateItemStatesThread->start(); // slotThreadFinished() is called when finished
} }