-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 3 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 88 |
2 files changed, 53 insertions, 38 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 472b13e..2eb9ddf 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -1,418 +1,418 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt 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 | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging 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 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** OContact info@trolltech.com if any conditions of this licensing are | 16 | ** OContact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define QTOPIA_INTERNAL_FD | 21 | #define QTOPIA_INTERNAL_FD |
22 | 22 | ||
23 | #include "contacteditor.h" | 23 | #include "contacteditor.h" |
24 | #include "ablabel.h" | 24 | #include "ablabel.h" |
25 | #include "abtable.h" | 25 | #include "abtable.h" |
26 | #include "addresssettings.h" | 26 | #include "addresssettings.h" |
27 | #include "addressbook.h" | 27 | #include "addressbook.h" |
28 | 28 | ||
29 | 29 | ||
30 | #include <opie/ofileselector.h> | 30 | #include <opie/ofileselector.h> |
31 | #include <opie/ofiledialog.h> | 31 | #include <opie/ofiledialog.h> |
32 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/config.h> | 33 | #include <qpe/config.h> |
34 | #include <qpe/contact.h> | 34 | #include <opie/ocontact.h> |
35 | 35 | ||
36 | #ifndef MAKE_FOR_SHARP_ROM | 36 | #ifndef MAKE_FOR_SHARP_ROM |
37 | #include <qpe/finddialog.h> | 37 | #include <qpe/finddialog.h> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #include <qpe/global.h> | 40 | #include <qpe/global.h> |
41 | #include <qpe/resource.h> | 41 | #include <qpe/resource.h> |
42 | #include <qpe/ir.h> | 42 | #include <qpe/ir.h> |
43 | #include <qpe/qpemessagebox.h> | 43 | #include <qpe/qpemessagebox.h> |
44 | #include <qpe/qcopenvelope_qws.h> | 44 | #include <qpe/qcopenvelope_qws.h> |
45 | 45 | ||
46 | #include <qaction.h> | 46 | #include <qaction.h> |
47 | #include <qdialog.h> | 47 | #include <qdialog.h> |
48 | #include <qdir.h> | 48 | #include <qdir.h> |
49 | #include <qfile.h> | 49 | #include <qfile.h> |
50 | #include <qimage.h> | 50 | #include <qimage.h> |
51 | #include <qlayout.h> | 51 | #include <qlayout.h> |
52 | #include <qpe/qpemenubar.h> | 52 | #include <qpe/qpemenubar.h> |
53 | #include <qmessagebox.h> | 53 | #include <qmessagebox.h> |
54 | #include <qpixmap.h> | 54 | #include <qpixmap.h> |
55 | #include <qpopupmenu.h> | 55 | #include <qpopupmenu.h> |
56 | #include <qpe/qpetoolbar.h> | 56 | #include <qpe/qpetoolbar.h> |
57 | #include <qstringlist.h> | 57 | #include <qstringlist.h> |
58 | #include <qtoolbutton.h> | 58 | #include <qtoolbutton.h> |
59 | #include <qwhatsthis.h> | 59 | #include <qwhatsthis.h> |
60 | 60 | ||
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | #include <sys/stat.h> | 62 | #include <sys/stat.h> |
63 | #include <sys/types.h> | 63 | #include <sys/types.h> |
64 | #include <fcntl.h> | 64 | #include <fcntl.h> |
65 | #include <unistd.h> | 65 | #include <unistd.h> |
66 | 66 | ||
67 | #include <qdatetime.h> | 67 | #include <qdatetime.h> |
68 | 68 | ||
69 | #include "picker.h" | 69 | #include "picker.h" |
70 | static QString addressbookOldXMLFilename() | 70 | static QString addressbookOldXMLFilename() |
71 | { | 71 | { |
72 | QString filename = QPEApplication::documentDir() + "addressbook.xml"; | 72 | QString filename = QPEApplication::documentDir() + "addressbook.xml"; |
73 | return filename; | 73 | return filename; |
74 | } | 74 | } |
75 | 75 | ||
76 | static QString addressbookXMLFilename() | 76 | static QString addressbookXMLFilename() |
77 | { | 77 | { |
78 | QString filename = Global::applicationFileName("addressbook", | 78 | QString filename = Global::applicationFileName("addressbook", |
79 | "addressbook.xml"); | 79 | "addressbook.xml"); |
80 | return filename; | 80 | return filename; |
81 | } | 81 | } |
82 | 82 | ||
83 | static QString addressbookPersonalVCardName() | 83 | static QString addressbookPersonalVCardName() |
84 | { | 84 | { |
85 | QString filename = Global::applicationFileName("addressbook", | 85 | QString filename = Global::applicationFileName("addressbook", |
86 | "businesscard.vcf"); | 86 | "businesscard.vcf"); |
87 | return filename; | 87 | return filename; |
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | 91 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, |
92 | WFlags f ) | 92 | WFlags f ) |
93 | : QMainWindow( parent, name, f ), | 93 | : QMainWindow( parent, name, f ), |
94 | abEditor(0), | 94 | abEditor(0), |
95 | bAbEditFirstTime(TRUE), | 95 | bAbEditFirstTime(TRUE), |
96 | syncing(FALSE) | 96 | syncing(FALSE) |
97 | { | 97 | { |
98 | isLoading = true; | 98 | isLoading = true; |
99 | 99 | ||
100 | initFields(); | 100 | initFields(); |
101 | 101 | ||
102 | setCaption( tr("Contacts") ); | 102 | setCaption( tr("Contacts") ); |
103 | setIcon( Resource::loadPixmap( "AddressBook" ) ); | 103 | setIcon( Resource::loadPixmap( "AddressBook" ) ); |
104 | 104 | ||
105 | setToolBarsMovable( FALSE ); | 105 | setToolBarsMovable( FALSE ); |
106 | 106 | ||
107 | // Create Toolbars | 107 | // Create Toolbars |
108 | 108 | ||
109 | QPEToolBar *bar = new QPEToolBar( this ); | 109 | QPEToolBar *bar = new QPEToolBar( this ); |
110 | bar->setHorizontalStretchable( TRUE ); | 110 | bar->setHorizontalStretchable( TRUE ); |
111 | 111 | ||
112 | QPEMenuBar *mbList = new QPEMenuBar( bar ); | 112 | QPEMenuBar *mbList = new QPEMenuBar( bar ); |
113 | mbList->setMargin( 0 ); | 113 | mbList->setMargin( 0 ); |
114 | 114 | ||
115 | QPopupMenu *edit = new QPopupMenu( this ); | 115 | QPopupMenu *edit = new QPopupMenu( this ); |
116 | mbList->insertItem( tr( "Contact" ), edit ); | 116 | mbList->insertItem( tr( "Contact" ), edit ); |
117 | 117 | ||
118 | listTools = new QPEToolBar( this, "list operations" ); | 118 | listTools = new QPEToolBar( this, "list operations" ); |
119 | 119 | ||
120 | 120 | ||
121 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, | 121 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, |
122 | 0, this, 0 ); | 122 | 0, this, 0 ); |
123 | actionNew = a; | 123 | actionNew = a; |
124 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); | 124 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); |
125 | a->addTo( edit ); | 125 | a->addTo( edit ); |
126 | a->addTo( listTools ); | 126 | a->addTo( listTools ); |
127 | 127 | ||
128 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | 128 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, |
129 | 0, this, 0 ); | 129 | 0, this, 0 ); |
130 | actionEdit = a; | 130 | actionEdit = a; |
131 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); | 131 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); |
132 | a->addTo( edit ); | 132 | a->addTo( edit ); |
133 | a->addTo( listTools ); | 133 | a->addTo( listTools ); |
134 | 134 | ||
135 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 135 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
136 | 0, this, 0 ); | 136 | 0, this, 0 ); |
137 | actionTrash = a; | 137 | actionTrash = a; |
138 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); | 138 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); |
139 | a->addTo( edit ); | 139 | a->addTo( edit ); |
140 | a->addTo( listTools ); | 140 | a->addTo( listTools ); |
141 | 141 | ||
142 | 142 | ||
143 | // make it possible to go directly to businesscard via qcop call | 143 | // make it possible to go directly to businesscard via qcop call |
144 | #if defined(Q_WS_QWS) | 144 | #if defined(Q_WS_QWS) |
145 | #if !defined(QT_NO_COP) | 145 | #if !defined(QT_NO_COP) |
146 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); | 146 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); |
147 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), | 147 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), |
148 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); | 148 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); |
149 | #endif | 149 | #endif |
150 | #endif | 150 | #endif |
151 | 151 | ||
152 | 152 | ||
153 | 153 | ||
154 | 154 | ||
155 | 155 | ||
156 | #ifndef MAKE_FOR_SHARP_ROM | 156 | #ifndef MAKE_FOR_SHARP_ROM |
157 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), | 157 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), |
158 | QString::null, 0, this, 0 ); | 158 | QString::null, 0, this, 0 ); |
159 | actionFind = a; | 159 | actionFind = a; |
160 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); | 160 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); |
161 | a->addTo( edit ); | 161 | a->addTo( edit ); |
162 | a->addTo( listTools ); | 162 | a->addTo( listTools ); |
163 | #endif | 163 | #endif |
164 | 164 | ||
165 | 165 | ||
166 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), | 166 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), |
167 | QString::null, 0, this, 0 ); | 167 | QString::null, 0, this, 0 ); |
168 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 168 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
169 | actionMail = a; | 169 | actionMail = a; |
170 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 170 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
171 | a->addTo( edit ); | 171 | a->addTo( edit ); |
172 | a->addTo( listTools ); | 172 | a->addTo( listTools ); |
173 | 173 | ||
174 | 174 | ||
175 | 175 | ||
176 | if ( Ir::supported() ) { | 176 | if ( Ir::supported() ) { |
177 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | 177 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, |
178 | 0, this, 0 ); | 178 | 0, this, 0 ); |
179 | actionBeam = a; | 179 | actionBeam = a; |
180 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 180 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
181 | a->addTo( edit ); | 181 | a->addTo( edit ); |
182 | a->addTo( listTools ); | 182 | a->addTo( listTools ); |
183 | } | 183 | } |
184 | 184 | ||
185 | edit->insertSeparator(); | 185 | edit->insertSeparator(); |
186 | 186 | ||
187 | a = new QAction( tr("Import vCard"), QString::null, 0, 0, 0, TRUE ); | 187 | a = new QAction( tr("Import vCard"), QString::null, 0, 0, 0, TRUE ); |
188 | actionPersonal = a; | 188 | actionPersonal = a; |
189 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); | 189 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); |
190 | a->addTo( edit ); | 190 | a->addTo( edit ); |
191 | 191 | ||
192 | edit->insertSeparator(); | 192 | edit->insertSeparator(); |
193 | 193 | ||
194 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); | 194 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); |
195 | actionPersonal = a; | 195 | actionPersonal = a; |
196 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); | 196 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); |
197 | a->addTo( edit ); | 197 | a->addTo( edit ); |
198 | 198 | ||
199 | 199 | ||
200 | a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); | 200 | a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); |
201 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 201 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
202 | a->addTo( edit ); | 202 | a->addTo( edit ); |
203 | 203 | ||
204 | // Create Views | 204 | // Create Views |
205 | 205 | ||
206 | // This is safe to call without checking to see if it exists... | 206 | // This is safe to call without checking to see if it exists... |
207 | // not to mention it also does the necessary stuff for the | 207 | // not to mention it also does the necessary stuff for the |
208 | // journaling... | 208 | // journaling... |
209 | QString str = addressbookXMLFilename(); | 209 | QString str = addressbookXMLFilename(); |
210 | if ( str.isNull() ) { | 210 | if ( str.isNull() ) { |
211 | QMessageBox::warning( | 211 | QMessageBox::warning( |
212 | this, | 212 | this, |
213 | tr("Out of Space"), | 213 | tr("Out of Space"), |
214 | tr("There is not enough space to create\n" | 214 | tr("There is not enough space to create\n" |
215 | "neccessary startup files.\n" | 215 | "neccessary startup files.\n" |
216 | "\nFree up some space before\nentering data!") | 216 | "\nFree up some space before\nentering data!") |
217 | ); | 217 | ); |
218 | } | 218 | } |
219 | 219 | ||
220 | listContainer = new QWidget( this ); | 220 | listContainer = new QWidget( this ); |
221 | 221 | ||
222 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | 222 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); |
223 | 223 | ||
224 | abList = new AbTable( &orderedFields, listContainer, "table" ); | 224 | abList = new AbTable( &orderedFields, listContainer, "table" ); |
225 | vb->addWidget(abList); | 225 | vb->addWidget(abList); |
226 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 226 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
227 | connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); | 227 | connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); |
228 | connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) ); | 228 | connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) ); |
229 | connect( abList, SIGNAL(currentChanged(int,int)), this, SLOT(slotUpdateToolbar()) ); | 229 | connect( abList, SIGNAL(currentChanged(int,int)), this, SLOT(slotUpdateToolbar()) ); |
230 | 230 | ||
231 | mView = 0; | 231 | mView = 0; |
232 | 232 | ||
233 | abList->load( addressbookXMLFilename() ); | 233 | abList->load( addressbookXMLFilename() ); |
234 | if ( QFile::exists(addressbookOldXMLFilename()) ) { | 234 | if ( QFile::exists(addressbookOldXMLFilename()) ) { |
235 | abList->load( addressbookOldXMLFilename() ); | 235 | abList->load( addressbookOldXMLFilename() ); |
236 | QFile::remove(addressbookOldXMLFilename()); | 236 | QFile::remove(addressbookOldXMLFilename()); |
237 | } | 237 | } |
238 | 238 | ||
239 | pLabel = new LetterPicker( listContainer ); | 239 | pLabel = new LetterPicker( listContainer ); |
240 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 240 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
241 | vb->addWidget(pLabel); | 241 | vb->addWidget(pLabel); |
242 | catMenu = new QPopupMenu( this ); | 242 | catMenu = new QPopupMenu( this ); |
243 | catMenu->setCheckable( TRUE ); | 243 | catMenu->setCheckable( TRUE ); |
244 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 244 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
245 | populateCategories(); | 245 | populateCategories(); |
246 | 246 | ||
247 | mbList->insertItem( tr("View"), catMenu ); | 247 | mbList->insertItem( tr("View"), catMenu ); |
248 | // setCentralWidget( listContainer ); | 248 | // setCentralWidget( listContainer ); |
249 | 249 | ||
250 | fontMenu = new QPopupMenu(this); | 250 | fontMenu = new QPopupMenu(this); |
251 | fontMenu->setCheckable( true ); | 251 | fontMenu->setCheckable( true ); |
252 | connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); | 252 | connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); |
253 | 253 | ||
254 | fontMenu->insertItem(tr( "Small" ), 0); | 254 | fontMenu->insertItem(tr( "Small" ), 0); |
255 | fontMenu->insertItem(tr( "Normal" ), 1); | 255 | fontMenu->insertItem(tr( "Normal" ), 1); |
256 | fontMenu->insertItem(tr( "Large" ), 2); | 256 | fontMenu->insertItem(tr( "Large" ), 2); |
257 | 257 | ||
258 | defaultFont = new QFont( abList->font() ); | 258 | defaultFont = new QFont( abList->font() ); |
259 | 259 | ||
260 | slotSetFont(startFontSize); | 260 | slotSetFont(startFontSize); |
261 | 261 | ||
262 | mbList->insertItem( tr("Font"), fontMenu); | 262 | mbList->insertItem( tr("Font"), fontMenu); |
263 | setCentralWidget(listContainer); | 263 | setCentralWidget(listContainer); |
264 | 264 | ||
265 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 265 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
266 | 266 | ||
267 | abList->setCurrentCell( 0, 0 ); | 267 | abList->setCurrentCell( 0, 0 ); |
268 | 268 | ||
269 | isLoading = false; | 269 | isLoading = false; |
270 | } | 270 | } |
271 | 271 | ||
272 | 272 | ||
273 | void AddressbookWindow::slotSetFont( int size ) { | 273 | void AddressbookWindow::slotSetFont( int size ) { |
274 | 274 | ||
275 | if (size > 2 || size < 0) | 275 | if (size > 2 || size < 0) |
276 | size = 1; | 276 | size = 1; |
277 | 277 | ||
278 | startFontSize = size; | 278 | startFontSize = size; |
279 | 279 | ||
280 | QFont *currentFont; | 280 | QFont *currentFont; |
281 | 281 | ||
282 | switch (size) { | 282 | switch (size) { |
283 | case 0: | 283 | case 0: |
284 | fontMenu->setItemChecked(0, true); | 284 | fontMenu->setItemChecked(0, true); |
285 | fontMenu->setItemChecked(1, false); | 285 | fontMenu->setItemChecked(1, false); |
286 | fontMenu->setItemChecked(2, false); | 286 | fontMenu->setItemChecked(2, false); |
287 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); | 287 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); |
288 | currentFont = new QFont (abList->font()); | 288 | currentFont = new QFont (abList->font()); |
289 | // abList->resizeRows(currentFont->pixelSize() + 7); | 289 | // abList->resizeRows(currentFont->pixelSize() + 7); |
290 | abList->resizeRows(); | 290 | abList->resizeRows(); |
291 | break; | 291 | break; |
292 | case 1: | 292 | case 1: |
293 | fontMenu->setItemChecked(0, false); | 293 | fontMenu->setItemChecked(0, false); |
294 | fontMenu->setItemChecked(1, true); | 294 | fontMenu->setItemChecked(1, true); |
295 | fontMenu->setItemChecked(2, false); | 295 | fontMenu->setItemChecked(2, false); |
296 | abList->setFont( *defaultFont ); | 296 | abList->setFont( *defaultFont ); |
297 | currentFont = new QFont (abList->font()); | 297 | currentFont = new QFont (abList->font()); |
298 | // abList->resizeRows(currentFont->pixelSize() + 7); | 298 | // abList->resizeRows(currentFont->pixelSize() + 7); |
299 | abList->resizeRows(); | 299 | abList->resizeRows(); |
300 | break; | 300 | break; |
301 | case 2: | 301 | case 2: |
302 | fontMenu->setItemChecked(0, false); | 302 | fontMenu->setItemChecked(0, false); |
303 | fontMenu->setItemChecked(1, false); | 303 | fontMenu->setItemChecked(1, false); |
304 | fontMenu->setItemChecked(2, true); | 304 | fontMenu->setItemChecked(2, true); |
305 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); | 305 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); |
306 | currentFont = new QFont (abList->font()); | 306 | currentFont = new QFont (abList->font()); |
307 | //abList->resizeRows(currentFont->pixelSize() + 7); | 307 | //abList->resizeRows(currentFont->pixelSize() + 7); |
308 | abList->resizeRows(); | 308 | abList->resizeRows(); |
309 | break; | 309 | break; |
310 | } | 310 | } |
311 | } | 311 | } |
312 | 312 | ||
313 | 313 | ||
314 | 314 | ||
315 | void AddressbookWindow::importvCard() { | 315 | void AddressbookWindow::importvCard() { |
316 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); | 316 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); |
317 | if(!str.isEmpty() ) | 317 | if(!str.isEmpty() ) |
318 | setDocument((const QString&) str ); | 318 | setDocument((const QString&) str ); |
319 | 319 | ||
320 | } | 320 | } |
321 | 321 | ||
322 | void AddressbookWindow::setDocument( const QString &filename ) | 322 | void AddressbookWindow::setDocument( const QString &filename ) |
323 | { | 323 | { |
324 | if ( filename.find(".vcf") != int(filename.length()) - 4 ) | 324 | if ( filename.find(".vcf") != int(filename.length()) - 4 ) |
325 | return; | 325 | return; |
326 | 326 | ||
327 | QValueList<OContact> cl = OContact::readVCard( filename ); | 327 | QValueList<OContact> cl = OContact::readVCard( filename ); |
328 | for( QValueList<OContact>::Iterator it = cl.begin(); it != cl.end(); ++it ) { | 328 | for( QValueList<OContact>::Iterator it = cl.begin(); it != cl.end(); ++it ) { |
329 | // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?") | 329 | // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?") |
330 | // .arg( (*it).fullName() ); | 330 | // .arg( (*it).fullName() ); |
331 | // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == | 331 | // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == |
332 | // QMessageBox::Ok ) { | 332 | // QMessageBox::Ok ) { |
333 | abList->addEntry( *it ); | 333 | abList->addEntry( *it ); |
334 | // } | 334 | // } |
335 | } | 335 | } |
336 | 336 | ||
337 | } | 337 | } |
338 | 338 | ||
339 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 339 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
340 | { | 340 | { |
341 | QMainWindow::resizeEvent( e ); | 341 | QMainWindow::resizeEvent( e ); |
342 | 342 | ||
343 | if ( centralWidget() == listContainer ) | 343 | if ( centralWidget() == listContainer ) |
344 | showList(); | 344 | showList(); |
345 | else if ( centralWidget() == mView ) | 345 | else if ( centralWidget() == mView ) |
346 | showView(); | 346 | showView(); |
347 | } | 347 | } |
348 | 348 | ||
349 | AddressbookWindow::~AddressbookWindow() | 349 | AddressbookWindow::~AddressbookWindow() |
350 | { | 350 | { |
351 | Config cfg("AddressBook"); | 351 | Config cfg("AddressBook"); |
352 | cfg.setGroup("Font"); | 352 | cfg.setGroup("Font"); |
353 | cfg.writeEntry("fontSize", startFontSize); | 353 | cfg.writeEntry("fontSize", startFontSize); |
354 | } | 354 | } |
355 | 355 | ||
356 | void AddressbookWindow::slotUpdateToolbar() | 356 | void AddressbookWindow::slotUpdateToolbar() |
357 | { | 357 | { |
358 | OContact ce = abList->currentEntry(); | 358 | OContact ce = abList->currentEntry(); |
359 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 359 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
360 | } | 360 | } |
361 | 361 | ||
362 | void AddressbookWindow::showList() | 362 | void AddressbookWindow::showList() |
363 | { | 363 | { |
364 | bool visiblemView; | 364 | bool visiblemView; |
365 | 365 | ||
366 | visiblemView = false; | 366 | visiblemView = false; |
367 | if ( mView ) { | 367 | if ( mView ) { |
368 | mView->hide(); | 368 | mView->hide(); |
369 | visiblemView = true; | 369 | visiblemView = true; |
370 | } | 370 | } |
371 | setCentralWidget( listContainer ); | 371 | setCentralWidget( listContainer ); |
372 | listContainer->show(); | 372 | listContainer->show(); |
373 | // update our focues... (or use a stack widget!); | 373 | // update our focues... (or use a stack widget!); |
374 | abList->setFocus(); | 374 | abList->setFocus(); |
375 | 375 | ||
376 | // This makes sure we are scrolled all the way to the left | 376 | // This makes sure we are scrolled all the way to the left |
377 | abList->setContentsPos( 0, abList->contentsY() ); | 377 | abList->setContentsPos( 0, abList->contentsY() ); |
378 | 378 | ||
379 | //if ( visiblemView && abList->showBook() == "Cards" ) | 379 | //if ( visiblemView && abList->showBook() == "Cards" ) |
380 | //abList->setShowCategory( abList->showBook(), abList->showCategory() ); | 380 | //abList->setShowCategory( abList->showBook(), abList->showCategory() ); |
381 | 381 | ||
382 | } | 382 | } |
383 | 383 | ||
384 | void AddressbookWindow::showView() | 384 | void AddressbookWindow::showView() |
385 | { | 385 | { |
386 | if ( abList->numRows() > 0 ) { | 386 | if ( abList->numRows() > 0 ) { |
387 | listContainer->hide(); | 387 | listContainer->hide(); |
388 | setCentralWidget( abView() ); | 388 | setCentralWidget( abView() ); |
389 | mView->show(); | 389 | mView->show(); |
390 | mView->setFocus(); | 390 | mView->setFocus(); |
391 | } | 391 | } |
392 | } | 392 | } |
393 | 393 | ||
394 | void AddressbookWindow::slotListNew() | 394 | void AddressbookWindow::slotListNew() |
395 | { | 395 | { |
396 | OContact cnt; | 396 | OContact cnt; |
397 | if( !syncing ) { | 397 | if( !syncing ) { |
398 | if ( abEditor ) | 398 | if ( abEditor ) |
399 | abEditor->setEntry( cnt ); | 399 | abEditor->setEntry( cnt ); |
400 | abView()->init( cnt ); | 400 | abView()->init( cnt ); |
401 | editEntry( NewEntry ); | 401 | editEntry( NewEntry ); |
402 | } else { | 402 | } else { |
403 | QMessageBox::warning(this, tr("OContacts"), | 403 | QMessageBox::warning(this, tr("OContacts"), |
404 | tr("Can not edit data, currently syncing")); | 404 | tr("Can not edit data, currently syncing")); |
405 | } | 405 | } |
406 | } | 406 | } |
407 | 407 | ||
408 | void AddressbookWindow::slotListView() | 408 | void AddressbookWindow::slotListView() |
409 | { | 409 | { |
410 | abView()->init( abList->currentEntry() ); | 410 | abView()->init( abList->currentEntry() ); |
411 | mView->sync(); | 411 | mView->sync(); |
412 | showView(); | 412 | showView(); |
413 | } | 413 | } |
414 | 414 | ||
415 | void AddressbookWindow::slotListDelete() | 415 | void AddressbookWindow::slotListDelete() |
416 | { | 416 | { |
417 | if(!syncing) { | 417 | if(!syncing) { |
418 | OContact tmpEntry = abList->currentEntry(); | 418 | OContact tmpEntry = abList->currentEntry(); |
@@ -476,557 +476,558 @@ void AddressbookWindow::slotBeam() | |||
476 | QString filename; | 476 | QString filename; |
477 | OContact c; | 477 | OContact c; |
478 | if ( actionPersonal->isOn() ) { | 478 | if ( actionPersonal->isOn() ) { |
479 | filename = addressbookPersonalVCardName(); | 479 | filename = addressbookPersonalVCardName(); |
480 | if (!QFile::exists(filename)) | 480 | if (!QFile::exists(filename)) |
481 | return; // can't beam a non-existent file | 481 | return; // can't beam a non-existent file |
482 | c = OContact::readVCard( filename )[0]; | 482 | c = OContact::readVCard( filename )[0]; |
483 | } else { | 483 | } else { |
484 | unlink( beamfile ); // delete if exists | 484 | unlink( beamfile ); // delete if exists |
485 | c = abList->currentEntry(); | 485 | c = abList->currentEntry(); |
486 | mkdir("/tmp/obex/", 0755); | 486 | mkdir("/tmp/obex/", 0755); |
487 | OContact::writeVCard( beamfile, c ); | 487 | OContact::writeVCard( beamfile, c ); |
488 | filename = beamfile; | 488 | filename = beamfile; |
489 | } | 489 | } |
490 | Ir *ir = new Ir( this ); | 490 | Ir *ir = new Ir( this ); |
491 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 491 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
492 | QString description = c.fullName(); | 492 | QString description = c.fullName(); |
493 | ir->send( filename, description, "text/x-vCard" ); | 493 | ir->send( filename, description, "text/x-vCard" ); |
494 | } | 494 | } |
495 | 495 | ||
496 | void AddressbookWindow::beamDone( Ir *ir ) | 496 | void AddressbookWindow::beamDone( Ir *ir ) |
497 | { | 497 | { |
498 | delete ir; | 498 | delete ir; |
499 | unlink( beamfile ); | 499 | unlink( beamfile ); |
500 | } | 500 | } |
501 | 501 | ||
502 | 502 | ||
503 | static void parseName( const QString& name, QString *first, QString *middle, | 503 | static void parseName( const QString& name, QString *first, QString *middle, |
504 | QString * last ) | 504 | QString * last ) |
505 | { | 505 | { |
506 | 506 | ||
507 | int comma = name.find ( "," ); | 507 | int comma = name.find ( "," ); |
508 | QString rest; | 508 | QString rest; |
509 | if ( comma > 0 ) { | 509 | if ( comma > 0 ) { |
510 | *last = name.left( comma ); | 510 | *last = name.left( comma ); |
511 | comma++; | 511 | comma++; |
512 | while ( comma < int(name.length()) && name[comma] == ' ' ) | 512 | while ( comma < int(name.length()) && name[comma] == ' ' ) |
513 | comma++; | 513 | comma++; |
514 | rest = name.mid( comma ); | 514 | rest = name.mid( comma ); |
515 | } else { | 515 | } else { |
516 | int space = name.findRev( ' ' ); | 516 | int space = name.findRev( ' ' ); |
517 | *last = name.mid( space+1 ); | 517 | *last = name.mid( space+1 ); |
518 | rest = name.left( space ); | 518 | rest = name.left( space ); |
519 | } | 519 | } |
520 | int space = rest.find( ' ' ); | 520 | int space = rest.find( ' ' ); |
521 | if ( space <= 0 ) { | 521 | if ( space <= 0 ) { |
522 | *first = rest; | 522 | *first = rest; |
523 | } else { | 523 | } else { |
524 | *first = rest.left( space ); | 524 | *first = rest.left( space ); |
525 | *middle = rest.mid( space+1 ); | 525 | *middle = rest.mid( space+1 ); |
526 | } | 526 | } |
527 | 527 | ||
528 | } | 528 | } |
529 | 529 | ||
530 | 530 | ||
531 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 531 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
532 | { | 532 | { |
533 | if (msg == "editPersonal()") { | 533 | if (msg == "editPersonal()") { |
534 | editPersonal(); | 534 | editPersonal(); |
535 | } else if (msg == "editPersonalAndClose()") { | 535 | } else if (msg == "editPersonalAndClose()") { |
536 | editPersonal(); | 536 | editPersonal(); |
537 | close(); | 537 | close(); |
538 | } else if ( msg == "addContact(QString,QString)" ) { | 538 | } else if ( msg == "addContact(QString,QString)" ) { |
539 | QDataStream stream(data,IO_ReadOnly); | 539 | QDataStream stream(data,IO_ReadOnly); |
540 | QString name, email; | 540 | QString name, email; |
541 | stream >> name >> email; | 541 | stream >> name >> email; |
542 | 542 | ||
543 | OContact cnt; | 543 | OContact cnt; |
544 | QString fn, mn, ln; | 544 | QString fn, mn, ln; |
545 | parseName( name, &fn, &mn, &ln ); | 545 | parseName( name, &fn, &mn, &ln ); |
546 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 546 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
547 | cnt.setFirstName( fn ); | 547 | cnt.setFirstName( fn ); |
548 | cnt.setMiddleName( mn ); | 548 | cnt.setMiddleName( mn ); |
549 | cnt.setLastName( ln ); | 549 | cnt.setLastName( ln ); |
550 | cnt.insertEmails( email ); | 550 | cnt.insertEmails( email ); |
551 | cnt.setDefaultEmail( email ); | 551 | cnt.setDefaultEmail( email ); |
552 | cnt.setFileAs(); | 552 | cnt.setFileAs(); |
553 | 553 | ||
554 | if ( bAbEditFirstTime ) { | 554 | if ( bAbEditFirstTime ) { |
555 | abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields, | 555 | abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields, |
556 | this, "editor" ); | 556 | this, "editor" ); |
557 | bAbEditFirstTime = FALSE; | 557 | bAbEditFirstTime = FALSE; |
558 | } else { | 558 | } else { |
559 | abEditor->setEntry( cnt ); | 559 | abEditor->setEntry( cnt ); |
560 | } | 560 | } |
561 | abView()->init( cnt ); | 561 | abView()->init( cnt ); |
562 | editEntry( NewEntry ); | 562 | editEntry( NewEntry ); |
563 | 563 | ||
564 | 564 | ||
565 | 565 | ||
566 | } | 566 | } |
567 | #if 0 | 567 | #if 0 |
568 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { | 568 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { |
569 | QDataStream stream(data,IO_ReadOnly); | 569 | QDataStream stream(data,IO_ReadOnly); |
570 | QCString ch,m; | 570 | QCString ch,m; |
571 | QStringList types; | 571 | QStringList types; |
572 | stream >> ch >> m >> types; | 572 | stream >> ch >> m >> types; |
573 | AddressPicker picker(abList,this,0,TRUE); | 573 | AddressPicker picker(abList,this,0,TRUE); |
574 | picker.showMaximized(); | 574 | picker.showMaximized(); |
575 | picker.setChoiceNames(types); | 575 | picker.setChoiceNames(types); |
576 | int i=0; | 576 | int i=0; |
577 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 577 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
578 | QStringList sel; | 578 | QStringList sel; |
579 | stream >> sel; | 579 | stream >> sel; |
580 | picker.setSelection(i++,sel); | 580 | picker.setSelection(i++,sel); |
581 | } | 581 | } |
582 | picker.showMaximized(); | 582 | picker.showMaximized(); |
583 | picker.exec(); | 583 | picker.exec(); |
584 | 584 | ||
585 | // ###### note: contacts may have been added - save here! | 585 | // ###### note: contacts may have been added - save here! |
586 | 586 | ||
587 | setCentralWidget(abList); | 587 | setCentralWidget(abList); |
588 | QCopEnvelope e(ch,m); | 588 | QCopEnvelope e(ch,m); |
589 | i=0; | 589 | i=0; |
590 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 590 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
591 | QStringList sel = picker.selection(i++); | 591 | QStringList sel = picker.selection(i++); |
592 | e << sel; | 592 | e << sel; |
593 | } | 593 | } |
594 | } | 594 | } |
595 | #endif | 595 | #endif |
596 | 596 | ||
597 | } | 597 | } |
598 | 598 | ||
599 | void AddressbookWindow::editPersonal() | 599 | void AddressbookWindow::editPersonal() |
600 | { | 600 | { |
601 | QString filename = addressbookPersonalVCardName(); | 601 | QString filename = addressbookPersonalVCardName(); |
602 | OContact me; | 602 | OContact me; |
603 | if (QFile::exists(filename)) | 603 | if (QFile::exists(filename)) |
604 | me = OContact::readVCard( filename )[0]; | 604 | me = OContact::readVCard( filename )[0]; |
605 | if (bAbEditFirstTime) { | 605 | if (bAbEditFirstTime) { |
606 | abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, | 606 | abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, |
607 | this, "editor" ); | 607 | this, "editor" ); |
608 | // don't create a new editor every time | 608 | // don't create a new editor every time |
609 | bAbEditFirstTime = FALSE; | 609 | bAbEditFirstTime = FALSE; |
610 | } else | 610 | } else |
611 | abEditor->setEntry( me ); | 611 | abEditor->setEntry( me ); |
612 | 612 | ||
613 | abEditor->setCaption(tr("Edit My Personal Details")); | 613 | abEditor->setCaption(tr("Edit My Personal Details")); |
614 | abEditor->showMaximized(); | 614 | abEditor->showMaximized(); |
615 | 615 | ||
616 | // fix the foxus... | 616 | // fix the foxus... |
617 | abEditor->setNameFocus(); | 617 | abEditor->setNameFocus(); |
618 | if ( abEditor->exec() ) { | 618 | if ( abEditor->exec() ) { |
619 | setFocus(); | 619 | setFocus(); |
620 | OContact new_personal = abEditor->entry(); | 620 | OContact new_personal = abEditor->entry(); |
621 | QString fname = addressbookPersonalVCardName(); | 621 | QString fname = addressbookPersonalVCardName(); |
622 | OContact::writeVCard( fname, new_personal ); | 622 | OContact::writeVCard( fname, new_personal ); |
623 | abView()->init(new_personal); | 623 | abView()->init(new_personal); |
624 | abView()->sync(); | 624 | abView()->sync(); |
625 | } | 625 | } |
626 | abEditor->setCaption( tr("Edit Address") ); | 626 | abEditor->setCaption( tr("Edit Address") ); |
627 | } | 627 | } |
628 | 628 | ||
629 | void AddressbookWindow::slotPersonalView() | 629 | void AddressbookWindow::slotPersonalView() |
630 | { | 630 | { |
631 | if (!actionPersonal->isOn()) { | 631 | if (!actionPersonal->isOn()) { |
632 | // we just turned it off | 632 | // we just turned it off |
633 | setCaption( tr("Contacts") ); | 633 | setCaption( tr("Contacts") ); |
634 | actionNew->setEnabled(TRUE); | 634 | actionNew->setEnabled(TRUE); |
635 | actionTrash->setEnabled(TRUE); | 635 | actionTrash->setEnabled(TRUE); |
636 | #ifndef MAKE_FOR_SHARP_ROM | 636 | #ifndef MAKE_FOR_SHARP_ROM |
637 | actionFind->setEnabled(TRUE); | 637 | actionFind->setEnabled(TRUE); |
638 | #endif | 638 | #endif |
639 | slotUpdateToolbar(); // maybe some of the above could be moved there | 639 | slotUpdateToolbar(); // maybe some of the above could be moved there |
640 | showList(); | 640 | showList(); |
641 | return; | 641 | return; |
642 | } | 642 | } |
643 | 643 | ||
644 | // XXX need to disable some QActions. | 644 | // XXX need to disable some QActions. |
645 | actionNew->setEnabled(FALSE); | 645 | actionNew->setEnabled(FALSE); |
646 | actionTrash->setEnabled(FALSE); | 646 | actionTrash->setEnabled(FALSE); |
647 | #ifndef MAKE_FOR_SHARP_ROM | 647 | #ifndef MAKE_FOR_SHARP_ROM |
648 | actionFind->setEnabled(FALSE); | 648 | actionFind->setEnabled(FALSE); |
649 | #endif | 649 | #endif |
650 | actionMail->setEnabled(FALSE); | 650 | actionMail->setEnabled(FALSE); |
651 | 651 | ||
652 | setCaption( tr("Contacts - My Personal Details") ); | 652 | setCaption( tr("Contacts - My Personal Details") ); |
653 | QString filename = addressbookPersonalVCardName(); | 653 | QString filename = addressbookPersonalVCardName(); |
654 | OContact me; | 654 | OContact me; |
655 | if (QFile::exists(filename)) | 655 | if (QFile::exists(filename)) |
656 | me = OContact::readVCard( filename )[0]; | 656 | me = OContact::readVCard( filename )[0]; |
657 | 657 | ||
658 | abView()->init( me ); | 658 | abView()->init( me ); |
659 | abView()->sync(); | 659 | abView()->sync(); |
660 | listContainer->hide(); | 660 | listContainer->hide(); |
661 | setCentralWidget( abView() ); | 661 | setCentralWidget( abView() ); |
662 | mView->show(); | 662 | mView->show(); |
663 | mView->setFocus(); | 663 | mView->setFocus(); |
664 | } | 664 | } |
665 | 665 | ||
666 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 666 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
667 | { | 667 | { |
668 | OContact entry; | 668 | OContact entry; |
669 | if ( bAbEditFirstTime ) { | 669 | if ( bAbEditFirstTime ) { |
670 | abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields, | 670 | abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields, |
671 | this, "editor" ); | 671 | this, "editor" ); |
672 | bAbEditFirstTime = FALSE; | 672 | bAbEditFirstTime = FALSE; |
673 | if ( entryMode == EditEntry ) | 673 | if ( entryMode == EditEntry ) |
674 | abEditor->setEntry( abList->currentEntry() ); | 674 | abEditor->setEntry( abList->currentEntry() ); |
675 | } | 675 | } |
676 | // other things may chane the caption. | 676 | // other things may chane the caption. |
677 | abEditor->setCaption( tr("Edit Address") ); | 677 | abEditor->setCaption( tr("Edit Address") ); |
678 | 678 | ||
679 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 679 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
680 | abEditor->showMaximized(); | 680 | abEditor->showMaximized(); |
681 | #endif | 681 | #endif |
682 | // fix the foxus... | 682 | // fix the foxus... |
683 | abEditor->setNameFocus(); | 683 | abEditor->setNameFocus(); |
684 | if ( abEditor->exec() ) { | 684 | if ( abEditor->exec() ) { |
685 | setFocus(); | 685 | setFocus(); |
686 | if ( entryMode == NewEntry ) { | 686 | if ( entryMode == NewEntry ) { |
687 | OContact insertEntry = abEditor->entry(); | 687 | OContact insertEntry = abEditor->entry(); |
688 | insertEntry.assignUid(); | 688 | insertEntry.assignUid(); |
689 | abList->addEntry( insertEntry ); | 689 | abList->addEntry( insertEntry ); |
690 | } else { | 690 | } else { |
691 | OContact replaceEntry = abEditor->entry(); | 691 | OContact replaceEntry = abEditor->entry(); |
692 | if ( !replaceEntry.isValidUid() ) | 692 | if ( !replaceEntry.isValidUid() ) |
693 | replaceEntry.assignUid(); | 693 | replaceEntry.assignUid(); |
694 | abList->replaceCurrentEntry( replaceEntry ); | 694 | abList->replaceCurrentEntry( replaceEntry ); |
695 | } | 695 | } |
696 | } | 696 | } |
697 | populateCategories(); | 697 | populateCategories(); |
698 | showList(); | 698 | showList(); |
699 | } | 699 | } |
700 | 700 | ||
701 | void AddressbookWindow::listIsEmpty( bool empty ) | 701 | void AddressbookWindow::listIsEmpty( bool empty ) |
702 | { | 702 | { |
703 | if ( !empty ) { | 703 | if ( !empty ) { |
704 | deleteButton->setEnabled( TRUE ); | 704 | deleteButton->setEnabled( TRUE ); |
705 | } | 705 | } |
706 | } | 706 | } |
707 | 707 | ||
708 | void AddressbookWindow::reload() | 708 | void AddressbookWindow::reload() |
709 | { | 709 | { |
710 | syncing = FALSE; | 710 | syncing = FALSE; |
711 | abList->clear(); | 711 | abList->clear(); |
712 | abList->load( addressbookXMLFilename() ); | 712 | abList->load( addressbookXMLFilename() ); |
713 | } | 713 | } |
714 | 714 | ||
715 | void AddressbookWindow::flush() | 715 | void AddressbookWindow::flush() |
716 | { | 716 | { |
717 | syncing = TRUE; | 717 | syncing = TRUE; |
718 | abList->save( addressbookXMLFilename() ); | 718 | abList->save( addressbookXMLFilename() ); |
719 | } | 719 | } |
720 | 720 | ||
721 | 721 | ||
722 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 722 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
723 | { | 723 | { |
724 | if ( centralWidget() == mView ) { | 724 | if ( centralWidget() == mView ) { |
725 | if (actionPersonal->isOn()) { | 725 | if (actionPersonal->isOn()) { |
726 | // pretend we clicked it off | 726 | // pretend we clicked it off |
727 | actionPersonal->setOn(FALSE); | 727 | actionPersonal->setOn(FALSE); |
728 | slotPersonalView(); | 728 | slotPersonalView(); |
729 | } else { | 729 | } else { |
730 | showList(); | 730 | showList(); |
731 | } | 731 | } |
732 | e->ignore(); | 732 | e->ignore(); |
733 | return; | 733 | return; |
734 | } | 734 | } |
735 | 735 | ||
736 | if(syncing) { | 736 | if(syncing) { |
737 | /* shouldn't we save, I hear you say? well its already been set | 737 | /* shouldn't we save, I hear you say? well its already been set |
738 | so that an edit can not occur during a sync, and we flushed | 738 | so that an edit can not occur during a sync, and we flushed |
739 | at the start of the sync, so there is no need to save | 739 | at the start of the sync, so there is no need to save |
740 | Saving however itself would cause problems. */ | 740 | Saving however itself would cause problems. */ |
741 | e->accept(); | 741 | e->accept(); |
742 | return; | 742 | return; |
743 | } | 743 | } |
744 | //################## shouldn't always save | 744 | //################## shouldn't always save |
745 | // True, but the database handles this automatically ! (se) | 745 | // True, but the database handles this automatically ! (se) |
746 | if ( save() ) | 746 | if ( save() ) |
747 | e->accept(); | 747 | e->accept(); |
748 | else | 748 | else |
749 | e->ignore(); | 749 | e->ignore(); |
750 | } | 750 | } |
751 | 751 | ||
752 | /* | 752 | /* |
753 | Returns TRUE if it is OK to exit | 753 | Returns TRUE if it is OK to exit |
754 | */ | 754 | */ |
755 | 755 | ||
756 | bool AddressbookWindow::save() | 756 | bool AddressbookWindow::save() |
757 | { | 757 | { |
758 | QString str = addressbookXMLFilename(); | 758 | QString str = addressbookXMLFilename(); |
759 | if ( str.isNull() ) { | 759 | if ( str.isNull() ) { |
760 | if ( QMessageBox::critical( 0, tr("Out of space"), | 760 | if ( QMessageBox::critical( 0, tr("Out of space"), |
761 | tr("Unable to save information.\n" | 761 | tr("Unable to save information.\n" |
762 | "Free up some space\n" | 762 | "Free up some space\n" |
763 | "and try again.\n" | 763 | "and try again.\n" |
764 | "\nQuit anyway?"), | 764 | "\nQuit anyway?"), |
765 | QMessageBox::Yes|QMessageBox::Escape, | 765 | QMessageBox::Yes|QMessageBox::Escape, |
766 | QMessageBox::No|QMessageBox::Default ) | 766 | QMessageBox::No|QMessageBox::Default ) |
767 | != QMessageBox::No ) | 767 | != QMessageBox::No ) |
768 | return TRUE; | 768 | return TRUE; |
769 | else | 769 | else |
770 | return FALSE; | 770 | return FALSE; |
771 | } else { | 771 | } else { |
772 | if ( !abList->save( str ) ) { | 772 | if ( !abList->save( str ) ) { |
773 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 773 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
774 | tr("Unable to save information.\n" | 774 | tr("Unable to save information.\n" |
775 | "Free up some space\n" | 775 | "Free up some space\n" |
776 | "and try again.\n" | 776 | "and try again.\n" |
777 | "\nQuit anyway?"), | 777 | "\nQuit anyway?"), |
778 | QMessageBox::Yes|QMessageBox::Escape, | 778 | QMessageBox::Yes|QMessageBox::Escape, |
779 | QMessageBox::No|QMessageBox::Default ) | 779 | QMessageBox::No|QMessageBox::Default ) |
780 | != QMessageBox::No ) | 780 | != QMessageBox::No ) |
781 | return TRUE; | 781 | return TRUE; |
782 | else | 782 | else |
783 | return FALSE; | 783 | return FALSE; |
784 | } | 784 | } |
785 | } | 785 | } |
786 | return TRUE; | 786 | return TRUE; |
787 | } | 787 | } |
788 | 788 | ||
789 | void AddressbookWindow::slotSettings() | 789 | void AddressbookWindow::slotSettings() |
790 | { | 790 | { |
791 | AddressSettings frmSettings( this ); | 791 | AddressSettings frmSettings( this ); |
792 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 792 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
793 | frmSettings.showMaximized(); | 793 | frmSettings.showMaximized(); |
794 | #endif | 794 | #endif |
795 | 795 | ||
796 | if ( frmSettings.exec() ) { | 796 | if ( frmSettings.exec() ) { |
797 | allFields.clear(); | 797 | allFields.clear(); |
798 | orderedFields.clear(); | 798 | orderedFields.clear(); |
799 | slOrderedFields.clear(); | 799 | slOrderedFields.clear(); |
800 | initFields(); | 800 | initFields(); |
801 | if ( abEditor ) | 801 | if ( abEditor ) |
802 | abEditor->loadFields(); | 802 | abEditor->loadFields(); |
803 | abList->refresh(); | 803 | abList->refresh(); |
804 | } | 804 | } |
805 | } | 805 | } |
806 | 806 | ||
807 | 807 | ||
808 | void AddressbookWindow::initFields() | 808 | void AddressbookWindow::initFields() |
809 | { | 809 | { |
810 | // we really don't need the things from the configuration, anymore | 810 | // we really don't need the things from the configuration, anymore |
811 | // only thing that is important are the important categories. So, | 811 | // only thing that is important are the important categories. So, |
812 | // Call the contact functions that correspond to these old functions... | 812 | // Call the contact functions that correspond to these old functions... |
813 | 813 | ||
814 | QStringList xmlFields = OContact::fields(); | 814 | QStringList xmlFields = OContact::fields(); |
815 | QStringList visibleFields = OContact::untrfields(); | 815 | QStringList visibleFields = OContact::untrfields(); |
816 | // QStringList trFields = OContact::trfields(); | 816 | // QStringList trFields = OContact::trfields(); |
817 | 817 | ||
818 | xmlFields.remove( "Title" ); | 818 | xmlFields.remove( "Title" ); |
819 | visibleFields.remove( "Name Title" ); | 819 | visibleFields.remove( "Name Title" ); |
820 | visibleFields.remove( "Notes" ); | 820 | visibleFields.remove( "Notes" ); |
821 | 821 | ||
822 | int i, version; | 822 | int i, version; |
823 | Config cfg( "AddressBook" ); | 823 | Config cfg( "AddressBook" ); |
824 | QString zn; | 824 | QString zn; |
825 | 825 | ||
826 | // ### Write a function to keep this from happening again... | 826 | // ### Write a function to keep this from happening again... |
827 | QStringList::ConstIterator it; | 827 | QStringList::ConstIterator it; |
828 | for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) { | 828 | for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) { |
829 | allFields.append( i + 3 ); | 829 | allFields.append( i + 3 ); |
830 | } | 830 | } |
831 | 831 | ||
832 | cfg.setGroup( "Version" ); | 832 | cfg.setGroup( "Version" ); |
833 | version = cfg.readNumEntry( "version" ); | 833 | version = cfg.readNumEntry( "version" ); |
834 | i = 0; | 834 | i = 0; |
835 | startFontSize = 1; | 835 | startFontSize = 1; |
836 | 836 | ||
837 | if ( version >= ADDRESSVERSION ) { | 837 | if ( version >= ADDRESSVERSION ) { |
838 | 838 | ||
839 | cfg.setGroup( "ImportantCategory" ); | 839 | cfg.setGroup( "ImportantCategory" ); |
840 | 840 | ||
841 | zn = cfg.readEntry( "Category" + QString::number(i), QString::null ); | 841 | zn = cfg.readEntry( "Category" + QString::number(i), QString::null ); |
842 | while ( !zn.isNull() ) { | 842 | while ( !zn.isNull() ) { |
843 | if ( zn.contains( "Work" ) || zn.contains( "Mb" ) ) { | 843 | if ( zn.contains( "Work" ) || zn.contains( "Mb" ) ) { |
844 | slOrderedFields.clear(); | 844 | slOrderedFields.clear(); |
845 | break; | 845 | break; |
846 | } | 846 | } |
847 | slOrderedFields.append( zn ); | 847 | slOrderedFields.append( zn ); |
848 | zn = cfg.readEntry( "Category" + QString::number(++i), QString::null ); | 848 | zn = cfg.readEntry( "Category" + QString::number(++i), QString::null ); |
849 | } | 849 | } |
850 | cfg.setGroup( "Font" ); | 850 | cfg.setGroup( "Font" ); |
851 | startFontSize = cfg.readNumEntry( "fontSize", 1 ); | 851 | startFontSize = cfg.readNumEntry( "fontSize", 1 ); |
852 | 852 | ||
853 | 853 | ||
854 | } else { | 854 | } else { |
855 | QString str; | 855 | QString str; |
856 | str = getenv("HOME"); | 856 | str = getenv("HOME"); |
857 | str += "/Settings/AddressBook.conf"; | 857 | str += "/Settings/AddressBook.conf"; |
858 | QFile::remove( str ); | 858 | QFile::remove( str ); |
859 | } | 859 | } |
860 | |||
860 | if ( slOrderedFields.count() > 0 ) { | 861 | if ( slOrderedFields.count() > 0 ) { |
861 | for( QStringList::ConstIterator it = slOrderedFields.begin(); | 862 | for( QStringList::ConstIterator it = slOrderedFields.begin(); |
862 | it != slOrderedFields.end(); ++it ) { | 863 | it != slOrderedFields.end(); ++it ) { |
863 | QValueList<int>::ConstIterator itVl; | 864 | QValueList<int>::ConstIterator itVl; |
864 | QStringList::ConstIterator itVis; | 865 | QStringList::ConstIterator itVis; |
865 | itVl = allFields.begin(); | 866 | itVl = allFields.begin(); |
866 | for ( itVis = visibleFields.begin(); | 867 | for ( itVis = visibleFields.begin(); |
867 | itVis != visibleFields.end() && itVl != allFields.end(); | 868 | itVis != visibleFields.end() && itVl != allFields.end(); |
868 | ++itVis, ++itVl ) { | 869 | ++itVis, ++itVl ) { |
869 | if ( *it == *itVis && itVl != allFields.end() ) { | 870 | if ( *it == *itVis && itVl != allFields.end() ) { |
870 | orderedFields.append( *itVl ); | 871 | orderedFields.append( *itVl ); |
871 | } | 872 | } |
872 | } | 873 | } |
873 | } | 874 | } |
874 | } else { | 875 | } else { |
875 | QValueList<int>::ConstIterator it; | 876 | QValueList<int>::ConstIterator it; |
876 | for ( it = allFields.begin(); it != allFields.end(); ++it ) | 877 | for ( it = allFields.begin(); it != allFields.end(); ++it ) |
877 | orderedFields.append( *it ); | 878 | orderedFields.append( *it ); |
878 | 879 | ||
879 | slOrderedFields = visibleFields; | 880 | slOrderedFields = visibleFields; |
880 | orderedFields.remove( Qtopia::AddressUid ); | 881 | orderedFields.remove( Qtopia::AddressUid ); |
881 | orderedFields.remove( Qtopia::Title ); | 882 | orderedFields.remove( Qtopia::Title ); |
882 | orderedFields.remove( Qtopia::Groups ); | 883 | orderedFields.remove( Qtopia::Groups ); |
883 | orderedFields.remove( Qtopia::AddressCategory ); | 884 | orderedFields.remove( Qtopia::AddressCategory ); |
884 | orderedFields.remove( Qtopia::FirstName ); | 885 | orderedFields.remove( Qtopia::FirstName ); |
885 | orderedFields.remove( Qtopia::LastName ); | 886 | orderedFields.remove( Qtopia::LastName ); |
886 | orderedFields.remove( Qtopia::DefaultEmail ); | 887 | orderedFields.remove( Qtopia::DefaultEmail ); |
887 | orderedFields.remove( Qtopia::FileAs ); | 888 | orderedFields.remove( Qtopia::FileAs ); |
888 | orderedFields.remove( Qtopia::Notes ); | 889 | orderedFields.remove( Qtopia::Notes ); |
889 | orderedFields.remove( Qtopia::Gender ); | 890 | orderedFields.remove( Qtopia::Gender ); |
890 | slOrderedFields.remove( "Name Title" ); | 891 | slOrderedFields.remove( "Name Title" ); |
891 | slOrderedFields.remove( "First Name" ); | 892 | slOrderedFields.remove( "First Name" ); |
892 | slOrderedFields.remove( "Last Name" ); | 893 | slOrderedFields.remove( "Last Name" ); |
893 | slOrderedFields.remove( "File As" ); | 894 | slOrderedFields.remove( "File As" ); |
894 | slOrderedFields.remove( "Default Email" ); | 895 | slOrderedFields.remove( "Default Email" ); |
895 | slOrderedFields.remove( "Notes" ); | 896 | slOrderedFields.remove( "Notes" ); |
896 | slOrderedFields.remove( "Gender" ); | 897 | slOrderedFields.remove( "Gender" ); |
897 | 898 | ||
898 | } | 899 | } |
899 | } | 900 | } |
900 | 901 | ||
901 | 902 | ||
902 | AbLabel *AddressbookWindow::abView() | 903 | AbLabel *AddressbookWindow::abView() |
903 | { | 904 | { |
904 | if ( !mView ) { | 905 | if ( !mView ) { |
905 | mView = new AbLabel( this, "viewer" ); | 906 | mView = new AbLabel( this, "viewer" ); |
906 | mView->init( OContact() ); | 907 | mView->init( OContact() ); |
907 | connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); | 908 | connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); |
908 | } | 909 | } |
909 | return mView; | 910 | return mView; |
910 | } | 911 | } |
911 | 912 | ||
912 | void AddressbookWindow::slotFind() | 913 | void AddressbookWindow::slotFind() |
913 | { | 914 | { |
914 | #ifndef MAKE_FOR_SHARP_ROM | 915 | #ifndef MAKE_FOR_SHARP_ROM |
915 | if ( centralWidget() == abView() ) | 916 | if ( centralWidget() == abView() ) |
916 | showList(); | 917 | showList(); |
917 | 918 | ||
918 | FindDialog frmFind( "Contacts", this ); | 919 | FindDialog frmFind( "Contacts", this ); |
919 | QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); | 920 | QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); |
920 | QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); | 921 | QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); |
921 | QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); | 922 | QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); |
922 | 923 | ||
923 | frmFind.exec(); | 924 | frmFind.exec(); |
924 | 925 | ||
925 | if ( abList->numSelections() ) | 926 | if ( abList->numSelections() ) |
926 | abList->clearSelection(); | 927 | abList->clearSelection(); |
927 | 928 | ||
928 | abList->clearFindRow(); | 929 | abList->clearFindRow(); |
929 | #endif | 930 | #endif |
930 | } | 931 | } |
931 | 932 | ||
932 | void AddressbookWindow::slotSetCategory( int c ) | 933 | void AddressbookWindow::slotSetCategory( int c ) |
933 | { | 934 | { |
934 | 935 | ||
935 | QString cat, book; | 936 | QString cat, book; |
936 | 937 | ||
937 | if ( c <= 0 ) | 938 | if ( c <= 0 ) |
938 | return; | 939 | return; |
939 | 940 | ||
940 | // Checkmark Book Menu Item Selected | 941 | // Checkmark Book Menu Item Selected |
941 | if ( c < 6 ) | 942 | if ( c < 6 ) |
942 | for ( unsigned int i = 1; i < 6; i++ ) | 943 | for ( unsigned int i = 1; i < 6; i++ ) |
943 | catMenu->setItemChecked( i, c == (int)i ); | 944 | catMenu->setItemChecked( i, c == (int)i ); |
944 | 945 | ||
945 | // Checkmark Category Menu Item Selected | 946 | // Checkmark Category Menu Item Selected |
946 | else | 947 | else |
947 | for ( unsigned int i = 6; i < catMenu->count(); i++ ) | 948 | for ( unsigned int i = 6; i < catMenu->count(); i++ ) |
948 | catMenu->setItemChecked( i, c == (int)i ); | 949 | catMenu->setItemChecked( i, c == (int)i ); |
949 | 950 | ||
950 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { | 951 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { |
951 | if (catMenu->isItemChecked( i )) { | 952 | if (catMenu->isItemChecked( i )) { |
952 | if ( i == 1 ) // default List view | 953 | if ( i == 1 ) // default List view |
953 | book = QString::null; | 954 | book = QString::null; |
954 | else if ( i == 2 ) | 955 | else if ( i == 2 ) |
955 | book = "Phone"; | 956 | book = "Phone"; |
956 | else if ( i == 3 ) | 957 | else if ( i == 3 ) |
957 | book = "Company"; | 958 | book = "Company"; |
958 | else if ( i == 4 ) | 959 | else if ( i == 4 ) |
959 | book = "Email"; | 960 | book = "Email"; |
960 | else if ( i == 5 ) | 961 | else if ( i == 5 ) |
961 | book = "Cards"; | 962 | book = "Cards"; |
962 | else if ( i == 6 ) // default All Categories | 963 | else if ( i == 6 ) // default All Categories |
963 | cat = QString::null; | 964 | cat = QString::null; |
964 | else if ( i == (unsigned int)catMenu->count() ) // last menu option will be Unfiled | 965 | else if ( i == (unsigned int)catMenu->count() ) // last menu option will be Unfiled |
965 | cat = "Unfiled"; | 966 | cat = "Unfiled"; |
966 | else | 967 | else |
967 | cat = abList->categories()[i - 7]; | 968 | cat = abList->categories()[i - 7]; |
968 | } | 969 | } |
969 | } | 970 | } |
970 | 971 | ||
971 | abList->setShowCategory( book, cat ); | 972 | abList->setShowCategory( book, cat ); |
972 | 973 | ||
973 | if ( book.isEmpty() ) | 974 | if ( book.isEmpty() ) |
974 | book = "List"; | 975 | book = "List"; |
975 | if ( cat.isEmpty() ) | 976 | if ( cat.isEmpty() ) |
976 | cat = "All"; | 977 | cat = "All"; |
977 | 978 | ||
978 | setCaption( tr( "Contacts" ) + " - " + tr( book ) + " - " + tr( cat ) ); | 979 | setCaption( tr( "Contacts" ) + " - " + tr( book ) + " - " + tr( cat ) ); |
979 | } | 980 | } |
980 | 981 | ||
981 | void AddressbookWindow::slotSetLetter( char c ) { | 982 | void AddressbookWindow::slotSetLetter( char c ) { |
982 | 983 | ||
983 | abList->setShowByLetter( c ); | 984 | abList->setShowByLetter( c ); |
984 | 985 | ||
985 | } | 986 | } |
986 | 987 | ||
987 | void AddressbookWindow::populateCategories() | 988 | void AddressbookWindow::populateCategories() |
988 | { | 989 | { |
989 | catMenu->clear(); | 990 | catMenu->clear(); |
990 | 991 | ||
991 | int id, rememberId; | 992 | int id, rememberId; |
992 | id = 1; | 993 | id = 1; |
993 | rememberId = 0; | 994 | rememberId = 0; |
994 | 995 | ||
995 | catMenu->insertItem( tr( "List" ), id++ ); | 996 | catMenu->insertItem( tr( "List" ), id++ ); |
996 | catMenu->insertItem( tr( "Phone Book" ), id++ ); | 997 | catMenu->insertItem( tr( "Phone Book" ), id++ ); |
997 | catMenu->insertItem( tr( "Company Book" ), id++ ); | 998 | catMenu->insertItem( tr( "Company Book" ), id++ ); |
998 | catMenu->insertItem( tr( "Email Book" ), id++ ); | 999 | catMenu->insertItem( tr( "Email Book" ), id++ ); |
999 | catMenu->insertItem( tr( "Cards" ), id++ ); | 1000 | catMenu->insertItem( tr( "Cards" ), id++ ); |
1000 | catMenu->insertSeparator(); | 1001 | catMenu->insertSeparator(); |
1001 | 1002 | ||
1002 | catMenu->insertItem( tr( "All" ), id++ ); | 1003 | catMenu->insertItem( tr( "All" ), id++ ); |
1003 | QStringList categories = abList->categories(); | 1004 | QStringList categories = abList->categories(); |
1004 | categories.append( tr( "Unfiled" ) ); | 1005 | categories.append( tr( "Unfiled" ) ); |
1005 | for ( QStringList::Iterator it = categories.begin(); | 1006 | for ( QStringList::Iterator it = categories.begin(); |
1006 | it != categories.end(); ++it ) { | 1007 | it != categories.end(); ++it ) { |
1007 | catMenu->insertItem( *it, id ); | 1008 | catMenu->insertItem( *it, id ); |
1008 | if ( *it == abList->showCategory() ) | 1009 | if ( *it == abList->showCategory() ) |
1009 | rememberId = id; | 1010 | rememberId = id; |
1010 | ++id; | 1011 | ++id; |
1011 | } | 1012 | } |
1012 | 1013 | ||
1013 | if ( abList->showBook().isEmpty() ) { | 1014 | if ( abList->showBook().isEmpty() ) { |
1014 | catMenu->setItemChecked( 1, true ); | 1015 | catMenu->setItemChecked( 1, true ); |
1015 | } else if ( abList->showBook() == "Phone" ) { | 1016 | } else if ( abList->showBook() == "Phone" ) { |
1016 | catMenu->setItemChecked( 2, true ); | 1017 | catMenu->setItemChecked( 2, true ); |
1017 | } else if ( abList->showBook() == "Company" ) { | 1018 | } else if ( abList->showBook() == "Company" ) { |
1018 | catMenu->setItemChecked( 3, true ); | 1019 | catMenu->setItemChecked( 3, true ); |
1019 | } else if ( abList->showBook() == "Email" ) { | 1020 | } else if ( abList->showBook() == "Email" ) { |
1020 | catMenu->setItemChecked( 4, true ); | 1021 | catMenu->setItemChecked( 4, true ); |
1021 | } else if ( abList->showBook() == "Cards" ) { | 1022 | } else if ( abList->showBook() == "Cards" ) { |
1022 | catMenu->setItemChecked( 5, true ); | 1023 | catMenu->setItemChecked( 5, true ); |
1023 | } | 1024 | } |
1024 | 1025 | ||
1025 | if ( abList->showCategory().isEmpty() ) { | 1026 | if ( abList->showCategory().isEmpty() ) { |
1026 | slotSetCategory( 6 ); | 1027 | slotSetCategory( 6 ); |
1027 | } | 1028 | } |
1028 | else { | 1029 | else { |
1029 | slotSetCategory( rememberId ); | 1030 | slotSetCategory( rememberId ); |
1030 | } | 1031 | } |
1031 | } | 1032 | } |
1032 | 1033 | ||
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index b01583f..bae3a2b 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -1,1760 +1,1774 @@ | |||
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 | ||
40 | static inline bool containsAlphaNum( const QString &str ); | 40 | static inline bool containsAlphaNum( const QString &str ); |
41 | static inline bool constainsWhiteSpace( const QString &str ); | 41 | static 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... |
45 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 45 | void 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... |
49 | void parseEmailTo( const QString &strDefaultEmail, | 49 | void parseEmailTo( const QString &strDefaultEmail, |
50 | const QString &strOtherEmail, QString &strBack ); | 50 | const QString &strOtherEmail, QString &strBack ); |
51 | 51 | ||
52 | ContactEditor::ContactEditor(const OContact &entry, | 52 | ContactEditor::ContactEditor(const OContact &entry, |
53 | const QValueList<int> *newOrderedValues, | 53 | const QValueList<int> *newOrderedValues, |
54 | QStringList *slNewOrdered, | 54 | QStringList *slNewOrdered, |
55 | QWidget *parent, | 55 | QWidget *parent, |
56 | const char *name, | 56 | const char *name, |
57 | WFlags fl ) | 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 | ||
69 | ContactEditor::~ContactEditor() { | 69 | ContactEditor::~ContactEditor() { |
70 | } | 70 | } |
71 | 71 | ||
72 | void ContactEditor::init() { | 72 | void ContactEditor::init() { |
73 | 73 | ||
74 | useFullName = TRUE; | 74 | useFullName = TRUE; |
75 | 75 | ||
76 | int i = 0; | 76 | int i = 0; |
77 | /** SHut up and stop leaking | 77 | /** SHut up and stop leaking |
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 | QStringList trlChooserNames; | ||
88 | |||
87 | for (i = 0; i <= 6; i++) { | 89 | for (i = 0; i <= 6; i++) { |
88 | slHomeAddress.append( "" ); | 90 | slHomeAddress.append( "" ); |
89 | slBusinessAddress.append( "" ); | 91 | slBusinessAddress.append( "" ); |
90 | } | 92 | } |
91 | 93 | ||
92 | { | 94 | { |
93 | hasGender = FALSE; | 95 | hasGender = FALSE; |
94 | hasTitle = FALSE; | 96 | hasTitle = FALSE; |
95 | hasCompany = FALSE; | 97 | hasCompany = FALSE; |
96 | hasNotes = FALSE; | 98 | hasNotes = FALSE; |
97 | hasStreet = FALSE; | 99 | hasStreet = FALSE; |
98 | hasStreet2 = FALSE; | 100 | hasStreet2 = FALSE; |
99 | hasPOBox = FALSE; | 101 | hasPOBox = FALSE; |
100 | hasCity = FALSE; | 102 | hasCity = FALSE; |
101 | hasState = FALSE; | 103 | hasState = FALSE; |
102 | hasZip = FALSE; | 104 | hasZip = FALSE; |
103 | hasCountry = FALSE; | 105 | hasCountry = FALSE; |
104 | 106 | ||
105 | QStringList::ConstIterator it = slOrdered.begin(); | 107 | QStringList::ConstIterator it = slOrdered.begin(); |
108 | |||
106 | for ( i = 0; it != slOrdered.end(); i++, ++it ) { | 109 | for ( i = 0; it != slOrdered.end(); i++, ++it ) { |
107 | 110 | ||
108 | if ( (*it) == "Business Fax" ) { | 111 | if ( (*it) == "Business Fax" ) { |
109 | slChooserNames.append( tr( "Business Fax" ) ); | 112 | trlChooserNames.append( tr( "Business Fax" ) ); |
113 | slChooserNames.append( *it ); | ||
110 | slChooserValues.append("" ); | 114 | slChooserValues.append("" ); |
111 | //slDynamicEntries->remove( it ); | 115 | //slDynamicEntries->remove( it ); |
112 | continue; | 116 | continue; |
113 | } | 117 | } |
114 | 118 | ||
115 | if ( (*it) == "Home Fax" ) { | 119 | if ( (*it) == "Home Fax" ) { |
116 | slChooserNames.append( tr( "Home Fax" ) ); | 120 | trlChooserNames.append( tr( "Home Fax" ) ); |
121 | slChooserNames.append( *it ); | ||
117 | slChooserValues.append("" ); | 122 | slChooserValues.append("" ); |
118 | //slDynamicEntries->remove( it ); | 123 | //slDynamicEntries->remove( it ); |
119 | continue; | 124 | continue; |
120 | } | 125 | } |
121 | 126 | ||
122 | 127 | ||
123 | if ( (*it) == "Business Phone" ) { | 128 | if ( (*it) == "Business Phone" ) { |
124 | slChooserNames.append( tr( "Business Phone" ) ); | 129 | trlChooserNames.append( tr( "Business Phone" ) ); |
130 | slChooserNames.append( *it ); | ||
125 | slChooserValues.append( "" ); | 131 | slChooserValues.append( "" ); |
126 | //slDynamicEntries->remove( it ); | 132 | //slDynamicEntries->remove( it ); |
127 | continue; | 133 | continue; |
128 | } | 134 | } |
129 | 135 | ||
130 | if ( (*it) == "Home Phone" ) { | 136 | if ( (*it) == "Home Phone" ) { |
131 | slChooserNames.append( tr( "Home Phone" ) ); | 137 | trlChooserNames.append( tr( "Home Phone" ) ); |
138 | slChooserNames.append( *it ); | ||
132 | slChooserValues.append( "" ); | 139 | slChooserValues.append( "" ); |
133 | //slDynamicEntries->remove( it ); | 140 | //slDynamicEntries->remove( it ); |
134 | continue; | 141 | continue; |
135 | } | 142 | } |
136 | 143 | ||
137 | /* | 144 | /* |
138 | if ( (*it).right( 2 ) == tr( "IM" ) ) { | 145 | if ( (*it).right( 2 ) == tr( "IM" ) ) { |
139 | slChooserNames.append( *it ); | 146 | slChooserNames.append( *it ); |
140 | slChooserValues.append( "" ); | 147 | slChooserValues.append( "" ); |
141 | //slDynamicEntries->remove( it ); | 148 | //slDynamicEntries->remove( it ); |
142 | continue; | 149 | continue; |
143 | } */ | 150 | } */ |
144 | 151 | ||
145 | if ( (*it) == "Business Mobile" ) { | 152 | if ( (*it) == "Business Mobile" ) { |
146 | slChooserNames.append( tr( "Business Mobile" ) ); | 153 | trlChooserNames.append( tr( "Business Mobile" ) ); |
154 | slChooserNames.append( *it ); | ||
147 | slChooserValues.append( "" ); | 155 | slChooserValues.append( "" ); |
148 | //slDynamicEntries->remove( it ); | 156 | //slDynamicEntries->remove( it ); |
149 | continue; | 157 | continue; |
150 | } | 158 | } |
151 | 159 | ||
152 | if ( (*it) == "Home Mobile" ) { | 160 | if ( (*it) == "Home Mobile" ) { |
153 | slChooserNames.append( tr( "Home Mobile" ) ); | 161 | trlChooserNames.append( tr( "Home Mobile" ) ); |
162 | slChooserNames.append( *it ); | ||
154 | slChooserValues.append( "" ); | 163 | slChooserValues.append( "" ); |
155 | //slDynamicEntries->remove( it ); | 164 | //slDynamicEntries->remove( it ); |
156 | continue; | 165 | continue; |
157 | } | 166 | } |
158 | 167 | ||
159 | 168 | ||
160 | if ( (*it) == "Business WebPage" ) { | 169 | if ( (*it) == "Business WebPage" ) { |
161 | slChooserNames.append( tr( "Business WebPage" ) ); | 170 | trlChooserNames.append( tr( "Business WebPage" ) ); |
171 | slChooserNames.append( *it ); | ||
162 | slChooserValues.append( "" ); | 172 | slChooserValues.append( "" ); |
163 | //slDynamicEntries->remove( it ); | 173 | //slDynamicEntries->remove( it ); |
164 | continue; | 174 | continue; |
165 | } | 175 | } |
166 | 176 | ||
167 | if ( (*it) == "Home Web Page" ) { | 177 | if ( (*it) == "Home Web Page" ) { |
168 | slChooserNames.append( tr( "Home Web Page" ) ); | 178 | trlChooserNames.append( tr( "Home Web Page" ) ); |
179 | slChooserNames.append( *it ); | ||
169 | slChooserValues.append( "" ); | 180 | slChooserValues.append( "" ); |
170 | //slDynamicEntries->remove( it ); | 181 | //slDynamicEntries->remove( it ); |
171 | continue; | 182 | continue; |
172 | } | 183 | } |
173 | 184 | ||
174 | if ( (*it) == "Business Pager" ) { | 185 | if ( (*it) == "Business Pager" ) { |
175 | slChooserNames.append( tr( "Business Pager" ) ); | 186 | trlChooserNames.append( tr( "Business Pager" ) ); |
187 | slChooserNames.append( *it ); | ||
176 | slChooserValues.append( "" ); | 188 | slChooserValues.append( "" ); |
177 | //slDynamicEntries->remove( it ); | 189 | //slDynamicEntries->remove( it ); |
178 | continue; | 190 | continue; |
179 | } | 191 | } |
180 | 192 | ||
181 | if ( *it == "Default Email" ) { | 193 | if ( *it == "Default Email" ) { |
182 | slChooserNames.append( tr( "Default Email" ) ); | 194 | trlChooserNames.append( tr( "Default Email" ) ); |
195 | slChooserNames.append( *it ); | ||
183 | slChooserValues.append( "" ); | 196 | slChooserValues.append( "" ); |
184 | //slDynamicEntries->remove( it ); | 197 | //slDynamicEntries->remove( it ); |
185 | continue; | 198 | continue; |
186 | } | 199 | } |
187 | 200 | ||
188 | if ( *it == "Emails" ) { | 201 | if ( *it == "Emails" ) { |
189 | slChooserNames.append( tr( "Emails" ) ); | 202 | trlChooserNames.append( tr( "Emails" ) ); |
203 | slChooserNames.append( *it ); | ||
190 | slChooserValues.append( "" ); | 204 | slChooserValues.append( "" ); |
191 | //slDynamicEntries->remove( it ); | 205 | //slDynamicEntries->remove( it ); |
192 | continue; | 206 | continue; |
193 | } | 207 | } |
194 | 208 | ||
195 | if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" ) | 209 | if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" ) |
196 | continue; | 210 | continue; |
197 | 211 | ||
198 | if ( *it == "Name Title" ) { | 212 | if ( *it == "Name Title" ) { |
199 | //slDynamicEntries->remove( it ); | 213 | //slDynamicEntries->remove( it ); |
200 | continue; | 214 | continue; |
201 | } | 215 | } |
202 | 216 | ||
203 | if ( *it == "First Name" ) { | 217 | if ( *it == "First Name" ) { |
204 | //slDynamicEntries->remove( it ); | 218 | //slDynamicEntries->remove( it ); |
205 | continue; | 219 | continue; |
206 | } | 220 | } |
207 | 221 | ||
208 | if ( *it == "Middle Name" ) { | 222 | if ( *it == "Middle Name" ) { |
209 | //slDynamicEntries->remove( it ); | 223 | //slDynamicEntries->remove( it ); |
210 | continue; | 224 | continue; |
211 | } | 225 | } |
212 | 226 | ||
213 | if ( *it == "Last Name" ) { | 227 | if ( *it == "Last Name" ) { |
214 | //slDynamicEntries->remove( it ); | 228 | //slDynamicEntries->remove( it ); |
215 | continue; | 229 | continue; |
216 | } | 230 | } |
217 | 231 | ||
218 | if ( *it == "Suffix" ) { | 232 | if ( *it == "Suffix" ) { |
219 | //slDynamicEntries->remove( it ); | 233 | //slDynamicEntries->remove( it ); |
220 | continue; | 234 | continue; |
221 | } | 235 | } |
222 | 236 | ||
223 | if ( *it == "File As" ) { | 237 | if ( *it == "File As" ) { |
224 | //slDynamicEntries->remove( it ); | 238 | //slDynamicEntries->remove( it ); |
225 | continue; | 239 | continue; |
226 | } | 240 | } |
227 | 241 | ||
228 | if ( *it == "Gender" ) { | 242 | if ( *it == "Gender" ) { |
229 | hasGender = TRUE; | 243 | hasGender = TRUE; |
230 | //slDynamicEntries->remove( it ); | 244 | //slDynamicEntries->remove( it ); |
231 | continue; | 245 | continue; |
232 | } | 246 | } |
233 | 247 | ||
234 | if ( *it == "Job Title" ) { | 248 | if ( *it == "Job Title" ) { |
235 | hasTitle = TRUE; | 249 | hasTitle = TRUE; |
236 | //slDynamicEntries->remove( it ); | 250 | //slDynamicEntries->remove( it ); |
237 | continue; | 251 | continue; |
238 | } | 252 | } |
239 | 253 | ||
240 | if ( ( *it == "Company") || (*it == "Organization" ) ) { | 254 | if ( ( *it == "Company") || (*it == "Organization" ) ) { |
241 | hasCompany = TRUE; | 255 | hasCompany = TRUE; |
242 | //slDynamicEntries->remove( it ); | 256 | //slDynamicEntries->remove( it ); |
243 | continue; | 257 | continue; |
244 | } | 258 | } |
245 | 259 | ||
246 | if ( *it == "Notes" ) { | 260 | if ( *it == "Notes" ) { |
247 | hasNotes = TRUE; | 261 | hasNotes = TRUE; |
248 | //slDynamicEntries->remove( it ); | 262 | //slDynamicEntries->remove( it ); |
249 | continue; | 263 | continue; |
250 | } | 264 | } |
251 | 265 | ||
252 | if ( *it == "Groups" ) { | 266 | if ( *it == "Groups" ) { |
253 | //slDynamicEntries->remove( it ); | 267 | //slDynamicEntries->remove( it ); |
254 | continue; | 268 | continue; |
255 | } | 269 | } |
256 | 270 | ||
257 | if ( (*it) == "Business Street" ) { | 271 | if ( (*it) == "Business Street" ) { |
258 | hasStreet = TRUE; | 272 | hasStreet = TRUE; |
259 | //slDynamicEntries->remove( it ); | 273 | //slDynamicEntries->remove( it ); |
260 | continue; | 274 | continue; |
261 | } | 275 | } |
262 | 276 | ||
263 | if ( (*it) == "Home Street" ) { | 277 | if ( (*it) == "Home Street" ) { |
264 | hasStreet = TRUE; | 278 | hasStreet = TRUE; |
265 | //slDynamicEntries->remove( it ); | 279 | //slDynamicEntries->remove( it ); |
266 | continue; | 280 | continue; |
267 | } | 281 | } |
268 | /* | 282 | /* |
269 | if ( (*it).right( 8 ) == tr( "Street 2" ) ) { | 283 | if ( (*it).right( 8 ) == tr( "Street 2" ) ) { |
270 | hasStreet2 = TRUE; | 284 | hasStreet2 = TRUE; |
271 | //slDynamicEntries->remove( it ); | 285 | //slDynamicEntries->remove( it ); |
272 | continue; | 286 | continue; |
273 | } | 287 | } |
274 | 288 | ||
275 | if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { | 289 | if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { |
276 | hasPOBox = TRUE; | 290 | hasPOBox = TRUE; |
277 | //slDynamicEntries->remove( it ); | 291 | //slDynamicEntries->remove( it ); |
278 | continue; | 292 | continue; |
279 | } */ | 293 | } */ |
280 | 294 | ||
281 | if ( (*it) == "Business City" ) { | 295 | if ( (*it) == "Business City" ) { |
282 | hasCity = TRUE; | 296 | hasCity = TRUE; |
283 | //slDynamicEntries->remove( it ); | 297 | //slDynamicEntries->remove( it ); |
284 | continue; | 298 | continue; |
285 | } | 299 | } |
286 | 300 | ||
287 | if ( (*it) == "Business State" ) { | 301 | if ( (*it) == "Business State" ) { |
288 | hasState = TRUE; | 302 | hasState = TRUE; |
289 | //slDynamicEntries->remove( it ); | 303 | //slDynamicEntries->remove( it ); |
290 | continue; | 304 | continue; |
291 | } | 305 | } |
292 | 306 | ||
293 | if ( (*it) == "Business Zip" ) { | 307 | if ( (*it) == "Business Zip" ) { |
294 | hasZip = TRUE; | 308 | hasZip = TRUE; |
295 | //slDynamicEntries->remove( it ); | 309 | //slDynamicEntries->remove( it ); |
296 | continue; | 310 | continue; |
297 | } | 311 | } |
298 | 312 | ||
299 | if ( (*it) == "Business Country" ) { | 313 | if ( (*it) == "Business Country" ) { |
300 | hasCountry = TRUE; | 314 | hasCountry = TRUE; |
301 | //slDynamicEntries->remove( it ); | 315 | //slDynamicEntries->remove( it ); |
302 | continue; | 316 | continue; |
303 | } | 317 | } |
304 | 318 | ||
305 | if ( (*it) == "Home City" ) { | 319 | if ( (*it) == "Home City" ) { |
306 | hasCity = TRUE; | 320 | hasCity = TRUE; |
307 | //slDynamicEntries->remove( it ); | 321 | //slDynamicEntries->remove( it ); |
308 | continue; | 322 | continue; |
309 | } | 323 | } |
310 | 324 | ||
311 | if ( (*it) == "Home State" ) { | 325 | if ( (*it) == "Home State" ) { |
312 | hasState = TRUE; | 326 | hasState = TRUE; |
313 | //slDynamicEntries->remove( it ); | 327 | //slDynamicEntries->remove( it ); |
314 | continue; | 328 | continue; |
315 | } | 329 | } |
316 | 330 | ||
317 | if ( (*it) == "Home Zip" ) { | 331 | if ( (*it) == "Home Zip" ) { |
318 | hasZip = TRUE; | 332 | hasZip = TRUE; |
319 | //slDynamicEntries->remove( it ); | 333 | //slDynamicEntries->remove( it ); |
320 | continue; | 334 | continue; |
321 | } | 335 | } |
322 | 336 | ||
323 | if ( (*it) == "Home Country" ) { | 337 | if ( (*it) == "Home Country" ) { |
324 | hasCountry = TRUE; | 338 | hasCountry = TRUE; |
325 | //slDynamicEntries->remove( it ); | 339 | //slDynamicEntries->remove( it ); |
326 | continue; | 340 | continue; |
327 | } | 341 | } |
328 | 342 | ||
329 | 343 | ||
330 | slDynamicEntries.append( *it ); | 344 | slDynamicEntries.append( *it ); |
331 | } | 345 | } |
332 | } | 346 | } |
333 | 347 | ||
334 | QVBoxLayout *vb = new QVBoxLayout( this ); | 348 | QVBoxLayout *vb = new QVBoxLayout( this ); |
335 | 349 | ||
336 | tabMain = new QTabWidget( this ); | 350 | tabMain = new QTabWidget( this ); |
337 | vb->addWidget( tabMain ); | 351 | vb->addWidget( tabMain ); |
338 | 352 | ||
339 | QWidget *tabViewport = new QWidget ( tabMain ); | 353 | QWidget *tabViewport = new QWidget ( tabMain ); |
340 | 354 | ||
341 | vb = new QVBoxLayout( tabViewport ); | 355 | vb = new QVBoxLayout( tabViewport ); |
342 | 356 | ||
343 | svGeneral = new QScrollView( tabViewport ); | 357 | svGeneral = new QScrollView( tabViewport ); |
344 | vb->addWidget( svGeneral, 0, 0 ); | 358 | vb->addWidget( svGeneral, 0, 0 ); |
345 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 359 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
346 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 360 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
347 | 361 | ||
348 | QWidget *container = new QWidget( svGeneral->viewport() ); | 362 | QWidget *container = new QWidget( svGeneral->viewport() ); |
349 | svGeneral->addChild( container ); | 363 | svGeneral->addChild( container ); |
350 | 364 | ||
351 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 365 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); |
352 | gl->setResizeMode( QLayout::FreeResize ); | 366 | gl->setResizeMode( QLayout::FreeResize ); |
353 | 367 | ||
354 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 368 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
355 | gl->addWidget( btnFullName, 0, 0 ); | 369 | gl->addWidget( btnFullName, 0, 0 ); |
356 | txtFullName = new QLineEdit( container ); | 370 | txtFullName = new QLineEdit( container ); |
357 | gl->addWidget( txtFullName, 0, 1 ); | 371 | gl->addWidget( txtFullName, 0, 1 ); |
358 | 372 | ||
359 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 373 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
360 | gl->addWidget( l, 1, 0 ); | 374 | gl->addWidget( l, 1, 0 ); |
361 | txtJobTitle = new QLineEdit( container ); | 375 | txtJobTitle = new QLineEdit( container ); |
362 | gl->addWidget( txtJobTitle, 1, 1 ); | 376 | gl->addWidget( txtJobTitle, 1, 1 ); |
363 | 377 | ||
364 | l = new QLabel( tr( "Organization" ), container ); | 378 | l = new QLabel( tr( "Organization" ), container ); |
365 | gl->addWidget( l, 2, 0 ); | 379 | gl->addWidget( l, 2, 0 ); |
366 | txtOrganization = new QLineEdit( container ); | 380 | txtOrganization = new QLineEdit( container ); |
367 | gl->addWidget( txtOrganization, 2, 1 ); | 381 | gl->addWidget( txtOrganization, 2, 1 ); |
368 | 382 | ||
369 | cmbChooserField1 = new QComboBox( FALSE, container ); | 383 | cmbChooserField1 = new QComboBox( FALSE, container ); |
370 | cmbChooserField1->setMaximumWidth( 90 ); | 384 | cmbChooserField1->setMaximumWidth( 90 ); |
371 | gl->addWidget( cmbChooserField1, 3, 0 ); | 385 | gl->addWidget( cmbChooserField1, 3, 0 ); |
372 | txtChooserField1 = new QLineEdit( container ); | 386 | txtChooserField1 = new QLineEdit( container ); |
373 | gl->addWidget( txtChooserField1, 3, 1 ); | 387 | gl->addWidget( txtChooserField1, 3, 1 ); |
374 | 388 | ||
375 | cmbChooserField2 = new QComboBox( FALSE, container ); | 389 | cmbChooserField2 = new QComboBox( FALSE, container ); |
376 | cmbChooserField2->setMaximumWidth( 90 ); | 390 | cmbChooserField2->setMaximumWidth( 90 ); |
377 | gl->addWidget( cmbChooserField2, 4, 0 ); | 391 | gl->addWidget( cmbChooserField2, 4, 0 ); |
378 | txtChooserField2 = new QLineEdit( container ); | 392 | txtChooserField2 = new QLineEdit( container ); |
379 | gl->addWidget( txtChooserField2, 4, 1 ); | 393 | gl->addWidget( txtChooserField2, 4, 1 ); |
380 | 394 | ||
381 | cmbChooserField3 = new QComboBox( FALSE, container ); | 395 | cmbChooserField3 = new QComboBox( FALSE, container ); |
382 | cmbChooserField3->setMaximumWidth( 90 ); | 396 | cmbChooserField3->setMaximumWidth( 90 ); |
383 | gl->addWidget( cmbChooserField3, 5, 0 ); | 397 | gl->addWidget( cmbChooserField3, 5, 0 ); |
384 | txtChooserField3 = new QLineEdit( container ); | 398 | txtChooserField3 = new QLineEdit( container ); |
385 | gl->addWidget( txtChooserField3, 5, 1 ); | 399 | gl->addWidget( txtChooserField3, 5, 1 ); |
386 | 400 | ||
387 | l = new QLabel( tr( "File As" ), container ); | 401 | l = new QLabel( tr( "File As" ), container ); |
388 | gl->addWidget( l, 6, 0 ); | 402 | gl->addWidget( l, 6, 0 ); |
389 | cmbFileAs = new QComboBox( TRUE, container ); | 403 | cmbFileAs = new QComboBox( TRUE, container ); |
390 | gl->addWidget( cmbFileAs, 6, 1 ); | 404 | gl->addWidget( cmbFileAs, 6, 1 ); |
391 | 405 | ||
392 | l = new QLabel( tr( "Category" ), container ); | 406 | l = new QLabel( tr( "Category" ), container ); |
393 | gl->addWidget( l, 7, 0 ); | 407 | gl->addWidget( l, 7, 0 ); |
394 | cmbCat = new CategorySelect( container ); | 408 | cmbCat = new CategorySelect( container ); |
395 | gl->addWidget( cmbCat, 7, 1 ); | 409 | gl->addWidget( cmbCat, 7, 1 ); |
396 | 410 | ||
397 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 411 | btnNote = new QPushButton( tr( "Notes..." ), container ); |
398 | gl->addWidget( btnNote, 8, 1 ); | 412 | gl->addWidget( btnNote, 8, 1 ); |
399 | 413 | ||
400 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 414 | tabMain->insertTab( tabViewport, tr( "General" ) ); |
401 | 415 | ||
402 | tabViewport = new QWidget ( tabMain ); | 416 | tabViewport = new QWidget ( tabMain ); |
403 | 417 | ||
404 | vb = new QVBoxLayout( tabViewport ); | 418 | vb = new QVBoxLayout( tabViewport ); |
405 | 419 | ||
406 | svAddress = new QScrollView( tabViewport ); | 420 | svAddress = new QScrollView( tabViewport ); |
407 | vb->addWidget( svAddress, 0, 0 ); | 421 | vb->addWidget( svAddress, 0, 0 ); |
408 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 422 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
409 | svAddress->setFrameStyle( QFrame::NoFrame ); | 423 | svAddress->setFrameStyle( QFrame::NoFrame ); |
410 | 424 | ||
411 | container = new QWidget( svAddress->viewport() ); | 425 | container = new QWidget( svAddress->viewport() ); |
412 | svAddress->addChild( container ); | 426 | svAddress->addChild( container ); |
413 | 427 | ||
414 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 428 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
415 | 429 | ||
416 | cmbAddress = new QComboBox( FALSE, container ); | 430 | cmbAddress = new QComboBox( FALSE, container ); |
417 | cmbAddress->insertItem( tr( "Business" ) ); | 431 | cmbAddress->insertItem( tr( "Business" ) ); |
418 | cmbAddress->insertItem( tr( "Home" ) ); | 432 | cmbAddress->insertItem( tr( "Home" ) ); |
419 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 433 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
420 | 434 | ||
421 | l = new QLabel( tr( "Address" ), container ); | 435 | l = new QLabel( tr( "Address" ), container ); |
422 | gl->addWidget( l, 1, 0 ); | 436 | gl->addWidget( l, 1, 0 ); |
423 | txtAddress = new QLineEdit( container ); | 437 | txtAddress = new QLineEdit( container ); |
424 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 438 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
425 | /* | 439 | /* |
426 | l = new QLabel( tr( "Address 2" ), container ); | 440 | l = new QLabel( tr( "Address 2" ), container ); |
427 | gl->addWidget( l, 2, 0 ); | 441 | gl->addWidget( l, 2, 0 ); |
428 | txtAddress2 = new QLineEdit( container ); | 442 | txtAddress2 = new QLineEdit( container ); |
429 | gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 ); | 443 | gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 ); |
430 | 444 | ||
431 | l = new QLabel( tr( "P.O. Box" ), container ); | 445 | l = new QLabel( tr( "P.O. Box" ), container ); |
432 | gl->addWidget( l, 3, 0 ); | 446 | gl->addWidget( l, 3, 0 ); |
433 | txtPOBox = new QLineEdit( container ); | 447 | txtPOBox = new QLineEdit( container ); |
434 | gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 ); | 448 | gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 ); |
435 | */ | 449 | */ |
436 | l = new QLabel( tr( "City" ), container ); | 450 | l = new QLabel( tr( "City" ), container ); |
437 | gl->addWidget( l, 2, 0 ); | 451 | gl->addWidget( l, 2, 0 ); |
438 | txtCity = new QLineEdit( container ); | 452 | txtCity = new QLineEdit( container ); |
439 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 453 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
440 | 454 | ||
441 | l = new QLabel( tr( "State" ), container ); | 455 | l = new QLabel( tr( "State" ), container ); |
442 | gl->addWidget( l, 3, 0 ); | 456 | gl->addWidget( l, 3, 0 ); |
443 | txtState = new QLineEdit( container ); | 457 | txtState = new QLineEdit( container ); |
444 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 458 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
445 | 459 | ||
446 | l = new QLabel( tr( "Zip Code" ), container ); | 460 | l = new QLabel( tr( "Zip Code" ), container ); |
447 | gl->addWidget( l, 4, 0 ); | 461 | gl->addWidget( l, 4, 0 ); |
448 | txtZip = new QLineEdit( container ); | 462 | txtZip = new QLineEdit( container ); |
449 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 463 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
450 | 464 | ||
451 | l = new QLabel( tr( "Country" ), container ); | 465 | l = new QLabel( tr( "Country" ), container ); |
452 | gl->addWidget( l, 5, 0 ); | 466 | gl->addWidget( l, 5, 0 ); |
453 | cmbCountry = new QComboBox( TRUE, container ); | 467 | cmbCountry = new QComboBox( TRUE, container ); |
454 | cmbCountry->insertItem( tr( "" ) ); | 468 | cmbCountry->insertItem( tr( "" ) ); |
455 | cmbCountry->insertItem( tr ( "United States" ) ); | 469 | cmbCountry->insertItem( tr ( "United States" ) ); |
456 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 470 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
457 | cmbCountry->insertItem( tr ( "Afganistan" ) ); | 471 | cmbCountry->insertItem( tr ( "Afganistan" ) ); |
458 | cmbCountry->insertItem( tr ( "Albania" ) ); | 472 | cmbCountry->insertItem( tr ( "Albania" ) ); |
459 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 473 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
460 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 474 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
461 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 475 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
462 | cmbCountry->insertItem( tr ( "Angola" ) ); | 476 | cmbCountry->insertItem( tr ( "Angola" ) ); |
463 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 477 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
464 | cmbCountry->insertItem( tr ( "Antartica" ) ); | 478 | cmbCountry->insertItem( tr ( "Antartica" ) ); |
465 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 479 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
466 | cmbCountry->insertItem( tr ( "Armania" ) ); | 480 | cmbCountry->insertItem( tr ( "Armania" ) ); |
467 | cmbCountry->insertItem( tr ( "Aruba" ) ); | 481 | cmbCountry->insertItem( tr ( "Aruba" ) ); |
468 | cmbCountry->insertItem( tr ( "Australia" ) ); | 482 | cmbCountry->insertItem( tr ( "Australia" ) ); |
469 | cmbCountry->insertItem( tr ( "Austria" ) ); | 483 | cmbCountry->insertItem( tr ( "Austria" ) ); |
470 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); | 484 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); |
471 | cmbCountry->insertItem( tr ( "Bahamas" ) ); | 485 | cmbCountry->insertItem( tr ( "Bahamas" ) ); |
472 | cmbCountry->insertItem( tr ( "Bahrain" ) ); | 486 | cmbCountry->insertItem( tr ( "Bahrain" ) ); |
473 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); | 487 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); |
474 | cmbCountry->insertItem( tr ( "Barbados" ) ); | 488 | cmbCountry->insertItem( tr ( "Barbados" ) ); |
475 | cmbCountry->insertItem( tr ( "Belarus" ) ); | 489 | cmbCountry->insertItem( tr ( "Belarus" ) ); |
476 | cmbCountry->insertItem( tr ( "Belgium" ) ); | 490 | cmbCountry->insertItem( tr ( "Belgium" ) ); |
477 | cmbCountry->insertItem( tr ( "Belize" ) ); | 491 | cmbCountry->insertItem( tr ( "Belize" ) ); |
478 | cmbCountry->insertItem( tr ( "Benin" ) ); | 492 | cmbCountry->insertItem( tr ( "Benin" ) ); |
479 | cmbCountry->insertItem( tr ( "Bermuda" ) ); | 493 | cmbCountry->insertItem( tr ( "Bermuda" ) ); |
480 | cmbCountry->insertItem( tr ( "Bhutan" ) ); | 494 | cmbCountry->insertItem( tr ( "Bhutan" ) ); |
481 | cmbCountry->insertItem( tr ( "Boliva" ) ); | 495 | cmbCountry->insertItem( tr ( "Boliva" ) ); |
482 | cmbCountry->insertItem( tr ( "Botswana" ) ); | 496 | cmbCountry->insertItem( tr ( "Botswana" ) ); |
483 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); | 497 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); |
484 | cmbCountry->insertItem( tr ( "Brazil" ) ); | 498 | cmbCountry->insertItem( tr ( "Brazil" ) ); |
485 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); | 499 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); |
486 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); | 500 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); |
487 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); | 501 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); |
488 | cmbCountry->insertItem( tr ( "Burundi" ) ); | 502 | cmbCountry->insertItem( tr ( "Burundi" ) ); |
489 | cmbCountry->insertItem( tr ( "Cambodia" ) ); | 503 | cmbCountry->insertItem( tr ( "Cambodia" ) ); |
490 | cmbCountry->insertItem( tr ( "Camaroon" ) ); | 504 | cmbCountry->insertItem( tr ( "Camaroon" ) ); |
491 | cmbCountry->insertItem( tr ( "Canada" ) ); | 505 | cmbCountry->insertItem( tr ( "Canada" ) ); |
492 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); | 506 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); |
493 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); | 507 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); |
494 | cmbCountry->insertItem( tr ( "Chad" ) ); | 508 | cmbCountry->insertItem( tr ( "Chad" ) ); |
495 | cmbCountry->insertItem( tr ( "Chile" ) ); | 509 | cmbCountry->insertItem( tr ( "Chile" ) ); |
496 | cmbCountry->insertItem( tr ( "China" ) ); | 510 | cmbCountry->insertItem( tr ( "China" ) ); |
497 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); | 511 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); |
498 | cmbCountry->insertItem( tr ( "Colombia" ) ); | 512 | cmbCountry->insertItem( tr ( "Colombia" ) ); |
499 | cmbCountry->insertItem( tr ( "Comoros" ) ); | 513 | cmbCountry->insertItem( tr ( "Comoros" ) ); |
500 | cmbCountry->insertItem( tr ( "Congo" ) ); | 514 | cmbCountry->insertItem( tr ( "Congo" ) ); |
501 | cmbCountry->insertItem( tr ( "Cook Island" ) ); | 515 | cmbCountry->insertItem( tr ( "Cook Island" ) ); |
502 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); | 516 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); |
503 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); | 517 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); |
504 | cmbCountry->insertItem( tr ( "Croatia" ) ); | 518 | cmbCountry->insertItem( tr ( "Croatia" ) ); |
505 | cmbCountry->insertItem( tr ( "Cuba" ) ); | 519 | cmbCountry->insertItem( tr ( "Cuba" ) ); |
506 | cmbCountry->insertItem( tr ( "Cyprus" ) ); | 520 | cmbCountry->insertItem( tr ( "Cyprus" ) ); |
507 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); | 521 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); |
508 | cmbCountry->insertItem( tr ( "Denmark" ) ); | 522 | cmbCountry->insertItem( tr ( "Denmark" ) ); |
509 | cmbCountry->insertItem( tr ( "Djibouti" ) ); | 523 | cmbCountry->insertItem( tr ( "Djibouti" ) ); |
510 | cmbCountry->insertItem( tr ( "Dominica" ) ); | 524 | cmbCountry->insertItem( tr ( "Dominica" ) ); |
511 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); | 525 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); |
512 | cmbCountry->insertItem( tr ( "East Timor" ) ); | 526 | cmbCountry->insertItem( tr ( "East Timor" ) ); |
513 | cmbCountry->insertItem( tr ( "Ecuador" ) ); | 527 | cmbCountry->insertItem( tr ( "Ecuador" ) ); |
514 | cmbCountry->insertItem( tr ( "Egypt" ) ); | 528 | cmbCountry->insertItem( tr ( "Egypt" ) ); |
515 | cmbCountry->insertItem( tr ( "El Salvador" ) ); | 529 | cmbCountry->insertItem( tr ( "El Salvador" ) ); |
516 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); | 530 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); |
517 | cmbCountry->insertItem( tr ( "Eritrea" ) ); | 531 | cmbCountry->insertItem( tr ( "Eritrea" ) ); |
518 | cmbCountry->insertItem( tr ( "Estonia" ) ); | 532 | cmbCountry->insertItem( tr ( "Estonia" ) ); |
519 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); | 533 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); |
520 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); | 534 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); |
521 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); | 535 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); |
522 | cmbCountry->insertItem( tr ( "Fiji" ) ); | 536 | cmbCountry->insertItem( tr ( "Fiji" ) ); |
523 | cmbCountry->insertItem( tr ( "Finland" ) ); | 537 | cmbCountry->insertItem( tr ( "Finland" ) ); |
524 | cmbCountry->insertItem( tr ( "France" ) ); | 538 | cmbCountry->insertItem( tr ( "France" ) ); |
525 | cmbCountry->insertItem( tr ( "French Guiana" ) ); | 539 | cmbCountry->insertItem( tr ( "French Guiana" ) ); |
526 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); | 540 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); |
527 | cmbCountry->insertItem( tr ( "Gabon" ) ); | 541 | cmbCountry->insertItem( tr ( "Gabon" ) ); |
528 | cmbCountry->insertItem( tr ( "Gambia" ) ); | 542 | cmbCountry->insertItem( tr ( "Gambia" ) ); |
529 | cmbCountry->insertItem( tr ( "Georgia" ) ); | 543 | cmbCountry->insertItem( tr ( "Georgia" ) ); |
530 | cmbCountry->insertItem( tr ( "Germany" ) ); | 544 | cmbCountry->insertItem( tr ( "Germany" ) ); |
531 | cmbCountry->insertItem( tr ( "Gahna" ) ); | 545 | cmbCountry->insertItem( tr ( "Gahna" ) ); |
532 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); | 546 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); |
533 | cmbCountry->insertItem( tr ( "Greece" ) ); | 547 | cmbCountry->insertItem( tr ( "Greece" ) ); |
534 | cmbCountry->insertItem( tr ( "Greenland" ) ); | 548 | cmbCountry->insertItem( tr ( "Greenland" ) ); |
535 | cmbCountry->insertItem( tr ( "Grenada" ) ); | 549 | cmbCountry->insertItem( tr ( "Grenada" ) ); |
536 | cmbCountry->insertItem( tr ( "Guadelupe" ) ); | 550 | cmbCountry->insertItem( tr ( "Guadelupe" ) ); |
537 | cmbCountry->insertItem( tr ( "Guam" ) ); | 551 | cmbCountry->insertItem( tr ( "Guam" ) ); |
538 | cmbCountry->insertItem( tr ( "Guatemala" ) ); | 552 | cmbCountry->insertItem( tr ( "Guatemala" ) ); |
539 | cmbCountry->insertItem( tr ( "Guinea" ) ); | 553 | cmbCountry->insertItem( tr ( "Guinea" ) ); |
540 | cmbCountry->insertItem( tr ( "Guinea-bissau" ) ); | 554 | cmbCountry->insertItem( tr ( "Guinea-bissau" ) ); |
541 | cmbCountry->insertItem( tr ( "Guyana" ) ); | 555 | cmbCountry->insertItem( tr ( "Guyana" ) ); |
542 | cmbCountry->insertItem( tr ( "Haiti" ) ); | 556 | cmbCountry->insertItem( tr ( "Haiti" ) ); |
543 | cmbCountry->insertItem( tr ( "Holy See" ) ); | 557 | cmbCountry->insertItem( tr ( "Holy See" ) ); |
544 | cmbCountry->insertItem( tr ( "Honduras" ) ); | 558 | cmbCountry->insertItem( tr ( "Honduras" ) ); |
545 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); | 559 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); |
546 | cmbCountry->insertItem( tr ( "Hungary" ) ); | 560 | cmbCountry->insertItem( tr ( "Hungary" ) ); |
547 | cmbCountry->insertItem( tr ( "Iceland" ) ); | 561 | cmbCountry->insertItem( tr ( "Iceland" ) ); |
548 | cmbCountry->insertItem( tr ( "India" ) ); | 562 | cmbCountry->insertItem( tr ( "India" ) ); |
549 | cmbCountry->insertItem( tr ( "Indonesia" ) ); | 563 | cmbCountry->insertItem( tr ( "Indonesia" ) ); |
550 | cmbCountry->insertItem( tr ( "Ireland" ) ); | 564 | cmbCountry->insertItem( tr ( "Ireland" ) ); |
551 | cmbCountry->insertItem( tr ( "Israel" ) ); | 565 | cmbCountry->insertItem( tr ( "Israel" ) ); |
552 | cmbCountry->insertItem( tr ( "Italy" ) ); | 566 | cmbCountry->insertItem( tr ( "Italy" ) ); |
553 | cmbCountry->insertItem( tr ( "Jamacia" ) ); | 567 | cmbCountry->insertItem( tr ( "Jamacia" ) ); |
554 | cmbCountry->insertItem( tr ( "Japan" ) ); | 568 | cmbCountry->insertItem( tr ( "Japan" ) ); |
555 | cmbCountry->insertItem( tr ( "Jordan" ) ); | 569 | cmbCountry->insertItem( tr ( "Jordan" ) ); |
556 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); | 570 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); |
557 | cmbCountry->insertItem( tr ( "Kenya" ) ); | 571 | cmbCountry->insertItem( tr ( "Kenya" ) ); |
558 | cmbCountry->insertItem( tr ( "Kribati" ) ); | 572 | cmbCountry->insertItem( tr ( "Kribati" ) ); |
559 | cmbCountry->insertItem( tr ( "Korea" ) ); | 573 | cmbCountry->insertItem( tr ( "Korea" ) ); |
560 | cmbCountry->insertItem( tr ( "Kuwait" ) ); | 574 | cmbCountry->insertItem( tr ( "Kuwait" ) ); |
561 | cmbCountry->insertItem( tr ( "Kyrgystan" ) ); | 575 | cmbCountry->insertItem( tr ( "Kyrgystan" ) ); |
562 | cmbCountry->insertItem( tr ( "Laos" ) ); | 576 | cmbCountry->insertItem( tr ( "Laos" ) ); |
563 | cmbCountry->insertItem( tr ( "Latvia" ) ); | 577 | cmbCountry->insertItem( tr ( "Latvia" ) ); |
564 | cmbCountry->insertItem( tr ( "Lebanon" ) ); | 578 | cmbCountry->insertItem( tr ( "Lebanon" ) ); |
565 | cmbCountry->insertItem( tr ( "Lesotho" ) ); | 579 | cmbCountry->insertItem( tr ( "Lesotho" ) ); |
566 | cmbCountry->insertItem( tr ( "Liberia" ) ); | 580 | cmbCountry->insertItem( tr ( "Liberia" ) ); |
567 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); | 581 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); |
568 | cmbCountry->insertItem( tr ( "Lithuania" ) ); | 582 | cmbCountry->insertItem( tr ( "Lithuania" ) ); |
569 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); | 583 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); |
570 | cmbCountry->insertItem( tr ( "Macau" ) ); | 584 | cmbCountry->insertItem( tr ( "Macau" ) ); |
571 | cmbCountry->insertItem( tr ( "Macedonia" ) ); | 585 | cmbCountry->insertItem( tr ( "Macedonia" ) ); |
572 | cmbCountry->insertItem( tr ( "Madagascar" ) ); | 586 | cmbCountry->insertItem( tr ( "Madagascar" ) ); |
573 | cmbCountry->insertItem( tr ( "Malawi" ) ); | 587 | cmbCountry->insertItem( tr ( "Malawi" ) ); |
574 | cmbCountry->insertItem( tr ( "Malaysia" ) ); | 588 | cmbCountry->insertItem( tr ( "Malaysia" ) ); |
575 | cmbCountry->insertItem( tr ( "Maldives" ) ); | 589 | cmbCountry->insertItem( tr ( "Maldives" ) ); |
576 | cmbCountry->insertItem( tr ( "Mali" ) ); | 590 | cmbCountry->insertItem( tr ( "Mali" ) ); |
577 | cmbCountry->insertItem( tr ( "Malta" ) ); | 591 | cmbCountry->insertItem( tr ( "Malta" ) ); |
578 | cmbCountry->insertItem( tr ( "Martinique" ) ); | 592 | cmbCountry->insertItem( tr ( "Martinique" ) ); |
579 | cmbCountry->insertItem( tr ( "Mauritania" ) ); | 593 | cmbCountry->insertItem( tr ( "Mauritania" ) ); |
580 | cmbCountry->insertItem( tr ( "Mauritius" ) ); | 594 | cmbCountry->insertItem( tr ( "Mauritius" ) ); |
581 | cmbCountry->insertItem( tr ( "Mayotte" ) ); | 595 | cmbCountry->insertItem( tr ( "Mayotte" ) ); |
582 | cmbCountry->insertItem( tr ( "Mexico" ) ); | 596 | cmbCountry->insertItem( tr ( "Mexico" ) ); |
583 | cmbCountry->insertItem( tr ( "Micronesia" ) ); | 597 | cmbCountry->insertItem( tr ( "Micronesia" ) ); |
584 | cmbCountry->insertItem( tr ( "Moldova" ) ); | 598 | cmbCountry->insertItem( tr ( "Moldova" ) ); |
585 | cmbCountry->insertItem( tr ( "Monaco" ) ); | 599 | cmbCountry->insertItem( tr ( "Monaco" ) ); |
586 | cmbCountry->insertItem( tr ( "Mongolia" ) ); | 600 | cmbCountry->insertItem( tr ( "Mongolia" ) ); |
587 | cmbCountry->insertItem( tr ( "Montserrat" ) ); | 601 | cmbCountry->insertItem( tr ( "Montserrat" ) ); |
588 | cmbCountry->insertItem( tr ( "Morocco" ) ); | 602 | cmbCountry->insertItem( tr ( "Morocco" ) ); |
589 | cmbCountry->insertItem( tr ( "Mozambique" ) ); | 603 | cmbCountry->insertItem( tr ( "Mozambique" ) ); |
590 | cmbCountry->insertItem( tr ( "Myanmar" ) ); | 604 | cmbCountry->insertItem( tr ( "Myanmar" ) ); |
591 | cmbCountry->insertItem( tr ( "Namibia" ) ); | 605 | cmbCountry->insertItem( tr ( "Namibia" ) ); |
592 | cmbCountry->insertItem( tr ( "Nauru" ) ); | 606 | cmbCountry->insertItem( tr ( "Nauru" ) ); |
593 | cmbCountry->insertItem( tr ( "Nepal" ) ); | 607 | cmbCountry->insertItem( tr ( "Nepal" ) ); |
594 | cmbCountry->insertItem( tr ( "Netherlands" ) ); | 608 | cmbCountry->insertItem( tr ( "Netherlands" ) ); |
595 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); | 609 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); |
596 | cmbCountry->insertItem( tr ( "New Zealand" ) ); | 610 | cmbCountry->insertItem( tr ( "New Zealand" ) ); |
597 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); | 611 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); |
598 | cmbCountry->insertItem( tr ( "Niger" ) ); | 612 | cmbCountry->insertItem( tr ( "Niger" ) ); |
599 | cmbCountry->insertItem( tr ( "Nigeria" ) ); | 613 | cmbCountry->insertItem( tr ( "Nigeria" ) ); |
600 | cmbCountry->insertItem( tr ( "Niue" ) ); | 614 | cmbCountry->insertItem( tr ( "Niue" ) ); |
601 | cmbCountry->insertItem( tr ( "Norway" ) ); | 615 | cmbCountry->insertItem( tr ( "Norway" ) ); |
602 | cmbCountry->insertItem( tr ( "Oman" ) ); | 616 | cmbCountry->insertItem( tr ( "Oman" ) ); |
603 | cmbCountry->insertItem( tr ( "Pakistan" ) ); | 617 | cmbCountry->insertItem( tr ( "Pakistan" ) ); |
604 | cmbCountry->insertItem( tr ( "Palau" ) ); | 618 | cmbCountry->insertItem( tr ( "Palau" ) ); |
605 | cmbCountry->insertItem( tr ( "Palestinian Territory" ) ); | 619 | cmbCountry->insertItem( tr ( "Palestinian Territory" ) ); |
606 | cmbCountry->insertItem( tr ( "Panama" ) ); | 620 | cmbCountry->insertItem( tr ( "Panama" ) ); |
607 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); | 621 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); |
608 | cmbCountry->insertItem( tr ( "Paraguay" ) ); | 622 | cmbCountry->insertItem( tr ( "Paraguay" ) ); |
609 | cmbCountry->insertItem( tr ( "Peru" ) ); | 623 | cmbCountry->insertItem( tr ( "Peru" ) ); |
610 | cmbCountry->insertItem( tr ( "Philippines" ) ); | 624 | cmbCountry->insertItem( tr ( "Philippines" ) ); |
611 | cmbCountry->insertItem( tr ( "Pitcairn" ) ); | 625 | cmbCountry->insertItem( tr ( "Pitcairn" ) ); |
612 | cmbCountry->insertItem( tr ( "Poland" ) ); | 626 | cmbCountry->insertItem( tr ( "Poland" ) ); |
613 | cmbCountry->insertItem( tr ( "Portugal" ) ); | 627 | cmbCountry->insertItem( tr ( "Portugal" ) ); |
614 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); | 628 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); |
615 | cmbCountry->insertItem( tr ( "Qatar" ) ); | 629 | cmbCountry->insertItem( tr ( "Qatar" ) ); |
616 | cmbCountry->insertItem( tr ( "Reunion" ) ); | 630 | cmbCountry->insertItem( tr ( "Reunion" ) ); |
617 | cmbCountry->insertItem( tr ( "Romania" ) ); | 631 | cmbCountry->insertItem( tr ( "Romania" ) ); |
618 | cmbCountry->insertItem( tr ( "Russia" ) ); | 632 | cmbCountry->insertItem( tr ( "Russia" ) ); |
619 | cmbCountry->insertItem( tr ( "Rwanda" ) ); | 633 | cmbCountry->insertItem( tr ( "Rwanda" ) ); |
620 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); | 634 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); |
621 | cmbCountry->insertItem( tr ( "Samoa" ) ); | 635 | cmbCountry->insertItem( tr ( "Samoa" ) ); |
622 | cmbCountry->insertItem( tr ( "San Marino" ) ); | 636 | cmbCountry->insertItem( tr ( "San Marino" ) ); |
623 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); | 637 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); |
624 | cmbCountry->insertItem( tr ( "Senegal" ) ); | 638 | cmbCountry->insertItem( tr ( "Senegal" ) ); |
625 | cmbCountry->insertItem( tr ( "Seychelles" ) ); | 639 | cmbCountry->insertItem( tr ( "Seychelles" ) ); |
626 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); | 640 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); |
627 | cmbCountry->insertItem( tr ( "Singapore" ) ); | 641 | cmbCountry->insertItem( tr ( "Singapore" ) ); |
628 | cmbCountry->insertItem( tr ( "Slovakia" ) ); | 642 | cmbCountry->insertItem( tr ( "Slovakia" ) ); |
629 | cmbCountry->insertItem( tr ( "Slovenia" ) ); | 643 | cmbCountry->insertItem( tr ( "Slovenia" ) ); |
630 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); | 644 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); |
631 | cmbCountry->insertItem( tr ( "Somalia" ) ); | 645 | cmbCountry->insertItem( tr ( "Somalia" ) ); |
632 | cmbCountry->insertItem( tr ( "South Africa" ) ); | 646 | cmbCountry->insertItem( tr ( "South Africa" ) ); |
633 | cmbCountry->insertItem( tr ( "Spain" ) ); | 647 | cmbCountry->insertItem( tr ( "Spain" ) ); |
634 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); | 648 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); |
635 | cmbCountry->insertItem( tr ( "St. Helena" ) ); | 649 | cmbCountry->insertItem( tr ( "St. Helena" ) ); |
636 | cmbCountry->insertItem( tr ( "Sudan" ) ); | 650 | cmbCountry->insertItem( tr ( "Sudan" ) ); |
637 | cmbCountry->insertItem( tr ( "Suriname" ) ); | 651 | cmbCountry->insertItem( tr ( "Suriname" ) ); |
638 | cmbCountry->insertItem( tr ( "Swaziland" ) ); | 652 | cmbCountry->insertItem( tr ( "Swaziland" ) ); |
639 | cmbCountry->insertItem( tr ( "Sweden" ) ); | 653 | cmbCountry->insertItem( tr ( "Sweden" ) ); |
640 | cmbCountry->insertItem( tr ( "Switzerland" ) ); | 654 | cmbCountry->insertItem( tr ( "Switzerland" ) ); |
641 | cmbCountry->insertItem( tr ( "Taiwan" ) ); | 655 | cmbCountry->insertItem( tr ( "Taiwan" ) ); |
642 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); | 656 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); |
643 | cmbCountry->insertItem( tr ( "Tanzania" ) ); | 657 | cmbCountry->insertItem( tr ( "Tanzania" ) ); |
644 | cmbCountry->insertItem( tr ( "Thailand" ) ); | 658 | cmbCountry->insertItem( tr ( "Thailand" ) ); |
645 | cmbCountry->insertItem( tr ( "Togo" ) ); | 659 | cmbCountry->insertItem( tr ( "Togo" ) ); |
646 | cmbCountry->insertItem( tr ( "Tokelau" ) ); | 660 | cmbCountry->insertItem( tr ( "Tokelau" ) ); |
647 | cmbCountry->insertItem( tr ( "Tonga" ) ); | 661 | cmbCountry->insertItem( tr ( "Tonga" ) ); |
648 | cmbCountry->insertItem( tr ( "Tunisia" ) ); | 662 | cmbCountry->insertItem( tr ( "Tunisia" ) ); |
649 | cmbCountry->insertItem( tr ( "Turkey" ) ); | 663 | cmbCountry->insertItem( tr ( "Turkey" ) ); |
650 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); | 664 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); |
651 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); | 665 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); |
652 | cmbCountry->insertItem( tr ( "Uganda" ) ); | 666 | cmbCountry->insertItem( tr ( "Uganda" ) ); |
653 | cmbCountry->insertItem( tr ( "Ukraine" ) ); | 667 | cmbCountry->insertItem( tr ( "Ukraine" ) ); |
654 | cmbCountry->insertItem( tr ( "Uruguay" ) ); | 668 | cmbCountry->insertItem( tr ( "Uruguay" ) ); |
655 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); | 669 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); |
656 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); | 670 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); |
657 | cmbCountry->insertItem( tr ( "Venezuela" ) ); | 671 | cmbCountry->insertItem( tr ( "Venezuela" ) ); |
658 | cmbCountry->insertItem( tr ( "Viet Nam" ) ); | 672 | cmbCountry->insertItem( tr ( "Viet Nam" ) ); |
659 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); | 673 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); |
660 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); | 674 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); |
661 | cmbCountry->insertItem( tr ( "Yemen" ) ); | 675 | cmbCountry->insertItem( tr ( "Yemen" ) ); |
662 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); | 676 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); |
663 | cmbCountry->insertItem( tr ( "Zambia" ) ); | 677 | cmbCountry->insertItem( tr ( "Zambia" ) ); |
664 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); | 678 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); |
665 | 679 | ||
666 | cmbCountry->setMaximumWidth( 135 ); | 680 | cmbCountry->setMaximumWidth( 135 ); |
667 | 681 | ||
668 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 682 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
669 | 683 | ||
670 | cmbChooserField4 = new QComboBox( FALSE, container ); | 684 | cmbChooserField4 = new QComboBox( FALSE, container ); |
671 | cmbChooserField4->setMaximumWidth( 90 ); | 685 | cmbChooserField4->setMaximumWidth( 90 ); |
672 | gl->addWidget( cmbChooserField4, 6, 0 ); | 686 | gl->addWidget( cmbChooserField4, 6, 0 ); |
673 | txtChooserField4 = new QLineEdit( container ); | 687 | txtChooserField4 = new QLineEdit( container ); |
674 | gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); | 688 | gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); |
675 | 689 | ||
676 | QSpacerItem *space = new QSpacerItem(1,1, | 690 | QSpacerItem *space = new QSpacerItem(1,1, |
677 | QSizePolicy::Maximum, | 691 | QSizePolicy::Maximum, |
678 | QSizePolicy::MinimumExpanding ); | 692 | QSizePolicy::MinimumExpanding ); |
679 | gl->addItem( space, 7, 0 ); | 693 | gl->addItem( space, 7, 0 ); |
680 | 694 | ||
681 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 695 | tabMain->insertTab( tabViewport, tr( "Address" ) ); |
682 | 696 | ||
683 | tabViewport = new QWidget ( tabMain ); | 697 | tabViewport = new QWidget ( tabMain ); |
684 | 698 | ||
685 | vb = new QVBoxLayout( tabViewport ); | 699 | vb = new QVBoxLayout( tabViewport ); |
686 | 700 | ||
687 | svDetails = new QScrollView( tabViewport ); | 701 | svDetails = new QScrollView( tabViewport ); |
688 | vb->addWidget( svDetails, 0, 0 ); | 702 | vb->addWidget( svDetails, 0, 0 ); |
689 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 703 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
690 | svDetails->setFrameStyle( QFrame::NoFrame ); | 704 | svDetails->setFrameStyle( QFrame::NoFrame ); |
691 | 705 | ||
692 | container = new QWidget( svDetails->viewport() ); | 706 | container = new QWidget( svDetails->viewport() ); |
693 | svDetails->addChild( container ); | 707 | svDetails->addChild( container ); |
694 | 708 | ||
695 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 709 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
696 | 710 | ||
697 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 711 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
698 | for (i = 0; it != slDynamicEntries.end(); i++, ++it) { | 712 | for (i = 0; it != slDynamicEntries.end(); i++, ++it) { |
699 | l = new QLabel( *it, container ); | 713 | l = new QLabel( *it, container ); |
700 | listName.append( l ); | 714 | listName.append( l ); |
701 | gl->addWidget( l, i, 0 ); | 715 | gl->addWidget( l, i, 0 ); |
702 | QLineEdit *e = new QLineEdit( container ); | 716 | QLineEdit *e = new QLineEdit( container ); |
703 | listValue.append( e ); | 717 | listValue.append( e ); |
704 | gl->addWidget( e, i, 1); | 718 | gl->addWidget( e, i, 1); |
705 | } | 719 | } |
706 | 720 | ||
707 | l = new QLabel( tr("Gender"), container ); | 721 | l = new QLabel( tr("Gender"), container ); |
708 | gl->addWidget( l, slDynamicEntries.count(), 0 ); | 722 | gl->addWidget( l, slDynamicEntries.count(), 0 ); |
709 | cmbGender = new QComboBox( container ); | 723 | cmbGender = new QComboBox( container ); |
710 | cmbGender->insertItem( "", 0 ); | 724 | cmbGender->insertItem( "", 0 ); |
711 | cmbGender->insertItem( tr("Male"), 1); | 725 | cmbGender->insertItem( tr("Male"), 1); |
712 | cmbGender->insertItem( tr("Female"), 2); | 726 | cmbGender->insertItem( tr("Female"), 2); |
713 | gl->addWidget( cmbGender, slDynamicEntries.count(), 1 ); | 727 | gl->addWidget( cmbGender, slDynamicEntries.count(), 1 ); |
714 | 728 | ||
715 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 729 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
716 | 730 | ||
717 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 731 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
718 | dlgNote->setCaption( tr("Enter Note") ); | 732 | dlgNote->setCaption( tr("Enter Note") ); |
719 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 733 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
720 | txtNote = new QMultiLineEdit( dlgNote ); | 734 | txtNote = new QMultiLineEdit( dlgNote ); |
721 | vbNote->addWidget( txtNote ); | 735 | vbNote->addWidget( txtNote ); |
722 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 736 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
723 | 737 | ||
724 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 738 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
725 | dlgName->setCaption( tr("Edit Name") ); | 739 | dlgName->setCaption( tr("Edit Name") ); |
726 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 740 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
727 | 741 | ||
728 | l = new QLabel( tr("First Name"), dlgName ); | 742 | l = new QLabel( tr("First Name"), dlgName ); |
729 | gl->addWidget( l, 0, 0 ); | 743 | gl->addWidget( l, 0, 0 ); |
730 | txtFirstName = new QLineEdit( dlgName ); | 744 | txtFirstName = new QLineEdit( dlgName ); |
731 | gl->addWidget( txtFirstName, 0, 1 ); | 745 | gl->addWidget( txtFirstName, 0, 1 ); |
732 | 746 | ||
733 | l = new QLabel( tr("Middle Name"), dlgName ); | 747 | l = new QLabel( tr("Middle Name"), dlgName ); |
734 | gl->addWidget( l, 1, 0 ); | 748 | gl->addWidget( l, 1, 0 ); |
735 | txtMiddleName = new QLineEdit( dlgName ); | 749 | txtMiddleName = new QLineEdit( dlgName ); |
736 | gl->addWidget( txtMiddleName, 1, 1 ); | 750 | gl->addWidget( txtMiddleName, 1, 1 ); |
737 | 751 | ||
738 | l = new QLabel( tr("Last Name"), dlgName ); | 752 | l = new QLabel( tr("Last Name"), dlgName ); |
739 | gl->addWidget( l, 2, 0 ); | 753 | gl->addWidget( l, 2, 0 ); |
740 | txtLastName = new QLineEdit( dlgName ); | 754 | txtLastName = new QLineEdit( dlgName ); |
741 | gl->addWidget( txtLastName, 2, 1 ); | 755 | gl->addWidget( txtLastName, 2, 1 ); |
742 | 756 | ||
743 | l = new QLabel( tr("Suffix"), dlgName ); | 757 | l = new QLabel( tr("Suffix"), dlgName ); |
744 | gl->addWidget( l, 3, 0 ); | 758 | gl->addWidget( l, 3, 0 ); |
745 | txtSuffix = new QLineEdit( dlgName ); | 759 | txtSuffix = new QLineEdit( dlgName ); |
746 | gl->addWidget( txtSuffix, 3, 1 ); | 760 | gl->addWidget( txtSuffix, 3, 1 ); |
747 | space = new QSpacerItem(1,1, | 761 | space = new QSpacerItem(1,1, |
748 | QSizePolicy::Maximum, | 762 | QSizePolicy::Maximum, |
749 | QSizePolicy::MinimumExpanding ); | 763 | QSizePolicy::MinimumExpanding ); |
750 | gl->addItem( space, 4, 0 ); | 764 | gl->addItem( space, 4, 0 ); |
751 | 765 | ||
752 | cmbChooserField1->insertStringList( slChooserNames ); | 766 | cmbChooserField1->insertStringList( trlChooserNames ); |
753 | cmbChooserField2->insertStringList( slChooserNames ); | 767 | cmbChooserField2->insertStringList( trlChooserNames ); |
754 | cmbChooserField3->insertStringList( slChooserNames ); | 768 | cmbChooserField3->insertStringList( trlChooserNames ); |
755 | cmbChooserField4->insertStringList( slChooserNames ); | 769 | cmbChooserField4->insertStringList( trlChooserNames ); |
756 | 770 | ||
757 | cmbChooserField1->setCurrentItem( 0 ); | 771 | cmbChooserField1->setCurrentItem( 0 ); |
758 | cmbChooserField2->setCurrentItem( 1 ); | 772 | cmbChooserField2->setCurrentItem( 1 ); |
759 | cmbChooserField3->setCurrentItem( 2 ); | 773 | cmbChooserField3->setCurrentItem( 2 ); |
760 | 774 | ||
761 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 775 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
762 | 776 | ||
763 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); | 777 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); |
764 | 778 | ||
765 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), | 779 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), |
766 | this, SLOT(slotChooser1Change(const QString &)) ); | 780 | this, SLOT(slotChooser1Change(const QString &)) ); |
767 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), | 781 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), |
768 | this, SLOT(slotChooser2Change(const QString &)) ); | 782 | this, SLOT(slotChooser2Change(const QString &)) ); |
769 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), | 783 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), |
770 | this, SLOT(slotChooser3Change(const QString &)) ); | 784 | this, SLOT(slotChooser3Change(const QString &)) ); |
771 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), | 785 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), |
772 | this, SLOT(slotChooser4Change(const QString &)) ); | 786 | this, SLOT(slotChooser4Change(const QString &)) ); |
773 | connect( txtAddress, SIGNAL(textChanged(const QString &)), | 787 | connect( txtAddress, SIGNAL(textChanged(const QString &)), |
774 | this, SLOT(slotAddressChange(const QString &)) ); | 788 | this, SLOT(slotAddressChange(const QString &)) ); |
775 | //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); | 789 | //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); |
776 | //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); | 790 | //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); |
777 | connect( txtCity, SIGNAL(textChanged(const QString &)), | 791 | connect( txtCity, SIGNAL(textChanged(const QString &)), |
778 | this, SLOT(slotCityChange(const QString &)) ); | 792 | this, SLOT(slotCityChange(const QString &)) ); |
779 | connect( txtState, SIGNAL(textChanged(const QString &)), | 793 | connect( txtState, SIGNAL(textChanged(const QString &)), |
780 | this, SLOT(slotStateChange(const QString &)) ); | 794 | this, SLOT(slotStateChange(const QString &)) ); |
781 | connect( txtZip, SIGNAL(textChanged(const QString &)), | 795 | connect( txtZip, SIGNAL(textChanged(const QString &)), |
782 | this, SLOT(slotZipChange(const QString &)) ); | 796 | this, SLOT(slotZipChange(const QString &)) ); |
783 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), | 797 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), |
784 | this, SLOT(slotCountryChange(const QString &)) ); | 798 | this, SLOT(slotCountryChange(const QString &)) ); |
785 | connect( cmbCountry, SIGNAL(activated(const QString &)), | 799 | connect( cmbCountry, SIGNAL(activated(const QString &)), |
786 | this, SLOT(slotCountryChange(const QString &)) ); | 800 | this, SLOT(slotCountryChange(const QString &)) ); |
787 | connect( cmbChooserField1, SIGNAL(activated(int)), | 801 | connect( cmbChooserField1, SIGNAL(activated(int)), |
788 | this, SLOT(slotCmbChooser1Change(int)) ); | 802 | this, SLOT(slotCmbChooser1Change(int)) ); |
789 | connect( cmbChooserField2, SIGNAL(activated(int)), | 803 | connect( cmbChooserField2, SIGNAL(activated(int)), |
790 | this, SLOT(slotCmbChooser2Change(int)) ); | 804 | this, SLOT(slotCmbChooser2Change(int)) ); |
791 | connect( cmbChooserField3, SIGNAL(activated(int)), | 805 | connect( cmbChooserField3, SIGNAL(activated(int)), |
792 | this, SLOT(slotCmbChooser3Change(int)) ); | 806 | this, SLOT(slotCmbChooser3Change(int)) ); |
793 | connect( cmbChooserField4, SIGNAL(activated(int)), | 807 | connect( cmbChooserField4, SIGNAL(activated(int)), |
794 | this, SLOT(slotCmbChooser4Change(int)) ); | 808 | this, SLOT(slotCmbChooser4Change(int)) ); |
795 | connect( cmbAddress, SIGNAL(activated(int)), | 809 | connect( cmbAddress, SIGNAL(activated(int)), |
796 | this, SLOT(slotAddressTypeChange(int)) ); | 810 | this, SLOT(slotAddressTypeChange(int)) ); |
797 | 811 | ||
798 | new QPEDialogListener(this); | 812 | new QPEDialogListener(this); |
799 | } | 813 | } |
800 | 814 | ||
801 | void ContactEditor::initMap() | 815 | void ContactEditor::initMap() |
802 | { | 816 | { |
803 | /* | 817 | /* |
804 | // since the fields and the XML fields exist, create a map | 818 | // since the fields and the XML fields exist, create a map |
805 | // between them... | 819 | // between them... |
806 | Config cfg1( "AddressBook" ); | 820 | Config cfg1( "AddressBook" ); |
807 | Config cfg2( "AddressBook" ); | 821 | Config cfg2( "AddressBook" ); |
808 | QString strCfg1, | 822 | QString strCfg1, |
809 | strCfg2; | 823 | strCfg2; |
810 | int i; | 824 | int i; |
811 | 825 | ||
812 | // This stuff better exist... | 826 | // This stuff better exist... |
813 | cfg1.setGroup( "AddressFields" ); | 827 | cfg1.setGroup( "AddressFields" ); |
814 | o cfg2.setGroup( "XMLFields" ); | 828 | o cfg2.setGroup( "XMLFields" ); |
815 | i = 0; | 829 | i = 0; |
816 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); | 830 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); |
817 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), | 831 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), |
818 | QString::null ); | 832 | QString::null ); |
819 | while ( !strCfg1.isNull() && !strCfg2.isNull() ) { | 833 | while ( !strCfg1.isNull() && !strCfg2.isNull() ) { |
820 | mapField.insert( strCfg1, strCfg2 ); | 834 | mapField.insert( strCfg1, strCfg2 ); |
821 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), | 835 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), |
822 | QString::null ); | 836 | QString::null ); |
823 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), | 837 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), |
824 | QString::null ); | 838 | QString::null ); |
825 | } | 839 | } |
826 | */ | 840 | */ |
827 | } | 841 | } |
828 | 842 | ||
829 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 843 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
830 | 844 | ||
831 | int index = cmbChooserField1->currentItem(); | 845 | int index = cmbChooserField1->currentItem(); |
832 | 846 | ||
833 | slChooserValues[index] = textChanged; | 847 | slChooserValues[index] = textChanged; |
834 | 848 | ||
835 | } | 849 | } |
836 | 850 | ||
837 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 851 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
838 | 852 | ||
839 | int index = cmbChooserField2->currentItem(); | 853 | int index = cmbChooserField2->currentItem(); |
840 | 854 | ||
841 | slChooserValues[index] = textChanged; | 855 | slChooserValues[index] = textChanged; |
842 | 856 | ||
843 | } | 857 | } |
844 | 858 | ||
845 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 859 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
846 | 860 | ||
847 | int index = cmbChooserField3->currentItem(); | 861 | int index = cmbChooserField3->currentItem(); |
848 | 862 | ||
849 | slChooserValues[index] = textChanged; | 863 | slChooserValues[index] = textChanged; |
850 | 864 | ||
851 | } | 865 | } |
852 | 866 | ||
853 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 867 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
854 | 868 | ||
855 | int index = cmbChooserField4->currentItem(); | 869 | int index = cmbChooserField4->currentItem(); |
856 | 870 | ||
857 | slChooserValues[index] = textChanged; | 871 | slChooserValues[index] = textChanged; |
858 | 872 | ||
859 | } | 873 | } |
860 | 874 | ||
861 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 875 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
862 | 876 | ||
863 | if ( cmbAddress->currentItem() == 0 ) { | 877 | if ( cmbAddress->currentItem() == 0 ) { |
864 | slBusinessAddress[0] = textChanged; | 878 | slBusinessAddress[0] = textChanged; |
865 | } else { | 879 | } else { |
866 | slHomeAddress[0] = textChanged; | 880 | slHomeAddress[0] = textChanged; |
867 | } | 881 | } |
868 | } | 882 | } |
869 | 883 | ||
870 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 884 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
871 | 885 | ||
872 | if ( cmbAddress->currentItem() == 0 ) { | 886 | if ( cmbAddress->currentItem() == 0 ) { |
873 | slBusinessAddress[1] = textChanged; | 887 | slBusinessAddress[1] = textChanged; |
874 | } else { | 888 | } else { |
875 | slHomeAddress[1] = textChanged; | 889 | slHomeAddress[1] = textChanged; |
876 | } | 890 | } |
877 | } | 891 | } |
878 | 892 | ||
879 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 893 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
880 | 894 | ||
881 | if ( cmbAddress->currentItem() == 0 ) { | 895 | if ( cmbAddress->currentItem() == 0 ) { |
882 | slBusinessAddress[2] = textChanged; | 896 | slBusinessAddress[2] = textChanged; |
883 | } else { | 897 | } else { |
884 | slHomeAddress[2] = textChanged; | 898 | slHomeAddress[2] = textChanged; |
885 | } | 899 | } |
886 | } | 900 | } |
887 | 901 | ||
888 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 902 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
889 | 903 | ||
890 | if ( cmbAddress->currentItem() == 0 ) { | 904 | if ( cmbAddress->currentItem() == 0 ) { |
891 | slBusinessAddress[3] = textChanged; | 905 | slBusinessAddress[3] = textChanged; |
892 | } else { | 906 | } else { |
893 | slHomeAddress[3] = textChanged; | 907 | slHomeAddress[3] = textChanged; |
894 | } | 908 | } |
895 | } | 909 | } |
896 | 910 | ||
897 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 911 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
898 | 912 | ||
899 | 913 | ||
900 | if ( cmbAddress->currentItem() == 0 ) { | 914 | if ( cmbAddress->currentItem() == 0 ) { |
901 | slBusinessAddress[4] = textChanged; | 915 | slBusinessAddress[4] = textChanged; |
902 | } else { | 916 | } else { |
903 | slHomeAddress[4] = textChanged; | 917 | slHomeAddress[4] = textChanged; |
904 | } | 918 | } |
905 | } | 919 | } |
906 | 920 | ||
907 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 921 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
908 | 922 | ||
909 | if ( cmbAddress->currentItem() == 0 ) { | 923 | if ( cmbAddress->currentItem() == 0 ) { |
910 | slBusinessAddress[5] = textChanged; | 924 | slBusinessAddress[5] = textChanged; |
911 | } else { | 925 | } else { |
912 | slHomeAddress[5] = textChanged; | 926 | slHomeAddress[5] = textChanged; |
913 | } | 927 | } |
914 | } | 928 | } |
915 | 929 | ||
916 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 930 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
917 | 931 | ||
918 | if ( cmbAddress->currentItem() == 0 ) { | 932 | if ( cmbAddress->currentItem() == 0 ) { |
919 | slBusinessAddress[6] = textChanged; | 933 | slBusinessAddress[6] = textChanged; |
920 | } else { | 934 | } else { |
921 | slHomeAddress[6] = textChanged; | 935 | slHomeAddress[6] = textChanged; |
922 | } | 936 | } |
923 | } | 937 | } |
924 | 938 | ||
925 | void ContactEditor::slotCmbChooser1Change( int index ) { | 939 | void ContactEditor::slotCmbChooser1Change( int index ) { |
926 | 940 | ||
927 | txtChooserField1->setText( slChooserValues[index] ); | 941 | txtChooserField1->setText( slChooserValues[index] ); |
928 | txtChooserField1->setFocus(); | 942 | txtChooserField1->setFocus(); |
929 | } | 943 | } |
930 | 944 | ||
931 | void ContactEditor::slotCmbChooser2Change( int index ) { | 945 | void ContactEditor::slotCmbChooser2Change( int index ) { |
932 | 946 | ||
933 | txtChooserField2->setText( slChooserValues[index] ); | 947 | txtChooserField2->setText( slChooserValues[index] ); |
934 | txtChooserField2->setFocus(); | 948 | txtChooserField2->setFocus(); |
935 | } | 949 | } |
936 | 950 | ||
937 | void ContactEditor::slotCmbChooser3Change( int index ) { | 951 | void ContactEditor::slotCmbChooser3Change( int index ) { |
938 | 952 | ||
939 | txtChooserField3->setText( slChooserValues[index] ); | 953 | txtChooserField3->setText( slChooserValues[index] ); |
940 | txtChooserField3->setFocus(); | 954 | txtChooserField3->setFocus(); |
941 | 955 | ||
942 | } | 956 | } |
943 | 957 | ||
944 | void ContactEditor::slotCmbChooser4Change( int index ) { | 958 | void ContactEditor::slotCmbChooser4Change( int index ) { |
945 | 959 | ||
946 | txtChooserField4->setText( slChooserValues[index] ); | 960 | txtChooserField4->setText( slChooserValues[index] ); |
947 | txtChooserField4->setFocus(); | 961 | txtChooserField4->setFocus(); |
948 | 962 | ||
949 | } | 963 | } |
950 | 964 | ||
951 | void ContactEditor::slotAddressTypeChange( int index ) { | 965 | void ContactEditor::slotAddressTypeChange( int index ) { |
952 | 966 | ||
953 | if ( index == 0 ) { | 967 | if ( index == 0 ) { |
954 | 968 | ||
955 | txtAddress->setText( slBusinessAddress[0] ); | 969 | txtAddress->setText( slBusinessAddress[0] ); |
956 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 970 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
957 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 971 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
958 | txtCity->setText( slBusinessAddress[3] ); | 972 | txtCity->setText( slBusinessAddress[3] ); |
959 | txtState->setText( slBusinessAddress[4] ); | 973 | txtState->setText( slBusinessAddress[4] ); |
960 | txtZip->setText( slBusinessAddress[5] ); | 974 | txtZip->setText( slBusinessAddress[5] ); |
961 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 975 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
962 | txtTmp->setText( slBusinessAddress[6] ); | 976 | txtTmp->setText( slBusinessAddress[6] ); |
963 | 977 | ||
964 | } else { | 978 | } else { |
965 | 979 | ||
966 | txtAddress->setText( slHomeAddress[0] ); | 980 | txtAddress->setText( slHomeAddress[0] ); |
967 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 981 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
968 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 982 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
969 | txtCity->setText( slHomeAddress[3] ); | 983 | txtCity->setText( slHomeAddress[3] ); |
970 | txtState->setText( slHomeAddress[4] ); | 984 | txtState->setText( slHomeAddress[4] ); |
971 | txtZip->setText( slHomeAddress[5] ); | 985 | txtZip->setText( slHomeAddress[5] ); |
972 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 986 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
973 | txtTmp->setText( slHomeAddress[6] ); | 987 | txtTmp->setText( slHomeAddress[6] ); |
974 | 988 | ||
975 | } | 989 | } |
976 | 990 | ||
977 | } | 991 | } |
978 | 992 | ||
979 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 993 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
980 | 994 | ||
981 | int index = cmbFileAs->currentItem(); | 995 | int index = cmbFileAs->currentItem(); |
982 | 996 | ||
983 | cmbFileAs->clear(); | 997 | cmbFileAs->clear(); |
984 | 998 | ||
985 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); | 999 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); |
986 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); | 1000 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); |
987 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); | 1001 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); |
988 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); | 1002 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); |
989 | 1003 | ||
990 | cmbFileAs->setCurrentItem( index ); | 1004 | cmbFileAs->setCurrentItem( index ); |
991 | 1005 | ||
992 | useFullName = TRUE; | 1006 | useFullName = TRUE; |
993 | 1007 | ||
994 | } | 1008 | } |
995 | 1009 | ||
996 | void ContactEditor::loadFields() { | 1010 | void ContactEditor::loadFields() { |
997 | 1011 | ||
998 | QStringList::ConstIterator it; | 1012 | QStringList::ConstIterator it; |
999 | QListIterator<QLabel> lit( listName ); | 1013 | QListIterator<QLabel> lit( listName ); |
1000 | for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { | 1014 | for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { |
1001 | (*lit)->setText( *it ); | 1015 | (*lit)->setText( *it ); |
1002 | } | 1016 | } |
1003 | } | 1017 | } |
1004 | 1018 | ||
1005 | void ContactEditor::accept() { | 1019 | void ContactEditor::accept() { |
1006 | 1020 | ||
1007 | if ( isEmpty() ) { | 1021 | if ( isEmpty() ) { |
1008 | cleanupFields(); | 1022 | cleanupFields(); |
1009 | reject(); | 1023 | reject(); |
1010 | } else { | 1024 | } else { |
1011 | saveEntry(); | 1025 | saveEntry(); |
1012 | cleanupFields(); | 1026 | cleanupFields(); |
1013 | QDialog::accept(); | 1027 | QDialog::accept(); |
1014 | } | 1028 | } |
1015 | 1029 | ||
1016 | } | 1030 | } |
1017 | 1031 | ||
1018 | void ContactEditor::slotNote() { | 1032 | void ContactEditor::slotNote() { |
1019 | 1033 | ||
1020 | dlgNote->showMaximized(); | 1034 | dlgNote->showMaximized(); |
1021 | if ( !dlgNote->exec() ) { | 1035 | if ( !dlgNote->exec() ) { |
1022 | txtNote->setText( ent.notes() ); | 1036 | txtNote->setText( ent.notes() ); |
1023 | } | 1037 | } |
1024 | } | 1038 | } |
1025 | 1039 | ||
1026 | void ContactEditor::slotName() { | 1040 | void ContactEditor::slotName() { |
1027 | 1041 | ||
1028 | QString tmpName; | 1042 | QString tmpName; |
1029 | if (useFullName == TRUE) { | 1043 | if (useFullName == TRUE) { |
1030 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1044 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1031 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1045 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1032 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1046 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1033 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1047 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1034 | } | 1048 | } |
1035 | dlgName->showMaximized(); | 1049 | dlgName->showMaximized(); |
1036 | if ( dlgName->exec() ) { | 1050 | if ( dlgName->exec() ) { |
1037 | 1051 | ||
1038 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); | 1052 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); |
1039 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1053 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1040 | slotFullNameChange( txtFullName->text() ); | 1054 | slotFullNameChange( txtFullName->text() ); |
1041 | useFullName = FALSE; | 1055 | useFullName = FALSE; |
1042 | } | 1056 | } |
1043 | 1057 | ||
1044 | } | 1058 | } |
1045 | 1059 | ||
1046 | void ContactEditor::setNameFocus() { | 1060 | void ContactEditor::setNameFocus() { |
1047 | 1061 | ||
1048 | txtFullName->setFocus(); | 1062 | txtFullName->setFocus(); |
1049 | 1063 | ||
1050 | } | 1064 | } |
1051 | 1065 | ||
1052 | bool ContactEditor::isEmpty() { | 1066 | bool ContactEditor::isEmpty() { |
1053 | // Test and see if the record should be saved. | 1067 | // Test and see if the record should be saved. |
1054 | // More strict than the original qtopia, needs name or fileas to save | 1068 | // More strict than the original qtopia, needs name or fileas to save |
1055 | 1069 | ||
1056 | QString t = txtFullName->text(); | 1070 | QString t = txtFullName->text(); |
1057 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1071 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1058 | return false; | 1072 | return false; |
1059 | 1073 | ||
1060 | t = cmbFileAs->currentText(); | 1074 | t = cmbFileAs->currentText(); |
1061 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1075 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1062 | return false; | 1076 | return false; |
1063 | 1077 | ||
1064 | return true; | 1078 | return true; |
1065 | 1079 | ||
1066 | } | 1080 | } |
1067 | 1081 | ||
1068 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1082 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1069 | 1083 | ||
1070 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1084 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1071 | QString strFirstName; | 1085 | QString strFirstName; |
1072 | QString strMiddleName; | 1086 | QString strMiddleName; |
1073 | QString strLastName; | 1087 | QString strLastName; |
1074 | QString strSuffix; | 1088 | QString strSuffix; |
1075 | QString strTitle; | 1089 | QString strTitle; |
1076 | int commapos; | 1090 | int commapos; |
1077 | int spCount; | 1091 | int spCount; |
1078 | int spPos; | 1092 | int spPos; |
1079 | int spPos2; | 1093 | int spPos2; |
1080 | 1094 | ||
1081 | 1095 | ||
1082 | commapos = simplifiedName.find( ',', 0, TRUE); | 1096 | commapos = simplifiedName.find( ',', 0, TRUE); |
1083 | spCount = simplifiedName.contains( ' ', TRUE ); | 1097 | spCount = simplifiedName.contains( ' ', TRUE ); |
1084 | 1098 | ||
1085 | if ( commapos == -1 ) { | 1099 | if ( commapos == -1 ) { |
1086 | 1100 | ||
1087 | switch (spCount) { | 1101 | switch (spCount) { |
1088 | case 0: | 1102 | case 0: |
1089 | //return simplifiedName; | 1103 | //return simplifiedName; |
1090 | if (txtLastName->text() != "") { | 1104 | if (txtLastName->text() != "") { |
1091 | strLastName = simplifiedName; | 1105 | strLastName = simplifiedName; |
1092 | break; | 1106 | break; |
1093 | } | 1107 | } |
1094 | if (txtMiddleName->text() != "") { | 1108 | if (txtMiddleName->text() != "") { |
1095 | strMiddleName = simplifiedName; | 1109 | strMiddleName = simplifiedName; |
1096 | break; | 1110 | break; |
1097 | } | 1111 | } |
1098 | if (txtSuffix->text() != "") { | 1112 | if (txtSuffix->text() != "") { |
1099 | strSuffix = simplifiedName; | 1113 | strSuffix = simplifiedName; |
1100 | break; | 1114 | break; |
1101 | } | 1115 | } |
1102 | strFirstName = simplifiedName; | 1116 | strFirstName = simplifiedName; |
1103 | break; | 1117 | break; |
1104 | 1118 | ||
1105 | case 1: | 1119 | case 1: |
1106 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1120 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1107 | strFirstName = simplifiedName.left( spPos ); | 1121 | strFirstName = simplifiedName.left( spPos ); |
1108 | strLastName = simplifiedName.mid( spPos + 1 ); | 1122 | strLastName = simplifiedName.mid( spPos + 1 ); |
1109 | break; | 1123 | break; |
1110 | 1124 | ||
1111 | case 2: | 1125 | case 2: |
1112 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1126 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1113 | strFirstName = simplifiedName.left( spPos ); | 1127 | strFirstName = simplifiedName.left( spPos ); |
1114 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1128 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1115 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1129 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1116 | strLastName = simplifiedName.mid( spPos2 + 1 ); | 1130 | strLastName = simplifiedName.mid( spPos2 + 1 ); |
1117 | break; | 1131 | break; |
1118 | 1132 | ||
1119 | case 3: | 1133 | case 3: |
1120 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1134 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1121 | strFirstName = simplifiedName.left( spPos ); | 1135 | strFirstName = simplifiedName.left( spPos ); |
1122 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1136 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1123 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1137 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1124 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1138 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1125 | strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1139 | strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1126 | strSuffix = simplifiedName.mid( spPos + 1 ); | 1140 | strSuffix = simplifiedName.mid( spPos + 1 ); |
1127 | break; | 1141 | break; |
1128 | 1142 | ||
1129 | case 4: | 1143 | case 4: |
1130 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1144 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1131 | strTitle = simplifiedName.left( spPos ); | 1145 | strTitle = simplifiedName.left( spPos ); |
1132 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1146 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1133 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1147 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1134 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1148 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1135 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1149 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1136 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1150 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1137 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1151 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1138 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1152 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1139 | break; | 1153 | break; |
1140 | 1154 | ||
1141 | default: | 1155 | default: |
1142 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1156 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1143 | strTitle = simplifiedName.left( spPos ); | 1157 | strTitle = simplifiedName.left( spPos ); |
1144 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1158 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1145 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1159 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1146 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1160 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1147 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1161 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1148 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1162 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1149 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1163 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1150 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1164 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1151 | break; | 1165 | break; |
1152 | } | 1166 | } |
1153 | } else { | 1167 | } else { |
1154 | simplifiedName.replace( commapos, 1, " " ); | 1168 | simplifiedName.replace( commapos, 1, " " ); |
1155 | simplifiedName = simplifiedName.simplifyWhiteSpace(); | 1169 | simplifiedName = simplifiedName.simplifyWhiteSpace(); |
1156 | 1170 | ||
1157 | switch (spCount) { | 1171 | switch (spCount) { |
1158 | case 0: | 1172 | case 0: |
1159 | //return simplifiedName; | 1173 | //return simplifiedName; |
1160 | if (txtLastName->text() != "") { | 1174 | if (txtLastName->text() != "") { |
1161 | strLastName = simplifiedName; | 1175 | strLastName = simplifiedName; |
1162 | break; | 1176 | break; |
1163 | } | 1177 | } |
1164 | if (txtMiddleName->text() != "") { | 1178 | if (txtMiddleName->text() != "") { |
1165 | strMiddleName = simplifiedName; | 1179 | strMiddleName = simplifiedName; |
1166 | break; | 1180 | break; |
1167 | } | 1181 | } |
1168 | if (txtSuffix->text() != "") { | 1182 | if (txtSuffix->text() != "") { |
1169 | strSuffix = simplifiedName; | 1183 | strSuffix = simplifiedName; |
1170 | break; | 1184 | break; |
1171 | } | 1185 | } |
1172 | strFirstName = simplifiedName; | 1186 | strFirstName = simplifiedName; |
1173 | break; | 1187 | break; |
1174 | 1188 | ||
1175 | case 1: | 1189 | case 1: |
1176 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1190 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1177 | strLastName = simplifiedName.left( spPos ); | 1191 | strLastName = simplifiedName.left( spPos ); |
1178 | strFirstName = simplifiedName.mid( spPos + 1 ); | 1192 | strFirstName = simplifiedName.mid( spPos + 1 ); |
1179 | break; | 1193 | break; |
1180 | 1194 | ||
1181 | case 2: | 1195 | case 2: |
1182 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1196 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1183 | strLastName = simplifiedName.left( spPos ); | 1197 | strLastName = simplifiedName.left( spPos ); |
1184 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1198 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1185 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1199 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1186 | strMiddleName = simplifiedName.mid( spPos2 + 1 ); | 1200 | strMiddleName = simplifiedName.mid( spPos2 + 1 ); |
1187 | break; | 1201 | break; |
1188 | 1202 | ||
1189 | case 3: | 1203 | case 3: |
1190 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1204 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1191 | strLastName = simplifiedName.left( spPos ); | 1205 | strLastName = simplifiedName.left( spPos ); |
1192 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1206 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1193 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1207 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1194 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1208 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1195 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1209 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1196 | strSuffix = simplifiedName.mid( spPos + 1 ); | 1210 | strSuffix = simplifiedName.mid( spPos + 1 ); |
1197 | break; | 1211 | break; |
1198 | 1212 | ||
1199 | case 4: | 1213 | case 4: |
1200 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1214 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1201 | strLastName = simplifiedName.left( spPos ); | 1215 | strLastName = simplifiedName.left( spPos ); |
1202 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1216 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1203 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1217 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1204 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1218 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1205 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1219 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1206 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1220 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1207 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1221 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1208 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1222 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1209 | break; | 1223 | break; |
1210 | 1224 | ||
1211 | default: | 1225 | default: |
1212 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1226 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1213 | strLastName = simplifiedName.left( spPos ); | 1227 | strLastName = simplifiedName.left( spPos ); |
1214 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1228 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1215 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1229 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1216 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1230 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1217 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 1231 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); |
1218 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1232 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1219 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1233 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1220 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1234 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1221 | break; | 1235 | break; |
1222 | } | 1236 | } |
1223 | } | 1237 | } |
1224 | switch (type) { | 1238 | switch (type) { |
1225 | case NAME_FL: | 1239 | case NAME_FL: |
1226 | return strFirstName + " " + strLastName; | 1240 | return strFirstName + " " + strLastName; |
1227 | 1241 | ||
1228 | case NAME_LF: | 1242 | case NAME_LF: |
1229 | return strLastName + ", " + strFirstName; | 1243 | return strLastName + ", " + strFirstName; |
1230 | 1244 | ||
1231 | case NAME_LFM: | 1245 | case NAME_LFM: |
1232 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1246 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1233 | 1247 | ||
1234 | case NAME_FMLS: | 1248 | case NAME_FMLS: |
1235 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; | 1249 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; |
1236 | 1250 | ||
1237 | case NAME_F: | 1251 | case NAME_F: |
1238 | return strFirstName; | 1252 | return strFirstName; |
1239 | 1253 | ||
1240 | case NAME_M: | 1254 | case NAME_M: |
1241 | return strMiddleName; | 1255 | return strMiddleName; |
1242 | 1256 | ||
1243 | case NAME_L: | 1257 | case NAME_L: |
1244 | return strLastName; | 1258 | return strLastName; |
1245 | 1259 | ||
1246 | case NAME_S: | 1260 | case NAME_S: |
1247 | return strSuffix; | 1261 | return strSuffix; |
1248 | 1262 | ||
1249 | } | 1263 | } |
1250 | return QString::null; | 1264 | return QString::null; |
1251 | } | 1265 | } |
1252 | 1266 | ||
1253 | void ContactEditor::cleanupFields() { | 1267 | void ContactEditor::cleanupFields() { |
1254 | 1268 | ||
1255 | QStringList::Iterator it = slChooserValues.begin(); | 1269 | QStringList::Iterator it = slChooserValues.begin(); |
1256 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1270 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1257 | (*it) = ""; | 1271 | (*it) = ""; |
1258 | } | 1272 | } |
1259 | 1273 | ||
1260 | for ( int i = 0; i < 7; i++ ) { | 1274 | for ( int i = 0; i < 7; i++ ) { |
1261 | slHomeAddress[i] = ""; | 1275 | slHomeAddress[i] = ""; |
1262 | slBusinessAddress[i] = ""; | 1276 | slBusinessAddress[i] = ""; |
1263 | } | 1277 | } |
1264 | 1278 | ||
1265 | QStringList::ConstIterator cit; | 1279 | QStringList::ConstIterator cit; |
1266 | QListIterator<QLineEdit> itLE( listValue ); | 1280 | QListIterator<QLineEdit> itLE( listValue ); |
1267 | for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) { | 1281 | for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) { |
1268 | (*itLE)->setText( "" ); | 1282 | (*itLE)->setText( "" ); |
1269 | } | 1283 | } |
1270 | 1284 | ||
1271 | txtFirstName->setText(""); | 1285 | txtFirstName->setText(""); |
1272 | txtMiddleName->setText(""); | 1286 | txtMiddleName->setText(""); |
1273 | txtLastName->setText(""); | 1287 | txtLastName->setText(""); |
1274 | txtSuffix->setText(""); | 1288 | txtSuffix->setText(""); |
1275 | txtNote->setText(""); | 1289 | txtNote->setText(""); |
1276 | txtFullName->setText(""); | 1290 | txtFullName->setText(""); |
1277 | txtJobTitle->setText(""); | 1291 | txtJobTitle->setText(""); |
1278 | txtOrganization->setText(""); | 1292 | txtOrganization->setText(""); |
1279 | txtChooserField1->setText(""); | 1293 | txtChooserField1->setText(""); |
1280 | txtChooserField2->setText(""); | 1294 | txtChooserField2->setText(""); |
1281 | txtChooserField3->setText(""); | 1295 | txtChooserField3->setText(""); |
1282 | txtAddress->setText(""); | 1296 | txtAddress->setText(""); |
1283 | //txtAddress2->setText(""); | 1297 | //txtAddress2->setText(""); |
1284 | txtCity->setText(""); | 1298 | txtCity->setText(""); |
1285 | //txtPOBox->setText(""); | 1299 | //txtPOBox->setText(""); |
1286 | txtState->setText(""); | 1300 | txtState->setText(""); |
1287 | txtZip->setText(""); | 1301 | txtZip->setText(""); |
1288 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1302 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1289 | txtTmp->setText(""); | 1303 | txtTmp->setText(""); |
1290 | txtTmp = cmbFileAs->lineEdit(); | 1304 | txtTmp = cmbFileAs->lineEdit(); |
1291 | txtTmp->setText(""); | 1305 | txtTmp->setText(""); |
1292 | 1306 | ||
1293 | } | 1307 | } |
1294 | 1308 | ||
1295 | void ContactEditor::setEntry( const OContact &entry ) { | 1309 | void ContactEditor::setEntry( const OContact &entry ) { |
1296 | 1310 | ||
1297 | cleanupFields(); | 1311 | cleanupFields(); |
1298 | 1312 | ||
1299 | 1313 | ||
1300 | ent = entry; | 1314 | ent = entry; |
1301 | 1315 | ||
1302 | useFullName = FALSE; | 1316 | useFullName = FALSE; |
1303 | txtFirstName->setText( ent.firstName() ); | 1317 | txtFirstName->setText( ent.firstName() ); |
1304 | txtMiddleName->setText( ent.middleName() ); | 1318 | txtMiddleName->setText( ent.middleName() ); |
1305 | txtLastName->setText( ent.lastName() ); | 1319 | txtLastName->setText( ent.lastName() ); |
1306 | txtSuffix->setText( ent.suffix() ); | 1320 | txtSuffix->setText( ent.suffix() ); |
1307 | 1321 | ||
1308 | QString *tmpString = new QString; | 1322 | QString *tmpString = new QString; |
1309 | *tmpString = ent.firstName() + " " + ent.middleName() + | 1323 | *tmpString = ent.firstName() + " " + ent.middleName() + |
1310 | + " " + ent.lastName() + " " + ent.suffix(); | 1324 | + " " + ent.lastName() + " " + ent.suffix(); |
1311 | 1325 | ||
1312 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1326 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1313 | 1327 | ||
1314 | cmbFileAs->setEditText( ent.fileAs() ); | 1328 | cmbFileAs->setEditText( ent.fileAs() ); |
1315 | 1329 | ||
1316 | if (hasTitle) | 1330 | if (hasTitle) |
1317 | txtJobTitle->setText( ent.jobTitle() ); | 1331 | txtJobTitle->setText( ent.jobTitle() ); |
1318 | 1332 | ||
1319 | if (hasCompany) | 1333 | if (hasCompany) |
1320 | txtOrganization->setText( ent.company() ); | 1334 | txtOrganization->setText( ent.company() ); |
1321 | 1335 | ||
1322 | if (hasNotes) | 1336 | if (hasNotes) |
1323 | txtNote->setText( ent.notes() ); | 1337 | txtNote->setText( ent.notes() ); |
1324 | 1338 | ||
1325 | if (hasStreet) { | 1339 | if (hasStreet) { |
1326 | slHomeAddress[0] = ent.homeStreet(); | 1340 | slHomeAddress[0] = ent.homeStreet(); |
1327 | slBusinessAddress[0] = ent.businessStreet(); | 1341 | slBusinessAddress[0] = ent.businessStreet(); |
1328 | } | 1342 | } |
1329 | /* | 1343 | /* |
1330 | if (hasStreet2) { | 1344 | if (hasStreet2) { |
1331 | (*slHomeAddress)[1] = ent.homeStreet2(); | 1345 | (*slHomeAddress)[1] = ent.homeStreet2(); |
1332 | (*slBusinessAddress)[1] = ent.businessStreet2(); | 1346 | (*slBusinessAddress)[1] = ent.businessStreet2(); |
1333 | } | 1347 | } |
1334 | 1348 | ||
1335 | if (hasPOBox) { | 1349 | if (hasPOBox) { |
1336 | (*slHomeAddress)[2] = ent.homePOBox(); | 1350 | (*slHomeAddress)[2] = ent.homePOBox(); |
1337 | (*slBusinessAddress)[2] = ent.businessPOBox(); | 1351 | (*slBusinessAddress)[2] = ent.businessPOBox(); |
1338 | } | 1352 | } |
1339 | */ | 1353 | */ |
1340 | if (hasCity) { | 1354 | if (hasCity) { |
1341 | slHomeAddress[3] = ent.homeCity(); | 1355 | slHomeAddress[3] = ent.homeCity(); |
1342 | slBusinessAddress[3] = ent.businessCity(); | 1356 | slBusinessAddress[3] = ent.businessCity(); |
1343 | } | 1357 | } |
1344 | 1358 | ||
1345 | if (hasState) { | 1359 | if (hasState) { |
1346 | slHomeAddress[4] = ent.homeState(); | 1360 | slHomeAddress[4] = ent.homeState(); |
1347 | slBusinessAddress[4] = ent.businessState(); | 1361 | slBusinessAddress[4] = ent.businessState(); |
1348 | } | 1362 | } |
1349 | 1363 | ||
1350 | if (hasZip) { | 1364 | if (hasZip) { |
1351 | slHomeAddress[5] = ent.homeZip(); | 1365 | slHomeAddress[5] = ent.homeZip(); |
1352 | slBusinessAddress[5] = ent.businessZip(); | 1366 | slBusinessAddress[5] = ent.businessZip(); |
1353 | } | 1367 | } |
1354 | 1368 | ||
1355 | if (hasCountry) { | 1369 | if (hasCountry) { |
1356 | slHomeAddress[6] = ent.homeCountry(); | 1370 | slHomeAddress[6] = ent.homeCountry(); |
1357 | slBusinessAddress[6] = ent.businessCountry(); | 1371 | slBusinessAddress[6] = ent.businessCountry(); |
1358 | } | 1372 | } |
1359 | 1373 | ||
1360 | QStringList::ConstIterator it; | 1374 | QStringList::ConstIterator it; |
1361 | QListIterator<QLineEdit> itLE( listValue ); | 1375 | QListIterator<QLineEdit> itLE( listValue ); |
1362 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { | 1376 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { |
1363 | if ( *it =="Department" ) | 1377 | if ( *it == tr( "Department" ) ) |
1364 | (*itLE)->setText( ent.department() ); | 1378 | (*itLE)->setText( ent.department() ); |
1365 | 1379 | ||
1366 | if ( *it == "Company" ) | 1380 | if ( *it == tr( "Company" ) ) |
1367 | (*itLE)->setText( ent.company() ); | 1381 | (*itLE)->setText( ent.company() ); |
1368 | 1382 | ||
1369 | if ( *it == "Office" ) | 1383 | if ( *it == tr( "Office" ) ) |
1370 | (*itLE)->setText( ent.office() ); | 1384 | (*itLE)->setText( ent.office() ); |
1371 | 1385 | ||
1372 | if ( *it == "Profession" ) | 1386 | if ( *it == tr( "Profession" ) ) |
1373 | (*itLE)->setText( ent.profession() ); | 1387 | (*itLE)->setText( ent.profession() ); |
1374 | 1388 | ||
1375 | if ( *it == "Assistant" ) | 1389 | if ( *it == tr( "Assistant" ) ) |
1376 | (*itLE)->setText( ent.assistant() ); | 1390 | (*itLE)->setText( ent.assistant() ); |
1377 | 1391 | ||
1378 | if ( *it == "Manager" ) | 1392 | if ( *it == tr( "Manager" ) ) |
1379 | (*itLE)->setText( ent.manager() ); | 1393 | (*itLE)->setText( ent.manager() ); |
1380 | 1394 | ||
1381 | if ( *it == "Spouse" ) | 1395 | if ( *it == tr( "Spouse" ) ) |
1382 | (*itLE)->setText( ent.spouse() ); | 1396 | (*itLE)->setText( ent.spouse() ); |
1383 | 1397 | ||
1384 | if ( *it == "Birthday" ) | 1398 | if ( *it == tr( "Birthday" ) ) |
1385 | (*itLE)->setText( ent.birthday() ); | 1399 | (*itLE)->setText( ent.birthday() ); |
1386 | 1400 | ||
1387 | if ( *it == "Anniversary" ) | 1401 | if ( *it == tr( "Anniversary" ) ) |
1388 | (*itLE)->setText( ent.anniversary() ); | 1402 | (*itLE)->setText( ent.anniversary() ); |
1389 | 1403 | ||
1390 | if ( *it == "Nickname" ) | 1404 | if ( *it == tr( "Nickname" ) ) |
1391 | (*itLE)->setText( ent.nickname() ); | 1405 | (*itLE)->setText( ent.nickname() ); |
1392 | 1406 | ||
1393 | if ( *it == "Children" ) | 1407 | if ( *it == tr( "Children" ) ) |
1394 | (*itLE)->setText( ent.children() ); | 1408 | (*itLE)->setText( ent.children() ); |
1395 | 1409 | ||
1396 | } | 1410 | } |
1397 | 1411 | ||
1398 | QStringList::Iterator itV; | 1412 | QStringList::Iterator itV; |
1399 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1413 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1400 | 1414 | ||
1401 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1415 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1402 | *itV = ent.businessPhone(); | 1416 | *itV = ent.businessPhone(); |
1403 | /* | 1417 | /* |
1404 | if ( *it == "Business 2 Phone" ) | 1418 | if ( *it == "Business 2 Phone" ) |
1405 | *itV = ent.business2Phone(); | 1419 | *itV = ent.business2Phone(); |
1406 | */ | 1420 | */ |
1407 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1421 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1408 | *itV = ent.businessFax(); | 1422 | *itV = ent.businessFax(); |
1409 | 1423 | ||
1410 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1424 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1411 | *itV = ent.businessMobile(); | 1425 | *itV = ent.businessMobile(); |
1412 | /* | 1426 | /* |
1413 | if ( *it == "Company Phone" ) | 1427 | if ( *it == "Company Phone" ) |
1414 | *itV = ent.companyPhone(); | 1428 | *itV = ent.companyPhone(); |
1415 | */ | 1429 | */ |
1416 | if ( *it == "Default Email" ) | 1430 | if ( *it == "Default Email" ) |
1417 | *itV = ent.defaultEmail(); | 1431 | *itV = ent.defaultEmail(); |
1418 | 1432 | ||
1419 | if ( *it == "Emails" ) | 1433 | if ( *it == "Emails" ) |
1420 | *itV = ent.emailList().join(", "); // :SX | 1434 | *itV = ent.emailList().join(", "); // :SX |
1421 | 1435 | ||
1422 | if ( *it == "Home Phone" ) | 1436 | if ( *it == "Home Phone" ) |
1423 | *itV = ent.homePhone(); | 1437 | *itV = ent.homePhone(); |
1424 | /* | 1438 | /* |
1425 | if ( *it == "Home 2 Phone" ) | 1439 | if ( *it == "Home 2 Phone" ) |
1426 | *itV = ent.home2Phone(); | 1440 | *itV = ent.home2Phone(); |
1427 | */ | 1441 | */ |
1428 | if ( *it == "Home Fax" ) | 1442 | if ( *it == "Home Fax" ) |
1429 | *itV = ent.homeFax(); | 1443 | *itV = ent.homeFax(); |
1430 | 1444 | ||
1431 | if ( *it == "Home Mobile" ) | 1445 | if ( *it == "Home Mobile" ) |
1432 | *itV = ent.homeMobile(); | 1446 | *itV = ent.homeMobile(); |
1433 | /* | 1447 | /* |
1434 | if ( *it == "Car Phone" ) | 1448 | if ( *it == "Car Phone" ) |
1435 | *itV = ent.carPhone(); | 1449 | *itV = ent.carPhone(); |
1436 | 1450 | ||
1437 | if ( *it == "ISDN Phone" ) | 1451 | if ( *it == "ISDN Phone" ) |
1438 | *itV = ent.ISDNPhone(); | 1452 | *itV = ent.ISDNPhone(); |
1439 | 1453 | ||
1440 | if ( *it == "Other Phone" ) | 1454 | if ( *it == "Other Phone" ) |
1441 | *itV = ent.otherPhone(); | 1455 | *itV = ent.otherPhone(); |
1442 | */ | 1456 | */ |
1443 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1457 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1444 | *itV = ent.businessPager(); | 1458 | *itV = ent.businessPager(); |
1445 | /* | 1459 | /* |
1446 | if ( *it == "Home Pager") | 1460 | if ( *it == "Home Pager") |
1447 | *itV = ent.homePager(); | 1461 | *itV = ent.homePager(); |
1448 | 1462 | ||
1449 | if ( *it == "AIM IM" ) | 1463 | if ( *it == "AIM IM" ) |
1450 | *itV = ent.AIMIM(); | 1464 | *itV = ent.AIMIM(); |
1451 | 1465 | ||
1452 | if ( *it == "ICQ IM" ) | 1466 | if ( *it == "ICQ IM" ) |
1453 | *itV = ent.ICQIM(); | 1467 | *itV = ent.ICQIM(); |
1454 | 1468 | ||
1455 | if ( *it == "Jabber IM" ) | 1469 | if ( *it == "Jabber IM" ) |
1456 | *itV = ent.jabberIM(); | 1470 | *itV = ent.jabberIM(); |
1457 | 1471 | ||
1458 | if ( *it == "MSN IM" ) | 1472 | if ( *it == "MSN IM" ) |
1459 | *itV = ent.MSNIM(); | 1473 | *itV = ent.MSNIM(); |
1460 | 1474 | ||
1461 | if ( *it == "Yahoo IM" ) | 1475 | if ( *it == "Yahoo IM" ) |
1462 | *itV = ent.yahooIM(); | 1476 | *itV = ent.yahooIM(); |
1463 | */ | 1477 | */ |
1464 | if ( *it == "Home Web Page" ) | 1478 | if ( *it == "Home Web Page" ) |
1465 | *itV = ent.homeWebpage(); | 1479 | *itV = ent.homeWebpage(); |
1466 | 1480 | ||
1467 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1481 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1468 | *itV = ent.businessWebpage(); | 1482 | *itV = ent.businessWebpage(); |
1469 | 1483 | ||
1470 | 1484 | ||
1471 | } | 1485 | } |
1472 | 1486 | ||
1473 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1487 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1474 | 1488 | ||
1475 | QString gender = ent.gender(); | 1489 | QString gender = ent.gender(); |
1476 | cmbGender->setCurrentItem( gender.toInt() ); | 1490 | cmbGender->setCurrentItem( gender.toInt() ); |
1477 | 1491 | ||
1478 | txtNote->setText( ent.notes() ); | 1492 | txtNote->setText( ent.notes() ); |
1479 | 1493 | ||
1480 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1494 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1481 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1495 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1482 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1496 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1483 | 1497 | ||
1484 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1498 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1485 | 1499 | ||
1486 | } | 1500 | } |
1487 | 1501 | ||
1488 | void ContactEditor::saveEntry() { | 1502 | void ContactEditor::saveEntry() { |
1489 | 1503 | ||
1490 | if ( useFullName == TRUE ) { | 1504 | if ( useFullName == TRUE ) { |
1491 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1505 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1492 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1506 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1493 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1507 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1494 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1508 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1495 | 1509 | ||
1496 | useFullName = FALSE; | 1510 | useFullName = FALSE; |
1497 | } | 1511 | } |
1498 | 1512 | ||
1499 | /*if ( ent.firstName() != txtFirstName->text() || | 1513 | /*if ( ent.firstName() != txtFirstName->text() || |
1500 | ent.lastName != txtLastName->text() || | 1514 | ent.lastName != txtLastName->text() || |
1501 | ent.middleName != txtMiddleName->text() ) { | 1515 | ent.middleName != txtMiddleName->text() ) { |
1502 | */ | 1516 | */ |
1503 | ent.setFirstName( txtFirstName->text() ); | 1517 | ent.setFirstName( txtFirstName->text() ); |
1504 | ent.setLastName( txtLastName->text() ); | 1518 | ent.setLastName( txtLastName->text() ); |
1505 | ent.setMiddleName( txtMiddleName->text() ); | 1519 | ent.setMiddleName( txtMiddleName->text() ); |
1506 | ent.setSuffix( txtSuffix->text() ); | 1520 | ent.setSuffix( txtSuffix->text() ); |
1507 | 1521 | ||
1508 | //} | 1522 | //} |
1509 | 1523 | ||
1510 | ent.setFileAs( cmbFileAs->currentText() ); | 1524 | ent.setFileAs( cmbFileAs->currentText() ); |
1511 | 1525 | ||
1512 | ent.setCategories( cmbCat->currentCategories() ); | 1526 | ent.setCategories( cmbCat->currentCategories() ); |
1513 | 1527 | ||
1514 | if (hasTitle) | 1528 | if (hasTitle) |
1515 | ent.setJobTitle( txtJobTitle->text() ); | 1529 | ent.setJobTitle( txtJobTitle->text() ); |
1516 | 1530 | ||
1517 | if (hasCompany) | 1531 | if (hasCompany) |
1518 | ent.setCompany( txtOrganization->text() ); | 1532 | ent.setCompany( txtOrganization->text() ); |
1519 | 1533 | ||
1520 | if (hasNotes) | 1534 | if (hasNotes) |
1521 | ent.setNotes( txtNote->text() ); | 1535 | ent.setNotes( txtNote->text() ); |
1522 | 1536 | ||
1523 | if (hasStreet) { | 1537 | if (hasStreet) { |
1524 | ent.setHomeStreet( slHomeAddress[0] ); | 1538 | ent.setHomeStreet( slHomeAddress[0] ); |
1525 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1539 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1526 | } | 1540 | } |
1527 | /* | 1541 | /* |
1528 | if (hasStreet2) { | 1542 | if (hasStreet2) { |
1529 | ent.setHomeStreet2( (*slHomeAddress)[1] ); | 1543 | ent.setHomeStreet2( (*slHomeAddress)[1] ); |
1530 | ent.setBusinessStreet2( (*slBusinessAddress)[1] ); | 1544 | ent.setBusinessStreet2( (*slBusinessAddress)[1] ); |
1531 | } | 1545 | } |
1532 | 1546 | ||
1533 | if (hasPOBox) { | 1547 | if (hasPOBox) { |
1534 | ent.setHomePOBox( (*slHomeAddress)[2] ); | 1548 | ent.setHomePOBox( (*slHomeAddress)[2] ); |
1535 | ent.setBusinessPOBox( (*slBusinessAddress)[2] ); | 1549 | ent.setBusinessPOBox( (*slBusinessAddress)[2] ); |
1536 | } | 1550 | } |
1537 | */ | 1551 | */ |
1538 | if (hasCity) { | 1552 | if (hasCity) { |
1539 | ent.setHomeCity( slHomeAddress[3] ); | 1553 | ent.setHomeCity( slHomeAddress[3] ); |
1540 | ent.setBusinessCity( slBusinessAddress[3] ); | 1554 | ent.setBusinessCity( slBusinessAddress[3] ); |
1541 | } | 1555 | } |
1542 | 1556 | ||
1543 | if (hasState) { | 1557 | if (hasState) { |
1544 | ent.setHomeState( slHomeAddress[4] ); | 1558 | ent.setHomeState( slHomeAddress[4] ); |
1545 | ent.setBusinessState( slBusinessAddress[4] ); | 1559 | ent.setBusinessState( slBusinessAddress[4] ); |
1546 | } | 1560 | } |
1547 | 1561 | ||
1548 | if (hasZip) { | 1562 | if (hasZip) { |
1549 | ent.setHomeZip( slHomeAddress[5] ); | 1563 | ent.setHomeZip( slHomeAddress[5] ); |
1550 | ent.setBusinessZip( slBusinessAddress[5] ); | 1564 | ent.setBusinessZip( slBusinessAddress[5] ); |
1551 | } | 1565 | } |
1552 | 1566 | ||
1553 | if (hasCountry) { | 1567 | if (hasCountry) { |
1554 | ent.setHomeCountry( slHomeAddress[6] ); | 1568 | ent.setHomeCountry( slHomeAddress[6] ); |
1555 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1569 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1556 | } | 1570 | } |
1557 | 1571 | ||
1558 | QStringList::ConstIterator it; | 1572 | QStringList::ConstIterator it; |
1559 | QListIterator<QLineEdit> itLE( listValue ); | 1573 | QListIterator<QLineEdit> itLE( listValue ); |
1560 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { | 1574 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { |
1561 | if ( *it == "Department" ) | 1575 | if ( *it == tr( "Department" ) ) |
1562 | ent.setDepartment( (*itLE)->text() ); | 1576 | ent.setDepartment( (*itLE)->text() ); |
1563 | 1577 | ||
1564 | if ( *it == "Company" ) | 1578 | if ( *it == tr( "Company" ) ) |
1565 | ent.setCompany( (*itLE)->text() ); | 1579 | ent.setCompany( (*itLE)->text() ); |
1566 | 1580 | ||
1567 | if ( *it == "Office" ) | 1581 | if ( *it == tr( "Office" ) ) |
1568 | ent.setOffice( (*itLE)->text() ); | 1582 | ent.setOffice( (*itLE)->text() ); |
1569 | 1583 | ||
1570 | if ( *it == "Profession" ) | 1584 | if ( *it == tr( "Profession" ) ) |
1571 | ent.setProfession( (*itLE)->text() ); | 1585 | ent.setProfession( (*itLE)->text() ); |
1572 | 1586 | ||
1573 | if ( *it == "Assistant" ) | 1587 | if ( *it == tr( "Assistant" ) ) |
1574 | ent.setAssistant( (*itLE)->text() ); | 1588 | ent.setAssistant( (*itLE)->text() ); |
1575 | 1589 | ||
1576 | if ( *it == "Manager" ) | 1590 | if ( *it == tr( "Manager" ) ) |
1577 | ent.setManager( (*itLE)->text() ); | 1591 | ent.setManager( (*itLE)->text() ); |
1578 | 1592 | ||
1579 | if ( *it == "Spouse" ) | 1593 | if ( *it == tr( "Spouse" ) ) |
1580 | ent.setSpouse( (*itLE)->text() ); | 1594 | ent.setSpouse( (*itLE)->text() ); |
1581 | 1595 | ||
1582 | if ( *it == "Birthday" ) | 1596 | if ( *it == tr( "Birthday" ) ) |
1583 | ent.setBirthday( (*itLE)->text() ); | 1597 | ent.setBirthday( (*itLE)->text() ); |
1584 | 1598 | ||
1585 | if ( *it == "Anniversary" ) | 1599 | if ( *it == tr( "Anniversary" ) ) |
1586 | ent.setAnniversary( (*itLE)->text() ); | 1600 | ent.setAnniversary( (*itLE)->text() ); |
1587 | 1601 | ||
1588 | if ( *it == "Nickname" ) | 1602 | if ( *it == tr( "Nickname" ) ) |
1589 | ent.setNickname( (*itLE)->text() ); | 1603 | ent.setNickname( (*itLE)->text() ); |
1590 | 1604 | ||
1591 | if ( *it == "Children" ) | 1605 | if ( *it == tr( "Children" ) ) |
1592 | ent.setChildren( (*itLE)->text() ); | 1606 | ent.setChildren( (*itLE)->text() ); |
1593 | 1607 | ||
1594 | } | 1608 | } |
1595 | 1609 | ||
1596 | QStringList::ConstIterator itV; | 1610 | QStringList::ConstIterator itV; |
1597 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1611 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1598 | 1612 | ||
1599 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1613 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1600 | ent.setBusinessPhone( *itV ); | 1614 | ent.setBusinessPhone( *itV ); |
1601 | /* | 1615 | /* |
1602 | if ( *it == tr("Business 2 Phone" ) | 1616 | if ( *it == tr("Business 2 Phone" ) |
1603 | ent.setBusiness2Phone( *itV ); | 1617 | ent.setBusiness2Phone( *itV ); |
1604 | */ | 1618 | */ |
1605 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1619 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1606 | ent.setBusinessFax( *itV ); | 1620 | ent.setBusinessFax( *itV ); |
1607 | 1621 | ||
1608 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1622 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1609 | ent.setBusinessMobile( *itV ); | 1623 | ent.setBusinessMobile( *itV ); |
1610 | /* | 1624 | /* |
1611 | if ( *it == "Company Phone" ) | 1625 | if ( *it == "Company Phone" ) |
1612 | ent.setCompanyPhone( *itV ); | 1626 | ent.setCompanyPhone( *itV ); |
1613 | */ | 1627 | */ |
1614 | //if ( *it == "Default Email" ) | 1628 | //if ( *it == "Default Email" ) |
1615 | //ent.setDefaultEmail( *itV ); | 1629 | //ent.setDefaultEmail( *itV ); |
1616 | 1630 | ||
1617 | if ( *it == "Emails" ){ | 1631 | if ( *it == "Emails" ){ |
1618 | QString allemail; | 1632 | QString allemail; |
1619 | QString defaultmail; | 1633 | QString defaultmail; |
1620 | parseEmailFrom( *itV, defaultmail, allemail ); | 1634 | parseEmailFrom( *itV, defaultmail, allemail ); |
1621 | // ent.clearEmails(); | 1635 | // ent.clearEmails(); |
1622 | ent.setDefaultEmail( defaultmail ); | 1636 | ent.setDefaultEmail( defaultmail ); |
1623 | ent.setEmails( allemail ); | 1637 | ent.setEmails( allemail ); |
1624 | } | 1638 | } |
1625 | 1639 | ||
1626 | if ( *it == "Home Phone" ) | 1640 | if ( *it == "Home Phone" ) |
1627 | ent.setHomePhone( *itV ); | 1641 | ent.setHomePhone( *itV ); |
1628 | /* | 1642 | /* |
1629 | if ( *it == "Home 2 Phone" ) | 1643 | if ( *it == "Home 2 Phone" ) |
1630 | ent.setHome2Phone( *itV ); | 1644 | ent.setHome2Phone( *itV ); |
1631 | */ | 1645 | */ |
1632 | if ( *it == "Home Fax" ) | 1646 | if ( *it == "Home Fax" ) |
1633 | ent.setHomeFax( *itV ); | 1647 | ent.setHomeFax( *itV ); |
1634 | 1648 | ||
1635 | if ( *it == "Home Mobile" ) | 1649 | if ( *it == "Home Mobile" ) |
1636 | ent.setHomeMobile( *itV ); | 1650 | ent.setHomeMobile( *itV ); |
1637 | /* | 1651 | /* |
1638 | if ( *it == "Car Phone" ) | 1652 | if ( *it == "Car Phone" ) |
1639 | ent.setCarPhone( *itV ); | 1653 | ent.setCarPhone( *itV ); |
1640 | 1654 | ||
1641 | if ( *it == "ISDN Phone" ) | 1655 | if ( *it == "ISDN Phone" ) |
1642 | ent.setISDNPhone( *itV ); | 1656 | ent.setISDNPhone( *itV ); |
1643 | 1657 | ||
1644 | if ( *it == "Other Phone" ) | 1658 | if ( *it == "Other Phone" ) |
1645 | ent.setOtherPhone( *itV ); | 1659 | ent.setOtherPhone( *itV ); |
1646 | */ | 1660 | */ |
1647 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1661 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1648 | ent.setBusinessPager( *itV ); | 1662 | ent.setBusinessPager( *itV ); |
1649 | /* | 1663 | /* |
1650 | if ( *it == "Home Pager" ) | 1664 | if ( *it == "Home Pager" ) |
1651 | ent.setHomePager( *itV ); | 1665 | ent.setHomePager( *itV ); |
1652 | 1666 | ||
1653 | if ( *it == "AIM IM" ) | 1667 | if ( *it == "AIM IM" ) |
1654 | ent.setAIMIM( *itV ); | 1668 | ent.setAIMIM( *itV ); |
1655 | 1669 | ||
1656 | if ( *it == "ICQ IM" ) | 1670 | if ( *it == "ICQ IM" ) |
1657 | ent.setICQIM( *itV ); | 1671 | ent.setICQIM( *itV ); |
1658 | 1672 | ||
1659 | if ( *it == "Jabber IM" ) | 1673 | if ( *it == "Jabber IM" ) |
1660 | ent.setJabberIM( *itV ); | 1674 | ent.setJabberIM( *itV ); |
1661 | 1675 | ||
1662 | if ( *it == "MSN IM" ) | 1676 | if ( *it == "MSN IM" ) |
1663 | ent.setMSNIM( *itV ); | 1677 | ent.setMSNIM( *itV ); |
1664 | 1678 | ||
1665 | if ( *it == "Yahoo IM" ) | 1679 | if ( *it == "Yahoo IM" ) |
1666 | ent.setYahooIM( *itV ); | 1680 | ent.setYahooIM( *itV ); |
1667 | */ | 1681 | */ |
1668 | if ( *it == "Home Web Page" ) | 1682 | if ( *it == "Home Web Page" ) |
1669 | ent.setHomeWebpage( *itV ); | 1683 | ent.setHomeWebpage( *itV ); |
1670 | 1684 | ||
1671 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1685 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1672 | ent.setBusinessWebpage( *itV ); | 1686 | ent.setBusinessWebpage( *itV ); |
1673 | 1687 | ||
1674 | 1688 | ||
1675 | } | 1689 | } |
1676 | 1690 | ||
1677 | int gender = cmbGender->currentItem(); | 1691 | int gender = cmbGender->currentItem(); |
1678 | ent.setGender( QString::number( gender ) ); | 1692 | ent.setGender( QString::number( gender ) ); |
1679 | 1693 | ||
1680 | QString str = txtNote->text(); | 1694 | QString str = txtNote->text(); |
1681 | if ( !str.isNull() ) | 1695 | if ( !str.isNull() ) |
1682 | ent.setNotes( str ); | 1696 | ent.setNotes( str ); |
1683 | 1697 | ||
1684 | } | 1698 | } |
1685 | 1699 | ||
1686 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1700 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1687 | QString &strAll ) | 1701 | QString &strAll ) |
1688 | { | 1702 | { |
1689 | int where, | 1703 | int where, |
1690 | start; | 1704 | start; |
1691 | if ( txt.isEmpty() ) | 1705 | if ( txt.isEmpty() ) |
1692 | return; | 1706 | return; |
1693 | // find the first | 1707 | // find the first |
1694 | where = txt.find( ',' ); | 1708 | where = txt.find( ',' ); |
1695 | if ( where < 0 ) { | 1709 | if ( where < 0 ) { |
1696 | strDefaultEmail = txt; | 1710 | strDefaultEmail = txt; |
1697 | strAll = txt; | 1711 | strAll = txt; |
1698 | } else { | 1712 | } else { |
1699 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1713 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1700 | strAll = strDefaultEmail; | 1714 | strAll = strDefaultEmail; |
1701 | while ( where > -1 ) { | 1715 | while ( where > -1 ) { |
1702 | strAll.append(" "); | 1716 | strAll.append(" "); |
1703 | start = where; | 1717 | start = where; |
1704 | where = txt.find( ',', where + 1 ); | 1718 | where = txt.find( ',', where + 1 ); |
1705 | if ( where > - 1 ) | 1719 | if ( where > - 1 ) |
1706 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1720 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1707 | else // grab until the end... | 1721 | else // grab until the end... |
1708 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1722 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1709 | } | 1723 | } |
1710 | } | 1724 | } |
1711 | } | 1725 | } |
1712 | 1726 | ||
1713 | void parseEmailTo( const QString &strDefaultEmail, | 1727 | void parseEmailTo( const QString &strDefaultEmail, |
1714 | const QString &strOtherEmail, QString &strBack ) | 1728 | const QString &strOtherEmail, QString &strBack ) |
1715 | { | 1729 | { |
1716 | // create a comma dilimeted set of emails... | 1730 | // create a comma dilimeted set of emails... |
1717 | // use the power of short circuiting... | 1731 | // use the power of short circuiting... |
1718 | bool foundDefault = false; | 1732 | bool foundDefault = false; |
1719 | QString strTmp; | 1733 | QString strTmp; |
1720 | int start = 0; | 1734 | int start = 0; |
1721 | int where; | 1735 | int where; |
1722 | // start at the beginng. | 1736 | // start at the beginng. |
1723 | strBack = strDefaultEmail; | 1737 | strBack = strDefaultEmail; |
1724 | where = 0; | 1738 | where = 0; |
1725 | while ( where > -1 ) { | 1739 | while ( where > -1 ) { |
1726 | start = where; | 1740 | start = where; |
1727 | where = strOtherEmail.find( ' ', where + 1 ); | 1741 | where = strOtherEmail.find( ' ', where + 1 ); |
1728 | if ( where > 0 ) { | 1742 | if ( where > 0 ) { |
1729 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1743 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1730 | } else | 1744 | } else |
1731 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 1745 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
1732 | if ( foundDefault || strTmp != strDefaultEmail ) { | 1746 | if ( foundDefault || strTmp != strDefaultEmail ) { |
1733 | strBack.append( ", " ); | 1747 | strBack.append( ", " ); |
1734 | strBack.append( strTmp ); | 1748 | strBack.append( strTmp ); |
1735 | } else | 1749 | } else |
1736 | foundDefault = true; | 1750 | foundDefault = true; |
1737 | } | 1751 | } |
1738 | } | 1752 | } |
1739 | 1753 | ||
1740 | 1754 | ||
1741 | static inline bool containsAlphaNum( const QString &str ) | 1755 | static inline bool containsAlphaNum( const QString &str ) |
1742 | { | 1756 | { |
1743 | int i, | 1757 | int i, |
1744 | count = str.length(); | 1758 | count = str.length(); |
1745 | for ( i = 0; i < count; i++ ) | 1759 | for ( i = 0; i < count; i++ ) |
1746 | if ( !str[i].isSpace() ) | 1760 | if ( !str[i].isSpace() ) |
1747 | return TRUE; | 1761 | return TRUE; |
1748 | return FALSE; | 1762 | return FALSE; |
1749 | } | 1763 | } |
1750 | 1764 | ||
1751 | static inline bool constainsWhiteSpace( const QString &str ) | 1765 | static inline bool constainsWhiteSpace( const QString &str ) |
1752 | { | 1766 | { |
1753 | int i, | 1767 | int i, |
1754 | count = str.length(); | 1768 | count = str.length(); |
1755 | for (i = 0; i < count; i++ ) | 1769 | for (i = 0; i < count; i++ ) |
1756 | if ( str[i].isSpace() ) | 1770 | if ( str[i].isSpace() ) |
1757 | return TRUE; | 1771 | return TRUE; |
1758 | return FALSE; | 1772 | return FALSE; |
1759 | } | 1773 | } |
1760 | 1774 | ||