Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
KDE:Frameworks5:LTS
kwin5
0002-Scripts-KCM-Use-GHNS-Button-instead-of-cre...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-Scripts-KCM-Use-GHNS-Button-instead-of-creating-a-lo.patch of Package kwin5
From e8602c803e12ff9c3489e81bce31da42b715ed2a Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik <kde@privat.broulik.de> Date: Tue, 13 Dec 2016 08:26:15 +0100 Subject: [PATCH 2/5] [Scripts KCM] Use GHNS Button instead of creating a look-alike button In the future the GHNS button might hide itself based on KIOSK restrictions. Using the GHNS Button will ensure we don't need to manually do this here. Differential Revision: https://phabricator.kde.org/D3647 --- kcmkwin/kwinscripts/module.cpp | 22 ++++++++-------------- kcmkwin/kwinscripts/module.h | 1 - kcmkwin/kwinscripts/module.ui | 7 ++++++- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/kcmkwin/kwinscripts/module.cpp b/kcmkwin/kwinscripts/module.cpp index 6b0519f58..5042a73db 100644 --- a/kcmkwin/kwinscripts/module.cpp +++ b/kcmkwin/kwinscripts/module.cpp @@ -37,7 +37,7 @@ #include <KPackage/Package> #include <Plasma/Package> -#include <KNewStuff3/KNS3/DownloadDialog> +#include <KNewStuff3/KNS3/Button> #include "version.h" @@ -58,11 +58,16 @@ Module::Module(QWidget *parent, const QVariantList &args) : setAboutData(about); ui->setupUi(this); - ui->ghnsButton->setIcon(QIcon::fromTheme("get-hot-new-stuff")); + + ui->ghnsButton->setConfigFile(QStringLiteral("kwinscripts.knsrc")); + connect(ui->ghnsButton, &KNS3::Button::dialogFinished, this, [this](const KNS3::Entry::List &changedEntries) { + if (!changedEntries.isEmpty()) { + updateListViewContents(); + } + }); connect(ui->scriptSelector, SIGNAL(changed(bool)), this, SLOT(changed())); connect(ui->importScriptButton, SIGNAL(clicked()), SLOT(importScript())); - connect(ui->ghnsButton, SIGNAL(clicked(bool)), SLOT(slotGHNSClicked())); ui->importScriptButton->setEnabled(false); @@ -136,15 +141,4 @@ void Module::save() emit changed(false); } -void Module::slotGHNSClicked() -{ - QPointer<KNS3::DownloadDialog> downloadDialog = new KNS3::DownloadDialog("kwinscripts.knsrc", this); - if (downloadDialog->exec() == QDialog::Accepted) { - if (!downloadDialog->changedEntries().isEmpty()) { - updateListViewContents(); - } - } - delete downloadDialog; -} - #include "module.moc" diff --git a/kcmkwin/kwinscripts/module.h b/kcmkwin/kwinscripts/module.h index 387c6dab2..fcbf94303 100644 --- a/kcmkwin/kwinscripts/module.h +++ b/kcmkwin/kwinscripts/module.h @@ -53,7 +53,6 @@ protected Q_SLOTS: * Called when the import script button is clicked. */ void importScript(); - void slotGHNSClicked(); private: /** diff --git a/kcmkwin/kwinscripts/module.ui b/kcmkwin/kwinscripts/module.ui index 21040a113..9a6e7a8b4 100644 --- a/kcmkwin/kwinscripts/module.ui +++ b/kcmkwin/kwinscripts/module.ui @@ -43,7 +43,7 @@ </widget> </item> <item> - <widget class="QPushButton" name="ghnsButton"> + <widget class="KNS3::Button" name="ghnsButton"> <property name="text"> <string>Get New Script...</string> </property> @@ -75,6 +75,11 @@ <header>kpluginselector.h</header> <container>1</container> </customwidget> + <customwidget> + <class>KNS3::Button</class> + <extends>QPushButton</extends> + <header>KNS3/Button</header> + </customwidget> </customwidgets> <resources/> <connections/> -- 2.13.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor