krusader/Panel-fixed-actions-in-PanelContextMenu-ignored.patch
Luca Beltrame e0d9ef4642 Accepting request 563997 from home:wolfi323:branches:KDE:Extra
- Add Panel-fixed-actions-in-PanelContextMenu-ignored.patch to fix
  the "Create New" context menu not working when the '..' entry is
  selected (boo#1075690, kde#383544)

OBS-URL: https://build.opensuse.org/request/show/563997
OBS-URL: https://build.opensuse.org/package/show/KDE:Extra/krusader?expand=0&rev=27
2018-01-14 17:50:45 +00:00

116 lines
4.6 KiB
Diff

From 3ec61a42eaf842a4ceec11aed5cf6c6154f7cd07 Mon Sep 17 00:00:00 2001
From: Alexander Bikadorov <alex.bikadorov@kdemail.net>
Date: Sun, 20 Aug 2017 21:20:28 +0200
Subject: Panel: fixed actions in PanelContextMenu ignored if ".." is current
FIXED: [ 383544 ] Unable to create new folder/file if '..' item is selected in current folder
BUG: 383544
---
krusader/Panel/krpopupmenu.cpp | 38 +++++++++++++++++--------------------
1 file changed, 17 insertions(+), 21 deletions(-)
diff --git a/krusader/Panel/panelcontextmenu.cpp b/krusader/Panel/panelcontextmenu.cpp
index 22f05bb..241d996 100644
--- a/krusader/Panel/krpopupmenu.cpp
+++ b/krusader/Panel/krpopupmenu.cpp
@@ -320,24 +320,21 @@ void KrPopupMenu::addCreateNewMenu()
void KrPopupMenu::performAction(int id)
{
- if (_items.isEmpty())
- return; // sanity check, empty file list
-
- KFileItem *item = &_items.first();
+ const QUrl singleURL = _items.isEmpty() ? QUrl() : _items.first().url();
switch (id) {
case - 1 : // the user clicked outside of the menu
return ;
case OPEN_TAB_ID :
// assuming only 1 file is selected (otherwise we won't get here)
- panel->manager()->newTab(item->url(), panel);
+ panel->manager()->newTab(singleURL, panel);
break;
case OPEN_ID :
foreach(const KFileItem &fi, _items)
panel->func->execute(fi.name());
break;
case BROWSE_ID :
- panel->func->goInside(item->url().fileName());
+ panel->func->goInside(singleURL.fileName());
break;
case COPY_ID :
panel->func->copyFiles();
@@ -355,7 +352,7 @@ void KrPopupMenu::performAction(int id)
panel->func->deleteFiles(false);
break;
case EJECT_ID :
- krMtMan.eject(item->url().adjusted(QUrl::StripTrailingSlash).path());
+ krMtMan.eject(singleURL.adjusted(QUrl::StripTrailingSlash).path());
break;
/* case SHRED_ID :
if ( KMessageBox::warningContinueCancel( krApp,
@@ -364,13 +361,13 @@ void PanelContextMenu::performAction(int id)
KShred::shred( panel->func->files() ->getFile( item->name() ).adjusted(QUrl::RemoveTrailingSlash).path() );
break;*/
case OPEN_KONQ_ID :
- KToolInvocation::startServiceByDesktopName("konqueror", item->url().toDisplayString(QUrl::PreferLocalFile));
+ KToolInvocation::startServiceByDesktopName("konqueror", singleURL.toDisplayString(QUrl::PreferLocalFile));
break;
case CHOOSE_ID : // open-with dialog
panel->func->displayOpenWithDialog(_items.urlList());
break;
case MOUNT_ID :
- krMtMan.mount(item->url().adjusted(QUrl::StripTrailingSlash).path());
+ krMtMan.mount(singleURL.adjusted(QUrl::StripTrailingSlash).path());
break;
case NEW_LINK_ID :
panel->func->krlink(false);
@@ -388,7 +385,7 @@ void PanelContextMenu::performAction(int id)
KrTrashHandler::restoreTrashedFiles(_items.urlList());
break;
case UNMOUNT_ID :
- krMtMan.unmount(item->url().adjusted(QUrl::StripTrailingSlash).path());
+ krMtMan.unmount(singleURL.adjusted(QUrl::StripTrailingSlash).path());
break;
case COPY_CLIP_ID :
panel->func->copyToClipboard();
@@ -412,16 +409,15 @@ void KrPopupMenu::performAction(int id)
#ifdef SYNCHRONIZER_ENABLED
case SYNC_SELECTED_ID : {
QStringList selectedNames;
- foreach(const KFileItem &item, _items)
- selectedNames << item.name();
- if (panel->otherPanel()->view->numSelected()) {
- KrViewItemList otherItems;
- panel->otherPanel()->view->getSelectedKrViewItems(&otherItems);
-
- for (KrViewItemList::Iterator it2 = otherItems.begin(); it2 != otherItems.end(); ++it2) {
- QString name = (*it2) ->name();
- if (!selectedNames.contains(name))
- selectedNames.append(name);
+ for (const KFileItem item : _items) {
+ selectedNames.append(item.name());
+ }
+ KrViewItemList otherItems;
+ panel->otherPanel()->view->getSelectedKrViewItems(&otherItems);
+ for (KrViewItem *otherItem : otherItems) {
+ const QString name = otherItem->name();
+ if (!selectedNames.contains(name)) {
+ selectedNames.append(name);
}
}
SLOTS->slotSynchronizeDirs(selectedNames);
@@ -429,7 +425,7 @@ void KrPopupMenu::performAction(int id)
break;
#endif
case OPEN_TERM_ID :
- SLOTS->runTerminal(item->url().path());
+ SLOTS->runTerminal(singleURL.path());
break;
}
--
cgit v0.11.2