[SCM] KDE Development Platform Libraries module packaging branch, squeeze, updated. debian/4.4.5-2-2-gbf7d9c1

Modestas Vainius modax at alioth.debian.org
Sat Jan 22 22:22:02 UTC 2011


The following commit has been merged in the squeeze branch:
commit bf7d9c1a5324c6db5112a832c9c2c9fb4b25af22
Author: Modestas Vainius <modestas at vainius.eu>
Date:   Sat Jan 22 23:22:07 2011 +0200

    Migrate away from old KDE 3 icon themes which are KDE 4 incompatible.
    
    This commit adds a kconf_update script which resets global icon theme to
    default if current one does not have some standard icons (e.g. document-open
    etc.) Useful when upgrading from KDE 3 to KDE 4 because default KDE 3 theme
    (crystalsvg) is exactly like this, i.e. incompatible with KDE 4.
    
    Patch: 01_kconf_update_migrate_from_kde3_icon_theme.diff
---
 debian/changelog                                   |    3 +
 debian/kdelibs5-plugins.install                    |    2 +
 ..._kconf_update_migrate_from_kde3_icon_theme.diff |  200 ++++++++++++++++++++
 debian/patches/series                              |    1 +
 4 files changed, 206 insertions(+), 0 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 9465bd4..5a8e591 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,8 @@
 kde4libs (4:4.4.5-3) UNRELEASED; urgency=low
 
+  * Add a kconf_update script (migrate_from_kde3_icon_theme) to migrate away
+    from old KDE 3 icon themes which are KDE 4 incompatible (e.g. crystalsvg).
+    (Closes: #588374)
 
  -- Modestas Vainius <modax at debian.org>  Sat, 22 Jan 2011 23:18:11 +0200
 
diff --git a/debian/kdelibs5-plugins.install b/debian/kdelibs5-plugins.install
index a0ed9fc..26b716c 100644
--- a/debian/kdelibs5-plugins.install
+++ b/debian/kdelibs5-plugins.install
@@ -1,3 +1,4 @@
+usr/lib/kconf_update_bin/migrate_from_kde3_icon_theme
 usr/lib/kde4/emoticonstheme_adium.so
 usr/lib/kde4/emoticonstheme_kde.so
 usr/lib/kde4/emoticonstheme_pidgin.so
@@ -62,3 +63,4 @@ usr/lib/kde4/spellcheckplugin.so
 usr/lib/libkdeinit4_kconf_update.so
 usr/lib/libkdeinit4_kio_http_cache_cleaner.so
 usr/lib/libkdeinit4_klauncher.so
+usr/share/kde4/apps/kconf_update/kdeui.upd
diff --git a/debian/patches/01_kconf_update_migrate_from_kde3_icon_theme.diff b/debian/patches/01_kconf_update_migrate_from_kde3_icon_theme.diff
new file mode 100644
index 0000000..2d2074b
--- /dev/null
+++ b/debian/patches/01_kconf_update_migrate_from_kde3_icon_theme.diff
@@ -0,0 +1,200 @@
+From: Modestas Vainius <modax at debian.org>
+Subject: Migrate from crystalsvg and similar KDE 4 incompatible icon themes
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=588374
+Forwarded: no
+Origin: vendor
+Last-Update: 2011-01-22
+
+The patch adds a kconf_update script which resets global icon theme to default
+if current one does not have some standard icons (e.g. document-open etc.)
+Useful when upgrading from KDE 3 to KDE 4 because default KDE 3 theme
+(crystalsvg) is exactly like this, i.e. incompatible with KDE 4.
+
+--- /dev/null
++++ b/kdeui/icons/kconf_update_migrate_from_kde3_icon_theme.cpp
+@@ -0,0 +1,157 @@
++/*
++   Copyright (c) 2011, Modestas Vainius <modax at debian.org>
++
++   This library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Library General Public
++   License as published by the Free Software Foundation; either
++   version 2 of the License, or (at your option) any later version.
++
++   This library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Library General Public License for more details.
++
++   You should have received a copy of the GNU Library General Public License
++   along with this library; see the file COPYING.LIB.  If not, write to
++   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++   Boston, MA 02110-1301, USA.
++*/
++
++#include <QtCore/QString>
++#include <QtCore/QLatin1String>
++#include <QtCore/QStringList>
++#include <QtCore/QTextStream>
++#include <QtCore/QRegExp>
++#include <QtCore/QHash>
++
++#include <kicontheme.h>
++#include <kiconloader.h>
++#include <kaboutdata.h>
++#include <kcmdlineargs.h>
++#include <kapplication.h>
++#include <kdebug.h>
++
++struct IconCheck {
++    QString name;
++    QString kde4IconName;
++    KIconLoader::Context context;
++
++    IconCheck(const QString &name, const QString &kde4IconName,
++            KIconLoader::Context context)
++        : name(name), kde4IconName(kde4IconName), context(context)
++    {
++    }
++};
++
++bool isIconThemeKde4Compat(const QString &themeName=QString())
++{
++    KIconTheme *theme = new KIconTheme(
++            themeName.isEmpty() ? KIconTheme::current() : themeName);
++    if (!theme->isValid()) {
++        // When the theme is invalid (i.e. icon directory does not exist),
++        // KIconLoader will load default one. As this might be temporary,
++        // do not anything
++        delete theme;
++        return true;
++    }
++
++    /* Check if the theme is not for KDE 3. Do this by checking
++       if some standard KDE4 icons which have different names
++       from KDE 3, actually exist.
++
++        |----------|------------|------------------|
++        | Action   | KDE 3 name | KDE 4 name       |
++        |----------|------------|------------------|
++        | Open     | fileopen   | document-open    |
++        | Save     | filesave   | document-save    |
++        | Save As  | filesaveas | document-save-as |
++        |----------|------------|------------------|
++
++    */
++
++    QList<struct IconCheck> iconChecks;
++    iconChecks <<
++        IconCheck(QLatin1String("Open"),  QLatin1String("document-open"), KIconLoader::Action) <<
++        IconCheck(QLatin1String("Save"),  QLatin1String("document-save"), KIconLoader::Action) <<
++        IconCheck(QLatin1String("SaveAs"), QLatin1String("document-save-as"), KIconLoader::Action);
++
++    int success = 0;
++    QHash<KIconLoader::Context, QStringList> icons;
++    foreach(IconCheck iconCheck, iconChecks) {
++        if (!icons.contains(iconCheck.context)) {
++            icons[iconCheck.context] = theme->queryIcons(32, iconCheck.context);
++        }
++        const QStringList &iconList = icons.value(iconCheck.context);
++        if (!iconList.filter(iconCheck.kde4IconName).isEmpty())
++            success++;
++        else
++            kDebug() << "Standard KDE 4 icon" << iconCheck.kde4IconName << "for"
++                << iconCheck.name << "could not be found in the current icon theme"
++                << theme->name();
++    }
++
++    if (success < iconChecks.size())
++    {
++        kDebug() << theme->internalName() << "theme is not KDE 4 compatible.";
++    }
++
++    delete theme;
++    return (success == iconChecks.size());
++}
++
++int main(int argc, char *argv[])
++{
++    KAboutData aboutData(
++        "kconf_update_migrate_from_kde3_icon_theme", 0,
++        ki18n("kconf_update for icon theme: migrate from KDE 3"),
++        "1.0",
++        ki18n("kconf_update utility which resets global icon theme if "
++              "current one is not KDE 4 compatible"),
++        KAboutData::License_GPL,
++        ki18n("Copyright (C) 2011 Modestas Vainius"),
++        ki18n(QByteArray()),
++        "http://pkg-kde.alioth.debian.org/",
++        "debian-qt-kde at lists.debian.org");
++    KCmdLineArgs::init( argc, argv, &aboutData );
++    KApplication app(false);
++
++
++    QTextStream in(stdin, QIODevice::ReadOnly);
++    QTextStream out(stdout, QIODevice::WriteOnly);
++    QRegExp themeRe("^\\s*(Theme(\\[[^]]+\\])?)\\s*=(.*)");
++    QRegExp spacesRe("^\\s+$");
++
++    QString line, key, themeName;
++    QStringList keysToDelete;
++    bool deleteGroup = true;
++
++    while (!in.atEnd()) {
++        line = in.readLine();
++        if (line.isEmpty() || spacesRe.exactMatch(line))
++            continue;
++
++        if (themeRe.indexIn(line) > -1) {
++            key = themeRe.cap(1);
++            themeName = themeRe.cap(3).trimmed();
++            if (!isIconThemeKde4Compat(themeName)) {
++                keysToDelete.append(key);
++                continue;
++            }
++        }
++
++        // It means some valid keys exist, so don't delete the whole group
++        deleteGroup = false;
++    }
++
++    if (!keysToDelete.isEmpty()) {
++        if (deleteGroup) {
++            out << "# DELETEGROUP" << endl;
++        } else {
++            foreach (key, keysToDelete) {
++                out << "# DELETE " << key << endl;
++            }
++        }
++    }
++
++    return 0;
++}
+--- a/kdeui/CMakeLists.txt
++++ b/kdeui/CMakeLists.txt
+@@ -376,6 +376,16 @@ set_target_properties(kdeui PROPERTIES V
+                        )
+ 
+ install(TARGETS kdeui EXPORT kdelibsLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
++
++# kconf_update to migrate from crystalsvg and the like KDE 4 incompatible icon
++# themes when upgrading to KDE SC 4
++kde4_add_executable(migrate_from_kde3_icon_theme icons/kconf_update_migrate_from_kde3_icon_theme.cpp)
++target_link_libraries(migrate_from_kde3_icon_theme ${QT_QTCORE_LIBRARY}
++                                                   ${KDE4_KDECORE_LIBRRY}
++                                                   ${KDE4_KDEUI_LIBRARY})
++install(TARGETS migrate_from_kde3_icon_theme DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin)
++install(FILES kdeui.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR})
++
+ ########### install files ###############
+ 
+ if (Q_WS_MAC)
+--- /dev/null
++++ b/kdeui/kdeui.upd
+@@ -0,0 +1,6 @@
++# Migrate from crystalsvg and similar KDE 4 incompatible icon themes
++Id=kde4/migrate_from_kde3_icon_theme
++File=kdeglobals
++Group=Icons
++Script=migrate_from_kde3_icon_theme
++
diff --git a/debian/patches/series b/debian/patches/series
index 43deb0a..44ca285 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
+01_kconf_update_migrate_from_kde3_icon_theme.diff
 08_add_debian_build_type.diff
 09_disable_usr_lib_install_rpath.diff
 10_make_libkdeinit4_private.diff

-- 
KDE Development Platform Libraries module packaging



More information about the pkg-kde-commits mailing list