X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/72ddf319b6dfbd117dee69d3f1eba964b5fb7f22..11e2b186af64e5a962f5020be100eafc28e50e18:/src/dolphinpart.cpp diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index ef9b300ca..c8bc8b647 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -60,8 +60,8 @@ K_PLUGIN_FACTORY(DolphinPartFactory, registerPlugin();) DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantList& args) : KParts::ReadOnlyPart(parent) - ,m_openTerminalAction(0) - ,m_removeAction(0) + ,m_openTerminalAction(nullptr) + ,m_removeAction(nullptr) { Q_UNUSED(args) setComponentData(*createAboutData(), false); @@ -253,8 +253,8 @@ void DolphinPart::slotSelectionChanged(const KFileItemList& selection) { const bool hasSelection = !selection.isEmpty(); - QAction* renameAction = actionCollection()->action(QStringLiteral("rename")); - QAction* moveToTrashAction = actionCollection()->action(QStringLiteral("move_to_trash")); + QAction* renameAction = actionCollection()->action(KStandardAction::name(KStandardAction::RenameFile)); + QAction* moveToTrashAction = actionCollection()->action(KStandardAction::name(KStandardAction::MoveToTrash)); QAction* deleteAction = actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile)); QAction* editMimeTypeAction = actionCollection()->action(QStringLiteral("editMimeType")); QAction* propertiesAction = actionCollection()->action(QStringLiteral("properties")); @@ -316,7 +316,7 @@ bool DolphinPart::openUrl(const QUrl &url) QString prettyUrl = visibleUrl.toDisplayString(QUrl::PreferLocalFile); emit setWindowCaption(prettyUrl); emit m_extension->setLocationBarUrl(prettyUrl); - emit started(0); // get the wheel to spin + emit started(nullptr); // get the wheel to spin m_view->setNameFilter(m_nameFilter); m_view->setUrl(url); updatePasteAction(); @@ -431,8 +431,8 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos, if (showDeleteAction && showMoveToTrashAction) { delete m_removeAction; - m_removeAction = 0; - editActions.append(actionCollection()->action(QStringLiteral("move_to_trash"))); + m_removeAction = nullptr; + editActions.append(actionCollection()->action(KStandardAction::name(KStandardAction::MoveToTrash))); editActions.append(actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile))); } else if (showDeleteAction && !showMoveToTrashAction) { editActions.append(actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile))); @@ -447,7 +447,7 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos, } if (supportsMoving) { - editActions.append(actionCollection()->action(QStringLiteral("rename"))); + editActions.append(actionCollection()->action(KStandardAction::name(KStandardAction::RenameFile))); } // Normally KonqPopupMenu only shows the "Create new" submenu in the current view @@ -597,6 +597,7 @@ void DolphinPart::setFilesToSelect(const QList& files) bool DolphinPart::eventFilter(QObject* obj, QEvent* event) { + using ShiftState = DolphinRemoveAction::ShiftState; const int type = event->type(); if ((type == QEvent::KeyPress || type == QEvent::KeyRelease) && m_removeAction) { @@ -604,7 +605,7 @@ bool DolphinPart::eventFilter(QObject* obj, QEvent* event) if (menu && menu->parent() == m_view) { QKeyEvent* ev = static_cast(event); if (ev->key() == Qt::Key_Shift) { - m_removeAction->update(); + m_removeAction->update(type == QEvent::KeyPress ? ShiftState::Pressed : ShiftState::Released); } } }