-rw-r--r-- | libopie/pim/ocontact.cpp | 5 | ||||
-rw-r--r-- | libopie2/opiepim/ocontact.cpp | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp index 8a0930b..b0f0d7f 100644 --- a/libopie/pim/ocontact.cpp +++ b/libopie/pim/ocontact.cpp | |||
@@ -1139,33 +1139,33 @@ static VObject *createVObject( const OContact &c ) | |||
1139 | } | 1139 | } |
1140 | 1140 | ||
1141 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { | 1141 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { |
1142 | VObject *org = safeAddProp( vcard, VCOrgProp ); | 1142 | VObject *org = safeAddProp( vcard, VCOrgProp ); |
1143 | safeAddPropValue( org, VCOrgNameProp, c.company() ); | 1143 | safeAddPropValue( org, VCOrgNameProp, c.company() ); |
1144 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); | 1144 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); |
1145 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); | 1145 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | // some values we have to export as custom fields | 1148 | // some values we have to export as custom fields |
1149 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); | 1149 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); |
1150 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); | 1150 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); |
1151 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); | 1151 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); |
1152 | 1152 | ||
1153 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); | 1153 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); |
1154 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); | 1154 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); |
1155 | safeAddPropValue( vcard, "X-Qtopia-Anniversary", TimeConversion::toString( c.anniversary() ) ); | 1155 | // safeAddPropValue( vcard, "X-Qtopia-Anniversary", TimeConversion::toString( c.anniversary() ) ); :SX |
1156 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); | 1156 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); |
1157 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); | 1157 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); |
1158 | 1158 | ||
1159 | return vcard; | 1159 | return vcard; |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | 1162 | ||
1163 | /*! | 1163 | /*! |
1164 | \internal | 1164 | \internal |
1165 | */ | 1165 | */ |
1166 | static QDate convVCardDateToDate( const QString& datestr ) | 1166 | static QDate convVCardDateToDate( const QString& datestr ) |
1167 | { | 1167 | { |
1168 | int monthPos = datestr.find('-'); | 1168 | int monthPos = datestr.find('-'); |
1169 | int dayPos = datestr.find('-', monthPos+1 ); | 1169 | int dayPos = datestr.find('-', monthPos+1 ); |
1170 | int sep_ignore = 1; | 1170 | int sep_ignore = 1; |
1171 | if ( monthPos == -1 || dayPos == -1 ) { | 1171 | if ( monthPos == -1 || dayPos == -1 ) { |
@@ -1218,32 +1218,33 @@ static OContact parseVObject( VObject *obj ) | |||
1218 | } | 1218 | } |
1219 | } | 1219 | } |
1220 | else if ( name == VCAdrProp ) { | 1220 | else if ( name == VCAdrProp ) { |
1221 | bool work = TRUE; // default address is work address | 1221 | bool work = TRUE; // default address is work address |
1222 | QString street; | 1222 | QString street; |
1223 | QString city; | 1223 | QString city; |
1224 | QString region; | 1224 | QString region; |
1225 | QString postal; | 1225 | QString postal; |
1226 | QString country; | 1226 | QString country; |
1227 | 1227 | ||
1228 | VObjectIterator nit; | 1228 | VObjectIterator nit; |
1229 | initPropIterator( &nit, o ); | 1229 | initPropIterator( &nit, o ); |
1230 | while( moreIteration( &nit ) ) { | 1230 | while( moreIteration( &nit ) ) { |
1231 | VObject *o = nextVObject( &nit ); | 1231 | VObject *o = nextVObject( &nit ); |
1232 | QCString name = vObjectName( o ); | 1232 | QCString name = vObjectName( o ); |
1233 | QString value = vObjectStringZValue( o ); | 1233 | QString value = vObjectStringZValue( o ); |
1234 | |||
1234 | if ( name == VCHomeProp ) | 1235 | if ( name == VCHomeProp ) |
1235 | work = FALSE; | 1236 | work = FALSE; |
1236 | else if ( name == VCWorkProp ) | 1237 | else if ( name == VCWorkProp ) |
1237 | work = TRUE; | 1238 | work = TRUE; |
1238 | else if ( name == VCStreetAddressProp ) | 1239 | else if ( name == VCStreetAddressProp ) |
1239 | street = value; | 1240 | street = value; |
1240 | else if ( name == VCCityProp ) | 1241 | else if ( name == VCCityProp ) |
1241 | city = value; | 1242 | city = value; |
1242 | else if ( name == VCRegionProp ) | 1243 | else if ( name == VCRegionProp ) |
1243 | region = value; | 1244 | region = value; |
1244 | else if ( name == VCPostalCodeProp ) | 1245 | else if ( name == VCPostalCodeProp ) |
1245 | postal = value; | 1246 | postal = value; |
1246 | else if ( name == VCCountryNameProp ) | 1247 | else if ( name == VCCountryNameProp ) |
1247 | country = value; | 1248 | country = value; |
1248 | } | 1249 | } |
1249 | if ( work ) { | 1250 | if ( work ) { |
@@ -1367,33 +1368,33 @@ static OContact parseVObject( VObject *obj ) | |||
1367 | else if ( name == "X-Qtopia-Profession" ) { | 1368 | else if ( name == "X-Qtopia-Profession" ) { |
1368 | c.setProfession( value ); | 1369 | c.setProfession( value ); |
1369 | } | 1370 | } |
1370 | else if ( name == "X-Qtopia-Manager" ) { | 1371 | else if ( name == "X-Qtopia-Manager" ) { |
1371 | c.setManager( value ); | 1372 | c.setManager( value ); |
1372 | } | 1373 | } |
1373 | else if ( name == "X-Qtopia-Assistant" ) { | 1374 | else if ( name == "X-Qtopia-Assistant" ) { |
1374 | c.setAssistant( value ); | 1375 | c.setAssistant( value ); |
1375 | } | 1376 | } |
1376 | else if ( name == "X-Qtopia-Spouse" ) { | 1377 | else if ( name == "X-Qtopia-Spouse" ) { |
1377 | c.setSpouse( value ); | 1378 | c.setSpouse( value ); |
1378 | } | 1379 | } |
1379 | else if ( name == "X-Qtopia-Gender" ) { | 1380 | else if ( name == "X-Qtopia-Gender" ) { |
1380 | c.setGender( value ); | 1381 | c.setGender( value ); |
1381 | } | 1382 | } |
1382 | else if ( name == "X-Qtopia-Anniversary" ) { | 1383 | else if ( name == "X-Qtopia-Anniversary" ) { |
1383 | c.setAnniversary( TimeConversion::fromString( value ) ); | 1384 | // c.setAnniversary( TimeConversion::fromString( value ) ); :SX |
1384 | } | 1385 | } |
1385 | else if ( name == "X-Qtopia-Nickname" ) { | 1386 | else if ( name == "X-Qtopia-Nickname" ) { |
1386 | c.setNickname( value ); | 1387 | c.setNickname( value ); |
1387 | } | 1388 | } |
1388 | else if ( name == "X-Qtopia-Children" ) { | 1389 | else if ( name == "X-Qtopia-Children" ) { |
1389 | c.setChildren( value ); | 1390 | c.setChildren( value ); |
1390 | } | 1391 | } |
1391 | else if ( name == VCBirthDateProp ) { | 1392 | else if ( name == VCBirthDateProp ) { |
1392 | // Reading Birthdate regarding RFC 2425 (5.8.4) | 1393 | // Reading Birthdate regarding RFC 2425 (5.8.4) |
1393 | c.setBirthday( convVCardDateToDate( value ) ); | 1394 | c.setBirthday( convVCardDateToDate( value ) ); |
1394 | 1395 | ||
1395 | } | 1396 | } |
1396 | 1397 | ||
1397 | #if 0 | 1398 | #if 0 |
1398 | else { | 1399 | else { |
1399 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); | 1400 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); |
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp index 8a0930b..b0f0d7f 100644 --- a/libopie2/opiepim/ocontact.cpp +++ b/libopie2/opiepim/ocontact.cpp | |||
@@ -1139,33 +1139,33 @@ static VObject *createVObject( const OContact &c ) | |||
1139 | } | 1139 | } |
1140 | 1140 | ||
1141 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { | 1141 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { |
1142 | VObject *org = safeAddProp( vcard, VCOrgProp ); | 1142 | VObject *org = safeAddProp( vcard, VCOrgProp ); |
1143 | safeAddPropValue( org, VCOrgNameProp, c.company() ); | 1143 | safeAddPropValue( org, VCOrgNameProp, c.company() ); |
1144 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); | 1144 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); |
1145 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); | 1145 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | // some values we have to export as custom fields | 1148 | // some values we have to export as custom fields |
1149 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); | 1149 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); |
1150 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); | 1150 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); |
1151 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); | 1151 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); |
1152 | 1152 | ||
1153 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); | 1153 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); |
1154 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); | 1154 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); |
1155 | safeAddPropValue( vcard, "X-Qtopia-Anniversary", TimeConversion::toString( c.anniversary() ) ); | 1155 | // safeAddPropValue( vcard, "X-Qtopia-Anniversary", TimeConversion::toString( c.anniversary() ) ); :SX |
1156 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); | 1156 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); |
1157 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); | 1157 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); |
1158 | 1158 | ||
1159 | return vcard; | 1159 | return vcard; |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | 1162 | ||
1163 | /*! | 1163 | /*! |
1164 | \internal | 1164 | \internal |
1165 | */ | 1165 | */ |
1166 | static QDate convVCardDateToDate( const QString& datestr ) | 1166 | static QDate convVCardDateToDate( const QString& datestr ) |
1167 | { | 1167 | { |
1168 | int monthPos = datestr.find('-'); | 1168 | int monthPos = datestr.find('-'); |
1169 | int dayPos = datestr.find('-', monthPos+1 ); | 1169 | int dayPos = datestr.find('-', monthPos+1 ); |
1170 | int sep_ignore = 1; | 1170 | int sep_ignore = 1; |
1171 | if ( monthPos == -1 || dayPos == -1 ) { | 1171 | if ( monthPos == -1 || dayPos == -1 ) { |
@@ -1218,32 +1218,33 @@ static OContact parseVObject( VObject *obj ) | |||
1218 | } | 1218 | } |
1219 | } | 1219 | } |
1220 | else if ( name == VCAdrProp ) { | 1220 | else if ( name == VCAdrProp ) { |
1221 | bool work = TRUE; // default address is work address | 1221 | bool work = TRUE; // default address is work address |
1222 | QString street; | 1222 | QString street; |
1223 | QString city; | 1223 | QString city; |
1224 | QString region; | 1224 | QString region; |
1225 | QString postal; | 1225 | QString postal; |
1226 | QString country; | 1226 | QString country; |
1227 | 1227 | ||
1228 | VObjectIterator nit; | 1228 | VObjectIterator nit; |
1229 | initPropIterator( &nit, o ); | 1229 | initPropIterator( &nit, o ); |
1230 | while( moreIteration( &nit ) ) { | 1230 | while( moreIteration( &nit ) ) { |
1231 | VObject *o = nextVObject( &nit ); | 1231 | VObject *o = nextVObject( &nit ); |
1232 | QCString name = vObjectName( o ); | 1232 | QCString name = vObjectName( o ); |
1233 | QString value = vObjectStringZValue( o ); | 1233 | QString value = vObjectStringZValue( o ); |
1234 | |||
1234 | if ( name == VCHomeProp ) | 1235 | if ( name == VCHomeProp ) |
1235 | work = FALSE; | 1236 | work = FALSE; |
1236 | else if ( name == VCWorkProp ) | 1237 | else if ( name == VCWorkProp ) |
1237 | work = TRUE; | 1238 | work = TRUE; |
1238 | else if ( name == VCStreetAddressProp ) | 1239 | else if ( name == VCStreetAddressProp ) |
1239 | street = value; | 1240 | street = value; |
1240 | else if ( name == VCCityProp ) | 1241 | else if ( name == VCCityProp ) |
1241 | city = value; | 1242 | city = value; |
1242 | else if ( name == VCRegionProp ) | 1243 | else if ( name == VCRegionProp ) |
1243 | region = value; | 1244 | region = value; |
1244 | else if ( name == VCPostalCodeProp ) | 1245 | else if ( name == VCPostalCodeProp ) |
1245 | postal = value; | 1246 | postal = value; |
1246 | else if ( name == VCCountryNameProp ) | 1247 | else if ( name == VCCountryNameProp ) |
1247 | country = value; | 1248 | country = value; |
1248 | } | 1249 | } |
1249 | if ( work ) { | 1250 | if ( work ) { |
@@ -1367,33 +1368,33 @@ static OContact parseVObject( VObject *obj ) | |||
1367 | else if ( name == "X-Qtopia-Profession" ) { | 1368 | else if ( name == "X-Qtopia-Profession" ) { |
1368 | c.setProfession( value ); | 1369 | c.setProfession( value ); |
1369 | } | 1370 | } |
1370 | else if ( name == "X-Qtopia-Manager" ) { | 1371 | else if ( name == "X-Qtopia-Manager" ) { |
1371 | c.setManager( value ); | 1372 | c.setManager( value ); |
1372 | } | 1373 | } |
1373 | else if ( name == "X-Qtopia-Assistant" ) { | 1374 | else if ( name == "X-Qtopia-Assistant" ) { |
1374 | c.setAssistant( value ); | 1375 | c.setAssistant( value ); |
1375 | } | 1376 | } |
1376 | else if ( name == "X-Qtopia-Spouse" ) { | 1377 | else if ( name == "X-Qtopia-Spouse" ) { |
1377 | c.setSpouse( value ); | 1378 | c.setSpouse( value ); |
1378 | } | 1379 | } |
1379 | else if ( name == "X-Qtopia-Gender" ) { | 1380 | else if ( name == "X-Qtopia-Gender" ) { |
1380 | c.setGender( value ); | 1381 | c.setGender( value ); |
1381 | } | 1382 | } |
1382 | else if ( name == "X-Qtopia-Anniversary" ) { | 1383 | else if ( name == "X-Qtopia-Anniversary" ) { |
1383 | c.setAnniversary( TimeConversion::fromString( value ) ); | 1384 | // c.setAnniversary( TimeConversion::fromString( value ) ); :SX |
1384 | } | 1385 | } |
1385 | else if ( name == "X-Qtopia-Nickname" ) { | 1386 | else if ( name == "X-Qtopia-Nickname" ) { |
1386 | c.setNickname( value ); | 1387 | c.setNickname( value ); |
1387 | } | 1388 | } |
1388 | else if ( name == "X-Qtopia-Children" ) { | 1389 | else if ( name == "X-Qtopia-Children" ) { |
1389 | c.setChildren( value ); | 1390 | c.setChildren( value ); |
1390 | } | 1391 | } |
1391 | else if ( name == VCBirthDateProp ) { | 1392 | else if ( name == VCBirthDateProp ) { |
1392 | // Reading Birthdate regarding RFC 2425 (5.8.4) | 1393 | // Reading Birthdate regarding RFC 2425 (5.8.4) |
1393 | c.setBirthday( convVCardDateToDate( value ) ); | 1394 | c.setBirthday( convVCardDateToDate( value ) ); |
1394 | 1395 | ||
1395 | } | 1396 | } |
1396 | 1397 | ||
1397 | #if 0 | 1398 | #if 0 |
1398 | else { | 1399 | else { |
1399 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); | 1400 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); |