summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-07-12 10:03:12 (UTC)
committer zautrix <zautrix>2004-07-12 10:03:12 (UTC)
commita55fa40fa32b115c7f7803fb6af0da5184cd7dff (patch) (unidiff)
treed55eec53c51f3bef866b67dedd5e8508c4d8579e
parent2aeb681a7e8a0696608485f36d9c0561ba505c5c (diff)
downloadkdepimpi-a55fa40fa32b115c7f7803fb6af0da5184cd7dff.zip
kdepimpi-a55fa40fa32b115c7f7803fb6af0da5184cd7dff.tar.gz
kdepimpi-a55fa40fa32b115c7f7803fb6af0da5184cd7dff.tar.bz2
Added importing from OL to KA/Pi
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp26
-rw-r--r--kaddressbook/kabcore.h3
-rw-r--r--kaddressbook/kaddressbook.pro11
-rw-r--r--kaddressbook/kaimportoldialog.cpp635
-rw-r--r--kaddressbook/kaimportoldialog.h85
5 files changed, 757 insertions, 3 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 7e3fc7c..f4263c4 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,1632 +1,1654 @@
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> 79#include <kcmkabconfig.h>
80 80
81//US#include <qpe/resource.h> // needed for Resource::loadPixmap 81//US#include <qpe/resource.h> // needed for Resource::loadPixmap
82//#include <qlabel.h> 82//#include <qlabel.h>
83#endif // KAB_EMBEDDED 83#endif // KAB_EMBEDDED
84#include <kcmkabconfig.h> 84#include <kcmkabconfig.h>
85 85
86 86
87#include <kresources/selectdialog.h> 87#include <kresources/selectdialog.h>
88#include <kmessagebox.h> 88#include <kmessagebox.h>
89 89
90#include <picture.h> 90#include <picture.h>
91#include <resource.h> 91#include <resource.h>
92 92
93//US#include <qsplitter.h> 93//US#include <qsplitter.h>
94#include <qvbox.h> 94#include <qvbox.h>
95#include <qlayout.h> 95#include <qlayout.h>
96#include <qclipboard.h> 96#include <qclipboard.h>
97 97
98#include <libkdepim/categoryselectdialog.h> 98#include <libkdepim/categoryselectdialog.h>
99 99
100#include "addresseeutil.h" 100#include "addresseeutil.h"
101#include "undocmds.h" 101#include "undocmds.h"
102#include "addresseeeditordialog.h" 102#include "addresseeeditordialog.h"
103#include "viewmanager.h" 103#include "viewmanager.h"
104#include "details/detailsviewcontainer.h" 104#include "details/detailsviewcontainer.h"
105#include "kabprefs.h" 105#include "kabprefs.h"
106#include "xxportmanager.h" 106#include "xxportmanager.h"
107#include "incsearchwidget.h" 107#include "incsearchwidget.h"
108#include "jumpbuttonbar.h" 108#include "jumpbuttonbar.h"
109#include "extensionmanager.h" 109#include "extensionmanager.h"
110#include "addresseeconfig.h" 110#include "addresseeconfig.h"
111#include <kcmultidialog.h> 111#include <kcmultidialog.h>
112 112
113#ifdef _WIN32_
114
115#include "kaimportoldialog.h"
116#endif
117
113 118
114#ifdef KAB_EMBEDDED 119#ifdef KAB_EMBEDDED
115KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 120KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
116 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 121 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
117 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 122 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
118 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 123 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
119#else //KAB_EMBEDDED 124#else //KAB_EMBEDDED
120KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 125KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
121 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 126 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
122 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 127 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
123 mReadWrite( readWrite ), mModified( false ) 128 mReadWrite( readWrite ), mModified( false )
124#endif //KAB_EMBEDDED 129#endif //KAB_EMBEDDED
125{ 130{
126#ifdef KAB_EMBEDDED 131#ifdef KAB_EMBEDDED
127 //US we define here our own global actioncollection. 132 //US we define here our own global actioncollection.
128 //mActionCollection = new KActionCollection(this); 133 //mActionCollection = new KActionCollection(this);
129#endif //KAB_EMBEDDED 134#endif //KAB_EMBEDDED
130 mExtensionBarSplitter = 0; 135 mExtensionBarSplitter = 0;
131 mIsPart = !parent->inherits( "KAddressBookMain" ); 136 mIsPart = !parent->inherits( "KAddressBookMain" );
132 137
133 mAddressBook = KABC::StdAddressBook::self(); 138 mAddressBook = KABC::StdAddressBook::self();
134 KABC::StdAddressBook::setAutomaticSave( false ); 139 KABC::StdAddressBook::setAutomaticSave( false );
135 140
136#ifndef KAB_EMBEDDED 141#ifndef KAB_EMBEDDED
137 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 142 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
138#endif //KAB_EMBEDDED 143#endif //KAB_EMBEDDED
139 144
140 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 145 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
141 SLOT( addressBookChanged() ) ); 146 SLOT( addressBookChanged() ) );
142 147
143 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 148 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
144 "X-Department", "KADDRESSBOOK" ); 149 "X-Department", "KADDRESSBOOK" );
145 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 150 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
146 "X-Profession", "KADDRESSBOOK" ); 151 "X-Profession", "KADDRESSBOOK" );
147 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 152 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
148 "X-AssistantsName", "KADDRESSBOOK" ); 153 "X-AssistantsName", "KADDRESSBOOK" );
149 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 154 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
150 "X-ManagersName", "KADDRESSBOOK" ); 155 "X-ManagersName", "KADDRESSBOOK" );
151 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 156 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
152 "X-SpousesName", "KADDRESSBOOK" ); 157 "X-SpousesName", "KADDRESSBOOK" );
153 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 158 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
154 "X-Office", "KADDRESSBOOK" ); 159 "X-Office", "KADDRESSBOOK" );
155 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 160 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
156 "X-IMAddress", "KADDRESSBOOK" ); 161 "X-IMAddress", "KADDRESSBOOK" );
157 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 162 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
158 "X-Anniversary", "KADDRESSBOOK" ); 163 "X-Anniversary", "KADDRESSBOOK" );
159 164
160//US added this field to become compatible with Opie addressbook 165//US added this field to become compatible with Opie addressbook
161 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 166 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
162 "X-Gender", "KADDRESSBOOK" ); 167 "X-Gender", "KADDRESSBOOK" );
163 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 168 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
164 "X-Children", "KADDRESSBOOK" ); 169 "X-Children", "KADDRESSBOOK" );
170 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
171 "X-FreeBusyUrl", "KADDRESSBOOK" );
165 172
166 initGUI(); 173 initGUI();
167 174
168 mIncSearchWidget->setFocus(); 175 mIncSearchWidget->setFocus();
169 176
170 177
171 connect( mViewManager, SIGNAL( selected( const QString& ) ), 178 connect( mViewManager, SIGNAL( selected( const QString& ) ),
172 SLOT( setContactSelected( const QString& ) ) ); 179 SLOT( setContactSelected( const QString& ) ) );
173 connect( mViewManager, SIGNAL( executed( const QString& ) ), 180 connect( mViewManager, SIGNAL( executed( const QString& ) ),
174 SLOT( editContact( const QString& ) ) ); 181 SLOT( editContact( const QString& ) ) );
175 connect( mViewManager, SIGNAL( deleteRequest( ) ), 182 connect( mViewManager, SIGNAL( deleteRequest( ) ),
176 SLOT( deleteContacts( ) ) ); 183 SLOT( deleteContacts( ) ) );
177 connect( mViewManager, SIGNAL( modified() ), 184 connect( mViewManager, SIGNAL( modified() ),
178 SLOT( setModified() ) ); 185 SLOT( setModified() ) );
179 186
180 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 187 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
181 188
182 connect( mXXPortManager, SIGNAL( modified() ), 189 connect( mXXPortManager, SIGNAL( modified() ),
183 SLOT( setModified() ) ); 190 SLOT( setModified() ) );
184 191
185 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 192 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
186 SLOT( incrementalSearch( const QString& ) ) ); 193 SLOT( incrementalSearch( const QString& ) ) );
187 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 194 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
188 mJumpButtonBar, SLOT( recreateButtons() ) ); 195 mJumpButtonBar, SLOT( recreateButtons() ) );
189 196
190#ifndef KAB_EMBEDDED 197#ifndef KAB_EMBEDDED
191 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 198 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
192 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 199 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
193 200
194 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 201 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
195 SLOT( sendMail( const QString& ) ) ); 202 SLOT( sendMail( const QString& ) ) );
196 connect( mDetails, SIGNAL( browse( const QString& ) ), 203 connect( mDetails, SIGNAL( browse( const QString& ) ),
197 SLOT( browse( const QString& ) ) ); 204 SLOT( browse( const QString& ) ) );
198 205
199 mAddressBookService = new KAddressBookService( this ); 206 mAddressBookService = new KAddressBookService( this );
200 207
201#endif //KAB_EMBEDDED 208#endif //KAB_EMBEDDED
202 mEditorDialog = 0; 209 mEditorDialog = 0;
203 createAddresseeEditorDialog( this ); 210 createAddresseeEditorDialog( this );
204 setModified( false ); 211 setModified( false );
205} 212}
206 213
207KABCore::~KABCore() 214KABCore::~KABCore()
208{ 215{
209 // save(); 216 // save();
210 //saveSettings(); 217 //saveSettings();
211 //KABPrefs::instance()->writeConfig(); 218 //KABPrefs::instance()->writeConfig();
212 delete AddresseeConfig::instance(); 219 delete AddresseeConfig::instance();
213 mAddressBook = 0; 220 mAddressBook = 0;
214 KABC::StdAddressBook::close(); 221 KABC::StdAddressBook::close();
215 222
216#ifdef KAB_EMBEDDED 223#ifdef KAB_EMBEDDED
217 //US we define here our own global actioncollection. 224 //US we define here our own global actioncollection.
218 // delete mActionCollection; 225 // delete mActionCollection;
219#endif //KAB_EMBEDDED 226#endif //KAB_EMBEDDED
220 227
221} 228}
222 229
223void KABCore::restoreSettings() 230void KABCore::restoreSettings()
224{ 231{
225 bool state = KABPrefs::instance()->mJumpButtonBarVisible; 232 bool state = KABPrefs::instance()->mJumpButtonBarVisible;
226 233
227 mActionJumpBar->setChecked( state ); 234 mActionJumpBar->setChecked( state );
228 setJumpButtonBarVisible( state ); 235 setJumpButtonBarVisible( state );
229 236
230 state = KABPrefs::instance()->mDetailsPageVisible; 237 state = KABPrefs::instance()->mDetailsPageVisible;
231 238
232 mActionDetails->setChecked( state ); 239 mActionDetails->setChecked( state );
233 setDetailsVisible( state ); 240 setDetailsVisible( state );
234 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 241 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
235 if ( splitterSize.count() == 0 ) { 242 if ( splitterSize.count() == 0 ) {
236 splitterSize.append( width() / 2 ); 243 splitterSize.append( width() / 2 );
237 splitterSize.append( width() / 2 ); 244 splitterSize.append( width() / 2 );
238 } 245 }
239 mMiniSplitter->setSizes( splitterSize ); 246 mMiniSplitter->setSizes( splitterSize );
240 if ( mExtensionBarSplitter ) { 247 if ( mExtensionBarSplitter ) {
241 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 248 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
242 if ( splitterSize.count() == 0 ) { 249 if ( splitterSize.count() == 0 ) {
243 splitterSize.append( width() / 2 ); 250 splitterSize.append( width() / 2 );
244 splitterSize.append( width() / 2 ); 251 splitterSize.append( width() / 2 );
245 } 252 }
246 mExtensionBarSplitter->setSizes( splitterSize ); 253 mExtensionBarSplitter->setSizes( splitterSize );
247 254
248 } 255 }
249#ifndef KAB_EMBEDDED 256#ifndef KAB_EMBEDDED
250 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; 257 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter;
251 if ( splitterSize.count() == 0 ) { 258 if ( splitterSize.count() == 0 ) {
252 splitterSize.append( width() / 2 ); 259 splitterSize.append( width() / 2 );
253 splitterSize.append( width() / 2 ); 260 splitterSize.append( width() / 2 );
254 } 261 }
255 mExtensionBarSplitter->setSizes( splitterSize ); 262 mExtensionBarSplitter->setSizes( splitterSize );
256 263
257 splitterSize = KABPrefs::instance()->mDetailsSplitter; 264 splitterSize = KABPrefs::instance()->mDetailsSplitter;
258 if ( splitterSize.count() == 0 ) { 265 if ( splitterSize.count() == 0 ) {
259 splitterSize.append( height() / 2 ); 266 splitterSize.append( height() / 2 );
260 splitterSize.append( height() / 2 ); 267 splitterSize.append( height() / 2 );
261 } 268 }
262 mDetailsSplitter->setSizes( splitterSize ); 269 mDetailsSplitter->setSizes( splitterSize );
263 270
264 mExtensionManager->restoreSettings(); 271 mExtensionManager->restoreSettings();
265 272
266#endif //KAB_EMBEDDED 273#endif //KAB_EMBEDDED
267 274
268 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 275 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
269 276
270 mViewManager->restoreSettings(); 277 mViewManager->restoreSettings();
271 mExtensionManager->restoreSettings(); 278 mExtensionManager->restoreSettings();
272} 279}
273 280
274void KABCore::saveSettings() 281void KABCore::saveSettings()
275{ 282{
276 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 283 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
277 if ( mExtensionBarSplitter ) 284 if ( mExtensionBarSplitter )
278 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 285 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
279 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 286 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
280 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 287 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
281#ifndef KAB_EMBEDDED 288#ifndef KAB_EMBEDDED
282 289
283 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 290 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
284 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 291 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
285#endif //KAB_EMBEDDED 292#endif //KAB_EMBEDDED
286 mExtensionManager->saveSettings(); 293 mExtensionManager->saveSettings();
287 mViewManager->saveSettings(); 294 mViewManager->saveSettings();
288 295
289 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 296 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
290 297
291} 298}
292 299
293KABC::AddressBook *KABCore::addressBook() const 300KABC::AddressBook *KABCore::addressBook() const
294{ 301{
295 return mAddressBook; 302 return mAddressBook;
296} 303}
297 304
298KConfig *KABCore::config() 305KConfig *KABCore::config()
299{ 306{
300#ifndef KAB_EMBEDDED 307#ifndef KAB_EMBEDDED
301 return KABPrefs::instance()->config(); 308 return KABPrefs::instance()->config();
302#else //KAB_EMBEDDED 309#else //KAB_EMBEDDED
303 return KABPrefs::instance()->getConfig(); 310 return KABPrefs::instance()->getConfig();
304#endif //KAB_EMBEDDED 311#endif //KAB_EMBEDDED
305} 312}
306 313
307KActionCollection *KABCore::actionCollection() const 314KActionCollection *KABCore::actionCollection() const
308{ 315{
309 return mGUIClient->actionCollection(); 316 return mGUIClient->actionCollection();
310} 317}
311 318
312KABC::Field *KABCore::currentSearchField() const 319KABC::Field *KABCore::currentSearchField() const
313{ 320{
314 if (mIncSearchWidget) 321 if (mIncSearchWidget)
315 return mIncSearchWidget->currentField(); 322 return mIncSearchWidget->currentField();
316 else 323 else
317 return 0; 324 return 0;
318} 325}
319 326
320QStringList KABCore::selectedUIDs() const 327QStringList KABCore::selectedUIDs() const
321{ 328{
322 return mViewManager->selectedUids(); 329 return mViewManager->selectedUids();
323} 330}
324 331
325KABC::Resource *KABCore::requestResource( QWidget *parent ) 332KABC::Resource *KABCore::requestResource( QWidget *parent )
326{ 333{
327 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 334 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
328 335
329 QPtrList<KRES::Resource> kresResources; 336 QPtrList<KRES::Resource> kresResources;
330 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 337 QPtrListIterator<KABC::Resource> resIt( kabcResources );
331 KABC::Resource *resource; 338 KABC::Resource *resource;
332 while ( ( resource = resIt.current() ) != 0 ) { 339 while ( ( resource = resIt.current() ) != 0 ) {
333 ++resIt; 340 ++resIt;
334 if ( !resource->readOnly() ) { 341 if ( !resource->readOnly() ) {
335 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 342 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
336 if ( res ) 343 if ( res )
337 kresResources.append( res ); 344 kresResources.append( res );
338 } 345 }
339 } 346 }
340 347
341 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 348 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
342 return static_cast<KABC::Resource*>( res ); 349 return static_cast<KABC::Resource*>( res );
343} 350}
344 351
345#ifndef KAB_EMBEDDED 352#ifndef KAB_EMBEDDED
346KAboutData *KABCore::createAboutData() 353KAboutData *KABCore::createAboutData()
347#else //KAB_EMBEDDED 354#else //KAB_EMBEDDED
348void KABCore::createAboutData() 355void KABCore::createAboutData()
349#endif //KAB_EMBEDDED 356#endif //KAB_EMBEDDED
350{ 357{
351#ifndef KAB_EMBEDDED 358#ifndef KAB_EMBEDDED
352 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 359 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
353 "3.1", I18N_NOOP( "The KDE Address Book" ), 360 "3.1", I18N_NOOP( "The KDE Address Book" ),
354 KAboutData::License_GPL_V2, 361 KAboutData::License_GPL_V2,
355 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 362 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
356 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 363 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
357 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 364 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
358 about->addAuthor( "Cornelius Schumacher", 365 about->addAuthor( "Cornelius Schumacher",
359 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 366 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
360 "schumacher@kde.org" ); 367 "schumacher@kde.org" );
361 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 368 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
362 "mpilone@slac.com" ); 369 "mpilone@slac.com" );
363 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 370 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
364 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 371 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
365 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 372 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
366 "michel@klaralvdalens-datakonsult.se" ); 373 "michel@klaralvdalens-datakonsult.se" );
367 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 374 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
368 "hansen@kde.org" ); 375 "hansen@kde.org" );
369 376
370 return about; 377 return about;
371#endif //KAB_EMBEDDED 378#endif //KAB_EMBEDDED
372 379
373 QString version; 380 QString version;
374#include <../version> 381#include <../version>
375 QMessageBox::about( this, "About KAddressbook/Pi", 382 QMessageBox::about( this, "About KAddressbook/Pi",
376 "KAddressbook/Platform-independent\n" 383 "KAddressbook/Platform-independent\n"
377 "(KA/Pi) " +version + " - " + 384 "(KA/Pi) " +version + " - " +
378#ifdef DESKTOP_VERSION 385#ifdef DESKTOP_VERSION
379 "Desktop Edition\n" 386 "Desktop Edition\n"
380#else 387#else
381 "PDA-Edition\n" 388 "PDA-Edition\n"
382 "for: Zaurus 5500 / 7x0 / 8x0\n" 389 "for: Zaurus 5500 / 7x0 / 8x0\n"
383#endif 390#endif
384 391
385 "(c) 2004 Ulf Schenk\n" 392 "(c) 2004 Ulf Schenk\n"
386 "(c) 1997-2003, The KDE PIM Team\n" 393 "(c) 1997-2003, The KDE PIM Team\n"
387 "Tobias Koenig Current maintainer tokoe@kde.org\n" 394 "Tobias Koenig Current maintainer tokoe@kde.org\n"
388 "Don Sanders Original author\n" 395 "Don Sanders Original author\n"
389 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" 396 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n"
390 "Mike Pilone GUI and framework redesign mpilone@slac.com\n" 397 "Mike Pilone GUI and framework redesign mpilone@slac.com\n"
391 "Greg Stern DCOP interface\n" 398 "Greg Stern DCOP interface\n"
392 "Mark Westcot Contact pinning\n" 399 "Mark Westcot Contact pinning\n"
393 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 400 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
394 "Steffen Hansen LDAP Lookup hansen@kde.org\n" ); 401 "Steffen Hansen LDAP Lookup hansen@kde.org\n" );
395} 402}
396 403
397void KABCore::setContactSelected( const QString &uid ) 404void KABCore::setContactSelected( const QString &uid )
398{ 405{
399 KABC::Addressee addr = mAddressBook->findByUid( uid ); 406 KABC::Addressee addr = mAddressBook->findByUid( uid );
400 if ( !mDetails->isHidden() ) 407 if ( !mDetails->isHidden() )
401 mDetails->setAddressee( addr ); 408 mDetails->setAddressee( addr );
402 409
403 if ( !addr.isEmpty() ) { 410 if ( !addr.isEmpty() ) {
404 emit contactSelected( addr.formattedName() ); 411 emit contactSelected( addr.formattedName() );
405 KABC::Picture pic = addr.photo(); 412 KABC::Picture pic = addr.photo();
406 if ( pic.isIntern() ) { 413 if ( pic.isIntern() ) {
407//US emit contactSelected( pic.data() ); 414//US emit contactSelected( pic.data() );
408//US instead use: 415//US instead use:
409 QPixmap px; 416 QPixmap px;
410 if (pic.data().isNull() != true) 417 if (pic.data().isNull() != true)
411 { 418 {
412 px.convertFromImage(pic.data()); 419 px.convertFromImage(pic.data());
413 } 420 }
414 421
415 emit contactSelected( px ); 422 emit contactSelected( px );
416 } 423 }
417 } 424 }
418 425
419 426
420 mExtensionManager->setSelectionChanged(); 427 mExtensionManager->setSelectionChanged();
421 428
422 // update the actions 429 // update the actions
423 bool selected = !uid.isEmpty(); 430 bool selected = !uid.isEmpty();
424 431
425 if ( mReadWrite ) { 432 if ( mReadWrite ) {
426 mActionCut->setEnabled( selected ); 433 mActionCut->setEnabled( selected );
427 mActionPaste->setEnabled( selected ); 434 mActionPaste->setEnabled( selected );
428 } 435 }
429 436
430 mActionCopy->setEnabled( selected ); 437 mActionCopy->setEnabled( selected );
431 mActionDelete->setEnabled( selected ); 438 mActionDelete->setEnabled( selected );
432 mActionEditAddressee->setEnabled( selected ); 439 mActionEditAddressee->setEnabled( selected );
433 mActionMail->setEnabled( selected ); 440 mActionMail->setEnabled( selected );
434 mActionMailVCard->setEnabled( selected ); 441 mActionMailVCard->setEnabled( selected );
435 mActionWhoAmI->setEnabled( selected ); 442 mActionWhoAmI->setEnabled( selected );
436 mActionCategories->setEnabled( selected ); 443 mActionCategories->setEnabled( selected );
437} 444}
438 445
439void KABCore::sendMail() 446void KABCore::sendMail()
440{ 447{
441#ifndef KAB_EMBEDDED 448#ifndef KAB_EMBEDDED
442 sendMail( mViewManager->selectedEmails().join( ", " ) ); 449 sendMail( mViewManager->selectedEmails().join( ", " ) );
443#else //KAB_EMBEDDED 450#else //KAB_EMBEDDED
444 qDebug("KABCore::sendMail() ust be fixed"); 451 qDebug("KABCore::sendMail() ust be fixed");
445#endif //KAB_EMBEDDED 452#endif //KAB_EMBEDDED
446} 453}
447 454
448void KABCore::sendMail( const QString& email ) 455void KABCore::sendMail( const QString& email )
449{ 456{
450#ifndef KAB_EMBEDDED 457#ifndef KAB_EMBEDDED
451 kapp->invokeMailer( email, "" ); 458 kapp->invokeMailer( email, "" );
452#else //KAB_EMBEDDED 459#else //KAB_EMBEDDED
453 qDebug("KABCore::sendMail(const QString& email) ust be fixed"); 460 qDebug("KABCore::sendMail(const QString& email) ust be fixed");
454#endif //KAB_EMBEDDED 461#endif //KAB_EMBEDDED
455} 462}
456 463
457void KABCore::mailVCard() 464void KABCore::mailVCard()
458{ 465{
459#ifndef KAB_EMBEDDED 466#ifndef KAB_EMBEDDED
460 QStringList uids = mViewManager->selectedUids(); 467 QStringList uids = mViewManager->selectedUids();
461 if ( !uids.isEmpty() ) 468 if ( !uids.isEmpty() )
462 mailVCard( uids ); 469 mailVCard( uids );
463#else //KAB_EMBEDDED 470#else //KAB_EMBEDDED
464 qDebug("KABCore::mailVCard() must be fixed"); 471 qDebug("KABCore::mailVCard() must be fixed");
465#endif //KAB_EMBEDDED 472#endif //KAB_EMBEDDED
466} 473}
467 474
468void KABCore::mailVCard( const QStringList& uids ) 475void KABCore::mailVCard( const QStringList& uids )
469{ 476{
470#ifndef KAB_EMBEDDED 477#ifndef KAB_EMBEDDED
471 QStringList urls; 478 QStringList urls;
472 479
473 // Create a temp dir, so that we can put the files in it with proper names 480 // Create a temp dir, so that we can put the files in it with proper names
474 KTempFile tempDir; 481 KTempFile tempDir;
475 if ( tempDir.status() != 0 ) { 482 if ( tempDir.status() != 0 ) {
476 kdWarning() << strerror( tempDir.status() ) << endl; 483 kdWarning() << strerror( tempDir.status() ) << endl;
477 return; 484 return;
478 } 485 }
479 486
480 QString dirName = tempDir.name(); 487 QString dirName = tempDir.name();
481 tempDir.unlink(); 488 tempDir.unlink();
482 QDir().mkdir( dirName, true ); 489 QDir().mkdir( dirName, true );
483 490
484 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 491 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
485 KABC::Addressee a = mAddressBook->findByUid( *it ); 492 KABC::Addressee a = mAddressBook->findByUid( *it );
486 493
487 if ( a.isEmpty() ) 494 if ( a.isEmpty() )
488 continue; 495 continue;
489 496
490 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 497 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
491 498
492 QString fileName = dirName + "/" + name; 499 QString fileName = dirName + "/" + name;
493 500
494 QFile outFile(fileName); 501 QFile outFile(fileName);
495 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 502 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
496 KABC::VCardConverter converter; 503 KABC::VCardConverter converter;
497 QString vcard; 504 QString vcard;
498 505
499 converter.addresseeToVCard( a, vcard ); 506 converter.addresseeToVCard( a, vcard );
500 507
501 QTextStream t( &outFile ); // use a text stream 508 QTextStream t( &outFile ); // use a text stream
502 t.setEncoding( QTextStream::UnicodeUTF8 ); 509 t.setEncoding( QTextStream::UnicodeUTF8 );
503 t << vcard; 510 t << vcard;
504 511
505 outFile.close(); 512 outFile.close();
506 513
507 urls.append( fileName ); 514 urls.append( fileName );
508 } 515 }
509 } 516 }
510 517
511 kapp->invokeMailer( QString::null, QString::null, QString::null, 518 kapp->invokeMailer( QString::null, QString::null, QString::null,
512 QString::null, // subject 519 QString::null, // subject
513 QString::null, // body 520 QString::null, // body
514 QString::null, 521 QString::null,
515 urls ); // attachments 522 urls ); // attachments
516#else //KAB_EMBEDDED 523#else //KAB_EMBEDDED
517 qDebug("KABCore::mailVCard( must be fixed"); 524 qDebug("KABCore::mailVCard( must be fixed");
518#endif //KAB_EMBEDDED 525#endif //KAB_EMBEDDED
519 526
520} 527}
521 528
522void KABCore::browse( const QString& url ) 529void KABCore::browse( const QString& url )
523{ 530{
524#ifndef KAB_EMBEDDED 531#ifndef KAB_EMBEDDED
525 kapp->invokeBrowser( url ); 532 kapp->invokeBrowser( url );
526#else //KAB_EMBEDDED 533#else //KAB_EMBEDDED
527 qDebug("KABCore::browse must be fixed"); 534 qDebug("KABCore::browse must be fixed");
528#endif //KAB_EMBEDDED 535#endif //KAB_EMBEDDED
529} 536}
530 537
531void KABCore::selectAllContacts() 538void KABCore::selectAllContacts()
532{ 539{
533 mViewManager->setSelected( QString::null, true ); 540 mViewManager->setSelected( QString::null, true );
534} 541}
535 542
536void KABCore::deleteContacts() 543void KABCore::deleteContacts()
537{ 544{
538 QStringList uidList = mViewManager->selectedUids(); 545 QStringList uidList = mViewManager->selectedUids();
539 deleteContacts( uidList ); 546 deleteContacts( uidList );
540} 547}
541 548
542void KABCore::deleteContacts( const QStringList &uids ) 549void KABCore::deleteContacts( const QStringList &uids )
543{ 550{
544 if ( uids.count() > 0 ) { 551 if ( uids.count() > 0 ) {
545 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 552 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
546 UndoStack::instance()->push( command ); 553 UndoStack::instance()->push( command );
547 RedoStack::instance()->clear(); 554 RedoStack::instance()->clear();
548 555
549 // now if we deleted anything, refresh 556 // now if we deleted anything, refresh
550 setContactSelected( QString::null ); 557 setContactSelected( QString::null );
551 setModified( true ); 558 setModified( true );
552 } 559 }
553} 560}
554 561
555void KABCore::copyContacts() 562void KABCore::copyContacts()
556{ 563{
557 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 564 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
558 565
559 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 566 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
560 567
561 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 568 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
562 569
563 QClipboard *cb = QApplication::clipboard(); 570 QClipboard *cb = QApplication::clipboard();
564 cb->setText( clipText ); 571 cb->setText( clipText );
565} 572}
566 573
567void KABCore::cutContacts() 574void KABCore::cutContacts()
568{ 575{
569 QStringList uidList = mViewManager->selectedUids(); 576 QStringList uidList = mViewManager->selectedUids();
570 577
571//US if ( uidList.size() > 0 ) { 578//US if ( uidList.size() > 0 ) {
572 if ( uidList.count() > 0 ) { 579 if ( uidList.count() > 0 ) {
573 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 580 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
574 UndoStack::instance()->push( command ); 581 UndoStack::instance()->push( command );
575 RedoStack::instance()->clear(); 582 RedoStack::instance()->clear();
576 583
577 setModified( true ); 584 setModified( true );
578 } 585 }
579} 586}
580 587
581void KABCore::pasteContacts() 588void KABCore::pasteContacts()
582{ 589{
583 QClipboard *cb = QApplication::clipboard(); 590 QClipboard *cb = QApplication::clipboard();
584 591
585 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 592 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
586 593
587 pasteContacts( list ); 594 pasteContacts( list );
588} 595}
589 596
590void KABCore::pasteContacts( KABC::Addressee::List &list ) 597void KABCore::pasteContacts( KABC::Addressee::List &list )
591{ 598{
592 KABC::Resource *resource = requestResource( this ); 599 KABC::Resource *resource = requestResource( this );
593 KABC::Addressee::List::Iterator it; 600 KABC::Addressee::List::Iterator it;
594 for ( it = list.begin(); it != list.end(); ++it ) 601 for ( it = list.begin(); it != list.end(); ++it )
595 (*it).setResource( resource ); 602 (*it).setResource( resource );
596 603
597 PwPasteCommand *command = new PwPasteCommand( this, list ); 604 PwPasteCommand *command = new PwPasteCommand( this, list );
598 UndoStack::instance()->push( command ); 605 UndoStack::instance()->push( command );
599 RedoStack::instance()->clear(); 606 RedoStack::instance()->clear();
600 607
601 setModified( true ); 608 setModified( true );
602} 609}
603 610
604void KABCore::setWhoAmI() 611void KABCore::setWhoAmI()
605{ 612{
606 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 613 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
607 614
608 if ( addrList.count() > 1 ) { 615 if ( addrList.count() > 1 ) {
609 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 616 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
610 return; 617 return;
611 } 618 }
612 619
613 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 620 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
614 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 621 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
615 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 622 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
616} 623}
617 624
618void KABCore::setCategories() 625void KABCore::setCategories()
619{ 626{
620 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 627 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
621 if ( !dlg.exec() ) 628 if ( !dlg.exec() )
622 return; 629 return;
623 630
624 bool merge = false; 631 bool merge = false;
625 QString msg = i18n( "Merge with existing categories?" ); 632 QString msg = i18n( "Merge with existing categories?" );
626 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 633 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
627 merge = true; 634 merge = true;
628 635
629 QStringList categories = dlg.selectedCategories(); 636 QStringList categories = dlg.selectedCategories();
630 637
631 QStringList uids = mViewManager->selectedUids(); 638 QStringList uids = mViewManager->selectedUids();
632 QStringList::Iterator it; 639 QStringList::Iterator it;
633 for ( it = uids.begin(); it != uids.end(); ++it ) { 640 for ( it = uids.begin(); it != uids.end(); ++it ) {
634 KABC::Addressee addr = mAddressBook->findByUid( *it ); 641 KABC::Addressee addr = mAddressBook->findByUid( *it );
635 if ( !addr.isEmpty() ) { 642 if ( !addr.isEmpty() ) {
636 if ( !merge ) 643 if ( !merge )
637 addr.setCategories( categories ); 644 addr.setCategories( categories );
638 else { 645 else {
639 QStringList addrCategories = addr.categories(); 646 QStringList addrCategories = addr.categories();
640 QStringList::Iterator catIt; 647 QStringList::Iterator catIt;
641 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 648 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
642 if ( !addrCategories.contains( *catIt ) ) 649 if ( !addrCategories.contains( *catIt ) )
643 addrCategories.append( *catIt ); 650 addrCategories.append( *catIt );
644 } 651 }
645 addr.setCategories( addrCategories ); 652 addr.setCategories( addrCategories );
646 } 653 }
647 654
648 mAddressBook->insertAddressee( addr ); 655 mAddressBook->insertAddressee( addr );
649 } 656 }
650 } 657 }
651 658
652 if ( uids.count() > 0 ) 659 if ( uids.count() > 0 )
653 setModified( true ); 660 setModified( true );
654} 661}
655 662
656void KABCore::setSearchFields( const KABC::Field::List &fields ) 663void KABCore::setSearchFields( const KABC::Field::List &fields )
657{ 664{
658 mIncSearchWidget->setFields( fields ); 665 mIncSearchWidget->setFields( fields );
659} 666}
660 667
661void KABCore::incrementalSearch( const QString& text ) 668void KABCore::incrementalSearch( const QString& text )
662{ 669{
663 mViewManager->setSelected( QString::null, false ); 670 mViewManager->setSelected( QString::null, false );
664 671
665 if ( !text.isEmpty() ) { 672 if ( !text.isEmpty() ) {
666 KABC::Field *field = mIncSearchWidget->currentField(); 673 KABC::Field *field = mIncSearchWidget->currentField();
667 674
668 QString pattern = text.lower(); 675 QString pattern = text.lower();
669 676
670#if 1 //KDE_VERSION >= 319 677#if 1 //KDE_VERSION >= 319
671 KABC::AddresseeList list( mAddressBook->allAddressees() ); 678 KABC::AddresseeList list( mAddressBook->allAddressees() );
672 if ( field ) { 679 if ( field ) {
673 list.sortByField( field ); 680 list.sortByField( field );
674 KABC::AddresseeList::Iterator it; 681 KABC::AddresseeList::Iterator it;
675 for ( it = list.begin(); it != list.end(); ++it ) { 682 for ( it = list.begin(); it != list.end(); ++it ) {
676 if ( field->value( *it ).lower().startsWith( pattern ) ) { 683 if ( field->value( *it ).lower().startsWith( pattern ) ) {
677 mViewManager->setSelected( (*it).uid(), true ); 684 mViewManager->setSelected( (*it).uid(), true );
678 return; 685 return;
679 } 686 }
680 } 687 }
681 } else { 688 } else {
682 KABC::AddresseeList::Iterator it; 689 KABC::AddresseeList::Iterator it;
683 for ( it = list.begin(); it != list.end(); ++it ) { 690 for ( it = list.begin(); it != list.end(); ++it ) {
684 KABC::Field::List fieldList = mIncSearchWidget->fields(); 691 KABC::Field::List fieldList = mIncSearchWidget->fields();
685 KABC::Field::List::ConstIterator fieldIt; 692 KABC::Field::List::ConstIterator fieldIt;
686 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 693 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
687 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 694 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
688 mViewManager->setSelected( (*it).uid(), true ); 695 mViewManager->setSelected( (*it).uid(), true );
689 return; 696 return;
690 } 697 }
691 } 698 }
692 } 699 }
693 } 700 }
694#else 701#else
695 KABC::AddressBook::Iterator it; 702 KABC::AddressBook::Iterator it;
696 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 703 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
697 if ( field ) { 704 if ( field ) {
698 if ( field->value( *it ).lower().startsWith( pattern ) ) { 705 if ( field->value( *it ).lower().startsWith( pattern ) ) {
699 mViewManager->setSelected( (*it).uid(), true ); 706 mViewManager->setSelected( (*it).uid(), true );
700 return; 707 return;
701 } 708 }
702 } else { 709 } else {
703 KABC::Field::List fieldList = mIncSearchWidget->fields(); 710 KABC::Field::List fieldList = mIncSearchWidget->fields();
704 KABC::Field::List::ConstIterator fieldIt; 711 KABC::Field::List::ConstIterator fieldIt;
705 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 712 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
706 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 713 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
707 mViewManager->setSelected( (*it).uid(), true ); 714 mViewManager->setSelected( (*it).uid(), true );
708 return; 715 return;
709 } 716 }
710 } 717 }
711 } 718 }
712 } 719 }
713#endif 720#endif
714 } 721 }
715} 722}
716 723
717void KABCore::setModified() 724void KABCore::setModified()
718{ 725{
719 setModified( true ); 726 setModified( true );
720} 727}
721 728
722void KABCore::setModifiedWOrefresh() 729void KABCore::setModifiedWOrefresh()
723{ 730{
724 // qDebug("KABCore::setModifiedWOrefresh() "); 731 // qDebug("KABCore::setModifiedWOrefresh() ");
725 mModified = true; 732 mModified = true;
726 mActionSave->setEnabled( mModified ); 733 mActionSave->setEnabled( mModified );
727#ifdef DESKTOP_VERSION 734#ifdef DESKTOP_VERSION
728 mDetails->refreshView(); 735 mDetails->refreshView();
729#endif 736#endif
730 737
731} 738}
732void KABCore::setModified( bool modified ) 739void KABCore::setModified( bool modified )
733{ 740{
734 mModified = modified; 741 mModified = modified;
735 mActionSave->setEnabled( mModified ); 742 mActionSave->setEnabled( mModified );
736 743
737 if ( modified ) 744 if ( modified )
738 mJumpButtonBar->recreateButtons(); 745 mJumpButtonBar->recreateButtons();
739 746
740 mViewManager->refreshView(); 747 mViewManager->refreshView();
741 mDetails->refreshView(); 748 mDetails->refreshView();
742 749
743} 750}
744 751
745bool KABCore::modified() const 752bool KABCore::modified() const
746{ 753{
747 return mModified; 754 return mModified;
748} 755}
749 756
750void KABCore::contactModified( const KABC::Addressee &addr ) 757void KABCore::contactModified( const KABC::Addressee &addr )
751{ 758{
752 759
753 Command *command = 0; 760 Command *command = 0;
754 QString uid; 761 QString uid;
755 762
756 // check if it exists already 763 // check if it exists already
757 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 764 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
758 if ( origAddr.isEmpty() ) 765 if ( origAddr.isEmpty() )
759 command = new PwNewCommand( mAddressBook, addr ); 766 command = new PwNewCommand( mAddressBook, addr );
760 else { 767 else {
761 command = new PwEditCommand( mAddressBook, origAddr, addr ); 768 command = new PwEditCommand( mAddressBook, origAddr, addr );
762 uid = addr.uid(); 769 uid = addr.uid();
763 } 770 }
764 771
765 UndoStack::instance()->push( command ); 772 UndoStack::instance()->push( command );
766 RedoStack::instance()->clear(); 773 RedoStack::instance()->clear();
767 774
768 setModified( true ); 775 setModified( true );
769} 776}
770 777
771void KABCore::newContact() 778void KABCore::newContact()
772{ 779{
773 780
774 781
775 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 782 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
776 783
777 QPtrList<KRES::Resource> kresResources; 784 QPtrList<KRES::Resource> kresResources;
778 QPtrListIterator<KABC::Resource> it( kabcResources ); 785 QPtrListIterator<KABC::Resource> it( kabcResources );
779 KABC::Resource *resource; 786 KABC::Resource *resource;
780 while ( ( resource = it.current() ) != 0 ) { 787 while ( ( resource = it.current() ) != 0 ) {
781 ++it; 788 ++it;
782 if ( !resource->readOnly() ) { 789 if ( !resource->readOnly() ) {
783 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 790 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
784 if ( res ) 791 if ( res )
785 kresResources.append( res ); 792 kresResources.append( res );
786 } 793 }
787 } 794 }
788 795
789 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 796 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
790 resource = static_cast<KABC::Resource*>( res ); 797 resource = static_cast<KABC::Resource*>( res );
791 798
792 if ( resource ) { 799 if ( resource ) {
793 KABC::Addressee addr; 800 KABC::Addressee addr;
794 addr.setResource( resource ); 801 addr.setResource( resource );
795 mEditorDialog->setAddressee( addr ); 802 mEditorDialog->setAddressee( addr );
796 KApplication::execDialog ( mEditorDialog ); 803 KApplication::execDialog ( mEditorDialog );
797 804
798 } else 805 } else
799 return; 806 return;
800 807
801 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 808 // mEditorDict.insert( dialog->addressee().uid(), dialog );
802 809
803 810
804} 811}
805 812
806void KABCore::addEmail( QString aStr ) 813void KABCore::addEmail( QString aStr )
807{ 814{
808#ifndef KAB_EMBEDDED 815#ifndef KAB_EMBEDDED
809 QString fullName, email; 816 QString fullName, email;
810 817
811 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 818 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
812 819
813 // Try to lookup the addressee matching the email address 820 // Try to lookup the addressee matching the email address
814 bool found = false; 821 bool found = false;
815 QStringList emailList; 822 QStringList emailList;
816 KABC::AddressBook::Iterator it; 823 KABC::AddressBook::Iterator it;
817 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 824 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
818 emailList = (*it).emails(); 825 emailList = (*it).emails();
819 if ( emailList.contains( email ) > 0 ) { 826 if ( emailList.contains( email ) > 0 ) {
820 found = true; 827 found = true;
821 (*it).setNameFromString( fullName ); 828 (*it).setNameFromString( fullName );
822 editContact( (*it).uid() ); 829 editContact( (*it).uid() );
823 } 830 }
824 } 831 }
825 832
826 if ( !found ) { 833 if ( !found ) {
827 KABC::Addressee addr; 834 KABC::Addressee addr;
828 addr.setNameFromString( fullName ); 835 addr.setNameFromString( fullName );
829 addr.insertEmail( email, true ); 836 addr.insertEmail( email, true );
830 837
831 mAddressBook->insertAddressee( addr ); 838 mAddressBook->insertAddressee( addr );
832 mViewManager->refreshView( addr.uid() ); 839 mViewManager->refreshView( addr.uid() );
833 editContact( addr.uid() ); 840 editContact( addr.uid() );
834 } 841 }
835#else //KAB_EMBEDDED 842#else //KAB_EMBEDDED
836 qDebug("KABCore::addEmail finsih method"); 843 qDebug("KABCore::addEmail finsih method");
837#endif //KAB_EMBEDDED 844#endif //KAB_EMBEDDED
838} 845}
839 846
840void KABCore::importVCard( const KURL &url, bool showPreview ) 847void KABCore::importVCard( const KURL &url, bool showPreview )
841{ 848{
842 mXXPortManager->importVCard( url, showPreview ); 849 mXXPortManager->importVCard( url, showPreview );
843} 850}
851void KABCore::importFromOL()
852{
853#ifdef _WIN32_
854 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
855 idgl->exec();
856 KABC::Addressee::List list = idgl->getAddressList();
857 if ( list.count() > 0 )
858 pasteContacts( list );
859 delete idgl;
860#endif
861}
844 862
845void KABCore::importVCard( const QString &vCard, bool showPreview ) 863void KABCore::importVCard( const QString &vCard, bool showPreview )
846{ 864{
847 mXXPortManager->importVCard( vCard, showPreview ); 865 mXXPortManager->importVCard( vCard, showPreview );
848} 866}
849 867
850//US added a second method without defaultparameter 868//US added a second method without defaultparameter
851void KABCore::editContact2() { 869void KABCore::editContact2() {
852 editContact( QString::null ); 870 editContact( QString::null );
853} 871}
854 872
855void KABCore::editContact( const QString &uid ) 873void KABCore::editContact( const QString &uid )
856{ 874{
857 875
858 if ( mExtensionManager->isQuickEditVisible() ) 876 if ( mExtensionManager->isQuickEditVisible() )
859 return; 877 return;
860 878
861 // First, locate the contact entry 879 // First, locate the contact entry
862 QString localUID = uid; 880 QString localUID = uid;
863 if ( localUID.isNull() ) { 881 if ( localUID.isNull() ) {
864 QStringList uidList = mViewManager->selectedUids(); 882 QStringList uidList = mViewManager->selectedUids();
865 if ( uidList.count() > 0 ) 883 if ( uidList.count() > 0 )
866 localUID = *( uidList.at( 0 ) ); 884 localUID = *( uidList.at( 0 ) );
867 } 885 }
868 886
869 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 887 KABC::Addressee addr = mAddressBook->findByUid( localUID );
870 if ( !addr.isEmpty() ) { 888 if ( !addr.isEmpty() ) {
871 mEditorDialog->setAddressee( addr ); 889 mEditorDialog->setAddressee( addr );
872 KApplication::execDialog ( mEditorDialog ); 890 KApplication::execDialog ( mEditorDialog );
873 } 891 }
874} 892}
875 893
876void KABCore::save() 894void KABCore::save()
877{ 895{
878 if ( !mModified ) 896 if ( !mModified )
879 return; 897 return;
880 QString text = i18n( "There was an error while attempting to save\n the " 898 QString text = i18n( "There was an error while attempting to save\n the "
881 "address book. Please check that some \nother application is " 899 "address book. Please check that some \nother application is "
882 "not using it. " ); 900 "not using it. " );
883 statusMessage(i18n("Saving addressbook ... ")); 901 statusMessage(i18n("Saving addressbook ... "));
884#ifndef KAB_EMBEDDED 902#ifndef KAB_EMBEDDED
885 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 903 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
886 if ( !b || !b->save() ) { 904 if ( !b || !b->save() ) {
887 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 905 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
888 } 906 }
889#else //KAB_EMBEDDED 907#else //KAB_EMBEDDED
890 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 908 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
891 if ( !b || !b->save() ) { 909 if ( !b || !b->save() ) {
892 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 910 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
893 } 911 }
894#endif //KAB_EMBEDDED 912#endif //KAB_EMBEDDED
895 913
896 statusMessage(i18n("Addressbook saved!")); 914 statusMessage(i18n("Addressbook saved!"));
897 setModified( false ); 915 setModified( false );
898} 916}
899 917
900void KABCore::statusMessage(QString mess , int time ) 918void KABCore::statusMessage(QString mess , int time )
901{ 919{
902 //topLevelWidget()->setCaption( mess ); 920 //topLevelWidget()->setCaption( mess );
903 // pending setting timer to revome message 921 // pending setting timer to revome message
904} 922}
905void KABCore::undo() 923void KABCore::undo()
906{ 924{
907 UndoStack::instance()->undo(); 925 UndoStack::instance()->undo();
908 926
909 // Refresh the view 927 // Refresh the view
910 mViewManager->refreshView(); 928 mViewManager->refreshView();
911} 929}
912 930
913void KABCore::redo() 931void KABCore::redo()
914{ 932{
915 RedoStack::instance()->redo(); 933 RedoStack::instance()->redo();
916 934
917 // Refresh the view 935 // Refresh the view
918 mViewManager->refreshView(); 936 mViewManager->refreshView();
919} 937}
920 938
921void KABCore::setJumpButtonBarVisible( bool visible ) 939void KABCore::setJumpButtonBarVisible( bool visible )
922{ 940{
923 if ( visible ) 941 if ( visible )
924 mJumpButtonBar->show(); 942 mJumpButtonBar->show();
925 else 943 else
926 mJumpButtonBar->hide(); 944 mJumpButtonBar->hide();
927} 945}
928void KABCore::setDetailsToState() 946void KABCore::setDetailsToState()
929{ 947{
930 setDetailsVisible( mActionDetails->isChecked() ); 948 setDetailsVisible( mActionDetails->isChecked() );
931} 949}
932 950
933void KABCore::setDetailsVisible( bool visible ) 951void KABCore::setDetailsVisible( bool visible )
934{ 952{
935 if ( visible ) 953 if ( visible )
936 mDetails->show(); 954 mDetails->show();
937 else 955 else
938 mDetails->hide(); 956 mDetails->hide();
939} 957}
940 958
941void KABCore::extensionModified( const KABC::Addressee::List &list ) 959void KABCore::extensionModified( const KABC::Addressee::List &list )
942{ 960{
943 961
944 if ( list.count() != 0 ) { 962 if ( list.count() != 0 ) {
945 KABC::Addressee::List::ConstIterator it; 963 KABC::Addressee::List::ConstIterator it;
946 for ( it = list.begin(); it != list.end(); ++it ) 964 for ( it = list.begin(); it != list.end(); ++it )
947 mAddressBook->insertAddressee( *it ); 965 mAddressBook->insertAddressee( *it );
948 if ( list.count() > 1 ) 966 if ( list.count() > 1 )
949 setModified(); 967 setModified();
950 else 968 else
951 setModifiedWOrefresh(); 969 setModifiedWOrefresh();
952 } 970 }
953 if ( list.count() == 0 ) 971 if ( list.count() == 0 )
954 mViewManager->refreshView(); 972 mViewManager->refreshView();
955 else 973 else
956 mViewManager->refreshView( list[ 0 ].uid() ); 974 mViewManager->refreshView( list[ 0 ].uid() );
957 975
958 976
959 977
960} 978}
961 979
962QString KABCore::getNameByPhone( const QString &phone ) 980QString KABCore::getNameByPhone( const QString &phone )
963{ 981{
964#ifndef KAB_EMBEDDED 982#ifndef KAB_EMBEDDED
965 QRegExp r( "[/*/-/ ]" ); 983 QRegExp r( "[/*/-/ ]" );
966 QString localPhone( phone ); 984 QString localPhone( phone );
967 985
968 bool found = false; 986 bool found = false;
969 QString ownerName = ""; 987 QString ownerName = "";
970 KABC::AddressBook::Iterator iter; 988 KABC::AddressBook::Iterator iter;
971 KABC::PhoneNumber::List::Iterator phoneIter; 989 KABC::PhoneNumber::List::Iterator phoneIter;
972 KABC::PhoneNumber::List phoneList; 990 KABC::PhoneNumber::List phoneList;
973 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 991 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
974 phoneList = (*iter).phoneNumbers(); 992 phoneList = (*iter).phoneNumbers();
975 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 993 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
976 ++phoneIter) { 994 ++phoneIter) {
977 // Get rid of separator chars so just the numbers are compared. 995 // Get rid of separator chars so just the numbers are compared.
978 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 996 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
979 ownerName = (*iter).formattedName(); 997 ownerName = (*iter).formattedName();
980 found = true; 998 found = true;
981 } 999 }
982 } 1000 }
983 } 1001 }
984 1002
985 return ownerName; 1003 return ownerName;
986#else //KAB_EMBEDDED 1004#else //KAB_EMBEDDED
987 qDebug("KABCore::getNameByPhone finsih method"); 1005 qDebug("KABCore::getNameByPhone finsih method");
988 return ""; 1006 return "";
989#endif //KAB_EMBEDDED 1007#endif //KAB_EMBEDDED
990 1008
991} 1009}
992 1010
993void KABCore::openConfigDialog() 1011void KABCore::openConfigDialog()
994{ 1012{
995 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1013 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
996 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1014 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
997 ConfigureDialog->addModule(kabcfg ); 1015 ConfigureDialog->addModule(kabcfg );
998 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1016 connect( ConfigureDialog, SIGNAL( applyClicked() ),
999 this, SLOT( configurationChanged() ) ); 1017 this, SLOT( configurationChanged() ) );
1000 connect( ConfigureDialog, SIGNAL( okClicked() ), 1018 connect( ConfigureDialog, SIGNAL( okClicked() ),
1001 this, SLOT( configurationChanged() ) ); 1019 this, SLOT( configurationChanged() ) );
1002 saveSettings(); 1020 saveSettings();
1003 ConfigureDialog->showMaximized(); 1021 ConfigureDialog->showMaximized();
1004 if ( ConfigureDialog->exec() ) 1022 if ( ConfigureDialog->exec() )
1005 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); 1023 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") );
1006 delete ConfigureDialog; 1024 delete ConfigureDialog;
1007} 1025}
1008 1026
1009void KABCore::openLDAPDialog() 1027void KABCore::openLDAPDialog()
1010{ 1028{
1011#ifndef KAB_EMBEDDED 1029#ifndef KAB_EMBEDDED
1012 if ( !mLdapSearchDialog ) { 1030 if ( !mLdapSearchDialog ) {
1013 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1031 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1014 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1032 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1015 SLOT( refreshView() ) ); 1033 SLOT( refreshView() ) );
1016 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1034 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1017 SLOT( setModified() ) ); 1035 SLOT( setModified() ) );
1018 } else 1036 } else
1019 mLdapSearchDialog->restoreSettings(); 1037 mLdapSearchDialog->restoreSettings();
1020 1038
1021 if ( mLdapSearchDialog->isOK() ) 1039 if ( mLdapSearchDialog->isOK() )
1022 mLdapSearchDialog->exec(); 1040 mLdapSearchDialog->exec();
1023#else //KAB_EMBEDDED 1041#else //KAB_EMBEDDED
1024 qDebug("KABCore::openLDAPDialog() finsih method"); 1042 qDebug("KABCore::openLDAPDialog() finsih method");
1025#endif //KAB_EMBEDDED 1043#endif //KAB_EMBEDDED
1026} 1044}
1027 1045
1028void KABCore::print() 1046void KABCore::print()
1029{ 1047{
1030#ifndef KAB_EMBEDDED 1048#ifndef KAB_EMBEDDED
1031 KPrinter printer; 1049 KPrinter printer;
1032 if ( !printer.setup( this ) ) 1050 if ( !printer.setup( this ) )
1033 return; 1051 return;
1034 1052
1035 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1053 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1036 mViewManager->selectedUids(), this ); 1054 mViewManager->selectedUids(), this );
1037 1055
1038 wizard.exec(); 1056 wizard.exec();
1039#else //KAB_EMBEDDED 1057#else //KAB_EMBEDDED
1040 qDebug("KABCore::print() finsih method"); 1058 qDebug("KABCore::print() finsih method");
1041#endif //KAB_EMBEDDED 1059#endif //KAB_EMBEDDED
1042 1060
1043} 1061}
1044 1062
1045 1063
1046void KABCore::addGUIClient( KXMLGUIClient *client ) 1064void KABCore::addGUIClient( KXMLGUIClient *client )
1047{ 1065{
1048 if ( mGUIClient ) 1066 if ( mGUIClient )
1049 mGUIClient->insertChildClient( client ); 1067 mGUIClient->insertChildClient( client );
1050 else 1068 else
1051 KMessageBox::error( this, "no KXMLGUICLient"); 1069 KMessageBox::error( this, "no KXMLGUICLient");
1052} 1070}
1053 1071
1054 1072
1055void KABCore::configurationChanged() 1073void KABCore::configurationChanged()
1056{ 1074{
1057 mExtensionManager->reconfigure(); 1075 mExtensionManager->reconfigure();
1058} 1076}
1059 1077
1060void KABCore::addressBookChanged() 1078void KABCore::addressBookChanged()
1061{ 1079{
1062#ifndef KAB_EMBEDDED 1080#ifndef KAB_EMBEDDED
1063 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1081 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1064 while ( it.current() ) { 1082 while ( it.current() ) {
1065 if ( it.current()->dirty() ) { 1083 if ( it.current()->dirty() ) {
1066 QString text = i18n( "Data has been changed externally. Unsaved " 1084 QString text = i18n( "Data has been changed externally. Unsaved "
1067 "changes will be lost." ); 1085 "changes will be lost." );
1068 KMessageBox::information( this, text ); 1086 KMessageBox::information( this, text );
1069 } 1087 }
1070 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1088 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1071 ++it; 1089 ++it;
1072 } 1090 }
1073 1091
1074 mViewManager->refreshView(); 1092 mViewManager->refreshView();
1075#else //KAB_EMBEDDED 1093#else //KAB_EMBEDDED
1076 qDebug("KABCore::addressBookChanged() finsih method"); 1094 qDebug("KABCore::addressBookChanged() finsih method");
1077#endif //KAB_EMBEDDED 1095#endif //KAB_EMBEDDED
1078} 1096}
1079 1097
1080AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1098AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1081 const char *name ) 1099 const char *name )
1082{ 1100{
1083 1101
1084 if ( mEditorDialog == 0 ) { 1102 if ( mEditorDialog == 0 ) {
1085 mEditorDialog = new AddresseeEditorDialog( this, parent, 1103 mEditorDialog = new AddresseeEditorDialog( this, parent,
1086 name ? name : "editorDialog" ); 1104 name ? name : "editorDialog" );
1087 1105
1088 1106
1089 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1107 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1090 SLOT( contactModified( const KABC::Addressee& ) ) ); 1108 SLOT( contactModified( const KABC::Addressee& ) ) );
1091 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1109 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1092 // SLOT( slotEditorDestroyed( const QString& ) ) ); 1110 // SLOT( slotEditorDestroyed( const QString& ) ) );
1093 } 1111 }
1094 1112
1095 return mEditorDialog; 1113 return mEditorDialog;
1096} 1114}
1097 1115
1098void KABCore::slotEditorDestroyed( const QString &uid ) 1116void KABCore::slotEditorDestroyed( const QString &uid )
1099{ 1117{
1100 qDebug("KABCore::slotEditorDestroyed called. maybe a problem! "); 1118 qDebug("KABCore::slotEditorDestroyed called. maybe a problem! ");
1101 //mEditorDict.remove( uid ); 1119 //mEditorDict.remove( uid );
1102} 1120}
1103 1121
1104void KABCore::initGUI() 1122void KABCore::initGUI()
1105{ 1123{
1106#ifndef KAB_EMBEDDED 1124#ifndef KAB_EMBEDDED
1107 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1125 QHBoxLayout *topLayout = new QHBoxLayout( this );
1108 topLayout->setSpacing( KDialogBase::spacingHint() ); 1126 topLayout->setSpacing( KDialogBase::spacingHint() );
1109 1127
1110 mExtensionBarSplitter = new QSplitter( this ); 1128 mExtensionBarSplitter = new QSplitter( this );
1111 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1129 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1112 1130
1113 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1131 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1114 1132
1115 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1133 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1116 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1134 mIncSearchWidget = new IncSearchWidget( viewSpace );
1117 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1135 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1118 SLOT( incrementalSearch( const QString& ) ) ); 1136 SLOT( incrementalSearch( const QString& ) ) );
1119 1137
1120 mViewManager = new ViewManager( this, viewSpace ); 1138 mViewManager = new ViewManager( this, viewSpace );
1121 viewSpace->setStretchFactor( mViewManager, 1 ); 1139 viewSpace->setStretchFactor( mViewManager, 1 );
1122 1140
1123 mDetails = new ViewContainer( mDetailsSplitter ); 1141 mDetails = new ViewContainer( mDetailsSplitter );
1124 1142
1125 mJumpButtonBar = new JumpButtonBar( this, this ); 1143 mJumpButtonBar = new JumpButtonBar( this, this );
1126 1144
1127 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1145 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1128 1146
1129 topLayout->addWidget( mExtensionBarSplitter ); 1147 topLayout->addWidget( mExtensionBarSplitter );
1130 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1148 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1131 topLayout->addWidget( mJumpButtonBar ); 1149 topLayout->addWidget( mJumpButtonBar );
1132 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1150 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1133 1151
1134 mXXPortManager = new XXPortManager( this, this ); 1152 mXXPortManager = new XXPortManager( this, this );
1135 1153
1136#else //KAB_EMBEDDED 1154#else //KAB_EMBEDDED
1137 //US initialize viewMenu before settingup viewmanager. 1155 //US initialize viewMenu before settingup viewmanager.
1138 // Viewmanager needs this menu to plugin submenues. 1156 // Viewmanager needs this menu to plugin submenues.
1139 viewMenu = new QPopupMenu( this ); 1157 viewMenu = new QPopupMenu( this );
1140 settingsMenu = new QPopupMenu( this ); 1158 settingsMenu = new QPopupMenu( this );
1141 //filterMenu = new QPopupMenu( this ); 1159 //filterMenu = new QPopupMenu( this );
1142 ImportMenu = new QPopupMenu( this ); 1160 ImportMenu = new QPopupMenu( this );
1143 ExportMenu = new QPopupMenu( this ); 1161 ExportMenu = new QPopupMenu( this );
1144 1162
1145 changeMenu= new QPopupMenu( this ); 1163 changeMenu= new QPopupMenu( this );
1146 1164
1147//US since we have no splitter for the embedded system, setup 1165//US since we have no splitter for the embedded system, setup
1148// a layout with two frames. One left and one right. 1166// a layout with two frames. One left and one right.
1149 1167
1150 QBoxLayout *topLayout; 1168 QBoxLayout *topLayout;
1151 1169
1152 // = new QHBoxLayout( this ); 1170 // = new QHBoxLayout( this );
1153// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1171// QBoxLayout *topLayout = (QBoxLayout*)layout();
1154 1172
1155// QWidget *mainBox = new QWidget( this ); 1173// QWidget *mainBox = new QWidget( this );
1156// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1174// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1157 1175
1158#ifdef DESKTOP_VERSION 1176#ifdef DESKTOP_VERSION
1159 topLayout = new QHBoxLayout( this ); 1177 topLayout = new QHBoxLayout( this );
1160 1178
1161 1179
1162 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1180 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1163 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1181 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1164 1182
1165 topLayout->addWidget(mMiniSplitter ); 1183 topLayout->addWidget(mMiniSplitter );
1166 1184
1167 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1185 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1168 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1186 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1169 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1187 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1170 mDetails = new ViewContainer( mMiniSplitter ); 1188 mDetails = new ViewContainer( mMiniSplitter );
1171 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1189 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1172#else 1190#else
1173 if ( QApplication::desktop()->width() > 480 ) { 1191 if ( QApplication::desktop()->width() > 480 ) {
1174 topLayout = new QHBoxLayout( this ); 1192 topLayout = new QHBoxLayout( this );
1175 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1193 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1176 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1194 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1177 } else { 1195 } else {
1178 1196
1179 topLayout = new QHBoxLayout( this ); 1197 topLayout = new QHBoxLayout( this );
1180 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1198 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1181 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1199 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1182 } 1200 }
1183 1201
1184 topLayout->addWidget(mMiniSplitter ); 1202 topLayout->addWidget(mMiniSplitter );
1185 mViewManager = new ViewManager( this, mMiniSplitter ); 1203 mViewManager = new ViewManager( this, mMiniSplitter );
1186 mDetails = new ViewContainer( mMiniSplitter ); 1204 mDetails = new ViewContainer( mMiniSplitter );
1187 1205
1188 1206
1189 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1207 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1190#endif 1208#endif
1191 //eh->hide(); 1209 //eh->hide();
1192 // topLayout->addWidget(mExtensionManager ); 1210 // topLayout->addWidget(mExtensionManager );
1193 1211
1194 1212
1195/*US 1213/*US
1196#ifndef KAB_NOSPLITTER 1214#ifndef KAB_NOSPLITTER
1197 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1215 QHBoxLayout *topLayout = new QHBoxLayout( this );
1198//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1216//US topLayout->setSpacing( KDialogBase::spacingHint() );
1199 topLayout->setSpacing( 10 ); 1217 topLayout->setSpacing( 10 );
1200 1218
1201 mDetailsSplitter = new QSplitter( this ); 1219 mDetailsSplitter = new QSplitter( this );
1202 1220
1203 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1221 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1204 1222
1205 mViewManager = new ViewManager( this, viewSpace ); 1223 mViewManager = new ViewManager( this, viewSpace );
1206 viewSpace->setStretchFactor( mViewManager, 1 ); 1224 viewSpace->setStretchFactor( mViewManager, 1 );
1207 1225
1208 mDetails = new ViewContainer( mDetailsSplitter ); 1226 mDetails = new ViewContainer( mDetailsSplitter );
1209 1227
1210 topLayout->addWidget( mDetailsSplitter ); 1228 topLayout->addWidget( mDetailsSplitter );
1211 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1229 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1212#else //KAB_NOSPLITTER 1230#else //KAB_NOSPLITTER
1213 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1231 QHBoxLayout *topLayout = new QHBoxLayout( this );
1214//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1232//US topLayout->setSpacing( KDialogBase::spacingHint() );
1215 topLayout->setSpacing( 10 ); 1233 topLayout->setSpacing( 10 );
1216 1234
1217// mDetailsSplitter = new QSplitter( this ); 1235// mDetailsSplitter = new QSplitter( this );
1218 1236
1219 QVBox *viewSpace = new QVBox( this ); 1237 QVBox *viewSpace = new QVBox( this );
1220 1238
1221 mViewManager = new ViewManager( this, viewSpace ); 1239 mViewManager = new ViewManager( this, viewSpace );
1222 viewSpace->setStretchFactor( mViewManager, 1 ); 1240 viewSpace->setStretchFactor( mViewManager, 1 );
1223 1241
1224 mDetails = new ViewContainer( this ); 1242 mDetails = new ViewContainer( this );
1225 1243
1226 topLayout->addWidget( viewSpace ); 1244 topLayout->addWidget( viewSpace );
1227// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1245// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1228 topLayout->addWidget( mDetails ); 1246 topLayout->addWidget( mDetails );
1229#endif //KAB_NOSPLITTER 1247#endif //KAB_NOSPLITTER
1230*/ 1248*/
1231 1249
1232 1250
1233#endif //KAB_EMBEDDED 1251#endif //KAB_EMBEDDED
1234 initActions(); 1252 initActions();
1235 1253
1236#ifdef KAB_EMBEDDED 1254#ifdef KAB_EMBEDDED
1237 addActionsManually(); 1255 addActionsManually();
1238 //US make sure the export and import menues are initialized before creating the xxPortManager. 1256 //US make sure the export and import menues are initialized before creating the xxPortManager.
1239 mXXPortManager = new XXPortManager( this, this ); 1257 mXXPortManager = new XXPortManager( this, this );
1240 1258
1241 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1259 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1242 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1260 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1243 // mActionQuit->plug ( mMainWindow->toolBar()); 1261 // mActionQuit->plug ( mMainWindow->toolBar());
1244 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1262 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1245 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1263 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1246 // mIncSearchWidget->hide(); 1264 // mIncSearchWidget->hide();
1247 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1265 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1248 SLOT( incrementalSearch( const QString& ) ) ); 1266 SLOT( incrementalSearch( const QString& ) ) );
1249 1267
1250 1268
1251 mJumpButtonBar = new JumpButtonBar( this, this ); 1269 mJumpButtonBar = new JumpButtonBar( this, this );
1252 1270
1253 topLayout->addWidget( mJumpButtonBar ); 1271 topLayout->addWidget( mJumpButtonBar );
1254//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1272//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1255 1273
1256// mMainWindow->getIconToolBar()->raise(); 1274// mMainWindow->getIconToolBar()->raise();
1257 1275
1258#endif //KAB_EMBEDDED 1276#endif //KAB_EMBEDDED
1259 1277
1260} 1278}
1261void KABCore::initActions() 1279void KABCore::initActions()
1262{ 1280{
1263//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1281//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1264 1282
1265#ifndef KAB_EMBEDDED 1283#ifndef KAB_EMBEDDED
1266 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1284 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1267 SLOT( clipboardDataChanged() ) ); 1285 SLOT( clipboardDataChanged() ) );
1268#endif //KAB_EMBEDDED 1286#endif //KAB_EMBEDDED
1269 1287
1270 // file menu 1288 // file menu
1271 if ( mIsPart ) { 1289 if ( mIsPart ) {
1272 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1290 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1273 SLOT( sendMail() ), actionCollection(), 1291 SLOT( sendMail() ), actionCollection(),
1274 "kaddressbook_mail" ); 1292 "kaddressbook_mail" );
1275 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1293 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1276 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1294 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1277 1295
1278 } else { 1296 } else {
1279 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1297 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1280 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1298 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1281 } 1299 }
1282 1300
1283 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1301 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1284 SLOT( save() ), actionCollection(), "file_sync" ); 1302 SLOT( save() ), actionCollection(), "file_sync" );
1285 1303
1286 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1304 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1287 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1305 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1288 1306
1289 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1307 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1290 this, SLOT( mailVCard() ), 1308 this, SLOT( mailVCard() ),
1291 actionCollection(), "file_mail_vcard"); 1309 actionCollection(), "file_mail_vcard");
1292 1310
1293 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1311 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1294 this, SLOT( editContact2() ), 1312 this, SLOT( editContact2() ),
1295 actionCollection(), "file_properties" ); 1313 actionCollection(), "file_properties" );
1296 1314
1297#ifdef KAB_EMBEDDED 1315#ifdef KAB_EMBEDDED
1298 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1316 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1299 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1317 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1300 mMainWindow, SLOT( exit() ), 1318 mMainWindow, SLOT( exit() ),
1301 actionCollection(), "quit" ); 1319 actionCollection(), "quit" );
1302#endif //KAB_EMBEDDED 1320#endif //KAB_EMBEDDED
1303 1321
1304 // edit menu 1322 // edit menu
1305 if ( mIsPart ) { 1323 if ( mIsPart ) {
1306 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1324 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1307 SLOT( copyContacts() ), actionCollection(), 1325 SLOT( copyContacts() ), actionCollection(),
1308 "kaddressbook_copy" ); 1326 "kaddressbook_copy" );
1309 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1327 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1310 SLOT( cutContacts() ), actionCollection(), 1328 SLOT( cutContacts() ), actionCollection(),
1311 "kaddressbook_cut" ); 1329 "kaddressbook_cut" );
1312 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1330 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1313 SLOT( pasteContacts() ), actionCollection(), 1331 SLOT( pasteContacts() ), actionCollection(),
1314 "kaddressbook_paste" ); 1332 "kaddressbook_paste" );
1315 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1333 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1316 SLOT( selectAllContacts() ), actionCollection(), 1334 SLOT( selectAllContacts() ), actionCollection(),
1317 "kaddressbook_select_all" ); 1335 "kaddressbook_select_all" );
1318 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1336 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1319 SLOT( undo() ), actionCollection(), 1337 SLOT( undo() ), actionCollection(),
1320 "kaddressbook_undo" ); 1338 "kaddressbook_undo" );
1321 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1339 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1322 this, SLOT( redo() ), actionCollection(), 1340 this, SLOT( redo() ), actionCollection(),
1323 "kaddressbook_redo" ); 1341 "kaddressbook_redo" );
1324 } else { 1342 } else {
1325 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1343 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1326 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1344 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1327 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1345 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1328 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1346 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1329 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1347 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1330 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1348 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1331 } 1349 }
1332 1350
1333 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1351 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1334 Key_Delete, this, SLOT( deleteContacts() ), 1352 Key_Delete, this, SLOT( deleteContacts() ),
1335 actionCollection(), "edit_delete" ); 1353 actionCollection(), "edit_delete" );
1336 1354
1337 mActionUndo->setEnabled( false ); 1355 mActionUndo->setEnabled( false );
1338 mActionRedo->setEnabled( false ); 1356 mActionRedo->setEnabled( false );
1339 1357
1340 // settings menu 1358 // settings menu
1341#ifdef KAB_EMBEDDED 1359#ifdef KAB_EMBEDDED
1342//US special menuentry to configure the addressbook resources. On KDE 1360//US special menuentry to configure the addressbook resources. On KDE
1343// you do that through the control center !!! 1361// you do that through the control center !!!
1344 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1362 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1345 SLOT( configureResources() ), actionCollection(), 1363 SLOT( configureResources() ), actionCollection(),
1346 "kaddressbook_configure_resources" ); 1364 "kaddressbook_configure_resources" );
1347#endif //KAB_EMBEDDED 1365#endif //KAB_EMBEDDED
1348 1366
1349 if ( mIsPart ) { 1367 if ( mIsPart ) {
1350 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1368 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1351 SLOT( openConfigDialog() ), actionCollection(), 1369 SLOT( openConfigDialog() ), actionCollection(),
1352 "kaddressbook_configure" ); 1370 "kaddressbook_configure" );
1353 1371
1354 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1372 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1355 this, SLOT( configureKeyBindings() ), actionCollection(), 1373 this, SLOT( configureKeyBindings() ), actionCollection(),
1356 "kaddressbook_configure_shortcuts" ); 1374 "kaddressbook_configure_shortcuts" );
1357#ifdef KAB_EMBEDDED 1375#ifdef KAB_EMBEDDED
1358 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1376 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1359 mActionConfigureToolbars->setEnabled( false ); 1377 mActionConfigureToolbars->setEnabled( false );
1360#endif //KAB_EMBEDDED 1378#endif //KAB_EMBEDDED
1361 1379
1362 } else { 1380 } else {
1363 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1381 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1364 1382
1365 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1383 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1366 } 1384 }
1367 1385
1368 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1386 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1369 actionCollection(), "options_show_jump_bar" ); 1387 actionCollection(), "options_show_jump_bar" );
1370 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1388 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1371 1389
1372 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, 1390 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0,
1373 actionCollection(), "options_show_details" ); 1391 actionCollection(), "options_show_details" );
1374 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1392 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1375 1393
1376 // misc 1394 // misc
1377 // only enable LDAP lookup if we can handle the protocol 1395 // only enable LDAP lookup if we can handle the protocol
1378#ifndef KAB_EMBEDDED 1396#ifndef KAB_EMBEDDED
1379 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1397 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1380 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1398 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1381 this, SLOT( openLDAPDialog() ), actionCollection(), 1399 this, SLOT( openLDAPDialog() ), actionCollection(),
1382 "ldap_lookup" ); 1400 "ldap_lookup" );
1383 } 1401 }
1384#else //KAB_EMBEDDED 1402#else //KAB_EMBEDDED
1385 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1403 //qDebug("KABCore::initActions() LDAP has to be implemented");
1386#endif //KAB_EMBEDDED 1404#endif //KAB_EMBEDDED
1387 1405
1388 1406
1389 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1407 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1390 SLOT( setWhoAmI() ), actionCollection(), 1408 SLOT( setWhoAmI() ), actionCollection(),
1391 "set_personal" ); 1409 "set_personal" );
1392 1410
1393 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1411 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1394 SLOT( setCategories() ), actionCollection(), 1412 SLOT( setCategories() ), actionCollection(),
1395 "edit_set_categories" ); 1413 "edit_set_categories" );
1396 1414
1397 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1415 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1398 SLOT( removeVoice() ), actionCollection(), 1416 SLOT( removeVoice() ), actionCollection(),
1399 "remove_voice" ); 1417 "remove_voice" );
1418 mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this,
1419 SLOT( importFromOL() ), actionCollection(),
1420 "import_OL" );
1400#ifdef KAB_EMBEDDED 1421#ifdef KAB_EMBEDDED
1401 1422
1402 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1423 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1403 this, SLOT( createAboutData() ), actionCollection(), 1424 this, SLOT( createAboutData() ), actionCollection(),
1404 "kaddressbook_about_data" ); 1425 "kaddressbook_about_data" );
1405#endif //KAB_EMBEDDED 1426#endif //KAB_EMBEDDED
1406 1427
1407 clipboardDataChanged(); 1428 clipboardDataChanged();
1408 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1429 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1409 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1430 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1410} 1431}
1411 1432
1412//US we need this function, to plug all actions into the correct menues. 1433//US we need this function, to plug all actions into the correct menues.
1413// KDE uses a XML format to plug the actions, but we work her without this overhead. 1434// KDE uses a XML format to plug the actions, but we work her without this overhead.
1414void KABCore::addActionsManually() 1435void KABCore::addActionsManually()
1415{ 1436{
1416//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1437//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1417 1438
1418#ifdef KAB_EMBEDDED 1439#ifdef KAB_EMBEDDED
1419 QPopupMenu *fileMenu = new QPopupMenu( this ); 1440 QPopupMenu *fileMenu = new QPopupMenu( this );
1420 QPopupMenu *editMenu = new QPopupMenu( this ); 1441 QPopupMenu *editMenu = new QPopupMenu( this );
1421 QPopupMenu *helpMenu = new QPopupMenu( this ); 1442 QPopupMenu *helpMenu = new QPopupMenu( this );
1422 1443
1423 KToolBar* tb = mMainWindow->toolBar(); 1444 KToolBar* tb = mMainWindow->toolBar();
1424 1445
1425#ifdef DESKTOP_VERSION 1446#ifdef DESKTOP_VERSION
1426 QMenuBar* mb = mMainWindow->menuBar(); 1447 QMenuBar* mb = mMainWindow->menuBar();
1427 1448
1428 //US setup menubar. 1449 //US setup menubar.
1429 //Disable the following block if you do not want to have a menubar. 1450 //Disable the following block if you do not want to have a menubar.
1430 mb->insertItem( "&File", fileMenu ); 1451 mb->insertItem( "&File", fileMenu );
1431 mb->insertItem( "&Edit", editMenu ); 1452 mb->insertItem( "&Edit", editMenu );
1432 mb->insertItem( "&View", viewMenu ); 1453 mb->insertItem( "&View", viewMenu );
1433 mb->insertItem( "&Settings", settingsMenu ); 1454 mb->insertItem( "&Settings", settingsMenu );
1434 mb->insertItem( "&Change selected", changeMenu ); 1455 mb->insertItem( "&Change selected", changeMenu );
1435 mb->insertItem( "&Help", helpMenu ); 1456 mb->insertItem( "&Help", helpMenu );
1436 mIncSearchWidget = new IncSearchWidget( tb ); 1457 mIncSearchWidget = new IncSearchWidget( tb );
1437 // tb->insertWidget(-1, 0, mIncSearchWidget); 1458 // tb->insertWidget(-1, 0, mIncSearchWidget);
1438 1459
1439#else 1460#else
1440 //US setup toolbar 1461 //US setup toolbar
1441 QMenuBar *menuBarTB = new QMenuBar( tb ); 1462 QMenuBar *menuBarTB = new QMenuBar( tb );
1442 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1463 QPopupMenu *popupBarTB = new QPopupMenu( this );
1443 menuBarTB->insertItem( "ME", popupBarTB); 1464 menuBarTB->insertItem( "ME", popupBarTB);
1444 tb->insertWidget(-1, 0, menuBarTB); 1465 tb->insertWidget(-1, 0, menuBarTB);
1445 mIncSearchWidget = new IncSearchWidget( tb ); 1466 mIncSearchWidget = new IncSearchWidget( tb );
1446 1467
1447 tb->enableMoving(false); 1468 tb->enableMoving(false);
1448 popupBarTB->insertItem( "&File", fileMenu ); 1469 popupBarTB->insertItem( "&File", fileMenu );
1449 popupBarTB->insertItem( "&Edit", editMenu ); 1470 popupBarTB->insertItem( "&Edit", editMenu );
1450 popupBarTB->insertItem( "&View", viewMenu ); 1471 popupBarTB->insertItem( "&View", viewMenu );
1451 popupBarTB->insertItem( "&Settings", settingsMenu ); 1472 popupBarTB->insertItem( "&Settings", settingsMenu );
1452 mViewManager->getFilterAction()->plug ( popupBarTB); 1473 mViewManager->getFilterAction()->plug ( popupBarTB);
1453 popupBarTB->insertItem( "&Change selected", changeMenu ); 1474 popupBarTB->insertItem( "&Change selected", changeMenu );
1454 popupBarTB->insertItem( "&Help", helpMenu ); 1475 popupBarTB->insertItem( "&Help", helpMenu );
1455 if (QApplication::desktop()->width() > 320 ) { 1476 if (QApplication::desktop()->width() > 320 ) {
1456 // mViewManager->getFilterAction()->plug ( tb); 1477 // mViewManager->getFilterAction()->plug ( tb);
1457 } 1478 }
1458#endif 1479#endif
1459 // mActionQuit->plug ( mMainWindow->toolBar()); 1480 // mActionQuit->plug ( mMainWindow->toolBar());
1460 1481
1461 1482
1462 1483
1463 //US Now connect the actions with the menue entries. 1484 //US Now connect the actions with the menue entries.
1464 mActionPrint->plug( fileMenu ); 1485 mActionPrint->plug( fileMenu );
1465 mActionMail->plug( fileMenu ); 1486 mActionMail->plug( fileMenu );
1466 fileMenu->insertSeparator(); 1487 fileMenu->insertSeparator();
1467 1488
1468 mActionNewContact->plug( fileMenu ); 1489 mActionNewContact->plug( fileMenu );
1469 mActionNewContact->plug( tb ); 1490 mActionNewContact->plug( tb );
1470 1491
1471 mActionEditAddressee->plug( fileMenu ); 1492 mActionEditAddressee->plug( fileMenu );
1472 fileMenu->insertSeparator(); 1493 fileMenu->insertSeparator();
1473 mActionSave->plug( fileMenu ); 1494 mActionSave->plug( fileMenu );
1474 fileMenu->insertItem( "&Import", ImportMenu ); 1495 fileMenu->insertItem( "&Import", ImportMenu );
1475 fileMenu->insertItem( "&Emport", ExportMenu ); 1496 fileMenu->insertItem( "&Emport", ExportMenu );
1476 fileMenu->insertSeparator(); 1497 fileMenu->insertSeparator();
1477 mActionMailVCard->plug( fileMenu ); 1498 mActionMailVCard->plug( fileMenu );
1478 fileMenu->insertSeparator(); 1499 fileMenu->insertSeparator();
1479 mActionQuit->plug( fileMenu ); 1500 mActionQuit->plug( fileMenu );
1480 1501#ifdef _WIN32_
1481 1502 mActionImportOL->plug( ImportMenu );
1503#endif
1482 // edit menu 1504 // edit menu
1483 mActionUndo->plug( editMenu ); 1505 mActionUndo->plug( editMenu );
1484 mActionRedo->plug( editMenu ); 1506 mActionRedo->plug( editMenu );
1485 editMenu->insertSeparator(); 1507 editMenu->insertSeparator();
1486 mActionCut->plug( editMenu ); 1508 mActionCut->plug( editMenu );
1487 mActionCopy->plug( editMenu ); 1509 mActionCopy->plug( editMenu );
1488 mActionPaste->plug( editMenu ); 1510 mActionPaste->plug( editMenu );
1489 mActionDelete->plug( editMenu ); 1511 mActionDelete->plug( editMenu );
1490 editMenu->insertSeparator(); 1512 editMenu->insertSeparator();
1491 mActionSelectAll->plug( editMenu ); 1513 mActionSelectAll->plug( editMenu );
1492 1514
1493 mActionRemoveVoice->plug( changeMenu ); 1515 mActionRemoveVoice->plug( changeMenu );
1494 // settings menu 1516 // settings menu
1495//US special menuentry to configure the addressbook resources. On KDE 1517//US special menuentry to configure the addressbook resources. On KDE
1496// you do that through the control center !!! 1518// you do that through the control center !!!
1497 mActionConfigResources->plug( settingsMenu ); 1519 mActionConfigResources->plug( settingsMenu );
1498 settingsMenu->insertSeparator(); 1520 settingsMenu->insertSeparator();
1499 1521
1500 mActionConfigKAddressbook->plug( settingsMenu ); 1522 mActionConfigKAddressbook->plug( settingsMenu );
1501 1523
1502 if ( mIsPart ) { 1524 if ( mIsPart ) {
1503 mActionConfigShortcuts->plug( settingsMenu ); 1525 mActionConfigShortcuts->plug( settingsMenu );
1504 mActionConfigureToolbars->plug( settingsMenu ); 1526 mActionConfigureToolbars->plug( settingsMenu );
1505 1527
1506 } else { 1528 } else {
1507 mActionKeyBindings->plug( settingsMenu ); 1529 mActionKeyBindings->plug( settingsMenu );
1508 } 1530 }
1509 1531
1510 settingsMenu->insertSeparator(); 1532 settingsMenu->insertSeparator();
1511 1533
1512 mActionJumpBar->plug( settingsMenu ); 1534 mActionJumpBar->plug( settingsMenu );
1513 mActionDetails->plug( settingsMenu ); 1535 mActionDetails->plug( settingsMenu );
1514 settingsMenu->insertSeparator(); 1536 settingsMenu->insertSeparator();
1515 1537
1516 mActionWhoAmI->plug( settingsMenu ); 1538 mActionWhoAmI->plug( settingsMenu );
1517 mActionCategories->plug( settingsMenu ); 1539 mActionCategories->plug( settingsMenu );
1518 1540
1519 mActionAboutKAddressbook->plug( helpMenu ); 1541 mActionAboutKAddressbook->plug( helpMenu );
1520 1542
1521 1543
1522 if (QApplication::desktop()->width() > 320 ) { 1544 if (QApplication::desktop()->width() > 320 ) {
1523 1545
1524 mActionEditAddressee->plug( tb ); 1546 mActionEditAddressee->plug( tb );
1525 mActionSave->plug( tb ); 1547 mActionSave->plug( tb );
1526 mViewManager->getFilterAction()->plug ( tb); 1548 mViewManager->getFilterAction()->plug ( tb);
1527 if (QApplication::desktop()->width() > 480 ) { 1549 if (QApplication::desktop()->width() > 480 ) {
1528 mActionUndo->plug( tb ); 1550 mActionUndo->plug( tb );
1529 mActionDelete->plug( tb ); 1551 mActionDelete->plug( tb );
1530 mActionRedo->plug( tb ); 1552 mActionRedo->plug( tb );
1531 } 1553 }
1532 } 1554 }
1533 //mActionQuit->plug ( tb ); 1555 //mActionQuit->plug ( tb );
1534 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1556 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1535 1557
1536 //US link the searchwidget first to this. 1558 //US link the searchwidget first to this.
1537 // The real linkage to the toolbar happens later. 1559 // The real linkage to the toolbar happens later.
1538//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1560//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1539//US tb->insertItem( mIncSearchWidget ); 1561//US tb->insertItem( mIncSearchWidget );
1540/*US 1562/*US
1541 mIncSearchWidget = new IncSearchWidget( tb ); 1563 mIncSearchWidget = new IncSearchWidget( tb );
1542 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1564 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1543 SLOT( incrementalSearch( const QString& ) ) ); 1565 SLOT( incrementalSearch( const QString& ) ) );
1544 1566
1545 mJumpButtonBar = new JumpButtonBar( this, this ); 1567 mJumpButtonBar = new JumpButtonBar( this, this );
1546 1568
1547//US topLayout->addWidget( mJumpButtonBar ); 1569//US topLayout->addWidget( mJumpButtonBar );
1548 this->layout()->add( mJumpButtonBar ); 1570 this->layout()->add( mJumpButtonBar );
1549*/ 1571*/
1550 1572
1551#endif //KAB_EMBEDDED 1573#endif //KAB_EMBEDDED
1552} 1574}
1553void KABCore::removeVoice() 1575void KABCore::removeVoice()
1554{ 1576{
1555 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 ) 1577 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 )
1556 return; 1578 return;
1557 KABC::Addressee::List list = mViewManager->selectedAddressees(); 1579 KABC::Addressee::List list = mViewManager->selectedAddressees();
1558 KABC::Addressee::List::Iterator it; 1580 KABC::Addressee::List::Iterator it;
1559 for ( it = list.begin(); it != list.end(); ++it ) { 1581 for ( it = list.begin(); it != list.end(); ++it ) {
1560 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 1582 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
1561 PhoneNumber::List::Iterator phoneIt; 1583 PhoneNumber::List::Iterator phoneIt;
1562 bool found = false; 1584 bool found = false;
1563 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { 1585 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
1564 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 1586 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
1565 if ((*phoneIt).type() - PhoneNumber::Voice ) { 1587 if ((*phoneIt).type() - PhoneNumber::Voice ) {
1566 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 1588 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
1567 (*it).insertPhoneNumber( (*phoneIt) ); 1589 (*it).insertPhoneNumber( (*phoneIt) );
1568 found = true; 1590 found = true;
1569 } 1591 }
1570 } 1592 }
1571 1593
1572 } 1594 }
1573 if ( found ) 1595 if ( found )
1574 contactModified((*it) ); 1596 contactModified((*it) );
1575 } 1597 }
1576} 1598}
1577 1599
1578 1600
1579 1601
1580void KABCore::clipboardDataChanged() 1602void KABCore::clipboardDataChanged()
1581{ 1603{
1582 1604
1583 if ( mReadWrite ) 1605 if ( mReadWrite )
1584 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 1606 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
1585 1607
1586} 1608}
1587 1609
1588void KABCore::updateActionMenu() 1610void KABCore::updateActionMenu()
1589{ 1611{
1590 UndoStack *undo = UndoStack::instance(); 1612 UndoStack *undo = UndoStack::instance();
1591 RedoStack *redo = RedoStack::instance(); 1613 RedoStack *redo = RedoStack::instance();
1592 1614
1593 if ( undo->isEmpty() ) 1615 if ( undo->isEmpty() )
1594 mActionUndo->setText( i18n( "Undo" ) ); 1616 mActionUndo->setText( i18n( "Undo" ) );
1595 else 1617 else
1596 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 1618 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
1597 1619
1598 mActionUndo->setEnabled( !undo->isEmpty() ); 1620 mActionUndo->setEnabled( !undo->isEmpty() );
1599 1621
1600 if ( !redo->top() ) 1622 if ( !redo->top() )
1601 mActionRedo->setText( i18n( "Redo" ) ); 1623 mActionRedo->setText( i18n( "Redo" ) );
1602 else 1624 else
1603 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 1625 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
1604 1626
1605 mActionRedo->setEnabled( !redo->isEmpty() ); 1627 mActionRedo->setEnabled( !redo->isEmpty() );
1606} 1628}
1607 1629
1608void KABCore::configureKeyBindings() 1630void KABCore::configureKeyBindings()
1609{ 1631{
1610#ifndef KAB_EMBEDDED 1632#ifndef KAB_EMBEDDED
1611 KKeyDialog::configure( actionCollection(), true ); 1633 KKeyDialog::configure( actionCollection(), true );
1612#else //KAB_EMBEDDED 1634#else //KAB_EMBEDDED
1613 qDebug("KABCore::configureKeyBindings() not implemented"); 1635 qDebug("KABCore::configureKeyBindings() not implemented");
1614#endif //KAB_EMBEDDED 1636#endif //KAB_EMBEDDED
1615} 1637}
1616 1638
1617#ifdef KAB_EMBEDDED 1639#ifdef KAB_EMBEDDED
1618void KABCore::configureResources() 1640void KABCore::configureResources()
1619{ 1641{
1620 KRES::KCMKResources dlg( this, "" , 0 ); 1642 KRES::KCMKResources dlg( this, "" , 0 );
1621 1643
1622 if ( !dlg.exec() ) 1644 if ( !dlg.exec() )
1623 return; 1645 return;
1624 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 1646 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
1625} 1647}
1626#endif //KAB_EMBEDDED 1648#endif //KAB_EMBEDDED
1627 1649
1628 1650
1629 1651
1630#ifndef KAB_EMBEDDED 1652#ifndef KAB_EMBEDDED
1631#include "kabcore.moc" 1653#include "kabcore.moc"
1632#endif //KAB_EMBEDDED 1654#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 8d6041e..69a98a5 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,425 +1,426 @@
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 KABCORE_H 24#ifndef KABCORE_H
25#define KABCORE_H 25#define KABCORE_H
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32 32
33#include <qwidget.h> 33#include <qwidget.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35 35
36namespace KABC { 36namespace KABC {
37class AddressBook; 37class AddressBook;
38} 38}
39 39
40#ifndef KAB_EMBEDDED 40#ifndef KAB_EMBEDDED
41class KAboutData; 41class KAboutData;
42class KConfig; 42class KConfig;
43 43
44class KAddressBookService; 44class KAddressBookService;
45class LDAPSearchDialog; 45class LDAPSearchDialog;
46#else //KAB_EMBEDDED 46#else //KAB_EMBEDDED
47class KAddressBookMain; 47class KAddressBookMain;
48//US class QAction; 48//US class QAction;
49#endif //KAB_EMBEDDED 49#endif //KAB_EMBEDDED
50class KCMultiDialog; 50class KCMultiDialog;
51class KXMLGUIClient; 51class KXMLGUIClient;
52class ExtensionManager; 52class ExtensionManager;
53class XXPortManager; 53class XXPortManager;
54class JumpButtonBar; 54class JumpButtonBar;
55class IncSearchWidget; 55class IncSearchWidget;
56class KDGanttMinimizeSplitter; 56class KDGanttMinimizeSplitter;
57class KAction; 57class KAction;
58class KActionCollection; 58class KActionCollection;
59class KToggleAction; 59class KToggleAction;
60 60
61class QAction; 61class QAction;
62class QMenuBar; 62class QMenuBar;
63class QSplitter; 63class QSplitter;
64class ViewContainer; 64class ViewContainer;
65class ViewManager; 65class ViewManager;
66class AddresseeEditorDialog; 66class AddresseeEditorDialog;
67 67
68class KABCore : public QWidget 68class KABCore : public QWidget
69{ 69{
70 Q_OBJECT 70 Q_OBJECT
71 71
72 public: 72 public:
73 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 73 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
74 74
75 75
76 ~KABCore(); 76 ~KABCore();
77 77
78 78
79#ifdef KAB_EMBEDDED 79#ifdef KAB_EMBEDDED
80 //US added functionality 80 //US added functionality
81 QPopupMenu* getViewMenu() {return viewMenu;} 81 QPopupMenu* getViewMenu() {return viewMenu;}
82 QPopupMenu* getFilterMenu() {return filterMenu;} 82 QPopupMenu* getFilterMenu() {return filterMenu;}
83 QPopupMenu* getSettingsMenu() {return settingsMenu;} 83 QPopupMenu* getSettingsMenu() {return settingsMenu;}
84 void addActionsManually(); 84 void addActionsManually();
85#endif //KAB_EMBEDDED 85#endif //KAB_EMBEDDED
86 /** 86 /**
87 Restores the global settings. 87 Restores the global settings.
88 */ 88 */
89 void restoreSettings(); 89 void restoreSettings();
90 90
91 /** 91 /**
92 Saves the global settings. 92 Saves the global settings.
93 */ 93 */
94 void saveSettings(); 94 void saveSettings();
95 95
96 /** 96 /**
97 Returns a pointer to the StdAddressBook of the application. 97 Returns a pointer to the StdAddressBook of the application.
98 */ 98 */
99 KABC::AddressBook *addressBook() const; 99 KABC::AddressBook *addressBook() const;
100 100
101 /** 101 /**
102 Returns a pointer to the KConfig object of the application. 102 Returns a pointer to the KConfig object of the application.
103 */ 103 */
104 static KConfig *config(); 104 static KConfig *config();
105 105
106 /** 106 /**
107 Returns a pointer to the global KActionCollection object. So 107 Returns a pointer to the global KActionCollection object. So
108 other classes can register their actions easily. 108 other classes can register their actions easily.
109 */ 109 */
110 KActionCollection *actionCollection() const; 110 KActionCollection *actionCollection() const;
111 111
112 /** 112 /**
113 Returns the current search field of the Incremental Search Widget. 113 Returns the current search field of the Incremental Search Widget.
114 */ 114 */
115 KABC::Field *currentSearchField() const; 115 KABC::Field *currentSearchField() const;
116 116
117 /** 117 /**
118 Returns the uid list of the currently selected contacts. 118 Returns the uid list of the currently selected contacts.
119 */ 119 */
120 QStringList selectedUIDs() const; 120 QStringList selectedUIDs() const;
121 121
122 /** 122 /**
123 Displays the ResourceSelectDialog and returns the selected 123 Displays the ResourceSelectDialog and returns the selected
124 resource or a null pointer if no resource was selected by 124 resource or a null pointer if no resource was selected by
125 the user. 125 the user.
126 */ 126 */
127 KABC::Resource *requestResource( QWidget *parent ); 127 KABC::Resource *requestResource( QWidget *parent );
128 128
129#ifndef KAB_EMBEDDED 129#ifndef KAB_EMBEDDED
130 static KAboutData *createAboutData(); 130 static KAboutData *createAboutData();
131#endif //KAB_EMBEDDED 131#endif //KAB_EMBEDDED
132 132
133#ifdef KAB_EMBEDDED 133#ifdef KAB_EMBEDDED
134 inline QPopupMenu* getImportMenu() { return ImportMenu;} 134 inline QPopupMenu* getImportMenu() { return ImportMenu;}
135 inline QPopupMenu* getExportMenu() { return ExportMenu;} 135 inline QPopupMenu* getExportMenu() { return ExportMenu;}
136#endif //KAB_EMBEDDED 136#endif //KAB_EMBEDDED
137 137
138 public slots: 138 public slots:
139#ifdef KAB_EMBEDDED 139#ifdef KAB_EMBEDDED
140 void createAboutData(); 140 void createAboutData();
141#endif //KAB_EMBEDDED 141#endif //KAB_EMBEDDED
142 142
143 void statusMessage(QString, int time = 0 ); 143 void statusMessage(QString, int time = 0 );
144 /** 144 /**
145 Is called whenever a contact is selected in the view. 145 Is called whenever a contact is selected in the view.
146 */ 146 */
147 void setContactSelected( const QString &uid ); 147 void setContactSelected( const QString &uid );
148 148
149 /** 149 /**
150 Opens the preferred mail composer with all selected contacts as 150 Opens the preferred mail composer with all selected contacts as
151 arguments. 151 arguments.
152 */ 152 */
153 void sendMail(); 153 void sendMail();
154 154
155 /** 155 /**
156 Opens the preferred mail composer with the given contacts as 156 Opens the preferred mail composer with the given contacts as
157 arguments. 157 arguments.
158 */ 158 */
159 void sendMail( const QString& email ); 159 void sendMail( const QString& email );
160 160
161 161
162 void mailVCard(); 162 void mailVCard();
163 void mailVCard(const QStringList& uids); 163 void mailVCard(const QStringList& uids);
164 164
165 /** 165 /**
166 Starts the preferred web browser with the given URL as argument. 166 Starts the preferred web browser with the given URL as argument.
167 */ 167 */
168 void browse( const QString& url ); 168 void browse( const QString& url );
169 169
170 /** 170 /**
171 Select all contacts in the view. 171 Select all contacts in the view.
172 */ 172 */
173 void selectAllContacts(); 173 void selectAllContacts();
174 174
175 /** 175 /**
176 Deletes all selected contacts from the address book. 176 Deletes all selected contacts from the address book.
177 */ 177 */
178 void deleteContacts(); 178 void deleteContacts();
179 179
180 /** 180 /**
181 Deletes given contacts from the address book. 181 Deletes given contacts from the address book.
182 182
183 @param uids The uids of the contacts, which shall be deleted. 183 @param uids The uids of the contacts, which shall be deleted.
184 */ 184 */
185 void deleteContacts( const QStringList &uids ); 185 void deleteContacts( const QStringList &uids );
186 186
187 /** 187 /**
188 Copys the selected contacts into clipboard for later pasting. 188 Copys the selected contacts into clipboard for later pasting.
189 */ 189 */
190 void copyContacts(); 190 void copyContacts();
191 191
192 /** 192 /**
193 Cuts the selected contacts and stores them for later pasting. 193 Cuts the selected contacts and stores them for later pasting.
194 */ 194 */
195 void cutContacts(); 195 void cutContacts();
196 196
197 /** 197 /**
198 Paste contacts from clipboard into the address book. 198 Paste contacts from clipboard into the address book.
199 */ 199 */
200 void pasteContacts(); 200 void pasteContacts();
201 201
202 /** 202 /**
203 Paste given contacts into the address book. 203 Paste given contacts into the address book.
204 204
205 @param list The list of addressee, which shall be pasted. 205 @param list The list of addressee, which shall be pasted.
206 */ 206 */
207 void pasteContacts( KABC::Addressee::List &list ); 207 void pasteContacts( KABC::Addressee::List &list );
208 208
209 /** 209 /**
210 Sets the whoAmI contact, that is used by many other programs to 210 Sets the whoAmI contact, that is used by many other programs to
211 get personal information about the current user. 211 get personal information about the current user.
212 */ 212 */
213 void setWhoAmI(); 213 void setWhoAmI();
214 214
215 /** 215 /**
216 Displays the category dialog and applies the result to all 216 Displays the category dialog and applies the result to all
217 selected contacts. 217 selected contacts.
218 */ 218 */
219 void setCategories(); 219 void setCategories();
220 220
221 /** 221 /**
222 Sets the field list of the Incremental Search Widget. 222 Sets the field list of the Incremental Search Widget.
223 */ 223 */
224 void setSearchFields( const KABC::Field::List &fields ); 224 void setSearchFields( const KABC::Field::List &fields );
225 225
226 /** 226 /**
227 Search with the current search field for a contact, that matches 227 Search with the current search field for a contact, that matches
228 the given text, and selects it in the view. 228 the given text, and selects it in the view.
229 */ 229 */
230 void incrementalSearch( const QString& text ); 230 void incrementalSearch( const QString& text );
231 231
232 /** 232 /**
233 Marks the address book as modified. 233 Marks the address book as modified.
234 */ 234 */
235 void setModified(); 235 void setModified();
236 /** 236 /**
237 Marks the address book as modified without refreshing the view. 237 Marks the address book as modified without refreshing the view.
238 */ 238 */
239 void setModifiedWOrefresh(); 239 void setModifiedWOrefresh();
240 240
241 /** 241 /**
242 Marks the address book as modified concerning the argument. 242 Marks the address book as modified concerning the argument.
243 */ 243 */
244 void setModified( bool modified ); 244 void setModified( bool modified );
245 245
246 /** 246 /**
247 Returns whether the address book is modified. 247 Returns whether the address book is modified.
248 */ 248 */
249 bool modified() const; 249 bool modified() const;
250 250
251 /** 251 /**
252 Called whenever an contact is modified in the contact editor 252 Called whenever an contact is modified in the contact editor
253 dialog or the quick edit. 253 dialog or the quick edit.
254 */ 254 */
255 void contactModified( const KABC::Addressee &addr ); 255 void contactModified( const KABC::Addressee &addr );
256 256
257 /** 257 /**
258 DCOP METHODS. 258 DCOP METHODS.
259 */ 259 */
260 void addEmail( QString addr ); 260 void addEmail( QString addr );
261 void importVCard( const KURL& url, bool showPreview ); 261 void importVCard( const KURL& url, bool showPreview );
262 void importVCard( const QString& vCard, bool showPreview ); 262 void importVCard( const QString& vCard, bool showPreview );
263 void newContact(); 263 void newContact();
264 QString getNameByPhone( const QString& phone ); 264 QString getNameByPhone( const QString& phone );
265 /** 265 /**
266 END DCOP METHODS 266 END DCOP METHODS
267 */ 267 */
268 268
269 /** 269 /**
270 Saves the contents of the AddressBook back to disk. 270 Saves the contents of the AddressBook back to disk.
271 */ 271 */
272 void save(); 272 void save();
273 273
274 /** 274 /**
275 Undos the last command using the undo stack. 275 Undos the last command using the undo stack.
276 */ 276 */
277 void undo(); 277 void undo();
278 278
279 /** 279 /**
280 Redos the last command that was undone, using the redo stack. 280 Redos the last command that was undone, using the redo stack.
281 */ 281 */
282 void redo(); 282 void redo();
283 283
284 /** 284 /**
285 Shows the edit dialog for the given uid. If the uid is QString::null, 285 Shows the edit dialog for the given uid. If the uid is QString::null,
286 the method will try to find a selected addressee in the view. 286 the method will try to find a selected addressee in the view.
287 */ 287 */
288 void editContact( const QString &uid /*US = QString::null*/ ); 288 void editContact( const QString &uid /*US = QString::null*/ );
289//US added a second method without defaultparameter 289//US added a second method without defaultparameter
290 void editContact2(); 290 void editContact2();
291 291
292 /** 292 /**
293 Launches the configuration dialog. 293 Launches the configuration dialog.
294 */ 294 */
295 void openConfigDialog(); 295 void openConfigDialog();
296 296
297 /** 297 /**
298 Launches the ldap search dialog. 298 Launches the ldap search dialog.
299 */ 299 */
300 void openLDAPDialog(); 300 void openLDAPDialog();
301 301
302 /** 302 /**
303 Creates a KAddressBookPrinter, which will display the print 303 Creates a KAddressBookPrinter, which will display the print
304 dialog and do the printing. 304 dialog and do the printing.
305 */ 305 */
306 void print(); 306 void print();
307 307
308 /** 308 /**
309 Registers a new GUI client, so plugins can register its actions. 309 Registers a new GUI client, so plugins can register its actions.
310 */ 310 */
311 void addGUIClient( KXMLGUIClient *client ); 311 void addGUIClient( KXMLGUIClient *client );
312 312
313 signals: 313 signals:
314 void contactSelected( const QString &name ); 314 void contactSelected( const QString &name );
315 void contactSelected( const QPixmap &pixmap ); 315 void contactSelected( const QPixmap &pixmap );
316 public slots: 316 public slots:
317 void setDetailsVisible( bool visible ); 317 void setDetailsVisible( bool visible );
318 void setDetailsToState(); 318 void setDetailsToState();
319 private slots: 319 private slots:
320 void setJumpButtonBarVisible( bool visible ); 320 void setJumpButtonBarVisible( bool visible );
321 321 void importFromOL();
322 void extensionModified( const KABC::Addressee::List &list ); 322 void extensionModified( const KABC::Addressee::List &list );
323 void clipboardDataChanged(); 323 void clipboardDataChanged();
324 void updateActionMenu(); 324 void updateActionMenu();
325 void configureKeyBindings(); 325 void configureKeyBindings();
326 void removeVoice(); 326 void removeVoice();
327#ifdef KAB_EMBEDDED 327#ifdef KAB_EMBEDDED
328 void configureResources(); 328 void configureResources();
329#endif //KAB_EMBEDDED 329#endif //KAB_EMBEDDED
330 330
331 void slotEditorDestroyed( const QString &uid ); 331 void slotEditorDestroyed( const QString &uid );
332 void configurationChanged(); 332 void configurationChanged();
333 void addressBookChanged(); 333 void addressBookChanged();
334 334
335 private: 335 private:
336 void initGUI(); 336 void initGUI();
337 void initActions(); 337 void initActions();
338 338
339 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 339 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
340 const char *name = 0 ); 340 const char *name = 0 );
341 341
342 KXMLGUIClient *mGUIClient; 342 KXMLGUIClient *mGUIClient;
343 343
344 KABC::AddressBook *mAddressBook; 344 KABC::AddressBook *mAddressBook;
345 345
346 ViewManager *mViewManager; 346 ViewManager *mViewManager;
347 // QSplitter *mDetailsSplitter; 347 // QSplitter *mDetailsSplitter;
348 KDGanttMinimizeSplitter *mExtensionBarSplitter; 348 KDGanttMinimizeSplitter *mExtensionBarSplitter;
349 ViewContainer *mDetails; 349 ViewContainer *mDetails;
350 KDGanttMinimizeSplitter* mMiniSplitter; 350 KDGanttMinimizeSplitter* mMiniSplitter;
351 XXPortManager *mXXPortManager; 351 XXPortManager *mXXPortManager;
352 JumpButtonBar *mJumpButtonBar; 352 JumpButtonBar *mJumpButtonBar;
353 IncSearchWidget *mIncSearchWidget; 353 IncSearchWidget *mIncSearchWidget;
354 ExtensionManager *mExtensionManager; 354 ExtensionManager *mExtensionManager;
355 355
356 KCMultiDialog *mConfigureDialog; 356 KCMultiDialog *mConfigureDialog;
357 357
358#ifndef KAB_EMBEDDED 358#ifndef KAB_EMBEDDED
359 359
360 KCMultiDialog *mConfigureDialog; 360 KCMultiDialog *mConfigureDialog;
361 LDAPSearchDialog *mLdapSearchDialog; 361 LDAPSearchDialog *mLdapSearchDialog;
362#endif //KAB_EMBEDDED 362#endif //KAB_EMBEDDED
363 // QDict<AddresseeEditorDialog> mEditorDict; 363 // QDict<AddresseeEditorDialog> mEditorDict;
364 AddresseeEditorDialog *mEditorDialog; 364 AddresseeEditorDialog *mEditorDialog;
365 bool mReadWrite; 365 bool mReadWrite;
366 bool mModified; 366 bool mModified;
367 bool mIsPart; 367 bool mIsPart;
368 368
369 //US file menu 369 //US file menu
370 KAction *mActionMail; 370 KAction *mActionMail;
371 KAction* mActionPrint; 371 KAction* mActionPrint;
372 KAction* mActionNewContact; 372 KAction* mActionNewContact;
373 KAction *mActionSave; 373 KAction *mActionSave;
374 KAction *mActionEditAddressee; 374 KAction *mActionEditAddressee;
375 KAction *mActionMailVCard; 375 KAction *mActionMailVCard;
376 KAction *mActionQuit; 376 KAction *mActionQuit;
377 377
378 //US edit menu 378 //US edit menu
379 KAction *mActionCopy; 379 KAction *mActionCopy;
380 KAction *mActionCut; 380 KAction *mActionCut;
381 KAction *mActionPaste; 381 KAction *mActionPaste;
382 KAction *mActionSelectAll; 382 KAction *mActionSelectAll;
383 KAction *mActionUndo; 383 KAction *mActionUndo;
384 KAction *mActionRedo; 384 KAction *mActionRedo;
385 KAction *mActionDelete; 385 KAction *mActionDelete;
386 386
387 //US settings menu 387 //US settings menu
388 KAction *mActionConfigResources; 388 KAction *mActionConfigResources;
389 KAction *mActionConfigKAddressbook; 389 KAction *mActionConfigKAddressbook;
390 KAction *mActionConfigShortcuts; 390 KAction *mActionConfigShortcuts;
391 KAction *mActionConfigureToolbars; 391 KAction *mActionConfigureToolbars;
392 KAction *mActionKeyBindings; 392 KAction *mActionKeyBindings;
393 KToggleAction *mActionJumpBar; 393 KToggleAction *mActionJumpBar;
394 KToggleAction *mActionDetails; 394 KToggleAction *mActionDetails;
395 KAction *mActionWhoAmI; 395 KAction *mActionWhoAmI;
396 KAction *mActionCategories; 396 KAction *mActionCategories;
397 KAction *mActionAboutKAddressbook; 397 KAction *mActionAboutKAddressbook;
398 398
399 KAction *mActionDeleteView; 399 KAction *mActionDeleteView;
400 400
401 QPopupMenu *viewMenu; 401 QPopupMenu *viewMenu;
402 QPopupMenu *filterMenu; 402 QPopupMenu *filterMenu;
403 QPopupMenu *settingsMenu; 403 QPopupMenu *settingsMenu;
404 QPopupMenu *changeMenu; 404 QPopupMenu *changeMenu;
405 405
406//US QAction *mActionSave; 406//US QAction *mActionSave;
407 QPopupMenu *ImportMenu; 407 QPopupMenu *ImportMenu;
408 QPopupMenu *ExportMenu; 408 QPopupMenu *ExportMenu;
409 //LR additional methods 409 //LR additional methods
410 KAction *mActionRemoveVoice; 410 KAction *mActionRemoveVoice;
411 KAction * mActionImportOL;
411 412
412#ifndef KAB_EMBEDDED 413#ifndef KAB_EMBEDDED
413 KAddressBookService *mAddressBookService; 414 KAddressBookService *mAddressBookService;
414#endif //KAB_EMBEDDED 415#endif //KAB_EMBEDDED
415 416
416 class KABCorePrivate; 417 class KABCorePrivate;
417 KABCorePrivate *d; 418 KABCorePrivate *d;
418 419
419#ifdef KAB_EMBEDDED 420#ifdef KAB_EMBEDDED
420 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 421 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
421#endif //KAB_EMBEDDED 422#endif //KAB_EMBEDDED
422 423
423}; 424};
424 425
425#endif 426#endif
diff --git a/kaddressbook/kaddressbook.pro b/kaddressbook/kaddressbook.pro
index 761c3e7..bc14e68 100644
--- a/kaddressbook/kaddressbook.pro
+++ b/kaddressbook/kaddressbook.pro
@@ -1,166 +1,177 @@
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/kdeui ../kabc ../ interfaces 9INCLUDEPATH += . ./details ./features ./kcmconfigs ./xxport ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kdeui ../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
30} 31}
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39INTERFACES = \ 40INTERFACES = \
40# filteredit_base.ui \ 41# filteredit_base.ui \
41# kofilterview_base.ui \ 42# kofilterview_base.ui \
42 43
43HEADERS = \ 44HEADERS = \
44features/mergewidget.h \ 45features/mergewidget.h \
45features/distributionlistwidget.h \ 46features/distributionlistwidget.h \
46kcmconfigs/addresseewidget.h \ 47kcmconfigs/addresseewidget.h \
47kcmconfigs/extensionconfigdialog.h \ 48kcmconfigs/extensionconfigdialog.h \
48kcmconfigs/kcmkabconfig.h \ 49kcmconfigs/kcmkabconfig.h \
49kcmconfigs/kabconfigwidget.h \ 50kcmconfigs/kabconfigwidget.h \
50addresseeeditordialog.h \ 51addresseeeditordialog.h \
51addresseeeditorwidget.h \ 52addresseeeditorwidget.h \
52addresseditwidget.h \ 53addresseditwidget.h \
53addresseeconfig.h \ 54addresseeconfig.h \
54addresseeutil.h \ 55addresseeutil.h \
55emaileditwidget.h \ 56emaileditwidget.h \
56filtereditdialog.h \ 57filtereditdialog.h \
57kaddressbookmain.h \ 58kaddressbookmain.h \
58kabprefs.h \ 59kabprefs.h \
59kabcore.h \ 60kabcore.h \
60viewmanager.h \ 61viewmanager.h \
61extensionmanager.h \ 62extensionmanager.h \
62extensionwidget.h \ 63extensionwidget.h \
63kaddressbookview.h \ 64kaddressbookview.h \
64geowidget.h \ 65geowidget.h \
65imagewidget.h \ 66imagewidget.h \
66incsearchwidget.h \ 67incsearchwidget.h \
67jumpbuttonbar.h \ 68jumpbuttonbar.h \
68phoneeditwidget.h \ 69phoneeditwidget.h \
69secrecywidget.h \ 70secrecywidget.h \
70keywidget.h \ 71keywidget.h \
71nameeditdialog.h \ 72nameeditdialog.h \
72filter.h \ 73filter.h \
73addviewdialog.h \ 74addviewdialog.h \
74configurewidget.h \ 75configurewidget.h \
75viewconfigurewidget.h \ 76viewconfigurewidget.h \
76viewconfigurefieldspage.h \ 77viewconfigurefieldspage.h \
77viewconfigurefilterpage.h \ 78viewconfigurefilterpage.h \
78typecombo.h \ 79typecombo.h \
79undo.h \ 80undo.h \
80undocmds.h \ 81undocmds.h \
81xxportmanager.h \ 82xxportmanager.h \
82xxportobject.h \ 83xxportobject.h \
83xxportselectdialog.h \ 84xxportselectdialog.h \
84details/detailsviewcontainer.h \ 85details/detailsviewcontainer.h \
85details/look_basic.h \ 86details/look_basic.h \
86details/look_html.h \ 87details/look_html.h \
87views/kaddressbookiconview.h \ 88views/kaddressbookiconview.h \
88views/kaddressbooktableview.h \ 89views/kaddressbooktableview.h \
89views/kaddressbookcardview.h \ 90views/kaddressbookcardview.h \
90views/configuretableviewdialog.h \ 91views/configuretableviewdialog.h \
91views/configurecardviewdialog.h \ 92views/configurecardviewdialog.h \
92views/cardview.h \ 93views/cardview.h \
93views/colorlistbox.h \ 94views/colorlistbox.h \
94views/contactlistview.h \ 95views/contactlistview.h \
95xxport/vcard_xxport.h \ 96xxport/vcard_xxport.h \
96xxport/kde2_xxport.h \ 97xxport/kde2_xxport.h \
97xxport/csv_xxport.h \ 98xxport/csv_xxport.h \
98xxport/csvimportdialog.h \ 99xxport/csvimportdialog.h \
99#details/look_details.h \ 100#details/look_details.h \
100#mainwindoiw.h \ 101#mainwindoiw.h \
101# alarmclient.h \ 102# alarmclient.h \
102# calendarview.h \ 103# calendarview.h \
103# customlistviewitem.h \ 104# customlistviewitem.h \
104# datenavigator.h 105# datenavigator.h
105 106
106SOURCES = \ 107SOURCES = \
107addresseeeditordialog.cpp \ 108addresseeeditordialog.cpp \
108addresseeeditorwidget.cpp \ 109addresseeeditorwidget.cpp \
109addresseditwidget.cpp \ 110addresseditwidget.cpp \
110addresseeconfig.cpp \ 111addresseeconfig.cpp \
111addresseeutil.cpp \ 112addresseeutil.cpp \
112extensionmanager.cpp \ 113extensionmanager.cpp \
113features/mergewidget.cpp \ 114features/mergewidget.cpp \
114features/distributionlistwidget.cpp \ 115features/distributionlistwidget.cpp \
115kcmconfigs/addresseewidget.cpp \ 116kcmconfigs/addresseewidget.cpp \
116kcmconfigs/extensionconfigdialog.cpp \ 117kcmconfigs/extensionconfigdialog.cpp \
117kcmconfigs/kcmkabconfig.cpp \ 118kcmconfigs/kcmkabconfig.cpp \
118kcmconfigs/kabconfigwidget.cpp \ 119kcmconfigs/kabconfigwidget.cpp \
119emaileditwidget.cpp \ 120emaileditwidget.cpp \
120filtereditdialog.cpp \ 121filtereditdialog.cpp \
121mainembedded.cpp \ 122mainembedded.cpp \
122kaddressbookmain.cpp \ 123kaddressbookmain.cpp \
123kabcore.cpp \ 124kabcore.cpp \
124kabprefs.cpp \ 125kabprefs.cpp \
125viewmanager.cpp \ 126viewmanager.cpp \
126kaddressbookview.cpp \ 127kaddressbookview.cpp \
127extensionwidget.cpp \ 128extensionwidget.cpp \
128geowidget.cpp \ 129geowidget.cpp \
129imagewidget.cpp \ 130imagewidget.cpp \
130incsearchwidget.cpp \ 131incsearchwidget.cpp \
131jumpbuttonbar.cpp \ 132jumpbuttonbar.cpp \
132phoneeditwidget.cpp \ 133phoneeditwidget.cpp \
133secrecywidget.cpp \ 134secrecywidget.cpp \
134keywidget.cpp \ 135keywidget.cpp \
135nameeditdialog.cpp \ 136nameeditdialog.cpp \
136filter.cpp \ 137filter.cpp \
137addviewdialog.cpp \ 138addviewdialog.cpp \
138configurewidget.cpp \ 139configurewidget.cpp \
139viewconfigurewidget.cpp \ 140viewconfigurewidget.cpp \
140viewconfigurefieldspage.cpp \ 141viewconfigurefieldspage.cpp \
141viewconfigurefilterpage.cpp \ 142viewconfigurefilterpage.cpp \
142undo.cpp \ 143undo.cpp \
143undocmds.cpp \ 144undocmds.cpp \
144xxportmanager.cpp \ 145xxportmanager.cpp \
145xxportobject.cpp \ 146xxportobject.cpp \
146xxportselectdialog.cpp \ 147xxportselectdialog.cpp \
147details/detailsviewcontainer.cpp \ 148details/detailsviewcontainer.cpp \
148details/look_basic.cpp \ 149details/look_basic.cpp \
149details/look_html.cpp \ 150details/look_html.cpp \
150views/kaddressbookiconview.cpp \ 151views/kaddressbookiconview.cpp \
151views/kaddressbooktableview.cpp \ 152views/kaddressbooktableview.cpp \
152views/kaddressbookcardview.cpp \ 153views/kaddressbookcardview.cpp \
153views/configuretableviewdialog.cpp \ 154views/configuretableviewdialog.cpp \
154views/configurecardviewdialog.cpp \ 155views/configurecardviewdialog.cpp \
155views/cardview.cpp \ 156views/cardview.cpp \
156views/contactlistview.cpp \ 157views/contactlistview.cpp \
157views/colorlistbox.cpp \ 158views/colorlistbox.cpp \
158xxport/vcard_xxport.cpp \ 159xxport/vcard_xxport.cpp \
159xxport/kde2_xxport.cpp \ 160xxport/kde2_xxport.cpp \
160xxport/csv_xxport.cpp \ 161xxport/csv_xxport.cpp \
161xxport/csvimportdialog.cpp \ 162xxport/csvimportdialog.cpp \
162#details/look_details.cpp \ 163#details/look_details.cpp \
163#mainwindow.cpp \ 164#mainwindow.cpp \
164# calendarview.cpp \ 165# calendarview.cpp \
165# timespanview.cpp 166# timespanview.cpp
166 167
168
169
170win32: {
171HEADERS += ../outport/msoutl9.h \
172 kaimportoldialog.h
173
174SOURCES += ../outport/msoutl9.cpp \
175 kaimportoldialog.cpp
176}
177
diff --git a/kaddressbook/kaimportoldialog.cpp b/kaddressbook/kaimportoldialog.cpp
new file mode 100644
index 0000000..5e7d7c4
--- a/dev/null
+++ b/kaddressbook/kaimportoldialog.cpp
@@ -0,0 +1,635 @@
1/*
2 This file is part of KAddressbook/Pi.
3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23
24#include <qtooltip.h>
25#include <qframe.h>
26#include <qpixmap.h>
27#include <qlayout.h>
28#include <qprogressbar.h>
29#include <qwidgetstack.h>
30#include <qdatetime.h>
31#include <qdir.h>
32#include <qapplication.h>
33#include <qhbox.h>
34#include <qheader.h>
35#include <qdatetime.h>
36#include <qlistview.h>
37
38#include <kdebug.h>
39#include <klocale.h>
40#include <kstandarddirs.h>
41#include <kmessagebox.h>
42#include <kfiledialog.h>
43
44#include <libkdepim/categoryselectdialog.h>
45#include <libkdepim/kinputdialog.h>
46
47#include <libkcal/calendarlocal.h>
48#include <libkcal/icalformat.h>
49
50#include <kabc/addresseelist.h>
51#include <kabc/phonenumber.h>
52
53#include "kaimportoldialog.h"
54
55#include "../outport/msoutl9.h"
56#include <ole2.h>
57#include <comutil.h>
58_Application gOlAppAB;
59
60QDateTime mDdate2Qdtr( DATE dt)
61{
62 COleDateTime odt;
63 SYSTEMTIME st;
64 odt = dt;
65 if ( odt.GetStatus() != 0 )
66 return QDateTime();
67 odt.GetAsSystemTime(st);
68 if ( st.wYear > 4000 ) // this program as a year 4000 bug!
69 return QDateTime();
70 // it seems so, that 1.1.4501 indicates: DATE invalid
71 QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) );
72 return qdt;
73}
74
75class OLEListViewItem : public QCheckListItem
76{
77 public:
78 OLEListViewItem( QListView *parent, QString text ) :
79 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; };
80 OLEListViewItem( QListViewItem *after, QString text ) :
81 QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; };
82 ~OLEListViewItem() {};
83 void setData( DWORD data ) {mData= data; };
84 DWORD data() { return mData ;};
85 private:
86 DWORD mData;
87};
88
89KAImportOLdialog::KAImportOLdialog( const QString &caption,
90 KABC::AddressBook * aBook, QWidget *parent ) :
91 KDialogBase( Plain, caption, User1 | Close, Ok,
92 parent, caption, true, false, i18n("Import!") )
93{
94 QHBox * mw = new QHBox( this );
95 setMainWidget( mw );
96 mListView = new QListView( mw );
97 mListView->addColumn(i18n("Select Folder to import"));
98 mListView->addColumn(i18n("Content Type"));
99 mABook = aBook;
100 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply()));
101 setupFolderView();
102 resize( sizeHint().width()+50, sizeHint().height()+50 );
103}
104
105KAImportOLdialog::~KAImportOLdialog()
106{
107
108}
109
110KABC::Addressee::List KAImportOLdialog::getAddressList()
111{
112 return mAList;
113}
114void KAImportOLdialog::setupFolderView()
115{
116 SCODE sc = ::OleInitialize(NULL);
117 if ( FAILED ( sc ) ) {
118 KMessageBox::information(this,"OLE initialisation failed");
119 return;
120 }
121
122 if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){
123 KMessageBox::information(this,"Sorry, cannot access Outlook");
124 return ;
125 }
126 MAPIFolder mfInbox;
127 MAPIFolder mfRoot;
128 CString szName;
129 _NameSpace olNS;
130 olNS = gOlAppAB.GetNamespace(_T("MAPI"));
131 mfInbox = olNS.GetDefaultFolder(6);
132 mfRoot = mfInbox.GetParent();
133 szName = mfRoot.GetName();
134 long iType = mfRoot.GetDefaultItemType();
135 QString mes;
136 mes = QString::fromUcs2( szName.GetBuffer() );
137 OLEListViewItem * root = new OLEListViewItem( mListView, mes );
138 mfRoot.m_lpDispatch->AddRef();
139 addFolder( root, mfRoot.m_lpDispatch );
140 root->setOpen( true );
141 mListView->setSortColumn( 0 );
142 mListView->sort( );
143}
144
145
146void KAImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent)
147{
148 MAPIFolder mfParent(dispParent), mfChild;
149 _Folders folders;
150 _variant_t fndx((long)0);
151 CString szName;
152 long iType;
153 OLEListViewItem* hChild;
154
155 folders = mfParent.GetFolders();
156 for(int i=1; i <= folders.GetCount(); ++i)
157 {
158 fndx = (long)i;
159 mfChild = folders.Item(fndx.Detach());
160 mfChild.m_lpDispatch->AddRef();
161 szName = mfChild.GetName();
162 iType = mfChild.GetDefaultItemType();
163 hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) );
164 if ( iType != 2)
165 hChild->setEnabled( false );
166 QString ts;
167 switch( iType ) {
168 case 0:
169 ts = i18n("Mail");
170 break;
171 case 1:
172 ts = i18n("Calendar");
173 break;
174 case 2:
175 ts = i18n("Contacts");
176 break;
177 case 3:
178 ts = i18n("Todos");
179 break;
180 case 4:
181 ts = i18n("Journals");
182 break;
183 case 5:
184 ts = i18n("Notes");
185 break;
186 default:
187 ts = i18n("Unknown");
188 }
189 hChild->setText( 1,ts);
190 hChild->setData( (DWORD) mfChild.m_lpDispatch );
191 mfChild.m_lpDispatch->AddRef();
192 addFolder(hChild, mfChild.m_lpDispatch);
193 }
194}
195
196void KAImportOLdialog::slotApply()
197{
198 importedItems = 0;
199 OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild();
200 while ( child ) {
201 if ( child->isOn() )
202 readContactData( child->data() );
203 child = (OLEListViewItem*) child->itemBelow();
204 }
205 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems);
206 KMessageBox::information(this,mes);
207}
208void KAImportOLdialog::readContactData( DWORD folder )
209{
210
211 LPDISPATCH dispItem = (LPDISPATCH)folder;
212 dispItem->AddRef();
213 MAPIFolder mf(dispItem);
214 mf.m_lpDispatch->AddRef();
215 _Items folderItems;
216 _variant_t indx((long)0);
217 LPDISPATCH itm;
218 int i;
219 folderItems = mf.GetItems();
220 QProgressBar bar( folderItems.GetCount(),0 );
221 bar.setCaption (i18n("Importing - close to abort!") );
222 int h = bar.sizeHint().height() ;
223 int w = 300;
224 int dw = QApplication::desktop()->width();
225 int dh = QApplication::desktop()->height();
226 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
227 bar.show();
228 for(i=1; i <= folderItems.GetCount(); ++i)
229 {
230 qApp->processEvents();
231 if ( ! bar.isVisible() )
232 return ;
233 bar.setProgress( i );
234 indx = (long)i;
235 itm = folderItems.Item(indx.Detach());
236 _ContactItem * pItem = (_ContactItem *)&itm;
237 ol2kapiContact( pItem );
238 itm->Release();
239 }
240}
241void KAImportOLdialog::slotOk()
242{
243 QDialog::accept();
244}
245
246void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem )
247{
248 KABC::Addressee addressee;
249
250 addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer()));
251
252 //addressee.setName( const QString &name );
253 //addressee.setFormattedName( const QString &formattedName );
254 addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) );
255 addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) );
256 addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) );
257 addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) );
258 addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) );
259 addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) );
260 QDateTime dtb = mDdate2Qdtr(aItem->GetBirthday());
261 if ( dtb.isValid() )
262 addressee.setBirthday( mDdate2Qdtr(aItem->GetBirthday()));
263
264 //QString::fromUcs2(aItem->.GetBuffer())
265 //addressee.setMailer( const QString &mailer );
266 //addressee.setTimeZone( const TimeZone &timeZone );
267 //addressee.setGeo( const Geo &geo );
268 //addressee.setTitle( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );// titel is the prefix
269 addressee.setRole( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );
270 addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()) );
271 addressee.setNote( QString::fromUcs2(aItem->GetBody().GetBuffer()) );
272
273 addressee.setProductId( QString::fromUcs2(aItem->GetCustomerID().GetBuffer()) );
274 //addressee.setRevision( const QDateTime &revision );
275 // addressee.setSortString( const QString &sortString );
276 addressee.setUrl( QString::fromUcs2(aItem->GetWebPage().GetBuffer()) );
277
278 QString tempS;
279 tempS = QString::fromUcs2(aItem->GetNetMeetingAlias().GetBuffer())+" AT SERVER: " +QString::fromUcs2(aItem->GetNetMeetingServer().GetBuffer());
280 if ( tempS.length() > 12 )
281 addressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", tempS );
282 tempS = QString::fromUcs2(aItem->GetSpouse().GetBuffer());
283 if ( !tempS.isEmpty() )
284 addressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", tempS );
285 tempS = QString::fromUcs2(aItem->GetManagerName().GetBuffer());
286 if ( !tempS.isEmpty() )
287 addressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", tempS );
288 tempS = QString::fromUcs2(aItem->GetAssistantName().GetBuffer());
289 if ( !tempS.isEmpty() )
290 addressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", tempS );
291 tempS = QString::fromUcs2(aItem->GetDepartment().GetBuffer());
292 if ( !tempS.isEmpty() )
293 addressee.insertCustom( "KADDRESSBOOK", "X-Department", tempS );
294 tempS = QString::fromUcs2(aItem->GetOfficeLocation().GetBuffer());
295 if ( !tempS.isEmpty() )
296 addressee.insertCustom( "KADDRESSBOOK", "X-Office",tempS );
297 tempS = QString::fromUcs2(aItem->GetProfession().GetBuffer());
298 if ( !tempS.isEmpty() )
299 addressee.insertCustom( "KADDRESSBOOK", "X-Profession", tempS );
300 dtb = mDdate2Qdtr(aItem->GetAnniversary());
301 if (dtb.isValid() ) {
302 QString dt = KGlobal::locale()->formatDate( dtb.date() , true, KLocale::ISODate);
303 addressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
304 }
305 int sec = aItem->GetSensitivity() ;
306 if ( sec > 1 )// mapping pers -> private
307 --sec;
308 addressee.setSecrecy( sec );
309 //addressee.setLogo( const Picture &logo );
310 //addressee.setPhoto( const Picture &photo );
311 //addressee.setSound( const Sound &sound );
312 //addressee.setAgent( const Agent &agent );
313 QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer());
314 addressee.setCategories( QStringList::split( ";", cat ));
315
316 QString phoneS;
317
318 phoneS = QString::fromUcs2( aItem->GetAssistantTelephoneNumber().GetBuffer());
319 if ( ! phoneS.isEmpty())
320 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Voice ) );
321 phoneS = QString::fromUcs2( aItem->GetBusinessTelephoneNumber().GetBuffer());
322 if ( ! phoneS.isEmpty())
323 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) );
324 phoneS = QString::fromUcs2( aItem->GetBusiness2TelephoneNumber().GetBuffer());
325 if ( ! phoneS.isEmpty())
326 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) );
327 phoneS = QString::fromUcs2( aItem->GetBusinessFaxNumber().GetBuffer());
328 if ( ! phoneS.isEmpty())
329 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Fax ) );
330 phoneS = QString::fromUcs2( aItem->GetCarTelephoneNumber().GetBuffer());
331 if ( ! phoneS.isEmpty())
332 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Car ) );
333 phoneS = QString::fromUcs2( aItem->GetHomeTelephoneNumber().GetBuffer());
334 if ( ! phoneS.isEmpty())
335 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) );
336 phoneS = QString::fromUcs2( aItem->GetHome2TelephoneNumber().GetBuffer());
337 if ( ! phoneS.isEmpty())
338 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) );
339 phoneS = QString::fromUcs2( aItem->GetHomeFaxNumber().GetBuffer());
340 if ( ! phoneS.isEmpty())
341 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home + KABC::PhoneNumber::Fax ) );
342 phoneS = QString::fromUcs2( aItem->GetISDNNumber().GetBuffer());
343 if ( ! phoneS.isEmpty())
344 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Isdn ) );
345 phoneS = QString::fromUcs2( aItem->GetMobileTelephoneNumber().GetBuffer());
346 if ( ! phoneS.isEmpty())
347 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Cell ) );
348 phoneS = QString::fromUcs2( aItem->GetOtherFaxNumber().GetBuffer());
349 if ( ! phoneS.isEmpty())
350 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax ) );
351 phoneS = QString::fromUcs2( aItem->GetOtherTelephoneNumber().GetBuffer());
352 if ( ! phoneS.isEmpty())
353 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice ) );
354 phoneS = QString::fromUcs2( aItem->GetPagerNumber().GetBuffer());
355 if ( ! phoneS.isEmpty())
356 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pager ) );
357 phoneS = QString::fromUcs2( aItem->GetPrimaryTelephoneNumber().GetBuffer());
358 if ( ! phoneS.isEmpty())
359 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pref ) );
360 phoneS = QString::fromUcs2( aItem->GetTTYTDDTelephoneNumber().GetBuffer());
361 if ( ! phoneS.isEmpty())
362 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Modem ) );
363 phoneS = QString::fromUcs2( aItem->GetTelexNumber().GetBuffer());
364 if ( ! phoneS.isEmpty())
365 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax + KABC::PhoneNumber::Bbs ) );
366 phoneS = QString::fromUcs2( aItem->GetCompanyMainTelephoneNumber().GetBuffer());
367 if ( ! phoneS.isEmpty())
368 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Pref ) );
369 phoneS = QString::fromUcs2( aItem->GetRadioTelephoneNumber().GetBuffer());
370 if ( ! phoneS.isEmpty())
371 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Video ) );
372 phoneS = QString::fromUcs2( aItem->GetCallbackTelephoneNumber().GetBuffer());
373 if ( ! phoneS.isEmpty())
374 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice + KABC::PhoneNumber::Pref ) );
375
376 bool preferred = true;
377 phoneS = QString::fromUcs2( aItem->GetEmail1Address().GetBuffer());
378 if ( ! phoneS.isEmpty()) {
379 addressee.insertEmail(phoneS , preferred );
380 preferred = false;
381 }
382 phoneS = QString::fromUcs2( aItem->GetEmail2Address().GetBuffer());
383 if ( ! phoneS.isEmpty()) {
384 addressee.insertEmail(phoneS , preferred );
385 preferred = false;
386 }
387 phoneS = QString::fromUcs2( aItem->GetEmail3Address().GetBuffer());
388 if ( ! phoneS.isEmpty()) {
389 addressee.insertEmail(phoneS , preferred );
390 preferred = false;
391 }
392 // is this the number of the preferred email?
393 //long GetSelectedMailingAddress();???
394
395 KABC::Address addressHome;
396 KABC::Address* addressAdd = &addressHome;
397 bool insert = false;
398 phoneS = QString::fromUcs2( aItem->GetHomeAddressCountry().GetBuffer());
399 if ( ! phoneS.isEmpty()) {
400 addressAdd->setCountry(phoneS );
401 insert = true;
402 }
403 phoneS = QString::fromUcs2( aItem->GetHomeAddressState().GetBuffer());
404 if ( ! phoneS.isEmpty()) {
405 addressAdd->setRegion(phoneS );
406 insert = true;
407 }
408 phoneS = QString::fromUcs2( aItem->GetHomeAddressCity().GetBuffer());
409 if ( ! phoneS.isEmpty()) {
410 addressAdd->setLocality(phoneS );
411 insert = true;
412 }
413 phoneS = QString::fromUcs2( aItem->GetHomeAddressPostalCode().GetBuffer());
414 if ( ! phoneS.isEmpty()) {
415 addressAdd->setPostalCode(phoneS );
416 insert = true;
417 }
418 phoneS = QString::fromUcs2( aItem->GetHomeAddressPostOfficeBox().GetBuffer());
419 if ( ! phoneS.isEmpty()) {
420 addressAdd->setPostOfficeBox(phoneS );
421 insert = true;
422 }
423 phoneS = QString::fromUcs2( aItem->GetHomeAddressStreet().GetBuffer());
424 if ( ! phoneS.isEmpty()) {
425 addressAdd->setStreet(phoneS );
426 insert = true;
427 }
428 phoneS = QString::fromUcs2( aItem->GetHomeAddress().GetBuffer());
429 if ( ! phoneS.isEmpty()) {
430 // redundant !addressAdd->setExtended(phoneS );
431 // insert = true;
432 }
433 addressAdd->setType( KABC::Address::Home );
434 if ( insert )
435 addressee.insertAddress( *addressAdd );
436 // ++++++++++++++++++++++ end of address
437
438 KABC::Address addressWork;
439 addressAdd = &addressWork;
440 insert = false;
441 phoneS = QString::fromUcs2( aItem->GetBusinessAddressCountry().GetBuffer());
442 if ( ! phoneS.isEmpty()) {
443 addressAdd->setCountry(phoneS );
444 insert = true;
445 }
446 phoneS = QString::fromUcs2( aItem->GetBusinessAddressState().GetBuffer());
447 if ( ! phoneS.isEmpty()) {
448 addressAdd->setRegion(phoneS );
449 insert = true;
450 }
451 phoneS = QString::fromUcs2( aItem->GetBusinessAddressCity().GetBuffer());
452 if ( ! phoneS.isEmpty()) {
453 addressAdd->setLocality(phoneS );
454 insert = true;
455 }
456 phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostalCode().GetBuffer());
457 if ( ! phoneS.isEmpty()) {
458 addressAdd->setPostalCode(phoneS );
459 insert = true;
460 }
461 phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostOfficeBox().GetBuffer());
462 if ( ! phoneS.isEmpty()) {
463 addressAdd->setPostOfficeBox(phoneS );
464 insert = true;
465 }
466 phoneS = QString::fromUcs2( aItem->GetBusinessAddressStreet().GetBuffer());
467 if ( ! phoneS.isEmpty()) {
468 addressAdd->setStreet(phoneS );
469 insert = true;
470 }
471 phoneS = QString::fromUcs2( aItem->GetBusinessAddress().GetBuffer());
472 if ( ! phoneS.isEmpty()) {
473 // redundant !addressAdd->setExtended(phoneS );
474 // insert = true;
475 }
476 addressAdd->setType( KABC::Address::Work );
477 if ( insert )
478 addressee.insertAddress( *addressAdd );
479 // ++++++++++++++++++++++ end of address
480
481 KABC::Address addressOther;
482 addressAdd = &addressOther;
483 insert = false;
484 phoneS = QString::fromUcs2( aItem->GetOtherAddressCountry().GetBuffer());
485 if ( ! phoneS.isEmpty()) {
486 addressAdd->setCountry(phoneS );
487 insert = true;
488 }
489 phoneS = QString::fromUcs2( aItem->GetOtherAddressState().GetBuffer());
490 if ( ! phoneS.isEmpty()) {
491 addressAdd->setRegion(phoneS );
492 insert = true;
493 }
494 phoneS = QString::fromUcs2( aItem->GetOtherAddressCity().GetBuffer());
495 if ( ! phoneS.isEmpty()) {
496 addressAdd->setLocality(phoneS );
497 insert = true;
498 }
499 phoneS = QString::fromUcs2( aItem->GetOtherAddressPostalCode().GetBuffer());
500 if ( ! phoneS.isEmpty()) {
501 addressAdd->setPostalCode(phoneS );
502 insert = true;
503 }
504 phoneS = QString::fromUcs2( aItem->GetOtherAddressPostOfficeBox().GetBuffer());
505 if ( ! phoneS.isEmpty()) {
506 addressAdd->setPostOfficeBox(phoneS );
507 insert = true;
508 }
509 phoneS = QString::fromUcs2( aItem->GetOtherAddressStreet().GetBuffer());
510 if ( ! phoneS.isEmpty()) {
511 addressAdd->setStreet(phoneS );
512 insert = true;
513 }
514 phoneS = QString::fromUcs2( aItem->GetOtherAddress().GetBuffer());
515 if ( ! phoneS.isEmpty()) {
516 // redundant !addressAdd->setExtended(phoneS );
517 //insert = true;
518 }
519 //addressAdd->setId( );
520 if ( insert )
521 addressee.insertAddress( *addressAdd );
522 // ++++++++++++++++++++++ end of address
523 KABC::Address addressMail;
524 addressAdd = &addressMail;
525 insert = false;
526 phoneS = QString::fromUcs2( aItem->GetMailingAddressCountry().GetBuffer());
527 if ( ! phoneS.isEmpty()) {
528 addressAdd->setCountry(phoneS );
529 insert = true;
530 }
531 phoneS = QString::fromUcs2( aItem->GetMailingAddressState().GetBuffer());
532 if ( ! phoneS.isEmpty()) {
533 addressAdd->setRegion(phoneS );
534 insert = true;
535 }
536 phoneS = QString::fromUcs2( aItem->GetMailingAddressCity().GetBuffer());
537 if ( ! phoneS.isEmpty()) {
538 addressAdd->setLocality(phoneS );
539 insert = true;
540 }
541 phoneS = QString::fromUcs2( aItem->GetMailingAddressPostalCode().GetBuffer());
542 if ( ! phoneS.isEmpty()) {
543 addressAdd->setPostalCode(phoneS );
544 insert = true;
545 }
546 phoneS = QString::fromUcs2( aItem->GetMailingAddressPostOfficeBox().GetBuffer());
547 if ( ! phoneS.isEmpty()) {
548 addressAdd->setPostOfficeBox(phoneS );
549 insert = true;
550 }
551 phoneS = QString::fromUcs2( aItem->GetMailingAddressStreet().GetBuffer());
552 if ( ! phoneS.isEmpty()) {
553 addressAdd->setStreet(phoneS );
554 insert = true;
555 }
556 phoneS = QString::fromUcs2( aItem->GetMailingAddress().GetBuffer());
557 if ( ! phoneS.isEmpty()) {
558 // redundant ! addressAdd->setExtended(phoneS );
559 // insert = true;
560 }
561 addressAdd->setType( KABC::Address::Postal );
562 if ( insert ) {
563 addressee.insertAddress( *addressAdd );
564 }
565 // the following code is disabled
566 // it does not seem to be useful
567#if 0
568 if ( insert ) {
569 addressAdd->setType( KABC::Address::Home );
570 if ( addressMail == addressHome ) {
571 addressHome.setType( KABC::Address::Postal+ KABC::Address::Home );
572 addressee.insertAddress( addressHome );
573 } else {
574 addressAdd->setType( KABC::Address::Work );
575 if ( addressMail == addressWork ){
576 addressWork.setType( KABC::Address::Postal+ KABC::Address::Work );
577 addressee.insertAddress( addressWork );
578
579 } else {
580 addressAdd->setType( 0 );
581 if ( addressOther == addressMail ){
582 addressOther.setType( KABC::Address::Postal );
583 addressee.insertAddress( addressOther );
584 } else {
585 addressee.insertAddress( *addressAdd );
586 }
587 }
588 }
589 }
590#endif
591 // ++++++++++++++++++++++ end of ALL addresses
592 //GetUserProperties();
593 tempS = QString::fromUcs2(aItem->GetInternetFreeBusyAddress().GetBuffer());
594 if ( !tempS.isEmpty() )
595 addressee.insertCustom( "KADDRESSBOOK", "X-FreeBusyUrl", tempS );
596 tempS = QString::fromUcs2(aItem->GetChildren().GetBuffer());
597 if ( !tempS.isEmpty() )
598 addressee.insertCustom( "KADDRESSBOOK", "X-Children", tempS );
599 int gen = aItem->GetGender();
600 if ( gen != 0 ) { // 0 undef - 1 female - 2 male
601 if ( gen == 1 )
602 addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female" );
603 else
604 addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male" );
605 }
606
607#if 0
608 // pending
609 - IM address: no clue where to get info about the helper ID
610 -custom fields: difficult to implement - not implemented
611 -keys: makes no sense
612#endif
613
614 if ( addAddressee( addressee ))
615 ++importedItems;
616}
617void KAImportOLdialog::slotCancel()
618{
619 reject();
620}
621
622bool KAImportOLdialog::addAddressee( KABC::Addressee a )
623{
624 bool add = true;
625 KABC::Addressee::List::Iterator it;
626 for ( it = mAList.begin(); it != mAList.end(); ++it ) {
627 if ( (*it).uid() == a.uid() ) {
628 add = false;
629 break;
630 }
631 }
632 if ( add )
633 mAList.append ( a );
634 return add;
635}
diff --git a/kaddressbook/kaimportoldialog.h b/kaddressbook/kaimportoldialog.h
new file mode 100644
index 0000000..41ea5f8
--- a/dev/null
+++ b/kaddressbook/kaimportoldialog.h
@@ -0,0 +1,85 @@
1/*
2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23#ifndef KOINCIDENCEEDITOR_H
24#define KOINCIDENCEEDITOR_H
25
26#include <kdialogbase.h>
27
28#include <afxdisp.h>
29
30#include <kabc/addressee.h>
31#include <kabc/addressbook.h>
32
33class QDateTime;
34class QListView;
35class OLEListViewItem;
36class _ContactItem;
37
38
39//using namespace KABC;
40//class KABC::AddressBook;
41
42/**
43 This is the base class for the calendar component editors.
44*/
45class KAImportOLdialog : public KDialogBase
46{
47 Q_OBJECT
48 public:
49 /**
50 Construct new IncidenceEditor.
51 */
52 KAImportOLdialog( const QString &caption, KABC::AddressBook * aBook,
53 QWidget *parent );
54 ~KAImportOLdialog();
55
56 /** Initialize editor. This function creates the tab widgets. */
57 void init();
58 KABC::Addressee::List getAddressList();
59 public slots:
60
61
62 signals:
63
64 protected slots:
65 void slotApply();
66 void slotOk();
67 void slotCancel();
68
69 protected:
70 void setupFolderView();
71 void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent);
72 void readContactData( DWORD folder );
73 void ol2kapiContact( _ContactItem * );
74
75 KABC::AddressBook * mABook;
76 QListView * mListView;
77 KABC::Addressee::List mAList;
78 bool addAddressee( KABC::Addressee a );
79 private:
80 int importedItems;
81};
82
83#endif
84
85