Changeset View
Changeset View
Standalone View
Standalone View
src/kmoretools/kmoretoolspresets.cpp
Show All 22 Lines | |||||
23 | 23 | | |||
24 | #include <KNS3/KMoreTools> | 24 | #include <KNS3/KMoreTools> | ||
25 | 25 | | |||
26 | #define _ QStringLiteral | 26 | #define _ QStringLiteral | ||
27 | 27 | | |||
28 | class KmtServiceInfo | 28 | class KmtServiceInfo | ||
29 | { | 29 | { | ||
30 | public: | 30 | public: | ||
31 | KmtServiceInfo(const QString &desktopEntryName, const QString &homepageUrl, int maxUrlArgCount) | 31 | KmtServiceInfo(const QString &desktopEntryName, const QString &homepageUrl, int maxUrlArgCount, const QString &appstreamId) | ||
32 | : desktopEntryName(desktopEntryName), homepageUrl(homepageUrl), maxUrlArgCount(maxUrlArgCount) | 32 | : desktopEntryName(desktopEntryName), homepageUrl(homepageUrl), maxUrlArgCount(maxUrlArgCount), appstreamId(appstreamId) | ||
33 | { | 33 | { | ||
34 | } | 34 | } | ||
35 | public: | 35 | public: | ||
36 | QString desktopEntryName; | 36 | QString desktopEntryName; | ||
37 | QString homepageUrl; | 37 | QString homepageUrl; | ||
38 | int maxUrlArgCount; | 38 | int maxUrlArgCount; | ||
39 | QString appstreamId; | ||||
39 | }; | 40 | }; | ||
40 | 41 | | |||
41 | // | 42 | // | ||
42 | // todo later: add a property "maturity" with values "stable" > "new" > "incubating" or similar | 43 | // todo later: add a property "maturity" with values "stable" > "new" > "incubating" or similar | ||
43 | // | 44 | // | ||
44 | KMoreToolsService* KMoreToolsPresets::registerServiceByDesktopEntryName(KMoreTools* kmt, const QString& desktopEntryName) | 45 | KMoreToolsService* KMoreToolsPresets::registerServiceByDesktopEntryName(KMoreTools* kmt, const QString& desktopEntryName) | ||
45 | { | 46 | { | ||
46 | static QHash<QString, KmtServiceInfo> dict; | 47 | static QHash<QString, KmtServiceInfo> dict; | ||
47 | 48 | | |||
48 | #define ADD_ENTRY(desktopEntryName, maxUrlArgCount, homepageUrl) dict.insert(desktopEntryName, KmtServiceInfo(desktopEntryName, QLatin1String(homepageUrl), maxUrlArgCount)); | 49 | #define ADD_ENTRY(desktopEntryName, maxUrlArgCount, homepageUrl, appstreamUrl) dict.insert(desktopEntryName, KmtServiceInfo(desktopEntryName, QLatin1String(homepageUrl), maxUrlArgCount, appstreamUrl)); | ||
49 | 50 | | |||
50 | // | 51 | // | ||
51 | // definitions begin (sorted alphabetically): | 52 | // definitions begin (sorted alphabetically): | ||
52 | // .------ If one gives more URL arguments as | 53 | // .------ If one gives more URL arguments as | ||
53 | // | specified here the program will not work. | 54 | // | specified here the program will not work. | ||
54 | // | Note, that there are some desktop files where _too few_ | 55 | // | Note, that there are some desktop files where _too few_ | ||
55 | // | arguments also lead to errors. Watch the console | 56 | // | arguments also lead to errors. Watch the console | ||
56 | // v output for messages from the program. | 57 | // v output for messages from the program. | ||
57 | // | 58 | // | ||
58 | ADD_ENTRY("angrysearch", 0, "https://github.com/DoTheEvo/ANGRYsearch"); | 59 | ADD_ENTRY("angrysearch", 0, "https://github.com/DoTheEvo/ANGRYsearch", ""); | ||
59 | ADD_ENTRY("com.uploadedlobster.peek", 0, "https://github.com/phw/peek"); // easy to use screen recorder, creates gif | 60 | ADD_ENTRY("com.uploadedlobster.peek", 0, "https://github.com/phw/peek", "com.uploadedlobster.peek.desktop"); // easy to use screen recorder, creates gif | ||
ngraham: `com.uploadedlobster.peek.desktop`
https://github.com/phw/peek/blob/master/data/com. | |||||
60 | ADD_ENTRY("catfish", 1, "http://www.twotoasts.de/index.php/catfish/"); | 61 | ADD_ENTRY("catfish", 1, "http://www.twotoasts.de/index.php/catfish/", "catfish"); | ||
ngraham: `catfish`
https://git.launchpad.net/catfish-search/tree/data/metainfo/catfish.appdata.xml.in#n4 | |||||
61 | ADD_ENTRY("ding", 0, "https://www-user.tu-chemnitz.de/~fri/ding/"); // Offline dict, Online: http://dict.tu-chemnitz.de/dings.cgi | 62 | ADD_ENTRY("ding", 0, "https://www-user.tu-chemnitz.de/~fri/ding/", ""); // Offline dict, Online: http://dict.tu-chemnitz.de/dings.cgi | ||
62 | ADD_ENTRY("disk", 0, "https://en.opensuse.org/YaST_Disk_Controller"); | 63 | ADD_ENTRY("disk", 0, "https://en.opensuse.org/YaST_Disk_Controller", ""); | ||
63 | ADD_ENTRY("fontinst", 0, "https://docs.kde.org/trunk5/en/kde-workspace/kcontrol/fontinst/"); // good for previewing many fonts at once | 64 | ADD_ENTRY("fontinst", 0, "https://docs.kde.org/trunk5/en/kde-workspace/kcontrol/fontinst/", ""); // good for previewing many fonts at once | ||
64 | ADD_ENTRY("fontmatrix", 0, "https://github.com/fontmatrix/fontmatrix"); | 65 | ADD_ENTRY("fontmatrix", 0, "https://github.com/fontmatrix/fontmatrix", ""); | ||
65 | ADD_ENTRY("fsearch", 0, "http://www.fsearch.org/"); | 66 | ADD_ENTRY("fsearch", 0, "http://www.fsearch.org/", ""); | ||
66 | ADD_ENTRY("giggle", 1, "https://wiki.gnome.org/Apps/giggle/"); // good for searching in history | 67 | ADD_ENTRY("giggle", 1, "https://wiki.gnome.org/Apps/giggle/", "giggle.desktop"); // good for searching in history | ||
67 | ADD_ENTRY("git-cola-folder-handler", 1, "https://git-cola.github.io"); | 68 | ADD_ENTRY("git-cola-folder-handler", 1, "https://git-cola.github.io", "git-cola.desktop"); | ||
ngraham: `git-cola.desktop`
https://github.com/git-cola/git-cola/blob/master/share/appdata/git-cola. | |||||
68 | ADD_ENTRY("git-cola-view-history.kmt-edition", 1, "https://git-cola.github.io"); | 69 | ADD_ENTRY("git-cola-view-history.kmt-edition", 1, "https://git-cola.github.io", "git-cola.desktop"); | ||
69 | ADD_ENTRY("gitk.kmt-edition", 1, "http://git-scm.com/docs/gitk"); | 70 | ADD_ENTRY("gitk.kmt-edition", 1, "http://git-scm.com/docs/gitk", ""); | ||
70 | ADD_ENTRY("qgit.kmt-edition", 1, "http://libre.tibirna.org/projects/qgit"); | 71 | ADD_ENTRY("qgit.kmt-edition", 1, "http://libre.tibirna.org/projects/qgit", ""); | ||
71 | ADD_ENTRY("gitg", 1, "https://wiki.gnome.org/action/show/Apps/Gitg?action=show&redirect=Gitg"); | 72 | ADD_ENTRY("gitg", 1, "https://wiki.gnome.org/action/show/Apps/Gitg?action=show&redirect=Gitg", "gitg.desktop"); | ||
ngraham: `gitg.desktop`
https://gitlab.gnome.org/GNOME/gitg/blob/master/data/gitg.appdata.xml#L3 | |||||
72 | ADD_ENTRY("gnome-search-tool", 0, "https://help.gnome.org/users/gnome-search-tool/"); // has good filtering options | 73 | ADD_ENTRY("gnome-search-tool", 0, "https://help.gnome.org/users/gnome-search-tool/", "gnome-search-tool.desktop"); // has good filtering options | ||
73 | ADD_ENTRY("gucharmap", 0, "https://wiki.gnome.org/action/show/Apps/Gucharmap"); | 74 | ADD_ENTRY("gucharmap", 0, "https://wiki.gnome.org/action/show/Apps/Gucharmap", "gucharmap.desktop"); | ||
74 | ADD_ENTRY("gparted", 0, "http://gparted.org"); | 75 | ADD_ENTRY("gparted", 0, "http://gparted.org", "gparted.desktop"); | ||
75 | ADD_ENTRY("htop", 0, "http://hisham.hm/htop/"); | 76 | ADD_ENTRY("htop", 0, "http://hisham.hm/htop/", "htop.desktop"); | ||
76 | ADD_ENTRY("hotshots", 1, "http://sourceforge.net/projects/hotshots/"); | 77 | ADD_ENTRY("hotshots", 1, "http://sourceforge.net/projects/hotshots/", ""); | ||
77 | ADD_ENTRY("kaption", 0, "http://kde-apps.org/content/show.php/?content=139302"); | 78 | ADD_ENTRY("kaption", 0, "http://kde-apps.org/content/show.php/?content=139302", ""); | ||
78 | ADD_ENTRY("kding", 0, ""); // Offline dict; unmaintained? | 79 | ADD_ENTRY("kding", 0, "", ""); // Offline dict; unmaintained? | ||
79 | ADD_ENTRY("org.kde.kmousetool", 0, "https://www.kde.org/applications/utilities/kmousetool/"); | 80 | ADD_ENTRY("org.kde.kmousetool", 0, "https://www.kde.org/applications/utilities/kmousetool/", "org.kde.kmousetool"); | ||
80 | ADD_ENTRY("org.gnome.clocks", 0, "https://wiki.gnome.org/Apps/Clocks"); | 81 | ADD_ENTRY("org.gnome.clocks", 0, "https://wiki.gnome.org/Apps/Clocks", "org.gnome.clocks.desktop"); | ||
81 | ADD_ENTRY("org.kde.filelight", 1, "https://utils.kde.org/projects/filelight"); | 82 | ADD_ENTRY("org.kde.filelight", 1, "https://utils.kde.org/projects/filelight", "org.kde.filelight.desktop"); | ||
82 | ADD_ENTRY("org.kde.kcharselect", 0, "https://utils.kde.org/projects/kcharselect/"); | 83 | ADD_ENTRY("org.kde.kcharselect", 0, "https://utils.kde.org/projects/kcharselect/", "org.kde.kcharselect"); | ||
83 | ADD_ENTRY("org.kde.kdf", 0, "https://www.kde.org/applications/system/kdiskfree"); | 84 | ADD_ENTRY("org.kde.kdf", 0, "https://www.kde.org/applications/system/kdiskfree", "org.kde.kdf"); | ||
84 | ADD_ENTRY("org.kde.kfind", 1, "https://www.kde.org/applications/utilities/kfind/"); // has good filtering options | 85 | ADD_ENTRY("org.kde.kfind", 1, "https://www.kde.org/applications/utilities/kfind/", "org.kde.kfind.desktop"); // has good filtering options | ||
85 | ADD_ENTRY("org.kde.partitionmanager", 0, "https://www.kde.org/applications/system/kdepartitionmanager/"); | 86 | ADD_ENTRY("org.kde.partitionmanager", 0, "https://www.kde.org/applications/system/kdepartitionmanager/", "org.kde.partitionmanager.desktop"); | ||
86 | ADD_ENTRY("org.kde.plasma.cuttlefish.kmt-edition", 0, "http://vizzzion.org/blog/2015/02/say-hi-to-cuttlefish/"); | 87 | ADD_ENTRY("org.kde.plasma.cuttlefish.kmt-edition", 0, "http://vizzzion.org/blog/2015/02/say-hi-to-cuttlefish/", "org.kde.plasma.cuttlefish"); | ||
87 | ADD_ENTRY("org.kde.ksysguard", 0, "https://userbase.kde.org/KSysGuard"); | 88 | ADD_ENTRY("org.kde.ksysguard", 0, "https://userbase.kde.org/KSysGuard", "org.kde.ksysguard"); | ||
88 | ADD_ENTRY("org.kde.ksystemlog", 0, "https://www.kde.org/applications/system/ksystemlog/"); | 89 | ADD_ENTRY("org.kde.ksystemlog", 0, "https://www.kde.org/applications/system/ksystemlog/", "org.kde.ksystemlog"); | ||
89 | ADD_ENTRY("org.kde.ktimer", 0, "https://www.kde.org/applications/utilities/ktimer/"); | 90 | ADD_ENTRY("org.kde.ktimer", 0, "https://www.kde.org/applications/utilities/ktimer/", "org.kde.ktimer"); | ||
90 | ADD_ENTRY("org.kde.spectacle", 0, "https://www.kde.org/applications/graphics/spectacle"); | 91 | ADD_ENTRY("org.kde.spectacle", 0, "https://www.kde.org/applications/graphics/spectacle", "org.kde.spectacle.desktop"); | ||
91 | ADD_ENTRY("simplescreenrecorder", 0, "http://www.maartenbaert.be/simplescreenrecorder/"); | 92 | ADD_ENTRY("simplescreenrecorder", 0, "http://www.maartenbaert.be/simplescreenrecorder/", "simplescreenrecorder.desktop"); | ||
92 | ADD_ENTRY("shutter", 0, "http://shutter-project.org"); // good for edit screenshot after capture | 93 | ADD_ENTRY("shutter", 0, "http://shutter-project.org", "org.shutterproject.shutter"); // good for edit screenshot after capture | ||
org.shutterproject.shutter ngraham: `org.shutterproject.shutter`
https://bugs.launchpad.net/shutter/+bug/1739971 | |||||
93 | ADD_ENTRY("vokoscreen", 0, "https://github.com/vkohaupt/vokoscreen"); // feature-rich screen recorder | 94 | ADD_ENTRY("vokoscreen", 0, "https://github.com/vkohaupt/vokoscreen", ""); // feature-rich screen recorder | ||
94 | ADD_ENTRY("xfce4-taskmanager", 0, "http://goodies.xfce.org/projects/applications/xfce4-taskmanager"); | 95 | ADD_ENTRY("xfce4-taskmanager", 0, "http://goodies.xfce.org/projects/applications/xfce4-taskmanager", "xfce4-taskmanager.desktop"); | ||
I have these thoughts when I see the ADD_ENTRY lines:
ADD_ENTRY("catfish", 1, "http://www.twotoasts.de/index.php/catfish/", "appstream://catfish"); ADD_ENTRY("giggle", 1, "https://wiki.gnome.org/Apps/giggle/", "appstream://giggle.desktop"); But in the end this is only cosmetics and not required to land this patch. gregormi: I have these thoughts when I see the ADD_ENTRY lines:
1. Appstream data is _the_ important… | |||||
95 | // | 96 | // | ||
96 | // ...definitions end | 97 | // ...definitions end | ||
97 | // | 98 | // | ||
98 | 99 | | |||
99 | #undef ADD_ENTRY | 100 | #undef ADD_ENTRY | ||
100 | 101 | | |||
101 | auto iter = dict.constFind(desktopEntryName); | 102 | auto iter = dict.constFind(desktopEntryName); | ||
102 | if (iter != dict.constEnd()) { | 103 | if (iter != dict.constEnd()) { | ||
103 | auto kmtServiceInfo = *iter; | 104 | auto kmtServiceInfo = *iter; | ||
104 | const QString subdir = QStringLiteral("presets-kmoretools"); | 105 | const QString subdir = QStringLiteral("presets-kmoretools"); | ||
105 | auto serviceLocatingMode = desktopEntryName.endsWith(QLatin1String(".kmt-edition")) ? | 106 | auto serviceLocatingMode = desktopEntryName.endsWith(QLatin1String(".kmt-edition")) ? | ||
106 | KMoreTools::ServiceLocatingMode_ByProvidedExecLine : KMoreTools::ServiceLocatingMode_Default; | 107 | KMoreTools::ServiceLocatingMode_ByProvidedExecLine : KMoreTools::ServiceLocatingMode_Default; | ||
107 | auto service = kmt->registerServiceByDesktopEntryName(desktopEntryName, subdir, serviceLocatingMode); | 108 | auto service = kmt->registerServiceByDesktopEntryName(desktopEntryName, subdir, serviceLocatingMode); | ||
108 | if (service) { // We might get nullptr in case of missing or broken .desktop files | 109 | if (service) { // We might get nullptr in case of missing or broken .desktop files | ||
109 | service->setHomepageUrl(QUrl(kmtServiceInfo.homepageUrl)); | 110 | service->setHomepageUrl(QUrl(kmtServiceInfo.homepageUrl)); | ||
110 | service->setMaxUrlArgCount(kmtServiceInfo.maxUrlArgCount); | 111 | service->setMaxUrlArgCount(kmtServiceInfo.maxUrlArgCount); | ||
112 | service->setAppstreamId(kmtServiceInfo.appstreamId); | ||||
111 | } | 113 | } | ||
112 | return service; | 114 | return service; | ||
113 | } else { | 115 | } else { | ||
114 | qCDebug(KNEWSTUFF) << "KMoreToolsPresets::registerServiceByDesktopEntryName: " << desktopEntryName << "was not found. Return nullptr."; | 116 | qCDebug(KNEWSTUFF) << "KMoreToolsPresets::registerServiceByDesktopEntryName: " << desktopEntryName << "was not found. Return nullptr."; | ||
115 | return nullptr; | 117 | return nullptr; | ||
116 | } | 118 | } | ||
117 | } | 119 | } | ||
118 | 120 | | |||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |
com.uploadedlobster.peek.desktop
https://github.com/phw/peek/blob/master/data/com.uploadedlobster.peek.appdata.xml.in