Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index e8fa37c..5a8038b 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -20,25 +20,29 @@ | |||
20 | 20 | ||
21 | #define QTOPIA_INTERNAL_FD | 21 | #define QTOPIA_INTERNAL_FD |
22 | 22 | ||
23 | #include "contacteditor.h" | 23 | #include "contacteditor.h" |
24 | #include "ablabel.h" | 24 | #include "ablabel.h" |
25 | #include "abtable.h" | 25 | #include "abtable.h" |
26 | #include "addresssettings.h" | 26 | #include "addresssettings.h" |
27 | #include "addressbook.h" | 27 | #include "addressbook.h" |
28 | 28 | ||
29 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/config.h> | 30 | #include <qpe/config.h> |
31 | #include <qpe/contact.h> | 31 | #include <qpe/contact.h> |
32 | |||
33 | #ifndef MAKE_FOR_SHARP_ROM | ||
32 | #include <qpe/finddialog.h> | 34 | #include <qpe/finddialog.h> |
35 | #endif | ||
36 | |||
33 | #include <qpe/global.h> | 37 | #include <qpe/global.h> |
34 | #include <qpe/resource.h> | 38 | #include <qpe/resource.h> |
35 | #include <qpe/ir.h> | 39 | #include <qpe/ir.h> |
36 | #include <qpe/qpemessagebox.h> | 40 | #include <qpe/qpemessagebox.h> |
37 | #include <qpe/qcopenvelope_qws.h> | 41 | #include <qpe/qcopenvelope_qws.h> |
38 | 42 | ||
39 | #include <qaction.h> | 43 | #include <qaction.h> |
40 | #include <qdialog.h> | 44 | #include <qdialog.h> |
41 | #include <qdir.h> | 45 | #include <qdir.h> |
42 | #include <qfile.h> | 46 | #include <qfile.h> |
43 | #include <qimage.h> | 47 | #include <qimage.h> |
44 | #include <qlayout.h> | 48 | #include <qlayout.h> |
@@ -120,30 +124,32 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
120 | actionEdit = a; | 124 | actionEdit = a; |
121 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); | 125 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); |
122 | a->addTo( edit ); | 126 | a->addTo( edit ); |
123 | a->addTo( listTools ); | 127 | a->addTo( listTools ); |
124 | 128 | ||
125 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 129 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
126 | 0, this, 0 ); | 130 | 0, this, 0 ); |
127 | actionTrash = a; | 131 | actionTrash = a; |
128 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); | 132 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); |
129 | a->addTo( edit ); | 133 | a->addTo( edit ); |
130 | a->addTo( listTools ); | 134 | a->addTo( listTools ); |
131 | 135 | ||
136 | #ifndef MAKE_FOR_SHARP_ROM | ||
132 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), | 137 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), |
133 | QString::null, 0, this, 0 ); | 138 | QString::null, 0, this, 0 ); |
134 | actionFind = a; | 139 | actionFind = a; |
135 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); | 140 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); |
136 | a->addTo( edit ); | 141 | a->addTo( edit ); |
137 | a->addTo( listTools ); | 142 | a->addTo( listTools ); |
143 | #endif | ||
138 | 144 | ||
139 | 145 | ||
140 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), | 146 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), |
141 | QString::null, 0, this, 0 ); | 147 | QString::null, 0, this, 0 ); |
142 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 148 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
143 | actionMail = a; | 149 | actionMail = a; |
144 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 150 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
145 | a->addTo( edit ); | 151 | a->addTo( edit ); |
146 | a->addTo( listTools ); | 152 | a->addTo( listTools ); |
147 | 153 | ||
148 | 154 | ||
149 | 155 | ||
@@ -501,34 +507,38 @@ void AddressbookWindow::editPersonal() | |||
501 | abView()->sync(); | 507 | abView()->sync(); |
502 | } | 508 | } |
503 | abEditor->setCaption( tr("Edit Address") ); | 509 | abEditor->setCaption( tr("Edit Address") ); |
504 | } | 510 | } |
505 | 511 | ||
506 | void AddressbookWindow::slotPersonalView() | 512 | void AddressbookWindow::slotPersonalView() |
507 | { | 513 | { |
508 | if (!actionPersonal->isOn()) { | 514 | if (!actionPersonal->isOn()) { |
509 | // we just turned it off | 515 | // we just turned it off |
510 | setCaption( tr("Contacts") ); | 516 | setCaption( tr("Contacts") ); |
511 | actionNew->setEnabled(TRUE); | 517 | actionNew->setEnabled(TRUE); |
512 | actionTrash->setEnabled(TRUE); | 518 | actionTrash->setEnabled(TRUE); |
519 | #ifndef MAKE_FOR_SHARP_ROM | ||
513 | actionFind->setEnabled(TRUE); | 520 | actionFind->setEnabled(TRUE); |
521 | #endif | ||
514 | slotUpdateToolbar(); // maybe some of the above could be moved there | 522 | slotUpdateToolbar(); // maybe some of the above could be moved there |
515 | showList(); | 523 | showList(); |
516 | return; | 524 | return; |
517 | } | 525 | } |
518 | 526 | ||
519 | // XXX need to disable some QActions. | 527 | // XXX need to disable some QActions. |
520 | actionNew->setEnabled(FALSE); | 528 | actionNew->setEnabled(FALSE); |
521 | actionTrash->setEnabled(FALSE); | 529 | actionTrash->setEnabled(FALSE); |
530 | #ifndef MAKE_FOR_SHARP_ROM | ||
522 | actionFind->setEnabled(FALSE); | 531 | actionFind->setEnabled(FALSE); |
532 | #endif | ||
523 | actionMail->setEnabled(FALSE); | 533 | actionMail->setEnabled(FALSE); |
524 | 534 | ||
525 | setCaption( tr("Contacts - My Personal Details") ); | 535 | setCaption( tr("Contacts - My Personal Details") ); |
526 | QString filename = addressbookPersonalVCardName(); | 536 | QString filename = addressbookPersonalVCardName(); |
527 | Contact me; | 537 | Contact me; |
528 | if (QFile::exists(filename)) | 538 | if (QFile::exists(filename)) |
529 | me = Contact::readVCard( filename )[0]; | 539 | me = Contact::readVCard( filename )[0]; |
530 | 540 | ||
531 | abView()->init( me ); | 541 | abView()->init( me ); |
532 | abView()->sync(); | 542 | abView()->sync(); |
533 | abList->hide(); | 543 | abList->hide(); |
534 | setCentralWidget( abView() ); | 544 | setCentralWidget( abView() ); |
@@ -767,34 +777,40 @@ void AddressbookWindow::initFields() | |||
767 | AbLabel *AddressbookWindow::abView() | 777 | AbLabel *AddressbookWindow::abView() |
768 | { | 778 | { |
769 | if ( !mView ) { | 779 | if ( !mView ) { |
770 | mView = new AbLabel( this, "viewer" ); | 780 | mView = new AbLabel( this, "viewer" ); |
771 | mView->init( Contact() ); | 781 | mView->init( Contact() ); |
772 | connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); | 782 | connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); |
773 | } | 783 | } |
774 | return mView; | 784 | return mView; |
775 | } | 785 | } |
776 | 786 | ||
777 | void AddressbookWindow::slotFind() | 787 | void AddressbookWindow::slotFind() |
778 | { | 788 | { |
789 | #ifndef MAKE_FOR_SHARP_ROM | ||
779 | if ( centralWidget() == abView() ) | 790 | if ( centralWidget() == abView() ) |
780 | showList(); | 791 | showList(); |
792 | |||
781 | FindDialog frmFind( "Contacts", this ); | 793 | FindDialog frmFind( "Contacts", this ); |
782 | QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); | 794 | QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); |
783 | QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); | 795 | QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); |
784 | QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); | 796 | QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); |
797 | |||
785 | frmFind.exec(); | 798 | frmFind.exec(); |
799 | |||
786 | if ( abList->numSelections() ) | 800 | if ( abList->numSelections() ) |
787 | abList->clearSelection(); | 801 | abList->clearSelection(); |
802 | |||
788 | abList->clearFindRow(); | 803 | abList->clearFindRow(); |
804 | #endif | ||
789 | } | 805 | } |
790 | 806 | ||
791 | void AddressbookWindow::slotSetCategory( int c ) | 807 | void AddressbookWindow::slotSetCategory( int c ) |
792 | { | 808 | { |
793 | if ( c <= 0 ) | 809 | if ( c <= 0 ) |
794 | return; | 810 | return; |
795 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) | 811 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) |
796 | catMenu->setItemChecked( i, c == (int)i ); | 812 | catMenu->setItemChecked( i, c == (int)i ); |
797 | if ( c == 1 ) { | 813 | if ( c == 1 ) { |
798 | abList->setShowCategory( QString::null ); | 814 | abList->setShowCategory( QString::null ); |
799 | setCaption( tr("Contacts") + " - " + tr ( "All" ) ); | 815 | setCaption( tr("Contacts") + " - " + tr ( "All" ) ); |
800 | } else if ( c == (int)catMenu->count() ) { | 816 | } else if ( c == (int)catMenu->count() ) { |