In times of KDE4 method actionCollectino was returning a KActionCollection, so that there was a way to find an "quit" action. Currently actionCollection method returns QList, so that there is no way to determine "quit" action. Commonly it is needed to reconnect action trigger to a custom slot, cause by default KSNI "quit" action _always_ asks whether user wants to quit or not. many apps changes such behavior. With QList there is no way to find "quit" action in a list. Possible solutions: 1) Add another actionCollection that will return internal QMap as is. 2) Add action(Qstring) method that will search for requested action in internal map. Reproducible: Always
Thanks for the report I think that the reason why it got removed was that the intended usage is meant to be this: QAction *quitAction; Q_FOREACH(QAction *action, ksni->actionCollection()) { if (action == KStandardAction::quit()) { quitAction = action; } } ...wouldn't that work?
Actually ignore that, that wouldn't work.
What you can do however, in the meantime anyway, is to set setStandardActionsEnabled(false); which will not put a "quit" action in the menu and then add your own quit action by using addAction(QString, QAction*);
But this also will disable "minimizeRestore" action that has a little bit advanced logic. I do not want to reimplement this logic too. This makes standard actions from KSNI useless and unneeded. Don't you think so?
Git commit f8d29aa9108fa74c1a3666c1774779eb100325a9 by Martin Klapetek. Committed on 01/07/2015 at 08:05. Pushed by mklapetek into branch 'master'. [ksni] Add method to retrieve action by its name REVIEW: 124155 M +5 -0 src/kstatusnotifieritem.cpp M +9 -0 src/kstatusnotifieritem.h http://commits.kde.org/knotifications/f8d29aa9108fa74c1a3666c1774779eb100325a9