summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp6
-rw-r--r--kaddressbook/kabcore.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 3650b20..1433568 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,749 +1,749 @@
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 Async a special exception, permission is given to link this program 19 Async 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/*s 24/*s
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#include <kfiledialog.h> 35#include <kfiledialog.h>
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qlabel.h> 37#include <qlabel.h>
38#include <qregexp.h> 38#include <qregexp.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qcheckbox.h> 40#include <qcheckbox.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qprogressbar.h> 42#include <qprogressbar.h>
43#include <libkdepim/phoneaccess.h> 43#include <libkdepim/phoneaccess.h>
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46#include <qclipboard.h> 46#include <qclipboard.h>
47#include <qdir.h> 47#include <qdir.h>
48#include <qfile.h> 48#include <qfile.h>
49#include <qapplicaton.h> 49#include <qapplicaton.h>
50#include <qprogressbar.h> 50#include <qprogressbar.h>
51#include <qlayout.h> 51#include <qlayout.h>
52#include <qregexp.h> 52#include <qregexp.h>
53#include <qvbox.h> 53#include <qvbox.h>
54#include <kabc/addresseelist.h> 54#include <kabc/addresseelist.h>
55#include <kabc/errorhandler.h> 55#include <kabc/errorhandler.h>
56#include <kabc/resource.h> 56#include <kabc/resource.h>
57#include <kabc/vcardconverter.h> 57#include <kabc/vcardconverter.h>
58#include <kapplication.h> 58#include <kapplication.h>
59#include <kactionclasses.h> 59#include <kactionclasses.h>
60#include <kcmultidialog.h> 60#include <kcmultidialog.h>
61#include <kdebug.h> 61#include <kdebug.h>
62#include <kdeversion.h> 62#include <kdeversion.h>
63#include <kkeydialog.h> 63#include <kkeydialog.h>
64#include <kmessagebox.h> 64#include <kmessagebox.h>
65#include <kprinter.h> 65#include <kprinter.h>
66#include <kprotocolinfo.h> 66#include <kprotocolinfo.h>
67#include <kresources/selectdialog.h> 67#include <kresources/selectdialog.h>
68#include <kstandarddirs.h> 68#include <kstandarddirs.h>
69#include <ktempfile.h> 69#include <ktempfile.h>
70#include <kxmlguiclient.h> 70#include <kxmlguiclient.h>
71#include <kaboutdata.h> 71#include <kaboutdata.h>
72#include <libkdepim/categoryselectdialog.h> 72#include <libkdepim/categoryselectdialog.h>
73 73
74#include "addresseeutil.h" 74#include "addresseeutil.h"
75#include "addresseeeditordialog.h" 75#include "addresseeeditordialog.h"
76#include "extensionmanager.h" 76#include "extensionmanager.h"
77#include "kstdaction.h" 77#include "kstdaction.h"
78#include "kaddressbookservice.h" 78#include "kaddressbookservice.h"
79#include "ldapsearchdialog.h" 79#include "ldapsearchdialog.h"
80#include "printing/printingwizard.h" 80#include "printing/printingwizard.h"
81#else // KAB_EMBEDDED 81#else // KAB_EMBEDDED
82 82
83#include <kapplication.h> 83#include <kapplication.h>
84#include "KDGanttMinimizeSplitter.h" 84#include "KDGanttMinimizeSplitter.h"
85#include "kaddressbookmain.h" 85#include "kaddressbookmain.h"
86#include "kactioncollection.h" 86#include "kactioncollection.h"
87#include "addresseedialog.h" 87#include "addresseedialog.h"
88//US 88//US
89#include <addresseeview.h> 89#include <addresseeview.h>
90 90
91#include <qapp.h> 91#include <qapp.h>
92#include <qmenubar.h> 92#include <qmenubar.h>
93//#include <qtoolbar.h> 93//#include <qtoolbar.h>
94#include <qmessagebox.h> 94#include <qmessagebox.h>
95#include <kdebug.h> 95#include <kdebug.h>
96#include <kiconloader.h> // needed for SmallIcon 96#include <kiconloader.h> // needed for SmallIcon
97#include <kresources/kcmkresources.h> 97#include <kresources/kcmkresources.h>
98#include <ktoolbar.h> 98#include <ktoolbar.h>
99 99
100 100
101//#include <qlabel.h> 101//#include <qlabel.h>
102 102
103 103
104#ifndef DESKTOP_VERSION 104#ifndef DESKTOP_VERSION
105#include <qpe/ir.h> 105#include <qpe/ir.h>
106#include <qpe/qpemenubar.h> 106#include <qpe/qpemenubar.h>
107#include <qtopia/qcopenvelope_qws.h> 107#include <qtopia/qcopenvelope_qws.h>
108#else 108#else
109 109
110#include <qmenubar.h> 110#include <qmenubar.h>
111#endif 111#endif
112 112
113#endif // KAB_EMBEDDED 113#endif // KAB_EMBEDDED
114#include "kcmconfigs/kcmkabconfig.h" 114#include "kcmconfigs/kcmkabconfig.h"
115#include "kcmconfigs/kcmkdepimconfig.h" 115#include "kcmconfigs/kcmkdepimconfig.h"
116#include "kpimglobalprefs.h" 116#include "kpimglobalprefs.h"
117#include "externalapphandler.h" 117#include "externalapphandler.h"
118#include "xxportselectdialog.h" 118#include "xxportselectdialog.h"
119 119
120 120
121#include <kresources/selectdialog.h> 121#include <kresources/selectdialog.h>
122#include <kmessagebox.h> 122#include <kmessagebox.h>
123 123
124#include <picture.h> 124#include <picture.h>
125#include <resource.h> 125#include <resource.h>
126 126
127//US#include <qsplitter.h> 127//US#include <qsplitter.h>
128#include <qmap.h> 128#include <qmap.h>
129#include <qdir.h> 129#include <qdir.h>
130#include <qfile.h> 130#include <qfile.h>
131#include <qvbox.h> 131#include <qvbox.h>
132#include <qlayout.h> 132#include <qlayout.h>
133#include <qclipboard.h> 133#include <qclipboard.h>
134#include <qtextstream.h> 134#include <qtextstream.h>
135#include <qradiobutton.h> 135#include <qradiobutton.h>
136#include <qbuttongroup.h> 136#include <qbuttongroup.h>
137 137
138#include <libkdepim/categoryselectdialog.h> 138#include <libkdepim/categoryselectdialog.h>
139#include <libkdepim/categoryeditdialog.h> 139#include <libkdepim/categoryeditdialog.h>
140#include <kabc/vcardconverter.h> 140#include <kabc/vcardconverter.h>
141 141
142 142
143#include "addresseeutil.h" 143#include "addresseeutil.h"
144#include "undocmds.h" 144#include "undocmds.h"
145#include "addresseeeditordialog.h" 145#include "addresseeeditordialog.h"
146#include "viewmanager.h" 146#include "viewmanager.h"
147#include "details/detailsviewcontainer.h" 147#include "details/detailsviewcontainer.h"
148#include "kabprefs.h" 148#include "kabprefs.h"
149#include "xxportmanager.h" 149#include "xxportmanager.h"
150#include "incsearchwidget.h" 150#include "incsearchwidget.h"
151#include "jumpbuttonbar.h" 151#include "jumpbuttonbar.h"
152#include "extensionmanager.h" 152#include "extensionmanager.h"
153#include "addresseeconfig.h" 153#include "addresseeconfig.h"
154#include "nameeditdialog.h" 154#include "nameeditdialog.h"
155#include <kcmultidialog.h> 155#include <kcmultidialog.h>
156 156
157#ifdef _WIN32_ 157#ifdef _WIN32_
158#ifdef _OL_IMPORT_ 158#ifdef _OL_IMPORT_
159#include "kaimportoldialog.h" 159#include "kaimportoldialog.h"
160#endif 160#endif
161#else 161#else
162#include <unistd.h> 162#include <unistd.h>
163#endif 163#endif
164// sync includes 164// sync includes
165#include <libkdepim/ksyncprofile.h> 165#include <libkdepim/ksyncprofile.h>
166#include <libkdepim/ksyncprefsdialog.h> 166#include <libkdepim/ksyncprefsdialog.h>
167 167
168 168
169class KABCatPrefs : public QDialog 169class KABCatPrefs : public QDialog
170{ 170{
171 public: 171 public:
172 KABCatPrefs( QWidget *parent=0, const char *name=0 ) : 172 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
173 QDialog( parent, name, true ) 173 QDialog( parent, name, true )
174 { 174 {
175 setCaption( i18n("Manage new Categories") ); 175 setCaption( i18n("Manage new Categories") );
176 QVBoxLayout* lay = new QVBoxLayout( this ); 176 QVBoxLayout* lay = new QVBoxLayout( this );
177 lay->setSpacing( 3 ); 177 lay->setSpacing( 3 );
178 lay->setMargin( 3 ); 178 lay->setMargin( 3 );
179 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 179 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
180 lay->addWidget( lab ); 180 lay->addWidget( lab );
181 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 181 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
182 lay->addWidget( format ); 182 lay->addWidget( format );
183 format->setExclusive ( true ) ; 183 format->setExclusive ( true ) ;
184 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 184 addCatBut = new QRadioButton(i18n("Add to category list"), format );
185 new QRadioButton(i18n("Remove from addressees"), format ); 185 new QRadioButton(i18n("Remove from addressees"), format );
186 addCatBut->setChecked( true ); 186 addCatBut->setChecked( true );
187 QPushButton * ok = new QPushButton( i18n("OK"), this ); 187 QPushButton * ok = new QPushButton( i18n("OK"), this );
188 lay->addWidget( ok ); 188 lay->addWidget( ok );
189 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 189 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
190 lay->addWidget( cancel ); 190 lay->addWidget( cancel );
191 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 191 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
192 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 192 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
193 resize( 200, 200 ); 193 resize( 200, 200 );
194 } 194 }
195 195
196 bool addCat() { return addCatBut->isChecked(); } 196 bool addCat() { return addCatBut->isChecked(); }
197private: 197private:
198 QRadioButton* addCatBut; 198 QRadioButton* addCatBut;
199}; 199};
200 200
201class KABFormatPrefs : public QDialog 201class KABFormatPrefs : public QDialog
202{ 202{
203 public: 203 public:
204 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : 204 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) :
205 QDialog( parent, name, true ) 205 QDialog( parent, name, true )
206 { 206 {
207 setCaption( i18n("Set formatted name") ); 207 setCaption( i18n("Set formatted name") );
208 QVBoxLayout* lay = new QVBoxLayout( this ); 208 QVBoxLayout* lay = new QVBoxLayout( this );
209 lay->setSpacing( 3 ); 209 lay->setSpacing( 3 );
210 lay->setMargin( 3 ); 210 lay->setMargin( 3 );
211 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); 211 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this );
212 lay->addWidget( lab ); 212 lay->addWidget( lab );
213 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); 213 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this );
214 lay->addWidget( format ); 214 lay->addWidget( format );
215 format->setExclusive ( true ) ; 215 format->setExclusive ( true ) ;
216 simple = new QRadioButton(i18n("Simple: James Bond"), format ); 216 simple = new QRadioButton(i18n("Simple: James Bond"), format );
217 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); 217 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format );
218 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); 218 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format );
219 company = new QRadioButton(i18n("Organization: MI6"), format ); 219 company = new QRadioButton(i18n("Organization: MI6"), format );
220 simple->setChecked( true ); 220 simple->setChecked( true );
221 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); 221 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this);
222 lay->addWidget( setCompany ); 222 lay->addWidget( setCompany );
223 QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); 223 QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
224 lay->addWidget( ok ); 224 lay->addWidget( ok );
225 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 225 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
226 lay->addWidget( cancel ); 226 lay->addWidget( cancel );
227 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 227 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
228 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 228 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
229 //resize( 200, 200 ); 229 //resize( 200, 200 );
230 230
231 } 231 }
232public: 232public:
233 QRadioButton* simple, *full, *reverse, *company; 233 QRadioButton* simple, *full, *reverse, *company;
234 QCheckBox* setCompany; 234 QCheckBox* setCompany;
235}; 235};
236 236
237 237
238 238
239class KAex2phonePrefs : public QDialog 239class KAex2phonePrefs : public QDialog
240{ 240{
241 public: 241 public:
242 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 242 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
243 QDialog( parent, name, true ) 243 QDialog( parent, name, true )
244 { 244 {
245 setCaption( i18n("Export to phone options") ); 245 setCaption( i18n("Export to phone options") );
246 QVBoxLayout* lay = new QVBoxLayout( this ); 246 QVBoxLayout* lay = new QVBoxLayout( this );
247 lay->setSpacing( 3 ); 247 lay->setSpacing( 3 );
248 lay->setMargin( 3 ); 248 lay->setMargin( 3 );
249 QLabel *lab; 249 QLabel *lab;
250 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 250 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
251 lab->setAlignment (AlignHCenter ); 251 lab->setAlignment (AlignHCenter );
252 QHBox* temphb; 252 QHBox* temphb;
253 temphb = new QHBox( this ); 253 temphb = new QHBox( this );
254 new QLabel( i18n("I/O device: "), temphb ); 254 new QLabel( i18n("I/O device: "), temphb );
255 mPhoneDevice = new QLineEdit( temphb); 255 mPhoneDevice = new QLineEdit( temphb);
256 lay->addWidget( temphb ); 256 lay->addWidget( temphb );
257 temphb = new QHBox( this ); 257 temphb = new QHBox( this );
258 new QLabel( i18n("Connection: "), temphb ); 258 new QLabel( i18n("Connection: "), temphb );
259 mPhoneConnection = new QLineEdit( temphb); 259 mPhoneConnection = new QLineEdit( temphb);
260 lay->addWidget( temphb ); 260 lay->addWidget( temphb );
261 temphb = new QHBox( this ); 261 temphb = new QHBox( this );
262 new QLabel( i18n("Model(opt.): "), temphb ); 262 new QLabel( i18n("Model(opt.): "), temphb );
263 mPhoneModel = new QLineEdit( temphb); 263 mPhoneModel = new QLineEdit( temphb);
264 lay->addWidget( temphb ); 264 lay->addWidget( temphb );
265 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 265 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
266 // lay->addWidget( mWriteToSim ); 266 // lay->addWidget( mWriteToSim );
267 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 267 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
268 lab->setAlignment (AlignHCenter); 268 lab->setAlignment (AlignHCenter);
269 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 269 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
270 lay->addWidget( ok ); 270 lay->addWidget( ok );
271 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 271 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
272 lay->addWidget( cancel ); 272 lay->addWidget( cancel );
273 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 273 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
274 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 274 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
275 resize( 220, 240 ); 275 resize( 220, 240 );
276 276
277 } 277 }
278 278
279public: 279public:
280 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 280 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
281 QCheckBox* mWriteToSim; 281 QCheckBox* mWriteToSim;
282}; 282};
283 283
284 284
285bool pasteWithNewUid = true; 285bool pasteWithNewUid = true;
286 286
287#ifdef KAB_EMBEDDED 287#ifdef KAB_EMBEDDED
288KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 288KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
289 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 289 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
290 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 290 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
291 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 291 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
292#else //KAB_EMBEDDED 292#else //KAB_EMBEDDED
293KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 293KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
294 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 294 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
295 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 295 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
296 mReadWrite( readWrite ), mModified( false ) 296 mReadWrite( readWrite ), mModified( false )
297#endif //KAB_EMBEDDED 297#endif //KAB_EMBEDDED
298{ 298{
299 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 299 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
300 // syncManager->setBlockSave(false); 300 // syncManager->setBlockSave(false);
301 mIncSearchWidget = 0; 301 mIncSearchWidget = 0;
302 mMiniSplitter = 0; 302 mMiniSplitter = 0;
303 mExtensionBarSplitter = 0; 303 mExtensionBarSplitter = 0;
304 mIsPart = !parent->inherits( "KAddressBookMain" ); 304 mIsPart = !parent->inherits( "KAddressBookMain" );
305 mAddressBook = KABC::StdAddressBook::self(); 305 mAddressBook = KABC::StdAddressBook::self();
306 KABC::StdAddressBook::setAutomaticSave( false ); 306 KABC::StdAddressBook::setAutomaticSave( false );
307 307
308#ifndef KAB_EMBEDDED 308#ifndef KAB_EMBEDDED
309 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 309 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
310#endif //KAB_EMBEDDED 310#endif //KAB_EMBEDDED
311 311
312 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 312 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
313 SLOT( addressBookChanged() ) ); 313 SLOT( addressBookChanged() ) );
314 314
315#if 0 315#if 0
316 // LR moved to addressbook init method 316 // LR moved to addressbook init method
317 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 317 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
318 "X-Department", "KADDRESSBOOK" ); 318 "X-Department", "KADDRESSBOOK" );
319 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 319 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
320 "X-Profession", "KADDRESSBOOK" ); 320 "X-Profession", "KADDRESSBOOK" );
321 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 321 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
322 "X-AssistantsName", "KADDRESSBOOK" ); 322 "X-AssistantsName", "KADDRESSBOOK" );
323 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 323 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
324 "X-ManagersName", "KADDRESSBOOK" ); 324 "X-ManagersName", "KADDRESSBOOK" );
325 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 325 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
326 "X-SpousesName", "KADDRESSBOOK" ); 326 "X-SpousesName", "KADDRESSBOOK" );
327 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 327 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
328 "X-Office", "KADDRESSBOOK" ); 328 "X-Office", "KADDRESSBOOK" );
329 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 329 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
330 "X-IMAddress", "KADDRESSBOOK" ); 330 "X-IMAddress", "KADDRESSBOOK" );
331 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 331 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
332 "X-Anniversary", "KADDRESSBOOK" ); 332 "X-Anniversary", "KADDRESSBOOK" );
333 333
334 //US added this field to become compatible with Opie/qtopia addressbook 334 //US added this field to become compatible with Opie/qtopia addressbook
335 // values can be "female" or "male" or "". An empty field represents undefined. 335 // values can be "female" or "male" or "". An empty field represents undefined.
336 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 336 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
337 "X-Gender", "KADDRESSBOOK" ); 337 "X-Gender", "KADDRESSBOOK" );
338 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 338 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
339 "X-Children", "KADDRESSBOOK" ); 339 "X-Children", "KADDRESSBOOK" );
340 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 340 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
341 "X-FreeBusyUrl", "KADDRESSBOOK" ); 341 "X-FreeBusyUrl", "KADDRESSBOOK" );
342#endif 342#endif
343 initGUI(); 343 initGUI();
344 344
345 mIncSearchWidget->setFocus(); 345 mIncSearchWidget->setFocus();
346 346
347 347
348 connect( mViewManager, SIGNAL( selected( const QString& ) ), 348 connect( mViewManager, SIGNAL( selected( const QString& ) ),
349 SLOT( setContactSelected( const QString& ) ) ); 349 SLOT( setContactSelected( const QString& ) ) );
350 connect( mViewManager, SIGNAL( executed( const QString& ) ), 350 connect( mViewManager, SIGNAL( executed( const QString& ) ),
351 SLOT( executeContact( const QString& ) ) ); 351 SLOT( executeContact( const QString& ) ) );
352 352
353 connect( mViewManager, SIGNAL( deleteRequest( ) ), 353 connect( mViewManager, SIGNAL( deleteRequest( ) ),
354 SLOT( deleteContacts( ) ) ); 354 SLOT( deleteContacts( ) ) );
355 connect( mViewManager, SIGNAL( modified() ), 355 connect( mViewManager, SIGNAL( modified() ),
356 SLOT( setModified() ) ); 356 SLOT( setModified() ) );
357 357
358 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 358 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
359 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 359 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
360 360
361 connect( mXXPortManager, SIGNAL( modified() ), 361 connect( mXXPortManager, SIGNAL( modified() ),
362 SLOT( setModified() ) ); 362 SLOT( setModified() ) );
363 363
364 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 364 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
365 SLOT( incrementalSearch( const QString& ) ) ); 365 SLOT( incrementalSearchJump( const QString& ) ) );
366 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 366 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
367 mJumpButtonBar, SLOT( recreateButtons() ) ); 367 mJumpButtonBar, SLOT( recreateButtons() ) );
368 368
369 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 369 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
370 SLOT( sendMail( const QString& ) ) ); 370 SLOT( sendMail( const QString& ) ) );
371 371
372 372
373 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 373 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
374 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&))); 374 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&)));
375 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 375 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
376 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 376 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
377 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); 377 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog()));
378 378
379 379
380#ifndef KAB_EMBEDDED 380#ifndef KAB_EMBEDDED
381 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 381 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
382 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 382 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
383 383
384 connect( mDetails, SIGNAL( browse( const QString& ) ), 384 connect( mDetails, SIGNAL( browse( const QString& ) ),
385 SLOT( browse( const QString& ) ) ); 385 SLOT( browse( const QString& ) ) );
386 386
387 387
388 mAddressBookService = new KAddressBookService( this ); 388 mAddressBookService = new KAddressBookService( this );
389 389
390#endif //KAB_EMBEDDED 390#endif //KAB_EMBEDDED
391 391
392 mMessageTimer = new QTimer( this ); 392 mMessageTimer = new QTimer( this );
393 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 393 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
394 mEditorDialog = 0; 394 mEditorDialog = 0;
395 createAddresseeEditorDialog( this ); 395 createAddresseeEditorDialog( this );
396 setModified( false ); 396 setModified( false );
397 mBRdisabled = false; 397 mBRdisabled = false;
398#ifndef DESKTOP_VERSION 398#ifndef DESKTOP_VERSION
399 infrared = 0; 399 infrared = 0;
400#endif 400#endif
401 //toggleBeamReceive( ); 401 //toggleBeamReceive( );
402 //mMainWindow->toolBar()->show(); 402 //mMainWindow->toolBar()->show();
403 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 403 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
404 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 404 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
405} 405}
406 406
407void KABCore::updateToolBar() 407void KABCore::updateToolBar()
408{ 408{
409 static int iii = 0; 409 static int iii = 0;
410 ++iii; 410 ++iii;
411 mMainWindow->toolBar()->repaintMe(); 411 mMainWindow->toolBar()->repaintMe();
412 if ( iii < 4 ) 412 if ( iii < 4 )
413 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); 413 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar()));
414} 414}
415KABCore::~KABCore() 415KABCore::~KABCore()
416{ 416{
417 // save(); 417 // save();
418 //saveSettings(); 418 //saveSettings();
419 //KABPrefs::instance()->writeConfig(); 419 //KABPrefs::instance()->writeConfig();
420 delete AddresseeConfig::instance(); 420 delete AddresseeConfig::instance();
421 mAddressBook = 0; 421 mAddressBook = 0;
422 KABC::StdAddressBook::close(); 422 KABC::StdAddressBook::close();
423 423
424 delete syncManager; 424 delete syncManager;
425#ifndef DESKTOP_VERSION 425#ifndef DESKTOP_VERSION
426 if ( infrared ) 426 if ( infrared )
427 delete infrared; 427 delete infrared;
428#endif 428#endif
429} 429}
430void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 430void KABCore::receive( const QCString& cmsg, const QByteArray& data )
431{ 431{
432 //qDebug("KA: QCOP message received: %s ", cmsg.data() ); 432 //qDebug("KA: QCOP message received: %s ", cmsg.data() );
433 if ( cmsg == "setDocument(QString)" ) { 433 if ( cmsg == "setDocument(QString)" ) {
434 QDataStream stream( data, IO_ReadOnly ); 434 QDataStream stream( data, IO_ReadOnly );
435 QString fileName; 435 QString fileName;
436 stream >> fileName; 436 stream >> fileName;
437 recieve( fileName ); 437 recieve( fileName );
438 return; 438 return;
439 } 439 }
440} 440}
441void KABCore::toggleBeamReceive( ) 441void KABCore::toggleBeamReceive( )
442{ 442{
443 if ( mBRdisabled ) 443 if ( mBRdisabled )
444 return; 444 return;
445#ifndef DESKTOP_VERSION 445#ifndef DESKTOP_VERSION
446 if ( infrared ) { 446 if ( infrared ) {
447 qDebug("KA: AB disable BeamReceive "); 447 qDebug("KA: AB disable BeamReceive ");
448 delete infrared; 448 delete infrared;
449 infrared = 0; 449 infrared = 0;
450 mActionBR->setChecked(false); 450 mActionBR->setChecked(false);
451 return; 451 return;
452 } 452 }
453 qDebug("KA: AB enable BeamReceive "); 453 qDebug("KA: AB enable BeamReceive ");
454 mActionBR->setChecked(true); 454 mActionBR->setChecked(true);
455 455
456 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 456 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
457 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 457 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
458#endif 458#endif
459} 459}
460 460
461 461
462void KABCore::disableBR(bool b) 462void KABCore::disableBR(bool b)
463{ 463{
464#ifndef DESKTOP_VERSION 464#ifndef DESKTOP_VERSION
465 if ( b ) { 465 if ( b ) {
466 if ( infrared ) { 466 if ( infrared ) {
467 toggleBeamReceive( ); 467 toggleBeamReceive( );
468 } 468 }
469 mBRdisabled = true; 469 mBRdisabled = true;
470 } else { 470 } else {
471 if ( mBRdisabled ) { 471 if ( mBRdisabled ) {
472 mBRdisabled = false; 472 mBRdisabled = false;
473 //toggleBeamReceive( ); 473 //toggleBeamReceive( );
474 } 474 }
475 } 475 }
476#endif 476#endif
477 477
478} 478}
479void KABCore::recieve( QString fn ) 479void KABCore::recieve( QString fn )
480{ 480{
481 //qDebug("KABCore::recieve "); 481 //qDebug("KABCore::recieve ");
482 int count = mAddressBook->importFromFile( fn, true ); 482 int count = mAddressBook->importFromFile( fn, true );
483 if ( count ) 483 if ( count )
484 setModified( true ); 484 setModified( true );
485 mViewManager->refreshView(); 485 mViewManager->refreshView();
486 message(i18n("%1 contact(s) received!").arg( count )); 486 message(i18n("%1 contact(s) received!").arg( count ));
487 topLevelWidget()->showMaximized(); 487 topLevelWidget()->showMaximized();
488 topLevelWidget()->raise(); 488 topLevelWidget()->raise();
489} 489}
490void KABCore::restoreSettings() 490void KABCore::restoreSettings()
491{ 491{
492 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 492 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
493 493
494 bool state; 494 bool state;
495 495
496 if (mMultipleViewsAtOnce) 496 if (mMultipleViewsAtOnce)
497 state = KABPrefs::instance()->mDetailsPageVisible; 497 state = KABPrefs::instance()->mDetailsPageVisible;
498 else 498 else
499 state = false; 499 state = false;
500 500
501 mActionDetails->setChecked( state ); 501 mActionDetails->setChecked( state );
502 setDetailsVisible( state ); 502 setDetailsVisible( state );
503 503
504 state = KABPrefs::instance()->mJumpButtonBarVisible; 504 state = KABPrefs::instance()->mJumpButtonBarVisible;
505 505
506 mActionJumpBar->setChecked( state ); 506 mActionJumpBar->setChecked( state );
507 setJumpButtonBarVisible( state ); 507 setJumpButtonBarVisible( state );
508/*US 508/*US
509 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 509 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
510 if ( splitterSize.count() == 0 ) { 510 if ( splitterSize.count() == 0 ) {
511 splitterSize.append( width() / 2 ); 511 splitterSize.append( width() / 2 );
512 splitterSize.append( width() / 2 ); 512 splitterSize.append( width() / 2 );
513 } 513 }
514 mMiniSplitter->setSizes( splitterSize ); 514 mMiniSplitter->setSizes( splitterSize );
515 if ( mExtensionBarSplitter ) { 515 if ( mExtensionBarSplitter ) {
516 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 516 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
517 if ( splitterSize.count() == 0 ) { 517 if ( splitterSize.count() == 0 ) {
518 splitterSize.append( width() / 2 ); 518 splitterSize.append( width() / 2 );
519 splitterSize.append( width() / 2 ); 519 splitterSize.append( width() / 2 );
520 } 520 }
521 mExtensionBarSplitter->setSizes( splitterSize ); 521 mExtensionBarSplitter->setSizes( splitterSize );
522 522
523 } 523 }
524*/ 524*/
525 mViewManager->restoreSettings(); 525 mViewManager->restoreSettings();
526 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 526 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
527 mExtensionManager->restoreSettings(); 527 mExtensionManager->restoreSettings();
528#ifdef DESKTOP_VERSION 528#ifdef DESKTOP_VERSION
529 int wid = width(); 529 int wid = width();
530 if ( wid < 10 ) 530 if ( wid < 10 )
531 wid = 400; 531 wid = 400;
532#else 532#else
533 int wid = QApplication::desktop()->width(); 533 int wid = QApplication::desktop()->width();
534 if ( wid < 640 ) 534 if ( wid < 640 )
535 wid = QApplication::desktop()->height(); 535 wid = QApplication::desktop()->height();
536#endif 536#endif
537 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 537 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
538 if ( true /*splitterSize.count() == 0*/ ) { 538 if ( true /*splitterSize.count() == 0*/ ) {
539 splitterSize.append( wid / 2 ); 539 splitterSize.append( wid / 2 );
540 splitterSize.append( wid / 2 ); 540 splitterSize.append( wid / 2 );
541 } 541 }
542 mMiniSplitter->setSizes( splitterSize ); 542 mMiniSplitter->setSizes( splitterSize );
543 if ( mExtensionBarSplitter ) { 543 if ( mExtensionBarSplitter ) {
544 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 544 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
545 if ( true /*splitterSize.count() == 0*/ ) { 545 if ( true /*splitterSize.count() == 0*/ ) {
546 splitterSize.append( wid / 2 ); 546 splitterSize.append( wid / 2 );
547 splitterSize.append( wid / 2 ); 547 splitterSize.append( wid / 2 );
548 } 548 }
549 mExtensionBarSplitter->setSizes( splitterSize ); 549 mExtensionBarSplitter->setSizes( splitterSize );
550 550
551 } 551 }
552 552
553 553
554} 554}
555 555
556void KABCore::saveSettings() 556void KABCore::saveSettings()
557{ 557{
558 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 558 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
559 if ( mExtensionBarSplitter ) 559 if ( mExtensionBarSplitter )
560 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 560 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
561 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 561 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
562 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 562 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
563#ifndef KAB_EMBEDDED 563#ifndef KAB_EMBEDDED
564 564
565 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 565 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
566 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 566 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
567#endif //KAB_EMBEDDED 567#endif //KAB_EMBEDDED
568 mExtensionManager->saveSettings(); 568 mExtensionManager->saveSettings();
569 mViewManager->saveSettings(); 569 mViewManager->saveSettings();
570 570
571 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 571 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
572 KABPrefs::instance()->writeConfig(); 572 KABPrefs::instance()->writeConfig();
573 qDebug("KA: KABCore::saveSettings() "); 573 qDebug("KA: KABCore::saveSettings() ");
574} 574}
575 575
576KABC::AddressBook *KABCore::addressBook() const 576KABC::AddressBook *KABCore::addressBook() const
577{ 577{
578 return mAddressBook; 578 return mAddressBook;
579} 579}
580 580
581KConfig *KABCore::config() 581KConfig *KABCore::config()
582{ 582{
583#ifndef KAB_EMBEDDED 583#ifndef KAB_EMBEDDED
584 return KABPrefs::instance()->config(); 584 return KABPrefs::instance()->config();
585#else //KAB_EMBEDDED 585#else //KAB_EMBEDDED
586 return KABPrefs::instance()->getConfig(); 586 return KABPrefs::instance()->getConfig();
587#endif //KAB_EMBEDDED 587#endif //KAB_EMBEDDED
588} 588}
589 589
590KActionCollection *KABCore::actionCollection() const 590KActionCollection *KABCore::actionCollection() const
591{ 591{
592 return mGUIClient->actionCollection(); 592 return mGUIClient->actionCollection();
593} 593}
594 594
595KABC::Field *KABCore::currentSearchField() const 595KABC::Field *KABCore::currentSearchField() const
596{ 596{
597 if (mIncSearchWidget) 597 if (mIncSearchWidget)
598 return mIncSearchWidget->currentField(); 598 return mIncSearchWidget->currentField();
599 else 599 else
600 return 0; 600 return 0;
601} 601}
602 602
603QStringList KABCore::selectedUIDs() const 603QStringList KABCore::selectedUIDs() const
604{ 604{
605 return mViewManager->selectedUids(); 605 return mViewManager->selectedUids();
606} 606}
607 607
608KABC::Resource *KABCore::requestResource( QWidget *parent ) 608KABC::Resource *KABCore::requestResource( QWidget *parent )
609{ 609{
610 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 610 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
611 611
612 QPtrList<KRES::Resource> kresResources; 612 QPtrList<KRES::Resource> kresResources;
613 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 613 QPtrListIterator<KABC::Resource> resIt( kabcResources );
614 KABC::Resource *resource; 614 KABC::Resource *resource;
615 while ( ( resource = resIt.current() ) != 0 ) { 615 while ( ( resource = resIt.current() ) != 0 ) {
616 ++resIt; 616 ++resIt;
617 if ( !resource->readOnly() ) { 617 if ( !resource->readOnly() ) {
618 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 618 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
619 if ( res ) 619 if ( res )
620 kresResources.append( res ); 620 kresResources.append( res );
621 } 621 }
622 } 622 }
623 623
624 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 624 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
625 return static_cast<KABC::Resource*>( res ); 625 return static_cast<KABC::Resource*>( res );
626} 626}
627 627
628#ifndef KAB_EMBEDDED 628#ifndef KAB_EMBEDDED
629KAboutData *KABCore::createAboutData() 629KAboutData *KABCore::createAboutData()
630#else //KAB_EMBEDDED 630#else //KAB_EMBEDDED
631void KABCore::createAboutData() 631void KABCore::createAboutData()
632#endif //KAB_EMBEDDED 632#endif //KAB_EMBEDDED
633{ 633{
634#ifndef KAB_EMBEDDED 634#ifndef KAB_EMBEDDED
635 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 635 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
636 "3.1", I18N_NOOP( "The KDE Address Book" ), 636 "3.1", I18N_NOOP( "The KDE Address Book" ),
637 KAboutData::License_GPL_V2, 637 KAboutData::License_GPL_V2,
638 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 638 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
639 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 639 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
640 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 640 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
641 about->addAuthor( "Cornelius Schumacher", 641 about->addAuthor( "Cornelius Schumacher",
642 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 642 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
643 "schumacher@kde.org" ); 643 "schumacher@kde.org" );
644 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 644 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
645 "mpilone@slac.com" ); 645 "mpilone@slac.com" );
646 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 646 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
647 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 647 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
648 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 648 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
649 "michel@klaralvdalens-datakonsult.se" ); 649 "michel@klaralvdalens-datakonsult.se" );
650 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 650 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
651 "hansen@kde.org" ); 651 "hansen@kde.org" );
652 652
653 return about; 653 return about;
654#endif //KAB_EMBEDDED 654#endif //KAB_EMBEDDED
655 655
656 QString version; 656 QString version;
657#include <../version> 657#include <../version>
658 QMessageBox::about( this, "About KAddressbook/Pi", 658 QMessageBox::about( this, "About KAddressbook/Pi",
659 "KAddressbook/Platform-independent\n" 659 "KAddressbook/Platform-independent\n"
660 "(KA/Pi) " +version + " - " + 660 "(KA/Pi) " +version + " - " +
661#ifdef DESKTOP_VERSION 661#ifdef DESKTOP_VERSION
662 "Desktop Edition\n" 662 "Desktop Edition\n"
663#else 663#else
664 "PDA-Edition\n" 664 "PDA-Edition\n"
665 "for: Zaurus 5500 / 7x0 / 8x0\n" 665 "for: Zaurus 5500 / 7x0 / 8x0\n"
666#endif 666#endif
667 667
668 "(c) 2004 Ulf Schenk\n" 668 "(c) 2004 Ulf Schenk\n"
669 "(c) 2004 Lutz Rogowski\n" 669 "(c) 2004 Lutz Rogowski\n"
670 "(c) 1997-2003, The KDE PIM Team\n" 670 "(c) 1997-2003, The KDE PIM Team\n"
671 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 671 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
672 "Don Sanders Original author\n" 672 "Don Sanders Original author\n"
673 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 673 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
674 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 674 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
675 "Greg Stern DCOP interface\n" 675 "Greg Stern DCOP interface\n"
676 "Mark Westcot Contact pinning\n" 676 "Mark Westcot Contact pinning\n"
677 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 677 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
678 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 678 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
679#ifdef _WIN32_ 679#ifdef _WIN32_
680 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 680 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
681#endif 681#endif
682 ); 682 );
683} 683}
684 684
685void KABCore::setContactSelected( const QString &uid ) 685void KABCore::setContactSelected( const QString &uid )
686{ 686{
687 KABC::Addressee addr = mAddressBook->findByUid( uid ); 687 KABC::Addressee addr = mAddressBook->findByUid( uid );
688 if ( !mDetails->isHidden() ) 688 if ( !mDetails->isHidden() )
689 mDetails->setAddressee( addr ); 689 mDetails->setAddressee( addr );
690 690
691 if ( !addr.isEmpty() ) { 691 if ( !addr.isEmpty() ) {
692 emit contactSelected( addr.formattedName() ); 692 emit contactSelected( addr.formattedName() );
693 KABC::Picture pic = addr.photo(); 693 KABC::Picture pic = addr.photo();
694 if ( pic.isIntern() ) { 694 if ( pic.isIntern() ) {
695//US emit contactSelected( pic.data() ); 695//US emit contactSelected( pic.data() );
696//US instead use: 696//US instead use:
697 QPixmap px; 697 QPixmap px;
698 if (pic.data().isNull() != true) 698 if (pic.data().isNull() != true)
699 { 699 {
700 px.convertFromImage(pic.data()); 700 px.convertFromImage(pic.data());
701 } 701 }
702 702
703 emit contactSelected( px ); 703 emit contactSelected( px );
704 } 704 }
705 } 705 }
706 706
707 707
708 mExtensionManager->setSelectionChanged(); 708 mExtensionManager->setSelectionChanged();
709 709
710 // update the actions 710 // update the actions
711 bool selected = !uid.isEmpty(); 711 bool selected = !uid.isEmpty();
712 712
713 if ( mReadWrite ) { 713 if ( mReadWrite ) {
714 mActionCut->setEnabled( selected ); 714 mActionCut->setEnabled( selected );
715 mActionPaste->setEnabled( selected ); 715 mActionPaste->setEnabled( selected );
716 } 716 }
717 717
718 mActionCopy->setEnabled( selected ); 718 mActionCopy->setEnabled( selected );
719 mActionDelete->setEnabled( selected ); 719 mActionDelete->setEnabled( selected );
720 mActionEditAddressee->setEnabled( selected ); 720 mActionEditAddressee->setEnabled( selected );
721 mActionMail->setEnabled( selected ); 721 mActionMail->setEnabled( selected );
722 mActionMailVCard->setEnabled( selected ); 722 mActionMailVCard->setEnabled( selected );
723 //if (mActionBeam) 723 //if (mActionBeam)
724 //mActionBeam->setEnabled( selected ); 724 //mActionBeam->setEnabled( selected );
725 mActionWhoAmI->setEnabled( selected ); 725 mActionWhoAmI->setEnabled( selected );
726} 726}
727 727
728void KABCore::sendMail() 728void KABCore::sendMail()
729{ 729{
730 sendMail( mViewManager->selectedEmails().join( ", " ) ); 730 sendMail( mViewManager->selectedEmails().join( ", " ) );
731} 731}
732 732
733void KABCore::sendMail( const QString& emaillist ) 733void KABCore::sendMail( const QString& emaillist )
734{ 734{
735 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 735 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
736 if (emaillist.contains(",") > 0) 736 if (emaillist.contains(",") > 0)
737 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 737 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
738 else 738 else
739 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 739 ExternalAppHandler::instance()->mailToOneContact( emaillist );
740} 740}
741 741
742 742
743 743
744void KABCore::mailVCard() 744void KABCore::mailVCard()
745{ 745{
746 QStringList uids = mViewManager->selectedUids(); 746 QStringList uids = mViewManager->selectedUids();
747 if ( !uids.isEmpty() ) 747 if ( !uids.isEmpty() )
748 mailVCard( uids ); 748 mailVCard( uids );
749} 749}
@@ -792,768 +792,772 @@ void KABCore::mailVCard( const QStringList& uids )
792 792
793 793
794/*US 794/*US
795 kapp->invokeMailer( QString::null, QString::null, QString::null, 795 kapp->invokeMailer( QString::null, QString::null, QString::null,
796 QString::null, // subject 796 QString::null, // subject
797 QString::null, // body 797 QString::null, // body
798 QString::null, 798 QString::null,
799 urls ); // attachments 799 urls ); // attachments
800*/ 800*/
801 801
802} 802}
803 803
804/** 804/**
805 Beams the "WhoAmI contact. 805 Beams the "WhoAmI contact.
806*/ 806*/
807void KABCore::beamMySelf() 807void KABCore::beamMySelf()
808{ 808{
809 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 809 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
810 if (!a.isEmpty()) 810 if (!a.isEmpty())
811 { 811 {
812 QStringList uids; 812 QStringList uids;
813 uids << a.uid(); 813 uids << a.uid();
814 814
815 beamVCard(uids); 815 beamVCard(uids);
816 } else { 816 } else {
817 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 817 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
818 818
819 819
820 } 820 }
821} 821}
822void KABCore::updateMainWindow() 822void KABCore::updateMainWindow()
823{ 823{
824 mMainWindow->showMaximized(); 824 mMainWindow->showMaximized();
825 mMainWindow->update(); 825 mMainWindow->update();
826} 826}
827void KABCore::resizeEvent(QResizeEvent* e ) 827void KABCore::resizeEvent(QResizeEvent* e )
828{ 828{
829 if ( !mMiniSplitter ) 829 if ( !mMiniSplitter )
830 return; 830 return;
831 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); 831 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) ");
832 if ( QApplication::desktop()->width() >= 480 ) { 832 if ( QApplication::desktop()->width() >= 480 ) {
833 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 833 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
834 if ( mMiniSplitter->orientation() == Qt::Vertical ) { 834 if ( mMiniSplitter->orientation() == Qt::Vertical ) {
835 mMiniSplitter->setOrientation( Qt::Horizontal); 835 mMiniSplitter->setOrientation( Qt::Horizontal);
836 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 836 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
837 } 837 }
838 if ( QApplication::desktop()->width() <= 640 ) { 838 if ( QApplication::desktop()->width() <= 640 ) {
839 mMainWindow->showMinimized(); 839 mMainWindow->showMinimized();
840 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 840 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
841 mViewManager->getFilterAction()->setComboWidth( 150 ); 841 mViewManager->getFilterAction()->setComboWidth( 150 );
842 if ( mIncSearchWidget ) 842 if ( mIncSearchWidget )
843 mIncSearchWidget->setSize(); 843 mIncSearchWidget->setSize();
844 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 844 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
845 } 845 }
846 846
847 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 847 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
848 if ( mMiniSplitter->orientation() == Qt::Horizontal ) { 848 if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
849 mMiniSplitter->setOrientation( Qt::Vertical ); 849 mMiniSplitter->setOrientation( Qt::Vertical );
850 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 850 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
851 } 851 }
852 if ( QApplication::desktop()->width() <= 640 ) { 852 if ( QApplication::desktop()->width() <= 640 ) {
853 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 853 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
854 mMainWindow->showMinimized(); 854 mMainWindow->showMinimized();
855 if ( KABPrefs::instance()->mHideSearchOnSwitch ) { 855 if ( KABPrefs::instance()->mHideSearchOnSwitch ) {
856 if ( mIncSearchWidget ) { 856 if ( mIncSearchWidget ) {
857 mIncSearchWidget->setSize(); 857 mIncSearchWidget->setSize();
858 } 858 }
859 } else { 859 } else {
860 mViewManager->getFilterAction()->setComboWidth( 0 ); 860 mViewManager->getFilterAction()->setComboWidth( 0 );
861 } 861 }
862 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 862 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
863 } 863 }
864 } 864 }
865 } 865 }
866 QWidget::resizeEvent( e ); 866 QWidget::resizeEvent( e );
867 867
868} 868}
869void KABCore::export2phone() 869void KABCore::export2phone()
870{ 870{
871 871
872 QStringList uids; 872 QStringList uids;
873 XXPortSelectDialog dlg( this, false, this ); 873 XXPortSelectDialog dlg( this, false, this );
874 if ( dlg.exec() ) 874 if ( dlg.exec() )
875 uids = dlg.uids(); 875 uids = dlg.uids();
876 else 876 else
877 return; 877 return;
878 if ( uids.isEmpty() ) 878 if ( uids.isEmpty() )
879 return; 879 return;
880 // qDebug("count %d ", uids.count()); 880 // qDebug("count %d ", uids.count());
881 881
882 KAex2phonePrefs ex2phone; 882 KAex2phonePrefs ex2phone;
883 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 883 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
884 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 884 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
885 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 885 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
886 886
887 if ( !ex2phone.exec() ) { 887 if ( !ex2phone.exec() ) {
888 return; 888 return;
889 } 889 }
890 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 890 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
891 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 891 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
892 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 892 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
893 893
894 894
895 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 895 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
896 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 896 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
897 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 897 KPimGlobalPrefs::instance()->mEx2PhoneModel );
898 898
899 QString fileName = getPhoneFile(); 899 QString fileName = getPhoneFile();
900 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 900 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
901 return; 901 return;
902 902
903 message(i18n("Exporting to phone...")); 903 message(i18n("Exporting to phone..."));
904 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 904 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
905 905
906} 906}
907QString KABCore::getPhoneFile() 907QString KABCore::getPhoneFile()
908{ 908{
909#ifdef DESKTOP_VERSION 909#ifdef DESKTOP_VERSION
910 return locateLocal("tmp", "phonefile.vcf"); 910 return locateLocal("tmp", "phonefile.vcf");
911#else 911#else
912 return "/tmp/phonefile.vcf"; 912 return "/tmp/phonefile.vcf";
913#endif 913#endif
914 914
915} 915}
916void KABCore::writeToPhone( ) 916void KABCore::writeToPhone( )
917{ 917{
918 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 918 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
919 message(i18n("Export to phone finished!")); 919 message(i18n("Export to phone finished!"));
920 else 920 else
921 qDebug(i18n("KA: Error exporting to phone")); 921 qDebug(i18n("KA: Error exporting to phone"));
922} 922}
923void KABCore::beamVCard() 923void KABCore::beamVCard()
924{ 924{
925 QStringList uids; 925 QStringList uids;
926 XXPortSelectDialog dlg( this, false, this ); 926 XXPortSelectDialog dlg( this, false, this );
927 if ( dlg.exec() ) 927 if ( dlg.exec() )
928 uids = dlg.uids(); 928 uids = dlg.uids();
929 else 929 else
930 return; 930 return;
931 if ( uids.isEmpty() ) 931 if ( uids.isEmpty() )
932 return; 932 return;
933 beamVCard( uids ); 933 beamVCard( uids );
934} 934}
935 935
936 936
937void KABCore::beamVCard(const QStringList& uids) 937void KABCore::beamVCard(const QStringList& uids)
938{ 938{
939 939
940 // LR: we should use the /tmp dir on the Zaurus, 940 // LR: we should use the /tmp dir on the Zaurus,
941 // because: /tmp = RAM, (HOME)/kdepim = flash memory 941 // because: /tmp = RAM, (HOME)/kdepim = flash memory
942 942
943#ifdef DESKTOP_VERSION 943#ifdef DESKTOP_VERSION
944 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 944 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
945#else 945#else
946 QString fileName = "/tmp/kapibeamfile.vcf"; 946 QString fileName = "/tmp/kapibeamfile.vcf";
947#endif 947#endif
948 948
949 KABC::VCardConverter converter; 949 KABC::VCardConverter converter;
950 QString description; 950 QString description;
951 QString datastream; 951 QString datastream;
952 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 952 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
953 KABC::Addressee a = mAddressBook->findByUid( *it ); 953 KABC::Addressee a = mAddressBook->findByUid( *it );
954 954
955 if ( a.isEmpty() ) 955 if ( a.isEmpty() )
956 continue; 956 continue;
957 957
958 if (description.isEmpty()) 958 if (description.isEmpty())
959 description = a.formattedName(); 959 description = a.formattedName();
960 960
961 QString vcard; 961 QString vcard;
962 converter.addresseeToVCard( a, vcard ); 962 converter.addresseeToVCard( a, vcard );
963 int start = 0; 963 int start = 0;
964 int next; 964 int next;
965 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 965 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
966 int semi = vcard.find(";", next); 966 int semi = vcard.find(";", next);
967 int dopp = vcard.find(":", next); 967 int dopp = vcard.find(":", next);
968 int sep; 968 int sep;
969 if ( semi < dopp && semi >= 0 ) 969 if ( semi < dopp && semi >= 0 )
970 sep = semi ; 970 sep = semi ;
971 else 971 else
972 sep = dopp; 972 sep = dopp;
973 datastream +=vcard.mid( start, next - start); 973 datastream +=vcard.mid( start, next - start);
974 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 974 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
975 start = sep; 975 start = sep;
976 } 976 }
977 datastream += vcard.mid( start,vcard.length() ); 977 datastream += vcard.mid( start,vcard.length() );
978 } 978 }
979#ifndef DESKTOP_VERSION 979#ifndef DESKTOP_VERSION
980 QFile outFile(fileName); 980 QFile outFile(fileName);
981 if ( outFile.open(IO_WriteOnly) ) { 981 if ( outFile.open(IO_WriteOnly) ) {
982 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 982 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
983 QTextStream t( &outFile ); // use a text stream 983 QTextStream t( &outFile ); // use a text stream
984 //t.setEncoding( QTextStream::UnicodeUTF8 ); 984 //t.setEncoding( QTextStream::UnicodeUTF8 );
985 t.setEncoding( QTextStream::Latin1 ); 985 t.setEncoding( QTextStream::Latin1 );
986 t <<datastream.latin1(); 986 t <<datastream.latin1();
987 outFile.close(); 987 outFile.close();
988 Ir *ir = new Ir( this ); 988 Ir *ir = new Ir( this );
989 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 989 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
990 ir->send( fileName, description, "text/x-vCard" ); 990 ir->send( fileName, description, "text/x-vCard" );
991 } else { 991 } else {
992 qDebug("KA: Error open temp beam file "); 992 qDebug("KA: Error open temp beam file ");
993 return; 993 return;
994 } 994 }
995#endif 995#endif
996 996
997} 997}
998 998
999void KABCore::beamDone( Ir *ir ) 999void KABCore::beamDone( Ir *ir )
1000{ 1000{
1001#ifndef DESKTOP_VERSION 1001#ifndef DESKTOP_VERSION
1002 delete ir; 1002 delete ir;
1003#endif 1003#endif
1004 topLevelWidget()->raise(); 1004 topLevelWidget()->raise();
1005 message( i18n("Beaming finished!") ); 1005 message( i18n("Beaming finished!") );
1006} 1006}
1007 1007
1008 1008
1009void KABCore::browse( const QString& url ) 1009void KABCore::browse( const QString& url )
1010{ 1010{
1011#ifndef KAB_EMBEDDED 1011#ifndef KAB_EMBEDDED
1012 kapp->invokeBrowser( url ); 1012 kapp->invokeBrowser( url );
1013#else //KAB_EMBEDDED 1013#else //KAB_EMBEDDED
1014 qDebug("KABCore::browse must be fixed"); 1014 qDebug("KABCore::browse must be fixed");
1015#endif //KAB_EMBEDDED 1015#endif //KAB_EMBEDDED
1016} 1016}
1017 1017
1018void KABCore::selectAllContacts() 1018void KABCore::selectAllContacts()
1019{ 1019{
1020 mViewManager->setSelected( QString::null, true ); 1020 mViewManager->setSelected( QString::null, true );
1021} 1021}
1022 1022
1023void KABCore::deleteContacts() 1023void KABCore::deleteContacts()
1024{ 1024{
1025 QStringList uidList = mViewManager->selectedUids(); 1025 QStringList uidList = mViewManager->selectedUids();
1026 deleteContacts( uidList ); 1026 deleteContacts( uidList );
1027} 1027}
1028 1028
1029void KABCore::deleteContacts( const QStringList &uids ) 1029void KABCore::deleteContacts( const QStringList &uids )
1030{ 1030{
1031 if ( uids.count() > 0 ) { 1031 if ( uids.count() > 0 ) {
1032 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 1032 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
1033 UndoStack::instance()->push( command ); 1033 UndoStack::instance()->push( command );
1034 RedoStack::instance()->clear(); 1034 RedoStack::instance()->clear();
1035 1035
1036 // now if we deleted anything, refresh 1036 // now if we deleted anything, refresh
1037 setContactSelected( QString::null ); 1037 setContactSelected( QString::null );
1038 setModified( true ); 1038 setModified( true );
1039 } 1039 }
1040} 1040}
1041 1041
1042void KABCore::copyContacts() 1042void KABCore::copyContacts()
1043{ 1043{
1044 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1044 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1045 1045
1046 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 1046 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
1047 1047
1048 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 1048 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
1049 1049
1050 QClipboard *cb = QApplication::clipboard(); 1050 QClipboard *cb = QApplication::clipboard();
1051 cb->setText( clipText ); 1051 cb->setText( clipText );
1052} 1052}
1053 1053
1054void KABCore::cutContacts() 1054void KABCore::cutContacts()
1055{ 1055{
1056 QStringList uidList = mViewManager->selectedUids(); 1056 QStringList uidList = mViewManager->selectedUids();
1057 1057
1058//US if ( uidList.size() > 0 ) { 1058//US if ( uidList.size() > 0 ) {
1059 if ( uidList.count() > 0 ) { 1059 if ( uidList.count() > 0 ) {
1060 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 1060 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
1061 UndoStack::instance()->push( command ); 1061 UndoStack::instance()->push( command );
1062 RedoStack::instance()->clear(); 1062 RedoStack::instance()->clear();
1063 1063
1064 setModified( true ); 1064 setModified( true );
1065 } 1065 }
1066} 1066}
1067 1067
1068void KABCore::pasteContacts() 1068void KABCore::pasteContacts()
1069{ 1069{
1070 QClipboard *cb = QApplication::clipboard(); 1070 QClipboard *cb = QApplication::clipboard();
1071 1071
1072 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 1072 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
1073 1073
1074 pasteContacts( list ); 1074 pasteContacts( list );
1075} 1075}
1076 1076
1077void KABCore::pasteContacts( KABC::Addressee::List &list ) 1077void KABCore::pasteContacts( KABC::Addressee::List &list )
1078{ 1078{
1079 KABC::Resource *resource = requestResource( this ); 1079 KABC::Resource *resource = requestResource( this );
1080 KABC::Addressee::List::Iterator it; 1080 KABC::Addressee::List::Iterator it;
1081 for ( it = list.begin(); it != list.end(); ++it ) 1081 for ( it = list.begin(); it != list.end(); ++it )
1082 (*it).setResource( resource ); 1082 (*it).setResource( resource );
1083 1083
1084 PwPasteCommand *command = new PwPasteCommand( this, list ); 1084 PwPasteCommand *command = new PwPasteCommand( this, list );
1085 UndoStack::instance()->push( command ); 1085 UndoStack::instance()->push( command );
1086 RedoStack::instance()->clear(); 1086 RedoStack::instance()->clear();
1087 1087
1088 setModified( true ); 1088 setModified( true );
1089} 1089}
1090 1090
1091void KABCore::setWhoAmI() 1091void KABCore::setWhoAmI()
1092{ 1092{
1093 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1093 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1094 1094
1095 if ( addrList.count() > 1 ) { 1095 if ( addrList.count() > 1 ) {
1096 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 1096 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
1097 return; 1097 return;
1098 } 1098 }
1099 1099
1100 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 1100 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
1101 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 1101 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
1102 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 1102 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
1103} 1103}
1104void KABCore::editCategories() 1104void KABCore::editCategories()
1105{ 1105{
1106 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); 1106 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1107 dlg.exec(); 1107 dlg.exec();
1108} 1108}
1109void KABCore::setCategories() 1109void KABCore::setCategories()
1110{ 1110{
1111 1111
1112 QStringList uids; 1112 QStringList uids;
1113 XXPortSelectDialog dlgx( this, false, this ); 1113 XXPortSelectDialog dlgx( this, false, this );
1114 if ( dlgx.exec() ) 1114 if ( dlgx.exec() )
1115 uids = dlgx.uids(); 1115 uids = dlgx.uids();
1116 else 1116 else
1117 return; 1117 return;
1118 if ( uids.isEmpty() ) 1118 if ( uids.isEmpty() )
1119 return; 1119 return;
1120 // qDebug("count %d ", uids.count()); 1120 // qDebug("count %d ", uids.count());
1121 1121
1122 1122
1123 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 1123 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
1124 if ( !dlg.exec() ) { 1124 if ( !dlg.exec() ) {
1125 message( i18n("Setting categories cancelled") ); 1125 message( i18n("Setting categories cancelled") );
1126 return; 1126 return;
1127 } 1127 }
1128 bool merge = false; 1128 bool merge = false;
1129 QString msg = i18n( "Merge with existing categories?" ); 1129 QString msg = i18n( "Merge with existing categories?" );
1130 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 1130 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
1131 merge = true; 1131 merge = true;
1132 1132
1133 message( i18n("Setting categories ... please wait!") ); 1133 message( i18n("Setting categories ... please wait!") );
1134 QStringList categories = dlg.selectedCategories(); 1134 QStringList categories = dlg.selectedCategories();
1135 1135
1136 //QStringList uids = mViewManager->selectedUids(); 1136 //QStringList uids = mViewManager->selectedUids();
1137 QStringList::Iterator it; 1137 QStringList::Iterator it;
1138 for ( it = uids.begin(); it != uids.end(); ++it ) { 1138 for ( it = uids.begin(); it != uids.end(); ++it ) {
1139 KABC::Addressee addr = mAddressBook->findByUid( *it ); 1139 KABC::Addressee addr = mAddressBook->findByUid( *it );
1140 if ( !addr.isEmpty() ) { 1140 if ( !addr.isEmpty() ) {
1141 if ( !merge ) 1141 if ( !merge )
1142 addr.setCategories( categories ); 1142 addr.setCategories( categories );
1143 else { 1143 else {
1144 QStringList addrCategories = addr.categories(); 1144 QStringList addrCategories = addr.categories();
1145 QStringList::Iterator catIt; 1145 QStringList::Iterator catIt;
1146 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 1146 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
1147 if ( !addrCategories.contains( *catIt ) ) 1147 if ( !addrCategories.contains( *catIt ) )
1148 addrCategories.append( *catIt ); 1148 addrCategories.append( *catIt );
1149 } 1149 }
1150 addr.setCategories( addrCategories ); 1150 addr.setCategories( addrCategories );
1151 } 1151 }
1152 mAddressBook->insertAddressee( addr ); 1152 mAddressBook->insertAddressee( addr );
1153 } 1153 }
1154 } 1154 }
1155 1155
1156 if ( uids.count() > 0 ) 1156 if ( uids.count() > 0 )
1157 setModified( true ); 1157 setModified( true );
1158 message( i18n("Setting categories completed!") ); 1158 message( i18n("Setting categories completed!") );
1159} 1159}
1160 1160
1161void KABCore::setSearchFields( const KABC::Field::List &fields ) 1161void KABCore::setSearchFields( const KABC::Field::List &fields )
1162{ 1162{
1163 mIncSearchWidget->setFields( fields ); 1163 mIncSearchWidget->setFields( fields );
1164} 1164}
1165 1165
1166void KABCore::incrementalSearch( const QString& text ) 1166void KABCore::incrementalSearch( const QString& text )
1167{ 1167{
1168 QString stext; 1168 QString stext;
1169 if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { 1169 if ( KABPrefs::instance()->mAutoSearchWithWildcard ) {
1170 stext = "*" + text; 1170 stext = "*" + text;
1171 } else { 1171 } else {
1172 stext = text; 1172 stext = text;
1173 } 1173 }
1174 mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); 1174 mViewManager->doSearch( stext, mIncSearchWidget->currentField() );
1175} 1175}
1176void KABCore::incrementalSearchJump( const QString& text )
1177{
1178 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
1179}
1176 1180
1177void KABCore::setModified() 1181void KABCore::setModified()
1178{ 1182{
1179 setModified( true ); 1183 setModified( true );
1180} 1184}
1181 1185
1182void KABCore::setModifiedWOrefresh() 1186void KABCore::setModifiedWOrefresh()
1183{ 1187{
1184 // qDebug("KABCore::setModifiedWOrefresh() "); 1188 // qDebug("KABCore::setModifiedWOrefresh() ");
1185 mModified = true; 1189 mModified = true;
1186 mActionSave->setEnabled( mModified ); 1190 mActionSave->setEnabled( mModified );
1187 1191
1188 1192
1189} 1193}
1190void KABCore::setModified( bool modified ) 1194void KABCore::setModified( bool modified )
1191{ 1195{
1192 mModified = modified; 1196 mModified = modified;
1193 mActionSave->setEnabled( mModified ); 1197 mActionSave->setEnabled( mModified );
1194 1198
1195 if ( modified ) 1199 if ( modified )
1196 mJumpButtonBar->recreateButtons(); 1200 mJumpButtonBar->recreateButtons();
1197 1201
1198 mViewManager->refreshView(); 1202 mViewManager->refreshView();
1199 1203
1200} 1204}
1201 1205
1202bool KABCore::modified() const 1206bool KABCore::modified() const
1203{ 1207{
1204 return mModified; 1208 return mModified;
1205} 1209}
1206 1210
1207void KABCore::contactModified( const KABC::Addressee &addr ) 1211void KABCore::contactModified( const KABC::Addressee &addr )
1208{ 1212{
1209 addrModified( addr ); 1213 addrModified( addr );
1210#if 0 // debug only 1214#if 0 // debug only
1211 KABC::Addressee ad = addr; 1215 KABC::Addressee ad = addr;
1212 ad.computeCsum( "123"); 1216 ad.computeCsum( "123");
1213#endif 1217#endif
1214} 1218}
1215 1219
1216void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) 1220void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails )
1217{ 1221{
1218 1222
1219 Command *command = 0; 1223 Command *command = 0;
1220 QString uid; 1224 QString uid;
1221 1225
1222 // check if it exists already 1226 // check if it exists already
1223 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1227 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1224 if ( origAddr.isEmpty() ) 1228 if ( origAddr.isEmpty() )
1225 command = new PwNewCommand( mAddressBook, addr ); 1229 command = new PwNewCommand( mAddressBook, addr );
1226 else { 1230 else {
1227 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1231 command = new PwEditCommand( mAddressBook, origAddr, addr );
1228 uid = addr.uid(); 1232 uid = addr.uid();
1229 } 1233 }
1230 1234
1231 UndoStack::instance()->push( command ); 1235 UndoStack::instance()->push( command );
1232 RedoStack::instance()->clear(); 1236 RedoStack::instance()->clear();
1233 if ( updateDetails ) 1237 if ( updateDetails )
1234 mDetails->setAddressee( addr ); 1238 mDetails->setAddressee( addr );
1235 setModified( true ); 1239 setModified( true );
1236} 1240}
1237 1241
1238void KABCore::newContact() 1242void KABCore::newContact()
1239{ 1243{
1240 1244
1241 1245
1242 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1246 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1243 1247
1244 QPtrList<KRES::Resource> kresResources; 1248 QPtrList<KRES::Resource> kresResources;
1245 QPtrListIterator<KABC::Resource> it( kabcResources ); 1249 QPtrListIterator<KABC::Resource> it( kabcResources );
1246 KABC::Resource *resource; 1250 KABC::Resource *resource;
1247 while ( ( resource = it.current() ) != 0 ) { 1251 while ( ( resource = it.current() ) != 0 ) {
1248 ++it; 1252 ++it;
1249 if ( !resource->readOnly() ) { 1253 if ( !resource->readOnly() ) {
1250 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1254 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1251 if ( res ) 1255 if ( res )
1252 kresResources.append( res ); 1256 kresResources.append( res );
1253 } 1257 }
1254 } 1258 }
1255 1259
1256 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1260 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1257 resource = static_cast<KABC::Resource*>( res ); 1261 resource = static_cast<KABC::Resource*>( res );
1258 1262
1259 if ( resource ) { 1263 if ( resource ) {
1260 KABC::Addressee addr; 1264 KABC::Addressee addr;
1261 addr.setResource( resource ); 1265 addr.setResource( resource );
1262 mEditorDialog->setAddressee( addr ); 1266 mEditorDialog->setAddressee( addr );
1263 mEditorDialog->setCaption( i18n("Edit new contact")); 1267 mEditorDialog->setCaption( i18n("Edit new contact"));
1264 KApplication::execDialog ( mEditorDialog ); 1268 KApplication::execDialog ( mEditorDialog );
1265 1269
1266 } else 1270 } else
1267 return; 1271 return;
1268 1272
1269 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1273 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1270 1274
1271 1275
1272} 1276}
1273 1277
1274void KABCore::addEmail( QString aStr ) 1278void KABCore::addEmail( QString aStr )
1275{ 1279{
1276#ifndef KAB_EMBEDDED 1280#ifndef KAB_EMBEDDED
1277 QString fullName, email; 1281 QString fullName, email;
1278 1282
1279 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1283 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1280 1284
1281 // Try to lookup the addressee matching the email address 1285 // Try to lookup the addressee matching the email address
1282 bool found = false; 1286 bool found = false;
1283 QStringList emailList; 1287 QStringList emailList;
1284 KABC::AddressBook::Iterator it; 1288 KABC::AddressBook::Iterator it;
1285 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1289 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1286 emailList = (*it).emails(); 1290 emailList = (*it).emails();
1287 if ( emailList.contains( email ) > 0 ) { 1291 if ( emailList.contains( email ) > 0 ) {
1288 found = true; 1292 found = true;
1289 (*it).setNameFromString( fullName ); 1293 (*it).setNameFromString( fullName );
1290 editContact( (*it).uid() ); 1294 editContact( (*it).uid() );
1291 } 1295 }
1292 } 1296 }
1293 1297
1294 if ( !found ) { 1298 if ( !found ) {
1295 KABC::Addressee addr; 1299 KABC::Addressee addr;
1296 addr.setNameFromString( fullName ); 1300 addr.setNameFromString( fullName );
1297 addr.insertEmail( email, true ); 1301 addr.insertEmail( email, true );
1298 1302
1299 mAddressBook->insertAddressee( addr ); 1303 mAddressBook->insertAddressee( addr );
1300 mViewManager->refreshView( addr.uid() ); 1304 mViewManager->refreshView( addr.uid() );
1301 editContact( addr.uid() ); 1305 editContact( addr.uid() );
1302 } 1306 }
1303#else //KAB_EMBEDDED 1307#else //KAB_EMBEDDED
1304 qDebug("KABCore::addEmail finsih method"); 1308 qDebug("KABCore::addEmail finsih method");
1305#endif //KAB_EMBEDDED 1309#endif //KAB_EMBEDDED
1306} 1310}
1307 1311
1308void KABCore::importVCard( const KURL &url, bool showPreview ) 1312void KABCore::importVCard( const KURL &url, bool showPreview )
1309{ 1313{
1310 mXXPortManager->importVCard( url, showPreview ); 1314 mXXPortManager->importVCard( url, showPreview );
1311} 1315}
1312void KABCore::importFromOL() 1316void KABCore::importFromOL()
1313{ 1317{
1314#ifdef _OL_IMPORT_ 1318#ifdef _OL_IMPORT_
1315 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1319 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1316 idgl->exec(); 1320 idgl->exec();
1317 KABC::Addressee::List list = idgl->getAddressList(); 1321 KABC::Addressee::List list = idgl->getAddressList();
1318 if ( list.count() > 0 ) { 1322 if ( list.count() > 0 ) {
1319 KABC::Addressee::List listNew; 1323 KABC::Addressee::List listNew;
1320 KABC::Addressee::List listExisting; 1324 KABC::Addressee::List listExisting;
1321 KABC::Addressee::List::Iterator it; 1325 KABC::Addressee::List::Iterator it;
1322 KABC::AddressBook::Iterator iter; 1326 KABC::AddressBook::Iterator iter;
1323 for ( it = list.begin(); it != list.end(); ++it ) { 1327 for ( it = list.begin(); it != list.end(); ++it ) {
1324 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1328 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1325 listNew.append( (*it) ); 1329 listNew.append( (*it) );
1326 else 1330 else
1327 listExisting.append( (*it) ); 1331 listExisting.append( (*it) );
1328 } 1332 }
1329 if ( listExisting.count() > 0 ) 1333 if ( listExisting.count() > 0 )
1330 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1334 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1331 if ( listNew.count() > 0 ) { 1335 if ( listNew.count() > 0 ) {
1332 pasteWithNewUid = false; 1336 pasteWithNewUid = false;
1333 pasteContacts( listNew ); 1337 pasteContacts( listNew );
1334 pasteWithNewUid = true; 1338 pasteWithNewUid = true;
1335 } 1339 }
1336 } 1340 }
1337 delete idgl; 1341 delete idgl;
1338#endif 1342#endif
1339} 1343}
1340 1344
1341void KABCore::importVCard( const QString &vCard, bool showPreview ) 1345void KABCore::importVCard( const QString &vCard, bool showPreview )
1342{ 1346{
1343 mXXPortManager->importVCard( vCard, showPreview ); 1347 mXXPortManager->importVCard( vCard, showPreview );
1344} 1348}
1345 1349
1346//US added a second method without defaultparameter 1350//US added a second method without defaultparameter
1347void KABCore::editContact2() { 1351void KABCore::editContact2() {
1348 editContact( QString::null ); 1352 editContact( QString::null );
1349} 1353}
1350 1354
1351void KABCore::editContact( const QString &uid ) 1355void KABCore::editContact( const QString &uid )
1352{ 1356{
1353 1357
1354 if ( mExtensionManager->isQuickEditVisible() ) 1358 if ( mExtensionManager->isQuickEditVisible() )
1355 return; 1359 return;
1356 1360
1357 // First, locate the contact entry 1361 // First, locate the contact entry
1358 QString localUID = uid; 1362 QString localUID = uid;
1359 if ( localUID.isNull() ) { 1363 if ( localUID.isNull() ) {
1360 QStringList uidList = mViewManager->selectedUids(); 1364 QStringList uidList = mViewManager->selectedUids();
1361 if ( uidList.count() > 0 ) 1365 if ( uidList.count() > 0 )
1362 localUID = *( uidList.at( 0 ) ); 1366 localUID = *( uidList.at( 0 ) );
1363 } 1367 }
1364 1368
1365 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1369 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1366 if ( !addr.isEmpty() ) { 1370 if ( !addr.isEmpty() ) {
1367 mEditorDialog->setAddressee( addr ); 1371 mEditorDialog->setAddressee( addr );
1368 KApplication::execDialog ( mEditorDialog ); 1372 KApplication::execDialog ( mEditorDialog );
1369 } 1373 }
1370} 1374}
1371 1375
1372/** 1376/**
1373 Shows or edits the detail view for the given uid. If the uid is QString::null, 1377 Shows or edits the detail view for the given uid. If the uid is QString::null,
1374 the method will try to find a selected addressee in the view. 1378 the method will try to find a selected addressee in the view.
1375 */ 1379 */
1376void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1380void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1377{ 1381{
1378 if ( mMultipleViewsAtOnce ) 1382 if ( mMultipleViewsAtOnce )
1379 { 1383 {
1380 editContact( uid ); 1384 editContact( uid );
1381 } 1385 }
1382 else 1386 else
1383 { 1387 {
1384 setDetailsVisible( true ); 1388 setDetailsVisible( true );
1385 mActionDetails->setChecked(true); 1389 mActionDetails->setChecked(true);
1386 } 1390 }
1387 1391
1388} 1392}
1389 1393
1390void KABCore::save() 1394void KABCore::save()
1391{ 1395{
1392 if (syncManager->blockSave()) 1396 if (syncManager->blockSave())
1393 return; 1397 return;
1394 if ( !mModified ) 1398 if ( !mModified )
1395 return; 1399 return;
1396 1400
1397 syncManager->setBlockSave(true); 1401 syncManager->setBlockSave(true);
1398 QString text = i18n( "There was an error while attempting to save\n the " 1402 QString text = i18n( "There was an error while attempting to save\n the "
1399 "address book. Please check that some \nother application is " 1403 "address book. Please check that some \nother application is "
1400 "not using it. " ); 1404 "not using it. " );
1401 message(i18n("Saving ... please wait! "), false); 1405 message(i18n("Saving ... please wait! "), false);
1402 //qApp->processEvents(); 1406 //qApp->processEvents();
1403#ifndef KAB_EMBEDDED 1407#ifndef KAB_EMBEDDED
1404 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1408 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1405 if ( !b || !b->save() ) { 1409 if ( !b || !b->save() ) {
1406 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1410 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1407 } 1411 }
1408#else //KAB_EMBEDDED 1412#else //KAB_EMBEDDED
1409 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1413 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1410 if ( !b || !b->save() ) { 1414 if ( !b || !b->save() ) {
1411 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1415 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1412 } 1416 }
1413#endif //KAB_EMBEDDED 1417#endif //KAB_EMBEDDED
1414 1418
1415 message(i18n("Addressbook saved!")); 1419 message(i18n("Addressbook saved!"));
1416 setModified( false ); 1420 setModified( false );
1417 syncManager->setBlockSave(false); 1421 syncManager->setBlockSave(false);
1418} 1422}
1419 1423
1420 1424
1421void KABCore::undo() 1425void KABCore::undo()
1422{ 1426{
1423 UndoStack::instance()->undo(); 1427 UndoStack::instance()->undo();
1424 1428
1425 // Refresh the view 1429 // Refresh the view
1426 mViewManager->refreshView(); 1430 mViewManager->refreshView();
1427} 1431}
1428 1432
1429void KABCore::redo() 1433void KABCore::redo()
1430{ 1434{
1431 RedoStack::instance()->redo(); 1435 RedoStack::instance()->redo();
1432 1436
1433 // Refresh the view 1437 // Refresh the view
1434 mViewManager->refreshView(); 1438 mViewManager->refreshView();
1435} 1439}
1436void KABCore::setJumpButtonBar( bool visible ) 1440void KABCore::setJumpButtonBar( bool visible )
1437{ 1441{
1438 setJumpButtonBarVisible(visible ); 1442 setJumpButtonBarVisible(visible );
1439 saveSettings(); 1443 saveSettings();
1440} 1444}
1441void KABCore::setJumpButtonBarVisible( bool visible ) 1445void KABCore::setJumpButtonBarVisible( bool visible )
1442{ 1446{
1443 if (mMultipleViewsAtOnce) 1447 if (mMultipleViewsAtOnce)
1444 { 1448 {
1445 if ( visible ) 1449 if ( visible )
1446 mJumpButtonBar->show(); 1450 mJumpButtonBar->show();
1447 else 1451 else
1448 mJumpButtonBar->hide(); 1452 mJumpButtonBar->hide();
1449 } 1453 }
1450 else 1454 else
1451 { 1455 {
1452 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1456 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1453 if (mViewManager->isVisible()) 1457 if (mViewManager->isVisible())
1454 { 1458 {
1455 if ( visible ) 1459 if ( visible )
1456 mJumpButtonBar->show(); 1460 mJumpButtonBar->show();
1457 else 1461 else
1458 mJumpButtonBar->hide(); 1462 mJumpButtonBar->hide();
1459 } 1463 }
1460 else 1464 else
1461 { 1465 {
1462 mJumpButtonBar->hide(); 1466 mJumpButtonBar->hide();
1463 } 1467 }
1464 } 1468 }
1465 if ( visible ) { 1469 if ( visible ) {
1466 if ( mIncSearchWidget->currentItem() == 0 ) { 1470 if ( mIncSearchWidget->currentItem() == 0 ) {
1467 message( i18n("Change search field enable jump bar") ); 1471 message( i18n("Change search field enable jump bar") );
1468 } 1472 }
1469 } 1473 }
1470} 1474}
1471 1475
1472 1476
1473void KABCore::setDetailsToState() 1477void KABCore::setDetailsToState()
1474{ 1478{
1475 setDetailsVisible( mActionDetails->isChecked() ); 1479 setDetailsVisible( mActionDetails->isChecked() );
1476} 1480}
1477void KABCore::setDetailsToggle() 1481void KABCore::setDetailsToggle()
1478{ 1482{
1479 mActionDetails->setChecked( !mActionDetails->isChecked() ); 1483 mActionDetails->setChecked( !mActionDetails->isChecked() );
1480 setDetailsToState(); 1484 setDetailsToState();
1481} 1485}
1482 1486
1483 1487
1484 1488
1485void KABCore::setDetailsVisible( bool visible ) 1489void KABCore::setDetailsVisible( bool visible )
1486{ 1490{
1487 if (visible && mDetails->isHidden()) 1491 if (visible && mDetails->isHidden())
1488 { 1492 {
1489 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1493 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1490 if ( addrList.count() > 0 ) 1494 if ( addrList.count() > 0 )
1491 mDetails->setAddressee( addrList[ 0 ] ); 1495 mDetails->setAddressee( addrList[ 0 ] );
1492 } 1496 }
1493 1497
1494 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1498 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1495 // the listview and the detailview. We do that by changing the splitbar size. 1499 // the listview and the detailview. We do that by changing the splitbar size.
1496 if (mMultipleViewsAtOnce) 1500 if (mMultipleViewsAtOnce)
1497 { 1501 {
1498 if ( visible ) 1502 if ( visible )
1499 mDetails->show(); 1503 mDetails->show();
1500 else 1504 else
1501 mDetails->hide(); 1505 mDetails->hide();
1502 } 1506 }
1503 else 1507 else
1504 { 1508 {
1505 if ( visible ) { 1509 if ( visible ) {
1506 mViewManager->hide(); 1510 mViewManager->hide();
1507 mDetails->show(); 1511 mDetails->show();
1508 mIncSearchWidget->setFocus(); 1512 mIncSearchWidget->setFocus();
1509 } 1513 }
1510 else { 1514 else {
1511 mViewManager->show(); 1515 mViewManager->show();
1512 mDetails->hide(); 1516 mDetails->hide();
1513 mViewManager->setFocusAV(); 1517 mViewManager->setFocusAV();
1514 } 1518 }
1515 setJumpButtonBarVisible( !visible ); 1519 setJumpButtonBarVisible( !visible );
1516 } 1520 }
1517 1521
1518} 1522}
1519 1523
1520void KABCore::extensionChanged( int id ) 1524void KABCore::extensionChanged( int id )
1521{ 1525{
1522 //change the details view only for non desktop systems 1526 //change the details view only for non desktop systems
1523#ifndef DESKTOP_VERSION 1527#ifndef DESKTOP_VERSION
1524 1528
1525 if (id == 0) 1529 if (id == 0)
1526 { 1530 {
1527 //the user disabled the extension. 1531 //the user disabled the extension.
1528 1532
1529 if (mMultipleViewsAtOnce) 1533 if (mMultipleViewsAtOnce)
1530 { // enable detailsview again 1534 { // enable detailsview again
1531 setDetailsVisible( true ); 1535 setDetailsVisible( true );
1532 mActionDetails->setChecked( true ); 1536 mActionDetails->setChecked( true );
1533 } 1537 }
1534 else 1538 else
1535 { //go back to the listview 1539 { //go back to the listview
1536 setDetailsVisible( false ); 1540 setDetailsVisible( false );
1537 mActionDetails->setChecked( false ); 1541 mActionDetails->setChecked( false );
1538 mActionDetails->setEnabled(true); 1542 mActionDetails->setEnabled(true);
1539 } 1543 }
1540 1544
1541 } 1545 }
1542 else 1546 else
1543 { 1547 {
1544 //the user enabled the extension. 1548 //the user enabled the extension.
1545 setDetailsVisible( false ); 1549 setDetailsVisible( false );
1546 mActionDetails->setChecked( false ); 1550 mActionDetails->setChecked( false );
1547 1551
1548 if (!mMultipleViewsAtOnce) 1552 if (!mMultipleViewsAtOnce)
1549 { 1553 {
1550 mActionDetails->setEnabled(false); 1554 mActionDetails->setEnabled(false);
1551 } 1555 }
1552 1556
1553 mExtensionManager->setSelectionChanged(); 1557 mExtensionManager->setSelectionChanged();
1554 1558
1555 } 1559 }
1556 1560
1557#endif// DESKTOP_VERSION 1561#endif// DESKTOP_VERSION
1558 1562
1559} 1563}
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 47ea152..d89daee 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,524 +1,525 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KABCORE_H 24#ifndef KABCORE_H
25#define KABCORE_H 25#define KABCORE_H
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32#include <qtimer.h> 32#include <qtimer.h>
33 33
34#include <qwidget.h> 34#include <qwidget.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <ksyncmanager.h> 36#include <ksyncmanager.h>
37#ifndef DESKTOP_VERSION 37#ifndef DESKTOP_VERSION
38#include <qcopchannel_qws.h> 38#include <qcopchannel_qws.h>
39#endif 39#endif
40 40
41namespace KABC { 41namespace KABC {
42class AddressBook; 42class AddressBook;
43} 43}
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46class KAboutData; 46class KAboutData;
47class KConfig; 47class KConfig;
48 48
49class KAddressBookService; 49class KAddressBookService;
50class LDAPSearchDialog; 50class LDAPSearchDialog;
51#else //KAB_EMBEDDED 51#else //KAB_EMBEDDED
52class KAddressBookMain; 52class KAddressBookMain;
53//US class QAction; 53//US class QAction;
54#endif //KAB_EMBEDDED 54#endif //KAB_EMBEDDED
55class KCMultiDialog; 55class KCMultiDialog;
56class KXMLGUIClient; 56class KXMLGUIClient;
57class ExtensionManager; 57class ExtensionManager;
58class XXPortManager; 58class XXPortManager;
59class JumpButtonBar; 59class JumpButtonBar;
60class IncSearchWidget; 60class IncSearchWidget;
61class KDGanttMinimizeSplitter; 61class KDGanttMinimizeSplitter;
62class KAction; 62class KAction;
63class KActionCollection; 63class KActionCollection;
64class KToggleAction; 64class KToggleAction;
65class KSyncProfile; 65class KSyncProfile;
66 66
67class QAction; 67class QAction;
68class QMenuBar; 68class QMenuBar;
69class QSplitter; 69class QSplitter;
70class ViewContainer; 70class ViewContainer;
71class ViewManager; 71class ViewManager;
72class AddresseeEditorDialog; 72class AddresseeEditorDialog;
73class Ir; 73class Ir;
74 74
75class KABCore : public QWidget, public KSyncInterface 75class KABCore : public QWidget, public KSyncInterface
76{ 76{
77 Q_OBJECT 77 Q_OBJECT
78 78
79 public: 79 public:
80 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 80 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
81 81
82 82
83 ~KABCore(); 83 ~KABCore();
84 84
85 85
86#ifdef KAB_EMBEDDED 86#ifdef KAB_EMBEDDED
87 //US added functionality 87 //US added functionality
88 QPopupMenu* getViewMenu() {return viewMenu;} 88 QPopupMenu* getViewMenu() {return viewMenu;}
89 QPopupMenu* getFilterMenu() {return filterMenu;} 89 QPopupMenu* getFilterMenu() {return filterMenu;}
90 QPopupMenu* getSettingsMenu() {return settingsMenu;} 90 QPopupMenu* getSettingsMenu() {return settingsMenu;}
91 void addActionsManually(); 91 void addActionsManually();
92#endif //KAB_EMBEDDED 92#endif //KAB_EMBEDDED
93 /** 93 /**
94 Restores the global settings. 94 Restores the global settings.
95 */ 95 */
96 void restoreSettings(); 96 void restoreSettings();
97 97
98 98
99 99
100 /** 100 /**
101 Returns a pointer to the StdAddressBook of the application. 101 Returns a pointer to the StdAddressBook of the application.
102 */ 102 */
103 KABC::AddressBook *addressBook() const; 103 KABC::AddressBook *addressBook() const;
104 104
105 /** 105 /**
106 Returns a pointer to the KConfig object of the application. 106 Returns a pointer to the KConfig object of the application.
107 */ 107 */
108 static KConfig *config(); 108 static KConfig *config();
109 109
110 /** 110 /**
111 Returns a pointer to the global KActionCollection object. So 111 Returns a pointer to the global KActionCollection object. So
112 other classes can register their actions easily. 112 other classes can register their actions easily.
113 */ 113 */
114 KActionCollection *actionCollection() const; 114 KActionCollection *actionCollection() const;
115 115
116 /** 116 /**
117 Returns the current search field of the Incremental Search Widget. 117 Returns the current search field of the Incremental Search Widget.
118 */ 118 */
119 KABC::Field *currentSearchField() const; 119 KABC::Field *currentSearchField() const;
120 120
121 /** 121 /**
122 Returns the uid list of the currently selected contacts. 122 Returns the uid list of the currently selected contacts.
123 */ 123 */
124 QStringList selectedUIDs() const; 124 QStringList selectedUIDs() const;
125 125
126 /** 126 /**
127 Displays the ResourceSelectDialog and returns the selected 127 Displays the ResourceSelectDialog and returns the selected
128 resource or a null pointer if no resource was selected by 128 resource or a null pointer if no resource was selected by
129 the user. 129 the user.
130 */ 130 */
131 KABC::Resource *requestResource( QWidget *parent ); 131 KABC::Resource *requestResource( QWidget *parent );
132 132
133#ifndef KAB_EMBEDDED 133#ifndef KAB_EMBEDDED
134 static KAboutData *createAboutData(); 134 static KAboutData *createAboutData();
135#endif //KAB_EMBEDDED 135#endif //KAB_EMBEDDED
136 136
137#ifdef KAB_EMBEDDED 137#ifdef KAB_EMBEDDED
138 inline QPopupMenu* getImportMenu() { return ImportMenu;} 138 inline QPopupMenu* getImportMenu() { return ImportMenu;}
139 inline QPopupMenu* getExportMenu() { return ExportMenu;} 139 inline QPopupMenu* getExportMenu() { return ExportMenu;}
140#endif //KAB_EMBEDDED 140#endif //KAB_EMBEDDED
141 141
142 public slots: 142 public slots:
143#ifdef KAB_EMBEDDED 143#ifdef KAB_EMBEDDED
144 void createAboutData(); 144 void createAboutData();
145#endif //KAB_EMBEDDED 145#endif //KAB_EMBEDDED
146 void setDetailsToggle(); 146 void setDetailsToggle();
147 147
148 void showLicence(); 148 void showLicence();
149 void faq(); 149 void faq();
150 void whatsnew() ; 150 void whatsnew() ;
151 void synchowto() ; 151 void synchowto() ;
152 void multisynchowto() ; 152 void multisynchowto() ;
153 void kdesynchowto() ; 153 void kdesynchowto() ;
154 void writeToPhone(); 154 void writeToPhone();
155 155
156 /** 156 /**
157 Is called whenever a contact is selected in the view. 157 Is called whenever a contact is selected in the view.
158 */ 158 */
159 void setContactSelected( const QString &uid ); 159 void setContactSelected( const QString &uid );
160 160
161 /** 161 /**
162 Opens the preferred mail composer with all selected contacts as 162 Opens the preferred mail composer with all selected contacts as
163 arguments. 163 arguments.
164 */ 164 */
165 void sendMail(); 165 void sendMail();
166 166
167 /** 167 /**
168 Opens the preferred mail composer with the given contacts as 168 Opens the preferred mail composer with the given contacts as
169 arguments. 169 arguments.
170 */ 170 */
171 void sendMail( const QString& email ); 171 void sendMail( const QString& email );
172 172
173 173
174 void mailVCard(); 174 void mailVCard();
175 void mailVCard(const QStringList& uids); 175 void mailVCard(const QStringList& uids);
176 176
177 /** 177 /**
178 Beams the "WhoAmI contact. 178 Beams the "WhoAmI contact.
179 */ 179 */
180 void beamMySelf(); 180 void beamMySelf();
181 181
182 void beamVCard(); 182 void beamVCard();
183 void export2phone(); 183 void export2phone();
184 void beamVCard(const QStringList& uids); 184 void beamVCard(const QStringList& uids);
185 void beamDone( Ir *ir ); 185 void beamDone( Ir *ir );
186 186
187 187
188 /** 188 /**
189 Starts the preferred web browser with the given URL as argument. 189 Starts the preferred web browser with the given URL as argument.
190 */ 190 */
191 void browse( const QString& url ); 191 void browse( const QString& url );
192 192
193 /** 193 /**
194 Select all contacts in the view. 194 Select all contacts in the view.
195 */ 195 */
196 void selectAllContacts(); 196 void selectAllContacts();
197 197
198 /** 198 /**
199 Deletes all selected contacts from the address book. 199 Deletes all selected contacts from the address book.
200 */ 200 */
201 void deleteContacts(); 201 void deleteContacts();
202 202
203 /** 203 /**
204 Deletes given contacts from the address book. 204 Deletes given contacts from the address book.
205 205
206 @param uids The uids of the contacts, which shall be deleted. 206 @param uids The uids of the contacts, which shall be deleted.
207 */ 207 */
208 void deleteContacts( const QStringList &uids ); 208 void deleteContacts( const QStringList &uids );
209 209
210 /** 210 /**
211 Copys the selected contacts into clipboard for later pasting. 211 Copys the selected contacts into clipboard for later pasting.
212 */ 212 */
213 void copyContacts(); 213 void copyContacts();
214 214
215 /** 215 /**
216 Cuts the selected contacts and stores them for later pasting. 216 Cuts the selected contacts and stores them for later pasting.
217 */ 217 */
218 void cutContacts(); 218 void cutContacts();
219 219
220 /** 220 /**
221 Paste contacts from clipboard into the address book. 221 Paste contacts from clipboard into the address book.
222 */ 222 */
223 void pasteContacts(); 223 void pasteContacts();
224 224
225 /** 225 /**
226 Paste given contacts into the address book. 226 Paste given contacts into the address book.
227 227
228 @param list The list of addressee, which shall be pasted. 228 @param list The list of addressee, which shall be pasted.
229 */ 229 */
230 void pasteContacts( KABC::Addressee::List &list ); 230 void pasteContacts( KABC::Addressee::List &list );
231 231
232 /** 232 /**
233 Sets the whoAmI contact, that is used by many other programs to 233 Sets the whoAmI contact, that is used by many other programs to
234 get personal information about the current user. 234 get personal information about the current user.
235 */ 235 */
236 void setWhoAmI(); 236 void setWhoAmI();
237 237
238 /** 238 /**
239 Displays the category dialog and applies the result to all 239 Displays the category dialog and applies the result to all
240 selected contacts. 240 selected contacts.
241 */ 241 */
242 void setCategories(); 242 void setCategories();
243 void manageCategories(); 243 void manageCategories();
244 void editCategories(); 244 void editCategories();
245 245
246 /** 246 /**
247 Sets the field list of the Incremental Search Widget. 247 Sets the field list of the Incremental Search Widget.
248 */ 248 */
249 void setSearchFields( const KABC::Field::List &fields ); 249 void setSearchFields( const KABC::Field::List &fields );
250 250
251 /** 251 /**
252 Search with the current search field for a contact, that matches 252 Search with the current search field for a contact, that matches
253 the given text, and selects it in the view. 253 the given text, and selects it in the view.
254 */ 254 */
255 void incrementalSearch( const QString& text ); 255 void incrementalSearch( const QString& text );
256 void incrementalSearchJump( const QString& text );
256 257
257 /** 258 /**
258 Marks the address book as modified. 259 Marks the address book as modified.
259 */ 260 */
260 void setModified(); 261 void setModified();
261 /** 262 /**
262 Marks the address book as modified without refreshing the view. 263 Marks the address book as modified without refreshing the view.
263 */ 264 */
264 void setModifiedWOrefresh(); 265 void setModifiedWOrefresh();
265 266
266 /** 267 /**
267 Marks the address book as modified concerning the argument. 268 Marks the address book as modified concerning the argument.
268 */ 269 */
269 void setModified( bool modified ); 270 void setModified( bool modified );
270 271
271 /** 272 /**
272 Returns whether the address book is modified. 273 Returns whether the address book is modified.
273 */ 274 */
274 bool modified() const; 275 bool modified() const;
275 276
276 /** 277 /**
277 Called whenever an contact is modified in the contact editor 278 Called whenever an contact is modified in the contact editor
278 dialog or the quick edit. 279 dialog or the quick edit.
279 */ 280 */
280 void contactModified( const KABC::Addressee &addr ); 281 void contactModified( const KABC::Addressee &addr );
281 void addrModified( const KABC::Addressee &addr, bool updateDetails = true ); 282 void addrModified( const KABC::Addressee &addr, bool updateDetails = true );
282 283
283 /** 284 /**
284 DCOP METHODS. 285 DCOP METHODS.
285 */ 286 */
286 void addEmail( QString addr ); 287 void addEmail( QString addr );
287 void importVCard( const KURL& url, bool showPreview ); 288 void importVCard( const KURL& url, bool showPreview );
288 void importVCard( const QString& vCard, bool showPreview ); 289 void importVCard( const QString& vCard, bool showPreview );
289 void newContact(); 290 void newContact();
290 QString getNameByPhone( const QString& phone ); 291 QString getNameByPhone( const QString& phone );
291 /** 292 /**
292 END DCOP METHODS 293 END DCOP METHODS
293 */ 294 */
294 295
295 /** 296 /**
296 Saves the contents of the AddressBook back to disk. 297 Saves the contents of the AddressBook back to disk.
297 */ 298 */
298 void save(); 299 void save();
299 300
300 /** 301 /**
301 Undos the last command using the undo stack. 302 Undos the last command using the undo stack.
302 */ 303 */
303 void undo(); 304 void undo();
304 305
305 /** 306 /**
306 Redos the last command that was undone, using the redo stack. 307 Redos the last command that was undone, using the redo stack.
307 */ 308 */
308 void redo(); 309 void redo();
309 310
310 /** 311 /**
311 Shows the edit dialog for the given uid. If the uid is QString::null, 312 Shows the edit dialog for the given uid. If the uid is QString::null,
312 the method will try to find a selected addressee in the view. 313 the method will try to find a selected addressee in the view.
313 */ 314 */
314 void editContact( const QString &uid /*US = QString::null*/ ); 315 void editContact( const QString &uid /*US = QString::null*/ );
315//US added a second method without defaultparameter 316//US added a second method without defaultparameter
316 void editContact2(); 317 void editContact2();
317 318
318 /** 319 /**
319 Shows or edits the detail view for the given uid. If the uid is QString::null, 320 Shows or edits the detail view for the given uid. If the uid is QString::null,
320 the method will try to find a selected addressee in the view. 321 the method will try to find a selected addressee in the view.
321 */ 322 */
322 void executeContact( const QString &uid /*US = QString::null*/ ); 323 void executeContact( const QString &uid /*US = QString::null*/ );
323 324
324 /** 325 /**
325 Launches the configuration dialog. 326 Launches the configuration dialog.
326 */ 327 */
327 void openConfigDialog(); 328 void openConfigDialog();
328 329
329 /** 330 /**
330 Launches the ldap search dialog. 331 Launches the ldap search dialog.
331 */ 332 */
332 void openLDAPDialog(); 333 void openLDAPDialog();
333 334
334 /** 335 /**
335 Creates a KAddressBookPrinter, which will display the print 336 Creates a KAddressBookPrinter, which will display the print
336 dialog and do the printing. 337 dialog and do the printing.
337 */ 338 */
338 void print(); 339 void print();
339 340
340 /** 341 /**
341 Registers a new GUI client, so plugins can register its actions. 342 Registers a new GUI client, so plugins can register its actions.
342 */ 343 */
343 void addGUIClient( KXMLGUIClient *client ); 344 void addGUIClient( KXMLGUIClient *client );
344 345
345 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 346 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
346 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 347 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
347 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 348 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
348 349
349 350
350 signals: 351 signals:
351 void contactSelected( const QString &name ); 352 void contactSelected( const QString &name );
352 void contactSelected( const QPixmap &pixmap ); 353 void contactSelected( const QPixmap &pixmap );
353 public slots: 354 public slots:
354 void recieve(QString cmsg ); 355 void recieve(QString cmsg );
355 void getFile( bool success ); 356 void getFile( bool success );
356 void syncFileRequest(); 357 void syncFileRequest();
357 void setDetailsVisible( bool visible ); 358 void setDetailsVisible( bool visible );
358 void setDetailsToState(); 359 void setDetailsToState();
359 360
360 void saveSettings(); 361 void saveSettings();
361 362
362 private slots: 363 private slots:
363 void updateToolBar(); 364 void updateToolBar();
364 void updateMainWindow(); 365 void updateMainWindow();
365 void receive( const QCString& cmsg, const QByteArray& data ); 366 void receive( const QCString& cmsg, const QByteArray& data );
366 void toggleBeamReceive( ); 367 void toggleBeamReceive( );
367 void disableBR(bool); 368 void disableBR(bool);
368 void setJumpButtonBarVisible( bool visible ); 369 void setJumpButtonBarVisible( bool visible );
369 void setJumpButtonBar( bool visible ); 370 void setJumpButtonBar( bool visible );
370 void setCaptionBack(); 371 void setCaptionBack();
371 void resizeAndCallContactdialog(); 372 void resizeAndCallContactdialog();
372 void callContactdialog(); 373 void callContactdialog();
373 374
374 void importFromOL(); 375 void importFromOL();
375 void extensionModified( const KABC::Addressee::List &list ); 376 void extensionModified( const KABC::Addressee::List &list );
376 void extensionChanged( int id ); 377 void extensionChanged( int id );
377 void clipboardDataChanged(); 378 void clipboardDataChanged();
378 void updateActionMenu(); 379 void updateActionMenu();
379 void configureKeyBindings(); 380 void configureKeyBindings();
380 void removeVoice(); 381 void removeVoice();
381 void setFormattedName(); 382 void setFormattedName();
382#ifdef KAB_EMBEDDED 383#ifdef KAB_EMBEDDED
383 void configureResources(); 384 void configureResources();
384#endif //KAB_EMBEDDED 385#endif //KAB_EMBEDDED
385 386
386 void slotEditorDestroyed( const QString &uid ); 387 void slotEditorDestroyed( const QString &uid );
387 void configurationChanged(); 388 void configurationChanged();
388 void addressBookChanged(); 389 void addressBookChanged();
389 390
390 private: 391 private:
391 QString mEmailSourceChannel; 392 QString mEmailSourceChannel;
392 void resizeEvent(QResizeEvent* e ); 393 void resizeEvent(QResizeEvent* e );
393 bool mBRdisabled; 394 bool mBRdisabled;
394#ifndef DESKTOP_VERSION 395#ifndef DESKTOP_VERSION
395 QCopChannel* infrared; 396 QCopChannel* infrared;
396#endif 397#endif
397 QTimer *mMessageTimer; 398 QTimer *mMessageTimer;
398 void initGUI(); 399 void initGUI();
399 void initActions(); 400 void initActions();
400 QString getPhoneFile(); 401 QString getPhoneFile();
401 402
402 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 403 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
403 const char *name = 0 ); 404 const char *name = 0 );
404 405
405 KXMLGUIClient *mGUIClient; 406 KXMLGUIClient *mGUIClient;
406 407
407 KABC::AddressBook *mAddressBook; 408 KABC::AddressBook *mAddressBook;
408 409
409 ViewManager *mViewManager; 410 ViewManager *mViewManager;
410 // QSplitter *mDetailsSplitter; 411 // QSplitter *mDetailsSplitter;
411 KDGanttMinimizeSplitter *mExtensionBarSplitter; 412 KDGanttMinimizeSplitter *mExtensionBarSplitter;
412 ViewContainer *mDetails; 413 ViewContainer *mDetails;
413 KDGanttMinimizeSplitter* mMiniSplitter; 414 KDGanttMinimizeSplitter* mMiniSplitter;
414 XXPortManager *mXXPortManager; 415 XXPortManager *mXXPortManager;
415 JumpButtonBar *mJumpButtonBar; 416 JumpButtonBar *mJumpButtonBar;
416 IncSearchWidget *mIncSearchWidget; 417 IncSearchWidget *mIncSearchWidget;
417 ExtensionManager *mExtensionManager; 418 ExtensionManager *mExtensionManager;
418 419
419 KCMultiDialog *mConfigureDialog; 420 KCMultiDialog *mConfigureDialog;
420 421
421#ifndef KAB_EMBEDDED 422#ifndef KAB_EMBEDDED
422 LDAPSearchDialog *mLdapSearchDialog; 423 LDAPSearchDialog *mLdapSearchDialog;
423#endif //KAB_EMBEDDED 424#endif //KAB_EMBEDDED
424 // QDict<AddresseeEditorDialog> mEditorDict; 425 // QDict<AddresseeEditorDialog> mEditorDict;
425 AddresseeEditorDialog *mEditorDialog; 426 AddresseeEditorDialog *mEditorDialog;
426 bool mReadWrite; 427 bool mReadWrite;
427 bool mModified; 428 bool mModified;
428 bool mIsPart; 429 bool mIsPart;
429 bool mMultipleViewsAtOnce; 430 bool mMultipleViewsAtOnce;
430 431
431 432
432 //US file menu 433 //US file menu
433 KAction *mActionMail; 434 KAction *mActionMail;
434 KAction *mActionBeam; 435 KAction *mActionBeam;
435 KToggleAction *mActionBR; 436 KToggleAction *mActionBR;
436 KAction *mActionExport2phone; 437 KAction *mActionExport2phone;
437 KAction* mActionPrint; 438 KAction* mActionPrint;
438 KAction* mActionPrintDetails; 439 KAction* mActionPrintDetails;
439 KAction* mActionNewContact; 440 KAction* mActionNewContact;
440 KAction *mActionSave; 441 KAction *mActionSave;
441 KAction *mActionEditAddressee; 442 KAction *mActionEditAddressee;
442 KAction *mActionMailVCard; 443 KAction *mActionMailVCard;
443 KAction *mActionBeamVCard; 444 KAction *mActionBeamVCard;
444 445
445 KAction *mActionQuit; 446 KAction *mActionQuit;
446 447
447 //US edit menu 448 //US edit menu
448 KAction *mActionCopy; 449 KAction *mActionCopy;
449 KAction *mActionCut; 450 KAction *mActionCut;
450 KAction *mActionPaste; 451 KAction *mActionPaste;
451 KAction *mActionSelectAll; 452 KAction *mActionSelectAll;
452 KAction *mActionUndo; 453 KAction *mActionUndo;
453 KAction *mActionRedo; 454 KAction *mActionRedo;
454 KAction *mActionDelete; 455 KAction *mActionDelete;
455 456
456 //US settings menu 457 //US settings menu
457 KAction *mActionConfigResources; 458 KAction *mActionConfigResources;
458 KAction *mActionConfigKAddressbook; 459 KAction *mActionConfigKAddressbook;
459 KAction *mActionConfigShortcuts; 460 KAction *mActionConfigShortcuts;
460 KAction *mActionConfigureToolbars; 461 KAction *mActionConfigureToolbars;
461 KAction *mActionKeyBindings; 462 KAction *mActionKeyBindings;
462 KToggleAction *mActionJumpBar; 463 KToggleAction *mActionJumpBar;
463 KToggleAction *mActionDetails; 464 KToggleAction *mActionDetails;
464 KAction *mActionWhoAmI; 465 KAction *mActionWhoAmI;
465 KAction *mActionCategories; 466 KAction *mActionCategories;
466 KAction *mActionEditCategories; 467 KAction *mActionEditCategories;
467 KAction *mActionManageCategories; 468 KAction *mActionManageCategories;
468 KAction *mActionAboutKAddressbook; 469 KAction *mActionAboutKAddressbook;
469 KAction *mActionLicence; 470 KAction *mActionLicence;
470 KAction *mActionFaq; 471 KAction *mActionFaq;
471 KAction *mActionWN; 472 KAction *mActionWN;
472 KAction *mActionSyncHowto; 473 KAction *mActionSyncHowto;
473 KAction *mActionKdeSyncHowto; 474 KAction *mActionKdeSyncHowto;
474 KAction *mActionMultiSyncHowto; 475 KAction *mActionMultiSyncHowto;
475 476
476 KAction *mActionDeleteView; 477 KAction *mActionDeleteView;
477 478
478 QPopupMenu *viewMenu; 479 QPopupMenu *viewMenu;
479 QPopupMenu *filterMenu; 480 QPopupMenu *filterMenu;
480 QPopupMenu *settingsMenu; 481 QPopupMenu *settingsMenu;
481 QPopupMenu *changeMenu; 482 QPopupMenu *changeMenu;
482 QPopupMenu *beamMenu; 483 QPopupMenu *beamMenu;
483//US QAction *mActionSave; 484//US QAction *mActionSave;
484 QPopupMenu *ImportMenu; 485 QPopupMenu *ImportMenu;
485 QPopupMenu *ExportMenu; 486 QPopupMenu *ExportMenu;
486 //LR additional methods 487 //LR additional methods
487 KAction *mActionRemoveVoice; 488 KAction *mActionRemoveVoice;
488 KAction *mActionSetFormattedName; 489 KAction *mActionSetFormattedName;
489 KAction * mActionImportOL; 490 KAction * mActionImportOL;
490 491
491#ifndef KAB_EMBEDDED 492#ifndef KAB_EMBEDDED
492 KAddressBookService *mAddressBookService; 493 KAddressBookService *mAddressBookService;
493#endif //KAB_EMBEDDED 494#endif //KAB_EMBEDDED
494 495
495 class KABCorePrivate; 496 class KABCorePrivate;
496 KABCorePrivate *d; 497 KABCorePrivate *d;
497 //US bool mBlockSaveFlag; 498 //US bool mBlockSaveFlag;
498 499
499#ifdef KAB_EMBEDDED 500#ifdef KAB_EMBEDDED
500 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 501 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
501#endif //KAB_EMBEDDED 502#endif //KAB_EMBEDDED
502 503
503 //this are the overwritten callbackmethods from the syncinterface 504 //this are the overwritten callbackmethods from the syncinterface
504 virtual bool sync(KSyncManager* manager, QString filename, int mode); 505 virtual bool sync(KSyncManager* manager, QString filename, int mode);
505 virtual bool syncExternal(KSyncManager* manager, QString resource); 506 virtual bool syncExternal(KSyncManager* manager, QString resource);
506 virtual void removeSyncInfo( QString syncProfile); 507 virtual void removeSyncInfo( QString syncProfile);
507 bool syncPhone(); 508 bool syncPhone();
508 void message( QString m , bool startTimer = true); 509 void message( QString m , bool startTimer = true);
509 510
510 // LR ******************************* 511 // LR *******************************
511 // sync stuff! 512 // sync stuff!
512 QString sentSyncFile(); 513 QString sentSyncFile();
513 QPopupMenu *syncMenu; 514 QPopupMenu *syncMenu;
514 KSyncManager* syncManager; 515 KSyncManager* syncManager;
515 int mGlobalSyncMode; 516 int mGlobalSyncMode;
516 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 517 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
517 KABC::Addressee getLastSyncAddressee(); 518 KABC::Addressee getLastSyncAddressee();
518 QDateTime mLastAddressbookSync; 519 QDateTime mLastAddressbookSync;
519 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 520 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
520 // ********************* 521 // *********************
521 522
522}; 523};
523 524
524#endif 525#endif