summaryrefslogtreecommitdiff
authoreilers <eilers>2002-12-11 17:15:12 (UTC)
committer eilers <eilers>2002-12-11 17:15:12 (UTC)
commit9f5e007f4859027eaeb989c620ec62fc698b44cc (patch) (unidiff)
treef87f5882e5e9f87c32ac3833d9396a0de16b1c40
parent77b921d0269820b16d8ec613fb8de578638d372e (diff)
downloadopie-9f5e007f4859027eaeb989c620ec62fc698b44cc.zip
opie-9f5e007f4859027eaeb989c620ec62fc698b44cc.tar.gz
opie-9f5e007f4859027eaeb989c620ec62fc698b44cc.tar.bz2
Added dialogbox to notify that the vcard was unable to read
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index e009d52..a1ce5a0 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -164,384 +164,390 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
164 // searchEdit->setFont( f ); 164 // searchEdit->setFont( f );
165 165
166 searchBar->setStretchableWidget( searchEdit ); 166 searchBar->setStretchableWidget( searchEdit );
167 connect( searchEdit, SIGNAL( returnPressed( ) ), 167 connect( searchEdit, SIGNAL( returnPressed( ) ),
168 this, SLOT( slotFind( ) ) ); 168 this, SLOT( slotFind( ) ) );
169 169
170 a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); 170 a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
171 connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); 171 connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) );
172 a->addTo( searchBar ); 172 a->addTo( searchBar );
173 173
174 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 174 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
175 connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); 175 connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) );
176 a->addTo( searchBar ); 176 a->addTo( searchBar );
177 177
178 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "mail/sendmail" ), 178 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "mail/sendmail" ),
179 QString::null, 0, this, 0 ); 179 QString::null, 0, this, 0 );
180 //a->setEnabled( FALSE ); we got support for it now :) zecke 180 //a->setEnabled( FALSE ); we got support for it now :) zecke
181 actionMail = a; 181 actionMail = a;
182 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); 182 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) );
183 a->addTo( edit ); 183 a->addTo( edit );
184 a->addTo( listTools ); 184 a->addTo( listTools );
185 185
186 if ( Ir::supported() ) { 186 if ( Ir::supported() ) {
187 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, 187 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null,
188 0, this, 0 ); 188 0, this, 0 );
189 actionBeam = a; 189 actionBeam = a;
190 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); 190 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) );
191 a->addTo( edit ); 191 a->addTo( edit );
192 a->addTo( listTools ); 192 a->addTo( listTools );
193 } 193 }
194 194
195 edit->insertSeparator(); 195 edit->insertSeparator();
196 196
197 a = new QAction( tr("Import vCard"), QString::null, 0, 0); 197 a = new QAction( tr("Import vCard"), QString::null, 0, 0);
198 actionPersonal = a; 198 actionPersonal = a;
199 connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); 199 connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) );
200 a->addTo( edit ); 200 a->addTo( edit );
201 201
202 edit->insertSeparator(); 202 edit->insertSeparator();
203 203
204 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); 204 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE );
205 actionPersonal = a; 205 actionPersonal = a;
206 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); 206 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) );
207 a->addTo( edit ); 207 a->addTo( edit );
208 208
209 209
210#ifdef __DEBUG_RELEASE 210#ifdef __DEBUG_RELEASE
211 // Remove this function for public Release ! This is only 211 // Remove this function for public Release ! This is only
212 // for debug purposes .. 212 // for debug purposes ..
213 a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); 213 a = new QAction( tr( "Save all Data"), QString::null, 0, 0 );
214 connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); 214 connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) );
215 a->addTo( edit ); 215 a->addTo( edit );
216#endif 216#endif
217 a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 217 a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null,
218 0, this, 0 ); 218 0, this, 0 );
219 connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); 219 connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) );
220 a->addTo( edit ); 220 a->addTo( edit );
221 221
222 // Create Views 222 // Create Views
223 listContainer = new QWidget( this ); 223 listContainer = new QWidget( this );
224 QVBoxLayout *vb = new QVBoxLayout( listContainer ); 224 QVBoxLayout *vb = new QVBoxLayout( listContainer );
225 225
226 m_abView = new AbView( listContainer, m_config.orderList() ); 226 m_abView = new AbView( listContainer, m_config.orderList() );
227 vb->addWidget( m_abView ); 227 vb->addWidget( m_abView );
228 // abList->setHScrollBarMode( QScrollView::AlwaysOff ); 228 // abList->setHScrollBarMode( QScrollView::AlwaysOff );
229 connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), 229 connect( m_abView, SIGNAL( signalViewSwitched ( int ) ),
230 this, SLOT( slotViewSwitched( int ) ) ); 230 this, SLOT( slotViewSwitched( int ) ) );
231 231
232 232
233 QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); 233 QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) );
234 234
235 m_abView->load(); 235 m_abView->load();
236 236
237 // Letter Picker 237 // Letter Picker
238 pLabel = new LetterPicker( listContainer ); 238 pLabel = new LetterPicker( listContainer );
239 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); 239 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char)));
240 connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); 240 connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) );
241 241
242 vb->addWidget( pLabel ); 242 vb->addWidget( pLabel );
243 243
244 // Category Menu 244 // Category Menu
245 catMenu = new QPopupMenu( this ); 245 catMenu = new QPopupMenu( this );
246 catMenu->setCheckable( TRUE ); 246 catMenu->setCheckable( TRUE );
247 connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); 247 connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) );
248 populateCategories(); 248 populateCategories();
249 mbList->insertItem( tr("View"), catMenu ); 249 mbList->insertItem( tr("View"), catMenu );
250 250
251 defaultFont = new QFont( m_abView->font() ); 251 defaultFont = new QFont( m_abView->font() );
252 slotSetFont(m_config.fontSize()); 252 slotSetFont(m_config.fontSize());
253 m_curFontSize = m_config.fontSize(); 253 m_curFontSize = m_config.fontSize();
254 254
255 setCentralWidget(listContainer); 255 setCentralWidget(listContainer);
256 256
257 // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); 257 // qDebug("adressbook contrsuction: t=%d", t.elapsed() );
258 258
259 259
260 isLoading = false; 260 isLoading = false;
261} 261}
262 262
263 263
264void AddressbookWindow::slotConfig() 264void AddressbookWindow::slotConfig()
265{ 265{
266 ConfigDlg* dlg = new ConfigDlg( this, "Config" ); 266 ConfigDlg* dlg = new ConfigDlg( this, "Config" );
267 dlg -> setConfig( m_config ); 267 dlg -> setConfig( m_config );
268 dlg -> showMaximized(); 268 dlg -> showMaximized();
269 if ( dlg -> exec() ) { 269 if ( dlg -> exec() ) {
270 qWarning ("Config Dialog accepted !"); 270 qWarning ("Config Dialog accepted !");
271 m_config = dlg -> getConfig(); 271 m_config = dlg -> getConfig();
272 if ( m_curFontSize != m_config.fontSize() ){ 272 if ( m_curFontSize != m_config.fontSize() ){
273 qWarning("Font was changed!"); 273 qWarning("Font was changed!");
274 m_curFontSize = m_config.fontSize(); 274 m_curFontSize = m_config.fontSize();
275 emit slotSetFont( m_curFontSize ); 275 emit slotSetFont( m_curFontSize );
276 } 276 }
277 m_abView -> setListOrder( m_config.orderList() ); 277 m_abView -> setListOrder( m_config.orderList() );
278 } 278 }
279 279
280 delete dlg; 280 delete dlg;
281} 281}
282 282
283 283
284void AddressbookWindow::slotSetFont( int size ) 284void AddressbookWindow::slotSetFont( int size )
285{ 285{
286 qWarning("void AddressbookWindow::slotSetFont( %d )", size); 286 qWarning("void AddressbookWindow::slotSetFont( %d )", size);
287 287
288 if (size > 2 || size < 0) 288 if (size > 2 || size < 0)
289 size = 1; 289 size = 1;
290 290
291 m_config.setFontSize( size ); 291 m_config.setFontSize( size );
292 292
293 QFont *currentFont; 293 QFont *currentFont;
294 294
295 switch (size) { 295 switch (size) {
296 case 0: 296 case 0:
297 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); 297 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) );
298 currentFont = new QFont (m_abView->font()); 298 currentFont = new QFont (m_abView->font());
299 // abList->resizeRows(currentFont->pixelSize() + 7); :SX 299 // abList->resizeRows(currentFont->pixelSize() + 7); :SX
300 // abList->resizeRows(); 300 // abList->resizeRows();
301 break; 301 break;
302 case 1: 302 case 1:
303 m_abView->setFont( *defaultFont ); 303 m_abView->setFont( *defaultFont );
304 currentFont = new QFont (m_abView->font()); 304 currentFont = new QFont (m_abView->font());
305 // // abList->resizeRows(currentFont->pixelSize() + 7); 305 // // abList->resizeRows(currentFont->pixelSize() + 7);
306 // abList->resizeRows(); 306 // abList->resizeRows();
307 break; 307 break;
308 case 2: 308 case 2:
309 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); 309 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) );
310 currentFont = new QFont (m_abView->font()); 310 currentFont = new QFont (m_abView->font());
311 // //abList->resizeRows(currentFont->pixelSize() + 7); 311 // //abList->resizeRows(currentFont->pixelSize() + 7);
312 // abList->resizeRows(); 312 // abList->resizeRows();
313 break; 313 break;
314 } 314 }
315} 315}
316 316
317 317
318 318
319void AddressbookWindow::importvCard() { 319void AddressbookWindow::importvCard() {
320 QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); 320 QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this );
321 if(!str.isEmpty() ){ 321 if(!str.isEmpty() ){
322 setDocument((const QString&) str ); 322 setDocument((const QString&) str );
323 } 323 }
324 324
325} 325}
326 326
327void AddressbookWindow::setDocument( const QString &filename ) 327void AddressbookWindow::setDocument( const QString &filename )
328{ 328{
329 qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); 329 qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() );
330 330
331 if ( filename.find(".vcf") != int(filename.length()) - 4 ){ 331 if ( filename.find(".vcf") != int(filename.length()) - 4 ){
332 332
333 333
334 334
335 switch( QMessageBox::information( this, tr ( "Right file type ?" ), 335 switch( QMessageBox::information( this, tr ( "Right file type ?" ),
336 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), 336 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ),
337 tr( "&Yes" ), tr( "&No" ), QString::null, 337 tr( "&Yes" ), tr( "&No" ), QString::null,
338 0, // Enter == button 0 338 0, // Enter == button 0
339 2 ) ) { // Escape == button 2 339 2 ) ) { // Escape == button 2
340 case 0: 340 case 0:
341 qWarning("YES clicked"); 341 qWarning("YES clicked");
342 break; 342 break;
343 case 1: 343 case 1:
344 qWarning("NO clicked"); 344 qWarning("NO clicked");
345 return; 345 return;
346 break; 346 break;
347 } 347 }
348 } 348 }
349 349
350 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 350 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
351 filename ); 351 filename );
352 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 352 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
353 OContactAccess::List allList = access->allRecords(); 353 OContactAccess::List allList = access->allRecords();
354 qWarning( "Found number of contacts in File: %d", allList.count() ); 354 qWarning( "Found number of contacts in File: %d", allList.count() );
355 355
356 if ( !allList.count() ) {
357 QMessageBox::information( this, "Import VCard",
358 "It was impossible to import the VCard.\n"
359 "The VCard may be corrupted !" );
360 }
361
356 bool doAsk = true; 362 bool doAsk = true;
357 OContactAccess::List::Iterator it; 363 OContactAccess::List::Iterator it;
358 for ( it = allList.begin(); it != allList.end(); ++it ){ 364 for ( it = allList.begin(); it != allList.end(); ++it ){
359 qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); 365 qWarning("Adding Contact from: %s", (*it).fullName().latin1() );
360 if ( doAsk ){ 366 if ( doAsk ){
361 switch( QMessageBox::information( this, tr ( "Add Contact ?" ), 367 switch( QMessageBox::information( this, tr ( "Add Contact ?" ),
362 tr( "Do you really want add contact for \n%1 ?" ) 368 tr( "Do you really want add contact for \n%1 ?" )
363 .arg( (*it).fullName().latin1() ), 369 .arg( (*it).fullName().latin1() ),
364 tr( "&Yes" ), tr( "&No" ), tr( "&AllYes"), 370 tr( "&Yes" ), tr( "&No" ), tr( "&AllYes"),
365 0, // Enter == button 0 371 0, // Enter == button 0
366 2 ) ) { // Escape == button 2 372 2 ) ) { // Escape == button 2
367 case 0: 373 case 0:
368 qWarning("YES clicked"); 374 qWarning("YES clicked");
369 m_abView->addEntry( *it ); 375 m_abView->addEntry( *it );
370 break; 376 break;
371 case 1: 377 case 1:
372 qWarning("NO clicked"); 378 qWarning("NO clicked");
373 break; 379 break;
374 case 2: 380 case 2:
375 qWarning("YesAll clicked"); 381 qWarning("YesAll clicked");
376 doAsk = false; 382 doAsk = false;
377 break; 383 break;
378 } 384 }
379 }else 385 }else
380 m_abView->addEntry( *it ); 386 m_abView->addEntry( *it );
381 387
382 } 388 }
383 389
384 delete access; 390 delete access;
385} 391}
386 392
387void AddressbookWindow::resizeEvent( QResizeEvent *e ) 393void AddressbookWindow::resizeEvent( QResizeEvent *e )
388{ 394{
389 QMainWindow::resizeEvent( e ); 395 QMainWindow::resizeEvent( e );
390 396
391 397
392} 398}
393 399
394AddressbookWindow::~AddressbookWindow() 400AddressbookWindow::~AddressbookWindow()
395{ 401{
396 ToolBarDock dock; 402 ToolBarDock dock;
397 int dummy; 403 int dummy;
398 bool bDummy; 404 bool bDummy;
399 getLocation ( listTools, dock, dummy, bDummy, dummy ); 405 getLocation ( listTools, dock, dummy, bDummy, dummy );
400 m_config.setToolBarDock( dock ); 406 m_config.setToolBarDock( dock );
401 m_config.save(); 407 m_config.save();
402} 408}
403 409
404void AddressbookWindow::slotUpdateToolbar() 410void AddressbookWindow::slotUpdateToolbar()
405{ 411{
406 OContact ce = m_abView->currentEntry(); 412 OContact ce = m_abView->currentEntry();
407 actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); 413 actionMail->setEnabled( !ce.defaultEmail().isEmpty() );
408} 414}
409 415
410void AddressbookWindow::slotListNew() 416void AddressbookWindow::slotListNew()
411{ 417{
412 OContact cnt; 418 OContact cnt;
413 if( !syncing ) { 419 if( !syncing ) {
414 editEntry( NewEntry ); 420 editEntry( NewEntry );
415 } else { 421 } else {
416 QMessageBox::warning(this, tr("OContacts"), 422 QMessageBox::warning(this, tr("OContacts"),
417 tr("Can not edit data, currently syncing")); 423 tr("Can not edit data, currently syncing"));
418 } 424 }
419} 425}
420 426
421// void AddressbookWindow::slotListView() 427// void AddressbookWindow::slotListView()
422// { 428// {
423 // m_abView -> init( abList->currentEntry() ); 429 // m_abView -> init( abList->currentEntry() );
424 // // :SX mView->sync(); 430 // // :SX mView->sync();
425 // //:SXshowView(); 431 // //:SXshowView();
426// } 432// }
427 433
428void AddressbookWindow::slotListDelete() 434void AddressbookWindow::slotListDelete()
429{ 435{
430 if(!syncing) { 436 if(!syncing) {
431 OContact tmpEntry = m_abView ->currentEntry(); 437 OContact tmpEntry = m_abView ->currentEntry();
432 438
433 // get a name, do the best we can... 439 // get a name, do the best we can...
434 QString strName = tmpEntry.fullName(); 440 QString strName = tmpEntry.fullName();
435 if ( strName.isEmpty() ) { 441 if ( strName.isEmpty() ) {
436 strName = tmpEntry.company(); 442 strName = tmpEntry.company();
437 if ( strName.isEmpty() ) 443 if ( strName.isEmpty() )
438 strName = "No Name"; 444 strName = "No Name";
439 } 445 }
440 446
441 447
442 if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), 448 if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ),
443 strName ) ) { 449 strName ) ) {
444 m_abView->removeEntry( tmpEntry.uid() ); 450 m_abView->removeEntry( tmpEntry.uid() );
445 } 451 }
446 } else { 452 } else {
447 QMessageBox::warning( this, tr("Contacts"), 453 QMessageBox::warning( this, tr("Contacts"),
448 tr("Can not edit data, currently syncing") ); 454 tr("Can not edit data, currently syncing") );
449 } 455 }
450} 456}
451 457
452void AddressbookWindow::slotFindOpen() 458void AddressbookWindow::slotFindOpen()
453{ 459{
454 searchBar->show(); 460 searchBar->show();
455 m_abView -> inSearch(); 461 m_abView -> inSearch();
456 searchEdit->setFocus(); 462 searchEdit->setFocus();
457} 463}
458void AddressbookWindow::slotFindClose() 464void AddressbookWindow::slotFindClose()
459{ 465{
460 searchBar->hide(); 466 searchBar->hide();
461 m_abView -> offSearch(); 467 m_abView -> offSearch();
462 // m_abView->setFocus(); 468 // m_abView->setFocus();
463} 469}
464 470
465 471
466void AddressbookWindow::slotFind() 472void AddressbookWindow::slotFind()
467{ 473{
468 m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); 474 m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false);
469 475
470 searchEdit->clearFocus(); 476 searchEdit->clearFocus();
471 // m_abView->setFocus(); 477 // m_abView->setFocus();
472 478
473} 479}
474 480
475void AddressbookWindow::slotViewBack() 481void AddressbookWindow::slotViewBack()
476{ 482{
477 // :SX showList(); 483 // :SX showList();
478} 484}
479 485
480void AddressbookWindow::slotViewEdit() 486void AddressbookWindow::slotViewEdit()
481{ 487{
482 if(!syncing) { 488 if(!syncing) {
483 if (actionPersonal->isOn()) { 489 if (actionPersonal->isOn()) {
484 editPersonal(); 490 editPersonal();
485 } else { 491 } else {
486 editEntry( EditEntry ); 492 editEntry( EditEntry );
487 } 493 }
488 } else { 494 } else {
489 QMessageBox::warning( this, tr("Contacts"), 495 QMessageBox::warning( this, tr("Contacts"),
490 tr("Can not edit data, currently syncing") ); 496 tr("Can not edit data, currently syncing") );
491 } 497 }
492} 498}
493 499
494 500
495 501
496void AddressbookWindow::writeMail() 502void AddressbookWindow::writeMail()
497{ 503{
498 OContact c = m_abView -> currentEntry(); 504 OContact c = m_abView -> currentEntry();
499 QString name = c.fileAs(); 505 QString name = c.fileAs();
500 QString email = c.defaultEmail(); 506 QString email = c.defaultEmail();
501 507
502 // I prefer the OPIE-Environment variable before the 508 // I prefer the OPIE-Environment variable before the
503 // QPE-one.. 509 // QPE-one..
504 QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); 510 QString basepath = QString::fromLatin1( getenv("OPIEDIR") );
505 if ( basepath.isEmpty() ) 511 if ( basepath.isEmpty() )
506 basepath = QString::fromLatin1( getenv("QPEDIR") ); 512 basepath = QString::fromLatin1( getenv("QPEDIR") );
507 513
508 // Try to access the preferred. If not possible, try to 514 // Try to access the preferred. If not possible, try to
509 // switch to the other one.. 515 // switch to the other one..
510 if ( m_config.useQtMail() ){ 516 if ( m_config.useQtMail() ){
511 qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); 517 qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1());
512 if ( QFile::exists( basepath + "/bin/qtmail" ) ){ 518 if ( QFile::exists( basepath + "/bin/qtmail" ) ){
513 qWarning ("QCop"); 519 qWarning ("QCop");
514 QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); 520 QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)");
515 e << name << email; 521 e << name << email;
516 return; 522 return;
517 } else 523 } else
518 m_config.setUseOpieMail( true ); 524 m_config.setUseOpieMail( true );
519 } 525 }
520 if ( m_config.useOpieMail() ){ 526 if ( m_config.useOpieMail() ){
521 qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); 527 qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1());
522 if ( QFile::exists( basepath + "/bin/mail" ) ){ 528 if ( QFile::exists( basepath + "/bin/mail" ) ){
523 qWarning ("QCop"); 529 qWarning ("QCop");
524 QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); 530 QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)");
525 e << name << email; 531 e << name << email;
526 return; 532 return;
527 } else 533 } else
528 m_config.setUseQtMail( true ); 534 m_config.setUseQtMail( true );
529 } 535 }
530 536
531} 537}
532 538
533static const char * beamfile = "/tmp/obex/contact.vcf"; 539static const char * beamfile = "/tmp/obex/contact.vcf";
534 540
535void AddressbookWindow::slotBeam() 541void AddressbookWindow::slotBeam()
536{ 542{
537 QString filename; 543 QString filename;
538 OContact c; 544 OContact c;
539 if ( actionPersonal->isOn() ) { 545 if ( actionPersonal->isOn() ) {
540 filename = addressbookPersonalVCardName(); 546 filename = addressbookPersonalVCardName();
541 if (!QFile::exists(filename)) 547 if (!QFile::exists(filename))
542 return; // can't beam a non-existent file 548 return; // can't beam a non-existent file
543 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 549 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
544 filename ); 550 filename );
545 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 551 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
546 OContactAccess::List allList = access->allRecords(); 552 OContactAccess::List allList = access->allRecords();
547 OContactAccess::List::Iterator it = allList.begin(); // Just take first 553 OContactAccess::List::Iterator it = allList.begin(); // Just take first