Port kwineffects KCM to KNS QML components
This commit is contained in:
parent
09b1cea056
commit
309e278561
3 changed files with 8 additions and 22 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue