As a result of the KDE Release Party in Toulouse, I’ve decide to get involved in KDE source code. As I’m not familiar with it, I had to start with something simple. A good start was to integrate a ”Get Hot New Stuff” functionnality to Yakuake skin configuration page. Yakuake is a drop down terminal inspired by the Quake 3 console and “Get hot new stuff” (the link will lead you to developper documentation) is a simple way to graphically install supplementary stuff for KDE applications.
The patch is now ready and look like this:
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 9b34cf3..f46592e 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -33,7 +33,7 @@ kde4_add_app_icon(yakuake_SRCS "icons/hi*-app-yakuake.png")
kde4_add_executable(yakuake ${yakuake_SRCS})
-target_link_libraries(yakuake ${KDE4_KPARTS_LIBS})
+target_link_libraries(yakuake ${KDE4_KPARTS_LIBS} ${KDE4_KNEWSTUFF3_LIBS})
if(Q_WS_X11)
target_link_libraries(yakuake ${X11_X11_LIB})
@@ -42,3 +42,5 @@ endif(Q_WS_X11)
install(TARGETS yakuake ${INSTALL_TARGETS_DEFAULT_ARGS})
install(PROGRAMS yakuake.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
+
+install(FILES config/yakuake.knsrc DESTINATION ${CONFIG_INSTALL_DIR} )
diff --git a/app/config/appearancesettings.cpp b/app/config/appearancesettings.cpp
index 7ae00e9..a4b645c 100644
--- a/app/config/appearancesettings.cpp
+++ b/app/config/appearancesettings.cpp
@@ -37,6 +37,8 @@
#include <unistd.h>
+#include <knewstuff3/downloaddialog.h>
+
AppearanceSettings::AppearanceSettings(QWidget* parent) : QWidget(parent)
{
setupUi(this);
@@ -55,7 +57,10 @@ AppearanceSettings::AppearanceSettings(QWidget* parent) : QWidget(parent)
connect(skinList->selectionModel(), SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)),
this, SLOT(updateRemoveSkinButton()));
connect(installButton, SIGNAL(clicked()), this, SLOT(installSkin()));
+ connect(getnewButton, SIGNAL(clicked()), this, SLOT(getnewSkin()));
connect(removeButton, SIGNAL(clicked()), this, SLOT(removeSelectedSkin()));
+
+ getnewButton->setIcon(KIcon("get-hot-new-stuff"));
m_selectedSkinId = Settings::skin();
@@ -223,6 +228,17 @@ void AppearanceSettings::installSkin()
failInstall(i18nc("@info", "The installer was given a directory, not a file."));
}
+void AppearanceSettings::getnewSkin()
+{
+ KNS3::DownloadDialog dialog("yakuake.knsrc", this);
+ dialog.exec();
+ KNS3::Entry::List entries = dialog.changedEntries();
+ if (entries.size() > 0) {
+ populateSkinList();
+ }
+
+}
+
void AppearanceSettings::listSkinArchive(KIO::Job* /* job */, const KIO::UDSEntryList& list)
{
if (list.count() == 0) return;
diff --git a/app/config/appearancesettings.h b/app/config/appearancesettings.h
index 1363f70..02397ec 100644
--- a/app/config/appearancesettings.h
+++ b/app/config/appearancesettings.h
@@ -70,6 +70,7 @@ class AppearanceSettings : public QWidget, private Ui::AppearanceSettings
void updateSkinSetting();
void installSkin();
+ void getnewSkin();
void listSkinArchive(KIO::Job* job, const KIO::UDSEntryList& list);
void validateSkinArchive(KJob* job);
void installSkinArchive(KJob* deleteJob = 0);
diff --git a/app/config/appearancesettings.ui b/app/config/appearancesettings.ui
index a951568..fa7754a 100644
--- a/app/config/appearancesettings.ui
+++ b/app/config/appearancesettings.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>307</width>
- <height>355</height>
+ <width>467</width>
+ <height>435</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@@ -154,17 +154,7 @@
<string comment="@title:group">Skin</string>
</property>
<layout class="QGridLayout">
- <item row="0" column="0" colspan="2">
- <widget class="QListView" name="skinList">
- <property name="contextMenuPolicy">
- <enum>Qt::NoContextMenu</enum>
- </property>
- <property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
+ <item row="2" column="1">
<widget class="QPushButton" name="installButton">
<property name="enabled">
<bool>true</bool>
@@ -174,7 +164,7 @@
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="2" column="2">
<widget class="QPushButton" name="removeButton">
<property name="enabled">
<bool>false</bool>
@@ -184,13 +174,30 @@
</property>
</widget>
</item>
- <item row="2" column="0" colspan="2">
+ <item row="3" column="1" colspan="2">
<widget class="KLineEdit" name="kcfg_Skin">
<property name="frame">
<bool>false</bool>
</property>
</widget>
</item>
+ <item row="2" column="0">
+ <widget class="QPushButton" name="getnewButton">
+ <property name="text">
+ <string>Get New Skin...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="3">
+ <widget class="QListView" name="skinList">
+ <property name="contextMenuPolicy">
+ <enum>Qt::NoContextMenu</enum>
+ </property>
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -198,15 +205,15 @@
</widget>
<customwidgets>
<customwidget>
- <class>KColorButton</class>
- <extends>QPushButton</extends>
- <header>kcolorbutton.h</header>
- </customwidget>
- <customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
+ <customwidget>
+ <class>KColorButton</class>
+ <extends>QPushButton</extends>
+ <header>kcolorbutton.h</header>
+ </customwidget>
</customwidgets>
<tabstops>
<tabstop>kcfg_TerminalHighlightOnManualActivation</tabstop>
@@ -214,6 +221,7 @@
<tabstop>kcfg_Translucency</tabstop>
<tabstop>kcfg_BackgroundColorOpacity</tabstop>
<tabstop>skinList</tabstop>
+ <tabstop>getnewButton</tabstop>
<tabstop>installButton</tabstop>
<tabstop>removeButton</tabstop>
<tabstop>kcfg_Skin</tabstop>
A file named yakuake.knsrc must be added in the app/config directory of the yakuake source directory. Here it is:
[KNewStuff3] ProvidersUrl=http://download.kde.org/ocs/providers.xml Uncompress=always TargetDir=yakuake/skins Categories=Yakuake Skin
I hope this will be commited soon to Yakuake official source code. For now you can try to apply the patch and compile it if you want “Get Hot New Stuff” before the next Yakuake version get out. To do that try this:
git clone git://anongit.kde.org/yakuake cd yakuake wget http://jeff.levasseur.tuxfamily.org/files/yakuake-gethotnewstuff.patch wget http://jeff.levasseur.tuxfamily.org/files/yakuake.knsrc mv -fv yakuake.knsrc app/config/ patch -Np1 -i yakuake-gethotnewstuff.patch mkdir build && cd build cmake ./ ../ -DCMAKE_INSTALL_PREFIX=$KDEDIR make su -c "make install"
Make sure that the Yakuake package from your distribution is uninstalled before and the KDEDIR environement variable is set to your KDE 4 installation prefix (most of the time /usr or /opt/kde4). You will be asked for your root password after the last line have been validated. Enjoy!
Français