X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/01761798a93bc93f3e16f8fb68fe5739ab66d98b..c03e7a3272772fb10204e338124bc918742653ac:/src/dolphinpart.cpp diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index 642b15013..fc7b74dc0 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -58,6 +58,7 @@ #include #include #include +#include K_PLUGIN_FACTORY(DolphinPartFactory, registerPlugin();) K_EXPORT_PLUGIN(DolphinPartFactory("dolphinpart", "dolphin")) @@ -355,7 +356,8 @@ void DolphinPart::slotRequestItemInfo(const KFileItem& item) if (item.isNull()) { updateStatusBar(); } else { - ReadOnlyPart::setStatusBarText(item.getStatusBarInfo()); + const QString escapedText = Qt::escape(item.getStatusBarInfo()); + ReadOnlyPart::setStatusBarText(QString("%1").arg(escapedText)); } } @@ -426,10 +428,27 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos, editActions += customActions; if (!_item.isNull()) { // only for context menu on one or more items - bool supportsDeleting = capabilities.supportsDeleting(); - bool supportsMoving = capabilities.supportsMoving(); - - if (!supportsDeleting) { + const bool supportsMoving = capabilities.supportsMoving(); + + if (capabilities.supportsDeleting()) { + const bool showDeleteAction = (KGlobal::config()->group("KDE").readEntry("ShowDeleteCommand", false) || + !item.isLocalFile()); + const bool showMoveToTrashAction = capabilities.isLocal() && supportsMoving; + + if (showDeleteAction && showMoveToTrashAction) { + delete m_removeAction; + m_removeAction = 0; + editActions.append(actionCollection()->action("move_to_trash")); + editActions.append(actionCollection()->action("delete")); + } else if (showDeleteAction && !showMoveToTrashAction) { + editActions.append(actionCollection()->action("delete")); + } else { + if (!m_removeAction) + m_removeAction = new DolphinRemoveAction(this, actionCollection()); + editActions.append(m_removeAction); + m_removeAction->update(); + } + } else { popupFlags |= KParts::BrowserExtension::NoDeletion; } @@ -437,35 +456,6 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos, editActions.append(actionCollection()->action("rename")); } - bool addTrash = capabilities.isLocal() && supportsMoving; - bool addDel = false; - if (supportsDeleting) { - if ( !item.isLocalFile() ) - addDel = true; - else if (QApplication::keyboardModifiers() & Qt::ShiftModifier) { - addTrash = false; - addDel = true; - } - else { - KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals); - KConfigGroup configGroup(globalConfig, "KDE"); - addDel = configGroup.readEntry("ShowDeleteCommand", false); - } - } - - if (!addTrash || !addDel) { - if (!m_removeAction) { - m_removeAction = new DolphinRemoveAction(this, actionCollection()); - } - editActions.append(m_removeAction); - m_removeAction->update(); - } else { - delete m_removeAction; - m_removeAction = 0; - editActions.append(actionCollection()->action("move_to_trash")); - editActions.append(actionCollection()->action("delete")); - } - // Normally KonqPopupMenu only shows the "Create new" submenu in the current view // since otherwise the created file would not be visible. // But in treeview mode we should allow it.