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)
{
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() :

View 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:

View 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()

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
// 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(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, 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(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);
}
}

View 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();

View 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.

View 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) {

View 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);

View 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);
}

View 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
}