-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 | |||
@@ -29,7 +29,6 @@ Urgent: | |||
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 | ---------- |
@@ -114,3 +113,4 @@ Fixed/Ready: | |||
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 | |||
@@ -157,61 +157,66 @@ void ContactEditor::init() { | |||
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 | ||
@@ -618,10 +623,10 @@ void ContactEditor::init() { | |||
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 ); |
@@ -1015,14 +1020,16 @@ void ContactEditor::slotAddressTypeChange( int index ) { | |||
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 | ||
@@ -1058,7 +1065,7 @@ void ContactEditor::slotName() { | |||
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() ) { |
@@ -1102,194 +1109,99 @@ QString ContactEditor::parseName( const QString fullName, int type ) { | |||
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( "" ); |
@@ -1314,192 +1226,197 @@ void ContactEditor::cleanupFields() { | |||
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 ! |
@@ -1507,7 +1424,7 @@ void ContactEditor::setEntry( const OContact &entry ) { | |||
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) ); |
@@ -1520,9 +1437,9 @@ void ContactEditor::setEntry( const OContact &entry ) { | |||
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() |
@@ -1533,119 +1450,119 @@ void ContactEditor::updateDatePicker() | |||
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; |
@@ -1657,113 +1574,113 @@ void ContactEditor::saveEntry() { | |||
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 ) |
@@ -1773,11 +1690,11 @@ void ContactEditor::setPersonalView( bool personal ) | |||
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(); |
@@ -1786,20 +1703,20 @@ void ContactEditor::setPersonalView( bool personal ) | |||
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() |
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 | |||
@@ -2,8 +2,8 @@ | |||
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 | ||