Diffstat (limited to 'libkdepim/kcmconfigs/kdepimconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index ff1e240..764c495 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp @@ -197,9 +197,9 @@ void KDEPIMConfigWidget::setupStoreTab() qDebug("Reading config from %s ", confFile.latin1()); } } -#endif +#endif new QLabel( i18n("New dirs are created automatically"), storePage ); QHBox *bb = new QHBox( storePage ); QPushButton * pb; if ( QApplication::desktop()->width() < 640 ) @@ -213,10 +213,16 @@ void KDEPIMConfigWidget::setupStoreTab() pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); #endif new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); - new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); + mDataStoragePath = new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); tabWidget->addTab( storePage, i18n( "Data storage path" ) ); + +#ifdef DESKTOP_VERSION + if ( mStoreUrl->url().startsWith( "LOCAL:" ) ) { + mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( qApp->applicationDirPath ()+"/.microkdehome" )); + } +#endif } void KDEPIMConfigWidget::setLocalStore() { mStoreUrl->setURL( "LOCAL:kdepimpi" ); @@ -230,8 +236,19 @@ void KDEPIMConfigWidget::setStandardStore() saveStoreSettings(); } void KDEPIMConfigWidget::saveStoreSettings() { +#ifdef DESKTOP_VERSION + if ( !mStoreUrl->url().startsWith( "LOCAL:" ) ) { + QString file = qApp->applicationDirPath ()+"/.microkdehome"; + QFileInfo fi ( file ); + if ( fi.exists() ) { + bool res = QFile::remove( file ); + if ( ! res ) + KMessageBox::information( this, i18n("ERROR: Cannot remove file\n%1\nPlease remove it manually.").arg( file )); + } + } +#endif if ( !mStoreUrl->url().isEmpty() ) { QString path = QDir::homeDirPath(); QString url = mStoreUrl->url(); #ifdef DESKTOP_VERSION @@ -243,8 +260,9 @@ void KDEPIMConfigWidget::saveStoreSettings() cfg.setGroup("Global"); cfg.writeEntry( "MICROKDEHOME", url ); qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); cfg.sync(); + mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( path+"/.microkdehome" )); } else { mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); saveStoreSettings(); } @@ -840,10 +858,12 @@ void KDEPIMConfigWidget::usrReadConfig() blockSignals( true ); if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir ) mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); - else + else { mBackupUrl->setURL(prefs->mBackupDatadir); + + } mBackupNumbersSpin->setValue( prefs->mBackupNumbers ); mBackupDayCountSpin->setValue( prefs->mBackupDayCount); QString dummy = prefs->mUserDateFormatLong; |