author | eilers <eilers> | 2003-01-04 14:24:36 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-01-04 14:24:36 (UTC) |
commit | 4a9e13d7b9220b45cbbbdfab5f2ea56ea415d6a7 (patch) (unidiff) | |
tree | 00babfde2cfd15687cb87d73800e75630afdab0b | |
parent | 851c182383c34fd4925677713bb5f6fd603c86a0 (diff) | |
download | opie-4a9e13d7b9220b45cbbbdfab5f2ea56ea415d6a7.zip opie-4a9e13d7b9220b45cbbbdfab5f2ea56ea415d6a7.tar.gz opie-4a9e13d7b9220b45cbbbdfab5f2ea56ea415d6a7.tar.bz2 |
Hope I fixed the default-email bugs..
-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,110 +1,112 @@ | |||
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: |
89 | There are already entries in Cardview after up/down | 91 | There are already entries in Cardview after up/down |
90 | - Personal Details: Anniversary zeigt Fantasie-Werte | 92 | - Personal Details: Anniversary zeigt Fantasie-Werte |
91 | - Unfiled shown just in Category "All" and "Unfiled". | 93 | - Unfiled shown just in Category "All" and "Unfiled". |
92 | - After finising search and after Edit: Clear Picker | 94 | - After finising search and after Edit: Clear Picker |
93 | - After Edit: Table position back to edited entry. | 95 | - After Edit: Table position back to edited entry. |
94 | - Optimize Table Update... | 96 | - Optimize Table Update... |
95 | - Change MyDialog to Config | 97 | - Change MyDialog to Config |
96 | - Store position and state of toolbar | 98 | - Store position and state of toolbar |
97 | - Searchwidget closed: Selected user is jumping | 99 | - Searchwidget closed: Selected user is jumping |
98 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) | 100 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) |
99 | zu lange.. | 101 | zu lange.. |
100 | - VCARD: Import of Anniversary does not work correctly (currently disabled) | 102 | - VCARD: Import of Anniversary does not work correctly (currently disabled) |
101 | - Name order selected in "contacteditor" not used in list view. | 103 | - Name order selected in "contacteditor" not used in list view. |
102 | - OK-Key does not switch from Detailview (ablable) to Listview | 104 | - OK-Key does not switch from Detailview (ablable) to Listview |
103 | - Receiving of beams should open a dialog | 105 | - Receiving of beams should open a dialog |
104 | - Fix start of opie-mail | 106 | - Fix start of opie-mail |
105 | - Implement Button Pics | 107 | - Implement Button Pics |
106 | - Add a dialog to accept and optionally edit received contacts by IRDA. | 108 | - Add a dialog to accept and optionally edit received contacts by IRDA. |
107 | - Language not English (tested with german opie-translation): | 109 | - Language not English (tested with german opie-translation): |
108 | 1. Configure nicht übersetzt (alles leer). | 110 | 1. Configure nicht übersetzt (alles leer). |
109 | 2. Contacteditor nur teilweise übersetzt. | 111 | 2. Contacteditor nur teilweise übersetzt. |
110 | 3. Kategorie-Picker geht nicht. | 112 | 3. Kategorie-Picker geht nicht. |
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,144 +1,145 @@ | |||
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 ); |
97 | slDynamicEntries = OContactFields::untrdetailsfields( false ); | 98 | slDynamicEntries = OContactFields::untrdetailsfields( false ); |
98 | trlDynamicEntries = OContactFields::trdetailsfields( false ); | 99 | trlDynamicEntries = OContactFields::trdetailsfields( false ); |
99 | 100 | ||
100 | // Ok, we have to remove elements from the list of dynamic entries | 101 | // Ok, we have to remove elements from the list of dynamic entries |
101 | // which are now stored in special (not dynamic) widgets.. | 102 | // which are now stored in special (not dynamic) widgets.. |
102 | // Otherwise we will get problems with field assignments! (se) | 103 | // Otherwise we will get problems with field assignments! (se) |
103 | slDynamicEntries.remove("Anniversary"); | 104 | slDynamicEntries.remove("Anniversary"); |
104 | slDynamicEntries.remove("Birthday"); | 105 | slDynamicEntries.remove("Birthday"); |
105 | slDynamicEntries.remove("Gender"); | 106 | slDynamicEntries.remove("Gender"); |
106 | 107 | ||
107 | // The same with translated fields.. But I will | 108 | // The same with translated fields.. But I will |
108 | // use the translation map to avoid mismatches.. | 109 | // use the translation map to avoid mismatches.. |
109 | QMap<int, QString> translMap = OContactFields::idToTrFields(); | 110 | QMap<int, QString> translMap = OContactFields::idToTrFields(); |
110 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); | 111 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); |
111 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); | 112 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); |
112 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); | 113 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); |
113 | 114 | ||
114 | // Last Check to be sure.. | 115 | // Last Check to be sure.. |
115 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); | 116 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); |
116 | assert( slChooserNames.count() == trlChooserNames.count() ); | 117 | assert( slChooserNames.count() == trlChooserNames.count() ); |
117 | 118 | ||
118 | for (i = 0; i < slChooserNames.count(); i++) | 119 | for (i = 0; i < slChooserNames.count(); i++) |
119 | slChooserValues.append(""); | 120 | slChooserValues.append(""); |
120 | 121 | ||
121 | 122 | ||
122 | QVBoxLayout *vb = new QVBoxLayout( this ); | 123 | QVBoxLayout *vb = new QVBoxLayout( this ); |
123 | 124 | ||
124 | tabMain = new QTabWidget( this ); | 125 | tabMain = new QTabWidget( this ); |
125 | vb->addWidget( tabMain ); | 126 | vb->addWidget( tabMain ); |
126 | 127 | ||
127 | QWidget *tabViewport = new QWidget ( tabMain ); | 128 | QWidget *tabViewport = new QWidget ( tabMain ); |
128 | 129 | ||
129 | vb = new QVBoxLayout( tabViewport ); | 130 | vb = new QVBoxLayout( tabViewport ); |
130 | 131 | ||
131 | svGeneral = new QScrollView( tabViewport ); | 132 | svGeneral = new QScrollView( tabViewport ); |
132 | vb->addWidget( svGeneral, 0, 0 ); | 133 | vb->addWidget( svGeneral, 0, 0 ); |
133 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 134 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
134 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 135 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
135 | 136 | ||
136 | QWidget *container = new QWidget( svGeneral->viewport() ); | 137 | QWidget *container = new QWidget( svGeneral->viewport() ); |
137 | svGeneral->addChild( container ); | 138 | svGeneral->addChild( container ); |
138 | 139 | ||
139 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 140 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); |
140 | gl->setResizeMode( QLayout::FreeResize ); | 141 | gl->setResizeMode( QLayout::FreeResize ); |
141 | 142 | ||
142 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 143 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
143 | gl->addWidget( btnFullName, 0, 0 ); | 144 | gl->addWidget( btnFullName, 0, 0 ); |
144 | txtFullName = new QLineEdit( container ); | 145 | txtFullName = new QLineEdit( container ); |
@@ -551,351 +552,487 @@ void ContactEditor::init() { | |||
551 | gl->addWidget( l, i, 0 ); | 552 | gl->addWidget( l, i, 0 ); |
552 | QLineEdit *e = new QLineEdit( container ); | 553 | QLineEdit *e = new QLineEdit( container ); |
553 | listValue.append( e ); | 554 | listValue.append( e ); |
554 | gl->addWidget( e, i, 1); | 555 | gl->addWidget( e, i, 1); |
555 | } | 556 | } |
556 | // Fill labels with names.. | 557 | // Fill labels with names.. |
557 | //loadFields(); | 558 | //loadFields(); |
558 | 559 | ||
559 | 560 | ||
560 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 561 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
561 | 562 | ||
562 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 563 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
563 | dlgNote->setCaption( tr("Enter Note") ); | 564 | dlgNote->setCaption( tr("Enter Note") ); |
564 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 565 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
565 | txtNote = new QMultiLineEdit( dlgNote ); | 566 | txtNote = new QMultiLineEdit( dlgNote ); |
566 | vbNote->addWidget( txtNote ); | 567 | vbNote->addWidget( txtNote ); |
567 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 568 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
568 | 569 | ||
569 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 570 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
570 | dlgName->setCaption( tr("Edit Name") ); | 571 | dlgName->setCaption( tr("Edit Name") ); |
571 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 572 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
572 | 573 | ||
573 | l = new QLabel( tr("First Name"), dlgName ); | 574 | l = new QLabel( tr("First Name"), dlgName ); |
574 | gl->addWidget( l, 0, 0 ); | 575 | gl->addWidget( l, 0, 0 ); |
575 | txtFirstName = new QLineEdit( dlgName ); | 576 | txtFirstName = new QLineEdit( dlgName ); |
576 | gl->addWidget( txtFirstName, 0, 1 ); | 577 | gl->addWidget( txtFirstName, 0, 1 ); |
577 | 578 | ||
578 | l = new QLabel( tr("Middle Name"), dlgName ); | 579 | l = new QLabel( tr("Middle Name"), dlgName ); |
579 | gl->addWidget( l, 1, 0 ); | 580 | gl->addWidget( l, 1, 0 ); |
580 | txtMiddleName = new QLineEdit( dlgName ); | 581 | txtMiddleName = new QLineEdit( dlgName ); |
581 | gl->addWidget( txtMiddleName, 1, 1 ); | 582 | gl->addWidget( txtMiddleName, 1, 1 ); |
582 | 583 | ||
583 | l = new QLabel( tr("Last Name"), dlgName ); | 584 | l = new QLabel( tr("Last Name"), dlgName ); |
584 | gl->addWidget( l, 2, 0 ); | 585 | gl->addWidget( l, 2, 0 ); |
585 | txtLastName = new QLineEdit( dlgName ); | 586 | txtLastName = new QLineEdit( dlgName ); |
586 | gl->addWidget( txtLastName, 2, 1 ); | 587 | gl->addWidget( txtLastName, 2, 1 ); |
587 | 588 | ||
588 | l = new QLabel( tr("Suffix"), dlgName ); | 589 | l = new QLabel( tr("Suffix"), dlgName ); |
589 | gl->addWidget( l, 3, 0 ); | 590 | gl->addWidget( l, 3, 0 ); |
590 | txtSuffix = new QLineEdit( dlgName ); | 591 | txtSuffix = new QLineEdit( dlgName ); |
591 | gl->addWidget( txtSuffix, 3, 1 ); | 592 | gl->addWidget( txtSuffix, 3, 1 ); |
592 | space = new QSpacerItem(1,1, | 593 | space = new QSpacerItem(1,1, |
593 | QSizePolicy::Maximum, | 594 | QSizePolicy::Maximum, |
594 | QSizePolicy::MinimumExpanding ); | 595 | QSizePolicy::MinimumExpanding ); |
595 | gl->addItem( space, 4, 0 ); | 596 | gl->addItem( space, 4, 0 ); |
596 | 597 | ||
597 | cmbChooserField1->insertStringList( trlChooserNames ); | 598 | cmbChooserField1->insertStringList( trlChooserNames ); |
598 | cmbChooserField2->insertStringList( trlChooserNames ); | 599 | cmbChooserField2->insertStringList( trlChooserNames ); |
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() { |
854 | 991 | ||
855 | if ( isEmpty() ) { | 992 | if ( isEmpty() ) { |
856 | cleanupFields(); | 993 | cleanupFields(); |
857 | reject(); | 994 | reject(); |
858 | } else { | 995 | } else { |
859 | saveEntry(); | 996 | saveEntry(); |
860 | cleanupFields(); | 997 | cleanupFields(); |
861 | QDialog::accept(); | 998 | QDialog::accept(); |
862 | } | 999 | } |
863 | 1000 | ||
864 | } | 1001 | } |
865 | 1002 | ||
866 | void ContactEditor::slotNote() { | 1003 | void ContactEditor::slotNote() { |
867 | 1004 | ||
868 | dlgNote->showMaximized(); | 1005 | dlgNote->showMaximized(); |
869 | if ( !dlgNote->exec() ) { | 1006 | if ( !dlgNote->exec() ) { |
870 | txtNote->setText( ent.notes() ); | 1007 | txtNote->setText( ent.notes() ); |
871 | } | 1008 | } |
872 | } | 1009 | } |
873 | 1010 | ||
874 | void ContactEditor::slotName() { | 1011 | void ContactEditor::slotName() { |
875 | 1012 | ||
876 | QString tmpName; | 1013 | QString tmpName; |
877 | if (useFullName) { | 1014 | if (useFullName) { |
878 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1015 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
879 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1016 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
880 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1017 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
881 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1018 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
882 | } | 1019 | } |
883 | dlgName->showMaximized(); | 1020 | dlgName->showMaximized(); |
884 | if ( dlgName->exec() ) { | 1021 | if ( dlgName->exec() ) { |
885 | 1022 | ||
886 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); | 1023 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); |
887 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1024 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
888 | slotFullNameChange( txtFullName->text() ); | 1025 | slotFullNameChange( txtFullName->text() ); |
889 | useFullName = false; | 1026 | useFullName = false; |
890 | } | 1027 | } |
891 | 1028 | ||
892 | } | 1029 | } |
893 | 1030 | ||
894 | void ContactEditor::setNameFocus() { | 1031 | void ContactEditor::setNameFocus() { |
895 | 1032 | ||
896 | txtFullName->setFocus(); | 1033 | txtFullName->setFocus(); |
897 | 1034 | ||
898 | } | 1035 | } |
899 | 1036 | ||
900 | bool ContactEditor::isEmpty() { | 1037 | bool ContactEditor::isEmpty() { |
901 | // Test and see if the record should be saved. | 1038 | // Test and see if the record should be saved. |
@@ -1355,200 +1492,203 @@ void ContactEditor::saveEntry() { | |||
1355 | useFullName = false; | 1492 | useFullName = false; |
1356 | } | 1493 | } |
1357 | 1494 | ||
1358 | ent.setFirstName( txtFirstName->text() ); | 1495 | ent.setFirstName( txtFirstName->text() ); |
1359 | ent.setLastName( txtLastName->text() ); | 1496 | ent.setLastName( txtLastName->text() ); |
1360 | ent.setMiddleName( txtMiddleName->text() ); | 1497 | ent.setMiddleName( txtMiddleName->text() ); |
1361 | ent.setSuffix( txtSuffix->text() ); | 1498 | ent.setSuffix( txtSuffix->text() ); |
1362 | 1499 | ||
1363 | ent.setFileAs( cmbFileAs->currentText() ); | 1500 | ent.setFileAs( cmbFileAs->currentText() ); |
1364 | 1501 | ||
1365 | ent.setCategories( cmbCat->currentCategories() ); | 1502 | ent.setCategories( cmbCat->currentCategories() ); |
1366 | 1503 | ||
1367 | 1504 | ||
1368 | //if (hasTitle) | 1505 | //if (hasTitle) |
1369 | ent.setJobTitle( txtJobTitle->text() ); | 1506 | ent.setJobTitle( txtJobTitle->text() ); |
1370 | 1507 | ||
1371 | //if (hasCompany) | 1508 | //if (hasCompany) |
1372 | ent.setCompany( txtOrganization->text() ); | 1509 | ent.setCompany( txtOrganization->text() ); |
1373 | 1510 | ||
1374 | //if (hasNotes) | 1511 | //if (hasNotes) |
1375 | ent.setNotes( txtNote->text() ); | 1512 | ent.setNotes( txtNote->text() ); |
1376 | 1513 | ||
1377 | //if (hasStreet) { | 1514 | //if (hasStreet) { |
1378 | ent.setHomeStreet( slHomeAddress[0] ); | 1515 | ent.setHomeStreet( slHomeAddress[0] ); |
1379 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1516 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1380 | //} | 1517 | //} |
1381 | 1518 | ||
1382 | //if (hasCity) { | 1519 | //if (hasCity) { |
1383 | ent.setHomeCity( slHomeAddress[3] ); | 1520 | ent.setHomeCity( slHomeAddress[3] ); |
1384 | ent.setBusinessCity( slBusinessAddress[3] ); | 1521 | ent.setBusinessCity( slBusinessAddress[3] ); |
1385 | //} | 1522 | //} |
1386 | 1523 | ||
1387 | //if (hasState) { | 1524 | //if (hasState) { |
1388 | ent.setHomeState( slHomeAddress[4] ); | 1525 | ent.setHomeState( slHomeAddress[4] ); |
1389 | ent.setBusinessState( slBusinessAddress[4] ); | 1526 | ent.setBusinessState( slBusinessAddress[4] ); |
1390 | //} | 1527 | //} |
1391 | 1528 | ||
1392 | //if (hasZip) { | 1529 | //if (hasZip) { |
1393 | ent.setHomeZip( slHomeAddress[5] ); | 1530 | ent.setHomeZip( slHomeAddress[5] ); |
1394 | ent.setBusinessZip( slBusinessAddress[5] ); | 1531 | ent.setBusinessZip( slBusinessAddress[5] ); |
1395 | //} | 1532 | //} |
1396 | 1533 | ||
1397 | //if (hasCountry) { | 1534 | //if (hasCountry) { |
1398 | ent.setHomeCountry( slHomeAddress[6] ); | 1535 | ent.setHomeCountry( slHomeAddress[6] ); |
1399 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1536 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1400 | //} | 1537 | //} |
1401 | 1538 | ||
1402 | QStringList::ConstIterator it; | 1539 | QStringList::ConstIterator it; |
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(" "); |
1507 | start = where; | 1647 | start = where; |
1508 | where = txt.find( ',', where + 1 ); | 1648 | where = txt.find( ',', where + 1 ); |
1509 | if ( where > - 1 ) | 1649 | if ( where > - 1 ) |
1510 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1650 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1511 | else // grab until the end... | 1651 | else // grab until the end... |
1512 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1652 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1513 | } | 1653 | } |
1514 | } | 1654 | } |
1515 | } | 1655 | } |
1516 | 1656 | ||
1517 | void parseEmailTo( const QString &strDefaultEmail, | 1657 | void parseEmailTo( const QString &strDefaultEmail, |
1518 | const QString &strOtherEmail, QString &strBack ) | 1658 | const QString &strOtherEmail, QString &strBack ) |
1519 | { | 1659 | { |
1520 | // create a comma dilimeted set of emails... | 1660 | // create a comma dilimeted set of emails... |
1521 | // use the power of short circuiting... | 1661 | // use the power of short circuiting... |
1522 | bool foundDefault = false; | 1662 | bool foundDefault = false; |
1523 | QString strTmp; | 1663 | QString strTmp; |
1524 | int start = 0; | 1664 | int start = 0; |
1525 | int where; | 1665 | int where; |
1526 | // start at the beginng. | 1666 | // start at the beginng. |
1527 | strBack = strDefaultEmail; | 1667 | strBack = strDefaultEmail; |
1528 | where = 0; | 1668 | where = 0; |
1529 | while ( where > -1 ) { | 1669 | while ( where > -1 ) { |
1530 | start = where; | 1670 | start = where; |
1531 | where = strOtherEmail.find( ' ', where + 1 ); | 1671 | where = strOtherEmail.find( ' ', where + 1 ); |
1532 | if ( where > 0 ) { | 1672 | if ( where > 0 ) { |
1533 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1673 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1534 | } else | 1674 | } else |
1535 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 1675 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
1536 | if ( foundDefault || strTmp != strDefaultEmail ) { | 1676 | if ( foundDefault || strTmp != strDefaultEmail ) { |
1537 | strBack.append( ", " ); | 1677 | strBack.append( ", " ); |
1538 | strBack.append( strTmp ); | 1678 | strBack.append( strTmp ); |
1539 | } else | 1679 | } else |
1540 | foundDefault = true; | 1680 | foundDefault = true; |
1541 | } | 1681 | } |
1542 | } | 1682 | } |
1543 | 1683 | ||
1544 | 1684 | ||
1545 | static inline bool containsAlphaNum( const QString &str ) | 1685 | static inline bool containsAlphaNum( const QString &str ) |
1546 | { | 1686 | { |
1547 | int i, | 1687 | int i, |
1548 | count = str.length(); | 1688 | count = str.length(); |
1549 | for ( i = 0; i < count; i++ ) | 1689 | for ( i = 0; i < count; i++ ) |
1550 | if ( !str[i].isSpace() ) | 1690 | if ( !str[i].isSpace() ) |
1551 | return TRUE; | 1691 | return TRUE; |
1552 | return FALSE; | 1692 | return FALSE; |
1553 | } | 1693 | } |
1554 | 1694 | ||
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 | |||
@@ -1,179 +1,181 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * | 3 | * |
4 | * This file is an add-on for the OPIE Palmtop Environment | 4 | * This file is an add-on for the OPIE Palmtop Environment |
5 | * | 5 | * |
6 | * This file may be distributed and/or modified under the terms of the | 6 | * This file may be distributed and/or modified under the terms of the |
7 | * GNU General Public License version 2 as published by the Free Software | 7 | * GNU General Public License version 2 as published by the Free Software |
8 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging | 8 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
9 | * of this file. | 9 | * of this file. |
10 | * | 10 | * |
11 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | * | 13 | * |
14 | * | 14 | * |
15 | * This is a rewrite of the abeditor.h file, modified to provide a more | 15 | * This is a rewrite of the abeditor.h file, modified to provide a more |
16 | * intuitive interface to TrollTech's original Address Book editor. This | 16 | * intuitive interface to TrollTech's original Address Book editor. This |
17 | * is made to operate exactly in interface with the exception of name. | 17 | * is made to operate exactly in interface with the exception of name. |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef CONTACTEDITOR_H | 21 | #ifndef CONTACTEDITOR_H |
22 | #define CONTACTEDITOR_H | 22 | #define CONTACTEDITOR_H |
23 | 23 | ||
24 | #include <opie/ocontact.h> | 24 | #include <opie/ocontact.h> |
25 | 25 | ||
26 | #include <qpe/datebookmonth.h> | 26 | #include <qpe/datebookmonth.h> |
27 | 27 | ||
28 | #include <qdialog.h> | 28 | #include <qdialog.h> |
29 | #include <qlist.h> | 29 | #include <qlist.h> |
30 | #include <qmap.h> | 30 | #include <qmap.h> |
31 | #include <qstringlist.h> | 31 | #include <qstringlist.h> |
32 | 32 | ||
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; |
157 | QComboBox *cmbFileAs; | 159 | QComboBox *cmbFileAs; |
158 | CategorySelect *cmbCat; | 160 | CategorySelect *cmbCat; |
159 | QLabel *labCat; | 161 | QLabel *labCat; |
160 | 162 | ||
161 | QScrollView *svAddress; | 163 | QScrollView *svAddress; |
162 | QLineEdit *txtAddress; | 164 | QLineEdit *txtAddress; |
163 | //QLineEdit *txtAddress2; | 165 | //QLineEdit *txtAddress2; |
164 | //QLineEdit *txtPOBox; | 166 | //QLineEdit *txtPOBox; |
165 | QLineEdit *txtCity; | 167 | QLineEdit *txtCity; |
166 | QLineEdit *txtState; | 168 | QLineEdit *txtState; |
167 | QLineEdit *txtZip; | 169 | QLineEdit *txtZip; |
168 | QComboBox *cmbAddress; | 170 | QComboBox *cmbAddress; |
169 | QComboBox *cmbCountry; | 171 | QComboBox *cmbCountry; |
170 | 172 | ||
171 | QScrollView *svDetails; | 173 | QScrollView *svDetails; |
172 | QComboBox *cmbGender; | 174 | QComboBox *cmbGender; |
173 | DateBookMonth* birthdayPicker; | 175 | DateBookMonth* birthdayPicker; |
174 | QToolButton* birthdayButton; | 176 | QToolButton* birthdayButton; |
175 | DateBookMonth* anniversaryPicker; | 177 | DateBookMonth* anniversaryPicker; |
176 | QToolButton* anniversaryButton; | 178 | QToolButton* anniversaryButton; |
177 | }; | 179 | }; |
178 | 180 | ||
179 | #endif | 181 | #endif |