summaryrefslogtreecommitdiffabout
path: root/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
Side-by-side diff
Diffstat (limited to 'libkdepim/kcmconfigs/kdepimconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp26
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
@@ -177,94 +177,112 @@ void KDEPIMConfigWidget::setupStoreTab()
topLayout->addWidget(holidayColor->label());
topLayout->addWidget( (QWidget* )holidayColor->button());
QVBox *storePage = new QVBox( this );
if ( QApplication::desktop()->height() > 240 )
new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage );
new QLabel( i18n("<b>New data storage dir:</b>"), storePage );
mStoreUrl = new KURLRequester( storePage );
mStoreUrl->setPathIsDir();
mStoreUrl->setURL( KGlobal::dirs()->localkdedir() );
#ifdef DESKTOP_VERSION
QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ;
QFileInfo fi ( confFile );
if ( fi.exists() ) {
KConfig cfg ( confFile );
cfg.setGroup("Global");
QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" );
if ( localKdeDir != "x_x_x" ) {
mStoreUrl->setURL( localKdeDir );
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 )
pb = new QPushButton ( i18n("Save"), bb );
else
pb = new QPushButton ( i18n("Save settings"), bb );
connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) );
pb = new QPushButton ( i18n("Save standard"), bb );
connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) );
#ifdef DESKTOP_VERSION
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" );
saveStoreSettings();
QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data.");
KMessageBox::information( this, message);
}
void KDEPIMConfigWidget::setStandardStore()
{
mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
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
if ( url.startsWith( "LOCAL:" ) ) {
path = qApp->applicationDirPath () ;
}
#endif
KConfig cfg ( path + "/.microkdehome" );
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();
}
}
void KDEPIMConfigWidget::setupExternalAppTab()
{
QWidget *externalAppsPage = new QWidget( this );
QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
KDialog::spacingHintSmall() );
mExternalApps = new QComboBox( externalAppsPage );
QMap<ExternalAppHandler::Types, QString>::Iterator it;
for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
mExternalApps->insertItem( it.data(), it.key() );
layout->addWidget( mExternalApps );
connect( mExternalApps, SIGNAL( activated( int ) ),
this, SLOT (externalapp_changed( int ) ) );
mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
@@ -820,50 +838,52 @@ void KDEPIMConfigWidget::updateClientWidgets()
mParameters2->setText( "" );
}
if (enabled == true) {
if ( mMessage2 )
mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
if ( mParameters2 )
mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
}
blockSignals( blocked );
}
void KDEPIMConfigWidget::usrReadConfig()
{
KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
bool blocked = signalsBlocked();
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;
mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
dummy = prefs->mUserDateFormatShort;
mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
QDate current ( 2001, 1,1);
mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1));
mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1));
setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId));
mEmailClient = prefs->mEmailClient;
mEmailOtherChannel = prefs->mEmailOtherChannel;
mEmailOtherMessage = prefs->mEmailOtherMessage;
mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
mPhoneClient = prefs->mPhoneClient;
mPhoneOtherChannel = prefs->mPhoneOtherChannel;
mPhoneOtherMessage = prefs->mPhoneOtherMessage;
mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters;