summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 254cff7..1b83308 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -26,95 +26,116 @@
26#include <qpe/categoryselect.h> 26#include <qpe/categoryselect.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/qpedialog.h> 28#include <qpe/qpedialog.h>
29#include <qpe/timeconversion.h> 29#include <qpe/timeconversion.h>
30#include <opie/ocontact.h> 30#include <opie/ocontact.h>
31#include <qpe/resource.h> 31#include <qpe/resource.h>
32 32
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qlabel.h> 34#include <qlabel.h>
35#include <qtabwidget.h> 35#include <qtabwidget.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qmultilineedit.h> 38#include <qmultilineedit.h>
39#include <qscrollview.h> 39#include <qscrollview.h>
40#include <qtoolbutton.h> 40#include <qtoolbutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qmainwindow.h> 42#include <qmainwindow.h>
43#include <qvaluelist.h> 43#include <qvaluelist.h>
44#include <qpopupmenu.h> 44#include <qpopupmenu.h>
45#include <qlistbox.h> 45#include <qlistbox.h>
46#include <qhbox.h> 46#include <qhbox.h>
47#include <qaction.h> 47#include <qaction.h>
48#include <qiconset.h> 48#include <qiconset.h>
49 49
50#include <assert.h>
51
50static inline bool containsAlphaNum( const QString &str ); 52static inline bool containsAlphaNum( const QString &str );
51static inline bool constainsWhiteSpace( const QString &str ); 53static inline bool constainsWhiteSpace( const QString &str );
52 54
53// helper functions, convert our comma delimited list to proper 55// helper functions, convert our comma delimited list to proper
54// file format... 56// file format...
55void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 57void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
56 QString &strAll ); 58 QString &strAll );
57 59
58// helper convert from file format to comma delimited... 60// helper convert from file format to comma delimited...
59void parseEmailTo( const QString &strDefaultEmail, 61void parseEmailTo( const QString &strDefaultEmail,
60 const QString &strOtherEmail, QString &strBack ); 62 const QString &strOtherEmail, QString &strBack );
61 63
62 ContactEditor::ContactEditor(const OContact &entry, 64 ContactEditor::ContactEditor(const OContact &entry,
63 QWidget *parent, 65 QWidget *parent,
64 const char *name, 66 const char *name,
65 WFlags fl ) 67 WFlags fl )
66 : QDialog( parent, name, TRUE, fl ), 68 : QDialog( parent, name, TRUE, fl ),
67 m_personalView ( false ) 69 m_personalView ( false )
68 70
69{ 71{
70 72
71 init(); 73 init();
72 setEntry( entry ); 74 setEntry( entry );
73 cmbDefaultEmail = 0; 75 cmbDefaultEmail = 0;
74 defaultEmailChooserPosition = -1; 76 defaultEmailChooserPosition = -1;
75} 77}
76 78
77ContactEditor::~ContactEditor() { 79ContactEditor::~ContactEditor() {
78} 80}
79 81
80void ContactEditor::init() { 82void ContactEditor::init() {
81 83
82 useFullName = true; 84 useFullName = true;
83 85
84 uint i = 0; 86 uint i = 0;
85 87
86 QStringList trlChooserNames; 88 QStringList trlChooserNames;
87 89
88 for (i = 0; i <= 6; i++) { 90 for (i = 0; i <= 6; i++) {
89 slHomeAddress.append( "" ); 91 slHomeAddress.append( "" );
90 slBusinessAddress.append( "" ); 92 slBusinessAddress.append( "" );
91 } 93 }
92 94
93 trlChooserNames = OContactFields::trphonefields( false ); 95 trlChooserNames = OContactFields::trphonefields( false );
94 slChooserNames = OContactFields::untrphonefields( false ); 96 slChooserNames = OContactFields::untrphonefields( false );
95 slDynamicEntries = OContactFields::untrdetailsfields( false ); 97 slDynamicEntries = OContactFields::untrdetailsfields( false );
96 trlDynamicEntries = OContactFields::trdetailsfields( false ); 98 trlDynamicEntries = OContactFields::trdetailsfields( false );
99
100 // Ok, we have to remove elements from the list of dynamic entries
101 // which are now stored in special (not dynamic) widgets..
102 // Otherwise we will get problems with field assignments! (se)
103 slDynamicEntries.remove("Anniversary");
104 slDynamicEntries.remove("Birthday");
105 slDynamicEntries.remove("Gender");
106
107 // The same with translated fields.. But I will
108 // use the translation map to avoid mismatches..
109 QMap<int, QString> translMap = OContactFields::idToTrFields();
110 trlDynamicEntries.remove( translMap[Qtopia::Anniversary] );
111 trlDynamicEntries.remove( translMap[Qtopia::Birthday] );
112 trlDynamicEntries.remove( translMap[Qtopia::Gender] );
113
114 // Last Check to be sure..
115 assert( slDynamicEntries.count() == trlDynamicEntries.count() );
116 assert( slChooserNames.count() == trlChooserNames.count() );
117
97 for (i = 0; i < slChooserNames.count(); i++) 118 for (i = 0; i < slChooserNames.count(); i++)
98 slChooserValues.append(""); 119 slChooserValues.append("");
99 120
100 121
101 QVBoxLayout *vb = new QVBoxLayout( this ); 122 QVBoxLayout *vb = new QVBoxLayout( this );
102 123
103 tabMain = new QTabWidget( this ); 124 tabMain = new QTabWidget( this );
104 vb->addWidget( tabMain ); 125 vb->addWidget( tabMain );
105 126
106 QWidget *tabViewport = new QWidget ( tabMain ); 127 QWidget *tabViewport = new QWidget ( tabMain );
107 128
108 vb = new QVBoxLayout( tabViewport ); 129 vb = new QVBoxLayout( tabViewport );
109 130
110 svGeneral = new QScrollView( tabViewport ); 131 svGeneral = new QScrollView( tabViewport );
111 vb->addWidget( svGeneral, 0, 0 ); 132 vb->addWidget( svGeneral, 0, 0 );
112 svGeneral->setResizePolicy( QScrollView::AutoOneFit ); 133 svGeneral->setResizePolicy( QScrollView::AutoOneFit );
113 svGeneral->setFrameStyle( QFrame::NoFrame ); 134 svGeneral->setFrameStyle( QFrame::NoFrame );
114 135
115 QWidget *container = new QWidget( svGeneral->viewport() ); 136 QWidget *container = new QWidget( svGeneral->viewport() );
116 svGeneral->addChild( container ); 137 svGeneral->addChild( container );
117 138
118 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); 139 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
119 gl->setResizeMode( QLayout::FreeResize ); 140 gl->setResizeMode( QLayout::FreeResize );
120 141
@@ -1155,71 +1176,76 @@ void ContactEditor::setEntry( const OContact &entry ) {
1155 1176
1156 //if (hasCity) { 1177 //if (hasCity) {
1157 slHomeAddress[3] = ent.homeCity(); 1178 slHomeAddress[3] = ent.homeCity();
1158 slBusinessAddress[3] = ent.businessCity(); 1179 slBusinessAddress[3] = ent.businessCity();
1159//} 1180//}
1160 1181
1161//if (hasState) { 1182//if (hasState) {
1162 slHomeAddress[4] = ent.homeState(); 1183 slHomeAddress[4] = ent.homeState();
1163 slBusinessAddress[4] = ent.businessState(); 1184 slBusinessAddress[4] = ent.businessState();
1164//} 1185//}
1165 1186
1166//if (hasZip) { 1187//if (hasZip) {
1167 slHomeAddress[5] = ent.homeZip(); 1188 slHomeAddress[5] = ent.homeZip();
1168 slBusinessAddress[5] = ent.businessZip(); 1189 slBusinessAddress[5] = ent.businessZip();
1169//} 1190//}
1170 1191
1171//if (hasCountry) { 1192//if (hasCountry) {
1172 slHomeAddress[6] = ent.homeCountry(); 1193 slHomeAddress[6] = ent.homeCountry();
1173 slBusinessAddress[6] = ent.businessCountry(); 1194 slBusinessAddress[6] = ent.businessCountry();
1174//} 1195//}
1175 1196
1176 QStringList::ConstIterator it; 1197 QStringList::ConstIterator it;
1177 QListIterator<QLineEdit> itLE( listValue ); 1198 QListIterator<QLineEdit> itLE( listValue );
1178 for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { 1199 for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) {
1200
1201 qWarning(" Filling dynamic Field: %s", (*it).latin1() );
1202
1179 if ( *it == "Department" ) 1203 if ( *it == "Department" )
1180 (*itLE)->setText( ent.department() ); 1204 (*itLE)->setText( ent.department() );
1181 1205
1182 if ( *it == "Company" ) 1206 if ( *it == "Company" )
1183 (*itLE)->setText( ent.company() ); 1207 (*itLE)->setText( ent.company() );
1184 1208
1185 if ( *it == "Office" ) 1209 if ( *it == "Office" )
1186 (*itLE)->setText( ent.office() ); 1210 (*itLE)->setText( ent.office() );
1187 1211
1188 if ( *it == "Profession" ) 1212 if ( *it == "Profession" )
1189 (*itLE)->setText( ent.profession() ); 1213 (*itLE)->setText( ent.profession() );
1190 1214
1191 if ( *it == "Assistant" ) 1215 if ( *it == "Assistant" )
1192 (*itLE)->setText( ent.assistant() ); 1216 (*itLE)->setText( ent.assistant() );
1193 1217
1194 if ( *it == "Manager" ) 1218 if ( *it == "Manager" )
1195 (*itLE)->setText( ent.manager() ); 1219 (*itLE)->setText( ent.manager() );
1196 1220
1197 if ( *it == "Spouse" ) 1221 if ( *it == "Spouse" )
1198 (*itLE)->setText( ent.spouse() ); 1222 (*itLE)->setText( ent.spouse() );
1199 1223
1200 if ( *it == "Nickname" ) 1224 if ( *it == "Nickname" ){
1225 qWarning("**** Nichname: %s", ent.nickname().latin1() );
1201 (*itLE)->setText( ent.nickname() ); 1226 (*itLE)->setText( ent.nickname() );
1227 }
1202 1228
1203 if ( *it == "Children" ) 1229 if ( *it == "Children" )
1204 (*itLE)->setText( ent.children() ); 1230 (*itLE)->setText( ent.children() );
1205 1231
1206 } 1232 }
1207 1233
1208 QStringList::Iterator itV; 1234 QStringList::Iterator itV;
1209 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1235 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1210 1236
1211 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) 1237 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) )
1212 *itV = ent.businessPhone(); 1238 *itV = ent.businessPhone();
1213/* 1239/*
1214 if ( *it == "Business 2 Phone" ) 1240 if ( *it == "Business 2 Phone" )
1215 *itV = ent.business2Phone(); 1241 *itV = ent.business2Phone();
1216*/ 1242*/
1217 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) 1243 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) )
1218 *itV = ent.businessFax(); 1244 *itV = ent.businessFax();
1219 1245
1220 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) 1246 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) )
1221 *itV = ent.businessMobile(); 1247 *itV = ent.businessMobile();
1222/* 1248/*
1223 if ( *it == "Company Phone" ) 1249 if ( *it == "Company Phone" )
1224 *itV = ent.companyPhone(); 1250 *itV = ent.companyPhone();
1225*/ 1251*/