summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/addressbook.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp67
1 files changed, 34 insertions, 33 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 9ae66d1..94c0a13 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -19,13 +19,13 @@
19 19
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#include <opie2/odebug.h>
26#include <opie2/ofileselector.h> 26#include <opie2/ofileselector.h>
27#include <opie2/ofiledialog.h> 27#include <opie2/ofiledialog.h>
28#include <opie2/opimcontact.h> 28#include <opie2/opimcontact.h>
29#include <opie2/ocontactaccessbackend_vcard.h> 29#include <opie2/ocontactaccessbackend_vcard.h>
30 30
31#include <qpe/resource.h> 31#include <qpe/resource.h>
@@ -248,13 +248,13 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
248 defaultFont = new QFont( m_abView->font() ); 248 defaultFont = new QFont( m_abView->font() );
249 slotSetFont(m_config.fontSize()); 249 slotSetFont(m_config.fontSize());
250 m_curFontSize = m_config.fontSize(); 250 m_curFontSize = m_config.fontSize();
251 251
252 setCentralWidget(listContainer); 252 setCentralWidget(listContainer);
253 253
254 // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); 254 //Opie::Core::odebug << "adressbook contrsuction: t=" << t.elapsed() << oendl;
255 connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); 255 connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) );
256 connect( qApp, SIGNAL( reload() ), this, SLOT( reload() ) ); 256 connect( qApp, SIGNAL( reload() ), this, SLOT( reload() ) );
257 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), 257 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
258 this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); 258 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
259 259
260 260
@@ -264,29 +264,29 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
264 264
265void AddressbookWindow::slotConfig() 265void AddressbookWindow::slotConfig()
266{ 266{
267 ConfigDlg* dlg = new ConfigDlg( this, "Config" ); 267 ConfigDlg* dlg = new ConfigDlg( this, "Config" );
268 dlg -> setConfig( m_config ); 268 dlg -> setConfig( m_config );
269 if ( QPEApplication::execDialog( dlg ) ) { 269 if ( QPEApplication::execDialog( dlg ) ) {
270 qWarning ("Config Dialog accepted!"); 270 Opie::Core::owarn << "Config Dialog accepted!" << oendl;
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 Opie::Core::owarn << "Font was changed!" << oendl;
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 Opie::Core::owarn << "void AddressbookWindow::slotSetFont( " << size << " )" << oendl;
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
@@ -322,16 +322,16 @@ void AddressbookWindow::importvCard() {
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 Opie::Core::owarn << "void AddressbookWindow::exportvCard()" << oendl;
329 QString filename = Opie::Ui::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 Opie::Core::owarn << " Save to file " << filename << ", (" << filename.length()-1 << ")" << oendl;
332 Opie::OPimContact curCont = m_abView->currentEntry(); 332 Opie::OPimContact curCont = m_abView->currentEntry();
333 if ( !curCont.isEmpty() ){ 333 if ( !curCont.isEmpty() ){
334 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 334 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
335 filename ); 335 filename );
336 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "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 ){
@@ -347,65 +347,65 @@ void AddressbookWindow::exportvCard()
347 QMessageBox::critical( 0, "Export VCard", 347 QMessageBox::critical( 0, "Export VCard",
348 QString( tr( "You have to set a filename !") ) ); 348 QString( tr( "You have to set a filename !") ) );
349} 349}
350 350
351void AddressbookWindow::setDocument( const QString &filename ) 351void AddressbookWindow::setDocument( const QString &filename )
352{ 352{
353 qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); 353 Opie::Core::owarn << "void AddressbookWindow::setDocument( " << filename << " )" << oendl;
354 354
355 if ( filename.find(".vcf") != int(filename.length()) - 4 ){ 355 if ( filename.find(".vcf") != int(filename.length()) - 4 ){
356 356
357 357
358 358
359 switch( QMessageBox::information( this, tr ( "Right file type ?" ), 359 switch( QMessageBox::information( this, tr ( "Right file type ?" ),
360 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), 360 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ),
361 tr( "&Yes" ), tr( "&No" ), QString::null, 361 tr( "&Yes" ), tr( "&No" ), QString::null,
362 0, // Enter == button 0 362 0, // Enter == button 0
363 2 ) ) { // Escape == button 2 363 2 ) ) { // Escape == button 2
364 case 0: 364 case 0:
365 qWarning("YES clicked"); 365 Opie::Core::owarn << "YES clicked" << oendl;
366 break; 366 break;
367 case 1: 367 case 1:
368 qWarning("NO clicked"); 368 Opie::Core::owarn << "NO clicked" << oendl;
369 return; 369 return;
370 break; 370 break;
371 } 371 }
372 } 372 }
373 373
374 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 374 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
375 filename ); 375 filename );
376 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 376 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
377 Opie::OPimContactAccess::List allList = access->allRecords(); 377 Opie::OPimContactAccess::List allList = access->allRecords();
378 qWarning( "Found number of contacts in File: %d", allList.count() ); 378 Opie::Core::owarn << "Found number of contacts in File: " << allList.count() << oendl;
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 Opie::OPimContactAccess::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 Opie::Core::owarn << "Adding Contact from: " << (*it).fullName() << oendl;
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() ),
394 tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), 394 tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"),
395 0, // Enter == button 0 395 0, // Enter == button 0
396 2 ) ) { // Escape == button 2 396 2 ) ) { // Escape == button 2
397 case 0: 397 case 0:
398 qWarning("YES clicked"); 398 Opie::Core::owarn << "YES clicked" << oendl;
399 m_abView->addEntry( *it ); 399 m_abView->addEntry( *it );
400 break; 400 break;
401 case 1: 401 case 1:
402 qWarning("NO clicked"); 402 Opie::Core::owarn << "NO clicked" << oendl;
403 break; 403 break;
404 case 2: 404 case 2:
405 qWarning("YesAll clicked"); 405 Opie::Core::owarn << "YesAll clicked" << oendl;
406 doAsk = false; 406 doAsk = false;
407 break; 407 break;
408 } 408 }
409 }else 409 }else
410 m_abView->addEntry( *it ); 410 m_abView->addEntry( *it );
411 411
@@ -535,25 +535,25 @@ void AddressbookWindow::writeMail()
535 if ( basepath.isEmpty() ) 535 if ( basepath.isEmpty() )
536 basepath = QString::fromLatin1( getenv("QPEDIR") ); 536 basepath = QString::fromLatin1( getenv("QPEDIR") );
537 537
538 // Try to access the preferred. If not possible, try to 538 // Try to access the preferred. If not possible, try to
539 // switch to the other one.. 539 // switch to the other one..
540 if ( m_config.useQtMail() ){ 540 if ( m_config.useQtMail() ){
541 qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); 541 Opie::Core::owarn << "Accessing: " << (basepath + "/bin/qtmail") << oendl;
542 if ( QFile::exists( basepath + "/bin/qtmail" ) ){ 542 if ( QFile::exists( basepath + "/bin/qtmail" ) ){
543 qWarning ("QCop"); 543 Opie::Core::owarn << "QCop" << oendl;
544 QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); 544 QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)");
545 e << name << email; 545 e << name << email;
546 return; 546 return;
547 } else 547 } else
548 m_config.setUseOpieMail( true ); 548 m_config.setUseOpieMail( true );
549 } 549 }
550 if ( m_config.useOpieMail() ){ 550 if ( m_config.useOpieMail() ){
551 qWarning ("Accessing: %s", (basepath + "/bin/opiemail").latin1()); 551 Opie::Core::owarn << "Accessing: " << (basepath + "/bin/opiemail") << oendl;
552 if ( QFile::exists( basepath + "/bin/opiemail" ) ){ 552 if ( QFile::exists( basepath + "/bin/opiemail" ) ){
553 qWarning ("QCop"); 553 Opie::Core::owarn << "QCop" << oendl;
554 QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)"); 554 QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)");
555 e << name << email; 555 e << name << email;
556 return; 556 return;
557 } else 557 } else
558 m_config.setUseQtMail( true ); 558 m_config.setUseQtMail( true );
559 } 559 }
@@ -589,13 +589,13 @@ void AddressbookWindow::slotBeam()
589 access->save(); 589 access->save();
590 delete access; 590 delete access;
591 591
592 beamFilename = beamfile; 592 beamFilename = beamfile;
593 } 593 }
594 594
595 qWarning("Beaming: %s", beamFilename.latin1() ); 595 Opie::Core::owarn << "Beaming: " << beamFilename << oendl;
596 596
597 Ir *ir = new Ir( this ); 597 Ir *ir = new Ir( this );
598 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 598 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
599 QString description = c.fullName(); 599 QString description = c.fullName();
600 ir->send( beamFilename, description, "text/x-vCard" ); 600 ir->send( beamFilename, description, "text/x-vCard" );
601} 601}
@@ -636,13 +636,13 @@ static void parseName( const QString& name, QString *first, QString *middle,
636} 636}
637 637
638 638
639void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) 639void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
640{ 640{
641 bool needShow = FALSE; 641 bool needShow = FALSE;
642 qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); 642 Opie::Core::owarn << "Receiving QCop-Call with message " << msg << oendl;
643 643
644 644
645 if (msg == "editPersonal()") { 645 if (msg == "editPersonal()") {
646 editPersonal(); 646 editPersonal();
647 } else if (msg == "editPersonalAndClose()") { 647 } else if (msg == "editPersonalAndClose()") {
648 editPersonal(); 648 editPersonal();
@@ -652,13 +652,13 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
652 QString name, email; 652 QString name, email;
653 stream >> name >> email; 653 stream >> name >> email;
654 654
655 Opie::OPimContact 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 //Opie::Core::odebug << " " << fn << " - " << mn " - " << ln << oendl;
659 cnt.setFirstName( fn ); 659 cnt.setFirstName( fn );
660 cnt.setMiddleName( mn ); 660 cnt.setMiddleName( mn );
661 cnt.setLastName( ln ); 661 cnt.setLastName( ln );
662 cnt.insertEmails( email ); 662 cnt.insertEmails( email );
663 cnt.setDefaultEmail( email ); 663 cnt.setDefaultEmail( email );
664 cnt.setFileAs(); 664 cnt.setFileAs();
@@ -679,13 +679,13 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
679 } else if ( msg == "show(int)" ) { 679 } else if ( msg == "show(int)" ) {
680 raise(); 680 raise();
681 QDataStream stream(data,IO_ReadOnly); 681 QDataStream stream(data,IO_ReadOnly);
682 int uid; 682 int uid;
683 stream >> uid; 683 stream >> uid;
684 684
685 qWarning( "Showing uid: %d" , uid ); 685 Opie::Core::owarn << "Showing uid: " << uid << oendl;
686 686
687 // Deactivate Personal View.. 687 // Deactivate Personal View..
688 if ( actionPersonal->isOn() ){ 688 if ( actionPersonal->isOn() ){
689 actionPersonal->setOn( false ); 689 actionPersonal->setOn( false );
690 slotPersonalView(); 690 slotPersonalView();
691 } 691 }
@@ -759,13 +759,13 @@ void AddressbookWindow::editPersonal()
759{ 759{
760 Opie::OPimContact 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 Opie::Core::owarn << "*** ++++" << oendl;
766 actionPersonal->setOn( true ); 766 actionPersonal->setOn( true );
767 slotPersonalView(); 767 slotPersonalView();
768 } 768 }
769 769
770 if ( !abEditor ) { 770 if ( !abEditor ) {
771 abEditor = new ContactEditor( entry, this, "editor" ); 771 abEditor = new ContactEditor( entry, this, "editor" );
@@ -778,29 +778,29 @@ void AddressbookWindow::editPersonal()
778 778
779} 779}
780 780
781 781
782void AddressbookWindow::slotPersonalView() 782void AddressbookWindow::slotPersonalView()
783{ 783{
784 qWarning("slotPersonalView()"); 784 Opie::Core::owarn << "slotPersonalView()" << oendl;
785 if (!actionPersonal->isOn()) { 785 if (!actionPersonal->isOn()) {
786 // we just turned it off 786 // we just turned it off
787 qWarning("slotPersonalView()-> OFF"); 787 Opie::Core::owarn << "slotPersonalView()-> OFF" << oendl;
788 setCaption( tr("Contacts") ); 788 setCaption( tr("Contacts") );
789 actionNew->setEnabled(TRUE); 789 actionNew->setEnabled(TRUE);
790 actionTrash->setEnabled(TRUE); 790 actionTrash->setEnabled(TRUE);
791 actionFind->setEnabled(TRUE); 791 actionFind->setEnabled(TRUE);
792 actionMail->setEnabled(TRUE); 792 actionMail->setEnabled(TRUE);
793 // slotUpdateToolbar(); 793 // slotUpdateToolbar();
794 794
795 m_abView->showPersonal( false ); 795 m_abView->showPersonal( false );
796 796
797 return; 797 return;
798 } 798 }
799 799
800 qWarning("slotPersonalView()-> ON"); 800 Opie::Core::owarn << "slotPersonalView()-> ON" << oendl;
801 // XXX need to disable some QActions. 801 // XXX need to disable some QActions.
802 actionNew->setEnabled(FALSE); 802 actionNew->setEnabled(FALSE);
803 actionTrash->setEnabled(FALSE); 803 actionTrash->setEnabled(FALSE);
804 actionFind->setEnabled(FALSE); 804 actionFind->setEnabled(FALSE);
805 actionMail->setEnabled(FALSE); 805 actionMail->setEnabled(FALSE);
806 806
@@ -884,30 +884,31 @@ void AddressbookWindow::slotSave()
884} 884}
885#endif 885#endif
886 886
887 887
888void AddressbookWindow::slotNotFound() 888void AddressbookWindow::slotNotFound()
889{ 889{
890 qWarning("Got notfound signal!"); 890 Opie::Core::owarn << "Got not found signal!" << oendl;
891 QMessageBox::information( this, tr( "Not Found" ), 891 QMessageBox::information( this, tr( "Not Found" ),
892 "<qt>" + tr( "Unable to find a contact for this search pattern!" ) + "</qt>" ); 892 "<qt>" + tr( "Unable to find a contact for this search pattern!" ) + "</qt>" );
893 893
894 894
895} 895}
896void AddressbookWindow::slotWrapAround() 896void AddressbookWindow::slotWrapAround()
897{ 897{
898 qWarning("Got wrap signal!"); 898 Opie::Core::owarn << "Got wrap signal!" << oendl;
899 // if ( doNotifyWrapAround ) 899 // if ( doNotifyWrapAround )
900 // QMessageBox::information( this, tr( "End of list" ), 900 // QMessageBox::information( this, tr( "End of list" ),
901 // tr( "End of list. Wrap around now...!" ) + "\n" ); 901 // tr( "End of list. Wrap around now...!" ) + "\n" );
902 902
903} 903}
904 904
905void AddressbookWindow::slotSetCategory( int c ) 905void AddressbookWindow::slotSetCategory( int c )
906{ 906{
907 qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); 907 Opie::Core::owarn << "void AddressbookWindow::slotSetCategory( " << c << " ) from "
908 << catMenu->count() << oendl;
908 909
909 QString cat, book; 910 QString cat, book;
910 AbView::Views view = AbView::TableView; 911 AbView::Views view = AbView::TableView;
911 912
912 if ( c <= 0 ) 913 if ( c <= 0 )
913 return; 914 return;
@@ -936,13 +937,13 @@ void AddressbookWindow::slotSetCategory( int c )
936 // book = tr( "Personal" ); 937 // book = tr( "Personal" );
937 // view = AbView:: PersonalView; 938 // view = AbView:: PersonalView;
938 }else if ( i == 3 ){ // default All Categories 939 }else if ( i == 3 ){ // default All Categories
939 cat = QString::null; 940 cat = QString::null;
940 }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled 941 }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled
941 cat = "Unfiled"; 942 cat = "Unfiled";
942 qWarning ("Unfiled selected!"); 943 Opie::Core::owarn << "Unfiled selected!" << oendl;
943 }else{ 944 }else{
944 cat = m_abView->categories()[i - 4]; 945 cat = m_abView->categories()[i - 4];
945 } 946 }
946 } 947 }
947 } 948 }
948 949
@@ -959,13 +960,13 @@ void AddressbookWindow::slotSetCategory( int c )
959 960
960 setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); 961 setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) );
961} 962}
962 963
963void AddressbookWindow::slotViewSwitched( int view ) 964void AddressbookWindow::slotViewSwitched( int view )
964{ 965{
965 qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); 966 Opie::Core::owarn << "void AddressbookWindow::slotViewSwitched( " << view << " )" << oendl;
966 int menu = 0; 967 int menu = 0;
967 968
968 // Switch to selected view 969 // Switch to selected view
969 switch ( view ){ 970 switch ( view ){
970 case AbView::TableView: 971 case AbView::TableView:
971 menu = 1; 972 menu = 1;