X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/de3e2ae40f626c1368dfd40bace54ef3e7815833..3653c8ad6bfb21a4b098f4e89d5ff34ed6df2901:/src/dolphincontextmenu.cpp diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index cf9270fa8..f597d52e3 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -27,35 +27,28 @@ #include "dolphinremoveaction.h" #include -#include #include #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include -#include #include #include -#include -#include +#include #include -#include #include +#include #include #include -#include -#include -#include #include "views/dolphinview.h" #include "views/viewmodecontroller.h" @@ -64,7 +57,7 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent, const QPoint& pos, const KFileItem& fileInfo, const KUrl& baseUrl) : - KMenu(parent), + QMenu(parent), m_pos(pos), m_mainWindow(parent), m_fileInfo(fileInfo), @@ -129,7 +122,7 @@ void DolphinContextMenu::keyPressEvent(QKeyEvent *ev) if (m_removeAction && ev->key() == Qt::Key_Shift) { m_removeAction->update(); } - KMenu::keyPressEvent(ev); + QMenu::keyPressEvent(ev); } void DolphinContextMenu::keyReleaseEvent(QKeyEvent *ev) @@ -137,7 +130,7 @@ void DolphinContextMenu::keyReleaseEvent(QKeyEvent *ev) if (m_removeAction && ev->key() == Qt::Key_Shift) { m_removeAction->update(); } - KMenu::keyReleaseEvent(ev); + QMenu::keyReleaseEvent(ev); } void DolphinContextMenu::openTrashContextMenu() @@ -157,7 +150,13 @@ void DolphinContextMenu::openTrashContextMenu() addShowMenuBarAction(); if (exec(m_pos) == emptyTrashAction) { - KonqOperations::emptyTrash(m_mainWindow); + KIO::JobUiDelegate uiDelegate; + uiDelegate.setWindow(m_mainWindow); + if (uiDelegate.askDeleteConfirmation(QList(), KIO::JobUiDelegate::EmptyTrash, KIO::JobUiDelegate::DefaultConfirmation)) { + KIO::Job* job = KIO::emptyTrash(); + KJobWidgets::setWindow(job, m_mainWindow); + job->ui()->setAutoErrorHandlingEnabled(true); + } } } @@ -181,7 +180,9 @@ void DolphinContextMenu::openTrashItemContextMenu() selectedUrls.append(item.url()); } - KonqOperations::restoreTrashedItems(selectedUrls, m_mainWindow); + KIO::RestoreJob *job = KIO::restoreFromTrash(selectedUrls); + KJobWidgets::setWindow(job, m_mainWindow); + job->uiDelegate()->setAutoErrorHandlingEnabled(true); } } @@ -189,6 +190,7 @@ void DolphinContextMenu::openItemContextMenu() { Q_ASSERT(!m_fileInfo.isNull()); + QAction* openParentAction = 0; QAction* openParentInNewWindowAction = 0; QAction* openParentInNewTabAction = 0; QAction* addToPlacesAction = 0; @@ -224,7 +226,13 @@ void DolphinContextMenu::openItemContextMenu() } addSeparator(); - } else if (m_baseUrl.protocol().contains("search")) { + } else if (m_baseUrl.protocol().contains("search") || m_baseUrl.protocol().contains("timeline")) { + openParentAction = new QAction(QIcon::fromTheme("document-open-folder"), + i18nc("@action:inmenu", + "Open Path"), + this); + addAction(openParentAction); + openParentInNewWindowAction = new QAction(QIcon::fromTheme("window-new"), i18nc("@action:inmenu", "Open Path in New Window"), @@ -295,6 +303,8 @@ void DolphinContextMenu::openItemContextMenu() PlacesItem* item = model.createPlacesItem(text, selectedUrl); model.appendItemToGroup(item); } + } else if (activatedAction == openParentAction) { + m_command = OpenParentFolder; } else if (activatedAction == openParentInNewWindowAction) { m_command = OpenParentFolderInNewWindow; } else if (activatedAction == openParentInNewTabAction) { @@ -378,7 +388,7 @@ void DolphinContextMenu::insertDefaultItemActions(const KFileItemListProperties& // Insert 'Move to Trash' and/or 'Delete' if (properties.supportsDeleting()) { - const bool showDeleteAction = (KGlobal::config()->group("KDE").readEntry("ShowDeleteCommand", false) || + const bool showDeleteAction = (KSharedConfig::openConfig()->group("KDE").readEntry("ShowDeleteCommand", false) || !properties.isLocal()); const bool showMoveToTrashAction = (properties.isLocal() && properties.supportsMoving());