author | zautrix <zautrix> | 2005-01-18 12:06:27 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-18 12:06:27 (UTC) |
commit | 4b82a36d1b2479dd2e6f00aef45af848f6793099 (patch) (side-by-side diff) | |
tree | 21e5077956085c33f57c4cb54c2b25d5d9a4dc20 /libkdepim/kcmconfigs/kdepimconfigwidget.cpp | |
parent | fbc1ca53388337b66017973896725d51416aae1a (diff) | |
download | kdepimpi-4b82a36d1b2479dd2e6f00aef45af848f6793099.zip kdepimpi-4b82a36d1b2479dd2e6f00aef45af848f6793099.tar.gz kdepimpi-4b82a36d1b2479dd2e6f00aef45af848f6793099.tar.bz2 |
data dir
Diffstat (limited to 'libkdepim/kcmconfigs/kdepimconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index 20594c6..d097078 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp @@ -23,32 +23,34 @@ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <qlayout.h> #include <qtabwidget.h> #include <qcombobox.h> #include <qgroupbox.h> #include <qlabel.h> #include <qlineedit.h> #include <qbuttongroup.h> #include <qfile.h> +#include <qvbox.h> +#include <qdir.h> #include <qregexp.h> #include <kdialog.h> #include <klocale.h> #include <kdateedit.h> #include <kglobal.h> #include <stdlib.h> /*US #include <qcheckbox.h> #include <qframe.h> #include <qpushbutton.h> #include <qcombobox.h> #include <qlineedit.h> #include <qlabel.h> #include <qfile.h> @@ -90,38 +92,74 @@ KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); QVBoxLayout *topLayout = new QVBoxLayout( this, 0, KDialog::spacingHint() ); tabWidget = new QTabWidget( this ); topLayout->addWidget( tabWidget ); setupLocaleTab(); setupLocaleDateTab(); setupTimeZoneTab(); setupExternalAppTab(); + setupStoreTab(); } void KDEPIMConfigWidget::showTimeZoneTab() { tabWidget->setCurrentPage ( 3 ) ; } +void KDEPIMConfigWidget::setupStoreTab() +{ + QVBox *storePage = new QVBox( this ); + 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>Set new data storage dir:</b>"), storePage ); + mStoreUrl = new KURLRequester( storePage ); + mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); + new QLabel( i18n("Not existing dirs are created automatically"), storePage ); + QHBox *bb = new QHBox( storePage ); + QPushButton * 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() ) ); + new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); + new QLabel( i18n("The settings of the storage\ndir is saved in the file\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); + tabWidget->addTab( storePage, i18n( "Data storage path" ) ); +} +void KDEPIMConfigWidget::setStandardStore() +{ + mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); + saveStoreSettings(); +} +void KDEPIMConfigWidget::saveStoreSettings() +{ + if ( !mStoreUrl->url().isEmpty() ) { + KConfig cfg ( QDir::homeDirPath() + "/.microkdehome" ); + cfg.setGroup("Global"); + cfg.writeEntry( "MICROKDEHOME", mStoreUrl->url() ); + qDebug("cfg.writeEntry( MICROKDEHOME, mStoreUrl->url() ); "); + cfg.sync(); + } 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 ) ) ); |