diff options
Diffstat (limited to 'client/config/deKoratorconfig.cpp')
-rw-r--r-- | client/config/deKoratorconfig.cpp | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/client/config/deKoratorconfig.cpp b/client/config/deKoratorconfig.cpp index 1904a9a..8f8ac71 100644 --- a/client/config/deKoratorconfig.cpp +++ b/client/config/deKoratorconfig.cpp @@ -48,6 +48,8 @@ #include <tqcheckbox.h> #include <kcolorbutton.h> #include <tdelistview.h> +#include <kstandarddirs.h> +#include <kdebug.h> #include "deKoratorconfig.h" #include "configdialog.h" @@ -254,10 +256,23 @@ void DeKoratorConfig::load( TDEConfig* ) // path's config_->setGroup( "PATHS" ); - dialog_->framesPathKurl->setURL( config_->readEntry( "FramesPath", "" ) ); - dialog_->buttonsPathKurl->setURL( config_->readEntry( "ButtonsPath", "" ) ); + // Default theme (if installed) + TQString deftheme = locate("data", "deKorator/themes/Default-theme/"); + kdDebug() << "default theme path: " << deftheme << endl; + + dialog_->framesPathKurl->setURL( config_->readEntry( "FramesPath", (deftheme.isNull() ? "" : deftheme + "deco") ) ); + dialog_->buttonsPathKurl->setURL( config_->readEntry( "ButtonsPath", (deftheme.isNull() ? "" : deftheme + "buttons") ) ); dialog_->useMasks_Chkbox->setChecked( config_->readBoolEntry( "UseMasks", TRUE ) ); - dialog_->masksPathKurl->setURL( config_->readEntry( "MasksPath", "" ) ); + dialog_->masksPathKurl->setURL( config_->readEntry( "MasksPath", (deftheme.isNull() ? "" : deftheme + "masks") ) ); + + // Find and preselect current theme + config_->setGroup( "THEME" ); + TQString curtheme = config_->readEntry( "ThemeName", "Default-theme" ); + TQListViewItem *cur = dialog_->themesKlstView->findItem(curtheme, 0); + if ( cur != 0 ) { + dialog_->themesKlstView->setCurrentItem(cur); + themeSelected(cur); // update preview + } } ////////////////////////////////////////////////////////////////////////////// @@ -337,6 +352,9 @@ void DeKoratorConfig::save( TDEConfig* ) config_->writeEntry( "UseMasks", dialog_->useMasks_Chkbox->isChecked() ); config_->writeEntry( "MasksPath", dialog_->masksPathKurl->url() ); + config_->setGroup( "THEME" ); + config_->writeEntry( "ThemeName", dialog_->themesKlstView->currentItem()->text(0) ); + config_->sync(); } @@ -405,11 +423,21 @@ void DeKoratorConfig::defaults() dialog_->shadeClrBtn->setColor( TQColor( 150, 150, 150 ) ); dialog_->shadeDownClrBtn->setColor( TQColor( 150, 150, 150 ) ); - // path's - dialog_->framesPathKurl->setURL( "" ); - dialog_->buttonsPathKurl->setURL( "" ); + // theme & paths + TQString deftheme = locate("data", "deKorator/themes/Default-theme/"); + + dialog_->framesPathKurl->setURL( (deftheme.isNull() ? "" : deftheme + "deco") ); + dialog_->buttonsPathKurl->setURL( (deftheme.isNull() ? "" : deftheme + "buttons") ); dialog_->useMasks_Chkbox->setChecked( config_->readBoolEntry( "UseMasks", FALSE ) ); - dialog_->masksPathKurl->setURL( "" ); + dialog_->masksPathKurl->setURL( (deftheme.isNull() ? "" : deftheme + "masks") ); + + if(! deftheme.isNull()) { + TQListViewItem *def = dialog_->themesKlstView->findItem("Default-theme", 0); + if ( def != 0 ) + dialog_->themesKlstView->setCurrentItem(def); + + themeSelected(def); // update preview + } } ////////////////////////////////////////////////////////////////////////////// |