From 4cb65ad38cb5a95448f9345e77f5d7fa35531758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 5 Aug 2009 10:37:24 +0000 Subject: [PATCH] GHNS support for Aurorae svn path=/trunk/KDE/kdebase/workspace/; revision=1007228 --- clients/aurorae/src/CMakeLists.txt | 3 ++- clients/aurorae/src/aurorae.knsrc | 4 ++++ clients/aurorae/src/config/config.cpp | 18 ++++++++++++++++++ clients/aurorae/src/config/config.h | 1 + clients/aurorae/src/config/config.ui | 9 ++++++++- 5 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 clients/aurorae/src/aurorae.knsrc diff --git a/clients/aurorae/src/CMakeLists.txt b/clients/aurorae/src/CMakeLists.txt index eb4adf27ab..a9d8a1fdfb 100644 --- a/clients/aurorae/src/CMakeLists.txt +++ b/clients/aurorae/src/CMakeLists.txt @@ -11,6 +11,7 @@ install(TARGETS kwin3_aurorae DESTINATION ${PLUGIN_INSTALL_DIR} ) ########### install files ############### install( FILES aurorae.desktop DESTINATION ${DATA_INSTALL_DIR}/kwin ) +install( FILES aurorae.knsrc DESTINATION ${CONFIG_INSTALL_DIR} ) ########### config ############### set(kwin_aurorae_config_PART_SRCS config/config.cpp themeconfig.cpp ) @@ -19,6 +20,6 @@ kde4_add_ui_files(kwin_aurorae_config_PART_SRCS config/config.ui) kde4_add_plugin(kwin_aurorae_config ${kwin_aurorae_config_PART_SRCS}) -target_link_libraries(kwin_aurorae_config ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTGUI_LIBRARY}) +target_link_libraries(kwin_aurorae_config ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTGUI_LIBRARY} ${KDE4_KNEWSTUFF2_LIBS}) install(TARGETS kwin_aurorae_config DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/clients/aurorae/src/aurorae.knsrc b/clients/aurorae/src/aurorae.knsrc new file mode 100644 index 0000000000..dcaaf9afaa --- /dev/null +++ b/clients/aurorae/src/aurorae.knsrc @@ -0,0 +1,4 @@ +[KNewStuff2] +ProvidersUrl=http://download.kde.org/khotnewstuff/aurorae-providers.xml +Uncompress=archive +TargetDir=aurorae/themes diff --git a/clients/aurorae/src/config/config.cpp b/clients/aurorae/src/config/config.cpp index b5cdc1540d..9b26712fe4 100644 --- a/clients/aurorae/src/config/config.cpp +++ b/clients/aurorae/src/config/config.cpp @@ -32,6 +32,7 @@ along with this program. If not, see . #include #include #include +#include #include #include @@ -495,6 +496,7 @@ AuroraeConfig::AuroraeConfig(KConfig* conf, QWidget* parent) Q_UNUSED(conf) m_ui = new AuroraeConfigUI(parent); m_ui->aboutPushButton->setIcon(KIcon("dialog-information")); + m_ui->ghnsButton->setIcon(KIcon("get-hot-new-stuff")); m_themeModel = new ThemeModel(this); m_ui->theme->setModel(m_themeModel); @@ -508,6 +510,7 @@ AuroraeConfig::AuroraeConfig(KConfig* conf, QWidget* parent) connect(m_ui->theme, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); connect(m_ui->installNewThemeButton, SIGNAL(clicked(bool)), this, SLOT(slotInstallNewTheme())); connect(m_ui->aboutPushButton, SIGNAL(clicked(bool)), this, SLOT(slotAboutClicked())); + connect(m_ui->ghnsButton, SIGNAL(clicked(bool)), this, SLOT(slotGHNSClicked())); m_ui->show(); } @@ -613,6 +616,21 @@ void AuroraeConfig::slotInstallNewTheme() m_ui->theme->setCurrentIndex(m_themeModel->indexOf(themeName)); } +void AuroraeConfig::slotGHNSClicked() +{ + KNS::Engine engine(NULL); + if (engine.init("aurorae.knsrc")) { + KNS::Entry::List entries = engine.downloadDialogModal(m_ui); + + if (entries.size() > 0) { + int index = m_ui->theme->currentIndex(); + const QString themeName = m_ui->theme->itemData(index, ThemeModel::PackageNameRole).toString(); + m_themeModel->reload(); + m_ui->theme->setCurrentIndex(m_themeModel->indexOf(themeName)); + } + } +} + } // namespace #include "config.moc" diff --git a/clients/aurorae/src/config/config.h b/clients/aurorae/src/config/config.h index e1e3002903..df27ea26ac 100644 --- a/clients/aurorae/src/config/config.h +++ b/clients/aurorae/src/config/config.h @@ -119,6 +119,7 @@ public slots: private slots: void slotAboutClicked(); void slotInstallNewTheme(); + void slotGHNSClicked(); private: QWidget *m_parent; diff --git a/clients/aurorae/src/config/config.ui b/clients/aurorae/src/config/config.ui index a50b020e42..8b19d0e341 100644 --- a/clients/aurorae/src/config/config.ui +++ b/clients/aurorae/src/config/config.ui @@ -59,10 +59,17 @@ + + + + Get New Themes... + + + - Install New Theme + Install New Theme...