summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-08-06 20:34:07 (UTC)
committer ulf69 <ulf69>2004-08-06 20:34:07 (UTC)
commit4cbb59835b52b524c9fcbb377159d91a97e1b626 (patch) (unidiff)
treeb2b4fe7fa037b1d4395f71873f086e11ac97e80f
parent26697d027609149853b984874190e2624749b7e3 (diff)
downloadkdepimpi-4cbb59835b52b524c9fcbb377159d91a97e1b626.zip
kdepimpi-4cbb59835b52b524c9fcbb377159d91a97e1b626.tar.gz
kdepimpi-4cbb59835b52b524c9fcbb377159d91a97e1b626.tar.bz2
kcmultidialog can now handle the configuration of multiple applications at once
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp16
-rw-r--r--kaddressbook/kabprefs.cpp2
-rw-r--r--kaddressbook/kabprefs.h10
-rw-r--r--kaddressbook/kaddressbook.pro2
-rw-r--r--kaddressbook/kaddressbookE.pro2
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp110
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h10
-rw-r--r--kaddressbook/kcmconfigs/kcmkabconfig.cpp60
-rw-r--r--kaddressbook/kcmconfigs/kcmkabconfig.h50
9 files changed, 78 insertions, 184 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2494aa2..1667400 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,475 +1,475 @@
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#include <kcmkabconfig.h>
80 79
81//#include <qlabel.h> 80//#include <qlabel.h>
82 81
83 82
84#ifdef Q_WS_QWS 83#ifdef Q_WS_QWS
85#include <qtopia/services.h> 84#include <qtopia/services.h>
86#include <qtopia/qcopenvelope_qws.h> 85#include <qtopia/qcopenvelope_qws.h>
87#endif 86#endif
88#include <qpe/ir.h> 87#include <qpe/ir.h>
89 88
90#endif // KAB_EMBEDDED 89#endif // KAB_EMBEDDED
91#include <kcmkabconfig.h> 90#include "kcmconfigs/kcmkabconfig.h"
91#include "kcmconfigs/kcmkdepimconfig.h"
92 92
93 93
94#include <kresources/selectdialog.h> 94#include <kresources/selectdialog.h>
95#include <kmessagebox.h> 95#include <kmessagebox.h>
96 96
97#include <picture.h> 97#include <picture.h>
98#include <resource.h> 98#include <resource.h>
99 99
100//US#include <qsplitter.h> 100//US#include <qsplitter.h>
101#include <qmap.h> 101#include <qmap.h>
102#include <qdir.h> 102#include <qdir.h>
103#include <qfile.h> 103#include <qfile.h>
104#include <qvbox.h> 104#include <qvbox.h>
105#include <qlayout.h> 105#include <qlayout.h>
106#include <qclipboard.h> 106#include <qclipboard.h>
107#include <qtextstream.h> 107#include <qtextstream.h>
108 108
109#include <libkdepim/categoryselectdialog.h> 109#include <libkdepim/categoryselectdialog.h>
110#include <kabc/vcardconverter.h> 110#include <kabc/vcardconverter.h>
111 111
112 112
113#include "addresseeutil.h" 113#include "addresseeutil.h"
114#include "undocmds.h" 114#include "undocmds.h"
115#include "addresseeeditordialog.h" 115#include "addresseeeditordialog.h"
116#include "viewmanager.h" 116#include "viewmanager.h"
117#include "details/detailsviewcontainer.h" 117#include "details/detailsviewcontainer.h"
118#include "kabprefs.h" 118#include "kabprefs.h"
119#include "xxportmanager.h" 119#include "xxportmanager.h"
120#include "incsearchwidget.h" 120#include "incsearchwidget.h"
121#include "jumpbuttonbar.h" 121#include "jumpbuttonbar.h"
122#include "extensionmanager.h" 122#include "extensionmanager.h"
123#include "addresseeconfig.h" 123#include "addresseeconfig.h"
124#include <kcmultidialog.h> 124#include <kcmultidialog.h>
125 125
126#ifdef _WIN32_ 126#ifdef _WIN32_
127 127
128#include "kaimportoldialog.h" 128#include "kaimportoldialog.h"
129#endif 129#endif
130 130
131bool pasteWithNewUid = true; 131bool pasteWithNewUid = true;
132 132
133#ifdef KAB_EMBEDDED 133#ifdef KAB_EMBEDDED
134KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 134KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
135 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 135 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
136 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 136 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
137 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 137 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
138#else //KAB_EMBEDDED 138#else //KAB_EMBEDDED
139KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 139KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
140 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 140 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
141 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 141 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
142 mReadWrite( readWrite ), mModified( false ) 142 mReadWrite( readWrite ), mModified( false )
143#endif //KAB_EMBEDDED 143#endif //KAB_EMBEDDED
144{ 144{
145 145
146 mExtensionBarSplitter = 0; 146 mExtensionBarSplitter = 0;
147 mIsPart = !parent->inherits( "KAddressBookMain" ); 147 mIsPart = !parent->inherits( "KAddressBookMain" );
148 148
149 mAddressBook = KABC::StdAddressBook::self(); 149 mAddressBook = KABC::StdAddressBook::self();
150 KABC::StdAddressBook::setAutomaticSave( false ); 150 KABC::StdAddressBook::setAutomaticSave( false );
151 151
152#ifndef KAB_EMBEDDED 152#ifndef KAB_EMBEDDED
153 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 153 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
154#endif //KAB_EMBEDDED 154#endif //KAB_EMBEDDED
155 155
156 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 156 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
157 SLOT( addressBookChanged() ) ); 157 SLOT( addressBookChanged() ) );
158 158
159 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 159 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
160 "X-Department", "KADDRESSBOOK" ); 160 "X-Department", "KADDRESSBOOK" );
161 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 161 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
162 "X-Profession", "KADDRESSBOOK" ); 162 "X-Profession", "KADDRESSBOOK" );
163 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 163 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
164 "X-AssistantsName", "KADDRESSBOOK" ); 164 "X-AssistantsName", "KADDRESSBOOK" );
165 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 165 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
166 "X-ManagersName", "KADDRESSBOOK" ); 166 "X-ManagersName", "KADDRESSBOOK" );
167 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 167 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
168 "X-SpousesName", "KADDRESSBOOK" ); 168 "X-SpousesName", "KADDRESSBOOK" );
169 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 169 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
170 "X-Office", "KADDRESSBOOK" ); 170 "X-Office", "KADDRESSBOOK" );
171 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 171 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
172 "X-IMAddress", "KADDRESSBOOK" ); 172 "X-IMAddress", "KADDRESSBOOK" );
173 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 173 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
174 "X-Anniversary", "KADDRESSBOOK" ); 174 "X-Anniversary", "KADDRESSBOOK" );
175 175
176 //US added this field to become compatible with Opie/qtopia addressbook 176 //US added this field to become compatible with Opie/qtopia addressbook
177 // values can be "female" or "male" or "". An empty field represents undefined. 177 // values can be "female" or "male" or "". An empty field represents undefined.
178 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 178 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
179 "X-Gender", "KADDRESSBOOK" ); 179 "X-Gender", "KADDRESSBOOK" );
180 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 180 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
181 "X-Children", "KADDRESSBOOK" ); 181 "X-Children", "KADDRESSBOOK" );
182 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 182 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
183 "X-FreeBusyUrl", "KADDRESSBOOK" ); 183 "X-FreeBusyUrl", "KADDRESSBOOK" );
184 184
185 initGUI(); 185 initGUI();
186 186
187 mIncSearchWidget->setFocus(); 187 mIncSearchWidget->setFocus();
188 188
189 189
190 connect( mViewManager, SIGNAL( selected( const QString& ) ), 190 connect( mViewManager, SIGNAL( selected( const QString& ) ),
191 SLOT( setContactSelected( const QString& ) ) ); 191 SLOT( setContactSelected( const QString& ) ) );
192 connect( mViewManager, SIGNAL( executed( const QString& ) ), 192 connect( mViewManager, SIGNAL( executed( const QString& ) ),
193 SLOT( editContact( const QString& ) ) ); 193 SLOT( editContact( const QString& ) ) );
194 connect( mViewManager, SIGNAL( deleteRequest( ) ), 194 connect( mViewManager, SIGNAL( deleteRequest( ) ),
195 SLOT( deleteContacts( ) ) ); 195 SLOT( deleteContacts( ) ) );
196 connect( mViewManager, SIGNAL( modified() ), 196 connect( mViewManager, SIGNAL( modified() ),
197 SLOT( setModified() ) ); 197 SLOT( setModified() ) );
198 198
199 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 199 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
200 200
201 connect( mXXPortManager, SIGNAL( modified() ), 201 connect( mXXPortManager, SIGNAL( modified() ),
202 SLOT( setModified() ) ); 202 SLOT( setModified() ) );
203 203
204 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 204 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
205 SLOT( incrementalSearch( const QString& ) ) ); 205 SLOT( incrementalSearch( const QString& ) ) );
206 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 206 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
207 mJumpButtonBar, SLOT( recreateButtons() ) ); 207 mJumpButtonBar, SLOT( recreateButtons() ) );
208 208
209 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 209 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
210 SLOT( sendMail( const QString& ) ) ); 210 SLOT( sendMail( const QString& ) ) );
211 211
212#ifndef KAB_EMBEDDED 212#ifndef KAB_EMBEDDED
213 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 213 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
214 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 214 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
215 215
216 connect( mDetails, SIGNAL( browse( const QString& ) ), 216 connect( mDetails, SIGNAL( browse( const QString& ) ),
217 SLOT( browse( const QString& ) ) ); 217 SLOT( browse( const QString& ) ) );
218 218
219 mAddressBookService = new KAddressBookService( this ); 219 mAddressBookService = new KAddressBookService( this );
220 220
221#endif //KAB_EMBEDDED 221#endif //KAB_EMBEDDED
222 mEditorDialog = 0; 222 mEditorDialog = 0;
223 createAddresseeEditorDialog( this ); 223 createAddresseeEditorDialog( this );
224 setModified( false ); 224 setModified( false );
225} 225}
226 226
227KABCore::~KABCore() 227KABCore::~KABCore()
228{ 228{
229 // save(); 229 // save();
230 //saveSettings(); 230 //saveSettings();
231 //KABPrefs::instance()->writeConfig(); 231 //KABPrefs::instance()->writeConfig();
232 delete AddresseeConfig::instance(); 232 delete AddresseeConfig::instance();
233 mAddressBook = 0; 233 mAddressBook = 0;
234 KABC::StdAddressBook::close(); 234 KABC::StdAddressBook::close();
235} 235}
236 236
237void KABCore::restoreSettings() 237void KABCore::restoreSettings()
238{ 238{
239 bool state = KABPrefs::instance()->mJumpButtonBarVisible; 239 bool state = KABPrefs::instance()->mJumpButtonBarVisible;
240 240
241 mActionJumpBar->setChecked( state ); 241 mActionJumpBar->setChecked( state );
242 setJumpButtonBarVisible( state ); 242 setJumpButtonBarVisible( state );
243 243
244 state = KABPrefs::instance()->mDetailsPageVisible; 244 state = KABPrefs::instance()->mDetailsPageVisible;
245 245
246 mActionDetails->setChecked( state ); 246 mActionDetails->setChecked( state );
247 setDetailsVisible( state ); 247 setDetailsVisible( state );
248 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 248 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
249 if ( splitterSize.count() == 0 ) { 249 if ( splitterSize.count() == 0 ) {
250 splitterSize.append( width() / 2 ); 250 splitterSize.append( width() / 2 );
251 splitterSize.append( width() / 2 ); 251 splitterSize.append( width() / 2 );
252 } 252 }
253 mMiniSplitter->setSizes( splitterSize ); 253 mMiniSplitter->setSizes( splitterSize );
254 if ( mExtensionBarSplitter ) { 254 if ( mExtensionBarSplitter ) {
255 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 255 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
256 if ( splitterSize.count() == 0 ) { 256 if ( splitterSize.count() == 0 ) {
257 splitterSize.append( width() / 2 ); 257 splitterSize.append( width() / 2 );
258 splitterSize.append( width() / 2 ); 258 splitterSize.append( width() / 2 );
259 } 259 }
260 mExtensionBarSplitter->setSizes( splitterSize ); 260 mExtensionBarSplitter->setSizes( splitterSize );
261 261
262 } 262 }
263#ifndef KAB_EMBEDDED 263#ifndef KAB_EMBEDDED
264 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; 264 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter;
265 if ( splitterSize.count() == 0 ) { 265 if ( splitterSize.count() == 0 ) {
266 splitterSize.append( width() / 2 ); 266 splitterSize.append( width() / 2 );
267 splitterSize.append( width() / 2 ); 267 splitterSize.append( width() / 2 );
268 } 268 }
269 mExtensionBarSplitter->setSizes( splitterSize ); 269 mExtensionBarSplitter->setSizes( splitterSize );
270 270
271 splitterSize = KABPrefs::instance()->mDetailsSplitter; 271 splitterSize = KABPrefs::instance()->mDetailsSplitter;
272 if ( splitterSize.count() == 0 ) { 272 if ( splitterSize.count() == 0 ) {
273 splitterSize.append( height() / 2 ); 273 splitterSize.append( height() / 2 );
274 splitterSize.append( height() / 2 ); 274 splitterSize.append( height() / 2 );
275 } 275 }
276 mDetailsSplitter->setSizes( splitterSize ); 276 mDetailsSplitter->setSizes( splitterSize );
277 277
278 mExtensionManager->restoreSettings(); 278 mExtensionManager->restoreSettings();
279 279
280#endif //KAB_EMBEDDED 280#endif //KAB_EMBEDDED
281 281
282 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 282 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
283 283
284 mViewManager->restoreSettings(); 284 mViewManager->restoreSettings();
285 mExtensionManager->restoreSettings(); 285 mExtensionManager->restoreSettings();
286} 286}
287 287
288void KABCore::saveSettings() 288void KABCore::saveSettings()
289{ 289{
290 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 290 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
291 if ( mExtensionBarSplitter ) 291 if ( mExtensionBarSplitter )
292 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 292 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
293 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 293 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
294 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 294 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
295#ifndef KAB_EMBEDDED 295#ifndef KAB_EMBEDDED
296 296
297 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 297 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
298 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 298 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
299#endif //KAB_EMBEDDED 299#endif //KAB_EMBEDDED
300 mExtensionManager->saveSettings(); 300 mExtensionManager->saveSettings();
301 mViewManager->saveSettings(); 301 mViewManager->saveSettings();
302 302
303 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 303 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
304 304
305} 305}
306 306
307KABC::AddressBook *KABCore::addressBook() const 307KABC::AddressBook *KABCore::addressBook() const
308{ 308{
309 return mAddressBook; 309 return mAddressBook;
310} 310}
311 311
312KConfig *KABCore::config() 312KConfig *KABCore::config()
313{ 313{
314#ifndef KAB_EMBEDDED 314#ifndef KAB_EMBEDDED
315 return KABPrefs::instance()->config(); 315 return KABPrefs::instance()->config();
316#else //KAB_EMBEDDED 316#else //KAB_EMBEDDED
317 return KABPrefs::instance()->getConfig(); 317 return KABPrefs::instance()->getConfig();
318#endif //KAB_EMBEDDED 318#endif //KAB_EMBEDDED
319} 319}
320 320
321KActionCollection *KABCore::actionCollection() const 321KActionCollection *KABCore::actionCollection() const
322{ 322{
323 return mGUIClient->actionCollection(); 323 return mGUIClient->actionCollection();
324} 324}
325 325
326KABC::Field *KABCore::currentSearchField() const 326KABC::Field *KABCore::currentSearchField() const
327{ 327{
328 if (mIncSearchWidget) 328 if (mIncSearchWidget)
329 return mIncSearchWidget->currentField(); 329 return mIncSearchWidget->currentField();
330 else 330 else
331 return 0; 331 return 0;
332} 332}
333 333
334QStringList KABCore::selectedUIDs() const 334QStringList KABCore::selectedUIDs() const
335{ 335{
336 return mViewManager->selectedUids(); 336 return mViewManager->selectedUids();
337} 337}
338 338
339KABC::Resource *KABCore::requestResource( QWidget *parent ) 339KABC::Resource *KABCore::requestResource( QWidget *parent )
340{ 340{
341 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 341 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
342 342
343 QPtrList<KRES::Resource> kresResources; 343 QPtrList<KRES::Resource> kresResources;
344 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 344 QPtrListIterator<KABC::Resource> resIt( kabcResources );
345 KABC::Resource *resource; 345 KABC::Resource *resource;
346 while ( ( resource = resIt.current() ) != 0 ) { 346 while ( ( resource = resIt.current() ) != 0 ) {
347 ++resIt; 347 ++resIt;
348 if ( !resource->readOnly() ) { 348 if ( !resource->readOnly() ) {
349 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 349 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
350 if ( res ) 350 if ( res )
351 kresResources.append( res ); 351 kresResources.append( res );
352 } 352 }
353 } 353 }
354 354
355 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 355 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
356 return static_cast<KABC::Resource*>( res ); 356 return static_cast<KABC::Resource*>( res );
357} 357}
358 358
359#ifndef KAB_EMBEDDED 359#ifndef KAB_EMBEDDED
360KAboutData *KABCore::createAboutData() 360KAboutData *KABCore::createAboutData()
361#else //KAB_EMBEDDED 361#else //KAB_EMBEDDED
362void KABCore::createAboutData() 362void KABCore::createAboutData()
363#endif //KAB_EMBEDDED 363#endif //KAB_EMBEDDED
364{ 364{
365#ifndef KAB_EMBEDDED 365#ifndef KAB_EMBEDDED
366 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 366 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
367 "3.1", I18N_NOOP( "The KDE Address Book" ), 367 "3.1", I18N_NOOP( "The KDE Address Book" ),
368 KAboutData::License_GPL_V2, 368 KAboutData::License_GPL_V2,
369 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 369 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
370 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 370 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
371 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 371 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
372 about->addAuthor( "Cornelius Schumacher", 372 about->addAuthor( "Cornelius Schumacher",
373 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 373 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
374 "schumacher@kde.org" ); 374 "schumacher@kde.org" );
375 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 375 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
376 "mpilone@slac.com" ); 376 "mpilone@slac.com" );
377 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 377 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
378 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 378 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
379 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 379 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
380 "michel@klaralvdalens-datakonsult.se" ); 380 "michel@klaralvdalens-datakonsult.se" );
381 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 381 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
382 "hansen@kde.org" ); 382 "hansen@kde.org" );
383 383
384 return about; 384 return about;
385#endif //KAB_EMBEDDED 385#endif //KAB_EMBEDDED
386 386
387 QString version; 387 QString version;
388#include <../version> 388#include <../version>
389 QMessageBox::about( this, "About KAddressbook/Pi", 389 QMessageBox::about( this, "About KAddressbook/Pi",
390 "KAddressbook/Platform-independent\n" 390 "KAddressbook/Platform-independent\n"
391 "(KA/Pi) " +version + " - " + 391 "(KA/Pi) " +version + " - " +
392#ifdef DESKTOP_VERSION 392#ifdef DESKTOP_VERSION
393 "Desktop Edition\n" 393 "Desktop Edition\n"
394#else 394#else
395 "PDA-Edition\n" 395 "PDA-Edition\n"
396 "for: Zaurus 5500 / 7x0 / 8x0\n" 396 "for: Zaurus 5500 / 7x0 / 8x0\n"
397#endif 397#endif
398 398
399 "(c) 2004 Ulf Schenk\n" 399 "(c) 2004 Ulf Schenk\n"
400 "(c) 1997-2003, The KDE PIM Team\n" 400 "(c) 1997-2003, The KDE PIM Team\n"
401 "Tobias Koenig Current maintainer tokoe@kde.org\n" 401 "Tobias Koenig Current maintainer tokoe@kde.org\n"
402 "Don Sanders Original author\n" 402 "Don Sanders Original author\n"
403 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" 403 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n"
404 "Mike Pilone GUI and framework redesign mpilone@slac.com\n" 404 "Mike Pilone GUI and framework redesign mpilone@slac.com\n"
405 "Greg Stern DCOP interface\n" 405 "Greg Stern DCOP interface\n"
406 "Mark Westcot Contact pinning\n" 406 "Mark Westcot Contact pinning\n"
407 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 407 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
408 "Steffen Hansen LDAP Lookup hansen@kde.org\n" 408 "Steffen Hansen LDAP Lookup hansen@kde.org\n"
409#ifdef _WIN32_ 409#ifdef _WIN32_
410 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" 410 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n"
411#endif 411#endif
412 ); 412 );
413} 413}
414 414
415void KABCore::setContactSelected( const QString &uid ) 415void KABCore::setContactSelected( const QString &uid )
416{ 416{
417 KABC::Addressee addr = mAddressBook->findByUid( uid ); 417 KABC::Addressee addr = mAddressBook->findByUid( uid );
418 if ( !mDetails->isHidden() ) 418 if ( !mDetails->isHidden() )
419 mDetails->setAddressee( addr ); 419 mDetails->setAddressee( addr );
420 420
421 if ( !addr.isEmpty() ) { 421 if ( !addr.isEmpty() ) {
422 emit contactSelected( addr.formattedName() ); 422 emit contactSelected( addr.formattedName() );
423 KABC::Picture pic = addr.photo(); 423 KABC::Picture pic = addr.photo();
424 if ( pic.isIntern() ) { 424 if ( pic.isIntern() ) {
425//US emit contactSelected( pic.data() ); 425//US emit contactSelected( pic.data() );
426//US instead use: 426//US instead use:
427 QPixmap px; 427 QPixmap px;
428 if (pic.data().isNull() != true) 428 if (pic.data().isNull() != true)
429 { 429 {
430 px.convertFromImage(pic.data()); 430 px.convertFromImage(pic.data());
431 } 431 }
432 432
433 emit contactSelected( px ); 433 emit contactSelected( px );
434 } 434 }
435 } 435 }
436 436
437 437
438 mExtensionManager->setSelectionChanged(); 438 mExtensionManager->setSelectionChanged();
439 439
440 // update the actions 440 // update the actions
441 bool selected = !uid.isEmpty(); 441 bool selected = !uid.isEmpty();
442 442
443 if ( mReadWrite ) { 443 if ( mReadWrite ) {
444 mActionCut->setEnabled( selected ); 444 mActionCut->setEnabled( selected );
445 mActionPaste->setEnabled( selected ); 445 mActionPaste->setEnabled( selected );
446 } 446 }
447 447
448 mActionCopy->setEnabled( selected ); 448 mActionCopy->setEnabled( selected );
449 mActionDelete->setEnabled( selected ); 449 mActionDelete->setEnabled( selected );
450 mActionEditAddressee->setEnabled( selected ); 450 mActionEditAddressee->setEnabled( selected );
451 mActionMail->setEnabled( selected ); 451 mActionMail->setEnabled( selected );
452 mActionMailVCard->setEnabled( selected ); 452 mActionMailVCard->setEnabled( selected );
453 //if (mActionBeam) 453 //if (mActionBeam)
454 //mActionBeam->setEnabled( selected ); 454 //mActionBeam->setEnabled( selected );
455 455
456 if (mActionBeamVCard) 456 if (mActionBeamVCard)
457 mActionBeamVCard->setEnabled( selected ); 457 mActionBeamVCard->setEnabled( selected );
458 458
459 mActionWhoAmI->setEnabled( selected ); 459 mActionWhoAmI->setEnabled( selected );
460 mActionCategories->setEnabled( selected ); 460 mActionCategories->setEnabled( selected );
461} 461}
462 462
463void KABCore::sendMail() 463void KABCore::sendMail()
464{ 464{
465 sendMail( mViewManager->selectedEmails().join( ", " ) ); 465 sendMail( mViewManager->selectedEmails().join( ", " ) );
466} 466}
467 467
468void KABCore::sendMail( const QString& email ) 468void KABCore::sendMail( const QString& email )
469{ 469{
470//US original kde implementation : kapp->invokeMailer( email, "" ); 470//US original kde implementation : kapp->invokeMailer( email, "" );
471 471
472/*US original qtopia implementation 472/*US original qtopia implementation
473 PimContact c = abList->currentEntry(); 473 PimContact c = abList->currentEntry();
474 QString name = c.fileAs(); 474 QString name = c.fileAs();
475 QString email = c.defaultEmail(); 475 QString email = c.defaultEmail();
@@ -816,1065 +816,1071 @@ void KABCore::setCategories()
816 QStringList addrCategories = addr.categories(); 816 QStringList addrCategories = addr.categories();
817 QStringList::Iterator catIt; 817 QStringList::Iterator catIt;
818 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 818 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
819 if ( !addrCategories.contains( *catIt ) ) 819 if ( !addrCategories.contains( *catIt ) )
820 addrCategories.append( *catIt ); 820 addrCategories.append( *catIt );
821 } 821 }
822 addr.setCategories( addrCategories ); 822 addr.setCategories( addrCategories );
823 } 823 }
824 824
825 mAddressBook->insertAddressee( addr ); 825 mAddressBook->insertAddressee( addr );
826 } 826 }
827 } 827 }
828 828
829 if ( uids.count() > 0 ) 829 if ( uids.count() > 0 )
830 setModified( true ); 830 setModified( true );
831} 831}
832 832
833void KABCore::setSearchFields( const KABC::Field::List &fields ) 833void KABCore::setSearchFields( const KABC::Field::List &fields )
834{ 834{
835 mIncSearchWidget->setFields( fields ); 835 mIncSearchWidget->setFields( fields );
836} 836}
837 837
838void KABCore::incrementalSearch( const QString& text ) 838void KABCore::incrementalSearch( const QString& text )
839{ 839{
840 mViewManager->setSelected( QString::null, false ); 840 mViewManager->setSelected( QString::null, false );
841 841
842 if ( !text.isEmpty() ) { 842 if ( !text.isEmpty() ) {
843 KABC::Field *field = mIncSearchWidget->currentField(); 843 KABC::Field *field = mIncSearchWidget->currentField();
844 844
845 QString pattern = text.lower(); 845 QString pattern = text.lower();
846 846
847#if 1 //KDE_VERSION >= 319 847#if 1 //KDE_VERSION >= 319
848 KABC::AddresseeList list( mAddressBook->allAddressees() ); 848 KABC::AddresseeList list( mAddressBook->allAddressees() );
849 if ( field ) { 849 if ( field ) {
850 list.sortByField( field ); 850 list.sortByField( field );
851 KABC::AddresseeList::Iterator it; 851 KABC::AddresseeList::Iterator it;
852 for ( it = list.begin(); it != list.end(); ++it ) { 852 for ( it = list.begin(); it != list.end(); ++it ) {
853 if ( field->value( *it ).lower().startsWith( pattern ) ) { 853 if ( field->value( *it ).lower().startsWith( pattern ) ) {
854 mViewManager->setSelected( (*it).uid(), true ); 854 mViewManager->setSelected( (*it).uid(), true );
855 return; 855 return;
856 } 856 }
857 } 857 }
858 } else { 858 } else {
859 KABC::AddresseeList::Iterator it; 859 KABC::AddresseeList::Iterator it;
860 for ( it = list.begin(); it != list.end(); ++it ) { 860 for ( it = list.begin(); it != list.end(); ++it ) {
861 KABC::Field::List fieldList = mIncSearchWidget->fields(); 861 KABC::Field::List fieldList = mIncSearchWidget->fields();
862 KABC::Field::List::ConstIterator fieldIt; 862 KABC::Field::List::ConstIterator fieldIt;
863 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 863 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
864 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 864 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
865 mViewManager->setSelected( (*it).uid(), true ); 865 mViewManager->setSelected( (*it).uid(), true );
866 return; 866 return;
867 } 867 }
868 } 868 }
869 } 869 }
870 } 870 }
871#else 871#else
872 KABC::AddressBook::Iterator it; 872 KABC::AddressBook::Iterator it;
873 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 873 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
874 if ( field ) { 874 if ( field ) {
875 if ( field->value( *it ).lower().startsWith( pattern ) ) { 875 if ( field->value( *it ).lower().startsWith( pattern ) ) {
876 mViewManager->setSelected( (*it).uid(), true ); 876 mViewManager->setSelected( (*it).uid(), true );
877 return; 877 return;
878 } 878 }
879 } else { 879 } else {
880 KABC::Field::List fieldList = mIncSearchWidget->fields(); 880 KABC::Field::List fieldList = mIncSearchWidget->fields();
881 KABC::Field::List::ConstIterator fieldIt; 881 KABC::Field::List::ConstIterator fieldIt;
882 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 882 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
883 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 883 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
884 mViewManager->setSelected( (*it).uid(), true ); 884 mViewManager->setSelected( (*it).uid(), true );
885 return; 885 return;
886 } 886 }
887 } 887 }
888 } 888 }
889 } 889 }
890#endif 890#endif
891 } 891 }
892} 892}
893 893
894void KABCore::setModified() 894void KABCore::setModified()
895{ 895{
896 setModified( true ); 896 setModified( true );
897} 897}
898 898
899void KABCore::setModifiedWOrefresh() 899void KABCore::setModifiedWOrefresh()
900{ 900{
901 // qDebug("KABCore::setModifiedWOrefresh() "); 901 // qDebug("KABCore::setModifiedWOrefresh() ");
902 mModified = true; 902 mModified = true;
903 mActionSave->setEnabled( mModified ); 903 mActionSave->setEnabled( mModified );
904#ifdef DESKTOP_VERSION 904#ifdef DESKTOP_VERSION
905 mDetails->refreshView(); 905 mDetails->refreshView();
906#endif 906#endif
907 907
908} 908}
909void KABCore::setModified( bool modified ) 909void KABCore::setModified( bool modified )
910{ 910{
911 mModified = modified; 911 mModified = modified;
912 mActionSave->setEnabled( mModified ); 912 mActionSave->setEnabled( mModified );
913 913
914 if ( modified ) 914 if ( modified )
915 mJumpButtonBar->recreateButtons(); 915 mJumpButtonBar->recreateButtons();
916 916
917 mViewManager->refreshView(); 917 mViewManager->refreshView();
918 mDetails->refreshView(); 918 mDetails->refreshView();
919 919
920} 920}
921 921
922bool KABCore::modified() const 922bool KABCore::modified() const
923{ 923{
924 return mModified; 924 return mModified;
925} 925}
926 926
927void KABCore::contactModified( const KABC::Addressee &addr ) 927void KABCore::contactModified( const KABC::Addressee &addr )
928{ 928{
929 929
930 Command *command = 0; 930 Command *command = 0;
931 QString uid; 931 QString uid;
932 932
933 // check if it exists already 933 // check if it exists already
934 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 934 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
935 if ( origAddr.isEmpty() ) 935 if ( origAddr.isEmpty() )
936 command = new PwNewCommand( mAddressBook, addr ); 936 command = new PwNewCommand( mAddressBook, addr );
937 else { 937 else {
938 command = new PwEditCommand( mAddressBook, origAddr, addr ); 938 command = new PwEditCommand( mAddressBook, origAddr, addr );
939 uid = addr.uid(); 939 uid = addr.uid();
940 } 940 }
941 941
942 UndoStack::instance()->push( command ); 942 UndoStack::instance()->push( command );
943 RedoStack::instance()->clear(); 943 RedoStack::instance()->clear();
944 944
945 setModified( true ); 945 setModified( true );
946} 946}
947 947
948void KABCore::newContact() 948void KABCore::newContact()
949{ 949{
950 950
951 951
952 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 952 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
953 953
954 QPtrList<KRES::Resource> kresResources; 954 QPtrList<KRES::Resource> kresResources;
955 QPtrListIterator<KABC::Resource> it( kabcResources ); 955 QPtrListIterator<KABC::Resource> it( kabcResources );
956 KABC::Resource *resource; 956 KABC::Resource *resource;
957 while ( ( resource = it.current() ) != 0 ) { 957 while ( ( resource = it.current() ) != 0 ) {
958 ++it; 958 ++it;
959 if ( !resource->readOnly() ) { 959 if ( !resource->readOnly() ) {
960 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 960 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
961 if ( res ) 961 if ( res )
962 kresResources.append( res ); 962 kresResources.append( res );
963 } 963 }
964 } 964 }
965 965
966 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 966 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
967 resource = static_cast<KABC::Resource*>( res ); 967 resource = static_cast<KABC::Resource*>( res );
968 968
969 if ( resource ) { 969 if ( resource ) {
970 KABC::Addressee addr; 970 KABC::Addressee addr;
971 addr.setResource( resource ); 971 addr.setResource( resource );
972 mEditorDialog->setAddressee( addr ); 972 mEditorDialog->setAddressee( addr );
973 KApplication::execDialog ( mEditorDialog ); 973 KApplication::execDialog ( mEditorDialog );
974 974
975 } else 975 } else
976 return; 976 return;
977 977
978 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 978 // mEditorDict.insert( dialog->addressee().uid(), dialog );
979 979
980 980
981} 981}
982 982
983void KABCore::addEmail( QString aStr ) 983void KABCore::addEmail( QString aStr )
984{ 984{
985#ifndef KAB_EMBEDDED 985#ifndef KAB_EMBEDDED
986 QString fullName, email; 986 QString fullName, email;
987 987
988 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 988 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
989 989
990 // Try to lookup the addressee matching the email address 990 // Try to lookup the addressee matching the email address
991 bool found = false; 991 bool found = false;
992 QStringList emailList; 992 QStringList emailList;
993 KABC::AddressBook::Iterator it; 993 KABC::AddressBook::Iterator it;
994 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 994 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
995 emailList = (*it).emails(); 995 emailList = (*it).emails();
996 if ( emailList.contains( email ) > 0 ) { 996 if ( emailList.contains( email ) > 0 ) {
997 found = true; 997 found = true;
998 (*it).setNameFromString( fullName ); 998 (*it).setNameFromString( fullName );
999 editContact( (*it).uid() ); 999 editContact( (*it).uid() );
1000 } 1000 }
1001 } 1001 }
1002 1002
1003 if ( !found ) { 1003 if ( !found ) {
1004 KABC::Addressee addr; 1004 KABC::Addressee addr;
1005 addr.setNameFromString( fullName ); 1005 addr.setNameFromString( fullName );
1006 addr.insertEmail( email, true ); 1006 addr.insertEmail( email, true );
1007 1007
1008 mAddressBook->insertAddressee( addr ); 1008 mAddressBook->insertAddressee( addr );
1009 mViewManager->refreshView( addr.uid() ); 1009 mViewManager->refreshView( addr.uid() );
1010 editContact( addr.uid() ); 1010 editContact( addr.uid() );
1011 } 1011 }
1012#else //KAB_EMBEDDED 1012#else //KAB_EMBEDDED
1013 qDebug("KABCore::addEmail finsih method"); 1013 qDebug("KABCore::addEmail finsih method");
1014#endif //KAB_EMBEDDED 1014#endif //KAB_EMBEDDED
1015} 1015}
1016 1016
1017void KABCore::importVCard( const KURL &url, bool showPreview ) 1017void KABCore::importVCard( const KURL &url, bool showPreview )
1018{ 1018{
1019 mXXPortManager->importVCard( url, showPreview ); 1019 mXXPortManager->importVCard( url, showPreview );
1020} 1020}
1021void KABCore::importFromOL() 1021void KABCore::importFromOL()
1022{ 1022{
1023#ifdef _WIN32_ 1023#ifdef _WIN32_
1024 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1024 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1025 idgl->exec(); 1025 idgl->exec();
1026 KABC::Addressee::List list = idgl->getAddressList(); 1026 KABC::Addressee::List list = idgl->getAddressList();
1027 if ( list.count() > 0 ) { 1027 if ( list.count() > 0 ) {
1028 KABC::Addressee::List listNew; 1028 KABC::Addressee::List listNew;
1029 KABC::Addressee::List listExisting; 1029 KABC::Addressee::List listExisting;
1030 KABC::Addressee::List::Iterator it; 1030 KABC::Addressee::List::Iterator it;
1031 KABC::AddressBook::Iterator iter; 1031 KABC::AddressBook::Iterator iter;
1032 for ( it = list.begin(); it != list.end(); ++it ) { 1032 for ( it = list.begin(); it != list.end(); ++it ) {
1033 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1033 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1034 listNew.append( (*it) ); 1034 listNew.append( (*it) );
1035 else 1035 else
1036 listExisting.append( (*it) ); 1036 listExisting.append( (*it) );
1037 } 1037 }
1038 if ( listExisting.count() > 0 ) 1038 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() )); 1039 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 ) { 1040 if ( listNew.count() > 0 ) {
1041 pasteWithNewUid = false; 1041 pasteWithNewUid = false;
1042 pasteContacts( listNew ); 1042 pasteContacts( listNew );
1043 pasteWithNewUid = true; 1043 pasteWithNewUid = true;
1044 } 1044 }
1045 } 1045 }
1046 delete idgl; 1046 delete idgl;
1047#endif 1047#endif
1048} 1048}
1049 1049
1050void KABCore::importVCard( const QString &vCard, bool showPreview ) 1050void KABCore::importVCard( const QString &vCard, bool showPreview )
1051{ 1051{
1052 mXXPortManager->importVCard( vCard, showPreview ); 1052 mXXPortManager->importVCard( vCard, showPreview );
1053} 1053}
1054 1054
1055//US added a second method without defaultparameter 1055//US added a second method without defaultparameter
1056void KABCore::editContact2() { 1056void KABCore::editContact2() {
1057 editContact( QString::null ); 1057 editContact( QString::null );
1058} 1058}
1059 1059
1060void KABCore::editContact( const QString &uid ) 1060void KABCore::editContact( const QString &uid )
1061{ 1061{
1062 1062
1063 if ( mExtensionManager->isQuickEditVisible() ) 1063 if ( mExtensionManager->isQuickEditVisible() )
1064 return; 1064 return;
1065 1065
1066 // First, locate the contact entry 1066 // First, locate the contact entry
1067 QString localUID = uid; 1067 QString localUID = uid;
1068 if ( localUID.isNull() ) { 1068 if ( localUID.isNull() ) {
1069 QStringList uidList = mViewManager->selectedUids(); 1069 QStringList uidList = mViewManager->selectedUids();
1070 if ( uidList.count() > 0 ) 1070 if ( uidList.count() > 0 )
1071 localUID = *( uidList.at( 0 ) ); 1071 localUID = *( uidList.at( 0 ) );
1072 } 1072 }
1073 1073
1074 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1074 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1075 if ( !addr.isEmpty() ) { 1075 if ( !addr.isEmpty() ) {
1076 mEditorDialog->setAddressee( addr ); 1076 mEditorDialog->setAddressee( addr );
1077 KApplication::execDialog ( mEditorDialog ); 1077 KApplication::execDialog ( mEditorDialog );
1078 } 1078 }
1079} 1079}
1080 1080
1081void KABCore::save() 1081void KABCore::save()
1082{ 1082{
1083 if ( !mModified ) 1083 if ( !mModified )
1084 return; 1084 return;
1085 QString text = i18n( "There was an error while attempting to save\n the " 1085 QString text = i18n( "There was an error while attempting to save\n the "
1086 "address book. Please check that some \nother application is " 1086 "address book. Please check that some \nother application is "
1087 "not using it. " ); 1087 "not using it. " );
1088 statusMessage(i18n("Saving addressbook ... ")); 1088 statusMessage(i18n("Saving addressbook ... "));
1089#ifndef KAB_EMBEDDED 1089#ifndef KAB_EMBEDDED
1090 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1090 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1091 if ( !b || !b->save() ) { 1091 if ( !b || !b->save() ) {
1092 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1092 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1093 } 1093 }
1094#else //KAB_EMBEDDED 1094#else //KAB_EMBEDDED
1095 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1095 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1096 if ( !b || !b->save() ) { 1096 if ( !b || !b->save() ) {
1097 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1097 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1098 } 1098 }
1099#endif //KAB_EMBEDDED 1099#endif //KAB_EMBEDDED
1100 1100
1101 statusMessage(i18n("Addressbook saved!")); 1101 statusMessage(i18n("Addressbook saved!"));
1102 setModified( false ); 1102 setModified( false );
1103} 1103}
1104 1104
1105void KABCore::statusMessage(QString mess , int time ) 1105void KABCore::statusMessage(QString mess , int time )
1106{ 1106{
1107 //topLevelWidget()->setCaption( mess ); 1107 //topLevelWidget()->setCaption( mess );
1108 // pending setting timer to revome message 1108 // pending setting timer to revome message
1109} 1109}
1110void KABCore::undo() 1110void KABCore::undo()
1111{ 1111{
1112 UndoStack::instance()->undo(); 1112 UndoStack::instance()->undo();
1113 1113
1114 // Refresh the view 1114 // Refresh the view
1115 mViewManager->refreshView(); 1115 mViewManager->refreshView();
1116} 1116}
1117 1117
1118void KABCore::redo() 1118void KABCore::redo()
1119{ 1119{
1120 RedoStack::instance()->redo(); 1120 RedoStack::instance()->redo();
1121 1121
1122 // Refresh the view 1122 // Refresh the view
1123 mViewManager->refreshView(); 1123 mViewManager->refreshView();
1124} 1124}
1125 1125
1126void KABCore::setJumpButtonBarVisible( bool visible ) 1126void KABCore::setJumpButtonBarVisible( bool visible )
1127{ 1127{
1128 if ( visible ) 1128 if ( visible )
1129 mJumpButtonBar->show(); 1129 mJumpButtonBar->show();
1130 else 1130 else
1131 mJumpButtonBar->hide(); 1131 mJumpButtonBar->hide();
1132} 1132}
1133void KABCore::setDetailsToState() 1133void KABCore::setDetailsToState()
1134{ 1134{
1135 setDetailsVisible( mActionDetails->isChecked() ); 1135 setDetailsVisible( mActionDetails->isChecked() );
1136} 1136}
1137 1137
1138void KABCore::setDetailsVisible( bool visible ) 1138void KABCore::setDetailsVisible( bool visible )
1139{ 1139{
1140 if ( visible ) 1140 if ( visible )
1141 mDetails->show(); 1141 mDetails->show();
1142 else 1142 else
1143 mDetails->hide(); 1143 mDetails->hide();
1144} 1144}
1145 1145
1146void KABCore::extensionModified( const KABC::Addressee::List &list ) 1146void KABCore::extensionModified( const KABC::Addressee::List &list )
1147{ 1147{
1148 1148
1149 if ( list.count() != 0 ) { 1149 if ( list.count() != 0 ) {
1150 KABC::Addressee::List::ConstIterator it; 1150 KABC::Addressee::List::ConstIterator it;
1151 for ( it = list.begin(); it != list.end(); ++it ) 1151 for ( it = list.begin(); it != list.end(); ++it )
1152 mAddressBook->insertAddressee( *it ); 1152 mAddressBook->insertAddressee( *it );
1153 if ( list.count() > 1 ) 1153 if ( list.count() > 1 )
1154 setModified(); 1154 setModified();
1155 else 1155 else
1156 setModifiedWOrefresh(); 1156 setModifiedWOrefresh();
1157 } 1157 }
1158 if ( list.count() == 0 ) 1158 if ( list.count() == 0 )
1159 mViewManager->refreshView(); 1159 mViewManager->refreshView();
1160 else 1160 else
1161 mViewManager->refreshView( list[ 0 ].uid() ); 1161 mViewManager->refreshView( list[ 0 ].uid() );
1162 1162
1163 1163
1164 1164
1165} 1165}
1166 1166
1167QString KABCore::getNameByPhone( const QString &phone ) 1167QString KABCore::getNameByPhone( const QString &phone )
1168{ 1168{
1169#ifndef KAB_EMBEDDED 1169#ifndef KAB_EMBEDDED
1170 QRegExp r( "[/*/-/ ]" ); 1170 QRegExp r( "[/*/-/ ]" );
1171 QString localPhone( phone ); 1171 QString localPhone( phone );
1172 1172
1173 bool found = false; 1173 bool found = false;
1174 QString ownerName = ""; 1174 QString ownerName = "";
1175 KABC::AddressBook::Iterator iter; 1175 KABC::AddressBook::Iterator iter;
1176 KABC::PhoneNumber::List::Iterator phoneIter; 1176 KABC::PhoneNumber::List::Iterator phoneIter;
1177 KABC::PhoneNumber::List phoneList; 1177 KABC::PhoneNumber::List phoneList;
1178 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1178 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1179 phoneList = (*iter).phoneNumbers(); 1179 phoneList = (*iter).phoneNumbers();
1180 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1180 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1181 ++phoneIter) { 1181 ++phoneIter) {
1182 // Get rid of separator chars so just the numbers are compared. 1182 // Get rid of separator chars so just the numbers are compared.
1183 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1183 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1184 ownerName = (*iter).formattedName(); 1184 ownerName = (*iter).formattedName();
1185 found = true; 1185 found = true;
1186 } 1186 }
1187 } 1187 }
1188 } 1188 }
1189 1189
1190 return ownerName; 1190 return ownerName;
1191#else //KAB_EMBEDDED 1191#else //KAB_EMBEDDED
1192 qDebug("KABCore::getNameByPhone finsih method"); 1192 qDebug("KABCore::getNameByPhone finsih method");
1193 return ""; 1193 return "";
1194#endif //KAB_EMBEDDED 1194#endif //KAB_EMBEDDED
1195 1195
1196} 1196}
1197 1197
1198void KABCore::openConfigDialog() 1198void KABCore::openConfigDialog()
1199{ 1199{
1200 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1200 KABPrefs* prefs = KABPrefs::instance();
1201 KCMultiDialog* ConfigureDialog = new KCMultiDialog( prefs, "PIM", this ,"kabconfigdialog", true );
1201 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1202 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1202 ConfigureDialog->addModule(kabcfg ); 1203 ConfigureDialog->addModule(kabcfg );
1204 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Pim")) , "KCMKdeLibConfig" );
1205 ConfigureDialog->addModule(kdelibcfg );
1206
1207
1208
1203 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1209 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1204 this, SLOT( configurationChanged() ) ); 1210 this, SLOT( configurationChanged() ) );
1205 connect( ConfigureDialog, SIGNAL( okClicked() ), 1211 connect( ConfigureDialog, SIGNAL( okClicked() ),
1206 this, SLOT( configurationChanged() ) ); 1212 this, SLOT( configurationChanged() ) );
1207 saveSettings(); 1213 saveSettings();
1208 ConfigureDialog->showMaximized(); 1214 ConfigureDialog->showMaximized();
1209 if ( ConfigureDialog->exec() ) 1215 if ( ConfigureDialog->exec() )
1210 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); 1216 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") );
1211 delete ConfigureDialog; 1217 delete ConfigureDialog;
1212} 1218}
1213 1219
1214void KABCore::openLDAPDialog() 1220void KABCore::openLDAPDialog()
1215{ 1221{
1216#ifndef KAB_EMBEDDED 1222#ifndef KAB_EMBEDDED
1217 if ( !mLdapSearchDialog ) { 1223 if ( !mLdapSearchDialog ) {
1218 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1224 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1219 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1225 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1220 SLOT( refreshView() ) ); 1226 SLOT( refreshView() ) );
1221 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1227 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1222 SLOT( setModified() ) ); 1228 SLOT( setModified() ) );
1223 } else 1229 } else
1224 mLdapSearchDialog->restoreSettings(); 1230 mLdapSearchDialog->restoreSettings();
1225 1231
1226 if ( mLdapSearchDialog->isOK() ) 1232 if ( mLdapSearchDialog->isOK() )
1227 mLdapSearchDialog->exec(); 1233 mLdapSearchDialog->exec();
1228#else //KAB_EMBEDDED 1234#else //KAB_EMBEDDED
1229 qDebug("KABCore::openLDAPDialog() finsih method"); 1235 qDebug("KABCore::openLDAPDialog() finsih method");
1230#endif //KAB_EMBEDDED 1236#endif //KAB_EMBEDDED
1231} 1237}
1232 1238
1233void KABCore::print() 1239void KABCore::print()
1234{ 1240{
1235#ifndef KAB_EMBEDDED 1241#ifndef KAB_EMBEDDED
1236 KPrinter printer; 1242 KPrinter printer;
1237 if ( !printer.setup( this ) ) 1243 if ( !printer.setup( this ) )
1238 return; 1244 return;
1239 1245
1240 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1246 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1241 mViewManager->selectedUids(), this ); 1247 mViewManager->selectedUids(), this );
1242 1248
1243 wizard.exec(); 1249 wizard.exec();
1244#else //KAB_EMBEDDED 1250#else //KAB_EMBEDDED
1245 qDebug("KABCore::print() finsih method"); 1251 qDebug("KABCore::print() finsih method");
1246#endif //KAB_EMBEDDED 1252#endif //KAB_EMBEDDED
1247 1253
1248} 1254}
1249 1255
1250 1256
1251void KABCore::addGUIClient( KXMLGUIClient *client ) 1257void KABCore::addGUIClient( KXMLGUIClient *client )
1252{ 1258{
1253 if ( mGUIClient ) 1259 if ( mGUIClient )
1254 mGUIClient->insertChildClient( client ); 1260 mGUIClient->insertChildClient( client );
1255 else 1261 else
1256 KMessageBox::error( this, "no KXMLGUICLient"); 1262 KMessageBox::error( this, "no KXMLGUICLient");
1257} 1263}
1258 1264
1259 1265
1260void KABCore::configurationChanged() 1266void KABCore::configurationChanged()
1261{ 1267{
1262 mExtensionManager->reconfigure(); 1268 mExtensionManager->reconfigure();
1263} 1269}
1264 1270
1265void KABCore::addressBookChanged() 1271void KABCore::addressBookChanged()
1266{ 1272{
1267/*US 1273/*US
1268 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1274 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1269 while ( it.current() ) { 1275 while ( it.current() ) {
1270 if ( it.current()->dirty() ) { 1276 if ( it.current()->dirty() ) {
1271 QString text = i18n( "Data has been changed externally. Unsaved " 1277 QString text = i18n( "Data has been changed externally. Unsaved "
1272 "changes will be lost." ); 1278 "changes will be lost." );
1273 KMessageBox::information( this, text ); 1279 KMessageBox::information( this, text );
1274 } 1280 }
1275 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1281 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1276 ++it; 1282 ++it;
1277 } 1283 }
1278*/ 1284*/
1279 if (mEditorDialog) 1285 if (mEditorDialog)
1280 { 1286 {
1281 if (mEditorDialog->dirty()) 1287 if (mEditorDialog->dirty())
1282 { 1288 {
1283 QString text = i18n( "Data has been changed externally. Unsaved " 1289 QString text = i18n( "Data has been changed externally. Unsaved "
1284 "changes will be lost." ); 1290 "changes will be lost." );
1285 KMessageBox::information( this, text ); 1291 KMessageBox::information( this, text );
1286 } 1292 }
1287 QString currentuid = mEditorDialog->addressee().uid(); 1293 QString currentuid = mEditorDialog->addressee().uid();
1288 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1294 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1289 } 1295 }
1290 mViewManager->refreshView(); 1296 mViewManager->refreshView();
1291// mDetails->refreshView(); 1297// mDetails->refreshView();
1292 1298
1293 1299
1294} 1300}
1295 1301
1296AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1302AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1297 const char *name ) 1303 const char *name )
1298{ 1304{
1299 1305
1300 if ( mEditorDialog == 0 ) { 1306 if ( mEditorDialog == 0 ) {
1301 mEditorDialog = new AddresseeEditorDialog( this, parent, 1307 mEditorDialog = new AddresseeEditorDialog( this, parent,
1302 name ? name : "editorDialog" ); 1308 name ? name : "editorDialog" );
1303 1309
1304 1310
1305 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1311 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1306 SLOT( contactModified( const KABC::Addressee& ) ) ); 1312 SLOT( contactModified( const KABC::Addressee& ) ) );
1307 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1313 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1308 // SLOT( slotEditorDestroyed( const QString& ) ) ); 1314 // SLOT( slotEditorDestroyed( const QString& ) ) );
1309 } 1315 }
1310 1316
1311 return mEditorDialog; 1317 return mEditorDialog;
1312} 1318}
1313 1319
1314void KABCore::slotEditorDestroyed( const QString &uid ) 1320void KABCore::slotEditorDestroyed( const QString &uid )
1315{ 1321{
1316 //mEditorDict.remove( uid ); 1322 //mEditorDict.remove( uid );
1317} 1323}
1318 1324
1319void KABCore::initGUI() 1325void KABCore::initGUI()
1320{ 1326{
1321#ifndef KAB_EMBEDDED 1327#ifndef KAB_EMBEDDED
1322 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1328 QHBoxLayout *topLayout = new QHBoxLayout( this );
1323 topLayout->setSpacing( KDialogBase::spacingHint() ); 1329 topLayout->setSpacing( KDialogBase::spacingHint() );
1324 1330
1325 mExtensionBarSplitter = new QSplitter( this ); 1331 mExtensionBarSplitter = new QSplitter( this );
1326 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1332 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1327 1333
1328 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1334 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1329 1335
1330 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1336 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1331 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1337 mIncSearchWidget = new IncSearchWidget( viewSpace );
1332 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1338 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1333 SLOT( incrementalSearch( const QString& ) ) ); 1339 SLOT( incrementalSearch( const QString& ) ) );
1334 1340
1335 mViewManager = new ViewManager( this, viewSpace ); 1341 mViewManager = new ViewManager( this, viewSpace );
1336 viewSpace->setStretchFactor( mViewManager, 1 ); 1342 viewSpace->setStretchFactor( mViewManager, 1 );
1337 1343
1338 mDetails = new ViewContainer( mDetailsSplitter ); 1344 mDetails = new ViewContainer( mDetailsSplitter );
1339 1345
1340 mJumpButtonBar = new JumpButtonBar( this, this ); 1346 mJumpButtonBar = new JumpButtonBar( this, this );
1341 1347
1342 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1348 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1343 1349
1344 topLayout->addWidget( mExtensionBarSplitter ); 1350 topLayout->addWidget( mExtensionBarSplitter );
1345 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1351 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1346 topLayout->addWidget( mJumpButtonBar ); 1352 topLayout->addWidget( mJumpButtonBar );
1347 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1353 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1348 1354
1349 mXXPortManager = new XXPortManager( this, this ); 1355 mXXPortManager = new XXPortManager( this, this );
1350 1356
1351#else //KAB_EMBEDDED 1357#else //KAB_EMBEDDED
1352 //US initialize viewMenu before settingup viewmanager. 1358 //US initialize viewMenu before settingup viewmanager.
1353 // Viewmanager needs this menu to plugin submenues. 1359 // Viewmanager needs this menu to plugin submenues.
1354 viewMenu = new QPopupMenu( this ); 1360 viewMenu = new QPopupMenu( this );
1355 settingsMenu = new QPopupMenu( this ); 1361 settingsMenu = new QPopupMenu( this );
1356 //filterMenu = new QPopupMenu( this ); 1362 //filterMenu = new QPopupMenu( this );
1357 ImportMenu = new QPopupMenu( this ); 1363 ImportMenu = new QPopupMenu( this );
1358 ExportMenu = new QPopupMenu( this ); 1364 ExportMenu = new QPopupMenu( this );
1359 1365
1360 changeMenu= new QPopupMenu( this ); 1366 changeMenu= new QPopupMenu( this );
1361 1367
1362//US since we have no splitter for the embedded system, setup 1368//US since we have no splitter for the embedded system, setup
1363// a layout with two frames. One left and one right. 1369// a layout with two frames. One left and one right.
1364 1370
1365 QBoxLayout *topLayout; 1371 QBoxLayout *topLayout;
1366 1372
1367 // = new QHBoxLayout( this ); 1373 // = new QHBoxLayout( this );
1368// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1374// QBoxLayout *topLayout = (QBoxLayout*)layout();
1369 1375
1370// QWidget *mainBox = new QWidget( this ); 1376// QWidget *mainBox = new QWidget( this );
1371// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1377// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1372 1378
1373#ifdef DESKTOP_VERSION 1379#ifdef DESKTOP_VERSION
1374 topLayout = new QHBoxLayout( this ); 1380 topLayout = new QHBoxLayout( this );
1375 1381
1376 1382
1377 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1383 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1378 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1384 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1379 1385
1380 topLayout->addWidget(mMiniSplitter ); 1386 topLayout->addWidget(mMiniSplitter );
1381 1387
1382 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1388 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1383 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1389 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1384 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1390 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1385 mDetails = new ViewContainer( mMiniSplitter ); 1391 mDetails = new ViewContainer( mMiniSplitter );
1386 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1392 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1387#else 1393#else
1388 if ( QApplication::desktop()->width() > 480 ) { 1394 if ( QApplication::desktop()->width() > 480 ) {
1389 topLayout = new QHBoxLayout( this ); 1395 topLayout = new QHBoxLayout( this );
1390 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1396 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1391 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1397 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1392 } else { 1398 } else {
1393 1399
1394 topLayout = new QHBoxLayout( this ); 1400 topLayout = new QHBoxLayout( this );
1395 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1401 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1396 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1402 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1397 } 1403 }
1398 1404
1399 topLayout->addWidget(mMiniSplitter ); 1405 topLayout->addWidget(mMiniSplitter );
1400 mViewManager = new ViewManager( this, mMiniSplitter ); 1406 mViewManager = new ViewManager( this, mMiniSplitter );
1401 mDetails = new ViewContainer( mMiniSplitter ); 1407 mDetails = new ViewContainer( mMiniSplitter );
1402 1408
1403 1409
1404 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1410 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1405#endif 1411#endif
1406 //eh->hide(); 1412 //eh->hide();
1407 // topLayout->addWidget(mExtensionManager ); 1413 // topLayout->addWidget(mExtensionManager );
1408 1414
1409 1415
1410/*US 1416/*US
1411#ifndef KAB_NOSPLITTER 1417#ifndef KAB_NOSPLITTER
1412 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1418 QHBoxLayout *topLayout = new QHBoxLayout( this );
1413//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1419//US topLayout->setSpacing( KDialogBase::spacingHint() );
1414 topLayout->setSpacing( 10 ); 1420 topLayout->setSpacing( 10 );
1415 1421
1416 mDetailsSplitter = new QSplitter( this ); 1422 mDetailsSplitter = new QSplitter( this );
1417 1423
1418 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1424 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1419 1425
1420 mViewManager = new ViewManager( this, viewSpace ); 1426 mViewManager = new ViewManager( this, viewSpace );
1421 viewSpace->setStretchFactor( mViewManager, 1 ); 1427 viewSpace->setStretchFactor( mViewManager, 1 );
1422 1428
1423 mDetails = new ViewContainer( mDetailsSplitter ); 1429 mDetails = new ViewContainer( mDetailsSplitter );
1424 1430
1425 topLayout->addWidget( mDetailsSplitter ); 1431 topLayout->addWidget( mDetailsSplitter );
1426 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1432 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1427#else //KAB_NOSPLITTER 1433#else //KAB_NOSPLITTER
1428 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1434 QHBoxLayout *topLayout = new QHBoxLayout( this );
1429//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1435//US topLayout->setSpacing( KDialogBase::spacingHint() );
1430 topLayout->setSpacing( 10 ); 1436 topLayout->setSpacing( 10 );
1431 1437
1432// mDetailsSplitter = new QSplitter( this ); 1438// mDetailsSplitter = new QSplitter( this );
1433 1439
1434 QVBox *viewSpace = new QVBox( this ); 1440 QVBox *viewSpace = new QVBox( this );
1435 1441
1436 mViewManager = new ViewManager( this, viewSpace ); 1442 mViewManager = new ViewManager( this, viewSpace );
1437 viewSpace->setStretchFactor( mViewManager, 1 ); 1443 viewSpace->setStretchFactor( mViewManager, 1 );
1438 1444
1439 mDetails = new ViewContainer( this ); 1445 mDetails = new ViewContainer( this );
1440 1446
1441 topLayout->addWidget( viewSpace ); 1447 topLayout->addWidget( viewSpace );
1442// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1448// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1443 topLayout->addWidget( mDetails ); 1449 topLayout->addWidget( mDetails );
1444#endif //KAB_NOSPLITTER 1450#endif //KAB_NOSPLITTER
1445*/ 1451*/
1446 1452
1447 1453
1448#endif //KAB_EMBEDDED 1454#endif //KAB_EMBEDDED
1449 initActions(); 1455 initActions();
1450 1456
1451#ifdef KAB_EMBEDDED 1457#ifdef KAB_EMBEDDED
1452 addActionsManually(); 1458 addActionsManually();
1453 //US make sure the export and import menues are initialized before creating the xxPortManager. 1459 //US make sure the export and import menues are initialized before creating the xxPortManager.
1454 mXXPortManager = new XXPortManager( this, this ); 1460 mXXPortManager = new XXPortManager( this, this );
1455 1461
1456 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1462 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1457 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1463 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1458 // mActionQuit->plug ( mMainWindow->toolBar()); 1464 // mActionQuit->plug ( mMainWindow->toolBar());
1459 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1465 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1460 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1466 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1461 // mIncSearchWidget->hide(); 1467 // mIncSearchWidget->hide();
1462 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1468 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1463 SLOT( incrementalSearch( const QString& ) ) ); 1469 SLOT( incrementalSearch( const QString& ) ) );
1464 1470
1465 1471
1466 mJumpButtonBar = new JumpButtonBar( this, this ); 1472 mJumpButtonBar = new JumpButtonBar( this, this );
1467 1473
1468 topLayout->addWidget( mJumpButtonBar ); 1474 topLayout->addWidget( mJumpButtonBar );
1469//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1475//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1470 1476
1471// mMainWindow->getIconToolBar()->raise(); 1477// mMainWindow->getIconToolBar()->raise();
1472 1478
1473#endif //KAB_EMBEDDED 1479#endif //KAB_EMBEDDED
1474 1480
1475} 1481}
1476void KABCore::initActions() 1482void KABCore::initActions()
1477{ 1483{
1478//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1484//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1479 1485
1480#ifndef KAB_EMBEDDED 1486#ifndef KAB_EMBEDDED
1481 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1487 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1482 SLOT( clipboardDataChanged() ) ); 1488 SLOT( clipboardDataChanged() ) );
1483#endif //KAB_EMBEDDED 1489#endif //KAB_EMBEDDED
1484 1490
1485 // file menu 1491 // file menu
1486 if ( mIsPart ) { 1492 if ( mIsPart ) {
1487 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1493 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1488 SLOT( sendMail() ), actionCollection(), 1494 SLOT( sendMail() ), actionCollection(),
1489 "kaddressbook_mail" ); 1495 "kaddressbook_mail" );
1490 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1496 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1491 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1497 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1492 1498
1493 } else { 1499 } else {
1494 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1500 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1495 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1501 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1496 } 1502 }
1497 1503
1498 1504
1499 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1505 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1500 SLOT( save() ), actionCollection(), "file_sync" ); 1506 SLOT( save() ), actionCollection(), "file_sync" );
1501 1507
1502 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1508 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1503 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1509 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1504 1510
1505 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1511 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1506 this, SLOT( mailVCard() ), 1512 this, SLOT( mailVCard() ),
1507 actionCollection(), "file_mail_vcard"); 1513 actionCollection(), "file_mail_vcard");
1508 1514
1509 mActionBeamVCard = 0; 1515 mActionBeamVCard = 0;
1510 mActionBeam = 0; 1516 mActionBeam = 0;
1511 1517
1512#ifndef DESKTOP_VERSION 1518#ifndef DESKTOP_VERSION
1513 if ( Ir::supported() ) { 1519 if ( Ir::supported() ) {
1514 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1520 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1515 SLOT( beamVCard() ), actionCollection(), 1521 SLOT( beamVCard() ), actionCollection(),
1516 "kaddressbook_beam_vcard" ); 1522 "kaddressbook_beam_vcard" );
1517 1523
1518 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1524 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1519 SLOT( beamMySelf() ), actionCollection(), 1525 SLOT( beamMySelf() ), actionCollection(),
1520 "kaddressbook_beam_myself" ); 1526 "kaddressbook_beam_myself" );
1521 } 1527 }
1522#endif 1528#endif
1523 1529
1524 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1530 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1525 this, SLOT( editContact2() ), 1531 this, SLOT( editContact2() ),
1526 actionCollection(), "file_properties" ); 1532 actionCollection(), "file_properties" );
1527 1533
1528#ifdef KAB_EMBEDDED 1534#ifdef KAB_EMBEDDED
1529 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1535 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1530 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1536 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1531 mMainWindow, SLOT( exit() ), 1537 mMainWindow, SLOT( exit() ),
1532 actionCollection(), "quit" ); 1538 actionCollection(), "quit" );
1533#endif //KAB_EMBEDDED 1539#endif //KAB_EMBEDDED
1534 1540
1535 // edit menu 1541 // edit menu
1536 if ( mIsPart ) { 1542 if ( mIsPart ) {
1537 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1543 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1538 SLOT( copyContacts() ), actionCollection(), 1544 SLOT( copyContacts() ), actionCollection(),
1539 "kaddressbook_copy" ); 1545 "kaddressbook_copy" );
1540 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1546 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1541 SLOT( cutContacts() ), actionCollection(), 1547 SLOT( cutContacts() ), actionCollection(),
1542 "kaddressbook_cut" ); 1548 "kaddressbook_cut" );
1543 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1549 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1544 SLOT( pasteContacts() ), actionCollection(), 1550 SLOT( pasteContacts() ), actionCollection(),
1545 "kaddressbook_paste" ); 1551 "kaddressbook_paste" );
1546 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1552 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1547 SLOT( selectAllContacts() ), actionCollection(), 1553 SLOT( selectAllContacts() ), actionCollection(),
1548 "kaddressbook_select_all" ); 1554 "kaddressbook_select_all" );
1549 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1555 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1550 SLOT( undo() ), actionCollection(), 1556 SLOT( undo() ), actionCollection(),
1551 "kaddressbook_undo" ); 1557 "kaddressbook_undo" );
1552 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1558 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1553 this, SLOT( redo() ), actionCollection(), 1559 this, SLOT( redo() ), actionCollection(),
1554 "kaddressbook_redo" ); 1560 "kaddressbook_redo" );
1555 } else { 1561 } else {
1556 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1562 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1557 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1563 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1558 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1564 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1559 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1565 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1560 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1566 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1561 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1567 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1562 } 1568 }
1563 1569
1564 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1570 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1565 Key_Delete, this, SLOT( deleteContacts() ), 1571 Key_Delete, this, SLOT( deleteContacts() ),
1566 actionCollection(), "edit_delete" ); 1572 actionCollection(), "edit_delete" );
1567 1573
1568 mActionUndo->setEnabled( false ); 1574 mActionUndo->setEnabled( false );
1569 mActionRedo->setEnabled( false ); 1575 mActionRedo->setEnabled( false );
1570 1576
1571 // settings menu 1577 // settings menu
1572#ifdef KAB_EMBEDDED 1578#ifdef KAB_EMBEDDED
1573//US special menuentry to configure the addressbook resources. On KDE 1579//US special menuentry to configure the addressbook resources. On KDE
1574// you do that through the control center !!! 1580// you do that through the control center !!!
1575 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1581 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1576 SLOT( configureResources() ), actionCollection(), 1582 SLOT( configureResources() ), actionCollection(),
1577 "kaddressbook_configure_resources" ); 1583 "kaddressbook_configure_resources" );
1578#endif //KAB_EMBEDDED 1584#endif //KAB_EMBEDDED
1579 1585
1580 if ( mIsPart ) { 1586 if ( mIsPart ) {
1581 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1587 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1582 SLOT( openConfigDialog() ), actionCollection(), 1588 SLOT( openConfigDialog() ), actionCollection(),
1583 "kaddressbook_configure" ); 1589 "kaddressbook_configure" );
1584 1590
1585 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1591 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1586 this, SLOT( configureKeyBindings() ), actionCollection(), 1592 this, SLOT( configureKeyBindings() ), actionCollection(),
1587 "kaddressbook_configure_shortcuts" ); 1593 "kaddressbook_configure_shortcuts" );
1588#ifdef KAB_EMBEDDED 1594#ifdef KAB_EMBEDDED
1589 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1595 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1590 mActionConfigureToolbars->setEnabled( false ); 1596 mActionConfigureToolbars->setEnabled( false );
1591#endif //KAB_EMBEDDED 1597#endif //KAB_EMBEDDED
1592 1598
1593 } else { 1599 } else {
1594 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1600 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1595 1601
1596 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1602 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1597 } 1603 }
1598 1604
1599 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1605 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1600 actionCollection(), "options_show_jump_bar" ); 1606 actionCollection(), "options_show_jump_bar" );
1601 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1607 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1602 1608
1603 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, 1609 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0,
1604 actionCollection(), "options_show_details" ); 1610 actionCollection(), "options_show_details" );
1605 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1611 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1606 1612
1607 // misc 1613 // misc
1608 // only enable LDAP lookup if we can handle the protocol 1614 // only enable LDAP lookup if we can handle the protocol
1609#ifndef KAB_EMBEDDED 1615#ifndef KAB_EMBEDDED
1610 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1616 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1611 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1617 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1612 this, SLOT( openLDAPDialog() ), actionCollection(), 1618 this, SLOT( openLDAPDialog() ), actionCollection(),
1613 "ldap_lookup" ); 1619 "ldap_lookup" );
1614 } 1620 }
1615#else //KAB_EMBEDDED 1621#else //KAB_EMBEDDED
1616 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1622 //qDebug("KABCore::initActions() LDAP has to be implemented");
1617#endif //KAB_EMBEDDED 1623#endif //KAB_EMBEDDED
1618 1624
1619 1625
1620 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1626 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1621 SLOT( setWhoAmI() ), actionCollection(), 1627 SLOT( setWhoAmI() ), actionCollection(),
1622 "set_personal" ); 1628 "set_personal" );
1623 1629
1624 1630
1625 1631
1626 1632
1627 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1633 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1628 SLOT( setCategories() ), actionCollection(), 1634 SLOT( setCategories() ), actionCollection(),
1629 "edit_set_categories" ); 1635 "edit_set_categories" );
1630 1636
1631 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1637 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1632 SLOT( removeVoice() ), actionCollection(), 1638 SLOT( removeVoice() ), actionCollection(),
1633 "remove_voice" ); 1639 "remove_voice" );
1634 mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, 1640 mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this,
1635 SLOT( importFromOL() ), actionCollection(), 1641 SLOT( importFromOL() ), actionCollection(),
1636 "import_OL" ); 1642 "import_OL" );
1637#ifdef KAB_EMBEDDED 1643#ifdef KAB_EMBEDDED
1638 mActionLicence = new KAction( i18n( "Licence" ), "licence", 0, 1644 mActionLicence = new KAction( i18n( "Licence" ), "licence", 0,
1639 this, SLOT( showLicence() ), actionCollection(), 1645 this, SLOT( showLicence() ), actionCollection(),
1640 "licence_about_data" ); 1646 "licence_about_data" );
1641 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1647 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1642 this, SLOT( createAboutData() ), actionCollection(), 1648 this, SLOT( createAboutData() ), actionCollection(),
1643 "kaddressbook_about_data" ); 1649 "kaddressbook_about_data" );
1644#endif //KAB_EMBEDDED 1650#endif //KAB_EMBEDDED
1645 1651
1646 clipboardDataChanged(); 1652 clipboardDataChanged();
1647 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1653 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1648 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1654 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1649} 1655}
1650 1656
1651//US we need this function, to plug all actions into the correct menues. 1657//US we need this function, to plug all actions into the correct menues.
1652// KDE uses a XML format to plug the actions, but we work her without this overhead. 1658// KDE uses a XML format to plug the actions, but we work her without this overhead.
1653void KABCore::addActionsManually() 1659void KABCore::addActionsManually()
1654{ 1660{
1655//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1661//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1656 1662
1657#ifdef KAB_EMBEDDED 1663#ifdef KAB_EMBEDDED
1658 QPopupMenu *fileMenu = new QPopupMenu( this ); 1664 QPopupMenu *fileMenu = new QPopupMenu( this );
1659 QPopupMenu *editMenu = new QPopupMenu( this ); 1665 QPopupMenu *editMenu = new QPopupMenu( this );
1660 QPopupMenu *helpMenu = new QPopupMenu( this ); 1666 QPopupMenu *helpMenu = new QPopupMenu( this );
1661 1667
1662 KToolBar* tb = mMainWindow->toolBar(); 1668 KToolBar* tb = mMainWindow->toolBar();
1663 1669
1664#ifdef DESKTOP_VERSION 1670#ifdef DESKTOP_VERSION
1665 QMenuBar* mb = mMainWindow->menuBar(); 1671 QMenuBar* mb = mMainWindow->menuBar();
1666 1672
1667 //US setup menubar. 1673 //US setup menubar.
1668 //Disable the following block if you do not want to have a menubar. 1674 //Disable the following block if you do not want to have a menubar.
1669 mb->insertItem( "&File", fileMenu ); 1675 mb->insertItem( "&File", fileMenu );
1670 mb->insertItem( "&Edit", editMenu ); 1676 mb->insertItem( "&Edit", editMenu );
1671 mb->insertItem( "&View", viewMenu ); 1677 mb->insertItem( "&View", viewMenu );
1672 mb->insertItem( "&Settings", settingsMenu ); 1678 mb->insertItem( "&Settings", settingsMenu );
1673 mb->insertItem( "&Change selected", changeMenu ); 1679 mb->insertItem( "&Change selected", changeMenu );
1674 mb->insertItem( "&Help", helpMenu ); 1680 mb->insertItem( "&Help", helpMenu );
1675 mIncSearchWidget = new IncSearchWidget( tb ); 1681 mIncSearchWidget = new IncSearchWidget( tb );
1676 // tb->insertWidget(-1, 0, mIncSearchWidget); 1682 // tb->insertWidget(-1, 0, mIncSearchWidget);
1677 1683
1678#else 1684#else
1679 //US setup toolbar 1685 //US setup toolbar
1680 QMenuBar *menuBarTB = new QMenuBar( tb ); 1686 QMenuBar *menuBarTB = new QMenuBar( tb );
1681 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1687 QPopupMenu *popupBarTB = new QPopupMenu( this );
1682 menuBarTB->insertItem( "ME", popupBarTB); 1688 menuBarTB->insertItem( "ME", popupBarTB);
1683 tb->insertWidget(-1, 0, menuBarTB); 1689 tb->insertWidget(-1, 0, menuBarTB);
1684 mIncSearchWidget = new IncSearchWidget( tb ); 1690 mIncSearchWidget = new IncSearchWidget( tb );
1685 1691
1686 tb->enableMoving(false); 1692 tb->enableMoving(false);
1687 popupBarTB->insertItem( "&File", fileMenu ); 1693 popupBarTB->insertItem( "&File", fileMenu );
1688 popupBarTB->insertItem( "&Edit", editMenu ); 1694 popupBarTB->insertItem( "&Edit", editMenu );
1689 popupBarTB->insertItem( "&View", viewMenu ); 1695 popupBarTB->insertItem( "&View", viewMenu );
1690 popupBarTB->insertItem( "&Settings", settingsMenu ); 1696 popupBarTB->insertItem( "&Settings", settingsMenu );
1691 mViewManager->getFilterAction()->plug ( popupBarTB); 1697 mViewManager->getFilterAction()->plug ( popupBarTB);
1692 popupBarTB->insertItem( "&Change selected", changeMenu ); 1698 popupBarTB->insertItem( "&Change selected", changeMenu );
1693 popupBarTB->insertItem( "&Help", helpMenu ); 1699 popupBarTB->insertItem( "&Help", helpMenu );
1694 if (QApplication::desktop()->width() > 320 ) { 1700 if (QApplication::desktop()->width() > 320 ) {
1695 // mViewManager->getFilterAction()->plug ( tb); 1701 // mViewManager->getFilterAction()->plug ( tb);
1696 } 1702 }
1697#endif 1703#endif
1698 // mActionQuit->plug ( mMainWindow->toolBar()); 1704 // mActionQuit->plug ( mMainWindow->toolBar());
1699 1705
1700 1706
1701 1707
1702 //US Now connect the actions with the menue entries. 1708 //US Now connect the actions with the menue entries.
1703 mActionPrint->plug( fileMenu ); 1709 mActionPrint->plug( fileMenu );
1704 mActionMail->plug( fileMenu ); 1710 mActionMail->plug( fileMenu );
1705 fileMenu->insertSeparator(); 1711 fileMenu->insertSeparator();
1706 1712
1707 mActionNewContact->plug( fileMenu ); 1713 mActionNewContact->plug( fileMenu );
1708 mActionNewContact->plug( tb ); 1714 mActionNewContact->plug( tb );
1709 1715
1710 mActionEditAddressee->plug( fileMenu ); 1716 mActionEditAddressee->plug( fileMenu );
1711 fileMenu->insertSeparator(); 1717 fileMenu->insertSeparator();
1712 mActionSave->plug( fileMenu ); 1718 mActionSave->plug( fileMenu );
1713 fileMenu->insertItem( "&Import", ImportMenu ); 1719 fileMenu->insertItem( "&Import", ImportMenu );
1714 fileMenu->insertItem( "&Emport", ExportMenu ); 1720 fileMenu->insertItem( "&Emport", ExportMenu );
1715 fileMenu->insertSeparator(); 1721 fileMenu->insertSeparator();
1716 mActionMailVCard->plug( fileMenu ); 1722 mActionMailVCard->plug( fileMenu );
1717#ifndef DESKTOP_VERSION 1723#ifndef DESKTOP_VERSION
1718 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 1724 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1719 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 1725 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1720#endif 1726#endif
1721 fileMenu->insertSeparator(); 1727 fileMenu->insertSeparator();
1722 mActionQuit->plug( fileMenu ); 1728 mActionQuit->plug( fileMenu );
1723#ifdef _WIN32_ 1729#ifdef _WIN32_
1724 mActionImportOL->plug( ImportMenu ); 1730 mActionImportOL->plug( ImportMenu );
1725#endif 1731#endif
1726 // edit menu 1732 // edit menu
1727 mActionUndo->plug( editMenu ); 1733 mActionUndo->plug( editMenu );
1728 mActionRedo->plug( editMenu ); 1734 mActionRedo->plug( editMenu );
1729 editMenu->insertSeparator(); 1735 editMenu->insertSeparator();
1730 mActionCut->plug( editMenu ); 1736 mActionCut->plug( editMenu );
1731 mActionCopy->plug( editMenu ); 1737 mActionCopy->plug( editMenu );
1732 mActionPaste->plug( editMenu ); 1738 mActionPaste->plug( editMenu );
1733 mActionDelete->plug( editMenu ); 1739 mActionDelete->plug( editMenu );
1734 editMenu->insertSeparator(); 1740 editMenu->insertSeparator();
1735 mActionSelectAll->plug( editMenu ); 1741 mActionSelectAll->plug( editMenu );
1736 1742
1737 mActionRemoveVoice->plug( changeMenu ); 1743 mActionRemoveVoice->plug( changeMenu );
1738 // settings menu 1744 // settings menu
1739//US special menuentry to configure the addressbook resources. On KDE 1745//US special menuentry to configure the addressbook resources. On KDE
1740// you do that through the control center !!! 1746// you do that through the control center !!!
1741 mActionConfigResources->plug( settingsMenu ); 1747 mActionConfigResources->plug( settingsMenu );
1742 settingsMenu->insertSeparator(); 1748 settingsMenu->insertSeparator();
1743 1749
1744 mActionConfigKAddressbook->plug( settingsMenu ); 1750 mActionConfigKAddressbook->plug( settingsMenu );
1745 1751
1746 if ( mIsPart ) { 1752 if ( mIsPart ) {
1747 mActionConfigShortcuts->plug( settingsMenu ); 1753 mActionConfigShortcuts->plug( settingsMenu );
1748 mActionConfigureToolbars->plug( settingsMenu ); 1754 mActionConfigureToolbars->plug( settingsMenu );
1749 1755
1750 } else { 1756 } else {
1751 mActionKeyBindings->plug( settingsMenu ); 1757 mActionKeyBindings->plug( settingsMenu );
1752 } 1758 }
1753 1759
1754 settingsMenu->insertSeparator(); 1760 settingsMenu->insertSeparator();
1755 1761
1756 mActionJumpBar->plug( settingsMenu ); 1762 mActionJumpBar->plug( settingsMenu );
1757 mActionDetails->plug( settingsMenu ); 1763 mActionDetails->plug( settingsMenu );
1758 settingsMenu->insertSeparator(); 1764 settingsMenu->insertSeparator();
1759 1765
1760 mActionWhoAmI->plug( settingsMenu ); 1766 mActionWhoAmI->plug( settingsMenu );
1761 mActionCategories->plug( settingsMenu ); 1767 mActionCategories->plug( settingsMenu );
1762 1768
1763 mActionAboutKAddressbook->plug( helpMenu ); 1769 mActionAboutKAddressbook->plug( helpMenu );
1764 mActionLicence->plug( helpMenu ); 1770 mActionLicence->plug( helpMenu );
1765 1771
1766 if (QApplication::desktop()->width() > 320 ) { 1772 if (QApplication::desktop()->width() > 320 ) {
1767 1773
1768 mActionEditAddressee->plug( tb ); 1774 mActionEditAddressee->plug( tb );
1769 mActionSave->plug( tb ); 1775 mActionSave->plug( tb );
1770 mViewManager->getFilterAction()->plug ( tb); 1776 mViewManager->getFilterAction()->plug ( tb);
1771 if (QApplication::desktop()->width() > 480 ) { 1777 if (QApplication::desktop()->width() > 480 ) {
1772 mActionUndo->plug( tb ); 1778 mActionUndo->plug( tb );
1773 mActionDelete->plug( tb ); 1779 mActionDelete->plug( tb );
1774 mActionRedo->plug( tb ); 1780 mActionRedo->plug( tb );
1775 } 1781 }
1776 } 1782 }
1777 //mActionQuit->plug ( tb ); 1783 //mActionQuit->plug ( tb );
1778 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1784 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1779 1785
1780 //US link the searchwidget first to this. 1786 //US link the searchwidget first to this.
1781 // The real linkage to the toolbar happens later. 1787 // The real linkage to the toolbar happens later.
1782//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1788//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1783//US tb->insertItem( mIncSearchWidget ); 1789//US tb->insertItem( mIncSearchWidget );
1784/*US 1790/*US
1785 mIncSearchWidget = new IncSearchWidget( tb ); 1791 mIncSearchWidget = new IncSearchWidget( tb );
1786 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1792 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1787 SLOT( incrementalSearch( const QString& ) ) ); 1793 SLOT( incrementalSearch( const QString& ) ) );
1788 1794
1789 mJumpButtonBar = new JumpButtonBar( this, this ); 1795 mJumpButtonBar = new JumpButtonBar( this, this );
1790 1796
1791//US topLayout->addWidget( mJumpButtonBar ); 1797//US topLayout->addWidget( mJumpButtonBar );
1792 this->layout()->add( mJumpButtonBar ); 1798 this->layout()->add( mJumpButtonBar );
1793*/ 1799*/
1794 1800
1795#endif //KAB_EMBEDDED 1801#endif //KAB_EMBEDDED
1796} 1802}
1797void KABCore::showLicence() 1803void KABCore::showLicence()
1798{ 1804{
1799 KApplication::showLicence(); 1805 KApplication::showLicence();
1800} 1806}
1801void KABCore::removeVoice() 1807void KABCore::removeVoice()
1802{ 1808{
1803 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 1809 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
1804 return; 1810 return;
1805 KABC::Addressee::List list = mViewManager->selectedAddressees(); 1811 KABC::Addressee::List list = mViewManager->selectedAddressees();
1806 KABC::Addressee::List::Iterator it; 1812 KABC::Addressee::List::Iterator it;
1807 for ( it = list.begin(); it != list.end(); ++it ) { 1813 for ( it = list.begin(); it != list.end(); ++it ) {
1808 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 1814 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
1809 PhoneNumber::List::Iterator phoneIt; 1815 PhoneNumber::List::Iterator phoneIt;
1810 bool found = false; 1816 bool found = false;
1811 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { 1817 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
1812 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 1818 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
1813 if ((*phoneIt).type() - PhoneNumber::Voice ) { 1819 if ((*phoneIt).type() - PhoneNumber::Voice ) {
1814 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 1820 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
1815 (*it).insertPhoneNumber( (*phoneIt) ); 1821 (*it).insertPhoneNumber( (*phoneIt) );
1816 found = true; 1822 found = true;
1817 } 1823 }
1818 } 1824 }
1819 1825
1820 } 1826 }
1821 if ( found ) 1827 if ( found )
1822 contactModified((*it) ); 1828 contactModified((*it) );
1823 } 1829 }
1824} 1830}
1825 1831
1826 1832
1827 1833
1828void KABCore::clipboardDataChanged() 1834void KABCore::clipboardDataChanged()
1829{ 1835{
1830 1836
1831 if ( mReadWrite ) 1837 if ( mReadWrite )
1832 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 1838 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
1833 1839
1834} 1840}
1835 1841
1836void KABCore::updateActionMenu() 1842void KABCore::updateActionMenu()
1837{ 1843{
1838 UndoStack *undo = UndoStack::instance(); 1844 UndoStack *undo = UndoStack::instance();
1839 RedoStack *redo = RedoStack::instance(); 1845 RedoStack *redo = RedoStack::instance();
1840 1846
1841 if ( undo->isEmpty() ) 1847 if ( undo->isEmpty() )
1842 mActionUndo->setText( i18n( "Undo" ) ); 1848 mActionUndo->setText( i18n( "Undo" ) );
1843 else 1849 else
1844 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 1850 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
1845 1851
1846 mActionUndo->setEnabled( !undo->isEmpty() ); 1852 mActionUndo->setEnabled( !undo->isEmpty() );
1847 1853
1848 if ( !redo->top() ) 1854 if ( !redo->top() )
1849 mActionRedo->setText( i18n( "Redo" ) ); 1855 mActionRedo->setText( i18n( "Redo" ) );
1850 else 1856 else
1851 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 1857 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
1852 1858
1853 mActionRedo->setEnabled( !redo->isEmpty() ); 1859 mActionRedo->setEnabled( !redo->isEmpty() );
1854} 1860}
1855 1861
1856void KABCore::configureKeyBindings() 1862void KABCore::configureKeyBindings()
1857{ 1863{
1858#ifndef KAB_EMBEDDED 1864#ifndef KAB_EMBEDDED
1859 KKeyDialog::configure( actionCollection(), true ); 1865 KKeyDialog::configure( actionCollection(), true );
1860#else //KAB_EMBEDDED 1866#else //KAB_EMBEDDED
1861 qDebug("KABCore::configureKeyBindings() not implemented"); 1867 qDebug("KABCore::configureKeyBindings() not implemented");
1862#endif //KAB_EMBEDDED 1868#endif //KAB_EMBEDDED
1863} 1869}
1864 1870
1865#ifdef KAB_EMBEDDED 1871#ifdef KAB_EMBEDDED
1866void KABCore::configureResources() 1872void KABCore::configureResources()
1867{ 1873{
1868 KRES::KCMKResources dlg( this, "" , 0 ); 1874 KRES::KCMKResources dlg( this, "" , 0 );
1869 1875
1870 if ( !dlg.exec() ) 1876 if ( !dlg.exec() )
1871 return; 1877 return;
1872 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 1878 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
1873} 1879}
1874#endif //KAB_EMBEDDED 1880#endif //KAB_EMBEDDED
1875 1881
1876 1882
1877 1883
1878#ifndef KAB_EMBEDDED 1884#ifndef KAB_EMBEDDED
1879#include "kabcore.moc" 1885#include "kabcore.moc"
1880#endif //KAB_EMBEDDED 1886#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index 8bd4b15..0c192dd 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -1,130 +1,128 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
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//US#ifdef KAB_EMBEDDED 24//US#ifdef KAB_EMBEDDED
25//#include <qstring.h> 25//#include <qstring.h>
26//#endif //KAB_EMBEDDED 26//#endif //KAB_EMBEDDED
27 27
28 28
29#include <kconfig.h> 29#include <kconfig.h>
30#include <klocale.h> 30#include <klocale.h>
31#include <kstaticdeleter.h> 31#include <kstaticdeleter.h>
32//US#include <kdebug.h> // defines kdDebug() 32//US#include <kdebug.h> // defines kdDebug()
33 33
34#include "kabprefs.h" 34#include "kabprefs.h"
35 35
36KABPrefs *KABPrefs::sInstance = 0; 36KABPrefs *KABPrefs::sInstance = 0;
37static KStaticDeleter<KABPrefs> staticDeleter; 37static KStaticDeleter<KABPrefs> staticDeleter;
38 38
39KABPrefs::KABPrefs() 39KABPrefs::KABPrefs()
40 : KPimPrefs("kaddressbookrc") 40 : KPimPrefs("kaddressbookrc")
41{ 41{
42 KPrefs::setCurrentGroup( "Views" ); 42 KPrefs::setCurrentGroup( "Views" );
43 addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); 43 addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
44 44
45 KPrefs::setCurrentGroup( "General" ); 45 KPrefs::setCurrentGroup( "General" );
46 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); 46 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true );
47 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); 47 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 );
48 48
49#ifdef KAB_EMBEDDED 49#ifdef KAB_EMBEDDED
50 addItemBool("AskForQuit",&mAskForQuit,false); 50 addItemBool("AskForQuit",&mAskForQuit,false);
51 addItemBool("ToolBarHor",&mToolBarHor, true ); 51 addItemBool("ToolBarHor",&mToolBarHor, true );
52 addItemBool("ToolBarUp",&mToolBarUp, false ); 52 addItemBool("ToolBarUp",&mToolBarUp, false );
53 addItemInt( "EmailChannelType", &mEmailClient, OMPI );
54 addItemString( "EmailChannelOther", &mEmailChannel, "" );
55 53
56#endif //KAB_EMBEDDED 54#endif //KAB_EMBEDDED
57 55
58 KPrefs::setCurrentGroup( "MainWindow" ); 56 KPrefs::setCurrentGroup( "MainWindow" );
59 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); 57 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false );
60 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); 58 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true );
61 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); 59 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter );
62 addItemIntList( "DetailsSplitter", &mDetailsSplitter ); 60 addItemIntList( "DetailsSplitter", &mDetailsSplitter );
63 61
64 KPrefs::setCurrentGroup( "Extensions_General" ); 62 KPrefs::setCurrentGroup( "Extensions_General" );
65 QStringList defaultExtensions; 63 QStringList defaultExtensions;
66 defaultExtensions << "merge"; 64 defaultExtensions << "merge";
67 defaultExtensions << "distribution_list_editor"; 65 defaultExtensions << "distribution_list_editor";
68 addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); 66 addItemInt( "CurrentExtension", &mCurrentExtension, 0 );
69 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); 67 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions );
70 68
71 KPrefs::setCurrentGroup( "Views" ); 69 KPrefs::setCurrentGroup( "Views" );
72 QString defaultView = i18n( "Default Table View" ); 70 QString defaultView = i18n( "Default Table View" );
73 addItemString( "CurrentView", &mCurrentView, defaultView ); 71 addItemString( "CurrentView", &mCurrentView, defaultView );
74 addItemStringList( "ViewNames", &mViewNames, defaultView ); 72 addItemStringList( "ViewNames", &mViewNames, defaultView );
75 73
76 KPrefs::setCurrentGroup( "Filters" ); 74 KPrefs::setCurrentGroup( "Filters" );
77 addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); 75 addItemInt( "CurrentFilter", &mCurrentFilter, 0 );
78 76
79} 77}
80 78
81KABPrefs::~KABPrefs() 79KABPrefs::~KABPrefs()
82{ 80{
83} 81}
84 82
85KABPrefs *KABPrefs::instance() 83KABPrefs *KABPrefs::instance()
86{ 84{
87 if ( !sInstance ) { 85 if ( !sInstance ) {
88#ifdef KAB_EMBEDDED 86#ifdef KAB_EMBEDDED
89 sInstance = staticDeleter.setObject( new KABPrefs() ); 87 sInstance = staticDeleter.setObject( new KABPrefs() );
90#else //KAB_EMBEDDED 88#else //KAB_EMBEDDED
91 //US the following line has changed ???. Why 89 //US the following line has changed ???. Why
92 staticDeleter.setObject( sInstance, new KABPrefs() ); 90 staticDeleter.setObject( sInstance, new KABPrefs() );
93#endif //KAB_EMBEDDED 91#endif //KAB_EMBEDDED
94 sInstance->readConfig(); 92 sInstance->readConfig();
95 } 93 }
96 94
97 return sInstance; 95 return sInstance;
98} 96}
99 97
100void KABPrefs::setCategoryDefaults() 98void KABPrefs::setCategoryDefaults()
101{ 99{
102 mCustomCategories.clear(); 100 mCustomCategories.clear();
103 101
104 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) 102 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
105 << i18n( "Customer" ) << i18n( "Friend" ); 103 << i18n( "Customer" ) << i18n( "Friend" );
106} 104}
107 105
108 // US introduce a nonconst way to return the config object. 106 // US introduce a nonconst way to return the config object.
109KConfig* KABPrefs::getConfig() 107KConfig* KABPrefs::getConfig()
110{ 108{
111 return config(); 109 return config();
112} 110}
113 111
114 112
115/*US 113/*US
116void KABPrefs::usrSetDefaults() 114void KABPrefs::usrSetDefaults()
117{ 115{
118 KPimPrefs::usrSetDefaults(); 116 KPimPrefs::usrSetDefaults();
119} 117}
120 118
121void KABPrefs::usrReadConfig() 119void KABPrefs::usrReadConfig()
122{ 120{
123 KPimPrefs::usrReadConfig(); 121 KPimPrefs::usrReadConfig();
124} 122}
125 123
126void KABPrefs::usrWriteConfig() 124void KABPrefs::usrWriteConfig()
127{ 125{
128 KPimPrefs::usrWriteConfig(); 126 KPimPrefs::usrWriteConfig();
129} 127}
130*/ 128*/
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h
index c81a9a9..8f149ac 100644
--- a/kaddressbook/kabprefs.h
+++ b/kaddressbook/kabprefs.h
@@ -1,100 +1,90 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
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 KABPREFS_H 24#ifndef KABPREFS_H
25#define KABPREFS_H 25#define KABPREFS_H
26 26
27#include <qstringlist.h> 27#include <qstringlist.h>
28 28
29#include <libkdepim/kpimprefs.h> 29#include <libkdepim/kpimprefs.h>
30 30
31class KConfig; 31class KConfig;
32 32
33class KABPrefs : public KPimPrefs 33class KABPrefs : public KPimPrefs
34{ 34{
35 public: 35 public:
36 virtual ~KABPrefs(); 36 virtual ~KABPrefs();
37 37
38 static KABPrefs *instance(); 38 static KABPrefs *instance();
39 39
40 enum EMailClients {
41 OMPI = 0,
42 QTOPIA = 1,
43 OPIE = 2,
44 OTHER = 3
45 };
46
47
48 // General 40 // General
49 bool mHonorSingleClick; 41 bool mHonorSingleClick;
50 bool mAutomaticNameParsing; 42 bool mAutomaticNameParsing;
51 int mCurrentIncSearchField; 43 int mCurrentIncSearchField;
52 44
53#ifdef KAB_EMBEDDED 45#ifdef KAB_EMBEDDED
54 // US introduce a nonconst way to return the config object. 46 // US introduce a nonconst way to return the config object.
55 KConfig* getConfig(); 47 KConfig* getConfig();
56 48
57 bool mToolBarHor; 49 bool mToolBarHor;
58 bool mToolBarUp; 50 bool mToolBarUp;
59 bool mAskForQuit; 51 bool mAskForQuit;
60 52
61 int mEmailClient;
62 QString mEmailChannel;
63 53
64 /** Set preferences to default values */ 54 /** Set preferences to default values */
65// void usrSetDefaults(); 55// void usrSetDefaults();
66 56
67 /** Read preferences from config file */ 57 /** Read preferences from config file */
68// void usrReadConfig(); 58// void usrReadConfig();
69 59
70 /** Write preferences to config file */ 60 /** Write preferences to config file */
71// void usrWriteConfig(); 61// void usrWriteConfig();
72#endif //KAB_EMBEDDED 62#endif //KAB_EMBEDDED
73 63
74 64
75 // GUI 65 // GUI
76 bool mJumpButtonBarVisible; 66 bool mJumpButtonBarVisible;
77 bool mDetailsPageVisible; 67 bool mDetailsPageVisible;
78 QValueList<int> mExtensionsSplitter; 68 QValueList<int> mExtensionsSplitter;
79 QValueList<int> mDetailsSplitter; 69 QValueList<int> mDetailsSplitter;
80 70
81 // Extensions stuff 71 // Extensions stuff
82 int mCurrentExtension; 72 int mCurrentExtension;
83 QStringList mActiveExtensions; 73 QStringList mActiveExtensions;
84 74
85 // Views stuff 75 // Views stuff
86 QString mCurrentView; 76 QString mCurrentView;
87 QStringList mViewNames; 77 QStringList mViewNames;
88 78
89 // Filter 79 // Filter
90 int mCurrentFilter; 80 int mCurrentFilter;
91 81
92 void setCategoryDefaults(); 82 void setCategoryDefaults();
93 83
94 private: 84 private:
95 KABPrefs(); 85 KABPrefs();
96 86
97 static KABPrefs *sInstance; 87 static KABPrefs *sInstance;
98}; 88};
99 89
100#endif 90#endif
diff --git a/kaddressbook/kaddressbook.pro b/kaddressbook/kaddressbook.pro
index 0da5842..b57317f 100644
--- a/kaddressbook/kaddressbook.pro
+++ b/kaddressbook/kaddressbook.pro
@@ -1,183 +1,183 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on 2 CONFIG = qt warn_on
3 TARGET = kapi 3 TARGET = kapi
4DESTDIR= ../bin 4DESTDIR= ../bin
5 5
6include( ../variables.pri ) 6include( ../variables.pri )
7 7
8 8
9INCLUDEPATH += . ./details ./features ./kcmconfigs ./xxport ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../ interfaces 9INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../ interfaces
10DEFINES += KAB_EMBEDDED KAB_NOSPLITTER DESKTOP_VERSION 10DEFINES += KAB_EMBEDDED KAB_NOSPLITTER DESKTOP_VERSION
11 11
12unix : { 12unix : {
13LIBS += ../bin/libmicrokdepim.so 13LIBS += ../bin/libmicrokdepim.so
14LIBS += ../bin/libmicrokde.so 14LIBS += ../bin/libmicrokde.so
15LIBS += ../bin/libmicrokabc.so 15LIBS += ../bin/libmicrokabc.so
16LIBS += ../bin/libmicrokcal.so 16LIBS += ../bin/libmicrokcal.so
17LIBS += -lldap 17LIBS += -lldap
18OBJECTS_DIR = obj/unix 18OBJECTS_DIR = obj/unix
19MOC_DIR = moc/unix 19MOC_DIR = moc/unix
20} 20}
21win32: { 21win32: {
22DEFINES += _WIN32_ 22DEFINES += _WIN32_
23LIBS += ../bin/microkdepim.lib 23LIBS += ../bin/microkdepim.lib
24LIBS += ../bin/microkcal.lib 24LIBS += ../bin/microkcal.lib
25LIBS += ../bin/microkde.lib 25LIBS += ../bin/microkde.lib
26LIBS += ../bin/microkabc.lib 26LIBS += ../bin/microkabc.lib
27QMAKE_LINK += /NODEFAULTLIB:LIBC 27QMAKE_LINK += /NODEFAULTLIB:LIBC
28OBJECTS_DIR = obj/win 28OBJECTS_DIR = obj/win
29MOC_DIR = moc/win 29MOC_DIR = moc/win
30LIBS += mfc71u.lib 30LIBS += mfc71u.lib
31} 31}
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40INTERFACES = \ 40INTERFACES = \
41# filteredit_base.ui \ 41# filteredit_base.ui \
42# kofilterview_base.ui \ 42# kofilterview_base.ui \
43 43
44HEADERS = \ 44HEADERS = \
45features/mergewidget.h \ 45features/mergewidget.h \
46features/distributionlistwidget.h \ 46features/distributionlistwidget.h \
47kcmconfigs/addresseewidget.h \ 47kcmconfigs/addresseewidget.h \
48kcmconfigs/extensionconfigdialog.h \ 48kcmconfigs/extensionconfigdialog.h \
49kcmconfigs/kcmkabconfig.h \ 49kcmconfigs/kcmkabconfig.h \
50kcmconfigs/kabconfigwidget.h \ 50kcmconfigs/kabconfigwidget.h \
51addresseeeditordialog.h \ 51addresseeeditordialog.h \
52addresseeeditorwidget.h \ 52addresseeeditorwidget.h \
53addresseditwidget.h \ 53addresseditwidget.h \
54addresseeconfig.h \ 54addresseeconfig.h \
55addresseeutil.h \ 55addresseeutil.h \
56emaileditwidget.h \ 56emaileditwidget.h \
57filtereditdialog.h \ 57filtereditdialog.h \
58kaddressbookmain.h \ 58kaddressbookmain.h \
59kabprefs.h \ 59kabprefs.h \
60kabcore.h \ 60kabcore.h \
61viewmanager.h \ 61viewmanager.h \
62extensionmanager.h \ 62extensionmanager.h \
63extensionwidget.h \ 63extensionwidget.h \
64kaddressbookview.h \ 64kaddressbookview.h \
65geowidget.h \ 65geowidget.h \
66imagewidget.h \ 66imagewidget.h \
67incsearchwidget.h \ 67incsearchwidget.h \
68jumpbuttonbar.h \ 68jumpbuttonbar.h \
69phoneeditwidget.h \ 69phoneeditwidget.h \
70secrecywidget.h \ 70secrecywidget.h \
71keywidget.h \ 71keywidget.h \
72nameeditdialog.h \ 72nameeditdialog.h \
73filter.h \ 73filter.h \
74addviewdialog.h \ 74addviewdialog.h \
75configurewidget.h \ 75configurewidget.h \
76viewconfigurewidget.h \ 76viewconfigurewidget.h \
77viewconfigurefieldspage.h \ 77viewconfigurefieldspage.h \
78viewconfigurefilterpage.h \ 78viewconfigurefilterpage.h \
79typecombo.h \ 79typecombo.h \
80undo.h \ 80undo.h \
81undocmds.h \ 81undocmds.h \
82xxportmanager.h \ 82xxportmanager.h \
83xxportobject.h \ 83xxportobject.h \
84xxportselectdialog.h \ 84xxportselectdialog.h \
85details/detailsviewcontainer.h \ 85details/detailsviewcontainer.h \
86details/look_basic.h \ 86details/look_basic.h \
87details/look_html.h \ 87details/look_html.h \
88views/kaddressbookiconview.h \ 88views/kaddressbookiconview.h \
89views/kaddressbooktableview.h \ 89views/kaddressbooktableview.h \
90views/kaddressbookcardview.h \ 90views/kaddressbookcardview.h \
91views/configuretableviewdialog.h \ 91views/configuretableviewdialog.h \
92views/configurecardviewdialog.h \ 92views/configurecardviewdialog.h \
93views/cardview.h \ 93views/cardview.h \
94views/colorlistbox.h \ 94views/colorlistbox.h \
95views/contactlistview.h \ 95views/contactlistview.h \
96xxport/vcard_xxport.h \ 96xxport/vcard_xxport.h \
97xxport/kde2_xxport.h \ 97xxport/kde2_xxport.h \
98xxport/csv_xxport.h \ 98xxport/csv_xxport.h \
99xxport/csvimportdialog.h \ 99xxport/csvimportdialog.h \
100xxport/opie_xxport.h \ 100xxport/opie_xxport.h \
101xxport/qtopia_xxport.h \ 101xxport/qtopia_xxport.h \
102xxport/sharpdtm_xxport.h \ 102xxport/sharpdtm_xxport.h \
103#details/look_details.h \ 103#details/look_details.h \
104#mainwindoiw.h \ 104#mainwindoiw.h \
105# alarmclient.h \ 105# alarmclient.h \
106# calendarview.h \ 106# calendarview.h \
107# customlistviewitem.h \ 107# customlistviewitem.h \
108# datenavigator.h 108# datenavigator.h
109 109
110SOURCES = \ 110SOURCES = \
111addresseeeditordialog.cpp \ 111addresseeeditordialog.cpp \
112addresseeeditorwidget.cpp \ 112addresseeeditorwidget.cpp \
113addresseditwidget.cpp \ 113addresseditwidget.cpp \
114addresseeconfig.cpp \ 114addresseeconfig.cpp \
115addresseeutil.cpp \ 115addresseeutil.cpp \
116extensionmanager.cpp \ 116extensionmanager.cpp \
117features/mergewidget.cpp \ 117features/mergewidget.cpp \
118features/distributionlistwidget.cpp \ 118features/distributionlistwidget.cpp \
119kcmconfigs/addresseewidget.cpp \ 119kcmconfigs/addresseewidget.cpp \
120kcmconfigs/extensionconfigdialog.cpp \ 120kcmconfigs/extensionconfigdialog.cpp \
121kcmconfigs/kcmkabconfig.cpp \ 121kcmconfigs/kcmkabconfig.cpp \
122kcmconfigs/kabconfigwidget.cpp \ 122kcmconfigs/kabconfigwidget.cpp \
123emaileditwidget.cpp \ 123emaileditwidget.cpp \
124filtereditdialog.cpp \ 124filtereditdialog.cpp \
125mainembedded.cpp \ 125mainembedded.cpp \
126kaddressbookmain.cpp \ 126kaddressbookmain.cpp \
127kabcore.cpp \ 127kabcore.cpp \
128kabprefs.cpp \ 128kabprefs.cpp \
129viewmanager.cpp \ 129viewmanager.cpp \
130kaddressbookview.cpp \ 130kaddressbookview.cpp \
131extensionwidget.cpp \ 131extensionwidget.cpp \
132geowidget.cpp \ 132geowidget.cpp \
133imagewidget.cpp \ 133imagewidget.cpp \
134incsearchwidget.cpp \ 134incsearchwidget.cpp \
135jumpbuttonbar.cpp \ 135jumpbuttonbar.cpp \
136phoneeditwidget.cpp \ 136phoneeditwidget.cpp \
137secrecywidget.cpp \ 137secrecywidget.cpp \
138keywidget.cpp \ 138keywidget.cpp \
139nameeditdialog.cpp \ 139nameeditdialog.cpp \
140filter.cpp \ 140filter.cpp \
141addviewdialog.cpp \ 141addviewdialog.cpp \
142configurewidget.cpp \ 142configurewidget.cpp \
143viewconfigurewidget.cpp \ 143viewconfigurewidget.cpp \
144viewconfigurefieldspage.cpp \ 144viewconfigurefieldspage.cpp \
145viewconfigurefilterpage.cpp \ 145viewconfigurefilterpage.cpp \
146undo.cpp \ 146undo.cpp \
147undocmds.cpp \ 147undocmds.cpp \
148xxportmanager.cpp \ 148xxportmanager.cpp \
149xxportobject.cpp \ 149xxportobject.cpp \
150xxportselectdialog.cpp \ 150xxportselectdialog.cpp \
151details/detailsviewcontainer.cpp \ 151details/detailsviewcontainer.cpp \
152details/look_basic.cpp \ 152details/look_basic.cpp \
153details/look_html.cpp \ 153details/look_html.cpp \
154views/kaddressbookiconview.cpp \ 154views/kaddressbookiconview.cpp \
155views/kaddressbooktableview.cpp \ 155views/kaddressbooktableview.cpp \
156views/kaddressbookcardview.cpp \ 156views/kaddressbookcardview.cpp \
157views/configuretableviewdialog.cpp \ 157views/configuretableviewdialog.cpp \
158views/configurecardviewdialog.cpp \ 158views/configurecardviewdialog.cpp \
159views/cardview.cpp \ 159views/cardview.cpp \
160views/contactlistview.cpp \ 160views/contactlistview.cpp \
161views/colorlistbox.cpp \ 161views/colorlistbox.cpp \
162xxport/vcard_xxport.cpp \ 162xxport/vcard_xxport.cpp \
163xxport/kde2_xxport.cpp \ 163xxport/kde2_xxport.cpp \
164xxport/csv_xxport.cpp \ 164xxport/csv_xxport.cpp \
165xxport/csvimportdialog.cpp \ 165xxport/csvimportdialog.cpp \
166xxport/opie_xxport.cpp \ 166xxport/opie_xxport.cpp \
167xxport/qtopia_xxport.cpp \ 167xxport/qtopia_xxport.cpp \
168xxport/sharpdtm_xxport.cpp \ 168xxport/sharpdtm_xxport.cpp \
169#details/look_details.cpp \ 169#details/look_details.cpp \
170#mainwindow.cpp \ 170#mainwindow.cpp \
171# calendarview.cpp \ 171# calendarview.cpp \
172# timespanview.cpp 172# timespanview.cpp
173 173
174 174
175 175
176win32: { 176win32: {
177HEADERS += ../outport/msoutl9.h \ 177HEADERS += ../outport/msoutl9.h \
178 kaimportoldialog.h 178 kaimportoldialog.h
179 179
180SOURCES += ../outport/msoutl9.cpp \ 180SOURCES += ../outport/msoutl9.cpp \
181 kaimportoldialog.cpp 181 kaimportoldialog.cpp
182} 182}
183 183
diff --git a/kaddressbook/kaddressbookE.pro b/kaddressbook/kaddressbookE.pro
index 95e6641..41f293d 100644
--- a/kaddressbook/kaddressbookE.pro
+++ b/kaddressbook/kaddressbookE.pro
@@ -1,163 +1,163 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3 3
4 4
5 TARGET = kapi 5 TARGET = kapi
6OBJECTS_DIR = obj/$(PLATFORM) 6OBJECTS_DIR = obj/$(PLATFORM)
7MOC_DIR = moc/$(PLATFORM) 7MOC_DIR = moc/$(PLATFORM)
8DESTDIR=$(QPEDIR)/bin 8DESTDIR=$(QPEDIR)/bin
9 9
10#LFLAGS += -Wl,-export-dynamic 10#LFLAGS += -Wl,-export-dynamic
11 11
12 12
13INCLUDEPATH += . ./details ./features ./kcmconfigs ./xxport ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include 13INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include
14DEFINES += KAB_EMBEDDED KAB_NOSPLITTER 14DEFINES += KAB_EMBEDDED KAB_NOSPLITTER
15#DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL 15#DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL
16#DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER 16#DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
17#DEFINES += KORG_NOLVALTERNATION 17#DEFINES += KORG_NOLVALTERNATION
18LIBS += -lmicrokdepim 18LIBS += -lmicrokdepim
19#LIBS += -lmicrokcal 19#LIBS += -lmicrokcal
20LIBS += -lmicrokde 20LIBS += -lmicrokde
21LIBS += -lmicrokcal 21LIBS += -lmicrokcal
22LIBS += -lmicroqtcompat 22LIBS += -lmicroqtcompat
23LIBS += -lmicrokabc 23LIBS += -lmicrokabc
24LIBS += -lqpe 24LIBS += -lqpe
25LIBS += -ljpeg 25LIBS += -ljpeg
26LIBS += $(QTOPIALIB) 26LIBS += $(QTOPIALIB)
27LIBS += -L$(QPEDIR)/lib 27LIBS += -L$(QPEDIR)/lib
28LIBS += -Wl,-export-dynamic 28LIBS += -Wl,-export-dynamic
29 29
30INTERFACES = \ 30INTERFACES = \
31# filteredit_base.ui \ 31# filteredit_base.ui \
32# kofilterview_base.ui \ 32# kofilterview_base.ui \
33 33
34HEADERS = \ 34HEADERS = \
35features/mergewidget.h \ 35features/mergewidget.h \
36features/distributionlistwidget.h \ 36features/distributionlistwidget.h \
37kcmconfigs/addresseewidget.h \ 37kcmconfigs/addresseewidget.h \
38kcmconfigs/extensionconfigdialog.h \ 38kcmconfigs/extensionconfigdialog.h \
39kcmconfigs/kcmkabconfig.h \ 39kcmconfigs/kcmkabconfig.h \
40kcmconfigs/kabconfigwidget.h \ 40kcmconfigs/kabconfigwidget.h \
41addresseeeditordialog.h \ 41addresseeeditordialog.h \
42addresseeeditorwidget.h \ 42addresseeeditorwidget.h \
43addresseditwidget.h \ 43addresseditwidget.h \
44addresseeconfig.h \ 44addresseeconfig.h \
45addresseeutil.h \ 45addresseeutil.h \
46emaileditwidget.h \ 46emaileditwidget.h \
47filtereditdialog.h \ 47filtereditdialog.h \
48kaddressbookmain.h \ 48kaddressbookmain.h \
49kabprefs.h \ 49kabprefs.h \
50kabcore.h \ 50kabcore.h \
51viewmanager.h \ 51viewmanager.h \
52extensionmanager.h \ 52extensionmanager.h \
53extensionwidget.h \ 53extensionwidget.h \
54kaddressbookview.h \ 54kaddressbookview.h \
55geowidget.h \ 55geowidget.h \
56imagewidget.h \ 56imagewidget.h \
57incsearchwidget.h \ 57incsearchwidget.h \
58jumpbuttonbar.h \ 58jumpbuttonbar.h \
59phoneeditwidget.h \ 59phoneeditwidget.h \
60secrecywidget.h \ 60secrecywidget.h \
61keywidget.h \ 61keywidget.h \
62nameeditdialog.h \ 62nameeditdialog.h \
63filter.h \ 63filter.h \
64addviewdialog.h \ 64addviewdialog.h \
65configurewidget.h \ 65configurewidget.h \
66viewconfigurewidget.h \ 66viewconfigurewidget.h \
67viewconfigurefieldspage.h \ 67viewconfigurefieldspage.h \
68viewconfigurefilterpage.h \ 68viewconfigurefilterpage.h \
69typecombo.h \ 69typecombo.h \
70undo.h \ 70undo.h \
71undocmds.h \ 71undocmds.h \
72xxportmanager.h \ 72xxportmanager.h \
73xxportobject.h \ 73xxportobject.h \
74xxportselectdialog.h \ 74xxportselectdialog.h \
75details/detailsviewcontainer.h \ 75details/detailsviewcontainer.h \
76details/look_basic.h \ 76details/look_basic.h \
77details/look_html.h \ 77details/look_html.h \
78views/kaddressbookiconview.h \ 78views/kaddressbookiconview.h \
79views/kaddressbooktableview.h \ 79views/kaddressbooktableview.h \
80views/kaddressbookcardview.h \ 80views/kaddressbookcardview.h \
81views/configuretableviewdialog.h \ 81views/configuretableviewdialog.h \
82views/configurecardviewdialog.h \ 82views/configurecardviewdialog.h \
83views/cardview.h \ 83views/cardview.h \
84views/colorlistbox.h \ 84views/colorlistbox.h \
85views/contactlistview.h \ 85views/contactlistview.h \
86xxport/vcard_xxport.h \ 86xxport/vcard_xxport.h \
87xxport/kde2_xxport.h \ 87xxport/kde2_xxport.h \
88xxport/csv_xxport.h \ 88xxport/csv_xxport.h \
89xxport/csvimportdialog.h \ 89xxport/csvimportdialog.h \
90xxport/opie_xxport.h \ 90xxport/opie_xxport.h \
91xxport/qtopia_xxport.h \ 91xxport/qtopia_xxport.h \
92xxport/sharpdtm_xxport.h \ 92xxport/sharpdtm_xxport.h \
93#details/look_details.h \ 93#details/look_details.h \
94#mainwindoiw.h \ 94#mainwindoiw.h \
95# alarmclient.h \ 95# alarmclient.h \
96# calendarview.h \ 96# calendarview.h \
97# customlistviewitem.h \ 97# customlistviewitem.h \
98# datenavigator.h 98# datenavigator.h
99 99
100SOURCES = \ 100SOURCES = \
101addresseeeditordialog.cpp \ 101addresseeeditordialog.cpp \
102addresseeeditorwidget.cpp \ 102addresseeeditorwidget.cpp \
103addresseditwidget.cpp \ 103addresseditwidget.cpp \
104addresseeconfig.cpp \ 104addresseeconfig.cpp \
105addresseeutil.cpp \ 105addresseeutil.cpp \
106extensionmanager.cpp \ 106extensionmanager.cpp \
107features/mergewidget.cpp \ 107features/mergewidget.cpp \
108features/distributionlistwidget.cpp \ 108features/distributionlistwidget.cpp \
109kcmconfigs/addresseewidget.cpp \ 109kcmconfigs/addresseewidget.cpp \
110kcmconfigs/extensionconfigdialog.cpp \ 110kcmconfigs/extensionconfigdialog.cpp \
111kcmconfigs/kcmkabconfig.cpp \ 111kcmconfigs/kcmkabconfig.cpp \
112kcmconfigs/kabconfigwidget.cpp \ 112kcmconfigs/kabconfigwidget.cpp \
113emaileditwidget.cpp \ 113emaileditwidget.cpp \
114filtereditdialog.cpp \ 114filtereditdialog.cpp \
115mainembedded.cpp \ 115mainembedded.cpp \
116kaddressbookmain.cpp \ 116kaddressbookmain.cpp \
117kabcore.cpp \ 117kabcore.cpp \
118kabprefs.cpp \ 118kabprefs.cpp \
119viewmanager.cpp \ 119viewmanager.cpp \
120kaddressbookview.cpp \ 120kaddressbookview.cpp \
121extensionwidget.cpp \ 121extensionwidget.cpp \
122geowidget.cpp \ 122geowidget.cpp \
123imagewidget.cpp \ 123imagewidget.cpp \
124incsearchwidget.cpp \ 124incsearchwidget.cpp \
125jumpbuttonbar.cpp \ 125jumpbuttonbar.cpp \
126phoneeditwidget.cpp \ 126phoneeditwidget.cpp \
127secrecywidget.cpp \ 127secrecywidget.cpp \
128keywidget.cpp \ 128keywidget.cpp \
129nameeditdialog.cpp \ 129nameeditdialog.cpp \
130filter.cpp \ 130filter.cpp \
131addviewdialog.cpp \ 131addviewdialog.cpp \
132configurewidget.cpp \ 132configurewidget.cpp \
133viewconfigurewidget.cpp \ 133viewconfigurewidget.cpp \
134viewconfigurefieldspage.cpp \ 134viewconfigurefieldspage.cpp \
135viewconfigurefilterpage.cpp \ 135viewconfigurefilterpage.cpp \
136undo.cpp \ 136undo.cpp \
137undocmds.cpp \ 137undocmds.cpp \
138xxportmanager.cpp \ 138xxportmanager.cpp \
139xxportobject.cpp \ 139xxportobject.cpp \
140xxportselectdialog.cpp \ 140xxportselectdialog.cpp \
141details/detailsviewcontainer.cpp \ 141details/detailsviewcontainer.cpp \
142details/look_basic.cpp \ 142details/look_basic.cpp \
143details/look_html.cpp \ 143details/look_html.cpp \
144views/kaddressbookiconview.cpp \ 144views/kaddressbookiconview.cpp \
145views/kaddressbooktableview.cpp \ 145views/kaddressbooktableview.cpp \
146views/kaddressbookcardview.cpp \ 146views/kaddressbookcardview.cpp \
147views/configuretableviewdialog.cpp \ 147views/configuretableviewdialog.cpp \
148views/configurecardviewdialog.cpp \ 148views/configurecardviewdialog.cpp \
149views/cardview.cpp \ 149views/cardview.cpp \
150views/contactlistview.cpp \ 150views/contactlistview.cpp \
151views/colorlistbox.cpp \ 151views/colorlistbox.cpp \
152xxport/vcard_xxport.cpp \ 152xxport/vcard_xxport.cpp \
153xxport/kde2_xxport.cpp \ 153xxport/kde2_xxport.cpp \
154xxport/csv_xxport.cpp \ 154xxport/csv_xxport.cpp \
155xxport/csvimportdialog.cpp \ 155xxport/csvimportdialog.cpp \
156xxport/opie_xxport.cpp \ 156xxport/opie_xxport.cpp \
157xxport/qtopia_xxport.cpp \ 157xxport/qtopia_xxport.cpp \
158xxport/sharpdtm_xxport.cpp \ 158xxport/sharpdtm_xxport.cpp \
159#details/look_details.cpp \ 159#details/look_details.cpp \
160#mainwindow.cpp \ 160#mainwindow.cpp \
161# calendarview.cpp \ 161# calendarview.cpp \
162# timespanview.cpp 162# timespanview.cpp
163 163
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 1bac26f..b5309c0 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -1,470 +1,376 @@
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 <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qtabwidget.h> 29#include <qtabwidget.h>
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qfile.h> 33#include <qfile.h>
34 34
35#include <kconfig.h> 35#include <kconfig.h>
36#include <kdebug.h> 36#include <kdebug.h>
37#include <kdialog.h> 37#include <kdialog.h>
38#include <klistview.h> 38#include <klistview.h>
39#include <klocale.h> 39#include <klocale.h>
40#include <kglobal.h> 40#include <kglobal.h>
41#include <kmessagebox.h> 41#include <kmessagebox.h>
42#include <kstandarddirs.h> 42#include <kstandarddirs.h>
43 43
44#ifndef KAB_EMBEDDED 44#ifndef KAB_EMBEDDED
45#include <ktrader.h> 45#include <ktrader.h>
46#else // KAB_EMBEDDED 46#else // KAB_EMBEDDED
47#include <mergewidget.h> 47#include <mergewidget.h>
48#include <distributionlistwidget.h> 48#include <distributionlistwidget.h>
49#endif // KAB_EMBEDDED 49#endif // KAB_EMBEDDED
50 50
51#include "addresseewidget.h" 51#include "addresseewidget.h"
52#include "extensionconfigdialog.h" 52#include "extensionconfigdialog.h"
53#include "extensionwidget.h" 53#include "extensionwidget.h"
54#include "kabprefs.h" 54#include "kabprefs.h"
55 55
56#include "kabconfigwidget.h" 56#include "kabconfigwidget.h"
57 57
58class ExtensionItem : public QCheckListItem 58class ExtensionItem : public QCheckListItem
59{ 59{
60 public: 60 public:
61 61
62#ifndef KAB_EMBEDDED 62#ifndef KAB_EMBEDDED
63 ExtensionItem( QListView *parent, const QString &text ); 63 ExtensionItem( QListView *parent, const QString &text );
64 void setService( const KService::Ptr &ptr ); 64 void setService( const KService::Ptr &ptr );
65#else //KAB_EMBEDDED 65#else //KAB_EMBEDDED
66 ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); 66 ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment );
67 void setFactory( ExtensionFactory* fac ); 67 void setFactory( ExtensionFactory* fac );
68#endif //KAB_EMBEDDED 68#endif //KAB_EMBEDDED
69 69
70 bool configWidgetAvailable() const; 70 bool configWidgetAvailable() const;
71 ExtensionFactory *factory() const; 71 ExtensionFactory *factory() const;
72 72
73 virtual QString text( int column ) const; 73 virtual QString text( int column ) const;
74 74
75 private: 75 private:
76#ifndef KAB_EMBEDDED 76#ifndef KAB_EMBEDDED
77 KService::Ptr mPtr; 77 KService::Ptr mPtr;
78#else //KAB_EMBEDDED 78#else //KAB_EMBEDDED
79 ExtensionFactory* mFactory; 79 ExtensionFactory* mFactory;
80 QString mName; 80 QString mName;
81 QString mComment; 81 QString mComment;
82 82
83#endif //KAB_EMBEDDED 83#endif //KAB_EMBEDDED
84 84
85}; 85};
86 86
87KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) 87KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
88 : QWidget( parent, name ) 88 : QWidget( parent, name )
89{ 89{
90 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 90 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
91 KDialog::spacingHint() ); 91 KDialog::spacingHint() );
92 92
93 QTabWidget *tabWidget = new QTabWidget( this ); 93 QTabWidget *tabWidget = new QTabWidget( this );
94 topLayout->addWidget( tabWidget ); 94 topLayout->addWidget( tabWidget );
95 95
96 // General page 96 // General page
97 QWidget *generalPage = new QWidget( this ); 97 QWidget *generalPage = new QWidget( this );
98 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), 98 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
99 KDialog::spacingHintSmall() ); 99 KDialog::spacingHintSmall() );
100 //general groupbox 100 //general groupbox
101 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage ); 101 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage );
102 QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() ); 102 QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() );
103 boxLayout->setAlignment( Qt::AlignTop ); 103 boxLayout->setAlignment( Qt::AlignTop );
104 boxLayout->setMargin(KDialog::marginHintSmall() ); 104 boxLayout->setMargin(KDialog::marginHintSmall() );
105 groupBox->layout()->setMargin(KDialog::marginHintSmall()) ; 105 groupBox->layout()->setMargin(KDialog::marginHintSmall()) ;
106 groupBox->layout()->setSpacing(KDialog::spacingHintSmall()); 106 groupBox->layout()->setSpacing(KDialog::spacingHintSmall());
107 boxLayout->setSpacing( KDialog::spacingHintSmall() ); 107 boxLayout->setSpacing( KDialog::spacingHintSmall() );
108 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" ); 108 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" );
109 boxLayout->addWidget( mViewsSingleClickBox ); 109 boxLayout->addWidget( mViewsSingleClickBox );
110 110
111 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" ); 111 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" );
112 boxLayout->addWidget( mNameParsing ); 112 boxLayout->addWidget( mNameParsing );
113 113
114 layout->addWidget( groupBox ); 114 layout->addWidget( groupBox );
115 115
116 116
117 //extensions groupbox 117 //extensions groupbox
118 118
119 groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage ); 119 groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage );
120 boxLayout = new QVBoxLayout( groupBox->layout() ); 120 boxLayout = new QVBoxLayout( groupBox->layout() );
121 boxLayout->setAlignment( Qt::AlignTop ); 121 boxLayout->setAlignment( Qt::AlignTop );
122 boxLayout->setMargin(KDialog::marginHintSmall()); 122 boxLayout->setMargin(KDialog::marginHintSmall());
123 boxLayout->setSpacing(KDialog::spacingHintSmall()); 123 boxLayout->setSpacing(KDialog::spacingHintSmall());
124 groupBox->layout()->setMargin(1) ; 124 groupBox->layout()->setMargin(1) ;
125 groupBox->layout()->setSpacing(0); 125 groupBox->layout()->setSpacing(0);
126 mExtensionView = new KListView( groupBox ); 126 mExtensionView = new KListView( groupBox );
127 mExtensionView->setAllColumnsShowFocus( true ); 127 mExtensionView->setAllColumnsShowFocus( true );
128 mExtensionView->addColumn( i18n( "Name" ) ); 128 mExtensionView->addColumn( i18n( "Name" ) );
129 mExtensionView->addColumn( i18n( "Description" ) ); 129 mExtensionView->addColumn( i18n( "Description" ) );
130 mExtensionView->setMaximumHeight(80); 130 mExtensionView->setMaximumHeight(80);
131 131
132 boxLayout->addWidget( mExtensionView ); 132 boxLayout->addWidget( mExtensionView );
133 133
134 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); 134 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
135 mConfigureButton->setEnabled( false ); 135 mConfigureButton->setEnabled( false );
136 boxLayout->addWidget( mConfigureButton ); 136 boxLayout->addWidget( mConfigureButton );
137 137
138 layout->addWidget( groupBox ); 138 layout->addWidget( groupBox );
139 139
140 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 140 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
141 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 141 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
142 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), 142 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
143 SLOT( selectionChanged( QListViewItem* ) ) ); 143 SLOT( selectionChanged( QListViewItem* ) ) );
144 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), 144 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
145 SLOT( itemClicked( QListViewItem* ) ) ); 145 SLOT( itemClicked( QListViewItem* ) ) );
146 connect( mConfigureButton, SIGNAL( clicked() ), 146 connect( mConfigureButton, SIGNAL( clicked() ),
147 SLOT( configureExtension() ) ); 147 SLOT( configureExtension() ) );
148 148
149 tabWidget->addTab( generalPage, i18n( "General" ) ); 149 tabWidget->addTab( generalPage, i18n( "General" ) );
150 150
151 // Addressee page 151 // Addressee page
152 mAddresseeWidget = new AddresseeWidget( this ); 152 mAddresseeWidget = new AddresseeWidget( this );
153 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); 153 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
154 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); 154 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
155 155
156 // mailclient page
157 QWidget *mailclientPage = new QWidget( this );
158 layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(),
159 KDialog::spacingHintSmall() );
160
161 groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage );
162 boxLayout = new QVBoxLayout( groupBox->layout() );
163 boxLayout->setAlignment( Qt::AlignTop );
164// boxLayout->setMargin(KDialog::marginHintSmall() );
165// groupBox->layout()->setMargin(KDialog::marginHintSmall()) ;
166// groupBox->layout()->setSpacing(KDialog::spacingHintSmall());
167// boxLayout->setSpacing( KDialog::spacingHintSmall() );
168
169 mEmailClient = new QComboBox( groupBox );
170 mEmailClient->insertItem( i18n("OM/Pi"), KABPrefs::OMPI );
171 mEmailClient->insertItem( i18n("Qtopia mail"), KABPrefs::QTOPIA );
172 mEmailClient->insertItem( i18n("Opie mail"), KABPrefs::OPIE );
173 mEmailClient->insertItem( i18n("Other"), KABPrefs::OTHER );
174 boxLayout->addWidget( mEmailClient );
175
176 connect( mEmailClient, SIGNAL( activated( int ) ),
177 this, SLOT (emailclient_changed( int ) ) );
178
179 QLabel* lab = new QLabel( i18n("Channel:"), groupBox);
180 boxLayout->addWidget( lab );
181 mEmailChannel = new QLineEdit(groupBox);
182 mEmailChannel->setReadOnly(true);
183 boxLayout->addWidget( mEmailChannel );
184
185 layout->addWidget( groupBox );
186 tabWidget->addTab( mailclientPage, i18n( "Mail" ) );
187
188
189
190} 156}
191 157
192 158
193 159void KABConfigWidget::restoreSettings(KABPrefs* prefs)
194void KABConfigWidget::emailclient_changed( int newClient )
195{ 160{
196 if (newClient == KABPrefs::OTHER) 161//US prefs was KABPrefs::instance() before
197 mEmailChannel->setReadOnly(false);
198 else
199 mEmailChannel->setReadOnly(true);
200
201 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
202 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
203
204 if (opiepath.isEmpty())
205 opiepath = qtopiapath;
206
207 QString text = mEmailChannel->text();
208
209 if (newClient == KABPrefs::OPIE)
210 {
211 if ( QFile::exists( opiepath + "/bin/opiemail" ))
212 text = "QPE/Application/opiemail";
213 else
214 text = "FILENOTFOUND: " + opiepath + "/bin/opiemail";
215 }
216 else if (newClient == KABPrefs::QTOPIA)
217 {
218 if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
219 text = "QPE/Application/qtmail";
220 else
221 text = "FILENOTFOUND: " + qtopiapath + "/bin/qtmail";
222 162
223 }
224 else if (newClient == KABPrefs::OMPI)
225 {
226 if ( QFile::exists( qtopiapath + "/bin/ompi" ))
227 text = "QPE/Application/ompi";
228 else if ( QFile::exists( opiepath + "/bin/ompi" ))
229 text = "QPE/Application/ompi";
230 else
231 text = "FILENOTFOUND: " + qtopiapath + "/bin/ompi";
232
233 }
234 else
235 {
236 //do nothing if we choosed other
237 }
238
239 mEmailChannel->setText( text );
240
241
242}
243
244
245void KABConfigWidget::restoreSettings()
246{
247 bool blocked = signalsBlocked(); 163 bool blocked = signalsBlocked();
248 blockSignals( true ); 164 blockSignals( true );
249 165
250 mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing ); 166 mNameParsing->setChecked( prefs->mAutomaticNameParsing );
251 mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick ); 167 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
252
253 mEmailChannel->setText( KABPrefs::instance()->mEmailChannel );
254 mEmailClient->setCurrentItem(KABPrefs::instance()->mEmailClient);
255 168
256 mAddresseeWidget->restoreSettings(); 169 mAddresseeWidget->restoreSettings();
257 170
258 restoreExtensionSettings(); 171 restoreExtensionSettings();
259 172
260 blockSignals( blocked ); 173 blockSignals( blocked );
261 174
262 emit changed( false ); 175 emit changed( false );
263} 176}
264 177
265void KABConfigWidget::saveSettings() 178void KABConfigWidget::saveSettings(KABPrefs* prefs)
266{ 179{
267 KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked(); 180 prefs->mAutomaticNameParsing = mNameParsing->isChecked();
268 KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked(); 181 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked();
269
270 KABPrefs::instance()->mEmailClient = mEmailClient->currentItem();
271 KABPrefs::instance()->mEmailChannel = mEmailChannel->text();
272 182
273 mAddresseeWidget->saveSettings(); 183 mAddresseeWidget->saveSettings();
274 184
275 saveExtensionSettings(); 185 saveExtensionSettings();
276 KABPrefs::instance()->writeConfig(); 186 KABPrefs::instance()->writeConfig();
277 187
278 emit changed( false ); 188 emit changed( false );
279} 189}
280 190
281void KABConfigWidget::defaults() 191void KABConfigWidget::defaults(KABPrefs* prefs)
282{ 192{
283 mNameParsing->setChecked( true ); 193 mNameParsing->setChecked( true );
284 mViewsSingleClickBox->setChecked( false ); 194 mViewsSingleClickBox->setChecked( false );
285 195
286 mEmailClient->setCurrentItem(KABPrefs::OMPI);
287 emailclient_changed( KABPrefs::OMPI );
288
289
290 emit changed( true ); 196 emit changed( true );
291} 197}
292 198
293void KABConfigWidget::modified() 199void KABConfigWidget::modified()
294{ 200{
295 emit changed( true ); 201 emit changed( true );
296} 202}
297 203
298void KABConfigWidget::restoreExtensionSettings() 204void KABConfigWidget::restoreExtensionSettings()
299{ 205{
300 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; 206 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
301 207
302 mExtensionView->clear(); 208 mExtensionView->clear();
303 209
304#ifndef KAB_EMBEDDED 210#ifndef KAB_EMBEDDED
305 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); 211 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
306 KTrader::OfferList::ConstIterator it; 212 KTrader::OfferList::ConstIterator it;
307 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 213 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
308 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) 214 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) )
309 continue; 215 continue;
310 216
311 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); 217 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() );
312 item->setService( *it ); 218 item->setService( *it );
313 if ( activeExtensions.contains( item->factory()->identifier() ) ) 219 if ( activeExtensions.contains( item->factory()->identifier() ) )
314 item->setOn( true ); 220 item->setOn( true );
315 } 221 }
316#else //KAB_EMBEDDED 222#else //KAB_EMBEDDED
317 ExtensionFactory *extensionFactory = new MergeFactory(); 223 ExtensionFactory *extensionFactory = new MergeFactory();
318 224
319 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); 225 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts");
320 226
321 item->setFactory( extensionFactory ); 227 item->setFactory( extensionFactory );
322 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 228 if ( activeExtensions.contains( extensionFactory->identifier() ) )
323 item->setOn( true ); 229 item->setOn( true );
324 230
325 231
326 232
327 extensionFactory = new DistributionListFactory(); 233 extensionFactory = new DistributionListFactory();
328 234
329 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); 235 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists");
330 236
331 item->setFactory( extensionFactory ); 237 item->setFactory( extensionFactory );
332 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 238 if ( activeExtensions.contains( extensionFactory->identifier() ) )
333 item->setOn( true ); 239 item->setOn( true );
334 240
335 241
336#endif //KAB_EMBEDDED 242#endif //KAB_EMBEDDED
337 243
338} 244}
339 245
340void KABConfigWidget::saveExtensionSettings() 246void KABConfigWidget::saveExtensionSettings()
341{ 247{
342 QStringList activeExtensions; 248 QStringList activeExtensions;
343 249
344 QPtrList<QListViewItem> list; 250 QPtrList<QListViewItem> list;
345 QListViewItemIterator it( mExtensionView ); 251 QListViewItemIterator it( mExtensionView );
346 while ( it.current() ) { 252 while ( it.current() ) {
347 ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); 253 ExtensionItem *item = static_cast<ExtensionItem*>( it.current() );
348 if ( item ) { 254 if ( item ) {
349 if ( item->isOn() ) 255 if ( item->isOn() )
350 activeExtensions.append( item->factory()->identifier() ); 256 activeExtensions.append( item->factory()->identifier() );
351 } 257 }
352 ++it; 258 ++it;
353 } 259 }
354 260
355 KABPrefs::instance()->mActiveExtensions = activeExtensions; 261 KABPrefs::instance()->mActiveExtensions = activeExtensions;
356} 262}
357 263
358void KABConfigWidget::configureExtension() 264void KABConfigWidget::configureExtension()
359{ 265{
360 ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); 266 ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() );
361 if ( !item ) 267 if ( !item )
362 return; 268 return;
363 269
364#ifndef KAB_EMBEDDED 270#ifndef KAB_EMBEDDED
365 KConfig config( "kaddressbookrc" ); 271 KConfig config( "kaddressbookrc" );
366#else //KAB_EMBEDDED 272#else //KAB_EMBEDDED
367 KConfig config( locateLocal("config", "kaddressbookrc") ); 273 KConfig config( locateLocal("config", "kaddressbookrc") );
368#endif //KAB_EMBEDDED 274#endif //KAB_EMBEDDED
369 config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); 275 config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) );
370 276
371 ExtensionConfigDialog dlg( item->factory(), &config, this ); 277 ExtensionConfigDialog dlg( item->factory(), &config, this );
372 dlg.exec(); 278 dlg.exec();
373 279
374 config.sync(); 280 config.sync();
375} 281}
376 282
377void KABConfigWidget::selectionChanged( QListViewItem *i ) 283void KABConfigWidget::selectionChanged( QListViewItem *i )
378{ 284{
379 ExtensionItem *item = static_cast<ExtensionItem*>( i ); 285 ExtensionItem *item = static_cast<ExtensionItem*>( i );
380 if ( !item ) 286 if ( !item )
381 return; 287 return;
382 288
383 mConfigureButton->setEnabled( item->configWidgetAvailable() ); 289 mConfigureButton->setEnabled( item->configWidgetAvailable() );
384} 290}
385 291
386void KABConfigWidget::itemClicked( QListViewItem *item ) 292void KABConfigWidget::itemClicked( QListViewItem *item )
387{ 293{
388 if ( item != 0 ) 294 if ( item != 0 )
389 modified(); 295 modified();
390} 296}
391 297
392#ifndef KAB_EMBEDDED 298#ifndef KAB_EMBEDDED
393ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) 299ExtensionItem::ExtensionItem( QListView *parent, const QString &text )
394 : QCheckListItem( parent, text, CheckBox ) 300 : QCheckListItem( parent, text, CheckBox )
395{ 301{
396} 302}
397 303
398void ExtensionItem::setService( const KService::Ptr &ptr ) 304void ExtensionItem::setService( const KService::Ptr &ptr )
399{ 305{
400 mPtr = ptr; 306 mPtr = ptr;
401} 307}
402#else //KAB_EMBEDDED 308#else //KAB_EMBEDDED
403ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) 309ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment )
404 : QCheckListItem( parent, text, CheckBox ) 310 : QCheckListItem( parent, text, CheckBox )
405{ 311{
406 mName = name; 312 mName = name;
407 mComment = comment; 313 mComment = comment;
408} 314}
409 315
410 316
411void ExtensionItem::setFactory( ExtensionFactory* fac ) 317void ExtensionItem::setFactory( ExtensionFactory* fac )
412{ 318{
413 mFactory = fac; 319 mFactory = fac;
414} 320}
415#endif //KAB_EMBEDDED 321#endif //KAB_EMBEDDED
416 322
417bool ExtensionItem::configWidgetAvailable() const 323bool ExtensionItem::configWidgetAvailable() const
418{ 324{
419#ifndef KAB_EMBEDDED 325#ifndef KAB_EMBEDDED
420 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); 326 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() );
421 if ( !factory ) 327 if ( !factory )
422 return false; 328 return false;
423 329
424 ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); 330 ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory );
425 if ( !extensionFactory ) 331 if ( !extensionFactory )
426 return false; 332 return false;
427 333
428 return extensionFactory->configureWidgetAvailable(); 334 return extensionFactory->configureWidgetAvailable();
429#else //KAB_EMBEDDED 335#else //KAB_EMBEDDED
430 return mFactory->configureWidgetAvailable(); 336 return mFactory->configureWidgetAvailable();
431#endif //KAB_EMBEDDED 337#endif //KAB_EMBEDDED
432 338
433} 339}
434 340
435ExtensionFactory *ExtensionItem::factory() const 341ExtensionFactory *ExtensionItem::factory() const
436{ 342{
437#ifndef KAB_EMBEDDED 343#ifndef KAB_EMBEDDED
438 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); 344 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() );
439 if ( !factory ) 345 if ( !factory )
440 return 0; 346 return 0;
441 347
442 return static_cast<ExtensionFactory*>( factory ); 348 return static_cast<ExtensionFactory*>( factory );
443#else //KAB_EMBEDDED 349#else //KAB_EMBEDDED
444 return mFactory; 350 return mFactory;
445#endif //KAB_EMBEDDED 351#endif //KAB_EMBEDDED
446} 352}
447 353
448QString ExtensionItem::text( int column ) const 354QString ExtensionItem::text( int column ) const
449{ 355{
450#ifndef KAB_EMBEDDED 356#ifndef KAB_EMBEDDED
451 if ( column == 0 ) 357 if ( column == 0 )
452 return mPtr->name(); 358 return mPtr->name();
453 else if ( column == 1 ) 359 else if ( column == 1 )
454 return mPtr->comment(); 360 return mPtr->comment();
455 else 361 else
456 return QString::null; 362 return QString::null;
457#else //KAB_EMBEDDED 363#else //KAB_EMBEDDED
458 if ( column == 0 ) 364 if ( column == 0 )
459 return mName; 365 return mName;
460 else if ( column == 1 ) 366 else if ( column == 1 )
461 return mComment; 367 return mComment;
462 else 368 else
463 return QString::null; 369 return QString::null;
464#endif //KAB_EMBEDDED 370#endif //KAB_EMBEDDED
465} 371}
466 372
467#ifndef KAB_EMBEDDED 373#ifndef KAB_EMBEDDED
468#include "kabconfigwidget.moc" 374#include "kabconfigwidget.moc"
469#endif //KAB_EMBEDDED 375#endif //KAB_EMBEDDED
470 376
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h
index 9d1363b..8c0c436 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.h
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.h
@@ -1,78 +1,76 @@
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 KABCONFIGWIDGET_H 24#ifndef KABCONFIGWIDGET_H
25#define KABCONFIGWIDGET_H 25#define KABCONFIGWIDGET_H
26 26
27#include <qwidget.h> 27#include <qwidget.h>
28 28
29class QCheckBox; 29class QCheckBox;
30class QListViewItem; 30class QListViewItem;
31class QPushButton; 31class QPushButton;
32class QComboBox; 32class QComboBox;
33class QLineEdit; 33class QLineEdit;
34class KListView; 34class KListView;
35class KABPrefs;
35 36
36class AddresseeWidget; 37class AddresseeWidget;
37 38
38class KABConfigWidget : public QWidget 39class KABConfigWidget : public QWidget
39{ 40{
40 Q_OBJECT 41 Q_OBJECT
41 42
42 public: 43 public:
43 KABConfigWidget( QWidget *parent, const char *name = 0 ); 44 KABConfigWidget( QWidget *parent, const char *name = 0 );
44 45
45 void restoreSettings(); 46 void restoreSettings(KABPrefs* prefs);
46 void saveSettings(); 47 void saveSettings(KABPrefs* prefs);
47 void defaults(); 48 void defaults(KABPrefs* prefs);
48 49
49 signals: 50 signals:
50 void changed( bool ); 51 void changed( bool );
51 52
52 public slots: 53 public slots:
53 void modified(); 54 void modified();
54 55
55 56
56 57
57 private slots: 58 private slots:
58 void configureExtension(); 59 void configureExtension();
59 void selectionChanged( QListViewItem* ); 60 void selectionChanged( QListViewItem* );
60 void itemClicked( QListViewItem* ); 61 void itemClicked( QListViewItem* );
61 void emailclient_changed( int newClient );
62 62
63 private: 63 private:
64 void restoreExtensionSettings(); 64 void restoreExtensionSettings();
65 void saveExtensionSettings(); 65 void saveExtensionSettings();
66 66
67 KListView *mExtensionView; 67 KListView *mExtensionView;
68 68
69 QCheckBox *mNameParsing; 69 QCheckBox *mNameParsing;
70 QCheckBox *mViewsSingleClickBox; 70 QCheckBox *mViewsSingleClickBox;
71 QPushButton *mConfigureButton; 71 QPushButton *mConfigureButton;
72 QComboBox* mEmailClient;
73 QLineEdit* mEmailChannel;
74 72
75 AddresseeWidget *mAddresseeWidget; 73 AddresseeWidget *mAddresseeWidget;
76}; 74};
77 75
78#endif 76#endif
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.cpp b/kaddressbook/kcmconfigs/kcmkabconfig.cpp
index a278042..26398f8 100644
--- a/kaddressbook/kcmconfigs/kcmkabconfig.cpp
+++ b/kaddressbook/kcmconfigs/kcmkabconfig.cpp
@@ -1,90 +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"
38#include "kprefs.h"
39
37extern "C" 40extern "C"
38{ 41{
39 KCModule *create_kabconfig( QWidget *parent, const char * ) { 42 KCModule *create_kabconfig( QWidget *parent, const char * ) {
40 return new KCMKabConfig( parent, "kcmkabconfig" ); 43 return new KCMKabConfig( parent, "kcmkabconfig" );
41 } 44 }
42} 45}
43 46
44KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name ) 47KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name )
45 : KCModule( parent, name ) 48 : KCModule( parent, name )
46{ 49{
47 //abort(); 50 //abort();
48 QVBoxLayout *layout = new QVBoxLayout( this ); 51 QVBoxLayout *layout = new QVBoxLayout( this );
49 mConfigWidget = new KABConfigWidget( this, "mConfigWidget" ); 52 mConfigWidget = new KABConfigWidget( this, "mConfigWidget" );
50 layout->addWidget( mConfigWidget ); 53 layout->addWidget( mConfigWidget );
51 layout->setSpacing( 0 ); 54 layout->setSpacing( 0 );
52 layout->setMargin( 0 ); 55 layout->setMargin( 0 );
53 56
54 connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); 57 connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
55 load();
56} 58}
57 59
58void KCMKabConfig::load() 60void KCMKabConfig::load(KPrefs* prefs)
59{ 61{
60 mConfigWidget->restoreSettings(); 62 mConfigWidget->restoreSettings((KABPrefs*)prefs);
61} 63}
62 64
63void KCMKabConfig::save() 65void KCMKabConfig::save(KPrefs* prefs)
64{ 66{
65 mConfigWidget->saveSettings(); 67 mConfigWidget->saveSettings((KABPrefs*)prefs);
66} 68}
67 69
68void KCMKabConfig::defaults() 70void KCMKabConfig::defaults(KPrefs* prefs)
69{ 71{
70 mConfigWidget->defaults(); 72 mConfigWidget->defaults((KABPrefs*)prefs);
71} 73}
72 74
73#ifndef KAB_EMBEDDED 75#ifndef KAB_EMBEDDED
74const KAboutData* KCMKabConfig::aboutData() const 76const KAboutData* KCMKabConfig::aboutData() const
75{ 77{
76 KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ), 78 KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ),
77 I18N_NOOP( "KAddressBook Configure Dialog" ), 79 I18N_NOOP( "KAddressBook Configure Dialog" ),
78 0, 0, KAboutData::License_GPL, 80 0, 0, KAboutData::License_GPL,
79 I18N_NOOP( "(c), 2003 Tobias Koenig" ) ); 81 I18N_NOOP( "(c), 2003 Tobias Koenig" ) );
80 82
81 about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" ); 83 about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" );
82 84
83 return about; 85 return about;
84 86
85} 87}
86#endif //KAB_EMBEDDED 88#endif //KAB_EMBEDDED
87 89
88#ifndef KAB_EMBEDDED 90#ifndef KAB_EMBEDDED
89#include "kcmkabconfig.moc" 91#include "kcmkabconfig.moc"
90#endif //KAB_EMBEDDED 92#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.h b/kaddressbook/kcmconfigs/kcmkabconfig.h
index be345b8..b4858c1 100644
--- a/kaddressbook/kcmconfigs/kcmkabconfig.h
+++ b/kaddressbook/kcmconfigs/kcmkabconfig.h
@@ -1,53 +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;
30 30class KPrefs;
31#ifndef KAB_EMBEDDED
32class KAboutData;
33#endif //KAB_EMBEDDED
34 31
35class KCMKabConfig : public KCModule 32class KCMKabConfig : public KCModule
36{ 33{
37 Q_OBJECT 34 Q_OBJECT
38 35
39 public: 36 public:
40 KCMKabConfig( QWidget *parent = 0, const char *name = 0 ); 37 KCMKabConfig( QWidget *parent = 0, const char *name = 0 );
41 38
42 virtual void load(); 39 virtual void load(KPrefs* prefs);
43 virtual void save(); 40 virtual void save(KPrefs* prefs);
44 virtual void defaults(); 41 virtual void defaults(KPrefs* prefs);
45#ifndef KAB_EMBEDDED
46 virtual const KAboutData* aboutData() const;
47#endif //KAB_EMBEDDED
48 42
49 private: 43 private:
50 KABConfigWidget *mConfigWidget; 44 KABConfigWidget *mConfigWidget;
51}; 45};
52 46
53#endif 47#endif