Use Default-theme by default and update mini-preview on start and on reset.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/2/head
Mavridis Philippe 1 year ago
parent 7d5c09fcba
commit 4554d3cafb
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494
  1. 42
      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
}
}
//////////////////////////////////////////////////////////////////////////////

Loading…
Cancel
Save