[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
This commit is contained in:
parent
c855555903
commit
17482609a1
3 changed files with 14 additions and 16 deletions
|
@ -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"
|
||||
|
|
|
@ -53,7 +53,6 @@ protected Q_SLOTS:
|
|||
* Called when the import script button is clicked.
|
||||
*/
|
||||
void importScript();
|
||||
void slotGHNSClicked();
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
|
@ -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/>
|
||||
|
|
Loading…
Reference in a new issue