summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/details/look_html.cpp2
-rw-r--r--kaddressbook/kabcore.cpp2
-rw-r--r--kaddressbook/kaddressbookE.pro6
-rw-r--r--kaddressbook/xxportmanager.cpp2
4 files changed, 7 insertions, 5 deletions
diff --git a/kaddressbook/details/look_html.cpp b/kaddressbook/details/look_html.cpp
index 2a70273..63364a7 100644
--- a/kaddressbook/details/look_html.cpp
+++ b/kaddressbook/details/look_html.cpp
@@ -1,45 +1,45 @@
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 <libkdepim/addresseeview.h> 24#include <addresseeview.h>
25 25
26#include "look_html.h" 26#include "look_html.h"
27#include <qscrollview.h> 27#include <qscrollview.h>
28KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) 28KABHtmlView::KABHtmlView( QWidget *parent, const char *name )
29 : KABBasicLook( parent, name ) 29 : KABBasicLook( parent, name )
30{ 30{
31 mView = new KPIM::AddresseeView( this ); 31 mView = new KPIM::AddresseeView( this );
32} 32}
33 33
34KABHtmlView::~KABHtmlView() 34KABHtmlView::~KABHtmlView()
35{ 35{
36} 36}
37 37
38void KABHtmlView::setAddressee( const KABC::Addressee &addr ) 38void KABHtmlView::setAddressee( const KABC::Addressee &addr )
39{ 39{
40 mView->setAddressee( addr ); 40 mView->setAddressee( addr );
41} 41}
42 42
43#ifndef KAB_EMBEDDED 43#ifndef KAB_EMBEDDED
44#include "look_html.moc" 44#include "look_html.moc"
45#endif //KAB_EMBEDDED 45#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index f21507a..32dd43a 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,1615 +1,1615 @@
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/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include "kabcore.h" 31#include "kabcore.h"
32 32
33#include <stdaddressbook.h> 33#include <stdaddressbook.h>
34#include <klocale.h> 34#include <klocale.h>
35 35
36#ifndef KAB_EMBEDDED 36#ifndef KAB_EMBEDDED
37#include <qclipboard.h> 37#include <qclipboard.h>
38#include <qdir.h> 38#include <qdir.h>
39#include <qfile.h> 39#include <qfile.h>
40#include <qapplicaton.h> 40#include <qapplicaton.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qregexp.h> 42#include <qregexp.h>
43#include <qvbox.h> 43#include <qvbox.h>
44#include <kabc/addresseelist.h> 44#include <kabc/addresseelist.h>
45#include <kabc/errorhandler.h> 45#include <kabc/errorhandler.h>
46#include <kabc/resource.h> 46#include <kabc/resource.h>
47#include <kabc/vcardconverter.h> 47#include <kabc/vcardconverter.h>
48#include <kapplication.h> 48#include <kapplication.h>
49#include <kactionclasses.h> 49#include <kactionclasses.h>
50#include <kcmultidialog.h> 50#include <kcmultidialog.h>
51#include <kdebug.h> 51#include <kdebug.h>
52#include <kdeversion.h> 52#include <kdeversion.h>
53#include <kkeydialog.h> 53#include <kkeydialog.h>
54#include <kmessagebox.h> 54#include <kmessagebox.h>
55#include <kprinter.h> 55#include <kprinter.h>
56#include <kprotocolinfo.h> 56#include <kprotocolinfo.h>
57#include <kresources/selectdialog.h> 57#include <kresources/selectdialog.h>
58#include <kstandarddirs.h> 58#include <kstandarddirs.h>
59#include <ktempfile.h> 59#include <ktempfile.h>
60#include <kxmlguiclient.h> 60#include <kxmlguiclient.h>
61#include <kaboutdata.h> 61#include <kaboutdata.h>
62#include <libkdepim/categoryselectdialog.h> 62#include <libkdepim/categoryselectdialog.h>
63 63
64#include "addresseeutil.h" 64#include "addresseeutil.h"
65#include "addresseeeditordialog.h" 65#include "addresseeeditordialog.h"
66#include "extensionmanager.h" 66#include "extensionmanager.h"
67#include "kstdaction.h" 67#include "kstdaction.h"
68#include "kaddressbookservice.h" 68#include "kaddressbookservice.h"
69#include "ldapsearchdialog.h" 69#include "ldapsearchdialog.h"
70#include "printing/printingwizard.h" 70#include "printing/printingwizard.h"
71#else // KAB_EMBEDDED 71#else // KAB_EMBEDDED
72 72
73#include <kapplication.h> 73#include <kapplication.h>
74#include "KDGanttMinimizeSplitter.h" 74#include "KDGanttMinimizeSplitter.h"
75#include "kaddressbookmain.h" 75#include "kaddressbookmain.h"
76#include "kactioncollection.h" 76#include "kactioncollection.h"
77#include "addresseedialog.h" 77#include "addresseedialog.h"
78//US 78//US
79#include <libkdepim/addresseeview.h> 79#include <addresseeview.h>
80 80
81#include <qapp.h> 81#include <qapp.h>
82#include <qmenubar.h> 82#include <qmenubar.h>
83//#include <qtoolbar.h> 83//#include <qtoolbar.h>
84#include <qmessagebox.h> 84#include <qmessagebox.h>
85#include <kdebug.h> 85#include <kdebug.h>
86#include <kiconloader.h> // needed for SmallIcon 86#include <kiconloader.h> // needed for SmallIcon
87#include <kresources/kcmkresources.h> 87#include <kresources/kcmkresources.h>
88#include <ktoolbar.h> 88#include <ktoolbar.h>
89 89
90 90
91//#include <qlabel.h> 91//#include <qlabel.h>
92 92
93 93
94#ifndef DESKTOP_VERSION 94#ifndef DESKTOP_VERSION
95#include <qpe/ir.h> 95#include <qpe/ir.h>
96#include <qpe/qpemenubar.h> 96#include <qpe/qpemenubar.h>
97#include <qtopia/qcopenvelope_qws.h> 97#include <qtopia/qcopenvelope_qws.h>
98#else 98#else
99 99
100#include <qmenubar.h> 100#include <qmenubar.h>
101#endif 101#endif
102 102
103#endif // KAB_EMBEDDED 103#endif // KAB_EMBEDDED
104#include "kcmconfigs/kcmkabconfig.h" 104#include "kcmconfigs/kcmkabconfig.h"
105#include "kcmconfigs/kcmkdepimconfig.h" 105#include "kcmconfigs/kcmkdepimconfig.h"
106#include "kpimglobalprefs.h" 106#include "kpimglobalprefs.h"
107#include "externalapphandler.h" 107#include "externalapphandler.h"
108 108
109 109
110#include <kresources/selectdialog.h> 110#include <kresources/selectdialog.h>
111#include <kmessagebox.h> 111#include <kmessagebox.h>
112 112
113#include <picture.h> 113#include <picture.h>
114#include <resource.h> 114#include <resource.h>
115 115
116//US#include <qsplitter.h> 116//US#include <qsplitter.h>
117#include <qmap.h> 117#include <qmap.h>
118#include <qdir.h> 118#include <qdir.h>
119#include <qfile.h> 119#include <qfile.h>
120#include <qvbox.h> 120#include <qvbox.h>
121#include <qlayout.h> 121#include <qlayout.h>
122#include <qclipboard.h> 122#include <qclipboard.h>
123#include <qtextstream.h> 123#include <qtextstream.h>
124 124
125#include <libkdepim/categoryselectdialog.h> 125#include <libkdepim/categoryselectdialog.h>
126#include <kabc/vcardconverter.h> 126#include <kabc/vcardconverter.h>
127 127
128 128
129#include "addresseeutil.h" 129#include "addresseeutil.h"
130#include "undocmds.h" 130#include "undocmds.h"
131#include "addresseeeditordialog.h" 131#include "addresseeeditordialog.h"
132#include "viewmanager.h" 132#include "viewmanager.h"
133#include "details/detailsviewcontainer.h" 133#include "details/detailsviewcontainer.h"
134#include "kabprefs.h" 134#include "kabprefs.h"
135#include "xxportmanager.h" 135#include "xxportmanager.h"
136#include "incsearchwidget.h" 136#include "incsearchwidget.h"
137#include "jumpbuttonbar.h" 137#include "jumpbuttonbar.h"
138#include "extensionmanager.h" 138#include "extensionmanager.h"
139#include "addresseeconfig.h" 139#include "addresseeconfig.h"
140#include <kcmultidialog.h> 140#include <kcmultidialog.h>
141 141
142#ifdef _WIN32_ 142#ifdef _WIN32_
143 143
144#include "kaimportoldialog.h" 144#include "kaimportoldialog.h"
145#endif 145#endif
146 146
147bool pasteWithNewUid = true; 147bool pasteWithNewUid = true;
148 148
149#ifdef KAB_EMBEDDED 149#ifdef KAB_EMBEDDED
150KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 150KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
151 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 151 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
152 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 152 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
153 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 153 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
154#else //KAB_EMBEDDED 154#else //KAB_EMBEDDED
155KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 155KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
156 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 156 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
157 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 157 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
158 mReadWrite( readWrite ), mModified( false ) 158 mReadWrite( readWrite ), mModified( false )
159#endif //KAB_EMBEDDED 159#endif //KAB_EMBEDDED
160{ 160{
161 161
162 mExtensionBarSplitter = 0; 162 mExtensionBarSplitter = 0;
163 mIsPart = !parent->inherits( "KAddressBookMain" ); 163 mIsPart = !parent->inherits( "KAddressBookMain" );
164 164
165 mAddressBook = KABC::StdAddressBook::self(); 165 mAddressBook = KABC::StdAddressBook::self();
166 KABC::StdAddressBook::setAutomaticSave( false ); 166 KABC::StdAddressBook::setAutomaticSave( false );
167 167
168#ifndef KAB_EMBEDDED 168#ifndef KAB_EMBEDDED
169 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 169 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
170#endif //KAB_EMBEDDED 170#endif //KAB_EMBEDDED
171 171
172 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 172 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
173 SLOT( addressBookChanged() ) ); 173 SLOT( addressBookChanged() ) );
174 174
175 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 175 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
176 "X-Department", "KADDRESSBOOK" ); 176 "X-Department", "KADDRESSBOOK" );
177 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 177 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
178 "X-Profession", "KADDRESSBOOK" ); 178 "X-Profession", "KADDRESSBOOK" );
179 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 179 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
180 "X-AssistantsName", "KADDRESSBOOK" ); 180 "X-AssistantsName", "KADDRESSBOOK" );
181 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 181 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
182 "X-ManagersName", "KADDRESSBOOK" ); 182 "X-ManagersName", "KADDRESSBOOK" );
183 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 183 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
184 "X-SpousesName", "KADDRESSBOOK" ); 184 "X-SpousesName", "KADDRESSBOOK" );
185 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 185 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
186 "X-Office", "KADDRESSBOOK" ); 186 "X-Office", "KADDRESSBOOK" );
187 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 187 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
188 "X-IMAddress", "KADDRESSBOOK" ); 188 "X-IMAddress", "KADDRESSBOOK" );
189 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 189 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
190 "X-Anniversary", "KADDRESSBOOK" ); 190 "X-Anniversary", "KADDRESSBOOK" );
191 191
192 //US added this field to become compatible with Opie/qtopia addressbook 192 //US added this field to become compatible with Opie/qtopia addressbook
193 // values can be "female" or "male" or "". An empty field represents undefined. 193 // values can be "female" or "male" or "". An empty field represents undefined.
194 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 194 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
195 "X-Gender", "KADDRESSBOOK" ); 195 "X-Gender", "KADDRESSBOOK" );
196 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 196 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
197 "X-Children", "KADDRESSBOOK" ); 197 "X-Children", "KADDRESSBOOK" );
198 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 198 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
199 "X-FreeBusyUrl", "KADDRESSBOOK" ); 199 "X-FreeBusyUrl", "KADDRESSBOOK" );
200 200
201 initGUI(); 201 initGUI();
202 202
203 mIncSearchWidget->setFocus(); 203 mIncSearchWidget->setFocus();
204 204
205 205
206 connect( mViewManager, SIGNAL( selected( const QString& ) ), 206 connect( mViewManager, SIGNAL( selected( const QString& ) ),
207 SLOT( setContactSelected( const QString& ) ) ); 207 SLOT( setContactSelected( const QString& ) ) );
208 connect( mViewManager, SIGNAL( executed( const QString& ) ), 208 connect( mViewManager, SIGNAL( executed( const QString& ) ),
209 SLOT( executeContact( const QString& ) ) ); 209 SLOT( executeContact( const QString& ) ) );
210 210
211 connect( mViewManager, SIGNAL( deleteRequest( ) ), 211 connect( mViewManager, SIGNAL( deleteRequest( ) ),
212 SLOT( deleteContacts( ) ) ); 212 SLOT( deleteContacts( ) ) );
213 connect( mViewManager, SIGNAL( modified() ), 213 connect( mViewManager, SIGNAL( modified() ),
214 SLOT( setModified() ) ); 214 SLOT( setModified() ) );
215 215
216 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 216 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
217 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 217 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
218 218
219 connect( mXXPortManager, SIGNAL( modified() ), 219 connect( mXXPortManager, SIGNAL( modified() ),
220 SLOT( setModified() ) ); 220 SLOT( setModified() ) );
221 221
222 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 222 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
223 SLOT( incrementalSearch( const QString& ) ) ); 223 SLOT( incrementalSearch( const QString& ) ) );
224 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 224 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
225 mJumpButtonBar, SLOT( recreateButtons() ) ); 225 mJumpButtonBar, SLOT( recreateButtons() ) );
226 226
227 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 227 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
228 SLOT( sendMail( const QString& ) ) ); 228 SLOT( sendMail( const QString& ) ) );
229 229
230 230
231 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 231 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
232 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 232 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
233 233
234 234
235#ifndef KAB_EMBEDDED 235#ifndef KAB_EMBEDDED
236 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 236 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
237 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 237 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
238 238
239 connect( mDetails, SIGNAL( browse( const QString& ) ), 239 connect( mDetails, SIGNAL( browse( const QString& ) ),
240 SLOT( browse( const QString& ) ) ); 240 SLOT( browse( const QString& ) ) );
241 241
242 242
243 mAddressBookService = new KAddressBookService( this ); 243 mAddressBookService = new KAddressBookService( this );
244 244
245#endif //KAB_EMBEDDED 245#endif //KAB_EMBEDDED
246 mEditorDialog = 0; 246 mEditorDialog = 0;
247 createAddresseeEditorDialog( this ); 247 createAddresseeEditorDialog( this );
248 setModified( false ); 248 setModified( false );
249} 249}
250 250
251KABCore::~KABCore() 251KABCore::~KABCore()
252{ 252{
253 // save(); 253 // save();
254 //saveSettings(); 254 //saveSettings();
255 //KABPrefs::instance()->writeConfig(); 255 //KABPrefs::instance()->writeConfig();
256 delete AddresseeConfig::instance(); 256 delete AddresseeConfig::instance();
257 mAddressBook = 0; 257 mAddressBook = 0;
258 KABC::StdAddressBook::close(); 258 KABC::StdAddressBook::close();
259} 259}
260 260
261void KABCore::restoreSettings() 261void KABCore::restoreSettings()
262{ 262{
263 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 263 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
264 264
265 bool state; 265 bool state;
266 266
267 if (mMultipleViewsAtOnce) 267 if (mMultipleViewsAtOnce)
268 state = KABPrefs::instance()->mDetailsPageVisible; 268 state = KABPrefs::instance()->mDetailsPageVisible;
269 else 269 else
270 state = false; 270 state = false;
271 271
272 mActionDetails->setChecked( state ); 272 mActionDetails->setChecked( state );
273 setDetailsVisible( state ); 273 setDetailsVisible( state );
274 274
275 state = KABPrefs::instance()->mJumpButtonBarVisible; 275 state = KABPrefs::instance()->mJumpButtonBarVisible;
276 276
277 mActionJumpBar->setChecked( state ); 277 mActionJumpBar->setChecked( state );
278 setJumpButtonBarVisible( state ); 278 setJumpButtonBarVisible( state );
279/*US 279/*US
280 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 280 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
281 if ( splitterSize.count() == 0 ) { 281 if ( splitterSize.count() == 0 ) {
282 splitterSize.append( width() / 2 ); 282 splitterSize.append( width() / 2 );
283 splitterSize.append( width() / 2 ); 283 splitterSize.append( width() / 2 );
284 } 284 }
285 mMiniSplitter->setSizes( splitterSize ); 285 mMiniSplitter->setSizes( splitterSize );
286 if ( mExtensionBarSplitter ) { 286 if ( mExtensionBarSplitter ) {
287 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 287 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
288 if ( splitterSize.count() == 0 ) { 288 if ( splitterSize.count() == 0 ) {
289 splitterSize.append( width() / 2 ); 289 splitterSize.append( width() / 2 );
290 splitterSize.append( width() / 2 ); 290 splitterSize.append( width() / 2 );
291 } 291 }
292 mExtensionBarSplitter->setSizes( splitterSize ); 292 mExtensionBarSplitter->setSizes( splitterSize );
293 293
294 } 294 }
295*/ 295*/
296 mViewManager->restoreSettings(); 296 mViewManager->restoreSettings();
297 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 297 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
298 mExtensionManager->restoreSettings(); 298 mExtensionManager->restoreSettings();
299#ifdef DESKTOP_VERSION 299#ifdef DESKTOP_VERSION
300 int wid = width(); 300 int wid = width();
301 if ( wid < 10 ) 301 if ( wid < 10 )
302 wid = 400; 302 wid = 400;
303#else 303#else
304 int wid = QApplication::desktop()->width(); 304 int wid = QApplication::desktop()->width();
305 if ( wid < 640 ) 305 if ( wid < 640 )
306 wid = QApplication::desktop()->height(); 306 wid = QApplication::desktop()->height();
307#endif 307#endif
308 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 308 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
309 if ( true /*splitterSize.count() == 0*/ ) { 309 if ( true /*splitterSize.count() == 0*/ ) {
310 splitterSize.append( wid / 2 ); 310 splitterSize.append( wid / 2 );
311 splitterSize.append( wid / 2 ); 311 splitterSize.append( wid / 2 );
312 } 312 }
313 mMiniSplitter->setSizes( splitterSize ); 313 mMiniSplitter->setSizes( splitterSize );
314 if ( mExtensionBarSplitter ) { 314 if ( mExtensionBarSplitter ) {
315 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 315 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
316 if ( true /*splitterSize.count() == 0*/ ) { 316 if ( true /*splitterSize.count() == 0*/ ) {
317 splitterSize.append( wid / 2 ); 317 splitterSize.append( wid / 2 );
318 splitterSize.append( wid / 2 ); 318 splitterSize.append( wid / 2 );
319 } 319 }
320 mExtensionBarSplitter->setSizes( splitterSize ); 320 mExtensionBarSplitter->setSizes( splitterSize );
321 321
322 } 322 }
323 323
324 324
325} 325}
326 326
327void KABCore::saveSettings() 327void KABCore::saveSettings()
328{ 328{
329 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 329 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
330 if ( mExtensionBarSplitter ) 330 if ( mExtensionBarSplitter )
331 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 331 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
332 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 332 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
333 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 333 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
334#ifndef KAB_EMBEDDED 334#ifndef KAB_EMBEDDED
335 335
336 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 336 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
337 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 337 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
338#endif //KAB_EMBEDDED 338#endif //KAB_EMBEDDED
339 mExtensionManager->saveSettings(); 339 mExtensionManager->saveSettings();
340 mViewManager->saveSettings(); 340 mViewManager->saveSettings();
341 341
342 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 342 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
343} 343}
344 344
345KABC::AddressBook *KABCore::addressBook() const 345KABC::AddressBook *KABCore::addressBook() const
346{ 346{
347 return mAddressBook; 347 return mAddressBook;
348} 348}
349 349
350KConfig *KABCore::config() 350KConfig *KABCore::config()
351{ 351{
352#ifndef KAB_EMBEDDED 352#ifndef KAB_EMBEDDED
353 return KABPrefs::instance()->config(); 353 return KABPrefs::instance()->config();
354#else //KAB_EMBEDDED 354#else //KAB_EMBEDDED
355 return KABPrefs::instance()->getConfig(); 355 return KABPrefs::instance()->getConfig();
356#endif //KAB_EMBEDDED 356#endif //KAB_EMBEDDED
357} 357}
358 358
359KActionCollection *KABCore::actionCollection() const 359KActionCollection *KABCore::actionCollection() const
360{ 360{
361 return mGUIClient->actionCollection(); 361 return mGUIClient->actionCollection();
362} 362}
363 363
364KABC::Field *KABCore::currentSearchField() const 364KABC::Field *KABCore::currentSearchField() const
365{ 365{
366 if (mIncSearchWidget) 366 if (mIncSearchWidget)
367 return mIncSearchWidget->currentField(); 367 return mIncSearchWidget->currentField();
368 else 368 else
369 return 0; 369 return 0;
370} 370}
371 371
372QStringList KABCore::selectedUIDs() const 372QStringList KABCore::selectedUIDs() const
373{ 373{
374 return mViewManager->selectedUids(); 374 return mViewManager->selectedUids();
375} 375}
376 376
377KABC::Resource *KABCore::requestResource( QWidget *parent ) 377KABC::Resource *KABCore::requestResource( QWidget *parent )
378{ 378{
379 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 379 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
380 380
381 QPtrList<KRES::Resource> kresResources; 381 QPtrList<KRES::Resource> kresResources;
382 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 382 QPtrListIterator<KABC::Resource> resIt( kabcResources );
383 KABC::Resource *resource; 383 KABC::Resource *resource;
384 while ( ( resource = resIt.current() ) != 0 ) { 384 while ( ( resource = resIt.current() ) != 0 ) {
385 ++resIt; 385 ++resIt;
386 if ( !resource->readOnly() ) { 386 if ( !resource->readOnly() ) {
387 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 387 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
388 if ( res ) 388 if ( res )
389 kresResources.append( res ); 389 kresResources.append( res );
390 } 390 }
391 } 391 }
392 392
393 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 393 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
394 return static_cast<KABC::Resource*>( res ); 394 return static_cast<KABC::Resource*>( res );
395} 395}
396 396
397#ifndef KAB_EMBEDDED 397#ifndef KAB_EMBEDDED
398KAboutData *KABCore::createAboutData() 398KAboutData *KABCore::createAboutData()
399#else //KAB_EMBEDDED 399#else //KAB_EMBEDDED
400void KABCore::createAboutData() 400void KABCore::createAboutData()
401#endif //KAB_EMBEDDED 401#endif //KAB_EMBEDDED
402{ 402{
403#ifndef KAB_EMBEDDED 403#ifndef KAB_EMBEDDED
404 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 404 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
405 "3.1", I18N_NOOP( "The KDE Address Book" ), 405 "3.1", I18N_NOOP( "The KDE Address Book" ),
406 KAboutData::License_GPL_V2, 406 KAboutData::License_GPL_V2,
407 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 407 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
408 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 408 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
409 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 409 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
410 about->addAuthor( "Cornelius Schumacher", 410 about->addAuthor( "Cornelius Schumacher",
411 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 411 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
412 "schumacher@kde.org" ); 412 "schumacher@kde.org" );
413 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 413 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
414 "mpilone@slac.com" ); 414 "mpilone@slac.com" );
415 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 415 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
416 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 416 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
417 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 417 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
418 "michel@klaralvdalens-datakonsult.se" ); 418 "michel@klaralvdalens-datakonsult.se" );
419 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 419 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
420 "hansen@kde.org" ); 420 "hansen@kde.org" );
421 421
422 return about; 422 return about;
423#endif //KAB_EMBEDDED 423#endif //KAB_EMBEDDED
424 424
425 QString version; 425 QString version;
426#include <../version> 426#include <../version>
427 QMessageBox::about( this, "About KAddressbook/Pi", 427 QMessageBox::about( this, "About KAddressbook/Pi",
428 "KAddressbook/Platform-independent\n" 428 "KAddressbook/Platform-independent\n"
429 "(KA/Pi) " +version + " - " + 429 "(KA/Pi) " +version + " - " +
430#ifdef DESKTOP_VERSION 430#ifdef DESKTOP_VERSION
431 "Desktop Edition\n" 431 "Desktop Edition\n"
432#else 432#else
433 "PDA-Edition\n" 433 "PDA-Edition\n"
434 "for: Zaurus 5500 / 7x0 / 8x0\n" 434 "for: Zaurus 5500 / 7x0 / 8x0\n"
435#endif 435#endif
436 436
437 "(c) 2004 Ulf Schenk\n" 437 "(c) 2004 Ulf Schenk\n"
438 "(c) 2004 Lutz Rogowski\n" 438 "(c) 2004 Lutz Rogowski\n"
439 "(c) 1997-2003, The KDE PIM Team\n" 439 "(c) 1997-2003, The KDE PIM Team\n"
440 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 440 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
441 "Don Sanders Original author\n" 441 "Don Sanders Original author\n"
442 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 442 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
443 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 443 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
444 "Greg Stern DCOP interface\n" 444 "Greg Stern DCOP interface\n"
445 "Mark Westcot Contact pinning\n" 445 "Mark Westcot Contact pinning\n"
446 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 446 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
447 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 447 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
448#ifdef _WIN32_ 448#ifdef _WIN32_
449 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 449 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
450#endif 450#endif
451 ); 451 );
452} 452}
453 453
454void KABCore::setContactSelected( const QString &uid ) 454void KABCore::setContactSelected( const QString &uid )
455{ 455{
456 KABC::Addressee addr = mAddressBook->findByUid( uid ); 456 KABC::Addressee addr = mAddressBook->findByUid( uid );
457 if ( !mDetails->isHidden() ) 457 if ( !mDetails->isHidden() )
458 mDetails->setAddressee( addr ); 458 mDetails->setAddressee( addr );
459 459
460 if ( !addr.isEmpty() ) { 460 if ( !addr.isEmpty() ) {
461 emit contactSelected( addr.formattedName() ); 461 emit contactSelected( addr.formattedName() );
462 KABC::Picture pic = addr.photo(); 462 KABC::Picture pic = addr.photo();
463 if ( pic.isIntern() ) { 463 if ( pic.isIntern() ) {
464//US emit contactSelected( pic.data() ); 464//US emit contactSelected( pic.data() );
465//US instead use: 465//US instead use:
466 QPixmap px; 466 QPixmap px;
467 if (pic.data().isNull() != true) 467 if (pic.data().isNull() != true)
468 { 468 {
469 px.convertFromImage(pic.data()); 469 px.convertFromImage(pic.data());
470 } 470 }
471 471
472 emit contactSelected( px ); 472 emit contactSelected( px );
473 } 473 }
474 } 474 }
475 475
476 476
477 mExtensionManager->setSelectionChanged(); 477 mExtensionManager->setSelectionChanged();
478 478
479 // update the actions 479 // update the actions
480 bool selected = !uid.isEmpty(); 480 bool selected = !uid.isEmpty();
481 481
482 if ( mReadWrite ) { 482 if ( mReadWrite ) {
483 mActionCut->setEnabled( selected ); 483 mActionCut->setEnabled( selected );
484 mActionPaste->setEnabled( selected ); 484 mActionPaste->setEnabled( selected );
485 } 485 }
486 486
487 mActionCopy->setEnabled( selected ); 487 mActionCopy->setEnabled( selected );
488 mActionDelete->setEnabled( selected ); 488 mActionDelete->setEnabled( selected );
489 mActionEditAddressee->setEnabled( selected ); 489 mActionEditAddressee->setEnabled( selected );
490 mActionMail->setEnabled( selected ); 490 mActionMail->setEnabled( selected );
491 mActionMailVCard->setEnabled( selected ); 491 mActionMailVCard->setEnabled( selected );
492 //if (mActionBeam) 492 //if (mActionBeam)
493 //mActionBeam->setEnabled( selected ); 493 //mActionBeam->setEnabled( selected );
494 494
495 if (mActionBeamVCard) 495 if (mActionBeamVCard)
496 mActionBeamVCard->setEnabled( selected ); 496 mActionBeamVCard->setEnabled( selected );
497 497
498 mActionWhoAmI->setEnabled( selected ); 498 mActionWhoAmI->setEnabled( selected );
499 mActionCategories->setEnabled( selected ); 499 mActionCategories->setEnabled( selected );
500} 500}
501 501
502void KABCore::sendMail() 502void KABCore::sendMail()
503{ 503{
504 sendMail( mViewManager->selectedEmails().join( ", " ) ); 504 sendMail( mViewManager->selectedEmails().join( ", " ) );
505} 505}
506 506
507void KABCore::sendMail( const QString& emaillist ) 507void KABCore::sendMail( const QString& emaillist )
508{ 508{
509 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 509 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
510 if (emaillist.contains(",") > 0) 510 if (emaillist.contains(",") > 0)
511 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 511 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
512 else 512 else
513 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 513 ExternalAppHandler::instance()->mailToOneContact( emaillist );
514} 514}
515 515
516 516
517 517
518void KABCore::mailVCard() 518void KABCore::mailVCard()
519{ 519{
520 QStringList uids = mViewManager->selectedUids(); 520 QStringList uids = mViewManager->selectedUids();
521 if ( !uids.isEmpty() ) 521 if ( !uids.isEmpty() )
522 mailVCard( uids ); 522 mailVCard( uids );
523} 523}
524 524
525void KABCore::mailVCard( const QStringList& uids ) 525void KABCore::mailVCard( const QStringList& uids )
526{ 526{
527 QStringList urls; 527 QStringList urls;
528 528
529// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 529// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
530 530
531 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 531 QString dirName = "/tmp/" + KApplication::randomString( 8 );
532 532
533 533
534 534
535 QDir().mkdir( dirName, true ); 535 QDir().mkdir( dirName, true );
536 536
537 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 537 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
538 KABC::Addressee a = mAddressBook->findByUid( *it ); 538 KABC::Addressee a = mAddressBook->findByUid( *it );
539 539
540 if ( a.isEmpty() ) 540 if ( a.isEmpty() )
541 continue; 541 continue;
542 542
543 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 543 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
544 544
545 QString fileName = dirName + "/" + name; 545 QString fileName = dirName + "/" + name;
546 546
547 QFile outFile(fileName); 547 QFile outFile(fileName);
548 548
549 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 549 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
550 KABC::VCardConverter converter; 550 KABC::VCardConverter converter;
551 QString vcard; 551 QString vcard;
552 552
553 converter.addresseeToVCard( a, vcard ); 553 converter.addresseeToVCard( a, vcard );
554 554
555 QTextStream t( &outFile ); // use a text stream 555 QTextStream t( &outFile ); // use a text stream
556 t.setEncoding( QTextStream::UnicodeUTF8 ); 556 t.setEncoding( QTextStream::UnicodeUTF8 );
557 t << vcard; 557 t << vcard;
558 558
559 outFile.close(); 559 outFile.close();
560 560
561 urls.append( fileName ); 561 urls.append( fileName );
562 } 562 }
563 } 563 }
564 564
565 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 565 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
566 566
567 567
568/*US 568/*US
569 kapp->invokeMailer( QString::null, QString::null, QString::null, 569 kapp->invokeMailer( QString::null, QString::null, QString::null,
570 QString::null, // subject 570 QString::null, // subject
571 QString::null, // body 571 QString::null, // body
572 QString::null, 572 QString::null,
573 urls ); // attachments 573 urls ); // attachments
574*/ 574*/
575 575
576} 576}
577 577
578/** 578/**
579 Beams the "WhoAmI contact. 579 Beams the "WhoAmI contact.
580*/ 580*/
581void KABCore::beamMySelf() 581void KABCore::beamMySelf()
582{ 582{
583 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 583 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
584 if (!a.isEmpty()) 584 if (!a.isEmpty())
585 { 585 {
586 QStringList uids; 586 QStringList uids;
587 uids << a.uid(); 587 uids << a.uid();
588 588
589 beamVCard(uids); 589 beamVCard(uids);
590 } else { 590 } else {
591 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 591 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
592 592
593 593
594 } 594 }
595} 595}
596 596
597void KABCore::beamVCard() 597void KABCore::beamVCard()
598{ 598{
599 QStringList uids = mViewManager->selectedUids(); 599 QStringList uids = mViewManager->selectedUids();
600 if ( !uids.isEmpty() ) 600 if ( !uids.isEmpty() )
601 beamVCard( uids ); 601 beamVCard( uids );
602} 602}
603 603
604 604
605void KABCore::beamVCard(const QStringList& uids) 605void KABCore::beamVCard(const QStringList& uids)
606{ 606{
607/*US 607/*US
608 QString beamFilename; 608 QString beamFilename;
609 Opie::OPimContact c; 609 Opie::OPimContact c;
610 if ( actionPersonal->isOn() ) { 610 if ( actionPersonal->isOn() ) {
611 beamFilename = addressbookPersonalVCardName(); 611 beamFilename = addressbookPersonalVCardName();
612 if ( !QFile::exists( beamFilename ) ) 612 if ( !QFile::exists( beamFilename ) )
613 return; // can't beam a non-existent file 613 return; // can't beam a non-existent file
614 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 614 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
615 beamFilename ); 615 beamFilename );
616 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 616 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
617 Opie::OPimContactAccess::List allList = access->allRecords(); 617 Opie::OPimContactAccess::List allList = access->allRecords();
618 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first 618 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
619 c = *it; 619 c = *it;
620 620
621 delete access; 621 delete access;
622 } else { 622 } else {
623 unlink( beamfile ); // delete if exists 623 unlink( beamfile ); // delete if exists
624 mkdir("/tmp/obex/", 0755); 624 mkdir("/tmp/obex/", 0755);
625 c = m_abView -> currentEntry(); 625 c = m_abView -> currentEntry();
626 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 626 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
627 beamfile ); 627 beamfile );
628 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 628 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
629 access->add( c ); 629 access->add( c );
630 access->save(); 630 access->save();
631 delete access; 631 delete access;
632 632
633 beamFilename = beamfile; 633 beamFilename = beamfile;
634 } 634 }
635 635
636 owarn << "Beaming: " << beamFilename << oendl; 636 owarn << "Beaming: " << beamFilename << oendl;
637*/ 637*/
638 638
639#if 0 639#if 0
640 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 640 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
641 641
642 QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); 642 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
643 643
644 QString name = "contact.vcf"; 644 QString name = "contact.vcf";
645 645
646 QString fileName = dirName + "/" + name; 646 QString fileName = dirName + "/" + name;
647#endif 647#endif
648 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory 648 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory
649 // 649 //
650 QString fileName = "/tmp/kapibeamfile.vcf"; 650 QString fileName = "/tmp/kapibeamfile.vcf";
651 651
652 652
653 //QDir().mkdir( dirName, true ); 653 //QDir().mkdir( dirName, true );
654 654
655 655
656 KABC::VCardConverter converter; 656 KABC::VCardConverter converter;
657 QString description; 657 QString description;
658 QString datastream; 658 QString datastream;
659 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 659 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
660 KABC::Addressee a = mAddressBook->findByUid( *it ); 660 KABC::Addressee a = mAddressBook->findByUid( *it );
661 661
662 if ( a.isEmpty() ) 662 if ( a.isEmpty() )
663 continue; 663 continue;
664 664
665 if (description.isEmpty()) 665 if (description.isEmpty())
666 description = a.formattedName(); 666 description = a.formattedName();
667 667
668 QString vcard; 668 QString vcard;
669 converter.addresseeToVCard( a, vcard ); 669 converter.addresseeToVCard( a, vcard );
670 int start = 0; 670 int start = 0;
671 int next; 671 int next;
672 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 672 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
673 int semi = vcard.find(";", next); 673 int semi = vcard.find(";", next);
674 int dopp = vcard.find(":", next); 674 int dopp = vcard.find(":", next);
675 int sep; 675 int sep;
676 if ( semi < dopp && semi >= 0 ) 676 if ( semi < dopp && semi >= 0 )
677 sep = semi ; 677 sep = semi ;
678 else 678 else
679 sep = dopp; 679 sep = dopp;
680 datastream +=vcard.mid( start, next - start); 680 datastream +=vcard.mid( start, next - start);
681 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 681 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
682 start = sep; 682 start = sep;
683 } 683 }
684 datastream += vcard.mid( start,vcard.length() ); 684 datastream += vcard.mid( start,vcard.length() );
685 } 685 }
686#ifndef DESKTOP_VERSION 686#ifndef DESKTOP_VERSION
687 QFile outFile(fileName); 687 QFile outFile(fileName);
688 if ( outFile.open(IO_WriteOnly) ) { 688 if ( outFile.open(IO_WriteOnly) ) {
689 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 689 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
690 QTextStream t( &outFile ); // use a text stream 690 QTextStream t( &outFile ); // use a text stream
691 t.setEncoding( QTextStream::UnicodeUTF8 ); 691 t.setEncoding( QTextStream::UnicodeUTF8 );
692 t <<datastream; 692 t <<datastream;
693 outFile.close(); 693 outFile.close();
694 Ir *ir = new Ir( this ); 694 Ir *ir = new Ir( this );
695 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 695 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
696 ir->send( fileName, description, "text/x-vCard" ); 696 ir->send( fileName, description, "text/x-vCard" );
697 } else { 697 } else {
698 qDebug("Error open temp beam file "); 698 qDebug("Error open temp beam file ");
699 return; 699 return;
700 } 700 }
701#endif 701#endif
702 702
703} 703}
704 704
705void KABCore::beamDone( Ir *ir ) 705void KABCore::beamDone( Ir *ir )
706{ 706{
707#ifndef DESKTOP_VERSION 707#ifndef DESKTOP_VERSION
708 delete ir; 708 delete ir;
709#endif 709#endif
710} 710}
711 711
712 712
713void KABCore::browse( const QString& url ) 713void KABCore::browse( const QString& url )
714{ 714{
715#ifndef KAB_EMBEDDED 715#ifndef KAB_EMBEDDED
716 kapp->invokeBrowser( url ); 716 kapp->invokeBrowser( url );
717#else //KAB_EMBEDDED 717#else //KAB_EMBEDDED
718 qDebug("KABCore::browse must be fixed"); 718 qDebug("KABCore::browse must be fixed");
719#endif //KAB_EMBEDDED 719#endif //KAB_EMBEDDED
720} 720}
721 721
722void KABCore::selectAllContacts() 722void KABCore::selectAllContacts()
723{ 723{
724 mViewManager->setSelected( QString::null, true ); 724 mViewManager->setSelected( QString::null, true );
725} 725}
726 726
727void KABCore::deleteContacts() 727void KABCore::deleteContacts()
728{ 728{
729 QStringList uidList = mViewManager->selectedUids(); 729 QStringList uidList = mViewManager->selectedUids();
730 deleteContacts( uidList ); 730 deleteContacts( uidList );
731} 731}
732 732
733void KABCore::deleteContacts( const QStringList &uids ) 733void KABCore::deleteContacts( const QStringList &uids )
734{ 734{
735 if ( uids.count() > 0 ) { 735 if ( uids.count() > 0 ) {
736 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 736 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
737 UndoStack::instance()->push( command ); 737 UndoStack::instance()->push( command );
738 RedoStack::instance()->clear(); 738 RedoStack::instance()->clear();
739 739
740 // now if we deleted anything, refresh 740 // now if we deleted anything, refresh
741 setContactSelected( QString::null ); 741 setContactSelected( QString::null );
742 setModified( true ); 742 setModified( true );
743 } 743 }
744} 744}
745 745
746void KABCore::copyContacts() 746void KABCore::copyContacts()
747{ 747{
748 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 748 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
749 749
750 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 750 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
751 751
752 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 752 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
753 753
754 QClipboard *cb = QApplication::clipboard(); 754 QClipboard *cb = QApplication::clipboard();
755 cb->setText( clipText ); 755 cb->setText( clipText );
756} 756}
757 757
758void KABCore::cutContacts() 758void KABCore::cutContacts()
759{ 759{
760 QStringList uidList = mViewManager->selectedUids(); 760 QStringList uidList = mViewManager->selectedUids();
761 761
762//US if ( uidList.size() > 0 ) { 762//US if ( uidList.size() > 0 ) {
763 if ( uidList.count() > 0 ) { 763 if ( uidList.count() > 0 ) {
764 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 764 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
765 UndoStack::instance()->push( command ); 765 UndoStack::instance()->push( command );
766 RedoStack::instance()->clear(); 766 RedoStack::instance()->clear();
767 767
768 setModified( true ); 768 setModified( true );
769 } 769 }
770} 770}
771 771
772void KABCore::pasteContacts() 772void KABCore::pasteContacts()
773{ 773{
774 QClipboard *cb = QApplication::clipboard(); 774 QClipboard *cb = QApplication::clipboard();
775 775
776 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 776 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
777 777
778 pasteContacts( list ); 778 pasteContacts( list );
779} 779}
780 780
781void KABCore::pasteContacts( KABC::Addressee::List &list ) 781void KABCore::pasteContacts( KABC::Addressee::List &list )
782{ 782{
783 KABC::Resource *resource = requestResource( this ); 783 KABC::Resource *resource = requestResource( this );
784 KABC::Addressee::List::Iterator it; 784 KABC::Addressee::List::Iterator it;
785 for ( it = list.begin(); it != list.end(); ++it ) 785 for ( it = list.begin(); it != list.end(); ++it )
786 (*it).setResource( resource ); 786 (*it).setResource( resource );
787 787
788 PwPasteCommand *command = new PwPasteCommand( this, list ); 788 PwPasteCommand *command = new PwPasteCommand( this, list );
789 UndoStack::instance()->push( command ); 789 UndoStack::instance()->push( command );
790 RedoStack::instance()->clear(); 790 RedoStack::instance()->clear();
791 791
792 setModified( true ); 792 setModified( true );
793} 793}
794 794
795void KABCore::setWhoAmI() 795void KABCore::setWhoAmI()
796{ 796{
797 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 797 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
798 798
799 if ( addrList.count() > 1 ) { 799 if ( addrList.count() > 1 ) {
800 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 800 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
801 return; 801 return;
802 } 802 }
803 803
804 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 804 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
805 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 805 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
806 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 806 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
807} 807}
808 808
809void KABCore::setCategories() 809void KABCore::setCategories()
810{ 810{
811 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 811 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
812 if ( !dlg.exec() ) 812 if ( !dlg.exec() )
813 return; 813 return;
814 814
815 bool merge = false; 815 bool merge = false;
816 QString msg = i18n( "Merge with existing categories?" ); 816 QString msg = i18n( "Merge with existing categories?" );
817 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 817 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
818 merge = true; 818 merge = true;
819 819
820 QStringList categories = dlg.selectedCategories(); 820 QStringList categories = dlg.selectedCategories();
821 821
822 QStringList uids = mViewManager->selectedUids(); 822 QStringList uids = mViewManager->selectedUids();
823 QStringList::Iterator it; 823 QStringList::Iterator it;
824 for ( it = uids.begin(); it != uids.end(); ++it ) { 824 for ( it = uids.begin(); it != uids.end(); ++it ) {
825 KABC::Addressee addr = mAddressBook->findByUid( *it ); 825 KABC::Addressee addr = mAddressBook->findByUid( *it );
826 if ( !addr.isEmpty() ) { 826 if ( !addr.isEmpty() ) {
827 if ( !merge ) 827 if ( !merge )
828 addr.setCategories( categories ); 828 addr.setCategories( categories );
829 else { 829 else {
830 QStringList addrCategories = addr.categories(); 830 QStringList addrCategories = addr.categories();
831 QStringList::Iterator catIt; 831 QStringList::Iterator catIt;
832 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 832 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
833 if ( !addrCategories.contains( *catIt ) ) 833 if ( !addrCategories.contains( *catIt ) )
834 addrCategories.append( *catIt ); 834 addrCategories.append( *catIt );
835 } 835 }
836 addr.setCategories( addrCategories ); 836 addr.setCategories( addrCategories );
837 } 837 }
838 838
839 mAddressBook->insertAddressee( addr ); 839 mAddressBook->insertAddressee( addr );
840 } 840 }
841 } 841 }
842 842
843 if ( uids.count() > 0 ) 843 if ( uids.count() > 0 )
844 setModified( true ); 844 setModified( true );
845} 845}
846 846
847void KABCore::setSearchFields( const KABC::Field::List &fields ) 847void KABCore::setSearchFields( const KABC::Field::List &fields )
848{ 848{
849 mIncSearchWidget->setFields( fields ); 849 mIncSearchWidget->setFields( fields );
850} 850}
851 851
852void KABCore::incrementalSearch( const QString& text ) 852void KABCore::incrementalSearch( const QString& text )
853{ 853{
854 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 854 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
855} 855}
856 856
857void KABCore::setModified() 857void KABCore::setModified()
858{ 858{
859 setModified( true ); 859 setModified( true );
860} 860}
861 861
862void KABCore::setModifiedWOrefresh() 862void KABCore::setModifiedWOrefresh()
863{ 863{
864 // qDebug("KABCore::setModifiedWOrefresh() "); 864 // qDebug("KABCore::setModifiedWOrefresh() ");
865 mModified = true; 865 mModified = true;
866 mActionSave->setEnabled( mModified ); 866 mActionSave->setEnabled( mModified );
867#ifdef DESKTOP_VERSION 867#ifdef DESKTOP_VERSION
868 mDetails->refreshView(); 868 mDetails->refreshView();
869#endif 869#endif
870 870
871} 871}
872void KABCore::setModified( bool modified ) 872void KABCore::setModified( bool modified )
873{ 873{
874 mModified = modified; 874 mModified = modified;
875 mActionSave->setEnabled( mModified ); 875 mActionSave->setEnabled( mModified );
876 876
877 if ( modified ) 877 if ( modified )
878 mJumpButtonBar->recreateButtons(); 878 mJumpButtonBar->recreateButtons();
879 879
880 mViewManager->refreshView(); 880 mViewManager->refreshView();
881 mDetails->refreshView(); 881 mDetails->refreshView();
882 882
883} 883}
884 884
885bool KABCore::modified() const 885bool KABCore::modified() const
886{ 886{
887 return mModified; 887 return mModified;
888} 888}
889 889
890void KABCore::contactModified( const KABC::Addressee &addr ) 890void KABCore::contactModified( const KABC::Addressee &addr )
891{ 891{
892 892
893 Command *command = 0; 893 Command *command = 0;
894 QString uid; 894 QString uid;
895 895
896 // check if it exists already 896 // check if it exists already
897 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 897 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
898 if ( origAddr.isEmpty() ) 898 if ( origAddr.isEmpty() )
899 command = new PwNewCommand( mAddressBook, addr ); 899 command = new PwNewCommand( mAddressBook, addr );
900 else { 900 else {
901 command = new PwEditCommand( mAddressBook, origAddr, addr ); 901 command = new PwEditCommand( mAddressBook, origAddr, addr );
902 uid = addr.uid(); 902 uid = addr.uid();
903 } 903 }
904 904
905 UndoStack::instance()->push( command ); 905 UndoStack::instance()->push( command );
906 RedoStack::instance()->clear(); 906 RedoStack::instance()->clear();
907 907
908 setModified( true ); 908 setModified( true );
909} 909}
910 910
911void KABCore::newContact() 911void KABCore::newContact()
912{ 912{
913 913
914 914
915 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 915 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
916 916
917 QPtrList<KRES::Resource> kresResources; 917 QPtrList<KRES::Resource> kresResources;
918 QPtrListIterator<KABC::Resource> it( kabcResources ); 918 QPtrListIterator<KABC::Resource> it( kabcResources );
919 KABC::Resource *resource; 919 KABC::Resource *resource;
920 while ( ( resource = it.current() ) != 0 ) { 920 while ( ( resource = it.current() ) != 0 ) {
921 ++it; 921 ++it;
922 if ( !resource->readOnly() ) { 922 if ( !resource->readOnly() ) {
923 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 923 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
924 if ( res ) 924 if ( res )
925 kresResources.append( res ); 925 kresResources.append( res );
926 } 926 }
927 } 927 }
928 928
929 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 929 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
930 resource = static_cast<KABC::Resource*>( res ); 930 resource = static_cast<KABC::Resource*>( res );
931 931
932 if ( resource ) { 932 if ( resource ) {
933 KABC::Addressee addr; 933 KABC::Addressee addr;
934 addr.setResource( resource ); 934 addr.setResource( resource );
935 mEditorDialog->setAddressee( addr ); 935 mEditorDialog->setAddressee( addr );
936 KApplication::execDialog ( mEditorDialog ); 936 KApplication::execDialog ( mEditorDialog );
937 937
938 } else 938 } else
939 return; 939 return;
940 940
941 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 941 // mEditorDict.insert( dialog->addressee().uid(), dialog );
942 942
943 943
944} 944}
945 945
946void KABCore::addEmail( QString aStr ) 946void KABCore::addEmail( QString aStr )
947{ 947{
948#ifndef KAB_EMBEDDED 948#ifndef KAB_EMBEDDED
949 QString fullName, email; 949 QString fullName, email;
950 950
951 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 951 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
952 952
953 // Try to lookup the addressee matching the email address 953 // Try to lookup the addressee matching the email address
954 bool found = false; 954 bool found = false;
955 QStringList emailList; 955 QStringList emailList;
956 KABC::AddressBook::Iterator it; 956 KABC::AddressBook::Iterator it;
957 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 957 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
958 emailList = (*it).emails(); 958 emailList = (*it).emails();
959 if ( emailList.contains( email ) > 0 ) { 959 if ( emailList.contains( email ) > 0 ) {
960 found = true; 960 found = true;
961 (*it).setNameFromString( fullName ); 961 (*it).setNameFromString( fullName );
962 editContact( (*it).uid() ); 962 editContact( (*it).uid() );
963 } 963 }
964 } 964 }
965 965
966 if ( !found ) { 966 if ( !found ) {
967 KABC::Addressee addr; 967 KABC::Addressee addr;
968 addr.setNameFromString( fullName ); 968 addr.setNameFromString( fullName );
969 addr.insertEmail( email, true ); 969 addr.insertEmail( email, true );
970 970
971 mAddressBook->insertAddressee( addr ); 971 mAddressBook->insertAddressee( addr );
972 mViewManager->refreshView( addr.uid() ); 972 mViewManager->refreshView( addr.uid() );
973 editContact( addr.uid() ); 973 editContact( addr.uid() );
974 } 974 }
975#else //KAB_EMBEDDED 975#else //KAB_EMBEDDED
976 qDebug("KABCore::addEmail finsih method"); 976 qDebug("KABCore::addEmail finsih method");
977#endif //KAB_EMBEDDED 977#endif //KAB_EMBEDDED
978} 978}
979 979
980void KABCore::importVCard( const KURL &url, bool showPreview ) 980void KABCore::importVCard( const KURL &url, bool showPreview )
981{ 981{
982 mXXPortManager->importVCard( url, showPreview ); 982 mXXPortManager->importVCard( url, showPreview );
983} 983}
984void KABCore::importFromOL() 984void KABCore::importFromOL()
985{ 985{
986#ifdef _WIN32_ 986#ifdef _WIN32_
987 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 987 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
988 idgl->exec(); 988 idgl->exec();
989 KABC::Addressee::List list = idgl->getAddressList(); 989 KABC::Addressee::List list = idgl->getAddressList();
990 if ( list.count() > 0 ) { 990 if ( list.count() > 0 ) {
991 KABC::Addressee::List listNew; 991 KABC::Addressee::List listNew;
992 KABC::Addressee::List listExisting; 992 KABC::Addressee::List listExisting;
993 KABC::Addressee::List::Iterator it; 993 KABC::Addressee::List::Iterator it;
994 KABC::AddressBook::Iterator iter; 994 KABC::AddressBook::Iterator iter;
995 for ( it = list.begin(); it != list.end(); ++it ) { 995 for ( it = list.begin(); it != list.end(); ++it ) {
996 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 996 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
997 listNew.append( (*it) ); 997 listNew.append( (*it) );
998 else 998 else
999 listExisting.append( (*it) ); 999 listExisting.append( (*it) );
1000 } 1000 }
1001 if ( listExisting.count() > 0 ) 1001 if ( listExisting.count() > 0 )
1002 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1002 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1003 if ( listNew.count() > 0 ) { 1003 if ( listNew.count() > 0 ) {
1004 pasteWithNewUid = false; 1004 pasteWithNewUid = false;
1005 pasteContacts( listNew ); 1005 pasteContacts( listNew );
1006 pasteWithNewUid = true; 1006 pasteWithNewUid = true;
1007 } 1007 }
1008 } 1008 }
1009 delete idgl; 1009 delete idgl;
1010#endif 1010#endif
1011} 1011}
1012 1012
1013void KABCore::importVCard( const QString &vCard, bool showPreview ) 1013void KABCore::importVCard( const QString &vCard, bool showPreview )
1014{ 1014{
1015 mXXPortManager->importVCard( vCard, showPreview ); 1015 mXXPortManager->importVCard( vCard, showPreview );
1016} 1016}
1017 1017
1018//US added a second method without defaultparameter 1018//US added a second method without defaultparameter
1019void KABCore::editContact2() { 1019void KABCore::editContact2() {
1020 editContact( QString::null ); 1020 editContact( QString::null );
1021} 1021}
1022 1022
1023void KABCore::editContact( const QString &uid ) 1023void KABCore::editContact( const QString &uid )
1024{ 1024{
1025 1025
1026 if ( mExtensionManager->isQuickEditVisible() ) 1026 if ( mExtensionManager->isQuickEditVisible() )
1027 return; 1027 return;
1028 1028
1029 // First, locate the contact entry 1029 // First, locate the contact entry
1030 QString localUID = uid; 1030 QString localUID = uid;
1031 if ( localUID.isNull() ) { 1031 if ( localUID.isNull() ) {
1032 QStringList uidList = mViewManager->selectedUids(); 1032 QStringList uidList = mViewManager->selectedUids();
1033 if ( uidList.count() > 0 ) 1033 if ( uidList.count() > 0 )
1034 localUID = *( uidList.at( 0 ) ); 1034 localUID = *( uidList.at( 0 ) );
1035 } 1035 }
1036 1036
1037 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1037 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1038 if ( !addr.isEmpty() ) { 1038 if ( !addr.isEmpty() ) {
1039 mEditorDialog->setAddressee( addr ); 1039 mEditorDialog->setAddressee( addr );
1040 KApplication::execDialog ( mEditorDialog ); 1040 KApplication::execDialog ( mEditorDialog );
1041 } 1041 }
1042} 1042}
1043 1043
1044/** 1044/**
1045 Shows or edits the detail view for the given uid. If the uid is QString::null, 1045 Shows or edits the detail view for the given uid. If the uid is QString::null,
1046 the method will try to find a selected addressee in the view. 1046 the method will try to find a selected addressee in the view.
1047 */ 1047 */
1048void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1048void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1049{ 1049{
1050 if ( mMultipleViewsAtOnce ) 1050 if ( mMultipleViewsAtOnce )
1051 { 1051 {
1052 editContact( uid ); 1052 editContact( uid );
1053 } 1053 }
1054 else 1054 else
1055 { 1055 {
1056 setDetailsVisible( true ); 1056 setDetailsVisible( true );
1057 mActionDetails->setChecked(true); 1057 mActionDetails->setChecked(true);
1058 } 1058 }
1059 1059
1060} 1060}
1061 1061
1062void KABCore::save() 1062void KABCore::save()
1063{ 1063{
1064 if ( !mModified ) 1064 if ( !mModified )
1065 return; 1065 return;
1066 QString text = i18n( "There was an error while attempting to save\n the " 1066 QString text = i18n( "There was an error while attempting to save\n the "
1067 "address book. Please check that some \nother application is " 1067 "address book. Please check that some \nother application is "
1068 "not using it. " ); 1068 "not using it. " );
1069 statusMessage(i18n("Saving addressbook ... ")); 1069 statusMessage(i18n("Saving addressbook ... "));
1070#ifndef KAB_EMBEDDED 1070#ifndef KAB_EMBEDDED
1071 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1071 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1072 if ( !b || !b->save() ) { 1072 if ( !b || !b->save() ) {
1073 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1073 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1074 } 1074 }
1075#else //KAB_EMBEDDED 1075#else //KAB_EMBEDDED
1076 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1076 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1077 if ( !b || !b->save() ) { 1077 if ( !b || !b->save() ) {
1078 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1078 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1079 } 1079 }
1080#endif //KAB_EMBEDDED 1080#endif //KAB_EMBEDDED
1081 1081
1082 statusMessage(i18n("Addressbook saved!")); 1082 statusMessage(i18n("Addressbook saved!"));
1083 setModified( false ); 1083 setModified( false );
1084} 1084}
1085 1085
1086void KABCore::statusMessage(QString mess , int time ) 1086void KABCore::statusMessage(QString mess , int time )
1087{ 1087{
1088 //topLevelWidget()->setCaption( mess ); 1088 //topLevelWidget()->setCaption( mess );
1089 // pending setting timer to revome message 1089 // pending setting timer to revome message
1090} 1090}
1091void KABCore::undo() 1091void KABCore::undo()
1092{ 1092{
1093 UndoStack::instance()->undo(); 1093 UndoStack::instance()->undo();
1094 1094
1095 // Refresh the view 1095 // Refresh the view
1096 mViewManager->refreshView(); 1096 mViewManager->refreshView();
1097} 1097}
1098 1098
1099void KABCore::redo() 1099void KABCore::redo()
1100{ 1100{
1101 RedoStack::instance()->redo(); 1101 RedoStack::instance()->redo();
1102 1102
1103 // Refresh the view 1103 // Refresh the view
1104 mViewManager->refreshView(); 1104 mViewManager->refreshView();
1105} 1105}
1106 1106
1107void KABCore::setJumpButtonBarVisible( bool visible ) 1107void KABCore::setJumpButtonBarVisible( bool visible )
1108{ 1108{
1109 if (mMultipleViewsAtOnce) 1109 if (mMultipleViewsAtOnce)
1110 { 1110 {
1111 if ( visible ) 1111 if ( visible )
1112 mJumpButtonBar->show(); 1112 mJumpButtonBar->show();
1113 else 1113 else
1114 mJumpButtonBar->hide(); 1114 mJumpButtonBar->hide();
1115 } 1115 }
1116 else 1116 else
1117 { 1117 {
1118 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1118 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1119 if (mViewManager->isVisible()) 1119 if (mViewManager->isVisible())
1120 { 1120 {
1121 if ( visible ) 1121 if ( visible )
1122 mJumpButtonBar->show(); 1122 mJumpButtonBar->show();
1123 else 1123 else
1124 mJumpButtonBar->hide(); 1124 mJumpButtonBar->hide();
1125 } 1125 }
1126 else 1126 else
1127 { 1127 {
1128 mJumpButtonBar->hide(); 1128 mJumpButtonBar->hide();
1129 } 1129 }
1130 } 1130 }
1131} 1131}
1132 1132
1133 1133
1134void KABCore::setDetailsToState() 1134void KABCore::setDetailsToState()
1135{ 1135{
1136 setDetailsVisible( mActionDetails->isChecked() ); 1136 setDetailsVisible( mActionDetails->isChecked() );
1137} 1137}
1138 1138
1139 1139
1140 1140
1141void KABCore::setDetailsVisible( bool visible ) 1141void KABCore::setDetailsVisible( bool visible )
1142{ 1142{
1143 if (visible && mDetails->isHidden()) 1143 if (visible && mDetails->isHidden())
1144 { 1144 {
1145 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1145 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1146 if ( addrList.count() > 0 ) 1146 if ( addrList.count() > 0 )
1147 mDetails->setAddressee( addrList[ 0 ] ); 1147 mDetails->setAddressee( addrList[ 0 ] );
1148 } 1148 }
1149 1149
1150 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1150 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1151 // the listview and the detailview. We do that by changing the splitbar size. 1151 // the listview and the detailview. We do that by changing the splitbar size.
1152 if (mMultipleViewsAtOnce) 1152 if (mMultipleViewsAtOnce)
1153 { 1153 {
1154 if ( visible ) 1154 if ( visible )
1155 mDetails->show(); 1155 mDetails->show();
1156 else 1156 else
1157 mDetails->hide(); 1157 mDetails->hide();
1158 } 1158 }
1159 else 1159 else
1160 { 1160 {
1161 if ( visible ) { 1161 if ( visible ) {
1162 mViewManager->hide(); 1162 mViewManager->hide();
1163 mDetails->show(); 1163 mDetails->show();
1164 } 1164 }
1165 else { 1165 else {
1166 mViewManager->show(); 1166 mViewManager->show();
1167 mDetails->hide(); 1167 mDetails->hide();
1168 } 1168 }
1169 setJumpButtonBarVisible( !visible ); 1169 setJumpButtonBarVisible( !visible );
1170 } 1170 }
1171 1171
1172} 1172}
1173 1173
1174void KABCore::extensionChanged( int id ) 1174void KABCore::extensionChanged( int id )
1175{ 1175{
1176 //change the details view only for non desktop systems 1176 //change the details view only for non desktop systems
1177#ifndef DESKTOP_VERSION 1177#ifndef DESKTOP_VERSION
1178 1178
1179 if (id == 0) 1179 if (id == 0)
1180 { 1180 {
1181 //the user disabled the extension. 1181 //the user disabled the extension.
1182 1182
1183 if (mMultipleViewsAtOnce) 1183 if (mMultipleViewsAtOnce)
1184 { // enable detailsview again 1184 { // enable detailsview again
1185 setDetailsVisible( true ); 1185 setDetailsVisible( true );
1186 mActionDetails->setChecked( true ); 1186 mActionDetails->setChecked( true );
1187 } 1187 }
1188 else 1188 else
1189 { //go back to the listview 1189 { //go back to the listview
1190 setDetailsVisible( false ); 1190 setDetailsVisible( false );
1191 mActionDetails->setChecked( false ); 1191 mActionDetails->setChecked( false );
1192 mActionDetails->setEnabled(true); 1192 mActionDetails->setEnabled(true);
1193 } 1193 }
1194 1194
1195 } 1195 }
1196 else 1196 else
1197 { 1197 {
1198 //the user enabled the extension. 1198 //the user enabled the extension.
1199 setDetailsVisible( false ); 1199 setDetailsVisible( false );
1200 mActionDetails->setChecked( false ); 1200 mActionDetails->setChecked( false );
1201 1201
1202 if (!mMultipleViewsAtOnce) 1202 if (!mMultipleViewsAtOnce)
1203 { 1203 {
1204 mActionDetails->setEnabled(false); 1204 mActionDetails->setEnabled(false);
1205 } 1205 }
1206 1206
1207 mExtensionManager->setSelectionChanged(); 1207 mExtensionManager->setSelectionChanged();
1208 1208
1209 } 1209 }
1210 1210
1211#endif// DESKTOP_VERSION 1211#endif// DESKTOP_VERSION
1212 1212
1213} 1213}
1214 1214
1215 1215
1216void KABCore::extensionModified( const KABC::Addressee::List &list ) 1216void KABCore::extensionModified( const KABC::Addressee::List &list )
1217{ 1217{
1218 1218
1219 if ( list.count() != 0 ) { 1219 if ( list.count() != 0 ) {
1220 KABC::Addressee::List::ConstIterator it; 1220 KABC::Addressee::List::ConstIterator it;
1221 for ( it = list.begin(); it != list.end(); ++it ) 1221 for ( it = list.begin(); it != list.end(); ++it )
1222 mAddressBook->insertAddressee( *it ); 1222 mAddressBook->insertAddressee( *it );
1223 if ( list.count() > 1 ) 1223 if ( list.count() > 1 )
1224 setModified(); 1224 setModified();
1225 else 1225 else
1226 setModifiedWOrefresh(); 1226 setModifiedWOrefresh();
1227 } 1227 }
1228 if ( list.count() == 0 ) 1228 if ( list.count() == 0 )
1229 mViewManager->refreshView(); 1229 mViewManager->refreshView();
1230 else 1230 else
1231 mViewManager->refreshView( list[ 0 ].uid() ); 1231 mViewManager->refreshView( list[ 0 ].uid() );
1232 1232
1233 1233
1234 1234
1235} 1235}
1236 1236
1237QString KABCore::getNameByPhone( const QString &phone ) 1237QString KABCore::getNameByPhone( const QString &phone )
1238{ 1238{
1239#ifndef KAB_EMBEDDED 1239#ifndef KAB_EMBEDDED
1240 QRegExp r( "[/*/-/ ]" ); 1240 QRegExp r( "[/*/-/ ]" );
1241 QString localPhone( phone ); 1241 QString localPhone( phone );
1242 1242
1243 bool found = false; 1243 bool found = false;
1244 QString ownerName = ""; 1244 QString ownerName = "";
1245 KABC::AddressBook::Iterator iter; 1245 KABC::AddressBook::Iterator iter;
1246 KABC::PhoneNumber::List::Iterator phoneIter; 1246 KABC::PhoneNumber::List::Iterator phoneIter;
1247 KABC::PhoneNumber::List phoneList; 1247 KABC::PhoneNumber::List phoneList;
1248 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1248 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1249 phoneList = (*iter).phoneNumbers(); 1249 phoneList = (*iter).phoneNumbers();
1250 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1250 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1251 ++phoneIter) { 1251 ++phoneIter) {
1252 // Get rid of separator chars so just the numbers are compared. 1252 // Get rid of separator chars so just the numbers are compared.
1253 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1253 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1254 ownerName = (*iter).formattedName(); 1254 ownerName = (*iter).formattedName();
1255 found = true; 1255 found = true;
1256 } 1256 }
1257 } 1257 }
1258 } 1258 }
1259 1259
1260 return ownerName; 1260 return ownerName;
1261#else //KAB_EMBEDDED 1261#else //KAB_EMBEDDED
1262 qDebug("KABCore::getNameByPhone finsih method"); 1262 qDebug("KABCore::getNameByPhone finsih method");
1263 return ""; 1263 return "";
1264#endif //KAB_EMBEDDED 1264#endif //KAB_EMBEDDED
1265 1265
1266} 1266}
1267 1267
1268void KABCore::openConfigDialog() 1268void KABCore::openConfigDialog()
1269{ 1269{
1270 KABPrefs* kab_prefs = KABPrefs::instance(); 1270 KABPrefs* kab_prefs = KABPrefs::instance();
1271 KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); 1271 KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance();
1272 1272
1273 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1273 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1274 KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1274 KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1275 ConfigureDialog->addModule(kabcfg ); 1275 ConfigureDialog->addModule(kabcfg );
1276 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 1276 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1277 ConfigureDialog->addModule(kdelibcfg ); 1277 ConfigureDialog->addModule(kdelibcfg );
1278 1278
1279 1279
1280 1280
1281 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1281 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1282 this, SLOT( configurationChanged() ) ); 1282 this, SLOT( configurationChanged() ) );
1283 connect( ConfigureDialog, SIGNAL( okClicked() ), 1283 connect( ConfigureDialog, SIGNAL( okClicked() ),
1284 this, SLOT( configurationChanged() ) ); 1284 this, SLOT( configurationChanged() ) );
1285 saveSettings(); 1285 saveSettings();
1286#ifndef DESKTOP_VERSION 1286#ifndef DESKTOP_VERSION
1287 ConfigureDialog->showMaximized(); 1287 ConfigureDialog->showMaximized();
1288#endif 1288#endif
1289 if ( ConfigureDialog->exec() ) 1289 if ( ConfigureDialog->exec() )
1290 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 1290 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1291 delete ConfigureDialog; 1291 delete ConfigureDialog;
1292} 1292}
1293 1293
1294void KABCore::openLDAPDialog() 1294void KABCore::openLDAPDialog()
1295{ 1295{
1296#ifndef KAB_EMBEDDED 1296#ifndef KAB_EMBEDDED
1297 if ( !mLdapSearchDialog ) { 1297 if ( !mLdapSearchDialog ) {
1298 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1298 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1299 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1299 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1300 SLOT( refreshView() ) ); 1300 SLOT( refreshView() ) );
1301 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1301 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1302 SLOT( setModified() ) ); 1302 SLOT( setModified() ) );
1303 } else 1303 } else
1304 mLdapSearchDialog->restoreSettings(); 1304 mLdapSearchDialog->restoreSettings();
1305 1305
1306 if ( mLdapSearchDialog->isOK() ) 1306 if ( mLdapSearchDialog->isOK() )
1307 mLdapSearchDialog->exec(); 1307 mLdapSearchDialog->exec();
1308#else //KAB_EMBEDDED 1308#else //KAB_EMBEDDED
1309 qDebug("KABCore::openLDAPDialog() finsih method"); 1309 qDebug("KABCore::openLDAPDialog() finsih method");
1310#endif //KAB_EMBEDDED 1310#endif //KAB_EMBEDDED
1311} 1311}
1312 1312
1313void KABCore::print() 1313void KABCore::print()
1314{ 1314{
1315#ifndef KAB_EMBEDDED 1315#ifndef KAB_EMBEDDED
1316 KPrinter printer; 1316 KPrinter printer;
1317 if ( !printer.setup( this ) ) 1317 if ( !printer.setup( this ) )
1318 return; 1318 return;
1319 1319
1320 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1320 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1321 mViewManager->selectedUids(), this ); 1321 mViewManager->selectedUids(), this );
1322 1322
1323 wizard.exec(); 1323 wizard.exec();
1324#else //KAB_EMBEDDED 1324#else //KAB_EMBEDDED
1325 qDebug("KABCore::print() finsih method"); 1325 qDebug("KABCore::print() finsih method");
1326#endif //KAB_EMBEDDED 1326#endif //KAB_EMBEDDED
1327 1327
1328} 1328}
1329 1329
1330 1330
1331void KABCore::addGUIClient( KXMLGUIClient *client ) 1331void KABCore::addGUIClient( KXMLGUIClient *client )
1332{ 1332{
1333 if ( mGUIClient ) 1333 if ( mGUIClient )
1334 mGUIClient->insertChildClient( client ); 1334 mGUIClient->insertChildClient( client );
1335 else 1335 else
1336 KMessageBox::error( this, "no KXMLGUICLient"); 1336 KMessageBox::error( this, "no KXMLGUICLient");
1337} 1337}
1338 1338
1339 1339
1340void KABCore::configurationChanged() 1340void KABCore::configurationChanged()
1341{ 1341{
1342 mExtensionManager->reconfigure(); 1342 mExtensionManager->reconfigure();
1343} 1343}
1344 1344
1345void KABCore::addressBookChanged() 1345void KABCore::addressBookChanged()
1346{ 1346{
1347/*US 1347/*US
1348 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1348 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1349 while ( it.current() ) { 1349 while ( it.current() ) {
1350 if ( it.current()->dirty() ) { 1350 if ( it.current()->dirty() ) {
1351 QString text = i18n( "Data has been changed externally. Unsaved " 1351 QString text = i18n( "Data has been changed externally. Unsaved "
1352 "changes will be lost." ); 1352 "changes will be lost." );
1353 KMessageBox::information( this, text ); 1353 KMessageBox::information( this, text );
1354 } 1354 }
1355 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1355 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1356 ++it; 1356 ++it;
1357 } 1357 }
1358*/ 1358*/
1359 if (mEditorDialog) 1359 if (mEditorDialog)
1360 { 1360 {
1361 if (mEditorDialog->dirty()) 1361 if (mEditorDialog->dirty())
1362 { 1362 {
1363 QString text = i18n( "Data has been changed externally. Unsaved " 1363 QString text = i18n( "Data has been changed externally. Unsaved "
1364 "changes will be lost." ); 1364 "changes will be lost." );
1365 KMessageBox::information( this, text ); 1365 KMessageBox::information( this, text );
1366 } 1366 }
1367 QString currentuid = mEditorDialog->addressee().uid(); 1367 QString currentuid = mEditorDialog->addressee().uid();
1368 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1368 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1369 } 1369 }
1370 mViewManager->refreshView(); 1370 mViewManager->refreshView();
1371// mDetails->refreshView(); 1371// mDetails->refreshView();
1372 1372
1373 1373
1374} 1374}
1375 1375
1376AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1376AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1377 const char *name ) 1377 const char *name )
1378{ 1378{
1379 1379
1380 if ( mEditorDialog == 0 ) { 1380 if ( mEditorDialog == 0 ) {
1381 mEditorDialog = new AddresseeEditorDialog( this, parent, 1381 mEditorDialog = new AddresseeEditorDialog( this, parent,
1382 name ? name : "editorDialog" ); 1382 name ? name : "editorDialog" );
1383 1383
1384 1384
1385 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1385 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1386 SLOT( contactModified( const KABC::Addressee& ) ) ); 1386 SLOT( contactModified( const KABC::Addressee& ) ) );
1387 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1387 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1388 // SLOT( slotEditorDestroyed( const QString& ) ) ; 1388 // SLOT( slotEditorDestroyed( const QString& ) ) ;
1389 } 1389 }
1390 1390
1391 return mEditorDialog; 1391 return mEditorDialog;
1392} 1392}
1393 1393
1394void KABCore::slotEditorDestroyed( const QString &uid ) 1394void KABCore::slotEditorDestroyed( const QString &uid )
1395{ 1395{
1396 //mEditorDict.remove( uid ); 1396 //mEditorDict.remove( uid );
1397} 1397}
1398 1398
1399void KABCore::initGUI() 1399void KABCore::initGUI()
1400{ 1400{
1401#ifndef KAB_EMBEDDED 1401#ifndef KAB_EMBEDDED
1402 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1402 QHBoxLayout *topLayout = new QHBoxLayout( this );
1403 topLayout->setSpacing( KDialogBase::spacingHint() ); 1403 topLayout->setSpacing( KDialogBase::spacingHint() );
1404 1404
1405 mExtensionBarSplitter = new QSplitter( this ); 1405 mExtensionBarSplitter = new QSplitter( this );
1406 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1406 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1407 1407
1408 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1408 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1409 1409
1410 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1410 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1411 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1411 mIncSearchWidget = new IncSearchWidget( viewSpace );
1412 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1412 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1413 SLOT( incrementalSearch( const QString& ) ) ); 1413 SLOT( incrementalSearch( const QString& ) ) );
1414 1414
1415 mViewManager = new ViewManager( this, viewSpace ); 1415 mViewManager = new ViewManager( this, viewSpace );
1416 viewSpace->setStretchFactor( mViewManager, 1 ); 1416 viewSpace->setStretchFactor( mViewManager, 1 );
1417 1417
1418 mDetails = new ViewContainer( mDetailsSplitter ); 1418 mDetails = new ViewContainer( mDetailsSplitter );
1419 1419
1420 mJumpButtonBar = new JumpButtonBar( this, this ); 1420 mJumpButtonBar = new JumpButtonBar( this, this );
1421 1421
1422 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1422 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1423 1423
1424 topLayout->addWidget( mExtensionBarSplitter ); 1424 topLayout->addWidget( mExtensionBarSplitter );
1425 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1425 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1426 topLayout->addWidget( mJumpButtonBar ); 1426 topLayout->addWidget( mJumpButtonBar );
1427 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1427 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1428 1428
1429 mXXPortManager = new XXPortManager( this, this ); 1429 mXXPortManager = new XXPortManager( this, this );
1430 1430
1431#else //KAB_EMBEDDED 1431#else //KAB_EMBEDDED
1432 //US initialize viewMenu before settingup viewmanager. 1432 //US initialize viewMenu before settingup viewmanager.
1433 // Viewmanager needs this menu to plugin submenues. 1433 // Viewmanager needs this menu to plugin submenues.
1434 viewMenu = new QPopupMenu( this ); 1434 viewMenu = new QPopupMenu( this );
1435 settingsMenu = new QPopupMenu( this ); 1435 settingsMenu = new QPopupMenu( this );
1436 //filterMenu = new QPopupMenu( this ); 1436 //filterMenu = new QPopupMenu( this );
1437 ImportMenu = new QPopupMenu( this ); 1437 ImportMenu = new QPopupMenu( this );
1438 ExportMenu = new QPopupMenu( this ); 1438 ExportMenu = new QPopupMenu( this );
1439 1439
1440 changeMenu= new QPopupMenu( this ); 1440 changeMenu= new QPopupMenu( this );
1441 1441
1442//US since we have no splitter for the embedded system, setup 1442//US since we have no splitter for the embedded system, setup
1443// a layout with two frames. One left and one right. 1443// a layout with two frames. One left and one right.
1444 1444
1445 QBoxLayout *topLayout; 1445 QBoxLayout *topLayout;
1446 1446
1447 // = new QHBoxLayout( this ); 1447 // = new QHBoxLayout( this );
1448// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1448// QBoxLayout *topLayout = (QBoxLayout*)layout();
1449 1449
1450// QWidget *mainBox = new QWidget( this ); 1450// QWidget *mainBox = new QWidget( this );
1451// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1451// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1452 1452
1453#ifdef DESKTOP_VERSION 1453#ifdef DESKTOP_VERSION
1454 topLayout = new QHBoxLayout( this ); 1454 topLayout = new QHBoxLayout( this );
1455 1455
1456 1456
1457 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1457 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1458 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1458 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1459 1459
1460 topLayout->addWidget(mMiniSplitter ); 1460 topLayout->addWidget(mMiniSplitter );
1461 1461
1462 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1462 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1463 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1463 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1464 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1464 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1465 mDetails = new ViewContainer( mMiniSplitter ); 1465 mDetails = new ViewContainer( mMiniSplitter );
1466 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1466 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1467#else 1467#else
1468 if ( QApplication::desktop()->width() > 480 ) { 1468 if ( QApplication::desktop()->width() > 480 ) {
1469 topLayout = new QHBoxLayout( this ); 1469 topLayout = new QHBoxLayout( this );
1470 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1470 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1471 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1471 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1472 } else { 1472 } else {
1473 1473
1474 topLayout = new QHBoxLayout( this ); 1474 topLayout = new QHBoxLayout( this );
1475 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1475 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1476 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1476 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1477 } 1477 }
1478 1478
1479 topLayout->addWidget(mMiniSplitter ); 1479 topLayout->addWidget(mMiniSplitter );
1480 mViewManager = new ViewManager( this, mMiniSplitter ); 1480 mViewManager = new ViewManager( this, mMiniSplitter );
1481 mDetails = new ViewContainer( mMiniSplitter ); 1481 mDetails = new ViewContainer( mMiniSplitter );
1482 1482
1483 1483
1484 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1484 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1485#endif 1485#endif
1486 //eh->hide(); 1486 //eh->hide();
1487 // topLayout->addWidget(mExtensionManager ); 1487 // topLayout->addWidget(mExtensionManager );
1488 1488
1489 1489
1490/*US 1490/*US
1491#ifndef KAB_NOSPLITTER 1491#ifndef KAB_NOSPLITTER
1492 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1492 QHBoxLayout *topLayout = new QHBoxLayout( this );
1493//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1493//US topLayout->setSpacing( KDialogBase::spacingHint() );
1494 topLayout->setSpacing( 10 ); 1494 topLayout->setSpacing( 10 );
1495 1495
1496 mDetailsSplitter = new QSplitter( this ); 1496 mDetailsSplitter = new QSplitter( this );
1497 1497
1498 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1498 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1499 1499
1500 mViewManager = new ViewManager( this, viewSpace ); 1500 mViewManager = new ViewManager( this, viewSpace );
1501 viewSpace->setStretchFactor( mViewManager, 1 ); 1501 viewSpace->setStretchFactor( mViewManager, 1 );
1502 1502
1503 mDetails = new ViewContainer( mDetailsSplitter ); 1503 mDetails = new ViewContainer( mDetailsSplitter );
1504 1504
1505 topLayout->addWidget( mDetailsSplitter ); 1505 topLayout->addWidget( mDetailsSplitter );
1506 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1506 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1507#else //KAB_NOSPLITTER 1507#else //KAB_NOSPLITTER
1508 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1508 QHBoxLayout *topLayout = new QHBoxLayout( this );
1509//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1509//US topLayout->setSpacing( KDialogBase::spacingHint() );
1510 topLayout->setSpacing( 10 ); 1510 topLayout->setSpacing( 10 );
1511 1511
1512// mDetailsSplitter = new QSplitter( this ); 1512// mDetailsSplitter = new QSplitter( this );
1513 1513
1514 QVBox *viewSpace = new QVBox( this ); 1514 QVBox *viewSpace = new QVBox( this );
1515 1515
1516 mViewManager = new ViewManager( this, viewSpace ); 1516 mViewManager = new ViewManager( this, viewSpace );
1517 viewSpace->setStretchFactor( mViewManager, 1 ); 1517 viewSpace->setStretchFactor( mViewManager, 1 );
1518 1518
1519 mDetails = new ViewContainer( this ); 1519 mDetails = new ViewContainer( this );
1520 1520
1521 topLayout->addWidget( viewSpace ); 1521 topLayout->addWidget( viewSpace );
1522// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1522// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1523 topLayout->addWidget( mDetails ); 1523 topLayout->addWidget( mDetails );
1524#endif //KAB_NOSPLITTER 1524#endif //KAB_NOSPLITTER
1525*/ 1525*/
1526 1526
1527 1527
1528#endif //KAB_EMBEDDED 1528#endif //KAB_EMBEDDED
1529 initActions(); 1529 initActions();
1530 1530
1531#ifdef KAB_EMBEDDED 1531#ifdef KAB_EMBEDDED
1532 addActionsManually(); 1532 addActionsManually();
1533 //US make sure the export and import menues are initialized before creating the xxPortManager. 1533 //US make sure the export and import menues are initialized before creating the xxPortManager.
1534 mXXPortManager = new XXPortManager( this, this ); 1534 mXXPortManager = new XXPortManager( this, this );
1535 1535
1536 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1536 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1537 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1537 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1538 // mActionQuit->plug ( mMainWindow->toolBar()); 1538 // mActionQuit->plug ( mMainWindow->toolBar());
1539 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1539 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1540 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1540 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1541 // mIncSearchWidget->hide(); 1541 // mIncSearchWidget->hide();
1542 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1542 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1543 SLOT( incrementalSearch( const QString& ) ) ); 1543 SLOT( incrementalSearch( const QString& ) ) );
1544 1544
1545 1545
1546 mJumpButtonBar = new JumpButtonBar( this, this ); 1546 mJumpButtonBar = new JumpButtonBar( this, this );
1547 1547
1548 topLayout->addWidget( mJumpButtonBar ); 1548 topLayout->addWidget( mJumpButtonBar );
1549//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1549//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1550 1550
1551// mMainWindow->getIconToolBar()->raise(); 1551// mMainWindow->getIconToolBar()->raise();
1552 1552
1553#endif //KAB_EMBEDDED 1553#endif //KAB_EMBEDDED
1554 1554
1555} 1555}
1556void KABCore::initActions() 1556void KABCore::initActions()
1557{ 1557{
1558//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1558//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1559 1559
1560#ifndef KAB_EMBEDDED 1560#ifndef KAB_EMBEDDED
1561 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1561 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1562 SLOT( clipboardDataChanged() ) ); 1562 SLOT( clipboardDataChanged() ) );
1563#endif //KAB_EMBEDDED 1563#endif //KAB_EMBEDDED
1564 1564
1565 // file menu 1565 // file menu
1566 if ( mIsPart ) { 1566 if ( mIsPart ) {
1567 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1567 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1568 SLOT( sendMail() ), actionCollection(), 1568 SLOT( sendMail() ), actionCollection(),
1569 "kaddressbook_mail" ); 1569 "kaddressbook_mail" );
1570 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1570 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1571 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1571 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1572 1572
1573 } else { 1573 } else {
1574 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1574 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1575 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1575 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1576 } 1576 }
1577 1577
1578 1578
1579 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1579 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1580 SLOT( save() ), actionCollection(), "file_sync" ); 1580 SLOT( save() ), actionCollection(), "file_sync" );
1581 1581
1582 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1582 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1583 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1583 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1584 1584
1585 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1585 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1586 this, SLOT( mailVCard() ), 1586 this, SLOT( mailVCard() ),
1587 actionCollection(), "file_mail_vcard"); 1587 actionCollection(), "file_mail_vcard");
1588 1588
1589 mActionBeamVCard = 0; 1589 mActionBeamVCard = 0;
1590 mActionBeam = 0; 1590 mActionBeam = 0;
1591 1591
1592#ifndef DESKTOP_VERSION 1592#ifndef DESKTOP_VERSION
1593 if ( Ir::supported() ) { 1593 if ( Ir::supported() ) {
1594 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1594 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1595 SLOT( beamVCard() ), actionCollection(), 1595 SLOT( beamVCard() ), actionCollection(),
1596 "kaddressbook_beam_vcard" ); 1596 "kaddressbook_beam_vcard" );
1597 1597
1598 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1598 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1599 SLOT( beamMySelf() ), actionCollection(), 1599 SLOT( beamMySelf() ), actionCollection(),
1600 "kaddressbook_beam_myself" ); 1600 "kaddressbook_beam_myself" );
1601 } 1601 }
1602#endif 1602#endif
1603 1603
1604 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1604 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1605 this, SLOT( editContact2() ), 1605 this, SLOT( editContact2() ),
1606 actionCollection(), "file_properties" ); 1606 actionCollection(), "file_properties" );
1607 1607
1608#ifdef KAB_EMBEDDED 1608#ifdef KAB_EMBEDDED
1609 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1609 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1610 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1610 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1611 mMainWindow, SLOT( exit() ), 1611 mMainWindow, SLOT( exit() ),
1612 actionCollection(), "quit" ); 1612 actionCollection(), "quit" );
1613#endif //KAB_EMBEDDED 1613#endif //KAB_EMBEDDED
1614 1614
1615 // edit menu 1615 // edit menu
diff --git a/kaddressbook/kaddressbookE.pro b/kaddressbook/kaddressbookE.pro
index 1c9eeef..c027895 100644
--- a/kaddressbook/kaddressbookE.pro
+++ b/kaddressbook/kaddressbookE.pro
@@ -1,159 +1,161 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3 3
4 4
5 TARGET = kapi 5 TARGET = kapi
6OBJECTS_DIR = obj/$(PLATFORM) 6OBJECTS_DIR = obj/$(PLATFORM)
7MOC_DIR = moc/$(PLATFORM) 7MOC_DIR = moc/$(PLATFORM)
8DESTDIR=$(QPEDIR)/bin 8DESTDIR=$(QPEDIR)/bin
9 9
10INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include 10INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include
11DEFINES += KAB_EMBEDDED KAB_NOSPLITTER 11DEFINES += KAB_EMBEDDED KAB_NOSPLITTER
12#DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL 12#DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL
13#DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER 13#DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
14#DEFINES += KORG_NOLVALTERNATION 14#DEFINES += KORG_NOLVALTERNATION
15LIBS += -lmicrokdepim 15#LIBS += -lmicrokdepim
16LIBS += -lmicrokcal 16#LIBS += -lmicrokcal
17LIBS += -lmicrokde 17LIBS += -lmicrokde
18LIBS += -lmicroqtcompat 18LIBS += -lmicroqtcompat
19LIBS += -lmicrokabc 19LIBS += -lmicrokabc
20LIBS += -lqpe 20LIBS += -lqpe
21LIBS += -ljpeg 21LIBS += -ljpeg
22LIBS += $(QTOPIALIB) 22LIBS += $(QTOPIALIB)
23LIBS += -L$(QPEDIR)/lib 23LIBS += -L$(QPEDIR)/lib
24LIBS += -Wl,-export-dynamic 24LIBS += -Wl,-export-dynamic
25LIBS += $(GCC3EXTRALIB1)
26LIBS += $(GCC3EXTRALIB2)
25 27
26INTERFACES = \ 28INTERFACES = \
27# filteredit_base.ui \ 29# filteredit_base.ui \
28# kofilterview_base.ui \ 30# kofilterview_base.ui \
29 31
30HEADERS = \ 32HEADERS = \
31features/mergewidget.h \ 33features/mergewidget.h \
32features/distributionlistwidget.h \ 34features/distributionlistwidget.h \
33kcmconfigs/addresseewidget.h \ 35kcmconfigs/addresseewidget.h \
34kcmconfigs/extensionconfigdialog.h \ 36kcmconfigs/extensionconfigdialog.h \
35kcmconfigs/kcmkabconfig.h \ 37kcmconfigs/kcmkabconfig.h \
36kcmconfigs/kabconfigwidget.h \ 38kcmconfigs/kabconfigwidget.h \
37addresseeeditordialog.h \ 39addresseeeditordialog.h \
38addresseeeditorwidget.h \ 40addresseeeditorwidget.h \
39addresseditwidget.h \ 41addresseditwidget.h \
40addresseeconfig.h \ 42addresseeconfig.h \
41addresseeutil.h \ 43addresseeutil.h \
42emaileditwidget.h \ 44emaileditwidget.h \
43filtereditdialog.h \ 45filtereditdialog.h \
44kaddressbookmain.h \ 46kaddressbookmain.h \
45kabprefs.h \ 47kabprefs.h \
46kabcore.h \ 48kabcore.h \
47viewmanager.h \ 49viewmanager.h \
48extensionmanager.h \ 50extensionmanager.h \
49extensionwidget.h \ 51extensionwidget.h \
50kaddressbookview.h \ 52kaddressbookview.h \
51geowidget.h \ 53geowidget.h \
52imagewidget.h \ 54imagewidget.h \
53incsearchwidget.h \ 55incsearchwidget.h \
54jumpbuttonbar.h \ 56jumpbuttonbar.h \
55phoneeditwidget.h \ 57phoneeditwidget.h \
56secrecywidget.h \ 58secrecywidget.h \
57keywidget.h \ 59keywidget.h \
58nameeditdialog.h \ 60nameeditdialog.h \
59filter.h \ 61filter.h \
60addviewdialog.h \ 62addviewdialog.h \
61configurewidget.h \ 63configurewidget.h \
62viewconfigurewidget.h \ 64viewconfigurewidget.h \
63viewconfigurefieldspage.h \ 65viewconfigurefieldspage.h \
64viewconfigurefilterpage.h \ 66viewconfigurefilterpage.h \
65typecombo.h \ 67typecombo.h \
66undo.h \ 68undo.h \
67undocmds.h \ 69undocmds.h \
68xxportmanager.h \ 70xxportmanager.h \
69xxportobject.h \ 71xxportobject.h \
70xxportselectdialog.h \ 72xxportselectdialog.h \
71details/detailsviewcontainer.h \ 73details/detailsviewcontainer.h \
72details/look_basic.h \ 74details/look_basic.h \
73details/look_html.h \ 75details/look_html.h \
74views/kaddressbookiconview.h \ 76views/kaddressbookiconview.h \
75views/kaddressbooktableview.h \ 77views/kaddressbooktableview.h \
76views/kaddressbookcardview.h \ 78views/kaddressbookcardview.h \
77views/configuretableviewdialog.h \ 79views/configuretableviewdialog.h \
78views/configurecardviewdialog.h \ 80views/configurecardviewdialog.h \
79views/cardview.h \ 81views/cardview.h \
80views/colorlistbox.h \ 82views/colorlistbox.h \
81views/contactlistview.h \ 83views/contactlistview.h \
82xxport/vcard_xxport.h \ 84xxport/vcard_xxport.h \
83xxport/kde2_xxport.h \ 85xxport/kde2_xxport.h \
84xxport/csv_xxport.h \ 86xxport/csv_xxport.h \
85xxport/csvimportdialog.h \ 87xxport/csvimportdialog.h \
86xxport/opie_xxport.h \ 88xxport/opie_xxport.h \
87xxport/qtopia_xxport.h \ 89xxport/qtopia_xxport.h \
88xxport/sharpdtm_xxport.h \ 90xxport/sharpdtm_xxport.h \
89#details/look_details.h \ 91#details/look_details.h \
90#mainwindoiw.h \ 92#mainwindoiw.h \
91# alarmclient.h \ 93# alarmclient.h \
92# calendarview.h \ 94# calendarview.h \
93# customlistviewitem.h \ 95# customlistviewitem.h \
94# datenavigator.h 96# datenavigator.h
95 97
96SOURCES = \ 98SOURCES = \
97addresseeeditordialog.cpp \ 99addresseeeditordialog.cpp \
98addresseeeditorwidget.cpp \ 100addresseeeditorwidget.cpp \
99addresseditwidget.cpp \ 101addresseditwidget.cpp \
100addresseeconfig.cpp \ 102addresseeconfig.cpp \
101addresseeutil.cpp \ 103addresseeutil.cpp \
102extensionmanager.cpp \ 104extensionmanager.cpp \
103features/mergewidget.cpp \ 105features/mergewidget.cpp \
104features/distributionlistwidget.cpp \ 106features/distributionlistwidget.cpp \
105kcmconfigs/addresseewidget.cpp \ 107kcmconfigs/addresseewidget.cpp \
106kcmconfigs/extensionconfigdialog.cpp \ 108kcmconfigs/extensionconfigdialog.cpp \
107kcmconfigs/kcmkabconfig.cpp \ 109kcmconfigs/kcmkabconfig.cpp \
108kcmconfigs/kabconfigwidget.cpp \ 110kcmconfigs/kabconfigwidget.cpp \
109emaileditwidget.cpp \ 111emaileditwidget.cpp \
110filtereditdialog.cpp \ 112filtereditdialog.cpp \
111mainembedded.cpp \ 113mainembedded.cpp \
112kaddressbookmain.cpp \ 114kaddressbookmain.cpp \
113kabcore.cpp \ 115kabcore.cpp \
114kabprefs.cpp \ 116kabprefs.cpp \
115viewmanager.cpp \ 117viewmanager.cpp \
116kaddressbookview.cpp \ 118kaddressbookview.cpp \
117extensionwidget.cpp \ 119extensionwidget.cpp \
118geowidget.cpp \ 120geowidget.cpp \
119imagewidget.cpp \ 121imagewidget.cpp \
120incsearchwidget.cpp \ 122incsearchwidget.cpp \
121jumpbuttonbar.cpp \ 123jumpbuttonbar.cpp \
122phoneeditwidget.cpp \ 124phoneeditwidget.cpp \
123secrecywidget.cpp \ 125secrecywidget.cpp \
124keywidget.cpp \ 126keywidget.cpp \
125nameeditdialog.cpp \ 127nameeditdialog.cpp \
126filter.cpp \ 128filter.cpp \
127addviewdialog.cpp \ 129addviewdialog.cpp \
128configurewidget.cpp \ 130configurewidget.cpp \
129viewconfigurewidget.cpp \ 131viewconfigurewidget.cpp \
130viewconfigurefieldspage.cpp \ 132viewconfigurefieldspage.cpp \
131viewconfigurefilterpage.cpp \ 133viewconfigurefilterpage.cpp \
132undo.cpp \ 134undo.cpp \
133undocmds.cpp \ 135undocmds.cpp \
134xxportmanager.cpp \ 136xxportmanager.cpp \
135xxportobject.cpp \ 137xxportobject.cpp \
136xxportselectdialog.cpp \ 138xxportselectdialog.cpp \
137details/detailsviewcontainer.cpp \ 139details/detailsviewcontainer.cpp \
138details/look_basic.cpp \ 140details/look_basic.cpp \
139details/look_html.cpp \ 141details/look_html.cpp \
140views/kaddressbookiconview.cpp \ 142views/kaddressbookiconview.cpp \
141views/kaddressbooktableview.cpp \ 143views/kaddressbooktableview.cpp \
142views/kaddressbookcardview.cpp \ 144views/kaddressbookcardview.cpp \
143views/configuretableviewdialog.cpp \ 145views/configuretableviewdialog.cpp \
144views/configurecardviewdialog.cpp \ 146views/configurecardviewdialog.cpp \
145views/cardview.cpp \ 147views/cardview.cpp \
146views/contactlistview.cpp \ 148views/contactlistview.cpp \
147views/colorlistbox.cpp \ 149views/colorlistbox.cpp \
148xxport/vcard_xxport.cpp \ 150xxport/vcard_xxport.cpp \
149xxport/kde2_xxport.cpp \ 151xxport/kde2_xxport.cpp \
150xxport/csv_xxport.cpp \ 152xxport/csv_xxport.cpp \
151xxport/csvimportdialog.cpp \ 153xxport/csvimportdialog.cpp \
152xxport/opie_xxport.cpp \ 154xxport/opie_xxport.cpp \
153xxport/qtopia_xxport.cpp \ 155xxport/qtopia_xxport.cpp \
154xxport/sharpdtm_xxport.cpp \ 156xxport/sharpdtm_xxport.cpp \
155#details/look_details.cpp \ 157#details/look_details.cpp \
156#mainwindow.cpp \ 158#mainwindow.cpp \
157# calendarview.cpp \ 159# calendarview.cpp \
158# timespanview.cpp 160# timespanview.cpp
159 161
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp
index 713b0fc..810c3e2 100644
--- a/kaddressbook/xxportmanager.cpp
+++ b/kaddressbook/xxportmanager.cpp
@@ -1,243 +1,243 @@
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/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qlist.h> 32#include <qlist.h>
33 33
34#include <kabc/addressbook.h> 34#include <kabc/addressbook.h>
35#include <kabc/resource.h> 35#include <kabc/resource.h>
36#include <kdebug.h> 36#include <kdebug.h>
37#include <kdialogbase.h> 37#include <kdialogbase.h>
38#include <klocale.h> 38#include <klocale.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40 40
41#ifndef KAB_EMBEDDED 41#ifndef KAB_EMBEDDED
42#include <ktrader.h> 42#include <ktrader.h>
43#else //KAB_EMBEDDED 43#else //KAB_EMBEDDED
44extern "C" 44extern "C"
45{ 45{
46 void* init_microkaddrbk_csv_xxport(); 46 void* init_microkaddrbk_csv_xxport();
47 void* init_microkaddrbk_kde2_xxport(); 47 void* init_microkaddrbk_kde2_xxport();
48 void* init_microkaddrbk_vcard_xxport(); 48 void* init_microkaddrbk_vcard_xxport();
49 void* init_microkaddrbk_opie_xxport(); 49 void* init_microkaddrbk_opie_xxport();
50 void* init_microkaddrbk_qtopia_xxport(); 50 void* init_microkaddrbk_qtopia_xxport();
51 void* init_microkaddrbk_sharpdtm_xxport(); 51 void* init_microkaddrbk_sharpdtm_xxport();
52} 52}
53#endif //KAB_EMBEDDED 53#endif //KAB_EMBEDDED
54 54
55#include <libkdepim/addresseeview.h> 55#include <addresseeview.h>
56 56
57#include "kabcore.h" 57#include "kabcore.h"
58#include "undocmds.h" 58#include "undocmds.h"
59#include "xxportselectdialog.h" 59#include "xxportselectdialog.h"
60 60
61#include "xxportmanager.h" 61#include "xxportmanager.h"
62 62
63KURL XXPortManager::importURL = KURL(); 63KURL XXPortManager::importURL = KURL();
64QString XXPortManager::importData = QString::null; 64QString XXPortManager::importData = QString::null;
65 65
66class PreviewDialog : public KDialogBase 66class PreviewDialog : public KDialogBase
67{ 67{
68 public: 68 public:
69 PreviewDialog( const KABC::Addressee &addr, 69 PreviewDialog( const KABC::Addressee &addr,
70 QWidget *parent, const char *name = 0 ); 70 QWidget *parent, const char *name = 0 );
71}; 71};
72 72
73XXPortManager::XXPortManager( KABCore *core, QObject *parent, const char *name ) 73XXPortManager::XXPortManager( KABCore *core, QObject *parent, const char *name )
74 : QObject( parent, name ), mCore( core ), mShowPreview( false ) 74 : QObject( parent, name ), mCore( core ), mShowPreview( false )
75{ 75{
76 loadPlugins(); 76 loadPlugins();
77} 77}
78 78
79XXPortManager::~XXPortManager() 79XXPortManager::~XXPortManager()
80{ 80{
81} 81}
82 82
83void XXPortManager::restoreSettings() 83void XXPortManager::restoreSettings()
84{ 84{
85} 85}
86 86
87void XXPortManager::saveSettings() 87void XXPortManager::saveSettings()
88{ 88{
89} 89}
90 90
91void XXPortManager::importVCard( const KURL &url ) 91void XXPortManager::importVCard( const KURL &url )
92{ 92{
93 importVCard( url, false ); 93 importVCard( url, false );
94} 94}
95 95
96void XXPortManager::importVCard( const KURL &url, bool showPreview ) 96void XXPortManager::importVCard( const KURL &url, bool showPreview )
97{ 97{
98 importURL = url; 98 importURL = url;
99 mShowPreview = showPreview; 99 mShowPreview = showPreview;
100 slotImport( "vcard", "<empty>" ); 100 slotImport( "vcard", "<empty>" );
101 mShowPreview = false; 101 mShowPreview = false;
102 importURL = KURL(); 102 importURL = KURL();
103} 103}
104 104
105void XXPortManager::importVCard( const QString &vCard, bool showPreview ) 105void XXPortManager::importVCard( const QString &vCard, bool showPreview )
106{ 106{
107 importData = vCard; 107 importData = vCard;
108 mShowPreview = showPreview; 108 mShowPreview = showPreview;
109 slotImport( "vcard", "<empty>" ); 109 slotImport( "vcard", "<empty>" );
110 mShowPreview = false; 110 mShowPreview = false;
111 importData = ""; 111 importData = "";
112} 112}
113 113
114void XXPortManager::slotImport( const QString &identifier, const QString &data ) 114void XXPortManager::slotImport( const QString &identifier, const QString &data )
115{ 115{
116 XXPortObject *obj = mXXPortObjects[ identifier ]; 116 XXPortObject *obj = mXXPortObjects[ identifier ];
117 if ( !obj ) { 117 if ( !obj ) {
118 KMessageBox::error( mCore, i18n( "<qt>No import plugin available for <b>%1</b>.</qt>" ).arg( identifier ) ); 118 KMessageBox::error( mCore, i18n( "<qt>No import plugin available for <b>%1</b>.</qt>" ).arg( identifier ) );
119 return; 119 return;
120 } 120 }
121 121
122 KABC::Resource *resource = mCore->requestResource( mCore ); 122 KABC::Resource *resource = mCore->requestResource( mCore );
123 if ( !resource ) 123 if ( !resource )
124 return; 124 return;
125 125
126 KABC::AddresseeList list = obj->importContacts( data ); 126 KABC::AddresseeList list = obj->importContacts( data );
127 KABC::AddresseeList::Iterator it; 127 KABC::AddresseeList::Iterator it;
128 bool imported = false; 128 bool imported = false;
129 for ( it = list.begin(); it != list.end(); ++it ) { 129 for ( it = list.begin(); it != list.end(); ++it ) {
130 if ( mShowPreview ) { 130 if ( mShowPreview ) {
131 PreviewDialog dlg( *it, mCore ); 131 PreviewDialog dlg( *it, mCore );
132 if ( !dlg.exec() ) 132 if ( !dlg.exec() )
133 continue; 133 continue;
134 } 134 }
135 135
136 (*it).setResource( resource ); 136 (*it).setResource( resource );
137 // We use a PwNewCommand so the user can undo it. 137 // We use a PwNewCommand so the user can undo it.
138 PwNewCommand *command = new PwNewCommand( mCore->addressBook(), *it ); 138 PwNewCommand *command = new PwNewCommand( mCore->addressBook(), *it );
139 UndoStack::instance()->push( command ); 139 UndoStack::instance()->push( command );
140 RedoStack::instance()->clear(); 140 RedoStack::instance()->clear();
141 imported = true; 141 imported = true;
142 } 142 }
143 143
144 if ( imported ) { 144 if ( imported ) {
145 KMessageBox::information( mCore, i18n( "contacts successfully imported." ) ); 145 KMessageBox::information( mCore, i18n( "contacts successfully imported." ) );
146 146
147 emit modified(); 147 emit modified();
148 } 148 }
149} 149}
150 150
151void XXPortManager::slotExport( const QString &identifier, const QString &data ) 151void XXPortManager::slotExport( const QString &identifier, const QString &data )
152{ 152{
153 XXPortObject *obj = mXXPortObjects[ identifier ]; 153 XXPortObject *obj = mXXPortObjects[ identifier ];
154 if ( !obj ) { 154 if ( !obj ) {
155 KMessageBox::error( mCore, i18n( "<qt>No export plugin available for <b>%1</b>.</qt>" ).arg( identifier ) ); 155 KMessageBox::error( mCore, i18n( "<qt>No export plugin available for <b>%1</b>.</qt>" ).arg( identifier ) );
156 return; 156 return;
157 } 157 }
158 158
159 KABC::AddresseeList addrList; 159 KABC::AddresseeList addrList;
160 XXPortSelectDialog dlg( mCore, obj->requiresSorting(), mCore ); 160 XXPortSelectDialog dlg( mCore, obj->requiresSorting(), mCore );
161 if ( dlg.exec() ) 161 if ( dlg.exec() )
162 addrList = dlg.contacts(); 162 addrList = dlg.contacts();
163 else 163 else
164 return; 164 return;
165 165
166 if ( !obj->exportContacts( addrList, data ) ) 166 if ( !obj->exportContacts( addrList, data ) )
167 KMessageBox::error( mCore, i18n( "Unable to export contacts." ) ); 167 KMessageBox::error( mCore, i18n( "Unable to export contacts." ) );
168 else 168 else
169 KMessageBox::information( mCore, i18n( "contacts successfully exported." ) ); 169 KMessageBox::information( mCore, i18n( "contacts successfully exported." ) );
170} 170}
171 171
172void XXPortManager::loadPlugins() 172void XXPortManager::loadPlugins()
173{ 173{
174 mXXPortObjects.clear(); 174 mXXPortObjects.clear();
175 175
176#ifndef KAB_EMBEDDED 176#ifndef KAB_EMBEDDED
177 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" ); 177 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" );
178 KTrader::OfferList::ConstIterator it; 178 KTrader::OfferList::ConstIterator it;
179 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 179 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
180 if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) ) 180 if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) )
181 continue; 181 continue;
182 182
183 KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); 183 KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() );
184 if ( !factory ) { 184 if ( !factory ) {
185 kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl; 185 kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl;
186 continue; 186 continue;
187 } 187 }
188 188
189 XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); 189 XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory );
190 190
191 if ( !xxportFactory ) { 191 if ( !xxportFactory ) {
192 kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl; 192 kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl;
193 continue; 193 continue;
194 } 194 }
195 195
196#else //KAB_EMBEDDED 196#else //KAB_EMBEDDED
197 QList<XXPortFactory> factorylist; 197 QList<XXPortFactory> factorylist;
198 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_csv_xxport())); 198 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_csv_xxport()));
199 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_kde2_xxport())); 199 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_kde2_xxport()));
200 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_vcard_xxport())); 200 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_vcard_xxport()));
201 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_opie_xxport())); 201 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_opie_xxport()));
202 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_qtopia_xxport())); 202 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_qtopia_xxport()));
203 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_sharpdtm_xxport())); 203 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_sharpdtm_xxport()));
204 204
205 QListIterator<XXPortFactory> it(factorylist); 205 QListIterator<XXPortFactory> it(factorylist);
206 for ( ; it.current(); ++it ) 206 for ( ; it.current(); ++it )
207 { 207 {
208 XXPortFactory *xxportFactory = it.current(); 208 XXPortFactory *xxportFactory = it.current();
209#endif //KAB_EMBEDDED 209#endif //KAB_EMBEDDED
210 210
211 XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore ); 211 XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore );
212 if ( obj ) { 212 if ( obj ) {
213 mCore->addGUIClient( obj ); 213 mCore->addGUIClient( obj );
214 mXXPortObjects.insert( obj->identifier(), obj ); 214 mXXPortObjects.insert( obj->identifier(), obj );
215 connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ), 215 connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ),
216 this, SLOT( slotExport( const QString&, const QString& ) ) ); 216 this, SLOT( slotExport( const QString&, const QString& ) ) );
217 connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ), 217 connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ),
218 this, SLOT( slotImport( const QString&, const QString& ) ) ); 218 this, SLOT( slotImport( const QString&, const QString& ) ) );
219 } 219 }
220 } 220 }
221} 221}
222 222
223 223
224PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, 224PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent,
225 const char *name ) 225 const char *name )
226 : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent, 226 : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent,
227 name, true, true ) 227 name, true, true )
228{ 228{
229 QWidget *page = plainPage(); 229 QWidget *page = plainPage();
230 QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); 230 QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() );
231 231
232 KPIM::AddresseeView *view = new KPIM::AddresseeView( page ); 232 KPIM::AddresseeView *view = new KPIM::AddresseeView( page );
233 view->setAddressee( addr ); 233 view->setAddressee( addr );
234 234
235 layout->addWidget( view ); 235 layout->addWidget( view );
236 236
237 resize( 400, 300 ); 237 resize( 400, 300 );
238} 238}
239 239
240#ifndef KAB_EMBEDDED 240#ifndef KAB_EMBEDDED
241#include "xxportmanager.moc" 241#include "xxportmanager.moc"
242#endif //KAB_EMBEDDED 242#endif //KAB_EMBEDDED
243 243