diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-05-15 14:10:16 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-05-15 14:10:16 -0500 |
commit | d3a9d56143cf668c7d29b26a324a424d02036371 (patch) | |
tree | aa69f1c1e1facdce0ad705d66b07d2af0b0e2c31 /tdecore/kinstance.cpp | |
parent | fffcd810f84ca3ad146a43b97aed02067adcf4f6 (diff) | |
download | tdelibs-d3a9d56143cf668c7d29b26a324a424d02036371.tar.gz tdelibs-d3a9d56143cf668c7d29b26a324a424d02036371.zip |
Add the ability to force read-only configuration file access in a TDE application
Force tde-config to use read-only access
This closes Bug 293
Diffstat (limited to 'tdecore/kinstance.cpp')
-rw-r--r-- | tdecore/kinstance.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tdecore/kinstance.cpp b/tdecore/kinstance.cpp index fe0a5152c..5b3aa8625 100644 --- a/tdecore/kinstance.cpp +++ b/tdecore/kinstance.cpp @@ -72,7 +72,7 @@ KInstance::KInstance( const TQCString& name) _config (0L), _iconLoader (0L), _hardwaredevices (0L), - _name( name ), _aboutData( new KAboutData( name, "", 0 ) ) + _name( name ), _aboutData( new KAboutData( name, "", 0 ) ), m_configReadOnly(false) { DEBUG_ADD Q_ASSERT(!name.isEmpty()); @@ -91,7 +91,7 @@ KInstance::KInstance( const KAboutData * aboutData ) _config (0L), _iconLoader (0L), _hardwaredevices (0L), - _name( aboutData->appName() ), _aboutData( aboutData ) + _name( aboutData->appName() ), _aboutData( aboutData ), m_configReadOnly(false) { DEBUG_ADD Q_ASSERT(!_name.isEmpty()); @@ -111,7 +111,7 @@ KInstance::KInstance( KInstance* src ) _config ( src->_config ), _iconLoader ( src->_iconLoader ), _hardwaredevices ( src->_hardwaredevices ), - _name( src->_name ), _aboutData( src->_aboutData ) + _name( src->_name ), _aboutData( src->_aboutData ), m_configReadOnly(false) { DEBUG_ADD Q_ASSERT(!_name.isEmpty()); @@ -182,6 +182,11 @@ KStandardDirs *KInstance::dirs() const extern bool kde_kiosk_exception; extern bool kde_kiosk_admin; +void KInstance::setConfigReadOnly(bool ro) +{ + m_configReadOnly = ro; +} + KConfig *KInstance::config() const { DEBUG_CHECK_ALIVE @@ -206,12 +211,14 @@ KConfig *KInstance::config() const if ( d->sharedConfig == 0 ) { - if ( !_name.isEmpty() ) - d->sharedConfig = KSharedConfig::openConfig( _name + "rc"); - else + if ( !_name.isEmpty() ) { + d->sharedConfig = KSharedConfig::openConfig( _name + "rc", m_configReadOnly ); + } + else { d->sharedConfig = KSharedConfig::openConfig( TQString::null ); + } } - + // Check if we are excempt from kiosk restrictions if (kde_kiosk_admin && !kde_kiosk_exception && !TQCString(getenv("TDE_KIOSK_NO_RESTRICTIONS")).isEmpty()) { @@ -219,7 +226,7 @@ KConfig *KInstance::config() const d->sharedConfig = 0; return config(); // Reread... } - + _config = d->sharedConfig; if (_dirs) if (_dirs->addCustomized(_config)) |