Commit 309e2785 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Port kwineffects KCM to KNS QML components

parent 09b1cea0
......@@ -10,7 +10,6 @@
#include <KAboutData>
#include <KLocalizedString>
#include <KNS3/DownloadDialog>
#include <KPluginFactory>
#include <QQuickWindow>
......@@ -72,23 +71,9 @@ void DesktopEffectsKCM::defaults()
updateNeedsSave();
}
void DesktopEffectsKCM::openGHNS(QQuickItem *context)
void DesktopEffectsKCM::onGHNSEntriesChanged()
{
QPointer<KNS3::DownloadDialog> dialog = new KNS3::DownloadDialog(QStringLiteral("kwineffect.knsrc"));
dialog->setWindowTitle(i18n("Download New Desktop Effects"));
dialog->winId();
if (context && context->window()) {
dialog->windowHandle()->setTransientParent(context->window());
}
if (dialog->exec() == QDialog::Accepted) {
if (!dialog->changedEntries().isEmpty()) {
m_model->load(EffectsModel::LoadOptions::KeepDirty);
}
}
delete dialog;
m_model->load(EffectsModel::LoadOptions::KeepDirty);
}
void DesktopEffectsKCM::configure(const QString &pluginId, QQuickItem *context)
......
......@@ -32,7 +32,7 @@ public Q_SLOTS:
void save() override;
void defaults() override;
void openGHNS(QQuickItem *context);
void onGHNSEntriesChanged();
void configure(const QString &pluginId, QQuickItem *context);
private Q_SLOTS:
......
......@@ -12,6 +12,8 @@ import QtQuick.Layouts 1.1
import org.kde.kcm 1.2
import org.kde.kconfig 1.0
import org.kde.kirigami 2.10 as Kirigami
import org.kde.newstuff 1.62 as NewStuff
import org.kde.private.kcms.kwin.effects 1.0 as Private
ScrollViewKCM {
......@@ -119,12 +121,11 @@ ScrollViewKCM {
RowLayout {
Layout.alignment: Qt.AlignRight
QQC2.Button {
icon.name: "get-hot-new-stuff"
NewStuff.Button {
text: i18n("Get New Desktop Effects...")
visible: KAuthorized.authorize("ghns")
onClicked: kcm.openGHNS(this)
configFile: "kwineffect.knsrc"
onChangedEntriesChanged: kcm.onGHNSEntriesChanged()
}
}
}
......
Supports Markdown
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