Pass application name and icon to KRun
ClosedPublic

Authored by broulik on Feb 27 2017, 4:07 PM.

Details

Summary

Otherwise this results in the generic executable icon as bouncy cursor.

Test Plan

Is there some KRun magic to improve this, some way to get the "self" service?

  • Pressed Ctrl+N, got a new Dolphin window and during loading now the Dolphin icon as bouncing cursor (is it intentional that open new windows opens on start page and not "clones" the current window?)
  • Right clicked a folder, chose "open in new window", it opened fine and during it now the Dolphin icon as bouncing cursor
  • Searched for a file, chose "open path in new window", it opened fine and during it now the Dolphin icon as bouncing cursor
  • Chose "Open containing folder" in Krunner, invoked OpenFileManagerWindowJob which now also shows Dolphin icon during loading

I also tried using KIO::iconForUrl for the URL when opening but that usually resulted in a black and white symbolic icon which looked horrible, although it would have been cool if doing open containing folder for a downloaded file would show the folder-download icon while opening it. :)

Diff Detail

Repository
R318 Dolphin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Feb 27 2017, 4:07 PM
dfaure edited edge metadata.Mar 4 2017, 9:17 AM

Seems like a valid fix.

BTW KAboutData::applicationData().displayName() is also qApp->applicationDisplayName(), which seems better (no need to depend on KAboutData just for that).

The other way is KService::serviceByDesktopName("org.kde.dolphin") and KRun::runService.
Technically it has the advantage of using kdeinit5 unlike the KRun::run solution (but these days this matters less I suppose).
It has the disadvantage that it breaks if someone removes org.kde.dolphin.desktop completely, but that's not really a valid use case (when you remove installed files stuff breaks, duh).

Nice!

Can you please add a new function to global.h which encapsulates all this?
Maybe "Dolphin::openNewWindow(urls, flags = None)"

broulik updated this revision to Diff 12259.Mar 7 2017, 11:42 AM
  • Introduce Dolphin::openNewWindow
  • Use qApp applicationDisplayName() (I didn't find it because I was only looking for displayName without the prefix ;)
emmanuelp requested changes to this revision.Mar 7 2017, 1:18 PM

Nice work! :)

src/global.cpp
50

QList -> QVector

62

QWidget::window() instead the additional window argument?

src/global.h
43

0 -> None

This revision now requires changes to proceed.Mar 7 2017, 1:18 PM
broulik added inline comments.Mar 8 2017, 11:42 AM
src/global.cpp
50

I did that deliberately so I can pass it to KRun verbatim

62

?

emmanuelp added inline comments.Mar 8 2017, 1:37 PM
src/global.cpp
50

Makes sense!

62

Ah what I actually meant is QApplication::activeWindow(), sorry.
This allows us to remove the window argument from the openNewWindow function.

dfaure added inline comments.Mar 8 2017, 1:39 PM
src/global.cpp
62

activeWindow is a bit fragile IMHO. It could be anything, including a "new folder" dialog or an error messagebox or whatever else. That would be a weird parent for any new error messageboxes from KRun.

emmanuelp accepted this revision.Mar 8 2017, 1:42 PM
emmanuelp added inline comments.
src/global.cpp
62

Ok you are right, let's keep it that way.

This revision is now accepted and ready to land.Mar 8 2017, 1:42 PM
This revision was automatically updated to reflect the committed changes.