summaryrefslogtreecommitdiffabout
path: root/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
Unidiff
Diffstat (limited to 'libkdepim/kcmconfigs/kdepimconfigwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 759b29d..753d90a 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -28,193 +28,193 @@ Copyright (c) 2004 Ulf Schenk
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> 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#include <kmessagebox.h>
87 87
88 88
89KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) 89KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
90 : KPrefsWidget(prefs, parent, name ) 90 : KPrefsWidget(prefs, parent, name )
91{ 91{
92 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); 92 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
93 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); 93 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
94 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); 94 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
95 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); 95 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
96 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); 96 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
97 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); 97 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
98 98
99 99
100 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 100 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
101 KDialog::spacingHint() ); 101 KDialog::spacingHint() );
102 102
103 tabWidget = new QTabWidget( this ); 103 tabWidget = new QTabWidget( this );
104 topLayout->addWidget( tabWidget ); 104 topLayout->addWidget( tabWidget );
105 105
106 106
107 setupLocaleTab(); 107 setupLocaleTab();
108 setupLocaleDateTab(); 108 setupLocaleDateTab();
109 setupTimeZoneTab(); 109 setupTimeZoneTab();
110 setupExternalAppTab(); 110 setupExternalAppTab();
111 setupStoreTab(); 111 setupStoreTab();
112 112
113} 113}
114void KDEPIMConfigWidget::showTimeZoneTab() 114void KDEPIMConfigWidget::showTimeZoneTab()
115{ 115{
116 tabWidget->setCurrentPage ( 3 ) ; 116 tabWidget->setCurrentPage ( 3 ) ;
117} 117}
118void KDEPIMConfigWidget::setupStoreTab() 118void KDEPIMConfigWidget::setupStoreTab()
119{ 119{
120 QVBox *colorPage = new QVBox( this ); 120 QVBox *colorPage = new QVBox( this );
121 tabWidget->addTab( colorPage, i18n( "Colors" ) ); 121 tabWidget->addTab( colorPage, i18n( "Colors" ) );
122 QWidget* cw = new QWidget( colorPage ); 122 QWidget* cw = new QWidget( colorPage );
123 KPrefsWidColor *holidayColor = 123 KPrefsWidColor *holidayColor =
124 addWidColor(i18n("Alternate background"), 124 addWidColor(i18n("Alternating background of list views"),
125 &(KPimGlobalPrefs::instance()->mAlternateColor),cw); 125 &(KPimGlobalPrefs::instance()->mAlternateColor),cw);
126 QHBoxLayout *topLayout = new QHBoxLayout(cw); 126 QHBoxLayout *topLayout = new QHBoxLayout(cw);
127 topLayout->addWidget(holidayColor->label()); 127 topLayout->addWidget(holidayColor->label());
128 topLayout->addWidget( (QWidget* )holidayColor->button()); 128 topLayout->addWidget( (QWidget* )holidayColor->button());
129 129
130 130
131 QVBox *storePage = new QVBox( this ); 131 QVBox *storePage = new QVBox( this );
132 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 ); 132 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 );
133 new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); 133 new QLabel( i18n("<b>New data storage dir:</b>"), storePage );
134 mStoreUrl = new KURLRequester( storePage ); 134 mStoreUrl = new KURLRequester( storePage );
135 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); 135 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() );
136#ifdef DESKTOP_VERSION 136#ifdef DESKTOP_VERSION
137 QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; 137 QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ;
138 QFileInfo fi ( confFile ); 138 QFileInfo fi ( confFile );
139 if ( fi.exists() ) { 139 if ( fi.exists() ) {
140 KConfig cfg ( confFile ); 140 KConfig cfg ( confFile );
141 cfg.setGroup("Global"); 141 cfg.setGroup("Global");
142 QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); 142 QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" );
143 if ( localKdeDir != "x_x_x" ) { 143 if ( localKdeDir != "x_x_x" ) {
144 mStoreUrl->setURL( localKdeDir ); 144 mStoreUrl->setURL( localKdeDir );
145 qDebug("Reading config from %s ", confFile.latin1()); 145 qDebug("Reading config from %s ", confFile.latin1());
146 } 146 }
147 } 147 }
148 148
149#endif 149#endif
150 new QLabel( i18n("New dirs are created automatically"), storePage ); 150 new QLabel( i18n("New dirs are created automatically"), storePage );
151 QHBox *bb = new QHBox( storePage ); 151 QHBox *bb = new QHBox( storePage );
152 QPushButton * pb; 152 QPushButton * pb;
153 if ( QApplication::desktop()->width() < 640 ) 153 if ( QApplication::desktop()->width() < 640 )
154 pb = new QPushButton ( i18n("Save"), bb ); 154 pb = new QPushButton ( i18n("Save"), bb );
155 else 155 else
156 pb = new QPushButton ( i18n("Save settings"), bb ); 156 pb = new QPushButton ( i18n("Save settings"), bb );
157 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); 157 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) );
158 pb = new QPushButton ( i18n("Save standard"), bb ); 158 pb = new QPushButton ( i18n("Save standard"), bb );
159 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); 159 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) );
160#ifdef DESKTOP_VERSION 160#ifdef DESKTOP_VERSION
161 pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); 161 pb = new QPushButton ( i18n("Save using LOCAL storage"), bb );
162 connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); 162 connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) );
163#endif 163#endif
164 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); 164 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage );
165 new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); 165 new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage );
166 tabWidget->addTab( storePage, i18n( "Data storage path" ) ); 166 tabWidget->addTab( storePage, i18n( "Data storage path" ) );
167} 167}
168void KDEPIMConfigWidget::setLocalStore() 168void KDEPIMConfigWidget::setLocalStore()
169{ 169{
170 mStoreUrl->setURL( "LOCAL:kdepimpi" ); 170 mStoreUrl->setURL( "LOCAL:kdepimpi" );
171 saveStoreSettings(); 171 saveStoreSettings();
172 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."); 172 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.");
173 KMessageBox::information( this, message); 173 KMessageBox::information( this, message);
174} 174}
175void KDEPIMConfigWidget::setStandardStore() 175void KDEPIMConfigWidget::setStandardStore()
176{ 176{
177 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); 177 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
178 saveStoreSettings(); 178 saveStoreSettings();
179} 179}
180void KDEPIMConfigWidget::saveStoreSettings() 180void KDEPIMConfigWidget::saveStoreSettings()
181{ 181{
182 if ( !mStoreUrl->url().isEmpty() ) { 182 if ( !mStoreUrl->url().isEmpty() ) {
183 QString path = QDir::homeDirPath(); 183 QString path = QDir::homeDirPath();
184 QString url = mStoreUrl->url(); 184 QString url = mStoreUrl->url();
185#ifdef DESKTOP_VERSION 185#ifdef DESKTOP_VERSION
186 if ( url.startsWith( "LOCAL:" ) ) { 186 if ( url.startsWith( "LOCAL:" ) ) {
187 path = qApp->applicationDirPath () ; 187 path = qApp->applicationDirPath () ;
188 } 188 }
189#endif 189#endif
190 KConfig cfg ( path + "/.microkdehome" ); 190 KConfig cfg ( path + "/.microkdehome" );
191 cfg.setGroup("Global"); 191 cfg.setGroup("Global");
192 cfg.writeEntry( "MICROKDEHOME", url ); 192 cfg.writeEntry( "MICROKDEHOME", url );
193 qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); 193 qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1());
194 cfg.sync(); 194 cfg.sync();
195 } else { 195 } else {
196 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); 196 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
197 saveStoreSettings(); 197 saveStoreSettings();
198 } 198 }
199} 199}
200void KDEPIMConfigWidget::setupExternalAppTab() 200void KDEPIMConfigWidget::setupExternalAppTab()
201{ 201{
202 QWidget *externalAppsPage = new QWidget( this ); 202 QWidget *externalAppsPage = new QWidget( this );
203 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), 203 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
204 KDialog::spacingHintSmall() ); 204 KDialog::spacingHintSmall() );
205 205
206 mExternalApps = new QComboBox( externalAppsPage ); 206 mExternalApps = new QComboBox( externalAppsPage );
207 207
208 QMap<ExternalAppHandler::Types, QString>::Iterator it; 208 QMap<ExternalAppHandler::Types, QString>::Iterator it;
209 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) 209 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
210 mExternalApps->insertItem( it.data(), it.key() ); 210 mExternalApps->insertItem( it.data(), it.key() );
211 211
212 layout->addWidget( mExternalApps ); 212 layout->addWidget( mExternalApps );
213 213
214 connect( mExternalApps, SIGNAL( activated( int ) ), 214 connect( mExternalApps, SIGNAL( activated( int ) ),
215 this, SLOT (externalapp_changed( int ) ) ); 215 this, SLOT (externalapp_changed( int ) ) );
216 216
217 217
218 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); 218 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
219 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); 219 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
220 mExternalAppGroupBox->layout()->setMargin(4); 220 mExternalAppGroupBox->layout()->setMargin(4);