-rw-r--r-- | core/pim/addressbook/TODO | 2 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 803 | ||||
-rw-r--r-- | core/pim/addressbook/version.h | 4 |
3 files changed, 363 insertions, 446 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index a0d50a3..106747e 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO | |||
@@ -1,116 +1,116 @@ | |||
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 in case it's installed and there's no mobile | 9 | - dial with dtmfdial in case 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 | - Beaming of multiple contacts (current list/ by search or by category) | 13 | - Beaming of multiple contacts (current list/ by search or by category) |
14 | - Configure the letter-picker: lastname/fullname search | 14 | - Configure the letter-picker: lastname/fullname search |
15 | - User center of the joypad to switch back from card to listview ! | 15 | - User center of the joypad to switch back from card to listview ! |
16 | - Cursor-UP/Down: Should additionally scroll cardview if it is too large | 16 | - Cursor-UP/Down: Should additionally scroll cardview if it is too large |
17 | (behaviour should be selectable by configuration) | 17 | (behaviour should be selectable by configuration) |
18 | 18 | ||
19 | Known Bugs: | 19 | Known Bugs: |
20 | ----------- | 20 | ----------- |
21 | 21 | ||
22 | Bugs but not in addressbook: | 22 | Bugs but not in addressbook: |
23 | ----------------------------- | 23 | ----------------------------- |
24 | - VCARD: If umlaut (äöüß) in address, the parser gets confused.. | 24 | - VCARD: If umlaut (äöüß) in address, the parser gets confused.. |
25 | 25 | ||
26 | 26 | ||
27 | Urgent: | 27 | Urgent: |
28 | -------- | 28 | -------- |
29 | - Category is on the wrong position after changing to personal and back to normal | 29 | - Category is on the wrong position after changing to personal and back to normal |
30 | ( Temporarily workaround: Category is never deactivated.. :S ) | 30 | ( Temporarily workaround: Category is never deactivated.. :S ) |
31 | 31 | ||
32 | - Fix handling of 3 Firstnames | ||
33 | 32 | ||
34 | Important: | 33 | Important: |
35 | ---------- | 34 | ---------- |
36 | 35 | ||
37 | - "What's this" should be added (Deleyed after Feature Freeze) | 36 | - "What's this" should be added (Deleyed after Feature Freeze) |
38 | 37 | ||
39 | Less important: | 38 | Less important: |
40 | --------------- | 39 | --------------- |
41 | - Reload if contacts were changed externally | 40 | - Reload if contacts were changed externally |
42 | - The picker (alphabetical sort widget) should be | 41 | - The picker (alphabetical sort widget) should be |
43 | placed verticaly or horizontally (configurable) | 42 | placed verticaly or horizontally (configurable) |
44 | - Find a smart solution for activating/deactivating the "send email" event | 43 | - Find a smart solution for activating/deactivating the "send email" event |
45 | - If new contact is added (contacteditor closed): focus (table, card) to | 44 | - If new contact is added (contacteditor closed): focus (table, card) to |
46 | this entry ! | 45 | this entry ! |
47 | - After search (Started with Return): KeyFocus should be on Tabelle | 46 | - After search (Started with Return): KeyFocus should be on Tabelle |
48 | 47 | ||
49 | ContactEditor: | 48 | ContactEditor: |
50 | - Redesign of Contacteditor | 49 | - Redesign of Contacteditor |
51 | 50 | ||
52 | Should be Fixed (not absolute sure, need further validation): | 51 | Should be Fixed (not absolute sure, need further validation): |
53 | ------------------------------------------------------------- | 52 | ------------------------------------------------------------- |
54 | 53 | ||
55 | 54 | ||
56 | Fixed/Ready: | 55 | Fixed/Ready: |
57 | ------- | 56 | ------- |
58 | - Syncing: abtable not reloaded after sync. | 57 | - Syncing: abtable not reloaded after sync. |
59 | - Find widget should be replaced by something like | 58 | - Find widget should be replaced by something like |
60 | qpdf has. | 59 | qpdf has. |
61 | - Adding a configuration dialog | 60 | - Adding a configuration dialog |
62 | - Picker: Activated letter schould be more visible | 61 | - Picker: Activated letter schould be more visible |
63 | - Advanced handling of cursor keys (search..) | 62 | - Advanced handling of cursor keys (search..) |
64 | - Mail-Icon is missing | 63 | - Mail-Icon is missing |
65 | - Use opie-mail insted of qt-mail if possible. | 64 | - Use opie-mail insted of qt-mail if possible. |
66 | - Font menu is invisible using german translation | 65 | - Font menu is invisible using german translation |
67 | - Personal contact editor: Disable categories | 66 | - Personal contact editor: Disable categories |
68 | - "Nonenglish" translation bug has to be fixed. | 67 | - "Nonenglish" translation bug has to be fixed. |
69 | - contacteditor: Birthday, annyversary, ... : Use Dateselector | 68 | - contacteditor: Birthday, annyversary, ... : Use Dateselector |
70 | - The names of the countries are sorted by there english names, only.. | 69 | - The names of the countries are sorted by there english names, only.. |
71 | Even if they are translated.. :S | 70 | Even if they are translated.. :S |
72 | - Cursor keys should work in detail-view (ablabel) | 71 | - Cursor keys should work in detail-view (ablabel) |
73 | -> Ablabel should be removed and Abtable should be increased with | 72 | -> Ablabel should be removed and Abtable should be increased with |
74 | different views (as started by darwin zins).. | 73 | different views (as started by darwin zins).. |
75 | - Use advanced database functions in abtable to decrease | 74 | - Use advanced database functions in abtable to decrease |
76 | memory footprint and to make everything more easy ! | 75 | memory footprint and to make everything more easy ! |
77 | (abtable should store Iterator for selected Category) | 76 | (abtable should store Iterator for selected Category) |
78 | - Abtable: Configure Contact column (internally already available, | 77 | - Abtable: Configure Contact column (internally already available, |
79 | need configuration) | 78 | need configuration) |
80 | - Select of primary contact (see #274 on mantis) | 79 | - Select of primary contact (see #274 on mantis) |
81 | - Category-select does not work completely: "Unfiled" is always in listview .. | 80 | - Category-select does not work completely: "Unfiled" is always in listview .. |
82 | - Return from Contacteditor: Category resettet to all | 81 | - Return from Contacteditor: Category resettet to all |
83 | - Personal Details not working | 82 | - Personal Details not working |
84 | - If category changed, the letterpicker should be resetted | 83 | - If category changed, the letterpicker should be resetted |
85 | - There should be some icons for List and Cardview | 84 | - There should be some icons for List and Cardview |
86 | - If in Cardview and a category change removes all entries: | 85 | - If in Cardview and a category change removes all entries: |
87 | There are already entries in Cardview after up/down | 86 | There are already entries in Cardview after up/down |
88 | - Personal Details: Anniversary zeigt Fantasie-Werte | 87 | - Personal Details: Anniversary zeigt Fantasie-Werte |
89 | - Unfiled shown just in Category "All" and "Unfiled". | 88 | - Unfiled shown just in Category "All" and "Unfiled". |
90 | - After finising search and after Edit: Clear Picker | 89 | - After finising search and after Edit: Clear Picker |
91 | - After Edit: Table position back to edited entry. | 90 | - After Edit: Table position back to edited entry. |
92 | - Optimize Table Update... | 91 | - Optimize Table Update... |
93 | - Change MyDialog to Config | 92 | - Change MyDialog to Config |
94 | - Store position and state of toolbar | 93 | - Store position and state of toolbar |
95 | - Searchwidget closed: Selected user is jumping | 94 | - Searchwidget closed: Selected user is jumping |
96 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) | 95 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) |
97 | zu lange.. | 96 | zu lange.. |
98 | - VCARD: Import of Anniversary does not work correctly (currently disabled) | 97 | - VCARD: Import of Anniversary does not work correctly (currently disabled) |
99 | - Name order selected in "contacteditor" not used in list view. | 98 | - Name order selected in "contacteditor" not used in list view. |
100 | - OK-Key does not switch from Detailview (ablable) to Listview | 99 | - OK-Key does not switch from Detailview (ablable) to Listview |
101 | - Receiving of beams should open a dialog | 100 | - Receiving of beams should open a dialog |
102 | - Fix start of opie-mail | 101 | - Fix start of opie-mail |
103 | - Implement Button Pics | 102 | - Implement Button Pics |
104 | - Add a dialog to accept and optionally edit received contacts by IRDA. | 103 | - Add a dialog to accept and optionally edit received contacts by IRDA. |
105 | - Language not English (tested with german opie-translation): | 104 | - Language not English (tested with german opie-translation): |
106 | 1. Configure nicht übersetzt (alles leer). | 105 | 1. Configure nicht übersetzt (alles leer). |
107 | 2. Contacteditor nur teilweise übersetzt. | 106 | 2. Contacteditor nur teilweise übersetzt. |
108 | 3. Kategorie-Picker geht nicht. | 107 | 3. Kategorie-Picker geht nicht. |
109 | - Plugin for Today for Birthdays and Anniversaries | 108 | - Plugin for Today for Birthdays and Anniversaries |
110 | - Implement a picker/combo for the default email. | 109 | - Implement a picker/combo for the default email. |
111 | - Overview window cleanup needed.. | 110 | - Overview window cleanup needed.. |
112 | - Store last settings of combo-boxes | 111 | - Store last settings of combo-boxes |
113 | - Personal and Business Web-page is not editable | 112 | - Personal and Business Web-page is not editable |
114 | - Default Email-button: A lot of problems: | 113 | - Default Email-button: A lot of problems: |
115 | If on second tab: The combo chooser is on the top left of the screen ! :( | 114 | If on second tab: The combo chooser is on the top left of the screen ! :( |
116 | - Default Email-Button: Sometimes not hiding the textfields completely | 115 | - Default Email-Button: Sometimes not hiding the textfields completely |
116 | - Fix handling of 3 Firstnames | ||
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index d1338f6..7bc5bde 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -64,247 +64,252 @@ void parseEmailTo( const QString &strDefaultEmail, | |||
64 | 64 | ||
65 | ContactEditor::ContactEditor(const OContact &entry, | 65 | ContactEditor::ContactEditor(const OContact &entry, |
66 | QWidget *parent, | 66 | QWidget *parent, |
67 | const char *name, | 67 | const char *name, |
68 | WFlags fl ) | 68 | WFlags fl ) |
69 | : QDialog( parent, name, TRUE, fl ), | 69 | : QDialog( parent, name, TRUE, fl ), |
70 | defaultEmailChooserPosition( -1 ), | 70 | defaultEmailChooserPosition( -1 ), |
71 | m_personalView ( false ), | 71 | m_personalView ( false ), |
72 | cmbDefaultEmail( 0 ), | 72 | cmbDefaultEmail( 0 ), |
73 | initializing ( false ) | 73 | initializing ( false ) |
74 | { | 74 | { |
75 | 75 | ||
76 | initializing = true; | 76 | initializing = true; |
77 | 77 | ||
78 | init(); | 78 | init(); |
79 | setEntry( entry ); | 79 | setEntry( entry ); |
80 | // cmbDefaultEmail = 0; | 80 | // cmbDefaultEmail = 0; |
81 | // defaultEmailChooserPosition = -1; | 81 | // defaultEmailChooserPosition = -1; |
82 | 82 | ||
83 | initializing = false; | 83 | initializing = false; |
84 | } | 84 | } |
85 | 85 | ||
86 | ContactEditor::~ContactEditor() { | 86 | ContactEditor::~ContactEditor() { |
87 | } | 87 | } |
88 | 88 | ||
89 | void ContactEditor::init() { | 89 | void ContactEditor::init() { |
90 | qWarning("init() START"); | 90 | qWarning("init() START"); |
91 | 91 | ||
92 | useFullName = true; | 92 | useFullName = true; |
93 | 93 | ||
94 | uint i = 0; | 94 | uint i = 0; |
95 | 95 | ||
96 | QStringList trlChooserNames; | 96 | QStringList trlChooserNames; |
97 | 97 | ||
98 | for (i = 0; i <= 6; i++) { | 98 | for (i = 0; i <= 6; i++) { |
99 | slHomeAddress.append( "" ); | 99 | slHomeAddress.append( "" ); |
100 | slBusinessAddress.append( "" ); | 100 | slBusinessAddress.append( "" ); |
101 | } | 101 | } |
102 | 102 | ||
103 | trlChooserNames = OContactFields::trphonefields( false ); | 103 | trlChooserNames = OContactFields::trphonefields( false ); |
104 | slChooserNames = OContactFields::untrphonefields( false ); | 104 | slChooserNames = OContactFields::untrphonefields( false ); |
105 | slDynamicEntries = OContactFields::untrdetailsfields( false ); | 105 | slDynamicEntries = OContactFields::untrdetailsfields( false ); |
106 | trlDynamicEntries = OContactFields::trdetailsfields( false ); | 106 | trlDynamicEntries = OContactFields::trdetailsfields( false ); |
107 | 107 | ||
108 | // Ok, we have to remove elements from the list of dynamic entries | 108 | // Ok, we have to remove elements from the list of dynamic entries |
109 | // which are now stored in special (not dynamic) widgets.. | 109 | // which are now stored in special (not dynamic) widgets.. |
110 | // Otherwise we will get problems with field assignments! (se) | 110 | // Otherwise we will get problems with field assignments! (se) |
111 | slDynamicEntries.remove("Anniversary"); | 111 | slDynamicEntries.remove("Anniversary"); |
112 | slDynamicEntries.remove("Birthday"); | 112 | slDynamicEntries.remove("Birthday"); |
113 | slDynamicEntries.remove("Gender"); | 113 | slDynamicEntries.remove("Gender"); |
114 | 114 | ||
115 | // The same with translated fields.. But I will | 115 | // The same with translated fields.. But I will |
116 | // use the translation map to avoid mismatches.. | 116 | // use the translation map to avoid mismatches.. |
117 | QMap<int, QString> translMap = OContactFields::idToTrFields(); | 117 | QMap<int, QString> translMap = OContactFields::idToTrFields(); |
118 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); | 118 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); |
119 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); | 119 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); |
120 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); | 120 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); |
121 | 121 | ||
122 | // Last Check to be sure.. | 122 | // Last Check to be sure.. |
123 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); | 123 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); |
124 | assert( slChooserNames.count() == trlChooserNames.count() ); | 124 | assert( slChooserNames.count() == trlChooserNames.count() ); |
125 | 125 | ||
126 | for (i = 0; i < slChooserNames.count(); i++) | 126 | for (i = 0; i < slChooserNames.count(); i++) |
127 | slChooserValues.append(""); | 127 | slChooserValues.append(""); |
128 | 128 | ||
129 | 129 | ||
130 | QVBoxLayout *vb = new QVBoxLayout( this ); | 130 | QVBoxLayout *vb = new QVBoxLayout( this ); |
131 | 131 | ||
132 | tabMain = new QTabWidget( this ); | 132 | tabMain = new QTabWidget( this ); |
133 | vb->addWidget( tabMain ); | 133 | vb->addWidget( tabMain ); |
134 | 134 | ||
135 | QWidget *tabViewport = new QWidget ( tabMain ); | 135 | QWidget *tabViewport = new QWidget ( tabMain ); |
136 | 136 | ||
137 | vb = new QVBoxLayout( tabViewport ); | 137 | vb = new QVBoxLayout( tabViewport ); |
138 | 138 | ||
139 | svGeneral = new QScrollView( tabViewport ); | 139 | svGeneral = new QScrollView( tabViewport ); |
140 | vb->addWidget( svGeneral, 0, 0 ); | 140 | vb->addWidget( svGeneral, 0, 0 ); |
141 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 141 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
142 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 142 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
143 | 143 | ||
144 | QWidget *container = new QWidget( svGeneral->viewport() ); | 144 | QWidget *container = new QWidget( svGeneral->viewport() ); |
145 | svGeneral->addChild( container ); | 145 | svGeneral->addChild( container ); |
146 | 146 | ||
147 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 147 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); |
148 | gl->setResizeMode( QLayout::FreeResize ); | 148 | gl->setResizeMode( QLayout::FreeResize ); |
149 | 149 | ||
150 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 150 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
151 | gl->addWidget( btnFullName, 0, 0 ); | 151 | gl->addWidget( btnFullName, 0, 0 ); |
152 | txtFullName = new QLineEdit( container ); | 152 | txtFullName = new QLineEdit( container ); |
153 | gl->addWidget( txtFullName, 0, 1 ); | 153 | gl->addWidget( txtFullName, 0, 1 ); |
154 | 154 | ||
155 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 155 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
156 | gl->addWidget( l, 1, 0 ); | 156 | gl->addWidget( l, 1, 0 ); |
157 | txtJobTitle = new QLineEdit( container ); | 157 | txtJobTitle = new QLineEdit( container ); |
158 | gl->addWidget( txtJobTitle, 1, 1 ); | 158 | gl->addWidget( txtJobTitle, 1, 1 ); |
159 | 159 | ||
160 | l = new QLabel( tr( "Organization" ), container ); | 160 | l = new QLabel( tr("Suffix"), container ); |
161 | gl->addWidget( l, 2, 0 ); | 161 | gl->addWidget( l, 2, 0 ); |
162 | txtSuffix = new QLineEdit( container ); | ||
163 | gl->addWidget( txtSuffix, 2, 1 ); | ||
164 | |||
165 | l = new QLabel( tr( "Organization" ), container ); | ||
166 | gl->addWidget( l, 3, 0 ); | ||
162 | txtOrganization = new QLineEdit( container ); | 167 | txtOrganization = new QLineEdit( container ); |
163 | gl->addWidget( txtOrganization, 2, 1 ); | 168 | gl->addWidget( txtOrganization, 3, 1 ); |
164 | 169 | ||
165 | // Chooser 1 | 170 | // Chooser 1 |
166 | cmbChooserField1 = new QComboBox( FALSE, container ); | 171 | cmbChooserField1 = new QComboBox( FALSE, container ); |
167 | cmbChooserField1->setMaximumWidth( 90 ); | 172 | cmbChooserField1->setMaximumWidth( 90 ); |
168 | gl->addWidget( cmbChooserField1, 3, 0 ); | 173 | gl->addWidget( cmbChooserField1, 4, 0 ); |
169 | // Textfield for chooser 1. | 174 | // Textfield for chooser 1. |
170 | // Now use Widgetstack to contain the textfield and the default-email combo ! | 175 | // Now use Widgetstack to contain the textfield and the default-email combo ! |
171 | m_widgetStack1 = new QWidgetStack( container ); | 176 | m_widgetStack1 = new QWidgetStack( container ); |
172 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); | 177 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); |
173 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); | 178 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); |
174 | gl->addWidget( m_widgetStack1, 3, 1 ); | 179 | gl->addWidget( m_widgetStack1, 4, 1 ); |
175 | m_widgetStack1 -> raiseWidget( TextField ); | 180 | m_widgetStack1 -> raiseWidget( TextField ); |
176 | 181 | ||
177 | // Chooser 2 | 182 | // Chooser 2 |
178 | cmbChooserField2 = new QComboBox( FALSE, container ); | 183 | cmbChooserField2 = new QComboBox( FALSE, container ); |
179 | cmbChooserField2->setMaximumWidth( 90 ); | 184 | cmbChooserField2->setMaximumWidth( 90 ); |
180 | gl->addWidget( cmbChooserField2, 4, 0 ); | 185 | gl->addWidget( cmbChooserField2, 5, 0 ); |
181 | // Textfield for chooser 2 | 186 | // Textfield for chooser 2 |
182 | // Now use WidgetStack to contain the textfield and the default-email combo! | 187 | // Now use WidgetStack to contain the textfield and the default-email combo! |
183 | m_widgetStack2 = new QWidgetStack( container ); | 188 | m_widgetStack2 = new QWidgetStack( container ); |
184 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); | 189 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); |
185 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); | 190 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); |
186 | gl->addWidget( m_widgetStack2, 4, 1 ); | 191 | gl->addWidget( m_widgetStack2, 5, 1 ); |
187 | m_widgetStack2 -> raiseWidget( TextField ); | 192 | m_widgetStack2 -> raiseWidget( TextField ); |
188 | 193 | ||
189 | // Chooser 3 | 194 | // Chooser 3 |
190 | cmbChooserField3 = new QComboBox( FALSE, container ); | 195 | cmbChooserField3 = new QComboBox( FALSE, container ); |
191 | cmbChooserField3->setMaximumWidth( 90 ); | 196 | cmbChooserField3->setMaximumWidth( 90 ); |
192 | gl->addWidget( cmbChooserField3, 5, 0 ); | 197 | gl->addWidget( cmbChooserField3, 6, 0 ); |
193 | // Textfield for chooser 2 | 198 | // Textfield for chooser 2 |
194 | // Now use WidgetStack to contain the textfield and the default-email combo! | 199 | // Now use WidgetStack to contain the textfield and the default-email combo! |
195 | m_widgetStack3 = new QWidgetStack( container ); | 200 | m_widgetStack3 = new QWidgetStack( container ); |
196 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); | 201 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); |
197 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); | 202 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); |
198 | gl->addWidget( m_widgetStack3, 5, 1 ); | 203 | gl->addWidget( m_widgetStack3, 6, 1 ); |
199 | m_widgetStack3 -> raiseWidget( TextField ); | 204 | m_widgetStack3 -> raiseWidget( TextField ); |
200 | 205 | ||
201 | l = new QLabel( tr( "File As" ), container ); | 206 | l = new QLabel( tr( "File As" ), container ); |
202 | gl->addWidget( l, 6, 0 ); | 207 | gl->addWidget( l, 7, 0 ); |
203 | cmbFileAs = new QComboBox( TRUE, container ); | 208 | cmbFileAs = new QComboBox( TRUE, container ); |
204 | gl->addWidget( cmbFileAs, 6, 1 ); | 209 | gl->addWidget( cmbFileAs, 7, 1 ); |
205 | 210 | ||
206 | labCat = new QLabel( tr( "Category" ), container ); | 211 | labCat = new QLabel( tr( "Category" ), container ); |
207 | gl->addWidget( labCat, 7, 0 ); | 212 | gl->addWidget( labCat, 8, 0 ); |
208 | cmbCat = new CategorySelect( container ); | 213 | cmbCat = new CategorySelect( container ); |
209 | gl->addWidget( cmbCat, 7, 1 ); | 214 | gl->addWidget( cmbCat, 8, 1 ); |
210 | labCat->show(); | 215 | labCat->show(); |
211 | cmbCat->show(); | 216 | cmbCat->show(); |
212 | 217 | ||
213 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 218 | btnNote = new QPushButton( tr( "Notes..." ), container ); |
214 | gl->addWidget( btnNote, 8, 1 ); | 219 | gl->addWidget( btnNote, 9, 1 ); |
215 | 220 | ||
216 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 221 | tabMain->insertTab( tabViewport, tr( "General" ) ); |
217 | 222 | ||
218 | tabViewport = new QWidget ( tabMain ); | 223 | tabViewport = new QWidget ( tabMain ); |
219 | 224 | ||
220 | vb = new QVBoxLayout( tabViewport ); | 225 | vb = new QVBoxLayout( tabViewport ); |
221 | 226 | ||
222 | svAddress = new QScrollView( tabViewport ); | 227 | svAddress = new QScrollView( tabViewport ); |
223 | vb->addWidget( svAddress, 0, 0 ); | 228 | vb->addWidget( svAddress, 0, 0 ); |
224 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 229 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
225 | svAddress->setFrameStyle( QFrame::NoFrame ); | 230 | svAddress->setFrameStyle( QFrame::NoFrame ); |
226 | 231 | ||
227 | container = new QWidget( svAddress->viewport() ); | 232 | container = new QWidget( svAddress->viewport() ); |
228 | svAddress->addChild( container ); | 233 | svAddress->addChild( container ); |
229 | 234 | ||
230 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 235 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
231 | 236 | ||
232 | cmbAddress = new QComboBox( FALSE, container ); | 237 | cmbAddress = new QComboBox( FALSE, container ); |
233 | cmbAddress->insertItem( tr( "Business" ) ); | 238 | cmbAddress->insertItem( tr( "Business" ) ); |
234 | cmbAddress->insertItem( tr( "Home" ) ); | 239 | cmbAddress->insertItem( tr( "Home" ) ); |
235 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 240 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
236 | 241 | ||
237 | l = new QLabel( tr( "Address" ), container ); | 242 | l = new QLabel( tr( "Address" ), container ); |
238 | gl->addWidget( l, 1, 0 ); | 243 | gl->addWidget( l, 1, 0 ); |
239 | txtAddress = new QLineEdit( container ); | 244 | txtAddress = new QLineEdit( container ); |
240 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 245 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
241 | 246 | ||
242 | l = new QLabel( tr( "City" ), container ); | 247 | l = new QLabel( tr( "City" ), container ); |
243 | gl->addWidget( l, 2, 0 ); | 248 | gl->addWidget( l, 2, 0 ); |
244 | txtCity = new QLineEdit( container ); | 249 | txtCity = new QLineEdit( container ); |
245 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 250 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
246 | 251 | ||
247 | l = new QLabel( tr( "State" ), container ); | 252 | l = new QLabel( tr( "State" ), container ); |
248 | gl->addWidget( l, 3, 0 ); | 253 | gl->addWidget( l, 3, 0 ); |
249 | txtState = new QLineEdit( container ); | 254 | txtState = new QLineEdit( container ); |
250 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 255 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
251 | 256 | ||
252 | l = new QLabel( tr( "Zip Code" ), container ); | 257 | l = new QLabel( tr( "Zip Code" ), container ); |
253 | gl->addWidget( l, 4, 0 ); | 258 | gl->addWidget( l, 4, 0 ); |
254 | txtZip = new QLineEdit( container ); | 259 | txtZip = new QLineEdit( container ); |
255 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 260 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
256 | 261 | ||
257 | l = new QLabel( tr( "Country" ), container ); | 262 | l = new QLabel( tr( "Country" ), container ); |
258 | gl->addWidget( l, 5, 0 ); | 263 | gl->addWidget( l, 5, 0 ); |
259 | cmbCountry = new QComboBox( TRUE, container ); | 264 | cmbCountry = new QComboBox( TRUE, container ); |
260 | cmbCountry->insertItem( tr( "" ) ); | 265 | cmbCountry->insertItem( tr( "" ) ); |
261 | cmbCountry->insertItem( tr ( "United States" ) ); | 266 | cmbCountry->insertItem( tr ( "United States" ) ); |
262 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 267 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
263 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); | 268 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); |
264 | cmbCountry->insertItem( tr ( "Albania" ) ); | 269 | cmbCountry->insertItem( tr ( "Albania" ) ); |
265 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 270 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
266 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 271 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
267 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 272 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
268 | cmbCountry->insertItem( tr ( "Angola" ) ); | 273 | cmbCountry->insertItem( tr ( "Angola" ) ); |
269 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 274 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
270 | cmbCountry->insertItem( tr ( "Antarctica" ) ); | 275 | cmbCountry->insertItem( tr ( "Antarctica" ) ); |
271 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 276 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
272 | cmbCountry->insertItem( tr ( "Armenia" ) ); | 277 | cmbCountry->insertItem( tr ( "Armenia" ) ); |
273 | cmbCountry->insertItem( tr ( "Aruba" ) ); | 278 | cmbCountry->insertItem( tr ( "Aruba" ) ); |
274 | cmbCountry->insertItem( tr ( "Australia" ) ); | 279 | cmbCountry->insertItem( tr ( "Australia" ) ); |
275 | cmbCountry->insertItem( tr ( "Austria" ) ); | 280 | cmbCountry->insertItem( tr ( "Austria" ) ); |
276 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); | 281 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); |
277 | cmbCountry->insertItem( tr ( "Bahamas" ) ); | 282 | cmbCountry->insertItem( tr ( "Bahamas" ) ); |
278 | cmbCountry->insertItem( tr ( "Bahrain" ) ); | 283 | cmbCountry->insertItem( tr ( "Bahrain" ) ); |
279 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); | 284 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); |
280 | cmbCountry->insertItem( tr ( "Barbados" ) ); | 285 | cmbCountry->insertItem( tr ( "Barbados" ) ); |
281 | cmbCountry->insertItem( tr ( "Belarus" ) ); | 286 | cmbCountry->insertItem( tr ( "Belarus" ) ); |
282 | cmbCountry->insertItem( tr ( "Belgium" ) ); | 287 | cmbCountry->insertItem( tr ( "Belgium" ) ); |
283 | cmbCountry->insertItem( tr ( "Belize" ) ); | 288 | cmbCountry->insertItem( tr ( "Belize" ) ); |
284 | cmbCountry->insertItem( tr ( "Benin" ) ); | 289 | cmbCountry->insertItem( tr ( "Benin" ) ); |
285 | cmbCountry->insertItem( tr ( "Bermuda" ) ); | 290 | cmbCountry->insertItem( tr ( "Bermuda" ) ); |
286 | cmbCountry->insertItem( tr ( "Bhutan" ) ); | 291 | cmbCountry->insertItem( tr ( "Bhutan" ) ); |
287 | cmbCountry->insertItem( tr ( "Bolivia" ) ); | 292 | cmbCountry->insertItem( tr ( "Bolivia" ) ); |
288 | cmbCountry->insertItem( tr ( "Botswana" ) ); | 293 | cmbCountry->insertItem( tr ( "Botswana" ) ); |
289 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); | 294 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); |
290 | cmbCountry->insertItem( tr ( "Brazil" ) ); | 295 | cmbCountry->insertItem( tr ( "Brazil" ) ); |
291 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); | 296 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); |
292 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); | 297 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); |
293 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); | 298 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); |
294 | cmbCountry->insertItem( tr ( "Burundi" ) ); | 299 | cmbCountry->insertItem( tr ( "Burundi" ) ); |
295 | cmbCountry->insertItem( tr ( "Cambodia" ) ); | 300 | cmbCountry->insertItem( tr ( "Cambodia" ) ); |
296 | cmbCountry->insertItem( tr ( "Cameroon" ) ); | 301 | cmbCountry->insertItem( tr ( "Cameroon" ) ); |
297 | cmbCountry->insertItem( tr ( "Canada" ) ); | 302 | cmbCountry->insertItem( tr ( "Canada" ) ); |
298 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); | 303 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); |
299 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); | 304 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); |
300 | cmbCountry->insertItem( tr ( "Chad" ) ); | 305 | cmbCountry->insertItem( tr ( "Chad" ) ); |
301 | cmbCountry->insertItem( tr ( "Chile" ) ); | 306 | cmbCountry->insertItem( tr ( "Chile" ) ); |
302 | cmbCountry->insertItem( tr ( "China" ) ); | 307 | cmbCountry->insertItem( tr ( "China" ) ); |
303 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); | 308 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); |
304 | cmbCountry->insertItem( tr ( "Colombia" ) ); | 309 | cmbCountry->insertItem( tr ( "Colombia" ) ); |
305 | cmbCountry->insertItem( tr ( "Comoros" ) ); | 310 | cmbCountry->insertItem( tr ( "Comoros" ) ); |
306 | cmbCountry->insertItem( tr ( "Congo" ) ); | 311 | cmbCountry->insertItem( tr ( "Congo" ) ); |
307 | cmbCountry->insertItem( tr ( "Cook Island" ) ); | 312 | cmbCountry->insertItem( tr ( "Cook Island" ) ); |
308 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); | 313 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); |
309 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); | 314 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); |
310 | cmbCountry->insertItem( tr ( "Croatia" ) ); | 315 | cmbCountry->insertItem( tr ( "Croatia" ) ); |
@@ -525,196 +530,196 @@ void ContactEditor::init() { | |||
525 | 530 | ||
526 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 531 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
527 | tr( "Delete" ), | 532 | tr( "Delete" ), |
528 | hBox, 0 ); | 533 | hBox, 0 ); |
529 | 534 | ||
530 | gl->addWidget( hBox, counter , 1 ); | 535 | gl->addWidget( hBox, counter , 1 ); |
531 | 536 | ||
532 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), | 537 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), |
533 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); | 538 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); |
534 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | 539 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); |
535 | 540 | ||
536 | ++counter; | 541 | ++counter; |
537 | 542 | ||
538 | // Anniversary | 543 | // Anniversary |
539 | hBox = new QHBox( container ); | 544 | hBox = new QHBox( container ); |
540 | l = new QLabel( tr("Anniversary"), container ); | 545 | l = new QLabel( tr("Anniversary"), container ); |
541 | gl->addWidget( l, counter, 0 ); | 546 | gl->addWidget( l, counter, 0 ); |
542 | 547 | ||
543 | m1 = new QPopupMenu( container ); | 548 | m1 = new QPopupMenu( container ); |
544 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 549 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); |
545 | m1->insertItem( anniversaryPicker ); | 550 | m1->insertItem( anniversaryPicker ); |
546 | 551 | ||
547 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 552 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
548 | anniversaryButton->setPopup( m1 ); | 553 | anniversaryButton->setPopup( m1 ); |
549 | anniversaryButton->setPopupDelay(0); | 554 | anniversaryButton->setPopupDelay(0); |
550 | 555 | ||
551 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 556 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
552 | tr( "Delete" ), | 557 | tr( "Delete" ), |
553 | hBox, 0 ); | 558 | hBox, 0 ); |
554 | gl->addWidget( hBox, counter , 1 ); | 559 | gl->addWidget( hBox, counter , 1 ); |
555 | 560 | ||
556 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), | 561 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), |
557 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); | 562 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); |
558 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); | 563 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); |
559 | 564 | ||
560 | ++counter; | 565 | ++counter; |
561 | 566 | ||
562 | // Gender | 567 | // Gender |
563 | l = new QLabel( tr("Gender"), container ); | 568 | l = new QLabel( tr("Gender"), container ); |
564 | gl->addWidget( l, counter, 0 ); | 569 | gl->addWidget( l, counter, 0 ); |
565 | cmbGender = new QComboBox( container ); | 570 | cmbGender = new QComboBox( container ); |
566 | cmbGender->insertItem( "", 0 ); | 571 | cmbGender->insertItem( "", 0 ); |
567 | cmbGender->insertItem( tr("Male"), 1); | 572 | cmbGender->insertItem( tr("Male"), 1); |
568 | cmbGender->insertItem( tr("Female"), 2); | 573 | cmbGender->insertItem( tr("Female"), 2); |
569 | gl->addWidget( cmbGender, counter, 1 ); | 574 | gl->addWidget( cmbGender, counter, 1 ); |
570 | 575 | ||
571 | ++counter; | 576 | ++counter; |
572 | 577 | ||
573 | // Create Labels and lineedit fields for every dynamic entry | 578 | // Create Labels and lineedit fields for every dynamic entry |
574 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 579 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
575 | QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); | 580 | QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); |
576 | QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); | 581 | QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); |
577 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { | 582 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { |
578 | 583 | ||
579 | if (((*it) == "Anniversary") || | 584 | if (((*it) == "Anniversary") || |
580 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | 585 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; |
581 | 586 | ||
582 | l = new QLabel( mapIdToStr[mapStrToID[*it]].utf8() , container ); | 587 | l = new QLabel( mapIdToStr[mapStrToID[*it]].utf8() , container ); |
583 | listName.append( l ); | 588 | listName.append( l ); |
584 | gl->addWidget( l, i, 0 ); | 589 | gl->addWidget( l, i, 0 ); |
585 | QLineEdit *e = new QLineEdit( container ); | 590 | QLineEdit *e = new QLineEdit( container ); |
586 | listValue.append( e ); | 591 | listValue.append( e ); |
587 | gl->addWidget( e, i, 1); | 592 | gl->addWidget( e, i, 1); |
588 | } | 593 | } |
589 | // Fill labels with names.. | 594 | // Fill labels with names.. |
590 | //loadFields(); | 595 | //loadFields(); |
591 | 596 | ||
592 | 597 | ||
593 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 598 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
594 | 599 | ||
595 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 600 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
596 | dlgNote->setCaption( tr("Enter Note") ); | 601 | dlgNote->setCaption( tr("Enter Note") ); |
597 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 602 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
598 | txtNote = new QMultiLineEdit( dlgNote ); | 603 | txtNote = new QMultiLineEdit( dlgNote ); |
599 | vbNote->addWidget( txtNote ); | 604 | vbNote->addWidget( txtNote ); |
600 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 605 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
601 | 606 | ||
602 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 607 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
603 | dlgName->setCaption( tr("Edit Name") ); | 608 | dlgName->setCaption( tr("Edit Name") ); |
604 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 609 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
605 | 610 | ||
606 | l = new QLabel( tr("First Name"), dlgName ); | 611 | l = new QLabel( tr("First Name"), dlgName ); |
607 | gl->addWidget( l, 0, 0 ); | 612 | gl->addWidget( l, 0, 0 ); |
608 | txtFirstName = new QLineEdit( dlgName ); | 613 | txtFirstName = new QLineEdit( dlgName ); |
609 | gl->addWidget( txtFirstName, 0, 1 ); | 614 | gl->addWidget( txtFirstName, 0, 1 ); |
610 | 615 | ||
611 | l = new QLabel( tr("Middle Name"), dlgName ); | 616 | l = new QLabel( tr("Middle Name"), dlgName ); |
612 | gl->addWidget( l, 1, 0 ); | 617 | gl->addWidget( l, 1, 0 ); |
613 | txtMiddleName = new QLineEdit( dlgName ); | 618 | txtMiddleName = new QLineEdit( dlgName ); |
614 | gl->addWidget( txtMiddleName, 1, 1 ); | 619 | gl->addWidget( txtMiddleName, 1, 1 ); |
615 | 620 | ||
616 | l = new QLabel( tr("Last Name"), dlgName ); | 621 | l = new QLabel( tr("Last Name"), dlgName ); |
617 | gl->addWidget( l, 2, 0 ); | 622 | gl->addWidget( l, 2, 0 ); |
618 | txtLastName = new QLineEdit( dlgName ); | 623 | txtLastName = new QLineEdit( dlgName ); |
619 | gl->addWidget( txtLastName, 2, 1 ); | 624 | gl->addWidget( txtLastName, 2, 1 ); |
620 | 625 | ||
621 | l = new QLabel( tr("Suffix"), dlgName ); | 626 | // l = new QLabel( tr("Suffix"), dlgName ); |
622 | gl->addWidget( l, 3, 0 ); | 627 | // gl->addWidget( l, 3, 0 ); |
623 | txtSuffix = new QLineEdit( dlgName ); | 628 | // txtSuffix = new QLineEdit( dlgName ); |
624 | gl->addWidget( txtSuffix, 3, 1 ); | 629 | // gl->addWidget( txtSuffix, 3, 1 ); |
625 | space = new QSpacerItem(1,1, | 630 | space = new QSpacerItem(1,1, |
626 | QSizePolicy::Maximum, | 631 | QSizePolicy::Maximum, |
627 | QSizePolicy::MinimumExpanding ); | 632 | QSizePolicy::MinimumExpanding ); |
628 | gl->addItem( space, 4, 0 ); | 633 | gl->addItem( space, 4, 0 ); |
629 | 634 | ||
630 | cmbChooserField1->insertStringList( trlChooserNames ); | 635 | cmbChooserField1->insertStringList( trlChooserNames ); |
631 | cmbChooserField2->insertStringList( trlChooserNames ); | 636 | cmbChooserField2->insertStringList( trlChooserNames ); |
632 | cmbChooserField3->insertStringList( trlChooserNames ); | 637 | cmbChooserField3->insertStringList( trlChooserNames ); |
633 | cmbChooserField4->insertStringList( trlChooserNames ); | 638 | cmbChooserField4->insertStringList( trlChooserNames ); |
634 | 639 | ||
635 | cmbChooserField1->setCurrentItem( 0 ); | 640 | cmbChooserField1->setCurrentItem( 0 ); |
636 | cmbChooserField2->setCurrentItem( 1 ); | 641 | cmbChooserField2->setCurrentItem( 1 ); |
637 | cmbChooserField3->setCurrentItem( 2 ); | 642 | cmbChooserField3->setCurrentItem( 2 ); |
638 | 643 | ||
639 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 644 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
640 | 645 | ||
641 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); | 646 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); |
642 | 647 | ||
643 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), | 648 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), |
644 | this, SLOT(slotChooser1Change(const QString &)) ); | 649 | this, SLOT(slotChooser1Change(const QString &)) ); |
645 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), | 650 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), |
646 | this, SLOT(slotChooser2Change(const QString &)) ); | 651 | this, SLOT(slotChooser2Change(const QString &)) ); |
647 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), | 652 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), |
648 | this, SLOT(slotChooser3Change(const QString &)) ); | 653 | this, SLOT(slotChooser3Change(const QString &)) ); |
649 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), | 654 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), |
650 | this, SLOT(slotChooser4Change(const QString &)) ); | 655 | this, SLOT(slotChooser4Change(const QString &)) ); |
651 | connect( txtAddress, SIGNAL(textChanged(const QString &)), | 656 | connect( txtAddress, SIGNAL(textChanged(const QString &)), |
652 | this, SLOT(slotAddressChange(const QString &)) ); | 657 | this, SLOT(slotAddressChange(const QString &)) ); |
653 | connect( txtCity, SIGNAL(textChanged(const QString &)), | 658 | connect( txtCity, SIGNAL(textChanged(const QString &)), |
654 | this, SLOT(slotCityChange(const QString &)) ); | 659 | this, SLOT(slotCityChange(const QString &)) ); |
655 | connect( txtState, SIGNAL(textChanged(const QString &)), | 660 | connect( txtState, SIGNAL(textChanged(const QString &)), |
656 | this, SLOT(slotStateChange(const QString &)) ); | 661 | this, SLOT(slotStateChange(const QString &)) ); |
657 | connect( txtZip, SIGNAL(textChanged(const QString &)), | 662 | connect( txtZip, SIGNAL(textChanged(const QString &)), |
658 | this, SLOT(slotZipChange(const QString &)) ); | 663 | this, SLOT(slotZipChange(const QString &)) ); |
659 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), | 664 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), |
660 | this, SLOT(slotCountryChange(const QString &)) ); | 665 | this, SLOT(slotCountryChange(const QString &)) ); |
661 | connect( cmbCountry, SIGNAL(activated(const QString &)), | 666 | connect( cmbCountry, SIGNAL(activated(const QString &)), |
662 | this, SLOT(slotCountryChange(const QString &)) ); | 667 | this, SLOT(slotCountryChange(const QString &)) ); |
663 | connect( cmbChooserField1, SIGNAL(activated(int)), | 668 | connect( cmbChooserField1, SIGNAL(activated(int)), |
664 | this, SLOT(slotCmbChooser1Change(int)) ); | 669 | this, SLOT(slotCmbChooser1Change(int)) ); |
665 | connect( cmbChooserField2, SIGNAL(activated(int)), | 670 | connect( cmbChooserField2, SIGNAL(activated(int)), |
666 | this, SLOT(slotCmbChooser2Change(int)) ); | 671 | this, SLOT(slotCmbChooser2Change(int)) ); |
667 | connect( cmbChooserField3, SIGNAL(activated(int)), | 672 | connect( cmbChooserField3, SIGNAL(activated(int)), |
668 | this, SLOT(slotCmbChooser3Change(int)) ); | 673 | this, SLOT(slotCmbChooser3Change(int)) ); |
669 | connect( cmbChooserField4, SIGNAL(activated(int)), | 674 | connect( cmbChooserField4, SIGNAL(activated(int)), |
670 | this, SLOT(slotCmbChooser4Change(int)) ); | 675 | this, SLOT(slotCmbChooser4Change(int)) ); |
671 | connect( cmbAddress, SIGNAL(activated(int)), | 676 | connect( cmbAddress, SIGNAL(activated(int)), |
672 | this, SLOT(slotAddressTypeChange(int)) ); | 677 | this, SLOT(slotAddressTypeChange(int)) ); |
673 | 678 | ||
674 | new QPEDialogListener(this); | 679 | new QPEDialogListener(this); |
675 | 680 | ||
676 | setPersonalView ( m_personalView ); | 681 | setPersonalView ( m_personalView ); |
677 | 682 | ||
678 | qWarning("init() END"); | 683 | qWarning("init() END"); |
679 | } | 684 | } |
680 | 685 | ||
681 | void ContactEditor::defaultEmailChanged(int i){ | 686 | void ContactEditor::defaultEmailChanged(int i){ |
682 | qDebug("defaultEmailChanged"); | 687 | qDebug("defaultEmailChanged"); |
683 | 688 | ||
684 | // was sollte das ? (se) | 689 | // was sollte das ? (se) |
685 | // int index = cmbChooserField1->currentItem(); | 690 | // int index = cmbChooserField1->currentItem(); |
686 | // slChooserValues[index] = cmbDefaultEmail->text(i); | 691 | // slChooserValues[index] = cmbDefaultEmail->text(i); |
687 | 692 | ||
688 | defaultEmail = cmbDefaultEmail->text(i); | 693 | defaultEmail = cmbDefaultEmail->text(i); |
689 | qDebug ("Changed to: %s", defaultEmail.latin1()); | 694 | qDebug ("Changed to: %s", defaultEmail.latin1()); |
690 | 695 | ||
691 | } | 696 | } |
692 | 697 | ||
693 | void ContactEditor::populateDefaultEmailCmb(){ | 698 | void ContactEditor::populateDefaultEmailCmb(){ |
694 | 699 | ||
695 | // if the default-email combo was not selected and therfore not created | 700 | // if the default-email combo was not selected and therfore not created |
696 | // we get a lot of trouble.. Therfore create an invisible one.. | 701 | // we get a lot of trouble.. Therfore create an invisible one.. |
697 | if ( !cmbDefaultEmail ){ | 702 | if ( !cmbDefaultEmail ){ |
698 | cmbDefaultEmail = new QComboBox(this); | 703 | cmbDefaultEmail = new QComboBox(this); |
699 | cmbDefaultEmail -> hide(); | 704 | cmbDefaultEmail -> hide(); |
700 | } | 705 | } |
701 | cmbDefaultEmail->clear(); | 706 | cmbDefaultEmail->clear(); |
702 | cmbDefaultEmail->insertStringList( emails ); | 707 | cmbDefaultEmail->insertStringList( emails ); |
703 | // cmbDefaultEmail->show(); | 708 | // cmbDefaultEmail->show(); |
704 | 709 | ||
705 | // Select default email in combo.. | 710 | // Select default email in combo.. |
706 | bool found = false; | 711 | bool found = false; |
707 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 712 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
708 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", | 713 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", |
709 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); | 714 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); |
710 | 715 | ||
711 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 716 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
712 | cmbDefaultEmail->setCurrentItem( i ); | 717 | cmbDefaultEmail->setCurrentItem( i ); |
713 | qDebug("set"); | 718 | qDebug("set"); |
714 | found = true; | 719 | found = true; |
715 | } | 720 | } |
716 | } | 721 | } |
717 | 722 | ||
718 | // If the current default email is not found in the list, we choose the | 723 | // If the current default email is not found in the list, we choose the |
719 | // first one.. | 724 | // first one.. |
720 | if ( !found ) | 725 | if ( !found ) |
@@ -922,896 +927,808 @@ void ContactEditor::slotZipChange( const QString &textChanged ) { | |||
922 | if ( cmbAddress->currentItem() == 0 ) { | 927 | if ( cmbAddress->currentItem() == 0 ) { |
923 | slBusinessAddress[5] = textChanged; | 928 | slBusinessAddress[5] = textChanged; |
924 | } else { | 929 | } else { |
925 | slHomeAddress[5] = textChanged; | 930 | slHomeAddress[5] = textChanged; |
926 | } | 931 | } |
927 | } | 932 | } |
928 | 933 | ||
929 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 934 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
930 | 935 | ||
931 | if ( cmbAddress->currentItem() == 0 ) { | 936 | if ( cmbAddress->currentItem() == 0 ) { |
932 | slBusinessAddress[6] = textChanged; | 937 | slBusinessAddress[6] = textChanged; |
933 | } else { | 938 | } else { |
934 | slHomeAddress[6] = textChanged; | 939 | slHomeAddress[6] = textChanged; |
935 | } | 940 | } |
936 | } | 941 | } |
937 | 942 | ||
938 | 943 | ||
939 | void ContactEditor::slotCmbChooser1Change( int index ) { | 944 | void ContactEditor::slotCmbChooser1Change( int index ) { |
940 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); | 945 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); |
941 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ | 946 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ |
942 | 947 | ||
943 | txtChooserField1->setText( slChooserValues[index] ); | 948 | txtChooserField1->setText( slChooserValues[index] ); |
944 | txtChooserField1->setFocus(); | 949 | txtChooserField1->setFocus(); |
945 | 950 | ||
946 | } | 951 | } |
947 | 952 | ||
948 | } | 953 | } |
949 | 954 | ||
950 | void ContactEditor::slotCmbChooser2Change( int index ) { | 955 | void ContactEditor::slotCmbChooser2Change( int index ) { |
951 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); | 956 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); |
952 | 957 | ||
953 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ | 958 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ |
954 | 959 | ||
955 | txtChooserField2->setText( slChooserValues[index] ); | 960 | txtChooserField2->setText( slChooserValues[index] ); |
956 | txtChooserField2->setFocus(); | 961 | txtChooserField2->setFocus(); |
957 | 962 | ||
958 | } | 963 | } |
959 | } | 964 | } |
960 | 965 | ||
961 | void ContactEditor::slotCmbChooser3Change( int index ) { | 966 | void ContactEditor::slotCmbChooser3Change( int index ) { |
962 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); | 967 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); |
963 | 968 | ||
964 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ | 969 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ |
965 | 970 | ||
966 | txtChooserField3->setText( slChooserValues[index] ); | 971 | txtChooserField3->setText( slChooserValues[index] ); |
967 | txtChooserField3->setFocus(); | 972 | txtChooserField3->setFocus(); |
968 | 973 | ||
969 | } | 974 | } |
970 | } | 975 | } |
971 | 976 | ||
972 | void ContactEditor::slotCmbChooser4Change( int index ) { | 977 | void ContactEditor::slotCmbChooser4Change( int index ) { |
973 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); | 978 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); |
974 | 979 | ||
975 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ | 980 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ |
976 | 981 | ||
977 | txtChooserField4->setText( slChooserValues[index] ); | 982 | txtChooserField4->setText( slChooserValues[index] ); |
978 | txtChooserField4->setFocus(); | 983 | txtChooserField4->setFocus(); |
979 | 984 | ||
980 | } | 985 | } |
981 | } | 986 | } |
982 | 987 | ||
983 | void ContactEditor::slotAddressTypeChange( int index ) { | 988 | void ContactEditor::slotAddressTypeChange( int index ) { |
984 | 989 | ||
985 | 990 | ||
986 | if ( !initializing ) | 991 | if ( !initializing ) |
987 | contactfields.setFieldOrder( 4, index ); | 992 | contactfields.setFieldOrder( 4, index ); |
988 | 993 | ||
989 | 994 | ||
990 | if ( index == 0 ) { | 995 | if ( index == 0 ) { |
991 | 996 | ||
992 | txtAddress->setText( slBusinessAddress[0] ); | 997 | txtAddress->setText( slBusinessAddress[0] ); |
993 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 998 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
994 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 999 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
995 | txtCity->setText( slBusinessAddress[3] ); | 1000 | txtCity->setText( slBusinessAddress[3] ); |
996 | txtState->setText( slBusinessAddress[4] ); | 1001 | txtState->setText( slBusinessAddress[4] ); |
997 | txtZip->setText( slBusinessAddress[5] ); | 1002 | txtZip->setText( slBusinessAddress[5] ); |
998 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1003 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
999 | txtTmp->setText( slBusinessAddress[6] ); | 1004 | txtTmp->setText( slBusinessAddress[6] ); |
1000 | 1005 | ||
1001 | } else { | 1006 | } else { |
1002 | 1007 | ||
1003 | txtAddress->setText( slHomeAddress[0] ); | 1008 | txtAddress->setText( slHomeAddress[0] ); |
1004 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 1009 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
1005 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 1010 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
1006 | txtCity->setText( slHomeAddress[3] ); | 1011 | txtCity->setText( slHomeAddress[3] ); |
1007 | txtState->setText( slHomeAddress[4] ); | 1012 | txtState->setText( slHomeAddress[4] ); |
1008 | txtZip->setText( slHomeAddress[5] ); | 1013 | txtZip->setText( slHomeAddress[5] ); |
1009 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1014 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1010 | txtTmp->setText( slHomeAddress[6] ); | 1015 | txtTmp->setText( slHomeAddress[6] ); |
1011 | 1016 | ||
1012 | } | 1017 | } |
1013 | 1018 | ||
1014 | } | 1019 | } |
1015 | 1020 | ||
1016 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1021 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
1017 | 1022 | ||
1023 | qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); | ||
1024 | |||
1018 | int index = cmbFileAs->currentItem(); | 1025 | int index = cmbFileAs->currentItem(); |
1019 | 1026 | ||
1020 | cmbFileAs->clear(); | 1027 | cmbFileAs->clear(); |
1021 | 1028 | ||
1022 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); | 1029 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); |
1023 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); | 1030 | cmbFileAs->insertItem( parseName( textChanged, NAME_FMLS ) ); |
1024 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); | 1031 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); |
1025 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); | 1032 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); |
1026 | 1033 | ||
1027 | cmbFileAs->setCurrentItem( index ); | 1034 | cmbFileAs->setCurrentItem( index ); |
1028 | 1035 | ||
1029 | useFullName = true; | 1036 | useFullName = true; |
1030 | 1037 | ||
1031 | } | 1038 | } |
1032 | 1039 | ||
1033 | void ContactEditor::accept() { | 1040 | void ContactEditor::accept() { |
1034 | 1041 | ||
1035 | if ( isEmpty() ) { | 1042 | if ( isEmpty() ) { |
1036 | cleanupFields(); | 1043 | cleanupFields(); |
1037 | reject(); | 1044 | reject(); |
1038 | } else { | 1045 | } else { |
1039 | saveEntry(); | 1046 | saveEntry(); |
1040 | cleanupFields(); | 1047 | cleanupFields(); |
1041 | QDialog::accept(); | 1048 | QDialog::accept(); |
1042 | } | 1049 | } |
1043 | 1050 | ||
1044 | } | 1051 | } |
1045 | 1052 | ||
1046 | void ContactEditor::slotNote() { | 1053 | void ContactEditor::slotNote() { |
1047 | 1054 | ||
1048 | dlgNote->showMaximized(); | 1055 | dlgNote->showMaximized(); |
1049 | if ( !dlgNote->exec() ) { | 1056 | if ( !dlgNote->exec() ) { |
1050 | txtNote->setText( ent.notes() ); | 1057 | txtNote->setText( ent.notes() ); |
1051 | } | 1058 | } |
1052 | } | 1059 | } |
1053 | 1060 | ||
1054 | void ContactEditor::slotName() { | 1061 | void ContactEditor::slotName() { |
1055 | 1062 | ||
1056 | QString tmpName; | 1063 | QString tmpName; |
1057 | if (useFullName) { | 1064 | if (useFullName) { |
1058 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1065 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1059 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1066 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1060 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1067 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1061 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1068 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1062 | } | 1069 | } |
1063 | dlgName->showMaximized(); | 1070 | dlgName->showMaximized(); |
1064 | if ( dlgName->exec() ) { | 1071 | if ( dlgName->exec() ) { |
1065 | 1072 | ||
1066 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); | 1073 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); |
1067 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1074 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1068 | slotFullNameChange( txtFullName->text() ); | 1075 | slotFullNameChange( txtFullName->text() ); |
1069 | useFullName = false; | 1076 | useFullName = false; |
1070 | } | 1077 | } |
1071 | 1078 | ||
1072 | } | 1079 | } |
1073 | 1080 | ||
1074 | void ContactEditor::setNameFocus() { | 1081 | void ContactEditor::setNameFocus() { |
1075 | 1082 | ||
1076 | txtFullName->setFocus(); | 1083 | txtFullName->setFocus(); |
1077 | 1084 | ||
1078 | } | 1085 | } |
1079 | 1086 | ||
1080 | bool ContactEditor::isEmpty() { | 1087 | bool ContactEditor::isEmpty() { |
1081 | // Test and see if the record should be saved. | 1088 | // Test and see if the record should be saved. |
1082 | // More strict than the original qtopia, needs name or fileas to save | 1089 | // More strict than the original qtopia, needs name or fileas to save |
1083 | 1090 | ||
1084 | QString t = txtFullName->text(); | 1091 | QString t = txtFullName->text(); |
1085 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1092 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1086 | return false; | 1093 | return false; |
1087 | 1094 | ||
1088 | t = cmbFileAs->currentText(); | 1095 | t = cmbFileAs->currentText(); |
1089 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1096 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1090 | return false; | 1097 | return false; |
1091 | 1098 | ||
1092 | return true; | 1099 | return true; |
1093 | 1100 | ||
1094 | } | 1101 | } |
1095 | 1102 | ||
1096 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1103 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1097 | 1104 | ||
1098 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1105 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1099 | QString strFirstName; | 1106 | QString strFirstName; |
1100 | QString strMiddleName; | 1107 | QString strMiddleName; |
1101 | QString strLastName; | 1108 | QString strLastName; |
1102 | QString strSuffix; | 1109 | QString strSuffix; |
1103 | QString strTitle; | 1110 | QString strTitle; |
1104 | int commapos; | 1111 | int commapos; |
1105 | int spCount; | 1112 | bool haveLastName = false; |
1106 | int spPos; | ||
1107 | int spPos2; | ||
1108 | 1113 | ||
1114 | qWarning("Fullname: %s", simplifiedName.latin1()); | ||
1109 | 1115 | ||
1110 | commapos = simplifiedName.find( ',', 0, TRUE); | 1116 | commapos = simplifiedName.find( ',', 0, TRUE); |
1111 | spCount = simplifiedName.contains( ' ', TRUE ); | 1117 | if ( commapos >= 0 ) { |
1112 | 1118 | qWarning(" Commapos: %d", commapos ); | |
1113 | if ( commapos == -1 ) { | 1119 | |
1114 | 1120 | // A comma (",") separates the lastname from one or | |
1115 | switch (spCount) { | 1121 | // many first names. Thus, remove the lastname from the |
1116 | case 0: | 1122 | // String and parse the firstnames. |
1117 | //return simplifiedName; | 1123 | |
1118 | if (txtLastName->text() != "") { | 1124 | strLastName = simplifiedName.left( commapos ); |
1119 | strLastName = simplifiedName; | 1125 | simplifiedName= simplifiedName.mid( commapos + 1 ); |
1120 | break; | 1126 | haveLastName = true; |
1121 | } | 1127 | qWarning("Fullname without ',': %s", simplifiedName.latin1()); |
1122 | if (txtMiddleName->text() != "") { | 1128 | |
1123 | strMiddleName = simplifiedName; | 1129 | // If we have any lastname, we should now split all first names. |
1124 | break; | 1130 | // The first one will be the used as first, the rest as "middle names" |
1125 | } | 1131 | |
1126 | if (txtSuffix->text() != "") { | 1132 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); |
1127 | strSuffix = simplifiedName; | 1133 | QStringList::Iterator it = allFirstNames.begin(); |
1128 | break; | 1134 | strFirstName = *it++; |
1129 | } | 1135 | QStringList allSecondNames; |
1130 | strFirstName = simplifiedName; | 1136 | for ( ; it != allFirstNames.end(); ++it ) |
1131 | break; | 1137 | allSecondNames.append( *it ); |
1132 | 1138 | ||
1133 | case 1: | 1139 | strMiddleName = allSecondNames.join(" "); |
1134 | spPos = simplifiedName.find( ' ', 0, TRUE ); | ||
1135 | strFirstName = simplifiedName.left( spPos ); | ||
1136 | strLastName = simplifiedName.mid( spPos + 1 ); | ||
1137 | break; | ||
1138 | |||
1139 | case 2: | ||
1140 | spPos = simplifiedName.find( ' ', 0, TRUE ); | ||
1141 | strFirstName = simplifiedName.left( spPos ); | ||
1142 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | ||
1143 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | ||
1144 | strLastName = simplifiedName.mid( spPos2 + 1 ); | ||
1145 | break; | ||
1146 | |||
1147 | case 3: | ||
1148 | spPos = simplifiedName.find( ' ', 0, TRUE ); | ||
1149 | strFirstName = simplifiedName.left( spPos ); | ||
1150 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | ||
1151 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | ||
1152 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | ||
1153 | strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | ||
1154 | strSuffix = simplifiedName.mid( spPos + 1 ); | ||
1155 | break; | ||
1156 | |||
1157 | case 4: | ||
1158 | spPos = simplifiedName.find( ' ', 0, TRUE ); | ||
1159 | strTitle = simplifiedName.left( spPos ); | ||
1160 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | ||
1161 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | ||
1162 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | ||
1163 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | ||
1164 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | ||
1165 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | ||
1166 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | ||
1167 | break; | ||
1168 | |||
1169 | default: | ||
1170 | spPos = simplifiedName.find( ' ', 0, TRUE ); | ||
1171 | strTitle = simplifiedName.left( spPos ); | ||
1172 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | ||
1173 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | ||
1174 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | ||
1175 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | ||
1176 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | ||
1177 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | ||
1178 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | ||
1179 | break; | ||
1180 | } | ||
1181 | } else { | ||
1182 | simplifiedName.replace( commapos, 1, " " ); | ||
1183 | simplifiedName = simplifiedName.simplifyWhiteSpace(); | ||
1184 | |||
1185 | switch (spCount) { | ||
1186 | case 0: | ||
1187 | //return simplifiedName; | ||
1188 | if (txtLastName->text() != "") { | ||
1189 | strLastName = simplifiedName; | ||
1190 | break; | ||
1191 | } | ||
1192 | if (txtMiddleName->text() != "") { | ||
1193 | strMiddleName = simplifiedName; | ||
1194 | break; | ||
1195 | } | ||
1196 | if (txtSuffix->text() != "") { | ||
1197 | strSuffix = simplifiedName; | ||
1198 | break; | ||
1199 | } | ||
1200 | strFirstName = simplifiedName; | ||
1201 | break; | ||
1202 | |||
1203 | case 1: | ||
1204 | spPos = simplifiedName.find( ' ', 0, TRUE ); | ||
1205 | strLastName = simplifiedName.left( spPos ); | ||
1206 | strFirstName = simplifiedName.mid( spPos + 1 ); | ||
1207 | break; | ||
1208 | |||
1209 | case 2: | ||
1210 | spPos = simplifiedName.find( ' ', 0, TRUE ); | ||
1211 | strLastName = simplifiedName.left( spPos ); | ||
1212 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | ||
1213 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | ||
1214 | strMiddleName = simplifiedName.mid( spPos2 + 1 ); | ||
1215 | break; | ||
1216 | |||
1217 | case 3: | ||
1218 | spPos = simplifiedName.find( ' ', 0, TRUE ); | ||
1219 | strLastName = simplifiedName.left( spPos ); | ||
1220 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | ||
1221 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | ||
1222 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | ||
1223 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | ||
1224 | strSuffix = simplifiedName.mid( spPos + 1 ); | ||
1225 | break; | ||
1226 | |||
1227 | case 4: | ||
1228 | spPos = simplifiedName.find( ' ', 0, TRUE ); | ||
1229 | strLastName = simplifiedName.left( spPos ); | ||
1230 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | ||
1231 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | ||
1232 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | ||
1233 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | ||
1234 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | ||
1235 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | ||
1236 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | ||
1237 | break; | ||
1238 | |||
1239 | default: | ||
1240 | spPos = simplifiedName.find( ' ', 0, TRUE ); | ||
1241 | strLastName = simplifiedName.left( spPos ); | ||
1242 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | ||
1243 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | ||
1244 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | ||
1245 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | ||
1246 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | ||
1247 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | ||
1248 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | ||
1249 | break; | ||
1250 | } | ||
1251 | } | ||
1252 | switch (type) { | ||
1253 | case NAME_FL: | ||
1254 | return strFirstName + " " + strLastName; | ||
1255 | |||
1256 | case NAME_LF: | ||
1257 | return strLastName + ", " + strFirstName; | ||
1258 | |||
1259 | case NAME_LFM: | ||
1260 | return strLastName + ", " + strFirstName + " " + strMiddleName; | ||
1261 | 1140 | ||
1262 | case NAME_FMLS: | 1141 | } else { |
1263 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; | ||
1264 | 1142 | ||
1265 | case NAME_F: | 1143 | // No comma separator used: We use the first word as firstname, the |
1266 | return strFirstName; | 1144 | // last as second/lastname and everything in the middle as middlename |
1267 | 1145 | ||
1268 | case NAME_M: | 1146 | QStringList allNames = QStringList::split(" ", simplifiedName); |
1269 | return strMiddleName; | 1147 | QStringList::Iterator it = allNames.begin(); |
1148 | strFirstName = *it++; | ||
1149 | QStringList allSecondNames; | ||
1150 | for ( ; it != --allNames.end(); ++it ) | ||
1151 | allSecondNames.append( *it ); | ||
1152 | |||
1153 | strMiddleName = allSecondNames.join(" "); | ||
1154 | strLastName = *(--allNames.end()); | ||
1270 | 1155 | ||
1271 | case NAME_L: | 1156 | } |
1272 | return strLastName; | ||
1273 | 1157 | ||
1274 | case NAME_S: | 1158 | qWarning(" strFirstName: %s", strFirstName.latin1()); |
1275 | return strSuffix; | 1159 | qWarning(" strMiddleName: %s", strMiddleName.latin1()); |
1160 | qWarning(" strLastName: %s", strLastName.latin1()); | ||
1161 | qWarning(" strSuffix: %s", strSuffix.latin1()); | ||
1162 | qWarning(" strTitle: %s", strTitle.latin1()); | ||
1276 | 1163 | ||
1164 | switch (type) { | ||
1165 | case NAME_FL: | ||
1166 | return strFirstName + " " + strLastName; | ||
1167 | |||
1168 | case NAME_LF: | ||
1169 | return strLastName + ", " + strFirstName; | ||
1170 | |||
1171 | case NAME_LFM: | ||
1172 | return strLastName + ", " + strFirstName + " " + strMiddleName; | ||
1173 | |||
1174 | case NAME_FMLS: | ||
1175 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; | ||
1176 | |||
1177 | case NAME_F: | ||
1178 | return strFirstName; | ||
1179 | |||
1180 | case NAME_M: | ||
1181 | return strMiddleName; | ||
1182 | |||
1183 | case NAME_L: | ||
1184 | return strLastName; | ||
1185 | |||
1186 | case NAME_S: | ||
1187 | return strSuffix; | ||
1188 | |||
1277 | } | 1189 | } |
1278 | return QString::null; | 1190 | return QString::null; |
1279 | } | 1191 | } |
1280 | 1192 | ||
1281 | void ContactEditor::cleanupFields() { | 1193 | void ContactEditor::cleanupFields() { |
1282 | QStringList::Iterator it = slChooserValues.begin(); | 1194 | QStringList::Iterator it = slChooserValues.begin(); |
1283 | 1195 | ||
1284 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1196 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1285 | (*it) = ""; | 1197 | (*it) = ""; |
1286 | } | 1198 | } |
1287 | 1199 | ||
1288 | for ( int i = 0; i < 7; i++ ) { | 1200 | for ( int i = 0; i < 7; i++ ) { |
1289 | slHomeAddress[i] = ""; | 1201 | slHomeAddress[i] = ""; |
1290 | slBusinessAddress[i] = ""; | 1202 | slBusinessAddress[i] = ""; |
1291 | } | 1203 | } |
1292 | 1204 | ||
1293 | QListIterator<QLineEdit> itLV( listValue ); | 1205 | QListIterator<QLineEdit> itLV( listValue ); |
1294 | for ( ; itLV.current(); ++itLV ) { | 1206 | for ( ; itLV.current(); ++itLV ) { |
1295 | (*itLV)->setText( "" ); | 1207 | (*itLV)->setText( "" ); |
1296 | } | 1208 | } |
1297 | 1209 | ||
1298 | txtFirstName->setText(""); | 1210 | txtFirstName->setText(""); |
1299 | txtMiddleName->setText(""); | 1211 | txtMiddleName->setText(""); |
1300 | txtLastName->setText(""); | 1212 | txtLastName->setText(""); |
1301 | txtSuffix->setText(""); | 1213 | txtSuffix->setText(""); |
1302 | txtNote->setText(""); | 1214 | txtNote->setText(""); |
1303 | txtFullName->setText(""); | 1215 | txtFullName->setText(""); |
1304 | txtJobTitle->setText(""); | 1216 | txtJobTitle->setText(""); |
1305 | txtOrganization->setText(""); | 1217 | txtOrganization->setText(""); |
1306 | txtChooserField1->setText(""); | 1218 | txtChooserField1->setText(""); |
1307 | txtChooserField2->setText(""); | 1219 | txtChooserField2->setText(""); |
1308 | txtChooserField3->setText(""); | 1220 | txtChooserField3->setText(""); |
1309 | txtAddress->setText(""); | 1221 | txtAddress->setText(""); |
1310 | txtCity->setText(""); | 1222 | txtCity->setText(""); |
1311 | txtState->setText(""); | 1223 | txtState->setText(""); |
1312 | txtZip->setText(""); | 1224 | txtZip->setText(""); |
1313 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1225 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1314 | txtTmp->setText(""); | 1226 | txtTmp->setText(""); |
1315 | txtTmp = cmbFileAs->lineEdit(); | 1227 | txtTmp = cmbFileAs->lineEdit(); |
1316 | txtTmp->setText(""); | 1228 | txtTmp->setText(""); |
1317 | 1229 | ||
1318 | } | 1230 | } |
1319 | 1231 | ||
1320 | void ContactEditor::setEntry( const OContact &entry ) { | 1232 | void ContactEditor::setEntry( const OContact &entry ) { |
1321 | 1233 | ||
1322 | initializing = true; | 1234 | initializing = true; |
1323 | 1235 | ||
1324 | cleanupFields(); | 1236 | cleanupFields(); |
1325 | 1237 | ||
1326 | ent = entry; | 1238 | ent = entry; |
1327 | 1239 | ||
1328 | emails = QStringList(ent.emailList()); | 1240 | emails = QStringList(ent.emailList()); |
1329 | defaultEmail = ent.defaultEmail(); | 1241 | defaultEmail = ent.defaultEmail(); |
1330 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1242 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1331 | qDebug("default email=%s",defaultEmail.latin1()); | 1243 | qDebug("default email=%s",defaultEmail.latin1()); |
1332 | 1244 | ||
1333 | useFullName = false; | 1245 | useFullName = false; |
1334 | txtFirstName->setText( ent.firstName() ); | 1246 | txtFirstName->setText( ent.firstName() ); |
1335 | txtMiddleName->setText( ent.middleName() ); | 1247 | txtMiddleName->setText( ent.middleName() ); |
1336 | txtLastName->setText( ent.lastName() ); | 1248 | txtLastName->setText( ent.lastName() ); |
1337 | txtSuffix->setText( ent.suffix() ); | 1249 | txtSuffix->setText( ent.suffix() ); |
1338 | 1250 | ||
1339 | QString *tmpString = new QString; | 1251 | // QString *tmpString = new QString; |
1340 | *tmpString = ent.firstName() + " " + ent.middleName() + | 1252 | // *tmpString = ent.firstName() + " " + ent.middleName() + |
1341 | + " " + ent.lastName() + " " + ent.suffix(); | 1253 | // + " " + ent.lastName() + " " + ent.suffix(); |
1342 | 1254 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); | |
1343 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1255 | |
1344 | 1256 | // Lastnames with multiple words need to be protected by a comma ! | |
1257 | if ( ent.lastName().contains( ' ', TRUE ) ) | ||
1258 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); | ||
1259 | else | ||
1260 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | ||
1261 | |||
1345 | cmbFileAs->setEditText( ent.fileAs() ); | 1262 | cmbFileAs->setEditText( ent.fileAs() ); |
1346 | 1263 | ||
1347 | //if (hasTitle) | 1264 | //if (hasTitle) |
1348 | txtJobTitle->setText( ent.jobTitle() ); | 1265 | txtJobTitle->setText( ent.jobTitle() ); |
1349 | 1266 | ||
1350 | //if (hasCompany) | 1267 | //if (hasCompany) |
1351 | txtOrganization->setText( ent.company() ); | 1268 | txtOrganization->setText( ent.company() ); |
1352 | 1269 | ||
1353 | //if (hasNotes) | 1270 | //if (hasNotes) |
1354 | txtNote->setText( ent.notes() ); | 1271 | txtNote->setText( ent.notes() ); |
1355 | 1272 | ||
1356 | //if (hasStreet) { | 1273 | //if (hasStreet) { |
1357 | slHomeAddress[0] = ent.homeStreet(); | 1274 | slHomeAddress[0] = ent.homeStreet(); |
1358 | slBusinessAddress[0] = ent.businessStreet(); | 1275 | slBusinessAddress[0] = ent.businessStreet(); |
1359 | //} | 1276 | //} |
1360 | 1277 | ||
1361 | //if (hasCity) { | 1278 | //if (hasCity) { |
1362 | slHomeAddress[3] = ent.homeCity(); | 1279 | slHomeAddress[3] = ent.homeCity(); |
1363 | slBusinessAddress[3] = ent.businessCity(); | 1280 | slBusinessAddress[3] = ent.businessCity(); |
1364 | //} | 1281 | //} |
1365 | 1282 | ||
1366 | //if (hasState) { | 1283 | //if (hasState) { |
1367 | slHomeAddress[4] = ent.homeState(); | 1284 | slHomeAddress[4] = ent.homeState(); |
1368 | slBusinessAddress[4] = ent.businessState(); | 1285 | slBusinessAddress[4] = ent.businessState(); |
1369 | //} | 1286 | //} |
1370 | 1287 | ||
1371 | //if (hasZip) { | 1288 | //if (hasZip) { |
1372 | slHomeAddress[5] = ent.homeZip(); | 1289 | slHomeAddress[5] = ent.homeZip(); |
1373 | slBusinessAddress[5] = ent.businessZip(); | 1290 | slBusinessAddress[5] = ent.businessZip(); |
1374 | //} | 1291 | //} |
1375 | 1292 | ||
1376 | //if (hasCountry) { | 1293 | //if (hasCountry) { |
1377 | slHomeAddress[6] = ent.homeCountry(); | 1294 | slHomeAddress[6] = ent.homeCountry(); |
1378 | slBusinessAddress[6] = ent.businessCountry(); | 1295 | slBusinessAddress[6] = ent.businessCountry(); |
1379 | //} | 1296 | //} |
1380 | 1297 | ||
1381 | QStringList::ConstIterator it; | 1298 | QStringList::ConstIterator it; |
1382 | QListIterator<QLineEdit> itLE( listValue ); | 1299 | QListIterator<QLineEdit> itLE( listValue ); |
1383 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { | 1300 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1384 | 1301 | ||
1385 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); | 1302 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); |
1386 | 1303 | ||
1387 | if ( *it == "Department" ) | 1304 | if ( *it == "Department" ) |
1388 | (*itLE)->setText( ent.department() ); | 1305 | (*itLE)->setText( ent.department() ); |
1389 | 1306 | ||
1390 | if ( *it == "Company" ) | 1307 | if ( *it == "Company" ) |
1391 | (*itLE)->setText( ent.company() ); | 1308 | (*itLE)->setText( ent.company() ); |
1392 | 1309 | ||
1393 | if ( *it == "Office" ) | 1310 | if ( *it == "Office" ) |
1394 | (*itLE)->setText( ent.office() ); | 1311 | (*itLE)->setText( ent.office() ); |
1395 | 1312 | ||
1396 | if ( *it == "Profession" ) | 1313 | if ( *it == "Profession" ) |
1397 | (*itLE)->setText( ent.profession() ); | 1314 | (*itLE)->setText( ent.profession() ); |
1398 | 1315 | ||
1399 | if ( *it == "Assistant" ) | 1316 | if ( *it == "Assistant" ) |
1400 | (*itLE)->setText( ent.assistant() ); | 1317 | (*itLE)->setText( ent.assistant() ); |
1401 | 1318 | ||
1402 | if ( *it == "Manager" ) | 1319 | if ( *it == "Manager" ) |
1403 | (*itLE)->setText( ent.manager() ); | 1320 | (*itLE)->setText( ent.manager() ); |
1404 | 1321 | ||
1405 | if ( *it == "Spouse" ) | 1322 | if ( *it == "Spouse" ) |
1406 | (*itLE)->setText( ent.spouse() ); | 1323 | (*itLE)->setText( ent.spouse() ); |
1407 | 1324 | ||
1408 | if ( *it == "Nickname" ){ | 1325 | if ( *it == "Nickname" ){ |
1409 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); | 1326 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); |
1410 | (*itLE)->setText( ent.nickname() ); | 1327 | (*itLE)->setText( ent.nickname() ); |
1411 | } | 1328 | } |
1412 | 1329 | ||
1413 | if ( *it == "Children" ) | 1330 | if ( *it == "Children" ) |
1414 | (*itLE)->setText( ent.children() ); | 1331 | (*itLE)->setText( ent.children() ); |
1415 | 1332 | ||
1416 | } | 1333 | } |
1417 | 1334 | ||
1418 | QStringList::Iterator itV; | 1335 | QStringList::Iterator itV; |
1419 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1336 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1420 | 1337 | ||
1421 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1338 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1422 | *itV = ent.businessPhone(); | 1339 | *itV = ent.businessPhone(); |
1423 | /* | 1340 | /* |
1424 | if ( *it == "Business 2 Phone" ) | 1341 | if ( *it == "Business 2 Phone" ) |
1425 | *itV = ent.business2Phone(); | 1342 | *itV = ent.business2Phone(); |
1426 | */ | 1343 | */ |
1427 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1344 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1428 | *itV = ent.businessFax(); | 1345 | *itV = ent.businessFax(); |
1429 | 1346 | ||
1430 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1347 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1431 | *itV = ent.businessMobile(); | 1348 | *itV = ent.businessMobile(); |
1432 | /* | 1349 | /* |
1433 | if ( *it == "Company Phone" ) | 1350 | if ( *it == "Company Phone" ) |
1434 | *itV = ent.companyPhone(); | 1351 | *itV = ent.companyPhone(); |
1435 | */ | 1352 | */ |
1436 | if ( *it == "Default Email" ) | 1353 | if ( *it == "Default Email" ) |
1437 | *itV = ent.defaultEmail(); | 1354 | *itV = ent.defaultEmail(); |
1438 | 1355 | ||
1439 | if ( *it == "Emails" ) | 1356 | if ( *it == "Emails" ) |
1440 | *itV = ent.emailList().join(", "); // :SX | 1357 | *itV = ent.emailList().join(", "); // :SX |
1441 | 1358 | ||
1442 | if ( *it == "Home Phone" ) | 1359 | if ( *it == "Home Phone" ) |
1443 | *itV = ent.homePhone(); | 1360 | *itV = ent.homePhone(); |
1444 | /* | 1361 | /* |
1445 | if ( *it == "Home 2 Phone" ) | 1362 | if ( *it == "Home 2 Phone" ) |
1446 | *itV = ent.home2Phone(); | 1363 | *itV = ent.home2Phone(); |
1447 | */ | 1364 | */ |
1448 | if ( *it == "Home Fax" ) | 1365 | if ( *it == "Home Fax" ) |
1449 | *itV = ent.homeFax(); | 1366 | *itV = ent.homeFax(); |
1450 | 1367 | ||
1451 | if ( *it == "Home Mobile" ) | 1368 | if ( *it == "Home Mobile" ) |
1452 | *itV = ent.homeMobile(); | 1369 | *itV = ent.homeMobile(); |
1453 | /* | 1370 | /* |
1454 | if ( *it == "Car Phone" ) | 1371 | if ( *it == "Car Phone" ) |
1455 | *itV = ent.carPhone(); | 1372 | *itV = ent.carPhone(); |
1456 | 1373 | ||
1457 | if ( *it == "ISDN Phone" ) | 1374 | if ( *it == "ISDN Phone" ) |
1458 | *itV = ent.ISDNPhone(); | 1375 | *itV = ent.ISDNPhone(); |
1459 | 1376 | ||
1460 | if ( *it == "Other Phone" ) | 1377 | if ( *it == "Other Phone" ) |
1461 | *itV = ent.otherPhone(); | 1378 | *itV = ent.otherPhone(); |
1462 | */ | 1379 | */ |
1463 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1380 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1464 | *itV = ent.businessPager(); | 1381 | *itV = ent.businessPager(); |
1465 | /* | 1382 | /* |
1466 | if ( *it == "Home Pager") | 1383 | if ( *it == "Home Pager") |
1467 | *itV = ent.homePager(); | 1384 | *itV = ent.homePager(); |
1468 | 1385 | ||
1469 | if ( *it == "AIM IM" ) | 1386 | if ( *it == "AIM IM" ) |
1470 | *itV = ent.AIMIM(); | 1387 | *itV = ent.AIMIM(); |
1471 | 1388 | ||
1472 | if ( *it == "ICQ IM" ) | 1389 | if ( *it == "ICQ IM" ) |
1473 | *itV = ent.ICQIM(); | 1390 | *itV = ent.ICQIM(); |
1474 | 1391 | ||
1475 | if ( *it == "Jabber IM" ) | 1392 | if ( *it == "Jabber IM" ) |
1476 | *itV = ent.jabberIM(); | 1393 | *itV = ent.jabberIM(); |
1477 | 1394 | ||
1478 | if ( *it == "MSN IM" ) | 1395 | if ( *it == "MSN IM" ) |
1479 | *itV = ent.MSNIM(); | 1396 | *itV = ent.MSNIM(); |
1480 | 1397 | ||
1481 | if ( *it == "Yahoo IM" ) | 1398 | if ( *it == "Yahoo IM" ) |
1482 | *itV = ent.yahooIM(); | 1399 | *itV = ent.yahooIM(); |
1483 | */ | 1400 | */ |
1484 | if ( *it == "Home Web Page" ) | 1401 | if ( *it == "Home Web Page" ) |
1485 | *itV = ent.homeWebpage(); | 1402 | *itV = ent.homeWebpage(); |
1486 | 1403 | ||
1487 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1404 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1488 | *itV = ent.businessWebpage(); | 1405 | *itV = ent.businessWebpage(); |
1489 | 1406 | ||
1490 | 1407 | ||
1491 | } | 1408 | } |
1492 | 1409 | ||
1493 | 1410 | ||
1494 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1411 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1495 | 1412 | ||
1496 | QString gender = ent.gender(); | 1413 | QString gender = ent.gender(); |
1497 | cmbGender->setCurrentItem( gender.toInt() ); | 1414 | cmbGender->setCurrentItem( gender.toInt() ); |
1498 | 1415 | ||
1499 | txtNote->setText( ent.notes() ); | 1416 | txtNote->setText( ent.notes() ); |
1500 | 1417 | ||
1501 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1418 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1502 | 1419 | ||
1503 | // Calling "show()" to arrange all widgets. Otherwise we will get | 1420 | // Calling "show()" to arrange all widgets. Otherwise we will get |
1504 | // a wrong position of the textfields and are unable to put our | 1421 | // a wrong position of the textfields and are unable to put our |
1505 | // default-email combo over it.. This is very ugly ! | 1422 | // default-email combo over it.. This is very ugly ! |
1506 | // Does anybody has a better solution ? | 1423 | // Does anybody has a better solution ? |
1507 | // Basically we should rethink the strategy to hide | 1424 | // Basically we should rethink the strategy to hide |
1508 | // a textfield with overwriting.. (se) | 1425 | // a textfield with overwriting.. (se) |
1509 | show(); | 1426 | show(); |
1510 | 1427 | ||
1511 | // Get combo-settings from contact and set preset.. | 1428 | // Get combo-settings from contact and set preset.. |
1512 | contactfields.loadFromRecord( ent ); | 1429 | contactfields.loadFromRecord( ent ); |
1513 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); | 1430 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); |
1514 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); | 1431 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); |
1515 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); | 1432 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); |
1516 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); | 1433 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); |
1517 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); | 1434 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); |
1518 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1435 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1519 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1436 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1520 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1437 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1521 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); | 1438 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); |
1522 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1439 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1523 | 1440 | ||
1524 | updateDatePicker(); | 1441 | updateDatePicker(); |
1525 | 1442 | ||
1526 | initializing = false; | 1443 | initializing = false; |
1527 | } | 1444 | } |
1528 | void ContactEditor::updateDatePicker() | 1445 | void ContactEditor::updateDatePicker() |
1529 | { | 1446 | { |
1530 | // Set DatePicker | 1447 | // Set DatePicker |
1531 | if ( !ent.birthday().isNull() ){ | 1448 | if ( !ent.birthday().isNull() ){ |
1532 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); | 1449 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); |
1533 | birthdayPicker->setDate( ent.birthday() ); | 1450 | birthdayPicker->setDate( ent.birthday() ); |
1534 | } else | 1451 | } else |
1535 | birthdayButton->setText( tr ("Unknown") ); | 1452 | birthdayButton->setText( tr ("Unknown") ); |
1536 | 1453 | ||
1537 | if ( !ent.anniversary().isNull() ){ | 1454 | if ( !ent.anniversary().isNull() ){ |
1538 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); | 1455 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); |
1539 | anniversaryPicker->setDate( ent.anniversary() ); | 1456 | anniversaryPicker->setDate( ent.anniversary() ); |
1540 | } else | 1457 | } else |
1541 | anniversaryButton->setText( tr ("Unknown") ); | 1458 | anniversaryButton->setText( tr ("Unknown") ); |
1542 | 1459 | ||
1543 | } | 1460 | } |
1544 | 1461 | ||
1545 | void ContactEditor::saveEntry() { | 1462 | void ContactEditor::saveEntry() { |
1546 | 1463 | ||
1547 | // Store current combo into contact | 1464 | // Store current combo into contact |
1548 | contactfields.saveToRecord( ent ); | 1465 | contactfields.saveToRecord( ent ); |
1549 | 1466 | ||
1550 | if ( useFullName ) { | 1467 | if ( useFullName ) { |
1551 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1468 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1552 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1469 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1553 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1470 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1554 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1471 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1555 | 1472 | ||
1556 | useFullName = false; | 1473 | useFullName = false; |
1557 | } | 1474 | } |
1558 | 1475 | ||
1559 | ent.setFirstName( txtFirstName->text() ); | 1476 | ent.setFirstName( txtFirstName->text() ); |
1560 | ent.setLastName( txtLastName->text() ); | 1477 | ent.setLastName( txtLastName->text() ); |
1561 | ent.setMiddleName( txtMiddleName->text() ); | 1478 | ent.setMiddleName( txtMiddleName->text() ); |
1562 | ent.setSuffix( txtSuffix->text() ); | 1479 | ent.setSuffix( txtSuffix->text() ); |
1563 | 1480 | ||
1564 | ent.setFileAs( cmbFileAs->currentText() ); | 1481 | ent.setFileAs( cmbFileAs->currentText() ); |
1565 | 1482 | ||
1566 | ent.setCategories( cmbCat->currentCategories() ); | 1483 | ent.setCategories( cmbCat->currentCategories() ); |
1567 | 1484 | ||
1568 | 1485 | ||
1569 | //if (hasTitle) | 1486 | //if (hasTitle) |
1570 | ent.setJobTitle( txtJobTitle->text() ); | 1487 | ent.setJobTitle( txtJobTitle->text() ); |
1571 | 1488 | ||
1572 | //if (hasCompany) | 1489 | //if (hasCompany) |
1573 | ent.setCompany( txtOrganization->text() ); | 1490 | ent.setCompany( txtOrganization->text() ); |
1574 | 1491 | ||
1575 | //if (hasNotes) | 1492 | //if (hasNotes) |
1576 | ent.setNotes( txtNote->text() ); | 1493 | ent.setNotes( txtNote->text() ); |
1577 | 1494 | ||
1578 | //if (hasStreet) { | 1495 | //if (hasStreet) { |
1579 | ent.setHomeStreet( slHomeAddress[0] ); | 1496 | ent.setHomeStreet( slHomeAddress[0] ); |
1580 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1497 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1581 | //} | 1498 | //} |
1582 | 1499 | ||
1583 | //if (hasCity) { | 1500 | //if (hasCity) { |
1584 | ent.setHomeCity( slHomeAddress[3] ); | 1501 | ent.setHomeCity( slHomeAddress[3] ); |
1585 | ent.setBusinessCity( slBusinessAddress[3] ); | 1502 | ent.setBusinessCity( slBusinessAddress[3] ); |
1586 | //} | 1503 | //} |
1587 | 1504 | ||
1588 | //if (hasState) { | 1505 | //if (hasState) { |
1589 | ent.setHomeState( slHomeAddress[4] ); | 1506 | ent.setHomeState( slHomeAddress[4] ); |
1590 | ent.setBusinessState( slBusinessAddress[4] ); | 1507 | ent.setBusinessState( slBusinessAddress[4] ); |
1591 | //} | 1508 | //} |
1592 | 1509 | ||
1593 | //if (hasZip) { | 1510 | //if (hasZip) { |
1594 | ent.setHomeZip( slHomeAddress[5] ); | 1511 | ent.setHomeZip( slHomeAddress[5] ); |
1595 | ent.setBusinessZip( slBusinessAddress[5] ); | 1512 | ent.setBusinessZip( slBusinessAddress[5] ); |
1596 | //} | 1513 | //} |
1597 | 1514 | ||
1598 | //if (hasCountry) { | 1515 | //if (hasCountry) { |
1599 | ent.setHomeCountry( slHomeAddress[6] ); | 1516 | ent.setHomeCountry( slHomeAddress[6] ); |
1600 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1517 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1601 | //} | 1518 | //} |
1602 | 1519 | ||
1603 | QStringList::ConstIterator it; | 1520 | QStringList::ConstIterator it; |
1604 | QListIterator<QLineEdit> itLE( listValue ); | 1521 | QListIterator<QLineEdit> itLE( listValue ); |
1605 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { | 1522 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { |
1606 | 1523 | ||
1607 | if ( *it == "Department" ) | 1524 | if ( *it == "Department" ) |
1608 | ent.setDepartment( (*itLE)->text() ); | 1525 | ent.setDepartment( (*itLE)->text() ); |
1609 | 1526 | ||
1610 | if ( *it == "Company" ) | 1527 | if ( *it == "Company" ) |
1611 | ent.setCompany( (*itLE)->text() ); | 1528 | ent.setCompany( (*itLE)->text() ); |
1612 | 1529 | ||
1613 | if ( *it == "Office" ) | 1530 | if ( *it == "Office" ) |
1614 | ent.setOffice( (*itLE)->text() ); | 1531 | ent.setOffice( (*itLE)->text() ); |
1615 | 1532 | ||
1616 | if ( *it == "Profession" ) | 1533 | if ( *it == "Profession" ) |
1617 | ent.setProfession( (*itLE)->text() ); | 1534 | ent.setProfession( (*itLE)->text() ); |
1618 | 1535 | ||
1619 | if ( *it == "Assistant" ) | 1536 | if ( *it == "Assistant" ) |
1620 | ent.setAssistant( (*itLE)->text() ); | 1537 | ent.setAssistant( (*itLE)->text() ); |
1621 | 1538 | ||
1622 | if ( *it == "Manager" ) | 1539 | if ( *it == "Manager" ) |
1623 | ent.setManager( (*itLE)->text() ); | 1540 | ent.setManager( (*itLE)->text() ); |
1624 | 1541 | ||
1625 | if ( *it == "Spouse" ) | 1542 | if ( *it == "Spouse" ) |
1626 | ent.setSpouse( (*itLE)->text() ); | 1543 | ent.setSpouse( (*itLE)->text() ); |
1627 | 1544 | ||
1628 | if ( *it == "Nickname" ) | 1545 | if ( *it == "Nickname" ) |
1629 | ent.setNickname( (*itLE)->text() ); | 1546 | ent.setNickname( (*itLE)->text() ); |
1630 | 1547 | ||
1631 | if ( *it == "Children" ) | 1548 | if ( *it == "Children" ) |
1632 | ent.setChildren( (*itLE)->text() ); | 1549 | ent.setChildren( (*itLE)->text() ); |
1633 | 1550 | ||
1634 | } | 1551 | } |
1635 | 1552 | ||
1636 | 1553 | ||
1637 | QStringList::ConstIterator itV; | 1554 | QStringList::ConstIterator itV; |
1638 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1555 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1639 | 1556 | ||
1640 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1557 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1641 | ent.setBusinessPhone( *itV ); | 1558 | ent.setBusinessPhone( *itV ); |
1642 | 1559 | ||
1643 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1560 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1644 | ent.setBusinessFax( *itV ); | 1561 | ent.setBusinessFax( *itV ); |
1645 | 1562 | ||
1646 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1563 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1647 | ent.setBusinessMobile( *itV ); | 1564 | ent.setBusinessMobile( *itV ); |
1648 | 1565 | ||
1649 | if ( *it == "Emails" ){ | 1566 | if ( *it == "Emails" ){ |
1650 | QString allemail; | 1567 | QString allemail; |
1651 | QString defaultmail; | 1568 | QString defaultmail; |
1652 | parseEmailFrom( emails.join(","), defaultmail, allemail ); | 1569 | parseEmailFrom( emails.join(","), defaultmail, allemail ); |
1653 | if ( defaultEmail.isEmpty() ){ | 1570 | if ( defaultEmail.isEmpty() ){ |
1654 | qWarning("Default email was not set by user!"); | 1571 | qWarning("Default email was not set by user!"); |
1655 | qWarning("Using first email in list: %s", defaultmail.latin1()); | 1572 | qWarning("Using first email in list: %s", defaultmail.latin1()); |
1656 | ent.setDefaultEmail( defaultmail ); | 1573 | ent.setDefaultEmail( defaultmail ); |
1657 | } | 1574 | } |
1658 | ent.setEmails( allemail ); | 1575 | ent.setEmails( allemail ); |
1659 | } | 1576 | } |
1660 | 1577 | ||
1661 | if ( *it == "Default Email") | 1578 | if ( *it == "Default Email") |
1662 | ent.setDefaultEmail( defaultEmail /* *itV */ ); | 1579 | ent.setDefaultEmail( defaultEmail /* *itV */ ); |
1663 | 1580 | ||
1664 | if ( *it == "Home Phone" ) | 1581 | if ( *it == "Home Phone" ) |
1665 | ent.setHomePhone( *itV ); | 1582 | ent.setHomePhone( *itV ); |
1666 | 1583 | ||
1667 | if ( *it == "Home Fax" ) | 1584 | if ( *it == "Home Fax" ) |
1668 | ent.setHomeFax( *itV ); | 1585 | ent.setHomeFax( *itV ); |
1669 | 1586 | ||
1670 | if ( *it == "Home Mobile" ) | 1587 | if ( *it == "Home Mobile" ) |
1671 | ent.setHomeMobile( *itV ); | 1588 | ent.setHomeMobile( *itV ); |
1672 | 1589 | ||
1673 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1590 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1674 | ent.setBusinessPager( *itV ); | 1591 | ent.setBusinessPager( *itV ); |
1675 | 1592 | ||
1676 | if ( *it == "Home Web Page" ) | 1593 | if ( *it == "Home Web Page" ) |
1677 | ent.setHomeWebpage( *itV ); | 1594 | ent.setHomeWebpage( *itV ); |
1678 | 1595 | ||
1679 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1596 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1680 | ent.setBusinessWebpage( *itV ); | 1597 | ent.setBusinessWebpage( *itV ); |
1681 | 1598 | ||
1682 | 1599 | ||
1683 | } | 1600 | } |
1684 | 1601 | ||
1685 | int gender = cmbGender->currentItem(); | 1602 | int gender = cmbGender->currentItem(); |
1686 | ent.setGender( QString::number( gender ) ); | 1603 | ent.setGender( QString::number( gender ) ); |
1687 | 1604 | ||
1688 | QString str = txtNote->text(); | 1605 | QString str = txtNote->text(); |
1689 | if ( !str.isNull() ) | 1606 | if ( !str.isNull() ) |
1690 | ent.setNotes( str ); | 1607 | ent.setNotes( str ); |
1691 | 1608 | ||
1692 | } | 1609 | } |
1693 | 1610 | ||
1694 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1611 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1695 | QString &strAll ) | 1612 | QString &strAll ) |
1696 | { | 1613 | { |
1697 | int where, | 1614 | int where, |
1698 | start; | 1615 | start; |
1699 | if ( txt.isEmpty() ) | 1616 | if ( txt.isEmpty() ) |
1700 | return; | 1617 | return; |
1701 | // find the first | 1618 | // find the first |
1702 | where = txt.find( ',' ); | 1619 | where = txt.find( ',' ); |
1703 | if ( where < 0 ) { | 1620 | if ( where < 0 ) { |
1704 | strDefaultEmail = txt; | 1621 | strDefaultEmail = txt; |
1705 | strAll = txt; | 1622 | strAll = txt; |
1706 | } else { | 1623 | } else { |
1707 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1624 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1708 | strAll = strDefaultEmail; | 1625 | strAll = strDefaultEmail; |
1709 | while ( where > -1 ) { | 1626 | while ( where > -1 ) { |
1710 | strAll.append(" "); | 1627 | strAll.append(" "); |
1711 | start = where; | 1628 | start = where; |
1712 | where = txt.find( ',', where + 1 ); | 1629 | where = txt.find( ',', where + 1 ); |
1713 | if ( where > - 1 ) | 1630 | if ( where > - 1 ) |
1714 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1631 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1715 | else // grab until the end... | 1632 | else // grab until the end... |
1716 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1633 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1634 | } | ||
1717 | } | 1635 | } |
1718 | } | ||
1719 | } | 1636 | } |
1720 | 1637 | ||
1721 | void parseEmailTo( const QString &strDefaultEmail, | 1638 | void parseEmailTo( const QString &strDefaultEmail, |
1722 | const QString &strOtherEmail, QString &strBack ) | 1639 | const QString &strOtherEmail, QString &strBack ) |
1723 | { | 1640 | { |
1724 | // create a comma dilimeted set of emails... | 1641 | // create a comma dilimeted set of emails... |
1725 | // use the power of short circuiting... | 1642 | // use the power of short circuiting... |
1726 | bool foundDefault = false; | 1643 | bool foundDefault = false; |
1727 | QString strTmp; | 1644 | QString strTmp; |
1728 | int start = 0; | 1645 | int start = 0; |
1729 | int where; | 1646 | int where; |
1730 | // start at the beginng. | 1647 | // start at the beginng. |
1731 | strBack = strDefaultEmail; | 1648 | strBack = strDefaultEmail; |
1732 | where = 0; | 1649 | where = 0; |
1733 | while ( where > -1 ) { | 1650 | while ( where > -1 ) { |
1734 | start = where; | 1651 | start = where; |
1735 | where = strOtherEmail.find( ' ', where + 1 ); | 1652 | where = strOtherEmail.find( ' ', where + 1 ); |
1736 | if ( where > 0 ) { | 1653 | if ( where > 0 ) { |
1737 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1654 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1738 | } else | 1655 | } else |
1739 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 1656 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
1740 | if ( foundDefault || strTmp != strDefaultEmail ) { | 1657 | if ( foundDefault || strTmp != strDefaultEmail ) { |
1741 | strBack.append( ", " ); | 1658 | strBack.append( ", " ); |
1742 | strBack.append( strTmp ); | 1659 | strBack.append( strTmp ); |
1743 | } else | 1660 | } else |
1744 | foundDefault = true; | 1661 | foundDefault = true; |
1745 | } | 1662 | } |
1746 | } | 1663 | } |
1747 | 1664 | ||
1748 | 1665 | ||
1749 | static inline bool containsAlphaNum( const QString &str ) | 1666 | static inline bool containsAlphaNum( const QString &str ) |
1750 | { | 1667 | { |
1751 | int i, | 1668 | int i, |
1752 | count = str.length(); | 1669 | count = str.length(); |
1753 | for ( i = 0; i < count; i++ ) | 1670 | for ( i = 0; i < count; i++ ) |
1754 | if ( !str[i].isSpace() ) | 1671 | if ( !str[i].isSpace() ) |
1755 | return TRUE; | 1672 | return TRUE; |
1756 | return FALSE; | 1673 | return FALSE; |
1757 | } | 1674 | } |
1758 | 1675 | ||
1759 | static inline bool constainsWhiteSpace( const QString &str ) | 1676 | static inline bool constainsWhiteSpace( const QString &str ) |
1760 | { | 1677 | { |
1761 | int i, | 1678 | int i, |
1762 | count = str.length(); | 1679 | count = str.length(); |
1763 | for (i = 0; i < count; i++ ) | 1680 | for (i = 0; i < count; i++ ) |
1764 | if ( str[i].isSpace() ) | 1681 | if ( str[i].isSpace() ) |
1765 | return TRUE; | 1682 | return TRUE; |
1766 | return FALSE; | 1683 | return FALSE; |
1767 | } | 1684 | } |
1768 | 1685 | ||
1769 | void ContactEditor::setPersonalView( bool personal ) | 1686 | void ContactEditor::setPersonalView( bool personal ) |
1770 | { | 1687 | { |
1771 | m_personalView = personal; | 1688 | m_personalView = personal; |
1772 | 1689 | ||
1773 | // Currently disbled due to the fact that | 1690 | // Currently disbled due to the fact that |
1774 | // show will not work... | 1691 | // show will not work... |
1775 | return; | 1692 | return; |
1776 | 1693 | ||
1777 | if ( personal ){ | 1694 | if ( personal ){ |
1778 | cmbCat->hide(); | 1695 | cmbCat->hide(); |
1779 | labCat->hide(); | 1696 | labCat->hide(); |
1780 | 1697 | ||
1781 | } else{ | 1698 | } else{ |
1782 | cmbCat->show(); | 1699 | cmbCat->show(); |
1783 | labCat->show(); | 1700 | labCat->show(); |
1784 | } | 1701 | } |
1785 | } | 1702 | } |
1786 | 1703 | ||
1787 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) | 1704 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) |
1788 | { | 1705 | { |
1789 | QDate date; | 1706 | QDate date; |
1790 | date.setYMD( year, month, day ); | 1707 | date.setYMD( year, month, day ); |
1791 | QString dateString = TimeString::numberDateString( date ); | 1708 | QString dateString = TimeString::numberDateString( date ); |
1792 | anniversaryButton->setText( dateString ); | 1709 | anniversaryButton->setText( dateString ); |
1793 | ent.setAnniversary ( date ); | 1710 | ent.setAnniversary ( date ); |
1794 | } | 1711 | } |
1795 | 1712 | ||
1796 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) | 1713 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) |
1797 | { | 1714 | { |
1798 | QDate date; | 1715 | QDate date; |
1799 | date.setYMD( year, month, day ); | 1716 | date.setYMD( year, month, day ); |
1800 | QString dateString = TimeString::numberDateString( date ); | 1717 | QString dateString = TimeString::numberDateString( date ); |
1801 | birthdayButton->setText( dateString ); | 1718 | birthdayButton->setText( dateString ); |
1802 | ent.setBirthday ( date ); | 1719 | ent.setBirthday ( date ); |
1803 | } | 1720 | } |
1804 | 1721 | ||
1805 | void ContactEditor::slotRemoveBirthday() | 1722 | void ContactEditor::slotRemoveBirthday() |
1806 | { | 1723 | { |
1807 | qWarning("void ContactEditor::slotRemoveBirthday()"); | 1724 | qWarning("void ContactEditor::slotRemoveBirthday()"); |
1808 | ent.setBirthday( QDate() ); | 1725 | ent.setBirthday( QDate() ); |
1809 | updateDatePicker(); | 1726 | updateDatePicker(); |
1810 | } | 1727 | } |
1811 | 1728 | ||
1812 | void ContactEditor::slotRemoveAnniversary() | 1729 | void ContactEditor::slotRemoveAnniversary() |
1813 | { | 1730 | { |
1814 | qWarning("void ContactEditor::slotRemoveAnniversary()"); | 1731 | qWarning("void ContactEditor::slotRemoveAnniversary()"); |
1815 | ent.setAnniversary( QDate() ); | 1732 | ent.setAnniversary( QDate() ); |
1816 | updateDatePicker(); | 1733 | updateDatePicker(); |
1817 | } | 1734 | } |
diff --git a/core/pim/addressbook/version.h b/core/pim/addressbook/version.h index 3becfdc..c2ead05 100644 --- a/core/pim/addressbook/version.h +++ b/core/pim/addressbook/version.h | |||
@@ -1,10 +1,10 @@ | |||
1 | #ifndef _VERSION_H_ | 1 | #ifndef _VERSION_H_ |
2 | #define _VERSION_H_ | 2 | #define _VERSION_H_ |
3 | 3 | ||
4 | #define MAINVERSION "0" | 4 | #define MAINVERSION "0" |
5 | #define SUBVERSION "2" | 5 | #define SUBVERSION "3" |
6 | #define PATCHVERSION "2" | 6 | #define PATCHVERSION "0" |
7 | 7 | ||
8 | #define APPNAME "OPIE_ADDRESSBOOK" | 8 | #define APPNAME "OPIE_ADDRESSBOOK" |
9 | 9 | ||
10 | #endif | 10 | #endif |