Adding license to the code source.
Small fixes to make theme list box update when a theme is added/removed. svn path=/trunk/kdebase/kwin/; revision=104679
This commit is contained in:
parent
278c511d4f
commit
dc2ddc90da
3 changed files with 63 additions and 23 deletions
|
@ -4,7 +4,7 @@ kde_module_LTLIBRARIES = libkwinicewm_config.la
|
|||
|
||||
libkwinicewm_config_la_SOURCES = config.cpp
|
||||
libkwinicewm_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
|
||||
libkwinicewm_config_la_LIBADD = $(LIB_KDEUI)
|
||||
libkwinicewm_config_la_LIBADD = $(LIB_KDEUI) $(LIB_KFILE)
|
||||
|
||||
METASOURCES = AUTO
|
||||
noinst_HEADERS = config.h
|
||||
|
|
|
@ -6,6 +6,22 @@
|
|||
* Copyright (c) 2001
|
||||
* Karol Szwed <gallium@kde.org>
|
||||
* http://gallium.n3.net/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -14,6 +30,7 @@
|
|||
#include <qwhatsthis.h>
|
||||
#include <klocale.h>
|
||||
#include <kstddirs.h>
|
||||
#include <kdirwatch.h>
|
||||
#include <kapp.h>
|
||||
|
||||
|
||||
|
@ -106,27 +123,34 @@ IceWMConfig::IceWMConfig( KConfig* conf, QWidget* parent )
|
|||
this, SLOT(slotSelectionChanged()) );
|
||||
|
||||
// Create the theme directory (if not found) ... and obtain the path as we do so.
|
||||
QString localThemeString = KGlobal::dirs()->saveLocation("data", "kwin");
|
||||
|
||||
localThemeString = KGlobal::dirs()->saveLocation("data", "kwin");
|
||||
localThemeString += "/icewm-themes";
|
||||
if (!QFile::exists(localThemeString))
|
||||
QDir().mkdir(localThemeString);
|
||||
|
||||
// Watch the icewm theme directory for theme additions/removals
|
||||
KDirWatch::self()->addDir(localThemeString);
|
||||
connect( KDirWatch::self(), SIGNAL(dirty(const QString&)), this, SLOT(findIceWMThemes()) );
|
||||
|
||||
// Set the konqui link url
|
||||
localThemeString = QString("file://") + localThemeString;
|
||||
localThemeString.replace( QRegExp("~"), "$HOME" );
|
||||
urlLabel->setURL( localThemeString );
|
||||
QString urlThemeString = QString("file://") + localThemeString;
|
||||
urlThemeString.replace( QRegExp("~"), "$HOME" );
|
||||
urlLabel->setURL( urlThemeString );
|
||||
|
||||
// Make the widgets visible in kwindecoration
|
||||
gb1->show();
|
||||
themeLabel->show();
|
||||
urlLabel->show();
|
||||
gb2->show();
|
||||
|
||||
KDirWatch::self()->startScan();
|
||||
}
|
||||
|
||||
|
||||
IceWMConfig::~IceWMConfig()
|
||||
{
|
||||
KDirWatch::self()->removeDir(localThemeString);
|
||||
KDirWatch::self()->stopScan();
|
||||
delete gb2;
|
||||
delete urlLabel;
|
||||
delete themeLabel;
|
||||
|
@ -175,6 +199,19 @@ void IceWMConfig::findIceWMThemes()
|
|||
|
||||
// Sort the items
|
||||
themeListBox->sort();
|
||||
|
||||
// Select the currently used IceWM theme
|
||||
QString themeName = icewmConfig->readEntry("CurrentTheme", "");
|
||||
|
||||
// Provide a theme alias
|
||||
if (themeName == "default")
|
||||
themeName = "";
|
||||
|
||||
if (themeName == "")
|
||||
themeListBox->setCurrentItem(
|
||||
themeListBox->findItem( i18n("Infadel #2 (default)") ) );
|
||||
else
|
||||
themeListBox->setCurrentItem( themeListBox->findItem(themeName) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -191,7 +228,6 @@ void IceWMConfig::slotSelectionChanged()
|
|||
|
||||
|
||||
// Loads the configurable options from the kwinicewmrc config file
|
||||
// It is passed the open config from kwindecoration to improve efficiency
|
||||
void IceWMConfig::load( KConfig* )
|
||||
{
|
||||
icewmConfig->setGroup("General");
|
||||
|
@ -206,18 +242,6 @@ void IceWMConfig::load( KConfig* )
|
|||
cbShowMenuButtonIcon->setChecked( override );
|
||||
|
||||
findIceWMThemes();
|
||||
QString themeName = icewmConfig->readEntry("CurrentTheme", "");
|
||||
|
||||
// Provide a theme alias
|
||||
if (themeName == "default")
|
||||
themeName = "";
|
||||
|
||||
// Select the currently used IceWM theme
|
||||
if (themeName == "")
|
||||
themeListBox->setCurrentItem(
|
||||
themeListBox->findItem( i18n("Infadel #2 (default)") ) );
|
||||
else
|
||||
themeListBox->setCurrentItem( themeListBox->findItem(themeName) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,10 +6,26 @@
|
|||
* Copyright (c) 2001
|
||||
* Karol Szwed <gallium@kde.org>
|
||||
* http://gallium.n3.net/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __KDEGALLIUM_ICEWMCONFIG_H
|
||||
#define __KDEGALLIUM_ICEWMCONFIG_H
|
||||
#ifndef _ICEWMCONFIG_H
|
||||
#define _ICEWMCONFIG_H
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qcheckbox.h>
|
||||
|
@ -39,10 +55,9 @@ class IceWMConfig: public QObject
|
|||
protected slots:
|
||||
void slotSelectionChanged(); // Internal use
|
||||
void callURL( const QString& s );
|
||||
|
||||
private:
|
||||
void findIceWMThemes();
|
||||
|
||||
private:
|
||||
KConfig* icewmConfig;
|
||||
QCheckBox* cbThemeButtonPositions;
|
||||
QCheckBox* cbThemeTitleTextColors;
|
||||
|
@ -53,6 +68,7 @@ class IceWMConfig: public QObject
|
|||
QListBox* themeListBox;
|
||||
QLabel* themeLabel;
|
||||
KURLLabel* urlLabel;
|
||||
QString localThemeString;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue