Changeset View
Changeset View
Standalone View
Standalone View
krusader/Panel/panelcontextmenu.cpp
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | |||||
54 | #include "../FileSystem/krtrashhandler.h" | 54 | #include "../FileSystem/krtrashhandler.h" | ||
55 | #include "../MountMan/kmountman.h" | 55 | #include "../MountMan/kmountman.h" | ||
56 | #include "../UserAction/useractionpopupmenu.h" | 56 | #include "../UserAction/useractionpopupmenu.h" | ||
57 | 57 | | |||
58 | void PanelContextMenu::run(const QPoint &pos, KrPanel *panel) | 58 | void PanelContextMenu::run(const QPoint &pos, KrPanel *panel) | ||
59 | { | 59 | { | ||
60 | PanelContextMenu menu(panel); | 60 | PanelContextMenu menu(panel); | ||
61 | QAction * res = menu.exec(pos); | 61 | QAction * res = menu.exec(pos); | ||
62 | int result = -1; | 62 | int result = res && res->data().canConvert<int>() ? | ||
63 | if (res && res->data().canConvert<int>()) | 63 | res->data().toInt() : | ||
64 | result = res->data().toInt(); | 64 | -1; | ||
65 | menu.performAction(result); | 65 | menu.performAction(result); | ||
66 | } | 66 | } | ||
67 | 67 | | |||
68 | /** | 68 | /** | ||
69 | * Copied from dolphin/src/dolphincontextmenu.cpp and modified to add only compress and extract submenus. | 69 | * Copied from dolphin/src/dolphincontextmenu.cpp and modified to add only compress and extract submenus. | ||
70 | */ | 70 | */ | ||
71 | void PanelContextMenu::addCompressAndExtractPluginActions() | 71 | void PanelContextMenu::addCompressAndExtractPluginActions() | ||
72 | { | 72 | { | ||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 92 | { | |||
122 | const bool trashOnly = inTrash && protocols.count() == 1; | 122 | const bool trashOnly = inTrash && protocols.count() == 1; | ||
123 | 123 | | |||
124 | FileItem *file = files.first(); | 124 | FileItem *file = files.first(); | ||
125 | 125 | | |||
126 | // ------------ the OPEN/BROWSE option - open preferred service | 126 | // ------------ the OPEN/BROWSE option - open preferred service | ||
127 | QAction * openAct = addAction(i18n("Open/Run")); | 127 | QAction * openAct = addAction(i18n("Open/Run")); | ||
128 | openAct->setData(QVariant(OPEN_ID)); | 128 | openAct->setData(QVariant(OPEN_ID)); | ||
129 | if (!multipleSelections) { // meaningful only if one file is selected | 129 | if (!multipleSelections) { // meaningful only if one file is selected | ||
130 | KrViewItemList viewItems; | 130 | const KrViewItemList viewItems = panel->view->getSelectedKrViewItems(); | ||
131 | panel->view->getSelectedKrViewItems(&viewItems); | | |||
132 | openAct->setIcon(viewItems.first()->icon()); | 131 | openAct->setIcon(viewItems.first()->icon()); | ||
133 | openAct->setText(file->isExecutable() && !file->isDir() ? | 132 | openAct->setText(file->isExecutable() && !file->isDir() ? | ||
134 | i18n("Run") : i18n("Open")); | 133 | i18n("Run") : i18n("Open")); | ||
135 | // open in a new tab (if folder) | 134 | // open in a new tab (if folder) | ||
136 | if (file->isDir()) { | 135 | if (file->isDir()) { | ||
137 | QAction * openTab = addAction(i18n("Open in New Tab")); | 136 | QAction * openTab = addAction(i18n("Open in New Tab")); | ||
138 | openTab->setData(QVariant(OPEN_TAB_ID)); | 137 | openTab->setData(QVariant(OPEN_TAB_ID)); | ||
139 | openTab->setIcon(Icon("tab-new")); | 138 | openTab->setIcon(Icon("tab-new")); | ||
▲ Show 20 Lines • Show All 262 Lines • ▼ Show 20 Line(s) | 400 | case NEW_TEXT_FILE_ID: | |||
402 | panel->func->editNew(); | 401 | panel->func->editNew(); | ||
403 | break; | 402 | break; | ||
404 | #ifdef SYNCHRONIZER_ENABLED | 403 | #ifdef SYNCHRONIZER_ENABLED | ||
405 | case SYNC_SELECTED_ID : { | 404 | case SYNC_SELECTED_ID : { | ||
406 | QStringList selectedNames; | 405 | QStringList selectedNames; | ||
407 | for (const KFileItem& item : _items) { | 406 | for (const KFileItem& item : _items) { | ||
408 | selectedNames.append(item.name()); | 407 | selectedNames.append(item.name()); | ||
409 | } | 408 | } | ||
410 | KrViewItemList otherItems; | 409 | const KrViewItemList otherItems = panel->otherPanel()->view->getSelectedKrViewItems(); | ||
411 | panel->otherPanel()->view->getSelectedKrViewItems(&otherItems); | | |||
412 | for (KrViewItem *otherItem : otherItems) { | 410 | for (KrViewItem *otherItem : otherItems) { | ||
413 | const QString& name = otherItem->name(); | 411 | const QString& name = otherItem->name(); | ||
414 | if (!selectedNames.contains(name)) { | 412 | if (!selectedNames.contains(name)) { | ||
415 | selectedNames.append(name); | 413 | selectedNames.append(name); | ||
416 | } | 414 | } | ||
417 | } | 415 | } | ||
418 | SLOTS->slotSynchronizeDirs(selectedNames); | 416 | SLOTS->slotSynchronizeDirs(selectedNames); | ||
419 | } | 417 | } | ||
Show All 14 Lines |