D23112: Add a event Spy for GtkFileChooser recent files

2019-08-17 Thread Méven Car
This revision was automatically updated to reflect the committed changes.
Closed by commit R161:acbc21c15622: Add a event Spy for GtkFileChooser recent 
files (authored by meven).

REPOSITORY
  R161 KActivity Manager Service

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D23112?vs=63913=63915

REVISION DETAIL
  https://phabricator.kde.org/D23112

AFFECTED FILES
  kactivitymanagerd.categories
  src/service/plugins/CMakeLists.txt
  src/service/plugins/gtk-eventspy/CMakeLists.txt
  src/service/plugins/gtk-eventspy/GtkEventSpy.cpp
  src/service/plugins/gtk-eventspy/GtkEventSpy.h
  src/service/plugins/gtk-eventspy/kactivitymanagerd-plugin-gtk-eventspy.json

To: meven, #frameworks, ivan
Cc: bruns, ngraham, broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, 
jraleigh, fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-17 Thread Méven Car
meven updated this revision to Diff 63913.
meven added a comment.


  Reduce the amount of included code and linked libraries

REPOSITORY
  R161 KActivity Manager Service

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D23112?vs=63890=63913

BRANCH
  arcpatch-D23112

REVISION DETAIL
  https://phabricator.kde.org/D23112

AFFECTED FILES
  kactivitymanagerd.categories
  src/service/plugins/CMakeLists.txt
  src/service/plugins/gtk-eventspy/CMakeLists.txt
  src/service/plugins/gtk-eventspy/GtkEventSpy.cpp
  src/service/plugins/gtk-eventspy/GtkEventSpy.h
  src/service/plugins/gtk-eventspy/kactivitymanagerd-plugin-gtk-eventspy.json

To: meven, #frameworks, ivan
Cc: bruns, ngraham, broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, 
jraleigh, fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-17 Thread Méven Car
meven updated this revision to Diff 63890.
meven added a comment.


  Ensure the log category is exported, compare only chars, variable naming fix

REPOSITORY
  R161 KActivity Manager Service

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D23112?vs=63830=63890

BRANCH
  arcpatch-D23112

REVISION DETAIL
  https://phabricator.kde.org/D23112

AFFECTED FILES
  kactivitymanagerd.categories
  src/service/plugins/CMakeLists.txt
  src/service/plugins/gtk-eventspy/CMakeLists.txt
  src/service/plugins/gtk-eventspy/GtkEventSpy.cpp
  src/service/plugins/gtk-eventspy/GtkEventSpy.h
  src/service/plugins/gtk-eventspy/kactivitymanagerd-plugin-gtk-eventspy.json

To: meven, #frameworks, ivan
Cc: bruns, ngraham, broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, 
jraleigh, fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-16 Thread Stefan Brüns
bruns added inline comments.

INLINE COMMENTS

> ivan wrote in GtkEventSpy.cpp:126
> No need to compare chars with strings:
> 
>   if (!exec.isEmpty() && exec[0] == '\'' && exec.back() == '\'')

missing `QChar('\'')`, otherwise it breaks with QT_NO_CAST_FROM_ASCII

-> `if (exec.startsWith(QChar('\'') && exec.endsWith(QChar('\'')) {...`

> GtkEventSpy.cpp:144
> +// remove space and any caracter after
> +const int spaceIdex = exec.indexOf(" ");
> +if (spaceIdex != -1) {

`spaceI_n_dex`

REPOSITORY
  R161 KActivity Manager Service

REVISION DETAIL
  https://phabricator.kde.org/D23112

To: meven, #frameworks, ivan
Cc: bruns, ngraham, broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, 
jraleigh, fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-16 Thread Ivan Čukić
ivan requested changes to this revision.
ivan added a comment.
This revision now requires changes to proceed.


  Another tiny change, and I think it is ready to land. Unless someone else 
sees other issues.

INLINE COMMENTS

> GtkEventSpy.cpp:126
> +
> +if (exec.at(0) == QStringLiteral("'") && exec.at(exec.size() - 1) == 
> QStringLiteral("'")) {
> +// remove "'" caracters wrapping the command

No need to compare chars with strings:

  if (!exec.isEmpty() && exec[0] == '\'' && exec.back() == '\'')

REPOSITORY
  R161 KActivity Manager Service

REVISION DETAIL
  https://phabricator.kde.org/D23112

To: meven, #frameworks, ivan
Cc: ngraham, broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, 
fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-15 Thread Méven Car
meven updated this revision to Diff 63830.
meven added a comment.


  run uncrustify-kf5

REPOSITORY
  R161 KActivity Manager Service

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D23112?vs=63786=63830

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D23112

AFFECTED FILES
  src/service/plugins/CMakeLists.txt
  src/service/plugins/gtk-eventspy/CMakeLists.txt
  src/service/plugins/gtk-eventspy/GtkEventSpy.cpp
  src/service/plugins/gtk-eventspy/GtkEventSpy.h
  src/service/plugins/gtk-eventspy/kactivitymanagerd-plugin-gtk-eventspy.json

To: meven, #frameworks, ivan
Cc: ngraham, broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, 
fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-15 Thread Méven Car
meven updated this revision to Diff 63786.
meven marked 9 inline comments as done.
meven added a comment.


  Remove unnecessary pointer use, code formatting

REPOSITORY
  R161 KActivity Manager Service

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D23112?vs=63724=63786

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D23112

AFFECTED FILES
  src/service/plugins/CMakeLists.txt
  src/service/plugins/gtk-eventspy/CMakeLists.txt
  src/service/plugins/gtk-eventspy/GtkEventSpy.cpp
  src/service/plugins/gtk-eventspy/GtkEventSpy.h
  src/service/plugins/gtk-eventspy/kactivitymanagerd-plugin-gtk-eventspy.json

To: meven, #frameworks, ivan
Cc: ngraham, broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, 
fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-15 Thread Ivan Čukić
ivan added inline comments.

INLINE COMMENTS

> GtkEventSpy.cpp:68
> +QDateTime visited;
> +QList *applications;
> +

No need for this to be a pointer to a list. Make it just `QList 
applications`.

> GtkEventSpy.cpp:70
> +
> +Bookmark(){
> +applications = new QList();

The constructor will not be needed once `applications` stops being a pointer.

> GtkEventSpy.cpp:76
> +
> +QString Bookmark::latestApplication() const {
> +Application current = applications->first();

`{` which starts a function should be on a new line (I don't care much about 
this, but let's follow the KF5 style)

> GtkEventSpy.cpp:77-78
> +QString Bookmark::latestApplication() const {
> +Application current = applications->first();
> +for (const Application  : qAsConst(*applications)) {
> +if (app.modified > current.modified) {

When you make `applications` not to be a pointer `qAsConst` will not be needed 
as this is a `const` member function.

> GtkEventSpy.cpp:89
> +public:
> +BookmarkHandler(){
> +current = nullptr;

Replace with:

  BookmarkHandler()
  : current(nullptr)
  {
  }

> GtkEventSpy.cpp:91
> +current = nullptr;
> +marks = QList();
> +}

No need for this - marks are already default-constructed.

> GtkEventSpy.cpp:113
> +if (qName == QStringLiteral("bookmark")) {
> +current = new Bookmark();
> +current->href = QUrl(attributes.value("href"));

No need for dynamic allocation. Make it a normal variable instead of a pointer.

> GtkEventSpy.cpp:185
> +reader.setErrorHandler();
> +QXmlInputSource *source = new QXmlInputSource();
> +

No need for dynamic allocation. Make it a normal variable instead of a pointer.

> meven wrote in GtkEventSpy.cpp:143
> It is to just extract the executable name, we don't want to have an exploding 
> number of initiatingAgent for every argument and parameter that might come 
> through here.

I meant it will be a problem if someone decides to have a space in the 
executable like `my\ aweomse\ binary`. But this should not be an issue at the 
moment.

REPOSITORY
  R161 KActivity Manager Service

REVISION DETAIL
  https://phabricator.kde.org/D23112

To: meven, #frameworks, ivan
Cc: ngraham, broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, 
fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-14 Thread Méven Car
meven marked an inline comment as done.
meven added a comment.


  In D23112#511779 , @ngraham wrote:
  
  > Cool stuff. Does it handle duplicates when a file is present in both 
GTKFileChooserRecent and KActivitiesStats?
  
  
  Yes, the file url is a sort of a key, so this is fine.

REPOSITORY
  R161 KActivity Manager Service

REVISION DETAIL
  https://phabricator.kde.org/D23112

To: meven, #frameworks, ivan
Cc: ngraham, broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, 
fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-14 Thread Méven Car
meven marked 2 inline comments as done.
meven added inline comments.

INLINE COMMENTS

> ngraham wrote in kactivitymanagerd-plugin-gtk-eventspy.json:41
> Not sure you need to add translations of your own name here

This was done for Ivan so I guess the translation team fills this.

REPOSITORY
  R161 KActivity Manager Service

REVISION DETAIL
  https://phabricator.kde.org/D23112

To: meven, #frameworks, ivan
Cc: ngraham, broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, 
fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-14 Thread Méven Car
meven updated this revision to Diff 63724.
meven added a comment.


  grammar

REPOSITORY
  R161 KActivity Manager Service

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D23112?vs=63713=63724

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D23112

AFFECTED FILES
  src/service/plugins/CMakeLists.txt
  src/service/plugins/gtk-eventspy/CMakeLists.txt
  src/service/plugins/gtk-eventspy/GtkEventSpy.cpp
  src/service/plugins/gtk-eventspy/GtkEventSpy.h
  src/service/plugins/gtk-eventspy/kactivitymanagerd-plugin-gtk-eventspy.json

To: meven, #frameworks, ivan
Cc: ngraham, broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, 
fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-14 Thread Nathaniel Graham
ngraham added a comment.


  Cool stuff. Does it handle duplicates when a file is present in both 
GTKFileChooserRecent and KActivitiesStats?

INLINE COMMENTS

> kactivitymanagerd-plugin-gtk-eventspy.json:41
> +"Name[zh_CN]": "Méven Car",
> +"Name[zh_TW]": "Méven Car"
> +}

Not sure you need to add translations of your own name here

> kactivitymanagerd-plugin-gtk-eventspy.json:46
> +"Dependencies": [],
> +"Description": "Collects events from applications that uses 
> GtkFileChooser and GtkRecentManager as specified by 
> https://www.freedesktop.org/wiki/Specifications/desktop-bookmark-spec/;,
> +"EnabledByDefault": true,

that uses -> that use

REPOSITORY
  R161 KActivity Manager Service

REVISION DETAIL
  https://phabricator.kde.org/D23112

To: meven, #frameworks, ivan
Cc: ngraham, broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, 
fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-14 Thread Méven Car
meven marked 5 inline comments as done.
meven added inline comments.

INLINE COMMENTS

> ivan wrote in GtkEventSpy.cpp:143
> Let's hope commands will never have spaces in them :)

It is to just extract the executable name, we don't want to have an exploding 
number of initiatingAgent for every argument and parameter that might come 
through here.

REPOSITORY
  R161 KActivity Manager Service

REVISION DETAIL
  https://phabricator.kde.org/D23112

To: meven, #frameworks, ivan
Cc: broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, 
GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-14 Thread Méven Car
meven updated this revision to Diff 63713.
meven added a comment.


  Add const where need be, simplify KTrader query

REPOSITORY
  R161 KActivity Manager Service

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D23112?vs=63669=63713

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D23112

AFFECTED FILES
  src/service/plugins/CMakeLists.txt
  src/service/plugins/gtk-eventspy/CMakeLists.txt
  src/service/plugins/gtk-eventspy/GtkEventSpy.cpp
  src/service/plugins/gtk-eventspy/GtkEventSpy.h
  src/service/plugins/gtk-eventspy/kactivitymanagerd-plugin-gtk-eventspy.json

To: meven, #frameworks, ivan
Cc: broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, 
GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-14 Thread Méven Car
meven added a comment.


  In D23112#511354 , @ivan wrote:
  
  > Thanks for geting involved this much!
  
  
  :D

REPOSITORY
  R161 KActivity Manager Service

REVISION DETAIL
  https://phabricator.kde.org/D23112

To: meven, #frameworks, ivan
Cc: broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, 
GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-14 Thread Kai Uwe Broulik
broulik added inline comments.

INLINE COMMENTS

> GtkEventSpy.cpp:135
> +// See 
> https://techbase.kde.org/Development/Tutorials/Services/Traders#The_KTrader_Query_Language
> +QString query = QString("exist Exec and ((Exec ~~ '%1') or (exist 
> GenericName and '%1' ~~ GenericName) or (exist Name and '%1' ~~ 
> Name))").arg(exec);
> +KService::List services = 
> KServiceTypeTrader::self()->query(QStringLiteral("Application"), query);

Isn't that a bit coarse? Doesn't matching the `Exec` line exactly work?

REPOSITORY
  R161 KActivity Manager Service

REVISION DETAIL
  https://phabricator.kde.org/D23112

To: meven, #frameworks, ivan
Cc: broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, 
GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-13 Thread Ivan Čukić
ivan requested changes to this revision.
ivan added a comment.
This revision now requires changes to proceed.


  Thanks for geting involved this much!

INLINE COMMENTS

> GtkEventSpy.cpp:129
> +// remove "'" caracters wrapping the command
> +exec = exec.mid(1, exec.size() -2 );
> +

It might be dangerous to assume that the command is wrapped with single quotes

> GtkEventSpy.cpp:133
> +// See 
> https://techbase.kde.org/Development/Tutorials/Services/Traders#The_KTrader_Query_Language
> +QString query = QString("exist Exec and ((Exec ~~ '%1') or (exist 
> GenericName and '%1' ~~ GenericName) or (exist Name and '%1' ~~ 
> Name))").arg(exec);
> +KService::List services = 
> KServiceTypeTrader::self()->query(QStringLiteral("Application"), query);

const auto query

> GtkEventSpy.cpp:134
> +QString query = QString("exist Exec and ((Exec ~~ '%1') or (exist 
> GenericName and '%1' ~~ GenericName) or (exist Name and '%1' ~~ 
> Name))").arg(exec);
> +KService::List services = 
> KServiceTypeTrader::self()->query(QStringLiteral("Application"), query);
> +

This should also be `const`, other local variables as well

> GtkEventSpy.cpp:143
> +// remove space and any caracter after
> +int spaceIdex = exec.indexOf(" ");
> +if (spaceIdex != -1) {

Let's hope commands will never have spaces in them :)

REPOSITORY
  R161 KActivity Manager Service

REVISION DETAIL
  https://phabricator.kde.org/D23112

To: meven, #frameworks, ivan
Cc: broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, 
GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-13 Thread Méven Car
meven updated this revision to Diff 63669.
meven added a comment.


  Add a logging category

REPOSITORY
  R161 KActivity Manager Service

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D23112?vs=63654=63669

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D23112

AFFECTED FILES
  src/service/plugins/CMakeLists.txt
  src/service/plugins/gtk-eventspy/CMakeLists.txt
  src/service/plugins/gtk-eventspy/GtkEventSpy.cpp
  src/service/plugins/gtk-eventspy/GtkEventSpy.h
  src/service/plugins/gtk-eventspy/kactivitymanagerd-plugin-gtk-eventspy.json

To: meven, #frameworks, ivan
Cc: broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, 
GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-13 Thread Méven Car
meven updated this revision to Diff 63654.
meven added a comment.


  Readd include QDebug used by qWarning

REPOSITORY
  R161 KActivity Manager Service

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D23112?vs=63647=63654

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D23112

AFFECTED FILES
  src/service/plugins/CMakeLists.txt
  src/service/plugins/gtk-eventspy/CMakeLists.txt
  src/service/plugins/gtk-eventspy/GtkEventSpy.cpp
  src/service/plugins/gtk-eventspy/GtkEventSpy.h
  src/service/plugins/gtk-eventspy/kactivitymanagerd-plugin-gtk-eventspy.json

To: meven, #frameworks, ivan
Cc: broulik, plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, 
Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-13 Thread Méven Car
meven updated this revision to Diff 63647.
meven marked an inline comment as done.
meven added a comment.


  Remove unused include

REPOSITORY
  R161 KActivity Manager Service

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D23112?vs=63641=63647

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D23112

AFFECTED FILES
  src/service/plugins/CMakeLists.txt
  src/service/plugins/gtk-eventspy/CMakeLists.txt
  src/service/plugins/gtk-eventspy/GtkEventSpy.cpp
  src/service/plugins/gtk-eventspy/GtkEventSpy.h
  src/service/plugins/gtk-eventspy/kactivitymanagerd-plugin-gtk-eventspy.json

To: meven, #frameworks, ivan
Cc: broulik, plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, 
Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-13 Thread Méven Car
meven updated this revision to Diff 63641.
meven added a comment.


  Use KServiceTypeTrader to look for apps being used

REPOSITORY
  R161 KActivity Manager Service

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D23112?vs=63603=63641

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D23112

AFFECTED FILES
  src/service/plugins/CMakeLists.txt
  src/service/plugins/gtk-eventspy/CMakeLists.txt
  src/service/plugins/gtk-eventspy/GtkEventSpy.cpp
  src/service/plugins/gtk-eventspy/GtkEventSpy.h
  src/service/plugins/gtk-eventspy/kactivitymanagerd-plugin-gtk-eventspy.json

To: meven, #frameworks, ivan
Cc: broulik, plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, 
Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-13 Thread Méven Car
meven added a comment.


  In D23112#510798 , @broulik wrote:
  
  > Can you check out the `KBookmarks` framework which has classes for 
processing xbel files
  
  
  Thanks for pointing it out.
  I just did, and It does not seem to cover my use case here :
  It is quite heavily oriented towards its main use : application bookmark.
  For instance to get the attributes of the bookmarks elements I would need to 
use the internalElement() method to get a raw QDomElement which kind of defeat 
the purpose of using a library.
  I would also need to parse myself the  elements using 
internalElement as well.
  While user-places.xbel references 
https://www.freedesktop.org/wiki/Specifications/desktop-bookmark-spec/ as its 
specification, it does not abide by it.

REPOSITORY
  R161 KActivity Manager Service

REVISION DETAIL
  https://phabricator.kde.org/D23112

To: meven, #frameworks, ivan
Cc: broulik, plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, 
Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-12 Thread Kai Uwe Broulik
broulik added inline comments.

INLINE COMMENTS

> GtkEventSpy.cpp:125
> +
> +app.name = attributes.value("exec");
> +// remove "'" caracters wrapping the command and any character after 
> a space

It stores the full `Exec` line of the desktop file, including the `%u`.
What you probably want do to is use `KServiceTypeTrader` to find the 
application with said Exec line.

  auto services = 
KServiceTypeTrader::self()->query(QStringLiteral("Application"), 
QStringLiteral("exist Exec and ('%1' == Exec)").arg(cmd));

and then operate on the `KService` desktop file name, e.g. `org.gnome.evince` 
instead of the executable.

REPOSITORY
  R161 KActivity Manager Service

REVISION DETAIL
  https://phabricator.kde.org/D23112

To: meven, #frameworks, ivan
Cc: broulik, plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, 
Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-12 Thread Kai Uwe Broulik
broulik added a comment.


  Can you check out the `KBookmarks` framework which has classes for processing 
xbel files

REPOSITORY
  R161 KActivity Manager Service

REVISION DETAIL
  https://phabricator.kde.org/D23112

To: meven, #frameworks, ivan
Cc: broulik, plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, 
Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, apol, mart


D23112: Add a event Spy for GtkFileChooser recent files

2019-08-12 Thread Méven Car
meven created this revision.
meven added reviewers: Frameworks, ivan.
Herald added a project: Plasma.
Herald added a subscriber: plasma-devel.
meven requested review of this revision.

REVISION SUMMARY
  GtkFileChooser/GtkRecentManager follows 
https://www.freedesktop.org/wiki/Specifications/desktop-bookmark-spec/ 
specification to store its recently accessed files.
  The history is stored in $HOME/.local/share/recently-used.xbel
  
  Adds an event spy for the xml file used by gtk following the example of the 
KRecentDocument EventSpy.
  
  It allows to populate recently accessed files from apps using Gtk, including 
inkscape, gimp...

TEST PLAN
  Compile
  killall -9 kactivitymanage
  run your localy built version of kactivitymanagerd, for instance:
  ~/kde/usr/lib/x86_64-linux-gnu/libexec/kactivitymanagerd
  Run a gtk app and open a file
  The file access can be seen in kickoff/kicker history

REPOSITORY
  R161 KActivity Manager Service

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D23112

AFFECTED FILES
  src/service/plugins/CMakeLists.txt
  src/service/plugins/gtk-eventspy/CMakeLists.txt
  src/service/plugins/gtk-eventspy/GtkEventSpy.cpp
  src/service/plugins/gtk-eventspy/GtkEventSpy.h
  src/service/plugins/gtk-eventspy/kactivitymanagerd-plugin-gtk-eventspy.json

To: meven, #frameworks, ivan
Cc: plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, Pitel, 
ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, 
apol, mart