GHNS support for Aurorae

svn path=/trunk/KDE/kdebase/workspace/; revision=1007228
This commit is contained in:
Martin Gräßlin 2009-08-05 10:37:24 +00:00
parent 47366d5720
commit 4cb65ad38c
5 changed files with 33 additions and 2 deletions

View file

@ -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} )

View file

@ -0,0 +1,4 @@
[KNewStuff2]
ProvidersUrl=http://download.kde.org/khotnewstuff/aurorae-providers.xml
Uncompress=archive
TargetDir=aurorae/themes

View file

@ -32,6 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KTar>
#include <KUrlRequesterDialog>
#include <KDE/Plasma/FrameSvg>
#include <KDE/KNS/Engine>
#include <QFile>
#include <QPainter>
@ -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"

View file

@ -119,6 +119,7 @@ public slots:
private slots:
void slotAboutClicked();
void slotInstallNewTheme();
void slotGHNSClicked();
private:
QWidget *m_parent;

View file

@ -59,10 +59,17 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="KPushButton" name="ghnsButton">
<property name="text">
<string>Get New Themes...</string>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="installNewThemeButton">
<property name="text">
<string>Install New Theme</string>
<string>Install New Theme...</string>
</property>
</widget>
</item>