Commit graph

75 commits

Author SHA1 Message Date
Méven Car 3aa8cf00ee Add open containing folder options for files in recentlyused:/ 2023-09-06 14:39:15 +02:00
Serg Podtynnyi 38c34eeca3 Add clang-format and format code as in Frameworks 2023-02-05 12:45:38 +07:00
Laurent Montel 2aa64b2c38 Not use forward and includes 2022-12-26 13:22:44 +01:00
Felix Ernst b3add25694 Refactor DolphinContextMenu so its actions are retrievable
This mostly red MR should have no visible effect. It is part of my work towards !273.

There are two calls necessary to open the DolphinContextMenu:
One to construct it and one to execute/show it.

Before this commit, the actual populating of the ContextMenu was
done on execute. This meant that the actions of the ContextMenu
couldn't be looked at or changed without first showing the Menu
to the user. It also meant that the construction itself didn't
actually do much constructing/populating at all which might seem
a bit unintuitive.

This commit changes this behaviour so the DolphinContextMenu is
actually populated fully on construction. The executing/showing of
the ContextMenu now does just that and nothing more.

Previously, some actions in the context menu were actually not
wired up to anything and instead the DolphinContextMenu or the
DolphinMainWindow executed some code after the user had clicked
such a dummy action from the ContextMenu. Now all the actions are
properly constructed beforehand and no special handling is
necessary when the ContextMenu hides itself.

This commit removes the pos parameter from the DolphinContextMenu
constructor. This parameter contained the position where the Menu
would be shown later. This information isn't necessary to have on
construction and was already part of the exec(pos) call in the
first place. The variable m_pos that stored the value is removed.

This commit also removes a "customActions" functionality that can
supposedly be used to add further custom actions to the
DolphinContextMenu but this functionality isn't ever used
anywhere so its usefulness is questionable. It also wouldn't be
difficult to re-add this functionality if it was ever required for
something.

This commit also addresses an old TODO in dolphinpart.cpp that
asked for the calls for opening the DolphinContextMenu to actually
contain the information for which items the DolphinContextMenu is
supposed to be constructed. Before this, only the item that was
directly clicked was transmitted and then DolphinContextMenu
retrieved the currently selected set of items by itself.
It makes more sense that DolphinContextMenu would be informed on
construction which items it is supposed to show context actions
for.

Most of this is necessary so we are able to show the contextual
actions anywhere else than in the ContextMenu in the future.

I am targeting 22.08 with this MR because it makes no sense to merge a refactor for the upcoming release already.
2022-04-02 17:00:58 +00:00
Alexander Lohnau 30299e00b1 Reuse KFileItemActions instance during lifetime of dolphin
With https://invent.kde.org/frameworks/kio/-/merge_requests/411 the
plugin instances can be reused during the lifetime of the
KFileItemActions object. This improves performance and also allows
the plugins to emit errors, even if they run async.
2021-07-04 20:33:48 +00:00
Derek Christ dc3beae3ab Fix shift-action modifier in context menu
Before this patch, the shift-action modifier in context menus did not
work when a sub-context menu is open, that does not have the main
context menu as its parent.
The new fix installs an event filter on QApplication whenever a new
context menu is opened to make the context menu aware of shift-presses
even when a sub-context menu is in focus.

BUG: 425997
FIXED-IN: 21.04
2021-06-22 08:53:55 +00:00
Derek Christ 9e4642d435 Fix delete action switching via 'Shift' when sub-context-menu is open
Switching the 'Move to Trash' action to 'Delete' using the shift key
does not work when the mouse hovers a submenu. This fix resolves the
issue by using an event filter instead of the key event functions.

BUG: 425997
2020-11-23 22:07:31 +00:00
Alexander Lohnau c3b238bbe9 Move repetitive contextmenu related logic in one place
This makes a bit easier to handle the stuff.
Also we don't need the `addVersionControlPluginActions` utility method
and we can put it in the new utility method instead.
2020-11-23 21:58:36 +00:00
Elvis Angelaccio 954e8c4790 Output of licensedigger + manual cleanup afterwards.
Unfortunately licensedigger does not strip the trailing * characters.
While at it, use a common style for all source files.
2020-08-25 17:07:38 +00:00
Méven Car 8b0c12a59c Refactoring to reduce size of openItemContextMenu and add the ContextType TimelineOrSearchContext
Reviewers: #dolphin, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D25615
2019-12-02 13:24:36 +01:00
Nathaniel Graham b9143a55a7 Move "Open" actions to the top of the context menu for files
Summary:
This patch moves the "Open", "Open With", and "Open in" items to the top of the context menu to reap the following benefits:
- Move the "Open" and "Open With" items closer to the top since they're commonly used items, and right now they're buried in the middle of the menu
- Group related functionality
- Consistency with other common platforms (macOS Finder and Windows Explorer both have these items at the top of the context menu)

For folders, the "Open With" entries are moved higher, but not all the way to the top, since the "open in New tab/folder" entries are more useful.

Test Plan:
Tested all menu items in the context menu for files, folders, and links; all still work.

Context menu for single file:
{F5806809}

Context menu for multiple files:
{F5806810}

Context menu for single folder:
{F5806811}

Context menu for multiple folders:
{F5806812}

Context menu for symlink to folder:
{F5806815}

Reviewers: #dolphin, #vdg, elvisangelaccio, abetts

Reviewed By: #dolphin, #vdg, elvisangelaccio, abetts

Subscribers: markg, abetts, elvisangelaccio

Differential Revision: https://phabricator.kde.org/D11884
2018-04-22 09:40:50 -06:00
Roman Inflianskas 48b58f830a Remove unused #include
Summary: I used CLion inspection to hunt all unused #include

Reviewers: #dolphin, elvisangelaccio, markg

Reviewed By: #dolphin, elvisangelaccio, markg

Subscribers: bcooksley, markg, elvisangelaccio, #dolphin

Differential Revision: https://phabricator.kde.org/D10985
2018-03-04 21:00:47 +03:00
Kevin Funk 464b13f382 Modernize: Use override where possible
Also use override instead of Q_DECL_OVERRIDE
2017-11-20 23:25:48 +01:00
Elvis Angelaccio a2f9e005a5 Drop unnecessary method 2017-06-06 19:16:34 +02:00
David Faure f54174f9f6 Popupmenu: use KIO 5.27's new addPluginActionsTo method
REVIEW: 129085
2016-10-02 22:28:03 +02:00
Emmanuel Pescosta 50c0aa3b07 Port KonqCopyToMenu to KFileCopyToMenu 2015-02-04 08:56:17 +01:00
Lukáš Tinkl 037d5db85b Q_DECL_OVERRIDE 2014-11-03 23:52:18 +01:00
Lukáš Tinkl 1b4572dac9 port Dolphin from KUrl to QUrl
REVIEW: 120688
2014-10-21 21:19:14 +02:00
Montel Laurent 0a6257bce3 Fix includes 2014-10-18 15:00:17 +02:00
Montel Laurent 6f6b1bbb69 Clean includes + port to QMenu 2014-10-10 23:36:36 +02:00
Kai Uwe Broulik 42153e55e6 Add "Open Path" context menu action
This adds a third option to the "in new tab" and "in new window" which opens
the parent folder in the same view

BUG: 298704
FIXED-IN: 4.15
REVIEW: 110133
2014-09-09 15:31:55 +02:00
Emmanuel Pescosta a4ef4bbfde Replaced all KNewFileMenu usages in DolphinPart by DolphinNewFileMenu.
Removed all signal-slot-connections related to DolphinNewFileMenu->errorMessage(QString)
in DolphinMainWindow and DolphinContextMenu and replaced it by a better solution.

Now we make use of the already existing DolphinNewFileMenuObserver singleton class to achieve a better
error handling, because every newly created DolphinContextMenu instance registers himself by DolphinNewFileMenuObserver
and we use this to connect the errorMessage(QString) signal of every DolphinContextMenu instance to the errorMessage(QString)
signal of the DolphinNewFileMenuObserver singleton class.

So we need only one connection from DolphinNewFileMenuObserver to DolphinMainWindow (or to DolphinPart) to
collect all error messages thrown by every DolphinNewFileMenu instance.

REVIEW: 112178
2013-08-28 18:46:45 +02:00
Emmanuel Pescosta 804e83f893 Cut the ropes between DolphinMainWindow and DolphinNewFileMenu. Error handling is now done via signals.
REVIEW: 111989
2013-08-16 20:22:33 +02:00
Dawit Alemayehu d72f5d2db7 Do not show "Move To Trash" action in context menu for remote URLs.
BUG: 261762
REVIEW: 111206
FIXED-IN: 4.11
2013-06-24 22:41:53 -04:00
Dawit Alemayehu 01761798a9 - Factored out the Delete/Move To Trash action into own class.
- Updated both the Dolphin KPart and context menu to use the new
  DolphinRemoveAction class to manage "Delete/Move to Trash" actions.

See also https://git.reviewboard.kde.org/r/107509/.

REVIEW: 108802
2013-05-14 08:37:21 -04:00
David Faure 57e65aab7f Reimplement handling of Shift while showing menu without KModifierKeyInfo
Finding out whether shift is pressed initially can be done
with qApp->keyboardModifiers(), and finding out that the user is pressing
or release shift can be done with keyPressEvent/keyReleaseEvent.

This required to inherit from KMenu rather than having the KMenu
as a member.

KModifierKeyInfo is only implemented on X11, so this makes the code
more portable. If similar solutions can be found for other users of
KModifierKeyInfo, it will be deprecated in KF5.

REVIEW: 110303
2013-05-05 22:42:49 +02:00
Peter Penz a2674f5184 Provide a default name when adding a search query to the places panel
BUG: 300430
FIXED-IN: 4.9.0
2012-06-02 15:47:17 +02:00
Peter Penz b319c59b8d Allow moving items to trash also for non-local files
See bug 188032 for an ongoing discussion. In case if this behavior
is really not wanted by users (the feedback on bugs.kde.org will
show), the review-request
https://git.reviewboard.kde.org/r/104915/ should be merged too
(after adjusting some parts of the code).
2012-05-11 16:26:34 +02:00
Peter Penz a0115f912a Fix issue when deleting items with the context menu
Thanks to Jekyll Wu for the analyses of the issue!

BUG: 290307
BUG: 269096
BUG: 290954
BUG: 264583
FIXED-IN: 4.8.0
2012-01-14 20:06:05 +01:00
Peter Penz 6551c000fc Context menu cleanups
- Open the context menu on the mouse-press event, not on the
  mouse-release event.
- Provide an explicit position-information and don't use
  QCursor::pos(). This fixes the issue that opening a context-menu
  by the keyboard opens below the cursor.
- Provide different signals in the KItemListController for
  the different context-menu types (item vs. view vs. header).
- Implement turning on/off roles by the header-context-menu.
2011-10-08 21:43:55 +02:00
Peter Penz 2dcc433ab2 DolphinContextMenu: Show "Show menubar" entry if necessary
If the user has hidden the menubar and the toolbar there is no way to
get back the menu (at least not without knowing the Ctrl+M shortcut).
Show an entry in the context-menu to bring back the menubar.
2011-03-27 19:29:23 +02:00
Peter Penz 9af429cae1 Provide toolbar-menu when the menubar is hidden
Use a similar default UI like in Rekonq and other browsers: Hide the
menubar and add access to all actions by a button in the toolbar.
Of course it is still possible to show the menubar so that the same UI
is given like before.
2011-03-26 23:26:39 +01:00
Peter Penz fd74aa8e20 Update e-mail address from peter.penz@gmx.at to peter.penz19@gmail.com 2011-02-04 15:57:33 +01:00
Peter Penz 8eb9b508ca Use capitalized KDE includes 2011-02-04 15:43:21 +01:00
Peter Penz edd98d7659 - Add support for file item actions (see http://reviewboard.kde.org/r/5659/)
- Internal cleanups of DolphinContextMenu code


svn path=/trunk/KDE/kdebase/apps/; revision=1189651
2010-10-25 13:45:34 +00:00
Peter Penz 7f7bea872b If the context-menu is opened for a file shown as search result, offer the actions "Open Parent Folder in New Window" and "Open Parent Folder in New Tab"
svn path=/trunk/KDE/kdebase/apps/; revision=1178362
2010-09-22 20:24:49 +00:00
Peter Penz fcef5f7721 Use K_GLOBAL_STATIC for the previously committed workaround to bypass a X11-issue in combination with KModifierKeyInfo. Thanks to David Faure for the hint.
svn path=/trunk/KDE/kdebase/apps/; revision=1177902
2010-09-21 16:18:20 +00:00
Peter Penz c7e8c4af3d Workaround for a X11-issue in combination with KModifierKeyInfo: When constructing KModifierKeyInfo in the constructor of the context menu, the user interface might freeze. Thanks to Mark Gaiser for clarifying this with the KModifierKeyInfo maintainer and testing the workaround!
CCMAIL: markg85@gmail.com

svn path=/trunk/KDE/kdebase/apps/; revision=1177658
2010-09-20 19:52:40 +00:00
Peter Penz 23a4868dea - Fix issue, that the 'Move To Trash'-action or 'Delete'-action from the File menu get invisible
- Use KFileItemListProperties to check whether all selected URLs are local
- Coding style cleanups

CCMAIL: markg85@gmail.com

svn path=/trunk/KDE/kdebase/apps/; revision=1176534
2010-09-17 22:23:11 +00:00
Peter Penz 9a55b0d704 There is no need to burden DolphinMainWindow with internals of the context-menu.
CCMAIL: markg85@gmail.com


svn path=/trunk/KDE/kdebase/apps/; revision=1176513
2010-09-17 21:16:56 +00:00
Mark Gaiser 304e9524b6 When you view the context menu of a file/folder and shift is pressed (and the delete action line is not enabled in the settings) then the
"Move to trash (del)" action gets replaced by the "Delete (shift del)" action and replaced back to "Move to trash (del)" when you release 
shift.

BUG: 194275

svn path=/trunk/KDE/kdebase/apps/; revision=1176493
2010-09-17 19:47:01 +00:00
Peter Penz 09e1cc4d77 Context-menu cleanups:
- KNewMenu has been deprecated by KNewFileMenu. Reflect this in the names of related Dolphin classes.
- Provide context-sensitive actions also when a context-menu is opened on the viewport

BUG: 191938
FIXED-IN: 4.6.0

svn path=/trunk/KDE/kdebase/apps/; revision=1168586
2010-08-27 05:26:27 +00:00
Peter Penz edc21bc24c SVN_SILENT: renamed addRevisionControlActions() to addVersionControlActions()
svn path=/trunk/KDE/kdebase/apps/; revision=1065347
2009-12-23 08:50:58 +00:00
Harsh Chouraria J 51dc542497 BUG: 191309
Don't show 'Add to Places' context-menu action for urls already in places.


svn path=/trunk/KDE/kdebase/apps/; revision=1048149
2009-11-12 20:22:22 +00:00
Peter Penz 9340a52cf8 also provide revision control actions for the viewport-context-menu
svn path=/trunk/KDE/kdebase/apps/; revision=1001385
2009-07-23 06:10:01 +00:00
David Faure 402a17bf1f KonqFileItemCapabilities -> KFileItemListProperties
svn path=/trunk/KDE/kdebase/apps/; revision=948007
2009-04-01 23:34:33 +00:00
Peter Penz 2f47863c68 - allow the view implementations to attach custom actions to the context menu
- let the "details view" show the "[x] Expandable Folders" action in the context menu

CCMAIL: faure@kde.org

svn path=/trunk/KDE/kdebase/apps/; revision=924867
2009-02-11 20:45:12 +00:00
David Faure d6e0d332e1 Use KonqMenuActions to add the "open with" actions to the popupmenu, to avoid this independent reimplementation,
which brought back bug 121728 ('&' in application name treated as accelerator)

svn path=/trunk/KDE/kdebase/apps/; revision=815838
2008-06-02 16:36:29 +00:00
George Goldberg 0a3a481ee2 Fix the edit-menu action disabling/enabling bug in dolphinpart finally! Also, move FileItemCapabilities from dolphin to KonqFileItemCapabilities at dfaure's request (making it implicitly shared along the way).
BUGS:161594

svn path=/trunk/KDE/kdebase/apps/; revision=815584
2008-06-02 10:07:13 +00:00
Peter Penz 7d0080868b Consider the protocol and directory capabilities for file actions like Move To/Copy To (note that this is just an initial version; adjustments must also be done for the global actions like Delete, Rename etc.)
svn path=/trunk/KDE/kdebase/apps/; revision=798658
2008-04-18 19:43:16 +00:00