diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2021-07-13 19:33:08 +0300 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2021-07-13 19:33:08 +0300 |
commit | 4554d3cafba059093066b333844a049008415b01 (patch) | |
tree | 824b0a6df647bf3e382eccba84582ed4249d82b0 | |
parent | 7d5c09fcba81401f990f6ec9f9b53f9f0f92ca9e (diff) | |
download | twin-style-dekorator-4554d3cafba059093066b333844a049008415b01.tar.gz twin-style-dekorator-4554d3cafba059093066b333844a049008415b01.zip |
Use Default-theme by default and update mini-preview on start and on reset.
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
-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 + } } ////////////////////////////////////////////////////////////////////////////// |