summaryrefslogtreecommitdiffabout
path: root/libkdepim
Unidiff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp38
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.h5
2 files changed, 43 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
@@ -15,48 +15,50 @@
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qtabwidget.h> 32#include <qtabwidget.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qgroupbox.h> 34#include <qgroupbox.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qbuttongroup.h> 37#include <qbuttongroup.h>
38#include <qfile.h> 38#include <qfile.h>
39#include <qvbox.h>
40#include <qdir.h>
39#include <qregexp.h> 41#include <qregexp.h>
40 42
41#include <kdialog.h> 43#include <kdialog.h>
42#include <klocale.h> 44#include <klocale.h>
43#include <kdateedit.h> 45#include <kdateedit.h>
44#include <kglobal.h> 46#include <kglobal.h>
45#include <stdlib.h> 47#include <stdlib.h>
46 48
47/*US 49/*US
48#include <qcheckbox.h> 50#include <qcheckbox.h>
49#include <qframe.h> 51#include <qframe.h>
50#include <qpushbutton.h> 52#include <qpushbutton.h>
51#include <qcombobox.h> 53#include <qcombobox.h>
52#include <qlineedit.h> 54#include <qlineedit.h>
53#include <qlabel.h> 55#include <qlabel.h>
54#include <qfile.h> 56#include <qfile.h>
55 57
56#include <kconfig.h> 58#include <kconfig.h>
57#include <kdebug.h> 59#include <kdebug.h>
58#include <kdialog.h> 60#include <kdialog.h>
59#include <klistview.h> 61#include <klistview.h>
60#include <klocale.h> 62#include <klocale.h>
61#include <kglobal.h> 63#include <kglobal.h>
62#include <kmessagebox.h> 64#include <kmessagebox.h>
@@ -82,54 +84,90 @@ $Id$
82 84
83 85
84KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) 86KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
85 : KPrefsWidget(prefs, parent, name ) 87 : KPrefsWidget(prefs, parent, name )
86{ 88{
87 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); 89 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
88 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); 90 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
89 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); 91 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
90 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); 92 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
91 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); 93 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
92 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); 94 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
93 95
94 96
95 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 97 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
96 KDialog::spacingHint() ); 98 KDialog::spacingHint() );
97 99
98 tabWidget = new QTabWidget( this ); 100 tabWidget = new QTabWidget( this );
99 topLayout->addWidget( tabWidget ); 101 topLayout->addWidget( tabWidget );
100 102
101 103
102 setupLocaleTab(); 104 setupLocaleTab();
103 setupLocaleDateTab(); 105 setupLocaleDateTab();
104 setupTimeZoneTab(); 106 setupTimeZoneTab();
105 setupExternalAppTab(); 107 setupExternalAppTab();
108 setupStoreTab();
106 109
107} 110}
108void KDEPIMConfigWidget::showTimeZoneTab() 111void KDEPIMConfigWidget::showTimeZoneTab()
109{ 112{
110 tabWidget->setCurrentPage ( 3 ) ; 113 tabWidget->setCurrentPage ( 3 ) ;
111} 114}
115void KDEPIMConfigWidget::setupStoreTab()
116{
117 QVBox *storePage = new QVBox( this );
118 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 );
119 new QLabel( i18n("<b>Set new data storage dir:</b>"), storePage );
120 mStoreUrl = new KURLRequester( storePage );
121 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() );
122 new QLabel( i18n("Not existing dirs are created automatically"), storePage );
123 QHBox *bb = new QHBox( storePage );
124 QPushButton * pb = new QPushButton ( i18n("Save settings"), bb );
125 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) );
126 pb = new QPushButton ( i18n("Save standard"), bb );
127 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) );
128 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage );
129 new QLabel( i18n("The settings of the storage\ndir is saved in the file\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage );
130 tabWidget->addTab( storePage, i18n( "Data storage path" ) );
131}
132void KDEPIMConfigWidget::setStandardStore()
133{
134 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
135 saveStoreSettings();
136}
137void KDEPIMConfigWidget::saveStoreSettings()
138{
139 if ( !mStoreUrl->url().isEmpty() ) {
140 KConfig cfg ( QDir::homeDirPath() + "/.microkdehome" );
141 cfg.setGroup("Global");
142 cfg.writeEntry( "MICROKDEHOME", mStoreUrl->url() );
143 qDebug("cfg.writeEntry( MICROKDEHOME, mStoreUrl->url() ); ");
144 cfg.sync();
145 } else {
146 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
147 saveStoreSettings();
148 }
149}
112void KDEPIMConfigWidget::setupExternalAppTab() 150void KDEPIMConfigWidget::setupExternalAppTab()
113{ 151{
114 QWidget *externalAppsPage = new QWidget( this ); 152 QWidget *externalAppsPage = new QWidget( this );
115 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), 153 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
116 KDialog::spacingHintSmall() ); 154 KDialog::spacingHintSmall() );
117 155
118 mExternalApps = new QComboBox( externalAppsPage ); 156 mExternalApps = new QComboBox( externalAppsPage );
119 157
120 QMap<ExternalAppHandler::Types, QString>::Iterator it; 158 QMap<ExternalAppHandler::Types, QString>::Iterator it;
121 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) 159 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
122 mExternalApps->insertItem( it.data(), it.key() ); 160 mExternalApps->insertItem( it.data(), it.key() );
123 161
124 layout->addWidget( mExternalApps ); 162 layout->addWidget( mExternalApps );
125 163
126 connect( mExternalApps, SIGNAL( activated( int ) ), 164 connect( mExternalApps, SIGNAL( activated( int ) ),
127 this, SLOT (externalapp_changed( int ) ) ); 165 this, SLOT (externalapp_changed( int ) ) );
128 166
129 167
130 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); 168 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
131 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); 169 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
132 mExternalAppGroupBox->layout()->setMargin(5); 170 mExternalAppGroupBox->layout()->setMargin(5);
133 171
134 mClient = new QComboBox( mExternalAppGroupBox ); 172 mClient = new QComboBox( mExternalAppGroupBox );
135 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); 173 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h
index 619f3d7..c545207 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.h
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h
@@ -11,90 +11,95 @@
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#ifndef KDEPIMCONFIGWIDGET_H 31#ifndef KDEPIMCONFIGWIDGET_H
32#define KDEPIMCONFIGWIDGET_H 32#define KDEPIMCONFIGWIDGET_H
33 33
34#include <kprefswidget.h> 34#include <kprefswidget.h>
35#include <kio/kfile/kurlrequester.h>
35#include <qmap.h> 36#include <qmap.h>
36 37
37#include "externalapphandler.h" 38#include "externalapphandler.h"
38 39
39 40
40class QComboBox; 41class QComboBox;
41class QLineEdit; 42class QLineEdit;
42class KPimGlobalPrefs; 43class KPimGlobalPrefs;
43class QGroupBox; 44class QGroupBox;
44class QTabWidget; 45class QTabWidget;
45class KDateEdit; 46class KDateEdit;
46 47
47class KDEPIMConfigWidget : public KPrefsWidget 48class KDEPIMConfigWidget : public KPrefsWidget
48{ 49{
49 Q_OBJECT 50 Q_OBJECT
50 51
51 public: 52 public:
52 KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name = 0 ); 53 KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name = 0 );
53 54
54 public slots: 55 public slots:
55 void textChanged( const QString& text ); 56 void textChanged( const QString& text );
56 void showTimeZoneTab(); 57 void showTimeZoneTab();
57 58
58 protected: 59 protected:
59 /** Implement this to read custom configuration widgets. */ 60 /** Implement this to read custom configuration widgets. */
60 virtual void usrReadConfig(); 61 virtual void usrReadConfig();
61 /** Implement this to write custom configuration widgets. */ 62 /** Implement this to write custom configuration widgets. */
62 virtual void usrWriteConfig(); 63 virtual void usrWriteConfig();
63 64
64 65
65 private slots: 66 private slots:
66// void configureExtension(); 67// void configureExtension();
67// void selectionChanged( QListViewItem* ); 68// void selectionChanged( QListViewItem* );
68// void itemClicked( QListViewItem* ); 69// void itemClicked( QListViewItem* );
69 void client_changed( int newClient ); 70 void client_changed( int newClient );
70 void externalapp_changed( int newApp ); 71 void externalapp_changed( int newApp );
72 void saveStoreSettings();
73 void setStandardStore();
71 74
72 private: 75 private:
73 void setupExternalAppTab(); 76 void setupExternalAppTab();
74 void setupLocaleDateTab(); 77 void setupLocaleDateTab();
75 void setupLocaleTab(); 78 void setupLocaleTab();
76 void setupTimeZoneTab(); 79 void setupTimeZoneTab();
80 void setupStoreTab();
81 KURLRequester* mStoreUrl;
77 82
78 void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); 83 void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0);
79 84
80 85
81 void saveEditFieldSettings(); 86 void saveEditFieldSettings();
82 void updateClientWidgets(); 87 void updateClientWidgets();
83 88
84 QTabWidget *tabWidget; 89 QTabWidget *tabWidget;
85 90
86 91
87 QLineEdit* mUserDateFormatShort; 92 QLineEdit* mUserDateFormatShort;
88 QLineEdit* mUserDateFormatLong; 93 QLineEdit* mUserDateFormatLong;
89 QComboBox* mTimeZoneCombo; 94 QComboBox* mTimeZoneCombo;
90 KDateEdit* mStartDateSavingEdit; 95 KDateEdit* mStartDateSavingEdit;
91 KDateEdit* mEndDateSavingEdit; 96 KDateEdit* mEndDateSavingEdit;
92 97
93// void restoreExtensionSettings(); 98// void restoreExtensionSettings();
94// void saveExtensionSettings(); 99// void saveExtensionSettings();
95 100
96// KListView *mExtensionView; 101// KListView *mExtensionView;
97 102
98// QCheckBox *mNameParsing; 103// QCheckBox *mNameParsing;
99// QCheckBox *mViewsSingleClickBox; 104// QCheckBox *mViewsSingleClickBox;
100// QPushButton *mConfigureButton; 105// QPushButton *mConfigureButton;