Commit 369f86ee authored by Laurent Montel's avatar Laurent Montel 😁

Hide action if GHNS is disabled by KIOSK restriction

parent 847614a8
......@@ -25,6 +25,7 @@
#include <KToggleAction>
#include <KLocalizedString>
#include <KNS3/DownloadDialog>
#include <KAuthorized>
#include <KCoreAddons/kaboutdata.h>
#include <KActionMenu>
#include <QDebug>
......@@ -50,6 +51,7 @@ public:
{
watch = new KDirWatch(q);
initThemesDirectories(relativePath);
if (KAuthorized::authorize(QStringLiteral("ghns"))) {
downloadThemesAction = new QAction(i18n("Download New Themes..."), q);
downloadThemesAction->setIcon(QIcon::fromTheme(QStringLiteral("get-hot-new-stuff")));
if (actionCollection) {
......@@ -57,8 +59,9 @@ public:
}
separatorAction = new QAction(q);
separatorAction->setSeparator(true);
q->connect(downloadThemesAction, SIGNAL(triggered(bool)), q, SLOT(slotDownloadHeaderThemes()));
}
q->connect(watch, SIGNAL(dirty(QString)), SLOT(directoryChanged()));
updateThemesPath(true);
......@@ -174,8 +177,10 @@ public:
actionCollection->removeAction(action);
}
}
if (separatorAction) {
menu->removeAction(separatorAction);
menu->removeAction(downloadThemesAction);
}
themesActionList.clear();
bool themeActivatedFound = false;
......@@ -203,9 +208,11 @@ public:
selectTheme(act);
}
}
if (separatorAction) {
menu->addAction(separatorAction);
menu->addAction(downloadThemesAction);
}
}
void selectTheme(KToggleAction *act)
{
......@@ -267,9 +274,9 @@ public:
QActionGroup *actionGroup;
KActionMenu *menu;
KActionCollection *actionCollection;
QAction *separatorAction;
QAction *separatorAction = nullptr;
QAction *downloadThemesAction;
QAction *downloadThemesAction = nullptr;
QWeakPointer<KNS3::DownloadDialog> downloadThemesDialog;
ThemeManager *q;
};
......
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