summaryrefslogtreecommitdiff
authorsimon <simon>2002-04-30 06:26:17 (UTC)
committer simon <simon>2002-04-30 06:26:17 (UTC)
commitf521dd69afdd07f46e41299846880289b727514b (patch) (unidiff)
tree1e9fe07ead05cf0ddfbf34438f4e2d85c1e87380
parent702c4b745d42d9ad5fdcede0a40d85ea1b0577a6 (diff)
downloadopie-f521dd69afdd07f46e41299846880289b727514b.zip
opie-f521dd69afdd07f46e41299846880289b727514b.tar.gz
opie-f521dd69afdd07f46e41299846880289b727514b.tar.bz2
- no default arguments in method implementations
- don't return void in non-void functions
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index adea1a1..e74da87 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,249 +1,249 @@
1/* 1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> 2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 * 3 *
4 * This file is an add-on for the OPIE Palmtop Environment 4 * This file is an add-on for the OPIE Palmtop Environment
5 * 5 *
6 * This file may be distributed and/or modified under the terms of the 6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software 7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging 8 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
9 * of this file. 9 * of this file.
10 * 10 *
11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 * 13 *
14 * 14 *
15 * This is a rewrite of the abeditor.h file, modified to provide a more 15 * This is a rewrite of the abeditor.h file, modified to provide a more
16 * intuitive interface to TrollTech's original Address Book editor. This 16 * intuitive interface to TrollTech's original Address Book editor. This
17 * is made to operate exactly in interface with the exception of name. 17 * is made to operate exactly in interface with the exception of name.
18 * 18 *
19 */ 19 */
20 20
21#include "contacteditor.h" 21#include "contacteditor.h"
22#include "addresspicker.h" 22#include "addresspicker.h"
23 23
24#include <qpe/categoryselect.h> 24#include <qpe/categoryselect.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/qpedialog.h> 26#include <qpe/qpedialog.h>
27 27
28#include <qcombobox.h> 28#include <qcombobox.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qtabwidget.h> 30#include <qtabwidget.h>
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qmultilineedit.h> 33#include <qmultilineedit.h>
34#include <qscrollview.h> 34#include <qscrollview.h>
35#include <qtoolbutton.h> 35#include <qtoolbutton.h>
36#include <qpushbutton.h> 36#include <qpushbutton.h>
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qvaluelist.h> 38#include <qvaluelist.h>
39 39
40static inline bool containsAlphaNum( const QString &str ); 40static inline bool containsAlphaNum( const QString &str );
41static inline bool constainsWhiteSpace( const QString &str ); 41static inline bool constainsWhiteSpace( const QString &str );
42 42
43// helper functions, convert our comma delimited list to proper 43// helper functions, convert our comma delimited list to proper
44// file format... 44// file format...
45void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 45void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
46 QString &strAll ); 46 QString &strAll );
47 47
48// helper convert from file format to comma delimited... 48// helper convert from file format to comma delimited...
49void parseEmailTo( const QString &strDefaultEmail, 49void parseEmailTo( const QString &strDefaultEmail,
50 const QString &strOtherEmail, QString &strBack ); 50 const QString &strOtherEmail, QString &strBack );
51 51
52 ContactEditor::ContactEditor(const Contact &entry, 52 ContactEditor::ContactEditor(const Contact &entry,
53 const QValueList<int> *newOrderedValues, 53 const QValueList<int> *newOrderedValues,
54 QStringList *slNewOrdered, 54 QStringList *slNewOrdered,
55 QWidget *parent = 0, 55 QWidget *parent,
56 const char *name = 0, 56 const char *name,
57 WFlags fl = 0 ) 57 WFlags fl )
58 : QDialog( parent, name, TRUE, fl ), 58 : QDialog( parent, name, TRUE, fl ),
59 orderedValues( newOrderedValues ), 59 orderedValues( newOrderedValues ),
60 slOrdered( slNewOrdered ) 60 slOrdered( slNewOrdered )
61{ 61{
62 62
63 init(); 63 init();
64 initMap(); 64 initMap();
65 setEntry( entry ); 65 setEntry( entry );
66 qDebug("finish"); 66 qDebug("finish");
67} 67}
68 68
69ContactEditor::~ContactEditor() { 69ContactEditor::~ContactEditor() {
70} 70}
71 71
72void ContactEditor::init() { 72void ContactEditor::init() {
73 73
74 useFullName = TRUE; 74 useFullName = TRUE;
75 75
76 int i = 0; 76 int i = 0;
77 77
78 slHomeAddress = new QStringList; 78 slHomeAddress = new QStringList;
79 slBusinessAddress = new QStringList; 79 slBusinessAddress = new QStringList;
80 slChooserNames = new QStringList; 80 slChooserNames = new QStringList;
81 slChooserValues = new QStringList; 81 slChooserValues = new QStringList;
82 82
83 slDynamicEntries = new QStringList; 83 slDynamicEntries = new QStringList;
84 84
85 //*slDynamicEntries = *slOrdered; 85 //*slDynamicEntries = *slOrdered;
86 86
87 for (i = 0; i <= 6; i++) { 87 for (i = 0; i <= 6; i++) {
88 slHomeAddress->append( "" ); 88 slHomeAddress->append( "" );
89 slBusinessAddress->append( "" ); 89 slBusinessAddress->append( "" );
90 } 90 }
91 91
92 { 92 {
93 hasGender = FALSE; 93 hasGender = FALSE;
94 hasTitle = FALSE; 94 hasTitle = FALSE;
95 hasCompany = FALSE; 95 hasCompany = FALSE;
96 hasNotes = FALSE; 96 hasNotes = FALSE;
97 hasStreet = FALSE; 97 hasStreet = FALSE;
98 hasStreet2 = FALSE; 98 hasStreet2 = FALSE;
99 hasPOBox = FALSE; 99 hasPOBox = FALSE;
100 hasCity = FALSE; 100 hasCity = FALSE;
101 hasState = FALSE; 101 hasState = FALSE;
102 hasZip = FALSE; 102 hasZip = FALSE;
103 hasCountry = FALSE; 103 hasCountry = FALSE;
104 104
105 QStringList::ConstIterator it = slOrdered->begin(); 105 QStringList::ConstIterator it = slOrdered->begin();
106 for ( i = 0; it != slOrdered->end(); i++, ++it ) { 106 for ( i = 0; it != slOrdered->end(); i++, ++it ) {
107 107
108 if ( (*it).right( 3 ) == tr( "Fax" ) ) { 108 if ( (*it).right( 3 ) == tr( "Fax" ) ) {
109 slChooserNames->append( *it ); 109 slChooserNames->append( *it );
110 slChooserValues->append( tr( "" ) ); 110 slChooserValues->append( tr( "" ) );
111 //slDynamicEntries->remove( it ); 111 //slDynamicEntries->remove( it );
112 continue; 112 continue;
113 } 113 }
114 114
115 if ( (*it).right( 5 ) == tr( "Phone" ) ) { 115 if ( (*it).right( 5 ) == tr( "Phone" ) ) {
116 slChooserNames->append( *it ); 116 slChooserNames->append( *it );
117 slChooserValues->append( "" ); 117 slChooserValues->append( "" );
118 //slDynamicEntries->remove( it ); 118 //slDynamicEntries->remove( it );
119 continue; 119 continue;
120 } 120 }
121 121
122 if ( (*it).right( 2 ) == tr( "IM" ) ) { 122 if ( (*it).right( 2 ) == tr( "IM" ) ) {
123 slChooserNames->append( *it ); 123 slChooserNames->append( *it );
124 slChooserValues->append( "" ); 124 slChooserValues->append( "" );
125 //slDynamicEntries->remove( it ); 125 //slDynamicEntries->remove( it );
126 continue; 126 continue;
127 } 127 }
128 128
129 if ( (*it).right( 6 ) == tr( "Mobile" ) ) { 129 if ( (*it).right( 6 ) == tr( "Mobile" ) ) {
130 slChooserNames->append( *it ); 130 slChooserNames->append( *it );
131 slChooserValues->append( "" ); 131 slChooserValues->append( "" );
132 //slDynamicEntries->remove( it ); 132 //slDynamicEntries->remove( it );
133 continue; 133 continue;
134 } 134 }
135 135
136 if ( (*it).right( 4 ) == tr( "Page" ) ) { 136 if ( (*it).right( 4 ) == tr( "Page" ) ) {
137 slChooserNames->append( *it ); 137 slChooserNames->append( *it );
138 slChooserValues->append( "" ); 138 slChooserValues->append( "" );
139 //slDynamicEntries->remove( it ); 139 //slDynamicEntries->remove( it );
140 continue; 140 continue;
141 } 141 }
142 142
143 if ( (*it).right( 5 ) == tr( "Pager" ) ) { 143 if ( (*it).right( 5 ) == tr( "Pager" ) ) {
144 slChooserNames->append( *it ); 144 slChooserNames->append( *it );
145 slChooserValues->append( "" ); 145 slChooserValues->append( "" );
146 //slDynamicEntries->remove( it ); 146 //slDynamicEntries->remove( it );
147 continue; 147 continue;
148 } 148 }
149 149
150 if ( *it == tr( "Default Email" ) ) { 150 if ( *it == tr( "Default Email" ) ) {
151 slChooserNames->append( *it ); 151 slChooserNames->append( *it );
152 slChooserValues->append( "" ); 152 slChooserValues->append( "" );
153 //slDynamicEntries->remove( it ); 153 //slDynamicEntries->remove( it );
154 continue; 154 continue;
155 } 155 }
156 156
157 if ( *it == tr( "Emails" ) ) { 157 if ( *it == tr( "Emails" ) ) {
158 slChooserNames->append( *it ); 158 slChooserNames->append( *it );
159 slChooserValues->append( "" ); 159 slChooserValues->append( "" );
160 //slDynamicEntries->remove( it ); 160 //slDynamicEntries->remove( it );
161 continue; 161 continue;
162 } 162 }
163 163
164 if ( *it == tr( "Name Title" ) ) { 164 if ( *it == tr( "Name Title" ) ) {
165 //slDynamicEntries->remove( it ); 165 //slDynamicEntries->remove( it );
166 continue; 166 continue;
167 } 167 }
168 168
169 if ( *it == tr( "First Name" ) ) { 169 if ( *it == tr( "First Name" ) ) {
170 //slDynamicEntries->remove( it ); 170 //slDynamicEntries->remove( it );
171 continue; 171 continue;
172 } 172 }
173 173
174 if ( *it == tr( "Middle Name" ) ) { 174 if ( *it == tr( "Middle Name" ) ) {
175 //slDynamicEntries->remove( it ); 175 //slDynamicEntries->remove( it );
176 continue; 176 continue;
177 } 177 }
178 178
179 if ( *it == tr( "Last Name" ) ) { 179 if ( *it == tr( "Last Name" ) ) {
180 //slDynamicEntries->remove( it ); 180 //slDynamicEntries->remove( it );
181 continue; 181 continue;
182 } 182 }
183 183
184 if ( *it == tr( "Suffix" ) ) { 184 if ( *it == tr( "Suffix" ) ) {
185 //slDynamicEntries->remove( it ); 185 //slDynamicEntries->remove( it );
186 continue; 186 continue;
187 } 187 }
188 188
189 if ( *it == tr( "File As" ) ) { 189 if ( *it == tr( "File As" ) ) {
190 //slDynamicEntries->remove( it ); 190 //slDynamicEntries->remove( it );
191 continue; 191 continue;
192 } 192 }
193 193
194 if ( *it == tr( "Gender" ) ) { 194 if ( *it == tr( "Gender" ) ) {
195 hasGender = TRUE; 195 hasGender = TRUE;
196 //slDynamicEntries->remove( it ); 196 //slDynamicEntries->remove( it );
197 continue; 197 continue;
198 } 198 }
199 199
200 if ( *it == tr( "Job Title" ) ) { 200 if ( *it == tr( "Job Title" ) ) {
201 hasTitle = TRUE; 201 hasTitle = TRUE;
202 //slDynamicEntries->remove( it ); 202 //slDynamicEntries->remove( it );
203 continue; 203 continue;
204 } 204 }
205 205
206 if ( *it == tr( "Company" ) ) { 206 if ( *it == tr( "Company" ) ) {
207 hasCompany = TRUE; 207 hasCompany = TRUE;
208 //slDynamicEntries->remove( it ); 208 //slDynamicEntries->remove( it );
209 continue; 209 continue;
210 } 210 }
211 211
212 if ( *it == tr( "Notes" ) ) { 212 if ( *it == tr( "Notes" ) ) {
213 hasNotes = TRUE; 213 hasNotes = TRUE;
214 //slDynamicEntries->remove( it ); 214 //slDynamicEntries->remove( it );
215 continue; 215 continue;
216 } 216 }
217 217
218 if ( *it == tr( "Groups" ) ) { 218 if ( *it == tr( "Groups" ) ) {
219 //slDynamicEntries->remove( it ); 219 //slDynamicEntries->remove( it );
220 continue; 220 continue;
221 } 221 }
222 222
223 if ( (*it).right( 6 ) == tr( "Street" ) ) { 223 if ( (*it).right( 6 ) == tr( "Street" ) ) {
224 hasStreet = TRUE; 224 hasStreet = TRUE;
225 //slDynamicEntries->remove( it ); 225 //slDynamicEntries->remove( it );
226 continue; 226 continue;
227 } 227 }
228 228
229 if ( (*it).right( 8 ) == tr( "Street 2" ) ) { 229 if ( (*it).right( 8 ) == tr( "Street 2" ) ) {
230 hasStreet2 = TRUE; 230 hasStreet2 = TRUE;
231 //slDynamicEntries->remove( it ); 231 //slDynamicEntries->remove( it );
232 continue; 232 continue;
233 } 233 }
234 234
235 if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { 235 if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) {
236 hasPOBox = TRUE; 236 hasPOBox = TRUE;
237 //slDynamicEntries->remove( it ); 237 //slDynamicEntries->remove( it );
238 continue; 238 continue;
239 } 239 }
240 240
241 if ( (*it).right( 4 ) == tr( "City" ) ) { 241 if ( (*it).right( 4 ) == tr( "City" ) ) {
242 hasCity = TRUE; 242 hasCity = TRUE;
243 //slDynamicEntries->remove( it ); 243 //slDynamicEntries->remove( it );
244 continue; 244 continue;
245 } 245 }
246 246
247 if ( (*it).right( 5 ) == tr( "State" ) ) { 247 if ( (*it).right( 5 ) == tr( "State" ) ) {
248 hasState = TRUE; 248 hasState = TRUE;
249 //slDynamicEntries->remove( it ); 249 //slDynamicEntries->remove( it );
@@ -936,384 +936,385 @@ void ContactEditor::slotName() {
936 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); 936 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
937 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); 937 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
938 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 938 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
939 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 939 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
940 } 940 }
941 941
942 dlgName->showMaximized(); 942 dlgName->showMaximized();
943 if ( dlgName->exec() ) { 943 if ( dlgName->exec() ) {
944 txtFullName->setText( txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text() ); 944 txtFullName->setText( txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text() );
945 slotFullNameChange( txtFullName->text() ); 945 slotFullNameChange( txtFullName->text() );
946 useFullName = FALSE; 946 useFullName = FALSE;
947 } 947 }
948 948
949} 949}
950 950
951void ContactEditor::setNameFocus() { 951void ContactEditor::setNameFocus() {
952 952
953 txtFullName->setFocus(); 953 txtFullName->setFocus();
954 954
955} 955}
956 956
957bool ContactEditor::isEmpty() { 957bool ContactEditor::isEmpty() {
958 // Test and see if the record should be saved. 958 // Test and see if the record should be saved.
959 // More strict than the original qtopia, needs name or fileas to save 959 // More strict than the original qtopia, needs name or fileas to save
960 960
961 QString t = txtFullName->text(); 961 QString t = txtFullName->text();
962 if ( !t.isEmpty() && containsAlphaNum( t ) ) 962 if ( !t.isEmpty() && containsAlphaNum( t ) )
963 return false; 963 return false;
964 964
965 t = cmbFileAs->currentText(); 965 t = cmbFileAs->currentText();
966 if ( !t.isEmpty() && containsAlphaNum( t ) ) 966 if ( !t.isEmpty() && containsAlphaNum( t ) )
967 return false; 967 return false;
968 968
969 return true; 969 return true;
970 970
971} 971}
972 972
973QString ContactEditor::parseName( const QString fullName, int type ) { 973QString ContactEditor::parseName( const QString fullName, int type ) {
974 974
975 QString simplifiedName( fullName.simplifyWhiteSpace() ); 975 QString simplifiedName( fullName.simplifyWhiteSpace() );
976 QString strFirstName; 976 QString strFirstName;
977 QString strMiddleName; 977 QString strMiddleName;
978 QString strLastName; 978 QString strLastName;
979 QString strSuffix; 979 QString strSuffix;
980 QString strTitle; 980 QString strTitle;
981 int commapos; 981 int commapos;
982 int spCount; 982 int spCount;
983 int spPos; 983 int spPos;
984 int spPos2; 984 int spPos2;
985 985
986 986
987 commapos = simplifiedName.find( ',', 0, TRUE); 987 commapos = simplifiedName.find( ',', 0, TRUE);
988 spCount = simplifiedName.contains( ' ', TRUE ); 988 spCount = simplifiedName.contains( ' ', TRUE );
989 989
990 if ( commapos == -1 ) { 990 if ( commapos == -1 ) {
991 991
992 switch (spCount) { 992 switch (spCount) {
993 case 0: 993 case 0:
994 return simplifiedName; 994 return simplifiedName;
995 995
996 case 1: 996 case 1:
997 spPos = simplifiedName.find( ' ', 0, TRUE ); 997 spPos = simplifiedName.find( ' ', 0, TRUE );
998 strFirstName = simplifiedName.left( spPos ); 998 strFirstName = simplifiedName.left( spPos );
999 strLastName = simplifiedName.mid( spPos + 1 ); 999 strLastName = simplifiedName.mid( spPos + 1 );
1000 break; 1000 break;
1001 1001
1002 case 2: 1002 case 2:
1003 spPos = simplifiedName.find( ' ', 0, TRUE ); 1003 spPos = simplifiedName.find( ' ', 0, TRUE );
1004 strFirstName = simplifiedName.left( spPos ); 1004 strFirstName = simplifiedName.left( spPos );
1005 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1005 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1006 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1006 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1007 strLastName = simplifiedName.mid( spPos2 + 1 ); 1007 strLastName = simplifiedName.mid( spPos2 + 1 );
1008 break; 1008 break;
1009 1009
1010 case 3: 1010 case 3:
1011 spPos = simplifiedName.find( ' ', 0, TRUE ); 1011 spPos = simplifiedName.find( ' ', 0, TRUE );
1012 strFirstName = simplifiedName.left( spPos ); 1012 strFirstName = simplifiedName.left( spPos );
1013 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1013 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1014 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1014 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1015 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1015 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1016 strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1016 strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1017 strSuffix = simplifiedName.mid( spPos + 1 ); 1017 strSuffix = simplifiedName.mid( spPos + 1 );
1018 break; 1018 break;
1019 1019
1020 case 4: 1020 case 4:
1021 spPos = simplifiedName.find( ' ', 0, TRUE ); 1021 spPos = simplifiedName.find( ' ', 0, TRUE );
1022 strTitle = simplifiedName.left( spPos ); 1022 strTitle = simplifiedName.left( spPos );
1023 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1023 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1024 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1024 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1025 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1025 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1026 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1026 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1027 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1027 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1028 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1028 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1029 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1029 strSuffix = simplifiedName.mid( spPos2 + 1 );
1030 break; 1030 break;
1031 1031
1032 default: 1032 default:
1033 spPos = simplifiedName.find( ' ', 0, TRUE ); 1033 spPos = simplifiedName.find( ' ', 0, TRUE );
1034 strTitle = simplifiedName.left( spPos ); 1034 strTitle = simplifiedName.left( spPos );
1035 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1035 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1036 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1036 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1037 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1037 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1038 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1038 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1039 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1039 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1040 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1040 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1041 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1041 strSuffix = simplifiedName.mid( spPos2 + 1 );
1042 break; 1042 break;
1043 } 1043 }
1044 } else { 1044 } else {
1045 simplifiedName.replace( commapos, 1, " " ); 1045 simplifiedName.replace( commapos, 1, " " );
1046 simplifiedName = simplifiedName.simplifyWhiteSpace(); 1046 simplifiedName = simplifiedName.simplifyWhiteSpace();
1047 1047
1048 switch (spCount) { 1048 switch (spCount) {
1049 case 0: 1049 case 0:
1050 return simplifiedName; 1050 return simplifiedName;
1051 1051
1052 case 1: 1052 case 1:
1053 spPos = simplifiedName.find( ' ', 0, TRUE ); 1053 spPos = simplifiedName.find( ' ', 0, TRUE );
1054 strLastName = simplifiedName.left( spPos ); 1054 strLastName = simplifiedName.left( spPos );
1055 strFirstName = simplifiedName.mid( spPos + 1 ); 1055 strFirstName = simplifiedName.mid( spPos + 1 );
1056 break; 1056 break;
1057 1057
1058 case 2: 1058 case 2:
1059 spPos = simplifiedName.find( ' ', 0, TRUE ); 1059 spPos = simplifiedName.find( ' ', 0, TRUE );
1060 strLastName = simplifiedName.left( spPos ); 1060 strLastName = simplifiedName.left( spPos );
1061 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1061 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1062 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1062 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1063 strMiddleName = simplifiedName.mid( spPos2 + 1 ); 1063 strMiddleName = simplifiedName.mid( spPos2 + 1 );
1064 break; 1064 break;
1065 1065
1066 case 3: 1066 case 3:
1067 spPos = simplifiedName.find( ' ', 0, TRUE ); 1067 spPos = simplifiedName.find( ' ', 0, TRUE );
1068 strLastName = simplifiedName.left( spPos ); 1068 strLastName = simplifiedName.left( spPos );
1069 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1069 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1070 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1070 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1071 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1071 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1072 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1072 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1073 strSuffix = simplifiedName.mid( spPos + 1 ); 1073 strSuffix = simplifiedName.mid( spPos + 1 );
1074 break; 1074 break;
1075 1075
1076 case 4: 1076 case 4:
1077 spPos = simplifiedName.find( ' ', 0, TRUE ); 1077 spPos = simplifiedName.find( ' ', 0, TRUE );
1078 strLastName = simplifiedName.left( spPos ); 1078 strLastName = simplifiedName.left( spPos );
1079 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1079 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1080 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1080 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1081 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1081 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1082 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1082 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1083 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1083 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1084 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1084 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1085 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1085 strSuffix = simplifiedName.mid( spPos2 + 1 );
1086 break; 1086 break;
1087 1087
1088 default: 1088 default:
1089 spPos = simplifiedName.find( ' ', 0, TRUE ); 1089 spPos = simplifiedName.find( ' ', 0, TRUE );
1090 strLastName = simplifiedName.left( spPos ); 1090 strLastName = simplifiedName.left( spPos );
1091 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1091 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1092 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1092 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1093 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1093 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1094 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); 1094 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
1095 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1095 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1096 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1096 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1097 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1097 strSuffix = simplifiedName.mid( spPos2 + 1 );
1098 break; 1098 break;
1099 } 1099 }
1100 } 1100 }
1101 1101
1102 switch (type) { 1102 switch (type) {
1103 case NAME_FL: 1103 case NAME_FL:
1104 return strFirstName + " " + strLastName; 1104 return strFirstName + " " + strLastName;
1105 1105
1106 case NAME_LF: 1106 case NAME_LF:
1107 return strLastName + ", " + strFirstName; 1107 return strLastName + ", " + strFirstName;
1108 1108
1109 case NAME_LFM: 1109 case NAME_LFM:
1110 return strLastName + ", " + strFirstName + " " + strMiddleName; 1110 return strLastName + ", " + strFirstName + " " + strMiddleName;
1111 1111
1112 case NAME_FMLS: 1112 case NAME_FMLS:
1113 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; 1113 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix;
1114 1114
1115 case NAME_F: 1115 case NAME_F:
1116 return strFirstName; 1116 return strFirstName;
1117 1117
1118 case NAME_M: 1118 case NAME_M:
1119 return strMiddleName; 1119 return strMiddleName;
1120 1120
1121 case NAME_L: 1121 case NAME_L:
1122 return strLastName; 1122 return strLastName;
1123 1123
1124 case NAME_S: 1124 case NAME_S:
1125 return strSuffix; 1125 return strSuffix;
1126 1126
1127 } 1127 }
1128 return QString::null;
1128} 1129}
1129 1130
1130void ContactEditor::cleanupFields() { 1131void ContactEditor::cleanupFields() {
1131 1132
1132 QStringList::Iterator it = slChooserValues->begin(); 1133 QStringList::Iterator it = slChooserValues->begin();
1133 for ( int i = 0; it != slChooserValues->end(); i++, ++it ) { 1134 for ( int i = 0; it != slChooserValues->end(); i++, ++it ) {
1134 (*it) = ""; 1135 (*it) = "";
1135 } 1136 }
1136 1137
1137 for ( int i = 0; i < 7; i++ ) { 1138 for ( int i = 0; i < 7; i++ ) {
1138 (*slHomeAddress)[i] = ""; 1139 (*slHomeAddress)[i] = "";
1139 (*slBusinessAddress)[i] = ""; 1140 (*slBusinessAddress)[i] = "";
1140 } 1141 }
1141 1142
1142 QStringList::ConstIterator cit; 1143 QStringList::ConstIterator cit;
1143 QListIterator<QLineEdit> itLE( listValue ); 1144 QListIterator<QLineEdit> itLE( listValue );
1144 for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) { 1145 for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) {
1145 (*itLE)->setText( "" ); 1146 (*itLE)->setText( "" );
1146 } 1147 }
1147 1148
1148 txtFirstName->setText(""); 1149 txtFirstName->setText("");
1149 txtMiddleName->setText(""); 1150 txtMiddleName->setText("");
1150 txtLastName->setText(""); 1151 txtLastName->setText("");
1151 txtSuffix->setText(""); 1152 txtSuffix->setText("");
1152 txtNote->setText(""); 1153 txtNote->setText("");
1153 txtFullName->setText(""); 1154 txtFullName->setText("");
1154 txtJobTitle->setText(""); 1155 txtJobTitle->setText("");
1155 txtOrganization->setText(""); 1156 txtOrganization->setText("");
1156 txtChooserField1->setText(""); 1157 txtChooserField1->setText("");
1157 txtChooserField2->setText(""); 1158 txtChooserField2->setText("");
1158 txtChooserField3->setText(""); 1159 txtChooserField3->setText("");
1159 txtAddress->setText(""); 1160 txtAddress->setText("");
1160 //txtAddress2->setText(""); 1161 //txtAddress2->setText("");
1161 txtCity->setText(""); 1162 txtCity->setText("");
1162 //txtPOBox->setText(""); 1163 //txtPOBox->setText("");
1163 txtState->setText(""); 1164 txtState->setText("");
1164 txtZip->setText(""); 1165 txtZip->setText("");
1165 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1166 QLineEdit *txtTmp = cmbCountry->lineEdit();
1166 txtTmp->setText(""); 1167 txtTmp->setText("");
1167 txtTmp = cmbFileAs->lineEdit(); 1168 txtTmp = cmbFileAs->lineEdit();
1168 txtTmp->setText(""); 1169 txtTmp->setText("");
1169 1170
1170} 1171}
1171 1172
1172void ContactEditor::setEntry( const Contact &entry ) { 1173void ContactEditor::setEntry( const Contact &entry ) {
1173 1174
1174 cleanupFields(); 1175 cleanupFields();
1175 1176
1176 1177
1177 ent = entry; 1178 ent = entry;
1178 1179
1179 useFullName = FALSE; 1180 useFullName = FALSE;
1180 txtFirstName->setText( ent.firstName() ); 1181 txtFirstName->setText( ent.firstName() );
1181 txtMiddleName->setText( ent.middleName() ); 1182 txtMiddleName->setText( ent.middleName() );
1182 txtLastName->setText( ent.lastName() ); 1183 txtLastName->setText( ent.lastName() );
1183 txtSuffix->setText( ent.suffix() ); 1184 txtSuffix->setText( ent.suffix() );
1184 1185
1185 QString *tmpString = new QString; 1186 QString *tmpString = new QString;
1186 *tmpString = ent.firstName() + " " + ent.middleName() + 1187 *tmpString = ent.firstName() + " " + ent.middleName() +
1187 + " " + ent.lastName() + " " + ent.suffix(); 1188 + " " + ent.lastName() + " " + ent.suffix();
1188 1189
1189 txtFullName->setText( tmpString->simplifyWhiteSpace() ); 1190 txtFullName->setText( tmpString->simplifyWhiteSpace() );
1190 1191
1191 cmbFileAs->setEditText( ent.fileAs() ); 1192 cmbFileAs->setEditText( ent.fileAs() );
1192 1193
1193 if (hasTitle) 1194 if (hasTitle)
1194 txtJobTitle->setText( ent.jobTitle() ); 1195 txtJobTitle->setText( ent.jobTitle() );
1195 1196
1196 if (hasCompany) 1197 if (hasCompany)
1197 txtOrganization->setText( ent.company() ); 1198 txtOrganization->setText( ent.company() );
1198 1199
1199 if (hasNotes) 1200 if (hasNotes)
1200 txtNote->setText( ent.notes() ); 1201 txtNote->setText( ent.notes() );
1201 1202
1202 if (hasStreet) { 1203 if (hasStreet) {
1203 (*slHomeAddress)[0] = ent.homeStreet(); 1204 (*slHomeAddress)[0] = ent.homeStreet();
1204 (*slBusinessAddress)[0] = ent.businessStreet(); 1205 (*slBusinessAddress)[0] = ent.businessStreet();
1205 } 1206 }
1206/* 1207/*
1207 if (hasStreet2) { 1208 if (hasStreet2) {
1208 (*slHomeAddress)[1] = ent.homeStreet2(); 1209 (*slHomeAddress)[1] = ent.homeStreet2();
1209 (*slBusinessAddress)[1] = ent.businessStreet2(); 1210 (*slBusinessAddress)[1] = ent.businessStreet2();
1210 } 1211 }
1211 1212
1212 if (hasPOBox) { 1213 if (hasPOBox) {
1213 (*slHomeAddress)[2] = ent.homePOBox(); 1214 (*slHomeAddress)[2] = ent.homePOBox();
1214 (*slBusinessAddress)[2] = ent.businessPOBox(); 1215 (*slBusinessAddress)[2] = ent.businessPOBox();
1215 } 1216 }
1216*/ 1217*/
1217 if (hasCity) { 1218 if (hasCity) {
1218 (*slHomeAddress)[3] = ent.homeCity(); 1219 (*slHomeAddress)[3] = ent.homeCity();
1219 (*slBusinessAddress)[3] = ent.businessCity(); 1220 (*slBusinessAddress)[3] = ent.businessCity();
1220 } 1221 }
1221 1222
1222 if (hasState) { 1223 if (hasState) {
1223 (*slHomeAddress)[4] = ent.homeState(); 1224 (*slHomeAddress)[4] = ent.homeState();
1224 (*slBusinessAddress)[4] = ent.businessState(); 1225 (*slBusinessAddress)[4] = ent.businessState();
1225 } 1226 }
1226 1227
1227 if (hasZip) { 1228 if (hasZip) {
1228 (*slHomeAddress)[5] = ent.homeZip(); 1229 (*slHomeAddress)[5] = ent.homeZip();
1229 (*slBusinessAddress)[5] = ent.businessZip(); 1230 (*slBusinessAddress)[5] = ent.businessZip();
1230 } 1231 }
1231 1232
1232 if (hasCountry) { 1233 if (hasCountry) {
1233 (*slHomeAddress)[6] = ent.homeCountry(); 1234 (*slHomeAddress)[6] = ent.homeCountry();
1234 (*slBusinessAddress)[6] = ent.businessCountry(); 1235 (*slBusinessAddress)[6] = ent.businessCountry();
1235 } 1236 }
1236 1237
1237 QStringList::ConstIterator it; 1238 QStringList::ConstIterator it;
1238 QListIterator<QLineEdit> itLE( listValue ); 1239 QListIterator<QLineEdit> itLE( listValue );
1239 for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { 1240 for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) {
1240 if ( *it == "Department" ) 1241 if ( *it == "Department" )
1241 (*itLE)->setText( ent.department() ); 1242 (*itLE)->setText( ent.department() );
1242 1243
1243 if ( *it == "Company" ) 1244 if ( *it == "Company" )
1244 (*itLE)->setText( ent.company() ); 1245 (*itLE)->setText( ent.company() );
1245 1246
1246 if ( *it == "Office" ) 1247 if ( *it == "Office" )
1247 (*itLE)->setText( ent.office() ); 1248 (*itLE)->setText( ent.office() );
1248 1249
1249 if ( *it == "Profession" ) 1250 if ( *it == "Profession" )
1250 (*itLE)->setText( ent.profession() ); 1251 (*itLE)->setText( ent.profession() );
1251 1252
1252 if ( *it == "Assistant" ) 1253 if ( *it == "Assistant" )
1253 (*itLE)->setText( ent.assistant() ); 1254 (*itLE)->setText( ent.assistant() );
1254 1255
1255 if ( *it == "Manager" ) 1256 if ( *it == "Manager" )
1256 (*itLE)->setText( ent.manager() ); 1257 (*itLE)->setText( ent.manager() );
1257 1258
1258 if ( *it == "Spouse" ) 1259 if ( *it == "Spouse" )
1259 (*itLE)->setText( ent.spouse() ); 1260 (*itLE)->setText( ent.spouse() );
1260 1261
1261 if ( *it == "Birthday" ) 1262 if ( *it == "Birthday" )
1262 (*itLE)->setText( ent.birthday() ); 1263 (*itLE)->setText( ent.birthday() );
1263 1264
1264 if ( *it == "Anniversary" ) 1265 if ( *it == "Anniversary" )
1265 (*itLE)->setText( ent.anniversary() ); 1266 (*itLE)->setText( ent.anniversary() );
1266 1267
1267 if ( *it == "Nickname" ) 1268 if ( *it == "Nickname" )
1268 (*itLE)->setText( ent.nickname() ); 1269 (*itLE)->setText( ent.nickname() );
1269 1270
1270 if ( *it == "Children" ) 1271 if ( *it == "Children" )
1271 (*itLE)->setText( ent.children() ); 1272 (*itLE)->setText( ent.children() );
1272 1273
1273 } 1274 }
1274 1275
1275 QStringList::Iterator itV; 1276 QStringList::Iterator itV;
1276 for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { 1277 for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) {
1277 1278
1278 if ( *it == "Business Phone" || *it == "Work Phone" ) 1279 if ( *it == "Business Phone" || *it == "Work Phone" )
1279 *itV = ent.businessPhone(); 1280 *itV = ent.businessPhone();
1280/* 1281/*
1281 if ( *it == "Business 2 Phone" ) 1282 if ( *it == "Business 2 Phone" )
1282 *itV = ent.business2Phone(); 1283 *itV = ent.business2Phone();
1283*/ 1284*/
1284 if ( *it == "Business Fax" || *it == "Work Fax" ) 1285 if ( *it == "Business Fax" || *it == "Work Fax" )
1285 *itV = ent.businessFax(); 1286 *itV = ent.businessFax();
1286 1287
1287 if ( *it == "Business Mobile" || *it == "work Mobile" ) 1288 if ( *it == "Business Mobile" || *it == "work Mobile" )
1288 *itV = ent.businessMobile(); 1289 *itV = ent.businessMobile();
1289/* 1290/*
1290 if ( *it == "Company Phone" ) 1291 if ( *it == "Company Phone" )
1291 *itV = ent.companyPhone(); 1292 *itV = ent.companyPhone();
1292*/ 1293*/
1293 if ( *it == "Default Email" ) 1294 if ( *it == "Default Email" )
1294 *itV = ent.defaultEmail(); 1295 *itV = ent.defaultEmail();
1295 1296
1296 if ( *it == "Emails" ) 1297 if ( *it == "Emails" )
1297 *itV = ent.emails(); 1298 *itV = ent.emails();
1298 1299
1299 if ( *it == "Home Phone" ) 1300 if ( *it == "Home Phone" )
1300 *itV = ent.homePhone(); 1301 *itV = ent.homePhone();
1301/* 1302/*
1302 if ( *it == "Home 2 Phone" ) 1303 if ( *it == "Home 2 Phone" )
1303 *itV = ent.home2Phone(); 1304 *itV = ent.home2Phone();
1304*/ 1305*/
1305 if ( *it == "Home Fax" ) 1306 if ( *it == "Home Fax" )
1306 *itV = ent.homeFax(); 1307 *itV = ent.homeFax();
1307 1308
1308 if ( *it == "Home Mobile" ) 1309 if ( *it == "Home Mobile" )
1309 *itV = ent.homeMobile(); 1310 *itV = ent.homeMobile();
1310/* 1311/*
1311 if ( *it == "Car Phone" ) 1312 if ( *it == "Car Phone" )
1312 *itV = ent.carPhone(); 1313 *itV = ent.carPhone();
1313 1314
1314 if ( *it == "ISDN Phone" ) 1315 if ( *it == "ISDN Phone" )
1315 *itV = ent.ISDNPhone(); 1316 *itV = ent.ISDNPhone();
1316 1317
1317 if ( *it == "Other Phone" ) 1318 if ( *it == "Other Phone" )
1318 *itV = ent.otherPhone(); 1319 *itV = ent.otherPhone();
1319*/ 1320*/