Get Hot New Stuff support for KWin Scripts
Button currently not yet shown as the category on kde-look is still missing. This means the code is also completely untested. REVIEW: 104877 CCBUG: 296774
This commit is contained in:
parent
606e40f26b
commit
ecb94fb98c
5 changed files with 38 additions and 1 deletions
|
@ -12,6 +12,7 @@ kde4_add_plugin(kcm_kwin_scripts ${kcm_SRCS})
|
|||
|
||||
target_link_libraries(kcm_kwin_scripts
|
||||
${KDE4_KDEUI_LIBRARY}
|
||||
${KDE4_KNEWSTUFF3_LIBS}
|
||||
${KDE4_KIO_LIBS}
|
||||
${KDE4_KCMUTILS_LIBS}
|
||||
${KDE4_PLASMA_LIBS}
|
||||
|
@ -19,3 +20,4 @@ target_link_libraries(kcm_kwin_scripts
|
|||
|
||||
install(TARGETS kcm_kwin_scripts DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
install(FILES kwinscripts.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
install(FILES kwinscripts.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
|
||||
|
|
5
kcmkwin/kwinscripts/kwinscripts.knsrc
Normal file
5
kcmkwin/kwinscripts/kwinscripts.knsrc
Normal file
|
@ -0,0 +1,5 @@
|
|||
[KNewStuff3]
|
||||
Categories=KWin Scripts
|
||||
StandardResource=tmp
|
||||
InstallationCommand=plasmapkg -t kwinscript -i %f
|
||||
UninstallCommand=plasmapkg -t kwinscript -r %f
|
|
@ -31,6 +31,7 @@
|
|||
#include <KDE/KPluginInfo>
|
||||
#include <KDE/KServiceTypeTrader>
|
||||
#include <KDE/Plasma/Package>
|
||||
#include <KNS3/DownloadDialog>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
@ -51,9 +52,14 @@ Module::Module(QWidget *parent, const QVariantList &args) :
|
|||
setAboutData(about);
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->ghnsButton->setIcon(KIcon("get-hot-new-stuff"));
|
||||
|
||||
// TODO: remove once the category has been created.
|
||||
ui->ghnsButton->setVisible(false);
|
||||
|
||||
connect(ui->scriptSelector, SIGNAL(changed(bool)), this, SLOT(changed()));
|
||||
connect(ui->importScriptButton, SIGNAL(clicked()), SLOT(importScript()));
|
||||
connect(ui->ghnsButton, SIGNAL(clicked(bool)), SLOT(slotGHNSClicked()));
|
||||
|
||||
// We have no help and defaults and apply buttons.
|
||||
setButtons(buttons() ^ KCModule::Help ^ KCModule::Default ^ KCModule::Apply);
|
||||
|
@ -110,3 +116,14 @@ void Module::save()
|
|||
|
||||
emit changed(false);
|
||||
}
|
||||
|
||||
void Module::slotGHNSClicked()
|
||||
{
|
||||
QPointer<KNS3::DownloadDialog> downloadDialog = new KNS3::DownloadDialog("kwinscripts.knsrc", this);
|
||||
if (downloadDialog->exec() == KDialog::Accepted) {
|
||||
if (!downloadDialog->changedEntries().isEmpty()) {
|
||||
updateListViewContents();
|
||||
}
|
||||
}
|
||||
delete downloadDialog;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ protected slots:
|
|||
* Called when the import script button is clicked.
|
||||
*/
|
||||
void importScript();
|
||||
void slotGHNSClicked();
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
|
@ -38,7 +38,14 @@
|
|||
<item>
|
||||
<widget class="QPushButton" name="importScriptButton">
|
||||
<property name="text">
|
||||
<string>Import KWin script</string>
|
||||
<string>Import KWin script...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KPushButton" name="ghnsButton">
|
||||
<property name="text">
|
||||
<string>Get New Script...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -62,6 +69,11 @@
|
|||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KPushButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>kpushbutton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>KPluginSelector</class>
|
||||
<extends>QWidget</extends>
|
||||
|
|
Loading…
Reference in a new issue