summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-10-06 16:02:56 (UTC)
committer zautrix <zautrix>2004-10-06 16:02:56 (UTC)
commita22de800110d8350a5200a994b041e47d51bf4c6 (patch) (unidiff)
treea4de195003d1ceabc3fd9ca4e5cd0510570bcb97 /kaddressbook
parentef71411c2f248d1dc908aa2f119c9b281e0e8bb9 (diff)
downloadkdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.zip
kdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.tar.gz
kdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.tar.bz2
added phone export
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp143
-rw-r--r--kaddressbook/kabcore.h2
2 files changed, 145 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index f8359de..185cf46 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,803 +1,941 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include "kabcore.h" 31#include "kabcore.h"
32 32
33#include <stdaddressbook.h> 33#include <stdaddressbook.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kfiledialog.h> 35#include <kfiledialog.h>
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qlabel.h>
38#include <qlineedit.h>
39#include <qcheckbox.h>
40#include <qpushbutton.h>
37#include <qprogressbar.h> 41#include <qprogressbar.h>
38 42
39#ifndef KAB_EMBEDDED 43#ifndef KAB_EMBEDDED
40#include <qclipboard.h> 44#include <qclipboard.h>
41#include <qdir.h> 45#include <qdir.h>
42#include <qfile.h> 46#include <qfile.h>
43#include <qapplicaton.h> 47#include <qapplicaton.h>
44#include <qprogressbar.h> 48#include <qprogressbar.h>
45#include <qlayout.h> 49#include <qlayout.h>
46#include <qregexp.h> 50#include <qregexp.h>
47#include <qvbox.h> 51#include <qvbox.h>
48#include <kabc/addresseelist.h> 52#include <kabc/addresseelist.h>
49#include <kabc/errorhandler.h> 53#include <kabc/errorhandler.h>
50#include <kabc/resource.h> 54#include <kabc/resource.h>
51#include <kabc/vcardconverter.h> 55#include <kabc/vcardconverter.h>
52#include <kapplication.h> 56#include <kapplication.h>
53#include <kactionclasses.h> 57#include <kactionclasses.h>
54#include <kcmultidialog.h> 58#include <kcmultidialog.h>
55#include <kdebug.h> 59#include <kdebug.h>
56#include <kdeversion.h> 60#include <kdeversion.h>
57#include <kkeydialog.h> 61#include <kkeydialog.h>
58#include <kmessagebox.h> 62#include <kmessagebox.h>
59#include <kprinter.h> 63#include <kprinter.h>
60#include <kprotocolinfo.h> 64#include <kprotocolinfo.h>
61#include <kresources/selectdialog.h> 65#include <kresources/selectdialog.h>
62#include <kstandarddirs.h> 66#include <kstandarddirs.h>
63#include <ktempfile.h> 67#include <ktempfile.h>
64#include <kxmlguiclient.h> 68#include <kxmlguiclient.h>
65#include <kaboutdata.h> 69#include <kaboutdata.h>
66#include <libkdepim/categoryselectdialog.h> 70#include <libkdepim/categoryselectdialog.h>
67 71
68#include "addresseeutil.h" 72#include "addresseeutil.h"
69#include "addresseeeditordialog.h" 73#include "addresseeeditordialog.h"
70#include "extensionmanager.h" 74#include "extensionmanager.h"
71#include "kstdaction.h" 75#include "kstdaction.h"
72#include "kaddressbookservice.h" 76#include "kaddressbookservice.h"
73#include "ldapsearchdialog.h" 77#include "ldapsearchdialog.h"
74#include "printing/printingwizard.h" 78#include "printing/printingwizard.h"
75#else // KAB_EMBEDDED 79#else // KAB_EMBEDDED
76 80
77#include <kapplication.h> 81#include <kapplication.h>
78#include "KDGanttMinimizeSplitter.h" 82#include "KDGanttMinimizeSplitter.h"
79#include "kaddressbookmain.h" 83#include "kaddressbookmain.h"
80#include "kactioncollection.h" 84#include "kactioncollection.h"
81#include "addresseedialog.h" 85#include "addresseedialog.h"
82//US 86//US
83#include <addresseeview.h> 87#include <addresseeview.h>
84 88
85#include <qapp.h> 89#include <qapp.h>
86#include <qmenubar.h> 90#include <qmenubar.h>
87//#include <qtoolbar.h> 91//#include <qtoolbar.h>
88#include <qmessagebox.h> 92#include <qmessagebox.h>
89#include <kdebug.h> 93#include <kdebug.h>
90#include <kiconloader.h> // needed for SmallIcon 94#include <kiconloader.h> // needed for SmallIcon
91#include <kresources/kcmkresources.h> 95#include <kresources/kcmkresources.h>
92#include <ktoolbar.h> 96#include <ktoolbar.h>
93 97
94 98
95//#include <qlabel.h> 99//#include <qlabel.h>
96 100
97 101
98#ifndef DESKTOP_VERSION 102#ifndef DESKTOP_VERSION
99#include <qpe/ir.h> 103#include <qpe/ir.h>
100#include <qpe/qpemenubar.h> 104#include <qpe/qpemenubar.h>
101#include <qtopia/qcopenvelope_qws.h> 105#include <qtopia/qcopenvelope_qws.h>
102#else 106#else
103 107
104#include <qmenubar.h> 108#include <qmenubar.h>
105#endif 109#endif
106 110
107#endif // KAB_EMBEDDED 111#endif // KAB_EMBEDDED
108#include "kcmconfigs/kcmkabconfig.h" 112#include "kcmconfigs/kcmkabconfig.h"
109#include "kcmconfigs/kcmkdepimconfig.h" 113#include "kcmconfigs/kcmkdepimconfig.h"
110#include "kpimglobalprefs.h" 114#include "kpimglobalprefs.h"
111#include "externalapphandler.h" 115#include "externalapphandler.h"
112 116
113 117
114#include <kresources/selectdialog.h> 118#include <kresources/selectdialog.h>
115#include <kmessagebox.h> 119#include <kmessagebox.h>
116 120
117#include <picture.h> 121#include <picture.h>
118#include <resource.h> 122#include <resource.h>
119 123
120//US#include <qsplitter.h> 124//US#include <qsplitter.h>
121#include <qmap.h> 125#include <qmap.h>
122#include <qdir.h> 126#include <qdir.h>
123#include <qfile.h> 127#include <qfile.h>
124#include <qvbox.h> 128#include <qvbox.h>
125#include <qlayout.h> 129#include <qlayout.h>
126#include <qclipboard.h> 130#include <qclipboard.h>
127#include <qtextstream.h> 131#include <qtextstream.h>
128 132
129#include <libkdepim/categoryselectdialog.h> 133#include <libkdepim/categoryselectdialog.h>
130#include <kabc/vcardconverter.h> 134#include <kabc/vcardconverter.h>
131 135
132 136
133#include "addresseeutil.h" 137#include "addresseeutil.h"
134#include "undocmds.h" 138#include "undocmds.h"
135#include "addresseeeditordialog.h" 139#include "addresseeeditordialog.h"
136#include "viewmanager.h" 140#include "viewmanager.h"
137#include "details/detailsviewcontainer.h" 141#include "details/detailsviewcontainer.h"
138#include "kabprefs.h" 142#include "kabprefs.h"
139#include "xxportmanager.h" 143#include "xxportmanager.h"
140#include "incsearchwidget.h" 144#include "incsearchwidget.h"
141#include "jumpbuttonbar.h" 145#include "jumpbuttonbar.h"
142#include "extensionmanager.h" 146#include "extensionmanager.h"
143#include "addresseeconfig.h" 147#include "addresseeconfig.h"
144#include <kcmultidialog.h> 148#include <kcmultidialog.h>
145 149
146#ifdef _WIN32_ 150#ifdef _WIN32_
147 151
148#include "kaimportoldialog.h" 152#include "kaimportoldialog.h"
149#else 153#else
150#include <unistd.h> 154#include <unistd.h>
151#endif 155#endif
152// sync includes 156// sync includes
153#include <libkdepim/ksyncprofile.h> 157#include <libkdepim/ksyncprofile.h>
154#include <libkdepim/ksyncprefsdialog.h> 158#include <libkdepim/ksyncprefsdialog.h>
155 159
160class KAex2phonePrefs : public QDialog
161{
162 public:
163 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
164 QDialog( parent, name, true )
165 {
166 setCaption( i18n("Export to phone options") );
167 QVBoxLayout* lay = new QVBoxLayout( this );
168 lay->setSpacing( 3 );
169 lay->setMargin( 3 );
170 QLabel *lab;
171 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
172 lab->setAlignment (AlignHCenter );
173 QHBox* temphb;
174 temphb = new QHBox( this );
175 new QLabel( i18n("I/O device: "), temphb );
176 mPhoneDevice = new QLineEdit( temphb);
177 lay->addWidget( temphb );
178 temphb = new QHBox( this );
179 new QLabel( i18n("Connection: "), temphb );
180 mPhoneConnection = new QLineEdit( temphb);
181 lay->addWidget( temphb );
182 temphb = new QHBox( this );
183 new QLabel( i18n("Model(opt.): "), temphb );
184 mPhoneModel = new QLineEdit( temphb);
185 lay->addWidget( temphb );
186 mWriteToSim= new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
187 lay->addWidget( mWriteToSim );
188 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
189 lab->setAlignment (AlignHCenter );
190 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
191 lay->addWidget( ok );
192 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
193 lay->addWidget( cancel );
194 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
195 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
196 resize( 220, 240 );
197
198 }
199
200public:
201 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
202 QCheckBox* mWriteToSim;
203};
156 204
157bool pasteWithNewUid = true; 205bool pasteWithNewUid = true;
158 206
159#ifdef KAB_EMBEDDED 207#ifdef KAB_EMBEDDED
160KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 208KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
161 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 209 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
162 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 210 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
163 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 211 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
164#else //KAB_EMBEDDED 212#else //KAB_EMBEDDED
165KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 213KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
166 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 214 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
167 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 215 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
168 mReadWrite( readWrite ), mModified( false ) 216 mReadWrite( readWrite ), mModified( false )
169#endif //KAB_EMBEDDED 217#endif //KAB_EMBEDDED
170{ 218{
171 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 219 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
172 // syncManager->setBlockSave(false); 220 // syncManager->setBlockSave(false);
173 mExtensionBarSplitter = 0; 221 mExtensionBarSplitter = 0;
174 mIsPart = !parent->inherits( "KAddressBookMain" ); 222 mIsPart = !parent->inherits( "KAddressBookMain" );
175 223
176 mAddressBook = KABC::StdAddressBook::self(); 224 mAddressBook = KABC::StdAddressBook::self();
177 KABC::StdAddressBook::setAutomaticSave( false ); 225 KABC::StdAddressBook::setAutomaticSave( false );
178 226
179#ifndef KAB_EMBEDDED 227#ifndef KAB_EMBEDDED
180 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 228 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
181#endif //KAB_EMBEDDED 229#endif //KAB_EMBEDDED
182 230
183 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 231 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
184 SLOT( addressBookChanged() ) ); 232 SLOT( addressBookChanged() ) );
185 233
186#if 0 234#if 0
187 // LP moved to addressbook init method 235 // LP moved to addressbook init method
188 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 236 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
189 "X-Department", "KADDRESSBOOK" ); 237 "X-Department", "KADDRESSBOOK" );
190 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 238 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
191 "X-Profession", "KADDRESSBOOK" ); 239 "X-Profession", "KADDRESSBOOK" );
192 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 240 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
193 "X-AssistantsName", "KADDRESSBOOK" ); 241 "X-AssistantsName", "KADDRESSBOOK" );
194 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 242 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
195 "X-ManagersName", "KADDRESSBOOK" ); 243 "X-ManagersName", "KADDRESSBOOK" );
196 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 244 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
197 "X-SpousesName", "KADDRESSBOOK" ); 245 "X-SpousesName", "KADDRESSBOOK" );
198 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 246 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
199 "X-Office", "KADDRESSBOOK" ); 247 "X-Office", "KADDRESSBOOK" );
200 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 248 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
201 "X-IMAddress", "KADDRESSBOOK" ); 249 "X-IMAddress", "KADDRESSBOOK" );
202 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 250 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
203 "X-Anniversary", "KADDRESSBOOK" ); 251 "X-Anniversary", "KADDRESSBOOK" );
204 252
205 //US added this field to become compatible with Opie/qtopia addressbook 253 //US added this field to become compatible with Opie/qtopia addressbook
206 // values can be "female" or "male" or "". An empty field represents undefined. 254 // values can be "female" or "male" or "". An empty field represents undefined.
207 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 255 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
208 "X-Gender", "KADDRESSBOOK" ); 256 "X-Gender", "KADDRESSBOOK" );
209 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 257 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
210 "X-Children", "KADDRESSBOOK" ); 258 "X-Children", "KADDRESSBOOK" );
211 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 259 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
212 "X-FreeBusyUrl", "KADDRESSBOOK" ); 260 "X-FreeBusyUrl", "KADDRESSBOOK" );
213#endif 261#endif
214 initGUI(); 262 initGUI();
215 263
216 mIncSearchWidget->setFocus(); 264 mIncSearchWidget->setFocus();
217 265
218 266
219 connect( mViewManager, SIGNAL( selected( const QString& ) ), 267 connect( mViewManager, SIGNAL( selected( const QString& ) ),
220 SLOT( setContactSelected( const QString& ) ) ); 268 SLOT( setContactSelected( const QString& ) ) );
221 connect( mViewManager, SIGNAL( executed( const QString& ) ), 269 connect( mViewManager, SIGNAL( executed( const QString& ) ),
222 SLOT( executeContact( const QString& ) ) ); 270 SLOT( executeContact( const QString& ) ) );
223 271
224 connect( mViewManager, SIGNAL( deleteRequest( ) ), 272 connect( mViewManager, SIGNAL( deleteRequest( ) ),
225 SLOT( deleteContacts( ) ) ); 273 SLOT( deleteContacts( ) ) );
226 connect( mViewManager, SIGNAL( modified() ), 274 connect( mViewManager, SIGNAL( modified() ),
227 SLOT( setModified() ) ); 275 SLOT( setModified() ) );
228 276
229 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 277 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
230 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 278 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
231 279
232 connect( mXXPortManager, SIGNAL( modified() ), 280 connect( mXXPortManager, SIGNAL( modified() ),
233 SLOT( setModified() ) ); 281 SLOT( setModified() ) );
234 282
235 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 283 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
236 SLOT( incrementalSearch( const QString& ) ) ); 284 SLOT( incrementalSearch( const QString& ) ) );
237 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 285 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
238 mJumpButtonBar, SLOT( recreateButtons() ) ); 286 mJumpButtonBar, SLOT( recreateButtons() ) );
239 287
240 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 288 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
241 SLOT( sendMail( const QString& ) ) ); 289 SLOT( sendMail( const QString& ) ) );
242 290
243 291
244 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 292 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
245 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&))); 293 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&)));
246 294
247 295
248#ifndef KAB_EMBEDDED 296#ifndef KAB_EMBEDDED
249 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 297 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
250 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 298 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
251 299
252 connect( mDetails, SIGNAL( browse( const QString& ) ), 300 connect( mDetails, SIGNAL( browse( const QString& ) ),
253 SLOT( browse( const QString& ) ) ); 301 SLOT( browse( const QString& ) ) );
254 302
255 303
256 mAddressBookService = new KAddressBookService( this ); 304 mAddressBookService = new KAddressBookService( this );
257 305
258#endif //KAB_EMBEDDED 306#endif //KAB_EMBEDDED
259 mEditorDialog = 0; 307 mEditorDialog = 0;
260 createAddresseeEditorDialog( this ); 308 createAddresseeEditorDialog( this );
261 setModified( false ); 309 setModified( false );
262} 310}
263 311
264KABCore::~KABCore() 312KABCore::~KABCore()
265{ 313{
266 // save(); 314 // save();
267 //saveSettings(); 315 //saveSettings();
268 //KABPrefs::instance()->writeConfig(); 316 //KABPrefs::instance()->writeConfig();
269 delete AddresseeConfig::instance(); 317 delete AddresseeConfig::instance();
270 mAddressBook = 0; 318 mAddressBook = 0;
271 KABC::StdAddressBook::close(); 319 KABC::StdAddressBook::close();
272 320
273 delete syncManager; 321 delete syncManager;
274} 322}
275 323
276void KABCore::restoreSettings() 324void KABCore::restoreSettings()
277{ 325{
278 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 326 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
279 327
280 bool state; 328 bool state;
281 329
282 if (mMultipleViewsAtOnce) 330 if (mMultipleViewsAtOnce)
283 state = KABPrefs::instance()->mDetailsPageVisible; 331 state = KABPrefs::instance()->mDetailsPageVisible;
284 else 332 else
285 state = false; 333 state = false;
286 334
287 mActionDetails->setChecked( state ); 335 mActionDetails->setChecked( state );
288 setDetailsVisible( state ); 336 setDetailsVisible( state );
289 337
290 state = KABPrefs::instance()->mJumpButtonBarVisible; 338 state = KABPrefs::instance()->mJumpButtonBarVisible;
291 339
292 mActionJumpBar->setChecked( state ); 340 mActionJumpBar->setChecked( state );
293 setJumpButtonBarVisible( state ); 341 setJumpButtonBarVisible( state );
294/*US 342/*US
295 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 343 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
296 if ( splitterSize.count() == 0 ) { 344 if ( splitterSize.count() == 0 ) {
297 splitterSize.append( width() / 2 ); 345 splitterSize.append( width() / 2 );
298 splitterSize.append( width() / 2 ); 346 splitterSize.append( width() / 2 );
299 } 347 }
300 mMiniSplitter->setSizes( splitterSize ); 348 mMiniSplitter->setSizes( splitterSize );
301 if ( mExtensionBarSplitter ) { 349 if ( mExtensionBarSplitter ) {
302 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 350 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
303 if ( splitterSize.count() == 0 ) { 351 if ( splitterSize.count() == 0 ) {
304 splitterSize.append( width() / 2 ); 352 splitterSize.append( width() / 2 );
305 splitterSize.append( width() / 2 ); 353 splitterSize.append( width() / 2 );
306 } 354 }
307 mExtensionBarSplitter->setSizes( splitterSize ); 355 mExtensionBarSplitter->setSizes( splitterSize );
308 356
309 } 357 }
310*/ 358*/
311 mViewManager->restoreSettings(); 359 mViewManager->restoreSettings();
312 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 360 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
313 mExtensionManager->restoreSettings(); 361 mExtensionManager->restoreSettings();
314#ifdef DESKTOP_VERSION 362#ifdef DESKTOP_VERSION
315 int wid = width(); 363 int wid = width();
316 if ( wid < 10 ) 364 if ( wid < 10 )
317 wid = 400; 365 wid = 400;
318#else 366#else
319 int wid = QApplication::desktop()->width(); 367 int wid = QApplication::desktop()->width();
320 if ( wid < 640 ) 368 if ( wid < 640 )
321 wid = QApplication::desktop()->height(); 369 wid = QApplication::desktop()->height();
322#endif 370#endif
323 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 371 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
324 if ( true /*splitterSize.count() == 0*/ ) { 372 if ( true /*splitterSize.count() == 0*/ ) {
325 splitterSize.append( wid / 2 ); 373 splitterSize.append( wid / 2 );
326 splitterSize.append( wid / 2 ); 374 splitterSize.append( wid / 2 );
327 } 375 }
328 mMiniSplitter->setSizes( splitterSize ); 376 mMiniSplitter->setSizes( splitterSize );
329 if ( mExtensionBarSplitter ) { 377 if ( mExtensionBarSplitter ) {
330 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 378 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
331 if ( true /*splitterSize.count() == 0*/ ) { 379 if ( true /*splitterSize.count() == 0*/ ) {
332 splitterSize.append( wid / 2 ); 380 splitterSize.append( wid / 2 );
333 splitterSize.append( wid / 2 ); 381 splitterSize.append( wid / 2 );
334 } 382 }
335 mExtensionBarSplitter->setSizes( splitterSize ); 383 mExtensionBarSplitter->setSizes( splitterSize );
336 384
337 } 385 }
338 386
339 387
340} 388}
341 389
342void KABCore::saveSettings() 390void KABCore::saveSettings()
343{ 391{
344 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 392 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
345 if ( mExtensionBarSplitter ) 393 if ( mExtensionBarSplitter )
346 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 394 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
347 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 395 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
348 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 396 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
349#ifndef KAB_EMBEDDED 397#ifndef KAB_EMBEDDED
350 398
351 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 399 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
352 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 400 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
353#endif //KAB_EMBEDDED 401#endif //KAB_EMBEDDED
354 mExtensionManager->saveSettings(); 402 mExtensionManager->saveSettings();
355 mViewManager->saveSettings(); 403 mViewManager->saveSettings();
356 404
357 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 405 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
358} 406}
359 407
360KABC::AddressBook *KABCore::addressBook() const 408KABC::AddressBook *KABCore::addressBook() const
361{ 409{
362 return mAddressBook; 410 return mAddressBook;
363} 411}
364 412
365KConfig *KABCore::config() 413KConfig *KABCore::config()
366{ 414{
367#ifndef KAB_EMBEDDED 415#ifndef KAB_EMBEDDED
368 return KABPrefs::instance()->config(); 416 return KABPrefs::instance()->config();
369#else //KAB_EMBEDDED 417#else //KAB_EMBEDDED
370 return KABPrefs::instance()->getConfig(); 418 return KABPrefs::instance()->getConfig();
371#endif //KAB_EMBEDDED 419#endif //KAB_EMBEDDED
372} 420}
373 421
374KActionCollection *KABCore::actionCollection() const 422KActionCollection *KABCore::actionCollection() const
375{ 423{
376 return mGUIClient->actionCollection(); 424 return mGUIClient->actionCollection();
377} 425}
378 426
379KABC::Field *KABCore::currentSearchField() const 427KABC::Field *KABCore::currentSearchField() const
380{ 428{
381 if (mIncSearchWidget) 429 if (mIncSearchWidget)
382 return mIncSearchWidget->currentField(); 430 return mIncSearchWidget->currentField();
383 else 431 else
384 return 0; 432 return 0;
385} 433}
386 434
387QStringList KABCore::selectedUIDs() const 435QStringList KABCore::selectedUIDs() const
388{ 436{
389 return mViewManager->selectedUids(); 437 return mViewManager->selectedUids();
390} 438}
391 439
392KABC::Resource *KABCore::requestResource( QWidget *parent ) 440KABC::Resource *KABCore::requestResource( QWidget *parent )
393{ 441{
394 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 442 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
395 443
396 QPtrList<KRES::Resource> kresResources; 444 QPtrList<KRES::Resource> kresResources;
397 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 445 QPtrListIterator<KABC::Resource> resIt( kabcResources );
398 KABC::Resource *resource; 446 KABC::Resource *resource;
399 while ( ( resource = resIt.current() ) != 0 ) { 447 while ( ( resource = resIt.current() ) != 0 ) {
400 ++resIt; 448 ++resIt;
401 if ( !resource->readOnly() ) { 449 if ( !resource->readOnly() ) {
402 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 450 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
403 if ( res ) 451 if ( res )
404 kresResources.append( res ); 452 kresResources.append( res );
405 } 453 }
406 } 454 }
407 455
408 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 456 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
409 return static_cast<KABC::Resource*>( res ); 457 return static_cast<KABC::Resource*>( res );
410} 458}
411 459
412#ifndef KAB_EMBEDDED 460#ifndef KAB_EMBEDDED
413KAboutData *KABCore::createAboutData() 461KAboutData *KABCore::createAboutData()
414#else //KAB_EMBEDDED 462#else //KAB_EMBEDDED
415void KABCore::createAboutData() 463void KABCore::createAboutData()
416#endif //KAB_EMBEDDED 464#endif //KAB_EMBEDDED
417{ 465{
418#ifndef KAB_EMBEDDED 466#ifndef KAB_EMBEDDED
419 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 467 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
420 "3.1", I18N_NOOP( "The KDE Address Book" ), 468 "3.1", I18N_NOOP( "The KDE Address Book" ),
421 KAboutData::License_GPL_V2, 469 KAboutData::License_GPL_V2,
422 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 470 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
423 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 471 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
424 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 472 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
425 about->addAuthor( "Cornelius Schumacher", 473 about->addAuthor( "Cornelius Schumacher",
426 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 474 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
427 "schumacher@kde.org" ); 475 "schumacher@kde.org" );
428 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 476 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
429 "mpilone@slac.com" ); 477 "mpilone@slac.com" );
430 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 478 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
431 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 479 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
432 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 480 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
433 "michel@klaralvdalens-datakonsult.se" ); 481 "michel@klaralvdalens-datakonsult.se" );
434 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 482 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
435 "hansen@kde.org" ); 483 "hansen@kde.org" );
436 484
437 return about; 485 return about;
438#endif //KAB_EMBEDDED 486#endif //KAB_EMBEDDED
439 487
440 QString version; 488 QString version;
441#include <../version> 489#include <../version>
442 QMessageBox::about( this, "About KAddressbook/Pi", 490 QMessageBox::about( this, "About KAddressbook/Pi",
443 "KAddressbook/Platform-independent\n" 491 "KAddressbook/Platform-independent\n"
444 "(KA/Pi) " +version + " - " + 492 "(KA/Pi) " +version + " - " +
445#ifdef DESKTOP_VERSION 493#ifdef DESKTOP_VERSION
446 "Desktop Edition\n" 494 "Desktop Edition\n"
447#else 495#else
448 "PDA-Edition\n" 496 "PDA-Edition\n"
449 "for: Zaurus 5500 / 7x0 / 8x0\n" 497 "for: Zaurus 5500 / 7x0 / 8x0\n"
450#endif 498#endif
451 499
452 "(c) 2004 Ulf Schenk\n" 500 "(c) 2004 Ulf Schenk\n"
453 "(c) 2004 Lutz Rogowski\n" 501 "(c) 2004 Lutz Rogowski\n"
454 "(c) 1997-2003, The KDE PIM Team\n" 502 "(c) 1997-2003, The KDE PIM Team\n"
455 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 503 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
456 "Don Sanders Original author\n" 504 "Don Sanders Original author\n"
457 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 505 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
458 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 506 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
459 "Greg Stern DCOP interface\n" 507 "Greg Stern DCOP interface\n"
460 "Mark Westcot Contact pinning\n" 508 "Mark Westcot Contact pinning\n"
461 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 509 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
462 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 510 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
463#ifdef _WIN32_ 511#ifdef _WIN32_
464 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 512 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
465#endif 513#endif
466 ); 514 );
467} 515}
468 516
469void KABCore::setContactSelected( const QString &uid ) 517void KABCore::setContactSelected( const QString &uid )
470{ 518{
471 KABC::Addressee addr = mAddressBook->findByUid( uid ); 519 KABC::Addressee addr = mAddressBook->findByUid( uid );
472 if ( !mDetails->isHidden() ) 520 if ( !mDetails->isHidden() )
473 mDetails->setAddressee( addr ); 521 mDetails->setAddressee( addr );
474 522
475 if ( !addr.isEmpty() ) { 523 if ( !addr.isEmpty() ) {
476 emit contactSelected( addr.formattedName() ); 524 emit contactSelected( addr.formattedName() );
477 KABC::Picture pic = addr.photo(); 525 KABC::Picture pic = addr.photo();
478 if ( pic.isIntern() ) { 526 if ( pic.isIntern() ) {
479//US emit contactSelected( pic.data() ); 527//US emit contactSelected( pic.data() );
480//US instead use: 528//US instead use:
481 QPixmap px; 529 QPixmap px;
482 if (pic.data().isNull() != true) 530 if (pic.data().isNull() != true)
483 { 531 {
484 px.convertFromImage(pic.data()); 532 px.convertFromImage(pic.data());
485 } 533 }
486 534
487 emit contactSelected( px ); 535 emit contactSelected( px );
488 } 536 }
489 } 537 }
490 538
491 539
492 mExtensionManager->setSelectionChanged(); 540 mExtensionManager->setSelectionChanged();
493 541
494 // update the actions 542 // update the actions
495 bool selected = !uid.isEmpty(); 543 bool selected = !uid.isEmpty();
496 544
497 if ( mReadWrite ) { 545 if ( mReadWrite ) {
498 mActionCut->setEnabled( selected ); 546 mActionCut->setEnabled( selected );
499 mActionPaste->setEnabled( selected ); 547 mActionPaste->setEnabled( selected );
500 } 548 }
501 549
502 mActionCopy->setEnabled( selected ); 550 mActionCopy->setEnabled( selected );
503 mActionDelete->setEnabled( selected ); 551 mActionDelete->setEnabled( selected );
504 mActionEditAddressee->setEnabled( selected ); 552 mActionEditAddressee->setEnabled( selected );
505 mActionMail->setEnabled( selected ); 553 mActionMail->setEnabled( selected );
506 mActionMailVCard->setEnabled( selected ); 554 mActionMailVCard->setEnabled( selected );
507 //if (mActionBeam) 555 //if (mActionBeam)
508 //mActionBeam->setEnabled( selected ); 556 //mActionBeam->setEnabled( selected );
509 557
510 if (mActionBeamVCard) 558 if (mActionBeamVCard)
511 mActionBeamVCard->setEnabled( selected ); 559 mActionBeamVCard->setEnabled( selected );
512 560
561 mActionExport2phone->setEnabled( selected );
513 mActionWhoAmI->setEnabled( selected ); 562 mActionWhoAmI->setEnabled( selected );
514 mActionCategories->setEnabled( selected ); 563 mActionCategories->setEnabled( selected );
515} 564}
516 565
517void KABCore::sendMail() 566void KABCore::sendMail()
518{ 567{
519 sendMail( mViewManager->selectedEmails().join( ", " ) ); 568 sendMail( mViewManager->selectedEmails().join( ", " ) );
520} 569}
521 570
522void KABCore::sendMail( const QString& emaillist ) 571void KABCore::sendMail( const QString& emaillist )
523{ 572{
524 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 573 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
525 if (emaillist.contains(",") > 0) 574 if (emaillist.contains(",") > 0)
526 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 575 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
527 else 576 else
528 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 577 ExternalAppHandler::instance()->mailToOneContact( emaillist );
529} 578}
530 579
531 580
532 581
533void KABCore::mailVCard() 582void KABCore::mailVCard()
534{ 583{
535 QStringList uids = mViewManager->selectedUids(); 584 QStringList uids = mViewManager->selectedUids();
536 if ( !uids.isEmpty() ) 585 if ( !uids.isEmpty() )
537 mailVCard( uids ); 586 mailVCard( uids );
538} 587}
539 588
540void KABCore::mailVCard( const QStringList& uids ) 589void KABCore::mailVCard( const QStringList& uids )
541{ 590{
542 QStringList urls; 591 QStringList urls;
543 592
544// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 593// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
545 594
546 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 595 QString dirName = "/tmp/" + KApplication::randomString( 8 );
547 596
548 597
549 598
550 QDir().mkdir( dirName, true ); 599 QDir().mkdir( dirName, true );
551 600
552 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 601 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
553 KABC::Addressee a = mAddressBook->findByUid( *it ); 602 KABC::Addressee a = mAddressBook->findByUid( *it );
554 603
555 if ( a.isEmpty() ) 604 if ( a.isEmpty() )
556 continue; 605 continue;
557 606
558 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 607 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
559 608
560 QString fileName = dirName + "/" + name; 609 QString fileName = dirName + "/" + name;
561 610
562 QFile outFile(fileName); 611 QFile outFile(fileName);
563 612
564 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 613 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
565 KABC::VCardConverter converter; 614 KABC::VCardConverter converter;
566 QString vcard; 615 QString vcard;
567 616
568 converter.addresseeToVCard( a, vcard ); 617 converter.addresseeToVCard( a, vcard );
569 618
570 QTextStream t( &outFile ); // use a text stream 619 QTextStream t( &outFile ); // use a text stream
571 t.setEncoding( QTextStream::UnicodeUTF8 ); 620 t.setEncoding( QTextStream::UnicodeUTF8 );
572 t << vcard; 621 t << vcard;
573 622
574 outFile.close(); 623 outFile.close();
575 624
576 urls.append( fileName ); 625 urls.append( fileName );
577 } 626 }
578 } 627 }
579 628
580 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 629 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
581 630
582 631
583/*US 632/*US
584 kapp->invokeMailer( QString::null, QString::null, QString::null, 633 kapp->invokeMailer( QString::null, QString::null, QString::null,
585 QString::null, // subject 634 QString::null, // subject
586 QString::null, // body 635 QString::null, // body
587 QString::null, 636 QString::null,
588 urls ); // attachments 637 urls ); // attachments
589*/ 638*/
590 639
591} 640}
592 641
593/** 642/**
594 Beams the "WhoAmI contact. 643 Beams the "WhoAmI contact.
595*/ 644*/
596void KABCore::beamMySelf() 645void KABCore::beamMySelf()
597{ 646{
598 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 647 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
599 if (!a.isEmpty()) 648 if (!a.isEmpty())
600 { 649 {
601 QStringList uids; 650 QStringList uids;
602 uids << a.uid(); 651 uids << a.uid();
603 652
604 beamVCard(uids); 653 beamVCard(uids);
605 } else { 654 } else {
606 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 655 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
607 656
608 657
609 } 658 }
610} 659}
611 660
661void KABCore::export2phone()
662{
663
664 KAex2phonePrefs ex2phone;
665 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
666 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
667 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
668
669 if ( !ex2phone.exec() ) {
670 return;
671 }
672 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
673 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
674 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
675
676#if 0
677 PhoneFormat::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
678 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
679 KPimGlobalPrefs::instance()->mEx2PhoneModel );
680
681
682
683
684
685 QString fileName = "/tmp/kapibeamfile.vcf";
686
687
688 //QDir().mkdir( dirName, true );
689
690
691 KABC::VCardConverter converter;
692 QString description;
693 QString datastream;
694 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
695 KABC::Addressee a = mAddressBook->findByUid( *it );
696
697 if ( a.isEmpty() )
698 continue;
699
700 if (description.isEmpty())
701 description = a.formattedName();
702
703 QString vcard;
704 converter.addresseeToVCard( a, vcard );
705 int start = 0;
706 int next;
707 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
708 int semi = vcard.find(";", next);
709 int dopp = vcard.find(":", next);
710 int sep;
711 if ( semi < dopp && semi >= 0 )
712 sep = semi ;
713 else
714 sep = dopp;
715 datastream +=vcard.mid( start, next - start);
716 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
717 start = sep;
718 }
719 datastream += vcard.mid( start,vcard.length() );
720 }
721#ifndef DESKTOP_VERSION
722 QFile outFile(fileName);
723 if ( outFile.open(IO_WriteOnly) ) {
724 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
725 QTextStream t( &outFile ); // use a text stream
726 t.setEncoding( QTextStream::UnicodeUTF8 );
727 t <<datastream;
728 outFile.close();
729 Ir *ir = new Ir( this );
730 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
731 ir->send( fileName, description, "text/x-vCard" );
732 } else {
733 qDebug("Error open temp beam file ");
734 return;
735 }
736#endif
737
738
739
740
741 setCaption( i18n("Writing to phone..."));
742 if ( PhoneFormat::writeToPhone( cal ) )
743 setCaption( i18n("Export to phone successful!"));
744 else
745 setCaption( i18n("Error exporting to phone!"));
746#endif
747
748
749}
612void KABCore::beamVCard() 750void KABCore::beamVCard()
613{ 751{
614 QStringList uids = mViewManager->selectedUids(); 752 QStringList uids = mViewManager->selectedUids();
615 if ( !uids.isEmpty() ) 753 if ( !uids.isEmpty() )
616 beamVCard( uids ); 754 beamVCard( uids );
617} 755}
618 756
619 757
620void KABCore::beamVCard(const QStringList& uids) 758void KABCore::beamVCard(const QStringList& uids)
621{ 759{
622/*US 760/*US
623 QString beamFilename; 761 QString beamFilename;
624 Opie::OPimContact c; 762 Opie::OPimContact c;
625 if ( actionPersonal->isOn() ) { 763 if ( actionPersonal->isOn() ) {
626 beamFilename = addressbookPersonalVCardName(); 764 beamFilename = addressbookPersonalVCardName();
627 if ( !QFile::exists( beamFilename ) ) 765 if ( !QFile::exists( beamFilename ) )
628 return; // can't beam a non-existent file 766 return; // can't beam a non-existent file
629 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 767 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
630 beamFilename ); 768 beamFilename );
631 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 769 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
632 Opie::OPimContactAccess::List allList = access->allRecords(); 770 Opie::OPimContactAccess::List allList = access->allRecords();
633 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first 771 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
634 c = *it; 772 c = *it;
635 773
636 delete access; 774 delete access;
637 } else { 775 } else {
638 unlink( beamfile ); // delete if exists 776 unlink( beamfile ); // delete if exists
639 mkdir("/tmp/obex/", 0755); 777 mkdir("/tmp/obex/", 0755);
640 c = m_abView -> currentEntry(); 778 c = m_abView -> currentEntry();
641 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 779 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
642 beamfile ); 780 beamfile );
643 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 781 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
644 access->add( c ); 782 access->add( c );
645 access->save(); 783 access->save();
646 delete access; 784 delete access;
647 785
648 beamFilename = beamfile; 786 beamFilename = beamfile;
649 } 787 }
650 788
651 owarn << "Beaming: " << beamFilename << oendl; 789 owarn << "Beaming: " << beamFilename << oendl;
652*/ 790*/
653 791
654#if 0 792#if 0
655 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 793 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
656 794
657 QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); 795 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
658 796
659 QString name = "contact.vcf"; 797 QString name = "contact.vcf";
660 798
661 QString fileName = dirName + "/" + name; 799 QString fileName = dirName + "/" + name;
662#endif 800#endif
663 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory 801 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory
664 // 802 //
665 QString fileName = "/tmp/kapibeamfile.vcf"; 803 QString fileName = "/tmp/kapibeamfile.vcf";
666 804
667 805
668 //QDir().mkdir( dirName, true ); 806 //QDir().mkdir( dirName, true );
669 807
670 808
671 KABC::VCardConverter converter; 809 KABC::VCardConverter converter;
672 QString description; 810 QString description;
673 QString datastream; 811 QString datastream;
674 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 812 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
675 KABC::Addressee a = mAddressBook->findByUid( *it ); 813 KABC::Addressee a = mAddressBook->findByUid( *it );
676 814
677 if ( a.isEmpty() ) 815 if ( a.isEmpty() )
678 continue; 816 continue;
679 817
680 if (description.isEmpty()) 818 if (description.isEmpty())
681 description = a.formattedName(); 819 description = a.formattedName();
682 820
683 QString vcard; 821 QString vcard;
684 converter.addresseeToVCard( a, vcard ); 822 converter.addresseeToVCard( a, vcard );
685 int start = 0; 823 int start = 0;
686 int next; 824 int next;
687 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 825 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
688 int semi = vcard.find(";", next); 826 int semi = vcard.find(";", next);
689 int dopp = vcard.find(":", next); 827 int dopp = vcard.find(":", next);
690 int sep; 828 int sep;
691 if ( semi < dopp && semi >= 0 ) 829 if ( semi < dopp && semi >= 0 )
692 sep = semi ; 830 sep = semi ;
693 else 831 else
694 sep = dopp; 832 sep = dopp;
695 datastream +=vcard.mid( start, next - start); 833 datastream +=vcard.mid( start, next - start);
696 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 834 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
697 start = sep; 835 start = sep;
698 } 836 }
699 datastream += vcard.mid( start,vcard.length() ); 837 datastream += vcard.mid( start,vcard.length() );
700 } 838 }
701#ifndef DESKTOP_VERSION 839#ifndef DESKTOP_VERSION
702 QFile outFile(fileName); 840 QFile outFile(fileName);
703 if ( outFile.open(IO_WriteOnly) ) { 841 if ( outFile.open(IO_WriteOnly) ) {
704 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 842 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
705 QTextStream t( &outFile ); // use a text stream 843 QTextStream t( &outFile ); // use a text stream
706 t.setEncoding( QTextStream::UnicodeUTF8 ); 844 t.setEncoding( QTextStream::UnicodeUTF8 );
707 t <<datastream; 845 t <<datastream;
708 outFile.close(); 846 outFile.close();
709 Ir *ir = new Ir( this ); 847 Ir *ir = new Ir( this );
710 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 848 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
711 ir->send( fileName, description, "text/x-vCard" ); 849 ir->send( fileName, description, "text/x-vCard" );
712 } else { 850 } else {
713 qDebug("Error open temp beam file "); 851 qDebug("Error open temp beam file ");
714 return; 852 return;
715 } 853 }
716#endif 854#endif
717 855
718} 856}
719 857
720void KABCore::beamDone( Ir *ir ) 858void KABCore::beamDone( Ir *ir )
721{ 859{
722#ifndef DESKTOP_VERSION 860#ifndef DESKTOP_VERSION
723 delete ir; 861 delete ir;
724#endif 862#endif
725} 863}
726 864
727 865
728void KABCore::browse( const QString& url ) 866void KABCore::browse( const QString& url )
729{ 867{
730#ifndef KAB_EMBEDDED 868#ifndef KAB_EMBEDDED
731 kapp->invokeBrowser( url ); 869 kapp->invokeBrowser( url );
732#else //KAB_EMBEDDED 870#else //KAB_EMBEDDED
733 qDebug("KABCore::browse must be fixed"); 871 qDebug("KABCore::browse must be fixed");
734#endif //KAB_EMBEDDED 872#endif //KAB_EMBEDDED
735} 873}
736 874
737void KABCore::selectAllContacts() 875void KABCore::selectAllContacts()
738{ 876{
739 mViewManager->setSelected( QString::null, true ); 877 mViewManager->setSelected( QString::null, true );
740} 878}
741 879
742void KABCore::deleteContacts() 880void KABCore::deleteContacts()
743{ 881{
744 QStringList uidList = mViewManager->selectedUids(); 882 QStringList uidList = mViewManager->selectedUids();
745 deleteContacts( uidList ); 883 deleteContacts( uidList );
746} 884}
747 885
748void KABCore::deleteContacts( const QStringList &uids ) 886void KABCore::deleteContacts( const QStringList &uids )
749{ 887{
750 if ( uids.count() > 0 ) { 888 if ( uids.count() > 0 ) {
751 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 889 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
752 UndoStack::instance()->push( command ); 890 UndoStack::instance()->push( command );
753 RedoStack::instance()->clear(); 891 RedoStack::instance()->clear();
754 892
755 // now if we deleted anything, refresh 893 // now if we deleted anything, refresh
756 setContactSelected( QString::null ); 894 setContactSelected( QString::null );
757 setModified( true ); 895 setModified( true );
758 } 896 }
759} 897}
760 898
761void KABCore::copyContacts() 899void KABCore::copyContacts()
762{ 900{
763 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 901 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
764 902
765 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 903 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
766 904
767 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 905 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
768 906
769 QClipboard *cb = QApplication::clipboard(); 907 QClipboard *cb = QApplication::clipboard();
770 cb->setText( clipText ); 908 cb->setText( clipText );
771} 909}
772 910
773void KABCore::cutContacts() 911void KABCore::cutContacts()
774{ 912{
775 QStringList uidList = mViewManager->selectedUids(); 913 QStringList uidList = mViewManager->selectedUids();
776 914
777//US if ( uidList.size() > 0 ) { 915//US if ( uidList.size() > 0 ) {
778 if ( uidList.count() > 0 ) { 916 if ( uidList.count() > 0 ) {
779 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 917 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
780 UndoStack::instance()->push( command ); 918 UndoStack::instance()->push( command );
781 RedoStack::instance()->clear(); 919 RedoStack::instance()->clear();
782 920
783 setModified( true ); 921 setModified( true );
784 } 922 }
785} 923}
786 924
787void KABCore::pasteContacts() 925void KABCore::pasteContacts()
788{ 926{
789 QClipboard *cb = QApplication::clipboard(); 927 QClipboard *cb = QApplication::clipboard();
790 928
791 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 929 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
792 930
793 pasteContacts( list ); 931 pasteContacts( list );
794} 932}
795 933
796void KABCore::pasteContacts( KABC::Addressee::List &list ) 934void KABCore::pasteContacts( KABC::Addressee::List &list )
797{ 935{
798 KABC::Resource *resource = requestResource( this ); 936 KABC::Resource *resource = requestResource( this );
799 KABC::Addressee::List::Iterator it; 937 KABC::Addressee::List::Iterator it;
800 for ( it = list.begin(); it != list.end(); ++it ) 938 for ( it = list.begin(); it != list.end(); ++it )
801 (*it).setResource( resource ); 939 (*it).setResource( resource );
802 940
803 PwPasteCommand *command = new PwPasteCommand( this, list ); 941 PwPasteCommand *command = new PwPasteCommand( this, list );
@@ -1415,684 +1553,689 @@ void KABCore::initGUI()
1415{ 1553{
1416#ifndef KAB_EMBEDDED 1554#ifndef KAB_EMBEDDED
1417 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1555 QHBoxLayout *topLayout = new QHBoxLayout( this );
1418 topLayout->setSpacing( KDialogBase::spacingHint() ); 1556 topLayout->setSpacing( KDialogBase::spacingHint() );
1419 1557
1420 mExtensionBarSplitter = new QSplitter( this ); 1558 mExtensionBarSplitter = new QSplitter( this );
1421 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1559 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1422 1560
1423 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1561 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1424 1562
1425 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1563 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1426 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1564 mIncSearchWidget = new IncSearchWidget( viewSpace );
1427 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1565 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1428 SLOT( incrementalSearch( const QString& ) ) ); 1566 SLOT( incrementalSearch( const QString& ) ) );
1429 1567
1430 mViewManager = new ViewManager( this, viewSpace ); 1568 mViewManager = new ViewManager( this, viewSpace );
1431 viewSpace->setStretchFactor( mViewManager, 1 ); 1569 viewSpace->setStretchFactor( mViewManager, 1 );
1432 1570
1433 mDetails = new ViewContainer( mDetailsSplitter ); 1571 mDetails = new ViewContainer( mDetailsSplitter );
1434 1572
1435 mJumpButtonBar = new JumpButtonBar( this, this ); 1573 mJumpButtonBar = new JumpButtonBar( this, this );
1436 1574
1437 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1575 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1438 1576
1439 topLayout->addWidget( mExtensionBarSplitter ); 1577 topLayout->addWidget( mExtensionBarSplitter );
1440 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1578 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1441 topLayout->addWidget( mJumpButtonBar ); 1579 topLayout->addWidget( mJumpButtonBar );
1442 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1580 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1443 1581
1444 mXXPortManager = new XXPortManager( this, this ); 1582 mXXPortManager = new XXPortManager( this, this );
1445 1583
1446#else //KAB_EMBEDDED 1584#else //KAB_EMBEDDED
1447 //US initialize viewMenu before settingup viewmanager. 1585 //US initialize viewMenu before settingup viewmanager.
1448 // Viewmanager needs this menu to plugin submenues. 1586 // Viewmanager needs this menu to plugin submenues.
1449 viewMenu = new QPopupMenu( this ); 1587 viewMenu = new QPopupMenu( this );
1450 settingsMenu = new QPopupMenu( this ); 1588 settingsMenu = new QPopupMenu( this );
1451 //filterMenu = new QPopupMenu( this ); 1589 //filterMenu = new QPopupMenu( this );
1452 ImportMenu = new QPopupMenu( this ); 1590 ImportMenu = new QPopupMenu( this );
1453 ExportMenu = new QPopupMenu( this ); 1591 ExportMenu = new QPopupMenu( this );
1454 syncMenu = new QPopupMenu( this ); 1592 syncMenu = new QPopupMenu( this );
1455 changeMenu= new QPopupMenu( this ); 1593 changeMenu= new QPopupMenu( this );
1456 1594
1457//US since we have no splitter for the embedded system, setup 1595//US since we have no splitter for the embedded system, setup
1458// a layout with two frames. One left and one right. 1596// a layout with two frames. One left and one right.
1459 1597
1460 QBoxLayout *topLayout; 1598 QBoxLayout *topLayout;
1461 1599
1462 // = new QHBoxLayout( this ); 1600 // = new QHBoxLayout( this );
1463// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1601// QBoxLayout *topLayout = (QBoxLayout*)layout();
1464 1602
1465// QWidget *mainBox = new QWidget( this ); 1603// QWidget *mainBox = new QWidget( this );
1466// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1604// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1467 1605
1468#ifdef DESKTOP_VERSION 1606#ifdef DESKTOP_VERSION
1469 topLayout = new QHBoxLayout( this ); 1607 topLayout = new QHBoxLayout( this );
1470 1608
1471 1609
1472 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1610 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1473 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1611 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1474 1612
1475 topLayout->addWidget(mMiniSplitter ); 1613 topLayout->addWidget(mMiniSplitter );
1476 1614
1477 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1615 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1478 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1616 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1479 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1617 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1480 mDetails = new ViewContainer( mMiniSplitter ); 1618 mDetails = new ViewContainer( mMiniSplitter );
1481 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1619 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1482#else 1620#else
1483 if ( QApplication::desktop()->width() > 480 ) { 1621 if ( QApplication::desktop()->width() > 480 ) {
1484 topLayout = new QHBoxLayout( this ); 1622 topLayout = new QHBoxLayout( this );
1485 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1623 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1486 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1624 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1487 } else { 1625 } else {
1488 1626
1489 topLayout = new QHBoxLayout( this ); 1627 topLayout = new QHBoxLayout( this );
1490 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1628 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1491 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1629 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1492 } 1630 }
1493 1631
1494 topLayout->addWidget(mMiniSplitter ); 1632 topLayout->addWidget(mMiniSplitter );
1495 mViewManager = new ViewManager( this, mMiniSplitter ); 1633 mViewManager = new ViewManager( this, mMiniSplitter );
1496 mDetails = new ViewContainer( mMiniSplitter ); 1634 mDetails = new ViewContainer( mMiniSplitter );
1497 1635
1498 1636
1499 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1637 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1500#endif 1638#endif
1501 //eh->hide(); 1639 //eh->hide();
1502 // topLayout->addWidget(mExtensionManager ); 1640 // topLayout->addWidget(mExtensionManager );
1503 1641
1504 1642
1505/*US 1643/*US
1506#ifndef KAB_NOSPLITTER 1644#ifndef KAB_NOSPLITTER
1507 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1645 QHBoxLayout *topLayout = new QHBoxLayout( this );
1508//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1646//US topLayout->setSpacing( KDialogBase::spacingHint() );
1509 topLayout->setSpacing( 10 ); 1647 topLayout->setSpacing( 10 );
1510 1648
1511 mDetailsSplitter = new QSplitter( this ); 1649 mDetailsSplitter = new QSplitter( this );
1512 1650
1513 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1651 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1514 1652
1515 mViewManager = new ViewManager( this, viewSpace ); 1653 mViewManager = new ViewManager( this, viewSpace );
1516 viewSpace->setStretchFactor( mViewManager, 1 ); 1654 viewSpace->setStretchFactor( mViewManager, 1 );
1517 1655
1518 mDetails = new ViewContainer( mDetailsSplitter ); 1656 mDetails = new ViewContainer( mDetailsSplitter );
1519 1657
1520 topLayout->addWidget( mDetailsSplitter ); 1658 topLayout->addWidget( mDetailsSplitter );
1521 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1659 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1522#else //KAB_NOSPLITTER 1660#else //KAB_NOSPLITTER
1523 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1661 QHBoxLayout *topLayout = new QHBoxLayout( this );
1524//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1662//US topLayout->setSpacing( KDialogBase::spacingHint() );
1525 topLayout->setSpacing( 10 ); 1663 topLayout->setSpacing( 10 );
1526 1664
1527// mDetailsSplitter = new QSplitter( this ); 1665// mDetailsSplitter = new QSplitter( this );
1528 1666
1529 QVBox *viewSpace = new QVBox( this ); 1667 QVBox *viewSpace = new QVBox( this );
1530 1668
1531 mViewManager = new ViewManager( this, viewSpace ); 1669 mViewManager = new ViewManager( this, viewSpace );
1532 viewSpace->setStretchFactor( mViewManager, 1 ); 1670 viewSpace->setStretchFactor( mViewManager, 1 );
1533 1671
1534 mDetails = new ViewContainer( this ); 1672 mDetails = new ViewContainer( this );
1535 1673
1536 topLayout->addWidget( viewSpace ); 1674 topLayout->addWidget( viewSpace );
1537// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1675// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1538 topLayout->addWidget( mDetails ); 1676 topLayout->addWidget( mDetails );
1539#endif //KAB_NOSPLITTER 1677#endif //KAB_NOSPLITTER
1540*/ 1678*/
1541 1679
1542 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1680 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1543 syncManager->setBlockSave(false); 1681 syncManager->setBlockSave(false);
1544 1682
1545 1683
1546#endif //KAB_EMBEDDED 1684#endif //KAB_EMBEDDED
1547 initActions(); 1685 initActions();
1548 1686
1549#ifdef KAB_EMBEDDED 1687#ifdef KAB_EMBEDDED
1550 addActionsManually(); 1688 addActionsManually();
1551 //US make sure the export and import menues are initialized before creating the xxPortManager. 1689 //US make sure the export and import menues are initialized before creating the xxPortManager.
1552 mXXPortManager = new XXPortManager( this, this ); 1690 mXXPortManager = new XXPortManager( this, this );
1553 1691
1554 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1692 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1555 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1693 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1556 // mActionQuit->plug ( mMainWindow->toolBar()); 1694 // mActionQuit->plug ( mMainWindow->toolBar());
1557 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1695 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1558 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1696 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1559 // mIncSearchWidget->hide(); 1697 // mIncSearchWidget->hide();
1560 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1698 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1561 SLOT( incrementalSearch( const QString& ) ) ); 1699 SLOT( incrementalSearch( const QString& ) ) );
1562 1700
1563 1701
1564 mJumpButtonBar = new JumpButtonBar( this, this ); 1702 mJumpButtonBar = new JumpButtonBar( this, this );
1565 1703
1566 topLayout->addWidget( mJumpButtonBar ); 1704 topLayout->addWidget( mJumpButtonBar );
1567//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1705//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1568 1706
1569// mMainWindow->getIconToolBar()->raise(); 1707// mMainWindow->getIconToolBar()->raise();
1570 1708
1571#endif //KAB_EMBEDDED 1709#endif //KAB_EMBEDDED
1572 1710
1573} 1711}
1574void KABCore::initActions() 1712void KABCore::initActions()
1575{ 1713{
1576//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1714//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1577 1715
1578#ifndef KAB_EMBEDDED 1716#ifndef KAB_EMBEDDED
1579 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1717 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1580 SLOT( clipboardDataChanged() ) ); 1718 SLOT( clipboardDataChanged() ) );
1581#endif //KAB_EMBEDDED 1719#endif //KAB_EMBEDDED
1582 1720
1583 // file menu 1721 // file menu
1584 if ( mIsPart ) { 1722 if ( mIsPart ) {
1585 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1723 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1586 SLOT( sendMail() ), actionCollection(), 1724 SLOT( sendMail() ), actionCollection(),
1587 "kaddressbook_mail" ); 1725 "kaddressbook_mail" );
1588 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1726 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1589 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1727 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1590 1728
1591 } else { 1729 } else {
1592 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1730 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1593 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1731 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1594 } 1732 }
1595 1733
1596 1734
1597 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1735 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1598 SLOT( save() ), actionCollection(), "file_sync" ); 1736 SLOT( save() ), actionCollection(), "file_sync" );
1599 1737
1600 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1738 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1601 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1739 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1602 1740
1603 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1741 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1604 this, SLOT( mailVCard() ), 1742 this, SLOT( mailVCard() ),
1605 actionCollection(), "file_mail_vcard"); 1743 actionCollection(), "file_mail_vcard");
1606 1744
1745 mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this,
1746 SLOT( export2phone() ), actionCollection(),
1747 "kaddressbook_ex2phone" );
1748
1607 mActionBeamVCard = 0; 1749 mActionBeamVCard = 0;
1608 mActionBeam = 0; 1750 mActionBeam = 0;
1609 1751
1610#ifndef DESKTOP_VERSION 1752#ifndef DESKTOP_VERSION
1611 if ( Ir::supported() ) { 1753 if ( Ir::supported() ) {
1612 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1754 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1613 SLOT( beamVCard() ), actionCollection(), 1755 SLOT( beamVCard() ), actionCollection(),
1614 "kaddressbook_beam_vcard" ); 1756 "kaddressbook_beam_vcard" );
1615 1757
1616 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1758 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1617 SLOT( beamMySelf() ), actionCollection(), 1759 SLOT( beamMySelf() ), actionCollection(),
1618 "kaddressbook_beam_myself" ); 1760 "kaddressbook_beam_myself" );
1619 } 1761 }
1620#endif 1762#endif
1621 1763
1622 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1764 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1623 this, SLOT( editContact2() ), 1765 this, SLOT( editContact2() ),
1624 actionCollection(), "file_properties" ); 1766 actionCollection(), "file_properties" );
1625 1767
1626#ifdef KAB_EMBEDDED 1768#ifdef KAB_EMBEDDED
1627 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1769 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1628 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1770 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1629 mMainWindow, SLOT( exit() ), 1771 mMainWindow, SLOT( exit() ),
1630 actionCollection(), "quit" ); 1772 actionCollection(), "quit" );
1631#endif //KAB_EMBEDDED 1773#endif //KAB_EMBEDDED
1632 1774
1633 // edit menu 1775 // edit menu
1634 if ( mIsPart ) { 1776 if ( mIsPart ) {
1635 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1777 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1636 SLOT( copyContacts() ), actionCollection(), 1778 SLOT( copyContacts() ), actionCollection(),
1637 "kaddressbook_copy" ); 1779 "kaddressbook_copy" );
1638 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1780 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1639 SLOT( cutContacts() ), actionCollection(), 1781 SLOT( cutContacts() ), actionCollection(),
1640 "kaddressbook_cut" ); 1782 "kaddressbook_cut" );
1641 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1783 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1642 SLOT( pasteContacts() ), actionCollection(), 1784 SLOT( pasteContacts() ), actionCollection(),
1643 "kaddressbook_paste" ); 1785 "kaddressbook_paste" );
1644 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1786 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1645 SLOT( selectAllContacts() ), actionCollection(), 1787 SLOT( selectAllContacts() ), actionCollection(),
1646 "kaddressbook_select_all" ); 1788 "kaddressbook_select_all" );
1647 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1789 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1648 SLOT( undo() ), actionCollection(), 1790 SLOT( undo() ), actionCollection(),
1649 "kaddressbook_undo" ); 1791 "kaddressbook_undo" );
1650 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1792 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1651 this, SLOT( redo() ), actionCollection(), 1793 this, SLOT( redo() ), actionCollection(),
1652 "kaddressbook_redo" ); 1794 "kaddressbook_redo" );
1653 } else { 1795 } else {
1654 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1796 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1655 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1797 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1656 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1798 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1657 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1799 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1658 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1800 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1659 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1801 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1660 } 1802 }
1661 1803
1662 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1804 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1663 Key_Delete, this, SLOT( deleteContacts() ), 1805 Key_Delete, this, SLOT( deleteContacts() ),
1664 actionCollection(), "edit_delete" ); 1806 actionCollection(), "edit_delete" );
1665 1807
1666 mActionUndo->setEnabled( false ); 1808 mActionUndo->setEnabled( false );
1667 mActionRedo->setEnabled( false ); 1809 mActionRedo->setEnabled( false );
1668 1810
1669 // settings menu 1811 // settings menu
1670#ifdef KAB_EMBEDDED 1812#ifdef KAB_EMBEDDED
1671//US special menuentry to configure the addressbook resources. On KDE 1813//US special menuentry to configure the addressbook resources. On KDE
1672// you do that through the control center !!! 1814// you do that through the control center !!!
1673 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1815 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1674 SLOT( configureResources() ), actionCollection(), 1816 SLOT( configureResources() ), actionCollection(),
1675 "kaddressbook_configure_resources" ); 1817 "kaddressbook_configure_resources" );
1676#endif //KAB_EMBEDDED 1818#endif //KAB_EMBEDDED
1677 1819
1678 if ( mIsPart ) { 1820 if ( mIsPart ) {
1679 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1821 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1680 SLOT( openConfigDialog() ), actionCollection(), 1822 SLOT( openConfigDialog() ), actionCollection(),
1681 "kaddressbook_configure" ); 1823 "kaddressbook_configure" );
1682 1824
1683 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1825 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1684 this, SLOT( configureKeyBindings() ), actionCollection(), 1826 this, SLOT( configureKeyBindings() ), actionCollection(),
1685 "kaddressbook_configure_shortcuts" ); 1827 "kaddressbook_configure_shortcuts" );
1686#ifdef KAB_EMBEDDED 1828#ifdef KAB_EMBEDDED
1687 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1829 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1688 mActionConfigureToolbars->setEnabled( false ); 1830 mActionConfigureToolbars->setEnabled( false );
1689#endif //KAB_EMBEDDED 1831#endif //KAB_EMBEDDED
1690 1832
1691 } else { 1833 } else {
1692 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1834 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1693 1835
1694 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1836 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1695 } 1837 }
1696 1838
1697 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1839 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1698 actionCollection(), "options_show_jump_bar" ); 1840 actionCollection(), "options_show_jump_bar" );
1699 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1841 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1700 1842
1701 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 1843 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1702 actionCollection(), "options_show_details" ); 1844 actionCollection(), "options_show_details" );
1703 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1845 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1704 1846
1705 // misc 1847 // misc
1706 // only enable LDAP lookup if we can handle the protocol 1848 // only enable LDAP lookup if we can handle the protocol
1707#ifndef KAB_EMBEDDED 1849#ifndef KAB_EMBEDDED
1708 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1850 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1709 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1851 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1710 this, SLOT( openLDAPDialog() ), actionCollection(), 1852 this, SLOT( openLDAPDialog() ), actionCollection(),
1711 "ldap_lookup" ); 1853 "ldap_lookup" );
1712 } 1854 }
1713#else //KAB_EMBEDDED 1855#else //KAB_EMBEDDED
1714 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1856 //qDebug("KABCore::initActions() LDAP has to be implemented");
1715#endif //KAB_EMBEDDED 1857#endif //KAB_EMBEDDED
1716 1858
1717 1859
1718 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1860 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1719 SLOT( setWhoAmI() ), actionCollection(), 1861 SLOT( setWhoAmI() ), actionCollection(),
1720 "set_personal" ); 1862 "set_personal" );
1721 1863
1722 1864
1723 1865
1724 1866
1725 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1867 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1726 SLOT( setCategories() ), actionCollection(), 1868 SLOT( setCategories() ), actionCollection(),
1727 "edit_set_categories" ); 1869 "edit_set_categories" );
1728 1870
1729 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1871 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1730 SLOT( removeVoice() ), actionCollection(), 1872 SLOT( removeVoice() ), actionCollection(),
1731 "remove_voice" ); 1873 "remove_voice" );
1732 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 1874 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
1733 SLOT( importFromOL() ), actionCollection(), 1875 SLOT( importFromOL() ), actionCollection(),
1734 "import_OL" ); 1876 "import_OL" );
1735#ifdef KAB_EMBEDDED 1877#ifdef KAB_EMBEDDED
1736 mActionLicence = new KAction( i18n( "Licence" ), 0, 1878 mActionLicence = new KAction( i18n( "Licence" ), 0,
1737 this, SLOT( showLicence() ), actionCollection(), 1879 this, SLOT( showLicence() ), actionCollection(),
1738 "licence_about_data" ); 1880 "licence_about_data" );
1739 mActionFaq = new KAction( i18n( "Faq" ), 0, 1881 mActionFaq = new KAction( i18n( "Faq" ), 0,
1740 this, SLOT( faq() ), actionCollection(), 1882 this, SLOT( faq() ), actionCollection(),
1741 "faq_about_data" ); 1883 "faq_about_data" );
1742 1884
1743 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1885 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1744 this, SLOT( createAboutData() ), actionCollection(), 1886 this, SLOT( createAboutData() ), actionCollection(),
1745 "kaddressbook_about_data" ); 1887 "kaddressbook_about_data" );
1746#endif //KAB_EMBEDDED 1888#endif //KAB_EMBEDDED
1747 1889
1748 clipboardDataChanged(); 1890 clipboardDataChanged();
1749 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1891 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1750 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1892 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1751} 1893}
1752 1894
1753//US we need this function, to plug all actions into the correct menues. 1895//US we need this function, to plug all actions into the correct menues.
1754// KDE uses a XML format to plug the actions, but we work her without this overhead. 1896// KDE uses a XML format to plug the actions, but we work her without this overhead.
1755void KABCore::addActionsManually() 1897void KABCore::addActionsManually()
1756{ 1898{
1757//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1899//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1758 1900
1759#ifdef KAB_EMBEDDED 1901#ifdef KAB_EMBEDDED
1760 QPopupMenu *fileMenu = new QPopupMenu( this ); 1902 QPopupMenu *fileMenu = new QPopupMenu( this );
1761 QPopupMenu *editMenu = new QPopupMenu( this ); 1903 QPopupMenu *editMenu = new QPopupMenu( this );
1762 QPopupMenu *helpMenu = new QPopupMenu( this ); 1904 QPopupMenu *helpMenu = new QPopupMenu( this );
1763 1905
1764 KToolBar* tb = mMainWindow->toolBar(); 1906 KToolBar* tb = mMainWindow->toolBar();
1765 1907
1766#ifdef DESKTOP_VERSION 1908#ifdef DESKTOP_VERSION
1767 QMenuBar* mb = mMainWindow->menuBar(); 1909 QMenuBar* mb = mMainWindow->menuBar();
1768 1910
1769 //US setup menubar. 1911 //US setup menubar.
1770 //Disable the following block if you do not want to have a menubar. 1912 //Disable the following block if you do not want to have a menubar.
1771 mb->insertItem( "&File", fileMenu ); 1913 mb->insertItem( "&File", fileMenu );
1772 mb->insertItem( "&Edit", editMenu ); 1914 mb->insertItem( "&Edit", editMenu );
1773 mb->insertItem( "&View", viewMenu ); 1915 mb->insertItem( "&View", viewMenu );
1774 mb->insertItem( "&Settings", settingsMenu ); 1916 mb->insertItem( "&Settings", settingsMenu );
1775 mb->insertItem( i18n("Synchronize"), syncMenu ); 1917 mb->insertItem( i18n("Synchronize"), syncMenu );
1776 mb->insertItem( "&Change selected", changeMenu ); 1918 mb->insertItem( "&Change selected", changeMenu );
1777 mb->insertItem( "&Help", helpMenu ); 1919 mb->insertItem( "&Help", helpMenu );
1778 mIncSearchWidget = new IncSearchWidget( tb ); 1920 mIncSearchWidget = new IncSearchWidget( tb );
1779 // tb->insertWidget(-1, 0, mIncSearchWidget); 1921 // tb->insertWidget(-1, 0, mIncSearchWidget);
1780 1922
1781#else 1923#else
1782 //US setup toolbar 1924 //US setup toolbar
1783 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 1925 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
1784 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1926 QPopupMenu *popupBarTB = new QPopupMenu( this );
1785 menuBarTB->insertItem( "ME", popupBarTB); 1927 menuBarTB->insertItem( "ME", popupBarTB);
1786 tb->insertWidget(-1, 0, menuBarTB); 1928 tb->insertWidget(-1, 0, menuBarTB);
1787 mIncSearchWidget = new IncSearchWidget( tb ); 1929 mIncSearchWidget = new IncSearchWidget( tb );
1788 1930
1789 tb->enableMoving(false); 1931 tb->enableMoving(false);
1790 popupBarTB->insertItem( "&File", fileMenu ); 1932 popupBarTB->insertItem( "&File", fileMenu );
1791 popupBarTB->insertItem( "&Edit", editMenu ); 1933 popupBarTB->insertItem( "&Edit", editMenu );
1792 popupBarTB->insertItem( "&View", viewMenu ); 1934 popupBarTB->insertItem( "&View", viewMenu );
1793 popupBarTB->insertItem( "&Settings", settingsMenu ); 1935 popupBarTB->insertItem( "&Settings", settingsMenu );
1794 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 1936 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
1795 mViewManager->getFilterAction()->plug ( popupBarTB); 1937 mViewManager->getFilterAction()->plug ( popupBarTB);
1796 popupBarTB->insertItem( "&Change selected", changeMenu ); 1938 popupBarTB->insertItem( "&Change selected", changeMenu );
1797 popupBarTB->insertItem( "&Help", helpMenu ); 1939 popupBarTB->insertItem( "&Help", helpMenu );
1798 if (QApplication::desktop()->width() > 320 ) { 1940 if (QApplication::desktop()->width() > 320 ) {
1799 // mViewManager->getFilterAction()->plug ( tb); 1941 // mViewManager->getFilterAction()->plug ( tb);
1800 } 1942 }
1801#endif 1943#endif
1802 // mActionQuit->plug ( mMainWindow->toolBar()); 1944 // mActionQuit->plug ( mMainWindow->toolBar());
1803 1945
1804 1946
1805 1947
1806 //US Now connect the actions with the menue entries. 1948 //US Now connect the actions with the menue entries.
1807 mActionPrint->plug( fileMenu ); 1949 mActionPrint->plug( fileMenu );
1808 mActionMail->plug( fileMenu ); 1950 mActionMail->plug( fileMenu );
1809 fileMenu->insertSeparator(); 1951 fileMenu->insertSeparator();
1810 1952
1811 mActionNewContact->plug( fileMenu ); 1953 mActionNewContact->plug( fileMenu );
1812 mActionNewContact->plug( tb ); 1954 mActionNewContact->plug( tb );
1813 1955
1814 mActionEditAddressee->plug( fileMenu ); 1956 mActionEditAddressee->plug( fileMenu );
1815 if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 1957 if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
1816 (!KABPrefs::instance()->mMultipleViewsAtOnce )) 1958 (!KABPrefs::instance()->mMultipleViewsAtOnce ))
1817 mActionEditAddressee->plug( tb ); 1959 mActionEditAddressee->plug( tb );
1818 1960
1819 fileMenu->insertSeparator(); 1961 fileMenu->insertSeparator();
1820 mActionSave->plug( fileMenu ); 1962 mActionSave->plug( fileMenu );
1821 fileMenu->insertItem( "&Import", ImportMenu ); 1963 fileMenu->insertItem( "&Import", ImportMenu );
1822 fileMenu->insertItem( "&Export", ExportMenu ); 1964 fileMenu->insertItem( "&Export", ExportMenu );
1823 fileMenu->insertSeparator(); 1965 fileMenu->insertSeparator();
1824 mActionMailVCard->plug( fileMenu ); 1966 mActionMailVCard->plug( fileMenu );
1825#ifndef DESKTOP_VERSION 1967#ifndef DESKTOP_VERSION
1826 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 1968 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1827 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 1969 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1828#endif 1970#endif
1829 fileMenu->insertSeparator(); 1971 fileMenu->insertSeparator();
1830 mActionQuit->plug( fileMenu ); 1972 mActionQuit->plug( fileMenu );
1831#ifdef _WIN32_ 1973#ifdef _WIN32_
1832 mActionImportOL->plug( ImportMenu ); 1974 mActionImportOL->plug( ImportMenu );
1833#endif 1975#endif
1834 // edit menu 1976 // edit menu
1835 mActionUndo->plug( editMenu ); 1977 mActionUndo->plug( editMenu );
1836 mActionRedo->plug( editMenu ); 1978 mActionRedo->plug( editMenu );
1837 editMenu->insertSeparator(); 1979 editMenu->insertSeparator();
1838 mActionCut->plug( editMenu ); 1980 mActionCut->plug( editMenu );
1839 mActionCopy->plug( editMenu ); 1981 mActionCopy->plug( editMenu );
1840 mActionPaste->plug( editMenu ); 1982 mActionPaste->plug( editMenu );
1841 mActionDelete->plug( editMenu ); 1983 mActionDelete->plug( editMenu );
1842 editMenu->insertSeparator(); 1984 editMenu->insertSeparator();
1843 mActionSelectAll->plug( editMenu ); 1985 mActionSelectAll->plug( editMenu );
1844 1986
1845 mActionRemoveVoice->plug( changeMenu ); 1987 mActionRemoveVoice->plug( changeMenu );
1846 // settings menu 1988 // settings menu
1847//US special menuentry to configure the addressbook resources. On KDE 1989//US special menuentry to configure the addressbook resources. On KDE
1848// you do that through the control center !!! 1990// you do that through the control center !!!
1849 mActionConfigResources->plug( settingsMenu ); 1991 mActionConfigResources->plug( settingsMenu );
1850 settingsMenu->insertSeparator(); 1992 settingsMenu->insertSeparator();
1851 1993
1852 mActionConfigKAddressbook->plug( settingsMenu ); 1994 mActionConfigKAddressbook->plug( settingsMenu );
1853 1995
1854 if ( mIsPart ) { 1996 if ( mIsPart ) {
1855 mActionConfigShortcuts->plug( settingsMenu ); 1997 mActionConfigShortcuts->plug( settingsMenu );
1856 mActionConfigureToolbars->plug( settingsMenu ); 1998 mActionConfigureToolbars->plug( settingsMenu );
1857 1999
1858 } else { 2000 } else {
1859 mActionKeyBindings->plug( settingsMenu ); 2001 mActionKeyBindings->plug( settingsMenu );
1860 } 2002 }
1861 2003
1862 settingsMenu->insertSeparator(); 2004 settingsMenu->insertSeparator();
1863 2005
1864 mActionJumpBar->plug( settingsMenu ); 2006 mActionJumpBar->plug( settingsMenu );
1865 mActionDetails->plug( settingsMenu ); 2007 mActionDetails->plug( settingsMenu );
1866 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2008 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
1867 mActionDetails->plug( tb ); 2009 mActionDetails->plug( tb );
1868 settingsMenu->insertSeparator(); 2010 settingsMenu->insertSeparator();
1869 2011
1870 mActionWhoAmI->plug( settingsMenu ); 2012 mActionWhoAmI->plug( settingsMenu );
1871 mActionCategories->plug( settingsMenu ); 2013 mActionCategories->plug( settingsMenu );
1872 2014
1873 mActionLicence->plug( helpMenu ); 2015 mActionLicence->plug( helpMenu );
1874 mActionFaq->plug( helpMenu ); 2016 mActionFaq->plug( helpMenu );
1875 mActionAboutKAddressbook->plug( helpMenu ); 2017 mActionAboutKAddressbook->plug( helpMenu );
1876 2018
1877 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2019 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1878 2020
1879 mActionSave->plug( tb ); 2021 mActionSave->plug( tb );
1880 mViewManager->getFilterAction()->plug ( tb); 2022 mViewManager->getFilterAction()->plug ( tb);
1881 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 2023 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
1882 mActionUndo->plug( tb ); 2024 mActionUndo->plug( tb );
1883 mActionDelete->plug( tb ); 2025 mActionDelete->plug( tb );
1884 mActionRedo->plug( tb ); 2026 mActionRedo->plug( tb );
1885 } 2027 }
1886 } 2028 }
1887 //mActionQuit->plug ( tb ); 2029 //mActionQuit->plug ( tb );
1888 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2030 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1889 2031
1890 //US link the searchwidget first to this. 2032 //US link the searchwidget first to this.
1891 // The real linkage to the toolbar happens later. 2033 // The real linkage to the toolbar happens later.
1892//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2034//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1893//US tb->insertItem( mIncSearchWidget ); 2035//US tb->insertItem( mIncSearchWidget );
1894/*US 2036/*US
1895 mIncSearchWidget = new IncSearchWidget( tb ); 2037 mIncSearchWidget = new IncSearchWidget( tb );
1896 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2038 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1897 SLOT( incrementalSearch( const QString& ) ) ); 2039 SLOT( incrementalSearch( const QString& ) ) );
1898 2040
1899 mJumpButtonBar = new JumpButtonBar( this, this ); 2041 mJumpButtonBar = new JumpButtonBar( this, this );
1900 2042
1901//US topLayout->addWidget( mJumpButtonBar ); 2043//US topLayout->addWidget( mJumpButtonBar );
1902 this->layout()->add( mJumpButtonBar ); 2044 this->layout()->add( mJumpButtonBar );
1903*/ 2045*/
1904 2046
1905#endif //KAB_EMBEDDED 2047#endif //KAB_EMBEDDED
1906 2048
2049 mActionExport2phone->plug( ExportMenu );
1907 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2050 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
1908 syncManager->fillSyncMenu(); 2051 syncManager->fillSyncMenu();
1909 2052
1910} 2053}
1911void KABCore::showLicence() 2054void KABCore::showLicence()
1912{ 2055{
1913 KApplication::showLicence(); 2056 KApplication::showLicence();
1914} 2057}
1915void KABCore::removeVoice() 2058void KABCore::removeVoice()
1916{ 2059{
1917 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 ) 2060 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 )
1918 return; 2061 return;
1919 KABC::Addressee::List list = mViewManager->selectedAddressees(); 2062 KABC::Addressee::List list = mViewManager->selectedAddressees();
1920 KABC::Addressee::List::Iterator it; 2063 KABC::Addressee::List::Iterator it;
1921 for ( it = list.begin(); it != list.end(); ++it ) { 2064 for ( it = list.begin(); it != list.end(); ++it ) {
1922 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 2065 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
1923 PhoneNumber::List::Iterator phoneIt; 2066 PhoneNumber::List::Iterator phoneIt;
1924 bool found = false; 2067 bool found = false;
1925 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { 2068 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
1926 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 2069 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
1927 if ((*phoneIt).type() - PhoneNumber::Voice ) { 2070 if ((*phoneIt).type() - PhoneNumber::Voice ) {
1928 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 2071 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
1929 (*it).insertPhoneNumber( (*phoneIt) ); 2072 (*it).insertPhoneNumber( (*phoneIt) );
1930 found = true; 2073 found = true;
1931 } 2074 }
1932 } 2075 }
1933 2076
1934 } 2077 }
1935 if ( found ) 2078 if ( found )
1936 contactModified((*it) ); 2079 contactModified((*it) );
1937 } 2080 }
1938} 2081}
1939 2082
1940 2083
1941 2084
1942void KABCore::clipboardDataChanged() 2085void KABCore::clipboardDataChanged()
1943{ 2086{
1944 2087
1945 if ( mReadWrite ) 2088 if ( mReadWrite )
1946 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2089 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
1947 2090
1948} 2091}
1949 2092
1950void KABCore::updateActionMenu() 2093void KABCore::updateActionMenu()
1951{ 2094{
1952 UndoStack *undo = UndoStack::instance(); 2095 UndoStack *undo = UndoStack::instance();
1953 RedoStack *redo = RedoStack::instance(); 2096 RedoStack *redo = RedoStack::instance();
1954 2097
1955 if ( undo->isEmpty() ) 2098 if ( undo->isEmpty() )
1956 mActionUndo->setText( i18n( "Undo" ) ); 2099 mActionUndo->setText( i18n( "Undo" ) );
1957 else 2100 else
1958 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2101 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
1959 2102
1960 mActionUndo->setEnabled( !undo->isEmpty() ); 2103 mActionUndo->setEnabled( !undo->isEmpty() );
1961 2104
1962 if ( !redo->top() ) 2105 if ( !redo->top() )
1963 mActionRedo->setText( i18n( "Redo" ) ); 2106 mActionRedo->setText( i18n( "Redo" ) );
1964 else 2107 else
1965 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2108 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
1966 2109
1967 mActionRedo->setEnabled( !redo->isEmpty() ); 2110 mActionRedo->setEnabled( !redo->isEmpty() );
1968} 2111}
1969 2112
1970void KABCore::configureKeyBindings() 2113void KABCore::configureKeyBindings()
1971{ 2114{
1972#ifndef KAB_EMBEDDED 2115#ifndef KAB_EMBEDDED
1973 KKeyDialog::configure( actionCollection(), true ); 2116 KKeyDialog::configure( actionCollection(), true );
1974#else //KAB_EMBEDDED 2117#else //KAB_EMBEDDED
1975 qDebug("KABCore::configureKeyBindings() not implemented"); 2118 qDebug("KABCore::configureKeyBindings() not implemented");
1976#endif //KAB_EMBEDDED 2119#endif //KAB_EMBEDDED
1977} 2120}
1978 2121
1979#ifdef KAB_EMBEDDED 2122#ifdef KAB_EMBEDDED
1980void KABCore::configureResources() 2123void KABCore::configureResources()
1981{ 2124{
1982 KRES::KCMKResources dlg( this, "" , 0 ); 2125 KRES::KCMKResources dlg( this, "" , 0 );
1983 2126
1984 if ( !dlg.exec() ) 2127 if ( !dlg.exec() )
1985 return; 2128 return;
1986 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2129 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
1987} 2130}
1988#endif //KAB_EMBEDDED 2131#endif //KAB_EMBEDDED
1989 2132
1990 2133
1991/* this method will be called through the QCop interface from Ko/Pi to select addresses 2134/* this method will be called through the QCop interface from Ko/Pi to select addresses
1992 * for the attendees list of an event. 2135 * for the attendees list of an event.
1993 */ 2136 */
1994void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2137void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
1995{ 2138{
1996 QStringList nameList; 2139 QStringList nameList;
1997 QStringList emailList; 2140 QStringList emailList;
1998 QStringList uidList; 2141 QStringList uidList;
1999 2142
2000 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2143 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2001 uint i=0; 2144 uint i=0;
2002 for (i=0; i < list.count(); i++) 2145 for (i=0; i < list.count(); i++)
2003 { 2146 {
2004 nameList.append(list[i].realName()); 2147 nameList.append(list[i].realName());
2005 emailList.append(list[i].preferredEmail()); 2148 emailList.append(list[i].preferredEmail());
2006 uidList.append(list[i].uid()); 2149 uidList.append(list[i].uid());
2007 } 2150 }
2008 2151
2009 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2152 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2010 2153
2011} 2154}
2012 2155
2013/* this method will be called through the QCop interface from other apps to show details of a contact. 2156/* this method will be called through the QCop interface from other apps to show details of a contact.
2014 */ 2157 */
2015void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2158void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2016{ 2159{
2017 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2160 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2018 2161
2019 QString foundUid = QString::null; 2162 QString foundUid = QString::null;
2020 if ( ! uid.isEmpty() ) { 2163 if ( ! uid.isEmpty() ) {
2021 Addressee adrr = mAddressBook->findByUid( uid ); 2164 Addressee adrr = mAddressBook->findByUid( uid );
2022 if ( !adrr.isEmpty() ) { 2165 if ( !adrr.isEmpty() ) {
2023 foundUid = uid; 2166 foundUid = uid;
2024 } 2167 }
2025 if ( email == "sendbacklist" ) { 2168 if ( email == "sendbacklist" ) {
2026 //qDebug("ssssssssssssssssssssssend "); 2169 //qDebug("ssssssssssssssssssssssend ");
2027 QStringList nameList; 2170 QStringList nameList;
2028 QStringList emailList; 2171 QStringList emailList;
2029 QStringList uidList; 2172 QStringList uidList;
2030 nameList.append(adrr.realName()); 2173 nameList.append(adrr.realName());
2031 emailList = adrr.emails(); 2174 emailList = adrr.emails();
2032 uidList.append( adrr.preferredEmail()); 2175 uidList.append( adrr.preferredEmail());
2033 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2176 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2034 return; 2177 return;
2035 } 2178 }
2036 2179
2037 } 2180 }
2038 2181
2039 if ( email == "sendbacklist" ) 2182 if ( email == "sendbacklist" )
2040 return; 2183 return;
2041 if (foundUid.isEmpty()) 2184 if (foundUid.isEmpty())
2042 { 2185 {
2043 //find the uid of the person first 2186 //find the uid of the person first
2044 Addressee::List namelist; 2187 Addressee::List namelist;
2045 Addressee::List emaillist; 2188 Addressee::List emaillist;
2046 2189
2047 if (!name.isEmpty()) 2190 if (!name.isEmpty())
2048 namelist = mAddressBook->findByName( name ); 2191 namelist = mAddressBook->findByName( name );
2049 2192
2050 if (!email.isEmpty()) 2193 if (!email.isEmpty())
2051 emaillist = mAddressBook->findByEmail( email ); 2194 emaillist = mAddressBook->findByEmail( email );
2052 qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2195 qDebug("count %d %d ", namelist.count(),emaillist.count() );
2053 //check if we have a match in Namelist and Emaillist 2196 //check if we have a match in Namelist and Emaillist
2054 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2197 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2055 foundUid = emaillist[0].uid(); 2198 foundUid = emaillist[0].uid();
2056 } 2199 }
2057 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2200 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2058 foundUid = namelist[0].uid(); 2201 foundUid = namelist[0].uid();
2059 else 2202 else
2060 { 2203 {
2061 for (int i = 0; i < namelist.count(); i++) 2204 for (int i = 0; i < namelist.count(); i++)
2062 { 2205 {
2063 for (int j = 0; j < emaillist.count(); j++) 2206 for (int j = 0; j < emaillist.count(); j++)
2064 { 2207 {
2065 if (namelist[i] == emaillist[j]) 2208 if (namelist[i] == emaillist[j])
2066 { 2209 {
2067 foundUid = namelist[i].uid(); 2210 foundUid = namelist[i].uid();
2068 } 2211 }
2069 } 2212 }
2070 } 2213 }
2071 } 2214 }
2072 } 2215 }
2073 else 2216 else
2074 { 2217 {
2075 foundUid = uid; 2218 foundUid = uid;
2076 } 2219 }
2077 2220
2078 if (!foundUid.isEmpty()) 2221 if (!foundUid.isEmpty())
2079 { 2222 {
2080 2223
2081 // raise Ka/Pi if it is in the background 2224 // raise Ka/Pi if it is in the background
2082#ifndef DESKTOP_VERSION 2225#ifndef DESKTOP_VERSION
2083#ifndef KORG_NODCOP 2226#ifndef KORG_NODCOP
2084 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2227 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2085#endif 2228#endif
2086#endif 2229#endif
2087 2230
2088 mMainWindow->showMaximized(); 2231 mMainWindow->showMaximized();
2089 mMainWindow-> raise(); 2232 mMainWindow-> raise();
2090 2233
2091 mViewManager->setSelected( "", false); 2234 mViewManager->setSelected( "", false);
2092 mViewManager->refreshView( "" ); 2235 mViewManager->refreshView( "" );
2093 mViewManager->setSelected( foundUid, true ); 2236 mViewManager->setSelected( foundUid, true );
2094 mViewManager->refreshView( foundUid ); 2237 mViewManager->refreshView( foundUid );
2095 2238
2096 if ( !mMultipleViewsAtOnce ) 2239 if ( !mMultipleViewsAtOnce )
2097 { 2240 {
2098 setDetailsVisible( true ); 2241 setDetailsVisible( true );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 941458d..e6f286b 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,481 +1,483 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KABCORE_H 24#ifndef KABCORE_H
25#define KABCORE_H 25#define KABCORE_H
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32 32
33#include <qwidget.h> 33#include <qwidget.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <ksyncmanager.h> 35#include <ksyncmanager.h>
36 36
37namespace KABC { 37namespace KABC {
38class AddressBook; 38class AddressBook;
39} 39}
40 40
41#ifndef KAB_EMBEDDED 41#ifndef KAB_EMBEDDED
42class KAboutData; 42class KAboutData;
43class KConfig; 43class KConfig;
44 44
45class KAddressBookService; 45class KAddressBookService;
46class LDAPSearchDialog; 46class LDAPSearchDialog;
47#else //KAB_EMBEDDED 47#else //KAB_EMBEDDED
48class KAddressBookMain; 48class KAddressBookMain;
49//US class QAction; 49//US class QAction;
50#endif //KAB_EMBEDDED 50#endif //KAB_EMBEDDED
51class KCMultiDialog; 51class KCMultiDialog;
52class KXMLGUIClient; 52class KXMLGUIClient;
53class ExtensionManager; 53class ExtensionManager;
54class XXPortManager; 54class XXPortManager;
55class JumpButtonBar; 55class JumpButtonBar;
56class IncSearchWidget; 56class IncSearchWidget;
57class KDGanttMinimizeSplitter; 57class KDGanttMinimizeSplitter;
58class KAction; 58class KAction;
59class KActionCollection; 59class KActionCollection;
60class KToggleAction; 60class KToggleAction;
61class KSyncProfile; 61class KSyncProfile;
62 62
63class QAction; 63class QAction;
64class QMenuBar; 64class QMenuBar;
65class QSplitter; 65class QSplitter;
66class ViewContainer; 66class ViewContainer;
67class ViewManager; 67class ViewManager;
68class AddresseeEditorDialog; 68class AddresseeEditorDialog;
69class Ir; 69class Ir;
70 70
71class KABCore : public QWidget, public KSyncInterface 71class KABCore : public QWidget, public KSyncInterface
72{ 72{
73 Q_OBJECT 73 Q_OBJECT
74 74
75 public: 75 public:
76 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 76 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
77 77
78 78
79 ~KABCore(); 79 ~KABCore();
80 80
81 81
82#ifdef KAB_EMBEDDED 82#ifdef KAB_EMBEDDED
83 //US added functionality 83 //US added functionality
84 QPopupMenu* getViewMenu() {return viewMenu;} 84 QPopupMenu* getViewMenu() {return viewMenu;}
85 QPopupMenu* getFilterMenu() {return filterMenu;} 85 QPopupMenu* getFilterMenu() {return filterMenu;}
86 QPopupMenu* getSettingsMenu() {return settingsMenu;} 86 QPopupMenu* getSettingsMenu() {return settingsMenu;}
87 void addActionsManually(); 87 void addActionsManually();
88#endif //KAB_EMBEDDED 88#endif //KAB_EMBEDDED
89 /** 89 /**
90 Restores the global settings. 90 Restores the global settings.
91 */ 91 */
92 void restoreSettings(); 92 void restoreSettings();
93 93
94 /** 94 /**
95 Saves the global settings. 95 Saves the global settings.
96 */ 96 */
97 void saveSettings(); 97 void saveSettings();
98 98
99 /** 99 /**
100 Returns a pointer to the StdAddressBook of the application. 100 Returns a pointer to the StdAddressBook of the application.
101 */ 101 */
102 KABC::AddressBook *addressBook() const; 102 KABC::AddressBook *addressBook() const;
103 103
104 /** 104 /**
105 Returns a pointer to the KConfig object of the application. 105 Returns a pointer to the KConfig object of the application.
106 */ 106 */
107 static KConfig *config(); 107 static KConfig *config();
108 108
109 /** 109 /**
110 Returns a pointer to the global KActionCollection object. So 110 Returns a pointer to the global KActionCollection object. So
111 other classes can register their actions easily. 111 other classes can register their actions easily.
112 */ 112 */
113 KActionCollection *actionCollection() const; 113 KActionCollection *actionCollection() const;
114 114
115 /** 115 /**
116 Returns the current search field of the Incremental Search Widget. 116 Returns the current search field of the Incremental Search Widget.
117 */ 117 */
118 KABC::Field *currentSearchField() const; 118 KABC::Field *currentSearchField() const;
119 119
120 /** 120 /**
121 Returns the uid list of the currently selected contacts. 121 Returns the uid list of the currently selected contacts.
122 */ 122 */
123 QStringList selectedUIDs() const; 123 QStringList selectedUIDs() const;
124 124
125 /** 125 /**
126 Displays the ResourceSelectDialog and returns the selected 126 Displays the ResourceSelectDialog and returns the selected
127 resource or a null pointer if no resource was selected by 127 resource or a null pointer if no resource was selected by
128 the user. 128 the user.
129 */ 129 */
130 KABC::Resource *requestResource( QWidget *parent ); 130 KABC::Resource *requestResource( QWidget *parent );
131 131
132#ifndef KAB_EMBEDDED 132#ifndef KAB_EMBEDDED
133 static KAboutData *createAboutData(); 133 static KAboutData *createAboutData();
134#endif //KAB_EMBEDDED 134#endif //KAB_EMBEDDED
135 135
136#ifdef KAB_EMBEDDED 136#ifdef KAB_EMBEDDED
137 inline QPopupMenu* getImportMenu() { return ImportMenu;} 137 inline QPopupMenu* getImportMenu() { return ImportMenu;}
138 inline QPopupMenu* getExportMenu() { return ExportMenu;} 138 inline QPopupMenu* getExportMenu() { return ExportMenu;}
139#endif //KAB_EMBEDDED 139#endif //KAB_EMBEDDED
140 140
141 public slots: 141 public slots:
142#ifdef KAB_EMBEDDED 142#ifdef KAB_EMBEDDED
143 void createAboutData(); 143 void createAboutData();
144#endif //KAB_EMBEDDED 144#endif //KAB_EMBEDDED
145 145
146 void statusMessage(QString, int time = 0 ); 146 void statusMessage(QString, int time = 0 );
147 void showLicence(); 147 void showLicence();
148 void faq(); 148 void faq();
149 149
150 /** 150 /**
151 Is called whenever a contact is selected in the view. 151 Is called whenever a contact is selected in the view.
152 */ 152 */
153 void setContactSelected( const QString &uid ); 153 void setContactSelected( const QString &uid );
154 154
155 /** 155 /**
156 Opens the preferred mail composer with all selected contacts as 156 Opens the preferred mail composer with all selected contacts as
157 arguments. 157 arguments.
158 */ 158 */
159 void sendMail(); 159 void sendMail();
160 160
161 /** 161 /**
162 Opens the preferred mail composer with the given contacts as 162 Opens the preferred mail composer with the given contacts as
163 arguments. 163 arguments.
164 */ 164 */
165 void sendMail( const QString& email ); 165 void sendMail( const QString& email );
166 166
167 167
168 void mailVCard(); 168 void mailVCard();
169 void mailVCard(const QStringList& uids); 169 void mailVCard(const QStringList& uids);
170 170
171 /** 171 /**
172 Beams the "WhoAmI contact. 172 Beams the "WhoAmI contact.
173 */ 173 */
174 void beamMySelf(); 174 void beamMySelf();
175 175
176 void beamVCard(); 176 void beamVCard();
177 void export2phone();
177 void beamVCard(const QStringList& uids); 178 void beamVCard(const QStringList& uids);
178 void beamDone( Ir *ir ); 179 void beamDone( Ir *ir );
179 180
180 181
181 /** 182 /**
182 Starts the preferred web browser with the given URL as argument. 183 Starts the preferred web browser with the given URL as argument.
183 */ 184 */
184 void browse( const QString& url ); 185 void browse( const QString& url );
185 186
186 /** 187 /**
187 Select all contacts in the view. 188 Select all contacts in the view.
188 */ 189 */
189 void selectAllContacts(); 190 void selectAllContacts();
190 191
191 /** 192 /**
192 Deletes all selected contacts from the address book. 193 Deletes all selected contacts from the address book.
193 */ 194 */
194 void deleteContacts(); 195 void deleteContacts();
195 196
196 /** 197 /**
197 Deletes given contacts from the address book. 198 Deletes given contacts from the address book.
198 199
199 @param uids The uids of the contacts, which shall be deleted. 200 @param uids The uids of the contacts, which shall be deleted.
200 */ 201 */
201 void deleteContacts( const QStringList &uids ); 202 void deleteContacts( const QStringList &uids );
202 203
203 /** 204 /**
204 Copys the selected contacts into clipboard for later pasting. 205 Copys the selected contacts into clipboard for later pasting.
205 */ 206 */
206 void copyContacts(); 207 void copyContacts();
207 208
208 /** 209 /**
209 Cuts the selected contacts and stores them for later pasting. 210 Cuts the selected contacts and stores them for later pasting.
210 */ 211 */
211 void cutContacts(); 212 void cutContacts();
212 213
213 /** 214 /**
214 Paste contacts from clipboard into the address book. 215 Paste contacts from clipboard into the address book.
215 */ 216 */
216 void pasteContacts(); 217 void pasteContacts();
217 218
218 /** 219 /**
219 Paste given contacts into the address book. 220 Paste given contacts into the address book.
220 221
221 @param list The list of addressee, which shall be pasted. 222 @param list The list of addressee, which shall be pasted.
222 */ 223 */
223 void pasteContacts( KABC::Addressee::List &list ); 224 void pasteContacts( KABC::Addressee::List &list );
224 225
225 /** 226 /**
226 Sets the whoAmI contact, that is used by many other programs to 227 Sets the whoAmI contact, that is used by many other programs to
227 get personal information about the current user. 228 get personal information about the current user.
228 */ 229 */
229 void setWhoAmI(); 230 void setWhoAmI();
230 231
231 /** 232 /**
232 Displays the category dialog and applies the result to all 233 Displays the category dialog and applies the result to all
233 selected contacts. 234 selected contacts.
234 */ 235 */
235 void setCategories(); 236 void setCategories();
236 237
237 /** 238 /**
238 Sets the field list of the Incremental Search Widget. 239 Sets the field list of the Incremental Search Widget.
239 */ 240 */
240 void setSearchFields( const KABC::Field::List &fields ); 241 void setSearchFields( const KABC::Field::List &fields );
241 242
242 /** 243 /**
243 Search with the current search field for a contact, that matches 244 Search with the current search field for a contact, that matches
244 the given text, and selects it in the view. 245 the given text, and selects it in the view.
245 */ 246 */
246 void incrementalSearch( const QString& text ); 247 void incrementalSearch( const QString& text );
247 248
248 /** 249 /**
249 Marks the address book as modified. 250 Marks the address book as modified.
250 */ 251 */
251 void setModified(); 252 void setModified();
252 /** 253 /**
253 Marks the address book as modified without refreshing the view. 254 Marks the address book as modified without refreshing the view.
254 */ 255 */
255 void setModifiedWOrefresh(); 256 void setModifiedWOrefresh();
256 257
257 /** 258 /**
258 Marks the address book as modified concerning the argument. 259 Marks the address book as modified concerning the argument.
259 */ 260 */
260 void setModified( bool modified ); 261 void setModified( bool modified );
261 262
262 /** 263 /**
263 Returns whether the address book is modified. 264 Returns whether the address book is modified.
264 */ 265 */
265 bool modified() const; 266 bool modified() const;
266 267
267 /** 268 /**
268 Called whenever an contact is modified in the contact editor 269 Called whenever an contact is modified in the contact editor
269 dialog or the quick edit. 270 dialog or the quick edit.
270 */ 271 */
271 void contactModified( const KABC::Addressee &addr ); 272 void contactModified( const KABC::Addressee &addr );
272 273
273 /** 274 /**
274 DCOP METHODS. 275 DCOP METHODS.
275 */ 276 */
276 void addEmail( QString addr ); 277 void addEmail( QString addr );
277 void importVCard( const KURL& url, bool showPreview ); 278 void importVCard( const KURL& url, bool showPreview );
278 void importVCard( const QString& vCard, bool showPreview ); 279 void importVCard( const QString& vCard, bool showPreview );
279 void newContact(); 280 void newContact();
280 QString getNameByPhone( const QString& phone ); 281 QString getNameByPhone( const QString& phone );
281 /** 282 /**
282 END DCOP METHODS 283 END DCOP METHODS
283 */ 284 */
284 285
285 /** 286 /**
286 Saves the contents of the AddressBook back to disk. 287 Saves the contents of the AddressBook back to disk.
287 */ 288 */
288 void save(); 289 void save();
289 290
290 /** 291 /**
291 Undos the last command using the undo stack. 292 Undos the last command using the undo stack.
292 */ 293 */
293 void undo(); 294 void undo();
294 295
295 /** 296 /**
296 Redos the last command that was undone, using the redo stack. 297 Redos the last command that was undone, using the redo stack.
297 */ 298 */
298 void redo(); 299 void redo();
299 300
300 /** 301 /**
301 Shows the edit dialog for the given uid. If the uid is QString::null, 302 Shows the edit dialog for the given uid. If the uid is QString::null,
302 the method will try to find a selected addressee in the view. 303 the method will try to find a selected addressee in the view.
303 */ 304 */
304 void editContact( const QString &uid /*US = QString::null*/ ); 305 void editContact( const QString &uid /*US = QString::null*/ );
305//US added a second method without defaultparameter 306//US added a second method without defaultparameter
306 void editContact2(); 307 void editContact2();
307 308
308 /** 309 /**
309 Shows or edits the detail view for the given uid. If the uid is QString::null, 310 Shows or edits the detail view for the given uid. If the uid is QString::null,
310 the method will try to find a selected addressee in the view. 311 the method will try to find a selected addressee in the view.
311 */ 312 */
312 void executeContact( const QString &uid /*US = QString::null*/ ); 313 void executeContact( const QString &uid /*US = QString::null*/ );
313 314
314 /** 315 /**
315 Launches the configuration dialog. 316 Launches the configuration dialog.
316 */ 317 */
317 void openConfigDialog(); 318 void openConfigDialog();
318 319
319 /** 320 /**
320 Launches the ldap search dialog. 321 Launches the ldap search dialog.
321 */ 322 */
322 void openLDAPDialog(); 323 void openLDAPDialog();
323 324
324 /** 325 /**
325 Creates a KAddressBookPrinter, which will display the print 326 Creates a KAddressBookPrinter, which will display the print
326 dialog and do the printing. 327 dialog and do the printing.
327 */ 328 */
328 void print(); 329 void print();
329 330
330 /** 331 /**
331 Registers a new GUI client, so plugins can register its actions. 332 Registers a new GUI client, so plugins can register its actions.
332 */ 333 */
333 void addGUIClient( KXMLGUIClient *client ); 334 void addGUIClient( KXMLGUIClient *client );
334 335
335 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 336 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
336 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
337 338
338 339
339 signals: 340 signals:
340 void contactSelected( const QString &name ); 341 void contactSelected( const QString &name );
341 void contactSelected( const QPixmap &pixmap ); 342 void contactSelected( const QPixmap &pixmap );
342 public slots: 343 public slots:
343 void setDetailsVisible( bool visible ); 344 void setDetailsVisible( bool visible );
344 void setDetailsToState(); 345 void setDetailsToState();
345 // void slotSyncMenu( int ); 346 // void slotSyncMenu( int );
346 private slots: 347 private slots:
347 void setJumpButtonBarVisible( bool visible ); 348 void setJumpButtonBarVisible( bool visible );
348 void importFromOL(); 349 void importFromOL();
349 void extensionModified( const KABC::Addressee::List &list ); 350 void extensionModified( const KABC::Addressee::List &list );
350 void extensionChanged( int id ); 351 void extensionChanged( int id );
351 void clipboardDataChanged(); 352 void clipboardDataChanged();
352 void updateActionMenu(); 353 void updateActionMenu();
353 void configureKeyBindings(); 354 void configureKeyBindings();
354 void removeVoice(); 355 void removeVoice();
355#ifdef KAB_EMBEDDED 356#ifdef KAB_EMBEDDED
356 void configureResources(); 357 void configureResources();
357#endif //KAB_EMBEDDED 358#endif //KAB_EMBEDDED
358 359
359 void slotEditorDestroyed( const QString &uid ); 360 void slotEditorDestroyed( const QString &uid );
360 void configurationChanged(); 361 void configurationChanged();
361 void addressBookChanged(); 362 void addressBookChanged();
362 363
363 private: 364 private:
364 void initGUI(); 365 void initGUI();
365 void initActions(); 366 void initActions();
366 367
367 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 368 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
368 const char *name = 0 ); 369 const char *name = 0 );
369 370
370 KXMLGUIClient *mGUIClient; 371 KXMLGUIClient *mGUIClient;
371 372
372 KABC::AddressBook *mAddressBook; 373 KABC::AddressBook *mAddressBook;
373 374
374 ViewManager *mViewManager; 375 ViewManager *mViewManager;
375 // QSplitter *mDetailsSplitter; 376 // QSplitter *mDetailsSplitter;
376 KDGanttMinimizeSplitter *mExtensionBarSplitter; 377 KDGanttMinimizeSplitter *mExtensionBarSplitter;
377 ViewContainer *mDetails; 378 ViewContainer *mDetails;
378 KDGanttMinimizeSplitter* mMiniSplitter; 379 KDGanttMinimizeSplitter* mMiniSplitter;
379 XXPortManager *mXXPortManager; 380 XXPortManager *mXXPortManager;
380 JumpButtonBar *mJumpButtonBar; 381 JumpButtonBar *mJumpButtonBar;
381 IncSearchWidget *mIncSearchWidget; 382 IncSearchWidget *mIncSearchWidget;
382 ExtensionManager *mExtensionManager; 383 ExtensionManager *mExtensionManager;
383 384
384 KCMultiDialog *mConfigureDialog; 385 KCMultiDialog *mConfigureDialog;
385 386
386#ifndef KAB_EMBEDDED 387#ifndef KAB_EMBEDDED
387 LDAPSearchDialog *mLdapSearchDialog; 388 LDAPSearchDialog *mLdapSearchDialog;
388#endif //KAB_EMBEDDED 389#endif //KAB_EMBEDDED
389 // QDict<AddresseeEditorDialog> mEditorDict; 390 // QDict<AddresseeEditorDialog> mEditorDict;
390 AddresseeEditorDialog *mEditorDialog; 391 AddresseeEditorDialog *mEditorDialog;
391 bool mReadWrite; 392 bool mReadWrite;
392 bool mModified; 393 bool mModified;
393 bool mIsPart; 394 bool mIsPart;
394 bool mMultipleViewsAtOnce; 395 bool mMultipleViewsAtOnce;
395 396
396 397
397 //US file menu 398 //US file menu
398 KAction *mActionMail; 399 KAction *mActionMail;
399 KAction *mActionBeam; 400 KAction *mActionBeam;
401 KAction *mActionExport2phone;
400 KAction* mActionPrint; 402 KAction* mActionPrint;
401 KAction* mActionNewContact; 403 KAction* mActionNewContact;
402 KAction *mActionSave; 404 KAction *mActionSave;
403 KAction *mActionEditAddressee; 405 KAction *mActionEditAddressee;
404 KAction *mActionMailVCard; 406 KAction *mActionMailVCard;
405 KAction *mActionBeamVCard; 407 KAction *mActionBeamVCard;
406 408
407 KAction *mActionQuit; 409 KAction *mActionQuit;
408 410
409 //US edit menu 411 //US edit menu
410 KAction *mActionCopy; 412 KAction *mActionCopy;
411 KAction *mActionCut; 413 KAction *mActionCut;
412 KAction *mActionPaste; 414 KAction *mActionPaste;
413 KAction *mActionSelectAll; 415 KAction *mActionSelectAll;
414 KAction *mActionUndo; 416 KAction *mActionUndo;
415 KAction *mActionRedo; 417 KAction *mActionRedo;
416 KAction *mActionDelete; 418 KAction *mActionDelete;
417 419
418 //US settings menu 420 //US settings menu
419 KAction *mActionConfigResources; 421 KAction *mActionConfigResources;
420 KAction *mActionConfigKAddressbook; 422 KAction *mActionConfigKAddressbook;
421 KAction *mActionConfigShortcuts; 423 KAction *mActionConfigShortcuts;
422 KAction *mActionConfigureToolbars; 424 KAction *mActionConfigureToolbars;
423 KAction *mActionKeyBindings; 425 KAction *mActionKeyBindings;
424 KToggleAction *mActionJumpBar; 426 KToggleAction *mActionJumpBar;
425 KToggleAction *mActionDetails; 427 KToggleAction *mActionDetails;
426 KAction *mActionWhoAmI; 428 KAction *mActionWhoAmI;
427 KAction *mActionCategories; 429 KAction *mActionCategories;
428 KAction *mActionAboutKAddressbook; 430 KAction *mActionAboutKAddressbook;
429 KAction *mActionLicence; 431 KAction *mActionLicence;
430 KAction *mActionFaq; 432 KAction *mActionFaq;
431 433
432 KAction *mActionDeleteView; 434 KAction *mActionDeleteView;
433 435
434 QPopupMenu *viewMenu; 436 QPopupMenu *viewMenu;
435 QPopupMenu *filterMenu; 437 QPopupMenu *filterMenu;
436 QPopupMenu *settingsMenu; 438 QPopupMenu *settingsMenu;
437 QPopupMenu *changeMenu; 439 QPopupMenu *changeMenu;
438//US QAction *mActionSave; 440//US QAction *mActionSave;
439 QPopupMenu *ImportMenu; 441 QPopupMenu *ImportMenu;
440 QPopupMenu *ExportMenu; 442 QPopupMenu *ExportMenu;
441 //LR additional methods 443 //LR additional methods
442 KAction *mActionRemoveVoice; 444 KAction *mActionRemoveVoice;
443 KAction * mActionImportOL; 445 KAction * mActionImportOL;
444 446
445#ifndef KAB_EMBEDDED 447#ifndef KAB_EMBEDDED
446 KAddressBookService *mAddressBookService; 448 KAddressBookService *mAddressBookService;
447#endif //KAB_EMBEDDED 449#endif //KAB_EMBEDDED
448 450
449 class KABCorePrivate; 451 class KABCorePrivate;
450 KABCorePrivate *d; 452 KABCorePrivate *d;
451 //US bool mBlockSaveFlag; 453 //US bool mBlockSaveFlag;
452 454
453#ifdef KAB_EMBEDDED 455#ifdef KAB_EMBEDDED
454 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 456 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
455#endif //KAB_EMBEDDED 457#endif //KAB_EMBEDDED
456 458
457 //this are the overwritten callbackmethods from the syncinterface 459 //this are the overwritten callbackmethods from the syncinterface
458 virtual bool sync(KSyncManager* manager, QString filename, int mode); 460 virtual bool sync(KSyncManager* manager, QString filename, int mode);
459 virtual bool syncExternal(KSyncManager* manager, QString resource); 461 virtual bool syncExternal(KSyncManager* manager, QString resource);
460 462
461 //called by the syncmanager to indicate that the work has to marked as dirty. 463 //called by the syncmanager to indicate that the work has to marked as dirty.
462 virtual void sync_setModified(); 464 virtual void sync_setModified();
463 //called by the syncmanager to ask if the dirty flag is set. 465 //called by the syncmanager to ask if the dirty flag is set.
464 virtual bool sync_isModified(); 466 virtual bool sync_isModified();
465 //called by the syncmanager to indicate that the work has to be saved. 467 //called by the syncmanager to indicate that the work has to be saved.
466 virtual void sync_save(); 468 virtual void sync_save();
467 469
468 // LR ******************************* 470 // LR *******************************
469 // sync stuff! 471 // sync stuff!
470 QPopupMenu *syncMenu; 472 QPopupMenu *syncMenu;
471 KSyncManager* syncManager; 473 KSyncManager* syncManager;
472 int mGlobalSyncMode; 474 int mGlobalSyncMode;
473 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 475 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
474 KABC::Addressee getLastSyncAddressee(); 476 KABC::Addressee getLastSyncAddressee();
475 QDateTime mLastAddressbookSync; 477 QDateTime mLastAddressbookSync;
476 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 478 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
477 // ********************* 479 // *********************
478 480
479}; 481};
480 482
481#endif 483#endif