summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-30 01:46:35 (UTC)
committer zautrix <zautrix>2004-10-30 01:46:35 (UTC)
commit6c755a7a8a1e9d9a747267eadf914a6030c9b711 (patch) (unidiff)
tree14b1b8ed39f50683f095ca5fb7656abd3326854e
parentc477fa8ba7eacfaba3d154a72153acc7bc46abdc (diff)
downloadkdepimpi-6c755a7a8a1e9d9a747267eadf914a6030c9b711.zip
kdepimpi-6c755a7a8a1e9d9a747267eadf914a6030c9b711.tar.gz
kdepimpi-6c755a7a8a1e9d9a747267eadf914a6030c9b711.tar.bz2
better cat management in kapi
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp107
-rw-r--r--kaddressbook/kabcore.h2
2 files changed, 106 insertions, 3 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 83027ac..9505a23 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,353 +1,391 @@
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/*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 118
119 119
120#include <kresources/selectdialog.h> 120#include <kresources/selectdialog.h>
121#include <kmessagebox.h> 121#include <kmessagebox.h>
122 122
123#include <picture.h> 123#include <picture.h>
124#include <resource.h> 124#include <resource.h>
125 125
126//US#include <qsplitter.h> 126//US#include <qsplitter.h>
127#include <qmap.h> 127#include <qmap.h>
128#include <qdir.h> 128#include <qdir.h>
129#include <qfile.h> 129#include <qfile.h>
130#include <qvbox.h> 130#include <qvbox.h>
131#include <qlayout.h> 131#include <qlayout.h>
132#include <qclipboard.h> 132#include <qclipboard.h>
133#include <qtextstream.h> 133#include <qtextstream.h>
134#include <qradiobutton.h>
135#include <qbuttongroup.h>
134 136
135#include <libkdepim/categoryselectdialog.h> 137#include <libkdepim/categoryselectdialog.h>
138#include <libkdepim/categoryeditdialog.h>
136#include <kabc/vcardconverter.h> 139#include <kabc/vcardconverter.h>
137 140
138 141
139#include "addresseeutil.h" 142#include "addresseeutil.h"
140#include "undocmds.h" 143#include "undocmds.h"
141#include "addresseeeditordialog.h" 144#include "addresseeeditordialog.h"
142#include "viewmanager.h" 145#include "viewmanager.h"
143#include "details/detailsviewcontainer.h" 146#include "details/detailsviewcontainer.h"
144#include "kabprefs.h" 147#include "kabprefs.h"
145#include "xxportmanager.h" 148#include "xxportmanager.h"
146#include "incsearchwidget.h" 149#include "incsearchwidget.h"
147#include "jumpbuttonbar.h" 150#include "jumpbuttonbar.h"
148#include "extensionmanager.h" 151#include "extensionmanager.h"
149#include "addresseeconfig.h" 152#include "addresseeconfig.h"
150#include <kcmultidialog.h> 153#include <kcmultidialog.h>
151 154
152#ifdef _WIN32_ 155#ifdef _WIN32_
153 156
154#include "kaimportoldialog.h" 157#include "kaimportoldialog.h"
155#else 158#else
156#include <unistd.h> 159#include <unistd.h>
157#endif 160#endif
158// sync includes 161// sync includes
159#include <libkdepim/ksyncprofile.h> 162#include <libkdepim/ksyncprofile.h>
160#include <libkdepim/ksyncprefsdialog.h> 163#include <libkdepim/ksyncprefsdialog.h>
161 164
165
166class KABCatPrefs : public QDialog
167{
168 public:
169 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
170 QDialog( parent, name, true )
171 {
172 setCaption( i18n("Manage new Categories") );
173 QVBoxLayout* lay = new QVBoxLayout( this );
174 lay->setSpacing( 3 );
175 lay->setMargin( 3 );
176 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 );
177 lay->addWidget( lab );
178 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
179 lay->addWidget( format );
180 format->setExclusive ( true ) ;
181 addCatBut = new QRadioButton(i18n("Add to category list"), format );
182 new QRadioButton(i18n("Remove from addressees"), format );
183 addCatBut->setChecked( true );
184 QPushButton * ok = new QPushButton( i18n("OK"), this );
185 lay->addWidget( ok );
186 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
187 lay->addWidget( cancel );
188 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
189 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
190 resize( 200, 200 );
191 }
192
193 bool addCat() { return addCatBut->isChecked(); }
194private:
195 QRadioButton* addCatBut;
196};
197
198
199
162class KAex2phonePrefs : public QDialog 200class KAex2phonePrefs : public QDialog
163{ 201{
164 public: 202 public:
165 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 203 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
166 QDialog( parent, name, true ) 204 QDialog( parent, name, true )
167 { 205 {
168 setCaption( i18n("Export to phone options") ); 206 setCaption( i18n("Export to phone options") );
169 QVBoxLayout* lay = new QVBoxLayout( this ); 207 QVBoxLayout* lay = new QVBoxLayout( this );
170 lay->setSpacing( 3 ); 208 lay->setSpacing( 3 );
171 lay->setMargin( 3 ); 209 lay->setMargin( 3 );
172 QLabel *lab; 210 QLabel *lab;
173 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 211 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
174 lab->setAlignment (AlignHCenter ); 212 lab->setAlignment (AlignHCenter );
175 QHBox* temphb; 213 QHBox* temphb;
176 temphb = new QHBox( this ); 214 temphb = new QHBox( this );
177 new QLabel( i18n("I/O device: "), temphb ); 215 new QLabel( i18n("I/O device: "), temphb );
178 mPhoneDevice = new QLineEdit( temphb); 216 mPhoneDevice = new QLineEdit( temphb);
179 lay->addWidget( temphb ); 217 lay->addWidget( temphb );
180 temphb = new QHBox( this ); 218 temphb = new QHBox( this );
181 new QLabel( i18n("Connection: "), temphb ); 219 new QLabel( i18n("Connection: "), temphb );
182 mPhoneConnection = new QLineEdit( temphb); 220 mPhoneConnection = new QLineEdit( temphb);
183 lay->addWidget( temphb ); 221 lay->addWidget( temphb );
184 temphb = new QHBox( this ); 222 temphb = new QHBox( this );
185 new QLabel( i18n("Model(opt.): "), temphb ); 223 new QLabel( i18n("Model(opt.): "), temphb );
186 mPhoneModel = new QLineEdit( temphb); 224 mPhoneModel = new QLineEdit( temphb);
187 lay->addWidget( temphb ); 225 lay->addWidget( temphb );
188 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 226 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
189 // lay->addWidget( mWriteToSim ); 227 // lay->addWidget( mWriteToSim );
190 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 228 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
191 lab->setAlignment (AlignHCenter ); 229 lab->setAlignment (AlignHCenter );
192 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 230 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
193 lay->addWidget( ok ); 231 lay->addWidget( ok );
194 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 232 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
195 lay->addWidget( cancel ); 233 lay->addWidget( cancel );
196 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 234 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
197 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 235 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
198 resize( 220, 240 ); 236 resize( 220, 240 );
199 237
200 } 238 }
201 239
202public: 240public:
203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 241 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
204 QCheckBox* mWriteToSim; 242 QCheckBox* mWriteToSim;
205}; 243};
206 244
207 245
208bool pasteWithNewUid = true; 246bool pasteWithNewUid = true;
209 247
210#ifdef KAB_EMBEDDED 248#ifdef KAB_EMBEDDED
211KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 249KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
212 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 250 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
213 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 251 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
214 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 252 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
215#else //KAB_EMBEDDED 253#else //KAB_EMBEDDED
216KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 254KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
217 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 255 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
218 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 256 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
219 mReadWrite( readWrite ), mModified( false ) 257 mReadWrite( readWrite ), mModified( false )
220#endif //KAB_EMBEDDED 258#endif //KAB_EMBEDDED
221{ 259{
222 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 260 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
223 // syncManager->setBlockSave(false); 261 // syncManager->setBlockSave(false);
224 mExtensionBarSplitter = 0; 262 mExtensionBarSplitter = 0;
225 mIsPart = !parent->inherits( "KAddressBookMain" ); 263 mIsPart = !parent->inherits( "KAddressBookMain" );
226 mAddressBook = KABC::StdAddressBook::self(); 264 mAddressBook = KABC::StdAddressBook::self();
227 KABC::StdAddressBook::setAutomaticSave( false ); 265 KABC::StdAddressBook::setAutomaticSave( false );
228 266
229#ifndef KAB_EMBEDDED 267#ifndef KAB_EMBEDDED
230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 268 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
231#endif //KAB_EMBEDDED 269#endif //KAB_EMBEDDED
232 270
233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 271 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
234 SLOT( addressBookChanged() ) ); 272 SLOT( addressBookChanged() ) );
235 273
236#if 0 274#if 0
237 // LP moved to addressbook init method 275 // LP moved to addressbook init method
238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 276 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
239 "X-Department", "KADDRESSBOOK" ); 277 "X-Department", "KADDRESSBOOK" );
240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 278 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
241 "X-Profession", "KADDRESSBOOK" ); 279 "X-Profession", "KADDRESSBOOK" );
242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 280 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
243 "X-AssistantsName", "KADDRESSBOOK" ); 281 "X-AssistantsName", "KADDRESSBOOK" );
244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 282 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
245 "X-ManagersName", "KADDRESSBOOK" ); 283 "X-ManagersName", "KADDRESSBOOK" );
246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 284 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
247 "X-SpousesName", "KADDRESSBOOK" ); 285 "X-SpousesName", "KADDRESSBOOK" );
248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 286 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
249 "X-Office", "KADDRESSBOOK" ); 287 "X-Office", "KADDRESSBOOK" );
250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 288 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
251 "X-IMAddress", "KADDRESSBOOK" ); 289 "X-IMAddress", "KADDRESSBOOK" );
252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 290 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
253 "X-Anniversary", "KADDRESSBOOK" ); 291 "X-Anniversary", "KADDRESSBOOK" );
254 292
255 //US added this field to become compatible with Opie/qtopia addressbook 293 //US added this field to become compatible with Opie/qtopia addressbook
256 // values can be "female" or "male" or "". An empty field represents undefined. 294 // values can be "female" or "male" or "". An empty field represents undefined.
257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 295 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
258 "X-Gender", "KADDRESSBOOK" ); 296 "X-Gender", "KADDRESSBOOK" );
259 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 297 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
260 "X-Children", "KADDRESSBOOK" ); 298 "X-Children", "KADDRESSBOOK" );
261 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 299 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
262 "X-FreeBusyUrl", "KADDRESSBOOK" ); 300 "X-FreeBusyUrl", "KADDRESSBOOK" );
263#endif 301#endif
264 initGUI(); 302 initGUI();
265 303
266 mIncSearchWidget->setFocus(); 304 mIncSearchWidget->setFocus();
267 305
268 306
269 connect( mViewManager, SIGNAL( selected( const QString& ) ), 307 connect( mViewManager, SIGNAL( selected( const QString& ) ),
270 SLOT( setContactSelected( const QString& ) ) ); 308 SLOT( setContactSelected( const QString& ) ) );
271 connect( mViewManager, SIGNAL( executed( const QString& ) ), 309 connect( mViewManager, SIGNAL( executed( const QString& ) ),
272 SLOT( executeContact( const QString& ) ) ); 310 SLOT( executeContact( const QString& ) ) );
273 311
274 connect( mViewManager, SIGNAL( deleteRequest( ) ), 312 connect( mViewManager, SIGNAL( deleteRequest( ) ),
275 SLOT( deleteContacts( ) ) ); 313 SLOT( deleteContacts( ) ) );
276 connect( mViewManager, SIGNAL( modified() ), 314 connect( mViewManager, SIGNAL( modified() ),
277 SLOT( setModified() ) ); 315 SLOT( setModified() ) );
278 316
279 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 317 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 318 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
281 319
282 connect( mXXPortManager, SIGNAL( modified() ), 320 connect( mXXPortManager, SIGNAL( modified() ),
283 SLOT( setModified() ) ); 321 SLOT( setModified() ) );
284 322
285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 323 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
286 SLOT( incrementalSearch( const QString& ) ) ); 324 SLOT( incrementalSearch( const QString& ) ) );
287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 325 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
288 mJumpButtonBar, SLOT( recreateButtons() ) ); 326 mJumpButtonBar, SLOT( recreateButtons() ) );
289 327
290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 328 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
291 SLOT( sendMail( const QString& ) ) ); 329 SLOT( sendMail( const QString& ) ) );
292 330
293 331
294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 332 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
295 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&))); 333 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&)));
296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 334 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
297 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 335 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
298 336
299 337
300#ifndef KAB_EMBEDDED 338#ifndef KAB_EMBEDDED
301 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 339 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
302 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 340 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
303 341
304 connect( mDetails, SIGNAL( browse( const QString& ) ), 342 connect( mDetails, SIGNAL( browse( const QString& ) ),
305 SLOT( browse( const QString& ) ) ); 343 SLOT( browse( const QString& ) ) );
306 344
307 345
308 mAddressBookService = new KAddressBookService( this ); 346 mAddressBookService = new KAddressBookService( this );
309 347
310#endif //KAB_EMBEDDED 348#endif //KAB_EMBEDDED
311 349
312 mMessageTimer = new QTimer( this ); 350 mMessageTimer = new QTimer( this );
313 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 351 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
314 mEditorDialog = 0; 352 mEditorDialog = 0;
315 createAddresseeEditorDialog( this ); 353 createAddresseeEditorDialog( this );
316 setModified( false ); 354 setModified( false );
317 mBRdisabled = false; 355 mBRdisabled = false;
318#ifndef DESKTOP_VERSION 356#ifndef DESKTOP_VERSION
319 infrared = 0; 357 infrared = 0;
320#endif 358#endif
321 //toggleBeamReceive( ); 359 //toggleBeamReceive( );
322} 360}
323 361
324KABCore::~KABCore() 362KABCore::~KABCore()
325{ 363{
326 // save(); 364 // save();
327 //saveSettings(); 365 //saveSettings();
328 //KABPrefs::instance()->writeConfig(); 366 //KABPrefs::instance()->writeConfig();
329 delete AddresseeConfig::instance(); 367 delete AddresseeConfig::instance();
330 mAddressBook = 0; 368 mAddressBook = 0;
331 KABC::StdAddressBook::close(); 369 KABC::StdAddressBook::close();
332 370
333 delete syncManager; 371 delete syncManager;
334#ifndef DESKTOP_VERSION 372#ifndef DESKTOP_VERSION
335 if ( infrared ) 373 if ( infrared )
336 delete infrared; 374 delete infrared;
337#endif 375#endif
338} 376}
339void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 377void KABCore::receive( const QCString& cmsg, const QByteArray& data )
340{ 378{
341 qDebug("KA: QCOP message received: %s ", cmsg.data() ); 379 qDebug("KA: QCOP message received: %s ", cmsg.data() );
342 if ( cmsg == "setDocument(QString)" ) { 380 if ( cmsg == "setDocument(QString)" ) {
343 QDataStream stream( data, IO_ReadOnly ); 381 QDataStream stream( data, IO_ReadOnly );
344 QString fileName; 382 QString fileName;
345 stream >> fileName; 383 stream >> fileName;
346 recieve( fileName ); 384 recieve( fileName );
347 return; 385 return;
348 } 386 }
349} 387}
350void KABCore::toggleBeamReceive( ) 388void KABCore::toggleBeamReceive( )
351{ 389{
352 if ( mBRdisabled ) 390 if ( mBRdisabled )
353 return; 391 return;
@@ -767,417 +805,420 @@ void KABCore::export2phone()
767} 805}
768QString KABCore::getPhoneFile() 806QString KABCore::getPhoneFile()
769{ 807{
770#ifdef DESKTOP_VERSION 808#ifdef DESKTOP_VERSION
771 return locateLocal("tmp", "phonefile.vcf"); 809 return locateLocal("tmp", "phonefile.vcf");
772#else 810#else
773 return "/tmp/phonefile.vcf"; 811 return "/tmp/phonefile.vcf";
774#endif 812#endif
775 813
776} 814}
777void KABCore::writeToPhone( ) 815void KABCore::writeToPhone( )
778{ 816{
779 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 817 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
780 message(i18n("Export to phone finished!")); 818 message(i18n("Export to phone finished!"));
781 else 819 else
782 qDebug(i18n("Error exporting to phone")); 820 qDebug(i18n("Error exporting to phone"));
783} 821}
784void KABCore::beamVCard() 822void KABCore::beamVCard()
785{ 823{
786 QStringList uids = mViewManager->selectedUids(); 824 QStringList uids = mViewManager->selectedUids();
787 if ( !uids.isEmpty() ) 825 if ( !uids.isEmpty() )
788 beamVCard( uids ); 826 beamVCard( uids );
789} 827}
790 828
791 829
792void KABCore::beamVCard(const QStringList& uids) 830void KABCore::beamVCard(const QStringList& uids)
793{ 831{
794 832
795 // LR: we should use the /tmp dir on the Zaurus, 833 // LR: we should use the /tmp dir on the Zaurus,
796 // because: /tmp = RAM, (HOME)/kdepim = flash memory 834 // because: /tmp = RAM, (HOME)/kdepim = flash memory
797 835
798#ifdef DESKTOP_VERSION 836#ifdef DESKTOP_VERSION
799 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 837 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
800#else 838#else
801 QString fileName = "/tmp/kapibeamfile.vcf"; 839 QString fileName = "/tmp/kapibeamfile.vcf";
802#endif 840#endif
803 841
804 KABC::VCardConverter converter; 842 KABC::VCardConverter converter;
805 QString description; 843 QString description;
806 QString datastream; 844 QString datastream;
807 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 845 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
808 KABC::Addressee a = mAddressBook->findByUid( *it ); 846 KABC::Addressee a = mAddressBook->findByUid( *it );
809 847
810 if ( a.isEmpty() ) 848 if ( a.isEmpty() )
811 continue; 849 continue;
812 850
813 if (description.isEmpty()) 851 if (description.isEmpty())
814 description = a.formattedName(); 852 description = a.formattedName();
815 853
816 QString vcard; 854 QString vcard;
817 converter.addresseeToVCard( a, vcard ); 855 converter.addresseeToVCard( a, vcard );
818 int start = 0; 856 int start = 0;
819 int next; 857 int next;
820 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 858 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
821 int semi = vcard.find(";", next); 859 int semi = vcard.find(";", next);
822 int dopp = vcard.find(":", next); 860 int dopp = vcard.find(":", next);
823 int sep; 861 int sep;
824 if ( semi < dopp && semi >= 0 ) 862 if ( semi < dopp && semi >= 0 )
825 sep = semi ; 863 sep = semi ;
826 else 864 else
827 sep = dopp; 865 sep = dopp;
828 datastream +=vcard.mid( start, next - start); 866 datastream +=vcard.mid( start, next - start);
829 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 867 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
830 start = sep; 868 start = sep;
831 } 869 }
832 datastream += vcard.mid( start,vcard.length() ); 870 datastream += vcard.mid( start,vcard.length() );
833 } 871 }
834#ifndef DESKTOP_VERSION 872#ifndef DESKTOP_VERSION
835 QFile outFile(fileName); 873 QFile outFile(fileName);
836 if ( outFile.open(IO_WriteOnly) ) { 874 if ( outFile.open(IO_WriteOnly) ) {
837 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 875 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
838 QTextStream t( &outFile ); // use a text stream 876 QTextStream t( &outFile ); // use a text stream
839 //t.setEncoding( QTextStream::UnicodeUTF8 ); 877 //t.setEncoding( QTextStream::UnicodeUTF8 );
840 t.setEncoding( QTextStream::Latin1 ); 878 t.setEncoding( QTextStream::Latin1 );
841 t <<datastream.latin1(); 879 t <<datastream.latin1();
842 outFile.close(); 880 outFile.close();
843 Ir *ir = new Ir( this ); 881 Ir *ir = new Ir( this );
844 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 882 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
845 ir->send( fileName, description, "text/x-vCard" ); 883 ir->send( fileName, description, "text/x-vCard" );
846 } else { 884 } else {
847 qDebug("Error open temp beam file "); 885 qDebug("Error open temp beam file ");
848 return; 886 return;
849 } 887 }
850#endif 888#endif
851 889
852} 890}
853 891
854void KABCore::beamDone( Ir *ir ) 892void KABCore::beamDone( Ir *ir )
855{ 893{
856#ifndef DESKTOP_VERSION 894#ifndef DESKTOP_VERSION
857 delete ir; 895 delete ir;
858#endif 896#endif
859 topLevelWidget()->raise(); 897 topLevelWidget()->raise();
860 message( i18n("Beaming finished!") ); 898 message( i18n("Beaming finished!") );
861} 899}
862 900
863 901
864void KABCore::browse( const QString& url ) 902void KABCore::browse( const QString& url )
865{ 903{
866#ifndef KAB_EMBEDDED 904#ifndef KAB_EMBEDDED
867 kapp->invokeBrowser( url ); 905 kapp->invokeBrowser( url );
868#else //KAB_EMBEDDED 906#else //KAB_EMBEDDED
869 qDebug("KABCore::browse must be fixed"); 907 qDebug("KABCore::browse must be fixed");
870#endif //KAB_EMBEDDED 908#endif //KAB_EMBEDDED
871} 909}
872 910
873void KABCore::selectAllContacts() 911void KABCore::selectAllContacts()
874{ 912{
875 mViewManager->setSelected( QString::null, true ); 913 mViewManager->setSelected( QString::null, true );
876} 914}
877 915
878void KABCore::deleteContacts() 916void KABCore::deleteContacts()
879{ 917{
880 QStringList uidList = mViewManager->selectedUids(); 918 QStringList uidList = mViewManager->selectedUids();
881 deleteContacts( uidList ); 919 deleteContacts( uidList );
882} 920}
883 921
884void KABCore::deleteContacts( const QStringList &uids ) 922void KABCore::deleteContacts( const QStringList &uids )
885{ 923{
886 if ( uids.count() > 0 ) { 924 if ( uids.count() > 0 ) {
887 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 925 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
888 UndoStack::instance()->push( command ); 926 UndoStack::instance()->push( command );
889 RedoStack::instance()->clear(); 927 RedoStack::instance()->clear();
890 928
891 // now if we deleted anything, refresh 929 // now if we deleted anything, refresh
892 setContactSelected( QString::null ); 930 setContactSelected( QString::null );
893 setModified( true ); 931 setModified( true );
894 } 932 }
895} 933}
896 934
897void KABCore::copyContacts() 935void KABCore::copyContacts()
898{ 936{
899 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 937 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
900 938
901 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 939 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
902 940
903 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 941 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
904 942
905 QClipboard *cb = QApplication::clipboard(); 943 QClipboard *cb = QApplication::clipboard();
906 cb->setText( clipText ); 944 cb->setText( clipText );
907} 945}
908 946
909void KABCore::cutContacts() 947void KABCore::cutContacts()
910{ 948{
911 QStringList uidList = mViewManager->selectedUids(); 949 QStringList uidList = mViewManager->selectedUids();
912 950
913//US if ( uidList.size() > 0 ) { 951//US if ( uidList.size() > 0 ) {
914 if ( uidList.count() > 0 ) { 952 if ( uidList.count() > 0 ) {
915 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 953 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
916 UndoStack::instance()->push( command ); 954 UndoStack::instance()->push( command );
917 RedoStack::instance()->clear(); 955 RedoStack::instance()->clear();
918 956
919 setModified( true ); 957 setModified( true );
920 } 958 }
921} 959}
922 960
923void KABCore::pasteContacts() 961void KABCore::pasteContacts()
924{ 962{
925 QClipboard *cb = QApplication::clipboard(); 963 QClipboard *cb = QApplication::clipboard();
926 964
927 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 965 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
928 966
929 pasteContacts( list ); 967 pasteContacts( list );
930} 968}
931 969
932void KABCore::pasteContacts( KABC::Addressee::List &list ) 970void KABCore::pasteContacts( KABC::Addressee::List &list )
933{ 971{
934 KABC::Resource *resource = requestResource( this ); 972 KABC::Resource *resource = requestResource( this );
935 KABC::Addressee::List::Iterator it; 973 KABC::Addressee::List::Iterator it;
936 for ( it = list.begin(); it != list.end(); ++it ) 974 for ( it = list.begin(); it != list.end(); ++it )
937 (*it).setResource( resource ); 975 (*it).setResource( resource );
938 976
939 PwPasteCommand *command = new PwPasteCommand( this, list ); 977 PwPasteCommand *command = new PwPasteCommand( this, list );
940 UndoStack::instance()->push( command ); 978 UndoStack::instance()->push( command );
941 RedoStack::instance()->clear(); 979 RedoStack::instance()->clear();
942 980
943 setModified( true ); 981 setModified( true );
944} 982}
945 983
946void KABCore::setWhoAmI() 984void KABCore::setWhoAmI()
947{ 985{
948 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 986 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
949 987
950 if ( addrList.count() > 1 ) { 988 if ( addrList.count() > 1 ) {
951 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 989 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
952 return; 990 return;
953 } 991 }
954 992
955 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 993 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
956 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 994 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
957 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 995 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
958} 996}
959 997void KABCore::editCategories()
998{
999 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1000 dlg.exec();
1001}
960void KABCore::setCategories() 1002void KABCore::setCategories()
961{ 1003{
962 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 1004 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
963 if ( !dlg.exec() ) { 1005 if ( !dlg.exec() ) {
964 message( i18n("Setting categories cancelled") ); 1006 message( i18n("Setting categories cancelled") );
965 return; 1007 return;
966 } 1008 }
967 bool merge = false; 1009 bool merge = false;
968 QString msg = i18n( "Merge with existing categories?" ); 1010 QString msg = i18n( "Merge with existing categories?" );
969 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 1011 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
970 merge = true; 1012 merge = true;
971 1013
972 message( i18n("Setting categories ... please wait!") ); 1014 message( i18n("Setting categories ... please wait!") );
973 QStringList categories = dlg.selectedCategories(); 1015 QStringList categories = dlg.selectedCategories();
974 1016
975 QStringList uids = mViewManager->selectedUids(); 1017 QStringList uids = mViewManager->selectedUids();
976 QStringList::Iterator it; 1018 QStringList::Iterator it;
977 for ( it = uids.begin(); it != uids.end(); ++it ) { 1019 for ( it = uids.begin(); it != uids.end(); ++it ) {
978 KABC::Addressee addr = mAddressBook->findByUid( *it ); 1020 KABC::Addressee addr = mAddressBook->findByUid( *it );
979 if ( !addr.isEmpty() ) { 1021 if ( !addr.isEmpty() ) {
980 if ( !merge ) 1022 if ( !merge )
981 addr.setCategories( categories ); 1023 addr.setCategories( categories );
982 else { 1024 else {
983 QStringList addrCategories = addr.categories(); 1025 QStringList addrCategories = addr.categories();
984 QStringList::Iterator catIt; 1026 QStringList::Iterator catIt;
985 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 1027 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
986 if ( !addrCategories.contains( *catIt ) ) 1028 if ( !addrCategories.contains( *catIt ) )
987 addrCategories.append( *catIt ); 1029 addrCategories.append( *catIt );
988 } 1030 }
989 addr.setCategories( addrCategories ); 1031 addr.setCategories( addrCategories );
990 } 1032 }
991
992 mAddressBook->insertAddressee( addr ); 1033 mAddressBook->insertAddressee( addr );
993 } 1034 }
994 } 1035 }
995 1036
996 if ( uids.count() > 0 ) 1037 if ( uids.count() > 0 )
997 setModified( true ); 1038 setModified( true );
998 message( i18n("Setting categories completed!") ); 1039 message( i18n("Setting categories completed!") );
999} 1040}
1000 1041
1001void KABCore::setSearchFields( const KABC::Field::List &fields ) 1042void KABCore::setSearchFields( const KABC::Field::List &fields )
1002{ 1043{
1003 mIncSearchWidget->setFields( fields ); 1044 mIncSearchWidget->setFields( fields );
1004} 1045}
1005 1046
1006void KABCore::incrementalSearch( const QString& text ) 1047void KABCore::incrementalSearch( const QString& text )
1007{ 1048{
1008 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 1049 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
1009} 1050}
1010 1051
1011void KABCore::setModified() 1052void KABCore::setModified()
1012{ 1053{
1013 setModified( true ); 1054 setModified( true );
1014} 1055}
1015 1056
1016void KABCore::setModifiedWOrefresh() 1057void KABCore::setModifiedWOrefresh()
1017{ 1058{
1018 // qDebug("KABCore::setModifiedWOrefresh() "); 1059 // qDebug("KABCore::setModifiedWOrefresh() ");
1019 mModified = true; 1060 mModified = true;
1020 mActionSave->setEnabled( mModified ); 1061 mActionSave->setEnabled( mModified );
1021#ifdef DESKTOP_VERSION 1062#ifdef DESKTOP_VERSION
1022 mDetails->refreshView(); 1063 mDetails->refreshView();
1023#endif 1064#endif
1024 1065
1025} 1066}
1026void KABCore::setModified( bool modified ) 1067void KABCore::setModified( bool modified )
1027{ 1068{
1028 mModified = modified; 1069 mModified = modified;
1029 mActionSave->setEnabled( mModified ); 1070 mActionSave->setEnabled( mModified );
1030 1071
1031 if ( modified ) 1072 if ( modified )
1032 mJumpButtonBar->recreateButtons(); 1073 mJumpButtonBar->recreateButtons();
1033 1074
1034 mViewManager->refreshView(); 1075 mViewManager->refreshView();
1035 mDetails->refreshView(); 1076 mDetails->refreshView();
1036 1077
1037} 1078}
1038 1079
1039bool KABCore::modified() const 1080bool KABCore::modified() const
1040{ 1081{
1041 return mModified; 1082 return mModified;
1042} 1083}
1043 1084
1044void KABCore::contactModified( const KABC::Addressee &addr ) 1085void KABCore::contactModified( const KABC::Addressee &addr )
1045{ 1086{
1046 1087
1047 Command *command = 0; 1088 Command *command = 0;
1048 QString uid; 1089 QString uid;
1049 1090
1050 // check if it exists already 1091 // check if it exists already
1051 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1092 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1052 if ( origAddr.isEmpty() ) 1093 if ( origAddr.isEmpty() )
1053 command = new PwNewCommand( mAddressBook, addr ); 1094 command = new PwNewCommand( mAddressBook, addr );
1054 else { 1095 else {
1055 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1096 command = new PwEditCommand( mAddressBook, origAddr, addr );
1056 uid = addr.uid(); 1097 uid = addr.uid();
1057 } 1098 }
1058 1099
1059 UndoStack::instance()->push( command ); 1100 UndoStack::instance()->push( command );
1060 RedoStack::instance()->clear(); 1101 RedoStack::instance()->clear();
1061 1102
1062 setModified( true ); 1103 setModified( true );
1063} 1104}
1064 1105
1065void KABCore::newContact() 1106void KABCore::newContact()
1066{ 1107{
1067 1108
1068 1109
1069 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1110 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1070 1111
1071 QPtrList<KRES::Resource> kresResources; 1112 QPtrList<KRES::Resource> kresResources;
1072 QPtrListIterator<KABC::Resource> it( kabcResources ); 1113 QPtrListIterator<KABC::Resource> it( kabcResources );
1073 KABC::Resource *resource; 1114 KABC::Resource *resource;
1074 while ( ( resource = it.current() ) != 0 ) { 1115 while ( ( resource = it.current() ) != 0 ) {
1075 ++it; 1116 ++it;
1076 if ( !resource->readOnly() ) { 1117 if ( !resource->readOnly() ) {
1077 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1118 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1078 if ( res ) 1119 if ( res )
1079 kresResources.append( res ); 1120 kresResources.append( res );
1080 } 1121 }
1081 } 1122 }
1082 1123
1083 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1124 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1084 resource = static_cast<KABC::Resource*>( res ); 1125 resource = static_cast<KABC::Resource*>( res );
1085 1126
1086 if ( resource ) { 1127 if ( resource ) {
1087 KABC::Addressee addr; 1128 KABC::Addressee addr;
1088 addr.setResource( resource ); 1129 addr.setResource( resource );
1089 mEditorDialog->setAddressee( addr ); 1130 mEditorDialog->setAddressee( addr );
1090 KApplication::execDialog ( mEditorDialog ); 1131 KApplication::execDialog ( mEditorDialog );
1091 1132
1092 } else 1133 } else
1093 return; 1134 return;
1094 1135
1095 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1136 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1096 1137
1097 1138
1098} 1139}
1099 1140
1100void KABCore::addEmail( QString aStr ) 1141void KABCore::addEmail( QString aStr )
1101{ 1142{
1102#ifndef KAB_EMBEDDED 1143#ifndef KAB_EMBEDDED
1103 QString fullName, email; 1144 QString fullName, email;
1104 1145
1105 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1146 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1106 1147
1107 // Try to lookup the addressee matching the email address 1148 // Try to lookup the addressee matching the email address
1108 bool found = false; 1149 bool found = false;
1109 QStringList emailList; 1150 QStringList emailList;
1110 KABC::AddressBook::Iterator it; 1151 KABC::AddressBook::Iterator it;
1111 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1152 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1112 emailList = (*it).emails(); 1153 emailList = (*it).emails();
1113 if ( emailList.contains( email ) > 0 ) { 1154 if ( emailList.contains( email ) > 0 ) {
1114 found = true; 1155 found = true;
1115 (*it).setNameFromString( fullName ); 1156 (*it).setNameFromString( fullName );
1116 editContact( (*it).uid() ); 1157 editContact( (*it).uid() );
1117 } 1158 }
1118 } 1159 }
1119 1160
1120 if ( !found ) { 1161 if ( !found ) {
1121 KABC::Addressee addr; 1162 KABC::Addressee addr;
1122 addr.setNameFromString( fullName ); 1163 addr.setNameFromString( fullName );
1123 addr.insertEmail( email, true ); 1164 addr.insertEmail( email, true );
1124 1165
1125 mAddressBook->insertAddressee( addr ); 1166 mAddressBook->insertAddressee( addr );
1126 mViewManager->refreshView( addr.uid() ); 1167 mViewManager->refreshView( addr.uid() );
1127 editContact( addr.uid() ); 1168 editContact( addr.uid() );
1128 } 1169 }
1129#else //KAB_EMBEDDED 1170#else //KAB_EMBEDDED
1130 qDebug("KABCore::addEmail finsih method"); 1171 qDebug("KABCore::addEmail finsih method");
1131#endif //KAB_EMBEDDED 1172#endif //KAB_EMBEDDED
1132} 1173}
1133 1174
1134void KABCore::importVCard( const KURL &url, bool showPreview ) 1175void KABCore::importVCard( const KURL &url, bool showPreview )
1135{ 1176{
1136 mXXPortManager->importVCard( url, showPreview ); 1177 mXXPortManager->importVCard( url, showPreview );
1137} 1178}
1138void KABCore::importFromOL() 1179void KABCore::importFromOL()
1139{ 1180{
1140#ifdef _WIN32_ 1181#ifdef _WIN32_
1141 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1182 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1142 idgl->exec(); 1183 idgl->exec();
1143 KABC::Addressee::List list = idgl->getAddressList(); 1184 KABC::Addressee::List list = idgl->getAddressList();
1144 if ( list.count() > 0 ) { 1185 if ( list.count() > 0 ) {
1145 KABC::Addressee::List listNew; 1186 KABC::Addressee::List listNew;
1146 KABC::Addressee::List listExisting; 1187 KABC::Addressee::List listExisting;
1147 KABC::Addressee::List::Iterator it; 1188 KABC::Addressee::List::Iterator it;
1148 KABC::AddressBook::Iterator iter; 1189 KABC::AddressBook::Iterator iter;
1149 for ( it = list.begin(); it != list.end(); ++it ) { 1190 for ( it = list.begin(); it != list.end(); ++it ) {
1150 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1191 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1151 listNew.append( (*it) ); 1192 listNew.append( (*it) );
1152 else 1193 else
1153 listExisting.append( (*it) ); 1194 listExisting.append( (*it) );
1154 } 1195 }
1155 if ( listExisting.count() > 0 ) 1196 if ( listExisting.count() > 0 )
1156 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1197 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1157 if ( listNew.count() > 0 ) { 1198 if ( listNew.count() > 0 ) {
1158 pasteWithNewUid = false; 1199 pasteWithNewUid = false;
1159 pasteContacts( listNew ); 1200 pasteContacts( listNew );
1160 pasteWithNewUid = true; 1201 pasteWithNewUid = true;
1161 } 1202 }
1162 } 1203 }
1163 delete idgl; 1204 delete idgl;
1164#endif 1205#endif
1165} 1206}
1166 1207
1167void KABCore::importVCard( const QString &vCard, bool showPreview ) 1208void KABCore::importVCard( const QString &vCard, bool showPreview )
1168{ 1209{
1169 mXXPortManager->importVCard( vCard, showPreview ); 1210 mXXPortManager->importVCard( vCard, showPreview );
1170} 1211}
1171 1212
1172//US added a second method without defaultparameter 1213//US added a second method without defaultparameter
1173void KABCore::editContact2() { 1214void KABCore::editContact2() {
1174 editContact( QString::null ); 1215 editContact( QString::null );
1175} 1216}
1176 1217
1177void KABCore::editContact( const QString &uid ) 1218void KABCore::editContact( const QString &uid )
1178{ 1219{
1179 1220
1180 if ( mExtensionManager->isQuickEditVisible() ) 1221 if ( mExtensionManager->isQuickEditVisible() )
1181 return; 1222 return;
1182 1223
1183 // First, locate the contact entry 1224 // First, locate the contact entry
@@ -1693,610 +1734,670 @@ void KABCore::initGUI()
1693 initActions(); 1734 initActions();
1694 1735
1695#ifdef KAB_EMBEDDED 1736#ifdef KAB_EMBEDDED
1696 addActionsManually(); 1737 addActionsManually();
1697 //US make sure the export and import menues are initialized before creating the xxPortManager. 1738 //US make sure the export and import menues are initialized before creating the xxPortManager.
1698 mXXPortManager = new XXPortManager( this, this ); 1739 mXXPortManager = new XXPortManager( this, this );
1699 1740
1700 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1741 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1701 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1742 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1702 // mActionQuit->plug ( mMainWindow->toolBar()); 1743 // mActionQuit->plug ( mMainWindow->toolBar());
1703 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1744 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1704 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1745 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1705 // mIncSearchWidget->hide(); 1746 // mIncSearchWidget->hide();
1706 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1747 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1707 SLOT( incrementalSearch( const QString& ) ) ); 1748 SLOT( incrementalSearch( const QString& ) ) );
1708 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1749 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1709 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1750 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1710 1751
1711 mJumpButtonBar = new JumpButtonBar( this, this ); 1752 mJumpButtonBar = new JumpButtonBar( this, this );
1712 1753
1713 topLayout->addWidget( mJumpButtonBar ); 1754 topLayout->addWidget( mJumpButtonBar );
1714//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1755//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1715 1756
1716// mMainWindow->getIconToolBar()->raise(); 1757// mMainWindow->getIconToolBar()->raise();
1717 1758
1718#endif //KAB_EMBEDDED 1759#endif //KAB_EMBEDDED
1719 1760
1720} 1761}
1721void KABCore::initActions() 1762void KABCore::initActions()
1722{ 1763{
1723//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1764//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1724 1765
1725#ifndef KAB_EMBEDDED 1766#ifndef KAB_EMBEDDED
1726 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1767 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1727 SLOT( clipboardDataChanged() ) ); 1768 SLOT( clipboardDataChanged() ) );
1728#endif //KAB_EMBEDDED 1769#endif //KAB_EMBEDDED
1729 1770
1730 // file menu 1771 // file menu
1731 if ( mIsPart ) { 1772 if ( mIsPart ) {
1732 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1773 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1733 SLOT( sendMail() ), actionCollection(), 1774 SLOT( sendMail() ), actionCollection(),
1734 "kaddressbook_mail" ); 1775 "kaddressbook_mail" );
1735 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1776 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1736 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1777 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1737 1778
1738 } else { 1779 } else {
1739 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1780 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1740 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1781 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1741 } 1782 }
1742 1783
1743 1784
1744 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1785 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1745 SLOT( save() ), actionCollection(), "file_sync" ); 1786 SLOT( save() ), actionCollection(), "file_sync" );
1746 1787
1747 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1788 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1748 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1789 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1749 1790
1750 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1791 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1751 this, SLOT( mailVCard() ), 1792 this, SLOT( mailVCard() ),
1752 actionCollection(), "file_mail_vcard"); 1793 actionCollection(), "file_mail_vcard");
1753 1794
1754 mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, 1795 mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this,
1755 SLOT( export2phone() ), actionCollection(), 1796 SLOT( export2phone() ), actionCollection(),
1756 "kaddressbook_ex2phone" ); 1797 "kaddressbook_ex2phone" );
1757 1798
1758 mActionBeamVCard = 0; 1799 mActionBeamVCard = 0;
1759 mActionBeam = 0; 1800 mActionBeam = 0;
1760 1801
1761#ifndef DESKTOP_VERSION 1802#ifndef DESKTOP_VERSION
1762 if ( Ir::supported() ) { 1803 if ( Ir::supported() ) {
1763 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1804 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1764 SLOT( beamVCard() ), actionCollection(), 1805 SLOT( beamVCard() ), actionCollection(),
1765 "kaddressbook_beam_vcard" ); 1806 "kaddressbook_beam_vcard" );
1766 1807
1767 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1808 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1768 SLOT( beamMySelf() ), actionCollection(), 1809 SLOT( beamMySelf() ), actionCollection(),
1769 "kaddressbook_beam_myself" ); 1810 "kaddressbook_beam_myself" );
1770 } 1811 }
1771#endif 1812#endif
1772 1813
1773 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1814 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1774 this, SLOT( editContact2() ), 1815 this, SLOT( editContact2() ),
1775 actionCollection(), "file_properties" ); 1816 actionCollection(), "file_properties" );
1776 1817
1777#ifdef KAB_EMBEDDED 1818#ifdef KAB_EMBEDDED
1778 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1819 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1779 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1820 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1780 mMainWindow, SLOT( exit() ), 1821 mMainWindow, SLOT( exit() ),
1781 actionCollection(), "quit" ); 1822 actionCollection(), "quit" );
1782#endif //KAB_EMBEDDED 1823#endif //KAB_EMBEDDED
1783 1824
1784 // edit menu 1825 // edit menu
1785 if ( mIsPart ) { 1826 if ( mIsPart ) {
1786 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1827 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1787 SLOT( copyContacts() ), actionCollection(), 1828 SLOT( copyContacts() ), actionCollection(),
1788 "kaddressbook_copy" ); 1829 "kaddressbook_copy" );
1789 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1830 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1790 SLOT( cutContacts() ), actionCollection(), 1831 SLOT( cutContacts() ), actionCollection(),
1791 "kaddressbook_cut" ); 1832 "kaddressbook_cut" );
1792 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1833 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1793 SLOT( pasteContacts() ), actionCollection(), 1834 SLOT( pasteContacts() ), actionCollection(),
1794 "kaddressbook_paste" ); 1835 "kaddressbook_paste" );
1795 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1836 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1796 SLOT( selectAllContacts() ), actionCollection(), 1837 SLOT( selectAllContacts() ), actionCollection(),
1797 "kaddressbook_select_all" ); 1838 "kaddressbook_select_all" );
1798 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1839 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1799 SLOT( undo() ), actionCollection(), 1840 SLOT( undo() ), actionCollection(),
1800 "kaddressbook_undo" ); 1841 "kaddressbook_undo" );
1801 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1842 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1802 this, SLOT( redo() ), actionCollection(), 1843 this, SLOT( redo() ), actionCollection(),
1803 "kaddressbook_redo" ); 1844 "kaddressbook_redo" );
1804 } else { 1845 } else {
1805 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1846 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1806 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1847 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1807 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1848 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1808 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1849 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1809 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1850 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1810 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1851 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1811 } 1852 }
1812 1853
1813 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1854 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1814 Key_Delete, this, SLOT( deleteContacts() ), 1855 Key_Delete, this, SLOT( deleteContacts() ),
1815 actionCollection(), "edit_delete" ); 1856 actionCollection(), "edit_delete" );
1816 1857
1817 mActionUndo->setEnabled( false ); 1858 mActionUndo->setEnabled( false );
1818 mActionRedo->setEnabled( false ); 1859 mActionRedo->setEnabled( false );
1819 1860
1820 // settings menu 1861 // settings menu
1821#ifdef KAB_EMBEDDED 1862#ifdef KAB_EMBEDDED
1822//US special menuentry to configure the addressbook resources. On KDE 1863//US special menuentry to configure the addressbook resources. On KDE
1823// you do that through the control center !!! 1864// you do that through the control center !!!
1824 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1865 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1825 SLOT( configureResources() ), actionCollection(), 1866 SLOT( configureResources() ), actionCollection(),
1826 "kaddressbook_configure_resources" ); 1867 "kaddressbook_configure_resources" );
1827#endif //KAB_EMBEDDED 1868#endif //KAB_EMBEDDED
1828 1869
1829 if ( mIsPart ) { 1870 if ( mIsPart ) {
1830 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1871 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1831 SLOT( openConfigDialog() ), actionCollection(), 1872 SLOT( openConfigDialog() ), actionCollection(),
1832 "kaddressbook_configure" ); 1873 "kaddressbook_configure" );
1833 1874
1834 //US not implemented yet 1875 //US not implemented yet
1835 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1876 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1836 // this, SLOT( configureKeyBindings() ), actionCollection(), 1877 // this, SLOT( configureKeyBindings() ), actionCollection(),
1837 // "kaddressbook_configure_shortcuts" ); 1878 // "kaddressbook_configure_shortcuts" );
1838#ifdef KAB_EMBEDDED 1879#ifdef KAB_EMBEDDED
1839 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1880 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1840 mActionConfigureToolbars->setEnabled( false ); 1881 mActionConfigureToolbars->setEnabled( false );
1841#endif //KAB_EMBEDDED 1882#endif //KAB_EMBEDDED
1842 1883
1843 } else { 1884 } else {
1844 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1885 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1845 1886
1846 //US not implemented yet 1887 //US not implemented yet
1847 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1888 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1848 } 1889 }
1849 1890
1850 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1891 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1851 actionCollection(), "options_show_jump_bar" ); 1892 actionCollection(), "options_show_jump_bar" );
1852 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1893 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1853 1894
1854 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 1895 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1855 actionCollection(), "options_show_details" ); 1896 actionCollection(), "options_show_details" );
1856 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1897 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1857 1898
1858 1899
1859 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 1900 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
1860 SLOT( toggleBeamReceive() ), actionCollection(), 1901 SLOT( toggleBeamReceive() ), actionCollection(),
1861 "kaddressbook_beam_rec" ); 1902 "kaddressbook_beam_rec" );
1862 1903
1863 1904
1864 // misc 1905 // misc
1865 // only enable LDAP lookup if we can handle the protocol 1906 // only enable LDAP lookup if we can handle the protocol
1866#ifndef KAB_EMBEDDED 1907#ifndef KAB_EMBEDDED
1867 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1908 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1868 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1909 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1869 this, SLOT( openLDAPDialog() ), actionCollection(), 1910 this, SLOT( openLDAPDialog() ), actionCollection(),
1870 "ldap_lookup" ); 1911 "ldap_lookup" );
1871 } 1912 }
1872#else //KAB_EMBEDDED 1913#else //KAB_EMBEDDED
1873 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1914 //qDebug("KABCore::initActions() LDAP has to be implemented");
1874#endif //KAB_EMBEDDED 1915#endif //KAB_EMBEDDED
1875 1916
1876 1917
1877 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1918 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1878 SLOT( setWhoAmI() ), actionCollection(), 1919 SLOT( setWhoAmI() ), actionCollection(),
1879 "set_personal" ); 1920 "set_personal" );
1880 1921
1881 1922
1882 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1923 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1883 SLOT( setCategories() ), actionCollection(), 1924 SLOT( setCategories() ), actionCollection(),
1884 "edit_set_categories" ); 1925 "edit_set_categories" );
1926 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this,
1927 SLOT( editCategories() ), actionCollection(),
1928 "edit__categories" );
1885 1929
1886 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1930 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1887 SLOT( removeVoice() ), actionCollection(), 1931 SLOT( removeVoice() ), actionCollection(),
1888 "remove_voice" ); 1932 "remove_voice" );
1889 1933
1890 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, 1934 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
1891 SLOT( manageCategories() ), actionCollection(), 1935 SLOT( manageCategories() ), actionCollection(),
1892 "remove_voice" ); 1936 "remove_voice" );
1893 1937
1894 1938
1895 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 1939 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
1896 SLOT( importFromOL() ), actionCollection(), 1940 SLOT( importFromOL() ), actionCollection(),
1897 "import_OL" ); 1941 "import_OL" );
1898#ifdef KAB_EMBEDDED 1942#ifdef KAB_EMBEDDED
1899 mActionLicence = new KAction( i18n( "Licence" ), 0, 1943 mActionLicence = new KAction( i18n( "Licence" ), 0,
1900 this, SLOT( showLicence() ), actionCollection(), 1944 this, SLOT( showLicence() ), actionCollection(),
1901 "licence_about_data" ); 1945 "licence_about_data" );
1902 mActionFaq = new KAction( i18n( "Faq" ), 0, 1946 mActionFaq = new KAction( i18n( "Faq" ), 0,
1903 this, SLOT( faq() ), actionCollection(), 1947 this, SLOT( faq() ), actionCollection(),
1904 "faq_about_data" ); 1948 "faq_about_data" );
1905 mActionWN = new KAction( i18n( "What's New?" ), 0, 1949 mActionWN = new KAction( i18n( "What's New?" ), 0,
1906 this, SLOT( whatsnew() ), actionCollection(), 1950 this, SLOT( whatsnew() ), actionCollection(),
1907 "wn" ); 1951 "wn" );
1908 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 1952 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
1909 this, SLOT( synchowto() ), actionCollection(), 1953 this, SLOT( synchowto() ), actionCollection(),
1910 "sync" ); 1954 "sync" );
1911 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 1955 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
1912 this, SLOT( kdesynchowto() ), actionCollection(), 1956 this, SLOT( kdesynchowto() ), actionCollection(),
1913 "kdesync" ); 1957 "kdesync" );
1914 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 1958 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
1915 this, SLOT( multisynchowto() ), actionCollection(), 1959 this, SLOT( multisynchowto() ), actionCollection(),
1916 "multisync" ); 1960 "multisync" );
1917 1961
1918 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1962 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1919 this, SLOT( createAboutData() ), actionCollection(), 1963 this, SLOT( createAboutData() ), actionCollection(),
1920 "kaddressbook_about_data" ); 1964 "kaddressbook_about_data" );
1921#endif //KAB_EMBEDDED 1965#endif //KAB_EMBEDDED
1922 1966
1923 clipboardDataChanged(); 1967 clipboardDataChanged();
1924 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1968 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1925 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1969 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1926} 1970}
1927 1971
1928//US we need this function, to plug all actions into the correct menues. 1972//US we need this function, to plug all actions into the correct menues.
1929// KDE uses a XML format to plug the actions, but we work her without this overhead. 1973// KDE uses a XML format to plug the actions, but we work her without this overhead.
1930void KABCore::addActionsManually() 1974void KABCore::addActionsManually()
1931{ 1975{
1932//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1976//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1933 1977
1934#ifdef KAB_EMBEDDED 1978#ifdef KAB_EMBEDDED
1935 QPopupMenu *fileMenu = new QPopupMenu( this ); 1979 QPopupMenu *fileMenu = new QPopupMenu( this );
1936 QPopupMenu *editMenu = new QPopupMenu( this ); 1980 QPopupMenu *editMenu = new QPopupMenu( this );
1937 QPopupMenu *helpMenu = new QPopupMenu( this ); 1981 QPopupMenu *helpMenu = new QPopupMenu( this );
1938 1982
1939 KToolBar* tb = mMainWindow->toolBar(); 1983 KToolBar* tb = mMainWindow->toolBar();
1940 1984
1941#ifndef DESKTOP_VERSION 1985#ifndef DESKTOP_VERSION
1942 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 1986 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
1943#endif 1987#endif
1944 QMenuBar* mb = mMainWindow->menuBar(); 1988 QMenuBar* mb = mMainWindow->menuBar();
1945 1989
1946 //US setup menubar. 1990 //US setup menubar.
1947 //Disable the following block if you do not want to have a menubar. 1991 //Disable the following block if you do not want to have a menubar.
1948 mb->insertItem( "&File", fileMenu ); 1992 mb->insertItem( "&File", fileMenu );
1949 mb->insertItem( "&Edit", editMenu ); 1993 mb->insertItem( "&Edit", editMenu );
1950 mb->insertItem( "&View", viewMenu ); 1994 mb->insertItem( "&View", viewMenu );
1951 mb->insertItem( "&Settings", settingsMenu ); 1995 mb->insertItem( "&Settings", settingsMenu );
1952 mb->insertItem( i18n("Synchronize"), syncMenu ); 1996 mb->insertItem( i18n("Synchronize"), syncMenu );
1953 mb->insertItem( "&Change selected", changeMenu ); 1997 mb->insertItem( "&Change selected", changeMenu );
1954 mb->insertItem( "&Help", helpMenu ); 1998 mb->insertItem( "&Help", helpMenu );
1955 mIncSearchWidget = new IncSearchWidget( tb ); 1999 mIncSearchWidget = new IncSearchWidget( tb );
1956 // tb->insertWidget(-1, 0, mIncSearchWidget); 2000 // tb->insertWidget(-1, 0, mIncSearchWidget);
1957#ifndef DESKTOP_VERSION 2001#ifndef DESKTOP_VERSION
1958 } else { 2002 } else {
1959 //US setup toolbar 2003 //US setup toolbar
1960 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2004 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
1961 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2005 QPopupMenu *popupBarTB = new QPopupMenu( this );
1962 menuBarTB->insertItem( "ME", popupBarTB); 2006 menuBarTB->insertItem( "ME", popupBarTB);
1963 tb->insertWidget(-1, 0, menuBarTB); 2007 tb->insertWidget(-1, 0, menuBarTB);
1964 mIncSearchWidget = new IncSearchWidget( tb ); 2008 mIncSearchWidget = new IncSearchWidget( tb );
1965 2009
1966 tb->enableMoving(false); 2010 tb->enableMoving(false);
1967 popupBarTB->insertItem( "&File", fileMenu ); 2011 popupBarTB->insertItem( "&File", fileMenu );
1968 popupBarTB->insertItem( "&Edit", editMenu ); 2012 popupBarTB->insertItem( "&Edit", editMenu );
1969 popupBarTB->insertItem( "&View", viewMenu ); 2013 popupBarTB->insertItem( "&View", viewMenu );
1970 popupBarTB->insertItem( "&Settings", settingsMenu ); 2014 popupBarTB->insertItem( "&Settings", settingsMenu );
1971 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2015 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
1972 mViewManager->getFilterAction()->plug ( popupBarTB); 2016 mViewManager->getFilterAction()->plug ( popupBarTB);
1973 popupBarTB->insertItem( "&Change selected", changeMenu ); 2017 popupBarTB->insertItem( "&Change selected", changeMenu );
1974 popupBarTB->insertItem( "&Help", helpMenu ); 2018 popupBarTB->insertItem( "&Help", helpMenu );
1975 if (QApplication::desktop()->width() > 320 ) { 2019 if (QApplication::desktop()->width() > 320 ) {
1976 // mViewManager->getFilterAction()->plug ( tb); 2020 // mViewManager->getFilterAction()->plug ( tb);
1977 } 2021 }
1978 } 2022 }
1979#endif 2023#endif
1980 // mActionQuit->plug ( mMainWindow->toolBar()); 2024 // mActionQuit->plug ( mMainWindow->toolBar());
1981 2025
1982 2026
1983 2027
1984 //US Now connect the actions with the menue entries. 2028 //US Now connect the actions with the menue entries.
1985 mActionPrint->plug( fileMenu ); 2029 mActionPrint->plug( fileMenu );
1986 mActionMail->plug( fileMenu ); 2030 mActionMail->plug( fileMenu );
1987 fileMenu->insertSeparator(); 2031 fileMenu->insertSeparator();
1988 2032
1989 mActionNewContact->plug( fileMenu ); 2033 mActionNewContact->plug( fileMenu );
1990 mActionNewContact->plug( tb ); 2034 mActionNewContact->plug( tb );
1991 2035
1992 mActionEditAddressee->plug( fileMenu ); 2036 mActionEditAddressee->plug( fileMenu );
1993 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2037 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
1994 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2038 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
1995 mActionEditAddressee->plug( tb ); 2039 mActionEditAddressee->plug( tb );
1996 2040
1997 fileMenu->insertSeparator(); 2041 fileMenu->insertSeparator();
1998 mActionSave->plug( fileMenu ); 2042 mActionSave->plug( fileMenu );
1999 fileMenu->insertItem( "&Import", ImportMenu ); 2043 fileMenu->insertItem( "&Import", ImportMenu );
2000 fileMenu->insertItem( "&Export", ExportMenu ); 2044 fileMenu->insertItem( "&Export", ExportMenu );
2001 fileMenu->insertSeparator(); 2045 fileMenu->insertSeparator();
2002 mActionMailVCard->plug( fileMenu ); 2046 mActionMailVCard->plug( fileMenu );
2003#ifndef DESKTOP_VERSION 2047#ifndef DESKTOP_VERSION
2004 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 2048 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
2005 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 2049 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
2006#endif 2050#endif
2007 fileMenu->insertSeparator(); 2051 fileMenu->insertSeparator();
2008 mActionQuit->plug( fileMenu ); 2052 mActionQuit->plug( fileMenu );
2009#ifdef _WIN32_ 2053#ifdef _WIN32_
2010 mActionImportOL->plug( ImportMenu ); 2054 mActionImportOL->plug( ImportMenu );
2011#endif 2055#endif
2012 // edit menu 2056 // edit menu
2013 mActionUndo->plug( editMenu ); 2057 mActionUndo->plug( editMenu );
2014 mActionRedo->plug( editMenu ); 2058 mActionRedo->plug( editMenu );
2015 editMenu->insertSeparator(); 2059 editMenu->insertSeparator();
2016 mActionCut->plug( editMenu ); 2060 mActionCut->plug( editMenu );
2017 mActionCopy->plug( editMenu ); 2061 mActionCopy->plug( editMenu );
2018 mActionPaste->plug( editMenu ); 2062 mActionPaste->plug( editMenu );
2019 mActionDelete->plug( editMenu ); 2063 mActionDelete->plug( editMenu );
2020 editMenu->insertSeparator(); 2064 editMenu->insertSeparator();
2021 mActionSelectAll->plug( editMenu ); 2065 mActionSelectAll->plug( editMenu );
2022 2066
2023 mActionRemoveVoice->plug( changeMenu ); 2067 mActionRemoveVoice->plug( changeMenu );
2024 // settings menu 2068 // settings menu
2025//US special menuentry to configure the addressbook resources. On KDE 2069//US special menuentry to configure the addressbook resources. On KDE
2026// you do that through the control center !!! 2070// you do that through the control center !!!
2027 mActionConfigResources->plug( settingsMenu ); 2071 mActionConfigResources->plug( settingsMenu );
2028 settingsMenu->insertSeparator(); 2072 settingsMenu->insertSeparator();
2029 2073
2030 mActionConfigKAddressbook->plug( settingsMenu ); 2074 mActionConfigKAddressbook->plug( settingsMenu );
2031 2075
2032 if ( mIsPart ) { 2076 if ( mIsPart ) {
2033 //US not implemented yet 2077 //US not implemented yet
2034 //mActionConfigShortcuts->plug( settingsMenu ); 2078 //mActionConfigShortcuts->plug( settingsMenu );
2035 //mActionConfigureToolbars->plug( settingsMenu ); 2079 //mActionConfigureToolbars->plug( settingsMenu );
2036 2080
2037 } else { 2081 } else {
2038 //US not implemented yet 2082 //US not implemented yet
2039 //mActionKeyBindings->plug( settingsMenu ); 2083 //mActionKeyBindings->plug( settingsMenu );
2040 } 2084 }
2041 2085
2042 settingsMenu->insertSeparator(); 2086 settingsMenu->insertSeparator();
2043 2087
2044 mActionJumpBar->plug( settingsMenu ); 2088 mActionJumpBar->plug( settingsMenu );
2045 mActionDetails->plug( settingsMenu ); 2089 mActionDetails->plug( settingsMenu );
2046 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2090 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2047 mActionDetails->plug( tb ); 2091 mActionDetails->plug( tb );
2048 settingsMenu->insertSeparator(); 2092 settingsMenu->insertSeparator();
2049 mActionBR->plug(settingsMenu ); 2093 mActionBR->plug(settingsMenu );
2050 settingsMenu->insertSeparator(); 2094 settingsMenu->insertSeparator();
2051 2095
2052 mActionWhoAmI->plug( settingsMenu ); 2096 mActionWhoAmI->plug( settingsMenu );
2097 mActionEditCategories->plug( settingsMenu );
2053 mActionCategories->plug( settingsMenu ); 2098 mActionCategories->plug( settingsMenu );
2054 mActionManageCategories->plug( settingsMenu ); 2099 mActionManageCategories->plug( settingsMenu );
2055 2100
2056 2101
2057 mActionWN->plug( helpMenu ); 2102 mActionWN->plug( helpMenu );
2058 mActionSyncHowto->plug( helpMenu ); 2103 mActionSyncHowto->plug( helpMenu );
2059 mActionKdeSyncHowto->plug( helpMenu ); 2104 mActionKdeSyncHowto->plug( helpMenu );
2060 mActionMultiSyncHowto->plug( helpMenu ); 2105 mActionMultiSyncHowto->plug( helpMenu );
2061 mActionFaq->plug( helpMenu ); 2106 mActionFaq->plug( helpMenu );
2062 mActionLicence->plug( helpMenu ); 2107 mActionLicence->plug( helpMenu );
2063 mActionAboutKAddressbook->plug( helpMenu ); 2108 mActionAboutKAddressbook->plug( helpMenu );
2064 2109
2065 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2110 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2066 2111
2067 mActionSave->plug( tb ); 2112 mActionSave->plug( tb );
2068 mViewManager->getFilterAction()->plug ( tb); 2113 mViewManager->getFilterAction()->plug ( tb);
2069 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 2114 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
2070 mActionUndo->plug( tb ); 2115 mActionUndo->plug( tb );
2071 mActionDelete->plug( tb ); 2116 mActionDelete->plug( tb );
2072 mActionRedo->plug( tb ); 2117 mActionRedo->plug( tb );
2073 } 2118 }
2074 } else { 2119 } else {
2075 mActionSave->plug( tb ); 2120 mActionSave->plug( tb );
2076 tb->enableMoving(false); 2121 tb->enableMoving(false);
2077 } 2122 }
2078 //mActionQuit->plug ( tb ); 2123 //mActionQuit->plug ( tb );
2079 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2124 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2080 2125
2081 //US link the searchwidget first to this. 2126 //US link the searchwidget first to this.
2082 // The real linkage to the toolbar happens later. 2127 // The real linkage to the toolbar happens later.
2083//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2128//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2084//US tb->insertItem( mIncSearchWidget ); 2129//US tb->insertItem( mIncSearchWidget );
2085/*US 2130/*US
2086 mIncSearchWidget = new IncSearchWidget( tb ); 2131 mIncSearchWidget = new IncSearchWidget( tb );
2087 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2132 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2088 SLOT( incrementalSearch( const QString& ) ) ); 2133 SLOT( incrementalSearch( const QString& ) ) );
2089 2134
2090 mJumpButtonBar = new JumpButtonBar( this, this ); 2135 mJumpButtonBar = new JumpButtonBar( this, this );
2091 2136
2092//US topLayout->addWidget( mJumpButtonBar ); 2137//US topLayout->addWidget( mJumpButtonBar );
2093 this->layout()->add( mJumpButtonBar ); 2138 this->layout()->add( mJumpButtonBar );
2094*/ 2139*/
2095 2140
2096#endif //KAB_EMBEDDED 2141#endif //KAB_EMBEDDED
2097 2142
2098 mActionExport2phone->plug( ExportMenu ); 2143 mActionExport2phone->plug( ExportMenu );
2099 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2144 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2100 syncManager->fillSyncMenu(); 2145 syncManager->fillSyncMenu();
2101 2146
2102} 2147}
2103void KABCore::showLicence() 2148void KABCore::showLicence()
2104{ 2149{
2105 KApplication::showLicence(); 2150 KApplication::showLicence();
2106} 2151}
2107 2152
2108void KABCore::manageCategories( ) 2153void KABCore::manageCategories( )
2109{ 2154{
2110 2155 KABCatPrefs* cp = new KABCatPrefs();
2156 cp->show();
2157 int w =cp->sizeHint().width() ;
2158 int h = cp->sizeHint().height() ;
2159 int dw = QApplication::desktop()->width();
2160 int dh = QApplication::desktop()->height();
2161 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2162 if ( !cp->exec() ) {
2163 delete cp;
2164 return;
2165 }
2166 int count = 0;
2167 message( i18n("Please wait, processing categories..."));
2168 if ( cp->addCat() ) {
2169 KABC::AddressBook::Iterator it;
2170 QStringList catList = KABPrefs::instance()->mCustomCategories;
2171 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2172 QStringList catIncList = (*it).categories();
2173 int i;
2174 for( i = 0; i< catIncList.count(); ++i ) {
2175 if ( !catList.contains (catIncList[i])) {
2176 catList.append( catIncList[i] );
2177 //qDebug("add cat %s ", catIncList[i].latin1());
2178 ++count;
2179 }
2180 }
2181 }
2182 catList.sort();
2183 KABPrefs::instance()->mCustomCategories = catList;
2184 KABPrefs::instance()->writeConfig();
2185 message(QString::number( count )+ i18n(" categories added to list! "));
2186 } else {
2187 QStringList catList = KABPrefs::instance()->mCustomCategories;
2188 QStringList catIncList;
2189 QStringList newCatList;
2190 KABC::AddressBook::Iterator it;
2191 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2192 QStringList catIncList = (*it).categories();
2193 int i;
2194 if ( catIncList.count() ) {
2195 newCatList.clear();
2196 for( i = 0; i< catIncList.count(); ++i ) {
2197 if ( catList.contains (catIncList[i])) {
2198 newCatList.append( catIncList[i] );
2199 }
2200 }
2201 newCatList.sort();
2202 (*it).setCategories( newCatList );
2203 mAddressBook->insertAddressee( (*it) );
2204 }
2205 }
2206 setModified( true );
2207 mViewManager->refreshView();
2208 mDetails->refreshView();
2209 message( i18n("Removing categories done!"));
2210 }
2211 delete cp;
2111} 2212}
2112void KABCore::removeVoice() 2213void KABCore::removeVoice()
2113{ 2214{
2114 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2215 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
2115 return; 2216 return;
2116 KABC::Addressee::List list = mViewManager->selectedAddressees(); 2217 KABC::Addressee::List list = mViewManager->selectedAddressees();
2117 KABC::Addressee::List::Iterator it; 2218 KABC::Addressee::List::Iterator it;
2118 for ( it = list.begin(); it != list.end(); ++it ) { 2219 for ( it = list.begin(); it != list.end(); ++it ) {
2119 2220
2120 if ( (*it).removeVoice() ) 2221 if ( (*it).removeVoice() )
2121 contactModified((*it) ); 2222 contactModified((*it) );
2122 } 2223 }
2123} 2224}
2124 2225
2125 2226
2126 2227
2127void KABCore::clipboardDataChanged() 2228void KABCore::clipboardDataChanged()
2128{ 2229{
2129 2230
2130 if ( mReadWrite ) 2231 if ( mReadWrite )
2131 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2232 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2132 2233
2133} 2234}
2134 2235
2135void KABCore::updateActionMenu() 2236void KABCore::updateActionMenu()
2136{ 2237{
2137 UndoStack *undo = UndoStack::instance(); 2238 UndoStack *undo = UndoStack::instance();
2138 RedoStack *redo = RedoStack::instance(); 2239 RedoStack *redo = RedoStack::instance();
2139 2240
2140 if ( undo->isEmpty() ) 2241 if ( undo->isEmpty() )
2141 mActionUndo->setText( i18n( "Undo" ) ); 2242 mActionUndo->setText( i18n( "Undo" ) );
2142 else 2243 else
2143 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2244 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2144 2245
2145 mActionUndo->setEnabled( !undo->isEmpty() ); 2246 mActionUndo->setEnabled( !undo->isEmpty() );
2146 2247
2147 if ( !redo->top() ) 2248 if ( !redo->top() )
2148 mActionRedo->setText( i18n( "Redo" ) ); 2249 mActionRedo->setText( i18n( "Redo" ) );
2149 else 2250 else
2150 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2251 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2151 2252
2152 mActionRedo->setEnabled( !redo->isEmpty() ); 2253 mActionRedo->setEnabled( !redo->isEmpty() );
2153} 2254}
2154 2255
2155void KABCore::configureKeyBindings() 2256void KABCore::configureKeyBindings()
2156{ 2257{
2157#ifndef KAB_EMBEDDED 2258#ifndef KAB_EMBEDDED
2158 KKeyDialog::configure( actionCollection(), true ); 2259 KKeyDialog::configure( actionCollection(), true );
2159#else //KAB_EMBEDDED 2260#else //KAB_EMBEDDED
2160 qDebug("KABCore::configureKeyBindings() not implemented"); 2261 qDebug("KABCore::configureKeyBindings() not implemented");
2161#endif //KAB_EMBEDDED 2262#endif //KAB_EMBEDDED
2162} 2263}
2163 2264
2164#ifdef KAB_EMBEDDED 2265#ifdef KAB_EMBEDDED
2165void KABCore::configureResources() 2266void KABCore::configureResources()
2166{ 2267{
2167 KRES::KCMKResources dlg( this, "" , 0 ); 2268 KRES::KCMKResources dlg( this, "" , 0 );
2168 2269
2169 if ( !dlg.exec() ) 2270 if ( !dlg.exec() )
2170 return; 2271 return;
2171 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2272 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2172} 2273}
2173#endif //KAB_EMBEDDED 2274#endif //KAB_EMBEDDED
2174 2275
2175 2276
2176/* this method will be called through the QCop interface from Ko/Pi to select addresses 2277/* this method will be called through the QCop interface from Ko/Pi to select addresses
2177 * for the attendees list of an event. 2278 * for the attendees list of an event.
2178 */ 2279 */
2179void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2280void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2180{ 2281{
2181 QStringList nameList; 2282 QStringList nameList;
2182 QStringList emailList; 2283 QStringList emailList;
2183 QStringList uidList; 2284 QStringList uidList;
2184 2285
2185 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2286 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2186 uint i=0; 2287 uint i=0;
2187 for (i=0; i < list.count(); i++) 2288 for (i=0; i < list.count(); i++)
2188 { 2289 {
2189 nameList.append(list[i].realName()); 2290 nameList.append(list[i].realName());
2190 emailList.append(list[i].preferredEmail()); 2291 emailList.append(list[i].preferredEmail());
2191 uidList.append(list[i].uid()); 2292 uidList.append(list[i].uid());
2192 } 2293 }
2193 2294
2194 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2295 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2195 2296
2196} 2297}
2197 2298
2198/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2299/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2199 * to put them into the calendar. 2300 * to put them into the calendar.
2200 */ 2301 */
2201void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2302void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2202{ 2303{
2203 // qDebug("KABCore::requestForBirthdayList"); 2304 // qDebug("KABCore::requestForBirthdayList");
2204 QStringList birthdayList; 2305 QStringList birthdayList;
2205 QStringList anniversaryList; 2306 QStringList anniversaryList;
2206 QStringList realNameList; 2307 QStringList realNameList;
2207 QStringList preferredEmailList; 2308 QStringList preferredEmailList;
2208 QStringList assembledNameList; 2309 QStringList assembledNameList;
2209 QStringList uidList; 2310 QStringList uidList;
2210 2311
2211 KABC::AddressBook::Iterator it; 2312 KABC::AddressBook::Iterator it;
2212 2313
2213 int count = 0; 2314 int count = 0;
2214 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2315 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2215 ++count; 2316 ++count;
2216 } 2317 }
2217 QProgressBar bar(count,0 ); 2318 QProgressBar bar(count,0 );
2218 int w = 300; 2319 int w = 300;
2219 if ( QApplication::desktop()->width() < 320 ) 2320 if ( QApplication::desktop()->width() < 320 )
2220 w = 220; 2321 w = 220;
2221 int h = bar.sizeHint().height() ; 2322 int h = bar.sizeHint().height() ;
2222 int dw = QApplication::desktop()->width(); 2323 int dw = QApplication::desktop()->width();
2223 int dh = QApplication::desktop()->height(); 2324 int dh = QApplication::desktop()->height();
2224 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2325 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2225 bar.show(); 2326 bar.show();
2226 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2327 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2227 qApp->processEvents(); 2328 qApp->processEvents();
2228 2329
2229 QDate bday; 2330 QDate bday;
2230 QString anni; 2331 QString anni;
2231 QString formattedbday; 2332 QString formattedbday;
2232 2333
2233 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2334 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2234 { 2335 {
2235 if ( ! bar.isVisible() ) 2336 if ( ! bar.isVisible() )
2236 return; 2337 return;
2237 bar.setProgress( count++ ); 2338 bar.setProgress( count++ );
2238 qApp->processEvents(); 2339 qApp->processEvents();
2239 bday = (*it).birthday().date(); 2340 bday = (*it).birthday().date();
2240 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2341 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2241 2342
2242 if ( bday.isValid() || !anni.isEmpty()) 2343 if ( bday.isValid() || !anni.isEmpty())
2243 { 2344 {
2244 if (bday.isValid()) 2345 if (bday.isValid())
2245 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2346 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2246 else 2347 else
2247 formattedbday = "NOTVALID"; 2348 formattedbday = "NOTVALID";
2248 if (anni.isEmpty()) 2349 if (anni.isEmpty())
2249 anni = "INVALID"; 2350 anni = "INVALID";
2250 2351
2251 birthdayList.append(formattedbday); 2352 birthdayList.append(formattedbday);
2252 anniversaryList.append(anni); //should be ISODate 2353 anniversaryList.append(anni); //should be ISODate
2253 realNameList.append((*it).realName()); 2354 realNameList.append((*it).realName());
2254 preferredEmailList.append((*it).preferredEmail()); 2355 preferredEmailList.append((*it).preferredEmail());
2255 assembledNameList.append((*it).assembledName()); 2356 assembledNameList.append((*it).assembledName());
2256 uidList.append((*it).uid()); 2357 uidList.append((*it).uid());
2257 2358
2258 //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); 2359 //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() );
2259 } 2360 }
2260 } 2361 }
2261 2362
2262 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2363 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2263 2364
2264} 2365}
2265 2366
2266/* this method will be called through the QCop interface from other apps to show details of a contact. 2367/* this method will be called through the QCop interface from other apps to show details of a contact.
2267 */ 2368 */
2268void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2369void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2269{ 2370{
2270 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2371 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2271 2372
2272 QString foundUid = QString::null; 2373 QString foundUid = QString::null;
2273 if ( ! uid.isEmpty() ) { 2374 if ( ! uid.isEmpty() ) {
2274 Addressee adrr = mAddressBook->findByUid( uid ); 2375 Addressee adrr = mAddressBook->findByUid( uid );
2275 if ( !adrr.isEmpty() ) { 2376 if ( !adrr.isEmpty() ) {
2276 foundUid = uid; 2377 foundUid = uid;
2277 } 2378 }
2278 if ( email == "sendbacklist" ) { 2379 if ( email == "sendbacklist" ) {
2279 //qDebug("ssssssssssssssssssssssend "); 2380 //qDebug("ssssssssssssssssssssssend ");
2280 QStringList nameList; 2381 QStringList nameList;
2281 QStringList emailList; 2382 QStringList emailList;
2282 QStringList uidList; 2383 QStringList uidList;
2283 nameList.append(adrr.realName()); 2384 nameList.append(adrr.realName());
2284 emailList = adrr.emails(); 2385 emailList = adrr.emails();
2285 uidList.append( adrr.preferredEmail()); 2386 uidList.append( adrr.preferredEmail());
2286 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2387 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2287 return; 2388 return;
2288 } 2389 }
2289 2390
2290 } 2391 }
2291 2392
2292 if ( email == "sendbacklist" ) 2393 if ( email == "sendbacklist" )
2293 return; 2394 return;
2294 if (foundUid.isEmpty()) 2395 if (foundUid.isEmpty())
2295 { 2396 {
2296 //find the uid of the person first 2397 //find the uid of the person first
2297 Addressee::List namelist; 2398 Addressee::List namelist;
2298 Addressee::List emaillist; 2399 Addressee::List emaillist;
2299 2400
2300 if (!name.isEmpty()) 2401 if (!name.isEmpty())
2301 namelist = mAddressBook->findByName( name ); 2402 namelist = mAddressBook->findByName( name );
2302 2403
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index bf5398b..d2ee45d 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -55,456 +55,458 @@ class KAddressBookMain;
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 Saves the global settings. 99 Saves the global settings.
100 */ 100 */
101 void saveSettings(); 101 void saveSettings();
102 102
103 /** 103 /**
104 Returns a pointer to the StdAddressBook of the application. 104 Returns a pointer to the StdAddressBook of the application.
105 */ 105 */
106 KABC::AddressBook *addressBook() const; 106 KABC::AddressBook *addressBook() const;
107 107
108 /** 108 /**
109 Returns a pointer to the KConfig object of the application. 109 Returns a pointer to the KConfig object of the application.
110 */ 110 */
111 static KConfig *config(); 111 static KConfig *config();
112 112
113 /** 113 /**
114 Returns a pointer to the global KActionCollection object. So 114 Returns a pointer to the global KActionCollection object. So
115 other classes can register their actions easily. 115 other classes can register their actions easily.
116 */ 116 */
117 KActionCollection *actionCollection() const; 117 KActionCollection *actionCollection() const;
118 118
119 /** 119 /**
120 Returns the current search field of the Incremental Search Widget. 120 Returns the current search field of the Incremental Search Widget.
121 */ 121 */
122 KABC::Field *currentSearchField() const; 122 KABC::Field *currentSearchField() const;
123 123
124 /** 124 /**
125 Returns the uid list of the currently selected contacts. 125 Returns the uid list of the currently selected contacts.
126 */ 126 */
127 QStringList selectedUIDs() const; 127 QStringList selectedUIDs() const;
128 128
129 /** 129 /**
130 Displays the ResourceSelectDialog and returns the selected 130 Displays the ResourceSelectDialog and returns the selected
131 resource or a null pointer if no resource was selected by 131 resource or a null pointer if no resource was selected by
132 the user. 132 the user.
133 */ 133 */
134 KABC::Resource *requestResource( QWidget *parent ); 134 KABC::Resource *requestResource( QWidget *parent );
135 135
136#ifndef KAB_EMBEDDED 136#ifndef KAB_EMBEDDED
137 static KAboutData *createAboutData(); 137 static KAboutData *createAboutData();
138#endif //KAB_EMBEDDED 138#endif //KAB_EMBEDDED
139 139
140#ifdef KAB_EMBEDDED 140#ifdef KAB_EMBEDDED
141 inline QPopupMenu* getImportMenu() { return ImportMenu;} 141 inline QPopupMenu* getImportMenu() { return ImportMenu;}
142 inline QPopupMenu* getExportMenu() { return ExportMenu;} 142 inline QPopupMenu* getExportMenu() { return ExportMenu;}
143#endif //KAB_EMBEDDED 143#endif //KAB_EMBEDDED
144 144
145 public slots: 145 public slots:
146#ifdef KAB_EMBEDDED 146#ifdef KAB_EMBEDDED
147 void createAboutData(); 147 void createAboutData();
148#endif //KAB_EMBEDDED 148#endif //KAB_EMBEDDED
149 void setDetailsToggle(); 149 void setDetailsToggle();
150 150
151 void showLicence(); 151 void showLicence();
152 void faq(); 152 void faq();
153 void whatsnew() ; 153 void whatsnew() ;
154 void synchowto() ; 154 void synchowto() ;
155 void multisynchowto() ; 155 void multisynchowto() ;
156 void kdesynchowto() ; 156 void kdesynchowto() ;
157 void writeToPhone(); 157 void writeToPhone();
158 158
159 /** 159 /**
160 Is called whenever a contact is selected in the view. 160 Is called whenever a contact is selected in the view.
161 */ 161 */
162 void setContactSelected( const QString &uid ); 162 void setContactSelected( const QString &uid );
163 163
164 /** 164 /**
165 Opens the preferred mail composer with all selected contacts as 165 Opens the preferred mail composer with all selected contacts as
166 arguments. 166 arguments.
167 */ 167 */
168 void sendMail(); 168 void sendMail();
169 169
170 /** 170 /**
171 Opens the preferred mail composer with the given contacts as 171 Opens the preferred mail composer with the given contacts as
172 arguments. 172 arguments.
173 */ 173 */
174 void sendMail( const QString& email ); 174 void sendMail( const QString& email );
175 175
176 176
177 void mailVCard(); 177 void mailVCard();
178 void mailVCard(const QStringList& uids); 178 void mailVCard(const QStringList& uids);
179 179
180 /** 180 /**
181 Beams the "WhoAmI contact. 181 Beams the "WhoAmI contact.
182 */ 182 */
183 void beamMySelf(); 183 void beamMySelf();
184 184
185 void beamVCard(); 185 void beamVCard();
186 void export2phone(); 186 void export2phone();
187 void beamVCard(const QStringList& uids); 187 void beamVCard(const QStringList& uids);
188 void beamDone( Ir *ir ); 188 void beamDone( Ir *ir );
189 189
190 190
191 /** 191 /**
192 Starts the preferred web browser with the given URL as argument. 192 Starts the preferred web browser with the given URL as argument.
193 */ 193 */
194 void browse( const QString& url ); 194 void browse( const QString& url );
195 195
196 /** 196 /**
197 Select all contacts in the view. 197 Select all contacts in the view.
198 */ 198 */
199 void selectAllContacts(); 199 void selectAllContacts();
200 200
201 /** 201 /**
202 Deletes all selected contacts from the address book. 202 Deletes all selected contacts from the address book.
203 */ 203 */
204 void deleteContacts(); 204 void deleteContacts();
205 205
206 /** 206 /**
207 Deletes given contacts from the address book. 207 Deletes given contacts from the address book.
208 208
209 @param uids The uids of the contacts, which shall be deleted. 209 @param uids The uids of the contacts, which shall be deleted.
210 */ 210 */
211 void deleteContacts( const QStringList &uids ); 211 void deleteContacts( const QStringList &uids );
212 212
213 /** 213 /**
214 Copys the selected contacts into clipboard for later pasting. 214 Copys the selected contacts into clipboard for later pasting.
215 */ 215 */
216 void copyContacts(); 216 void copyContacts();
217 217
218 /** 218 /**
219 Cuts the selected contacts and stores them for later pasting. 219 Cuts the selected contacts and stores them for later pasting.
220 */ 220 */
221 void cutContacts(); 221 void cutContacts();
222 222
223 /** 223 /**
224 Paste contacts from clipboard into the address book. 224 Paste contacts from clipboard into the address book.
225 */ 225 */
226 void pasteContacts(); 226 void pasteContacts();
227 227
228 /** 228 /**
229 Paste given contacts into the address book. 229 Paste given contacts into the address book.
230 230
231 @param list The list of addressee, which shall be pasted. 231 @param list The list of addressee, which shall be pasted.
232 */ 232 */
233 void pasteContacts( KABC::Addressee::List &list ); 233 void pasteContacts( KABC::Addressee::List &list );
234 234
235 /** 235 /**
236 Sets the whoAmI contact, that is used by many other programs to 236 Sets the whoAmI contact, that is used by many other programs to
237 get personal information about the current user. 237 get personal information about the current user.
238 */ 238 */
239 void setWhoAmI(); 239 void setWhoAmI();
240 240
241 /** 241 /**
242 Displays the category dialog and applies the result to all 242 Displays the category dialog and applies the result to all
243 selected contacts. 243 selected contacts.
244 */ 244 */
245 void setCategories(); 245 void setCategories();
246 void manageCategories(); 246 void manageCategories();
247 void editCategories();
247 248
248 /** 249 /**
249 Sets the field list of the Incremental Search Widget. 250 Sets the field list of the Incremental Search Widget.
250 */ 251 */
251 void setSearchFields( const KABC::Field::List &fields ); 252 void setSearchFields( const KABC::Field::List &fields );
252 253
253 /** 254 /**
254 Search with the current search field for a contact, that matches 255 Search with the current search field for a contact, that matches
255 the given text, and selects it in the view. 256 the given text, and selects it in the view.
256 */ 257 */
257 void incrementalSearch( const QString& text ); 258 void incrementalSearch( const QString& text );
258 259
259 /** 260 /**
260 Marks the address book as modified. 261 Marks the address book as modified.
261 */ 262 */
262 void setModified(); 263 void setModified();
263 /** 264 /**
264 Marks the address book as modified without refreshing the view. 265 Marks the address book as modified without refreshing the view.
265 */ 266 */
266 void setModifiedWOrefresh(); 267 void setModifiedWOrefresh();
267 268
268 /** 269 /**
269 Marks the address book as modified concerning the argument. 270 Marks the address book as modified concerning the argument.
270 */ 271 */
271 void setModified( bool modified ); 272 void setModified( bool modified );
272 273
273 /** 274 /**
274 Returns whether the address book is modified. 275 Returns whether the address book is modified.
275 */ 276 */
276 bool modified() const; 277 bool modified() const;
277 278
278 /** 279 /**
279 Called whenever an contact is modified in the contact editor 280 Called whenever an contact is modified in the contact editor
280 dialog or the quick edit. 281 dialog or the quick edit.
281 */ 282 */
282 void contactModified( const KABC::Addressee &addr ); 283 void contactModified( const KABC::Addressee &addr );
283 284
284 /** 285 /**
285 DCOP METHODS. 286 DCOP METHODS.
286 */ 287 */
287 void addEmail( QString addr ); 288 void addEmail( QString addr );
288 void importVCard( const KURL& url, bool showPreview ); 289 void importVCard( const KURL& url, bool showPreview );
289 void importVCard( const QString& vCard, bool showPreview ); 290 void importVCard( const QString& vCard, bool showPreview );
290 void newContact(); 291 void newContact();
291 QString getNameByPhone( const QString& phone ); 292 QString getNameByPhone( const QString& phone );
292 /** 293 /**
293 END DCOP METHODS 294 END DCOP METHODS
294 */ 295 */
295 296
296 /** 297 /**
297 Saves the contents of the AddressBook back to disk. 298 Saves the contents of the AddressBook back to disk.
298 */ 299 */
299 void save(); 300 void save();
300 301
301 /** 302 /**
302 Undos the last command using the undo stack. 303 Undos the last command using the undo stack.
303 */ 304 */
304 void undo(); 305 void undo();
305 306
306 /** 307 /**
307 Redos the last command that was undone, using the redo stack. 308 Redos the last command that was undone, using the redo stack.
308 */ 309 */
309 void redo(); 310 void redo();
310 311
311 /** 312 /**
312 Shows the edit dialog for the given uid. If the uid is QString::null, 313 Shows the edit dialog for the given uid. If the uid is QString::null,
313 the method will try to find a selected addressee in the view. 314 the method will try to find a selected addressee in the view.
314 */ 315 */
315 void editContact( const QString &uid /*US = QString::null*/ ); 316 void editContact( const QString &uid /*US = QString::null*/ );
316//US added a second method without defaultparameter 317//US added a second method without defaultparameter
317 void editContact2(); 318 void editContact2();
318 319
319 /** 320 /**
320 Shows or edits the detail view for the given uid. If the uid is QString::null, 321 Shows or edits the detail view for the given uid. If the uid is QString::null,
321 the method will try to find a selected addressee in the view. 322 the method will try to find a selected addressee in the view.
322 */ 323 */
323 void executeContact( const QString &uid /*US = QString::null*/ ); 324 void executeContact( const QString &uid /*US = QString::null*/ );
324 325
325 /** 326 /**
326 Launches the configuration dialog. 327 Launches the configuration dialog.
327 */ 328 */
328 void openConfigDialog(); 329 void openConfigDialog();
329 330
330 /** 331 /**
331 Launches the ldap search dialog. 332 Launches the ldap search dialog.
332 */ 333 */
333 void openLDAPDialog(); 334 void openLDAPDialog();
334 335
335 /** 336 /**
336 Creates a KAddressBookPrinter, which will display the print 337 Creates a KAddressBookPrinter, which will display the print
337 dialog and do the printing. 338 dialog and do the printing.
338 */ 339 */
339 void print(); 340 void print();
340 341
341 /** 342 /**
342 Registers a new GUI client, so plugins can register its actions. 343 Registers a new GUI client, so plugins can register its actions.
343 */ 344 */
344 void addGUIClient( KXMLGUIClient *client ); 345 void addGUIClient( KXMLGUIClient *client );
345 346
346 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 347 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
347 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 348 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
348 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 349 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
349 350
350 351
351 signals: 352 signals:
352 void contactSelected( const QString &name ); 353 void contactSelected( const QString &name );
353 void contactSelected( const QPixmap &pixmap ); 354 void contactSelected( const QPixmap &pixmap );
354 public slots: 355 public slots:
355 void recieve(QString cmsg ); 356 void recieve(QString cmsg );
356 void getFile( bool success ); 357 void getFile( bool success );
357 void syncFileRequest(); 358 void syncFileRequest();
358 void setDetailsVisible( bool visible ); 359 void setDetailsVisible( bool visible );
359 void setDetailsToState(); 360 void setDetailsToState();
360 // void slotSyncMenu( int ); 361 // void slotSyncMenu( int );
361 private slots: 362 private slots:
362 void receive( const QCString& cmsg, const QByteArray& data ); 363 void receive( const QCString& cmsg, const QByteArray& data );
363 void toggleBeamReceive( ); 364 void toggleBeamReceive( );
364 void disableBR(bool); 365 void disableBR(bool);
365 void setJumpButtonBarVisible( bool visible ); 366 void setJumpButtonBarVisible( bool visible );
366 void setCaptionBack(); 367 void setCaptionBack();
367 void importFromOL(); 368 void importFromOL();
368 void extensionModified( const KABC::Addressee::List &list ); 369 void extensionModified( const KABC::Addressee::List &list );
369 void extensionChanged( int id ); 370 void extensionChanged( int id );
370 void clipboardDataChanged(); 371 void clipboardDataChanged();
371 void updateActionMenu(); 372 void updateActionMenu();
372 void configureKeyBindings(); 373 void configureKeyBindings();
373 void removeVoice(); 374 void removeVoice();
374#ifdef KAB_EMBEDDED 375#ifdef KAB_EMBEDDED
375 void configureResources(); 376 void configureResources();
376#endif //KAB_EMBEDDED 377#endif //KAB_EMBEDDED
377 378
378 void slotEditorDestroyed( const QString &uid ); 379 void slotEditorDestroyed( const QString &uid );
379 void configurationChanged(); 380 void configurationChanged();
380 void addressBookChanged(); 381 void addressBookChanged();
381 382
382 private: 383 private:
383 bool mBRdisabled; 384 bool mBRdisabled;
384#ifndef DESKTOP_VERSION 385#ifndef DESKTOP_VERSION
385 QCopChannel* infrared; 386 QCopChannel* infrared;
386#endif 387#endif
387 QTimer *mMessageTimer; 388 QTimer *mMessageTimer;
388 void initGUI(); 389 void initGUI();
389 void initActions(); 390 void initActions();
390 QString getPhoneFile(); 391 QString getPhoneFile();
391 392
392 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 393 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
393 const char *name = 0 ); 394 const char *name = 0 );
394 395
395 KXMLGUIClient *mGUIClient; 396 KXMLGUIClient *mGUIClient;
396 397
397 KABC::AddressBook *mAddressBook; 398 KABC::AddressBook *mAddressBook;
398 399
399 ViewManager *mViewManager; 400 ViewManager *mViewManager;
400 // QSplitter *mDetailsSplitter; 401 // QSplitter *mDetailsSplitter;
401 KDGanttMinimizeSplitter *mExtensionBarSplitter; 402 KDGanttMinimizeSplitter *mExtensionBarSplitter;
402 ViewContainer *mDetails; 403 ViewContainer *mDetails;
403 KDGanttMinimizeSplitter* mMiniSplitter; 404 KDGanttMinimizeSplitter* mMiniSplitter;
404 XXPortManager *mXXPortManager; 405 XXPortManager *mXXPortManager;
405 JumpButtonBar *mJumpButtonBar; 406 JumpButtonBar *mJumpButtonBar;
406 IncSearchWidget *mIncSearchWidget; 407 IncSearchWidget *mIncSearchWidget;
407 ExtensionManager *mExtensionManager; 408 ExtensionManager *mExtensionManager;
408 409
409 KCMultiDialog *mConfigureDialog; 410 KCMultiDialog *mConfigureDialog;
410 411
411#ifndef KAB_EMBEDDED 412#ifndef KAB_EMBEDDED
412 LDAPSearchDialog *mLdapSearchDialog; 413 LDAPSearchDialog *mLdapSearchDialog;
413#endif //KAB_EMBEDDED 414#endif //KAB_EMBEDDED
414 // QDict<AddresseeEditorDialog> mEditorDict; 415 // QDict<AddresseeEditorDialog> mEditorDict;
415 AddresseeEditorDialog *mEditorDialog; 416 AddresseeEditorDialog *mEditorDialog;
416 bool mReadWrite; 417 bool mReadWrite;
417 bool mModified; 418 bool mModified;
418 bool mIsPart; 419 bool mIsPart;
419 bool mMultipleViewsAtOnce; 420 bool mMultipleViewsAtOnce;
420 421
421 422
422 //US file menu 423 //US file menu
423 KAction *mActionMail; 424 KAction *mActionMail;
424 KAction *mActionBeam; 425 KAction *mActionBeam;
425 KToggleAction *mActionBR; 426 KToggleAction *mActionBR;
426 KAction *mActionExport2phone; 427 KAction *mActionExport2phone;
427 KAction* mActionPrint; 428 KAction* mActionPrint;
428 KAction* mActionNewContact; 429 KAction* mActionNewContact;
429 KAction *mActionSave; 430 KAction *mActionSave;
430 KAction *mActionEditAddressee; 431 KAction *mActionEditAddressee;
431 KAction *mActionMailVCard; 432 KAction *mActionMailVCard;
432 KAction *mActionBeamVCard; 433 KAction *mActionBeamVCard;
433 434
434 KAction *mActionQuit; 435 KAction *mActionQuit;
435 436
436 //US edit menu 437 //US edit menu
437 KAction *mActionCopy; 438 KAction *mActionCopy;
438 KAction *mActionCut; 439 KAction *mActionCut;
439 KAction *mActionPaste; 440 KAction *mActionPaste;
440 KAction *mActionSelectAll; 441 KAction *mActionSelectAll;
441 KAction *mActionUndo; 442 KAction *mActionUndo;
442 KAction *mActionRedo; 443 KAction *mActionRedo;
443 KAction *mActionDelete; 444 KAction *mActionDelete;
444 445
445 //US settings menu 446 //US settings menu
446 KAction *mActionConfigResources; 447 KAction *mActionConfigResources;
447 KAction *mActionConfigKAddressbook; 448 KAction *mActionConfigKAddressbook;
448 KAction *mActionConfigShortcuts; 449 KAction *mActionConfigShortcuts;
449 KAction *mActionConfigureToolbars; 450 KAction *mActionConfigureToolbars;
450 KAction *mActionKeyBindings; 451 KAction *mActionKeyBindings;
451 KToggleAction *mActionJumpBar; 452 KToggleAction *mActionJumpBar;
452 KToggleAction *mActionDetails; 453 KToggleAction *mActionDetails;
453 KAction *mActionWhoAmI; 454 KAction *mActionWhoAmI;
454 KAction *mActionCategories; 455 KAction *mActionCategories;
456 KAction *mActionEditCategories;
455 KAction *mActionManageCategories; 457 KAction *mActionManageCategories;
456 KAction *mActionAboutKAddressbook; 458 KAction *mActionAboutKAddressbook;
457 KAction *mActionLicence; 459 KAction *mActionLicence;
458 KAction *mActionFaq; 460 KAction *mActionFaq;
459 KAction *mActionWN; 461 KAction *mActionWN;
460 KAction *mActionSyncHowto; 462 KAction *mActionSyncHowto;
461 KAction *mActionKdeSyncHowto; 463 KAction *mActionKdeSyncHowto;
462 KAction *mActionMultiSyncHowto; 464 KAction *mActionMultiSyncHowto;
463 465
464 KAction *mActionDeleteView; 466 KAction *mActionDeleteView;
465 467
466 QPopupMenu *viewMenu; 468 QPopupMenu *viewMenu;
467 QPopupMenu *filterMenu; 469 QPopupMenu *filterMenu;
468 QPopupMenu *settingsMenu; 470 QPopupMenu *settingsMenu;
469 QPopupMenu *changeMenu; 471 QPopupMenu *changeMenu;
470//US QAction *mActionSave; 472//US QAction *mActionSave;
471 QPopupMenu *ImportMenu; 473 QPopupMenu *ImportMenu;
472 QPopupMenu *ExportMenu; 474 QPopupMenu *ExportMenu;
473 //LR additional methods 475 //LR additional methods
474 KAction *mActionRemoveVoice; 476 KAction *mActionRemoveVoice;
475 KAction * mActionImportOL; 477 KAction * mActionImportOL;
476 478
477#ifndef KAB_EMBEDDED 479#ifndef KAB_EMBEDDED
478 KAddressBookService *mAddressBookService; 480 KAddressBookService *mAddressBookService;
479#endif //KAB_EMBEDDED 481#endif //KAB_EMBEDDED
480 482
481 class KABCorePrivate; 483 class KABCorePrivate;
482 KABCorePrivate *d; 484 KABCorePrivate *d;
483 //US bool mBlockSaveFlag; 485 //US bool mBlockSaveFlag;
484 486
485#ifdef KAB_EMBEDDED 487#ifdef KAB_EMBEDDED
486 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 488 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
487#endif //KAB_EMBEDDED 489#endif //KAB_EMBEDDED
488 490
489 //this are the overwritten callbackmethods from the syncinterface 491 //this are the overwritten callbackmethods from the syncinterface
490 virtual bool sync(KSyncManager* manager, QString filename, int mode); 492 virtual bool sync(KSyncManager* manager, QString filename, int mode);
491 virtual bool syncExternal(KSyncManager* manager, QString resource); 493 virtual bool syncExternal(KSyncManager* manager, QString resource);
492 virtual void removeSyncInfo( QString syncProfile); 494 virtual void removeSyncInfo( QString syncProfile);
493 bool syncPhone(); 495 bool syncPhone();
494 void message( QString m ); 496 void message( QString m );
495 497
496 // LR ******************************* 498 // LR *******************************
497 // sync stuff! 499 // sync stuff!
498 QString sentSyncFile(); 500 QString sentSyncFile();
499 QPopupMenu *syncMenu; 501 QPopupMenu *syncMenu;
500 KSyncManager* syncManager; 502 KSyncManager* syncManager;
501 int mGlobalSyncMode; 503 int mGlobalSyncMode;
502 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 504 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
503 KABC::Addressee getLastSyncAddressee(); 505 KABC::Addressee getLastSyncAddressee();
504 QDateTime mLastAddressbookSync; 506 QDateTime mLastAddressbookSync;
505 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 507 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
506 // ********************* 508 // *********************
507 509
508}; 510};
509 511
510#endif 512#endif