diff -pur ksmtheme-0.1.orig/AUTHORS ksmtheme-0.1.patched/AUTHORS --- ksmtheme-0.1.orig/AUTHORS 2005-03-24 04:59:06.000000000 +0100 +++ ksmtheme-0.1.patched/AUTHORS 2007-06-01 14:27:49.000000000 +0200 @@ -1,4 +1,8 @@ Stephen Leaf Laurent Montel - Numerious fixes \ Kein Zeilenumbruch am Dateiende. + Numerious fixes + +Johannes Schriewer + Heavy patches and fixes to make it useable and work. + Don't know how it even _could_ have worked before. \ Kein Zeilenumbruch am Dateiende. diff -pur ksmtheme-0.1.orig/ChangeLog ksmtheme-0.1.patched/ChangeLog --- ksmtheme-0.1.orig/ChangeLog 2006-03-24 05:51:55.000000000 +0100 +++ ksmtheme-0.1.patched/ChangeLog 2007-06-01 14:29:46.000000000 +0200 @@ -75,4 +75,9 @@ 2006-02-23 (1.1): Applied a patch from Jonathan Patrick Davies to fix an i18n/l10n issue. Removed Themes Variable in the kdmrc (kdm devs didn't like it :) The problem with removing this however is you can now no longer "insert" themes, instead they all must be your $KDEDIR/share/kdm/themes dir. If you have always used kdmtheme to install themes and not insert them, you'll not need to worry. This will also mean that your list can now never be lost! (unless of course you lose your themes directory.) Also being that this list is now auto generated if you remove a theme be sure to check "remove from hard drive" if you don't want it to show up again on the next load. - Updated address for the GPL license to match that found in KDE. \ Kein Zeilenumbruch am Dateiende. + Updated address for the GPL license to match that found in KDE. + +2007-06-01 (1.2): Updated source to make it work as non-root user + You can install themes as normal user now. + Fixed the theme search path to allow global and user local themes. + Fixed many crashes. \ Kein Zeilenumbruch am Dateiende. diff -pur ksmtheme-0.1.orig/Makefile ksmtheme-0.1.patched/Makefile --- ksmtheme-0.1.orig/Makefile 2006-03-31 09:09:27.000000000 +0200 +++ ksmtheme-0.1.patched/Makefile 2007-06-01 14:26:29.000000000 +0200 @@ -219,7 +219,7 @@ USER_LDFLAGS = USE_EXCEPTIONS = -fexceptions USE_RTTI = USE_THREADS = -VERSION = 0.1 +VERSION = 0.2 WOVERLOADED_VIRTUAL = XGETTEXT = /usr/bin/xgettext XMLLINT = /usr/bin/xmllint diff -pur ksmtheme-0.1.orig/config.h ksmtheme-0.1.patched/config.h --- ksmtheme-0.1.orig/config.h 2006-03-31 09:09:27.000000000 +0200 +++ ksmtheme-0.1.patched/config.h 2007-06-01 14:30:14.000000000 +0200 @@ -134,7 +134,7 @@ #define STDC_HEADERS 1 /* Version number of package */ -#define VERSION "0.1" +#define VERSION "0.2" /* Defined if compiling without arts */ /* #undef WITHOUT_ARTS */ diff -pur ksmtheme-0.1.orig/configure ksmtheme-0.1.patched/configure --- ksmtheme-0.1.orig/configure 2005-07-19 23:21:01.000000000 +0200 +++ ksmtheme-0.1.patched/configure 2007-06-01 14:30:36.000000000 +0200 @@ -1901,7 +1901,7 @@ fi # Define the identity of the package. PACKAGE=kdmtheme - VERSION=0.1 + VERSION=0.2 cat >>confdefs.h <<_ACEOF diff -pur ksmtheme-0.1.orig/configure.in ksmtheme-0.1.patched/configure.in --- ksmtheme-0.1.orig/configure.in 2005-04-06 07:51:27.000000000 +0200 +++ ksmtheme-0.1.patched/configure.in 2007-06-01 14:30:47.000000000 +0200 @@ -36,7 +36,7 @@ dnl Perform program name transformation AC_ARG_PROGRAM dnl Automake doc recommends to do this only here. (Janos) -AM_INIT_AUTOMAKE(kdmtheme, 0.1) dnl searches for some needed programs +AM_INIT_AUTOMAKE(kdmtheme, 0.2) dnl searches for some needed programs KDE_SET_PREFIX diff -pur ksmtheme-0.1.orig/configure.in.in ksmtheme-0.1.patched/configure.in.in --- ksmtheme-0.1.orig/configure.in.in 2005-03-22 15:12:15.000000000 +0100 +++ ksmtheme-0.1.patched/configure.in.in 2007-06-01 14:30:53.000000000 +0200 @@ -1,5 +1,5 @@ #MIN_CONFIG(3.0.0) -AM_INIT_AUTOMAKE(kdmtheme, 0.1) +AM_INIT_AUTOMAKE(kdmtheme, 0.2) AC_C_BIGENDIAN AC_CHECK_KDEMAXPATHLEN diff -pur ksmtheme-0.1.orig/src/Makefile ksmtheme-0.1.patched/src/Makefile --- ksmtheme-0.1.orig/src/Makefile 2006-03-31 09:52:55.000000000 +0200 +++ ksmtheme-0.1.patched/src/Makefile 2007-06-01 14:25:34.000000000 +0200 @@ -219,7 +219,7 @@ USER_LDFLAGS = USE_EXCEPTIONS = -fexceptions USE_RTTI = USE_THREADS = -VERSION = 0.1 +VERSION = 0.2 WOVERLOADED_VIRTUAL = XGETTEXT = /usr/bin/xgettext XMLLINT = /usr/bin/xmllint diff -pur ksmtheme-0.1.orig/src/ksmtheme.cpp ksmtheme-0.1.patched/src/ksmtheme.cpp --- ksmtheme-0.1.orig/src/ksmtheme.cpp 2006-03-31 09:52:27.000000000 +0200 +++ ksmtheme-0.1.patched/src/ksmtheme.cpp 2007-06-01 14:23:12.000000000 +0200 @@ -62,30 +62,24 @@ ksmtheme::ksmtheme(QWidget *parent, cons p_configWidget = new KSMThemeConfig( this ); - load(); + load(); + toggleUseTheme( p_configWidget->cUseTheme->isChecked() ); - if( getuid() != 0 ) { - p_configWidget->bInstallTheme->setEnabled(false); - p_configWidget->bRemoveTheme->setEnabled(false); - p_configWidget->ThemeList->setEnabled(false); - p_configWidget->cUseTheme->setEnabled(false); - } else { - connect( p_configWidget->bInstallTheme, SIGNAL(clicked()), SLOT(installNewTheme()) ); - connect( p_configWidget->bRemoveTheme, SIGNAL(clicked()), SLOT(removeSelectedTheme()) ); + connect( p_configWidget->bInstallTheme, SIGNAL(clicked()), SLOT(installNewTheme()) ); + connect( p_configWidget->bRemoveTheme, SIGNAL(clicked()), SLOT(removeSelectedTheme()) ); - connect( p_configWidget->ThemeList, SIGNAL(selectionChanged(QListViewItem *)), - SLOT(themeSelected(QListViewItem *)) ); - connect( p_configWidget->ThemeList, SIGNAL(selectionChanged()), - SLOT(themeSelected()) ); + connect( p_configWidget->ThemeList, SIGNAL(selectionChanged(QListViewItem *)), + SLOT(themeSelected(QListViewItem *)) ); + connect( p_configWidget->ThemeList, SIGNAL(selectionChanged()), + SLOT(themeSelected()) ); - connect( p_configWidget->cUseTheme, SIGNAL( toggled( bool ) ), - SLOT( toggleUseTheme( bool ) ) ); + connect( p_configWidget->cUseTheme, SIGNAL( toggled( bool ) ), + SLOT( toggleUseTheme( bool ) ) ); #if KDE_IS_VERSION(3,3,90) - p_configWidget->ThemeList->setShadeSortColumn( true ); + p_configWidget->ThemeList->setShadeSortColumn( true ); #endif - p_configWidget->ThemeList->setSorting( 0 ); - } + p_configWidget->ThemeList->setSorting( 0 ); KAboutData* about = new KAboutData("ksmtheme", I18N_NOOP("KSM Theme Manager"), "1.1", I18N_NOOP("KSM Theme Manager Control Panel Module"), @@ -96,6 +90,7 @@ ksmtheme::ksmtheme(QWidget *parent, cons // Added in the order they contributed. about->addCredit("Laurent Montel", 0, "montel@kde.org"); about->addCredit("Jonathan Patrick Davies", 0, "jpatrick@ubuntu.com"); + about->addCredit("Johannes Schriewer", 0, "jschriewer@gmail.com"); setAboutData( about ); }; @@ -201,6 +196,10 @@ QStringList ksmtheme::installThemes(QStr { QStringList themeList; + // find correct theme dir + QString themeDir; + themeDir = locateLocal("data", "ksmserver/themes/"); + if ( ! KGlobal::dirs()->exists( themeDir ) ) { KIO::mkdir( KURL( themeDir ), 755 ); } @@ -258,13 +257,13 @@ QStringList ksmtheme::findThemeDirs(cons KArchiveEntry* possibleDir = 0L; KArchiveDirectory* subDir = 0L; - // iterate all the dirs looking for a GdmGreeterTheme.desktop file + // iterate all the dirs looking for a ksms.desktop file QStringList entries = themeDir->entries(); for (QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) { possibleDir = const_cast(themeDir->entry(*it)); if (possibleDir->isDirectory()) { subDir = dynamic_cast( possibleDir ); - if (subDir && (subDir->entry("GdmGreeterTheme.desktop") != NULL)) + if (subDir && (subDir->entry("ksms.desktop") != NULL)) foundThemes.append(subDir->name()); } } @@ -352,12 +351,34 @@ void ksmtheme::load() { p_configWidget->cUseTheme->setChecked( config->readBoolEntry( "UseTheme", false ) ); - themeDir = *(KGlobal::dirs()->findDirs("data","ksmserver/").begin()) + "themes/"; + themeDirs = KGlobal::dirs()->findDirs("data", "ksmserver/themes"); +// themeDir = *(KGlobal::dirs()->findDirs("data","ksmserver/").end()) + "themes/"; - QDir dirThemes( themeDir ); - dirThemes.setFilter( QDir::Dirs ); - dirThemes.setSorting( QDir::Name ); - themes = dirThemes.entryList(); +#if 0 + if ( ! KGlobal::dirs()->exists( *(KGlobal::dirs()->findDirs("data","ksmserver/").end()) ) ) { + KIO::mkdir( KURL( *(KGlobal::dirs()->findDirs("data","ksmserver/").end()) ), 755 ); + } +#endif + + // scan all directories we get with "data" + for ( QStringList::Iterator it = themeDirs.begin(); it != themeDirs.end(); ++it ) + { + QDir dirThemes( *it ); + QStringList dirThemesList = dirThemes.entryList(QDir::Dirs, QDir::Name); + + for ( QStringList::Iterator dir = dirThemesList.begin(); dir != dirThemesList.end(); dir++) + { + QString *path; + if (( *dir == "." ) || ( *dir == "..")) + continue; + path = new QString(*it); + path->append(*dir); + + kdDebug() << "Found " << *path << endl; + themes.append(*path); + delete path; + } + } QString themeActiveName = config->readEntry("Theme"); if ( themes.isEmpty() ) { @@ -366,9 +387,9 @@ void ksmtheme::load() { bool setActiveTheme = false; QStringList tmpTheme; for ( QStringList::Iterator it = themes.begin(); it != themes.end(); ++it ) { - if ( *it == "." || *it == "..") continue; +// if ( *it == "." || *it == "..") continue; - *it = themeDir + *it; +// *it = themeDir + *it; kdDebug() << "Adding " << *it << " to the list" << endl; @@ -382,7 +403,9 @@ void ksmtheme::load() { p_configWidget->ThemeList->setSelected( p_configWidget->ThemeList->itemAtIndex( 0 ), true ); m_defaultTheme = p_configWidget->ThemeList->itemAtIndex( 0 ); } - + + if (m_defaultTheme == NULL) + return; themeSelected( m_defaultTheme ); } } @@ -424,7 +447,8 @@ void ksmtheme::updateTheme( const QStrin void ksmtheme::defaults() { - p_configWidget->ThemeList->setSelected( m_defaultTheme, true ); + if ( m_defaultTheme ) + p_configWidget->ThemeList->setSelected( m_defaultTheme, true ); configChanged(); } @@ -436,7 +460,7 @@ void ksmtheme::save() config->writeEntry( "UseTheme", p_configWidget->cUseTheme->isChecked() ); - if ( m_selectedTheme ) + if ( ( m_selectedTheme ) && ( m_selectedTheme->text(0) )&& ( m_themeNames[ m_selectedTheme->text(0) + "0"] ) ) config->writeEntry( "Theme", m_themeNames[ m_selectedTheme->text(0) + "0"] ); config->sync(); diff -pur ksmtheme-0.1.orig/src/ksmtheme.desktop ksmtheme-0.1.patched/src/ksmtheme.desktop --- ksmtheme-0.1.orig/src/ksmtheme.desktop 2006-03-31 09:58:08.000000000 +0200 +++ ksmtheme-0.1.patched/src/ksmtheme.desktop 2007-06-01 12:56:00.000000000 +0200 @@ -6,8 +6,8 @@ Type=Application X-KDE-ModuleType=Library X-KDE-Library=ksmtheme -X-KDE-RootOnly=true -X-KDE-HasReadOnlyMode=true +X-KDE-RootOnly=false +X-KDE-HasReadOnlyMode=false X-KDE-ParentApp=kcontrol diff -pur ksmtheme-0.1.orig/src/ksmtheme.h ksmtheme-0.1.patched/src/ksmtheme.h --- ksmtheme-0.1.orig/src/ksmtheme.h 2006-03-31 09:52:18.000000000 +0200 +++ ksmtheme-0.1.patched/src/ksmtheme.h 2007-06-01 13:01:07.000000000 +0200 @@ -65,6 +65,7 @@ private: QListViewItem *m_defaultTheme; QListViewItem *m_selectedTheme; QMap m_themeNames; + QStringList themeDirs; QStringList themes; QString themeDir; };