author | zautrix <zautrix> | 2005-03-30 13:24:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-30 13:24:56 (UTC) |
commit | 056f171723a9301aea5a65340dffeda34e078abf (patch) (unidiff) | |
tree | 7930525c801dd9c5d9a910b71bca7dc79e10f666 /libkdepim/kcmconfigs/kdepimconfigwidget.cpp | |
parent | b5222dd7a607f78235b1ea39fea0f95a9c08ccd3 (diff) | |
download | kdepimpi-056f171723a9301aea5a65340dffeda34e078abf.zip kdepimpi-056f171723a9301aea5a65340dffeda34e078abf.tar.gz kdepimpi-056f171723a9301aea5a65340dffeda34e078abf.tar.bz2 |
fixes
Diffstat (limited to 'libkdepim/kcmconfigs/kdepimconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index 5cd845e..4fe1e66 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp | |||
@@ -38,148 +38,174 @@ $Id$ | |||
38 | #include <qfile.h> | 38 | #include <qfile.h> |
39 | #include <qvbox.h> | 39 | #include <qvbox.h> |
40 | #include <qdir.h> | 40 | #include <qdir.h> |
41 | #include <qregexp.h> | 41 | #include <qregexp.h> |
42 | 42 | ||
43 | #include <kdialog.h> | 43 | #include <kdialog.h> |
44 | #include <kprefsdialog.h> | 44 | #include <kprefsdialog.h> |
45 | #include <klocale.h> | 45 | #include <klocale.h> |
46 | #include <kdateedit.h> | 46 | #include <kdateedit.h> |
47 | #include <kglobal.h> | 47 | #include <kglobal.h> |
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
49 | 49 | ||
50 | /*US | 50 | /*US |
51 | #include <qcheckbox.h> | 51 | #include <qcheckbox.h> |
52 | #include <qframe.h> | 52 | #include <qframe.h> |
53 | #include <qpushbutton.h> | 53 | #include <qpushbutton.h> |
54 | #include <qcombobox.h> | 54 | #include <qcombobox.h> |
55 | #include <qlineedit.h> | 55 | #include <qlineedit.h> |
56 | #include <qlabel.h> | 56 | #include <qlabel.h> |
57 | #include <qfile.h> | 57 | #include <qfile.h> |
58 | 58 | ||
59 | #include <kconfig.h> | 59 | #include <kconfig.h> |
60 | #include <kdebug.h> | 60 | #include <kdebug.h> |
61 | #include <kdialog.h> | 61 | #include <kdialog.h> |
62 | #include <klistview.h> | 62 | #include <klistview.h> |
63 | #include <klocale.h> | 63 | #include <klocale.h> |
64 | #include <kglobal.h> | 64 | #include <kglobal.h> |
65 | #include <kmessagebox.h> | 65 | #include <kmessagebox.h> |
66 | #include <kstandarddirs.h> | 66 | #include <kstandarddirs.h> |
67 | 67 | ||
68 | #ifndef KAB_EMBEDDED | 68 | #ifndef KAB_EMBEDDED |
69 | #include <ktrader.h> | 69 | #include <ktrader.h> |
70 | #else // KAB_EMBEDDED | 70 | #else // KAB_EMBEDDED |
71 | #include <mergewidget.h> | 71 | #include <mergewidget.h> |
72 | #include <distributionlistwidget.h> | 72 | #include <distributionlistwidget.h> |
73 | #endif // KAB_EMBEDDED | 73 | #endif // KAB_EMBEDDED |
74 | 74 | ||
75 | #include "addresseewidget.h" | 75 | #include "addresseewidget.h" |
76 | #include "extensionconfigdialog.h" | 76 | #include "extensionconfigdialog.h" |
77 | #include "extensionwidget.h" | 77 | #include "extensionwidget.h" |
78 | */ | 78 | */ |
79 | 79 | ||
80 | #include "qapplication.h" | 80 | #include "qapplication.h" |
81 | 81 | ||
82 | #include "kpimglobalprefs.h" | 82 | #include "kpimglobalprefs.h" |
83 | 83 | ||
84 | #include "kdepimconfigwidget.h" | 84 | #include "kdepimconfigwidget.h" |
85 | #include <kprefs.h> | 85 | #include <kprefs.h> |
86 | #include <kmessagebox.h> | ||
86 | 87 | ||
87 | 88 | ||
88 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) | 89 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) |
89 | : KPrefsWidget(prefs, parent, name ) | 90 | : KPrefsWidget(prefs, parent, name ) |
90 | { | 91 | { |
91 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); | 92 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); |
92 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); | 93 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); |
93 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); | 94 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); |
94 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); | 95 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); |
95 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); | 96 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); |
96 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); | 97 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); |
97 | 98 | ||
98 | 99 | ||
99 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 100 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
100 | KDialog::spacingHint() ); | 101 | KDialog::spacingHint() ); |
101 | 102 | ||
102 | tabWidget = new QTabWidget( this ); | 103 | tabWidget = new QTabWidget( this ); |
103 | topLayout->addWidget( tabWidget ); | 104 | topLayout->addWidget( tabWidget ); |
104 | 105 | ||
105 | 106 | ||
106 | setupLocaleTab(); | 107 | setupLocaleTab(); |
107 | setupLocaleDateTab(); | 108 | setupLocaleDateTab(); |
108 | setupTimeZoneTab(); | 109 | setupTimeZoneTab(); |
109 | setupExternalAppTab(); | 110 | setupExternalAppTab(); |
110 | setupStoreTab(); | 111 | setupStoreTab(); |
111 | 112 | ||
112 | } | 113 | } |
113 | void KDEPIMConfigWidget::showTimeZoneTab() | 114 | void KDEPIMConfigWidget::showTimeZoneTab() |
114 | { | 115 | { |
115 | tabWidget->setCurrentPage ( 3 ) ; | 116 | tabWidget->setCurrentPage ( 3 ) ; |
116 | } | 117 | } |
117 | void KDEPIMConfigWidget::setupStoreTab() | 118 | void KDEPIMConfigWidget::setupStoreTab() |
118 | { | 119 | { |
119 | QVBox *storePage = new QVBox( this ); | 120 | QVBox *storePage = new QVBox( this ); |
120 | 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 ); | 121 | 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 ); |
121 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); | 122 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); |
122 | mStoreUrl = new KURLRequester( storePage ); | 123 | mStoreUrl = new KURLRequester( storePage ); |
123 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); | 124 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); |
125 | #ifdef DESKTOP_VERSION | ||
126 | QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; | ||
127 | QFileInfo fi ( confFile ); | ||
128 | if ( fi.exists() ) { | ||
129 | KConfig cfg ( confFile ); | ||
130 | cfg.setGroup("Global"); | ||
131 | QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); | ||
132 | if ( localKdeDir != "x_x_x" ) { | ||
133 | mStoreUrl->setURL( localKdeDir ); | ||
134 | qDebug("Reading config from %s ", confFile.latin1()); | ||
135 | } | ||
136 | } | ||
137 | |||
138 | #endif | ||
124 | new QLabel( i18n("New dirs are created automatically"), storePage ); | 139 | new QLabel( i18n("New dirs are created automatically"), storePage ); |
125 | QHBox *bb = new QHBox( storePage ); | 140 | QHBox *bb = new QHBox( storePage ); |
126 | QPushButton * pb; | 141 | QPushButton * pb; |
127 | if ( QApplication::desktop()->width() < 640 ) | 142 | if ( QApplication::desktop()->width() < 640 ) |
128 | pb = new QPushButton ( i18n("Save"), bb ); | 143 | pb = new QPushButton ( i18n("Save"), bb ); |
129 | else | 144 | else |
130 | pb = new QPushButton ( i18n("Save settings"), bb ); | 145 | pb = new QPushButton ( i18n("Save settings"), bb ); |
131 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); | 146 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); |
132 | pb = new QPushButton ( i18n("Save standard"), bb ); | 147 | pb = new QPushButton ( i18n("Save standard"), bb ); |
133 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); | 148 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); |
149 | #ifdef DESKTOP_VERSION | ||
150 | pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); | ||
151 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); | ||
152 | #endif | ||
134 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); | 153 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); |
135 | new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); | 154 | new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); |
136 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); | 155 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); |
137 | } | 156 | } |
157 | void KDEPIMConfigWidget::setLocalStore() | ||
158 | { | ||
159 | mStoreUrl->setURL( "LOCAL:kdepimpi" ); | ||
160 | saveStoreSettings(); | ||
161 | 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."); | ||
162 | KMessageBox::information( this, message); | ||
163 | } | ||
138 | void KDEPIMConfigWidget::setStandardStore() | 164 | void KDEPIMConfigWidget::setStandardStore() |
139 | { | 165 | { |
140 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 166 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
141 | saveStoreSettings(); | 167 | saveStoreSettings(); |
142 | } | 168 | } |
143 | void KDEPIMConfigWidget::saveStoreSettings() | 169 | void KDEPIMConfigWidget::saveStoreSettings() |
144 | { | 170 | { |
145 | if ( !mStoreUrl->url().isEmpty() ) { | 171 | if ( !mStoreUrl->url().isEmpty() ) { |
146 | QString path = QDir::homeDirPath(); | 172 | QString path = QDir::homeDirPath(); |
147 | QString url = mStoreUrl->url(); | 173 | QString url = mStoreUrl->url(); |
148 | #ifdef DESKTOP_VERSION | 174 | #ifdef DESKTOP_VERSION |
149 | if ( url.startsWith( "LOCAL:" ) ) { | 175 | if ( url.startsWith( "LOCAL:" ) ) { |
150 | path = qApp->applicationDirPath () ; | 176 | path = qApp->applicationDirPath () ; |
151 | } | 177 | } |
152 | #endif | 178 | #endif |
153 | KConfig cfg ( path + "/.microkdehome" ); | 179 | KConfig cfg ( path + "/.microkdehome" ); |
154 | cfg.setGroup("Global"); | 180 | cfg.setGroup("Global"); |
155 | cfg.writeEntry( "MICROKDEHOME", url ); | 181 | cfg.writeEntry( "MICROKDEHOME", url ); |
156 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); | 182 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); |
157 | cfg.sync(); | 183 | cfg.sync(); |
158 | } else { | 184 | } else { |
159 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 185 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
160 | saveStoreSettings(); | 186 | saveStoreSettings(); |
161 | } | 187 | } |
162 | } | 188 | } |
163 | void KDEPIMConfigWidget::setupExternalAppTab() | 189 | void KDEPIMConfigWidget::setupExternalAppTab() |
164 | { | 190 | { |
165 | QWidget *externalAppsPage = new QWidget( this ); | 191 | QWidget *externalAppsPage = new QWidget( this ); |
166 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), | 192 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), |
167 | KDialog::spacingHintSmall() ); | 193 | KDialog::spacingHintSmall() ); |
168 | 194 | ||
169 | mExternalApps = new QComboBox( externalAppsPage ); | 195 | mExternalApps = new QComboBox( externalAppsPage ); |
170 | 196 | ||
171 | QMap<ExternalAppHandler::Types, QString>::Iterator it; | 197 | QMap<ExternalAppHandler::Types, QString>::Iterator it; |
172 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) | 198 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) |
173 | mExternalApps->insertItem( it.data(), it.key() ); | 199 | mExternalApps->insertItem( it.data(), it.key() ); |
174 | 200 | ||
175 | layout->addWidget( mExternalApps ); | 201 | layout->addWidget( mExternalApps ); |
176 | 202 | ||
177 | connect( mExternalApps, SIGNAL( activated( int ) ), | 203 | connect( mExternalApps, SIGNAL( activated( int ) ), |
178 | this, SLOT (externalapp_changed( int ) ) ); | 204 | this, SLOT (externalapp_changed( int ) ) ); |
179 | 205 | ||
180 | 206 | ||
181 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); | 207 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); |
182 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); | 208 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); |
183 | mExternalAppGroupBox->layout()->setMargin(5); | 209 | mExternalAppGroupBox->layout()->setMargin(5); |
184 | 210 | ||
185 | mClient = new QComboBox( mExternalAppGroupBox ); | 211 | mClient = new QComboBox( mExternalAppGroupBox ); |