summaryrefslogtreecommitdiffstats
path: root/src/tdmtheme.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-05-05 03:06:23 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-05-05 03:06:23 -0500
commit8cd17f9262dfdace115ce709db21d8d145f2919d (patch)
treecfe123e96a29a1054b84874551ecf23e690a7851 /src/tdmtheme.cpp
parent85bc59b82666393359e68a26585eefc25ff7a2ac (diff)
downloadtdmtheme-8cd17f9262dfdace115ce709db21d8d145f2919d.tar.gz
tdmtheme-8cd17f9262dfdace115ce709db21d8d145f2919d.zip
Fix theming support when tdmdistrc file is in use
Provide graphical fedback when theming is not available
Diffstat (limited to 'src/tdmtheme.cpp')
-rw-r--r--src/tdmtheme.cpp41
1 files changed, 38 insertions, 3 deletions
diff --git a/src/tdmtheme.cpp b/src/tdmtheme.cpp
index 071216b..8451810 100644
--- a/src/tdmtheme.cpp
+++ b/src/tdmtheme.cpp
@@ -67,13 +67,18 @@ TDMThemeWidget::TDMThemeWidget( 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 TDM 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 TDMThemeWidget::selectTheme( const TQString &path )
void TDMThemeWidget::load()
{
- TQString tdmrc = TDEGlobal::dirs()->findResource("config", "tdm/tdmrc");
+ TQString tdmrc = TDEGlobal::dirs()->findResource("config", "tdm/tdmdistrc");
+ if ( tdmrc.isEmpty() ) {
+ tdmrc = TDEGlobal::dirs()->findResource("config", "tdm/tdmrc");
+ }
if ( tdmrc.isEmpty() ) {
kdError() << "Failed to find tdm resource file tdmrc!" << endl;
@@ -161,6 +169,30 @@ void TDMThemeWidget::load()
delete config;
config = new TDEConfig( tdmrc );
+
+ 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 TDMThemeWidget::toggleUseTheme(bool useTheme) {
void TDMThemeWidget::setReadOnly(bool ro)
{
+ if (!cUseTheme->isEnabled()) {
+ ro = true;
+ }
themeWidget->setEnabled( ro );
bInstallTheme->setEnabled( ro );
bRemoveTheme->setEnabled( ro );