-rw-r--r-- | core/pim/addressbook/TODO | 2 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 224 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 2 |
3 files changed, 186 insertions, 42 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index 1eb537f..76247c1 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO | |||
@@ -1,88 +1,90 @@ | |||
1 | Stuff todo until OPIE 1.0 : | 1 | Stuff todo until OPIE 1.0 : |
2 | =========================== | 2 | =========================== |
3 | 3 | ||
4 | Feature requests: | 4 | Feature requests: |
5 | ----------------- | 5 | ----------------- |
6 | - Dial by mobile phone by tapping the number.. | 6 | - Dial by mobile phone by tapping the number.. |
7 | (Maybe using gsmtool. And we may | 7 | (Maybe using gsmtool. And we may |
8 | add a library class for this) | 8 | add a library class for this) |
9 | - dial with dtmfdial incase it's installed and there's no mobile | 9 | - dial with dtmfdial incase it's installed and there's no mobile |
10 | - 3rd column for 2. Contact | 10 | - 3rd column for 2. Contact |
11 | - Implementing additional Views (Phonebook, ...) | 11 | - Implementing additional Views (Phonebook, ...) |
12 | - Birthday & Anniversary Reminder | 12 | - Birthday & Anniversary Reminder |
13 | - Plugin for Today for Birthdays and Anniversaries | 13 | - Plugin for Today for Birthdays and Anniversaries |
14 | - Beaming of multiple contacts (current list/ by search or by category) | 14 | - Beaming of multiple contacts (current list/ by search or by category) |
15 | 15 | ||
16 | Known Bugs: | 16 | Known Bugs: |
17 | ----------- | 17 | ----------- |
18 | 18 | ||
19 | 19 | ||
20 | Bugs but not in addressbook: | 20 | Bugs but not in addressbook: |
21 | ----------------------------- | 21 | ----------------------------- |
22 | - VCARD: If umlaut (äöüß) in address, the parser gets confused.. | 22 | - VCARD: If umlaut (äöüß) in address, the parser gets confused.. |
23 | 23 | ||
24 | - Exporting and reimporting of Jobtitle was reported to fail (Could not reproduce this ! (se)) | 24 | - Exporting and reimporting of Jobtitle was reported to fail (Could not reproduce this ! (se)) |
25 | 25 | ||
26 | 26 | ||
27 | Urgent: | 27 | Urgent: |
28 | -------- | 28 | -------- |
29 | ContactEditor: | 29 | ContactEditor: |
30 | - Contact-Editor is temporarely reenabled. Wait for replacement. | 30 | - Contact-Editor is temporarely reenabled. Wait for replacement. |
31 | - Redesign of Contacteditor | 31 | - Redesign of Contacteditor |
32 | - Store last settings of combo-boxes | 32 | - Store last settings of combo-boxes |
33 | - Category is on the wrong position after changing to personal and back to normal | 33 | - Category is on the wrong position after changing to personal and back to normal |
34 | ( Temporarily workaround: Category is never deactivated.. :S ) | 34 | ( Temporarily workaround: Category is never deactivated.. :S ) |
35 | 35 | ||
36 | - Personal and Business Web-page is not editable | 36 | - Personal and Business Web-page is not editable |
37 | 37 | ||
38 | Important: | 38 | Important: |
39 | ---------- | 39 | ---------- |
40 | 40 | ||
41 | - If new contact is added (contacteditor closed): focus (table, card) to | ||
42 | this entry ! | ||
41 | - Implement a picker/combo for the default email. | 43 | - Implement a picker/combo for the default email. |
42 | - After search (Started with Return): KeyFocus should be on Tabelle | 44 | - After search (Started with Return): KeyFocus should be on Tabelle |
43 | 45 | ||
44 | - "What's this" should be added (Deleyed after Feature Freeze) | 46 | - "What's this" should be added (Deleyed after Feature Freeze) |
45 | 47 | ||
46 | Less important: | 48 | Less important: |
47 | --------------- | 49 | --------------- |
48 | - Reload if contacts were changed externally | 50 | - Reload if contacts were changed externally |
49 | - Overview window cleanup needed.. | 51 | - Overview window cleanup needed.. |
50 | - The picker (alphabetical sort widget) should be | 52 | - The picker (alphabetical sort widget) should be |
51 | placed verticaly or horizontally (configurable) | 53 | placed verticaly or horizontally (configurable) |
52 | - Find a smart solution for activating/deactivating the "send email" event | 54 | - Find a smart solution for activating/deactivating the "send email" event |
53 | 55 | ||
54 | Should be Fixed (not absolute sure, need further validation): | 56 | Should be Fixed (not absolute sure, need further validation): |
55 | ------------------------------------------------------------- | 57 | ------------------------------------------------------------- |
56 | 58 | ||
57 | 59 | ||
58 | Fixed: | 60 | Fixed: |
59 | ------- | 61 | ------- |
60 | - Syncing: abtable not reloaded after sync. | 62 | - Syncing: abtable not reloaded after sync. |
61 | - Find widget should be replaced by something like | 63 | - Find widget should be replaced by something like |
62 | qpdf has. | 64 | qpdf has. |
63 | - Adding a configuration dialog | 65 | - Adding a configuration dialog |
64 | - Picker: Activated letter schould be more visible | 66 | - Picker: Activated letter schould be more visible |
65 | - Advanced handling of cursor keys (search..) | 67 | - Advanced handling of cursor keys (search..) |
66 | - Mail-Icon is missing | 68 | - Mail-Icon is missing |
67 | - Use opie-mail insted of qt-mail if possible. | 69 | - Use opie-mail insted of qt-mail if possible. |
68 | - Font menu is invisible using german translation | 70 | - Font menu is invisible using german translation |
69 | - Personal contact editor: Disable categories | 71 | - Personal contact editor: Disable categories |
70 | - "Nonenglish" translation bug has to be fixed. | 72 | - "Nonenglish" translation bug has to be fixed. |
71 | - contacteditor: Birthday, annyversary, ... : Use Dateselector | 73 | - contacteditor: Birthday, annyversary, ... : Use Dateselector |
72 | - The names of the countries are sorted by there english names, only.. | 74 | - The names of the countries are sorted by there english names, only.. |
73 | Even if they are translated.. :S | 75 | Even if they are translated.. :S |
74 | - Cursor keys should work in detail-view (ablabel) | 76 | - Cursor keys should work in detail-view (ablabel) |
75 | -> Ablabel should be removed and Abtable should be increased with | 77 | -> Ablabel should be removed and Abtable should be increased with |
76 | different views (as started by darwin zins).. | 78 | different views (as started by darwin zins).. |
77 | - Use advanced database functions in abtable to decrease | 79 | - Use advanced database functions in abtable to decrease |
78 | memory footprint and to make everything more easy ! | 80 | memory footprint and to make everything more easy ! |
79 | (abtable should store Iterator for selected Category) | 81 | (abtable should store Iterator for selected Category) |
80 | - Abtable: Configure Contact column (internally already available, | 82 | - Abtable: Configure Contact column (internally already available, |
81 | need configuration) | 83 | need configuration) |
82 | - Select of primary contact (see #274 on mantis) | 84 | - Select of primary contact (see #274 on mantis) |
83 | - Category-select does not work completely: "Unfiled" is always in listview .. | 85 | - Category-select does not work completely: "Unfiled" is always in listview .. |
84 | - Return from Contacteditor: Category resettet to all | 86 | - Return from Contacteditor: Category resettet to all |
85 | - Personal Details not working | 87 | - Personal Details not working |
86 | - If category changed, the letterpicker should be resetted | 88 | - If category changed, the letterpicker should be resetted |
87 | - There should be some icons for List and Cardview | 89 | - There should be some icons for List and Cardview |
88 | - If in Cardview and a category change removes all entries: | 90 | - If in Cardview and a category change removes all entries: |
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index c5ad0c4..37e3a54 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -1,96 +1,97 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) | 3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) |
4 | * | 4 | * |
5 | * This file is an add-on for the OPIE Palmtop Environment | 5 | * This file is an add-on for the OPIE Palmtop Environment |
6 | * | 6 | * |
7 | * This file may be distributed and/or modified under the terms of the | 7 | * This file may be distributed and/or modified under the terms of the |
8 | * GNU General Public License version 2 as published by the Free Software | 8 | * GNU General Public License version 2 as published by the Free Software |
9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging | 9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
10 | * of this file. | 10 | * of this file. |
11 | * | 11 | * |
12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | * | 14 | * |
15 | * | 15 | * |
16 | * This is a rewrite of the abeditor.h file, modified to provide a more | 16 | * This is a rewrite of the abeditor.h file, modified to provide a more |
17 | * intuitive interface to TrollTech's original Address Book editor. This | 17 | * intuitive interface to TrollTech's original Address Book editor. This |
18 | * is made to operate exactly in interface with the exception of name. | 18 | * is made to operate exactly in interface with the exception of name. |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "contacteditor.h" | 22 | #include "contacteditor.h" |
23 | #include "addresspicker.h" | 23 | #include "addresspicker.h" |
24 | #include "ocontactfields.h" | 24 | #include "ocontactfields.h" |
25 | 25 | ||
26 | #include <qpe/categoryselect.h> | 26 | #include <qpe/categoryselect.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/qpedialog.h> | 28 | #include <qpe/qpedialog.h> |
29 | #include <qpe/timeconversion.h> | 29 | #include <qpe/timeconversion.h> |
30 | #include <opie/ocontact.h> | 30 | #include <opie/ocontact.h> |
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | 32 | ||
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qlabel.h> | 34 | #include <qlabel.h> |
35 | #include <qtabwidget.h> | 35 | #include <qtabwidget.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qlineedit.h> | 37 | #include <qlineedit.h> |
38 | #include <qmultilineedit.h> | 38 | #include <qmultilineedit.h> |
39 | #include <qscrollview.h> | 39 | #include <qscrollview.h> |
40 | #include <qtoolbutton.h> | 40 | #include <qtoolbutton.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qmainwindow.h> | 42 | #include <qmainwindow.h> |
43 | #include <qvaluelist.h> | 43 | #include <qvaluelist.h> |
44 | #include <qpopupmenu.h> | 44 | #include <qpopupmenu.h> |
45 | #include <qlistbox.h> | 45 | #include <qlistbox.h> |
46 | #include <qhbox.h> | 46 | #include <qhbox.h> |
47 | #include <qaction.h> | 47 | #include <qaction.h> |
48 | #include <qiconset.h> | 48 | #include <qiconset.h> |
49 | #include <qmessagebox.h> | ||
49 | 50 | ||
50 | #include <assert.h> | 51 | #include <assert.h> |
51 | 52 | ||
52 | static inline bool containsAlphaNum( const QString &str ); | 53 | static inline bool containsAlphaNum( const QString &str ); |
53 | static inline bool constainsWhiteSpace( const QString &str ); | 54 | static inline bool constainsWhiteSpace( const QString &str ); |
54 | 55 | ||
55 | // helper functions, convert our comma delimited list to proper | 56 | // helper functions, convert our comma delimited list to proper |
56 | // file format... | 57 | // file format... |
57 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 58 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
58 | QString &strAll ); | 59 | QString &strAll ); |
59 | 60 | ||
60 | // helper convert from file format to comma delimited... | 61 | // helper convert from file format to comma delimited... |
61 | void parseEmailTo( const QString &strDefaultEmail, | 62 | void parseEmailTo( const QString &strDefaultEmail, |
62 | const QString &strOtherEmail, QString &strBack ); | 63 | const QString &strOtherEmail, QString &strBack ); |
63 | 64 | ||
64 | ContactEditor::ContactEditor(const OContact &entry, | 65 | ContactEditor::ContactEditor(const OContact &entry, |
65 | QWidget *parent, | 66 | QWidget *parent, |
66 | const char *name, | 67 | const char *name, |
67 | WFlags fl ) | 68 | WFlags fl ) |
68 | : QDialog( parent, name, TRUE, fl ), | 69 | : QDialog( parent, name, TRUE, fl ), |
69 | m_personalView ( false ) | 70 | m_personalView ( false ) |
70 | 71 | ||
71 | { | 72 | { |
72 | 73 | ||
73 | init(); | 74 | init(); |
74 | setEntry( entry ); | 75 | setEntry( entry ); |
75 | cmbDefaultEmail = 0; | 76 | cmbDefaultEmail = 0; |
76 | defaultEmailChooserPosition = -1; | 77 | defaultEmailChooserPosition = -1; |
77 | } | 78 | } |
78 | 79 | ||
79 | ContactEditor::~ContactEditor() { | 80 | ContactEditor::~ContactEditor() { |
80 | } | 81 | } |
81 | 82 | ||
82 | void ContactEditor::init() { | 83 | void ContactEditor::init() { |
83 | 84 | ||
84 | useFullName = true; | 85 | useFullName = true; |
85 | 86 | ||
86 | uint i = 0; | 87 | uint i = 0; |
87 | 88 | ||
88 | QStringList trlChooserNames; | 89 | QStringList trlChooserNames; |
89 | 90 | ||
90 | for (i = 0; i <= 6; i++) { | 91 | for (i = 0; i <= 6; i++) { |
91 | slHomeAddress.append( "" ); | 92 | slHomeAddress.append( "" ); |
92 | slBusinessAddress.append( "" ); | 93 | slBusinessAddress.append( "" ); |
93 | } | 94 | } |
94 | 95 | ||
95 | trlChooserNames = OContactFields::trphonefields( false ); | 96 | trlChooserNames = OContactFields::trphonefields( false ); |
96 | slChooserNames = OContactFields::untrphonefields( false ); | 97 | slChooserNames = OContactFields::untrphonefields( false ); |
@@ -599,255 +600,391 @@ void ContactEditor::init() { | |||
599 | cmbChooserField3->insertStringList( trlChooserNames ); | 600 | cmbChooserField3->insertStringList( trlChooserNames ); |
600 | cmbChooserField4->insertStringList( trlChooserNames ); | 601 | cmbChooserField4->insertStringList( trlChooserNames ); |
601 | 602 | ||
602 | cmbChooserField1->setCurrentItem( 0 ); | 603 | cmbChooserField1->setCurrentItem( 0 ); |
603 | cmbChooserField2->setCurrentItem( 1 ); | 604 | cmbChooserField2->setCurrentItem( 1 ); |
604 | cmbChooserField3->setCurrentItem( 2 ); | 605 | cmbChooserField3->setCurrentItem( 2 ); |
605 | 606 | ||
606 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 607 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
607 | 608 | ||
608 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); | 609 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); |
609 | 610 | ||
610 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), | 611 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), |
611 | this, SLOT(slotChooser1Change(const QString &)) ); | 612 | this, SLOT(slotChooser1Change(const QString &)) ); |
612 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), | 613 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), |
613 | this, SLOT(slotChooser2Change(const QString &)) ); | 614 | this, SLOT(slotChooser2Change(const QString &)) ); |
614 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), | 615 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), |
615 | this, SLOT(slotChooser3Change(const QString &)) ); | 616 | this, SLOT(slotChooser3Change(const QString &)) ); |
616 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), | 617 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), |
617 | this, SLOT(slotChooser4Change(const QString &)) ); | 618 | this, SLOT(slotChooser4Change(const QString &)) ); |
618 | connect( txtAddress, SIGNAL(textChanged(const QString &)), | 619 | connect( txtAddress, SIGNAL(textChanged(const QString &)), |
619 | this, SLOT(slotAddressChange(const QString &)) ); | 620 | this, SLOT(slotAddressChange(const QString &)) ); |
620 | connect( txtCity, SIGNAL(textChanged(const QString &)), | 621 | connect( txtCity, SIGNAL(textChanged(const QString &)), |
621 | this, SLOT(slotCityChange(const QString &)) ); | 622 | this, SLOT(slotCityChange(const QString &)) ); |
622 | connect( txtState, SIGNAL(textChanged(const QString &)), | 623 | connect( txtState, SIGNAL(textChanged(const QString &)), |
623 | this, SLOT(slotStateChange(const QString &)) ); | 624 | this, SLOT(slotStateChange(const QString &)) ); |
624 | connect( txtZip, SIGNAL(textChanged(const QString &)), | 625 | connect( txtZip, SIGNAL(textChanged(const QString &)), |
625 | this, SLOT(slotZipChange(const QString &)) ); | 626 | this, SLOT(slotZipChange(const QString &)) ); |
626 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), | 627 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), |
627 | this, SLOT(slotCountryChange(const QString &)) ); | 628 | this, SLOT(slotCountryChange(const QString &)) ); |
628 | connect( cmbCountry, SIGNAL(activated(const QString &)), | 629 | connect( cmbCountry, SIGNAL(activated(const QString &)), |
629 | this, SLOT(slotCountryChange(const QString &)) ); | 630 | this, SLOT(slotCountryChange(const QString &)) ); |
630 | connect( cmbChooserField1, SIGNAL(activated(int)), | 631 | connect( cmbChooserField1, SIGNAL(activated(int)), |
631 | this, SLOT(slotCmbChooser1Change(int)) ); | 632 | this, SLOT(slotCmbChooser1Change(int)) ); |
632 | connect( cmbChooserField2, SIGNAL(activated(int)), | 633 | connect( cmbChooserField2, SIGNAL(activated(int)), |
633 | this, SLOT(slotCmbChooser2Change(int)) ); | 634 | this, SLOT(slotCmbChooser2Change(int)) ); |
634 | connect( cmbChooserField3, SIGNAL(activated(int)), | 635 | connect( cmbChooserField3, SIGNAL(activated(int)), |
635 | this, SLOT(slotCmbChooser3Change(int)) ); | 636 | this, SLOT(slotCmbChooser3Change(int)) ); |
636 | connect( cmbChooserField4, SIGNAL(activated(int)), | 637 | connect( cmbChooserField4, SIGNAL(activated(int)), |
637 | this, SLOT(slotCmbChooser4Change(int)) ); | 638 | this, SLOT(slotCmbChooser4Change(int)) ); |
638 | connect( cmbAddress, SIGNAL(activated(int)), | 639 | connect( cmbAddress, SIGNAL(activated(int)), |
639 | this, SLOT(slotAddressTypeChange(int)) ); | 640 | this, SLOT(slotAddressTypeChange(int)) ); |
640 | 641 | ||
641 | new QPEDialogListener(this); | 642 | new QPEDialogListener(this); |
642 | 643 | ||
643 | setPersonalView ( m_personalView ); | 644 | setPersonalView ( m_personalView ); |
644 | } | 645 | } |
645 | 646 | ||
646 | void ContactEditor::defaultEmailChanged(int i){ | 647 | void ContactEditor::defaultEmailChanged(int i){ |
647 | qDebug("defaultEmailChanged"); | 648 | qDebug("defaultEmailChanged"); |
649 | |||
648 | int index = cmbChooserField1->currentItem(); | 650 | int index = cmbChooserField1->currentItem(); |
649 | slChooserValues[index] = cmbDefaultEmail->text(i); | 651 | slChooserValues[index] = cmbDefaultEmail->text(i); |
650 | 652 | ||
653 | defaultEmail = cmbDefaultEmail->text(i); | ||
654 | qDebug ("Changed to: %s", defaultEmail.latin1()); | ||
655 | |||
651 | } | 656 | } |
652 | 657 | ||
653 | void ContactEditor::populateDefaultEmailCmb(){ | 658 | void ContactEditor::populateDefaultEmailCmb(){ |
659 | |||
660 | // if the default-email combo was not selected and therfore not created | ||
661 | // we get a lot of trouble.. Therfore create an invisible one.. | ||
662 | if ( !cmbDefaultEmail ){ | ||
663 | cmbDefaultEmail = new QComboBox(this); | ||
664 | cmbDefaultEmail -> hide(); | ||
665 | } | ||
654 | cmbDefaultEmail->clear(); | 666 | cmbDefaultEmail->clear(); |
655 | cmbDefaultEmail->insertStringList(emails); | 667 | cmbDefaultEmail->insertStringList( emails ); |
668 | // cmbDefaultEmail->show(); | ||
669 | |||
670 | // Select default email in combo.. | ||
671 | bool found = false; | ||
656 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 672 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
657 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",cmbDefaultEmail->text( i ).latin1(),defaultEmail.latin1()); | 673 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", |
658 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 674 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); |
659 | cmbDefaultEmail->setCurrentItem( i ); | 675 | |
660 | qDebug("set"); | 676 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
677 | cmbDefaultEmail->setCurrentItem( i ); | ||
678 | qDebug("set"); | ||
679 | found = true; | ||
661 | } | 680 | } |
662 | } | 681 | } |
682 | |||
683 | // If the current default email is not found in the list, we choose the | ||
684 | // first one.. | ||
685 | if ( !found ) | ||
686 | defaultEmail = cmbDefaultEmail->text(0); | ||
687 | } | ||
688 | |||
689 | // Called when any combobox was changed. | ||
690 | // "true" returned if the change was chandled by this function, else it should | ||
691 | // be handled by something else.. | ||
692 | bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widgetPos ) { | ||
693 | QString type = slChooserNames[index]; | ||
694 | qWarning("ContactEditor::cmbChooserChange -> Type: %s", type.latin1() ); | ||
695 | |||
696 | // Create and connect combobox for selecting the default email | ||
697 | if ( type == "Default Email"){ | ||
698 | qWarning("Choosing default-email "); | ||
699 | |||
700 | // More than one defaul-email chooser is not allowed ! | ||
701 | if ( ( defaultEmailChooserPosition != -1 ) && | ||
702 | defaultEmailChooserPosition != widgetPos ){ | ||
703 | chooserError( widgetPos ); | ||
704 | return true; | ||
705 | } | ||
706 | |||
707 | if ( cmbDefaultEmail ){ | ||
708 | delete cmbDefaultEmail; | ||
709 | cmbDefaultEmail = 0l; | ||
710 | } | ||
711 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); | ||
712 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); | ||
713 | |||
714 | connect( cmbDefaultEmail,SIGNAL( activated(int) ), | ||
715 | SLOT( defaultEmailChanged(int) ) ); | ||
716 | |||
717 | cmbDefaultEmail->clear(); | ||
718 | cmbDefaultEmail->insertStringList( emails ); | ||
719 | cmbDefaultEmail->show(); | ||
720 | |||
721 | defaultEmailChooserPosition = widgetPos; | ||
722 | |||
723 | // Set current default email | ||
724 | populateDefaultEmailCmb(); | ||
725 | |||
726 | |||
727 | } else { | ||
728 | // Something else was selected: Hide combo.. | ||
729 | qWarning(" Hiding default-email combo" ); | ||
730 | if ( defaultEmailChooserPosition == widgetPos ){ | ||
731 | defaultEmailChooserPosition = -1; | ||
732 | if ( cmbDefaultEmail ) | ||
733 | cmbDefaultEmail->hide(); | ||
734 | |||
735 | } | ||
736 | |||
737 | // Caller should initialize the responsible textfield, therefore | ||
738 | // "false" is returned | ||
739 | return false; | ||
740 | } | ||
741 | |||
742 | // Everything is worked off .. | ||
743 | return true; | ||
744 | |||
745 | } | ||
746 | |||
747 | // Currently accessed when we select default-email more than once ! | ||
748 | void ContactEditor::chooserError( int index ) | ||
749 | { | ||
750 | qWarning("ContactEditor::chooserError( %d )", index); | ||
751 | QMessageBox::warning( this, "Chooser Error", | ||
752 | "Multiple selection of this\n" | ||
753 | "Item is not allowed !\n\n" | ||
754 | "First deselect the previous one !", | ||
755 | "&OK", 0, 0, | ||
756 | 0, 0 ); | ||
757 | |||
758 | // Reset the selected Chooser. Unfortunately the chooser | ||
759 | // generates no signal, therfore we have to | ||
760 | // call the cmbChooserChange function manually.. | ||
761 | switch( index ){ | ||
762 | case 1: | ||
763 | cmbChooserField1 -> setCurrentItem( 0 ); | ||
764 | slotCmbChooser1Change( 0 ); | ||
765 | break; | ||
766 | case 2: | ||
767 | cmbChooserField2 -> setCurrentItem( 0 ); | ||
768 | slotCmbChooser2Change( 0 ); | ||
769 | break; | ||
770 | case 3: | ||
771 | cmbChooserField3 -> setCurrentItem( 0 ); | ||
772 | slotCmbChooser3Change( 0 ); | ||
773 | break; | ||
774 | case 4: | ||
775 | cmbChooserField4 -> setCurrentItem( 0 ); | ||
776 | slotCmbChooser4Change( 0 ); | ||
777 | break; | ||
778 | } | ||
663 | } | 779 | } |
664 | 780 | ||
665 | void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) { | 781 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
782 | void ContactEditor::chooserChange( const QString &textChanged, int index, | ||
783 | QLineEdit* , int widgetPos ) { | ||
784 | |||
666 | QString type = slChooserNames[index]; | 785 | QString type = slChooserNames[index]; |
667 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i",type.latin1(),textChanged.latin1(), index, widgetPos ); | 786 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", |
787 | type.latin1(),textChanged.latin1(), index, widgetPos ); | ||
788 | |||
668 | if ( type == "Default Email"){ | 789 | if ( type == "Default Email"){ |
669 | defaultEmail = textChanged; | 790 | qWarning ("??? Wozu??: %s", textChanged.latin1()); |
670 | if (cmbDefaultEmail){ | 791 | defaultEmail = textChanged; |
671 | delete cmbDefaultEmail; | 792 | |
672 | cmbDefaultEmail = 0l; | 793 | populateDefaultEmailCmb(); |
673 | } | 794 | |
674 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); | ||
675 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); | ||
676 | cmbDefaultEmail->show(); | ||
677 | populateDefaultEmailCmb(); | ||
678 | connect(cmbDefaultEmail,SIGNAL(activated(int)), | ||
679 | SLOT(defaultEmailChanged(int))); | ||
680 | defaultEmailChooserPosition = widgetPos; | ||
681 | }else if (defaultEmailChooserPosition == widgetPos){ | 795 | }else if (defaultEmailChooserPosition == widgetPos){ |
682 | qDebug("cmbDefaultEmail->hide()"); | 796 | qDebug("cmbDefaultEmail->hide()"); |
683 | if (cmbDefaultEmail) cmbDefaultEmail->hide(); | 797 | |
684 | widgetPos=-1; | 798 | if (cmbDefaultEmail) cmbDefaultEmail->hide(); |
799 | widgetPos=-1; | ||
800 | |||
685 | }else if (type == "Emails"){ | 801 | }else if (type == "Emails"){ |
686 | qDebug("emails"); | 802 | qDebug("emails"); |
687 | QString de; | 803 | |
688 | emails = QStringList::split (",", textChanged ); | 804 | QString de; |
805 | emails = QStringList::split (",", textChanged ); | ||
689 | 806 | ||
690 | if ( cmbDefaultEmail ) | 807 | populateDefaultEmailCmb(); |
691 | populateDefaultEmailCmb(); | ||
692 | } | 808 | } |
693 | 809 | ||
694 | |||
695 | |||
696 | slChooserValues[index] = textChanged; | 810 | slChooserValues[index] = textChanged; |
697 | 811 | ||
698 | } | 812 | } |
699 | 813 | ||
700 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 814 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
815 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); | ||
701 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 816 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
702 | } | 817 | } |
703 | 818 | ||
704 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 819 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
820 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); | ||
705 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 821 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
706 | 822 | ||
707 | } | 823 | } |
708 | 824 | ||
709 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 825 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
826 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); | ||
710 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 827 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
711 | } | 828 | } |
712 | 829 | ||
713 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 830 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
831 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); | ||
714 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 832 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
715 | } | 833 | } |
716 | 834 | ||
717 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 835 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
718 | 836 | ||
719 | if ( cmbAddress->currentItem() == 0 ) { | 837 | if ( cmbAddress->currentItem() == 0 ) { |
720 | slBusinessAddress[0] = textChanged; | 838 | slBusinessAddress[0] = textChanged; |
721 | } else { | 839 | } else { |
722 | slHomeAddress[0] = textChanged; | 840 | slHomeAddress[0] = textChanged; |
723 | } | 841 | } |
724 | } | 842 | } |
725 | 843 | ||
726 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 844 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
727 | 845 | ||
728 | if ( cmbAddress->currentItem() == 0 ) { | 846 | if ( cmbAddress->currentItem() == 0 ) { |
729 | slBusinessAddress[1] = textChanged; | 847 | slBusinessAddress[1] = textChanged; |
730 | } else { | 848 | } else { |
731 | slHomeAddress[1] = textChanged; | 849 | slHomeAddress[1] = textChanged; |
732 | } | 850 | } |
733 | } | 851 | } |
734 | 852 | ||
735 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 853 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
736 | 854 | ||
737 | if ( cmbAddress->currentItem() == 0 ) { | 855 | if ( cmbAddress->currentItem() == 0 ) { |
738 | slBusinessAddress[2] = textChanged; | 856 | slBusinessAddress[2] = textChanged; |
739 | } else { | 857 | } else { |
740 | slHomeAddress[2] = textChanged; | 858 | slHomeAddress[2] = textChanged; |
741 | } | 859 | } |
742 | } | 860 | } |
743 | 861 | ||
744 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 862 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
745 | 863 | ||
746 | if ( cmbAddress->currentItem() == 0 ) { | 864 | if ( cmbAddress->currentItem() == 0 ) { |
747 | slBusinessAddress[3] = textChanged; | 865 | slBusinessAddress[3] = textChanged; |
748 | } else { | 866 | } else { |
749 | slHomeAddress[3] = textChanged; | 867 | slHomeAddress[3] = textChanged; |
750 | } | 868 | } |
751 | } | 869 | } |
752 | 870 | ||
753 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 871 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
754 | 872 | ||
755 | 873 | ||
756 | if ( cmbAddress->currentItem() == 0 ) { | 874 | if ( cmbAddress->currentItem() == 0 ) { |
757 | slBusinessAddress[4] = textChanged; | 875 | slBusinessAddress[4] = textChanged; |
758 | } else { | 876 | } else { |
759 | slHomeAddress[4] = textChanged; | 877 | slHomeAddress[4] = textChanged; |
760 | } | 878 | } |
761 | } | 879 | } |
762 | 880 | ||
763 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 881 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
764 | 882 | ||
765 | if ( cmbAddress->currentItem() == 0 ) { | 883 | if ( cmbAddress->currentItem() == 0 ) { |
766 | slBusinessAddress[5] = textChanged; | 884 | slBusinessAddress[5] = textChanged; |
767 | } else { | 885 | } else { |
768 | slHomeAddress[5] = textChanged; | 886 | slHomeAddress[5] = textChanged; |
769 | } | 887 | } |
770 | } | 888 | } |
771 | 889 | ||
772 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 890 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
773 | 891 | ||
774 | if ( cmbAddress->currentItem() == 0 ) { | 892 | if ( cmbAddress->currentItem() == 0 ) { |
775 | slBusinessAddress[6] = textChanged; | 893 | slBusinessAddress[6] = textChanged; |
776 | } else { | 894 | } else { |
777 | slHomeAddress[6] = textChanged; | 895 | slHomeAddress[6] = textChanged; |
778 | } | 896 | } |
779 | } | 897 | } |
780 | 898 | ||
781 | 899 | ||
782 | void ContactEditor::slotCmbChooser1Change( int index ) { | 900 | void ContactEditor::slotCmbChooser1Change( int index ) { |
901 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); | ||
902 | |||
903 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), txtChooserField1, 1) ){ | ||
904 | |||
905 | txtChooserField1->setText( slChooserValues[index] ); | ||
906 | txtChooserField1->setFocus(); | ||
907 | |||
908 | } | ||
783 | 909 | ||
784 | txtChooserField1->setText( slChooserValues[index] ); | ||
785 | txtChooserField1->setFocus(); | ||
786 | } | 910 | } |
787 | 911 | ||
788 | void ContactEditor::slotCmbChooser2Change( int index ) { | 912 | void ContactEditor::slotCmbChooser2Change( int index ) { |
913 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); | ||
914 | |||
915 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), txtChooserField2, 2) ){ | ||
789 | 916 | ||
790 | txtChooserField2->setText( slChooserValues[index] ); | 917 | txtChooserField2->setText( slChooserValues[index] ); |
791 | txtChooserField2->setFocus(); | 918 | txtChooserField2->setFocus(); |
919 | |||
920 | } | ||
792 | } | 921 | } |
793 | 922 | ||
794 | void ContactEditor::slotCmbChooser3Change( int index ) { | 923 | void ContactEditor::slotCmbChooser3Change( int index ) { |
924 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); | ||
925 | |||
926 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), txtChooserField3, 3) ){ | ||
795 | 927 | ||
796 | txtChooserField3->setText( slChooserValues[index] ); | 928 | txtChooserField3->setText( slChooserValues[index] ); |
797 | txtChooserField3->setFocus(); | 929 | txtChooserField3->setFocus(); |
798 | 930 | ||
931 | } | ||
799 | } | 932 | } |
800 | 933 | ||
801 | void ContactEditor::slotCmbChooser4Change( int index ) { | 934 | void ContactEditor::slotCmbChooser4Change( int index ) { |
935 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); | ||
936 | |||
937 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), txtChooserField4, 4) ){ | ||
802 | 938 | ||
803 | txtChooserField4->setText( slChooserValues[index] ); | 939 | txtChooserField4->setText( slChooserValues[index] ); |
804 | txtChooserField4->setFocus(); | 940 | txtChooserField4->setFocus(); |
805 | 941 | ||
942 | } | ||
806 | } | 943 | } |
807 | 944 | ||
808 | void ContactEditor::slotAddressTypeChange( int index ) { | 945 | void ContactEditor::slotAddressTypeChange( int index ) { |
809 | 946 | ||
810 | if ( index == 0 ) { | 947 | if ( index == 0 ) { |
811 | 948 | ||
812 | txtAddress->setText( slBusinessAddress[0] ); | 949 | txtAddress->setText( slBusinessAddress[0] ); |
813 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 950 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
814 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 951 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
815 | txtCity->setText( slBusinessAddress[3] ); | 952 | txtCity->setText( slBusinessAddress[3] ); |
816 | txtState->setText( slBusinessAddress[4] ); | 953 | txtState->setText( slBusinessAddress[4] ); |
817 | txtZip->setText( slBusinessAddress[5] ); | 954 | txtZip->setText( slBusinessAddress[5] ); |
818 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 955 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
819 | txtTmp->setText( slBusinessAddress[6] ); | 956 | txtTmp->setText( slBusinessAddress[6] ); |
820 | 957 | ||
821 | } else { | 958 | } else { |
822 | 959 | ||
823 | txtAddress->setText( slHomeAddress[0] ); | 960 | txtAddress->setText( slHomeAddress[0] ); |
824 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 961 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
825 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 962 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
826 | txtCity->setText( slHomeAddress[3] ); | 963 | txtCity->setText( slHomeAddress[3] ); |
827 | txtState->setText( slHomeAddress[4] ); | 964 | txtState->setText( slHomeAddress[4] ); |
828 | txtZip->setText( slHomeAddress[5] ); | 965 | txtZip->setText( slHomeAddress[5] ); |
829 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 966 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
830 | txtTmp->setText( slHomeAddress[6] ); | 967 | txtTmp->setText( slHomeAddress[6] ); |
831 | 968 | ||
832 | } | 969 | } |
833 | 970 | ||
834 | } | 971 | } |
835 | 972 | ||
836 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 973 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
837 | 974 | ||
838 | int index = cmbFileAs->currentItem(); | 975 | int index = cmbFileAs->currentItem(); |
839 | 976 | ||
840 | cmbFileAs->clear(); | 977 | cmbFileAs->clear(); |
841 | 978 | ||
842 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); | 979 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); |
843 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); | 980 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); |
844 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); | 981 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); |
845 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); | 982 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); |
846 | 983 | ||
847 | cmbFileAs->setCurrentItem( index ); | 984 | cmbFileAs->setCurrentItem( index ); |
848 | 985 | ||
849 | useFullName = true; | 986 | useFullName = true; |
850 | 987 | ||
851 | } | 988 | } |
852 | 989 | ||
853 | void ContactEditor::accept() { | 990 | void ContactEditor::accept() { |
@@ -1403,104 +1540,107 @@ void ContactEditor::saveEntry() { | |||
1403 | QListIterator<QLineEdit> itLE( listValue ); | 1540 | QListIterator<QLineEdit> itLE( listValue ); |
1404 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { | 1541 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { |
1405 | 1542 | ||
1406 | if ( *it == "Department" ) | 1543 | if ( *it == "Department" ) |
1407 | ent.setDepartment( (*itLE)->text() ); | 1544 | ent.setDepartment( (*itLE)->text() ); |
1408 | 1545 | ||
1409 | if ( *it == "Company" ) | 1546 | if ( *it == "Company" ) |
1410 | ent.setCompany( (*itLE)->text() ); | 1547 | ent.setCompany( (*itLE)->text() ); |
1411 | 1548 | ||
1412 | if ( *it == "Office" ) | 1549 | if ( *it == "Office" ) |
1413 | ent.setOffice( (*itLE)->text() ); | 1550 | ent.setOffice( (*itLE)->text() ); |
1414 | 1551 | ||
1415 | if ( *it == "Profession" ) | 1552 | if ( *it == "Profession" ) |
1416 | ent.setProfession( (*itLE)->text() ); | 1553 | ent.setProfession( (*itLE)->text() ); |
1417 | 1554 | ||
1418 | if ( *it == "Assistant" ) | 1555 | if ( *it == "Assistant" ) |
1419 | ent.setAssistant( (*itLE)->text() ); | 1556 | ent.setAssistant( (*itLE)->text() ); |
1420 | 1557 | ||
1421 | if ( *it == "Manager" ) | 1558 | if ( *it == "Manager" ) |
1422 | ent.setManager( (*itLE)->text() ); | 1559 | ent.setManager( (*itLE)->text() ); |
1423 | 1560 | ||
1424 | if ( *it == "Spouse" ) | 1561 | if ( *it == "Spouse" ) |
1425 | ent.setSpouse( (*itLE)->text() ); | 1562 | ent.setSpouse( (*itLE)->text() ); |
1426 | 1563 | ||
1427 | if ( *it == "Nickname" ) | 1564 | if ( *it == "Nickname" ) |
1428 | ent.setNickname( (*itLE)->text() ); | 1565 | ent.setNickname( (*itLE)->text() ); |
1429 | 1566 | ||
1430 | if ( *it == "Children" ) | 1567 | if ( *it == "Children" ) |
1431 | ent.setChildren( (*itLE)->text() ); | 1568 | ent.setChildren( (*itLE)->text() ); |
1432 | 1569 | ||
1433 | } | 1570 | } |
1434 | 1571 | ||
1435 | 1572 | ||
1436 | QStringList::ConstIterator itV; | 1573 | QStringList::ConstIterator itV; |
1437 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1574 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1438 | 1575 | ||
1439 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1576 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1440 | ent.setBusinessPhone( *itV ); | 1577 | ent.setBusinessPhone( *itV ); |
1441 | 1578 | ||
1442 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1579 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1443 | ent.setBusinessFax( *itV ); | 1580 | ent.setBusinessFax( *itV ); |
1444 | 1581 | ||
1445 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1582 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1446 | ent.setBusinessMobile( *itV ); | 1583 | ent.setBusinessMobile( *itV ); |
1447 | 1584 | ||
1448 | if ( *it == "Emails" ){ | 1585 | if ( *it == "Emails" ){ |
1449 | QString allemail; | 1586 | QString allemail; |
1450 | QString defaultmail; | 1587 | QString defaultmail; |
1451 | parseEmailFrom( *itV, defaultmail, allemail ); | 1588 | parseEmailFrom( emails.join(","), defaultmail, allemail ); |
1452 | // ent.clearEmails(); | 1589 | if ( defaultEmail.isEmpty() ){ |
1453 | // ent.setDefaultEmail( defaultmail ); | 1590 | qWarning("Default email was not set by user!"); |
1591 | qWarning("Using first email in list: %s", defaultmail.latin1()); | ||
1592 | ent.setDefaultEmail( defaultmail ); | ||
1593 | } | ||
1454 | ent.setEmails( allemail ); | 1594 | ent.setEmails( allemail ); |
1455 | } | 1595 | } |
1456 | 1596 | ||
1457 | if ( *it == "Default Email") | 1597 | if ( *it == "Default Email") |
1458 | ent.setDefaultEmail( *itV ); | 1598 | ent.setDefaultEmail( defaultEmail /* *itV */ ); |
1459 | 1599 | ||
1460 | if ( *it == "Home Phone" ) | 1600 | if ( *it == "Home Phone" ) |
1461 | ent.setHomePhone( *itV ); | 1601 | ent.setHomePhone( *itV ); |
1462 | 1602 | ||
1463 | if ( *it == "Home Fax" ) | 1603 | if ( *it == "Home Fax" ) |
1464 | ent.setHomeFax( *itV ); | 1604 | ent.setHomeFax( *itV ); |
1465 | 1605 | ||
1466 | if ( *it == "Home Mobile" ) | 1606 | if ( *it == "Home Mobile" ) |
1467 | ent.setHomeMobile( *itV ); | 1607 | ent.setHomeMobile( *itV ); |
1468 | 1608 | ||
1469 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1609 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1470 | ent.setBusinessPager( *itV ); | 1610 | ent.setBusinessPager( *itV ); |
1471 | 1611 | ||
1472 | if ( *it == "Home Web Page" ) | 1612 | if ( *it == "Home Web Page" ) |
1473 | ent.setHomeWebpage( *itV ); | 1613 | ent.setHomeWebpage( *itV ); |
1474 | 1614 | ||
1475 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1615 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1476 | ent.setBusinessWebpage( *itV ); | 1616 | ent.setBusinessWebpage( *itV ); |
1477 | 1617 | ||
1478 | 1618 | ||
1479 | } | 1619 | } |
1480 | 1620 | ||
1481 | int gender = cmbGender->currentItem(); | 1621 | int gender = cmbGender->currentItem(); |
1482 | ent.setGender( QString::number( gender ) ); | 1622 | ent.setGender( QString::number( gender ) ); |
1483 | 1623 | ||
1484 | QString str = txtNote->text(); | 1624 | QString str = txtNote->text(); |
1485 | if ( !str.isNull() ) | 1625 | if ( !str.isNull() ) |
1486 | ent.setNotes( str ); | 1626 | ent.setNotes( str ); |
1487 | 1627 | ||
1488 | } | 1628 | } |
1489 | 1629 | ||
1490 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1630 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1491 | QString &strAll ) | 1631 | QString &strAll ) |
1492 | { | 1632 | { |
1493 | int where, | 1633 | int where, |
1494 | start; | 1634 | start; |
1495 | if ( txt.isEmpty() ) | 1635 | if ( txt.isEmpty() ) |
1496 | return; | 1636 | return; |
1497 | // find the first | 1637 | // find the first |
1498 | where = txt.find( ',' ); | 1638 | where = txt.find( ',' ); |
1499 | if ( where < 0 ) { | 1639 | if ( where < 0 ) { |
1500 | strDefaultEmail = txt; | 1640 | strDefaultEmail = txt; |
1501 | strAll = txt; | 1641 | strAll = txt; |
1502 | } else { | 1642 | } else { |
1503 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1643 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1504 | strAll = strDefaultEmail; | 1644 | strAll = strDefaultEmail; |
1505 | while ( where > -1 ) { | 1645 | while ( where > -1 ) { |
1506 | strAll.append(" "); | 1646 | strAll.append(" "); |
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index bcef679..4fa48d1 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h | |||
@@ -33,124 +33,126 @@ | |||
33 | const int NAME_LF = 0; | 33 | const int NAME_LF = 0; |
34 | const int NAME_LFM = 1; | 34 | const int NAME_LFM = 1; |
35 | const int NAME_FL = 2; | 35 | const int NAME_FL = 2; |
36 | const int NAME_FMLS = 3; | 36 | const int NAME_FMLS = 3; |
37 | 37 | ||
38 | const int NAME_F = 4; | 38 | const int NAME_F = 4; |
39 | const int NAME_M = 5; | 39 | const int NAME_M = 5; |
40 | const int NAME_L = 6; | 40 | const int NAME_L = 6; |
41 | const int NAME_S = 7; | 41 | const int NAME_S = 7; |
42 | 42 | ||
43 | 43 | ||
44 | class QScrollView; | 44 | class QScrollView; |
45 | class QTabWidget; | 45 | class QTabWidget; |
46 | class QMultiLineEdit; | 46 | class QMultiLineEdit; |
47 | class QLineEdit; | 47 | class QLineEdit; |
48 | class QComboBox; | 48 | class QComboBox; |
49 | class QPushButton; | 49 | class QPushButton; |
50 | class CategorySelect; | 50 | class CategorySelect; |
51 | class QLabel; | 51 | class QLabel; |
52 | 52 | ||
53 | class ContactEditor : public QDialog { | 53 | class ContactEditor : public QDialog { |
54 | Q_OBJECT | 54 | Q_OBJECT |
55 | 55 | ||
56 | public: | 56 | public: |
57 | ContactEditor(const OContact &entry, | 57 | ContactEditor(const OContact &entry, |
58 | QWidget *parent = 0, | 58 | QWidget *parent = 0, |
59 | const char *name = 0, | 59 | const char *name = 0, |
60 | WFlags fl = 0 ); | 60 | WFlags fl = 0 ); |
61 | ~ContactEditor(); | 61 | ~ContactEditor(); |
62 | void setNameFocus(); | 62 | void setNameFocus(); |
63 | void setPersonalView( bool personal = true ); | 63 | void setPersonalView( bool personal = true ); |
64 | OContact entry() const { return ent; } | 64 | OContact entry() const { return ent; } |
65 | 65 | ||
66 | public slots: | 66 | public slots: |
67 | void slotNote(); | 67 | void slotNote(); |
68 | void slotName(); | 68 | void slotName(); |
69 | void setEntry(const OContact &entry); | 69 | void setEntry(const OContact &entry); |
70 | 70 | ||
71 | protected slots: | 71 | protected slots: |
72 | void accept(); | 72 | void accept(); |
73 | 73 | ||
74 | private: | 74 | private: |
75 | void init(); | 75 | void init(); |
76 | void saveEntry(); | 76 | void saveEntry(); |
77 | bool isEmpty(); | 77 | bool isEmpty(); |
78 | void cleanupFields(); | 78 | void cleanupFields(); |
79 | void updateDatePicker(); | 79 | void updateDatePicker(); |
80 | QString parseName( QString fullName, int type ); | 80 | QString parseName( QString fullName, int type ); |
81 | void chooserError( int index ); | ||
81 | private slots: | 82 | private slots: |
82 | void slotChooser1Change( const QString &textChanged ); | 83 | void slotChooser1Change( const QString &textChanged ); |
83 | void slotChooser2Change( const QString &textChanged ); | 84 | void slotChooser2Change( const QString &textChanged ); |
84 | void slotChooser3Change( const QString &textChanged ); | 85 | void slotChooser3Change( const QString &textChanged ); |
85 | void slotChooser4Change( const QString &textChanged ); | 86 | void slotChooser4Change( const QString &textChanged ); |
86 | void slotCmbChooser1Change( int index ); | 87 | void slotCmbChooser1Change( int index ); |
87 | void slotCmbChooser2Change( int index ); | 88 | void slotCmbChooser2Change( int index ); |
88 | void slotCmbChooser3Change( int index ); | 89 | void slotCmbChooser3Change( int index ); |
89 | void slotCmbChooser4Change( int index ); | 90 | void slotCmbChooser4Change( int index ); |
90 | void slotAddressTypeChange( int index ); | 91 | void slotAddressTypeChange( int index ); |
91 | void slotAddressChange( const QString &textChanged ); | 92 | void slotAddressChange( const QString &textChanged ); |
92 | void slotAddress2Change( const QString &textChanged ); | 93 | void slotAddress2Change( const QString &textChanged ); |
93 | void slotPOBoxChange( const QString &textChanged ); | 94 | void slotPOBoxChange( const QString &textChanged ); |
94 | void slotCityChange( const QString &textChanged ); | 95 | void slotCityChange( const QString &textChanged ); |
95 | void slotStateChange( const QString &textChanged ); | 96 | void slotStateChange( const QString &textChanged ); |
96 | void slotZipChange( const QString &textChanged ); | 97 | void slotZipChange( const QString &textChanged ); |
97 | void slotCountryChange( const QString &textChanged ); | 98 | void slotCountryChange( const QString &textChanged ); |
98 | void slotFullNameChange( const QString &textChanged ); | 99 | void slotFullNameChange( const QString &textChanged ); |
99 | void slotAnniversaryDateChanged( int year, int month, int day); | 100 | void slotAnniversaryDateChanged( int year, int month, int day); |
100 | void slotBirthdayDateChanged( int year, int month, int day); | 101 | void slotBirthdayDateChanged( int year, int month, int day); |
101 | void slotRemoveBirthday(); | 102 | void slotRemoveBirthday(); |
102 | void slotRemoveAnniversary(); | 103 | void slotRemoveAnniversary(); |
103 | void defaultEmailChanged(int); | 104 | void defaultEmailChanged(int); |
104 | 105 | ||
105 | private: | 106 | private: |
106 | int defaultEmailChooserPosition; | 107 | int defaultEmailChooserPosition; |
107 | void populateDefaultEmailCmb(); | 108 | void populateDefaultEmailCmb(); |
108 | void chooserChange( const QString&, int , QLineEdit*, int ); | 109 | void chooserChange( const QString&, int , QLineEdit*, int ); |
110 | bool cmbChooserChange( int , QLineEdit*, int ); | ||
109 | 111 | ||
110 | bool useFullName; | 112 | bool useFullName; |
111 | 113 | ||
112 | OContact ent; | 114 | OContact ent; |
113 | 115 | ||
114 | QDialog *dlgNote; | 116 | QDialog *dlgNote; |
115 | QDialog *dlgName; | 117 | QDialog *dlgName; |
116 | 118 | ||
117 | QList<QLineEdit> listValue; | 119 | QList<QLineEdit> listValue; |
118 | QList<QLabel> listName; | 120 | QList<QLabel> listName; |
119 | 121 | ||
120 | QStringList slDynamicEntries; | 122 | QStringList slDynamicEntries; |
121 | QStringList trlDynamicEntries; | 123 | QStringList trlDynamicEntries; |
122 | 124 | ||
123 | bool m_personalView; | 125 | bool m_personalView; |
124 | 126 | ||
125 | QStringList slHomeAddress; | 127 | QStringList slHomeAddress; |
126 | QStringList slBusinessAddress; | 128 | QStringList slBusinessAddress; |
127 | QStringList slChooserNames; | 129 | QStringList slChooserNames; |
128 | QStringList slChooserValues; | 130 | QStringList slChooserValues; |
129 | QStringList emails; | 131 | QStringList emails; |
130 | QString defaultEmail; | 132 | QString defaultEmail; |
131 | 133 | ||
132 | QMultiLineEdit *txtNote; | 134 | QMultiLineEdit *txtNote; |
133 | QLabel *lblNote; | 135 | QLabel *lblNote; |
134 | 136 | ||
135 | //QLineEdit *txtTitle; | 137 | //QLineEdit *txtTitle; |
136 | QLineEdit *txtFirstName; | 138 | QLineEdit *txtFirstName; |
137 | QLineEdit *txtMiddleName; | 139 | QLineEdit *txtMiddleName; |
138 | QLineEdit *txtLastName; | 140 | QLineEdit *txtLastName; |
139 | QLineEdit *txtSuffix; | 141 | QLineEdit *txtSuffix; |
140 | 142 | ||
141 | QTabWidget *tabMain; | 143 | QTabWidget *tabMain; |
142 | QScrollView *svGeneral; | 144 | QScrollView *svGeneral; |
143 | QPushButton *btnFullName; | 145 | QPushButton *btnFullName; |
144 | QPushButton *btnNote; | 146 | QPushButton *btnNote; |
145 | QLineEdit *txtFullName; | 147 | QLineEdit *txtFullName; |
146 | QLineEdit *txtJobTitle; | 148 | QLineEdit *txtJobTitle; |
147 | QLineEdit *txtOrganization; | 149 | QLineEdit *txtOrganization; |
148 | QLineEdit *txtChooserField1; | 150 | QLineEdit *txtChooserField1; |
149 | QLineEdit *txtChooserField2; | 151 | QLineEdit *txtChooserField2; |
150 | QLineEdit *txtChooserField3; | 152 | QLineEdit *txtChooserField3; |
151 | QLineEdit *txtChooserField4; | 153 | QLineEdit *txtChooserField4; |
152 | QComboBox *cmbChooserField1; | 154 | QComboBox *cmbChooserField1; |
153 | QComboBox *cmbChooserField2; | 155 | QComboBox *cmbChooserField2; |
154 | QComboBox *cmbChooserField3; | 156 | QComboBox *cmbChooserField3; |
155 | QComboBox *cmbChooserField4; | 157 | QComboBox *cmbChooserField4; |
156 | QComboBox *cmbDefaultEmail; | 158 | QComboBox *cmbDefaultEmail; |