summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorulf69 <ulf69>2004-08-06 20:35:30 (UTC)
committer ulf69 <ulf69>2004-08-06 20:35:30 (UTC)
commitda50a4ee7dba00bb6d0d2425298327a41057a02a (patch) (unidiff)
treeb9fb8e4455f71fffb9765b437f546d7e40292753 /libkdepim
parentdd23184314a4f181ba00499a89ae04a5092659f4 (diff)
downloadkdepimpi-da50a4ee7dba00bb6d0d2425298327a41057a02a.zip
kdepimpi-da50a4ee7dba00bb6d0d2425298327a41057a02a.tar.gz
kdepimpi-da50a4ee7dba00bb6d0d2425298327a41057a02a.tar.bz2
added new files to support systemwide pim related configuration
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.cpp77
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.h54
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp273
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.h86
4 files changed, 490 insertions, 0 deletions
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
new file mode 100644
index 0000000..77a294a
--- a/dev/null
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
@@ -0,0 +1,77 @@
1/*
2 This file is part of KDEPim/Pi.
3 Copyright (c) 2004 Ulf Schenk
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
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
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23
24/*
25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk
27
28$Id$
29*/
30
31
32#include <qlayout.h>
33
34#include <kdebug.h>
35//#include <klocale.h>
36//#include <stdlib.h>
37
38#include "kdepimconfigwidget.h"
39
40#include "kcmkdepimconfig.h"
41#include "kprefs.h"
42#include "kpimprefs.h"
43
44extern "C"
45{
46 KCModule *create_kabconfig( QWidget *parent, const char * ) {
47 return new KCMKdePimConfig( parent, "kcmkdepimconfig" );
48 }
49}
50
51KCMKdePimConfig::KCMKdePimConfig( QWidget *parent, const char *name )
52 : KCModule( parent, name )
53{
54 //abort();
55 QVBoxLayout *layout = new QVBoxLayout( this );
56 mConfigWidget = new KDEPIMConfigWidget( this, "mConfigWidget" );
57 layout->addWidget( mConfigWidget );
58 layout->setSpacing( 0 );
59 layout->setMargin( 0 );
60
61 connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
62}
63
64void KCMKdePimConfig::load(KPrefs* prefs)
65{
66 mConfigWidget->restoreSettings((KPimPrefs*)prefs);
67}
68
69void KCMKdePimConfig::save(KPrefs* prefs)
70{
71 mConfigWidget->saveSettings((KPimPrefs*)prefs);
72}
73
74void KCMKdePimConfig::defaults(KPrefs* prefs)
75{
76 mConfigWidget->defaults((KPimPrefs*)prefs);
77}
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.h b/libkdepim/kcmconfigs/kcmkdepimconfig.h
new file mode 100644
index 0000000..8cb74f4
--- a/dev/null
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.h
@@ -0,0 +1,54 @@
1/*
2 This file is part of KdePim/Pi.
3 Copyright (c) 2004 Ulf Schenk
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
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
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23
24/*
25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk
27
28$Id$
29*/
30
31#ifndef KCMKDEPIMCONFIG_H
32#define KCMKDEPIMCONFIG_H
33
34#include <kcmodule.h>
35
36class KDEPIMConfigWidget;
37class KPrefs;
38
39class KCMKdePimConfig : public KCModule
40{
41 Q_OBJECT
42
43 public:
44 KCMKdePimConfig( QWidget *parent = 0, const char *name = 0 );
45
46 virtual void load(KPrefs* prefs);
47 virtual void save(KPrefs* prefs);
48 virtual void defaults(KPrefs* prefs);
49
50 private:
51 KDEPIMConfigWidget *mConfigWidget;
52};
53
54#endif
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
new file mode 100644
index 0000000..477267c
--- a/dev/null
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -0,0 +1,273 @@
1/*
2 This file is part of KdePim/Pi.
3 Copyright (c) 2004 Ulf Schenk
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
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
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23
24/*
25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk
27
28$Id$
29*/
30
31#include <qlayout.h>
32#include <qtabwidget.h>
33#include <qcombobox.h>
34#include <qgroupbox.h>
35#include <qlabel.h>
36#include <qlineedit.h>
37#include <qfile.h>
38
39#include <kdialog.h>
40#include <klocale.h>
41
42#include <stdlib.h>
43
44/*US
45#include <qcheckbox.h>
46#include <qframe.h>
47#include <qpushbutton.h>
48#include <qcombobox.h>
49#include <qlineedit.h>
50#include <qlabel.h>
51#include <qfile.h>
52
53#include <kconfig.h>
54#include <kdebug.h>
55#include <kdialog.h>
56#include <klistview.h>
57#include <klocale.h>
58#include <kglobal.h>
59#include <kmessagebox.h>
60#include <kstandarddirs.h>
61
62#ifndef KAB_EMBEDDED
63#include <ktrader.h>
64#else // KAB_EMBEDDED
65#include <mergewidget.h>
66#include <distributionlistwidget.h>
67#endif // KAB_EMBEDDED
68
69#include "addresseewidget.h"
70#include "extensionconfigdialog.h"
71#include "extensionwidget.h"
72*/
73
74#include "kpimprefs.h"
75
76#include "kdepimconfigwidget.h"
77
78
79KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name )
80 : QWidget( parent, name )
81{
82 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
83 KDialog::spacingHint() );
84
85 QTabWidget *tabWidget = new QTabWidget( this );
86 topLayout->addWidget( tabWidget );
87/*US
88 // General page
89 QWidget *generalPage = new QWidget( this );
90 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
91 KDialog::spacingHintSmall() );
92 //general groupbox
93 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage );
94 QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() );
95 boxLayout->setAlignment( Qt::AlignTop );
96 boxLayout->setMargin(KDialog::marginHintSmall() );
97 groupBox->layout()->setMargin(KDialog::marginHintSmall()) ;
98 groupBox->layout()->setSpacing(KDialog::spacingHintSmall());
99 boxLayout->setSpacing( KDialog::spacingHintSmall() );
100 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" );
101 boxLayout->addWidget( mViewsSingleClickBox );
102
103 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" );
104 boxLayout->addWidget( mNameParsing );
105
106 layout->addWidget( groupBox );
107
108
109 //extensions groupbox
110
111 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage );
112 QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() );
113 boxLayout->setAlignment( Qt::AlignTop );
114 boxLayout->setMargin(KDialog::marginHintSmall());
115 boxLayout->setSpacing(KDialog::spacingHintSmall());
116 groupBox->layout()->setMargin(1) ;
117 groupBox->layout()->setSpacing(0);
118 mExtensionView = new KListView( groupBox );
119 mExtensionView->setAllColumnsShowFocus( true );
120 mExtensionView->addColumn( i18n( "Name" ) );
121 mExtensionView->addColumn( i18n( "Description" ) );
122 mExtensionView->setMaximumHeight(80);
123
124 boxLayout->addWidget( mExtensionView );
125
126 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
127 mConfigureButton->setEnabled( false );
128 boxLayout->addWidget( mConfigureButton );
129
130 layout->addWidget( groupBox );
131
132 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
133 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
134 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
135 SLOT( selectionChanged( QListViewItem* ) ) );
136 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
137 SLOT( itemClicked( QListViewItem* ) ) );
138 connect( mConfigureButton, SIGNAL( clicked() ),
139 SLOT( configureExtension() ) );
140
141 tabWidget->addTab( generalPage, i18n( "General" ) );
142
143 // Addressee page
144 mAddresseeWidget = new AddresseeWidget( this );
145 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
146 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
147*/
148
149 // mailclient page
150 QWidget *mailclientPage = new QWidget( this );
151 QVBoxLayout* layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(),
152 KDialog::spacingHintSmall() );
153
154 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage );
155 QVBoxLayout* boxLayout = new QVBoxLayout( groupBox->layout() );
156 boxLayout->setAlignment( Qt::AlignTop );
157// boxLayout->setMargin(KDialog::marginHintSmall() );
158// groupBox->layout()->setMargin(KDialog::marginHintSmall()) ;
159// groupBox->layout()->setSpacing(KDialog::spacingHintSmall());
160// boxLayout->setSpacing( KDialog::spacingHintSmall() );
161
162 mEmailClient = new QComboBox( groupBox );
163 mEmailClient->insertItem( i18n("OM/Pi"), KPimPrefs::OMPI );
164 mEmailClient->insertItem( i18n("Qtopia mail"), KPimPrefs::QTOPIA );
165 mEmailClient->insertItem( i18n("Opie mail"), KPimPrefs::OPIE );
166 mEmailClient->insertItem( i18n("Other"), KPimPrefs::OTHER );
167 boxLayout->addWidget( mEmailClient );
168
169 connect( mEmailClient, SIGNAL( activated( int ) ),
170 this, SLOT (emailclient_changed( int ) ) );
171
172 QLabel* lab = new QLabel( i18n("Channel:"), groupBox);
173 boxLayout->addWidget( lab );
174 mEmailChannel = new QLineEdit(groupBox);
175 mEmailChannel->setReadOnly(true);
176 boxLayout->addWidget( mEmailChannel );
177
178 layout->addWidget( groupBox );
179 tabWidget->addTab( mailclientPage, i18n( "Mail" ) );
180
181
182
183}
184
185
186
187void KDEPIMConfigWidget::emailclient_changed( int newClient )
188{
189 if (newClient == KPimPrefs::OTHER)
190 mEmailChannel->setReadOnly(false);
191 else
192 mEmailChannel->setReadOnly(true);
193
194 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
195 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
196
197 if (opiepath.isEmpty())
198 opiepath = qtopiapath;
199
200 QString text = mEmailChannel->text();
201
202 if (newClient == KPimPrefs::OPIE)
203 {
204 if ( QFile::exists( opiepath + "/bin/opiemail" ))
205 text = "QPE/Application/opiemail";
206 else
207 text = "FILENOTFOUND: " + opiepath + "/bin/opiemail";
208 }
209 else if (newClient == KPimPrefs::QTOPIA)
210 {
211 if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
212 text = "QPE/Application/qtmail";
213 else
214 text = "FILENOTFOUND: " + qtopiapath + "/bin/qtmail";
215
216 }
217 else if (newClient == KPimPrefs::OMPI)
218 {
219 if ( QFile::exists( qtopiapath + "/bin/ompi" ))
220 text = "QPE/Application/ompi";
221 else if ( QFile::exists( opiepath + "/bin/ompi" ))
222 text = "QPE/Application/ompi";
223 else
224 text = "FILENOTFOUND: " + qtopiapath + "/bin/ompi";
225
226 }
227 else
228 {
229 //do nothing if we choosed other
230 }
231
232 mEmailChannel->setText( text );
233
234
235}
236
237
238void KDEPIMConfigWidget::restoreSettings(KPimPrefs* prefs)
239{
240 bool blocked = signalsBlocked();
241 blockSignals( true );
242
243 mEmailChannel->setText( prefs->mEmailChannel );
244 mEmailClient->setCurrentItem(prefs->mEmailClient);
245
246 blockSignals( blocked );
247
248 emit changed( false );
249}
250
251void KDEPIMConfigWidget::saveSettings(KPimPrefs* prefs)
252{
253 prefs->mEmailClient = mEmailClient->currentItem();
254 prefs->mEmailChannel = mEmailChannel->text();
255
256 prefs->writeConfig();
257
258 emit changed( false );
259}
260
261void KDEPIMConfigWidget::defaults(KPimPrefs* prefs)
262{
263 mEmailClient->setCurrentItem(KPimPrefs::OMPI);
264 emailclient_changed( KPimPrefs::OMPI );
265
266
267 emit changed( true );
268}
269
270void KDEPIMConfigWidget::modified()
271{
272 emit changed( true );
273}
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h
new file mode 100644
index 0000000..109a847
--- a/dev/null
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h
@@ -0,0 +1,86 @@
1/*
2 This file is part of KDEPim/Pi.
3 Copyright (c) 2004 Ulf Schenk
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
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
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23
24/*
25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk
27
28$Id$
29*/
30
31#ifndef KDEPIMCONFIGWIDGET_H
32#define KDEPIMCONFIGWIDGET_H
33
34#include <qwidget.h>
35
36/*
37class QCheckBox;
38class QListViewItem;
39class QPushButton;
40class KListView;
41*/
42class QComboBox;
43class QLineEdit;
44class KPimPrefs;
45
46class KDEPIMConfigWidget : public QWidget
47{
48 Q_OBJECT
49
50 public:
51 KDEPIMConfigWidget( QWidget *parent, const char *name = 0 );
52
53 void restoreSettings(KPimPrefs* prefs);
54 void saveSettings(KPimPrefs* prefs);
55 void defaults(KPimPrefs* prefs);
56
57 signals:
58 void changed( bool );
59
60 public slots:
61 void modified();
62
63
64
65 private slots:
66// void configureExtension();
67// void selectionChanged( QListViewItem* );
68// void itemClicked( QListViewItem* );
69 void emailclient_changed( int newClient );
70
71 private:
72// void restoreExtensionSettings();
73// void saveExtensionSettings();
74
75// KListView *mExtensionView;
76
77// QCheckBox *mNameParsing;
78// QCheckBox *mViewsSingleClickBox;
79// QPushButton *mConfigureButton;
80 QComboBox* mEmailClient;
81 QLineEdit* mEmailChannel;
82
83// AddresseeWidget *mAddresseeWidget;
84};
85
86#endif