summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp53
-rw-r--r--kaddressbook/kcmconfigs/kcmkabconfig.cpp20
-rw-r--r--kaddressbook/kcmconfigs/kcmkabconfig.h10
-rw-r--r--libkdepim/addresseeview.cpp31
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.cpp24
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.h10
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp534
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.h68
-rw-r--r--libkdepim/kpimprefs.cpp11
-rw-r--r--libkdepim/kpimprefs.h19
-rw-r--r--libkdepim/libkdepim.pro4
-rw-r--r--libkdepim/libkdepimE.pro4
-rw-r--r--microkde/kdeui/kcmodule.cpp16
-rw-r--r--microkde/kdeui/kcmodule.h11
-rw-r--r--microkde/kutils/kcmultidialog.cpp13
-rw-r--r--microkde/kutils/kcmultidialog.h5
16 files changed, 580 insertions, 253 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 4303cab..fe4841a 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,1588 +1,1561 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 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 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 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
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#include "kabcore.h" 24#include "kabcore.h"
25 25
26#include <stdaddressbook.h> 26#include <stdaddressbook.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#include <qclipboard.h> 30#include <qclipboard.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qapplicaton.h> 33#include <qapplicaton.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qregexp.h> 35#include <qregexp.h>
36#include <qvbox.h> 36#include <qvbox.h>
37#include <kabc/addresseelist.h> 37#include <kabc/addresseelist.h>
38#include <kabc/errorhandler.h> 38#include <kabc/errorhandler.h>
39#include <kabc/resource.h> 39#include <kabc/resource.h>
40#include <kabc/vcardconverter.h> 40#include <kabc/vcardconverter.h>
41#include <kapplication.h> 41#include <kapplication.h>
42#include <kactionclasses.h> 42#include <kactionclasses.h>
43#include <kcmultidialog.h> 43#include <kcmultidialog.h>
44#include <kdebug.h> 44#include <kdebug.h>
45#include <kdeversion.h> 45#include <kdeversion.h>
46#include <kkeydialog.h> 46#include <kkeydialog.h>
47#include <kmessagebox.h> 47#include <kmessagebox.h>
48#include <kprinter.h> 48#include <kprinter.h>
49#include <kprotocolinfo.h> 49#include <kprotocolinfo.h>
50#include <kresources/selectdialog.h> 50#include <kresources/selectdialog.h>
51#include <kstandarddirs.h> 51#include <kstandarddirs.h>
52#include <ktempfile.h> 52#include <ktempfile.h>
53#include <kxmlguiclient.h> 53#include <kxmlguiclient.h>
54#include <kaboutdata.h> 54#include <kaboutdata.h>
55#include <libkdepim/categoryselectdialog.h> 55#include <libkdepim/categoryselectdialog.h>
56 56
57#include "addresseeutil.h" 57#include "addresseeutil.h"
58#include "addresseeeditordialog.h" 58#include "addresseeeditordialog.h"
59#include "extensionmanager.h" 59#include "extensionmanager.h"
60#include "kstdaction.h" 60#include "kstdaction.h"
61#include "kaddressbookservice.h" 61#include "kaddressbookservice.h"
62#include "ldapsearchdialog.h" 62#include "ldapsearchdialog.h"
63#include "printing/printingwizard.h" 63#include "printing/printingwizard.h"
64#else // KAB_EMBEDDED 64#else // KAB_EMBEDDED
65 65
66#include <kapplication.h> 66#include <kapplication.h>
67#include "KDGanttMinimizeSplitter.h" 67#include "KDGanttMinimizeSplitter.h"
68#include "kaddressbookmain.h" 68#include "kaddressbookmain.h"
69#include "kactioncollection.h" 69#include "kactioncollection.h"
70#include <qapp.h> 70#include <qapp.h>
71#include <qmenubar.h> 71#include <qmenubar.h>
72//#include <qtoolbar.h> 72//#include <qtoolbar.h>
73#include <qmessagebox.h> 73#include <qmessagebox.h>
74#include <kdebug.h> 74#include <kdebug.h>
75#include <kiconloader.h> // needed for SmallIcon 75#include <kiconloader.h> // needed for SmallIcon
76#include <kresources/kcmkresources.h> 76#include <kresources/kcmkresources.h>
77#include <ktoolbar.h> 77#include <ktoolbar.h>
78 78
79 79
80//#include <qlabel.h> 80//#include <qlabel.h>
81 81
82 82
83#ifndef DESKTOP_VERSION 83#ifndef DESKTOP_VERSION
84#include <qtopia/services.h> 84#include <qtopia/services.h>
85#include <qtopia/qcopenvelope_qws.h> 85#include <qtopia/qcopenvelope_qws.h>
86#include <qpe/ir.h> 86#include <qpe/ir.h>
87#endif 87#endif
88 88
89#endif // KAB_EMBEDDED 89#endif // KAB_EMBEDDED
90#include "kcmconfigs/kcmkabconfig.h" 90#include "kcmconfigs/kcmkabconfig.h"
91#include "kcmconfigs/kcmkdepimconfig.h" 91#include "kcmconfigs/kcmkdepimconfig.h"
92#include "kpimglobalprefs.h"
93#include "externalapphandler.h"
92 94
93 95
94#include <kresources/selectdialog.h> 96#include <kresources/selectdialog.h>
95#include <kmessagebox.h> 97#include <kmessagebox.h>
96 98
97#include <picture.h> 99#include <picture.h>
98#include <resource.h> 100#include <resource.h>
99 101
100//US#include <qsplitter.h> 102//US#include <qsplitter.h>
101#include <qmap.h> 103#include <qmap.h>
102#include <qdir.h> 104#include <qdir.h>
103#include <qfile.h> 105#include <qfile.h>
104#include <qvbox.h> 106#include <qvbox.h>
105#include <qlayout.h> 107#include <qlayout.h>
106#include <qclipboard.h> 108#include <qclipboard.h>
107#include <qtextstream.h> 109#include <qtextstream.h>
108 110
109#include <libkdepim/categoryselectdialog.h> 111#include <libkdepim/categoryselectdialog.h>
110#include <kabc/vcardconverter.h> 112#include <kabc/vcardconverter.h>
111 113
112 114
113#include "addresseeutil.h" 115#include "addresseeutil.h"
114#include "undocmds.h" 116#include "undocmds.h"
115#include "addresseeeditordialog.h" 117#include "addresseeeditordialog.h"
116#include "viewmanager.h" 118#include "viewmanager.h"
117#include "details/detailsviewcontainer.h" 119#include "details/detailsviewcontainer.h"
118#include "kabprefs.h" 120#include "kabprefs.h"
119#include "xxportmanager.h" 121#include "xxportmanager.h"
120#include "incsearchwidget.h" 122#include "incsearchwidget.h"
121#include "jumpbuttonbar.h" 123#include "jumpbuttonbar.h"
122#include "extensionmanager.h" 124#include "extensionmanager.h"
123#include "addresseeconfig.h" 125#include "addresseeconfig.h"
124#include <kcmultidialog.h> 126#include <kcmultidialog.h>
125 127
126#ifdef _WIN32_ 128#ifdef _WIN32_
127 129
128#include "kaimportoldialog.h" 130#include "kaimportoldialog.h"
129#endif 131#endif
130 132
131bool pasteWithNewUid = true; 133bool pasteWithNewUid = true;
132 134
133#ifdef KAB_EMBEDDED 135#ifdef KAB_EMBEDDED
134KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 136KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
135 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 137 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
136 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 138 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
137 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 139 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
138#else //KAB_EMBEDDED 140#else //KAB_EMBEDDED
139KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 141KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
140 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 142 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
141 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 143 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
142 mReadWrite( readWrite ), mModified( false ) 144 mReadWrite( readWrite ), mModified( false )
143#endif //KAB_EMBEDDED 145#endif //KAB_EMBEDDED
144{ 146{
145 147
146 mExtensionBarSplitter = 0; 148 mExtensionBarSplitter = 0;
147 mIsPart = !parent->inherits( "KAddressBookMain" ); 149 mIsPart = !parent->inherits( "KAddressBookMain" );
148 150
149 mAddressBook = KABC::StdAddressBook::self(); 151 mAddressBook = KABC::StdAddressBook::self();
150 KABC::StdAddressBook::setAutomaticSave( false ); 152 KABC::StdAddressBook::setAutomaticSave( false );
151 153
152#ifndef KAB_EMBEDDED 154#ifndef KAB_EMBEDDED
153 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 155 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
154#endif //KAB_EMBEDDED 156#endif //KAB_EMBEDDED
155 157
156 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 158 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
157 SLOT( addressBookChanged() ) ); 159 SLOT( addressBookChanged() ) );
158 160
159 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 161 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
160 "X-Department", "KADDRESSBOOK" ); 162 "X-Department", "KADDRESSBOOK" );
161 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 163 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
162 "X-Profession", "KADDRESSBOOK" ); 164 "X-Profession", "KADDRESSBOOK" );
163 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 165 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
164 "X-AssistantsName", "KADDRESSBOOK" ); 166 "X-AssistantsName", "KADDRESSBOOK" );
165 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 167 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
166 "X-ManagersName", "KADDRESSBOOK" ); 168 "X-ManagersName", "KADDRESSBOOK" );
167 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 169 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
168 "X-SpousesName", "KADDRESSBOOK" ); 170 "X-SpousesName", "KADDRESSBOOK" );
169 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 171 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
170 "X-Office", "KADDRESSBOOK" ); 172 "X-Office", "KADDRESSBOOK" );
171 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 173 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
172 "X-IMAddress", "KADDRESSBOOK" ); 174 "X-IMAddress", "KADDRESSBOOK" );
173 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 175 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
174 "X-Anniversary", "KADDRESSBOOK" ); 176 "X-Anniversary", "KADDRESSBOOK" );
175 177
176 //US added this field to become compatible with Opie/qtopia addressbook 178 //US added this field to become compatible with Opie/qtopia addressbook
177 // values can be "female" or "male" or "". An empty field represents undefined. 179 // values can be "female" or "male" or "". An empty field represents undefined.
178 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 180 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
179 "X-Gender", "KADDRESSBOOK" ); 181 "X-Gender", "KADDRESSBOOK" );
180 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 182 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
181 "X-Children", "KADDRESSBOOK" ); 183 "X-Children", "KADDRESSBOOK" );
182 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 184 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
183 "X-FreeBusyUrl", "KADDRESSBOOK" ); 185 "X-FreeBusyUrl", "KADDRESSBOOK" );
184 186
185 initGUI(); 187 initGUI();
186 188
187 mIncSearchWidget->setFocus(); 189 mIncSearchWidget->setFocus();
188 190
189 191
190 connect( mViewManager, SIGNAL( selected( const QString& ) ), 192 connect( mViewManager, SIGNAL( selected( const QString& ) ),
191 SLOT( setContactSelected( const QString& ) ) ); 193 SLOT( setContactSelected( const QString& ) ) );
192 connect( mViewManager, SIGNAL( executed( const QString& ) ), 194 connect( mViewManager, SIGNAL( executed( const QString& ) ),
193 SLOT( editContact( const QString& ) ) ); 195 SLOT( editContact( const QString& ) ) );
194 connect( mViewManager, SIGNAL( deleteRequest( ) ), 196 connect( mViewManager, SIGNAL( deleteRequest( ) ),
195 SLOT( deleteContacts( ) ) ); 197 SLOT( deleteContacts( ) ) );
196 connect( mViewManager, SIGNAL( modified() ), 198 connect( mViewManager, SIGNAL( modified() ),
197 SLOT( setModified() ) ); 199 SLOT( setModified() ) );
198 200
199 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 201 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
200 202
201 connect( mXXPortManager, SIGNAL( modified() ), 203 connect( mXXPortManager, SIGNAL( modified() ),
202 SLOT( setModified() ) ); 204 SLOT( setModified() ) );
203 205
204 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 206 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
205 SLOT( incrementalSearch( const QString& ) ) ); 207 SLOT( incrementalSearch( const QString& ) ) );
206 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 208 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
207 mJumpButtonBar, SLOT( recreateButtons() ) ); 209 mJumpButtonBar, SLOT( recreateButtons() ) );
208 210
209 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 211 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
210 SLOT( sendMail( const QString& ) ) ); 212 SLOT( sendMail( const QString& ) ) );
211 213
212#ifndef KAB_EMBEDDED 214#ifndef KAB_EMBEDDED
213 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 215 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
214 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 216 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
215 217
216 connect( mDetails, SIGNAL( browse( const QString& ) ), 218 connect( mDetails, SIGNAL( browse( const QString& ) ),
217 SLOT( browse( const QString& ) ) ); 219 SLOT( browse( const QString& ) ) );
218 220
219 mAddressBookService = new KAddressBookService( this ); 221 mAddressBookService = new KAddressBookService( this );
220 222
221#endif //KAB_EMBEDDED 223#endif //KAB_EMBEDDED
222 mEditorDialog = 0; 224 mEditorDialog = 0;
223 createAddresseeEditorDialog( this ); 225 createAddresseeEditorDialog( this );
224 setModified( false ); 226 setModified( false );
225} 227}
226 228
227KABCore::~KABCore() 229KABCore::~KABCore()
228{ 230{
229 // save(); 231 // save();
230 //saveSettings(); 232 //saveSettings();
231 //KABPrefs::instance()->writeConfig(); 233 //KABPrefs::instance()->writeConfig();
232 delete AddresseeConfig::instance(); 234 delete AddresseeConfig::instance();
233 mAddressBook = 0; 235 mAddressBook = 0;
234 KABC::StdAddressBook::close(); 236 KABC::StdAddressBook::close();
235} 237}
236 238
237void KABCore::restoreSettings() 239void KABCore::restoreSettings()
238{ 240{
239 bool state = KABPrefs::instance()->mJumpButtonBarVisible; 241 bool state = KABPrefs::instance()->mJumpButtonBarVisible;
240 242
241 mActionJumpBar->setChecked( state ); 243 mActionJumpBar->setChecked( state );
242 setJumpButtonBarVisible( state ); 244 setJumpButtonBarVisible( state );
243 245
244 state = KABPrefs::instance()->mDetailsPageVisible; 246 state = KABPrefs::instance()->mDetailsPageVisible;
245 247
246 mActionDetails->setChecked( state ); 248 mActionDetails->setChecked( state );
247 setDetailsVisible( state ); 249 setDetailsVisible( state );
248 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 250 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
249 if ( splitterSize.count() == 0 ) { 251 if ( splitterSize.count() == 0 ) {
250 splitterSize.append( width() / 2 ); 252 splitterSize.append( width() / 2 );
251 splitterSize.append( width() / 2 ); 253 splitterSize.append( width() / 2 );
252 } 254 }
253 mMiniSplitter->setSizes( splitterSize ); 255 mMiniSplitter->setSizes( splitterSize );
254 if ( mExtensionBarSplitter ) { 256 if ( mExtensionBarSplitter ) {
255 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 257 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
256 if ( splitterSize.count() == 0 ) { 258 if ( splitterSize.count() == 0 ) {
257 splitterSize.append( width() / 2 ); 259 splitterSize.append( width() / 2 );
258 splitterSize.append( width() / 2 ); 260 splitterSize.append( width() / 2 );
259 } 261 }
260 mExtensionBarSplitter->setSizes( splitterSize ); 262 mExtensionBarSplitter->setSizes( splitterSize );
261 263
262 } 264 }
263#ifndef KAB_EMBEDDED 265#ifndef KAB_EMBEDDED
264 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; 266 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter;
265 if ( splitterSize.count() == 0 ) { 267 if ( splitterSize.count() == 0 ) {
266 splitterSize.append( width() / 2 ); 268 splitterSize.append( width() / 2 );
267 splitterSize.append( width() / 2 ); 269 splitterSize.append( width() / 2 );
268 } 270 }
269 mExtensionBarSplitter->setSizes( splitterSize ); 271 mExtensionBarSplitter->setSizes( splitterSize );
270 272
271 splitterSize = KABPrefs::instance()->mDetailsSplitter; 273 splitterSize = KABPrefs::instance()->mDetailsSplitter;
272 if ( splitterSize.count() == 0 ) { 274 if ( splitterSize.count() == 0 ) {
273 splitterSize.append( height() / 2 ); 275 splitterSize.append( height() / 2 );
274 splitterSize.append( height() / 2 ); 276 splitterSize.append( height() / 2 );
275 } 277 }
276 mDetailsSplitter->setSizes( splitterSize ); 278 mDetailsSplitter->setSizes( splitterSize );
277 279
278 mExtensionManager->restoreSettings(); 280 mExtensionManager->restoreSettings();
279 281
280#endif //KAB_EMBEDDED 282#endif //KAB_EMBEDDED
281 283
282 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 284 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
283 285
284 mViewManager->restoreSettings(); 286 mViewManager->restoreSettings();
285 mExtensionManager->restoreSettings(); 287 mExtensionManager->restoreSettings();
286} 288}
287 289
288void KABCore::saveSettings() 290void KABCore::saveSettings()
289{ 291{
290 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 292 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
291 if ( mExtensionBarSplitter ) 293 if ( mExtensionBarSplitter )
292 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 294 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
293 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 295 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
294 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 296 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
295#ifndef KAB_EMBEDDED 297#ifndef KAB_EMBEDDED
296 298
297 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 299 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
298 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 300 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
299#endif //KAB_EMBEDDED 301#endif //KAB_EMBEDDED
300 mExtensionManager->saveSettings(); 302 mExtensionManager->saveSettings();
301 mViewManager->saveSettings(); 303 mViewManager->saveSettings();
302 304
303 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 305 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
304 306
305} 307}
306 308
307KABC::AddressBook *KABCore::addressBook() const 309KABC::AddressBook *KABCore::addressBook() const
308{ 310{
309 return mAddressBook; 311 return mAddressBook;
310} 312}
311 313
312KConfig *KABCore::config() 314KConfig *KABCore::config()
313{ 315{
314#ifndef KAB_EMBEDDED 316#ifndef KAB_EMBEDDED
315 return KABPrefs::instance()->config(); 317 return KABPrefs::instance()->config();
316#else //KAB_EMBEDDED 318#else //KAB_EMBEDDED
317 return KABPrefs::instance()->getConfig(); 319 return KABPrefs::instance()->getConfig();
318#endif //KAB_EMBEDDED 320#endif //KAB_EMBEDDED
319} 321}
320 322
321KActionCollection *KABCore::actionCollection() const 323KActionCollection *KABCore::actionCollection() const
322{ 324{
323 return mGUIClient->actionCollection(); 325 return mGUIClient->actionCollection();
324} 326}
325 327
326KABC::Field *KABCore::currentSearchField() const 328KABC::Field *KABCore::currentSearchField() const
327{ 329{
328 if (mIncSearchWidget) 330 if (mIncSearchWidget)
329 return mIncSearchWidget->currentField(); 331 return mIncSearchWidget->currentField();
330 else 332 else
331 return 0; 333 return 0;
332} 334}
333 335
334QStringList KABCore::selectedUIDs() const 336QStringList KABCore::selectedUIDs() const
335{ 337{
336 return mViewManager->selectedUids(); 338 return mViewManager->selectedUids();
337} 339}
338 340
339KABC::Resource *KABCore::requestResource( QWidget *parent ) 341KABC::Resource *KABCore::requestResource( QWidget *parent )
340{ 342{
341 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 343 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
342 344
343 QPtrList<KRES::Resource> kresResources; 345 QPtrList<KRES::Resource> kresResources;
344 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 346 QPtrListIterator<KABC::Resource> resIt( kabcResources );
345 KABC::Resource *resource; 347 KABC::Resource *resource;
346 while ( ( resource = resIt.current() ) != 0 ) { 348 while ( ( resource = resIt.current() ) != 0 ) {
347 ++resIt; 349 ++resIt;
348 if ( !resource->readOnly() ) { 350 if ( !resource->readOnly() ) {
349 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 351 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
350 if ( res ) 352 if ( res )
351 kresResources.append( res ); 353 kresResources.append( res );
352 } 354 }
353 } 355 }
354 356
355 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 357 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
356 return static_cast<KABC::Resource*>( res ); 358 return static_cast<KABC::Resource*>( res );
357} 359}
358 360
359#ifndef KAB_EMBEDDED 361#ifndef KAB_EMBEDDED
360KAboutData *KABCore::createAboutData() 362KAboutData *KABCore::createAboutData()
361#else //KAB_EMBEDDED 363#else //KAB_EMBEDDED
362void KABCore::createAboutData() 364void KABCore::createAboutData()
363#endif //KAB_EMBEDDED 365#endif //KAB_EMBEDDED
364{ 366{
365#ifndef KAB_EMBEDDED 367#ifndef KAB_EMBEDDED
366 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 368 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
367 "3.1", I18N_NOOP( "The KDE Address Book" ), 369 "3.1", I18N_NOOP( "The KDE Address Book" ),
368 KAboutData::License_GPL_V2, 370 KAboutData::License_GPL_V2,
369 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 371 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
370 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 372 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
371 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 373 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
372 about->addAuthor( "Cornelius Schumacher", 374 about->addAuthor( "Cornelius Schumacher",
373 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 375 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
374 "schumacher@kde.org" ); 376 "schumacher@kde.org" );
375 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 377 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
376 "mpilone@slac.com" ); 378 "mpilone@slac.com" );
377 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 379 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
378 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 380 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
379 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 381 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
380 "michel@klaralvdalens-datakonsult.se" ); 382 "michel@klaralvdalens-datakonsult.se" );
381 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 383 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
382 "hansen@kde.org" ); 384 "hansen@kde.org" );
383 385
384 return about; 386 return about;
385#endif //KAB_EMBEDDED 387#endif //KAB_EMBEDDED
386 388
387 QString version; 389 QString version;
388#include <../version> 390#include <../version>
389 QMessageBox::about( this, "About KAddressbook/Pi", 391 QMessageBox::about( this, "About KAddressbook/Pi",
390 "KAddressbook/Platform-independent\n" 392 "KAddressbook/Platform-independent\n"
391 "(KA/Pi) " +version + " - " + 393 "(KA/Pi) " +version + " - " +
392#ifdef DESKTOP_VERSION 394#ifdef DESKTOP_VERSION
393 "Desktop Edition\n" 395 "Desktop Edition\n"
394#else 396#else
395 "PDA-Edition\n" 397 "PDA-Edition\n"
396 "for: Zaurus 5500 / 7x0 / 8x0\n" 398 "for: Zaurus 5500 / 7x0 / 8x0\n"
397#endif 399#endif
398 400
399 "(c) 2004 Ulf Schenk\n" 401 "(c) 2004 Ulf Schenk\n"
400 "(c) 1997-2003, The KDE PIM Team\n" 402 "(c) 1997-2003, The KDE PIM Team\n"
401 "Tobias Koenig Current maintainer tokoe@kde.org\n" 403 "Tobias Koenig Current maintainer tokoe@kde.org\n"
402 "Don Sanders Original author\n" 404 "Don Sanders Original author\n"
403 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" 405 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n"
404 "Mike Pilone GUI and framework redesign mpilone@slac.com\n" 406 "Mike Pilone GUI and framework redesign mpilone@slac.com\n"
405 "Greg Stern DCOP interface\n" 407 "Greg Stern DCOP interface\n"
406 "Mark Westcot Contact pinning\n" 408 "Mark Westcot Contact pinning\n"
407 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 409 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
408 "Steffen Hansen LDAP Lookup hansen@kde.org\n" 410 "Steffen Hansen LDAP Lookup hansen@kde.org\n"
409#ifdef _WIN32_ 411#ifdef _WIN32_
410 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" 412 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n"
411#endif 413#endif
412 ); 414 );
413} 415}
414 416
415void KABCore::setContactSelected( const QString &uid ) 417void KABCore::setContactSelected( const QString &uid )
416{ 418{
417 KABC::Addressee addr = mAddressBook->findByUid( uid ); 419 KABC::Addressee addr = mAddressBook->findByUid( uid );
418 if ( !mDetails->isHidden() ) 420 if ( !mDetails->isHidden() )
419 mDetails->setAddressee( addr ); 421 mDetails->setAddressee( addr );
420 422
421 if ( !addr.isEmpty() ) { 423 if ( !addr.isEmpty() ) {
422 emit contactSelected( addr.formattedName() ); 424 emit contactSelected( addr.formattedName() );
423 KABC::Picture pic = addr.photo(); 425 KABC::Picture pic = addr.photo();
424 if ( pic.isIntern() ) { 426 if ( pic.isIntern() ) {
425//US emit contactSelected( pic.data() ); 427//US emit contactSelected( pic.data() );
426//US instead use: 428//US instead use:
427 QPixmap px; 429 QPixmap px;
428 if (pic.data().isNull() != true) 430 if (pic.data().isNull() != true)
429 { 431 {
430 px.convertFromImage(pic.data()); 432 px.convertFromImage(pic.data());
431 } 433 }
432 434
433 emit contactSelected( px ); 435 emit contactSelected( px );
434 } 436 }
435 } 437 }
436 438
437 439
438 mExtensionManager->setSelectionChanged(); 440 mExtensionManager->setSelectionChanged();
439 441
440 // update the actions 442 // update the actions
441 bool selected = !uid.isEmpty(); 443 bool selected = !uid.isEmpty();
442 444
443 if ( mReadWrite ) { 445 if ( mReadWrite ) {
444 mActionCut->setEnabled( selected ); 446 mActionCut->setEnabled( selected );
445 mActionPaste->setEnabled( selected ); 447 mActionPaste->setEnabled( selected );
446 } 448 }
447 449
448 mActionCopy->setEnabled( selected ); 450 mActionCopy->setEnabled( selected );
449 mActionDelete->setEnabled( selected ); 451 mActionDelete->setEnabled( selected );
450 mActionEditAddressee->setEnabled( selected ); 452 mActionEditAddressee->setEnabled( selected );
451 mActionMail->setEnabled( selected ); 453 mActionMail->setEnabled( selected );
452 mActionMailVCard->setEnabled( selected ); 454 mActionMailVCard->setEnabled( selected );
453 //if (mActionBeam) 455 //if (mActionBeam)
454 //mActionBeam->setEnabled( selected ); 456 //mActionBeam->setEnabled( selected );
455 457
456 if (mActionBeamVCard) 458 if (mActionBeamVCard)
457 mActionBeamVCard->setEnabled( selected ); 459 mActionBeamVCard->setEnabled( selected );
458 460
459 mActionWhoAmI->setEnabled( selected ); 461 mActionWhoAmI->setEnabled( selected );
460 mActionCategories->setEnabled( selected ); 462 mActionCategories->setEnabled( selected );
461} 463}
462 464
463void KABCore::sendMail() 465void KABCore::sendMail()
464{ 466{
465 sendMail( mViewManager->selectedEmails().join( ", " ) ); 467 sendMail( mViewManager->selectedEmails().join( ", " ) );
466} 468}
467 469
468void KABCore::sendMail( const QString& email ) 470void KABCore::sendMail( const QString& email )
469{ 471{
470//US original kde implementation : kapp->invokeMailer( email, "" ); 472 bool result = ExternalAppHandler::instance()->mailToContacts(email);
471
472/*US original qtopia implementation
473 PimContact c = abList->currentEntry();
474 QString name = c.fileAs();
475 QString email = c.defaultEmail();
476#ifndef QT_NO_COP
477 QCopEnvelope e(Service::channel("Email"), "writeMail(QString,QString)");
478 e << name << email;
479#else
480*/
481
482
483#ifndef QT_NO_COP
484 QCString channel = KABPrefs::instance()->mEmailChannel.latin1();
485 qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")");
486
487 QCopEnvelope e(channel, "writeMail(QString,QString)");
488 //US we need no names in the To field. The emailadresses are enough
489 e << "" << email;
490#else
491 KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) );
492#endif
493} 473}
494 474
495 475
496 476
497void KABCore::mailVCard() 477void KABCore::mailVCard()
498{ 478{
499 QStringList uids = mViewManager->selectedUids(); 479 QStringList uids = mViewManager->selectedUids();
500 if ( !uids.isEmpty() ) 480 if ( !uids.isEmpty() )
501 mailVCard( uids ); 481 mailVCard( uids );
502} 482}
503 483
504void KABCore::mailVCard( const QStringList& uids ) 484void KABCore::mailVCard( const QStringList& uids )
505{ 485{
506 QStringList urls; 486 QStringList urls;
507 487
508 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 488 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
509 489
510/*US 490/*US
511 // Create a temp dir, so that we can put the files in it with proper names 491 // Create a temp dir, so that we can put the files in it with proper names
512 KTempFile tempDir; 492 KTempFile tempDir;
513 if ( tempDir.status() != 0 ) { 493 if ( tempDir.status() != 0 ) {
514 kdWarning() << strerror( tempDir.status() ) << endl; 494 kdWarning() << strerror( tempDir.status() ) << endl;
515 return; 495 return;
516 } 496 }
517 497
518 QString dirName = tempDir.name(); 498 QString dirName = tempDir.name();
519 tempDir.unlink(); 499 tempDir.unlink();
520*/ 500*/
521 QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); 501 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
522 502
523 503
524 504
525 QDir().mkdir( dirName, true ); 505 QDir().mkdir( dirName, true );
526 506
527 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 507 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
528 KABC::Addressee a = mAddressBook->findByUid( *it ); 508 KABC::Addressee a = mAddressBook->findByUid( *it );
529 509
530 if ( a.isEmpty() ) 510 if ( a.isEmpty() )
531 continue; 511 continue;
532 512
533 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 513 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
534 514
535 QString fileName = dirName + "/" + name; 515 QString fileName = dirName + "/" + name;
536 516
537 QFile outFile(fileName); 517 QFile outFile(fileName);
538 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 518 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
539 KABC::VCardConverter converter; 519 KABC::VCardConverter converter;
540 QString vcard; 520 QString vcard;
541 521
542 converter.addresseeToVCard( a, vcard ); 522 converter.addresseeToVCard( a, vcard );
543 523
544 QTextStream t( &outFile ); // use a text stream 524 QTextStream t( &outFile ); // use a text stream
545 t.setEncoding( QTextStream::UnicodeUTF8 ); 525 t.setEncoding( QTextStream::UnicodeUTF8 );
546 t << vcard; 526 t << vcard;
547 527
548 outFile.close(); 528 outFile.close();
549 529
550 urls.append( fileName ); 530 urls.append( fileName );
551 } 531 }
552 } 532 }
533
534 bool result = ExternalAppHandler::instance()->mailAttachments(urls.join(", "));
535
536
553/*US 537/*US
554 kapp->invokeMailer( QString::null, QString::null, QString::null, 538 kapp->invokeMailer( QString::null, QString::null, QString::null,
555 QString::null, // subject 539 QString::null, // subject
556 QString::null, // body 540 QString::null, // body
557 QString::null, 541 QString::null,
558 urls ); // attachments 542 urls ); // attachments
559*/ 543*/
560#ifndef QT_NO_COP
561 QCString channel = KABPrefs::instance()->mEmailChannel.latin1();
562 qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")");
563
564 QMap<QString, QString> parameterMap;
565 parameterMap.insert("ATTACHMENT<n>", urls.join(", "));
566
567 QCopEnvelope e(channel, "writeMail(QMap(QString,QString))");
568 e << parameterMap;
569#else
570 KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) );
571#endif
572
573 544
574} 545}
575 546
576/** 547/**
577 Beams the "WhoAmI contact. 548 Beams the "WhoAmI contact.
578*/ 549*/
579void KABCore::beamMySelf() 550void KABCore::beamMySelf()
580{ 551{
581 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 552 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
582 if (!a.isEmpty()) 553 if (!a.isEmpty())
583 { 554 {
584 QStringList uids; 555 QStringList uids;
585 uids << a.uid(); 556 uids << a.uid();
586 557
587 beamVCard(uids); 558 beamVCard(uids);
588 } else { 559 } else {
589 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 560 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
590 561
591 562
592 } 563 }
593} 564}
594 565
595void KABCore::beamVCard() 566void KABCore::beamVCard()
596{ 567{
597 QStringList uids = mViewManager->selectedUids(); 568 QStringList uids = mViewManager->selectedUids();
598 if ( !uids.isEmpty() ) 569 if ( !uids.isEmpty() )
599 beamVCard( uids ); 570 beamVCard( uids );
600} 571}
601 572
602 573
603void KABCore::beamVCard(const QStringList& uids) 574void KABCore::beamVCard(const QStringList& uids)
604{ 575{
605/*US 576/*US
606 QString beamFilename; 577 QString beamFilename;
607 Opie::OPimContact c; 578 Opie::OPimContact c;
608 if ( actionPersonal->isOn() ) { 579 if ( actionPersonal->isOn() ) {
609 beamFilename = addressbookPersonalVCardName(); 580 beamFilename = addressbookPersonalVCardName();
610 if ( !QFile::exists( beamFilename ) ) 581 if ( !QFile::exists( beamFilename ) )
611 return; // can't beam a non-existent file 582 return; // can't beam a non-existent file
612 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 583 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
613 beamFilename ); 584 beamFilename );
614 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 585 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
615 Opie::OPimContactAccess::List allList = access->allRecords(); 586 Opie::OPimContactAccess::List allList = access->allRecords();
616 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first 587 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
617 c = *it; 588 c = *it;
618 589
619 delete access; 590 delete access;
620 } else { 591 } else {
621 unlink( beamfile ); // delete if exists 592 unlink( beamfile ); // delete if exists
622 mkdir("/tmp/obex/", 0755); 593 mkdir("/tmp/obex/", 0755);
623 c = m_abView -> currentEntry(); 594 c = m_abView -> currentEntry();
624 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 595 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
625 beamfile ); 596 beamfile );
626 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 597 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
627 access->add( c ); 598 access->add( c );
628 access->save(); 599 access->save();
629 delete access; 600 delete access;
630 601
631 beamFilename = beamfile; 602 beamFilename = beamfile;
632 } 603 }
633 604
634 owarn << "Beaming: " << beamFilename << oendl; 605 owarn << "Beaming: " << beamFilename << oendl;
635*/ 606*/
636 607
637#if 0 608#if 0
638 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 609 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
639 610
640 QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); 611 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
641 612
642 QString name = "contact.vcf"; 613 QString name = "contact.vcf";
643 614
644 QString fileName = dirName + "/" + name; 615 QString fileName = dirName + "/" + name;
645#endif 616#endif
646 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory 617 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory
647 // 618 //
648 QString fileName = "/tmp/kdepimbeamfile"; 619 QString fileName = "/tmp/kdepimbeamfile";
649 620
650 621
651 //QDir().mkdir( dirName, true ); 622 //QDir().mkdir( dirName, true );
652 623
653 QFile outFile(fileName); 624 QFile outFile(fileName);
654 KABC::VCardConverter converter; 625 KABC::VCardConverter converter;
655 QString description; 626 QString description;
656 627
657 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 628 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
658 629
659 QTextStream t( &outFile ); // use a text stream 630 QTextStream t( &outFile ); // use a text stream
660 t.setEncoding( QTextStream::UnicodeUTF8 ); 631 t.setEncoding( QTextStream::UnicodeUTF8 );
661 632
662 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 633 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
663 KABC::Addressee a = mAddressBook->findByUid( *it ); 634 KABC::Addressee a = mAddressBook->findByUid( *it );
664 635
665 if ( a.isEmpty() ) 636 if ( a.isEmpty() )
666 continue; 637 continue;
667 638
668 if (description.isEmpty()) 639 if (description.isEmpty())
669 description = a.formattedName(); 640 description = a.formattedName();
670 641
671 QString vcard; 642 QString vcard;
672 converter.addresseeToVCard( a, vcard ); 643 converter.addresseeToVCard( a, vcard );
673 t << vcard; 644 t << vcard;
674 645
675 } 646 }
676 } else { 647 } else {
677 qDebug("Error open temp beam file "); 648 qDebug("Error open temp beam file ");
678 return; 649 return;
679 } 650 }
680 651
681 outFile.close(); 652 outFile.close();
682 653
683#ifndef DESKTOP_VERSION 654#ifndef DESKTOP_VERSION
684 Ir *ir = new Ir( this ); 655 Ir *ir = new Ir( this );
685 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 656 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
686 ir->send( fileName, description, "text/x-vCard" ); 657 ir->send( fileName, description, "text/x-vCard" );
687#endif 658#endif
688 659
689} 660}
690 661
691void KABCore::beamDone( Ir *ir ) 662void KABCore::beamDone( Ir *ir )
692{ 663{
693#ifndef DESKTOP_VERSION 664#ifndef DESKTOP_VERSION
694 delete ir; 665 delete ir;
695#endif 666#endif
696} 667}
697 668
698 669
699void KABCore::browse( const QString& url ) 670void KABCore::browse( const QString& url )
700{ 671{
701#ifndef KAB_EMBEDDED 672#ifndef KAB_EMBEDDED
702 kapp->invokeBrowser( url ); 673 kapp->invokeBrowser( url );
703#else //KAB_EMBEDDED 674#else //KAB_EMBEDDED
704 qDebug("KABCore::browse must be fixed"); 675 qDebug("KABCore::browse must be fixed");
705#endif //KAB_EMBEDDED 676#endif //KAB_EMBEDDED
706} 677}
707 678
708void KABCore::selectAllContacts() 679void KABCore::selectAllContacts()
709{ 680{
710 mViewManager->setSelected( QString::null, true ); 681 mViewManager->setSelected( QString::null, true );
711} 682}
712 683
713void KABCore::deleteContacts() 684void KABCore::deleteContacts()
714{ 685{
715 QStringList uidList = mViewManager->selectedUids(); 686 QStringList uidList = mViewManager->selectedUids();
716 deleteContacts( uidList ); 687 deleteContacts( uidList );
717} 688}
718 689
719void KABCore::deleteContacts( const QStringList &uids ) 690void KABCore::deleteContacts( const QStringList &uids )
720{ 691{
721 if ( uids.count() > 0 ) { 692 if ( uids.count() > 0 ) {
722 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 693 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
723 UndoStack::instance()->push( command ); 694 UndoStack::instance()->push( command );
724 RedoStack::instance()->clear(); 695 RedoStack::instance()->clear();
725 696
726 // now if we deleted anything, refresh 697 // now if we deleted anything, refresh
727 setContactSelected( QString::null ); 698 setContactSelected( QString::null );
728 setModified( true ); 699 setModified( true );
729 } 700 }
730} 701}
731 702
732void KABCore::copyContacts() 703void KABCore::copyContacts()
733{ 704{
734 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 705 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
735 706
736 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 707 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
737 708
738 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 709 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
739 710
740 QClipboard *cb = QApplication::clipboard(); 711 QClipboard *cb = QApplication::clipboard();
741 cb->setText( clipText ); 712 cb->setText( clipText );
742} 713}
743 714
744void KABCore::cutContacts() 715void KABCore::cutContacts()
745{ 716{
746 QStringList uidList = mViewManager->selectedUids(); 717 QStringList uidList = mViewManager->selectedUids();
747 718
748//US if ( uidList.size() > 0 ) { 719//US if ( uidList.size() > 0 ) {
749 if ( uidList.count() > 0 ) { 720 if ( uidList.count() > 0 ) {
750 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 721 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
751 UndoStack::instance()->push( command ); 722 UndoStack::instance()->push( command );
752 RedoStack::instance()->clear(); 723 RedoStack::instance()->clear();
753 724
754 setModified( true ); 725 setModified( true );
755 } 726 }
756} 727}
757 728
758void KABCore::pasteContacts() 729void KABCore::pasteContacts()
759{ 730{
760 QClipboard *cb = QApplication::clipboard(); 731 QClipboard *cb = QApplication::clipboard();
761 732
762 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 733 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
763 734
764 pasteContacts( list ); 735 pasteContacts( list );
765} 736}
766 737
767void KABCore::pasteContacts( KABC::Addressee::List &list ) 738void KABCore::pasteContacts( KABC::Addressee::List &list )
768{ 739{
769 KABC::Resource *resource = requestResource( this ); 740 KABC::Resource *resource = requestResource( this );
770 KABC::Addressee::List::Iterator it; 741 KABC::Addressee::List::Iterator it;
771 for ( it = list.begin(); it != list.end(); ++it ) 742 for ( it = list.begin(); it != list.end(); ++it )
772 (*it).setResource( resource ); 743 (*it).setResource( resource );
773 744
774 PwPasteCommand *command = new PwPasteCommand( this, list ); 745 PwPasteCommand *command = new PwPasteCommand( this, list );
775 UndoStack::instance()->push( command ); 746 UndoStack::instance()->push( command );
776 RedoStack::instance()->clear(); 747 RedoStack::instance()->clear();
777 748
778 setModified( true ); 749 setModified( true );
779} 750}
780 751
781void KABCore::setWhoAmI() 752void KABCore::setWhoAmI()
782{ 753{
783 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 754 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
784 755
785 if ( addrList.count() > 1 ) { 756 if ( addrList.count() > 1 ) {
786 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 757 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
787 return; 758 return;
788 } 759 }
789 760
790 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 761 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
791 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 762 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
792 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 763 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
793} 764}
794 765
795void KABCore::setCategories() 766void KABCore::setCategories()
796{ 767{
797 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 768 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
798 if ( !dlg.exec() ) 769 if ( !dlg.exec() )
799 return; 770 return;
800 771
801 bool merge = false; 772 bool merge = false;
802 QString msg = i18n( "Merge with existing categories?" ); 773 QString msg = i18n( "Merge with existing categories?" );
803 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 774 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
804 merge = true; 775 merge = true;
805 776
806 QStringList categories = dlg.selectedCategories(); 777 QStringList categories = dlg.selectedCategories();
807 778
808 QStringList uids = mViewManager->selectedUids(); 779 QStringList uids = mViewManager->selectedUids();
809 QStringList::Iterator it; 780 QStringList::Iterator it;
810 for ( it = uids.begin(); it != uids.end(); ++it ) { 781 for ( it = uids.begin(); it != uids.end(); ++it ) {
811 KABC::Addressee addr = mAddressBook->findByUid( *it ); 782 KABC::Addressee addr = mAddressBook->findByUid( *it );
812 if ( !addr.isEmpty() ) { 783 if ( !addr.isEmpty() ) {
813 if ( !merge ) 784 if ( !merge )
814 addr.setCategories( categories ); 785 addr.setCategories( categories );
815 else { 786 else {
816 QStringList addrCategories = addr.categories(); 787 QStringList addrCategories = addr.categories();
817 QStringList::Iterator catIt; 788 QStringList::Iterator catIt;
818 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 789 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
819 if ( !addrCategories.contains( *catIt ) ) 790 if ( !addrCategories.contains( *catIt ) )
820 addrCategories.append( *catIt ); 791 addrCategories.append( *catIt );
821 } 792 }
822 addr.setCategories( addrCategories ); 793 addr.setCategories( addrCategories );
823 } 794 }
824 795
825 mAddressBook->insertAddressee( addr ); 796 mAddressBook->insertAddressee( addr );
826 } 797 }
827 } 798 }
828 799
829 if ( uids.count() > 0 ) 800 if ( uids.count() > 0 )
830 setModified( true ); 801 setModified( true );
831} 802}
832 803
833void KABCore::setSearchFields( const KABC::Field::List &fields ) 804void KABCore::setSearchFields( const KABC::Field::List &fields )
834{ 805{
835 mIncSearchWidget->setFields( fields ); 806 mIncSearchWidget->setFields( fields );
836} 807}
837 808
838void KABCore::incrementalSearch( const QString& text ) 809void KABCore::incrementalSearch( const QString& text )
839{ 810{
840 mViewManager->setSelected( QString::null, false ); 811 mViewManager->setSelected( QString::null, false );
841 812
842 if ( !text.isEmpty() ) { 813 if ( !text.isEmpty() ) {
843 KABC::Field *field = mIncSearchWidget->currentField(); 814 KABC::Field *field = mIncSearchWidget->currentField();
844 815
845 QString pattern = text.lower(); 816 QString pattern = text.lower();
846 817
847#if 1 //KDE_VERSION >= 319 818#if 1 //KDE_VERSION >= 319
848 KABC::AddresseeList list( mAddressBook->allAddressees() ); 819 KABC::AddresseeList list( mAddressBook->allAddressees() );
849 if ( field ) { 820 if ( field ) {
850 list.sortByField( field ); 821 list.sortByField( field );
851 KABC::AddresseeList::Iterator it; 822 KABC::AddresseeList::Iterator it;
852 for ( it = list.begin(); it != list.end(); ++it ) { 823 for ( it = list.begin(); it != list.end(); ++it ) {
853 if ( field->value( *it ).lower().startsWith( pattern ) ) { 824 if ( field->value( *it ).lower().startsWith( pattern ) ) {
854 mViewManager->setSelected( (*it).uid(), true ); 825 mViewManager->setSelected( (*it).uid(), true );
855 return; 826 return;
856 } 827 }
857 } 828 }
858 } else { 829 } else {
859 KABC::AddresseeList::Iterator it; 830 KABC::AddresseeList::Iterator it;
860 for ( it = list.begin(); it != list.end(); ++it ) { 831 for ( it = list.begin(); it != list.end(); ++it ) {
861 KABC::Field::List fieldList = mIncSearchWidget->fields(); 832 KABC::Field::List fieldList = mIncSearchWidget->fields();
862 KABC::Field::List::ConstIterator fieldIt; 833 KABC::Field::List::ConstIterator fieldIt;
863 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 834 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
864 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 835 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
865 mViewManager->setSelected( (*it).uid(), true ); 836 mViewManager->setSelected( (*it).uid(), true );
866 return; 837 return;
867 } 838 }
868 } 839 }
869 } 840 }
870 } 841 }
871#else 842#else
872 KABC::AddressBook::Iterator it; 843 KABC::AddressBook::Iterator it;
873 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 844 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
874 if ( field ) { 845 if ( field ) {
875 if ( field->value( *it ).lower().startsWith( pattern ) ) { 846 if ( field->value( *it ).lower().startsWith( pattern ) ) {
876 mViewManager->setSelected( (*it).uid(), true ); 847 mViewManager->setSelected( (*it).uid(), true );
877 return; 848 return;
878 } 849 }
879 } else { 850 } else {
880 KABC::Field::List fieldList = mIncSearchWidget->fields(); 851 KABC::Field::List fieldList = mIncSearchWidget->fields();
881 KABC::Field::List::ConstIterator fieldIt; 852 KABC::Field::List::ConstIterator fieldIt;
882 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 853 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
883 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 854 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
884 mViewManager->setSelected( (*it).uid(), true ); 855 mViewManager->setSelected( (*it).uid(), true );
885 return; 856 return;
886 } 857 }
887 } 858 }
888 } 859 }
889 } 860 }
890#endif 861#endif
891 } 862 }
892} 863}
893 864
894void KABCore::setModified() 865void KABCore::setModified()
895{ 866{
896 setModified( true ); 867 setModified( true );
897} 868}
898 869
899void KABCore::setModifiedWOrefresh() 870void KABCore::setModifiedWOrefresh()
900{ 871{
901 // qDebug("KABCore::setModifiedWOrefresh() "); 872 // qDebug("KABCore::setModifiedWOrefresh() ");
902 mModified = true; 873 mModified = true;
903 mActionSave->setEnabled( mModified ); 874 mActionSave->setEnabled( mModified );
904#ifdef DESKTOP_VERSION 875#ifdef DESKTOP_VERSION
905 mDetails->refreshView(); 876 mDetails->refreshView();
906#endif 877#endif
907 878
908} 879}
909void KABCore::setModified( bool modified ) 880void KABCore::setModified( bool modified )
910{ 881{
911 mModified = modified; 882 mModified = modified;
912 mActionSave->setEnabled( mModified ); 883 mActionSave->setEnabled( mModified );
913 884
914 if ( modified ) 885 if ( modified )
915 mJumpButtonBar->recreateButtons(); 886 mJumpButtonBar->recreateButtons();
916 887
917 mViewManager->refreshView(); 888 mViewManager->refreshView();
918 mDetails->refreshView(); 889 mDetails->refreshView();
919 890
920} 891}
921 892
922bool KABCore::modified() const 893bool KABCore::modified() const
923{ 894{
924 return mModified; 895 return mModified;
925} 896}
926 897
927void KABCore::contactModified( const KABC::Addressee &addr ) 898void KABCore::contactModified( const KABC::Addressee &addr )
928{ 899{
929 900
930 Command *command = 0; 901 Command *command = 0;
931 QString uid; 902 QString uid;
932 903
933 // check if it exists already 904 // check if it exists already
934 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 905 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
935 if ( origAddr.isEmpty() ) 906 if ( origAddr.isEmpty() )
936 command = new PwNewCommand( mAddressBook, addr ); 907 command = new PwNewCommand( mAddressBook, addr );
937 else { 908 else {
938 command = new PwEditCommand( mAddressBook, origAddr, addr ); 909 command = new PwEditCommand( mAddressBook, origAddr, addr );
939 uid = addr.uid(); 910 uid = addr.uid();
940 } 911 }
941 912
942 UndoStack::instance()->push( command ); 913 UndoStack::instance()->push( command );
943 RedoStack::instance()->clear(); 914 RedoStack::instance()->clear();
944 915
945 setModified( true ); 916 setModified( true );
946} 917}
947 918
948void KABCore::newContact() 919void KABCore::newContact()
949{ 920{
950 921
951 922
952 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 923 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
953 924
954 QPtrList<KRES::Resource> kresResources; 925 QPtrList<KRES::Resource> kresResources;
955 QPtrListIterator<KABC::Resource> it( kabcResources ); 926 QPtrListIterator<KABC::Resource> it( kabcResources );
956 KABC::Resource *resource; 927 KABC::Resource *resource;
957 while ( ( resource = it.current() ) != 0 ) { 928 while ( ( resource = it.current() ) != 0 ) {
958 ++it; 929 ++it;
959 if ( !resource->readOnly() ) { 930 if ( !resource->readOnly() ) {
960 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 931 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
961 if ( res ) 932 if ( res )
962 kresResources.append( res ); 933 kresResources.append( res );
963 } 934 }
964 } 935 }
965 936
966 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 937 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
967 resource = static_cast<KABC::Resource*>( res ); 938 resource = static_cast<KABC::Resource*>( res );
968 939
969 if ( resource ) { 940 if ( resource ) {
970 KABC::Addressee addr; 941 KABC::Addressee addr;
971 addr.setResource( resource ); 942 addr.setResource( resource );
972 mEditorDialog->setAddressee( addr ); 943 mEditorDialog->setAddressee( addr );
973 KApplication::execDialog ( mEditorDialog ); 944 KApplication::execDialog ( mEditorDialog );
974 945
975 } else 946 } else
976 return; 947 return;
977 948
978 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 949 // mEditorDict.insert( dialog->addressee().uid(), dialog );
979 950
980 951
981} 952}
982 953
983void KABCore::addEmail( QString aStr ) 954void KABCore::addEmail( QString aStr )
984{ 955{
985#ifndef KAB_EMBEDDED 956#ifndef KAB_EMBEDDED
986 QString fullName, email; 957 QString fullName, email;
987 958
988 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 959 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
989 960
990 // Try to lookup the addressee matching the email address 961 // Try to lookup the addressee matching the email address
991 bool found = false; 962 bool found = false;
992 QStringList emailList; 963 QStringList emailList;
993 KABC::AddressBook::Iterator it; 964 KABC::AddressBook::Iterator it;
994 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 965 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
995 emailList = (*it).emails(); 966 emailList = (*it).emails();
996 if ( emailList.contains( email ) > 0 ) { 967 if ( emailList.contains( email ) > 0 ) {
997 found = true; 968 found = true;
998 (*it).setNameFromString( fullName ); 969 (*it).setNameFromString( fullName );
999 editContact( (*it).uid() ); 970 editContact( (*it).uid() );
1000 } 971 }
1001 } 972 }
1002 973
1003 if ( !found ) { 974 if ( !found ) {
1004 KABC::Addressee addr; 975 KABC::Addressee addr;
1005 addr.setNameFromString( fullName ); 976 addr.setNameFromString( fullName );
1006 addr.insertEmail( email, true ); 977 addr.insertEmail( email, true );
1007 978
1008 mAddressBook->insertAddressee( addr ); 979 mAddressBook->insertAddressee( addr );
1009 mViewManager->refreshView( addr.uid() ); 980 mViewManager->refreshView( addr.uid() );
1010 editContact( addr.uid() ); 981 editContact( addr.uid() );
1011 } 982 }
1012#else //KAB_EMBEDDED 983#else //KAB_EMBEDDED
1013 qDebug("KABCore::addEmail finsih method"); 984 qDebug("KABCore::addEmail finsih method");
1014#endif //KAB_EMBEDDED 985#endif //KAB_EMBEDDED
1015} 986}
1016 987
1017void KABCore::importVCard( const KURL &url, bool showPreview ) 988void KABCore::importVCard( const KURL &url, bool showPreview )
1018{ 989{
1019 mXXPortManager->importVCard( url, showPreview ); 990 mXXPortManager->importVCard( url, showPreview );
1020} 991}
1021void KABCore::importFromOL() 992void KABCore::importFromOL()
1022{ 993{
1023#ifdef _WIN32_ 994#ifdef _WIN32_
1024 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 995 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1025 idgl->exec(); 996 idgl->exec();
1026 KABC::Addressee::List list = idgl->getAddressList(); 997 KABC::Addressee::List list = idgl->getAddressList();
1027 if ( list.count() > 0 ) { 998 if ( list.count() > 0 ) {
1028 KABC::Addressee::List listNew; 999 KABC::Addressee::List listNew;
1029 KABC::Addressee::List listExisting; 1000 KABC::Addressee::List listExisting;
1030 KABC::Addressee::List::Iterator it; 1001 KABC::Addressee::List::Iterator it;
1031 KABC::AddressBook::Iterator iter; 1002 KABC::AddressBook::Iterator iter;
1032 for ( it = list.begin(); it != list.end(); ++it ) { 1003 for ( it = list.begin(); it != list.end(); ++it ) {
1033 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1004 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1034 listNew.append( (*it) ); 1005 listNew.append( (*it) );
1035 else 1006 else
1036 listExisting.append( (*it) ); 1007 listExisting.append( (*it) );
1037 } 1008 }
1038 if ( listExisting.count() > 0 ) 1009 if ( listExisting.count() > 0 )
1039 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1010 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1040 if ( listNew.count() > 0 ) { 1011 if ( listNew.count() > 0 ) {
1041 pasteWithNewUid = false; 1012 pasteWithNewUid = false;
1042 pasteContacts( listNew ); 1013 pasteContacts( listNew );
1043 pasteWithNewUid = true; 1014 pasteWithNewUid = true;
1044 } 1015 }
1045 } 1016 }
1046 delete idgl; 1017 delete idgl;
1047#endif 1018#endif
1048} 1019}
1049 1020
1050void KABCore::importVCard( const QString &vCard, bool showPreview ) 1021void KABCore::importVCard( const QString &vCard, bool showPreview )
1051{ 1022{
1052 mXXPortManager->importVCard( vCard, showPreview ); 1023 mXXPortManager->importVCard( vCard, showPreview );
1053} 1024}
1054 1025
1055//US added a second method without defaultparameter 1026//US added a second method without defaultparameter
1056void KABCore::editContact2() { 1027void KABCore::editContact2() {
1057 editContact( QString::null ); 1028 editContact( QString::null );
1058} 1029}
1059 1030
1060void KABCore::editContact( const QString &uid ) 1031void KABCore::editContact( const QString &uid )
1061{ 1032{
1062 1033
1063 if ( mExtensionManager->isQuickEditVisible() ) 1034 if ( mExtensionManager->isQuickEditVisible() )
1064 return; 1035 return;
1065 1036
1066 // First, locate the contact entry 1037 // First, locate the contact entry
1067 QString localUID = uid; 1038 QString localUID = uid;
1068 if ( localUID.isNull() ) { 1039 if ( localUID.isNull() ) {
1069 QStringList uidList = mViewManager->selectedUids(); 1040 QStringList uidList = mViewManager->selectedUids();
1070 if ( uidList.count() > 0 ) 1041 if ( uidList.count() > 0 )
1071 localUID = *( uidList.at( 0 ) ); 1042 localUID = *( uidList.at( 0 ) );
1072 } 1043 }
1073 1044
1074 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1045 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1075 if ( !addr.isEmpty() ) { 1046 if ( !addr.isEmpty() ) {
1076 mEditorDialog->setAddressee( addr ); 1047 mEditorDialog->setAddressee( addr );
1077 KApplication::execDialog ( mEditorDialog ); 1048 KApplication::execDialog ( mEditorDialog );
1078 } 1049 }
1079} 1050}
1080 1051
1081void KABCore::save() 1052void KABCore::save()
1082{ 1053{
1083 if ( !mModified ) 1054 if ( !mModified )
1084 return; 1055 return;
1085 QString text = i18n( "There was an error while attempting to save\n the " 1056 QString text = i18n( "There was an error while attempting to save\n the "
1086 "address book. Please check that some \nother application is " 1057 "address book. Please check that some \nother application is "
1087 "not using it. " ); 1058 "not using it. " );
1088 statusMessage(i18n("Saving addressbook ... ")); 1059 statusMessage(i18n("Saving addressbook ... "));
1089#ifndef KAB_EMBEDDED 1060#ifndef KAB_EMBEDDED
1090 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1061 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1091 if ( !b || !b->save() ) { 1062 if ( !b || !b->save() ) {
1092 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1063 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1093 } 1064 }
1094#else //KAB_EMBEDDED 1065#else //KAB_EMBEDDED
1095 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1066 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1096 if ( !b || !b->save() ) { 1067 if ( !b || !b->save() ) {
1097 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1068 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1098 } 1069 }
1099#endif //KAB_EMBEDDED 1070#endif //KAB_EMBEDDED
1100 1071
1101 statusMessage(i18n("Addressbook saved!")); 1072 statusMessage(i18n("Addressbook saved!"));
1102 setModified( false ); 1073 setModified( false );
1103} 1074}
1104 1075
1105void KABCore::statusMessage(QString mess , int time ) 1076void KABCore::statusMessage(QString mess , int time )
1106{ 1077{
1107 //topLevelWidget()->setCaption( mess ); 1078 //topLevelWidget()->setCaption( mess );
1108 // pending setting timer to revome message 1079 // pending setting timer to revome message
1109} 1080}
1110void KABCore::undo() 1081void KABCore::undo()
1111{ 1082{
1112 UndoStack::instance()->undo(); 1083 UndoStack::instance()->undo();
1113 1084
1114 // Refresh the view 1085 // Refresh the view
1115 mViewManager->refreshView(); 1086 mViewManager->refreshView();
1116} 1087}
1117 1088
1118void KABCore::redo() 1089void KABCore::redo()
1119{ 1090{
1120 RedoStack::instance()->redo(); 1091 RedoStack::instance()->redo();
1121 1092
1122 // Refresh the view 1093 // Refresh the view
1123 mViewManager->refreshView(); 1094 mViewManager->refreshView();
1124} 1095}
1125 1096
1126void KABCore::setJumpButtonBarVisible( bool visible ) 1097void KABCore::setJumpButtonBarVisible( bool visible )
1127{ 1098{
1128 if ( visible ) 1099 if ( visible )
1129 mJumpButtonBar->show(); 1100 mJumpButtonBar->show();
1130 else 1101 else
1131 mJumpButtonBar->hide(); 1102 mJumpButtonBar->hide();
1132} 1103}
1133void KABCore::setDetailsToState() 1104void KABCore::setDetailsToState()
1134{ 1105{
1135 setDetailsVisible( mActionDetails->isChecked() ); 1106 setDetailsVisible( mActionDetails->isChecked() );
1136} 1107}
1137 1108
1138void KABCore::setDetailsVisible( bool visible ) 1109void KABCore::setDetailsVisible( bool visible )
1139{ 1110{
1140 if ( visible ) 1111 if ( visible )
1141 mDetails->show(); 1112 mDetails->show();
1142 else 1113 else
1143 mDetails->hide(); 1114 mDetails->hide();
1144} 1115}
1145 1116
1146void KABCore::extensionModified( const KABC::Addressee::List &list ) 1117void KABCore::extensionModified( const KABC::Addressee::List &list )
1147{ 1118{
1148 1119
1149 if ( list.count() != 0 ) { 1120 if ( list.count() != 0 ) {
1150 KABC::Addressee::List::ConstIterator it; 1121 KABC::Addressee::List::ConstIterator it;
1151 for ( it = list.begin(); it != list.end(); ++it ) 1122 for ( it = list.begin(); it != list.end(); ++it )
1152 mAddressBook->insertAddressee( *it ); 1123 mAddressBook->insertAddressee( *it );
1153 if ( list.count() > 1 ) 1124 if ( list.count() > 1 )
1154 setModified(); 1125 setModified();
1155 else 1126 else
1156 setModifiedWOrefresh(); 1127 setModifiedWOrefresh();
1157 } 1128 }
1158 if ( list.count() == 0 ) 1129 if ( list.count() == 0 )
1159 mViewManager->refreshView(); 1130 mViewManager->refreshView();
1160 else 1131 else
1161 mViewManager->refreshView( list[ 0 ].uid() ); 1132 mViewManager->refreshView( list[ 0 ].uid() );
1162 1133
1163 1134
1164 1135
1165} 1136}
1166 1137
1167QString KABCore::getNameByPhone( const QString &phone ) 1138QString KABCore::getNameByPhone( const QString &phone )
1168{ 1139{
1169#ifndef KAB_EMBEDDED 1140#ifndef KAB_EMBEDDED
1170 QRegExp r( "[/*/-/ ]" ); 1141 QRegExp r( "[/*/-/ ]" );
1171 QString localPhone( phone ); 1142 QString localPhone( phone );
1172 1143
1173 bool found = false; 1144 bool found = false;
1174 QString ownerName = ""; 1145 QString ownerName = "";
1175 KABC::AddressBook::Iterator iter; 1146 KABC::AddressBook::Iterator iter;
1176 KABC::PhoneNumber::List::Iterator phoneIter; 1147 KABC::PhoneNumber::List::Iterator phoneIter;
1177 KABC::PhoneNumber::List phoneList; 1148 KABC::PhoneNumber::List phoneList;
1178 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1149 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1179 phoneList = (*iter).phoneNumbers(); 1150 phoneList = (*iter).phoneNumbers();
1180 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1151 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1181 ++phoneIter) { 1152 ++phoneIter) {
1182 // Get rid of separator chars so just the numbers are compared. 1153 // Get rid of separator chars so just the numbers are compared.
1183 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1154 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1184 ownerName = (*iter).formattedName(); 1155 ownerName = (*iter).formattedName();
1185 found = true; 1156 found = true;
1186 } 1157 }
1187 } 1158 }
1188 } 1159 }
1189 1160
1190 return ownerName; 1161 return ownerName;
1191#else //KAB_EMBEDDED 1162#else //KAB_EMBEDDED
1192 qDebug("KABCore::getNameByPhone finsih method"); 1163 qDebug("KABCore::getNameByPhone finsih method");
1193 return ""; 1164 return "";
1194#endif //KAB_EMBEDDED 1165#endif //KAB_EMBEDDED
1195 1166
1196} 1167}
1197 1168
1198void KABCore::openConfigDialog() 1169void KABCore::openConfigDialog()
1199{ 1170{
1200 KABPrefs* prefs = KABPrefs::instance(); 1171 KABPrefs* kab_prefs = KABPrefs::instance();
1201 KCMultiDialog* ConfigureDialog = new KCMultiDialog( prefs, "PIM", this ,"kabconfigdialog", true ); 1172 KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance();
1202 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1173
1174 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1175 KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1203 ConfigureDialog->addModule(kabcfg ); 1176 ConfigureDialog->addModule(kabcfg );
1204 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Pim")) , "KCMKdeLibConfig" ); 1177 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1205 ConfigureDialog->addModule(kdelibcfg ); 1178 ConfigureDialog->addModule(kdelibcfg );
1206 1179
1207 1180
1208 1181
1209 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1182 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1210 this, SLOT( configurationChanged() ) ); 1183 this, SLOT( configurationChanged() ) );
1211 connect( ConfigureDialog, SIGNAL( okClicked() ), 1184 connect( ConfigureDialog, SIGNAL( okClicked() ),
1212 this, SLOT( configurationChanged() ) ); 1185 this, SLOT( configurationChanged() ) );
1213 saveSettings(); 1186 saveSettings();
1214 ConfigureDialog->showMaximized(); 1187 ConfigureDialog->showMaximized();
1215 if ( ConfigureDialog->exec() ) 1188 if ( ConfigureDialog->exec() )
1216 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); 1189 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") );
1217 delete ConfigureDialog; 1190 delete ConfigureDialog;
1218} 1191}
1219 1192
1220void KABCore::openLDAPDialog() 1193void KABCore::openLDAPDialog()
1221{ 1194{
1222#ifndef KAB_EMBEDDED 1195#ifndef KAB_EMBEDDED
1223 if ( !mLdapSearchDialog ) { 1196 if ( !mLdapSearchDialog ) {
1224 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1197 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1225 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1198 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1226 SLOT( refreshView() ) ); 1199 SLOT( refreshView() ) );
1227 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1200 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1228 SLOT( setModified() ) ); 1201 SLOT( setModified() ) );
1229 } else 1202 } else
1230 mLdapSearchDialog->restoreSettings(); 1203 mLdapSearchDialog->restoreSettings();
1231 1204
1232 if ( mLdapSearchDialog->isOK() ) 1205 if ( mLdapSearchDialog->isOK() )
1233 mLdapSearchDialog->exec(); 1206 mLdapSearchDialog->exec();
1234#else //KAB_EMBEDDED 1207#else //KAB_EMBEDDED
1235 qDebug("KABCore::openLDAPDialog() finsih method"); 1208 qDebug("KABCore::openLDAPDialog() finsih method");
1236#endif //KAB_EMBEDDED 1209#endif //KAB_EMBEDDED
1237} 1210}
1238 1211
1239void KABCore::print() 1212void KABCore::print()
1240{ 1213{
1241#ifndef KAB_EMBEDDED 1214#ifndef KAB_EMBEDDED
1242 KPrinter printer; 1215 KPrinter printer;
1243 if ( !printer.setup( this ) ) 1216 if ( !printer.setup( this ) )
1244 return; 1217 return;
1245 1218
1246 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1219 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1247 mViewManager->selectedUids(), this ); 1220 mViewManager->selectedUids(), this );
1248 1221
1249 wizard.exec(); 1222 wizard.exec();
1250#else //KAB_EMBEDDED 1223#else //KAB_EMBEDDED
1251 qDebug("KABCore::print() finsih method"); 1224 qDebug("KABCore::print() finsih method");
1252#endif //KAB_EMBEDDED 1225#endif //KAB_EMBEDDED
1253 1226
1254} 1227}
1255 1228
1256 1229
1257void KABCore::addGUIClient( KXMLGUIClient *client ) 1230void KABCore::addGUIClient( KXMLGUIClient *client )
1258{ 1231{
1259 if ( mGUIClient ) 1232 if ( mGUIClient )
1260 mGUIClient->insertChildClient( client ); 1233 mGUIClient->insertChildClient( client );
1261 else 1234 else
1262 KMessageBox::error( this, "no KXMLGUICLient"); 1235 KMessageBox::error( this, "no KXMLGUICLient");
1263} 1236}
1264 1237
1265 1238
1266void KABCore::configurationChanged() 1239void KABCore::configurationChanged()
1267{ 1240{
1268 mExtensionManager->reconfigure(); 1241 mExtensionManager->reconfigure();
1269} 1242}
1270 1243
1271void KABCore::addressBookChanged() 1244void KABCore::addressBookChanged()
1272{ 1245{
1273/*US 1246/*US
1274 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1247 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1275 while ( it.current() ) { 1248 while ( it.current() ) {
1276 if ( it.current()->dirty() ) { 1249 if ( it.current()->dirty() ) {
1277 QString text = i18n( "Data has been changed externally. Unsaved " 1250 QString text = i18n( "Data has been changed externally. Unsaved "
1278 "changes will be lost." ); 1251 "changes will be lost." );
1279 KMessageBox::information( this, text ); 1252 KMessageBox::information( this, text );
1280 } 1253 }
1281 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1254 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1282 ++it; 1255 ++it;
1283 } 1256 }
1284*/ 1257*/
1285 if (mEditorDialog) 1258 if (mEditorDialog)
1286 { 1259 {
1287 if (mEditorDialog->dirty()) 1260 if (mEditorDialog->dirty())
1288 { 1261 {
1289 QString text = i18n( "Data has been changed externally. Unsaved " 1262 QString text = i18n( "Data has been changed externally. Unsaved "
1290 "changes will be lost." ); 1263 "changes will be lost." );
1291 KMessageBox::information( this, text ); 1264 KMessageBox::information( this, text );
1292 } 1265 }
1293 QString currentuid = mEditorDialog->addressee().uid(); 1266 QString currentuid = mEditorDialog->addressee().uid();
1294 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1267 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1295 } 1268 }
1296 mViewManager->refreshView(); 1269 mViewManager->refreshView();
1297// mDetails->refreshView(); 1270// mDetails->refreshView();
1298 1271
1299 1272
1300} 1273}
1301 1274
1302AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1275AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1303 const char *name ) 1276 const char *name )
1304{ 1277{
1305 1278
1306 if ( mEditorDialog == 0 ) { 1279 if ( mEditorDialog == 0 ) {
1307 mEditorDialog = new AddresseeEditorDialog( this, parent, 1280 mEditorDialog = new AddresseeEditorDialog( this, parent,
1308 name ? name : "editorDialog" ); 1281 name ? name : "editorDialog" );
1309 1282
1310 1283
1311 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1284 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1312 SLOT( contactModified( const KABC::Addressee& ) ) ); 1285 SLOT( contactModified( const KABC::Addressee& ) ) );
1313 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1286 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1314 // SLOT( slotEditorDestroyed( const QString& ) ) ); 1287 // SLOT( slotEditorDestroyed( const QString& ) ) );
1315 } 1288 }
1316 1289
1317 return mEditorDialog; 1290 return mEditorDialog;
1318} 1291}
1319 1292
1320void KABCore::slotEditorDestroyed( const QString &uid ) 1293void KABCore::slotEditorDestroyed( const QString &uid )
1321{ 1294{
1322 //mEditorDict.remove( uid ); 1295 //mEditorDict.remove( uid );
1323} 1296}
1324 1297
1325void KABCore::initGUI() 1298void KABCore::initGUI()
1326{ 1299{
1327#ifndef KAB_EMBEDDED 1300#ifndef KAB_EMBEDDED
1328 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1301 QHBoxLayout *topLayout = new QHBoxLayout( this );
1329 topLayout->setSpacing( KDialogBase::spacingHint() ); 1302 topLayout->setSpacing( KDialogBase::spacingHint() );
1330 1303
1331 mExtensionBarSplitter = new QSplitter( this ); 1304 mExtensionBarSplitter = new QSplitter( this );
1332 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1305 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1333 1306
1334 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1307 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1335 1308
1336 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1309 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1337 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1310 mIncSearchWidget = new IncSearchWidget( viewSpace );
1338 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1311 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1339 SLOT( incrementalSearch( const QString& ) ) ); 1312 SLOT( incrementalSearch( const QString& ) ) );
1340 1313
1341 mViewManager = new ViewManager( this, viewSpace ); 1314 mViewManager = new ViewManager( this, viewSpace );
1342 viewSpace->setStretchFactor( mViewManager, 1 ); 1315 viewSpace->setStretchFactor( mViewManager, 1 );
1343 1316
1344 mDetails = new ViewContainer( mDetailsSplitter ); 1317 mDetails = new ViewContainer( mDetailsSplitter );
1345 1318
1346 mJumpButtonBar = new JumpButtonBar( this, this ); 1319 mJumpButtonBar = new JumpButtonBar( this, this );
1347 1320
1348 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1321 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1349 1322
1350 topLayout->addWidget( mExtensionBarSplitter ); 1323 topLayout->addWidget( mExtensionBarSplitter );
1351 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1324 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1352 topLayout->addWidget( mJumpButtonBar ); 1325 topLayout->addWidget( mJumpButtonBar );
1353 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1326 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1354 1327
1355 mXXPortManager = new XXPortManager( this, this ); 1328 mXXPortManager = new XXPortManager( this, this );
1356 1329
1357#else //KAB_EMBEDDED 1330#else //KAB_EMBEDDED
1358 //US initialize viewMenu before settingup viewmanager. 1331 //US initialize viewMenu before settingup viewmanager.
1359 // Viewmanager needs this menu to plugin submenues. 1332 // Viewmanager needs this menu to plugin submenues.
1360 viewMenu = new QPopupMenu( this ); 1333 viewMenu = new QPopupMenu( this );
1361 settingsMenu = new QPopupMenu( this ); 1334 settingsMenu = new QPopupMenu( this );
1362 //filterMenu = new QPopupMenu( this ); 1335 //filterMenu = new QPopupMenu( this );
1363 ImportMenu = new QPopupMenu( this ); 1336 ImportMenu = new QPopupMenu( this );
1364 ExportMenu = new QPopupMenu( this ); 1337 ExportMenu = new QPopupMenu( this );
1365 1338
1366 changeMenu= new QPopupMenu( this ); 1339 changeMenu= new QPopupMenu( this );
1367 1340
1368//US since we have no splitter for the embedded system, setup 1341//US since we have no splitter for the embedded system, setup
1369// a layout with two frames. One left and one right. 1342// a layout with two frames. One left and one right.
1370 1343
1371 QBoxLayout *topLayout; 1344 QBoxLayout *topLayout;
1372 1345
1373 // = new QHBoxLayout( this ); 1346 // = new QHBoxLayout( this );
1374// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1347// QBoxLayout *topLayout = (QBoxLayout*)layout();
1375 1348
1376// QWidget *mainBox = new QWidget( this ); 1349// QWidget *mainBox = new QWidget( this );
1377// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1350// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1378 1351
1379#ifdef DESKTOP_VERSION 1352#ifdef DESKTOP_VERSION
1380 topLayout = new QHBoxLayout( this ); 1353 topLayout = new QHBoxLayout( this );
1381 1354
1382 1355
1383 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1356 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1384 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1357 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1385 1358
1386 topLayout->addWidget(mMiniSplitter ); 1359 topLayout->addWidget(mMiniSplitter );
1387 1360
1388 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1361 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1389 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1362 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1390 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1363 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1391 mDetails = new ViewContainer( mMiniSplitter ); 1364 mDetails = new ViewContainer( mMiniSplitter );
1392 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1365 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1393#else 1366#else
1394 if ( QApplication::desktop()->width() > 480 ) { 1367 if ( QApplication::desktop()->width() > 480 ) {
1395 topLayout = new QHBoxLayout( this ); 1368 topLayout = new QHBoxLayout( this );
1396 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1369 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1397 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1370 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1398 } else { 1371 } else {
1399 1372
1400 topLayout = new QHBoxLayout( this ); 1373 topLayout = new QHBoxLayout( this );
1401 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1374 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1402 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1375 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1403 } 1376 }
1404 1377
1405 topLayout->addWidget(mMiniSplitter ); 1378 topLayout->addWidget(mMiniSplitter );
1406 mViewManager = new ViewManager( this, mMiniSplitter ); 1379 mViewManager = new ViewManager( this, mMiniSplitter );
1407 mDetails = new ViewContainer( mMiniSplitter ); 1380 mDetails = new ViewContainer( mMiniSplitter );
1408 1381
1409 1382
1410 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1383 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1411#endif 1384#endif
1412 //eh->hide(); 1385 //eh->hide();
1413 // topLayout->addWidget(mExtensionManager ); 1386 // topLayout->addWidget(mExtensionManager );
1414 1387
1415 1388
1416/*US 1389/*US
1417#ifndef KAB_NOSPLITTER 1390#ifndef KAB_NOSPLITTER
1418 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1391 QHBoxLayout *topLayout = new QHBoxLayout( this );
1419//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1392//US topLayout->setSpacing( KDialogBase::spacingHint() );
1420 topLayout->setSpacing( 10 ); 1393 topLayout->setSpacing( 10 );
1421 1394
1422 mDetailsSplitter = new QSplitter( this ); 1395 mDetailsSplitter = new QSplitter( this );
1423 1396
1424 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1397 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1425 1398
1426 mViewManager = new ViewManager( this, viewSpace ); 1399 mViewManager = new ViewManager( this, viewSpace );
1427 viewSpace->setStretchFactor( mViewManager, 1 ); 1400 viewSpace->setStretchFactor( mViewManager, 1 );
1428 1401
1429 mDetails = new ViewContainer( mDetailsSplitter ); 1402 mDetails = new ViewContainer( mDetailsSplitter );
1430 1403
1431 topLayout->addWidget( mDetailsSplitter ); 1404 topLayout->addWidget( mDetailsSplitter );
1432 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1405 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1433#else //KAB_NOSPLITTER 1406#else //KAB_NOSPLITTER
1434 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1407 QHBoxLayout *topLayout = new QHBoxLayout( this );
1435//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1408//US topLayout->setSpacing( KDialogBase::spacingHint() );
1436 topLayout->setSpacing( 10 ); 1409 topLayout->setSpacing( 10 );
1437 1410
1438// mDetailsSplitter = new QSplitter( this ); 1411// mDetailsSplitter = new QSplitter( this );
1439 1412
1440 QVBox *viewSpace = new QVBox( this ); 1413 QVBox *viewSpace = new QVBox( this );
1441 1414
1442 mViewManager = new ViewManager( this, viewSpace ); 1415 mViewManager = new ViewManager( this, viewSpace );
1443 viewSpace->setStretchFactor( mViewManager, 1 ); 1416 viewSpace->setStretchFactor( mViewManager, 1 );
1444 1417
1445 mDetails = new ViewContainer( this ); 1418 mDetails = new ViewContainer( this );
1446 1419
1447 topLayout->addWidget( viewSpace ); 1420 topLayout->addWidget( viewSpace );
1448// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1421// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1449 topLayout->addWidget( mDetails ); 1422 topLayout->addWidget( mDetails );
1450#endif //KAB_NOSPLITTER 1423#endif //KAB_NOSPLITTER
1451*/ 1424*/
1452 1425
1453 1426
1454#endif //KAB_EMBEDDED 1427#endif //KAB_EMBEDDED
1455 initActions(); 1428 initActions();
1456 1429
1457#ifdef KAB_EMBEDDED 1430#ifdef KAB_EMBEDDED
1458 addActionsManually(); 1431 addActionsManually();
1459 //US make sure the export and import menues are initialized before creating the xxPortManager. 1432 //US make sure the export and import menues are initialized before creating the xxPortManager.
1460 mXXPortManager = new XXPortManager( this, this ); 1433 mXXPortManager = new XXPortManager( this, this );
1461 1434
1462 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1435 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1463 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1436 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1464 // mActionQuit->plug ( mMainWindow->toolBar()); 1437 // mActionQuit->plug ( mMainWindow->toolBar());
1465 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1438 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1466 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1439 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1467 // mIncSearchWidget->hide(); 1440 // mIncSearchWidget->hide();
1468 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1441 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1469 SLOT( incrementalSearch( const QString& ) ) ); 1442 SLOT( incrementalSearch( const QString& ) ) );
1470 1443
1471 1444
1472 mJumpButtonBar = new JumpButtonBar( this, this ); 1445 mJumpButtonBar = new JumpButtonBar( this, this );
1473 1446
1474 topLayout->addWidget( mJumpButtonBar ); 1447 topLayout->addWidget( mJumpButtonBar );
1475//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1448//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1476 1449
1477// mMainWindow->getIconToolBar()->raise(); 1450// mMainWindow->getIconToolBar()->raise();
1478 1451
1479#endif //KAB_EMBEDDED 1452#endif //KAB_EMBEDDED
1480 1453
1481} 1454}
1482void KABCore::initActions() 1455void KABCore::initActions()
1483{ 1456{
1484//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1457//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1485 1458
1486#ifndef KAB_EMBEDDED 1459#ifndef KAB_EMBEDDED
1487 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1460 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1488 SLOT( clipboardDataChanged() ) ); 1461 SLOT( clipboardDataChanged() ) );
1489#endif //KAB_EMBEDDED 1462#endif //KAB_EMBEDDED
1490 1463
1491 // file menu 1464 // file menu
1492 if ( mIsPart ) { 1465 if ( mIsPart ) {
1493 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1466 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1494 SLOT( sendMail() ), actionCollection(), 1467 SLOT( sendMail() ), actionCollection(),
1495 "kaddressbook_mail" ); 1468 "kaddressbook_mail" );
1496 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1469 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1497 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1470 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1498 1471
1499 } else { 1472 } else {
1500 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1473 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1501 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1474 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1502 } 1475 }
1503 1476
1504 1477
1505 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1478 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1506 SLOT( save() ), actionCollection(), "file_sync" ); 1479 SLOT( save() ), actionCollection(), "file_sync" );
1507 1480
1508 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1481 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1509 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1482 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1510 1483
1511 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1484 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1512 this, SLOT( mailVCard() ), 1485 this, SLOT( mailVCard() ),
1513 actionCollection(), "file_mail_vcard"); 1486 actionCollection(), "file_mail_vcard");
1514 1487
1515 mActionBeamVCard = 0; 1488 mActionBeamVCard = 0;
1516 mActionBeam = 0; 1489 mActionBeam = 0;
1517 1490
1518#ifndef DESKTOP_VERSION 1491#ifndef DESKTOP_VERSION
1519 if ( Ir::supported() ) { 1492 if ( Ir::supported() ) {
1520 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1493 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1521 SLOT( beamVCard() ), actionCollection(), 1494 SLOT( beamVCard() ), actionCollection(),
1522 "kaddressbook_beam_vcard" ); 1495 "kaddressbook_beam_vcard" );
1523 1496
1524 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1497 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1525 SLOT( beamMySelf() ), actionCollection(), 1498 SLOT( beamMySelf() ), actionCollection(),
1526 "kaddressbook_beam_myself" ); 1499 "kaddressbook_beam_myself" );
1527 } 1500 }
1528#endif 1501#endif
1529 1502
1530 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1503 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1531 this, SLOT( editContact2() ), 1504 this, SLOT( editContact2() ),
1532 actionCollection(), "file_properties" ); 1505 actionCollection(), "file_properties" );
1533 1506
1534#ifdef KAB_EMBEDDED 1507#ifdef KAB_EMBEDDED
1535 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1508 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1536 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1509 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1537 mMainWindow, SLOT( exit() ), 1510 mMainWindow, SLOT( exit() ),
1538 actionCollection(), "quit" ); 1511 actionCollection(), "quit" );
1539#endif //KAB_EMBEDDED 1512#endif //KAB_EMBEDDED
1540 1513
1541 // edit menu 1514 // edit menu
1542 if ( mIsPart ) { 1515 if ( mIsPart ) {
1543 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1516 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1544 SLOT( copyContacts() ), actionCollection(), 1517 SLOT( copyContacts() ), actionCollection(),
1545 "kaddressbook_copy" ); 1518 "kaddressbook_copy" );
1546 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1519 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1547 SLOT( cutContacts() ), actionCollection(), 1520 SLOT( cutContacts() ), actionCollection(),
1548 "kaddressbook_cut" ); 1521 "kaddressbook_cut" );
1549 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1522 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1550 SLOT( pasteContacts() ), actionCollection(), 1523 SLOT( pasteContacts() ), actionCollection(),
1551 "kaddressbook_paste" ); 1524 "kaddressbook_paste" );
1552 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1525 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1553 SLOT( selectAllContacts() ), actionCollection(), 1526 SLOT( selectAllContacts() ), actionCollection(),
1554 "kaddressbook_select_all" ); 1527 "kaddressbook_select_all" );
1555 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1528 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1556 SLOT( undo() ), actionCollection(), 1529 SLOT( undo() ), actionCollection(),
1557 "kaddressbook_undo" ); 1530 "kaddressbook_undo" );
1558 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1531 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1559 this, SLOT( redo() ), actionCollection(), 1532 this, SLOT( redo() ), actionCollection(),
1560 "kaddressbook_redo" ); 1533 "kaddressbook_redo" );
1561 } else { 1534 } else {
1562 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1535 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1563 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1536 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1564 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1537 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1565 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1538 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1566 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1539 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1567 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1540 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1568 } 1541 }
1569 1542
1570 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1543 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1571 Key_Delete, this, SLOT( deleteContacts() ), 1544 Key_Delete, this, SLOT( deleteContacts() ),
1572 actionCollection(), "edit_delete" ); 1545 actionCollection(), "edit_delete" );
1573 1546
1574 mActionUndo->setEnabled( false ); 1547 mActionUndo->setEnabled( false );
1575 mActionRedo->setEnabled( false ); 1548 mActionRedo->setEnabled( false );
1576 1549
1577 // settings menu 1550 // settings menu
1578#ifdef KAB_EMBEDDED 1551#ifdef KAB_EMBEDDED
1579//US special menuentry to configure the addressbook resources. On KDE 1552//US special menuentry to configure the addressbook resources. On KDE
1580// you do that through the control center !!! 1553// you do that through the control center !!!
1581 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1554 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1582 SLOT( configureResources() ), actionCollection(), 1555 SLOT( configureResources() ), actionCollection(),
1583 "kaddressbook_configure_resources" ); 1556 "kaddressbook_configure_resources" );
1584#endif //KAB_EMBEDDED 1557#endif //KAB_EMBEDDED
1585 1558
1586 if ( mIsPart ) { 1559 if ( mIsPart ) {
1587 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1560 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1588 SLOT( openConfigDialog() ), actionCollection(), 1561 SLOT( openConfigDialog() ), actionCollection(),
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.cpp b/kaddressbook/kcmconfigs/kcmkabconfig.cpp
index 26398f8..b460a81 100644
--- a/kaddressbook/kcmconfigs/kcmkabconfig.cpp
+++ b/kaddressbook/kcmconfigs/kcmkabconfig.cpp
@@ -1,92 +1,92 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 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 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 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
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#include <qlayout.h> 24#include <qlayout.h>
25 25
26#ifndef KAB_EMBEDDED 26#ifndef KAB_EMBEDDED
27#include <kaboutdata.h> 27#include <kaboutdata.h>
28#endif //KAB_EMBEDDED 28#endif //KAB_EMBEDDED
29#include <kdebug.h> 29#include <kdebug.h>
30//#include <klocale.h> 30//#include <klocale.h>
31//#include <stdlib.h> 31//#include <stdlib.h>
32 32
33#include "kabconfigwidget.h" 33#include "kabconfigwidget.h"
34 34
35#include "kcmkabconfig.h" 35#include "kcmkabconfig.h"
36 36
37#include "kabprefs.h" 37#include "kabprefs.h"
38#include "kprefs.h" 38#include "kprefs.h"
39 39
40extern "C" 40extern "C"
41{ 41{
42 KCModule *create_kabconfig( QWidget *parent, const char * ) { 42 KCModule *create_kabconfig( KABPrefs* prefs, QWidget *parent, const char * ) {
43 return new KCMKabConfig( parent, "kcmkabconfig" ); 43 return new KCMKabConfig( prefs, parent, "kcmkabconfig" );
44 } 44 }
45} 45}
46 46
47KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name ) 47KCMKabConfig::KCMKabConfig( KABPrefs* prefs, QWidget *parent, const char *name )
48 : KCModule( parent, name ) 48 : KCModule( prefs, parent, name )
49{ 49{
50 //abort(); 50 //abort();
51 QVBoxLayout *layout = new QVBoxLayout( this ); 51 QVBoxLayout *layout = new QVBoxLayout( this );
52 mConfigWidget = new KABConfigWidget( this, "mConfigWidget" ); 52 mConfigWidget = new KABConfigWidget( this, "mConfigWidget" );
53 layout->addWidget( mConfigWidget ); 53 layout->addWidget( mConfigWidget );
54 layout->setSpacing( 0 ); 54 layout->setSpacing( 0 );
55 layout->setMargin( 0 ); 55 layout->setMargin( 0 );
56 56
57 connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); 57 connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
58} 58}
59 59
60void KCMKabConfig::load(KPrefs* prefs) 60void KCMKabConfig::load()
61{ 61{
62 mConfigWidget->restoreSettings((KABPrefs*)prefs); 62 mConfigWidget->restoreSettings((KABPrefs*)getPreferences());
63} 63}
64 64
65void KCMKabConfig::save(KPrefs* prefs) 65void KCMKabConfig::save()
66{ 66{
67 mConfigWidget->saveSettings((KABPrefs*)prefs); 67 mConfigWidget->saveSettings((KABPrefs*)getPreferences());
68} 68}
69 69
70void KCMKabConfig::defaults(KPrefs* prefs) 70void KCMKabConfig::defaults()
71{ 71{
72 mConfigWidget->defaults((KABPrefs*)prefs); 72 mConfigWidget->defaults((KABPrefs*)getPreferences());
73} 73}
74 74
75#ifndef KAB_EMBEDDED 75#ifndef KAB_EMBEDDED
76const KAboutData* KCMKabConfig::aboutData() const 76const KAboutData* KCMKabConfig::aboutData() const
77{ 77{
78 KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ), 78 KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ),
79 I18N_NOOP( "KAddressBook Configure Dialog" ), 79 I18N_NOOP( "KAddressBook Configure Dialog" ),
80 0, 0, KAboutData::License_GPL, 80 0, 0, KAboutData::License_GPL,
81 I18N_NOOP( "(c), 2003 Tobias Koenig" ) ); 81 I18N_NOOP( "(c), 2003 Tobias Koenig" ) );
82 82
83 about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" ); 83 about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" );
84 84
85 return about; 85 return about;
86 86
87} 87}
88#endif //KAB_EMBEDDED 88#endif //KAB_EMBEDDED
89 89
90#ifndef KAB_EMBEDDED 90#ifndef KAB_EMBEDDED
91#include "kcmkabconfig.moc" 91#include "kcmkabconfig.moc"
92#endif //KAB_EMBEDDED 92#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.h b/kaddressbook/kcmconfigs/kcmkabconfig.h
index b4858c1..1cb6ad3 100644
--- a/kaddressbook/kcmconfigs/kcmkabconfig.h
+++ b/kaddressbook/kcmconfigs/kcmkabconfig.h
@@ -1,47 +1,47 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 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 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 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
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#ifndef KCMKABCONFIG_H 24#ifndef KCMKABCONFIG_H
25#define KCMKABCONFIG_H 25#define KCMKABCONFIG_H
26 26
27#include <kcmodule.h> 27#include <kcmodule.h>
28 28
29class KABConfigWidget; 29class KABConfigWidget;
30class KPrefs; 30class KABPrefs;
31 31
32class KCMKabConfig : public KCModule 32class KCMKabConfig : public KCModule
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35 35
36 public: 36 public:
37 KCMKabConfig( QWidget *parent = 0, const char *name = 0 ); 37 KCMKabConfig( KABPrefs* prefs, QWidget *parent = 0, const char *name = 0 );
38 38
39 virtual void load(KPrefs* prefs); 39 virtual void load();
40 virtual void save(KPrefs* prefs); 40 virtual void save();
41 virtual void defaults(KPrefs* prefs); 41 virtual void defaults();
42 42
43 private: 43 private:
44 KABConfigWidget *mConfigWidget; 44 KABConfigWidget *mConfigWidget;
45}; 45};
46 46
47#endif 47#endif
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp
index 547441c..83aba48 100644
--- a/libkdepim/addresseeview.cpp
+++ b/libkdepim/addresseeview.cpp
@@ -1,345 +1,346 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 3
4 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 4 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#include <kabc/address.h> 22#include <kabc/address.h>
23#include <kabc/addressee.h> 23#include <kabc/addressee.h>
24#include <kabc/phonenumber.h> 24#include <kabc/phonenumber.h>
25#include <kglobal.h> 25#include <kglobal.h>
26//US#include <kglobalsettings.h> 26//US#include <kglobalsettings.h>
27#include <kiconloader.h> 27#include <kiconloader.h>
28#include <klocale.h> 28#include <klocale.h>
29//US #include <kstringhandler.h> 29//US #include <kstringhandler.h>
30#include <qscrollview.h> 30#include <qscrollview.h>
31#include <qregexp.h> 31#include <qregexp.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qapplication.h> 33#include <qapplication.h>
34 34
35 35
36#include "addresseeview.h" 36#include "addresseeview.h"
37 37
38 38
39#ifndef DESKTOP_VERSION 39#ifndef DESKTOP_VERSION
40#include <qtopia/qcopenvelope_qws.h> 40#include <qtopia/qcopenvelope_qws.h>
41#include <qpe/qpeapplication.h> 41#include <qpe/qpeapplication.h>
42#endif 42#endif
43 43
44static int kphoneInstalled = 0; 44static int kphoneInstalled = 0;
45 45
46using namespace KPIM; 46using namespace KPIM;
47 47
48AddresseeView::AddresseeView( QWidget *parent, const char *name ) 48AddresseeView::AddresseeView( QWidget *parent, const char *name )
49//US : KTextBrowser( parent, name ) 49//US : KTextBrowser( parent, name )
50 : QTextBrowser( parent, name ) 50 : QTextBrowser( parent, name )
51 51
52 52
53{ 53{
54//US setWrapPolicy( QTextEdit::AtWordBoundary ); 54//US setWrapPolicy( QTextEdit::AtWordBoundary );
55 setLinkUnderline( false ); 55 setLinkUnderline( false );
56 // setVScrollBarMode( QScrollView::AlwaysOff ); 56 // setVScrollBarMode( QScrollView::AlwaysOff );
57 //setHScrollBarMode( QScrollView::AlwaysOff ); 57 //setHScrollBarMode( QScrollView::AlwaysOff );
58 58
59//US QStyleSheet *sheet = styleSheet(); 59//US QStyleSheet *sheet = styleSheet();
60//US QStyleSheetItem *link = sheet->item( "a" ); 60//US QStyleSheetItem *link = sheet->item( "a" );
61//US link->setColor( KGlobalSettings::linkColor() ); 61//US link->setColor( KGlobalSettings::linkColor() );
62 62
63} 63}
64void AddresseeView::setSource(const QString& n) 64void AddresseeView::setSource(const QString& n)
65{ 65{
66 qDebug("********AddresseeView::setSource %s", n.latin1()); 66 qDebug("********AddresseeView::setSource %s", n.latin1());
67#ifndef DESKTOP_VERSION 67#ifndef DESKTOP_VERSION
68 if ( n.left( 6 ) == "mailto" ) { 68 if ( n.left( 6 ) == "mailto" ) {
69 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)"); 69 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)");
70 e << n.mid(7); 70 e << n.mid(7);
71 } 71 }
72 if ( n.left( 7 ) == "phoneto" ) { 72 if ( n.left( 7 ) == "phoneto" ) {
73 QString mess = "-ring:" + n.mid(8); 73 QString mess = "-ring:" + n.mid(8);
74 QCopEnvelope e("QPE/Application/kppi", mess.latin1()); 74 QCopEnvelope e("QPE/Application/kppi", mess.latin1());
75 } 75 }
76#endif 76#endif
77 77
78} 78}
79void AddresseeView::setAddressee( const KABC::Addressee& addr ) 79void AddresseeView::setAddressee( const KABC::Addressee& addr )
80{ 80{
81 bool kphoneAvail = false; 81 bool kphoneAvail = false;
82 82
83#ifndef DESKTOP_VERSION 83#ifndef DESKTOP_VERSION
84 if ( ! kphoneInstalled ) { 84 if ( ! kphoneInstalled ) {
85 if ( QFile::exists( QPEApplication::qpeDir() + "/bin/kppi" ) ) 85 if ( QFile::exists( QPEApplication::qpeDir() + "/bin/kppi" ) )
86 kphoneInstalled = 1; 86 kphoneInstalled = 1;
87 else 87 else
88 kphoneInstalled = -1; 88 kphoneInstalled = -1;
89 } 89 }
90 if ( kphoneInstalled > 0 ) 90 if ( kphoneInstalled > 0 )
91 kphoneAvail = true; 91 kphoneAvail = true;
92#if 0 92#if 0
93 if ( kphoneAvail ) 93 if ( kphoneAvail )
94 qDebug("KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail "); 94 qDebug("KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail ");
95 else 95 else
96 qDebug("NOOOOOOOOOOOo KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail "); 96 qDebug("NOOOOOOOOOOOo KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail ");
97#endif 97#endif
98 98
99#endif 99#endif
100 mAddressee = addr; 100 mAddressee = addr;
101 // clear view 101 // clear view
102 setText( QString::null ); 102 setText( QString::null );
103 103
104 if ( mAddressee.isEmpty() ) 104 if ( mAddressee.isEmpty() )
105 return; 105 return;
106 106
107 QString name = ( mAddressee.formattedName().isEmpty() ? 107 QString name = ( mAddressee.formattedName().isEmpty() ?
108 mAddressee.assembledName() : mAddressee.formattedName() ); 108 mAddressee.assembledName() : mAddressee.formattedName() );
109 109
110 QString dynamicPart; 110 QString dynamicPart;
111 111
112 QStringList emails = mAddressee.emails(); 112 QStringList emails = mAddressee.emails();
113 QStringList::ConstIterator emailIt; 113 QStringList::ConstIterator emailIt;
114 QString type = i18n( "Email" ); 114 QString type = i18n( "Email" );
115 emailIt = emails.begin(); 115 emailIt = emails.begin();
116 if ( emailIt != emails.end() ) { 116 if ( emailIt != emails.end() ) {
117 dynamicPart += QString( 117 dynamicPart += QString(
118 "<tr><td align=\"right\"><b>%1</b></td>" 118 "<tr><td align=\"right\"><b>%1</b></td>"
119 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) 119 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
120 .arg( type ) 120 .arg( type )
121 .arg( name ) 121 .arg( name )
122 .arg( *emailIt ) 122 .arg( *emailIt )
123 .arg( *emailIt ); 123 .arg( *emailIt );
124 ++emailIt; 124 ++emailIt;
125 } 125 }
126 126
127 KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); 127 KABC::PhoneNumber::List phones = mAddressee.phoneNumbers();
128 KABC::PhoneNumber::List::ConstIterator phoneIt; 128 KABC::PhoneNumber::List::ConstIterator phoneIt;
129 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { 129 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) {
130 if ( kphoneAvail ) { 130 if ( kphoneAvail ) {
131 dynamicPart += QString( 131 dynamicPart += QString(
132 "<tr><td align=\"right\"><b>%1</b></td>" 132 "<tr><td align=\"right\"><b>%1</b></td>"
133 "<td align=\"left\"><a href=\"phoneto:%2 \">%3</a></td></tr>" ) 133 "<td align=\"left\"><a href=\"phoneto:%2 \">%3</a></td></tr>" )
134 .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) 134 .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) )
135 .arg( (*phoneIt).number() ) 135 .arg( (*phoneIt).number() )
136 .arg( (*phoneIt).number() ); 136 .arg( (*phoneIt).number() );
137 137
138 } else { 138 } else {
139 dynamicPart += QString( 139 dynamicPart += QString(
140 "<tr><td align=\"right\"><b>%1</b></td>" 140 "<tr><td align=\"right\"><b>%1</b></td>"
141 "<td align=\"left\">%2</td></tr>" ) 141 "<td align=\"left\">%2</td></tr>" )
142 .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) 142 .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) )
143 .arg( (*phoneIt).number() ); 143 .arg( (*phoneIt).number() );
144 } 144 }
145 } 145 }
146 146
147 147
148 for ( ; emailIt != emails.end(); ++emailIt ) { 148 for ( ; emailIt != emails.end(); ++emailIt ) {
149 dynamicPart += QString( 149 dynamicPart += QString(
150 "<tr><td align=\"right\"><b>%1</b></td>" 150 "<tr><td align=\"right\"><b>%1</b></td>"
151 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) 151 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
152 .arg( type ) 152 .arg( type )
153 .arg( name ) 153 .arg( name )
154 .arg( *emailIt ) 154 .arg( *emailIt )
155 .arg( *emailIt ); 155 .arg( *emailIt );
156 } 156 }
157 157
158 if ( !mAddressee.url().url().isEmpty() ) { 158 if ( !mAddressee.url().url().isEmpty() ) {
159 dynamicPart += QString( 159 dynamicPart += QString(
160 "<tr><td align=\"right\"><b>%1</b></td>" 160 "<tr><td align=\"right\"><b>%1</b></td>"
161 "<td align=\"left\">%2</td></tr>" ) 161 "<td align=\"left\">%2</td></tr>" )
162 .arg( i18n( "Homepage" ) ) 162 .arg( i18n( "Homepage" ) )
163//US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); 163//US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) );
164 .arg( mAddressee.url().url() ); 164 .arg( mAddressee.url().url() );
165 //qDebug("AddresseeView::setAddressee has to be verified."); 165 //qDebug("AddresseeView::setAddressee has to be verified.");
166 } 166 }
167 167
168 KABC::Address::List addresses = mAddressee.addresses(); 168 KABC::Address::List addresses = mAddressee.addresses();
169 KABC::Address::List::ConstIterator addrIt; 169 KABC::Address::List::ConstIterator addrIt;
170 for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { 170 for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) {
171 if ( true /*(*addrIt).label().isEmpty()*/ ) { 171 if ( true /*(*addrIt).label().isEmpty()*/ ) {
172 QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); 172 QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace();
173//US formattedAddress = formattedAddress.replace( '\n', "<br>" ); 173//US formattedAddress = formattedAddress.replace( '\n', "<br>" );
174 //qDebug("adresss %s ",formattedAddress.latin1() ); 174 //qDebug("adresss %s ",formattedAddress.latin1() );
175 formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); 175 formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" );
176 //qDebug("AddresseeView::setAddressee has to be verified."); 176 //qDebug("AddresseeView::setAddressee has to be verified.");
177 177
178 dynamicPart += QString( 178 dynamicPart += QString(
179 "<tr><td align=\"right\"><b>%1</b></td>" 179 "<tr><td align=\"right\"><b>%1</b></td>"
180 "<td align=\"left\">%2</td></tr>" ) 180 "<td align=\"left\">%2</td></tr>" )
181 .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) 181 .arg( KABC::Address::typeLabel( (*addrIt).type() ) )
182 .arg( formattedAddress ); 182 .arg( formattedAddress );
183 } else { 183 } else {
184 184
185 dynamicPart += QString( 185 dynamicPart += QString(
186 "<tr><td align=\"right\"><b>%1</b></td>" 186 "<tr><td align=\"right\"><b>%1</b></td>"
187 "<td align=\"left\">%2</td></tr>" ) 187 "<td align=\"left\">%2</td></tr>" )
188 .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) 188 .arg( KABC::Address::typeLabel( (*addrIt).type() ) )
189//US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); 189//US .arg( (*addrIt).label().replace( '\n', "<br>" ) );
190 .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); 190 .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ );
191 191
192 } 192 }
193 } 193 }
194 194
195 QString notes; 195 QString notes;
196 if ( !mAddressee.note().isEmpty() ) { 196 if ( !mAddressee.note().isEmpty() ) {
197 notes = QString( 197 notes = QString(
198 "<tr>" 198 "<tr>"
199 "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label 199 "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label
200 "<td align=\"left\">%2</td>" // note 200 "<td align=\"left\">%2</td>" // note
201 "</tr>" ).arg( i18n( "Notes" ) ) 201 "</tr>" ).arg( i18n( "Notes" ) )
202//US .arg( mAddressee.note().replace( '\n', "<br>" ) ); 202//US .arg( mAddressee.note().replace( '\n', "<br>" ) );
203 .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); 203 .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) );
204 //qDebug("AddresseeView::setAddressee has to be verified."); 204 //qDebug("AddresseeView::setAddressee has to be verified.");
205 } 205 }
206 206
207 QString aRole = ""; 207 QString aRole = "";
208 QString aOrga = ""; 208 QString aOrga = "";
209 if ( true /*!mAddressee.role().isEmpty()*/ ) { 209 if ( true /*!mAddressee.role().isEmpty()*/ ) {
210 aRole = "<tr>" 210 aRole = "<tr>"
211 "<td align=\"left\">" + mAddressee.role() + "</td>" 211 "<td align=\"left\">" + mAddressee.role() + "</td>"
212 "</tr>"; 212 "</tr>";
213 } 213 }
214 if ( true /*!mAddressee.organization().isEmpty()*/ ) { 214 if ( true /*!mAddressee.organization().isEmpty()*/ ) {
215 aOrga = "<tr>" 215 aOrga = "<tr>"
216 "<td align=\"left\">" + mAddressee.organization() + "</td>" ; 216 "<td align=\"left\">" + mAddressee.organization() + "</td>" ;
217 "</tr>"; 217 "</tr>";
218 } 218 }
219 mText = ""; 219 mText = "";
220 QString picString = ""; 220 QString picString = "";
221 KABC::Picture picture = mAddressee.photo(); 221 KABC::Picture picture = mAddressee.photo();
222 bool picAvailintern = false; 222 bool picAvailintern = false;
223 bool picAvailUrl = false; 223 bool picAvailUrl = false;
224 if (! picture.undefined() ) { 224 if (! picture.undefined() ) {
225 picAvailintern = (picture.isIntern() && !picture.data().isNull()); 225 picAvailintern = (picture.isIntern() && !picture.data().isNull());
226 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); 226 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() );
227 } 227 }
228 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { 228 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) {
229 if ( picAvailintern ) { 229 if ( picAvailintern ) {
230 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); 230 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() );
231 } else { 231 } else {
232 if ( picAvailUrl ) { 232 if ( picAvailUrl ) {
233 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); 233 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() ));
234 } else { 234 } else {
235 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); 235 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) );
236 } 236 }
237 } 237 }
238 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; 238 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">";
239 mText = QString::fromLatin1( 239 mText = QString::fromLatin1(
240 "<html>" 240 "<html>"
241 "<body text=\"%1\" bgcolor=\"%2\">" // text and background color 241 "<body text=\"%1\" bgcolor=\"%2\">" // text and background color
242 "<table>" 242 "<table>"
243 "<tr>" 243 "<tr>"
244 "<td rowspan=\"3\" align=\"right\" valign=\"top\">" 244 "<td rowspan=\"3\" align=\"right\" valign=\"top\">"
245 "%3" 245 "%3"
246 "</td>" 246 "</td>"
247 "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name 247 "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name
248 "</tr>" 248 "</tr>"
249 "%5" // role 249 "%5" // role
250 "%6" // organization 250 "%6" // organization
251 "<td colspan=\"2\">&nbsp;</td>" 251 "<td colspan=\"2\">&nbsp;</td>"
252 "%7" // dynamic part 252 "%7" // dynamic part
253 "%8" // notes 253 "%8" // notes
254 "</table>" 254 "</table>"
255 "</body>" 255 "</body>"
256 "</html>") 256 "</html>")
257//US 257//US
258 .arg( /*KGlobalSettings::textColor().name()*/ "black" ) 258 .arg( /*KGlobalSettings::textColor().name()*/ "black" )
259//US 259//US
260 .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) 260 .arg( /*KGlobalSettings::baseColor().name()*/ "white" )
261 .arg( picString ) 261 .arg( picString )
262 .arg( name ) 262 .arg( name )
263 .arg( aRole ) 263 .arg( aRole )
264 .arg( aOrga ) 264 .arg( aOrga )
265 .arg( dynamicPart ) 265 .arg( dynamicPart )
266 .arg( notes ); 266 .arg( notes );
267 267
268 } else { // no picture! 268 } else { // no picture!
269 269
270mText = "<table width=\"100%\">\n"; 270mText = "<table width=\"100%\">\n";
271 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 271 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
272#ifdef DESKTOP_VERSION 272#ifdef DESKTOP_VERSION
273 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; 273 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>";
274#else 274#else
275 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>"; 275 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>";
276#endif 276#endif
277 277
278#ifdef DESKTOP_VERSION 278#ifdef DESKTOP_VERSION
279 mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>"; 279 mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>";
280#else 280#else
281 mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>"; 281 mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>";
282#endif 282#endif
283 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 283 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
284 284
285 mText += "<table><td colspan=\"2\">&nbsp;</td>"; 285 mText += "<table><td colspan=\"2\">&nbsp;</td>";
286 /* 286 /*
287 mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" 287 mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>"
288 "<td align=\"left\"><b>%2</b></td></tr>" ) 288 "<td align=\"left\"><b>%2</b></td></tr>" )
289 .arg( i18n(" ") ) 289 .arg( i18n(" ") )
290 .arg( name ); 290 .arg( name );
291 */ 291 */
292 if ( ! mAddressee.role().isEmpty() ) 292 if ( ! mAddressee.role().isEmpty() )
293 mText += QString("<tr><td align=\"right\"><b>%1</b></td>" 293 mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
294 "<td align=\"left\">%2</td></tr>" ) 294 "<td align=\"left\">%2</td></tr>" )
295 .arg( i18n(" ") ) 295 .arg( i18n(" ") )
296 .arg( mAddressee.role()); 296 .arg( mAddressee.role());
297 if ( ! mAddressee.organization().isEmpty() ) 297 if ( ! mAddressee.organization().isEmpty() )
298 mText += QString("<tr><td align=\"right\"><b>%1</b></td>" 298 mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
299 "<td align=\"left\">%2</td></tr>" ) 299 "<td align=\"left\">%2</td></tr>" )
300 .arg( i18n(" ") ) 300 .arg( i18n(" ") )
301 .arg( mAddressee.organization()); 301 .arg( mAddressee.organization());
302 mText += dynamicPart; 302 mText += dynamicPart;
303 mText += notes; 303 mText += notes;
304 mText += "</table>"; 304 mText += "</table>";
305 305
306 } 306 }
307 307
308 // at last display it... 308 // at last display it...
309 setText( mText ); 309 setText( mText );
310
310} 311}
311 312
312KABC::Addressee AddresseeView::addressee() const 313KABC::Addressee AddresseeView::addressee() const
313{ 314{
314 return mAddressee; 315 return mAddressee;
315} 316}
316void AddresseeView::addTag(const QString & tag,const QString & text) 317void AddresseeView::addTag(const QString & tag,const QString & text)
317{ 318{
318 if ( text.isEmpty() ) 319 if ( text.isEmpty() )
319 return; 320 return;
320 int number=text.contains("\n"); 321 int number=text.contains("\n");
321 QString str = "<" + tag + ">"; 322 QString str = "<" + tag + ">";
322 QString tmpText=text; 323 QString tmpText=text;
323 QString tmpStr=str; 324 QString tmpStr=str;
324 if(number !=-1) 325 if(number !=-1)
325 { 326 {
326 if (number > 0) { 327 if (number > 0) {
327 int pos=0; 328 int pos=0;
328 QString tmp; 329 QString tmp;
329 for(int i=0;i<=number;i++) { 330 for(int i=0;i<=number;i++) {
330 pos=tmpText.find("\n"); 331 pos=tmpText.find("\n");
331 tmp=tmpText.left(pos); 332 tmp=tmpText.left(pos);
332 tmpText=tmpText.right(tmpText.length()-pos-1); 333 tmpText=tmpText.right(tmpText.length()-pos-1);
333 tmpStr+=tmp+"<br>"; 334 tmpStr+=tmp+"<br>";
334 } 335 }
335 } 336 }
336 else tmpStr += tmpText; 337 else tmpStr += tmpText;
337 tmpStr+="</" + tag + ">"; 338 tmpStr+="</" + tag + ">";
338 mText.append(tmpStr); 339 mText.append(tmpStr);
339 } 340 }
340 else 341 else
341 { 342 {
342 str += text + "</" + tag + ">"; 343 str += text + "</" + tag + ">";
343 mText.append(str); 344 mText.append(str);
344 } 345 }
345} 346}
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
index 830d5d2..f26efe0 100644
--- a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
@@ -1,77 +1,79 @@
1/* 1/*
2 This file is part of KDEPim/Pi. 2 This file is part of KDEPim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 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 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 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
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 31
32#include <qlayout.h> 32#include <qlayout.h>
33 33
34#include <kdebug.h> 34#include <kdebug.h>
35//#include <klocale.h> 35//#include <klocale.h>
36//#include <stdlib.h> 36//#include <stdlib.h>
37 37
38#include "kdepimconfigwidget.h" 38#include "kdepimconfigwidget.h"
39 39
40#include "kcmkdepimconfig.h" 40#include "kcmkdepimconfig.h"
41#include "kprefs.h" 41#include "kprefs.h"
42#include "kpimprefs.h" 42#include "kpimglobalprefs.h"
43
43#ifndef _WIN32_ 44#ifndef _WIN32_
44extern "C" 45extern "C"
45{ 46{
46 KCModule *create_kabconfig( QWidget *parent, const char * ) { 47 KCModule *create_kabconfig( KPimGlobalPrefs* prefs, QWidget *parent, const char * ) {
47 return new KCMKdePimConfig( parent, "kcmkdepimconfig" ); 48 return new KCMKdePimConfig( prefs, parent, "kcmkdepimconfig" );
48 } 49 }
49} 50}
50#endif 51#endif
51KCMKdePimConfig::KCMKdePimConfig( QWidget *parent, const char *name ) 52
52 : KCModule( parent, name ) 53KCMKdePimConfig::KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent, const char *name )
54 : KCModule( prefs, parent, name )
53{ 55{
54 //abort(); 56 //abort();
55 QVBoxLayout *layout = new QVBoxLayout( this ); 57 QVBoxLayout *layout = new QVBoxLayout( this );
56 mConfigWidget = new KDEPIMConfigWidget( this, "mConfigWidget" ); 58 mConfigWidget = new KDEPIMConfigWidget( this, "mConfigWidget" );
57 layout->addWidget( mConfigWidget ); 59 layout->addWidget( mConfigWidget );
58 layout->setSpacing( 0 ); 60 layout->setSpacing( 0 );
59 layout->setMargin( 0 ); 61 layout->setMargin( 0 );
60 62
61 connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); 63 connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
62} 64}
63 65
64void KCMKdePimConfig::load(KPrefs* prefs) 66void KCMKdePimConfig::load()
65{ 67{
66 mConfigWidget->restoreSettings((KPimPrefs*)prefs); 68 mConfigWidget->restoreSettings((KPimGlobalPrefs*)getPreferences());
67} 69}
68 70
69void KCMKdePimConfig::save(KPrefs* prefs) 71void KCMKdePimConfig::save()
70{ 72{
71 mConfigWidget->saveSettings((KPimPrefs*)prefs); 73 mConfigWidget->saveSettings((KPimGlobalPrefs*)getPreferences());
72} 74}
73 75
74void KCMKdePimConfig::defaults(KPrefs* prefs) 76void KCMKdePimConfig::defaults()
75{ 77{
76 mConfigWidget->defaults((KPimPrefs*)prefs); 78 mConfigWidget->defaults((KPimGlobalPrefs*)getPreferences());
77} 79}
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.h b/libkdepim/kcmconfigs/kcmkdepimconfig.h
index 8cb74f4..fa96eda 100644
--- a/libkdepim/kcmconfigs/kcmkdepimconfig.h
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.h
@@ -1,54 +1,54 @@
1/* 1/*
2 This file is part of KdePim/Pi. 2 This file is part of KdePim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 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 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 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
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 KCMKDEPIMCONFIG_H 31#ifndef KCMKDEPIMCONFIG_H
32#define KCMKDEPIMCONFIG_H 32#define KCMKDEPIMCONFIG_H
33 33
34#include <kcmodule.h> 34#include <kcmodule.h>
35 35
36class KDEPIMConfigWidget; 36class KDEPIMConfigWidget;
37class KPrefs; 37class KPimGlobalPrefs;
38 38
39class KCMKdePimConfig : public KCModule 39class KCMKdePimConfig : public KCModule
40{ 40{
41 Q_OBJECT 41 Q_OBJECT
42 42
43 public: 43 public:
44 KCMKdePimConfig( QWidget *parent = 0, const char *name = 0 ); 44 KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent = 0, const char *name = 0 );
45 45
46 virtual void load(KPrefs* prefs); 46 virtual void load();
47 virtual void save(KPrefs* prefs); 47 virtual void save();
48 virtual void defaults(KPrefs* prefs); 48 virtual void defaults();
49 49
50 private: 50 private:
51 KDEPIMConfigWidget *mConfigWidget; 51 KDEPIMConfigWidget *mConfigWidget;
52}; 52};
53 53
54#endif 54#endif
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 477267c..9964eeb 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -1,273 +1,557 @@
1/* 1/*
2 This file is part of KdePim/Pi. 2 This file is part of KdePim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 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 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 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
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#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 <qfile.h> 37#include <qfile.h>
38 38
39#include <kdialog.h> 39#include <kdialog.h>
40#include <klocale.h> 40#include <klocale.h>
41 41
42#include <stdlib.h> 42#include <stdlib.h>
43 43
44/*US 44/*US
45#include <qcheckbox.h> 45#include <qcheckbox.h>
46#include <qframe.h> 46#include <qframe.h>
47#include <qpushbutton.h> 47#include <qpushbutton.h>
48#include <qcombobox.h> 48#include <qcombobox.h>
49#include <qlineedit.h> 49#include <qlineedit.h>
50#include <qlabel.h> 50#include <qlabel.h>
51#include <qfile.h> 51#include <qfile.h>
52 52
53#include <kconfig.h> 53#include <kconfig.h>
54#include <kdebug.h> 54#include <kdebug.h>
55#include <kdialog.h> 55#include <kdialog.h>
56#include <klistview.h> 56#include <klistview.h>
57#include <klocale.h> 57#include <klocale.h>
58#include <kglobal.h> 58#include <kglobal.h>
59#include <kmessagebox.h> 59#include <kmessagebox.h>
60#include <kstandarddirs.h> 60#include <kstandarddirs.h>
61 61
62#ifndef KAB_EMBEDDED 62#ifndef KAB_EMBEDDED
63#include <ktrader.h> 63#include <ktrader.h>
64#else // KAB_EMBEDDED 64#else // KAB_EMBEDDED
65#include <mergewidget.h> 65#include <mergewidget.h>
66#include <distributionlistwidget.h> 66#include <distributionlistwidget.h>
67#endif // KAB_EMBEDDED 67#endif // KAB_EMBEDDED
68 68
69#include "addresseewidget.h" 69#include "addresseewidget.h"
70#include "extensionconfigdialog.h" 70#include "extensionconfigdialog.h"
71#include "extensionwidget.h" 71#include "extensionwidget.h"
72*/ 72*/
73 73
74#include "kpimprefs.h" 74#include "kpimglobalprefs.h"
75 75
76#include "kdepimconfigwidget.h" 76#include "kdepimconfigwidget.h"
77 77
78 78
79KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name ) 79KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name )
80 : QWidget( parent, name ) 80 : QWidget( parent, name )
81{ 81{
82 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
83 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
84 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
85 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
86 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
87
88
82 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 89 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
83 KDialog::spacingHint() ); 90 KDialog::spacingHint() );
84 91
85 QTabWidget *tabWidget = new QTabWidget( this ); 92 QTabWidget *tabWidget = new QTabWidget( this );
86 topLayout->addWidget( tabWidget ); 93 topLayout->addWidget( tabWidget );
87/*US 94
88 // General page 95
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 96
149 // mailclient page 97 // mailclient page
150 QWidget *mailclientPage = new QWidget( this ); 98 QWidget *externalAppsPage = new QWidget( this );
151 QVBoxLayout* layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(), 99 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
152 KDialog::spacingHintSmall() ); 100 KDialog::spacingHintSmall() );
153 101
154 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage ); 102 mExternalApps = new QComboBox( externalAppsPage );
155 QVBoxLayout* boxLayout = new QVBoxLayout( groupBox->layout() ); 103
156 boxLayout->setAlignment( Qt::AlignTop ); 104 QMap<ExternalAppHandler::Types, QString>::Iterator it;
157// boxLayout->setMargin(KDialog::marginHintSmall() ); 105 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
158// groupBox->layout()->setMargin(KDialog::marginHintSmall()) ; 106 mExternalApps->insertItem( it.data(), it.key() );
159// groupBox->layout()->setSpacing(KDialog::spacingHintSmall()); 107
160// boxLayout->setSpacing( KDialog::spacingHintSmall() ); 108 layout->addWidget( mExternalApps );
109
110 connect( mExternalApps, SIGNAL( activated( int ) ),
111 this, SLOT (externalapp_changed( int ) ) );
112
113
114
115
116 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
117 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
118
119
120 mClient = new QComboBox( mExternalAppGroupBox );
121 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
122
123 connect( mClient, SIGNAL( activated( int ) ),
124 this, SLOT (client_changed( int ) ) );
125
126 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox);
127 boxLayout->addWidget( lab, 1, 0 );
128 mChannel = new QLineEdit(mExternalAppGroupBox);
129 mChannel->setReadOnly(true);
130 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 );
131
132 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox);
133 boxLayout->addWidget( lab, 3, 0 );
134 mMessage = new QLineEdit(mExternalAppGroupBox);
135 mMessage->setReadOnly(true);
136 boxLayout->addWidget( mMessage , 4, 0);
137
138 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox);
139 boxLayout->addWidget( lab, 3, 1 );
140 mParameters = new QLineEdit(mExternalAppGroupBox);
141 mParameters->setReadOnly(true);
142 boxLayout->addWidget( mParameters, 4, 1 );
143
144 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
145 boxLayout->addWidget( lab, 5, 0 );
146 mMessage2 = new QLineEdit(mExternalAppGroupBox);
147 mMessage2->setReadOnly(true);
148 boxLayout->addWidget( mMessage2 , 6, 0);
149
150 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
151 boxLayout->addWidget( lab, 5, 1 );
152 mParameters2 = new QLineEdit(mExternalAppGroupBox);
153 mParameters2->setReadOnly(true);
154 boxLayout->addWidget( mParameters2, 6, 1 );
161 155
162 mEmailClient = new QComboBox( groupBox ); 156 lab = new QLabel( i18n("HINT: Delimiter=; Data=%1 "), mExternalAppGroupBox);
163 mEmailClient->insertItem( i18n("OM/Pi"), KPimPrefs::OMPI ); 157 boxLayout->addMultiCellWidget( lab, 7, 7, 0, 1 );
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 158
169 connect( mEmailClient, SIGNAL( activated( int ) ),
170 this, SLOT (emailclient_changed( int ) ) );
171 159
172 QLabel* lab = new QLabel( i18n("Channel:"), groupBox); 160 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
173 boxLayout->addWidget( lab ); 161 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
174 mEmailChannel = new QLineEdit(groupBox); 162 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
175 mEmailChannel->setReadOnly(true); 163 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
176 boxLayout->addWidget( mEmailChannel ); 164 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
177 165
178 layout->addWidget( groupBox );
179 tabWidget->addTab( mailclientPage, i18n( "Mail" ) );
180 166
181 167
168 layout->addWidget( mExternalAppGroupBox );
169 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
182 170
183} 171}
184 172
173void KDEPIMConfigWidget::externalapp_changed( int newApp )
174{
175 // first store the current data
176 saveEditFieldSettings();
177
178 // set mCurrentApp
179 mCurrentApp = (ExternalAppHandler::Types)newApp;
180
181 // set mCurrentClient
182 switch(mCurrentApp)
183 {
184 case(ExternalAppHandler::EMAIL):
185 mCurrentClient = mEmailClient;
186 break;
187 case(ExternalAppHandler::PHONE):
188 mCurrentClient = mPhoneClient;
189 break;
190 case(ExternalAppHandler::SMS):
191 mCurrentClient = mSMSClient;
192 break;
193 case(ExternalAppHandler::FAX):
194 mCurrentClient = mFaxClient;
195 break;
196 case(ExternalAppHandler::PAGER):
197 mCurrentClient = mPagerClient;
198 break;
199 default:
200 return;
201 }
185 202
203 // and at last update the widgets
204 updateClientWidgets();
205}
186 206
187void KDEPIMConfigWidget::emailclient_changed( int newClient ) 207
208
209void KDEPIMConfigWidget::client_changed( int newClient )
188{ 210{
189 if (newClient == KPimPrefs::OTHER) 211 if (newClient == mCurrentClient)
190 mEmailChannel->setReadOnly(false); 212 return;
191 else
192 mEmailChannel->setReadOnly(true);
193 213
194 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); 214 // first store the current data
195 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); 215 saveEditFieldSettings();
196 216
197 if (opiepath.isEmpty())
198 opiepath = qtopiapath;
199 217
200 QString text = mEmailChannel->text(); 218 //then reset the clientvariable
219 mCurrentClient = newClient;
201 220
202 if (newClient == KPimPrefs::OPIE) 221 // and at last update the widgets
222 updateClientWidgets();
223
224 modified();
225}
226
227void KDEPIMConfigWidget::saveEditFieldSettings()
228{
229
230 switch(mCurrentApp)
203 { 231 {
204 if ( QFile::exists( opiepath + "/bin/opiemail" )) 232 case(ExternalAppHandler::EMAIL):
205 text = "QPE/Application/opiemail"; 233 mEmailClient = mClient->currentItem();
206 else 234 break;
207 text = "FILENOTFOUND: " + opiepath + "/bin/opiemail"; 235 case(ExternalAppHandler::PHONE):
236 mPhoneClient= mClient->currentItem();
237 break;
238 case(ExternalAppHandler::SMS):
239 mSMSClient = mClient->currentItem();
240 break;
241 case(ExternalAppHandler::FAX):
242 mFaxClient = mClient->currentItem();
243 break;
244 case(ExternalAppHandler::PAGER):
245 mPagerClient = mClient->currentItem();
246 break;
247 default:
248 return;
208 } 249 }
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 250
251 //store the current data back to the apropriate membervariables if we had set it to "other"
252 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
253 {
254 mEmailOtherChannel = mChannel->text();
255 mEmailOtherMessage = mMessage->text();
256 mEmailOtherMessageParameters = mParameters->text();
257 mEmailOtherMessage2 = mMessage2->text();
258 mEmailOtherMessageParameters2 = mParameters2->text();
259 }
260 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
261 {
262 mPhoneOtherChannel = mChannel->text();
263 mPhoneOtherMessage = mMessage->text();
264 mPhoneOtherMessageParameters = mParameters->text();
265 }
266 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
267 {
268 mSMSOtherChannel = mChannel->text();
269 mSMSOtherMessage = mMessage->text();
270 mSMSOtherMessageParameters = mParameters->text();
271 }
272 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
273 {
274 mFaxOtherChannel = mChannel->text();
275 mFaxOtherMessage = mMessage->text();
276 mFaxOtherMessageParameters = mParameters->text();
277 }
278 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
279 {
280 mPagerOtherChannel = mChannel->text();
281 mPagerOtherMessage = mMessage->text();
282 mPagerOtherMessageParameters = mParameters->text();
216 } 283 }
217 else if (newClient == KPimPrefs::OMPI) 284
285}
286
287void KDEPIMConfigWidget::updateClientWidgets()
288{
289 bool blocked = signalsBlocked();
290 blockSignals( true );
291
292 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display
293 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp );
294 if (it == mExternalAppsMap.end())
295 return;
296
297 // update group box
298 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data()));
299
300 //update the entries in the client combobox
301 mClient->clear();
302
303 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp);
304 DefaultAppItem* dai;
305 for ( dai=items.first(); dai != 0; dai=items.next() )
218 { 306 {
219 if ( QFile::exists( qtopiapath + "/bin/ompi" )) 307 mClient->insertItem( i18n(dai->_label), dai->_id );
220 text = "QPE/Application/ompi"; 308
221 else if ( QFile::exists( opiepath + "/bin/ompi" )) 309 if (dai->_id == mCurrentClient)
222 text = "QPE/Application/ompi"; 310 {
223 else 311 //restore the edit fields with the data of the local membervariables if we had set it to "other".
224 text = "FILENOTFOUND: " + qtopiapath + "/bin/ompi"; 312 //Otherwise take the default data from externalapphandler.
313 mChannel->setText(dai->_channel);
314 mMessage->setText(dai->_message);
315 mParameters->setText(dai->_parameters);
316 mMessage2->setText(dai->_message2);
317 mParameters2->setText(dai->_parameters2);
318
319
320 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
321 {
322 mChannel->setText(mEmailOtherChannel);
323 mMessage->setText(mEmailOtherMessage);
324 mParameters->setText(mEmailOtherMessageParameters);
325 mMessage2->setText(mEmailOtherMessage2);
326 mParameters2->setText(mEmailOtherMessageParameters2);
327 }
328 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
329 {
330 mChannel->setText(mPhoneOtherChannel);
331 mMessage->setText(mPhoneOtherMessage);
332 mParameters->setText(mPhoneOtherMessageParameters);
333 }
334 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
335 {
336 mChannel->setText(mSMSOtherChannel);
337 mMessage->setText(mSMSOtherMessage);
338 mParameters->setText(mSMSOtherMessageParameters);
339 }
340 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
341 {
342 mChannel->setText(mFaxOtherChannel);
343 mMessage->setText(mFaxOtherMessage);
344 mParameters->setText(mFaxOtherMessageParameters);
345 }
346 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
347 {
348 mChannel->setText(mPagerOtherChannel);
349 mMessage->setText(mPagerOtherMessage);
350 mParameters->setText(mPagerOtherMessageParameters);
351 }
352 }
353
354 }
225 355
356 bool readonly;
357 bool enabled;
358 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
359 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
360 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
361 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
362 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)))
363 {
364 readonly = false;
365 }
366 else
367 {
368 readonly = true;
369 }
370
371 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC))
372 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC))
373 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC))
374 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC))
375 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)))
376 {
377 enabled = false;
378 }
379 else
380 {
381 enabled = true;
382 }
383
384
385 mChannel->setReadOnly(readonly);
386 mMessage->setReadOnly(readonly);
387 mParameters->setReadOnly(readonly);
388 mMessage2->setReadOnly(readonly);
389 mParameters2->setReadOnly(readonly);
390
391 mChannel->setEnabled(enabled);
392 mMessage->setEnabled(enabled);
393 mParameters->setEnabled(enabled);
394 mMessage2->setEnabled(enabled);
395 mParameters2->setEnabled(enabled);
396
397
398
399 mClient->setCurrentItem(mCurrentClient);
400
401
402 // enable/disable the extra message/parameter field
403 if (mCurrentApp == ExternalAppHandler::EMAIL)
404 {
226 } 405 }
227 else 406 else
228 { 407 {
229 //do nothing if we choosed other 408 mMessage2->setText( "" );
409 mParameters2->setText( "" );
230 } 410 }
231 411
232 mEmailChannel->setText( text ); 412 if (enabled == true) {
413 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
414 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
415 }
233 416
234 417
418 blockSignals( blocked );
419
235} 420}
236 421
237 422
238void KDEPIMConfigWidget::restoreSettings(KPimPrefs* prefs) 423
424
425void KDEPIMConfigWidget::restoreSettings(KPimGlobalPrefs* prefs)
239{ 426{
240 bool blocked = signalsBlocked(); 427 bool blocked = signalsBlocked();
241 blockSignals( true ); 428 blockSignals( true );
242 429
243 mEmailChannel->setText( prefs->mEmailChannel ); 430 mEmailClient = prefs->mEmailClient;
244 mEmailClient->setCurrentItem(prefs->mEmailClient); 431 mEmailOtherChannel = prefs->mEmailOtherChannel;
432 mEmailOtherMessage = prefs->mEmailOtherMessage;
433 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
434 mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
435 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
436
437 mPhoneClient = prefs->mPhoneClient;
438 mPhoneOtherChannel = prefs->mPhoneOtherChannel;
439 mPhoneOtherMessage = prefs->mPhoneOtherMessage;
440 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters;
441
442 mFaxClient = prefs->mFaxClient;
443 mFaxOtherChannel = prefs->mFaxOtherChannel;
444 mFaxOtherMessage = prefs->mFaxOtherMessage;
445 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters;
446
447 mSMSClient = prefs->mSMSClient;
448 mSMSOtherChannel = prefs->mSMSOtherChannel;
449 mSMSOtherMessage = prefs->mSMSOtherMessage;
450 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters;
451
452 mPagerClient = prefs->mPagerClient;
453 mPagerOtherChannel = prefs->mPagerOtherChannel;
454 mPagerOtherMessage = prefs->mPagerOtherMessage;
455 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters;
456
457 mCurrentApp = ExternalAppHandler::EMAIL;
458 mCurrentClient = mEmailClient;
459
460 updateClientWidgets();
245 461
246 blockSignals( blocked ); 462 blockSignals( blocked );
247 463
248 emit changed( false ); 464 emit changed( false );
465
249} 466}
250 467
251void KDEPIMConfigWidget::saveSettings(KPimPrefs* prefs) 468void KDEPIMConfigWidget::saveSettings(KPimGlobalPrefs* prefs)
252{ 469{
253 prefs->mEmailClient = mEmailClient->currentItem(); 470 saveEditFieldSettings();
254 prefs->mEmailChannel = mEmailChannel->text(); 471
472 prefs->mEmailClient = mEmailClient;
473 prefs->mEmailOtherChannel = mEmailOtherChannel;
474 prefs->mEmailOtherMessage = mEmailOtherMessage;
475 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters;
476 prefs->mEmailOtherMessage2 = mEmailOtherMessage2;
477 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2;
478
479 prefs->mPhoneClient = mPhoneClient;
480 prefs->mPhoneOtherChannel = mPhoneOtherChannel;
481 prefs->mPhoneOtherMessage = mPhoneOtherMessage;
482 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters;
483
484 prefs->mFaxClient = mFaxClient;
485 prefs->mFaxOtherChannel = mFaxOtherChannel;
486 prefs->mFaxOtherMessage = mFaxOtherMessage;
487 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters;
488
489 prefs->mSMSClient = mSMSClient;
490 prefs->mSMSOtherChannel = mSMSOtherChannel;
491 prefs->mSMSOtherMessage = mSMSOtherMessage;
492 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters;
493
494 prefs->mPagerClient = mPagerClient;
495 prefs->mPagerOtherChannel = mPagerOtherChannel;
496 prefs->mPagerOtherMessage = mPagerOtherMessage;
497 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters;
255 498
256 prefs->writeConfig(); 499 prefs->writeConfig();
257 500
258 emit changed( false ); 501 emit changed( false );
259} 502}
260 503
261void KDEPIMConfigWidget::defaults(KPimPrefs* prefs) 504void KDEPIMConfigWidget::defaults(KPimGlobalPrefs* prefs)
262{ 505{
263 mEmailClient->setCurrentItem(KPimPrefs::OMPI); 506
264 emailclient_changed( KPimPrefs::OMPI ); 507 DefaultAppItem* dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC);
508
509 mEmailClient = dai->_id;
510 mEmailOtherChannel = dai->_channel;
511 mEmailOtherMessage = dai->_message;
512 mEmailOtherMessageParameters = dai->_parameters;
513 mEmailOtherMessage2 = dai->_message2;
514 mEmailOtherMessageParameters2 = dai->_parameters2;
515
516
517 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC);
518
519 mPhoneClient = dai->_id;
520 mPhoneOtherChannel = dai->_channel;
521 mPhoneOtherMessage = dai->_message;
522 mPhoneOtherMessageParameters = dai->_parameters;
523
524 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC);
525
526 mFaxClient = dai->_id;
527 mFaxOtherChannel = dai->_channel;
528 mFaxOtherMessage = dai->_message;
529 mFaxOtherMessageParameters = dai->_parameters;
530
531 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC);
532
533 mSMSClient = dai->_id;
534 mSMSOtherChannel = dai->_channel;
535 mSMSOtherMessage = dai->_message;
536 mSMSOtherMessageParameters = dai->_parameters;
537
538 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC);
539
540 mPagerClient = dai->_id;
541 mPagerOtherChannel = dai->_channel;
542 mPagerOtherMessage = dai->_message;
543 mPagerOtherMessageParameters = dai->_parameters;
265 544
266 545
267 emit changed( true ); 546 emit changed( true );
268} 547}
269 548
270void KDEPIMConfigWidget::modified() 549void KDEPIMConfigWidget::modified()
271{ 550{
272 emit changed( true ); 551 emit changed( true );
273} 552}
553
554void KDEPIMConfigWidget::textChanged( const QString& text )
555{
556 emit changed( true );
557}
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h
index 109a847..6e02544 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.h
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h
@@ -1,86 +1,140 @@
1/* 1/*
2 This file is part of KDEPim/Pi. 2 This file is part of KDEPim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 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 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 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
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 <qwidget.h> 34#include <qwidget.h>
35#include <qmap.h>
36
37#include "externalapphandler.h"
38
35 39
36/* 40/*
37class QCheckBox; 41class QCheckBox;
38class QListViewItem; 42class QListViewItem;
39class QPushButton; 43class QPushButton;
40class KListView; 44class KListView;
41*/ 45*/
42class QComboBox; 46class QComboBox;
43class QLineEdit; 47class QLineEdit;
44class KPimPrefs; 48class KPimGlobalPrefs;
49class QGroupBox;
45 50
46class KDEPIMConfigWidget : public QWidget 51class KDEPIMConfigWidget : public QWidget
47{ 52{
48 Q_OBJECT 53 Q_OBJECT
49 54
50 public: 55 public:
51 KDEPIMConfigWidget( QWidget *parent, const char *name = 0 ); 56 KDEPIMConfigWidget( QWidget *parent, const char *name = 0 );
52 57
53 void restoreSettings(KPimPrefs* prefs); 58 void restoreSettings(KPimGlobalPrefs* prefs);
54 void saveSettings(KPimPrefs* prefs); 59 void saveSettings(KPimGlobalPrefs* prefs);
55 void defaults(KPimPrefs* prefs); 60 void defaults(KPimGlobalPrefs* prefs);
56 61
57 signals: 62 signals:
58 void changed( bool ); 63 void changed( bool );
59 64
65
60 public slots: 66 public slots:
61 void modified(); 67 void modified();
68 void textChanged( const QString& text );
62 69
63 70
64 71
65 private slots: 72 private slots:
66// void configureExtension(); 73// void configureExtension();
67// void selectionChanged( QListViewItem* ); 74// void selectionChanged( QListViewItem* );
68// void itemClicked( QListViewItem* ); 75// void itemClicked( QListViewItem* );
69 void emailclient_changed( int newClient ); 76 void client_changed( int newClient );
77 void externalapp_changed( int newApp );
70 78
71 private: 79 private:
80 void saveEditFieldSettings();
81 void updateClientWidgets();
82
72// void restoreExtensionSettings(); 83// void restoreExtensionSettings();
73// void saveExtensionSettings(); 84// void saveExtensionSettings();
74 85
75// KListView *mExtensionView; 86// KListView *mExtensionView;
76 87
77// QCheckBox *mNameParsing; 88// QCheckBox *mNameParsing;
78// QCheckBox *mViewsSingleClickBox; 89// QCheckBox *mViewsSingleClickBox;
79// QPushButton *mConfigureButton; 90// QPushButton *mConfigureButton;
80 QComboBox* mEmailClient; 91 QComboBox* mExternalApps;
81 QLineEdit* mEmailChannel; 92 QGroupBox* mExternalAppGroupBox;
93
94
95 QComboBox* mClient;
96 QLineEdit* mChannel;
97 QLineEdit* mMessage;
98 QLineEdit* mParameters;
99 QLineEdit* mMessage2;
100 QLineEdit* mParameters2;
101
102 ExternalAppHandler::Types mCurrentApp;
103 int mCurrentClient;
104
105
106 int mEmailClient;
107 QString mEmailOtherChannel;
108 QString mEmailOtherMessage;
109 QString mEmailOtherMessageParameters;
110 QString mEmailOtherMessage2;
111 QString mEmailOtherMessageParameters2;
112
113 int mPhoneClient;
114 QString mPhoneOtherChannel;
115 QString mPhoneOtherMessage;
116 QString mPhoneOtherMessageParameters;
117
118 int mFaxClient;
119 QString mFaxOtherChannel;
120 QString mFaxOtherMessage;
121 QString mFaxOtherMessageParameters;
122
123 int mSMSClient;
124 QString mSMSOtherChannel;
125 QString mSMSOtherMessage;
126 QString mSMSOtherMessageParameters;
127
128 int mPagerClient;
129 QString mPagerOtherChannel;
130 QString mPagerOtherMessage;
131 QString mPagerOtherMessageParameters;
132
133
134
135 QMap<ExternalAppHandler::Types, QString> mExternalAppsMap;
82 136
83// AddresseeWidget *mAddresseeWidget; 137// AddresseeWidget *mAddresseeWidget;
84}; 138};
85 139
86#endif 140#endif
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index 15531c7..140a286 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -1,63 +1,66 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 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 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 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
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/*
25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk
27
28$Id$
29*/
30
24#include <kglobal.h> 31#include <kglobal.h>
25#include <kconfig.h> 32#include <kconfig.h>
26#include <klocale.h> 33#include <klocale.h>
27#include <kdebug.h> 34#include <kdebug.h>
28 35
29#include "kpimprefs.h" 36#include "kpimprefs.h"
30 37
31KPimPrefs::KPimPrefs( const QString &name ) : 38KPimPrefs::KPimPrefs( const QString &name ) :
32 KPrefs( name ) 39 KPrefs( name )
33{ 40{
34 KPrefs::setCurrentGroup( "ExternalApplications" );
35 addItemInt( "EmailChannelType", &mEmailClient, OMPI );
36 addItemString( "EmailChannelOther", &mEmailChannel, "" );
37
38} 41}
39 42
40KPimPrefs::~KPimPrefs() 43KPimPrefs::~KPimPrefs()
41{ 44{
42} 45}
43 46
44void KPimPrefs::usrSetDefaults() 47void KPimPrefs::usrSetDefaults()
45{ 48{
46 setCategoryDefaults(); 49 setCategoryDefaults();
47} 50}
48 51
49void KPimPrefs::usrReadConfig() 52void KPimPrefs::usrReadConfig()
50{ 53{
51 kdDebug(5300) << "KPimPrefs::usrReadConfig()" << endl; 54 kdDebug(5300) << "KPimPrefs::usrReadConfig()" << endl;
52 55
53 config()->setGroup("General"); 56 config()->setGroup("General");
54 mCustomCategories = config()->readListEntry("Custom Categories"); 57 mCustomCategories = config()->readListEntry("Custom Categories");
55 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 58 if (mCustomCategories.isEmpty()) setCategoryDefaults();
56} 59}
57 60
58 61
59void KPimPrefs::usrWriteConfig() 62void KPimPrefs::usrWriteConfig()
60{ 63{
61 config()->setGroup("General"); 64 config()->setGroup("General");
62 config()->writeEntry("Custom Categories",mCustomCategories); 65 config()->writeEntry("Custom Categories",mCustomCategories);
63} 66}
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index 5186315..9bd9466 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -1,67 +1,64 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 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 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 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
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
24/*
25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk
27
28$Id$
29*/
30
23#ifndef KPIMPREFS_H 31#ifndef KPIMPREFS_H
24#define KPIMPREFS_H 32#define KPIMPREFS_H
25 33
26#include <qstringlist.h> 34#include <qstringlist.h>
27 35
28#include "kprefs.h" 36#include "kprefs.h"
29 37
30class KPimPrefs : public KPrefs 38class KPimPrefs : public KPrefs
31{ 39{
32 public: 40 public:
33 41
34 KPimPrefs( const QString &name = QString::null ); 42 KPimPrefs( const QString &name = QString::null );
35 43
36 virtual ~KPimPrefs(); 44 virtual ~KPimPrefs();
37 45
38 /** Set preferences to default values */ 46 /** Set preferences to default values */
39 void usrSetDefaults(); 47 void usrSetDefaults();
40 48
41 /** Read preferences from config file */ 49 /** Read preferences from config file */
42 void usrReadConfig(); 50 void usrReadConfig();
43 51
44 /** Write preferences to config file */ 52 /** Write preferences to config file */
45 void usrWriteConfig(); 53 void usrWriteConfig();
46 54
47 enum EMailClients {
48 OMPI = 0,
49 QTOPIA = 1,
50 OPIE = 2,
51 OTHER = 3
52 };
53
54 55
55 public: 56 public:
56 QStringList mCustomCategories; 57 QStringList mCustomCategories;
57 58
58 int mEmailClient;
59 QString mEmailChannel;
60
61
62 59
63 protected: 60 protected:
64 virtual void setCategoryDefaults() = 0; 61 virtual void setCategoryDefaults() = 0;
65}; 62};
66 63
67#endif 64#endif
diff --git a/libkdepim/libkdepim.pro b/libkdepim/libkdepim.pro
index 902f049..e05e681 100644
--- a/libkdepim/libkdepim.pro
+++ b/libkdepim/libkdepim.pro
@@ -1,55 +1,59 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG = qt warn_on 2 CONFIG = qt warn_on
3DEFINES +=KORG_NOKABC 3DEFINES +=KORG_NOKABC
4TARGET = microkdepim 4TARGET = microkdepim
5INCLUDEPATH += ../microkde ../libkabcwrap ../microkde/kdecore ../microkde/kdeui . .. 5INCLUDEPATH += ../microkde ../libkabcwrap ../microkde/kdecore ../microkde/kdeui . ..
6DESTDIR=../bin 6DESTDIR=../bin
7 7
8DEFINES += DESKTOP_VERSION 8DEFINES += DESKTOP_VERSION
9include( ../variables.pri ) 9include( ../variables.pri )
10unix : { 10unix : {
11OBJECTS_DIR = obj/unix 11OBJECTS_DIR = obj/unix
12MOC_DIR = moc/unix 12MOC_DIR = moc/unix
13} 13}
14win32: { 14win32: {
15DEFINES += _WIN32_ 15DEFINES += _WIN32_
16OBJECTS_DIR = obj/win 16OBJECTS_DIR = obj/win
17MOC_DIR = moc/win 17MOC_DIR = moc/win
18} 18}
19INTERFACES = \ 19INTERFACES = \
20 20
21HEADERS = \ 21HEADERS = \
22 categoryeditdialog.h \ 22 categoryeditdialog.h \
23 categoryeditdialog_base.h \ 23 categoryeditdialog_base.h \
24 categoryselectdialog.h \ 24 categoryselectdialog.h \
25 categoryselectdialog_base.h \ 25 categoryselectdialog_base.h \
26 externalapphandler.h \
26 kdateedit.h \ 27 kdateedit.h \
27 kdatepicker.h \ 28 kdatepicker.h \
28 kinputdialog.h \ 29 kinputdialog.h \
29 kincidenceformatter.h \ 30 kincidenceformatter.h \
30 kpimprefs.h \ 31 kpimprefs.h \
32 kpimglobalprefs.h \
31 kprefsdialog.h \ 33 kprefsdialog.h \
32 addresseeview.h \ 34 addresseeview.h \
33 ksyncprofile.h \ 35 ksyncprofile.h \
34 ksyncprefsdialog.h \ 36 ksyncprefsdialog.h \
35 kcmconfigs/kcmkdepimconfig.h \ 37 kcmconfigs/kcmkdepimconfig.h \
36 kcmconfigs/kdepimconfigwidget.h 38 kcmconfigs/kdepimconfigwidget.h
37 39
38SOURCES = \ 40SOURCES = \
39 categoryeditdialog.cpp \ 41 categoryeditdialog.cpp \
40 categoryeditdialog_base.cpp \ 42 categoryeditdialog_base.cpp \
41 categoryselectdialog.cpp \ 43 categoryselectdialog.cpp \
42 categoryselectdialog_base.cpp \ 44 categoryselectdialog_base.cpp \
45 externalapphandler.cpp \
43 kdateedit.cpp \ 46 kdateedit.cpp \
44 kdatepicker.cpp \ 47 kdatepicker.cpp \
45 kinputdialog.cpp \ 48 kinputdialog.cpp \
46 kincidenceformatter.cpp \ 49 kincidenceformatter.cpp \
47 kpimprefs.cpp \ 50 kpimprefs.cpp \
51 kpimglobalprefs.cpp \
48 kprefsdialog.cpp \ 52 kprefsdialog.cpp \
49 addresseeview.cpp \ 53 addresseeview.cpp \
50 ksyncprofile.cpp \ 54 ksyncprofile.cpp \
51 ksyncprefsdialog.cpp \ 55 ksyncprefsdialog.cpp \
52 kcmconfigs/kcmkdepimconfig.cpp \ 56 kcmconfigs/kcmkdepimconfig.cpp \
53 kcmconfigs/kdepimconfigwidget.cpp 57 kcmconfigs/kdepimconfigwidget.cpp
54 58
55 59
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro
index fc8abe1..b322bce 100644
--- a/libkdepim/libkdepimE.pro
+++ b/libkdepim/libkdepimE.pro
@@ -1,49 +1,53 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3TARGET = microkdepim 3TARGET = microkdepim
4INCLUDEPATH += ../microkde ../qtcompat ../libkabcwrap ../microkde/kdecore ../microkde/kdeui $(QPEDIR)/include 4INCLUDEPATH += ../microkde ../qtcompat ../libkabcwrap ../microkde/kdecore ../microkde/kdeui $(QPEDIR)/include
5INCLUDEPATH += . .. 5INCLUDEPATH += . ..
6LIBS += -lmicrokde 6LIBS += -lmicrokde
7LIBS += -L$(QPEDIR)/lib 7LIBS += -L$(QPEDIR)/lib
8OBJECTS_DIR = obj/$(PLATFORM) 8OBJECTS_DIR = obj/$(PLATFORM)
9MOC_DIR = moc/$(PLATFORM) 9MOC_DIR = moc/$(PLATFORM)
10DESTDIR=$(QPEDIR)/lib 10DESTDIR=$(QPEDIR)/lib
11 11
12 12
13INTERFACES = \ 13INTERFACES = \
14 14
15HEADERS = \ 15HEADERS = \
16 categoryeditdialog.h \ 16 categoryeditdialog.h \
17 categoryeditdialog_base.h \ 17 categoryeditdialog_base.h \
18 categoryselectdialog.h \ 18 categoryselectdialog.h \
19 categoryselectdialog_base.h \ 19 categoryselectdialog_base.h \
20 externalapphandler.h \
20 kdateedit.h \ 21 kdateedit.h \
21 kdatepicker.h \ 22 kdatepicker.h \
22 kinputdialog.h \ 23 kinputdialog.h \
23 kincidenceformatter.h \ 24 kincidenceformatter.h \
24 kpimprefs.h \ 25 kpimprefs.h \
26 kpimglobalprefs.h \
25 kprefsdialog.h \ 27 kprefsdialog.h \
26 addresseeview.h \ 28 addresseeview.h \
27 ksyncprofile.h \ 29 ksyncprofile.h \
28 ksyncprefsdialog.h \ 30 ksyncprefsdialog.h \
29 kcmconfigs/kcmkdepimconfig.h \ 31 kcmconfigs/kcmkdepimconfig.h \
30 kcmconfigs/kdepimconfigwidget.h 32 kcmconfigs/kdepimconfigwidget.h
31 33
32 34
33 35
34SOURCES = \ 36SOURCES = \
35 categoryeditdialog.cpp \ 37 categoryeditdialog.cpp \
36 categoryeditdialog_base.cpp \ 38 categoryeditdialog_base.cpp \
37 categoryselectdialog.cpp \ 39 categoryselectdialog.cpp \
38 categoryselectdialog_base.cpp \ 40 categoryselectdialog_base.cpp \
41 externalapphandler.cpp \
39 kdateedit.cpp \ 42 kdateedit.cpp \
40 kinputdialog.cpp \ 43 kinputdialog.cpp \
41 kdatepicker.cpp \ 44 kdatepicker.cpp \
42 kincidenceformatter.cpp \ 45 kincidenceformatter.cpp \
43 kpimprefs.cpp \ 46 kpimprefs.cpp \
47 kpimglobalprefs.cpp \
44 kprefsdialog.cpp \ 48 kprefsdialog.cpp \
45 addresseeview.cpp \ 49 addresseeview.cpp \
46 ksyncprofile.cpp \ 50 ksyncprofile.cpp \
47 ksyncprefsdialog.cpp \ 51 ksyncprefsdialog.cpp \
48 kcmconfigs/kcmkdepimconfig.cpp \ 52 kcmconfigs/kcmkdepimconfig.cpp \
49 kcmconfigs/kdepimconfigwidget.cpp 53 kcmconfigs/kdepimconfigwidget.cpp
diff --git a/microkde/kdeui/kcmodule.cpp b/microkde/kdeui/kcmodule.cpp
index 915cd0f..f646db3 100644
--- a/microkde/kdeui/kcmodule.cpp
+++ b/microkde/kdeui/kcmodule.cpp
@@ -1,106 +1,114 @@
1/* 1/*
2 This file is part of the KDE libraries 2 This file is part of the KDE libraries
3 3
4 Copyright (c) 2001 Michael Goffioul <goffioul@imec.be> 4 Copyright (c) 2001 Michael Goffioul <goffioul@imec.be>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20 20
21*/ 21*/
22 22
23#include "kcmodule.h" 23#include "kcmodule.h"
24//US#include <kinstance.h> 24//US#include <kinstance.h>
25#include <kglobal.h> 25#include <kglobal.h>
26#include <klocale.h> 26#include <klocale.h>
27#include <kdebug.h> 27#include <kdebug.h>
28 28
29class KCModulePrivate 29class KCModulePrivate
30{ 30{
31public: 31public:
32//US KInstance *_instance; 32//US KInstance *_instance;
33 QString _rootOnlyMsg; 33 QString _rootOnlyMsg;
34 bool _useRootOnlyMsg; 34 bool _useRootOnlyMsg;
35 bool _hasOwnInstance; 35 bool _hasOwnInstance;
36 KPrefs* _prefs;
36}; 37};
37 38
38KCModule::KCModule(QWidget *parent, const char *name, const QStringList &) 39KCModule::KCModule(KPrefs* prefs, QWidget *parent, const char *name, const QStringList &)
39 : QWidget(parent, name), _btn(Help|Default|Apply) 40 : QWidget(parent, name), _btn(Help|Default|Apply)
40{ 41{
41 kdDebug() << "KCModule " << name << endl; 42 kdDebug() << "KCModule " << name << endl;
42 d = new KCModulePrivate; 43 d = new KCModulePrivate;
43 d->_useRootOnlyMsg = true; 44 d->_useRootOnlyMsg = true;
44/*US 45 d->_prefs = prefs;
46/*US
45 d->_instance = new KInstance(name); 47 d->_instance = new KInstance(name);
46 if (name && strlen(name)) { 48 if (name && strlen(name)) {
47 d->_instance = new KInstance(name); 49 d->_instance = new KInstance(name);
48 KGlobal::locale()->insertCatalogue(name); 50 KGlobal::locale()->insertCatalogue(name);
49 } else 51 } else
50 d->_instance = new KInstance("kcmunnamed"); 52 d->_instance = new KInstance("kcmunnamed");
51*/ 53*/
52 d->_hasOwnInstance = true; 54 d->_hasOwnInstance = true;
53//US KGlobal::setActiveInstance(this->instance()); 55//US KGlobal::setActiveInstance(this->instance());
54} 56}
55 57
56/*US 58/*US
57KCModule::KCModule(KInstance *instance, QWidget *parent, const QStringList & ) 59KCModule::KCModule(KInstance *instance, QWidget *parent, const QStringList & )
58 : QWidget(parent, instance ? instance->instanceName().data() : 0), _btn(Help|Default|Apply) 60 : QWidget(parent, instance ? instance->instanceName().data() : 0), _btn(Help|Default|Apply)
59{ 61{
60 kdDebug() << "KCModule instance " << (instance ? instance->instanceName().data() : "none") << endl; 62 kdDebug() << "KCModule instance " << (instance ? instance->instanceName().data() : "none") << endl;
61 d = new KCModulePrivate; 63 d = new KCModulePrivate;
62 d->_useRootOnlyMsg = true; 64 d->_useRootOnlyMsg = true;
63 d->_instance = instance; 65 d->_instance = instance;
64 KGlobal::locale()->insertCatalogue(instance->instanceName()); 66 KGlobal::locale()->insertCatalogue(instance->instanceName());
65 d->_hasOwnInstance = false; 67 d->_hasOwnInstance = false;
66 KGlobal::setActiveInstance(this->instance()); 68 KGlobal::setActiveInstance(this->instance());
67} 69}
68*/ 70*/
69KCModule::~KCModule() 71KCModule::~KCModule()
70{ 72{
71/*US 73/*US
72 if (d->_hasOwnInstance) 74 if (d->_hasOwnInstance)
73 delete d->_instance; 75 delete d->_instance;
74*/ 76*/
75 delete d; 77 delete d;
76} 78}
77 79
78void KCModule::setRootOnlyMsg(const QString& msg) 80void KCModule::setRootOnlyMsg(const QString& msg)
79{ 81{
80 d->_rootOnlyMsg = msg; 82 d->_rootOnlyMsg = msg;
81} 83}
82 84
83QString KCModule::rootOnlyMsg() const 85QString KCModule::rootOnlyMsg() const
84{ 86{
85 return d->_rootOnlyMsg; 87 return d->_rootOnlyMsg;
86} 88}
87 89
88void KCModule::setUseRootOnlyMsg(bool on) 90void KCModule::setUseRootOnlyMsg(bool on)
89{ 91{
90 d->_useRootOnlyMsg = on; 92 d->_useRootOnlyMsg = on;
91} 93}
92 94
93bool KCModule::useRootOnlyMsg() const 95bool KCModule::useRootOnlyMsg() const
94{ 96{
95 return d->_useRootOnlyMsg; 97 return d->_useRootOnlyMsg;
96} 98}
99
100KPrefs* KCModule::getPreferences()
101{
102 return d->_prefs;
103}
104
97/*US 105/*US
98KInstance *KCModule::instance() const 106KInstance *KCModule::instance() const
99{ 107{
100 return d->_instance; 108 return d->_instance;
101} 109}
102*/ 110*/
103void KCModule::virtual_hook( int, void* ) 111void KCModule::virtual_hook( int, void* )
104{ /*BASE::virtual_hook( id, data );*/ } 112{ /*BASE::virtual_hook( id, data );*/ }
105 113
106//US #include "kcmodule.moc" 114//US #include "kcmodule.moc"
diff --git a/microkde/kdeui/kcmodule.h b/microkde/kdeui/kcmodule.h
index bc020bc..874958c 100644
--- a/microkde/kdeui/kcmodule.h
+++ b/microkde/kdeui/kcmodule.h
@@ -1,267 +1,268 @@
1/* 1/*
2 This file is part of the KDE libraries 2 This file is part of the KDE libraries
3 3
4 Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org> 4 Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20 20
21*/ 21*/
22#ifndef __KCMODULE_H__ 22#ifndef __KCMODULE_H__
23#define __KCMODULE_H__ 23#define __KCMODULE_H__
24 24
25#include <qwidget.h> 25#include <qwidget.h>
26#include <qstringlist.h> 26#include <qstringlist.h>
27//USclass KAboutData; 27//USclass KAboutData;
28class KCModulePrivate; 28class KCModulePrivate;
29class KPrefs; 29class KPrefs;
30//US class KInstance; 30//US class KInstance;
31 31
32/** 32/**
33 * The base class for control center modules. 33 * The base class for control center modules.
34 * 34 *
35 * Starting from KDE 2.0, control center modules are realized as shared 35 * Starting from KDE 2.0, control center modules are realized as shared
36 * libraries that are loaded into the control center at runtime. 36 * libraries that are loaded into the control center at runtime.
37 * 37 *
38 * The module in principle is a simple widget displaying the 38 * The module in principle is a simple widget displaying the
39 * item to be changed. The module has a very small interface. 39 * item to be changed. The module has a very small interface.
40 * 40 *
41 * All the necessary glue logic and the GUI bells and whistles 41 * All the necessary glue logic and the GUI bells and whistles
42 * are provided by the control center and must not concern 42 * are provided by the control center and must not concern
43 * the module author. 43 * the module author.
44 * 44 *
45 * To write a config module, you have to create a library 45 * To write a config module, you have to create a library
46 * that contains at one factory function like this: 46 * that contains at one factory function like this:
47 * 47 *
48 * <pre> 48 * <pre>
49 * #include <kgenericfactory.h> 49 * #include <kgenericfactory.h>
50 * 50 *
51 * typedef KGenericFactory<YourKCModule, QWidget> YourKCModuleFactory; 51 * typedef KGenericFactory<YourKCModule, QWidget> YourKCModuleFactory;
52 * K_EXPORT_COMPONENT_FACTORY( yourLibName, YourKCModuleFactory("name_of_the_po_file") ); 52 * K_EXPORT_COMPONENT_FACTORY( yourLibName, YourKCModuleFactory("name_of_the_po_file") );
53 * </pre> 53 * </pre>
54 * 54 *
55 * The parameter "name_of_the_po_file" has to correspond with the messages target 55 * The parameter "name_of_the_po_file" has to correspond with the messages target
56 * that you created in your Makefile.am. 56 * that you created in your Makefile.am.
57 * 57 *
58 * See kdebase/kcontrol/HOWTO for more detailed documentation. 58 * See kdebase/kcontrol/HOWTO for more detailed documentation.
59 * 59 *
60 * @author Matthias Hoelzer-Kluepfel <hoelzer@kde.org> 60 * @author Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
61 */ 61 */
62 62
63class KCModule : public QWidget 63class KCModule : public QWidget
64{ 64{
65 Q_OBJECT 65 Q_OBJECT
66 66
67public: 67public:
68 68
69 /** 69 /**
70 * An enumeration type for the buttons used by this module. 70 * An enumeration type for the buttons used by this module.
71 * You should only use Help, Default and Apply. The rest is obsolete. 71 * You should only use Help, Default and Apply. The rest is obsolete.
72 * 72 *
73 * @see KCModule::buttons @see KCModule::setButtons 73 * @see KCModule::buttons @see KCModule::setButtons
74 */ 74 */
75 enum Button {Help=1, Default=2, Apply=16, 75 enum Button {Help=1, Default=2, Apply=16,
76 Reset=4, /* obsolete, do not use! */ 76 Reset=4, /* obsolete, do not use! */
77 Cancel=8, /* obsolete, do not use! */ 77 Cancel=8, /* obsolete, do not use! */
78 Ok=32, /* obsolete, do not use! */ 78 Ok=32, /* obsolete, do not use! */
79 SysDefault=64 /* obsolete, do not use! */ }; 79 SysDefault=64 /* obsolete, do not use! */ };
80 80
81 /* 81 /*
82 * Base class for all KControlModules. 82 * Base class for all KControlModules.
83 * Make sure you have a QStringList argument in your 83 * Make sure you have a QStringList argument in your
84 * implementation. 84 * implementation.
85 */ 85 */
86 KCModule(QWidget *parent=0, const char *name=0, const QStringList &args=QStringList() ); 86 KCModule(KPrefs* prefs, QWidget *parent=0, const char *name=0, const QStringList &args=QStringList() );
87 87
88//US KCModule(KInstance *instance, QWidget *parent=0, const QStringList &args=QStringList() ); 88//US KCModule(KInstance *instance, QWidget *parent=0, const QStringList &args=QStringList() );
89 89
90 /* 90 /*
91 * Destroys the module. 91 * Destroys the module.
92 */ 92 */
93 ~KCModule(); 93 ~KCModule();
94 94
95 /** 95 /**
96 * Load the configuration data into the module. 96 * Load the configuration data into the module.
97 * 97 *
98 * The load method sets the user interface elements of the 98 * The load method sets the user interface elements of the
99 * module to reflect the current settings stored in the 99 * module to reflect the current settings stored in the
100 * configuration files. 100 * configuration files.
101 * 101 *
102 * This method is invoked whenever the module should read its configuration 102 * This method is invoked whenever the module should read its configuration
103 * (most of the times from a config file) and update the user interface. 103 * (most of the times from a config file) and update the user interface.
104 * This happens when the user clicks the "Reset" button in the control 104 * This happens when the user clicks the "Reset" button in the control
105 * center, to undo all of his changes and restore the currently valid 105 * center, to undo all of his changes and restore the currently valid
106 * settings. NOTE that this is not called after the modules is loaded, 106 * settings. NOTE that this is not called after the modules is loaded,
107 * so you probably want to call this method in the constructor. 107 * so you probably want to call this method in the constructor.
108 */ 108 */
109 virtual void load(KPrefs* prefs) {}; 109 virtual void load() {};
110 110
111 /** 111 /**
112 * Save the configuration data. 112 * Save the configuration data.
113 * 113 *
114 * The save method stores the config information as shown 114 * The save method stores the config information as shown
115 * in the user interface in the config files. 115 * in the user interface in the config files.
116 * 116 *
117 * If necessary, this method also updates the running system, 117 * If necessary, this method also updates the running system,
118 * e.g. by restarting applications. 118 * e.g. by restarting applications.
119 * 119 *
120 * save is called when the user clicks "Apply" or "Ok". 120 * save is called when the user clicks "Apply" or "Ok".
121 */ 121 */
122 virtual void save(KPrefs* prefs) {}; 122 virtual void save() {};
123 123
124 /** 124 /**
125 * Sets the configuration to sensible default values. 125 * Sets the configuration to sensible default values.
126 * 126 *
127 * This method is called when the user clicks the "Default" 127 * This method is called when the user clicks the "Default"
128 * button. It should set the display to useful values. 128 * button. It should set the display to useful values.
129 */ 129 */
130 virtual void defaults(KPrefs* prefs) {}; 130 virtual void defaults() {};
131 131
132 /** 132 /**
133 * Set the configuration to system default values. 133 * Set the configuration to system default values.
134 * 134 *
135 * This method is called when the user clicks the "System-Default" 135 * This method is called when the user clicks the "System-Default"
136 * button. It should set the display to the system default values. 136 * button. It should set the display to the system default values.
137 * 137 *
138 * NOTE: The default behaviour is to call defaults(). 138 * NOTE: The default behaviour is to call defaults().
139 */ 139 */
140 virtual void sysdefaults(KPrefs* prefs) { defaults(prefs); }; 140 virtual void sysdefaults() { defaults(); };
141 141
142 /** 142 /**
143 * Return a quick-help text. 143 * Return a quick-help text.
144 * 144 *
145 * This method is called when the module is docked. 145 * This method is called when the module is docked.
146 * The quick-help text should contain a short description of the module and 146 * The quick-help text should contain a short description of the module and
147 * links to the module's help files. You can use QML formating tags in the text. 147 * links to the module's help files. You can use QML formating tags in the text.
148 * 148 *
149 * NOTE: Please make sure the quick help text gets translated (use i18n()). 149 * NOTE: Please make sure the quick help text gets translated (use i18n()).
150 */ 150 */
151 virtual QString quickHelp() const { return QString::null; }; 151 virtual QString quickHelp() const { return QString::null; };
152 152
153 /** 153 /**
154 * Returns a the KAboutData for this module 154 * Returns a the KAboutData for this module
155 * This is generally only called for the KBugReport. 155 * This is generally only called for the KBugReport.
156 * Override and have it return a pointer to a constant 156 * Override and have it return a pointer to a constant
157 */ 157 */
158//US virtual const KAboutData *aboutData() const { return 0; } 158//US virtual const KAboutData *aboutData() const { return 0; }
159 159
160 /** 160 /**
161 * Indicate which buttons will be used. 161 * Indicate which buttons will be used.
162 * 162 *
163 * The return value is a value or'ed together from 163 * The return value is a value or'ed together from
164 * the Button enumeration type. 164 * the Button enumeration type.
165 * 165 *
166 * @see KCModule::setButtons 166 * @see KCModule::setButtons
167 */ 167 */
168 int buttons() const { return _btn; }; 168 int buttons() const { return _btn; };
169 169
170 /** 170 /**
171 * Get the RootOnly message for this module. 171 * Get the RootOnly message for this module.
172 * 172 *
173 * When the module must be run as root, or acts differently 173 * When the module must be run as root, or acts differently
174 * for root and a normal user, it is sometimes useful to 174 * for root and a normal user, it is sometimes useful to
175 * customize the message that appears at the top of the module 175 * customize the message that appears at the top of the module
176 * when used as a normal user. This function returns this 176 * when used as a normal user. This function returns this
177 * customized message. If none has been set, a default message 177 * customized message. If none has been set, a default message
178 * will be used. 178 * will be used.
179 * 179 *
180 * @see KCModule::setRootOnlyMsg 180 * @see KCModule::setRootOnlyMsg
181 */ 181 */
182 QString rootOnlyMsg() const; 182 QString rootOnlyMsg() const;
183 183
184 /** 184 /**
185 * Tell if KControl should show a RootOnly message when run as 185 * Tell if KControl should show a RootOnly message when run as
186 * a normal user. 186 * a normal user.
187 * 187 *
188 * In some cases, the module don't want a RootOnly message to 188 * In some cases, the module don't want a RootOnly message to
189 * appear (for example if it has already one). This function 189 * appear (for example if it has already one). This function
190 * tells KControl if a RootOnly message should be shown 190 * tells KControl if a RootOnly message should be shown
191 * 191 *
192 * @see KCModule::setUseRootOnlyMsg 192 * @see KCModule::setUseRootOnlyMsg
193 */ 193 */
194 bool useRootOnlyMsg() const; 194 bool useRootOnlyMsg() const;
195 195
196 KPrefs* getPreferences();
196 197
197//US KInstance *instance() const; 198//US KInstance *instance() const;
198 199
199signals: 200signals:
200 201
201 /** 202 /**
202 * Indicate that the state of the modules contents has changed. 203 * Indicate that the state of the modules contents has changed.
203 * 204 *
204 * This signal is emitted whenever the state of the configuration 205 * This signal is emitted whenever the state of the configuration
205 * shown in the module changes. It allows the control center to 206 * shown in the module changes. It allows the control center to
206 * keep track of unsaved changes. 207 * keep track of unsaved changes.
207 * 208 *
208 */ 209 */
209 void changed(bool state); 210 void changed(bool state);
210 211
211 /** 212 /**
212 * Indicate that the module's quickhelp has changed. 213 * Indicate that the module's quickhelp has changed.
213 * 214 *
214 * Emit this signal whenever the module's quickhelp changes. 215 * Emit this signal whenever the module's quickhelp changes.
215 * Modules implemented as tabbed dialogs might want to implement 216 * Modules implemented as tabbed dialogs might want to implement
216 * per-tab quickhelp for example. 217 * per-tab quickhelp for example.
217 * 218 *
218 */ 219 */
219 void quickHelpChanged(); 220 void quickHelpChanged();
220 221
221protected: 222protected:
222 223
223 /** 224 /**
224 * Sets the buttons to display. 225 * Sets the buttons to display.
225 * 226 *
226 * Help: shows a "Help" button. 227 * Help: shows a "Help" button.
227 * Default: shows a "Use Defaults" button 228 * Default: shows a "Use Defaults" button
228 * Apply: in kcontrol this will show an "Apply" and "Reset" button 229 * Apply: in kcontrol this will show an "Apply" and "Reset" button
229 * in kcmshell this will show an "Ok", "Apply" and "Cancel" button 230 * in kcmshell this will show an "Ok", "Apply" and "Cancel" button
230 * 231 *
231 * If Apply is not specified, kcmshell will show a "Close" button. 232 * If Apply is not specified, kcmshell will show a "Close" button.
232 * 233 *
233 * @see KCModule::buttons 234 * @see KCModule::buttons
234 */ 235 */
235 void setButtons(int btn) { _btn = btn; }; 236 void setButtons(int btn) { _btn = btn; };
236 237
237 /** 238 /**
238 * Sets the RootOnly message. 239 * Sets the RootOnly message.
239 * 240 *
240 * This message will be shown at the top of the module of the 241 * This message will be shown at the top of the module of the
241 * corresponding desktop file contains the line X-KDE-RootOnly=true. 242 * corresponding desktop file contains the line X-KDE-RootOnly=true.
242 * If no message is set, a default one will be used. 243 * If no message is set, a default one will be used.
243 * 244 *
244 * @see KCModule::rootOnlyMessage 245 * @see KCModule::rootOnlyMessage
245 */ 246 */
246 void setRootOnlyMsg(const QString& msg); 247 void setRootOnlyMsg(const QString& msg);
247 248
248 /** 249 /**
249 * Change wether or not the RootOnly message should be shown. 250 * Change wether or not the RootOnly message should be shown.
250 * 251 *
251 * Following the value of @p on, the RootOnly message will be 252 * Following the value of @p on, the RootOnly message will be
252 * shown or not. 253 * shown or not.
253 * 254 *
254 * @see KCModule::useRootOnlyMsg 255 * @see KCModule::useRootOnlyMsg
255 */ 256 */
256 void setUseRootOnlyMsg(bool on); 257 void setUseRootOnlyMsg(bool on);
257 258
258private: 259private:
259 260
260 int _btn; 261 int _btn;
261protected: 262protected:
262 virtual void virtual_hook( int id, void* data ); 263 virtual void virtual_hook( int id, void* data );
263private: 264private:
264 KCModulePrivate *d; 265 KCModulePrivate *d;
265}; 266};
266 267
267#endif 268#endif
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp
index c2378fb..6c82e4f 100644
--- a/microkde/kutils/kcmultidialog.cpp
+++ b/microkde/kutils/kcmultidialog.cpp
@@ -1,207 +1,206 @@
1/* 1/*
2 Copyright (c) 2000 Matthias Elter <elter@kde.org> 2 Copyright (c) 2000 Matthias Elter <elter@kde.org>
3 Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org> 3 Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
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 GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19 19
20*/ 20*/
21 21
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qvbox.h> 23#include <qvbox.h>
24#include <qcursor.h> 24#include <qcursor.h>
25#include <qlayout.h> 25#include <qlayout.h>
26 26
27#include <klocale.h> 27#include <klocale.h>
28#include <kglobal.h> 28#include <kglobal.h>
29#include <kdebug.h> 29#include <kdebug.h>
30#include <kiconloader.h> 30#include <kiconloader.h>
31#include <kmessagebox.h> 31#include <kmessagebox.h>
32//US #include <klibloader.h> 32//US #include <klibloader.h>
33#include <krun.h> 33#include <krun.h>
34#include <kprocess.h> 34#include <kprocess.h>
35 35
36#include "kcmultidialog.h" 36#include "kcmultidialog.h"
37#include "kprefs.h"
38//US #include "kcmultidialog.moc" 37//US #include "kcmultidialog.moc"
39//US #include "kcmoduleloader.h" 38//US #include "kcmoduleloader.h"
40 39
41KCMultiDialog::KCMultiDialog(KPrefs* prefs, const QString& baseGroup, QWidget *parent, const char *name, bool modal) 40KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal)
42 : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok, 41 : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok,
43 parent, name, modal, true), mPrefs(prefs), d(0L) 42 parent, name, modal, true), d(0L)
44{ 43{
45 enableButton(Apply, false); 44 enableButton(Apply, false);
46 //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *))); 45 //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *)));
47 46
48 connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) ); 47 connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) );
49 48
50 _baseGroup = baseGroup; 49 _baseGroup = baseGroup;
51 mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); 50 mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed );
52 setMainWidget(mMainWidget ); 51 setMainWidget(mMainWidget );
53#ifdef DESKTOP_VERSION 52#ifdef DESKTOP_VERSION
54 resize(640,480); 53 resize(640,480);
55#else 54#else
56 resize(640,480); 55 resize(640,480);
57 setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480)); 56 setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480));
58 //showMaximized(); 57 //showMaximized();
59#endif 58#endif
60 59
61} 60}
62 61
63KCMultiDialog::~KCMultiDialog() 62KCMultiDialog::~KCMultiDialog()
64{ 63{
65//US moduleDict.setAutoDelete(true); 64//US moduleDict.setAutoDelete(true);
66} 65}
67 66
68void KCMultiDialog::slotDefault() 67void KCMultiDialog::slotDefault()
69{ 68{
70 69
71 int curPageIndex = mMainWidget->activePageIndex(); 70 int curPageIndex = mMainWidget->activePageIndex();
72 71
73 QPtrListIterator<KCModule> it(modules); 72 QPtrListIterator<KCModule> it(modules);
74 for (; it.current(); ++it) 73 for (; it.current(); ++it)
75 { 74 {
76 if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) 75 if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex)
77 { 76 {
78 (*it)->defaults(mPrefs); 77 (*it)->defaults();
79 clientChanged(true); 78 clientChanged(true);
80 return; 79 return;
81 } 80 }
82 } 81 }
83 82
84} 83}
85 84
86void KCMultiDialog::slotApply() 85void KCMultiDialog::slotApply()
87{ 86{
88qDebug("KCMultiDialog::slotApply clicked"); 87qDebug("KCMultiDialog::slotApply clicked");
89 88
90 QPtrListIterator<KCModule> it(modules); 89 QPtrListIterator<KCModule> it(modules);
91 for (; it.current(); ++it) 90 for (; it.current(); ++it)
92 (*it)->save(mPrefs); 91 (*it)->save();
93 clientChanged(false); 92 clientChanged(false);
94 93
95 emit applyClicked(); 94 emit applyClicked();
96 95
97} 96}
98 97
99 98
100void KCMultiDialog::slotOk() 99void KCMultiDialog::slotOk()
101{ 100{
102qDebug("KCMultiDialog::slotOk clicked"); 101qDebug("KCMultiDialog::slotOk clicked");
103 102
104 QPtrListIterator<KCModule> it(modules); 103 QPtrListIterator<KCModule> it(modules);
105 for (; it.current(); ++it) 104 for (; it.current(); ++it)
106 (*it)->save(mPrefs); 105 (*it)->save();
107 accept(); 106 accept();
108 107
109 emit okClicked(); 108 emit okClicked();
110} 109}
111 110
112void KCMultiDialog::slotHelp() 111void KCMultiDialog::slotHelp()
113{ 112{
114/*US 113/*US
115 KURL url( KURL("help:/"), _docPath ); 114 KURL url( KURL("help:/"), _docPath );
116 115
117 if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") { 116 if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") {
118 KProcess process; 117 KProcess process;
119 process << "khelpcenter" 118 process << "khelpcenter"
120 << url.url(); 119 << url.url();
121 process.start(KProcess::DontCare); 120 process.start(KProcess::DontCare);
122 process.detach(); 121 process.detach();
123 } else { 122 } else {
124 new KRun(url); 123 new KRun(url);
125 } 124 }
126*/ 125*/
127} 126}
128 127
129void KCMultiDialog::clientChanged(bool state) 128void KCMultiDialog::clientChanged(bool state)
130{ 129{
131 enableButton(Apply, state); 130 enableButton(Apply, state);
132} 131}
133 132
134/*US 133/*US
135void KCMultiDialog::addModule(const QString& path, bool withfallback) 134void KCMultiDialog::addModule(const QString& path, bool withfallback)
136{ 135{
137 kdDebug(1208) << "KCMultiDialog::addModule " << path << endl; 136 kdDebug(1208) << "KCMultiDialog::addModule " << path << endl;
138 137
139 KCModuleInfo info(path, _baseGroup); 138 KCModuleInfo info(path, _baseGroup);
140 139
141 QHBox* page = addHBoxPage(info.moduleName(), info.comment(), 140 QHBox* page = addHBoxPage(info.moduleName(), info.comment(),
142 KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium)); 141 KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium));
143 if(!page) { 142 if(!page) {
144 KCModuleLoader::unloadModule(info); 143 KCModuleLoader::unloadModule(info);
145 return; 144 return;
146 } 145 }
147 moduleDict.insert(page, new LoadInfo(path, withfallback)); 146 moduleDict.insert(page, new LoadInfo(path, withfallback));
148 if (modules.isEmpty()) 147 if (modules.isEmpty())
149 slotAboutToShow(page); 148 slotAboutToShow(page);
150} 149}
151*/ 150*/
152QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename ) 151QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename )
153{ 152{
154 QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() ); 153 QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() );
155 return page; 154 return page;
156 155
157} 156}
158//US special method for microkde. We dop noty want to load everything dynamically. 157//US special method for microkde. We dop noty want to load everything dynamically.
159void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) 158void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname)
160{ 159{
161 160
162 modules.append(module); 161 modules.append(module);
163 connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); 162 connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));
164//US 163//US
165 module->load(mPrefs); 164 module->load();
166 165
167 166
168} 167}
169 168
170void KCMultiDialog::slotAboutToShow(QWidget *page) 169void KCMultiDialog::slotAboutToShow(QWidget *page)
171{ 170{
172/*US 171/*US
173 LoadInfo *loadInfo = moduleDict[page]; 172 LoadInfo *loadInfo = moduleDict[page];
174 if (!loadInfo) 173 if (!loadInfo)
175 return; 174 return;
176 175
177 QApplication::setOverrideCursor(Qt::WaitCursor); 176 QApplication::setOverrideCursor(Qt::WaitCursor);
178 177
179 moduleDict.remove(page); 178 moduleDict.remove(page);
180 179
181 KCModuleInfo info(loadInfo->path, _baseGroup); 180 KCModuleInfo info(loadInfo->path, _baseGroup);
182 181
183 KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback); 182 KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback);
184 183
185 if (!module) 184 if (!module)
186 { 185 {
187 QApplication::restoreOverrideCursor(); 186 QApplication::restoreOverrideCursor();
188 KCModuleLoader::showLastLoaderError(this); 187 KCModuleLoader::showLastLoaderError(this);
189 delete loadInfo; 188 delete loadInfo;
190 return; 189 return;
191 } 190 }
192 191
193 module->reparent(page,0,QPoint(0,0),true); 192 module->reparent(page,0,QPoint(0,0),true);
194 connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); 193 connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));
195 //setHelp( docpath, QString::null ); 194 //setHelp( docpath, QString::null );
196 _docPath = info.docPath(); 195 _docPath = info.docPath();
197 modules.append(module); 196 modules.append(module);
198 197
199 //KCGlobal::repairAccels( topLevelWidget() ); 198 //KCGlobal::repairAccels( topLevelWidget() );
200 199
201 delete loadInfo; 200 delete loadInfo;
202 201
203 QApplication::restoreOverrideCursor(); 202 QApplication::restoreOverrideCursor();
204*/ 203*/
205 204
206qDebug("KCMultiDialog::slotAboutToShow not implemented"); 205qDebug("KCMultiDialog::slotAboutToShow not implemented");
207} 206}
diff --git a/microkde/kutils/kcmultidialog.h b/microkde/kutils/kcmultidialog.h
index a42555f..1aa66b2 100644
--- a/microkde/kutils/kcmultidialog.h
+++ b/microkde/kutils/kcmultidialog.h
@@ -1,149 +1,146 @@
1/* 1/*
2 Copyright (c) 2000 Matthias Elter <elter@kde.org> 2 Copyright (c) 2000 Matthias Elter <elter@kde.org>
3 Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org> 3 Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
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 GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19 19
20*/ 20*/
21 21
22#ifndef KCMULTIDIALOG_H 22#ifndef KCMULTIDIALOG_H
23#define KCMULTIDIALOG_H 23#define KCMULTIDIALOG_H
24 24
25#include <qptrlist.h> 25#include <qptrlist.h>
26#include <qptrdict.h> 26#include <qptrdict.h>
27 27
28#include <kdialogbase.h> 28#include <kdialogbase.h>
29#include <kjanuswidget.h> 29#include <kjanuswidget.h>
30#include <kcmodule.h> 30#include <kcmodule.h>
31 31
32class KPrefs;
33
34/** 32/**
35 * A class that offers a @ref KDialogBase containing arbitrary KControl Modules 33 * A class that offers a @ref KDialogBase containing arbitrary KControl Modules
36 * 34 *
37 * @short A method that offers a @ref KDialogBase containing arbitrary 35 * @short A method that offers a @ref KDialogBase containing arbitrary
38 * KControl Modules. 36 * KControl Modules.
39 * 37 *
40 * @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org> 38 * @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org>
41 * @since 3.2 39 * @since 3.2
42 */ 40 */
43class KCMultiDialog : public KDialogBase 41class KCMultiDialog : public KDialogBase
44{ 42{
45 Q_OBJECT 43 Q_OBJECT
46 44
47public: 45public:
48 /** 46 /**
49 * Constructs a new KCMultiDialog 47 * Constructs a new KCMultiDialog
50 * 48 *
51 * @param parent The parent Widget 49 * @param parent The parent Widget
52 * @param name The widget name 50 * @param name The widget name
53 * @param baseGroup The baseGroup, if you want to call a module out of 51 * @param baseGroup The baseGroup, if you want to call a module out of
54 * kcontrol, just keep "settings" 52 * kcontrol, just keep "settings"
55 * @param modal If you pass true here, the dialog will be modal 53 * @param modal If you pass true here, the dialog will be modal
56 **/ 54 **/
57 KCMultiDialog(KPrefs* prefs, const QString& baseGroup = QString::fromLatin1("settings"), 55 KCMultiDialog(const QString& baseGroup = QString::fromLatin1("settings"),
58 QWidget *parent=0, const char *name=0, 56 QWidget *parent=0, const char *name=0,
59 bool modal=false); 57 bool modal=false);
60 58
61 /** 59 /**
62 * Destructor 60 * Destructor
63 **/ 61 **/
64 virtual ~KCMultiDialog(); 62 virtual ~KCMultiDialog();
65 63
66 /** 64 /**
67 * Add a module. 65 * Add a module.
68 * 66 *
69 * @param module Specify the name of the module that is to be added 67 * @param module Specify the name of the module that is to be added
70 * to the list of modules the dialog will show. 68 * to the list of modules the dialog will show.
71 * 69 *
72 * @param withfallback Try harder to load the module. Might result 70 * @param withfallback Try harder to load the module. Might result
73 * in the module appearing outside the dialog. 71 * in the module appearing outside the dialog.
74 **/ 72 **/
75//US void addModule(const QString& module, bool withfallback=true); 73//US void addModule(const QString& module, bool withfallback=true);
76 74
77 75
78//US special method for microkde. We dop noty want to load everything dynamically. 76//US special method for microkde. We dop noty want to load everything dynamically.
79 void addModule(KCModule* module );//, const QString& modulename, const QString& iconname); 77 void addModule(KCModule* module );//, const QString& modulename, const QString& iconname);
80 QVBox* getNewVBoxPage(const QString & modulename) ; 78 QVBox* getNewVBoxPage(const QString & modulename) ;
81 79
82 80
83 81
84protected slots: 82protected slots:
85 /** 83 /**
86 * This slot is called when the user presses the "Default" Button 84 * This slot is called when the user presses the "Default" Button
87 * You can reimplement it if needed. 85 * You can reimplement it if needed.
88 * 86 *
89 * @note Make sure you call the original implementation! 87 * @note Make sure you call the original implementation!
90 **/ 88 **/
91 virtual void slotDefault(); 89 virtual void slotDefault();
92 90
93 /** 91 /**
94 * This slot is called when the user presses the "Apply" Button 92 * This slot is called when the user presses the "Apply" Button
95 * You can reimplement it if needed 93 * You can reimplement it if needed
96 * 94 *
97 * @note Make sure you call the original implementation! 95 * @note Make sure you call the original implementation!
98 **/ 96 **/
99 virtual void slotApply(); 97 virtual void slotApply();
100 98
101 /** 99 /**
102 * This slot is called when the user presses the "OK" Button 100 * This slot is called when the user presses the "OK" Button
103 * You can reimplement it if needed 101 * You can reimplement it if needed
104 * 102 *
105 * @note Make sure you call the original implementation! 103 * @note Make sure you call the original implementation!
106 **/ 104 **/
107 virtual void slotOk(); 105 virtual void slotOk();
108 106
109 /** 107 /**
110 * This slot is called when the user presses the "Help" Button 108 * This slot is called when the user presses the "Help" Button
111 * You can reimplement it if needed 109 * You can reimplement it if needed
112 * 110 *
113 * @note Make sure you call the original implementation! 111 * @note Make sure you call the original implementation!
114 **/ 112 **/
115 virtual void slotHelp(); 113 virtual void slotHelp();
116 114
117private slots: 115private slots:
118 116
119 void slotAboutToShow(QWidget *); 117 void slotAboutToShow(QWidget *);
120 118
121 void clientChanged(bool state); 119 void clientChanged(bool state);
122 120
123private: 121private:
124/*US 122/*US
125 struct LoadInfo { 123 struct LoadInfo {
126 LoadInfo(const QString &_path, bool _withfallback) 124 LoadInfo(const QString &_path, bool _withfallback)
127 : path(_path), withfallback(_withfallback) 125 : path(_path), withfallback(_withfallback)
128 { } 126 { }
129 QString path; 127 QString path;
130 bool withfallback; 128 bool withfallback;
131 }; 129 };
132*/ 130*/
133 QPtrList<KCModule> modules; 131 QPtrList<KCModule> modules;
134/* 132/*
135 QPtrDict<LoadInfo> moduleDict; 133 QPtrDict<LoadInfo> moduleDict;
136 QString _docPath; 134 QString _docPath;
137*/ 135*/
138 QString _baseGroup; 136 QString _baseGroup;
139 137
140//US 138//US
141 KJanusWidget* mMainWidget; 139 KJanusWidget* mMainWidget;
142 KPrefs* mPrefs;
143 140
144 // For future use 141 // For future use
145 class KCMultiDialogPrivate; 142 class KCMultiDialogPrivate;
146 KCMultiDialogPrivate *d; 143 KCMultiDialogPrivate *d;
147}; 144};
148 145
149#endif //KCMULTIDIALOG_H 146#endif //KCMULTIDIALOG_H