Commit ac3fa8cb authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Icon Applet] Show busy indicator when launching app

Provides some feedback when clicking the icon.

Differential Revision: https://phabricator.kde.org/D18701
parent 36a85c5e
......@@ -13,6 +13,7 @@ target_link_libraries(plasma_applet_icon
KF5::KIOCore # for OpenFileManagerWindowJob
KF5::KIOGui # for FavIconRequestJob
KF5::KIOWidgets # for KRun
KF5::WindowSystem # for KStartupInfo
KF5::Plasma)
install(TARGETS plasma_applet_icon DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
......
......@@ -42,6 +42,7 @@
#include <KLocalizedString>
#include <KProtocolManager>
#include <KRun>
#include <KStartupInfo>
#include <KIO/DropJob>
#include <KIO/FavIconRequestJob>
......@@ -393,6 +394,27 @@ QList<QAction *> IconApplet::contextualActions()
void IconApplet::run()
{
if (!m_startupInfo) {
m_startupInfo = new KStartupInfo(KStartupInfo::CleanOnCantDetect, this);
const KConfig klaunchrc("klaunchrc");
KConfigGroup c = KConfigGroup(&klaunchrc, "TaskbarButtonSettings");
m_startupInfo->setTimeout(c.readEntry("Timeout", 5));
connect(m_startupInfo, &KStartupInfo::gotNewStartup, this, [this](const KStartupInfoId &id, const KStartupInfoData &data) {
Q_UNUSED(id);
if (data.applicationId() == m_localPath) {
setBusy(true);
}
});
connect(m_startupInfo, &KStartupInfo::gotRemoveStartup, this, [this](const KStartupInfoId &id, const KStartupInfoData &data) {
Q_UNUSED(id);
if (data.applicationId() == m_localPath) {
setBusy(false);
}
});
}
new KRun(QUrl::fromLocalFile(m_localPath), QApplication::desktop());
}
......
......@@ -28,6 +28,8 @@
#include <KPropertiesDialog>
class KFileItemActions;
class KStartupInfo;
class QMenu;
class IconApplet : public Plasma::Applet
......@@ -100,4 +102,6 @@ private:
QPointer<KPropertiesDialog> m_configDialog;
KStartupInfo *m_startupInfo = nullptr;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment