summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp134
-rw-r--r--kaddressbook/kabcore.h42
2 files changed, 162 insertions, 14 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2a54900..d891b07 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,1719 +1,1853 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include "kabcore.h" 24#include "kabcore.h"
25 25
26#include <stdaddressbook.h> 26#include <stdaddressbook.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#include <qclipboard.h> 30#include <qclipboard.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qapplicaton.h> 33#include <qapplicaton.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qregexp.h> 35#include <qregexp.h>
36#include <qvbox.h> 36#include <qvbox.h>
37#include <kabc/addresseelist.h> 37#include <kabc/addresseelist.h>
38#include <kabc/errorhandler.h> 38#include <kabc/errorhandler.h>
39#include <kabc/resource.h> 39#include <kabc/resource.h>
40#include <kabc/vcardconverter.h> 40#include <kabc/vcardconverter.h>
41#include <kapplication.h> 41#include <kapplication.h>
42#include <kactionclasses.h> 42#include <kactionclasses.h>
43#include <kcmultidialog.h> 43#include <kcmultidialog.h>
44#include <kdebug.h> 44#include <kdebug.h>
45#include <kdeversion.h> 45#include <kdeversion.h>
46#include <kkeydialog.h> 46#include <kkeydialog.h>
47#include <kmessagebox.h> 47#include <kmessagebox.h>
48#include <kprinter.h> 48#include <kprinter.h>
49#include <kprotocolinfo.h> 49#include <kprotocolinfo.h>
50#include <kresources/selectdialog.h> 50#include <kresources/selectdialog.h>
51#include <kstandarddirs.h> 51#include <kstandarddirs.h>
52#include <ktempfile.h> 52#include <ktempfile.h>
53#include <kxmlguiclient.h> 53#include <kxmlguiclient.h>
54#include <kaboutdata.h> 54#include <kaboutdata.h>
55#include <libkdepim/categoryselectdialog.h> 55#include <libkdepim/categoryselectdialog.h>
56 56
57#include "addresseeutil.h" 57#include "addresseeutil.h"
58#include "addresseeeditordialog.h" 58#include "addresseeeditordialog.h"
59#include "extensionmanager.h" 59#include "extensionmanager.h"
60#include "kstdaction.h" 60#include "kstdaction.h"
61#include "kaddressbookservice.h" 61#include "kaddressbookservice.h"
62#include "ldapsearchdialog.h" 62#include "ldapsearchdialog.h"
63#include "printing/printingwizard.h" 63#include "printing/printingwizard.h"
64#else // KAB_EMBEDDED 64#else // KAB_EMBEDDED
65 65
66#include <kapplication.h> 66#include <kapplication.h>
67#include "KDGanttMinimizeSplitter.h" 67#include "KDGanttMinimizeSplitter.h"
68#include "kaddressbookmain.h" 68#include "kaddressbookmain.h"
69#include "kactioncollection.h" 69#include "kactioncollection.h"
70#include <qapp.h> 70#include <qapp.h>
71#include <qmenubar.h> 71#include <qmenubar.h>
72//#include <qtoolbar.h> 72//#include <qtoolbar.h>
73#include <qmessagebox.h> 73#include <qmessagebox.h>
74#include <kdebug.h> 74#include <kdebug.h>
75#include <kiconloader.h> // needed for SmallIcon 75#include <kiconloader.h> // needed for SmallIcon
76#include <kresources/kcmkresources.h> 76#include <kresources/kcmkresources.h>
77#include <ktoolbar.h> 77#include <ktoolbar.h>
78 78
79#include <kcmkabconfig.h> 79#include <kcmkabconfig.h>
80 80
81//#include <qlabel.h> 81//#include <qlabel.h>
82 82
83 83
84#ifdef Q_WS_QWS 84#ifdef Q_WS_QWS
85#include <qtopia/services.h> 85#include <qtopia/services.h>
86#include <qtopia/qcopenvelope_qws.h> 86#include <qtopia/qcopenvelope_qws.h>
87#endif 87#endif
88#include <qpe/ir.h>
88 89
89#endif // KAB_EMBEDDED 90#endif // KAB_EMBEDDED
90#include <kcmkabconfig.h> 91#include <kcmkabconfig.h>
91 92
92 93
93#include <kresources/selectdialog.h> 94#include <kresources/selectdialog.h>
94#include <kmessagebox.h> 95#include <kmessagebox.h>
95 96
96#include <picture.h> 97#include <picture.h>
97#include <resource.h> 98#include <resource.h>
98 99
99//US#include <qsplitter.h> 100//US#include <qsplitter.h>
100#include <qmap.h> 101#include <qmap.h>
101#include <qdir.h> 102#include <qdir.h>
102#include <qfile.h> 103#include <qfile.h>
103#include <qvbox.h> 104#include <qvbox.h>
104#include <qlayout.h> 105#include <qlayout.h>
105#include <qclipboard.h> 106#include <qclipboard.h>
106#include <qtextstream.h> 107#include <qtextstream.h>
107 108
108#include <libkdepim/categoryselectdialog.h> 109#include <libkdepim/categoryselectdialog.h>
109#include <kabc/vcardconverter.h> 110#include <kabc/vcardconverter.h>
110 111
111 112
112#include "addresseeutil.h" 113#include "addresseeutil.h"
113#include "undocmds.h" 114#include "undocmds.h"
114#include "addresseeeditordialog.h" 115#include "addresseeeditordialog.h"
115#include "viewmanager.h" 116#include "viewmanager.h"
116#include "details/detailsviewcontainer.h" 117#include "details/detailsviewcontainer.h"
117#include "kabprefs.h" 118#include "kabprefs.h"
118#include "xxportmanager.h" 119#include "xxportmanager.h"
119#include "incsearchwidget.h" 120#include "incsearchwidget.h"
120#include "jumpbuttonbar.h" 121#include "jumpbuttonbar.h"
121#include "extensionmanager.h" 122#include "extensionmanager.h"
122#include "addresseeconfig.h" 123#include "addresseeconfig.h"
123#include <kcmultidialog.h> 124#include <kcmultidialog.h>
124 125
125#ifdef _WIN32_ 126#ifdef _WIN32_
126 127
127#include "kaimportoldialog.h" 128#include "kaimportoldialog.h"
128#endif 129#endif
129 130
130bool pasteWithNewUid = true; 131bool pasteWithNewUid = true;
131 132
132#ifdef KAB_EMBEDDED 133#ifdef KAB_EMBEDDED
133KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 134KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
134 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 135 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
135 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 136 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
136 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 137 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
137#else //KAB_EMBEDDED 138#else //KAB_EMBEDDED
138KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 139KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
139 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 140 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
140 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 141 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
141 mReadWrite( readWrite ), mModified( false ) 142 mReadWrite( readWrite ), mModified( false )
142#endif //KAB_EMBEDDED 143#endif //KAB_EMBEDDED
143{ 144{
144 145
145 mExtensionBarSplitter = 0; 146 mExtensionBarSplitter = 0;
146 mIsPart = !parent->inherits( "KAddressBookMain" ); 147 mIsPart = !parent->inherits( "KAddressBookMain" );
147 148
148 mAddressBook = KABC::StdAddressBook::self(); 149 mAddressBook = KABC::StdAddressBook::self();
149 KABC::StdAddressBook::setAutomaticSave( false ); 150 KABC::StdAddressBook::setAutomaticSave( false );
150 151
151#ifndef KAB_EMBEDDED 152#ifndef KAB_EMBEDDED
152 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 153 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
153#endif //KAB_EMBEDDED 154#endif //KAB_EMBEDDED
154 155
155 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 156 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
156 SLOT( addressBookChanged() ) ); 157 SLOT( addressBookChanged() ) );
157 158
158 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 159 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
159 "X-Department", "KADDRESSBOOK" ); 160 "X-Department", "KADDRESSBOOK" );
160 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 161 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
161 "X-Profession", "KADDRESSBOOK" ); 162 "X-Profession", "KADDRESSBOOK" );
162 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 163 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
163 "X-AssistantsName", "KADDRESSBOOK" ); 164 "X-AssistantsName", "KADDRESSBOOK" );
164 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 165 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
165 "X-ManagersName", "KADDRESSBOOK" ); 166 "X-ManagersName", "KADDRESSBOOK" );
166 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 167 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
167 "X-SpousesName", "KADDRESSBOOK" ); 168 "X-SpousesName", "KADDRESSBOOK" );
168 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 169 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
169 "X-Office", "KADDRESSBOOK" ); 170 "X-Office", "KADDRESSBOOK" );
170 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 171 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
171 "X-IMAddress", "KADDRESSBOOK" ); 172 "X-IMAddress", "KADDRESSBOOK" );
172 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 173 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
173 "X-Anniversary", "KADDRESSBOOK" ); 174 "X-Anniversary", "KADDRESSBOOK" );
174 175
175 //US added this field to become compatible with Opie/qtopia addressbook 176 //US added this field to become compatible with Opie/qtopia addressbook
176 // values can be "female" or "male" or "". An empty field represents undefined. 177 // values can be "female" or "male" or "". An empty field represents undefined.
177 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 178 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
178 "X-Gender", "KADDRESSBOOK" ); 179 "X-Gender", "KADDRESSBOOK" );
179 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 180 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
180 "X-Children", "KADDRESSBOOK" ); 181 "X-Children", "KADDRESSBOOK" );
181 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 182 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
182 "X-FreeBusyUrl", "KADDRESSBOOK" ); 183 "X-FreeBusyUrl", "KADDRESSBOOK" );
183 184
184 initGUI(); 185 initGUI();
185 186
186 mIncSearchWidget->setFocus(); 187 mIncSearchWidget->setFocus();
187 188
188 189
189 connect( mViewManager, SIGNAL( selected( const QString& ) ), 190 connect( mViewManager, SIGNAL( selected( const QString& ) ),
190 SLOT( setContactSelected( const QString& ) ) ); 191 SLOT( setContactSelected( const QString& ) ) );
191 connect( mViewManager, SIGNAL( executed( const QString& ) ), 192 connect( mViewManager, SIGNAL( executed( const QString& ) ),
192 SLOT( editContact( const QString& ) ) ); 193 SLOT( editContact( const QString& ) ) );
193 connect( mViewManager, SIGNAL( deleteRequest( ) ), 194 connect( mViewManager, SIGNAL( deleteRequest( ) ),
194 SLOT( deleteContacts( ) ) ); 195 SLOT( deleteContacts( ) ) );
195 connect( mViewManager, SIGNAL( modified() ), 196 connect( mViewManager, SIGNAL( modified() ),
196 SLOT( setModified() ) ); 197 SLOT( setModified() ) );
197 198
198 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 199 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
199 200
200 connect( mXXPortManager, SIGNAL( modified() ), 201 connect( mXXPortManager, SIGNAL( modified() ),
201 SLOT( setModified() ) ); 202 SLOT( setModified() ) );
202 203
203 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 204 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
204 SLOT( incrementalSearch( const QString& ) ) ); 205 SLOT( incrementalSearch( const QString& ) ) );
205 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 206 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
206 mJumpButtonBar, SLOT( recreateButtons() ) ); 207 mJumpButtonBar, SLOT( recreateButtons() ) );
207 208
208 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 209 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
209 SLOT( sendMail( const QString& ) ) ); 210 SLOT( sendMail( const QString& ) ) );
210 211
211#ifndef KAB_EMBEDDED 212#ifndef KAB_EMBEDDED
212 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 213 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
213 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 214 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
214 215
215 connect( mDetails, SIGNAL( browse( const QString& ) ), 216 connect( mDetails, SIGNAL( browse( const QString& ) ),
216 SLOT( browse( const QString& ) ) ); 217 SLOT( browse( const QString& ) ) );
217 218
218 mAddressBookService = new KAddressBookService( this ); 219 mAddressBookService = new KAddressBookService( this );
219 220
220#endif //KAB_EMBEDDED 221#endif //KAB_EMBEDDED
221 mEditorDialog = 0; 222 mEditorDialog = 0;
222 createAddresseeEditorDialog( this ); 223 createAddresseeEditorDialog( this );
223 setModified( false ); 224 setModified( false );
224} 225}
225 226
226KABCore::~KABCore() 227KABCore::~KABCore()
227{ 228{
228 // save(); 229 // save();
229 //saveSettings(); 230 //saveSettings();
230 //KABPrefs::instance()->writeConfig(); 231 //KABPrefs::instance()->writeConfig();
231 delete AddresseeConfig::instance(); 232 delete AddresseeConfig::instance();
232 mAddressBook = 0; 233 mAddressBook = 0;
233 KABC::StdAddressBook::close(); 234 KABC::StdAddressBook::close();
234} 235}
235 236
236void KABCore::restoreSettings() 237void KABCore::restoreSettings()
237{ 238{
238 bool state = KABPrefs::instance()->mJumpButtonBarVisible; 239 bool state = KABPrefs::instance()->mJumpButtonBarVisible;
239 240
240 mActionJumpBar->setChecked( state ); 241 mActionJumpBar->setChecked( state );
241 setJumpButtonBarVisible( state ); 242 setJumpButtonBarVisible( state );
242 243
243 state = KABPrefs::instance()->mDetailsPageVisible; 244 state = KABPrefs::instance()->mDetailsPageVisible;
244 245
245 mActionDetails->setChecked( state ); 246 mActionDetails->setChecked( state );
246 setDetailsVisible( state ); 247 setDetailsVisible( state );
247 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 248 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
248 if ( splitterSize.count() == 0 ) { 249 if ( splitterSize.count() == 0 ) {
249 splitterSize.append( width() / 2 ); 250 splitterSize.append( width() / 2 );
250 splitterSize.append( width() / 2 ); 251 splitterSize.append( width() / 2 );
251 } 252 }
252 mMiniSplitter->setSizes( splitterSize ); 253 mMiniSplitter->setSizes( splitterSize );
253 if ( mExtensionBarSplitter ) { 254 if ( mExtensionBarSplitter ) {
254 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 255 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
255 if ( splitterSize.count() == 0 ) { 256 if ( splitterSize.count() == 0 ) {
256 splitterSize.append( width() / 2 ); 257 splitterSize.append( width() / 2 );
257 splitterSize.append( width() / 2 ); 258 splitterSize.append( width() / 2 );
258 } 259 }
259 mExtensionBarSplitter->setSizes( splitterSize ); 260 mExtensionBarSplitter->setSizes( splitterSize );
260 261
261 } 262 }
262#ifndef KAB_EMBEDDED 263#ifndef KAB_EMBEDDED
263 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; 264 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter;
264 if ( splitterSize.count() == 0 ) { 265 if ( splitterSize.count() == 0 ) {
265 splitterSize.append( width() / 2 ); 266 splitterSize.append( width() / 2 );
266 splitterSize.append( width() / 2 ); 267 splitterSize.append( width() / 2 );
267 } 268 }
268 mExtensionBarSplitter->setSizes( splitterSize ); 269 mExtensionBarSplitter->setSizes( splitterSize );
269 270
270 splitterSize = KABPrefs::instance()->mDetailsSplitter; 271 splitterSize = KABPrefs::instance()->mDetailsSplitter;
271 if ( splitterSize.count() == 0 ) { 272 if ( splitterSize.count() == 0 ) {
272 splitterSize.append( height() / 2 ); 273 splitterSize.append( height() / 2 );
273 splitterSize.append( height() / 2 ); 274 splitterSize.append( height() / 2 );
274 } 275 }
275 mDetailsSplitter->setSizes( splitterSize ); 276 mDetailsSplitter->setSizes( splitterSize );
276 277
277 mExtensionManager->restoreSettings(); 278 mExtensionManager->restoreSettings();
278 279
279#endif //KAB_EMBEDDED 280#endif //KAB_EMBEDDED
280 281
281 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 282 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
282 283
283 mViewManager->restoreSettings(); 284 mViewManager->restoreSettings();
284 mExtensionManager->restoreSettings(); 285 mExtensionManager->restoreSettings();
285} 286}
286 287
287void KABCore::saveSettings() 288void KABCore::saveSettings()
288{ 289{
289 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 290 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
290 if ( mExtensionBarSplitter ) 291 if ( mExtensionBarSplitter )
291 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 292 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
292 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 293 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
293 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 294 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
294#ifndef KAB_EMBEDDED 295#ifndef KAB_EMBEDDED
295 296
296 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 297 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
297 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 298 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
298#endif //KAB_EMBEDDED 299#endif //KAB_EMBEDDED
299 mExtensionManager->saveSettings(); 300 mExtensionManager->saveSettings();
300 mViewManager->saveSettings(); 301 mViewManager->saveSettings();
301 302
302 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 303 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
303 304
304} 305}
305 306
306KABC::AddressBook *KABCore::addressBook() const 307KABC::AddressBook *KABCore::addressBook() const
307{ 308{
308 return mAddressBook; 309 return mAddressBook;
309} 310}
310 311
311KConfig *KABCore::config() 312KConfig *KABCore::config()
312{ 313{
313#ifndef KAB_EMBEDDED 314#ifndef KAB_EMBEDDED
314 return KABPrefs::instance()->config(); 315 return KABPrefs::instance()->config();
315#else //KAB_EMBEDDED 316#else //KAB_EMBEDDED
316 return KABPrefs::instance()->getConfig(); 317 return KABPrefs::instance()->getConfig();
317#endif //KAB_EMBEDDED 318#endif //KAB_EMBEDDED
318} 319}
319 320
320KActionCollection *KABCore::actionCollection() const 321KActionCollection *KABCore::actionCollection() const
321{ 322{
322 return mGUIClient->actionCollection(); 323 return mGUIClient->actionCollection();
323} 324}
324 325
325KABC::Field *KABCore::currentSearchField() const 326KABC::Field *KABCore::currentSearchField() const
326{ 327{
327 if (mIncSearchWidget) 328 if (mIncSearchWidget)
328 return mIncSearchWidget->currentField(); 329 return mIncSearchWidget->currentField();
329 else 330 else
330 return 0; 331 return 0;
331} 332}
332 333
333QStringList KABCore::selectedUIDs() const 334QStringList KABCore::selectedUIDs() const
334{ 335{
335 return mViewManager->selectedUids(); 336 return mViewManager->selectedUids();
336} 337}
337 338
338KABC::Resource *KABCore::requestResource( QWidget *parent ) 339KABC::Resource *KABCore::requestResource( QWidget *parent )
339{ 340{
340 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 341 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
341 342
342 QPtrList<KRES::Resource> kresResources; 343 QPtrList<KRES::Resource> kresResources;
343 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 344 QPtrListIterator<KABC::Resource> resIt( kabcResources );
344 KABC::Resource *resource; 345 KABC::Resource *resource;
345 while ( ( resource = resIt.current() ) != 0 ) { 346 while ( ( resource = resIt.current() ) != 0 ) {
346 ++resIt; 347 ++resIt;
347 if ( !resource->readOnly() ) { 348 if ( !resource->readOnly() ) {
348 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 349 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
349 if ( res ) 350 if ( res )
350 kresResources.append( res ); 351 kresResources.append( res );
351 } 352 }
352 } 353 }
353 354
354 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 355 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
355 return static_cast<KABC::Resource*>( res ); 356 return static_cast<KABC::Resource*>( res );
356} 357}
357 358
358#ifndef KAB_EMBEDDED 359#ifndef KAB_EMBEDDED
359KAboutData *KABCore::createAboutData() 360KAboutData *KABCore::createAboutData()
360#else //KAB_EMBEDDED 361#else //KAB_EMBEDDED
361void KABCore::createAboutData() 362void KABCore::createAboutData()
362#endif //KAB_EMBEDDED 363#endif //KAB_EMBEDDED
363{ 364{
364#ifndef KAB_EMBEDDED 365#ifndef KAB_EMBEDDED
365 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 366 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
366 "3.1", I18N_NOOP( "The KDE Address Book" ), 367 "3.1", I18N_NOOP( "The KDE Address Book" ),
367 KAboutData::License_GPL_V2, 368 KAboutData::License_GPL_V2,
368 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 369 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
369 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 370 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
370 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 371 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
371 about->addAuthor( "Cornelius Schumacher", 372 about->addAuthor( "Cornelius Schumacher",
372 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 373 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
373 "schumacher@kde.org" ); 374 "schumacher@kde.org" );
374 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 375 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
375 "mpilone@slac.com" ); 376 "mpilone@slac.com" );
376 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 377 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
377 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 378 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
378 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 379 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
379 "michel@klaralvdalens-datakonsult.se" ); 380 "michel@klaralvdalens-datakonsult.se" );
380 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 381 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
381 "hansen@kde.org" ); 382 "hansen@kde.org" );
382 383
383 return about; 384 return about;
384#endif //KAB_EMBEDDED 385#endif //KAB_EMBEDDED
385 386
386 QString version; 387 QString version;
387#include <../version> 388#include <../version>
388 QMessageBox::about( this, "About KAddressbook/Pi", 389 QMessageBox::about( this, "About KAddressbook/Pi",
389 "KAddressbook/Platform-independent\n" 390 "KAddressbook/Platform-independent\n"
390 "(KA/Pi) " +version + " - " + 391 "(KA/Pi) " +version + " - " +
391#ifdef DESKTOP_VERSION 392#ifdef DESKTOP_VERSION
392 "Desktop Edition\n" 393 "Desktop Edition\n"
393#else 394#else
394 "PDA-Edition\n" 395 "PDA-Edition\n"
395 "for: Zaurus 5500 / 7x0 / 8x0\n" 396 "for: Zaurus 5500 / 7x0 / 8x0\n"
396#endif 397#endif
397 398
398 "(c) 2004 Ulf Schenk\n" 399 "(c) 2004 Ulf Schenk\n"
399 "(c) 1997-2003, The KDE PIM Team\n" 400 "(c) 1997-2003, The KDE PIM Team\n"
400 "Tobias Koenig Current maintainer tokoe@kde.org\n" 401 "Tobias Koenig Current maintainer tokoe@kde.org\n"
401 "Don Sanders Original author\n" 402 "Don Sanders Original author\n"
402 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" 403 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n"
403 "Mike Pilone GUI and framework redesign mpilone@slac.com\n" 404 "Mike Pilone GUI and framework redesign mpilone@slac.com\n"
404 "Greg Stern DCOP interface\n" 405 "Greg Stern DCOP interface\n"
405 "Mark Westcot Contact pinning\n" 406 "Mark Westcot Contact pinning\n"
406 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 407 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
407 "Steffen Hansen LDAP Lookup hansen@kde.org\n" 408 "Steffen Hansen LDAP Lookup hansen@kde.org\n"
408#ifdef _WIN32_ 409#ifdef _WIN32_
409 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" 410 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n"
410#endif 411#endif
411 ); 412 );
412} 413}
413 414
414void KABCore::setContactSelected( const QString &uid ) 415void KABCore::setContactSelected( const QString &uid )
415{ 416{
416 KABC::Addressee addr = mAddressBook->findByUid( uid ); 417 KABC::Addressee addr = mAddressBook->findByUid( uid );
417 if ( !mDetails->isHidden() ) 418 if ( !mDetails->isHidden() )
418 mDetails->setAddressee( addr ); 419 mDetails->setAddressee( addr );
419 420
420 if ( !addr.isEmpty() ) { 421 if ( !addr.isEmpty() ) {
421 emit contactSelected( addr.formattedName() ); 422 emit contactSelected( addr.formattedName() );
422 KABC::Picture pic = addr.photo(); 423 KABC::Picture pic = addr.photo();
423 if ( pic.isIntern() ) { 424 if ( pic.isIntern() ) {
424//US emit contactSelected( pic.data() ); 425//US emit contactSelected( pic.data() );
425//US instead use: 426//US instead use:
426 QPixmap px; 427 QPixmap px;
427 if (pic.data().isNull() != true) 428 if (pic.data().isNull() != true)
428 { 429 {
429 px.convertFromImage(pic.data()); 430 px.convertFromImage(pic.data());
430 } 431 }
431 432
432 emit contactSelected( px ); 433 emit contactSelected( px );
433 } 434 }
434 } 435 }
435 436
436 437
437 mExtensionManager->setSelectionChanged(); 438 mExtensionManager->setSelectionChanged();
438 439
439 // update the actions 440 // update the actions
440 bool selected = !uid.isEmpty(); 441 bool selected = !uid.isEmpty();
441 442
442 if ( mReadWrite ) { 443 if ( mReadWrite ) {
443 mActionCut->setEnabled( selected ); 444 mActionCut->setEnabled( selected );
444 mActionPaste->setEnabled( selected ); 445 mActionPaste->setEnabled( selected );
445 } 446 }
446 447
447 mActionCopy->setEnabled( selected ); 448 mActionCopy->setEnabled( selected );
448 mActionDelete->setEnabled( selected ); 449 mActionDelete->setEnabled( selected );
449 mActionEditAddressee->setEnabled( selected ); 450 mActionEditAddressee->setEnabled( selected );
450 mActionMail->setEnabled( selected ); 451 mActionMail->setEnabled( selected );
451 mActionMailVCard->setEnabled( selected ); 452 mActionMailVCard->setEnabled( selected );
453 if (mActionBeam)
454 mActionBeam->setEnabled( selected );
455
456 if (mActionBeam)
457 mActionBeamVCard->setEnabled( selected );
458
452 mActionWhoAmI->setEnabled( selected ); 459 mActionWhoAmI->setEnabled( selected );
453 mActionCategories->setEnabled( selected ); 460 mActionCategories->setEnabled( selected );
454} 461}
455 462
456void KABCore::sendMail() 463void KABCore::sendMail()
457{ 464{
458 sendMail( mViewManager->selectedEmails().join( ", " ) ); 465 sendMail( mViewManager->selectedEmails().join( ", " ) );
459} 466}
460 467
461void KABCore::sendMail( const QString& email ) 468void KABCore::sendMail( const QString& email )
462{ 469{
463//US original kde implementation : kapp->invokeMailer( email, "" ); 470//US original kde implementation : kapp->invokeMailer( email, "" );
464 471
465/*US original qtopia implementation 472/*US original qtopia implementation
466 PimContact c = abList->currentEntry(); 473 PimContact c = abList->currentEntry();
467 QString name = c.fileAs(); 474 QString name = c.fileAs();
468 QString email = c.defaultEmail(); 475 QString email = c.defaultEmail();
469#ifndef QT_NO_COP 476#ifndef QT_NO_COP
470 QCopEnvelope e(Service::channel("Email"), "writeMail(QString,QString)"); 477 QCopEnvelope e(Service::channel("Email"), "writeMail(QString,QString)");
471 e << name << email; 478 e << name << email;
472#else 479#else
473*/ 480*/
474 481
475 482
476#ifndef QT_NO_COP 483#ifndef QT_NO_COP
477 QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); 484 QCString channel = KABPrefs::instance()->mEmailChannel.latin1();
478 qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); 485 qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")");
479 486
480 QCopEnvelope e(channel, "writeMail(QString,QString)"); 487 QCopEnvelope e(channel, "writeMail(QString,QString)");
481 //US we need no names in the To field. The emailadresses are enough 488 //US we need no names in the To field. The emailadresses are enough
482 e << "" << email; 489 e << "" << email;
483#else 490#else
484 KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); 491 KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) );
485#endif 492#endif
486} 493}
487 494
495
496
488void KABCore::mailVCard() 497void KABCore::mailVCard()
489{ 498{
490 QStringList uids = mViewManager->selectedUids(); 499 QStringList uids = mViewManager->selectedUids();
491 if ( !uids.isEmpty() ) 500 if ( !uids.isEmpty() )
492 mailVCard( uids ); 501 mailVCard( uids );
493} 502}
494 503
495void KABCore::mailVCard( const QStringList& uids ) 504void KABCore::mailVCard( const QStringList& uids )
496{ 505{
497 QStringList urls; 506 QStringList urls;
498 507
499 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 508 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
500 509
501/*US 510/*US
502 // Create a temp dir, so that we can put the files in it with proper names 511 // Create a temp dir, so that we can put the files in it with proper names
503 KTempFile tempDir; 512 KTempFile tempDir;
504 if ( tempDir.status() != 0 ) { 513 if ( tempDir.status() != 0 ) {
505 kdWarning() << strerror( tempDir.status() ) << endl; 514 kdWarning() << strerror( tempDir.status() ) << endl;
506 return; 515 return;
507 } 516 }
508 517
509 QString dirName = tempDir.name(); 518 QString dirName = tempDir.name();
510 tempDir.unlink(); 519 tempDir.unlink();
511*/ 520*/
512 QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); 521 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
513 522
514 523
515 524
516 QDir().mkdir( dirName, true ); 525 QDir().mkdir( dirName, true );
517 526
518 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 527 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
519 KABC::Addressee a = mAddressBook->findByUid( *it ); 528 KABC::Addressee a = mAddressBook->findByUid( *it );
520 529
521 if ( a.isEmpty() ) 530 if ( a.isEmpty() )
522 continue; 531 continue;
523 532
524 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 533 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
525 534
526 QString fileName = dirName + "/" + name; 535 QString fileName = dirName + "/" + name;
527 536
528 QFile outFile(fileName); 537 QFile outFile(fileName);
529 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 538 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
530 KABC::VCardConverter converter; 539 KABC::VCardConverter converter;
531 QString vcard; 540 QString vcard;
532 541
533 converter.addresseeToVCard( a, vcard ); 542 converter.addresseeToVCard( a, vcard );
534 543
535 QTextStream t( &outFile ); // use a text stream 544 QTextStream t( &outFile ); // use a text stream
536 t.setEncoding( QTextStream::UnicodeUTF8 ); 545 t.setEncoding( QTextStream::UnicodeUTF8 );
537 t << vcard; 546 t << vcard;
538 547
539 outFile.close(); 548 outFile.close();
540 549
541 urls.append( fileName ); 550 urls.append( fileName );
542 } 551 }
543 } 552 }
544/*US 553/*US
545 kapp->invokeMailer( QString::null, QString::null, QString::null, 554 kapp->invokeMailer( QString::null, QString::null, QString::null,
546 QString::null, // subject 555 QString::null, // subject
547 QString::null, // body 556 QString::null, // body
548 QString::null, 557 QString::null,
549 urls ); // attachments 558 urls ); // attachments
550*/ 559*/
551#ifndef QT_NO_COP 560#ifndef QT_NO_COP
552 QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); 561 QCString channel = KABPrefs::instance()->mEmailChannel.latin1();
553 qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); 562 qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")");
554 563
555 QMap<QString, QString> parameterMap; 564 QMap<QString, QString> parameterMap;
556 parameterMap.insert("ATTACHMENT<n>", urls.join(", ")); 565 parameterMap.insert("ATTACHMENT<n>", urls.join(", "));
557 566
558 QCopEnvelope e(channel, "writeMail(QMap(QString,QString))"); 567 QCopEnvelope e(channel, "writeMail(QMap(QString,QString))");
559 e << parameterMap; 568 e << parameterMap;
560#else 569#else
561 KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); 570 KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) );
562#endif 571#endif
563 572
564 573
565} 574}
566 575
576/**
577 Beams the "WhoAmI contact.
578*/
579void KABCore::beamMySelf()
580{
581 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
582 if (!a.isEmpty())
583 {
584 QStringList uids;
585 uids << a.uid();
586
587 beamVCard(uids);
588 }
589}
590
591void KABCore::beamVCard()
592{
593 QStringList uids = mViewManager->selectedUids();
594 if ( !uids.isEmpty() )
595 beamVCard( uids );
596}
597
598
599void KABCore::beamVCard(const QStringList& uids)
600{
601/*US
602 QString beamFilename;
603 Opie::OPimContact c;
604 if ( actionPersonal->isOn() ) {
605 beamFilename = addressbookPersonalVCardName();
606 if ( !QFile::exists( beamFilename ) )
607 return; // can't beam a non-existent file
608 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
609 beamFilename );
610 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
611 Opie::OPimContactAccess::List allList = access->allRecords();
612 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
613 c = *it;
614
615 delete access;
616 } else {
617 unlink( beamfile ); // delete if exists
618 mkdir("/tmp/obex/", 0755);
619 c = m_abView -> currentEntry();
620 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
621 beamfile );
622 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
623 access->add( c );
624 access->save();
625 delete access;
626
627 beamFilename = beamfile;
628 }
629
630 owarn << "Beaming: " << beamFilename << oendl;
631*/
632 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
633
634 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
635
636 QString name = "contact.vcf";
637
638 QString fileName = dirName + "/" + name;
639
640
641 QDir().mkdir( dirName, true );
642
643 QFile outFile(fileName);
644 KABC::VCardConverter converter;
645 QString description;
646
647 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
648
649 QTextStream t( &outFile ); // use a text stream
650 t.setEncoding( QTextStream::UnicodeUTF8 );
651
652 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
653 KABC::Addressee a = mAddressBook->findByUid( *it );
654
655 if ( a.isEmpty() )
656 continue;
657
658 if (description.isEmpty())
659 description = a.formattedName();
660
661 QString vcard;
662 converter.addresseeToVCard( a, vcard );
663 t << vcard;
664
665 }
666 }
667
668 outFile.close();
669
670 Ir *ir = new Ir( this );
671 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
672 ir->send( fileName, description, "text/x-vCard" );
673
674}
675
676void KABCore::beamDone( Ir *ir )
677{
678 delete ir;
679}
680
681
567void KABCore::browse( const QString& url ) 682void KABCore::browse( const QString& url )
568{ 683{
569#ifndef KAB_EMBEDDED 684#ifndef KAB_EMBEDDED
570 kapp->invokeBrowser( url ); 685 kapp->invokeBrowser( url );
571#else //KAB_EMBEDDED 686#else //KAB_EMBEDDED
572 qDebug("KABCore::browse must be fixed"); 687 qDebug("KABCore::browse must be fixed");
573#endif //KAB_EMBEDDED 688#endif //KAB_EMBEDDED
574} 689}
575 690
576void KABCore::selectAllContacts() 691void KABCore::selectAllContacts()
577{ 692{
578 mViewManager->setSelected( QString::null, true ); 693 mViewManager->setSelected( QString::null, true );
579} 694}
580 695
581void KABCore::deleteContacts() 696void KABCore::deleteContacts()
582{ 697{
583 QStringList uidList = mViewManager->selectedUids(); 698 QStringList uidList = mViewManager->selectedUids();
584 deleteContacts( uidList ); 699 deleteContacts( uidList );
585} 700}
586 701
587void KABCore::deleteContacts( const QStringList &uids ) 702void KABCore::deleteContacts( const QStringList &uids )
588{ 703{
589 if ( uids.count() > 0 ) { 704 if ( uids.count() > 0 ) {
590 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 705 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
591 UndoStack::instance()->push( command ); 706 UndoStack::instance()->push( command );
592 RedoStack::instance()->clear(); 707 RedoStack::instance()->clear();
593 708
594 // now if we deleted anything, refresh 709 // now if we deleted anything, refresh
595 setContactSelected( QString::null ); 710 setContactSelected( QString::null );
596 setModified( true ); 711 setModified( true );
597 } 712 }
598} 713}
599 714
600void KABCore::copyContacts() 715void KABCore::copyContacts()
601{ 716{
602 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 717 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
603 718
604 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 719 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
605 720
606 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 721 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
607 722
608 QClipboard *cb = QApplication::clipboard(); 723 QClipboard *cb = QApplication::clipboard();
609 cb->setText( clipText ); 724 cb->setText( clipText );
610} 725}
611 726
612void KABCore::cutContacts() 727void KABCore::cutContacts()
613{ 728{
614 QStringList uidList = mViewManager->selectedUids(); 729 QStringList uidList = mViewManager->selectedUids();
615 730
616//US if ( uidList.size() > 0 ) { 731//US if ( uidList.size() > 0 ) {
617 if ( uidList.count() > 0 ) { 732 if ( uidList.count() > 0 ) {
618 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 733 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
619 UndoStack::instance()->push( command ); 734 UndoStack::instance()->push( command );
620 RedoStack::instance()->clear(); 735 RedoStack::instance()->clear();
621 736
622 setModified( true ); 737 setModified( true );
623 } 738 }
624} 739}
625 740
626void KABCore::pasteContacts() 741void KABCore::pasteContacts()
627{ 742{
628 QClipboard *cb = QApplication::clipboard(); 743 QClipboard *cb = QApplication::clipboard();
629 744
630 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 745 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
631 746
632 pasteContacts( list ); 747 pasteContacts( list );
633} 748}
634 749
635void KABCore::pasteContacts( KABC::Addressee::List &list ) 750void KABCore::pasteContacts( KABC::Addressee::List &list )
636{ 751{
637 KABC::Resource *resource = requestResource( this ); 752 KABC::Resource *resource = requestResource( this );
638 KABC::Addressee::List::Iterator it; 753 KABC::Addressee::List::Iterator it;
639 for ( it = list.begin(); it != list.end(); ++it ) 754 for ( it = list.begin(); it != list.end(); ++it )
640 (*it).setResource( resource ); 755 (*it).setResource( resource );
641 756
642 PwPasteCommand *command = new PwPasteCommand( this, list ); 757 PwPasteCommand *command = new PwPasteCommand( this, list );
643 UndoStack::instance()->push( command ); 758 UndoStack::instance()->push( command );
644 RedoStack::instance()->clear(); 759 RedoStack::instance()->clear();
645 760
646 setModified( true ); 761 setModified( true );
647} 762}
648 763
649void KABCore::setWhoAmI() 764void KABCore::setWhoAmI()
650{ 765{
651 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 766 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
652 767
653 if ( addrList.count() > 1 ) { 768 if ( addrList.count() > 1 ) {
654 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 769 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
655 return; 770 return;
656 } 771 }
657 772
658 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 773 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
659 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 774 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
660 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 775 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
661} 776}
662 777
663void KABCore::setCategories() 778void KABCore::setCategories()
664{ 779{
665 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 780 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
666 if ( !dlg.exec() ) 781 if ( !dlg.exec() )
667 return; 782 return;
668 783
669 bool merge = false; 784 bool merge = false;
670 QString msg = i18n( "Merge with existing categories?" ); 785 QString msg = i18n( "Merge with existing categories?" );
671 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 786 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
672 merge = true; 787 merge = true;
673 788
674 QStringList categories = dlg.selectedCategories(); 789 QStringList categories = dlg.selectedCategories();
675 790
676 QStringList uids = mViewManager->selectedUids(); 791 QStringList uids = mViewManager->selectedUids();
677 QStringList::Iterator it; 792 QStringList::Iterator it;
678 for ( it = uids.begin(); it != uids.end(); ++it ) { 793 for ( it = uids.begin(); it != uids.end(); ++it ) {
679 KABC::Addressee addr = mAddressBook->findByUid( *it ); 794 KABC::Addressee addr = mAddressBook->findByUid( *it );
680 if ( !addr.isEmpty() ) { 795 if ( !addr.isEmpty() ) {
681 if ( !merge ) 796 if ( !merge )
682 addr.setCategories( categories ); 797 addr.setCategories( categories );
683 else { 798 else {
684 QStringList addrCategories = addr.categories(); 799 QStringList addrCategories = addr.categories();
685 QStringList::Iterator catIt; 800 QStringList::Iterator catIt;
686 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 801 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
687 if ( !addrCategories.contains( *catIt ) ) 802 if ( !addrCategories.contains( *catIt ) )
688 addrCategories.append( *catIt ); 803 addrCategories.append( *catIt );
689 } 804 }
690 addr.setCategories( addrCategories ); 805 addr.setCategories( addrCategories );
691 } 806 }
692 807
693 mAddressBook->insertAddressee( addr ); 808 mAddressBook->insertAddressee( addr );
694 } 809 }
695 } 810 }
696 811
697 if ( uids.count() > 0 ) 812 if ( uids.count() > 0 )
698 setModified( true ); 813 setModified( true );
699} 814}
700 815
701void KABCore::setSearchFields( const KABC::Field::List &fields ) 816void KABCore::setSearchFields( const KABC::Field::List &fields )
702{ 817{
703 mIncSearchWidget->setFields( fields ); 818 mIncSearchWidget->setFields( fields );
704} 819}
705 820
706void KABCore::incrementalSearch( const QString& text ) 821void KABCore::incrementalSearch( const QString& text )
707{ 822{
708 mViewManager->setSelected( QString::null, false ); 823 mViewManager->setSelected( QString::null, false );
709 824
710 if ( !text.isEmpty() ) { 825 if ( !text.isEmpty() ) {
711 KABC::Field *field = mIncSearchWidget->currentField(); 826 KABC::Field *field = mIncSearchWidget->currentField();
712 827
713 QString pattern = text.lower(); 828 QString pattern = text.lower();
714 829
715#if 1 //KDE_VERSION >= 319 830#if 1 //KDE_VERSION >= 319
716 KABC::AddresseeList list( mAddressBook->allAddressees() ); 831 KABC::AddresseeList list( mAddressBook->allAddressees() );
717 if ( field ) { 832 if ( field ) {
718 list.sortByField( field ); 833 list.sortByField( field );
719 KABC::AddresseeList::Iterator it; 834 KABC::AddresseeList::Iterator it;
720 for ( it = list.begin(); it != list.end(); ++it ) { 835 for ( it = list.begin(); it != list.end(); ++it ) {
721 if ( field->value( *it ).lower().startsWith( pattern ) ) { 836 if ( field->value( *it ).lower().startsWith( pattern ) ) {
722 mViewManager->setSelected( (*it).uid(), true ); 837 mViewManager->setSelected( (*it).uid(), true );
723 return; 838 return;
724 } 839 }
725 } 840 }
726 } else { 841 } else {
727 KABC::AddresseeList::Iterator it; 842 KABC::AddresseeList::Iterator it;
728 for ( it = list.begin(); it != list.end(); ++it ) { 843 for ( it = list.begin(); it != list.end(); ++it ) {
729 KABC::Field::List fieldList = mIncSearchWidget->fields(); 844 KABC::Field::List fieldList = mIncSearchWidget->fields();
730 KABC::Field::List::ConstIterator fieldIt; 845 KABC::Field::List::ConstIterator fieldIt;
731 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 846 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
732 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 847 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
733 mViewManager->setSelected( (*it).uid(), true ); 848 mViewManager->setSelected( (*it).uid(), true );
734 return; 849 return;
735 } 850 }
736 } 851 }
737 } 852 }
738 } 853 }
739#else 854#else
740 KABC::AddressBook::Iterator it; 855 KABC::AddressBook::Iterator it;
741 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 856 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
742 if ( field ) { 857 if ( field ) {
743 if ( field->value( *it ).lower().startsWith( pattern ) ) { 858 if ( field->value( *it ).lower().startsWith( pattern ) ) {
744 mViewManager->setSelected( (*it).uid(), true ); 859 mViewManager->setSelected( (*it).uid(), true );
745 return; 860 return;
746 } 861 }
747 } else { 862 } else {
748 KABC::Field::List fieldList = mIncSearchWidget->fields(); 863 KABC::Field::List fieldList = mIncSearchWidget->fields();
749 KABC::Field::List::ConstIterator fieldIt; 864 KABC::Field::List::ConstIterator fieldIt;
750 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 865 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
751 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 866 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
752 mViewManager->setSelected( (*it).uid(), true ); 867 mViewManager->setSelected( (*it).uid(), true );
753 return; 868 return;
754 } 869 }
755 } 870 }
756 } 871 }
757 } 872 }
758#endif 873#endif
759 } 874 }
760} 875}
761 876
762void KABCore::setModified() 877void KABCore::setModified()
763{ 878{
764 setModified( true ); 879 setModified( true );
765} 880}
766 881
767void KABCore::setModifiedWOrefresh() 882void KABCore::setModifiedWOrefresh()
768{ 883{
769 // qDebug("KABCore::setModifiedWOrefresh() "); 884 // qDebug("KABCore::setModifiedWOrefresh() ");
770 mModified = true; 885 mModified = true;
771 mActionSave->setEnabled( mModified ); 886 mActionSave->setEnabled( mModified );
772#ifdef DESKTOP_VERSION 887#ifdef DESKTOP_VERSION
773 mDetails->refreshView(); 888 mDetails->refreshView();
774#endif 889#endif
775 890
776} 891}
777void KABCore::setModified( bool modified ) 892void KABCore::setModified( bool modified )
778{ 893{
779 mModified = modified; 894 mModified = modified;
780 mActionSave->setEnabled( mModified ); 895 mActionSave->setEnabled( mModified );
781 896
782 if ( modified ) 897 if ( modified )
783 mJumpButtonBar->recreateButtons(); 898 mJumpButtonBar->recreateButtons();
784 899
785 mViewManager->refreshView(); 900 mViewManager->refreshView();
786 mDetails->refreshView(); 901 mDetails->refreshView();
787 902
788} 903}
789 904
790bool KABCore::modified() const 905bool KABCore::modified() const
791{ 906{
792 return mModified; 907 return mModified;
793} 908}
794 909
795void KABCore::contactModified( const KABC::Addressee &addr ) 910void KABCore::contactModified( const KABC::Addressee &addr )
796{ 911{
797 912
798 Command *command = 0; 913 Command *command = 0;
799 QString uid; 914 QString uid;
800 915
801 // check if it exists already 916 // check if it exists already
802 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 917 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
803 if ( origAddr.isEmpty() ) 918 if ( origAddr.isEmpty() )
804 command = new PwNewCommand( mAddressBook, addr ); 919 command = new PwNewCommand( mAddressBook, addr );
805 else { 920 else {
806 command = new PwEditCommand( mAddressBook, origAddr, addr ); 921 command = new PwEditCommand( mAddressBook, origAddr, addr );
807 uid = addr.uid(); 922 uid = addr.uid();
808 } 923 }
809 924
810 UndoStack::instance()->push( command ); 925 UndoStack::instance()->push( command );
811 RedoStack::instance()->clear(); 926 RedoStack::instance()->clear();
812 927
813 setModified( true ); 928 setModified( true );
814} 929}
815 930
816void KABCore::newContact() 931void KABCore::newContact()
817{ 932{
818 933
819 934
820 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 935 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
821 936
822 QPtrList<KRES::Resource> kresResources; 937 QPtrList<KRES::Resource> kresResources;
823 QPtrListIterator<KABC::Resource> it( kabcResources ); 938 QPtrListIterator<KABC::Resource> it( kabcResources );
824 KABC::Resource *resource; 939 KABC::Resource *resource;
825 while ( ( resource = it.current() ) != 0 ) { 940 while ( ( resource = it.current() ) != 0 ) {
826 ++it; 941 ++it;
827 if ( !resource->readOnly() ) { 942 if ( !resource->readOnly() ) {
828 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 943 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
829 if ( res ) 944 if ( res )
830 kresResources.append( res ); 945 kresResources.append( res );
831 } 946 }
832 } 947 }
833 948
834 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 949 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
835 resource = static_cast<KABC::Resource*>( res ); 950 resource = static_cast<KABC::Resource*>( res );
836 951
837 if ( resource ) { 952 if ( resource ) {
838 KABC::Addressee addr; 953 KABC::Addressee addr;
839 addr.setResource( resource ); 954 addr.setResource( resource );
840 mEditorDialog->setAddressee( addr ); 955 mEditorDialog->setAddressee( addr );
841 KApplication::execDialog ( mEditorDialog ); 956 KApplication::execDialog ( mEditorDialog );
842 957
843 } else 958 } else
844 return; 959 return;
845 960
846 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 961 // mEditorDict.insert( dialog->addressee().uid(), dialog );
847 962
848 963
849} 964}
850 965
851void KABCore::addEmail( QString aStr ) 966void KABCore::addEmail( QString aStr )
852{ 967{
853#ifndef KAB_EMBEDDED 968#ifndef KAB_EMBEDDED
854 QString fullName, email; 969 QString fullName, email;
855 970
856 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 971 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
857 972
858 // Try to lookup the addressee matching the email address 973 // Try to lookup the addressee matching the email address
859 bool found = false; 974 bool found = false;
860 QStringList emailList; 975 QStringList emailList;
861 KABC::AddressBook::Iterator it; 976 KABC::AddressBook::Iterator it;
862 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 977 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
863 emailList = (*it).emails(); 978 emailList = (*it).emails();
864 if ( emailList.contains( email ) > 0 ) { 979 if ( emailList.contains( email ) > 0 ) {
865 found = true; 980 found = true;
866 (*it).setNameFromString( fullName ); 981 (*it).setNameFromString( fullName );
867 editContact( (*it).uid() ); 982 editContact( (*it).uid() );
868 } 983 }
869 } 984 }
870 985
871 if ( !found ) { 986 if ( !found ) {
872 KABC::Addressee addr; 987 KABC::Addressee addr;
873 addr.setNameFromString( fullName ); 988 addr.setNameFromString( fullName );
874 addr.insertEmail( email, true ); 989 addr.insertEmail( email, true );
875 990
876 mAddressBook->insertAddressee( addr ); 991 mAddressBook->insertAddressee( addr );
877 mViewManager->refreshView( addr.uid() ); 992 mViewManager->refreshView( addr.uid() );
878 editContact( addr.uid() ); 993 editContact( addr.uid() );
879 } 994 }
880#else //KAB_EMBEDDED 995#else //KAB_EMBEDDED
881 qDebug("KABCore::addEmail finsih method"); 996 qDebug("KABCore::addEmail finsih method");
882#endif //KAB_EMBEDDED 997#endif //KAB_EMBEDDED
883} 998}
884 999
885void KABCore::importVCard( const KURL &url, bool showPreview ) 1000void KABCore::importVCard( const KURL &url, bool showPreview )
886{ 1001{
887 mXXPortManager->importVCard( url, showPreview ); 1002 mXXPortManager->importVCard( url, showPreview );
888} 1003}
889void KABCore::importFromOL() 1004void KABCore::importFromOL()
890{ 1005{
891#ifdef _WIN32_ 1006#ifdef _WIN32_
892 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1007 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
893 idgl->exec(); 1008 idgl->exec();
894 KABC::Addressee::List list = idgl->getAddressList(); 1009 KABC::Addressee::List list = idgl->getAddressList();
895 if ( list.count() > 0 ) { 1010 if ( list.count() > 0 ) {
896 KABC::Addressee::List listNew; 1011 KABC::Addressee::List listNew;
897 KABC::Addressee::List listExisting; 1012 KABC::Addressee::List listExisting;
898 KABC::Addressee::List::Iterator it; 1013 KABC::Addressee::List::Iterator it;
899 KABC::AddressBook::Iterator iter; 1014 KABC::AddressBook::Iterator iter;
900 for ( it = list.begin(); it != list.end(); ++it ) { 1015 for ( it = list.begin(); it != list.end(); ++it ) {
901 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1016 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
902 listNew.append( (*it) ); 1017 listNew.append( (*it) );
903 else 1018 else
904 listExisting.append( (*it) ); 1019 listExisting.append( (*it) );
905 } 1020 }
906 if ( listExisting.count() > 0 ) 1021 if ( listExisting.count() > 0 )
907 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1022 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
908 if ( listNew.count() > 0 ) { 1023 if ( listNew.count() > 0 ) {
909 pasteWithNewUid = false; 1024 pasteWithNewUid = false;
910 pasteContacts( listNew ); 1025 pasteContacts( listNew );
911 pasteWithNewUid = true; 1026 pasteWithNewUid = true;
912 } 1027 }
913 } 1028 }
914 delete idgl; 1029 delete idgl;
915#endif 1030#endif
916} 1031}
917 1032
918void KABCore::importVCard( const QString &vCard, bool showPreview ) 1033void KABCore::importVCard( const QString &vCard, bool showPreview )
919{ 1034{
920 mXXPortManager->importVCard( vCard, showPreview ); 1035 mXXPortManager->importVCard( vCard, showPreview );
921} 1036}
922 1037
923//US added a second method without defaultparameter 1038//US added a second method without defaultparameter
924void KABCore::editContact2() { 1039void KABCore::editContact2() {
925 editContact( QString::null ); 1040 editContact( QString::null );
926} 1041}
927 1042
928void KABCore::editContact( const QString &uid ) 1043void KABCore::editContact( const QString &uid )
929{ 1044{
930 1045
931 if ( mExtensionManager->isQuickEditVisible() ) 1046 if ( mExtensionManager->isQuickEditVisible() )
932 return; 1047 return;
933 1048
934 // First, locate the contact entry 1049 // First, locate the contact entry
935 QString localUID = uid; 1050 QString localUID = uid;
936 if ( localUID.isNull() ) { 1051 if ( localUID.isNull() ) {
937 QStringList uidList = mViewManager->selectedUids(); 1052 QStringList uidList = mViewManager->selectedUids();
938 if ( uidList.count() > 0 ) 1053 if ( uidList.count() > 0 )
939 localUID = *( uidList.at( 0 ) ); 1054 localUID = *( uidList.at( 0 ) );
940 } 1055 }
941 1056
942 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1057 KABC::Addressee addr = mAddressBook->findByUid( localUID );
943 if ( !addr.isEmpty() ) { 1058 if ( !addr.isEmpty() ) {
944 mEditorDialog->setAddressee( addr ); 1059 mEditorDialog->setAddressee( addr );
945 KApplication::execDialog ( mEditorDialog ); 1060 KApplication::execDialog ( mEditorDialog );
946 } 1061 }
947} 1062}
948 1063
949void KABCore::save() 1064void KABCore::save()
950{ 1065{
951 if ( !mModified ) 1066 if ( !mModified )
952 return; 1067 return;
953 QString text = i18n( "There was an error while attempting to save\n the " 1068 QString text = i18n( "There was an error while attempting to save\n the "
954 "address book. Please check that some \nother application is " 1069 "address book. Please check that some \nother application is "
955 "not using it. " ); 1070 "not using it. " );
956 statusMessage(i18n("Saving addressbook ... ")); 1071 statusMessage(i18n("Saving addressbook ... "));
957#ifndef KAB_EMBEDDED 1072#ifndef KAB_EMBEDDED
958 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1073 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
959 if ( !b || !b->save() ) { 1074 if ( !b || !b->save() ) {
960 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1075 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
961 } 1076 }
962#else //KAB_EMBEDDED 1077#else //KAB_EMBEDDED
963 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1078 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
964 if ( !b || !b->save() ) { 1079 if ( !b || !b->save() ) {
965 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1080 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
966 } 1081 }
967#endif //KAB_EMBEDDED 1082#endif //KAB_EMBEDDED
968 1083
969 statusMessage(i18n("Addressbook saved!")); 1084 statusMessage(i18n("Addressbook saved!"));
970 setModified( false ); 1085 setModified( false );
971} 1086}
972 1087
973void KABCore::statusMessage(QString mess , int time ) 1088void KABCore::statusMessage(QString mess , int time )
974{ 1089{
975 //topLevelWidget()->setCaption( mess ); 1090 //topLevelWidget()->setCaption( mess );
976 // pending setting timer to revome message 1091 // pending setting timer to revome message
977} 1092}
978void KABCore::undo() 1093void KABCore::undo()
979{ 1094{
980 UndoStack::instance()->undo(); 1095 UndoStack::instance()->undo();
981 1096
982 // Refresh the view 1097 // Refresh the view
983 mViewManager->refreshView(); 1098 mViewManager->refreshView();
984} 1099}
985 1100
986void KABCore::redo() 1101void KABCore::redo()
987{ 1102{
988 RedoStack::instance()->redo(); 1103 RedoStack::instance()->redo();
989 1104
990 // Refresh the view 1105 // Refresh the view
991 mViewManager->refreshView(); 1106 mViewManager->refreshView();
992} 1107}
993 1108
994void KABCore::setJumpButtonBarVisible( bool visible ) 1109void KABCore::setJumpButtonBarVisible( bool visible )
995{ 1110{
996 if ( visible ) 1111 if ( visible )
997 mJumpButtonBar->show(); 1112 mJumpButtonBar->show();
998 else 1113 else
999 mJumpButtonBar->hide(); 1114 mJumpButtonBar->hide();
1000} 1115}
1001void KABCore::setDetailsToState() 1116void KABCore::setDetailsToState()
1002{ 1117{
1003 setDetailsVisible( mActionDetails->isChecked() ); 1118 setDetailsVisible( mActionDetails->isChecked() );
1004} 1119}
1005 1120
1006void KABCore::setDetailsVisible( bool visible ) 1121void KABCore::setDetailsVisible( bool visible )
1007{ 1122{
1008 if ( visible ) 1123 if ( visible )
1009 mDetails->show(); 1124 mDetails->show();
1010 else 1125 else
1011 mDetails->hide(); 1126 mDetails->hide();
1012} 1127}
1013 1128
1014void KABCore::extensionModified( const KABC::Addressee::List &list ) 1129void KABCore::extensionModified( const KABC::Addressee::List &list )
1015{ 1130{
1016 1131
1017 if ( list.count() != 0 ) { 1132 if ( list.count() != 0 ) {
1018 KABC::Addressee::List::ConstIterator it; 1133 KABC::Addressee::List::ConstIterator it;
1019 for ( it = list.begin(); it != list.end(); ++it ) 1134 for ( it = list.begin(); it != list.end(); ++it )
1020 mAddressBook->insertAddressee( *it ); 1135 mAddressBook->insertAddressee( *it );
1021 if ( list.count() > 1 ) 1136 if ( list.count() > 1 )
1022 setModified(); 1137 setModified();
1023 else 1138 else
1024 setModifiedWOrefresh(); 1139 setModifiedWOrefresh();
1025 } 1140 }
1026 if ( list.count() == 0 ) 1141 if ( list.count() == 0 )
1027 mViewManager->refreshView(); 1142 mViewManager->refreshView();
1028 else 1143 else
1029 mViewManager->refreshView( list[ 0 ].uid() ); 1144 mViewManager->refreshView( list[ 0 ].uid() );
1030 1145
1031 1146
1032 1147
1033} 1148}
1034 1149
1035QString KABCore::getNameByPhone( const QString &phone ) 1150QString KABCore::getNameByPhone( const QString &phone )
1036{ 1151{
1037#ifndef KAB_EMBEDDED 1152#ifndef KAB_EMBEDDED
1038 QRegExp r( "[/*/-/ ]" ); 1153 QRegExp r( "[/*/-/ ]" );
1039 QString localPhone( phone ); 1154 QString localPhone( phone );
1040 1155
1041 bool found = false; 1156 bool found = false;
1042 QString ownerName = ""; 1157 QString ownerName = "";
1043 KABC::AddressBook::Iterator iter; 1158 KABC::AddressBook::Iterator iter;
1044 KABC::PhoneNumber::List::Iterator phoneIter; 1159 KABC::PhoneNumber::List::Iterator phoneIter;
1045 KABC::PhoneNumber::List phoneList; 1160 KABC::PhoneNumber::List phoneList;
1046 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1161 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1047 phoneList = (*iter).phoneNumbers(); 1162 phoneList = (*iter).phoneNumbers();
1048 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1163 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1049 ++phoneIter) { 1164 ++phoneIter) {
1050 // Get rid of separator chars so just the numbers are compared. 1165 // Get rid of separator chars so just the numbers are compared.
1051 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1166 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1052 ownerName = (*iter).formattedName(); 1167 ownerName = (*iter).formattedName();
1053 found = true; 1168 found = true;
1054 } 1169 }
1055 } 1170 }
1056 } 1171 }
1057 1172
1058 return ownerName; 1173 return ownerName;
1059#else //KAB_EMBEDDED 1174#else //KAB_EMBEDDED
1060 qDebug("KABCore::getNameByPhone finsih method"); 1175 qDebug("KABCore::getNameByPhone finsih method");
1061 return ""; 1176 return "";
1062#endif //KAB_EMBEDDED 1177#endif //KAB_EMBEDDED
1063 1178
1064} 1179}
1065 1180
1066void KABCore::openConfigDialog() 1181void KABCore::openConfigDialog()
1067{ 1182{
1068 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1183 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1069 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1184 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1070 ConfigureDialog->addModule(kabcfg ); 1185 ConfigureDialog->addModule(kabcfg );
1071 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1186 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1072 this, SLOT( configurationChanged() ) ); 1187 this, SLOT( configurationChanged() ) );
1073 connect( ConfigureDialog, SIGNAL( okClicked() ), 1188 connect( ConfigureDialog, SIGNAL( okClicked() ),
1074 this, SLOT( configurationChanged() ) ); 1189 this, SLOT( configurationChanged() ) );
1075 saveSettings(); 1190 saveSettings();
1076 ConfigureDialog->showMaximized(); 1191 ConfigureDialog->showMaximized();
1077 if ( ConfigureDialog->exec() ) 1192 if ( ConfigureDialog->exec() )
1078 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); 1193 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") );
1079 delete ConfigureDialog; 1194 delete ConfigureDialog;
1080} 1195}
1081 1196
1082void KABCore::openLDAPDialog() 1197void KABCore::openLDAPDialog()
1083{ 1198{
1084#ifndef KAB_EMBEDDED 1199#ifndef KAB_EMBEDDED
1085 if ( !mLdapSearchDialog ) { 1200 if ( !mLdapSearchDialog ) {
1086 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1201 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1087 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1202 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1088 SLOT( refreshView() ) ); 1203 SLOT( refreshView() ) );
1089 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1204 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1090 SLOT( setModified() ) ); 1205 SLOT( setModified() ) );
1091 } else 1206 } else
1092 mLdapSearchDialog->restoreSettings(); 1207 mLdapSearchDialog->restoreSettings();
1093 1208
1094 if ( mLdapSearchDialog->isOK() ) 1209 if ( mLdapSearchDialog->isOK() )
1095 mLdapSearchDialog->exec(); 1210 mLdapSearchDialog->exec();
1096#else //KAB_EMBEDDED 1211#else //KAB_EMBEDDED
1097 qDebug("KABCore::openLDAPDialog() finsih method"); 1212 qDebug("KABCore::openLDAPDialog() finsih method");
1098#endif //KAB_EMBEDDED 1213#endif //KAB_EMBEDDED
1099} 1214}
1100 1215
1101void KABCore::print() 1216void KABCore::print()
1102{ 1217{
1103#ifndef KAB_EMBEDDED 1218#ifndef KAB_EMBEDDED
1104 KPrinter printer; 1219 KPrinter printer;
1105 if ( !printer.setup( this ) ) 1220 if ( !printer.setup( this ) )
1106 return; 1221 return;
1107 1222
1108 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1223 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1109 mViewManager->selectedUids(), this ); 1224 mViewManager->selectedUids(), this );
1110 1225
1111 wizard.exec(); 1226 wizard.exec();
1112#else //KAB_EMBEDDED 1227#else //KAB_EMBEDDED
1113 qDebug("KABCore::print() finsih method"); 1228 qDebug("KABCore::print() finsih method");
1114#endif //KAB_EMBEDDED 1229#endif //KAB_EMBEDDED
1115 1230
1116} 1231}
1117 1232
1118 1233
1119void KABCore::addGUIClient( KXMLGUIClient *client ) 1234void KABCore::addGUIClient( KXMLGUIClient *client )
1120{ 1235{
1121 if ( mGUIClient ) 1236 if ( mGUIClient )
1122 mGUIClient->insertChildClient( client ); 1237 mGUIClient->insertChildClient( client );
1123 else 1238 else
1124 KMessageBox::error( this, "no KXMLGUICLient"); 1239 KMessageBox::error( this, "no KXMLGUICLient");
1125} 1240}
1126 1241
1127 1242
1128void KABCore::configurationChanged() 1243void KABCore::configurationChanged()
1129{ 1244{
1130 mExtensionManager->reconfigure(); 1245 mExtensionManager->reconfigure();
1131} 1246}
1132 1247
1133void KABCore::addressBookChanged() 1248void KABCore::addressBookChanged()
1134{ 1249{
1135/*US 1250/*US
1136 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1251 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1137 while ( it.current() ) { 1252 while ( it.current() ) {
1138 if ( it.current()->dirty() ) { 1253 if ( it.current()->dirty() ) {
1139 QString text = i18n( "Data has been changed externally. Unsaved " 1254 QString text = i18n( "Data has been changed externally. Unsaved "
1140 "changes will be lost." ); 1255 "changes will be lost." );
1141 KMessageBox::information( this, text ); 1256 KMessageBox::information( this, text );
1142 } 1257 }
1143 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1258 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1144 ++it; 1259 ++it;
1145 } 1260 }
1146*/ 1261*/
1147 if (mEditorDialog) 1262 if (mEditorDialog)
1148 { 1263 {
1149 if (mEditorDialog->dirty()) 1264 if (mEditorDialog->dirty())
1150 { 1265 {
1151 QString text = i18n( "Data has been changed externally. Unsaved " 1266 QString text = i18n( "Data has been changed externally. Unsaved "
1152 "changes will be lost." ); 1267 "changes will be lost." );
1153 KMessageBox::information( this, text ); 1268 KMessageBox::information( this, text );
1154 } 1269 }
1155 QString currentuid = mEditorDialog->addressee().uid(); 1270 QString currentuid = mEditorDialog->addressee().uid();
1156 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1271 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1157 } 1272 }
1158 mViewManager->refreshView(); 1273 mViewManager->refreshView();
1159// mDetails->refreshView(); 1274// mDetails->refreshView();
1160 1275
1161 1276
1162} 1277}
1163 1278
1164AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1279AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1165 const char *name ) 1280 const char *name )
1166{ 1281{
1167 1282
1168 if ( mEditorDialog == 0 ) { 1283 if ( mEditorDialog == 0 ) {
1169 mEditorDialog = new AddresseeEditorDialog( this, parent, 1284 mEditorDialog = new AddresseeEditorDialog( this, parent,
1170 name ? name : "editorDialog" ); 1285 name ? name : "editorDialog" );
1171 1286
1172 1287
1173 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1288 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1174 SLOT( contactModified( const KABC::Addressee& ) ) ); 1289 SLOT( contactModified( const KABC::Addressee& ) ) );
1175 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1290 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1176 // SLOT( slotEditorDestroyed( const QString& ) ) ); 1291 // SLOT( slotEditorDestroyed( const QString& ) ) );
1177 } 1292 }
1178 1293
1179 return mEditorDialog; 1294 return mEditorDialog;
1180} 1295}
1181 1296
1182void KABCore::slotEditorDestroyed( const QString &uid ) 1297void KABCore::slotEditorDestroyed( const QString &uid )
1183{ 1298{
1184 //mEditorDict.remove( uid ); 1299 //mEditorDict.remove( uid );
1185} 1300}
1186 1301
1187void KABCore::initGUI() 1302void KABCore::initGUI()
1188{ 1303{
1189#ifndef KAB_EMBEDDED 1304#ifndef KAB_EMBEDDED
1190 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1305 QHBoxLayout *topLayout = new QHBoxLayout( this );
1191 topLayout->setSpacing( KDialogBase::spacingHint() ); 1306 topLayout->setSpacing( KDialogBase::spacingHint() );
1192 1307
1193 mExtensionBarSplitter = new QSplitter( this ); 1308 mExtensionBarSplitter = new QSplitter( this );
1194 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1309 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1195 1310
1196 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1311 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1197 1312
1198 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1313 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1199 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1314 mIncSearchWidget = new IncSearchWidget( viewSpace );
1200 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1315 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1201 SLOT( incrementalSearch( const QString& ) ) ); 1316 SLOT( incrementalSearch( const QString& ) ) );
1202 1317
1203 mViewManager = new ViewManager( this, viewSpace ); 1318 mViewManager = new ViewManager( this, viewSpace );
1204 viewSpace->setStretchFactor( mViewManager, 1 ); 1319 viewSpace->setStretchFactor( mViewManager, 1 );
1205 1320
1206 mDetails = new ViewContainer( mDetailsSplitter ); 1321 mDetails = new ViewContainer( mDetailsSplitter );
1207 1322
1208 mJumpButtonBar = new JumpButtonBar( this, this ); 1323 mJumpButtonBar = new JumpButtonBar( this, this );
1209 1324
1210 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1325 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1211 1326
1212 topLayout->addWidget( mExtensionBarSplitter ); 1327 topLayout->addWidget( mExtensionBarSplitter );
1213 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1328 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1214 topLayout->addWidget( mJumpButtonBar ); 1329 topLayout->addWidget( mJumpButtonBar );
1215 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1330 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1216 1331
1217 mXXPortManager = new XXPortManager( this, this ); 1332 mXXPortManager = new XXPortManager( this, this );
1218 1333
1219#else //KAB_EMBEDDED 1334#else //KAB_EMBEDDED
1220 //US initialize viewMenu before settingup viewmanager. 1335 //US initialize viewMenu before settingup viewmanager.
1221 // Viewmanager needs this menu to plugin submenues. 1336 // Viewmanager needs this menu to plugin submenues.
1222 viewMenu = new QPopupMenu( this ); 1337 viewMenu = new QPopupMenu( this );
1223 settingsMenu = new QPopupMenu( this ); 1338 settingsMenu = new QPopupMenu( this );
1224 //filterMenu = new QPopupMenu( this ); 1339 //filterMenu = new QPopupMenu( this );
1225 ImportMenu = new QPopupMenu( this ); 1340 ImportMenu = new QPopupMenu( this );
1226 ExportMenu = new QPopupMenu( this ); 1341 ExportMenu = new QPopupMenu( this );
1227 1342
1228 changeMenu= new QPopupMenu( this ); 1343 changeMenu= new QPopupMenu( this );
1229 1344
1230//US since we have no splitter for the embedded system, setup 1345//US since we have no splitter for the embedded system, setup
1231// a layout with two frames. One left and one right. 1346// a layout with two frames. One left and one right.
1232 1347
1233 QBoxLayout *topLayout; 1348 QBoxLayout *topLayout;
1234 1349
1235 // = new QHBoxLayout( this ); 1350 // = new QHBoxLayout( this );
1236// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1351// QBoxLayout *topLayout = (QBoxLayout*)layout();
1237 1352
1238// QWidget *mainBox = new QWidget( this ); 1353// QWidget *mainBox = new QWidget( this );
1239// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1354// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1240 1355
1241#ifdef DESKTOP_VERSION 1356#ifdef DESKTOP_VERSION
1242 topLayout = new QHBoxLayout( this ); 1357 topLayout = new QHBoxLayout( this );
1243 1358
1244 1359
1245 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1360 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1246 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1361 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1247 1362
1248 topLayout->addWidget(mMiniSplitter ); 1363 topLayout->addWidget(mMiniSplitter );
1249 1364
1250 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1365 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1251 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1366 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1252 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1367 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1253 mDetails = new ViewContainer( mMiniSplitter ); 1368 mDetails = new ViewContainer( mMiniSplitter );
1254 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1369 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1255#else 1370#else
1256 if ( QApplication::desktop()->width() > 480 ) { 1371 if ( QApplication::desktop()->width() > 480 ) {
1257 topLayout = new QHBoxLayout( this ); 1372 topLayout = new QHBoxLayout( this );
1258 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1373 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1259 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1374 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1260 } else { 1375 } else {
1261 1376
1262 topLayout = new QHBoxLayout( this ); 1377 topLayout = new QHBoxLayout( this );
1263 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1378 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1264 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1379 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1265 } 1380 }
1266 1381
1267 topLayout->addWidget(mMiniSplitter ); 1382 topLayout->addWidget(mMiniSplitter );
1268 mViewManager = new ViewManager( this, mMiniSplitter ); 1383 mViewManager = new ViewManager( this, mMiniSplitter );
1269 mDetails = new ViewContainer( mMiniSplitter ); 1384 mDetails = new ViewContainer( mMiniSplitter );
1270 1385
1271 1386
1272 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1387 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1273#endif 1388#endif
1274 //eh->hide(); 1389 //eh->hide();
1275 // topLayout->addWidget(mExtensionManager ); 1390 // topLayout->addWidget(mExtensionManager );
1276 1391
1277 1392
1278/*US 1393/*US
1279#ifndef KAB_NOSPLITTER 1394#ifndef KAB_NOSPLITTER
1280 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1395 QHBoxLayout *topLayout = new QHBoxLayout( this );
1281//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1396//US topLayout->setSpacing( KDialogBase::spacingHint() );
1282 topLayout->setSpacing( 10 ); 1397 topLayout->setSpacing( 10 );
1283 1398
1284 mDetailsSplitter = new QSplitter( this ); 1399 mDetailsSplitter = new QSplitter( this );
1285 1400
1286 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1401 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1287 1402
1288 mViewManager = new ViewManager( this, viewSpace ); 1403 mViewManager = new ViewManager( this, viewSpace );
1289 viewSpace->setStretchFactor( mViewManager, 1 ); 1404 viewSpace->setStretchFactor( mViewManager, 1 );
1290 1405
1291 mDetails = new ViewContainer( mDetailsSplitter ); 1406 mDetails = new ViewContainer( mDetailsSplitter );
1292 1407
1293 topLayout->addWidget( mDetailsSplitter ); 1408 topLayout->addWidget( mDetailsSplitter );
1294 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1409 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1295#else //KAB_NOSPLITTER 1410#else //KAB_NOSPLITTER
1296 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1411 QHBoxLayout *topLayout = new QHBoxLayout( this );
1297//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1412//US topLayout->setSpacing( KDialogBase::spacingHint() );
1298 topLayout->setSpacing( 10 ); 1413 topLayout->setSpacing( 10 );
1299 1414
1300// mDetailsSplitter = new QSplitter( this ); 1415// mDetailsSplitter = new QSplitter( this );
1301 1416
1302 QVBox *viewSpace = new QVBox( this ); 1417 QVBox *viewSpace = new QVBox( this );
1303 1418
1304 mViewManager = new ViewManager( this, viewSpace ); 1419 mViewManager = new ViewManager( this, viewSpace );
1305 viewSpace->setStretchFactor( mViewManager, 1 ); 1420 viewSpace->setStretchFactor( mViewManager, 1 );
1306 1421
1307 mDetails = new ViewContainer( this ); 1422 mDetails = new ViewContainer( this );
1308 1423
1309 topLayout->addWidget( viewSpace ); 1424 topLayout->addWidget( viewSpace );
1310// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1425// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1311 topLayout->addWidget( mDetails ); 1426 topLayout->addWidget( mDetails );
1312#endif //KAB_NOSPLITTER 1427#endif //KAB_NOSPLITTER
1313*/ 1428*/
1314 1429
1315 1430
1316#endif //KAB_EMBEDDED 1431#endif //KAB_EMBEDDED
1317 initActions(); 1432 initActions();
1318 1433
1319#ifdef KAB_EMBEDDED 1434#ifdef KAB_EMBEDDED
1320 addActionsManually(); 1435 addActionsManually();
1321 //US make sure the export and import menues are initialized before creating the xxPortManager. 1436 //US make sure the export and import menues are initialized before creating the xxPortManager.
1322 mXXPortManager = new XXPortManager( this, this ); 1437 mXXPortManager = new XXPortManager( this, this );
1323 1438
1324 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1439 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1325 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1440 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1326 // mActionQuit->plug ( mMainWindow->toolBar()); 1441 // mActionQuit->plug ( mMainWindow->toolBar());
1327 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1442 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1328 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1443 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1329 // mIncSearchWidget->hide(); 1444 // mIncSearchWidget->hide();
1330 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1445 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1331 SLOT( incrementalSearch( const QString& ) ) ); 1446 SLOT( incrementalSearch( const QString& ) ) );
1332 1447
1333 1448
1334 mJumpButtonBar = new JumpButtonBar( this, this ); 1449 mJumpButtonBar = new JumpButtonBar( this, this );
1335 1450
1336 topLayout->addWidget( mJumpButtonBar ); 1451 topLayout->addWidget( mJumpButtonBar );
1337//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1452//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1338 1453
1339// mMainWindow->getIconToolBar()->raise(); 1454// mMainWindow->getIconToolBar()->raise();
1340 1455
1341#endif //KAB_EMBEDDED 1456#endif //KAB_EMBEDDED
1342 1457
1343} 1458}
1344void KABCore::initActions() 1459void KABCore::initActions()
1345{ 1460{
1346//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1461//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1347 1462
1348#ifndef KAB_EMBEDDED 1463#ifndef KAB_EMBEDDED
1349 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1464 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1350 SLOT( clipboardDataChanged() ) ); 1465 SLOT( clipboardDataChanged() ) );
1351#endif //KAB_EMBEDDED 1466#endif //KAB_EMBEDDED
1352 1467
1353 // file menu 1468 // file menu
1354 if ( mIsPart ) { 1469 if ( mIsPart ) {
1355 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1470 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1356 SLOT( sendMail() ), actionCollection(), 1471 SLOT( sendMail() ), actionCollection(),
1357 "kaddressbook_mail" ); 1472 "kaddressbook_mail" );
1358 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1473 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1359 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1474 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1360 1475
1361 } else { 1476 } else {
1362 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1477 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1363 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1478 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1364 } 1479 }
1365 1480
1481
1366 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1482 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1367 SLOT( save() ), actionCollection(), "file_sync" ); 1483 SLOT( save() ), actionCollection(), "file_sync" );
1368 1484
1369 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1485 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1370 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1486 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1371 1487
1372 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1488 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1373 this, SLOT( mailVCard() ), 1489 this, SLOT( mailVCard() ),
1374 actionCollection(), "file_mail_vcard"); 1490 actionCollection(), "file_mail_vcard");
1375 1491
1492 mActionBeamVCard = 0;
1493 if ( Ir::supported() ) {
1494 mActionBeamVCard = new KAction( i18n( "Beam v&Card" ), "beam", 0, this,
1495 SLOT( beamVCard() ), actionCollection(),
1496 "kaddressbook_beam_vcard" );
1497 }
1498
1499
1376 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1500 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1377 this, SLOT( editContact2() ), 1501 this, SLOT( editContact2() ),
1378 actionCollection(), "file_properties" ); 1502 actionCollection(), "file_properties" );
1379 1503
1380#ifdef KAB_EMBEDDED 1504#ifdef KAB_EMBEDDED
1381 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1505 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1382 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1506 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1383 mMainWindow, SLOT( exit() ), 1507 mMainWindow, SLOT( exit() ),
1384 actionCollection(), "quit" ); 1508 actionCollection(), "quit" );
1385#endif //KAB_EMBEDDED 1509#endif //KAB_EMBEDDED
1386 1510
1387 // edit menu 1511 // edit menu
1388 if ( mIsPart ) { 1512 if ( mIsPart ) {
1389 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1513 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1390 SLOT( copyContacts() ), actionCollection(), 1514 SLOT( copyContacts() ), actionCollection(),
1391 "kaddressbook_copy" ); 1515 "kaddressbook_copy" );
1392 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1516 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1393 SLOT( cutContacts() ), actionCollection(), 1517 SLOT( cutContacts() ), actionCollection(),
1394 "kaddressbook_cut" ); 1518 "kaddressbook_cut" );
1395 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1519 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1396 SLOT( pasteContacts() ), actionCollection(), 1520 SLOT( pasteContacts() ), actionCollection(),
1397 "kaddressbook_paste" ); 1521 "kaddressbook_paste" );
1398 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1522 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1399 SLOT( selectAllContacts() ), actionCollection(), 1523 SLOT( selectAllContacts() ), actionCollection(),
1400 "kaddressbook_select_all" ); 1524 "kaddressbook_select_all" );
1401 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1525 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1402 SLOT( undo() ), actionCollection(), 1526 SLOT( undo() ), actionCollection(),
1403 "kaddressbook_undo" ); 1527 "kaddressbook_undo" );
1404 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1528 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1405 this, SLOT( redo() ), actionCollection(), 1529 this, SLOT( redo() ), actionCollection(),
1406 "kaddressbook_redo" ); 1530 "kaddressbook_redo" );
1407 } else { 1531 } else {
1408 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1532 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1409 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1533 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1410 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1534 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1411 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1535 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1412 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1536 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1413 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1537 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1414 } 1538 }
1415 1539
1416 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1540 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1417 Key_Delete, this, SLOT( deleteContacts() ), 1541 Key_Delete, this, SLOT( deleteContacts() ),
1418 actionCollection(), "edit_delete" ); 1542 actionCollection(), "edit_delete" );
1419 1543
1420 mActionUndo->setEnabled( false ); 1544 mActionUndo->setEnabled( false );
1421 mActionRedo->setEnabled( false ); 1545 mActionRedo->setEnabled( false );
1422 1546
1423 // settings menu 1547 // settings menu
1424#ifdef KAB_EMBEDDED 1548#ifdef KAB_EMBEDDED
1425//US special menuentry to configure the addressbook resources. On KDE 1549//US special menuentry to configure the addressbook resources. On KDE
1426// you do that through the control center !!! 1550// you do that through the control center !!!
1427 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1551 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1428 SLOT( configureResources() ), actionCollection(), 1552 SLOT( configureResources() ), actionCollection(),
1429 "kaddressbook_configure_resources" ); 1553 "kaddressbook_configure_resources" );
1430#endif //KAB_EMBEDDED 1554#endif //KAB_EMBEDDED
1431 1555
1432 if ( mIsPart ) { 1556 if ( mIsPart ) {
1433 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1557 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1434 SLOT( openConfigDialog() ), actionCollection(), 1558 SLOT( openConfigDialog() ), actionCollection(),
1435 "kaddressbook_configure" ); 1559 "kaddressbook_configure" );
1436 1560
1437 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1561 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1438 this, SLOT( configureKeyBindings() ), actionCollection(), 1562 this, SLOT( configureKeyBindings() ), actionCollection(),
1439 "kaddressbook_configure_shortcuts" ); 1563 "kaddressbook_configure_shortcuts" );
1440#ifdef KAB_EMBEDDED 1564#ifdef KAB_EMBEDDED
1441 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1565 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1442 mActionConfigureToolbars->setEnabled( false ); 1566 mActionConfigureToolbars->setEnabled( false );
1443#endif //KAB_EMBEDDED 1567#endif //KAB_EMBEDDED
1444 1568
1445 } else { 1569 } else {
1446 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1570 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1447 1571
1448 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1572 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1449 } 1573 }
1450 1574
1451 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1575 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1452 actionCollection(), "options_show_jump_bar" ); 1576 actionCollection(), "options_show_jump_bar" );
1453 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1577 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1454 1578
1455 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, 1579 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0,
1456 actionCollection(), "options_show_details" ); 1580 actionCollection(), "options_show_details" );
1457 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1581 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1458 1582
1459 // misc 1583 // misc
1460 // only enable LDAP lookup if we can handle the protocol 1584 // only enable LDAP lookup if we can handle the protocol
1461#ifndef KAB_EMBEDDED 1585#ifndef KAB_EMBEDDED
1462 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1586 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1463 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1587 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1464 this, SLOT( openLDAPDialog() ), actionCollection(), 1588 this, SLOT( openLDAPDialog() ), actionCollection(),
1465 "ldap_lookup" ); 1589 "ldap_lookup" );
1466 } 1590 }
1467#else //KAB_EMBEDDED 1591#else //KAB_EMBEDDED
1468 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1592 //qDebug("KABCore::initActions() LDAP has to be implemented");
1469#endif //KAB_EMBEDDED 1593#endif //KAB_EMBEDDED
1470 1594
1471 1595
1472 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1596 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1473 SLOT( setWhoAmI() ), actionCollection(), 1597 SLOT( setWhoAmI() ), actionCollection(),
1474 "set_personal" ); 1598 "set_personal" );
1475 1599
1600 mActionBeam = 0;
1601 if ( Ir::supported() ) {
1602 mActionBeam = new KAction( i18n( "&Beam Who Am I" ), "beam", 0, this,
1603 SLOT( beamMySelf() ), actionCollection(),
1604 "kaddressbook_beam_myself" );
1605 }
1606
1607
1476 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1608 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1477 SLOT( setCategories() ), actionCollection(), 1609 SLOT( setCategories() ), actionCollection(),
1478 "edit_set_categories" ); 1610 "edit_set_categories" );
1479 1611
1480 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1612 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1481 SLOT( removeVoice() ), actionCollection(), 1613 SLOT( removeVoice() ), actionCollection(),
1482 "remove_voice" ); 1614 "remove_voice" );
1483 mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, 1615 mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this,
1484 SLOT( importFromOL() ), actionCollection(), 1616 SLOT( importFromOL() ), actionCollection(),
1485 "import_OL" ); 1617 "import_OL" );
1486#ifdef KAB_EMBEDDED 1618#ifdef KAB_EMBEDDED
1487 1619
1488 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1620 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1489 this, SLOT( createAboutData() ), actionCollection(), 1621 this, SLOT( createAboutData() ), actionCollection(),
1490 "kaddressbook_about_data" ); 1622 "kaddressbook_about_data" );
1491#endif //KAB_EMBEDDED 1623#endif //KAB_EMBEDDED
1492 1624
1493 clipboardDataChanged(); 1625 clipboardDataChanged();
1494 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1626 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1495 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1627 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1496} 1628}
1497 1629
1498//US we need this function, to plug all actions into the correct menues. 1630//US we need this function, to plug all actions into the correct menues.
1499// KDE uses a XML format to plug the actions, but we work her without this overhead. 1631// KDE uses a XML format to plug the actions, but we work her without this overhead.
1500void KABCore::addActionsManually() 1632void KABCore::addActionsManually()
1501{ 1633{
1502//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1634//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1503 1635
1504#ifdef KAB_EMBEDDED 1636#ifdef KAB_EMBEDDED
1505 QPopupMenu *fileMenu = new QPopupMenu( this ); 1637 QPopupMenu *fileMenu = new QPopupMenu( this );
1506 QPopupMenu *editMenu = new QPopupMenu( this ); 1638 QPopupMenu *editMenu = new QPopupMenu( this );
1507 QPopupMenu *helpMenu = new QPopupMenu( this ); 1639 QPopupMenu *helpMenu = new QPopupMenu( this );
1508 1640
1509 KToolBar* tb = mMainWindow->toolBar(); 1641 KToolBar* tb = mMainWindow->toolBar();
1510 1642
1511#ifdef DESKTOP_VERSION 1643#ifdef DESKTOP_VERSION
1512 QMenuBar* mb = mMainWindow->menuBar(); 1644 QMenuBar* mb = mMainWindow->menuBar();
1513 1645
1514 //US setup menubar. 1646 //US setup menubar.
1515 //Disable the following block if you do not want to have a menubar. 1647 //Disable the following block if you do not want to have a menubar.
1516 mb->insertItem( "&File", fileMenu ); 1648 mb->insertItem( "&File", fileMenu );
1517 mb->insertItem( "&Edit", editMenu ); 1649 mb->insertItem( "&Edit", editMenu );
1518 mb->insertItem( "&View", viewMenu ); 1650 mb->insertItem( "&View", viewMenu );
1519 mb->insertItem( "&Settings", settingsMenu ); 1651 mb->insertItem( "&Settings", settingsMenu );
1520 mb->insertItem( "&Change selected", changeMenu ); 1652 mb->insertItem( "&Change selected", changeMenu );
1521 mb->insertItem( "&Help", helpMenu ); 1653 mb->insertItem( "&Help", helpMenu );
1522 mIncSearchWidget = new IncSearchWidget( tb ); 1654 mIncSearchWidget = new IncSearchWidget( tb );
1523 // tb->insertWidget(-1, 0, mIncSearchWidget); 1655 // tb->insertWidget(-1, 0, mIncSearchWidget);
1524 1656
1525#else 1657#else
1526 //US setup toolbar 1658 //US setup toolbar
1527 QMenuBar *menuBarTB = new QMenuBar( tb ); 1659 QMenuBar *menuBarTB = new QMenuBar( tb );
1528 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1660 QPopupMenu *popupBarTB = new QPopupMenu( this );
1529 menuBarTB->insertItem( "ME", popupBarTB); 1661 menuBarTB->insertItem( "ME", popupBarTB);
1530 tb->insertWidget(-1, 0, menuBarTB); 1662 tb->insertWidget(-1, 0, menuBarTB);
1531 mIncSearchWidget = new IncSearchWidget( tb ); 1663 mIncSearchWidget = new IncSearchWidget( tb );
1532 1664
1533 tb->enableMoving(false); 1665 tb->enableMoving(false);
1534 popupBarTB->insertItem( "&File", fileMenu ); 1666 popupBarTB->insertItem( "&File", fileMenu );
1535 popupBarTB->insertItem( "&Edit", editMenu ); 1667 popupBarTB->insertItem( "&Edit", editMenu );
1536 popupBarTB->insertItem( "&View", viewMenu ); 1668 popupBarTB->insertItem( "&View", viewMenu );
1537 popupBarTB->insertItem( "&Settings", settingsMenu ); 1669 popupBarTB->insertItem( "&Settings", settingsMenu );
1538 mViewManager->getFilterAction()->plug ( popupBarTB); 1670 mViewManager->getFilterAction()->plug ( popupBarTB);
1539 popupBarTB->insertItem( "&Change selected", changeMenu ); 1671 popupBarTB->insertItem( "&Change selected", changeMenu );
1540 popupBarTB->insertItem( "&Help", helpMenu ); 1672 popupBarTB->insertItem( "&Help", helpMenu );
1541 if (QApplication::desktop()->width() > 320 ) { 1673 if (QApplication::desktop()->width() > 320 ) {
1542 // mViewManager->getFilterAction()->plug ( tb); 1674 // mViewManager->getFilterAction()->plug ( tb);
1543 } 1675 }
1544#endif 1676#endif
1545 // mActionQuit->plug ( mMainWindow->toolBar()); 1677 // mActionQuit->plug ( mMainWindow->toolBar());
1546 1678
1547 1679
1548 1680
1549 //US Now connect the actions with the menue entries. 1681 //US Now connect the actions with the menue entries.
1550 mActionPrint->plug( fileMenu ); 1682 mActionPrint->plug( fileMenu );
1551 mActionMail->plug( fileMenu ); 1683 mActionMail->plug( fileMenu );
1552 fileMenu->insertSeparator(); 1684 fileMenu->insertSeparator();
1553 1685
1554 mActionNewContact->plug( fileMenu ); 1686 mActionNewContact->plug( fileMenu );
1555 mActionNewContact->plug( tb ); 1687 mActionNewContact->plug( tb );
1556 1688
1557 mActionEditAddressee->plug( fileMenu ); 1689 mActionEditAddressee->plug( fileMenu );
1558 fileMenu->insertSeparator(); 1690 fileMenu->insertSeparator();
1559 mActionSave->plug( fileMenu ); 1691 mActionSave->plug( fileMenu );
1560 fileMenu->insertItem( "&Import", ImportMenu ); 1692 fileMenu->insertItem( "&Import", ImportMenu );
1561 fileMenu->insertItem( "&Emport", ExportMenu ); 1693 fileMenu->insertItem( "&Emport", ExportMenu );
1562 fileMenu->insertSeparator(); 1694 fileMenu->insertSeparator();
1563 mActionMailVCard->plug( fileMenu ); 1695 mActionMailVCard->plug( fileMenu );
1696 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1564 fileMenu->insertSeparator(); 1697 fileMenu->insertSeparator();
1565 mActionQuit->plug( fileMenu ); 1698 mActionQuit->plug( fileMenu );
1566#ifdef _WIN32_ 1699#ifdef _WIN32_
1567 mActionImportOL->plug( ImportMenu ); 1700 mActionImportOL->plug( ImportMenu );
1568#endif 1701#endif
1569 // edit menu 1702 // edit menu
1570 mActionUndo->plug( editMenu ); 1703 mActionUndo->plug( editMenu );
1571 mActionRedo->plug( editMenu ); 1704 mActionRedo->plug( editMenu );
1572 editMenu->insertSeparator(); 1705 editMenu->insertSeparator();
1573 mActionCut->plug( editMenu ); 1706 mActionCut->plug( editMenu );
1574 mActionCopy->plug( editMenu ); 1707 mActionCopy->plug( editMenu );
1575 mActionPaste->plug( editMenu ); 1708 mActionPaste->plug( editMenu );
1576 mActionDelete->plug( editMenu ); 1709 mActionDelete->plug( editMenu );
1577 editMenu->insertSeparator(); 1710 editMenu->insertSeparator();
1578 mActionSelectAll->plug( editMenu ); 1711 mActionSelectAll->plug( editMenu );
1579 1712
1580 mActionRemoveVoice->plug( changeMenu ); 1713 mActionRemoveVoice->plug( changeMenu );
1581 // settings menu 1714 // settings menu
1582//US special menuentry to configure the addressbook resources. On KDE 1715//US special menuentry to configure the addressbook resources. On KDE
1583// you do that through the control center !!! 1716// you do that through the control center !!!
1584 mActionConfigResources->plug( settingsMenu ); 1717 mActionConfigResources->plug( settingsMenu );
1585 settingsMenu->insertSeparator(); 1718 settingsMenu->insertSeparator();
1586 1719
1587 mActionConfigKAddressbook->plug( settingsMenu ); 1720 mActionConfigKAddressbook->plug( settingsMenu );
1588 1721
1589 if ( mIsPart ) { 1722 if ( mIsPart ) {
1590 mActionConfigShortcuts->plug( settingsMenu ); 1723 mActionConfigShortcuts->plug( settingsMenu );
1591 mActionConfigureToolbars->plug( settingsMenu ); 1724 mActionConfigureToolbars->plug( settingsMenu );
1592 1725
1593 } else { 1726 } else {
1594 mActionKeyBindings->plug( settingsMenu ); 1727 mActionKeyBindings->plug( settingsMenu );
1595 } 1728 }
1596 1729
1597 settingsMenu->insertSeparator(); 1730 settingsMenu->insertSeparator();
1598 1731
1599 mActionJumpBar->plug( settingsMenu ); 1732 mActionJumpBar->plug( settingsMenu );
1600 mActionDetails->plug( settingsMenu ); 1733 mActionDetails->plug( settingsMenu );
1601 settingsMenu->insertSeparator(); 1734 settingsMenu->insertSeparator();
1602 1735
1603 mActionWhoAmI->plug( settingsMenu ); 1736 mActionWhoAmI->plug( settingsMenu );
1737 if ( Ir::supported() ) mActionBeam->plug( settingsMenu );
1604 mActionCategories->plug( settingsMenu ); 1738 mActionCategories->plug( settingsMenu );
1605 1739
1606 mActionAboutKAddressbook->plug( helpMenu ); 1740 mActionAboutKAddressbook->plug( helpMenu );
1607 1741
1608 1742
1609 if (QApplication::desktop()->width() > 320 ) { 1743 if (QApplication::desktop()->width() > 320 ) {
1610 1744
1611 mActionEditAddressee->plug( tb ); 1745 mActionEditAddressee->plug( tb );
1612 mActionSave->plug( tb ); 1746 mActionSave->plug( tb );
1613 mViewManager->getFilterAction()->plug ( tb); 1747 mViewManager->getFilterAction()->plug ( tb);
1614 if (QApplication::desktop()->width() > 480 ) { 1748 if (QApplication::desktop()->width() > 480 ) {
1615 mActionUndo->plug( tb ); 1749 mActionUndo->plug( tb );
1616 mActionDelete->plug( tb ); 1750 mActionDelete->plug( tb );
1617 mActionRedo->plug( tb ); 1751 mActionRedo->plug( tb );
1618 } 1752 }
1619 } 1753 }
1620 //mActionQuit->plug ( tb ); 1754 //mActionQuit->plug ( tb );
1621 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1755 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1622 1756
1623 //US link the searchwidget first to this. 1757 //US link the searchwidget first to this.
1624 // The real linkage to the toolbar happens later. 1758 // The real linkage to the toolbar happens later.
1625//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1759//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1626//US tb->insertItem( mIncSearchWidget ); 1760//US tb->insertItem( mIncSearchWidget );
1627/*US 1761/*US
1628 mIncSearchWidget = new IncSearchWidget( tb ); 1762 mIncSearchWidget = new IncSearchWidget( tb );
1629 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1763 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1630 SLOT( incrementalSearch( const QString& ) ) ); 1764 SLOT( incrementalSearch( const QString& ) ) );
1631 1765
1632 mJumpButtonBar = new JumpButtonBar( this, this ); 1766 mJumpButtonBar = new JumpButtonBar( this, this );
1633 1767
1634//US topLayout->addWidget( mJumpButtonBar ); 1768//US topLayout->addWidget( mJumpButtonBar );
1635 this->layout()->add( mJumpButtonBar ); 1769 this->layout()->add( mJumpButtonBar );
1636*/ 1770*/
1637 1771
1638#endif //KAB_EMBEDDED 1772#endif //KAB_EMBEDDED
1639} 1773}
1640void KABCore::removeVoice() 1774void KABCore::removeVoice()
1641{ 1775{
1642 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 ) 1776 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 )
1643 return; 1777 return;
1644 KABC::Addressee::List list = mViewManager->selectedAddressees(); 1778 KABC::Addressee::List list = mViewManager->selectedAddressees();
1645 KABC::Addressee::List::Iterator it; 1779 KABC::Addressee::List::Iterator it;
1646 for ( it = list.begin(); it != list.end(); ++it ) { 1780 for ( it = list.begin(); it != list.end(); ++it ) {
1647 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 1781 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
1648 PhoneNumber::List::Iterator phoneIt; 1782 PhoneNumber::List::Iterator phoneIt;
1649 bool found = false; 1783 bool found = false;
1650 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { 1784 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
1651 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 1785 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
1652 if ((*phoneIt).type() - PhoneNumber::Voice ) { 1786 if ((*phoneIt).type() - PhoneNumber::Voice ) {
1653 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 1787 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
1654 (*it).insertPhoneNumber( (*phoneIt) ); 1788 (*it).insertPhoneNumber( (*phoneIt) );
1655 found = true; 1789 found = true;
1656 } 1790 }
1657 } 1791 }
1658 1792
1659 } 1793 }
1660 if ( found ) 1794 if ( found )
1661 contactModified((*it) ); 1795 contactModified((*it) );
1662 } 1796 }
1663} 1797}
1664 1798
1665 1799
1666 1800
1667void KABCore::clipboardDataChanged() 1801void KABCore::clipboardDataChanged()
1668{ 1802{
1669 1803
1670 if ( mReadWrite ) 1804 if ( mReadWrite )
1671 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 1805 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
1672 1806
1673} 1807}
1674 1808
1675void KABCore::updateActionMenu() 1809void KABCore::updateActionMenu()
1676{ 1810{
1677 UndoStack *undo = UndoStack::instance(); 1811 UndoStack *undo = UndoStack::instance();
1678 RedoStack *redo = RedoStack::instance(); 1812 RedoStack *redo = RedoStack::instance();
1679 1813
1680 if ( undo->isEmpty() ) 1814 if ( undo->isEmpty() )
1681 mActionUndo->setText( i18n( "Undo" ) ); 1815 mActionUndo->setText( i18n( "Undo" ) );
1682 else 1816 else
1683 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 1817 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
1684 1818
1685 mActionUndo->setEnabled( !undo->isEmpty() ); 1819 mActionUndo->setEnabled( !undo->isEmpty() );
1686 1820
1687 if ( !redo->top() ) 1821 if ( !redo->top() )
1688 mActionRedo->setText( i18n( "Redo" ) ); 1822 mActionRedo->setText( i18n( "Redo" ) );
1689 else 1823 else
1690 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 1824 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
1691 1825
1692 mActionRedo->setEnabled( !redo->isEmpty() ); 1826 mActionRedo->setEnabled( !redo->isEmpty() );
1693} 1827}
1694 1828
1695void KABCore::configureKeyBindings() 1829void KABCore::configureKeyBindings()
1696{ 1830{
1697#ifndef KAB_EMBEDDED 1831#ifndef KAB_EMBEDDED
1698 KKeyDialog::configure( actionCollection(), true ); 1832 KKeyDialog::configure( actionCollection(), true );
1699#else //KAB_EMBEDDED 1833#else //KAB_EMBEDDED
1700 qDebug("KABCore::configureKeyBindings() not implemented"); 1834 qDebug("KABCore::configureKeyBindings() not implemented");
1701#endif //KAB_EMBEDDED 1835#endif //KAB_EMBEDDED
1702} 1836}
1703 1837
1704#ifdef KAB_EMBEDDED 1838#ifdef KAB_EMBEDDED
1705void KABCore::configureResources() 1839void KABCore::configureResources()
1706{ 1840{
1707 KRES::KCMKResources dlg( this, "" , 0 ); 1841 KRES::KCMKResources dlg( this, "" , 0 );
1708 1842
1709 if ( !dlg.exec() ) 1843 if ( !dlg.exec() )
1710 return; 1844 return;
1711 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 1845 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
1712} 1846}
1713#endif //KAB_EMBEDDED 1847#endif //KAB_EMBEDDED
1714 1848
1715 1849
1716 1850
1717#ifndef KAB_EMBEDDED 1851#ifndef KAB_EMBEDDED
1718#include "kabcore.moc" 1852#include "kabcore.moc"
1719#endif //KAB_EMBEDDED 1853#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 6446974..be39148 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,424 +1,438 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KABCORE_H 24#ifndef KABCORE_H
25#define KABCORE_H 25#define KABCORE_H
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32 32
33#include <qwidget.h> 33#include <qwidget.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35 35
36namespace KABC { 36namespace KABC {
37class AddressBook; 37class AddressBook;
38} 38}
39 39
40#ifndef KAB_EMBEDDED 40#ifndef KAB_EMBEDDED
41class KAboutData; 41class KAboutData;
42class KConfig; 42class KConfig;
43 43
44class KAddressBookService; 44class KAddressBookService;
45class LDAPSearchDialog; 45class LDAPSearchDialog;
46#else //KAB_EMBEDDED 46#else //KAB_EMBEDDED
47class KAddressBookMain; 47class KAddressBookMain;
48//US class QAction; 48//US class QAction;
49#endif //KAB_EMBEDDED 49#endif //KAB_EMBEDDED
50class KCMultiDialog; 50class KCMultiDialog;
51class KXMLGUIClient; 51class KXMLGUIClient;
52class ExtensionManager; 52class ExtensionManager;
53class XXPortManager; 53class XXPortManager;
54class JumpButtonBar; 54class JumpButtonBar;
55class IncSearchWidget; 55class IncSearchWidget;
56class KDGanttMinimizeSplitter; 56class KDGanttMinimizeSplitter;
57class KAction; 57class KAction;
58class KActionCollection; 58class KActionCollection;
59class KToggleAction; 59class KToggleAction;
60 60
61class QAction; 61class QAction;
62class QMenuBar; 62class QMenuBar;
63class QSplitter; 63class QSplitter;
64class ViewContainer; 64class ViewContainer;
65class ViewManager; 65class ViewManager;
66class AddresseeEditorDialog; 66class AddresseeEditorDialog;
67class Ir;
67 68
68class KABCore : public QWidget 69class KABCore : public QWidget
69{ 70{
70 Q_OBJECT 71 Q_OBJECT
71 72
72 public: 73 public:
73 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 74 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
74 75
75 76
76 ~KABCore(); 77 ~KABCore();
77 78
78 79
79#ifdef KAB_EMBEDDED 80#ifdef KAB_EMBEDDED
80 //US added functionality 81 //US added functionality
81 QPopupMenu* getViewMenu() {return viewMenu;} 82 QPopupMenu* getViewMenu() {return viewMenu;}
82 QPopupMenu* getFilterMenu() {return filterMenu;} 83 QPopupMenu* getFilterMenu() {return filterMenu;}
83 QPopupMenu* getSettingsMenu() {return settingsMenu;} 84 QPopupMenu* getSettingsMenu() {return settingsMenu;}
84 void addActionsManually(); 85 void addActionsManually();
85#endif //KAB_EMBEDDED 86#endif //KAB_EMBEDDED
86 /** 87 /**
87 Restores the global settings. 88 Restores the global settings.
88 */ 89 */
89 void restoreSettings(); 90 void restoreSettings();
90 91
91 /** 92 /**
92 Saves the global settings. 93 Saves the global settings.
93 */ 94 */
94 void saveSettings(); 95 void saveSettings();
95 96
96 /** 97 /**
97 Returns a pointer to the StdAddressBook of the application. 98 Returns a pointer to the StdAddressBook of the application.
98 */ 99 */
99 KABC::AddressBook *addressBook() const; 100 KABC::AddressBook *addressBook() const;
100 101
101 /** 102 /**
102 Returns a pointer to the KConfig object of the application. 103 Returns a pointer to the KConfig object of the application.
103 */ 104 */
104 static KConfig *config(); 105 static KConfig *config();
105 106
106 /** 107 /**
107 Returns a pointer to the global KActionCollection object. So 108 Returns a pointer to the global KActionCollection object. So
108 other classes can register their actions easily. 109 other classes can register their actions easily.
109 */ 110 */
110 KActionCollection *actionCollection() const; 111 KActionCollection *actionCollection() const;
111 112
112 /** 113 /**
113 Returns the current search field of the Incremental Search Widget. 114 Returns the current search field of the Incremental Search Widget.
114 */ 115 */
115 KABC::Field *currentSearchField() const; 116 KABC::Field *currentSearchField() const;
116 117
117 /** 118 /**
118 Returns the uid list of the currently selected contacts. 119 Returns the uid list of the currently selected contacts.
119 */ 120 */
120 QStringList selectedUIDs() const; 121 QStringList selectedUIDs() const;
121 122
122 /** 123 /**
123 Displays the ResourceSelectDialog and returns the selected 124 Displays the ResourceSelectDialog and returns the selected
124 resource or a null pointer if no resource was selected by 125 resource or a null pointer if no resource was selected by
125 the user. 126 the user.
126 */ 127 */
127 KABC::Resource *requestResource( QWidget *parent ); 128 KABC::Resource *requestResource( QWidget *parent );
128 129
129#ifndef KAB_EMBEDDED 130#ifndef KAB_EMBEDDED
130 static KAboutData *createAboutData(); 131 static KAboutData *createAboutData();
131#endif //KAB_EMBEDDED 132#endif //KAB_EMBEDDED
132 133
133#ifdef KAB_EMBEDDED 134#ifdef KAB_EMBEDDED
134 inline QPopupMenu* getImportMenu() { return ImportMenu;} 135 inline QPopupMenu* getImportMenu() { return ImportMenu;}
135 inline QPopupMenu* getExportMenu() { return ExportMenu;} 136 inline QPopupMenu* getExportMenu() { return ExportMenu;}
136#endif //KAB_EMBEDDED 137#endif //KAB_EMBEDDED
137 138
138 public slots: 139 public slots:
139#ifdef KAB_EMBEDDED 140#ifdef KAB_EMBEDDED
140 void createAboutData(); 141 void createAboutData();
141#endif //KAB_EMBEDDED 142#endif //KAB_EMBEDDED
142 143
143 void statusMessage(QString, int time = 0 ); 144 void statusMessage(QString, int time = 0 );
144 /** 145 /**
145 Is called whenever a contact is selected in the view. 146 Is called whenever a contact is selected in the view.
146 */ 147 */
147 void setContactSelected( const QString &uid ); 148 void setContactSelected( const QString &uid );
148 149
149 /** 150 /**
150 Opens the preferred mail composer with all selected contacts as 151 Opens the preferred mail composer with all selected contacts as
151 arguments. 152 arguments.
152 */ 153 */
153 void sendMail(); 154 void sendMail();
154 155
155 /** 156 /**
156 Opens the preferred mail composer with the given contacts as 157 Opens the preferred mail composer with the given contacts as
157 arguments. 158 arguments.
158 */ 159 */
159 void sendMail( const QString& email ); 160 void sendMail( const QString& email );
160 161
161 162
162 void mailVCard(); 163 void mailVCard();
163 void mailVCard(const QStringList& uids); 164 void mailVCard(const QStringList& uids);
164 165
165 /** 166 /**
167 Beams the "WhoAmI contact.
168 */
169 void beamMySelf();
170
171 void beamVCard();
172 void beamVCard(const QStringList& uids);
173 void beamDone( Ir *ir );
174
175
176 /**
166 Starts the preferred web browser with the given URL as argument. 177 Starts the preferred web browser with the given URL as argument.
167 */ 178 */
168 void browse( const QString& url ); 179 void browse( const QString& url );
169 180
170 /** 181 /**
171 Select all contacts in the view. 182 Select all contacts in the view.
172 */ 183 */
173 void selectAllContacts(); 184 void selectAllContacts();
174 185
175 /** 186 /**
176 Deletes all selected contacts from the address book. 187 Deletes all selected contacts from the address book.
177 */ 188 */
178 void deleteContacts(); 189 void deleteContacts();
179 190
180 /** 191 /**
181 Deletes given contacts from the address book. 192 Deletes given contacts from the address book.
182 193
183 @param uids The uids of the contacts, which shall be deleted. 194 @param uids The uids of the contacts, which shall be deleted.
184 */ 195 */
185 void deleteContacts( const QStringList &uids ); 196 void deleteContacts( const QStringList &uids );
186 197
187 /** 198 /**
188 Copys the selected contacts into clipboard for later pasting. 199 Copys the selected contacts into clipboard for later pasting.
189 */ 200 */
190 void copyContacts(); 201 void copyContacts();
191 202
192 /** 203 /**
193 Cuts the selected contacts and stores them for later pasting. 204 Cuts the selected contacts and stores them for later pasting.
194 */ 205 */
195 void cutContacts(); 206 void cutContacts();
196 207
197 /** 208 /**
198 Paste contacts from clipboard into the address book. 209 Paste contacts from clipboard into the address book.
199 */ 210 */
200 void pasteContacts(); 211 void pasteContacts();
201 212
202 /** 213 /**
203 Paste given contacts into the address book. 214 Paste given contacts into the address book.
204 215
205 @param list The list of addressee, which shall be pasted. 216 @param list The list of addressee, which shall be pasted.
206 */ 217 */
207 void pasteContacts( KABC::Addressee::List &list ); 218 void pasteContacts( KABC::Addressee::List &list );
208 219
209 /** 220 /**
210 Sets the whoAmI contact, that is used by many other programs to 221 Sets the whoAmI contact, that is used by many other programs to
211 get personal information about the current user. 222 get personal information about the current user.
212 */ 223 */
213 void setWhoAmI(); 224 void setWhoAmI();
214 225
215 /** 226 /**
216 Displays the category dialog and applies the result to all 227 Displays the category dialog and applies the result to all
217 selected contacts. 228 selected contacts.
218 */ 229 */
219 void setCategories(); 230 void setCategories();
220 231
221 /** 232 /**
222 Sets the field list of the Incremental Search Widget. 233 Sets the field list of the Incremental Search Widget.
223 */ 234 */
224 void setSearchFields( const KABC::Field::List &fields ); 235 void setSearchFields( const KABC::Field::List &fields );
225 236
226 /** 237 /**
227 Search with the current search field for a contact, that matches 238 Search with the current search field for a contact, that matches
228 the given text, and selects it in the view. 239 the given text, and selects it in the view.
229 */ 240 */
230 void incrementalSearch( const QString& text ); 241 void incrementalSearch( const QString& text );
231 242
232 /** 243 /**
233 Marks the address book as modified. 244 Marks the address book as modified.
234 */ 245 */
235 void setModified(); 246 void setModified();
236 /** 247 /**
237 Marks the address book as modified without refreshing the view. 248 Marks the address book as modified without refreshing the view.
238 */ 249 */
239 void setModifiedWOrefresh(); 250 void setModifiedWOrefresh();
240 251
241 /** 252 /**
242 Marks the address book as modified concerning the argument. 253 Marks the address book as modified concerning the argument.
243 */ 254 */
244 void setModified( bool modified ); 255 void setModified( bool modified );
245 256
246 /** 257 /**
247 Returns whether the address book is modified. 258 Returns whether the address book is modified.
248 */ 259 */
249 bool modified() const; 260 bool modified() const;
250 261
251 /** 262 /**
252 Called whenever an contact is modified in the contact editor 263 Called whenever an contact is modified in the contact editor
253 dialog or the quick edit. 264 dialog or the quick edit.
254 */ 265 */
255 void contactModified( const KABC::Addressee &addr ); 266 void contactModified( const KABC::Addressee &addr );
256 267
257 /** 268 /**
258 DCOP METHODS. 269 DCOP METHODS.
259 */ 270 */
260 void addEmail( QString addr ); 271 void addEmail( QString addr );
261 void importVCard( const KURL& url, bool showPreview ); 272 void importVCard( const KURL& url, bool showPreview );
262 void importVCard( const QString& vCard, bool showPreview ); 273 void importVCard( const QString& vCard, bool showPreview );
263 void newContact(); 274 void newContact();
264 QString getNameByPhone( const QString& phone ); 275 QString getNameByPhone( const QString& phone );
265 /** 276 /**
266 END DCOP METHODS 277 END DCOP METHODS
267 */ 278 */
268 279
269 /** 280 /**
270 Saves the contents of the AddressBook back to disk. 281 Saves the contents of the AddressBook back to disk.
271 */ 282 */
272 void save(); 283 void save();
273 284
274 /** 285 /**
275 Undos the last command using the undo stack. 286 Undos the last command using the undo stack.
276 */ 287 */
277 void undo(); 288 void undo();
278 289
279 /** 290 /**
280 Redos the last command that was undone, using the redo stack. 291 Redos the last command that was undone, using the redo stack.
281 */ 292 */
282 void redo(); 293 void redo();
283 294
284 /** 295 /**
285 Shows the edit dialog for the given uid. If the uid is QString::null, 296 Shows the edit dialog for the given uid. If the uid is QString::null,
286 the method will try to find a selected addressee in the view. 297 the method will try to find a selected addressee in the view.
287 */ 298 */
288 void editContact( const QString &uid /*US = QString::null*/ ); 299 void editContact( const QString &uid /*US = QString::null*/ );
289//US added a second method without defaultparameter 300//US added a second method without defaultparameter
290 void editContact2(); 301 void editContact2();
291 302
292 /** 303 /**
293 Launches the configuration dialog. 304 Launches the configuration dialog.
294 */ 305 */
295 void openConfigDialog(); 306 void openConfigDialog();
296 307
297 /** 308 /**
298 Launches the ldap search dialog. 309 Launches the ldap search dialog.
299 */ 310 */
300 void openLDAPDialog(); 311 void openLDAPDialog();
301 312
302 /** 313 /**
303 Creates a KAddressBookPrinter, which will display the print 314 Creates a KAddressBookPrinter, which will display the print
304 dialog and do the printing. 315 dialog and do the printing.
305 */ 316 */
306 void print(); 317 void print();
307 318
308 /** 319 /**
309 Registers a new GUI client, so plugins can register its actions. 320 Registers a new GUI client, so plugins can register its actions.
310 */ 321 */
311 void addGUIClient( KXMLGUIClient *client ); 322 void addGUIClient( KXMLGUIClient *client );
312 323
313 signals: 324 signals:
314 void contactSelected( const QString &name ); 325 void contactSelected( const QString &name );
315 void contactSelected( const QPixmap &pixmap ); 326 void contactSelected( const QPixmap &pixmap );
316 public slots: 327 public slots:
317 void setDetailsVisible( bool visible ); 328 void setDetailsVisible( bool visible );
318 void setDetailsToState(); 329 void setDetailsToState();
319 private slots: 330 private slots:
320 void setJumpButtonBarVisible( bool visible ); 331 void setJumpButtonBarVisible( bool visible );
321 void importFromOL(); 332 void importFromOL();
322 void extensionModified( const KABC::Addressee::List &list ); 333 void extensionModified( const KABC::Addressee::List &list );
323 void clipboardDataChanged(); 334 void clipboardDataChanged();
324 void updateActionMenu(); 335 void updateActionMenu();
325 void configureKeyBindings(); 336 void configureKeyBindings();
326 void removeVoice(); 337 void removeVoice();
327#ifdef KAB_EMBEDDED 338#ifdef KAB_EMBEDDED
328 void configureResources(); 339 void configureResources();
329#endif //KAB_EMBEDDED 340#endif //KAB_EMBEDDED
330 341
331 void slotEditorDestroyed( const QString &uid ); 342 void slotEditorDestroyed( const QString &uid );
332 void configurationChanged(); 343 void configurationChanged();
333 void addressBookChanged(); 344 void addressBookChanged();
334 345
335 private: 346 private:
336 void initGUI(); 347 void initGUI();
337 void initActions(); 348 void initActions();
338 349
339 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 350 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
340 const char *name = 0 ); 351 const char *name = 0 );
341 352
342 KXMLGUIClient *mGUIClient; 353 KXMLGUIClient *mGUIClient;
343 354
344 KABC::AddressBook *mAddressBook; 355 KABC::AddressBook *mAddressBook;
345 356
346 ViewManager *mViewManager; 357 ViewManager *mViewManager;
347 // QSplitter *mDetailsSplitter; 358 // QSplitter *mDetailsSplitter;
348 KDGanttMinimizeSplitter *mExtensionBarSplitter; 359 KDGanttMinimizeSplitter *mExtensionBarSplitter;
349 ViewContainer *mDetails; 360 ViewContainer *mDetails;
350 KDGanttMinimizeSplitter* mMiniSplitter; 361 KDGanttMinimizeSplitter* mMiniSplitter;
351 XXPortManager *mXXPortManager; 362 XXPortManager *mXXPortManager;
352 JumpButtonBar *mJumpButtonBar; 363 JumpButtonBar *mJumpButtonBar;
353 IncSearchWidget *mIncSearchWidget; 364 IncSearchWidget *mIncSearchWidget;
354 ExtensionManager *mExtensionManager; 365 ExtensionManager *mExtensionManager;
355 366
356 KCMultiDialog *mConfigureDialog; 367 KCMultiDialog *mConfigureDialog;
357 368
358#ifndef KAB_EMBEDDED 369#ifndef KAB_EMBEDDED
359 LDAPSearchDialog *mLdapSearchDialog; 370 LDAPSearchDialog *mLdapSearchDialog;
360#endif //KAB_EMBEDDED 371#endif //KAB_EMBEDDED
361 // QDict<AddresseeEditorDialog> mEditorDict; 372 // QDict<AddresseeEditorDialog> mEditorDict;
362 AddresseeEditorDialog *mEditorDialog; 373 AddresseeEditorDialog *mEditorDialog;
363 bool mReadWrite; 374 bool mReadWrite;
364 bool mModified; 375 bool mModified;
365 bool mIsPart; 376 bool mIsPart;
366 377
367 //US file menu 378 //US file menu
368 KAction *mActionMail; 379 KAction *mActionMail;
380 KAction *mActionBeam;
369 KAction* mActionPrint; 381 KAction* mActionPrint;
370 KAction* mActionNewContact; 382 KAction* mActionNewContact;
371 KAction *mActionSave; 383 KAction *mActionSave;
372 KAction *mActionEditAddressee; 384 KAction *mActionEditAddressee;
373 KAction *mActionMailVCard; 385 KAction *mActionMailVCard;
386 KAction *mActionBeamVCard;
387
374 KAction *mActionQuit; 388 KAction *mActionQuit;
375 389
376 //US edit menu 390 //US edit menu
377 KAction *mActionCopy; 391 KAction *mActionCopy;
378 KAction *mActionCut; 392 KAction *mActionCut;
379 KAction *mActionPaste; 393 KAction *mActionPaste;
380 KAction *mActionSelectAll; 394 KAction *mActionSelectAll;
381 KAction *mActionUndo; 395 KAction *mActionUndo;
382 KAction *mActionRedo; 396 KAction *mActionRedo;
383 KAction *mActionDelete; 397 KAction *mActionDelete;
384 398
385 //US settings menu 399 //US settings menu
386 KAction *mActionConfigResources; 400 KAction *mActionConfigResources;
387 KAction *mActionConfigKAddressbook; 401 KAction *mActionConfigKAddressbook;
388 KAction *mActionConfigShortcuts; 402 KAction *mActionConfigShortcuts;
389 KAction *mActionConfigureToolbars; 403 KAction *mActionConfigureToolbars;
390 KAction *mActionKeyBindings; 404 KAction *mActionKeyBindings;
391 KToggleAction *mActionJumpBar; 405 KToggleAction *mActionJumpBar;
392 KToggleAction *mActionDetails; 406 KToggleAction *mActionDetails;
393 KAction *mActionWhoAmI; 407 KAction *mActionWhoAmI;
394 KAction *mActionCategories; 408 KAction *mActionCategories;
395 KAction *mActionAboutKAddressbook; 409 KAction *mActionAboutKAddressbook;
396 410
397 KAction *mActionDeleteView; 411 KAction *mActionDeleteView;
398 412
399 QPopupMenu *viewMenu; 413 QPopupMenu *viewMenu;
400 QPopupMenu *filterMenu; 414 QPopupMenu *filterMenu;
401 QPopupMenu *settingsMenu; 415 QPopupMenu *settingsMenu;
402 QPopupMenu *changeMenu; 416 QPopupMenu *changeMenu;
403 417
404//US QAction *mActionSave; 418//US QAction *mActionSave;
405 QPopupMenu *ImportMenu; 419 QPopupMenu *ImportMenu;
406 QPopupMenu *ExportMenu; 420 QPopupMenu *ExportMenu;
407 //LR additional methods 421 //LR additional methods
408 KAction *mActionRemoveVoice; 422 KAction *mActionRemoveVoice;
409 KAction * mActionImportOL; 423 KAction * mActionImportOL;
410 424
411#ifndef KAB_EMBEDDED 425#ifndef KAB_EMBEDDED
412 KAddressBookService *mAddressBookService; 426 KAddressBookService *mAddressBookService;
413#endif //KAB_EMBEDDED 427#endif //KAB_EMBEDDED
414 428
415 class KABCorePrivate; 429 class KABCorePrivate;
416 KABCorePrivate *d; 430 KABCorePrivate *d;
417 431
418#ifdef KAB_EMBEDDED 432#ifdef KAB_EMBEDDED
419 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 433 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
420#endif //KAB_EMBEDDED 434#endif //KAB_EMBEDDED
421 435
422}; 436};
423 437
424#endif 438#endif