-rw-r--r-- | core/pim/addressbook/abview.cpp | 7 | ||||
-rw-r--r-- | core/pim/addressbook/abview.h | 1 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 52 |
3 files changed, 35 insertions, 25 deletions
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index b89b794..d3ca783 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp | |||
@@ -275,48 +275,55 @@ void AbView::showPersonal( bool personal ) | |||
275 | m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 275 | m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
276 | 276 | ||
277 | m_inPersonal = true; | 277 | m_inPersonal = true; |
278 | m_curr_View = CardView; | 278 | m_curr_View = CardView; |
279 | 279 | ||
280 | }else{ | 280 | }else{ |
281 | 281 | ||
282 | if ( !m_inPersonal ) | 282 | if ( !m_inPersonal ) |
283 | return; | 283 | return; |
284 | 284 | ||
285 | // Remove vCard Backend and restore default | 285 | // Remove vCard Backend and restore default |
286 | m_contactdb->save(); | 286 | m_contactdb->save(); |
287 | delete m_contactdb; | 287 | delete m_contactdb; |
288 | 288 | ||
289 | m_contactdb = m_storedDB; | 289 | m_contactdb = m_storedDB; |
290 | m_storedDB = 0l; | 290 | m_storedDB = 0l; |
291 | 291 | ||
292 | m_curr_View = TableView; | 292 | m_curr_View = TableView; |
293 | m_inPersonal = false; | 293 | m_inPersonal = false; |
294 | 294 | ||
295 | } | 295 | } |
296 | load(); | 296 | load(); |
297 | } | 297 | } |
298 | 298 | ||
299 | void AbView::setCurrentUid( int uid ){ | ||
300 | |||
301 | m_curr_Contact = uid; | ||
302 | updateView( true ); //true: Don't modificate the UID ! | ||
303 | } | ||
304 | |||
305 | |||
299 | QStringList AbView::categories() | 306 | QStringList AbView::categories() |
300 | { | 307 | { |
301 | mCat.load( categoryFileName() ); | 308 | mCat.load( categoryFileName() ); |
302 | QStringList categoryList = mCat.labels( "Contacts" ); | 309 | QStringList categoryList = mCat.labels( "Contacts" ); |
303 | return categoryList; | 310 | return categoryList; |
304 | } | 311 | } |
305 | 312 | ||
306 | // BEGIN: Slots | 313 | // BEGIN: Slots |
307 | void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | 314 | void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, |
308 | bool , QString cat ) | 315 | bool , QString cat ) |
309 | { | 316 | { |
310 | //qWarning( "void AbView::slotDoFind" ); | 317 | //qWarning( "void AbView::slotDoFind" ); |
311 | 318 | ||
312 | // We reloading the data: Deselect Letterpicker | 319 | // We reloading the data: Deselect Letterpicker |
313 | emit signalClearLetterPicker(); | 320 | emit signalClearLetterPicker(); |
314 | 321 | ||
315 | // Use the current Category if nothing else selected | 322 | // Use the current Category if nothing else selected |
316 | int category = 0; | 323 | int category = 0; |
317 | 324 | ||
318 | if ( cat.isEmpty() ) | 325 | if ( cat.isEmpty() ) |
319 | category = m_curr_category; | 326 | category = m_curr_category; |
320 | else{ | 327 | else{ |
321 | category = mCat.id("Contacts", cat ); | 328 | category = mCat.id("Contacts", cat ); |
322 | } | 329 | } |
diff --git a/core/pim/addressbook/abview.h b/core/pim/addressbook/abview.h index 8570fe7..55c63cc 100644 --- a/core/pim/addressbook/abview.h +++ b/core/pim/addressbook/abview.h | |||
@@ -8,48 +8,49 @@ | |||
8 | #include <opie/ocontact.h> | 8 | #include <opie/ocontact.h> |
9 | #include <opie/ocontactaccess.h> | 9 | #include <opie/ocontactaccess.h> |
10 | 10 | ||
11 | #include "contacteditor.h" | 11 | #include "contacteditor.h" |
12 | #include "abtable.h" | 12 | #include "abtable.h" |
13 | #include "ablabel.h" | 13 | #include "ablabel.h" |
14 | 14 | ||
15 | class AbView: public QWidget | 15 | class AbView: public QWidget |
16 | { | 16 | { |
17 | Q_OBJECT | 17 | Q_OBJECT |
18 | 18 | ||
19 | public: | 19 | public: |
20 | enum Views{ TableView=0, CardView, PersonalView }; | 20 | enum Views{ TableView=0, CardView, PersonalView }; |
21 | 21 | ||
22 | AbView( QWidget* parent, const QValueList<int>& ordered ); | 22 | AbView( QWidget* parent, const QValueList<int>& ordered ); |
23 | ~AbView(); | 23 | ~AbView(); |
24 | 24 | ||
25 | bool save(); | 25 | bool save(); |
26 | void load(); | 26 | void load(); |
27 | void reload(); | 27 | void reload(); |
28 | void clear(); | 28 | void clear(); |
29 | 29 | ||
30 | void setView( Views view ); | 30 | void setView( Views view ); |
31 | void showPersonal( bool personal ); | 31 | void showPersonal( bool personal ); |
32 | void setCurrentUid( int uid ); | ||
32 | void setShowByCategory( const QString& cat ); | 33 | void setShowByCategory( const QString& cat ); |
33 | void setShowToView( Views view ); | 34 | void setShowToView( Views view ); |
34 | void setShowByLetter( char c ); | 35 | void setShowByLetter( char c ); |
35 | void setListOrder( const QValueList<int>& ordered ); | 36 | void setListOrder( const QValueList<int>& ordered ); |
36 | 37 | ||
37 | // Add Entry and put to current | 38 | // Add Entry and put to current |
38 | void addEntry( const OContact &newContact ); | 39 | void addEntry( const OContact &newContact ); |
39 | void removeEntry( const int UID ); | 40 | void removeEntry( const int UID ); |
40 | void replaceEntry( const OContact &contact ); | 41 | void replaceEntry( const OContact &contact ); |
41 | OContact currentEntry(); | 42 | OContact currentEntry(); |
42 | 43 | ||
43 | void inSearch() { m_inSearch = true; } | 44 | void inSearch() { m_inSearch = true; } |
44 | void offSearch(); | 45 | void offSearch(); |
45 | 46 | ||
46 | QString showCategory() const; | 47 | QString showCategory() const; |
47 | QStringList categories(); | 48 | QStringList categories(); |
48 | 49 | ||
49 | signals: | 50 | signals: |
50 | void signalNotFound(); | 51 | void signalNotFound(); |
51 | void signalClearLetterPicker(); | 52 | void signalClearLetterPicker(); |
52 | void signalViewSwitched ( int ); | 53 | void signalViewSwitched ( int ); |
53 | 54 | ||
54 | public slots: | 55 | public slots: |
55 | void slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | 56 | void slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, |
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 89a3312..e053e94 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -665,78 +665,80 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | |||
665 | OContact cnt; | 665 | OContact cnt; |
666 | QString fn, mn, ln; | 666 | QString fn, mn, ln; |
667 | parseName( name, &fn, &mn, &ln ); | 667 | parseName( name, &fn, &mn, &ln ); |
668 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 668 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
669 | cnt.setFirstName( fn ); | 669 | cnt.setFirstName( fn ); |
670 | cnt.setMiddleName( mn ); | 670 | cnt.setMiddleName( mn ); |
671 | cnt.setLastName( ln ); | 671 | cnt.setLastName( ln ); |
672 | cnt.insertEmails( email ); | 672 | cnt.insertEmails( email ); |
673 | cnt.setDefaultEmail( email ); | 673 | cnt.setDefaultEmail( email ); |
674 | cnt.setFileAs(); | 674 | cnt.setFileAs(); |
675 | 675 | ||
676 | m_abView -> addEntry( cnt ); | 676 | m_abView -> addEntry( cnt ); |
677 | 677 | ||
678 | // :SXm_abView()->init( cnt ); | 678 | // :SXm_abView()->init( cnt ); |
679 | editEntry( EditEntry ); | 679 | editEntry( EditEntry ); |
680 | } else if ( msg == "beamBusinessCard()" ) { | 680 | } else if ( msg == "beamBusinessCard()" ) { |
681 | QString beamFilename = addressbookPersonalVCardName(); | 681 | QString beamFilename = addressbookPersonalVCardName(); |
682 | if ( !QFile::exists( beamFilename ) ) | 682 | if ( !QFile::exists( beamFilename ) ) |
683 | return; // can't beam a non-existent file | 683 | return; // can't beam a non-existent file |
684 | 684 | ||
685 | Ir *ir = new Ir( this ); | 685 | Ir *ir = new Ir( this ); |
686 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 686 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
687 | QString description = "mycard.vcf"; | 687 | QString description = "mycard.vcf"; |
688 | ir->send( beamFilename, description, "text/x-vCard" ); | 688 | ir->send( beamFilename, description, "text/x-vCard" ); |
689 | } | 689 | } else if ( msg == "showUid(int)" ) { |
690 | #if 0 | ||
691 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { | ||
692 | QDataStream stream(data,IO_ReadOnly); | 690 | QDataStream stream(data,IO_ReadOnly); |
693 | QCString ch,m; | 691 | int uid; |
694 | QStringList types; | 692 | stream >> uid; |
695 | stream >> ch >> m >> types; | 693 | |
696 | AddressPicker picker(abList,this,0,TRUE); | 694 | // Deactivate Personal View.. |
697 | picker.showMaximized(); | 695 | if ( actionPersonal->isOn() ){ |
698 | picker.setChoiceNames(types); | 696 | actionPersonal->setOn( false ); |
699 | int i=0; | 697 | slotPersonalView(); |
700 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | ||
701 | QStringList sel; | ||
702 | stream >> sel; | ||
703 | picker.setSelection(i++,sel); | ||
704 | } | 698 | } |
705 | picker.showMaximized(); | ||
706 | picker.exec(); | ||
707 | 699 | ||
708 | // ###### note: contacts may have been added - save here! | 700 | // Reset category and show as card.. |
701 | m_abView -> setShowByCategory( QString::null ); | ||
702 | m_abView -> setCurrentUid( uid ); | ||
703 | slotViewSwitched ( AbView::CardView ); | ||
704 | |||
705 | } else if ( msg == "editUid(int)" ) { | ||
706 | QDataStream stream(data,IO_ReadOnly); | ||
707 | int uid; | ||
708 | stream >> uid; | ||
709 | 709 | ||
710 | setCentralWidget(abList); | 710 | // Deactivate Personal View.. |
711 | QCopEnvelope e(ch,m); | 711 | if ( actionPersonal->isOn() ){ |
712 | i=0; | 712 | actionPersonal->setOn( false ); |
713 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 713 | slotPersonalView(); |
714 | QStringList sel = picker.selection(i++); | ||
715 | e << sel; | ||
716 | } | 714 | } |
717 | } | 715 | |
718 | #endif | 716 | // Reset category and edit.. |
717 | m_abView -> setShowByCategory( QString::null ); | ||
718 | m_abView -> setCurrentUid( uid ); | ||
719 | slotViewEdit(); | ||
720 | } | ||
719 | 721 | ||
720 | } | 722 | } |
721 | 723 | ||
722 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 724 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
723 | { | 725 | { |
724 | OContact entry; | 726 | OContact entry; |
725 | if ( !abEditor ) { | 727 | if ( !abEditor ) { |
726 | abEditor = new ContactEditor( entry, this, "editor" ); | 728 | abEditor = new ContactEditor( entry, this, "editor" ); |
727 | } | 729 | } |
728 | if ( entryMode == EditEntry ) | 730 | if ( entryMode == EditEntry ) |
729 | abEditor->setEntry( m_abView -> currentEntry() ); | 731 | abEditor->setEntry( m_abView -> currentEntry() ); |
730 | else if ( entryMode == NewEntry ) | 732 | else if ( entryMode == NewEntry ) |
731 | abEditor->setEntry( entry ); | 733 | abEditor->setEntry( entry ); |
732 | // other things may change the caption. | 734 | // other things may change the caption. |
733 | abEditor->setCaption( tr("Edit Address") ); | 735 | abEditor->setCaption( tr("Edit Address") ); |
734 | 736 | ||
735 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 737 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
736 | abEditor->showMaximized(); | 738 | abEditor->showMaximized(); |
737 | #endif | 739 | #endif |
738 | // fix the foxus... | 740 | // fix the foxus... |
739 | abEditor->setNameFocus(); | 741 | abEditor->setNameFocus(); |
740 | if ( abEditor->exec() ) { | 742 | if ( abEditor->exec() ) { |
741 | setFocus(); | 743 | setFocus(); |
742 | if ( entryMode == NewEntry ) { | 744 | if ( entryMode == NewEntry ) { |