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 @@ -1,175 +1,213 @@ /* This file is part of KdePim/Pi. Copyright (c) 2004 Ulf Schenk This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ /* 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> #include <kconfig.h> #include <kdebug.h> #include <kdialog.h> #include <klistview.h> #include <klocale.h> #include <kglobal.h> #include <kmessagebox.h> #include <kstandarddirs.h> #ifndef KAB_EMBEDDED #include <ktrader.h> #else // KAB_EMBEDDED #include <mergewidget.h> #include <distributionlistwidget.h> #endif // KAB_EMBEDDED #include "addresseewidget.h" #include "extensionconfigdialog.h" #include "extensionwidget.h" */ #include "qapplication.h" #include "kpimglobalprefs.h" #include "kdepimconfigwidget.h" KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) : KPrefsWidget(prefs, parent, name ) { mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); 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 ) ) ); mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); mExternalAppGroupBox->layout()->setMargin(5); mClient = new QComboBox( mExternalAppGroupBox ); boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); connect( mClient, SIGNAL( activated( int ) ), this, SLOT (client_changed( int ) ) ); QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); boxLayout->addWidget( lab, 1, 0 ); mChannel = new QLineEdit(mExternalAppGroupBox); mChannel->setReadOnly(true); boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); boxLayout->addWidget( lab, 3, 0 ); mMessage = new QLineEdit(mExternalAppGroupBox); mMessage->setReadOnly(true); boxLayout->addWidget( mMessage , 4, 0); lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); boxLayout->addWidget( lab, 3, 1 ); mParameters = new QLineEdit(mExternalAppGroupBox); mParameters->setReadOnly(true); boxLayout->addWidget( mParameters, 4, 1 ); lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); boxLayout->addWidget( lab, 6, 0 ); mMessage2 = new QLineEdit(mExternalAppGroupBox); mMessage2->setReadOnly(true); boxLayout->addWidget( mMessage2 , 7, 0); lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); boxLayout->addWidget( lab, 6, 1 ); mParameters2 = new QLineEdit(mExternalAppGroupBox); mParameters2->setReadOnly(true); boxLayout->addWidget( mParameters2, 7, 1 ); lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); |