summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-04-22 17:32:45 (UTC)
committer zautrix <zautrix>2005-04-22 17:32:45 (UTC)
commite6feb1ca0c45397ba7b922198c87fe9b95b7d872 (patch) (unidiff)
tree61b56d5a17f3eba87fef958d264e2da679496bda /kaddressbook
parent81158fa914f6d0f3aeb049d28d2ecfb5f5c0e261 (diff)
downloadkdepimpi-e6feb1ca0c45397ba7b922198c87fe9b95b7d872.zip
kdepimpi-e6feb1ca0c45397ba7b922198c87fe9b95b7d872.tar.gz
kdepimpi-e6feb1ca0c45397ba7b922198c87fe9b95b7d872.tar.bz2
fixxxx
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp38
1 files changed, 36 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 9c40142..a4f3579 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -168,788 +168,822 @@ $Id$
168 168
169class KABCatPrefs : public QDialog 169class KABCatPrefs : public QDialog
170{ 170{
171 public: 171 public:
172 KABCatPrefs( QWidget *parent=0, const char *name=0 ) : 172 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
173 QDialog( parent, name, true ) 173 QDialog( parent, name, true )
174 { 174 {
175 setCaption( i18n("Manage new Categories") ); 175 setCaption( i18n("Manage new Categories") );
176 QVBoxLayout* lay = new QVBoxLayout( this ); 176 QVBoxLayout* lay = new QVBoxLayout( this );
177 lay->setSpacing( 3 ); 177 lay->setSpacing( 3 );
178 lay->setMargin( 3 ); 178 lay->setMargin( 3 );
179 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 179 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
180 lay->addWidget( lab ); 180 lay->addWidget( lab );
181 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 181 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
182 lay->addWidget( format ); 182 lay->addWidget( format );
183 format->setExclusive ( true ) ; 183 format->setExclusive ( true ) ;
184 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 184 addCatBut = new QRadioButton(i18n("Add to category list"), format );
185 new QRadioButton(i18n("Remove from addressees"), format ); 185 new QRadioButton(i18n("Remove from addressees"), format );
186 addCatBut->setChecked( true ); 186 addCatBut->setChecked( true );
187 QPushButton * ok = new QPushButton( i18n("OK"), this ); 187 QPushButton * ok = new QPushButton( i18n("OK"), this );
188 lay->addWidget( ok ); 188 lay->addWidget( ok );
189 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 189 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
190 lay->addWidget( cancel ); 190 lay->addWidget( cancel );
191 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 191 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
192 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 192 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
193 resize( 200, 200 ); 193 resize( 200, 200 );
194 } 194 }
195 195
196 bool addCat() { return addCatBut->isChecked(); } 196 bool addCat() { return addCatBut->isChecked(); }
197private: 197private:
198 QRadioButton* addCatBut; 198 QRadioButton* addCatBut;
199}; 199};
200 200
201class KABFormatPrefs : public QDialog 201class KABFormatPrefs : public QDialog
202{ 202{
203 public: 203 public:
204 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : 204 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) :
205 QDialog( parent, name, true ) 205 QDialog( parent, name, true )
206 { 206 {
207 setCaption( i18n("Set formatted name") ); 207 setCaption( i18n("Set formatted name") );
208 QVBoxLayout* lay = new QVBoxLayout( this ); 208 QVBoxLayout* lay = new QVBoxLayout( this );
209 lay->setSpacing( 3 ); 209 lay->setSpacing( 3 );
210 lay->setMargin( 3 ); 210 lay->setMargin( 3 );
211 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); 211 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this );
212 lay->addWidget( lab ); 212 lay->addWidget( lab );
213 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); 213 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this );
214 lay->addWidget( format ); 214 lay->addWidget( format );
215 format->setExclusive ( true ) ; 215 format->setExclusive ( true ) ;
216 simple = new QRadioButton(i18n("Simple: James Bond"), format ); 216 simple = new QRadioButton(i18n("Simple: James Bond"), format );
217 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); 217 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format );
218 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); 218 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format );
219 company = new QRadioButton(i18n("Organization: MI6"), format ); 219 company = new QRadioButton(i18n("Organization: MI6"), format );
220 simple->setChecked( true ); 220 simple->setChecked( true );
221 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); 221 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this);
222 lay->addWidget( setCompany ); 222 lay->addWidget( setCompany );
223 QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); 223 QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
224 lay->addWidget( ok ); 224 lay->addWidget( ok );
225 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 225 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
226 lay->addWidget( cancel ); 226 lay->addWidget( cancel );
227 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 227 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
228 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 228 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
229 //resize( 200, 200 ); 229 //resize( 200, 200 );
230 230
231 } 231 }
232public: 232public:
233 QRadioButton* simple, *full, *reverse, *company; 233 QRadioButton* simple, *full, *reverse, *company;
234 QCheckBox* setCompany; 234 QCheckBox* setCompany;
235}; 235};
236 236
237 237
238 238
239class KAex2phonePrefs : public QDialog 239class KAex2phonePrefs : public QDialog
240{ 240{
241 public: 241 public:
242 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 242 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
243 QDialog( parent, name, true ) 243 QDialog( parent, name, true )
244 { 244 {
245 setCaption( i18n("Export to phone options") ); 245 setCaption( i18n("Export to phone options") );
246 QVBoxLayout* lay = new QVBoxLayout( this ); 246 QVBoxLayout* lay = new QVBoxLayout( this );
247 lay->setSpacing( 3 ); 247 lay->setSpacing( 3 );
248 lay->setMargin( 3 ); 248 lay->setMargin( 3 );
249 QLabel *lab; 249 QLabel *lab;
250 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 250 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
251 lab->setAlignment (AlignHCenter ); 251 lab->setAlignment (AlignHCenter );
252 QHBox* temphb; 252 QHBox* temphb;
253 temphb = new QHBox( this ); 253 temphb = new QHBox( this );
254 new QLabel( i18n("I/O device: "), temphb ); 254 new QLabel( i18n("I/O device: "), temphb );
255 mPhoneDevice = new QLineEdit( temphb); 255 mPhoneDevice = new QLineEdit( temphb);
256 lay->addWidget( temphb ); 256 lay->addWidget( temphb );
257 temphb = new QHBox( this ); 257 temphb = new QHBox( this );
258 new QLabel( i18n("Connection: "), temphb ); 258 new QLabel( i18n("Connection: "), temphb );
259 mPhoneConnection = new QLineEdit( temphb); 259 mPhoneConnection = new QLineEdit( temphb);
260 lay->addWidget( temphb ); 260 lay->addWidget( temphb );
261 temphb = new QHBox( this ); 261 temphb = new QHBox( this );
262 new QLabel( i18n("Model(opt.): "), temphb ); 262 new QLabel( i18n("Model(opt.): "), temphb );
263 mPhoneModel = new QLineEdit( temphb); 263 mPhoneModel = new QLineEdit( temphb);
264 lay->addWidget( temphb ); 264 lay->addWidget( temphb );
265 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 265 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
266 // lay->addWidget( mWriteToSim ); 266 // lay->addWidget( mWriteToSim );
267 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 267 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
268 lab->setAlignment (AlignHCenter); 268 lab->setAlignment (AlignHCenter);
269 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 269 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
270 lay->addWidget( ok ); 270 lay->addWidget( ok );
271 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 271 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
272 lay->addWidget( cancel ); 272 lay->addWidget( cancel );
273 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 273 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
274 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 274 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
275 resize( 220, 240 ); 275 resize( 220, 240 );
276 276
277 } 277 }
278 278
279public: 279public:
280 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 280 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
281 QCheckBox* mWriteToSim; 281 QCheckBox* mWriteToSim;
282}; 282};
283 283
284 284
285bool pasteWithNewUid = true; 285bool pasteWithNewUid = true;
286 286
287#ifdef KAB_EMBEDDED 287#ifdef KAB_EMBEDDED
288KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 288KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
289 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 289 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
290 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 290 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
291 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 291 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
292#else //KAB_EMBEDDED 292#else //KAB_EMBEDDED
293KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 293KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
294 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 294 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
295 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 295 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
296 mReadWrite( readWrite ), mModified( false ) 296 mReadWrite( readWrite ), mModified( false )
297#endif //KAB_EMBEDDED 297#endif //KAB_EMBEDDED
298{ 298{
299 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 299 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
300 // syncManager->setBlockSave(false); 300 // syncManager->setBlockSave(false);
301 mIncSearchWidget = 0; 301 mIncSearchWidget = 0;
302 mMiniSplitter = 0; 302 mMiniSplitter = 0;
303 mExtensionBarSplitter = 0; 303 mExtensionBarSplitter = 0;
304 mIsPart = !parent->inherits( "KAddressBookMain" ); 304 mIsPart = !parent->inherits( "KAddressBookMain" );
305 mAddressBook = KABC::StdAddressBook::self(); 305 mAddressBook = KABC::StdAddressBook::self();
306 KABC::StdAddressBook::setAutomaticSave( false ); 306 KABC::StdAddressBook::setAutomaticSave( false );
307 307
308#ifndef KAB_EMBEDDED 308#ifndef KAB_EMBEDDED
309 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 309 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
310#endif //KAB_EMBEDDED 310#endif //KAB_EMBEDDED
311 311
312 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 312 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
313 SLOT( addressBookChanged() ) ); 313 SLOT( addressBookChanged() ) );
314 314
315#if 0 315#if 0
316 // LR moved to addressbook init method 316 // LR moved to addressbook init method
317 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 317 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
318 "X-Department", "KADDRESSBOOK" ); 318 "X-Department", "KADDRESSBOOK" );
319 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 319 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
320 "X-Profession", "KADDRESSBOOK" ); 320 "X-Profession", "KADDRESSBOOK" );
321 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 321 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
322 "X-AssistantsName", "KADDRESSBOOK" ); 322 "X-AssistantsName", "KADDRESSBOOK" );
323 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 323 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
324 "X-ManagersName", "KADDRESSBOOK" ); 324 "X-ManagersName", "KADDRESSBOOK" );
325 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 325 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
326 "X-SpousesName", "KADDRESSBOOK" ); 326 "X-SpousesName", "KADDRESSBOOK" );
327 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 327 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
328 "X-Office", "KADDRESSBOOK" ); 328 "X-Office", "KADDRESSBOOK" );
329 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 329 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
330 "X-IMAddress", "KADDRESSBOOK" ); 330 "X-IMAddress", "KADDRESSBOOK" );
331 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 331 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
332 "X-Anniversary", "KADDRESSBOOK" ); 332 "X-Anniversary", "KADDRESSBOOK" );
333 333
334 //US added this field to become compatible with Opie/qtopia addressbook 334 //US added this field to become compatible with Opie/qtopia addressbook
335 // values can be "female" or "male" or "". An empty field represents undefined. 335 // values can be "female" or "male" or "". An empty field represents undefined.
336 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 336 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
337 "X-Gender", "KADDRESSBOOK" ); 337 "X-Gender", "KADDRESSBOOK" );
338 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 338 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
339 "X-Children", "KADDRESSBOOK" ); 339 "X-Children", "KADDRESSBOOK" );
340 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 340 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
341 "X-FreeBusyUrl", "KADDRESSBOOK" ); 341 "X-FreeBusyUrl", "KADDRESSBOOK" );
342#endif 342#endif
343 initGUI(); 343 initGUI();
344 344
345 mIncSearchWidget->setFocus(); 345 mIncSearchWidget->setFocus();
346 346
347 347
348 connect( mViewManager, SIGNAL( selected( const QString& ) ), 348 connect( mViewManager, SIGNAL( selected( const QString& ) ),
349 SLOT( setContactSelected( const QString& ) ) ); 349 SLOT( setContactSelected( const QString& ) ) );
350 connect( mViewManager, SIGNAL( executed( const QString& ) ), 350 connect( mViewManager, SIGNAL( executed( const QString& ) ),
351 SLOT( executeContact( const QString& ) ) ); 351 SLOT( executeContact( const QString& ) ) );
352 352
353 connect( mViewManager, SIGNAL( deleteRequest( ) ), 353 connect( mViewManager, SIGNAL( deleteRequest( ) ),
354 SLOT( deleteContacts( ) ) ); 354 SLOT( deleteContacts( ) ) );
355 connect( mViewManager, SIGNAL( modified() ), 355 connect( mViewManager, SIGNAL( modified() ),
356 SLOT( setModified() ) ); 356 SLOT( setModified() ) );
357 357
358 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 358 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
359 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 359 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
360 360
361 connect( mXXPortManager, SIGNAL( modified() ), 361 connect( mXXPortManager, SIGNAL( modified() ),
362 SLOT( setModified() ) ); 362 SLOT( setModified() ) );
363 363
364 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 364 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
365 SLOT( incrementalSearchJump( const QString& ) ) ); 365 SLOT( incrementalSearchJump( const QString& ) ) );
366 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 366 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
367 mJumpButtonBar, SLOT( recreateButtons() ) ); 367 mJumpButtonBar, SLOT( recreateButtons() ) );
368 368
369 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 369 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
370 SLOT( sendMail( const QString& ) ) ); 370 SLOT( sendMail( const QString& ) ) );
371 371
372 372
373 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 373 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
374 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 374 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
375 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 375 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
376 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 376 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
377 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); 377 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog()));
378 378
379 379
380#ifndef KAB_EMBEDDED 380#ifndef KAB_EMBEDDED
381 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 381 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
382 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 382 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
383 383
384 connect( mDetails, SIGNAL( browse( const QString& ) ), 384 connect( mDetails, SIGNAL( browse( const QString& ) ),
385 SLOT( browse( const QString& ) ) ); 385 SLOT( browse( const QString& ) ) );
386 386
387 387
388 mAddressBookService = new KAddressBookService( this ); 388 mAddressBookService = new KAddressBookService( this );
389 389
390#endif //KAB_EMBEDDED 390#endif //KAB_EMBEDDED
391 391
392 mMessageTimer = new QTimer( this ); 392 mMessageTimer = new QTimer( this );
393 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 393 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
394 mEditorDialog = 0; 394 mEditorDialog = 0;
395 createAddresseeEditorDialog( this ); 395 createAddresseeEditorDialog( this );
396 setModified( false ); 396 setModified( false );
397 mBRdisabled = false; 397 mBRdisabled = false;
398#ifndef DESKTOP_VERSION 398#ifndef DESKTOP_VERSION
399 infrared = 0; 399 infrared = 0;
400#endif 400#endif
401 //toggleBeamReceive( ); 401 //toggleBeamReceive( );
402 mMainWindow->toolBar()->show(); 402 mMainWindow->toolBar()->show();
403 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 403 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
404 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 404 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
405} 405}
406 406
407void KABCore::updateToolBar() 407void KABCore::updateToolBar()
408{ 408{
409 static int iii = 0; 409 static int iii = 0;
410 ++iii; 410 ++iii;
411 mMainWindow->toolBar()->repaintMe(); 411 mMainWindow->toolBar()->repaintMe();
412 if ( iii < 4 ) 412 if ( iii < 4 )
413 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); 413 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar()));
414} 414}
415KABCore::~KABCore() 415KABCore::~KABCore()
416{ 416{
417 // save(); 417 // save();
418 //saveSettings(); 418 //saveSettings();
419 //KABPrefs::instance()->writeConfig(); 419 //KABPrefs::instance()->writeConfig();
420 delete AddresseeConfig::instance(); 420 delete AddresseeConfig::instance();
421 mAddressBook = 0; 421 mAddressBook = 0;
422 KABC::StdAddressBook::close(); 422 KABC::StdAddressBook::close();
423 423
424 delete syncManager; 424 delete syncManager;
425#ifndef DESKTOP_VERSION 425#ifndef DESKTOP_VERSION
426 if ( infrared ) 426 if ( infrared )
427 delete infrared; 427 delete infrared;
428#endif 428#endif
429} 429}
430void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 430void KABCore::receive( const QCString& cmsg, const QByteArray& data )
431{ 431{
432 //qDebug("KA: QCOP message received: %s ", cmsg.data() ); 432 //qDebug("KA: QCOP message received: %s ", cmsg.data() );
433 if ( cmsg == "setDocument(QString)" ) { 433 if ( cmsg == "setDocument(QString)" ) {
434 QDataStream stream( data, IO_ReadOnly ); 434 QDataStream stream( data, IO_ReadOnly );
435 QString fileName; 435 QString fileName;
436 stream >> fileName; 436 stream >> fileName;
437 recieve( fileName ); 437 recieve( fileName );
438 return; 438 return;
439 } 439 }
440} 440}
441void KABCore::toggleBeamReceive( ) 441void KABCore::toggleBeamReceive( )
442{ 442{
443 if ( mBRdisabled ) 443 if ( mBRdisabled )
444 return; 444 return;
445#ifndef DESKTOP_VERSION 445#ifndef DESKTOP_VERSION
446 if ( infrared ) { 446 if ( infrared ) {
447 qDebug("KA: AB disable BeamReceive "); 447 qDebug("KA: AB disable BeamReceive ");
448 delete infrared; 448 delete infrared;
449 infrared = 0; 449 infrared = 0;
450 mActionBR->setChecked(false); 450 mActionBR->setChecked(false);
451 return; 451 return;
452 } 452 }
453 qDebug("KA: AB enable BeamReceive "); 453 qDebug("KA: AB enable BeamReceive ");
454 mActionBR->setChecked(true); 454 mActionBR->setChecked(true);
455 455
456 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 456 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
457 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 457 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
458#endif 458#endif
459} 459}
460 460
461 461
462void KABCore::disableBR(bool b) 462void KABCore::disableBR(bool b)
463{ 463{
464#ifndef DESKTOP_VERSION 464#ifndef DESKTOP_VERSION
465 if ( b ) { 465 if ( b ) {
466 if ( infrared ) { 466 if ( infrared ) {
467 toggleBeamReceive( ); 467 toggleBeamReceive( );
468 } 468 }
469 mBRdisabled = true; 469 mBRdisabled = true;
470 } else { 470 } else {
471 if ( mBRdisabled ) { 471 if ( mBRdisabled ) {
472 mBRdisabled = false; 472 mBRdisabled = false;
473 //toggleBeamReceive( ); 473 //toggleBeamReceive( );
474 } 474 }
475 } 475 }
476#endif 476#endif
477 477
478} 478}
479void KABCore::recieve( QString fn ) 479void KABCore::recieve( QString fn )
480{ 480{
481 //qDebug("KABCore::recieve "); 481 //qDebug("KABCore::recieve ");
482 int count = mAddressBook->importFromFile( fn, true ); 482 int count = mAddressBook->importFromFile( fn, true );
483 if ( count ) 483 if ( count )
484 setModified( true ); 484 setModified( true );
485 mViewManager->refreshView(); 485 mViewManager->refreshView();
486 message(i18n("%1 contact(s) received!").arg( count )); 486 message(i18n("%1 contact(s) received!").arg( count ));
487 topLevelWidget()->showMaximized(); 487 topLevelWidget()->showMaximized();
488 topLevelWidget()->raise(); 488 topLevelWidget()->raise();
489} 489}
490void KABCore::restoreSettings() 490void KABCore::restoreSettings()
491{ 491{
492 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 492 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
493 493
494 bool state; 494 bool state;
495 495
496 if (mMultipleViewsAtOnce) 496 if (mMultipleViewsAtOnce)
497 state = KABPrefs::instance()->mDetailsPageVisible; 497 state = KABPrefs::instance()->mDetailsPageVisible;
498 else 498 else
499 state = false; 499 state = false;
500 500
501 mActionDetails->setChecked( state ); 501 mActionDetails->setChecked( state );
502 setDetailsVisible( state ); 502 setDetailsVisible( state );
503 503
504 state = KABPrefs::instance()->mJumpButtonBarVisible; 504 state = KABPrefs::instance()->mJumpButtonBarVisible;
505 505
506 mActionJumpBar->setChecked( state ); 506 mActionJumpBar->setChecked( state );
507 setJumpButtonBarVisible( state ); 507 setJumpButtonBarVisible( state );
508/*US 508/*US
509 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 509 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
510 if ( splitterSize.count() == 0 ) { 510 if ( splitterSize.count() == 0 ) {
511 splitterSize.append( width() / 2 ); 511 splitterSize.append( width() / 2 );
512 splitterSize.append( width() / 2 ); 512 splitterSize.append( width() / 2 );
513 } 513 }
514 mMiniSplitter->setSizes( splitterSize ); 514 mMiniSplitter->setSizes( splitterSize );
515 if ( mExtensionBarSplitter ) { 515 if ( mExtensionBarSplitter ) {
516 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 516 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
517 if ( splitterSize.count() == 0 ) { 517 if ( splitterSize.count() == 0 ) {
518 splitterSize.append( width() / 2 ); 518 splitterSize.append( width() / 2 );
519 splitterSize.append( width() / 2 ); 519 splitterSize.append( width() / 2 );
520 } 520 }
521 mExtensionBarSplitter->setSizes( splitterSize ); 521 mExtensionBarSplitter->setSizes( splitterSize );
522 522
523 } 523 }
524*/ 524*/
525 mViewManager->restoreSettings(); 525 mViewManager->restoreSettings();
526 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 526 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
527 mExtensionManager->restoreSettings(); 527 mExtensionManager->restoreSettings();
528#ifdef DESKTOP_VERSION 528#ifdef DESKTOP_VERSION
529 int wid = width(); 529 int wid = width();
530 if ( wid < 10 ) 530 if ( wid < 10 )
531 wid = 400; 531 wid = 400;
532#else 532#else
533 int wid = QApplication::desktop()->width(); 533 int wid = QApplication::desktop()->width();
534 if ( wid < 640 ) 534 if ( wid < 640 )
535 wid = QApplication::desktop()->height(); 535 wid = QApplication::desktop()->height();
536#endif 536#endif
537 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 537 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
538 if ( true /*splitterSize.count() == 0*/ ) { 538 if ( true /*splitterSize.count() == 0*/ ) {
539 splitterSize.append( wid / 2 ); 539 splitterSize.append( wid / 2 );
540 splitterSize.append( wid / 2 ); 540 splitterSize.append( wid / 2 );
541 } 541 }
542 mMiniSplitter->setSizes( splitterSize ); 542 mMiniSplitter->setSizes( splitterSize );
543 if ( mExtensionBarSplitter ) { 543 if ( mExtensionBarSplitter ) {
544 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 544 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
545 if ( true /*splitterSize.count() == 0*/ ) { 545 if ( true /*splitterSize.count() == 0*/ ) {
546 splitterSize.append( wid / 2 ); 546 splitterSize.append( wid / 2 );
547 splitterSize.append( wid / 2 ); 547 splitterSize.append( wid / 2 );
548 } 548 }
549 mExtensionBarSplitter->setSizes( splitterSize ); 549 mExtensionBarSplitter->setSizes( splitterSize );
550 550
551 } 551 }
552 552#ifdef DESKTOP_VERSION
553 553 KConfig *config = KABPrefs::instance()->getConfig();
554 config->setGroup("WidgetLayout");
555 QStringList list;
556 list = config->readListEntry("MainLayout");
557 int x,y,w,h;
558 if ( ! list.isEmpty() ) {
559 x = list[0].toInt();
560 y = list[1].toInt();
561 w = list[2].toInt();
562 h = list[3].toInt();
563 KApplication::testCoords( &x,&y,&w,&h );
564 topLevelWidget()->setGeometry(x,y,w,h);
565
566 } else {
567 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
568 }
569#endif
554} 570}
555 571
556void KABCore::saveSettings() 572void KABCore::saveSettings()
557{ 573{
558 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 574 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
559 if ( mExtensionBarSplitter ) 575 if ( mExtensionBarSplitter )
560 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 576 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
561 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 577 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
562 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 578 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
563#ifndef KAB_EMBEDDED 579#ifndef KAB_EMBEDDED
564 580
565 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 581 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
566 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 582 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
567#endif //KAB_EMBEDDED 583#endif //KAB_EMBEDDED
568 mExtensionManager->saveSettings(); 584 mExtensionManager->saveSettings();
569 mViewManager->saveSettings(); 585 mViewManager->saveSettings();
570 586
571 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 587 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
588#ifdef DESKTOP_VERSION
589 KConfig *config = KABPrefs::instance()->getConfig();
590 config->setGroup("WidgetLayout");
591 QStringList list ;//= config->readListEntry("MainLayout");
592 int x,y,w,h;
593 QWidget* wid;
594 wid = topLevelWidget();
595 x = wid->geometry().x();
596 y = wid->geometry().y();
597 w = wid->width();
598 h = wid->height();
599 list.clear();
600 list << QString::number( x );
601 list << QString::number( y );
602 list << QString::number( w );
603 list << QString::number( h );
604 config->writeEntry("MainLayout",list );
605#endif
572 KABPrefs::instance()->writeConfig(); 606 KABPrefs::instance()->writeConfig();
573 qDebug("KA: KABCore::saveSettings() "); 607 qDebug("KA: KABCore::saveSettings() ");
574} 608}
575 609
576KABC::AddressBook *KABCore::addressBook() const 610KABC::AddressBook *KABCore::addressBook() const
577{ 611{
578 return mAddressBook; 612 return mAddressBook;
579} 613}
580 614
581KConfig *KABCore::config() 615KConfig *KABCore::config()
582{ 616{
583#ifndef KAB_EMBEDDED 617#ifndef KAB_EMBEDDED
584 return KABPrefs::instance()->config(); 618 return KABPrefs::instance()->config();
585#else //KAB_EMBEDDED 619#else //KAB_EMBEDDED
586 return KABPrefs::instance()->getConfig(); 620 return KABPrefs::instance()->getConfig();
587#endif //KAB_EMBEDDED 621#endif //KAB_EMBEDDED
588} 622}
589 623
590KActionCollection *KABCore::actionCollection() const 624KActionCollection *KABCore::actionCollection() const
591{ 625{
592 return mGUIClient->actionCollection(); 626 return mGUIClient->actionCollection();
593} 627}
594 628
595KABC::Field *KABCore::currentSearchField() const 629KABC::Field *KABCore::currentSearchField() const
596{ 630{
597 if (mIncSearchWidget) 631 if (mIncSearchWidget)
598 return mIncSearchWidget->currentField(); 632 return mIncSearchWidget->currentField();
599 else 633 else
600 return 0; 634 return 0;
601} 635}
602 636
603QStringList KABCore::selectedUIDs() const 637QStringList KABCore::selectedUIDs() const
604{ 638{
605 return mViewManager->selectedUids(); 639 return mViewManager->selectedUids();
606} 640}
607 641
608KABC::Resource *KABCore::requestResource( QWidget *parent ) 642KABC::Resource *KABCore::requestResource( QWidget *parent )
609{ 643{
610 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 644 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
611 645
612 QPtrList<KRES::Resource> kresResources; 646 QPtrList<KRES::Resource> kresResources;
613 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 647 QPtrListIterator<KABC::Resource> resIt( kabcResources );
614 KABC::Resource *resource; 648 KABC::Resource *resource;
615 while ( ( resource = resIt.current() ) != 0 ) { 649 while ( ( resource = resIt.current() ) != 0 ) {
616 ++resIt; 650 ++resIt;
617 if ( !resource->readOnly() ) { 651 if ( !resource->readOnly() ) {
618 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 652 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
619 if ( res ) 653 if ( res )
620 kresResources.append( res ); 654 kresResources.append( res );
621 } 655 }
622 } 656 }
623 657
624 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 658 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
625 return static_cast<KABC::Resource*>( res ); 659 return static_cast<KABC::Resource*>( res );
626} 660}
627 661
628#ifndef KAB_EMBEDDED 662#ifndef KAB_EMBEDDED
629KAboutData *KABCore::createAboutData() 663KAboutData *KABCore::createAboutData()
630#else //KAB_EMBEDDED 664#else //KAB_EMBEDDED
631void KABCore::createAboutData() 665void KABCore::createAboutData()
632#endif //KAB_EMBEDDED 666#endif //KAB_EMBEDDED
633{ 667{
634 668
635 669
636 QString version; 670 QString version;
637#include <../version> 671#include <../version>
638 QMessageBox::about( this, "About KAddressbook/Pi", 672 QMessageBox::about( this, "About KAddressbook/Pi",
639 "KAddressbook/Platform-independent\n" 673 "KAddressbook/Platform-independent\n"
640 "(KA/Pi) " +version + " - " + 674 "(KA/Pi) " +version + " - " +
641#ifdef DESKTOP_VERSION 675#ifdef DESKTOP_VERSION
642 "Desktop Edition\n" 676 "Desktop Edition\n"
643#else 677#else
644 "PDA-Edition\n" 678 "PDA-Edition\n"
645 "for: Zaurus 5500 / 7x0 / 8x0\n" 679 "for: Zaurus 5500 / 7x0 / 8x0\n"
646#endif 680#endif
647 681
648 "(c) 2004 Ulf Schenk\n" 682 "(c) 2004 Ulf Schenk\n"
649 "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n" 683 "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n"
650 "(c) 1997-2003, The KDE PIM Team\n" 684 "(c) 1997-2003, The KDE PIM Team\n"
651 "Tobias Koenig Maintainer\n" 685 "Tobias Koenig Maintainer\n"
652 "Don Sanders Original author\n" 686 "Don Sanders Original author\n"
653 "Cornelius Schumacher Co-maintainer\n" 687 "Cornelius Schumacher Co-maintainer\n"
654 "Mike Pilone GUI and framework redesign\n" 688 "Mike Pilone GUI and framework redesign\n"
655 "Greg Stern DCOP interface\n" 689 "Greg Stern DCOP interface\n"
656 "Mark Westcot Contact pinning\n" 690 "Mark Westcot Contact pinning\n"
657 "Michel Boyer de la Giroday LDAP Lookup\n" 691 "Michel Boyer de la Giroday LDAP Lookup\n"
658 "Steffen Hansen LDAP Lookup" 692 "Steffen Hansen LDAP Lookup"
659#ifdef _WIN32_ 693#ifdef _WIN32_
660 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 694 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
661#endif 695#endif
662 ); 696 );
663} 697}
664 698
665void KABCore::setContactSelected( const QString &uid ) 699void KABCore::setContactSelected( const QString &uid )
666{ 700{
667 KABC::Addressee addr = mAddressBook->findByUid( uid ); 701 KABC::Addressee addr = mAddressBook->findByUid( uid );
668 if ( !mDetails->isHidden() ) 702 if ( !mDetails->isHidden() )
669 mDetails->setAddressee( addr ); 703 mDetails->setAddressee( addr );
670 704
671 if ( !addr.isEmpty() ) { 705 if ( !addr.isEmpty() ) {
672 emit contactSelected( addr.formattedName() ); 706 emit contactSelected( addr.formattedName() );
673 KABC::Picture pic = addr.photo(); 707 KABC::Picture pic = addr.photo();
674 if ( pic.isIntern() ) { 708 if ( pic.isIntern() ) {
675//US emit contactSelected( pic.data() ); 709//US emit contactSelected( pic.data() );
676//US instead use: 710//US instead use:
677 QPixmap px; 711 QPixmap px;
678 if (pic.data().isNull() != true) 712 if (pic.data().isNull() != true)
679 { 713 {
680 px.convertFromImage(pic.data()); 714 px.convertFromImage(pic.data());
681 } 715 }
682 716
683 emit contactSelected( px ); 717 emit contactSelected( px );
684 } 718 }
685 } 719 }
686 720
687 721
688 mExtensionManager->setSelectionChanged(); 722 mExtensionManager->setSelectionChanged();
689 723
690 // update the actions 724 // update the actions
691 bool selected = !uid.isEmpty(); 725 bool selected = !uid.isEmpty();
692 726
693 if ( mReadWrite ) { 727 if ( mReadWrite ) {
694 mActionCut->setEnabled( selected ); 728 mActionCut->setEnabled( selected );
695 mActionPaste->setEnabled( selected ); 729 mActionPaste->setEnabled( selected );
696 } 730 }
697 731
698 mActionCopy->setEnabled( selected ); 732 mActionCopy->setEnabled( selected );
699 mActionDelete->setEnabled( selected ); 733 mActionDelete->setEnabled( selected );
700 mActionEditAddressee->setEnabled( selected ); 734 mActionEditAddressee->setEnabled( selected );
701 mActionMail->setEnabled( selected ); 735 mActionMail->setEnabled( selected );
702 mActionMailVCard->setEnabled( selected ); 736 mActionMailVCard->setEnabled( selected );
703 //if (mActionBeam) 737 //if (mActionBeam)
704 //mActionBeam->setEnabled( selected ); 738 //mActionBeam->setEnabled( selected );
705 mActionWhoAmI->setEnabled( selected ); 739 mActionWhoAmI->setEnabled( selected );
706} 740}
707 741
708void KABCore::sendMail() 742void KABCore::sendMail()
709{ 743{
710 sendMail( mViewManager->selectedEmails().join( ", " ) ); 744 sendMail( mViewManager->selectedEmails().join( ", " ) );
711} 745}
712 746
713void KABCore::sendMail( const QString& emaillist ) 747void KABCore::sendMail( const QString& emaillist )
714{ 748{
715 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 749 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
716 if (emaillist.contains(",") > 0) 750 if (emaillist.contains(",") > 0)
717 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 751 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
718 else 752 else
719 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 753 ExternalAppHandler::instance()->mailToOneContact( emaillist );
720} 754}
721 755
722 756
723 757
724void KABCore::mailVCard() 758void KABCore::mailVCard()
725{ 759{
726 QStringList uids = mViewManager->selectedUids(); 760 QStringList uids = mViewManager->selectedUids();
727 if ( !uids.isEmpty() ) 761 if ( !uids.isEmpty() )
728 mailVCard( uids ); 762 mailVCard( uids );
729} 763}
730 764
731void KABCore::mailVCard( const QStringList& uids ) 765void KABCore::mailVCard( const QStringList& uids )
732{ 766{
733 QStringList urls; 767 QStringList urls;
734 768
735// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 769// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
736 770
737 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 771 QString dirName = "/tmp/" + KApplication::randomString( 8 );
738 772
739 773
740 774
741 QDir().mkdir( dirName, true ); 775 QDir().mkdir( dirName, true );
742 776
743 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 777 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
744 KABC::Addressee a = mAddressBook->findByUid( *it ); 778 KABC::Addressee a = mAddressBook->findByUid( *it );
745 779
746 if ( a.isEmpty() ) 780 if ( a.isEmpty() )
747 continue; 781 continue;
748 782
749 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 783 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
750 784
751 QString fileName = dirName + "/" + name; 785 QString fileName = dirName + "/" + name;
752 786
753 QFile outFile(fileName); 787 QFile outFile(fileName);
754 788
755 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 789 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
756 KABC::VCardConverter converter; 790 KABC::VCardConverter converter;
757 QString vcard; 791 QString vcard;
758 792
759 converter.addresseeToVCard( a, vcard ); 793 converter.addresseeToVCard( a, vcard );
760 794
761 QTextStream t( &outFile ); // use a text stream 795 QTextStream t( &outFile ); // use a text stream
762 t.setEncoding( QTextStream::UnicodeUTF8 ); 796 t.setEncoding( QTextStream::UnicodeUTF8 );
763 t << vcard; 797 t << vcard;
764 798
765 outFile.close(); 799 outFile.close();
766 800
767 urls.append( fileName ); 801 urls.append( fileName );
768 } 802 }
769 } 803 }
770 804
771 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 805 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
772 806
773 807
774/*US 808/*US
775 kapp->invokeMailer( QString::null, QString::null, QString::null, 809 kapp->invokeMailer( QString::null, QString::null, QString::null,
776 QString::null, // subject 810 QString::null, // subject
777 QString::null, // body 811 QString::null, // body
778 QString::null, 812 QString::null,
779 urls ); // attachments 813 urls ); // attachments
780*/ 814*/
781 815
782} 816}
783 817
784/** 818/**
785 Beams the "WhoAmI contact. 819 Beams the "WhoAmI contact.
786*/ 820*/
787void KABCore::beamMySelf() 821void KABCore::beamMySelf()
788{ 822{
789 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 823 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
790 if (!a.isEmpty()) 824 if (!a.isEmpty())
791 { 825 {
792 QStringList uids; 826 QStringList uids;
793 uids << a.uid(); 827 uids << a.uid();
794 828
795 beamVCard(uids); 829 beamVCard(uids);
796 } else { 830 } else {
797 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 831 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
798 832
799 833
800 } 834 }
801} 835}
802void KABCore::updateMainWindow() 836void KABCore::updateMainWindow()
803{ 837{
804 mMainWindow->showMaximized(); 838 mMainWindow->showMaximized();
805 mMainWindow->update(); 839 mMainWindow->update();
806} 840}
807void KABCore::resizeEvent(QResizeEvent* e ) 841void KABCore::resizeEvent(QResizeEvent* e )
808{ 842{
809 if ( !mMiniSplitter ) 843 if ( !mMiniSplitter )
810 return; 844 return;
811 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); 845 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) ");
812 if ( QApplication::desktop()->width() >= 480 ) { 846 if ( QApplication::desktop()->width() >= 480 ) {
813 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 847 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
814 if ( mMiniSplitter->orientation() == Qt::Vertical ) { 848 if ( mMiniSplitter->orientation() == Qt::Vertical ) {
815 mMiniSplitter->setOrientation( Qt::Horizontal); 849 mMiniSplitter->setOrientation( Qt::Horizontal);
816 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 850 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
817 } 851 }
818 if ( QApplication::desktop()->width() <= 640 ) { 852 if ( QApplication::desktop()->width() <= 640 ) {
819 mMainWindow->showMinimized(); 853 mMainWindow->showMinimized();
820 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 854 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
821 mViewManager->getFilterAction()->setComboWidth( 150 ); 855 mViewManager->getFilterAction()->setComboWidth( 150 );
822 if ( mIncSearchWidget ) 856 if ( mIncSearchWidget )
823 mIncSearchWidget->setSize(); 857 mIncSearchWidget->setSize();
824 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 858 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
825 } 859 }
826 860
827 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 861 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
828 if ( mMiniSplitter->orientation() == Qt::Horizontal ) { 862 if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
829 mMiniSplitter->setOrientation( Qt::Vertical ); 863 mMiniSplitter->setOrientation( Qt::Vertical );
830 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 864 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
831 } 865 }
832 if ( QApplication::desktop()->width() <= 640 ) { 866 if ( QApplication::desktop()->width() <= 640 ) {
833 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 867 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
834 mMainWindow->showMinimized(); 868 mMainWindow->showMinimized();
835 if ( KABPrefs::instance()->mHideSearchOnSwitch ) { 869 if ( KABPrefs::instance()->mHideSearchOnSwitch ) {
836 if ( mIncSearchWidget ) { 870 if ( mIncSearchWidget ) {
837 mIncSearchWidget->setSize(); 871 mIncSearchWidget->setSize();
838 } 872 }
839 } else { 873 } else {
840 mViewManager->getFilterAction()->setComboWidth( 0 ); 874 mViewManager->getFilterAction()->setComboWidth( 0 );
841 } 875 }
842 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 876 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
843 } 877 }
844 } 878 }
845 } 879 }
846 QWidget::resizeEvent( e ); 880 QWidget::resizeEvent( e );
847 881
848} 882}
849void KABCore::export2phone() 883void KABCore::export2phone()
850{ 884{
851 885
852 QStringList uids; 886 QStringList uids;
853 XXPortSelectDialog dlg( this, false, this ); 887 XXPortSelectDialog dlg( this, false, this );
854 if ( dlg.exec() ) 888 if ( dlg.exec() )
855 uids = dlg.uids(); 889 uids = dlg.uids();
856 else 890 else
857 return; 891 return;
858 if ( uids.isEmpty() ) 892 if ( uids.isEmpty() )
859 return; 893 return;
860 // qDebug("count %d ", uids.count()); 894 // qDebug("count %d ", uids.count());
861 895
862 KAex2phonePrefs ex2phone; 896 KAex2phonePrefs ex2phone;
863 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 897 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
864 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 898 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
865 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 899 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
866 900
867 if ( !ex2phone.exec() ) { 901 if ( !ex2phone.exec() ) {
868 return; 902 return;
869 } 903 }
870 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 904 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
871 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 905 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
872 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 906 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
873 907
874 908
875 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 909 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
876 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 910 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
877 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 911 KPimGlobalPrefs::instance()->mEx2PhoneModel );
878 912
879 QString fileName = getPhoneFile(); 913 QString fileName = getPhoneFile();
880 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 914 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
881 return; 915 return;
882 916
883 message(i18n("Exporting to phone...")); 917 message(i18n("Exporting to phone..."));
884 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 918 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
885 919
886} 920}
887QString KABCore::getPhoneFile() 921QString KABCore::getPhoneFile()
888{ 922{
889#ifdef DESKTOP_VERSION 923#ifdef DESKTOP_VERSION
890 return locateLocal("tmp", "phonefile.vcf"); 924 return locateLocal("tmp", "phonefile.vcf");
891#else 925#else
892 return "/tmp/phonefile.vcf"; 926 return "/tmp/phonefile.vcf";
893#endif 927#endif
894 928
895} 929}
896void KABCore::writeToPhone( ) 930void KABCore::writeToPhone( )
897{ 931{
898 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 932 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
899 message(i18n("Export to phone finished!")); 933 message(i18n("Export to phone finished!"));
900 else 934 else
901 qDebug(i18n("KA: Error exporting to phone")); 935 qDebug(i18n("KA: Error exporting to phone"));
902} 936}
903void KABCore::beamVCard() 937void KABCore::beamVCard()
904{ 938{
905 QStringList uids; 939 QStringList uids;
906 XXPortSelectDialog dlg( this, false, this ); 940 XXPortSelectDialog dlg( this, false, this );
907 if ( dlg.exec() ) 941 if ( dlg.exec() )
908 uids = dlg.uids(); 942 uids = dlg.uids();
909 else 943 else
910 return; 944 return;
911 if ( uids.isEmpty() ) 945 if ( uids.isEmpty() )
912 return; 946 return;
913 beamVCard( uids ); 947 beamVCard( uids );
914} 948}
915 949
916 950
917void KABCore::beamVCard(const QStringList& uids) 951void KABCore::beamVCard(const QStringList& uids)
918{ 952{
919 953
920 // LR: we should use the /tmp dir on the Zaurus, 954 // LR: we should use the /tmp dir on the Zaurus,
921 // because: /tmp = RAM, (HOME)/kdepim = flash memory 955 // because: /tmp = RAM, (HOME)/kdepim = flash memory
922 956
923#ifdef DESKTOP_VERSION 957#ifdef DESKTOP_VERSION
924 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 958 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
925#else 959#else
926 QString fileName = "/tmp/kapibeamfile.vcf"; 960 QString fileName = "/tmp/kapibeamfile.vcf";
927#endif 961#endif
928 962
929 KABC::VCardConverter converter; 963 KABC::VCardConverter converter;
930 QString description; 964 QString description;
931 QString datastream; 965 QString datastream;
932 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 966 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
933 KABC::Addressee a = mAddressBook->findByUid( *it ); 967 KABC::Addressee a = mAddressBook->findByUid( *it );
934 968
935 if ( a.isEmpty() ) 969 if ( a.isEmpty() )
936 continue; 970 continue;
937 971
938 if (description.isEmpty()) 972 if (description.isEmpty())
939 description = a.formattedName(); 973 description = a.formattedName();
940 974
941 QString vcard; 975 QString vcard;
942 converter.addresseeToVCard( a, vcard ); 976 converter.addresseeToVCard( a, vcard );
943 int start = 0; 977 int start = 0;
944 int next; 978 int next;
945 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 979 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
946 int semi = vcard.find(";", next); 980 int semi = vcard.find(";", next);
947 int dopp = vcard.find(":", next); 981 int dopp = vcard.find(":", next);
948 int sep; 982 int sep;
949 if ( semi < dopp && semi >= 0 ) 983 if ( semi < dopp && semi >= 0 )
950 sep = semi ; 984 sep = semi ;
951 else 985 else
952 sep = dopp; 986 sep = dopp;
953 datastream +=vcard.mid( start, next - start); 987 datastream +=vcard.mid( start, next - start);
954 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 988 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
955 start = sep; 989 start = sep;