summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-05-05 03:06:23 -0500
committerSlávek Banko <[email protected]>2013-05-05 12:50:40 +0200
commit07b862c5db7682da48d4fc7a9caf0c9070b29301 (patch)
tree089c64fc6aa13240b7e7f671d8a37b187b91fd10
parent76a6c742e4b371369976f40f2183a7bcd358a68e (diff)
downloadtdmtheme-07b862c5db7682da48d4fc7a9caf0c9070b29301.tar.gz
tdmtheme-07b862c5db7682da48d4fc7a9caf0c9070b29301.zip
Fix theming support when tdmdistrc file is in use
Provide graphical fedback when theming is not available (cherry picked from commit 8cd17f9262dfdace115ce709db21d8d145f2919d)
-rw-r--r--src/kdmtheme.cpp41
-rw-r--r--src/kdmtheme.h1
2 files changed, 39 insertions, 3 deletions
diff --git a/src/kdmtheme.cpp b/src/kdmtheme.cpp
index 9cb57df..e9dd1fd 100644
--- a/src/kdmtheme.cpp
+++ b/src/kdmtheme.cpp
@@ -67,13 +67,18 @@ KDMThemeWidget::KDMThemeWidget( TQWidget *parent, const char *name, const TQStri
ml->setSpacing( KDialog::spacingHint() );
ml->setMargin( KDialog::marginHint() );
+ sakWarning = new TQLabel( this );
+ sakWarning->setText( i18n( "Theming is not available due to enabled Secure Attention Key (SAK) support" ) );
+ ml->addMultiCellWidget( sakWarning, 0, 0, 0, 2 );
+ sakWarning->hide();
+
cUseTheme = new TQCheckBox( this );
cUseTheme->setText( i18n( "En&able KDM Themes" ) );
ml->addMultiCellWidget( cUseTheme, 0, 0, 0, 2 );
themeWidget = new TQListView( this );
- themeWidget->addColumn( i18n( "Theme" ) );
- themeWidget->addColumn( i18n( "Author" ) );
+ themeWidget->addColumn( i18n( "Theme" ) );
+ themeWidget->addColumn( i18n( "Author" ) );
themeWidget->setAllColumnsShowFocus( true );
themeWidget->setShowSortIndicator( true );
themeWidget->setRootIsDecorated( false );
@@ -147,7 +152,10 @@ void KDMThemeWidget::selectTheme( const TQString &path )
void KDMThemeWidget::load()
{
- TQString kdmrc = KGlobal::dirs()->findResource("config", "kdm/kdmrc");
+ TQString kdmrc = KGlobal::dirs()->findResource("config", "kdm/kdmdistrc");
+ if ( kdmrc.isEmpty() ) {
+ kdmrc = KGlobal::dirs()->findResource("config", "kdm/kdmrc");
+ }
if ( kdmrc.isEmpty() ) {
kdError() << "Failed to find kdm resource file kdmrc!" << endl;
@@ -161,6 +169,30 @@ void KDMThemeWidget::load()
delete config;
config = new KConfig( kdmrc );
+
+ config->setGroup( "X-*-Greeter" );
+ bool sakEnabled = config->readBoolEntry( "UseSAK", true );
+ if (sakEnabled) {
+ // FIXME
+ // Integrate KDE_BINDIR with Autotools and use this line instead of the one below it...
+ // if (system(KDE_BINDIR "/tsak checkdeps") != 0) {
+ if (system("tsak checkdeps") != 0) {
+ sakEnabled = false;
+ }
+ }
+ if (sakEnabled) {
+ cUseTheme->hide();
+ sakWarning->show();
+ cUseTheme->setEnabled(false);
+ setReadOnly(true);
+ }
+ else {
+ sakWarning->hide();
+ cUseTheme->show();
+ cUseTheme->setEnabled(true);
+ setReadOnly(false);
+ }
+
config->setGroup( "X-*-Greeter" );
cUseTheme->setChecked( config->readBoolEntry( "UseTheme", false ) );
@@ -190,6 +222,9 @@ void KDMThemeWidget::toggleUseTheme(bool useTheme) {
void KDMThemeWidget::setReadOnly(bool ro)
{
+ if (!cUseTheme->isEnabled()) {
+ ro = true;
+ }
themeWidget->setEnabled( ro );
bInstallTheme->setEnabled( ro );
bRemoveTheme->setEnabled( ro );
diff --git a/src/kdmtheme.h b/src/kdmtheme.h
index 5371cab..d649c83 100644
--- a/src/kdmtheme.h
+++ b/src/kdmtheme.h
@@ -56,6 +56,7 @@ class KDMThemeWidget : public KCModule {
TQPushButton *bInstallTheme;
TQPushButton *bRemoveTheme;
TQCheckBox *cUseTheme;
+ TQLabel *sakWarning;
ThemeData *defaultTheme;
TQString themeDir;