Bugfix for konqueror for in dolphin: open in new tab/window opens one of the selected files

Eduardo Robles Elvira edulix at gmail.com
Sun Mar 2 11:21:42 GMT 2008


Hello people,

If in konqueror you select a bunch of items, right click them and select "Open 
in new tab/window", it opens only one of them. The one in which you riht 
clicked.

The problem was in void DolphinPart::slotOpenContextMenu(const KFileItem& 
_item, const KUrl&) as David Faure noticed. Here the signal 
m_extension->popupMenu() is emitted, and that's the one caught by konqueror. 
But in the KFileItemList sent with that signal there's only the fileItem 
received in the slotOpenContextMenu by the argument.

We could have two solutions: 
a) modify dolphin code to call to that signal with the list of selected files 
instead of the right clicked file.

But it turns out that the signal calling to our slot is also received by 
dolphinview, which in turns calls to DolphinViewContainer::openContextMenu(), 
which finally creates a DolphinContextMenu.

And the context menu constructor takes as a parameter the single right clicked 
file item. And inside the constructor it gets the selected file items list 
manually and saves it to a member variable, and sometimes use the one or the 
other depending on what it needs to do. 

Fixing the DolphinContextMenu to get the selected file item list instead of 
the right clicked item would probably need a rework of DolphinContextMenu, 
and I don't think it's easy and it might end up err being a waste of time.. 
So that leads to..

b) modify slotOpenContextMenu to call the m_extension->popupMenu() signal with 
list of file items without modifying the parameter list (which will still 
have the right clicked file item instead of the selected file items list). 

This is clearly the easiest solution as it does only involve changing one line 
in the code, and does the job. What's more, it's a pretty similar approach to 
the one in DolphinContextMenu.

So the patch using the b) option is the following, can I commit?

Index: src/dolphinpart.cpp
===================================================================
--- src/dolphinpart.cpp (revisiĆ³n: 780833)
+++ src/dolphinpart.cpp (copia de trabajo)
@@ -327,7 +327,7 @@
             editActions.append(actionCollection()->action("delete"));
         actionGroups.insert("editactions", editActions);

-        KFileItemList items; items.append(item);
+        KFileItemList items = m_view->selectedItems();
         emit m_extension->popupMenu(QCursor::pos(),
                                     items,
                                     KParts::OpenUrlArguments(),

Thanks for your time,
            Eduardo Robles Elvira.

-- 
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man." (George Bernard Shaw)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20080302/e0e9c76c/attachment.sig>


More information about the kfm-devel mailing list