summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/addressbook.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 8a5f9d5..9ae66d1 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -20,16 +20,16 @@
20#define QTOPIA_INTERNAL_FD 20#define QTOPIA_INTERNAL_FD
21 21
22// #include "addresssettings.h" 22// #include "addresssettings.h"
23#include "addressbook.h" 23#include "addressbook.h"
24 24
25 25
26#include <opie/ofileselector.h> 26#include <opie2/ofileselector.h>
27#include <opie/ofiledialog.h> 27#include <opie2/ofiledialog.h>
28#include <opie/ocontact.h> 28#include <opie2/opimcontact.h>
29#include <opie/ocontactaccessbackend_vcard.h> 29#include <opie2/ocontactaccessbackend_vcard.h>
30 30
31#include <qpe/resource.h> 31#include <qpe/resource.h>
32#include <qpe/ir.h> 32#include <qpe/ir.h>
33#include <qpe/qpemessagebox.h> 33#include <qpe/qpemessagebox.h>
34#include <qmenubar.h> 34#include <qmenubar.h>
35// #include <qtoolbar.h> 35// #include <qtoolbar.h>
@@ -314,29 +314,29 @@ void AddressbookWindow::slotSetFont( int size )
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 = Opie::Ui::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}
326void AddressbookWindow::exportvCard() 326void AddressbookWindow::exportvCard()
327{ 327{
328 qWarning(" void AddressbookWindow::exportvCard()"); 328 qWarning(" void AddressbookWindow::exportvCard()");
329 QString filename = OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this ); 329 QString filename = Opie::Ui::OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this );
330 if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){ 330 if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){
331 qWarning(" Save to file %s, (%d)", filename.latin1(), filename.length()-1 ); 331 qWarning(" Save to file %s, (%d)", filename.latin1(), filename.length()-1 );
332 OContact curCont = m_abView->currentEntry(); 332 Opie::OPimContact curCont = m_abView->currentEntry();
333 if ( !curCont.isEmpty() ){ 333 if ( !curCont.isEmpty() ){
334 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 334 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
335 filename ); 335 filename );
336 OContactAccess* access = new OContactAccess ( "addressbook_exp", QString::null , vcard_backend, true ); 336 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook_exp", QString::null , vcard_backend, true );
337 if ( access ){ 337 if ( access ){
338 access->add( curCont ); 338 access->add( curCont );
339 access->save(); 339 access->save();
340 } 340 }
341 delete access; 341 delete access;
342 }else 342 }else
@@ -368,26 +368,26 @@ void AddressbookWindow::setDocument( const QString &filename )
368 qWarning("NO clicked"); 368 qWarning("NO clicked");
369 return; 369 return;
370 break; 370 break;
371 } 371 }
372 } 372 }
373 373
374 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 374 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
375 filename ); 375 filename );
376 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 376 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
377 OContactAccess::List allList = access->allRecords(); 377 Opie::OPimContactAccess::List allList = access->allRecords();
378 qWarning( "Found number of contacts in File: %d", allList.count() ); 378 qWarning( "Found number of contacts in File: %d", allList.count() );
379 379
380 if ( !allList.count() ) { 380 if ( !allList.count() ) {
381 QMessageBox::information( this, "Import VCard", 381 QMessageBox::information( this, "Import VCard",
382 "It was impossible to import\nthe VCard.\n" 382 "It was impossible to import\nthe VCard.\n"
383 "The VCard may be corrupted!" ); 383 "The VCard may be corrupted!" );
384 } 384 }
385 385
386 bool doAsk = true; 386 bool doAsk = true;
387 OContactAccess::List::Iterator it; 387 Opie::OPimContactAccess::List::Iterator it;
388 for ( it = allList.begin(); it != allList.end(); ++it ){ 388 for ( it = allList.begin(); it != allList.end(); ++it ){
389 qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); 389 qWarning("Adding Contact from: %s", (*it).fullName().latin1() );
390 if ( doAsk ){ 390 if ( doAsk ){
391 switch( QMessageBox::information( this, tr ( "Add Contact?" ), 391 switch( QMessageBox::information( this, tr ( "Add Contact?" ),
392 tr( "Do you really want add contact for \n%1?" ) 392 tr( "Do you really want add contact for \n%1?" )
393 .arg( (*it).fullName().latin1() ), 393 .arg( (*it).fullName().latin1() ),
@@ -430,19 +430,19 @@ AddressbookWindow::~AddressbookWindow()
430 m_config.setToolBarDock( dock ); 430 m_config.setToolBarDock( dock );
431 m_config.save(); 431 m_config.save();
432} 432}
433 433
434void AddressbookWindow::slotUpdateToolbar() 434void AddressbookWindow::slotUpdateToolbar()
435{ 435{
436 OContact ce = m_abView->currentEntry(); 436 Opie::OPimContact ce = m_abView->currentEntry();
437 actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); 437 actionMail->setEnabled( !ce.defaultEmail().isEmpty() );
438} 438}
439 439
440void AddressbookWindow::slotListNew() 440void AddressbookWindow::slotListNew()
441{ 441{
442 OContact cnt; 442 Opie::OPimContact cnt;
443 if( !syncing ) { 443 if( !syncing ) {
444 editEntry( NewEntry ); 444 editEntry( NewEntry );
445 } else { 445 } else {
446 QMessageBox::warning(this, tr("Contacts"), 446 QMessageBox::warning(this, tr("Contacts"),
447 tr("Can not edit data, currently syncing")); 447 tr("Can not edit data, currently syncing"));
448 } 448 }
@@ -455,13 +455,13 @@ void AddressbookWindow::slotListNew()
455 // //:SXshowView(); 455 // //:SXshowView();
456// } 456// }
457 457
458void AddressbookWindow::slotListDelete() 458void AddressbookWindow::slotListDelete()
459{ 459{
460 if(!syncing) { 460 if(!syncing) {
461 OContact tmpEntry = m_abView ->currentEntry(); 461 Opie::OPimContact tmpEntry = m_abView ->currentEntry();
462 462
463 // get a name, do the best we can... 463 // get a name, do the best we can...
464 QString strName = tmpEntry.fullName(); 464 QString strName = tmpEntry.fullName();
465 if ( strName.isEmpty() ) { 465 if ( strName.isEmpty() ) {
466 strName = tmpEntry.company(); 466 strName = tmpEntry.company();
467 if ( strName.isEmpty() ) 467 if ( strName.isEmpty() )
@@ -522,13 +522,13 @@ void AddressbookWindow::slotViewEdit()
522} 522}
523 523
524 524
525 525
526void AddressbookWindow::writeMail() 526void AddressbookWindow::writeMail()
527{ 527{
528 OContact c = m_abView -> currentEntry(); 528 Opie::OPimContact c = m_abView -> currentEntry();
529 QString name = c.fileAs(); 529 QString name = c.fileAs();
530 QString email = c.defaultEmail(); 530 QString email = c.defaultEmail();
531 531
532 // I prefer the OPIE-Environment variable before the 532 // I prefer the OPIE-Environment variable before the
533 // QPE-one.. 533 // QPE-one..
534 QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); 534 QString basepath = QString::fromLatin1( getenv("OPIEDIR") );
@@ -562,32 +562,32 @@ void AddressbookWindow::writeMail()
562 562
563static const char * beamfile = "/tmp/obex/contact.vcf"; 563static const char * beamfile = "/tmp/obex/contact.vcf";
564 564
565void AddressbookWindow::slotBeam() 565void AddressbookWindow::slotBeam()
566{ 566{
567 QString beamFilename; 567 QString beamFilename;
568 OContact c; 568 Opie::OPimContact c;
569 if ( actionPersonal->isOn() ) { 569 if ( actionPersonal->isOn() ) {
570 beamFilename = addressbookPersonalVCardName(); 570 beamFilename = addressbookPersonalVCardName();
571 if ( !QFile::exists( beamFilename ) ) 571 if ( !QFile::exists( beamFilename ) )
572 return; // can't beam a non-existent file 572 return; // can't beam a non-existent file
573 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 573 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
574 beamFilename ); 574 beamFilename );
575 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 575 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
576 OContactAccess::List allList = access->allRecords(); 576 Opie::OPimContactAccess::List allList = access->allRecords();
577 OContactAccess::List::Iterator it = allList.begin(); // Just take first 577 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
578 c = *it; 578 c = *it;
579 579
580 delete access; 580 delete access;
581 } else { 581 } else {
582 unlink( beamfile ); // delete if exists 582 unlink( beamfile ); // delete if exists
583 mkdir("/tmp/obex/", 0755); 583 mkdir("/tmp/obex/", 0755);
584 c = m_abView -> currentEntry(); 584 c = m_abView -> currentEntry();
585 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 585 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
586 beamfile ); 586 beamfile );
587 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 587 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
588 access->add( c ); 588 access->add( c );
589 access->save(); 589 access->save();
590 delete access; 590 delete access;
591 591
592 beamFilename = beamfile; 592 beamFilename = beamfile;
593 } 593 }
@@ -649,13 +649,13 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
649 close(); 649 close();
650 } else if ( msg == "addContact(QString,QString)" ) { 650 } else if ( msg == "addContact(QString,QString)" ) {
651 QDataStream stream(data,IO_ReadOnly); 651 QDataStream stream(data,IO_ReadOnly);
652 QString name, email; 652 QString name, email;
653 stream >> name >> email; 653 stream >> name >> email;
654 654
655 OContact cnt; 655 Opie::OPimContact cnt;
656 QString fn, mn, ln; 656 QString fn, mn, ln;
657 parseName( name, &fn, &mn, &ln ); 657 parseName( name, &fn, &mn, &ln );
658 // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); 658 // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() );
659 cnt.setFirstName( fn ); 659 cnt.setFirstName( fn );
660 cnt.setMiddleName( mn ); 660 cnt.setMiddleName( mn );
661 cnt.setLastName( ln ); 661 cnt.setLastName( ln );
@@ -719,13 +719,13 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
719 QPEApplication::setKeepRunning(); 719 QPEApplication::setKeepRunning();
720 720
721} 721}
722 722
723void AddressbookWindow::editEntry( EntryMode entryMode ) 723void AddressbookWindow::editEntry( EntryMode entryMode )
724{ 724{
725 OContact entry; 725 Opie::OPimContact entry;
726 if ( !abEditor ) { 726 if ( !abEditor ) {
727 abEditor = new ContactEditor( entry, this, "editor" ); 727 abEditor = new ContactEditor( entry, this, "editor" );
728 } 728 }
729 if ( entryMode == EditEntry ) 729 if ( entryMode == EditEntry )
730 abEditor->setEntry( m_abView -> currentEntry() ); 730 abEditor->setEntry( m_abView -> currentEntry() );
731 else if ( entryMode == NewEntry ) 731 else if ( entryMode == NewEntry )
@@ -735,18 +735,18 @@ void AddressbookWindow::editEntry( EntryMode entryMode )
735 735
736 // fix the foxus... 736 // fix the foxus...
737 abEditor->setNameFocus(); 737 abEditor->setNameFocus();
738 if ( QPEApplication::execDialog( abEditor ) ) { 738 if ( QPEApplication::execDialog( abEditor ) ) {
739 setFocus(); 739 setFocus();
740 if ( entryMode == NewEntry ) { 740 if ( entryMode == NewEntry ) {
741 OContact insertEntry = abEditor->entry(); 741 Opie::OPimContact insertEntry = abEditor->entry();
742 insertEntry.assignUid(); 742 insertEntry.assignUid();
743 m_abView -> addEntry( insertEntry ); 743 m_abView -> addEntry( insertEntry );
744 m_abView -> setCurrentUid( insertEntry.uid() ); 744 m_abView -> setCurrentUid( insertEntry.uid() );
745 } else { 745 } else {
746 OContact replEntry = abEditor->entry(); 746 Opie::OPimContact replEntry = abEditor->entry();
747 747
748 if ( !replEntry.isValidUid() ) 748 if ( !replEntry.isValidUid() )
749 replEntry.assignUid(); 749 replEntry.assignUid();
750 750
751 m_abView -> replaceEntry( replEntry ); 751 m_abView -> replaceEntry( replEntry );
752 } 752 }
@@ -754,13 +754,13 @@ void AddressbookWindow::editEntry( EntryMode entryMode )
754 // populateCategories(); 754 // populateCategories();
755 755
756} 756}
757 757
758void AddressbookWindow::editPersonal() 758void AddressbookWindow::editPersonal()
759{ 759{
760 OContact entry; 760 Opie::OPimContact entry;
761 761
762 // Switch to personal view if not selected 762 // Switch to personal view if not selected
763 // but take care of the menu, too 763 // but take care of the menu, too
764 if ( ! actionPersonal->isOn() ){ 764 if ( ! actionPersonal->isOn() ){
765 qWarning("*** ++++"); 765 qWarning("*** ++++");
766 actionPersonal->setOn( true ); 766 actionPersonal->setOn( true );