summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp2
-rw-r--r--core/pim/addressbook/contacteditor.cpp28
2 files changed, 15 insertions, 15 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index ea87e51..8888611 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -1,934 +1,934 @@
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 "abview.h" 25#include "abview.h"
26#include "abtable.h" 26#include "abtable.h"
27// #include "addresssettings.h" 27// #include "addresssettings.h"
28#include "addressbook.h" 28#include "addressbook.h"
29 29
30 30
31#include <opie/ofileselector.h> 31#include <opie/ofileselector.h>
32#include <opie/ofiledialog.h> 32#include <opie/ofiledialog.h>
33#include <opie/ocontact.h> 33#include <opie/ocontact.h>
34#include <opie/ocontactaccessbackend_vcard.h> 34#include <opie/ocontactaccessbackend_vcard.h>
35 35
36#include <qpe/resource.h> 36#include <qpe/resource.h>
37#include <qpe/ir.h> 37#include <qpe/ir.h>
38#include <qpe/qpemessagebox.h> 38#include <qpe/qpemessagebox.h>
39#include <qpe/qcopenvelope_qws.h> 39#include <qpe/qcopenvelope_qws.h>
40#include <qpe/qpetoolbar.h> 40#include <qpe/qpetoolbar.h>
41#include <qpe/qpemenubar.h> 41#include <qpe/qpemenubar.h>
42// #include <qtoolbar.h> 42// #include <qtoolbar.h>
43// #include <qmenubar.h> 43// #include <qmenubar.h>
44#include <qpe/qpeapplication.h> 44#include <qpe/qpeapplication.h>
45#include <qpe/config.h> 45#include <qpe/config.h>
46 46
47#include <qaction.h> 47#include <qaction.h>
48#include <qdialog.h> 48#include <qdialog.h>
49#include <qdir.h> 49#include <qdir.h>
50#include <qfile.h> 50#include <qfile.h>
51#include <qimage.h> 51#include <qimage.h>
52#include <qlayout.h> 52#include <qlayout.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 <qstringlist.h> 56#include <qstringlist.h>
57#include <qtoolbutton.h> 57#include <qtoolbutton.h>
58#include <qwhatsthis.h> 58#include <qwhatsthis.h>
59#include <qdatetime.h> 59#include <qdatetime.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 67
68#include "picker.h" 68#include "picker.h"
69#include "configdlg.h" 69#include "configdlg.h"
70 70
71extern QString addressbookPersonalVCardName(); 71extern QString addressbookPersonalVCardName();
72 72
73AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, 73AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
74 WFlags f ) 74 WFlags f )
75 : QMainWindow( parent, name, f ), 75 : QMainWindow( parent, name, f ),
76 catMenu (0l), 76 catMenu (0l),
77 abEditor(0l), 77 abEditor(0l),
78 syncing(FALSE), 78 syncing(FALSE),
79 m_tableViewButton(0l), 79 m_tableViewButton(0l),
80 m_cardViewButton(0l) 80 m_cardViewButton(0l)
81{ 81{
82 isLoading = true; 82 isLoading = true;
83 83
84 m_config.load(); 84 m_config.load();
85 85
86 setCaption( tr("Contacts") ); 86 setCaption( tr("Contacts") );
87 setIcon( Resource::loadPixmap( "AddressBook" ) ); 87 setIcon( Resource::loadPixmap( "AddressBook" ) );
88 88
89 // Settings for Main Menu 89 // Settings for Main Menu
90 setToolBarsMovable( true ); 90 setToolBarsMovable( true );
91 setRightJustification( true ); 91 setRightJustification( true );
92 92
93 // Create Toolbar 93 // Create Toolbar
94 listTools = new QPEToolBar( this, "list operations" ); 94 listTools = new QPEToolBar( this, "list operations" );
95 listTools->setHorizontalStretchable( true ); 95 listTools->setHorizontalStretchable( true );
96 addToolBar( listTools ); 96 addToolBar( listTools );
97 moveToolBar( listTools, m_config.getToolBarPos() ); 97 moveToolBar( listTools, m_config.getToolBarPos() );
98 98
99 QPEMenuBar *mbList = new QPEMenuBar( this ); 99 QPEMenuBar *mbList = new QPEMenuBar( this );
100 mbList->setMargin( 0 ); 100 mbList->setMargin( 0 );
101 101
102 QPopupMenu *edit = new QPopupMenu( mbList ); 102 QPopupMenu *edit = new QPopupMenu( mbList );
103 mbList->insertItem( tr( "Contact" ), edit ); 103 mbList->insertItem( tr( "Contact" ), edit );
104 104
105 105
106 // View Icons 106 // View Icons
107 m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/weeklst" ), 107 m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/weeklst" ),
108 QString::null, 0, this, 0 ); 108 QString::null, 0, this, 0 );
109 connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); 109 connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) );
110 m_tableViewButton->setToggleAction( true ); 110 m_tableViewButton->setToggleAction( true );
111 m_tableViewButton->addTo( listTools ); 111 m_tableViewButton->addTo( listTools );
112 m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 ); 112 m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 );
113 connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); 113 connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) );
114 m_cardViewButton->setToggleAction( true ); 114 m_cardViewButton->setToggleAction( true );
115 m_cardViewButton->addTo( listTools ); 115 m_cardViewButton->addTo( listTools );
116 116
117 listTools->addSeparator(); 117 listTools->addSeparator();
118 118
119 // Other Buttons 119 // Other Buttons
120 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 120 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null,
121 0, this, 0 ); 121 0, this, 0 );
122 actionNew = a; 122 actionNew = a;
123 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); 123 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) );
124 a->addTo( edit ); 124 a->addTo( edit );
125 a->addTo( listTools ); 125 a->addTo( listTools );
126 126
127 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 127 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null,
128 0, this, 0 ); 128 0, this, 0 );
129 actionEdit = a; 129 actionEdit = a;
130 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); 130 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) );
131 a->addTo( edit ); 131 a->addTo( edit );
132 a->addTo( listTools ); 132 a->addTo( listTools );
133 133
134 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 134 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null,
135 0, this, 0 ); 135 0, this, 0 );
136 actionTrash = a; 136 actionTrash = a;
137 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); 137 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) );
138 a->addTo( edit ); 138 a->addTo( edit );
139 a->addTo( listTools ); 139 a->addTo( listTools );
140 140
141 141
142 // make it possible to go directly to businesscard via qcop call 142 // make it possible to go directly to businesscard via qcop call
143 //#if defined(Q_WS_QWS) // Why this ? (se) 143 //#if defined(Q_WS_QWS) // Why this ? (se)
144#if !defined(QT_NO_COP) 144#if !defined(QT_NO_COP)
145 QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); 145 QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this );
146 connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), 146 connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)),
147 this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); 147 this, SLOT ( appMessage(const QCString &, const QByteArray &) ) );
148#endif 148#endif
149 // #endif 149 // #endif
150 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), 150 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ),
151 QString::null, 0, this, 0 ); 151 QString::null, 0, this, 0 );
152 actionFind = a; 152 actionFind = a;
153 connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); 153 connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) );
154 a->addTo( edit ); 154 a->addTo( edit );
155 a->addTo( listTools ); 155 a->addTo( listTools );
156 156
157 // Much better search widget, taken from QTReader.. (se) 157 // Much better search widget, taken from QTReader.. (se)
158 searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); 158 searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE );
159 searchBar->setHorizontalStretchable( TRUE ); 159 searchBar->setHorizontalStretchable( TRUE );
160 searchBar->hide(); 160 searchBar->hide();
161 searchEdit = new QLineEdit( searchBar, "searchEdit" ); 161 searchEdit = new QLineEdit( searchBar, "searchEdit" );
162 162
163 // QFont f("unifont", 16 /*, QFont::Bold*/); 163 // QFont f("unifont", 16 /*, QFont::Bold*/);
164 // searchEdit->setFont( f ); 164 // searchEdit->setFont( f );
165 165
166 searchBar->setStretchableWidget( searchEdit ); 166 searchBar->setStretchableWidget( searchEdit );
167 connect( searchEdit, SIGNAL( returnPressed( ) ), 167 connect( searchEdit, SIGNAL( returnPressed( ) ),
168 this, SLOT( slotFind( ) ) ); 168 this, SLOT( slotFind( ) ) );
169 169
170 a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); 170 a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
171 connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); 171 connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) );
172 a->addTo( searchBar ); 172 a->addTo( searchBar );
173 173
174 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 174 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
175 connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); 175 connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) );
176 a->addTo( searchBar ); 176 a->addTo( searchBar );
177 177
178 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), 178 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ),
179 QString::null, 0, this, 0 ); 179 QString::null, 0, this, 0 );
180 //a->setEnabled( FALSE ); we got support for it now :) zecke 180 //a->setEnabled( FALSE ); we got support for it now :) zecke
181 actionMail = a; 181 actionMail = a;
182 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); 182 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) );
183 a->addTo( edit ); 183 a->addTo( edit );
184 a->addTo( listTools ); 184 a->addTo( listTools );
185 185
186 if ( Ir::supported() ) { 186 if ( Ir::supported() ) {
187 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, 187 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null,
188 0, this, 0 ); 188 0, this, 0 );
189 actionBeam = a; 189 actionBeam = a;
190 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); 190 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) );
191 a->addTo( edit ); 191 a->addTo( edit );
192 a->addTo( listTools ); 192 a->addTo( listTools );
193 } 193 }
194 194
195 edit->insertSeparator(); 195 edit->insertSeparator();
196 196
197 a = new QAction( tr("Import vCard"), QString::null, 0, 0); 197 a = new QAction( tr("Import vCard"), QString::null, 0, 0);
198 actionPersonal = a; 198 actionPersonal = a;
199 connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); 199 connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) );
200 a->addTo( edit ); 200 a->addTo( edit );
201 201
202 edit->insertSeparator(); 202 edit->insertSeparator();
203 203
204 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); 204 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE );
205 actionPersonal = a; 205 actionPersonal = a;
206 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); 206 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) );
207 a->addTo( edit ); 207 a->addTo( edit );
208 208
209 209
210#ifdef __DEBUG_RELEASE 210#ifdef __DEBUG_RELEASE
211 // Remove this function for public Release ! This is only 211 // Remove this function for public Release ! This is only
212 // for debug purposes .. 212 // for debug purposes ..
213 a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); 213 a = new QAction( tr( "Save all Data"), QString::null, 0, 0 );
214 connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); 214 connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) );
215 a->addTo( edit ); 215 a->addTo( edit );
216#endif 216#endif
217 a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 217 a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null,
218 0, this, 0 ); 218 0, this, 0 );
219 connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); 219 connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) );
220 a->addTo( edit ); 220 a->addTo( edit );
221 221
222 // Create Views 222 // Create Views
223 listContainer = new QWidget( this ); 223 listContainer = new QWidget( this );
224 QVBoxLayout *vb = new QVBoxLayout( listContainer ); 224 QVBoxLayout *vb = new QVBoxLayout( listContainer );
225 225
226 m_abView = new AbView( listContainer, m_config.orderList() ); 226 m_abView = new AbView( listContainer, m_config.orderList() );
227 vb->addWidget( m_abView ); 227 vb->addWidget( m_abView );
228 // abList->setHScrollBarMode( QScrollView::AlwaysOff ); 228 // abList->setHScrollBarMode( QScrollView::AlwaysOff );
229 connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), 229 connect( m_abView, SIGNAL( signalViewSwitched ( int ) ),
230 this, SLOT( slotViewSwitched( int ) ) ); 230 this, SLOT( slotViewSwitched( int ) ) );
231 231
232 232
233 QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); 233 QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) );
234 234
235 m_abView->load(); 235 m_abView->load();
236 236
237 // Letter Picker 237 // Letter Picker
238 pLabel = new LetterPicker( listContainer ); 238 pLabel = new LetterPicker( listContainer );
239 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); 239 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char)));
240 connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); 240 connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) );
241 241
242 vb->addWidget( pLabel ); 242 vb->addWidget( pLabel );
243 243
244 // Category Menu 244 // Category Menu
245 catMenu = new QPopupMenu( this ); 245 catMenu = new QPopupMenu( this );
246 catMenu->setCheckable( TRUE ); 246 catMenu->setCheckable( TRUE );
247 connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); 247 connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) );
248 populateCategories(); 248 populateCategories();
249 mbList->insertItem( tr("View"), catMenu ); 249 mbList->insertItem( tr("View"), catMenu );
250 250
251 defaultFont = new QFont( m_abView->font() ); 251 defaultFont = new QFont( m_abView->font() );
252 slotSetFont(m_config.fontSize()); 252 slotSetFont(m_config.fontSize());
253 m_curFontSize = m_config.fontSize(); 253 m_curFontSize = m_config.fontSize();
254 254
255 setCentralWidget(listContainer); 255 setCentralWidget(listContainer);
256 256
257 // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); 257 // qDebug("adressbook contrsuction: t=%d", t.elapsed() );
258 258
259 259
260 isLoading = false; 260 isLoading = false;
261} 261}
262 262
263 263
264void AddressbookWindow::slotConfig() 264void AddressbookWindow::slotConfig()
265{ 265{
266 ConfigDlg* dlg = new ConfigDlg( this, "Config" ); 266 ConfigDlg* dlg = new ConfigDlg( this, "Config" );
267 dlg -> setConfig( m_config ); 267 dlg -> setConfig( m_config );
268 dlg -> showMaximized(); 268 dlg -> showMaximized();
269 if ( dlg -> exec() ) { 269 if ( dlg -> exec() ) {
270 qWarning ("Config Dialog accepted!"); 270 qWarning ("Config Dialog accepted!");
271 m_config = dlg -> getConfig(); 271 m_config = dlg -> getConfig();
272 if ( m_curFontSize != m_config.fontSize() ){ 272 if ( m_curFontSize != m_config.fontSize() ){
273 qWarning("Font was changed!"); 273 qWarning("Font was changed!");
274 m_curFontSize = m_config.fontSize(); 274 m_curFontSize = m_config.fontSize();
275 emit slotSetFont( m_curFontSize ); 275 emit slotSetFont( m_curFontSize );
276 } 276 }
277 m_abView -> setListOrder( m_config.orderList() ); 277 m_abView -> setListOrder( m_config.orderList() );
278 } 278 }
279 279
280 delete dlg; 280 delete dlg;
281} 281}
282 282
283 283
284void AddressbookWindow::slotSetFont( int size ) 284void AddressbookWindow::slotSetFont( int size )
285{ 285{
286 qWarning("void AddressbookWindow::slotSetFont( %d )", size); 286 qWarning("void AddressbookWindow::slotSetFont( %d )", size);
287 287
288 if (size > 2 || size < 0) 288 if (size > 2 || size < 0)
289 size = 1; 289 size = 1;
290 290
291 m_config.setFontSize( size ); 291 m_config.setFontSize( size );
292 292
293 QFont *currentFont; 293 QFont *currentFont;
294 294
295 switch (size) { 295 switch (size) {
296 case 0: 296 case 0:
297 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); 297 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) );
298 currentFont = new QFont (m_abView->font()); 298 currentFont = new QFont (m_abView->font());
299 // abList->resizeRows(currentFont->pixelSize() + 7); :SX 299 // abList->resizeRows(currentFont->pixelSize() + 7); :SX
300 // abList->resizeRows(); 300 // abList->resizeRows();
301 break; 301 break;
302 case 1: 302 case 1:
303 m_abView->setFont( *defaultFont ); 303 m_abView->setFont( *defaultFont );
304 currentFont = new QFont (m_abView->font()); 304 currentFont = new QFont (m_abView->font());
305 // // abList->resizeRows(currentFont->pixelSize() + 7); 305 // // abList->resizeRows(currentFont->pixelSize() + 7);
306 // abList->resizeRows(); 306 // abList->resizeRows();
307 break; 307 break;
308 case 2: 308 case 2:
309 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); 309 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) );
310 currentFont = new QFont (m_abView->font()); 310 currentFont = new QFont (m_abView->font());
311 // //abList->resizeRows(currentFont->pixelSize() + 7); 311 // //abList->resizeRows(currentFont->pixelSize() + 7);
312 // abList->resizeRows(); 312 // abList->resizeRows();
313 break; 313 break;
314 } 314 }
315} 315}
316 316
317 317
318 318
319void AddressbookWindow::importvCard() { 319void AddressbookWindow::importvCard() {
320 QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); 320 QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this );
321 if(!str.isEmpty() ){ 321 if(!str.isEmpty() ){
322 setDocument((const QString&) str ); 322 setDocument((const QString&) str );
323 } 323 }
324 324
325} 325}
326 326
327void AddressbookWindow::setDocument( const QString &filename ) 327void AddressbookWindow::setDocument( const QString &filename )
328{ 328{
329 qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); 329 qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() );
330 330
331 if ( filename.find(".vcf") != int(filename.length()) - 4 ){ 331 if ( filename.find(".vcf") != int(filename.length()) - 4 ){
332 332
333 333
334 334
335 switch( QMessageBox::information( this, tr ( "Right file type ?" ), 335 switch( QMessageBox::information( this, tr ( "Right file type ?" ),
336 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), 336 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ),
337 tr( "&Yes" ), tr( "&No" ), QString::null, 337 tr( "&Yes" ), tr( "&No" ), QString::null,
338 0, // Enter == button 0 338 0, // Enter == button 0
339 2 ) ) { // Escape == button 2 339 2 ) ) { // Escape == button 2
340 case 0: 340 case 0:
341 qWarning("YES clicked"); 341 qWarning("YES clicked");
342 break; 342 break;
343 case 1: 343 case 1:
344 qWarning("NO clicked"); 344 qWarning("NO clicked");
345 return; 345 return;
346 break; 346 break;
347 } 347 }
348 } 348 }
349 349
350 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 350 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
351 filename ); 351 filename );
352 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 352 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
353 OContactAccess::List allList = access->allRecords(); 353 OContactAccess::List allList = access->allRecords();
354 qWarning( "Found number of contacts in File: %d", allList.count() ); 354 qWarning( "Found number of contacts in File: %d", allList.count() );
355 355
356 if ( !allList.count() ) { 356 if ( !allList.count() ) {
357 QMessageBox::information( this, "Import VCard", 357 QMessageBox::information( this, "Import VCard",
358 "It was impossible to import the VCard.\n" 358 "It was impossible to import the VCard.\n"
359 "The VCard may be corrupted!" ); 359 "The VCard may be corrupted!" );
360 } 360 }
361 361
362 bool doAsk = true; 362 bool doAsk = true;
363 OContactAccess::List::Iterator it; 363 OContactAccess::List::Iterator it;
364 for ( it = allList.begin(); it != allList.end(); ++it ){ 364 for ( it = allList.begin(); it != allList.end(); ++it ){
365 qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); 365 qWarning("Adding Contact from: %s", (*it).fullName().latin1() );
366 if ( doAsk ){ 366 if ( doAsk ){
367 switch( QMessageBox::information( this, tr ( "Add Contact?" ), 367 switch( QMessageBox::information( this, tr ( "Add Contact?" ),
368 tr( "Do you really want add contact for \n%1?" ) 368 tr( "Do you really want add contact for \n%1?" )
369 .arg( (*it).fullName().latin1() ), 369 .arg( (*it).fullName().latin1() ),
370 tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), 370 tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"),
371 0, // Enter == button 0 371 0, // Enter == button 0
372 2 ) ) { // Escape == button 2 372 2 ) ) { // Escape == button 2
373 case 0: 373 case 0:
374 qWarning("YES clicked"); 374 qWarning("YES clicked");
375 m_abView->addEntry( *it ); 375 m_abView->addEntry( *it );
376 break; 376 break;
377 case 1: 377 case 1:
378 qWarning("NO clicked"); 378 qWarning("NO clicked");
379 break; 379 break;
380 case 2: 380 case 2:
381 qWarning("YesAll clicked"); 381 qWarning("YesAll clicked");
382 doAsk = false; 382 doAsk = false;
383 break; 383 break;
384 } 384 }
385 }else 385 }else
386 m_abView->addEntry( *it ); 386 m_abView->addEntry( *it );
387 387
388 } 388 }
389 389
390 delete access; 390 delete access;
391} 391}
392 392
393void AddressbookWindow::resizeEvent( QResizeEvent *e ) 393void AddressbookWindow::resizeEvent( QResizeEvent *e )
394{ 394{
395 QMainWindow::resizeEvent( e ); 395 QMainWindow::resizeEvent( e );
396 396
397 397
398} 398}
399 399
400AddressbookWindow::~AddressbookWindow() 400AddressbookWindow::~AddressbookWindow()
401{ 401{
402 ToolBarDock dock; 402 ToolBarDock dock;
403 int dummy; 403 int dummy;
404 bool bDummy; 404 bool bDummy;
405 getLocation ( listTools, dock, dummy, bDummy, dummy ); 405 getLocation ( listTools, dock, dummy, bDummy, dummy );
406 m_config.setToolBarDock( dock ); 406 m_config.setToolBarDock( dock );
407 m_config.save(); 407 m_config.save();
408} 408}
409 409
410void AddressbookWindow::slotUpdateToolbar() 410void AddressbookWindow::slotUpdateToolbar()
411{ 411{
412 OContact ce = m_abView->currentEntry(); 412 OContact ce = m_abView->currentEntry();
413 actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); 413 actionMail->setEnabled( !ce.defaultEmail().isEmpty() );
414} 414}
415 415
416void AddressbookWindow::slotListNew() 416void AddressbookWindow::slotListNew()
417{ 417{
418 OContact cnt; 418 OContact cnt;
419 if( !syncing ) { 419 if( !syncing ) {
420 editEntry( NewEntry ); 420 editEntry( NewEntry );
421 } else { 421 } else {
422 QMessageBox::warning(this, tr("OContacts"), 422 QMessageBox::warning(this, tr("Contacts"),
423 tr("Can not edit data, currently syncing")); 423 tr("Can not edit data, currently syncing"));
424 } 424 }
425} 425}
426 426
427// void AddressbookWindow::slotListView() 427// void AddressbookWindow::slotListView()
428// { 428// {
429 // m_abView -> init( abList->currentEntry() ); 429 // m_abView -> init( abList->currentEntry() );
430 // // :SX mView->sync(); 430 // // :SX mView->sync();
431 // //:SXshowView(); 431 // //:SXshowView();
432// } 432// }
433 433
434void AddressbookWindow::slotListDelete() 434void AddressbookWindow::slotListDelete()
435{ 435{
436 if(!syncing) { 436 if(!syncing) {
437 OContact tmpEntry = m_abView ->currentEntry(); 437 OContact tmpEntry = m_abView ->currentEntry();
438 438
439 // get a name, do the best we can... 439 // get a name, do the best we can...
440 QString strName = tmpEntry.fullName(); 440 QString strName = tmpEntry.fullName();
441 if ( strName.isEmpty() ) { 441 if ( strName.isEmpty() ) {
442 strName = tmpEntry.company(); 442 strName = tmpEntry.company();
443 if ( strName.isEmpty() ) 443 if ( strName.isEmpty() )
444 strName = "No Name"; 444 strName = "No Name";
445 } 445 }
446 446
447 447
448 if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), 448 if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ),
449 strName ) ) { 449 strName ) ) {
450 m_abView->removeEntry( tmpEntry.uid() ); 450 m_abView->removeEntry( tmpEntry.uid() );
451 } 451 }
452 } else { 452 } else {
453 QMessageBox::warning( this, tr("Contacts"), 453 QMessageBox::warning( this, tr("Contacts"),
454 tr("Can not edit data, currently syncing") ); 454 tr("Can not edit data, currently syncing") );
455 } 455 }
456} 456}
457 457
458void AddressbookWindow::slotFindOpen() 458void AddressbookWindow::slotFindOpen()
459{ 459{
460 searchBar->show(); 460 searchBar->show();
461 m_abView -> inSearch(); 461 m_abView -> inSearch();
462 searchEdit->setFocus(); 462 searchEdit->setFocus();
463} 463}
464void AddressbookWindow::slotFindClose() 464void AddressbookWindow::slotFindClose()
465{ 465{
466 searchBar->hide(); 466 searchBar->hide();
467 m_abView -> offSearch(); 467 m_abView -> offSearch();
468 // m_abView->setFocus(); 468 // m_abView->setFocus();
469} 469}
470 470
471 471
472void AddressbookWindow::slotFind() 472void AddressbookWindow::slotFind()
473{ 473{
474 m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); 474 m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false);
475 475
476 searchEdit->clearFocus(); 476 searchEdit->clearFocus();
477 // m_abView->setFocus(); 477 // m_abView->setFocus();
478 478
479} 479}
480 480
481void AddressbookWindow::slotViewBack() 481void AddressbookWindow::slotViewBack()
482{ 482{
483 // :SX showList(); 483 // :SX showList();
484} 484}
485 485
486void AddressbookWindow::slotViewEdit() 486void AddressbookWindow::slotViewEdit()
487{ 487{
488 if(!syncing) { 488 if(!syncing) {
489 if (actionPersonal->isOn()) { 489 if (actionPersonal->isOn()) {
490 editPersonal(); 490 editPersonal();
491 } else { 491 } else {
492 editEntry( EditEntry ); 492 editEntry( EditEntry );
493 } 493 }
494 } else { 494 } else {
495 QMessageBox::warning( this, tr("Contacts"), 495 QMessageBox::warning( this, tr("Contacts"),
496 tr("Can not edit data, currently syncing") ); 496 tr("Can not edit data, currently syncing") );
497 } 497 }
498} 498}
499 499
500 500
501 501
502void AddressbookWindow::writeMail() 502void AddressbookWindow::writeMail()
503{ 503{
504 OContact c = m_abView -> currentEntry(); 504 OContact c = m_abView -> currentEntry();
505 QString name = c.fileAs(); 505 QString name = c.fileAs();
506 QString email = c.defaultEmail(); 506 QString email = c.defaultEmail();
507 507
508 // I prefer the OPIE-Environment variable before the 508 // I prefer the OPIE-Environment variable before the
509 // QPE-one.. 509 // QPE-one..
510 QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); 510 QString basepath = QString::fromLatin1( getenv("OPIEDIR") );
511 if ( basepath.isEmpty() ) 511 if ( basepath.isEmpty() )
512 basepath = QString::fromLatin1( getenv("QPEDIR") ); 512 basepath = QString::fromLatin1( getenv("QPEDIR") );
513 513
514 // Try to access the preferred. If not possible, try to 514 // Try to access the preferred. If not possible, try to
515 // switch to the other one.. 515 // switch to the other one..
516 if ( m_config.useQtMail() ){ 516 if ( m_config.useQtMail() ){
517 qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); 517 qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1());
518 if ( QFile::exists( basepath + "/bin/qtmail" ) ){ 518 if ( QFile::exists( basepath + "/bin/qtmail" ) ){
519 qWarning ("QCop"); 519 qWarning ("QCop");
520 QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); 520 QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)");
521 e << name << email; 521 e << name << email;
522 return; 522 return;
523 } else 523 } else
524 m_config.setUseOpieMail( true ); 524 m_config.setUseOpieMail( true );
525 } 525 }
526 if ( m_config.useOpieMail() ){ 526 if ( m_config.useOpieMail() ){
527 qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); 527 qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1());
528 if ( QFile::exists( basepath + "/bin/mail" ) ){ 528 if ( QFile::exists( basepath + "/bin/mail" ) ){
529 qWarning ("QCop"); 529 qWarning ("QCop");
530 QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); 530 QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)");
531 e << name << email; 531 e << name << email;
532 return; 532 return;
533 } else 533 } else
534 m_config.setUseQtMail( true ); 534 m_config.setUseQtMail( true );
535 } 535 }
536 536
537} 537}
538 538
539static const char * beamfile = "/tmp/obex/contact.vcf"; 539static const char * beamfile = "/tmp/obex/contact.vcf";
540 540
541void AddressbookWindow::slotBeam() 541void AddressbookWindow::slotBeam()
542{ 542{
543 QString filename; 543 QString filename;
544 OContact c; 544 OContact c;
545 if ( actionPersonal->isOn() ) { 545 if ( actionPersonal->isOn() ) {
546 filename = addressbookPersonalVCardName(); 546 filename = addressbookPersonalVCardName();
547 if (!QFile::exists(filename)) 547 if (!QFile::exists(filename))
548 return; // can't beam a non-existent file 548 return; // can't beam a non-existent file
549 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 549 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
550 filename ); 550 filename );
551 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 551 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
552 OContactAccess::List allList = access->allRecords(); 552 OContactAccess::List allList = access->allRecords();
553 OContactAccess::List::Iterator it = allList.begin(); // Just take first 553 OContactAccess::List::Iterator it = allList.begin(); // Just take first
554 c = *it; 554 c = *it;
555 555
556 delete access; 556 delete access;
557 } else { 557 } else {
558 unlink( beamfile ); // delete if exists 558 unlink( beamfile ); // delete if exists
559 mkdir("/tmp/obex/", 0755); 559 mkdir("/tmp/obex/", 0755);
560 c = m_abView -> currentEntry(); 560 c = m_abView -> currentEntry();
561 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 561 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
562 beamfile ); 562 beamfile );
563 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 563 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
564 access->add( c ); 564 access->add( c );
565 access->save(); 565 access->save();
566 delete access; 566 delete access;
567 567
568 filename = beamfile; 568 filename = beamfile;
569 } 569 }
570 570
571 571
572 Ir *ir = new Ir( this ); 572 Ir *ir = new Ir( this );
573 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 573 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
574 QString description = c.fullName(); 574 QString description = c.fullName();
575 ir->send( filename, description, "text/x-vCard" ); 575 ir->send( filename, description, "text/x-vCard" );
576} 576}
577 577
578void AddressbookWindow::beamDone( Ir *ir ) 578void AddressbookWindow::beamDone( Ir *ir )
579{ 579{
580 delete ir; 580 delete ir;
581 unlink( beamfile ); 581 unlink( beamfile );
582} 582}
583 583
584 584
585static void parseName( const QString& name, QString *first, QString *middle, 585static void parseName( const QString& name, QString *first, QString *middle,
586 QString * last ) 586 QString * last )
587{ 587{
588 588
589 int comma = name.find ( "," ); 589 int comma = name.find ( "," );
590 QString rest; 590 QString rest;
591 if ( comma > 0 ) { 591 if ( comma > 0 ) {
592 *last = name.left( comma ); 592 *last = name.left( comma );
593 comma++; 593 comma++;
594 while ( comma < int(name.length()) && name[comma] == ' ' ) 594 while ( comma < int(name.length()) && name[comma] == ' ' )
595 comma++; 595 comma++;
596 rest = name.mid( comma ); 596 rest = name.mid( comma );
597 } else { 597 } else {
598 int space = name.findRev( ' ' ); 598 int space = name.findRev( ' ' );
599 *last = name.mid( space+1 ); 599 *last = name.mid( space+1 );
600 rest = name.left( space ); 600 rest = name.left( space );
601 } 601 }
602 int space = rest.find( ' ' ); 602 int space = rest.find( ' ' );
603 if ( space <= 0 ) { 603 if ( space <= 0 ) {
604 *first = rest; 604 *first = rest;
605 } else { 605 } else {
606 *first = rest.left( space ); 606 *first = rest.left( space );
607 *middle = rest.mid( space+1 ); 607 *middle = rest.mid( space+1 );
608 } 608 }
609 609
610} 610}
611 611
612 612
613void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) 613void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
614{ 614{
615 if (msg == "editPersonal()") { 615 if (msg == "editPersonal()") {
616 editPersonal(); 616 editPersonal();
617 } else if (msg == "editPersonalAndClose()") { 617 } else if (msg == "editPersonalAndClose()") {
618 editPersonal(); 618 editPersonal();
619 close(); 619 close();
620 } else if ( msg == "addContact(QString,QString)" ) { 620 } else if ( msg == "addContact(QString,QString)" ) {
621 QDataStream stream(data,IO_ReadOnly); 621 QDataStream stream(data,IO_ReadOnly);
622 QString name, email; 622 QString name, email;
623 stream >> name >> email; 623 stream >> name >> email;
624 624
625 OContact cnt; 625 OContact cnt;
626 QString fn, mn, ln; 626 QString fn, mn, ln;
627 parseName( name, &fn, &mn, &ln ); 627 parseName( name, &fn, &mn, &ln );
628 // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); 628 // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() );
629 cnt.setFirstName( fn ); 629 cnt.setFirstName( fn );
630 cnt.setMiddleName( mn ); 630 cnt.setMiddleName( mn );
631 cnt.setLastName( ln ); 631 cnt.setLastName( ln );
632 cnt.insertEmails( email ); 632 cnt.insertEmails( email );
633 cnt.setDefaultEmail( email ); 633 cnt.setDefaultEmail( email );
634 cnt.setFileAs(); 634 cnt.setFileAs();
635 635
636 m_abView -> addEntry( cnt ); 636 m_abView -> addEntry( cnt );
637 637
638 // :SXm_abView()->init( cnt ); 638 // :SXm_abView()->init( cnt );
639 editEntry( EditEntry ); 639 editEntry( EditEntry );
640 640
641 641
642 642
643 } 643 }
644#if 0 644#if 0
645 else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { 645 else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) {
646 QDataStream stream(data,IO_ReadOnly); 646 QDataStream stream(data,IO_ReadOnly);
647 QCString ch,m; 647 QCString ch,m;
648 QStringList types; 648 QStringList types;
649 stream >> ch >> m >> types; 649 stream >> ch >> m >> types;
650 AddressPicker picker(abList,this,0,TRUE); 650 AddressPicker picker(abList,this,0,TRUE);
651 picker.showMaximized(); 651 picker.showMaximized();
652 picker.setChoiceNames(types); 652 picker.setChoiceNames(types);
653 int i=0; 653 int i=0;
654 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { 654 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
655 QStringList sel; 655 QStringList sel;
656 stream >> sel; 656 stream >> sel;
657 picker.setSelection(i++,sel); 657 picker.setSelection(i++,sel);
658 } 658 }
659 picker.showMaximized(); 659 picker.showMaximized();
660 picker.exec(); 660 picker.exec();
661 661
662 // ###### note: contacts may have been added - save here! 662 // ###### note: contacts may have been added - save here!
663 663
664 setCentralWidget(abList); 664 setCentralWidget(abList);
665 QCopEnvelope e(ch,m); 665 QCopEnvelope e(ch,m);
666 i=0; 666 i=0;
667 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { 667 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
668 QStringList sel = picker.selection(i++); 668 QStringList sel = picker.selection(i++);
669 e << sel; 669 e << sel;
670 } 670 }
671 } 671 }
672#endif 672#endif
673 673
674} 674}
675 675
676void AddressbookWindow::editEntry( EntryMode entryMode ) 676void AddressbookWindow::editEntry( EntryMode entryMode )
677{ 677{
678 OContact entry; 678 OContact entry;
679 if ( !abEditor ) { 679 if ( !abEditor ) {
680 abEditor = new ContactEditor( entry, this, "editor" ); 680 abEditor = new ContactEditor( entry, this, "editor" );
681 } 681 }
682 if ( entryMode == EditEntry ) 682 if ( entryMode == EditEntry )
683 abEditor->setEntry( m_abView -> currentEntry() ); 683 abEditor->setEntry( m_abView -> currentEntry() );
684 else if ( entryMode == NewEntry ) 684 else if ( entryMode == NewEntry )
685 abEditor->setEntry( entry ); 685 abEditor->setEntry( entry );
686 // other things may change the caption. 686 // other things may change the caption.
687 abEditor->setCaption( tr("Edit Address") ); 687 abEditor->setCaption( tr("Edit Address") );
688 688
689#if defined(Q_WS_QWS) || defined(_WS_QWS_) 689#if defined(Q_WS_QWS) || defined(_WS_QWS_)
690 abEditor->showMaximized(); 690 abEditor->showMaximized();
691#endif 691#endif
692 // fix the foxus... 692 // fix the foxus...
693 abEditor->setNameFocus(); 693 abEditor->setNameFocus();
694 if ( abEditor->exec() ) { 694 if ( abEditor->exec() ) {
695 setFocus(); 695 setFocus();
696 if ( entryMode == NewEntry ) { 696 if ( entryMode == NewEntry ) {
697 OContact insertEntry = abEditor->entry(); 697 OContact insertEntry = abEditor->entry();
698 insertEntry.assignUid(); 698 insertEntry.assignUid();
699 m_abView -> addEntry( insertEntry ); 699 m_abView -> addEntry( insertEntry );
700 } else { 700 } else {
701 OContact replEntry = abEditor->entry(); 701 OContact replEntry = abEditor->entry();
702 702
703 if ( !replEntry.isValidUid() ) 703 if ( !replEntry.isValidUid() )
704 replEntry.assignUid(); 704 replEntry.assignUid();
705 705
706 m_abView -> replaceEntry( replEntry ); 706 m_abView -> replaceEntry( replEntry );
707 } 707 }
708 } 708 }
709 // populateCategories(); 709 // populateCategories();
710 710
711} 711}
712 712
713void AddressbookWindow::editPersonal() 713void AddressbookWindow::editPersonal()
714{ 714{
715 OContact entry; 715 OContact entry;
716 716
717 // Switch to personal view if not selected 717 // Switch to personal view if not selected
718 // but take care of the menu, too 718 // but take care of the menu, too
719 if ( ! actionPersonal->isOn() ){ 719 if ( ! actionPersonal->isOn() ){
720 qWarning("*** ++++"); 720 qWarning("*** ++++");
721 actionPersonal->setOn( true ); 721 actionPersonal->setOn( true );
722 slotPersonalView(); 722 slotPersonalView();
723 } 723 }
724 724
725 if ( !abEditor ) { 725 if ( !abEditor ) {
726 abEditor = new ContactEditor( entry, this, "editor" ); 726 abEditor = new ContactEditor( entry, this, "editor" );
727 } 727 }
728 728
729 abEditor->setCaption(tr("Edit My Personal Details")); 729 abEditor->setCaption(tr("Edit My Personal Details"));
730 abEditor->setPersonalView( true ); 730 abEditor->setPersonalView( true );
731 editEntry( EditEntry ); 731 editEntry( EditEntry );
732 abEditor->setPersonalView( false ); 732 abEditor->setPersonalView( false );
733 733
734} 734}
735 735
736 736
737void AddressbookWindow::slotPersonalView() 737void AddressbookWindow::slotPersonalView()
738{ 738{
739 qWarning("slotPersonalView()"); 739 qWarning("slotPersonalView()");
740 if (!actionPersonal->isOn()) { 740 if (!actionPersonal->isOn()) {
741 // we just turned it off 741 // we just turned it off
742 qWarning("slotPersonalView()-> OFF"); 742 qWarning("slotPersonalView()-> OFF");
743 setCaption( tr("Contacts") ); 743 setCaption( tr("Contacts") );
744 actionNew->setEnabled(TRUE); 744 actionNew->setEnabled(TRUE);
745 actionTrash->setEnabled(TRUE); 745 actionTrash->setEnabled(TRUE);
746 actionFind->setEnabled(TRUE); 746 actionFind->setEnabled(TRUE);
747 actionMail->setEnabled(TRUE); 747 actionMail->setEnabled(TRUE);
748 // slotUpdateToolbar(); 748 // slotUpdateToolbar();
749 749
750 m_abView->showPersonal( false ); 750 m_abView->showPersonal( false );
751 751
752 return; 752 return;
753 } 753 }
754 754
755 qWarning("slotPersonalView()-> ON"); 755 qWarning("slotPersonalView()-> ON");
756 // XXX need to disable some QActions. 756 // XXX need to disable some QActions.
757 actionNew->setEnabled(FALSE); 757 actionNew->setEnabled(FALSE);
758 actionTrash->setEnabled(FALSE); 758 actionTrash->setEnabled(FALSE);
759 actionFind->setEnabled(FALSE); 759 actionFind->setEnabled(FALSE);
760 actionMail->setEnabled(FALSE); 760 actionMail->setEnabled(FALSE);
761 761
762 setCaption( tr("Contacts - My Personal Details") ); 762 setCaption( tr("Contacts - My Personal Details") );
763 763
764 m_abView->showPersonal( true ); 764 m_abView->showPersonal( true );
765 765
766} 766}
767 767
768 768
769void AddressbookWindow::listIsEmpty( bool empty ) 769void AddressbookWindow::listIsEmpty( bool empty )
770{ 770{
771 if ( !empty ) { 771 if ( !empty ) {
772 deleteButton->setEnabled( TRUE ); 772 deleteButton->setEnabled( TRUE );
773 } 773 }
774} 774}
775 775
776void AddressbookWindow::reload() 776void AddressbookWindow::reload()
777{ 777{
778 syncing = FALSE; 778 syncing = FALSE;
779 m_abView->clear(); 779 m_abView->clear();
780 m_abView->reload(); 780 m_abView->reload();
781} 781}
782 782
783void AddressbookWindow::flush() 783void AddressbookWindow::flush()
784{ 784{
785 syncing = TRUE; 785 syncing = TRUE;
786 m_abView->save(); 786 m_abView->save();
787} 787}
788 788
789 789
790void AddressbookWindow::closeEvent( QCloseEvent *e ) 790void AddressbookWindow::closeEvent( QCloseEvent *e )
791{ 791{
792 if(active_view == AbView::CardView){ 792 if(active_view == AbView::CardView){
793 slotViewSwitched( AbView::TableView ); 793 slotViewSwitched( AbView::TableView );
794 e->ignore(); 794 e->ignore();
795 return; 795 return;
796 } 796 }
797 if(syncing) { 797 if(syncing) {
798 /* shouldn't we save, I hear you say? well its already been set 798 /* shouldn't we save, I hear you say? well its already been set
799 so that an edit can not occur during a sync, and we flushed 799 so that an edit can not occur during a sync, and we flushed
800 at the start of the sync, so there is no need to save 800 at the start of the sync, so there is no need to save
801 Saving however itself would cause problems. */ 801 Saving however itself would cause problems. */
802 e->accept(); 802 e->accept();
803 return; 803 return;
804 } 804 }
805 //################## shouldn't always save 805 //################## shouldn't always save
806 // True, but the database handles this automatically ! (se) 806 // True, but the database handles this automatically ! (se)
807 if ( save() ) 807 if ( save() )
808 e->accept(); 808 e->accept();
809 else 809 else
810 e->ignore(); 810 e->ignore();
811} 811}
812 812
813/* 813/*
814 Returns TRUE if it is OK to exit 814 Returns TRUE if it is OK to exit
815*/ 815*/
816 816
817bool AddressbookWindow::save() 817bool AddressbookWindow::save()
818{ 818{
819 if ( !m_abView->save() ) { 819 if ( !m_abView->save() ) {
820 if ( QMessageBox::critical( 0, tr( "Out of space" ), 820 if ( QMessageBox::critical( 0, tr( "Out of space" ),
821 tr("Unable to save information.\n" 821 tr("Unable to save information.\n"
822 "Free up some space\n" 822 "Free up some space\n"
823 "and try again.\n" 823 "and try again.\n"
824 "\nQuit anyway?"), 824 "\nQuit anyway?"),
825 QMessageBox::Yes|QMessageBox::Escape, 825 QMessageBox::Yes|QMessageBox::Escape,
826 QMessageBox::No|QMessageBox::Default ) 826 QMessageBox::No|QMessageBox::Default )
827 != QMessageBox::No ) 827 != QMessageBox::No )
828 return TRUE; 828 return TRUE;
829 else 829 else
830 return FALSE; 830 return FALSE;
831 } 831 }
832 return TRUE; 832 return TRUE;
833} 833}
834 834
835#ifdef __DEBUG_RELEASE 835#ifdef __DEBUG_RELEASE
836void AddressbookWindow::slotSave() 836void AddressbookWindow::slotSave()
837{ 837{
838 save(); 838 save();
839} 839}
840#endif 840#endif
841 841
842 842
843void AddressbookWindow::slotNotFound() 843void AddressbookWindow::slotNotFound()
844{ 844{
845 qWarning("Got notfound signal!"); 845 qWarning("Got notfound signal!");
846 QMessageBox::information( this, tr( "Not Found" ), 846 QMessageBox::information( this, tr( "Not Found" ),
847 tr( "Unable to find a contact for this \n search pattern!" ) ); 847 tr( "Unable to find a contact for this \n search pattern!" ) );
848 848
849 849
850} 850}
851void AddressbookWindow::slotWrapAround() 851void AddressbookWindow::slotWrapAround()
852{ 852{
853 qWarning("Got wrap signal!"); 853 qWarning("Got wrap signal!");
854 // if ( doNotifyWrapAround ) 854 // if ( doNotifyWrapAround )
855 // QMessageBox::information( this, tr( "End of list" ), 855 // QMessageBox::information( this, tr( "End of list" ),
856 // tr( "End of list. Wrap around now...!" ) + "\n" ); 856 // tr( "End of list. Wrap around now...!" ) + "\n" );
857 857
858} 858}
859 859
860void AddressbookWindow::slotSetCategory( int c ) 860void AddressbookWindow::slotSetCategory( int c )
861{ 861{
862 qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); 862 qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() );
863 863
864 QString cat, book; 864 QString cat, book;
865 AbView::Views view = AbView::TableView; 865 AbView::Views view = AbView::TableView;
866 866
867 if ( c <= 0 ) 867 if ( c <= 0 )
868 return; 868 return;
869 869
870 // Switch view 870 // Switch view
871 if ( c < 3 ) 871 if ( c < 3 )
872 for ( unsigned int i = 1; i < 3; i++ ){ 872 for ( unsigned int i = 1; i < 3; i++ ){
873 if ( catMenu ) 873 if ( catMenu )
874 catMenu->setItemChecked( i, c == (int)i ); 874 catMenu->setItemChecked( i, c == (int)i );
875 } 875 }
876 else 876 else
877 // Checkmark Category Menu Item Selected 877 // Checkmark Category Menu Item Selected
878 for ( unsigned int i = 3; i < catMenu->count(); i++ ) 878 for ( unsigned int i = 3; i < catMenu->count(); i++ )
879 catMenu->setItemChecked( i, c == (int)i ); 879 catMenu->setItemChecked( i, c == (int)i );
880 880
881 // Now switch to the selected category 881 // Now switch to the selected category
882 for ( unsigned int i = 1; i < catMenu->count(); i++ ) { 882 for ( unsigned int i = 1; i < catMenu->count(); i++ ) {
883 if (catMenu->isItemChecked( i )) { 883 if (catMenu->isItemChecked( i )) {
884 if ( i == 1 ){ // default List view 884 if ( i == 1 ){ // default List view
885 book = QString::null; 885 book = QString::null;
886 view = AbView::TableView; 886 view = AbView::TableView;
887 }else if ( i == 2 ){ 887 }else if ( i == 2 ){
888 book = tr( "Cards" ); 888 book = tr( "Cards" );
889 view = AbView::CardView; 889 view = AbView::CardView;
890 // }else if ( i == 3 ){ 890 // }else if ( i == 3 ){
891 // book = tr( "Personal" ); 891 // book = tr( "Personal" );
892 // view = AbView:: PersonalView; 892 // view = AbView:: PersonalView;
893 }else if ( i == 3 ){ // default All Categories 893 }else if ( i == 3 ){ // default All Categories
894 cat = QString::null; 894 cat = QString::null;
895 }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled 895 }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled
896 cat = "Unfiled"; 896 cat = "Unfiled";
897 qWarning ("Unfiled selected!!!"); 897 qWarning ("Unfiled selected!!!");
898 }else{ 898 }else{
899 cat = m_abView->categories()[i - 4]; 899 cat = m_abView->categories()[i - 4];
900 } 900 }
901 } 901 }
902 } 902 }
903 903
904 // Switch to the selected View 904 // Switch to the selected View
905 slotViewSwitched( view ); 905 slotViewSwitched( view );
906 906
907 // Tell the view about the selected category 907 // Tell the view about the selected category
908 m_abView -> setShowByCategory( cat ); 908 m_abView -> setShowByCategory( cat );
909 909
910 if ( book.isEmpty() ) 910 if ( book.isEmpty() )
911 book = "List"; 911 book = "List";
912 if ( cat.isEmpty() ) 912 if ( cat.isEmpty() )
913 cat = "All"; 913 cat = "All";
914 914
915 setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); 915 setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) );
916} 916}
917 917
918void AddressbookWindow::slotViewSwitched( int view ) 918void AddressbookWindow::slotViewSwitched( int view )
919{ 919{
920 qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); 920 qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view );
921 int menu = 0; 921 int menu = 0;
922 922
923 // Switch to selected view 923 // Switch to selected view
924 switch ( view ){ 924 switch ( view ){
925 case AbView::TableView: 925 case AbView::TableView:
926 menu = 1; 926 menu = 1;
927 m_tableViewButton->setOn(true); 927 m_tableViewButton->setOn(true);
928 m_cardViewButton->setOn(false); 928 m_cardViewButton->setOn(false);
929 break; 929 break;
930 case AbView::CardView: 930 case AbView::CardView:
931 menu = 2; 931 menu = 2;
932 m_tableViewButton->setOn(false); 932 m_tableViewButton->setOn(false);
933 m_cardViewButton->setOn(true); 933 m_cardViewButton->setOn(true);
934 break; 934 break;
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index b68d88c..c5ad0c4 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,950 +1,950 @@
1/* 1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> 2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) 3 * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de)
4 * 4 *
5 * This file is an add-on for the OPIE Palmtop Environment 5 * This file is an add-on for the OPIE Palmtop Environment
6 * 6 *
7 * This file may be distributed and/or modified under the terms of the 7 * This file may be distributed and/or modified under the terms of the
8 * GNU General Public License version 2 as published by the Free Software 8 * GNU General Public License version 2 as published by the Free Software
9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging 9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
10 * of this file. 10 * of this file.
11 * 11 *
12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 * 14 *
15 * 15 *
16 * This is a rewrite of the abeditor.h file, modified to provide a more 16 * This is a rewrite of the abeditor.h file, modified to provide a more
17 * intuitive interface to TrollTech's original Address Book editor. This 17 * intuitive interface to TrollTech's original Address Book editor. This
18 * is made to operate exactly in interface with the exception of name. 18 * is made to operate exactly in interface with the exception of name.
19 * 19 *
20 */ 20 */
21 21
22#include "contacteditor.h" 22#include "contacteditor.h"
23#include "addresspicker.h" 23#include "addresspicker.h"
24#include "ocontactfields.h" 24#include "ocontactfields.h"
25 25
26#include <qpe/categoryselect.h> 26#include <qpe/categoryselect.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/qpedialog.h> 28#include <qpe/qpedialog.h>
29#include <qpe/timeconversion.h> 29#include <qpe/timeconversion.h>
30#include <opie/ocontact.h> 30#include <opie/ocontact.h>
31#include <qpe/resource.h> 31#include <qpe/resource.h>
32 32
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qlabel.h> 34#include <qlabel.h>
35#include <qtabwidget.h> 35#include <qtabwidget.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qmultilineedit.h> 38#include <qmultilineedit.h>
39#include <qscrollview.h> 39#include <qscrollview.h>
40#include <qtoolbutton.h> 40#include <qtoolbutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qmainwindow.h> 42#include <qmainwindow.h>
43#include <qvaluelist.h> 43#include <qvaluelist.h>
44#include <qpopupmenu.h> 44#include <qpopupmenu.h>
45#include <qlistbox.h> 45#include <qlistbox.h>
46#include <qhbox.h> 46#include <qhbox.h>
47#include <qaction.h> 47#include <qaction.h>
48#include <qiconset.h> 48#include <qiconset.h>
49 49
50#include <assert.h> 50#include <assert.h>
51 51
52static inline bool containsAlphaNum( const QString &str ); 52static inline bool containsAlphaNum( const QString &str );
53static inline bool constainsWhiteSpace( const QString &str ); 53static inline bool constainsWhiteSpace( const QString &str );
54 54
55// helper functions, convert our comma delimited list to proper 55// helper functions, convert our comma delimited list to proper
56// file format... 56// file format...
57void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 57void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
58 QString &strAll ); 58 QString &strAll );
59 59
60// helper convert from file format to comma delimited... 60// helper convert from file format to comma delimited...
61void parseEmailTo( const QString &strDefaultEmail, 61void parseEmailTo( const QString &strDefaultEmail,
62 const QString &strOtherEmail, QString &strBack ); 62 const QString &strOtherEmail, QString &strBack );
63 63
64 ContactEditor::ContactEditor(const OContact &entry, 64 ContactEditor::ContactEditor(const OContact &entry,
65 QWidget *parent, 65 QWidget *parent,
66 const char *name, 66 const char *name,
67 WFlags fl ) 67 WFlags fl )
68 : QDialog( parent, name, TRUE, fl ), 68 : QDialog( parent, name, TRUE, fl ),
69 m_personalView ( false ) 69 m_personalView ( false )
70 70
71{ 71{
72 72
73 init(); 73 init();
74 setEntry( entry ); 74 setEntry( entry );
75 cmbDefaultEmail = 0; 75 cmbDefaultEmail = 0;
76 defaultEmailChooserPosition = -1; 76 defaultEmailChooserPosition = -1;
77} 77}
78 78
79ContactEditor::~ContactEditor() { 79ContactEditor::~ContactEditor() {
80} 80}
81 81
82void ContactEditor::init() { 82void ContactEditor::init() {
83 83
84 useFullName = true; 84 useFullName = true;
85 85
86 uint i = 0; 86 uint i = 0;
87 87
88 QStringList trlChooserNames; 88 QStringList trlChooserNames;
89 89
90 for (i = 0; i <= 6; i++) { 90 for (i = 0; i <= 6; i++) {
91 slHomeAddress.append( "" ); 91 slHomeAddress.append( "" );
92 slBusinessAddress.append( "" ); 92 slBusinessAddress.append( "" );
93 } 93 }
94 94
95 trlChooserNames = OContactFields::trphonefields( false ); 95 trlChooserNames = OContactFields::trphonefields( false );
96 slChooserNames = OContactFields::untrphonefields( false ); 96 slChooserNames = OContactFields::untrphonefields( false );
97 slDynamicEntries = OContactFields::untrdetailsfields( false ); 97 slDynamicEntries = OContactFields::untrdetailsfields( false );
98 trlDynamicEntries = OContactFields::trdetailsfields( false ); 98 trlDynamicEntries = OContactFields::trdetailsfields( false );
99 99
100 // Ok, we have to remove elements from the list of dynamic entries 100 // Ok, we have to remove elements from the list of dynamic entries
101 // which are now stored in special (not dynamic) widgets.. 101 // which are now stored in special (not dynamic) widgets..
102 // Otherwise we will get problems with field assignments! (se) 102 // Otherwise we will get problems with field assignments! (se)
103 slDynamicEntries.remove("Anniversary"); 103 slDynamicEntries.remove("Anniversary");
104 slDynamicEntries.remove("Birthday"); 104 slDynamicEntries.remove("Birthday");
105 slDynamicEntries.remove("Gender"); 105 slDynamicEntries.remove("Gender");
106 106
107 // The same with translated fields.. But I will 107 // The same with translated fields.. But I will
108 // use the translation map to avoid mismatches.. 108 // use the translation map to avoid mismatches..
109 QMap<int, QString> translMap = OContactFields::idToTrFields(); 109 QMap<int, QString> translMap = OContactFields::idToTrFields();
110 trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); 110 trlDynamicEntries.remove( translMap[Qtopia::Anniversary] );
111 trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); 111 trlDynamicEntries.remove( translMap[Qtopia::Birthday] );
112 trlDynamicEntries.remove( translMap[Qtopia::Gender] ); 112 trlDynamicEntries.remove( translMap[Qtopia::Gender] );
113 113
114 // Last Check to be sure.. 114 // Last Check to be sure..
115 assert( slDynamicEntries.count() == trlDynamicEntries.count() ); 115 assert( slDynamicEntries.count() == trlDynamicEntries.count() );
116 assert( slChooserNames.count() == trlChooserNames.count() ); 116 assert( slChooserNames.count() == trlChooserNames.count() );
117 117
118 for (i = 0; i < slChooserNames.count(); i++) 118 for (i = 0; i < slChooserNames.count(); i++)
119 slChooserValues.append(""); 119 slChooserValues.append("");
120 120
121 121
122 QVBoxLayout *vb = new QVBoxLayout( this ); 122 QVBoxLayout *vb = new QVBoxLayout( this );
123 123
124 tabMain = new QTabWidget( this ); 124 tabMain = new QTabWidget( this );
125 vb->addWidget( tabMain ); 125 vb->addWidget( tabMain );
126 126
127 QWidget *tabViewport = new QWidget ( tabMain ); 127 QWidget *tabViewport = new QWidget ( tabMain );
128 128
129 vb = new QVBoxLayout( tabViewport ); 129 vb = new QVBoxLayout( tabViewport );
130 130
131 svGeneral = new QScrollView( tabViewport ); 131 svGeneral = new QScrollView( tabViewport );
132 vb->addWidget( svGeneral, 0, 0 ); 132 vb->addWidget( svGeneral, 0, 0 );
133 svGeneral->setResizePolicy( QScrollView::AutoOneFit ); 133 svGeneral->setResizePolicy( QScrollView::AutoOneFit );
134 svGeneral->setFrameStyle( QFrame::NoFrame ); 134 svGeneral->setFrameStyle( QFrame::NoFrame );
135 135
136 QWidget *container = new QWidget( svGeneral->viewport() ); 136 QWidget *container = new QWidget( svGeneral->viewport() );
137 svGeneral->addChild( container ); 137 svGeneral->addChild( container );
138 138
139 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); 139 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
140 gl->setResizeMode( QLayout::FreeResize ); 140 gl->setResizeMode( QLayout::FreeResize );
141 141
142 btnFullName = new QPushButton( tr( "Full Name..." ), container ); 142 btnFullName = new QPushButton( tr( "Full Name..." ), container );
143 gl->addWidget( btnFullName, 0, 0 ); 143 gl->addWidget( btnFullName, 0, 0 );
144 txtFullName = new QLineEdit( container ); 144 txtFullName = new QLineEdit( container );
145 gl->addWidget( txtFullName, 0, 1 ); 145 gl->addWidget( txtFullName, 0, 1 );
146 146
147 QLabel *l = new QLabel( tr( "Job Title" ), container ); 147 QLabel *l = new QLabel( tr( "Job Title" ), container );
148 gl->addWidget( l, 1, 0 ); 148 gl->addWidget( l, 1, 0 );
149 txtJobTitle = new QLineEdit( container ); 149 txtJobTitle = new QLineEdit( container );
150 gl->addWidget( txtJobTitle, 1, 1 ); 150 gl->addWidget( txtJobTitle, 1, 1 );
151 151
152 l = new QLabel( tr( "Organization" ), container ); 152 l = new QLabel( tr( "Organization" ), container );
153 gl->addWidget( l, 2, 0 ); 153 gl->addWidget( l, 2, 0 );
154 txtOrganization = new QLineEdit( container ); 154 txtOrganization = new QLineEdit( container );
155 gl->addWidget( txtOrganization, 2, 1 ); 155 gl->addWidget( txtOrganization, 2, 1 );
156 156
157 cmbChooserField1 = new QComboBox( FALSE, container ); 157 cmbChooserField1 = new QComboBox( FALSE, container );
158 cmbChooserField1->setMaximumWidth( 90 ); 158 cmbChooserField1->setMaximumWidth( 90 );
159 gl->addWidget( cmbChooserField1, 3, 0 ); 159 gl->addWidget( cmbChooserField1, 3, 0 );
160 txtChooserField1 = new QLineEdit( container ); 160 txtChooserField1 = new QLineEdit( container );
161 gl->addWidget( txtChooserField1, 3, 1 ); 161 gl->addWidget( txtChooserField1, 3, 1 );
162 162
163 cmbChooserField2 = new QComboBox( FALSE, container ); 163 cmbChooserField2 = new QComboBox( FALSE, container );
164 cmbChooserField2->setMaximumWidth( 90 ); 164 cmbChooserField2->setMaximumWidth( 90 );
165 gl->addWidget( cmbChooserField2, 4, 0 ); 165 gl->addWidget( cmbChooserField2, 4, 0 );
166 txtChooserField2 = new QLineEdit( container ); 166 txtChooserField2 = new QLineEdit( container );
167 gl->addWidget( txtChooserField2, 4, 1 ); 167 gl->addWidget( txtChooserField2, 4, 1 );
168 168
169 cmbChooserField3 = new QComboBox( FALSE, container ); 169 cmbChooserField3 = new QComboBox( FALSE, container );
170 cmbChooserField3->setMaximumWidth( 90 ); 170 cmbChooserField3->setMaximumWidth( 90 );
171 gl->addWidget( cmbChooserField3, 5, 0 ); 171 gl->addWidget( cmbChooserField3, 5, 0 );
172 txtChooserField3 = new QLineEdit( container ); 172 txtChooserField3 = new QLineEdit( container );
173 gl->addWidget( txtChooserField3, 5, 1 ); 173 gl->addWidget( txtChooserField3, 5, 1 );
174 174
175 l = new QLabel( tr( "File As" ), container ); 175 l = new QLabel( tr( "File As" ), container );
176 gl->addWidget( l, 6, 0 ); 176 gl->addWidget( l, 6, 0 );
177 cmbFileAs = new QComboBox( TRUE, container ); 177 cmbFileAs = new QComboBox( TRUE, container );
178 gl->addWidget( cmbFileAs, 6, 1 ); 178 gl->addWidget( cmbFileAs, 6, 1 );
179 179
180 labCat = new QLabel( tr( "Category" ), container ); 180 labCat = new QLabel( tr( "Category" ), container );
181 gl->addWidget( labCat, 7, 0 ); 181 gl->addWidget( labCat, 7, 0 );
182 cmbCat = new CategorySelect( container ); 182 cmbCat = new CategorySelect( container );
183 gl->addWidget( cmbCat, 7, 1 ); 183 gl->addWidget( cmbCat, 7, 1 );
184 labCat->show(); 184 labCat->show();
185 cmbCat->show(); 185 cmbCat->show();
186 186
187 btnNote = new QPushButton( tr( "Notes..." ), container ); 187 btnNote = new QPushButton( tr( "Notes..." ), container );
188 gl->addWidget( btnNote, 8, 1 ); 188 gl->addWidget( btnNote, 8, 1 );
189 189
190 tabMain->insertTab( tabViewport, tr( "General" ) ); 190 tabMain->insertTab( tabViewport, tr( "General" ) );
191 191
192 tabViewport = new QWidget ( tabMain ); 192 tabViewport = new QWidget ( tabMain );
193 193
194 vb = new QVBoxLayout( tabViewport ); 194 vb = new QVBoxLayout( tabViewport );
195 195
196 svAddress = new QScrollView( tabViewport ); 196 svAddress = new QScrollView( tabViewport );
197 vb->addWidget( svAddress, 0, 0 ); 197 vb->addWidget( svAddress, 0, 0 );
198 svAddress->setResizePolicy( QScrollView::AutoOneFit ); 198 svAddress->setResizePolicy( QScrollView::AutoOneFit );
199 svAddress->setFrameStyle( QFrame::NoFrame ); 199 svAddress->setFrameStyle( QFrame::NoFrame );
200 200
201 container = new QWidget( svAddress->viewport() ); 201 container = new QWidget( svAddress->viewport() );
202 svAddress->addChild( container ); 202 svAddress->addChild( container );
203 203
204 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem 204 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem
205 205
206 cmbAddress = new QComboBox( FALSE, container ); 206 cmbAddress = new QComboBox( FALSE, container );
207 cmbAddress->insertItem( tr( "Business" ) ); 207 cmbAddress->insertItem( tr( "Business" ) );
208 cmbAddress->insertItem( tr( "Home" ) ); 208 cmbAddress->insertItem( tr( "Home" ) );
209 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); 209 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 );
210 210
211 l = new QLabel( tr( "Address" ), container ); 211 l = new QLabel( tr( "Address" ), container );
212 gl->addWidget( l, 1, 0 ); 212 gl->addWidget( l, 1, 0 );
213 txtAddress = new QLineEdit( container ); 213 txtAddress = new QLineEdit( container );
214 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); 214 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 );
215 215
216 l = new QLabel( tr( "City" ), container ); 216 l = new QLabel( tr( "City" ), container );
217 gl->addWidget( l, 2, 0 ); 217 gl->addWidget( l, 2, 0 );
218 txtCity = new QLineEdit( container ); 218 txtCity = new QLineEdit( container );
219 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); 219 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 );
220 220
221 l = new QLabel( tr( "State" ), container ); 221 l = new QLabel( tr( "State" ), container );
222 gl->addWidget( l, 3, 0 ); 222 gl->addWidget( l, 3, 0 );
223 txtState = new QLineEdit( container ); 223 txtState = new QLineEdit( container );
224 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); 224 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 );
225 225
226 l = new QLabel( tr( "Zip Code" ), container ); 226 l = new QLabel( tr( "Zip Code" ), container );
227 gl->addWidget( l, 4, 0 ); 227 gl->addWidget( l, 4, 0 );
228 txtZip = new QLineEdit( container ); 228 txtZip = new QLineEdit( container );
229 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); 229 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 );
230 230
231 l = new QLabel( tr( "Country" ), container ); 231 l = new QLabel( tr( "Country" ), container );
232 gl->addWidget( l, 5, 0 ); 232 gl->addWidget( l, 5, 0 );
233 cmbCountry = new QComboBox( TRUE, container ); 233 cmbCountry = new QComboBox( TRUE, container );
234 cmbCountry->insertItem( tr( "" ) ); 234 cmbCountry->insertItem( tr( "" ) );
235 cmbCountry->insertItem( tr ( "United States" ) ); 235 cmbCountry->insertItem( tr ( "United States" ) );
236 cmbCountry->insertItem( tr ( "United Kingdom" ) ); 236 cmbCountry->insertItem( tr ( "United Kingdom" ) );
237 cmbCountry->insertItem( tr ( "Afganistan" ) ); 237 cmbCountry->insertItem( tr ( "Afghanistan" ) );
238 cmbCountry->insertItem( tr ( "Albania" ) ); 238 cmbCountry->insertItem( tr ( "Albania" ) );
239 cmbCountry->insertItem( tr ( "Algeria" ) ); 239 cmbCountry->insertItem( tr ( "Algeria" ) );
240 cmbCountry->insertItem( tr ( "American Samoa" ) ); 240 cmbCountry->insertItem( tr ( "American Samoa" ) );
241 cmbCountry->insertItem( tr ( "Andorra" ) ); 241 cmbCountry->insertItem( tr ( "Andorra" ) );
242 cmbCountry->insertItem( tr ( "Angola" ) ); 242 cmbCountry->insertItem( tr ( "Angola" ) );
243 cmbCountry->insertItem( tr ( "Anguilla" ) ); 243 cmbCountry->insertItem( tr ( "Anguilla" ) );
244 cmbCountry->insertItem( tr ( "Antartica" ) ); 244 cmbCountry->insertItem( tr ( "Antarctica" ) );
245 cmbCountry->insertItem( tr ( "Argentina" ) ); 245 cmbCountry->insertItem( tr ( "Argentina" ) );
246 cmbCountry->insertItem( tr ( "Armania" ) ); 246 cmbCountry->insertItem( tr ( "Armenia" ) );
247 cmbCountry->insertItem( tr ( "Aruba" ) ); 247 cmbCountry->insertItem( tr ( "Aruba" ) );
248 cmbCountry->insertItem( tr ( "Australia" ) ); 248 cmbCountry->insertItem( tr ( "Australia" ) );
249 cmbCountry->insertItem( tr ( "Austria" ) ); 249 cmbCountry->insertItem( tr ( "Austria" ) );
250 cmbCountry->insertItem( tr ( "Azerbaijan" ) ); 250 cmbCountry->insertItem( tr ( "Azerbaijan" ) );
251 cmbCountry->insertItem( tr ( "Bahamas" ) ); 251 cmbCountry->insertItem( tr ( "Bahamas" ) );
252 cmbCountry->insertItem( tr ( "Bahrain" ) ); 252 cmbCountry->insertItem( tr ( "Bahrain" ) );
253 cmbCountry->insertItem( tr ( "Bangladesh" ) ); 253 cmbCountry->insertItem( tr ( "Bangladesh" ) );
254 cmbCountry->insertItem( tr ( "Barbados" ) ); 254 cmbCountry->insertItem( tr ( "Barbados" ) );
255 cmbCountry->insertItem( tr ( "Belarus" ) ); 255 cmbCountry->insertItem( tr ( "Belarus" ) );
256 cmbCountry->insertItem( tr ( "Belgium" ) ); 256 cmbCountry->insertItem( tr ( "Belgium" ) );
257 cmbCountry->insertItem( tr ( "Belize" ) ); 257 cmbCountry->insertItem( tr ( "Belize" ) );
258 cmbCountry->insertItem( tr ( "Benin" ) ); 258 cmbCountry->insertItem( tr ( "Benin" ) );
259 cmbCountry->insertItem( tr ( "Bermuda" ) ); 259 cmbCountry->insertItem( tr ( "Bermuda" ) );
260 cmbCountry->insertItem( tr ( "Bhutan" ) ); 260 cmbCountry->insertItem( tr ( "Bhutan" ) );
261 cmbCountry->insertItem( tr ( "Boliva" ) ); 261 cmbCountry->insertItem( tr ( "Bolivia" ) );
262 cmbCountry->insertItem( tr ( "Botswana" ) ); 262 cmbCountry->insertItem( tr ( "Botswana" ) );
263 cmbCountry->insertItem( tr ( "Bouvet Island" ) ); 263 cmbCountry->insertItem( tr ( "Bouvet Island" ) );
264 cmbCountry->insertItem( tr ( "Brazil" ) ); 264 cmbCountry->insertItem( tr ( "Brazil" ) );
265 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); 265 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) );
266 cmbCountry->insertItem( tr ( "Bulgaria" ) ); 266 cmbCountry->insertItem( tr ( "Bulgaria" ) );
267 cmbCountry->insertItem( tr ( "Burkina Faso" ) ); 267 cmbCountry->insertItem( tr ( "Burkina Faso" ) );
268 cmbCountry->insertItem( tr ( "Burundi" ) ); 268 cmbCountry->insertItem( tr ( "Burundi" ) );
269 cmbCountry->insertItem( tr ( "Cambodia" ) ); 269 cmbCountry->insertItem( tr ( "Cambodia" ) );
270 cmbCountry->insertItem( tr ( "Camaroon" ) ); 270 cmbCountry->insertItem( tr ( "Cameroon" ) );
271 cmbCountry->insertItem( tr ( "Canada" ) ); 271 cmbCountry->insertItem( tr ( "Canada" ) );
272 cmbCountry->insertItem( tr ( "Cape Verde" ) ); 272 cmbCountry->insertItem( tr ( "Cape Verde" ) );
273 cmbCountry->insertItem( tr ( "Cayman Islands" ) ); 273 cmbCountry->insertItem( tr ( "Cayman Islands" ) );
274 cmbCountry->insertItem( tr ( "Chad" ) ); 274 cmbCountry->insertItem( tr ( "Chad" ) );
275 cmbCountry->insertItem( tr ( "Chile" ) ); 275 cmbCountry->insertItem( tr ( "Chile" ) );
276 cmbCountry->insertItem( tr ( "China" ) ); 276 cmbCountry->insertItem( tr ( "China" ) );
277 cmbCountry->insertItem( tr ( "Christmas Island" ) ); 277 cmbCountry->insertItem( tr ( "Christmas Island" ) );
278 cmbCountry->insertItem( tr ( "Colombia" ) ); 278 cmbCountry->insertItem( tr ( "Colombia" ) );
279 cmbCountry->insertItem( tr ( "Comoros" ) ); 279 cmbCountry->insertItem( tr ( "Comoros" ) );
280 cmbCountry->insertItem( tr ( "Congo" ) ); 280 cmbCountry->insertItem( tr ( "Congo" ) );
281 cmbCountry->insertItem( tr ( "Cook Island" ) ); 281 cmbCountry->insertItem( tr ( "Cook Island" ) );
282 cmbCountry->insertItem( tr ( "Costa Rica" ) ); 282 cmbCountry->insertItem( tr ( "Costa Rica" ) );
283 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); 283 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) );
284 cmbCountry->insertItem( tr ( "Croatia" ) ); 284 cmbCountry->insertItem( tr ( "Croatia" ) );
285 cmbCountry->insertItem( tr ( "Cuba" ) ); 285 cmbCountry->insertItem( tr ( "Cuba" ) );
286 cmbCountry->insertItem( tr ( "Cyprus" ) ); 286 cmbCountry->insertItem( tr ( "Cyprus" ) );
287 cmbCountry->insertItem( tr ( "Czech Republic" ) ); 287 cmbCountry->insertItem( tr ( "Czech Republic" ) );
288 cmbCountry->insertItem( tr ( "Denmark" ) ); 288 cmbCountry->insertItem( tr ( "Denmark" ) );
289 cmbCountry->insertItem( tr ( "Djibouti" ) ); 289 cmbCountry->insertItem( tr ( "Djibouti" ) );
290 cmbCountry->insertItem( tr ( "Dominica" ) ); 290 cmbCountry->insertItem( tr ( "Dominica" ) );
291 cmbCountry->insertItem( tr ( "Dominican Republic" ) ); 291 cmbCountry->insertItem( tr ( "Dominican Republic" ) );
292 cmbCountry->insertItem( tr ( "East Timor" ) ); 292 cmbCountry->insertItem( tr ( "East Timor" ) );
293 cmbCountry->insertItem( tr ( "Ecuador" ) ); 293 cmbCountry->insertItem( tr ( "Ecuador" ) );
294 cmbCountry->insertItem( tr ( "Egypt" ) ); 294 cmbCountry->insertItem( tr ( "Egypt" ) );
295 cmbCountry->insertItem( tr ( "El Salvador" ) ); 295 cmbCountry->insertItem( tr ( "El Salvador" ) );
296 cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); 296 cmbCountry->insertItem( tr ( "Equatorial Guinea" ) );
297 cmbCountry->insertItem( tr ( "Eritrea" ) ); 297 cmbCountry->insertItem( tr ( "Eritrea" ) );
298 cmbCountry->insertItem( tr ( "Estonia" ) ); 298 cmbCountry->insertItem( tr ( "Estonia" ) );
299 cmbCountry->insertItem( tr ( "Ethiopia" ) ); 299 cmbCountry->insertItem( tr ( "Ethiopia" ) );
300 cmbCountry->insertItem( tr ( "Falkland Islands" ) ); 300 cmbCountry->insertItem( tr ( "Falkland Islands" ) );
301 cmbCountry->insertItem( tr ( "Faroe Islands" ) ); 301 cmbCountry->insertItem( tr ( "Faroe Islands" ) );
302 cmbCountry->insertItem( tr ( "Fiji" ) ); 302 cmbCountry->insertItem( tr ( "Fiji" ) );
303 cmbCountry->insertItem( tr ( "Finland" ) ); 303 cmbCountry->insertItem( tr ( "Finland" ) );
304 cmbCountry->insertItem( tr ( "France" ) ); 304 cmbCountry->insertItem( tr ( "France" ) );
305 cmbCountry->insertItem( tr ( "French Guiana" ) ); 305 cmbCountry->insertItem( tr ( "French Guiana" ) );
306 cmbCountry->insertItem( tr ( "French Polynesia" ) ); 306 cmbCountry->insertItem( tr ( "French Polynesia" ) );
307 cmbCountry->insertItem( tr ( "Gabon" ) ); 307 cmbCountry->insertItem( tr ( "Gabon" ) );
308 cmbCountry->insertItem( tr ( "Gambia" ) ); 308 cmbCountry->insertItem( tr ( "Gambia" ) );
309 cmbCountry->insertItem( tr ( "Georgia" ) ); 309 cmbCountry->insertItem( tr ( "Georgia" ) );
310 cmbCountry->insertItem( tr ( "Germany" ) ); 310 cmbCountry->insertItem( tr ( "Germany" ) );
311 cmbCountry->insertItem( tr ( "Gahna" ) ); 311 cmbCountry->insertItem( tr ( "Ghana" ) );
312 cmbCountry->insertItem( tr ( "Gibraltar" ) ); 312 cmbCountry->insertItem( tr ( "Gibraltar" ) );
313 cmbCountry->insertItem( tr ( "Greece" ) ); 313 cmbCountry->insertItem( tr ( "Greece" ) );
314 cmbCountry->insertItem( tr ( "Greenland" ) ); 314 cmbCountry->insertItem( tr ( "Greenland" ) );
315 cmbCountry->insertItem( tr ( "Grenada" ) ); 315 cmbCountry->insertItem( tr ( "Grenada" ) );
316 cmbCountry->insertItem( tr ( "Guadelupe" ) ); 316 cmbCountry->insertItem( tr ( "Guadeloupe" ) );
317 cmbCountry->insertItem( tr ( "Guam" ) ); 317 cmbCountry->insertItem( tr ( "Guam" ) );
318 cmbCountry->insertItem( tr ( "Guatemala" ) ); 318 cmbCountry->insertItem( tr ( "Guatemala" ) );
319 cmbCountry->insertItem( tr ( "Guinea" ) ); 319 cmbCountry->insertItem( tr ( "Guinea" ) );
320 cmbCountry->insertItem( tr ( "Guinea-bissau" ) ); 320 cmbCountry->insertItem( tr ( "Guinea-Bissau" ) );
321 cmbCountry->insertItem( tr ( "Guyana" ) ); 321 cmbCountry->insertItem( tr ( "Guyana" ) );
322 cmbCountry->insertItem( tr ( "Haiti" ) ); 322 cmbCountry->insertItem( tr ( "Haiti" ) );
323 cmbCountry->insertItem( tr ( "Holy See" ) ); 323 cmbCountry->insertItem( tr ( "Holy See" ) );
324 cmbCountry->insertItem( tr ( "Honduras" ) ); 324 cmbCountry->insertItem( tr ( "Honduras" ) );
325 cmbCountry->insertItem( tr ( "Hong Kong" ) ); 325 cmbCountry->insertItem( tr ( "Hong Kong" ) );
326 cmbCountry->insertItem( tr ( "Hungary" ) ); 326 cmbCountry->insertItem( tr ( "Hungary" ) );
327 cmbCountry->insertItem( tr ( "Iceland" ) ); 327 cmbCountry->insertItem( tr ( "Iceland" ) );
328 cmbCountry->insertItem( tr ( "India" ) ); 328 cmbCountry->insertItem( tr ( "India" ) );
329 cmbCountry->insertItem( tr ( "Indonesia" ) ); 329 cmbCountry->insertItem( tr ( "Indonesia" ) );
330 cmbCountry->insertItem( tr ( "Ireland" ) ); 330 cmbCountry->insertItem( tr ( "Ireland" ) );
331 cmbCountry->insertItem( tr ( "Israel" ) ); 331 cmbCountry->insertItem( tr ( "Israel" ) );
332 cmbCountry->insertItem( tr ( "Italy" ) ); 332 cmbCountry->insertItem( tr ( "Italy" ) );
333 cmbCountry->insertItem( tr ( "Jamacia" ) ); 333 cmbCountry->insertItem( tr ( "Jamaica" ) );
334 cmbCountry->insertItem( tr ( "Japan" ) ); 334 cmbCountry->insertItem( tr ( "Japan" ) );
335 cmbCountry->insertItem( tr ( "Jordan" ) ); 335 cmbCountry->insertItem( tr ( "Jordan" ) );
336 cmbCountry->insertItem( tr ( "Kazakhstan" ) ); 336 cmbCountry->insertItem( tr ( "Kazakhstan" ) );
337 cmbCountry->insertItem( tr ( "Kenya" ) ); 337 cmbCountry->insertItem( tr ( "Kenya" ) );
338 cmbCountry->insertItem( tr ( "Kribati" ) ); 338 cmbCountry->insertItem( tr ( "Kiribati" ) );
339 cmbCountry->insertItem( tr ( "Korea" ) ); 339 cmbCountry->insertItem( tr ( "Korea" ) );
340 cmbCountry->insertItem( tr ( "Kuwait" ) ); 340 cmbCountry->insertItem( tr ( "Kuwait" ) );
341 cmbCountry->insertItem( tr ( "Kyrgystan" ) ); 341 cmbCountry->insertItem( tr ( "Kyrgyzstan" ) );
342 cmbCountry->insertItem( tr ( "Laos" ) ); 342 cmbCountry->insertItem( tr ( "Laos" ) );
343 cmbCountry->insertItem( tr ( "Latvia" ) ); 343 cmbCountry->insertItem( tr ( "Latvia" ) );
344 cmbCountry->insertItem( tr ( "Lebanon" ) ); 344 cmbCountry->insertItem( tr ( "Lebanon" ) );
345 cmbCountry->insertItem( tr ( "Lesotho" ) ); 345 cmbCountry->insertItem( tr ( "Lesotho" ) );
346 cmbCountry->insertItem( tr ( "Liberia" ) ); 346 cmbCountry->insertItem( tr ( "Liberia" ) );
347 cmbCountry->insertItem( tr ( "Liechtenstein" ) ); 347 cmbCountry->insertItem( tr ( "Liechtenstein" ) );
348 cmbCountry->insertItem( tr ( "Lithuania" ) ); 348 cmbCountry->insertItem( tr ( "Lithuania" ) );
349 cmbCountry->insertItem( tr ( "Luxembourg" ) ); 349 cmbCountry->insertItem( tr ( "Luxembourg" ) );
350 cmbCountry->insertItem( tr ( "Macau" ) ); 350 cmbCountry->insertItem( tr ( "Macau" ) );
351 cmbCountry->insertItem( tr ( "Macedonia" ) ); 351 cmbCountry->insertItem( tr ( "Macedonia" ) );
352 cmbCountry->insertItem( tr ( "Madagascar" ) ); 352 cmbCountry->insertItem( tr ( "Madagascar" ) );
353 cmbCountry->insertItem( tr ( "Malawi" ) ); 353 cmbCountry->insertItem( tr ( "Malawi" ) );
354 cmbCountry->insertItem( tr ( "Malaysia" ) ); 354 cmbCountry->insertItem( tr ( "Malaysia" ) );
355 cmbCountry->insertItem( tr ( "Maldives" ) ); 355 cmbCountry->insertItem( tr ( "Maldives" ) );
356 cmbCountry->insertItem( tr ( "Mali" ) ); 356 cmbCountry->insertItem( tr ( "Mali" ) );
357 cmbCountry->insertItem( tr ( "Malta" ) ); 357 cmbCountry->insertItem( tr ( "Malta" ) );
358 cmbCountry->insertItem( tr ( "Martinique" ) ); 358 cmbCountry->insertItem( tr ( "Martinique" ) );
359 cmbCountry->insertItem( tr ( "Mauritania" ) ); 359 cmbCountry->insertItem( tr ( "Mauritania" ) );
360 cmbCountry->insertItem( tr ( "Mauritius" ) ); 360 cmbCountry->insertItem( tr ( "Mauritius" ) );
361 cmbCountry->insertItem( tr ( "Mayotte" ) ); 361 cmbCountry->insertItem( tr ( "Mayotte" ) );
362 cmbCountry->insertItem( tr ( "Mexico" ) ); 362 cmbCountry->insertItem( tr ( "Mexico" ) );
363 cmbCountry->insertItem( tr ( "Micronesia" ) ); 363 cmbCountry->insertItem( tr ( "Micronesia" ) );
364 cmbCountry->insertItem( tr ( "Moldova" ) ); 364 cmbCountry->insertItem( tr ( "Moldova" ) );
365 cmbCountry->insertItem( tr ( "Monaco" ) ); 365 cmbCountry->insertItem( tr ( "Monaco" ) );
366 cmbCountry->insertItem( tr ( "Mongolia" ) ); 366 cmbCountry->insertItem( tr ( "Mongolia" ) );
367 cmbCountry->insertItem( tr ( "Montserrat" ) ); 367 cmbCountry->insertItem( tr ( "Montserrat" ) );
368 cmbCountry->insertItem( tr ( "Morocco" ) ); 368 cmbCountry->insertItem( tr ( "Morocco" ) );
369 cmbCountry->insertItem( tr ( "Mozambique" ) ); 369 cmbCountry->insertItem( tr ( "Mozambique" ) );
370 cmbCountry->insertItem( tr ( "Myanmar" ) ); 370 cmbCountry->insertItem( tr ( "Myanmar" ) );
371 cmbCountry->insertItem( tr ( "Namibia" ) ); 371 cmbCountry->insertItem( tr ( "Namibia" ) );
372 cmbCountry->insertItem( tr ( "Nauru" ) ); 372 cmbCountry->insertItem( tr ( "Nauru" ) );
373 cmbCountry->insertItem( tr ( "Nepal" ) ); 373 cmbCountry->insertItem( tr ( "Nepal" ) );
374 cmbCountry->insertItem( tr ( "Netherlands" ) ); 374 cmbCountry->insertItem( tr ( "Netherlands" ) );
375 cmbCountry->insertItem( tr ( "New Caledonia" ) ); 375 cmbCountry->insertItem( tr ( "New Caledonia" ) );
376 cmbCountry->insertItem( tr ( "New Zealand" ) ); 376 cmbCountry->insertItem( tr ( "New Zealand" ) );
377 cmbCountry->insertItem( tr ( "Nicaragua" ) ); 377 cmbCountry->insertItem( tr ( "Nicaragua" ) );
378 cmbCountry->insertItem( tr ( "Niger" ) ); 378 cmbCountry->insertItem( tr ( "Niger" ) );
379 cmbCountry->insertItem( tr ( "Nigeria" ) ); 379 cmbCountry->insertItem( tr ( "Nigeria" ) );
380 cmbCountry->insertItem( tr ( "Niue" ) ); 380 cmbCountry->insertItem( tr ( "Niue" ) );
381 cmbCountry->insertItem( tr ( "Norway" ) ); 381 cmbCountry->insertItem( tr ( "Norway" ) );
382 cmbCountry->insertItem( tr ( "Oman" ) ); 382 cmbCountry->insertItem( tr ( "Oman" ) );
383 cmbCountry->insertItem( tr ( "Pakistan" ) ); 383 cmbCountry->insertItem( tr ( "Pakistan" ) );
384 cmbCountry->insertItem( tr ( "Palau" ) ); 384 cmbCountry->insertItem( tr ( "Palau" ) );
385 cmbCountry->insertItem( tr ( "Palestinian Territory" ) ); 385 cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) );
386 cmbCountry->insertItem( tr ( "Panama" ) ); 386 cmbCountry->insertItem( tr ( "Panama" ) );
387 cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); 387 cmbCountry->insertItem( tr ( "Papua New Guinea" ) );
388 cmbCountry->insertItem( tr ( "Paraguay" ) ); 388 cmbCountry->insertItem( tr ( "Paraguay" ) );
389 cmbCountry->insertItem( tr ( "Peru" ) ); 389 cmbCountry->insertItem( tr ( "Peru" ) );
390 cmbCountry->insertItem( tr ( "Philippines" ) ); 390 cmbCountry->insertItem( tr ( "Philippines" ) );
391 cmbCountry->insertItem( tr ( "Pitcairn" ) ); 391 cmbCountry->insertItem( tr ( "Pitcairn Islands" ) );
392 cmbCountry->insertItem( tr ( "Poland" ) ); 392 cmbCountry->insertItem( tr ( "Poland" ) );
393 cmbCountry->insertItem( tr ( "Portugal" ) ); 393 cmbCountry->insertItem( tr ( "Portugal" ) );
394 cmbCountry->insertItem( tr ( "Puerto Rico" ) ); 394 cmbCountry->insertItem( tr ( "Puerto Rico" ) );
395 cmbCountry->insertItem( tr ( "Qatar" ) ); 395 cmbCountry->insertItem( tr ( "Qatar" ) );
396 cmbCountry->insertItem( tr ( "Reunion" ) ); 396 cmbCountry->insertItem( tr ( "Reunion" ) );
397 cmbCountry->insertItem( tr ( "Romania" ) ); 397 cmbCountry->insertItem( tr ( "Romania" ) );
398 cmbCountry->insertItem( tr ( "Russia" ) ); 398 cmbCountry->insertItem( tr ( "Russia" ) );
399 cmbCountry->insertItem( tr ( "Rwanda" ) ); 399 cmbCountry->insertItem( tr ( "Rwanda" ) );
400 cmbCountry->insertItem( tr ( "Saint Lucia" ) ); 400 cmbCountry->insertItem( tr ( "Saint Lucia" ) );
401 cmbCountry->insertItem( tr ( "Samoa" ) ); 401 cmbCountry->insertItem( tr ( "Samoa" ) );
402 cmbCountry->insertItem( tr ( "San Marino" ) ); 402 cmbCountry->insertItem( tr ( "San Marino" ) );
403 cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); 403 cmbCountry->insertItem( tr ( "Saudi Arabia" ) );
404 cmbCountry->insertItem( tr ( "Senegal" ) ); 404 cmbCountry->insertItem( tr ( "Senegal" ) );
405 cmbCountry->insertItem( tr ( "Seychelles" ) ); 405 cmbCountry->insertItem( tr ( "Seychelles" ) );
406 cmbCountry->insertItem( tr ( "Sierra Leone" ) ); 406 cmbCountry->insertItem( tr ( "Sierra Leone" ) );
407 cmbCountry->insertItem( tr ( "Singapore" ) ); 407 cmbCountry->insertItem( tr ( "Singapore" ) );
408 cmbCountry->insertItem( tr ( "Slovakia" ) ); 408 cmbCountry->insertItem( tr ( "Slovakia" ) );
409 cmbCountry->insertItem( tr ( "Slovenia" ) ); 409 cmbCountry->insertItem( tr ( "Slovenia" ) );
410 cmbCountry->insertItem( tr ( "Solomon Islands" ) ); 410 cmbCountry->insertItem( tr ( "Solomon Islands" ) );
411 cmbCountry->insertItem( tr ( "Somalia" ) ); 411 cmbCountry->insertItem( tr ( "Somalia" ) );
412 cmbCountry->insertItem( tr ( "South Africa" ) ); 412 cmbCountry->insertItem( tr ( "South Africa" ) );
413 cmbCountry->insertItem( tr ( "Spain" ) ); 413 cmbCountry->insertItem( tr ( "Spain" ) );
414 cmbCountry->insertItem( tr ( "Sri Lanka" ) ); 414 cmbCountry->insertItem( tr ( "Sri Lanka" ) );
415 cmbCountry->insertItem( tr ( "St. Helena" ) ); 415 cmbCountry->insertItem( tr ( "St. Helena" ) );
416 cmbCountry->insertItem( tr ( "Sudan" ) ); 416 cmbCountry->insertItem( tr ( "Sudan" ) );
417 cmbCountry->insertItem( tr ( "Suriname" ) ); 417 cmbCountry->insertItem( tr ( "Suriname" ) );
418 cmbCountry->insertItem( tr ( "Swaziland" ) ); 418 cmbCountry->insertItem( tr ( "Swaziland" ) );
419 cmbCountry->insertItem( tr ( "Sweden" ) ); 419 cmbCountry->insertItem( tr ( "Sweden" ) );
420 cmbCountry->insertItem( tr ( "Switzerland" ) ); 420 cmbCountry->insertItem( tr ( "Switzerland" ) );
421 cmbCountry->insertItem( tr ( "Taiwan" ) ); 421 cmbCountry->insertItem( tr ( "Taiwan" ) );
422 cmbCountry->insertItem( tr ( "Tajikistan" ) ); 422 cmbCountry->insertItem( tr ( "Tajikistan" ) );
423 cmbCountry->insertItem( tr ( "Tanzania" ) ); 423 cmbCountry->insertItem( tr ( "Tanzania" ) );
424 cmbCountry->insertItem( tr ( "Thailand" ) ); 424 cmbCountry->insertItem( tr ( "Thailand" ) );
425 cmbCountry->insertItem( tr ( "Togo" ) ); 425 cmbCountry->insertItem( tr ( "Togo" ) );
426 cmbCountry->insertItem( tr ( "Tokelau" ) ); 426 cmbCountry->insertItem( tr ( "Tokelau" ) );
427 cmbCountry->insertItem( tr ( "Tonga" ) ); 427 cmbCountry->insertItem( tr ( "Tonga" ) );
428 cmbCountry->insertItem( tr ( "Tunisia" ) ); 428 cmbCountry->insertItem( tr ( "Tunisia" ) );
429 cmbCountry->insertItem( tr ( "Turkey" ) ); 429 cmbCountry->insertItem( tr ( "Turkey" ) );
430 cmbCountry->insertItem( tr ( "Turkmenistan" ) ); 430 cmbCountry->insertItem( tr ( "Turkmenistan" ) );
431 cmbCountry->insertItem( tr ( "Tuvalu" ) ); 431 cmbCountry->insertItem( tr ( "Tuvalu" ) );
432 cmbCountry->insertItem( tr ( "Uganda" ) ); 432 cmbCountry->insertItem( tr ( "Uganda" ) );
433 cmbCountry->insertItem( tr ( "Ukraine" ) ); 433 cmbCountry->insertItem( tr ( "Ukraine" ) );
434 cmbCountry->insertItem( tr ( "Uruguay" ) ); 434 cmbCountry->insertItem( tr ( "Uruguay" ) );
435 cmbCountry->insertItem( tr ( "Uzbekistan" ) ); 435 cmbCountry->insertItem( tr ( "Uzbekistan" ) );
436 cmbCountry->insertItem( tr ( "Vanuatu" ) ); 436 cmbCountry->insertItem( tr ( "Vanuatu" ) );
437 cmbCountry->insertItem( tr ( "Venezuela" ) ); 437 cmbCountry->insertItem( tr ( "Venezuela" ) );
438 cmbCountry->insertItem( tr ( "Viet Nam" ) ); 438 cmbCountry->insertItem( tr ( "Vietnam" ) );
439 cmbCountry->insertItem( tr ( "Virgin Islands" ) ); 439 cmbCountry->insertItem( tr ( "Virgin Islands" ) );
440 cmbCountry->insertItem( tr ( "Western Sahara" ) ); 440 cmbCountry->insertItem( tr ( "Western Sahara" ) );
441 cmbCountry->insertItem( tr ( "Yemen" ) ); 441 cmbCountry->insertItem( tr ( "Yemen" ) );
442 cmbCountry->insertItem( tr ( "Yugoslavia" ) ); 442 cmbCountry->insertItem( tr ( "Yugoslavia" ) );
443 cmbCountry->insertItem( tr ( "Zambia" ) ); 443 cmbCountry->insertItem( tr ( "Zambia" ) );
444 cmbCountry->insertItem( tr ( "Zimbabwe" ) ); 444 cmbCountry->insertItem( tr ( "Zimbabwe" ) );
445 if (cmbCountry->listBox()!=0) 445 if (cmbCountry->listBox()!=0)
446 cmbCountry->listBox()->sort(); 446 cmbCountry->listBox()->sort();
447 447
448 cmbCountry->setMaximumWidth( 135 ); 448 cmbCountry->setMaximumWidth( 135 );
449 449
450 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); 450 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 );
451 451
452 cmbChooserField4 = new QComboBox( FALSE, container ); 452 cmbChooserField4 = new QComboBox( FALSE, container );
453 cmbChooserField4->setMaximumWidth( 90 ); 453 cmbChooserField4->setMaximumWidth( 90 );
454 gl->addWidget( cmbChooserField4, 6, 0 ); 454 gl->addWidget( cmbChooserField4, 6, 0 );
455 txtChooserField4 = new QLineEdit( container ); 455 txtChooserField4 = new QLineEdit( container );
456 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); 456 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 );
457 457
458 QSpacerItem *space = new QSpacerItem(1,1, 458 QSpacerItem *space = new QSpacerItem(1,1,
459 QSizePolicy::Maximum, 459 QSizePolicy::Maximum,
460 QSizePolicy::MinimumExpanding ); 460 QSizePolicy::MinimumExpanding );
461 gl->addItem( space, 7, 0 ); 461 gl->addItem( space, 7, 0 );
462 462
463 tabMain->insertTab( tabViewport, tr( "Address" ) ); 463 tabMain->insertTab( tabViewport, tr( "Address" ) );
464 464
465 tabViewport = new QWidget ( tabMain ); 465 tabViewport = new QWidget ( tabMain );
466 466
467 vb = new QVBoxLayout( tabViewport ); 467 vb = new QVBoxLayout( tabViewport );
468 468
469 svDetails = new QScrollView( tabViewport ); 469 svDetails = new QScrollView( tabViewport );
470 vb->addWidget( svDetails, 0, 0 ); 470 vb->addWidget( svDetails, 0, 0 );
471 svDetails->setResizePolicy( QScrollView::AutoOneFit ); 471 svDetails->setResizePolicy( QScrollView::AutoOneFit );
472 svDetails->setFrameStyle( QFrame::NoFrame ); 472 svDetails->setFrameStyle( QFrame::NoFrame );
473 473
474 container = new QWidget( svDetails->viewport() ); 474 container = new QWidget( svDetails->viewport() );
475 svDetails->addChild( container ); 475 svDetails->addChild( container );
476 476
477 gl = new QGridLayout( container, 1, 2, 2, 4 ); 477 gl = new QGridLayout( container, 1, 2, 2, 4 );
478 478
479 int counter = 0; 479 int counter = 0;
480 480
481 // Birthday 481 // Birthday
482 QHBox* hBox = new QHBox( container ); 482 QHBox* hBox = new QHBox( container );
483 l = new QLabel( tr("Birthday"), container ); 483 l = new QLabel( tr("Birthday"), container );
484 gl->addWidget( l, counter, 0 ); 484 gl->addWidget( l, counter, 0 );
485 485
486 QPopupMenu* m1 = new QPopupMenu( container ); 486 QPopupMenu* m1 = new QPopupMenu( container );
487 birthdayPicker = new DateBookMonth( m1, 0, TRUE ); 487 birthdayPicker = new DateBookMonth( m1, 0, TRUE );
488 m1->insertItem( birthdayPicker ); 488 m1->insertItem( birthdayPicker );
489 489
490 birthdayButton= new QToolButton( hBox, "buttonStart" ); 490 birthdayButton= new QToolButton( hBox, "buttonStart" );
491 birthdayButton->setPopup( m1 ); 491 birthdayButton->setPopup( m1 );
492 birthdayButton->setPopupDelay(0); 492 birthdayButton->setPopupDelay(0);
493 493
494 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 494 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
495 tr( "Delete" ), 495 tr( "Delete" ),
496 hBox, 0 ); 496 hBox, 0 );
497 497
498 gl->addWidget( hBox, counter , 1 ); 498 gl->addWidget( hBox, counter , 1 );
499 499
500 connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), 500 connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ),
501 this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); 501 this, SLOT( slotBirthdayDateChanged( int, int, int ) ) );
502 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); 502 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) );
503 503
504 ++counter; 504 ++counter;
505 505
506 // Anniversary 506 // Anniversary
507 hBox = new QHBox( container ); 507 hBox = new QHBox( container );
508 l = new QLabel( tr("Anniversary"), container ); 508 l = new QLabel( tr("Anniversary"), container );
509 gl->addWidget( l, counter, 0 ); 509 gl->addWidget( l, counter, 0 );
510 510
511 m1 = new QPopupMenu( container ); 511 m1 = new QPopupMenu( container );
512 anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); 512 anniversaryPicker = new DateBookMonth( m1, 0, TRUE );
513 m1->insertItem( anniversaryPicker ); 513 m1->insertItem( anniversaryPicker );
514 514
515 anniversaryButton= new QToolButton( hBox, "buttonStart" ); 515 anniversaryButton= new QToolButton( hBox, "buttonStart" );
516 anniversaryButton->setPopup( m1 ); 516 anniversaryButton->setPopup( m1 );
517 anniversaryButton->setPopupDelay(0); 517 anniversaryButton->setPopupDelay(0);
518 518
519 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 519 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
520 tr( "Delete" ), 520 tr( "Delete" ),
521 hBox, 0 ); 521 hBox, 0 );
522 gl->addWidget( hBox, counter , 1 ); 522 gl->addWidget( hBox, counter , 1 );
523 523
524 connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), 524 connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ),
525 this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); 525 this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) );
526 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); 526 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) );
527 527
528 ++counter; 528 ++counter;
529 529
530 // Gender 530 // Gender
531 l = new QLabel( tr("Gender"), container ); 531 l = new QLabel( tr("Gender"), container );
532 gl->addWidget( l, counter, 0 ); 532 gl->addWidget( l, counter, 0 );
533 cmbGender = new QComboBox( container ); 533 cmbGender = new QComboBox( container );
534 cmbGender->insertItem( "", 0 ); 534 cmbGender->insertItem( "", 0 );
535 cmbGender->insertItem( tr("Male"), 1); 535 cmbGender->insertItem( tr("Male"), 1);
536 cmbGender->insertItem( tr("Female"), 2); 536 cmbGender->insertItem( tr("Female"), 2);
537 gl->addWidget( cmbGender, counter, 1 ); 537 gl->addWidget( cmbGender, counter, 1 );
538 538
539 ++counter; 539 ++counter;
540 540
541 // Create Labels and lineedit fields for every dynamic entry 541 // Create Labels and lineedit fields for every dynamic entry
542 QStringList::ConstIterator it = slDynamicEntries.begin(); 542 QStringList::ConstIterator it = slDynamicEntries.begin();
543 QStringList::ConstIterator trit = trlDynamicEntries.begin(); 543 QStringList::ConstIterator trit = trlDynamicEntries.begin();
544 for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) { 544 for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) {
545 545
546 if (((*it) == "Anniversary") || 546 if (((*it) == "Anniversary") ||
547 ((*it) == "Birthday")|| ((*it) == "Gender")) continue; 547 ((*it) == "Birthday")|| ((*it) == "Gender")) continue;
548 548
549 l = new QLabel( (*it).utf8() , container ); 549 l = new QLabel( (*it).utf8() , container );
550 listName.append( l ); 550 listName.append( l );
551 gl->addWidget( l, i, 0 ); 551 gl->addWidget( l, i, 0 );
552 QLineEdit *e = new QLineEdit( container ); 552 QLineEdit *e = new QLineEdit( container );
553 listValue.append( e ); 553 listValue.append( e );
554 gl->addWidget( e, i, 1); 554 gl->addWidget( e, i, 1);
555 } 555 }
556 // Fill labels with names.. 556 // Fill labels with names..
557 //loadFields(); 557 //loadFields();
558 558
559 559
560 tabMain->insertTab( tabViewport, tr( "Details" ) ); 560 tabMain->insertTab( tabViewport, tr( "Details" ) );
561 561
562 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 562 dlgNote = new QDialog( this, "Note Dialog", TRUE );
563 dlgNote->setCaption( tr("Enter Note") ); 563 dlgNote->setCaption( tr("Enter Note") );
564 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 564 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
565 txtNote = new QMultiLineEdit( dlgNote ); 565 txtNote = new QMultiLineEdit( dlgNote );
566 vbNote->addWidget( txtNote ); 566 vbNote->addWidget( txtNote );
567 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 567 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
568 568
569 dlgName = new QDialog( this, "Name Dialog", TRUE ); 569 dlgName = new QDialog( this, "Name Dialog", TRUE );
570 dlgName->setCaption( tr("Edit Name") ); 570 dlgName->setCaption( tr("Edit Name") );
571 gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); 571 gl = new QGridLayout( dlgName, 5, 2, 2, 3 );
572 572
573 l = new QLabel( tr("First Name"), dlgName ); 573 l = new QLabel( tr("First Name"), dlgName );
574 gl->addWidget( l, 0, 0 ); 574 gl->addWidget( l, 0, 0 );
575 txtFirstName = new QLineEdit( dlgName ); 575 txtFirstName = new QLineEdit( dlgName );
576 gl->addWidget( txtFirstName, 0, 1 ); 576 gl->addWidget( txtFirstName, 0, 1 );
577 577
578 l = new QLabel( tr("Middle Name"), dlgName ); 578 l = new QLabel( tr("Middle Name"), dlgName );
579 gl->addWidget( l, 1, 0 ); 579 gl->addWidget( l, 1, 0 );
580 txtMiddleName = new QLineEdit( dlgName ); 580 txtMiddleName = new QLineEdit( dlgName );
581 gl->addWidget( txtMiddleName, 1, 1 ); 581 gl->addWidget( txtMiddleName, 1, 1 );
582 582
583 l = new QLabel( tr("Last Name"), dlgName ); 583 l = new QLabel( tr("Last Name"), dlgName );
584 gl->addWidget( l, 2, 0 ); 584 gl->addWidget( l, 2, 0 );
585 txtLastName = new QLineEdit( dlgName ); 585 txtLastName = new QLineEdit( dlgName );
586 gl->addWidget( txtLastName, 2, 1 ); 586 gl->addWidget( txtLastName, 2, 1 );
587 587
588 l = new QLabel( tr("Suffix"), dlgName ); 588 l = new QLabel( tr("Suffix"), dlgName );
589 gl->addWidget( l, 3, 0 ); 589 gl->addWidget( l, 3, 0 );
590 txtSuffix = new QLineEdit( dlgName ); 590 txtSuffix = new QLineEdit( dlgName );
591 gl->addWidget( txtSuffix, 3, 1 ); 591 gl->addWidget( txtSuffix, 3, 1 );
592 space = new QSpacerItem(1,1, 592 space = new QSpacerItem(1,1,
593 QSizePolicy::Maximum, 593 QSizePolicy::Maximum,
594 QSizePolicy::MinimumExpanding ); 594 QSizePolicy::MinimumExpanding );
595 gl->addItem( space, 4, 0 ); 595 gl->addItem( space, 4, 0 );
596 596
597 cmbChooserField1->insertStringList( trlChooserNames ); 597 cmbChooserField1->insertStringList( trlChooserNames );
598 cmbChooserField2->insertStringList( trlChooserNames ); 598 cmbChooserField2->insertStringList( trlChooserNames );
599 cmbChooserField3->insertStringList( trlChooserNames ); 599 cmbChooserField3->insertStringList( trlChooserNames );
600 cmbChooserField4->insertStringList( trlChooserNames ); 600 cmbChooserField4->insertStringList( trlChooserNames );
601 601
602 cmbChooserField1->setCurrentItem( 0 ); 602 cmbChooserField1->setCurrentItem( 0 );
603 cmbChooserField2->setCurrentItem( 1 ); 603 cmbChooserField2->setCurrentItem( 1 );
604 cmbChooserField3->setCurrentItem( 2 ); 604 cmbChooserField3->setCurrentItem( 2 );
605 605
606 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 606 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
607 607
608 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 608 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
609 609
610 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), 610 connect( txtChooserField1, SIGNAL(textChanged(const QString &)),
611 this, SLOT(slotChooser1Change(const QString &)) ); 611 this, SLOT(slotChooser1Change(const QString &)) );
612 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), 612 connect( txtChooserField2, SIGNAL(textChanged(const QString &)),
613 this, SLOT(slotChooser2Change(const QString &)) ); 613 this, SLOT(slotChooser2Change(const QString &)) );
614 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), 614 connect( txtChooserField3, SIGNAL(textChanged(const QString &)),
615 this, SLOT(slotChooser3Change(const QString &)) ); 615 this, SLOT(slotChooser3Change(const QString &)) );
616 connect( txtChooserField4, SIGNAL(textChanged(const QString &)), 616 connect( txtChooserField4, SIGNAL(textChanged(const QString &)),
617 this, SLOT(slotChooser4Change(const QString &)) ); 617 this, SLOT(slotChooser4Change(const QString &)) );
618 connect( txtAddress, SIGNAL(textChanged(const QString &)), 618 connect( txtAddress, SIGNAL(textChanged(const QString &)),
619 this, SLOT(slotAddressChange(const QString &)) ); 619 this, SLOT(slotAddressChange(const QString &)) );
620 connect( txtCity, SIGNAL(textChanged(const QString &)), 620 connect( txtCity, SIGNAL(textChanged(const QString &)),
621 this, SLOT(slotCityChange(const QString &)) ); 621 this, SLOT(slotCityChange(const QString &)) );
622 connect( txtState, SIGNAL(textChanged(const QString &)), 622 connect( txtState, SIGNAL(textChanged(const QString &)),
623 this, SLOT(slotStateChange(const QString &)) ); 623 this, SLOT(slotStateChange(const QString &)) );
624 connect( txtZip, SIGNAL(textChanged(const QString &)), 624 connect( txtZip, SIGNAL(textChanged(const QString &)),
625 this, SLOT(slotZipChange(const QString &)) ); 625 this, SLOT(slotZipChange(const QString &)) );
626 connect( cmbCountry, SIGNAL(textChanged(const QString &)), 626 connect( cmbCountry, SIGNAL(textChanged(const QString &)),
627 this, SLOT(slotCountryChange(const QString &)) ); 627 this, SLOT(slotCountryChange(const QString &)) );
628 connect( cmbCountry, SIGNAL(activated(const QString &)), 628 connect( cmbCountry, SIGNAL(activated(const QString &)),
629 this, SLOT(slotCountryChange(const QString &)) ); 629 this, SLOT(slotCountryChange(const QString &)) );
630 connect( cmbChooserField1, SIGNAL(activated(int)), 630 connect( cmbChooserField1, SIGNAL(activated(int)),
631 this, SLOT(slotCmbChooser1Change(int)) ); 631 this, SLOT(slotCmbChooser1Change(int)) );
632 connect( cmbChooserField2, SIGNAL(activated(int)), 632 connect( cmbChooserField2, SIGNAL(activated(int)),
633 this, SLOT(slotCmbChooser2Change(int)) ); 633 this, SLOT(slotCmbChooser2Change(int)) );
634 connect( cmbChooserField3, SIGNAL(activated(int)), 634 connect( cmbChooserField3, SIGNAL(activated(int)),
635 this, SLOT(slotCmbChooser3Change(int)) ); 635 this, SLOT(slotCmbChooser3Change(int)) );
636 connect( cmbChooserField4, SIGNAL(activated(int)), 636 connect( cmbChooserField4, SIGNAL(activated(int)),
637 this, SLOT(slotCmbChooser4Change(int)) ); 637 this, SLOT(slotCmbChooser4Change(int)) );
638 connect( cmbAddress, SIGNAL(activated(int)), 638 connect( cmbAddress, SIGNAL(activated(int)),
639 this, SLOT(slotAddressTypeChange(int)) ); 639 this, SLOT(slotAddressTypeChange(int)) );
640 640
641 new QPEDialogListener(this); 641 new QPEDialogListener(this);
642 642
643 setPersonalView ( m_personalView ); 643 setPersonalView ( m_personalView );
644} 644}
645 645
646void ContactEditor::defaultEmailChanged(int i){ 646void ContactEditor::defaultEmailChanged(int i){
647 qDebug("defaultEmailChanged"); 647 qDebug("defaultEmailChanged");
648 int index = cmbChooserField1->currentItem(); 648 int index = cmbChooserField1->currentItem();
649 slChooserValues[index] = cmbDefaultEmail->text(i); 649 slChooserValues[index] = cmbDefaultEmail->text(i);
650 650
651} 651}
652 652
653void ContactEditor::populateDefaultEmailCmb(){ 653void ContactEditor::populateDefaultEmailCmb(){
654 cmbDefaultEmail->clear(); 654 cmbDefaultEmail->clear();
655 cmbDefaultEmail->insertStringList(emails); 655 cmbDefaultEmail->insertStringList(emails);
656 for ( int i = 0; i < cmbDefaultEmail->count(); i++){ 656 for ( int i = 0; i < cmbDefaultEmail->count(); i++){
657 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",cmbDefaultEmail->text( i ).latin1(),defaultEmail.latin1()); 657 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",cmbDefaultEmail->text( i ).latin1(),defaultEmail.latin1());
658 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ 658 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){
659 cmbDefaultEmail->setCurrentItem( i ); 659 cmbDefaultEmail->setCurrentItem( i );
660 qDebug("set"); 660 qDebug("set");
661 } 661 }
662 } 662 }
663} 663}
664 664
665void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) { 665void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) {
666 QString type = slChooserNames[index]; 666 QString type = slChooserNames[index];
667 qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i",type.latin1(),textChanged.latin1(), index, widgetPos ); 667 qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i",type.latin1(),textChanged.latin1(), index, widgetPos );
668 if ( type == "Default Email"){ 668 if ( type == "Default Email"){
669 defaultEmail = textChanged; 669 defaultEmail = textChanged;
670 if (cmbDefaultEmail){ 670 if (cmbDefaultEmail){
671 delete cmbDefaultEmail; 671 delete cmbDefaultEmail;
672 cmbDefaultEmail = 0l; 672 cmbDefaultEmail = 0l;
673 } 673 }
674 cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); 674 cmbDefaultEmail = new QComboBox(inputWid->parentWidget());
675 cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); 675 cmbDefaultEmail->setGeometry(inputWid->frameGeometry());
676 cmbDefaultEmail->show(); 676 cmbDefaultEmail->show();
677 populateDefaultEmailCmb(); 677 populateDefaultEmailCmb();
678 connect(cmbDefaultEmail,SIGNAL(activated(int)), 678 connect(cmbDefaultEmail,SIGNAL(activated(int)),
679 SLOT(defaultEmailChanged(int))); 679 SLOT(defaultEmailChanged(int)));
680 defaultEmailChooserPosition = widgetPos; 680 defaultEmailChooserPosition = widgetPos;
681 }else if (defaultEmailChooserPosition == widgetPos){ 681 }else if (defaultEmailChooserPosition == widgetPos){
682 qDebug("cmbDefaultEmail->hide()"); 682 qDebug("cmbDefaultEmail->hide()");
683 if (cmbDefaultEmail) cmbDefaultEmail->hide(); 683 if (cmbDefaultEmail) cmbDefaultEmail->hide();
684 widgetPos=-1; 684 widgetPos=-1;
685 }else if (type == "Emails"){ 685 }else if (type == "Emails"){
686 qDebug("emails"); 686 qDebug("emails");
687 QString de; 687 QString de;
688 emails = QStringList::split (",", textChanged ); 688 emails = QStringList::split (",", textChanged );
689 689
690 if ( cmbDefaultEmail ) 690 if ( cmbDefaultEmail )
691 populateDefaultEmailCmb(); 691 populateDefaultEmailCmb();
692 } 692 }
693 693
694 694
695 695
696 slChooserValues[index] = textChanged; 696 slChooserValues[index] = textChanged;
697 697
698} 698}
699 699
700void ContactEditor::slotChooser1Change( const QString &textChanged ) { 700void ContactEditor::slotChooser1Change( const QString &textChanged ) {
701 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); 701 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1);
702} 702}
703 703
704void ContactEditor::slotChooser2Change( const QString &textChanged ) { 704void ContactEditor::slotChooser2Change( const QString &textChanged ) {
705 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); 705 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2);
706 706
707} 707}
708 708
709void ContactEditor::slotChooser3Change( const QString &textChanged ) { 709void ContactEditor::slotChooser3Change( const QString &textChanged ) {
710 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); 710 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3);
711} 711}
712 712
713void ContactEditor::slotChooser4Change( const QString &textChanged ) { 713void ContactEditor::slotChooser4Change( const QString &textChanged ) {
714 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); 714 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4);
715} 715}
716 716
717void ContactEditor::slotAddressChange( const QString &textChanged ) { 717void ContactEditor::slotAddressChange( const QString &textChanged ) {
718 718
719 if ( cmbAddress->currentItem() == 0 ) { 719 if ( cmbAddress->currentItem() == 0 ) {
720 slBusinessAddress[0] = textChanged; 720 slBusinessAddress[0] = textChanged;
721 } else { 721 } else {
722 slHomeAddress[0] = textChanged; 722 slHomeAddress[0] = textChanged;
723 } 723 }
724} 724}
725 725
726void ContactEditor::slotAddress2Change( const QString &textChanged ) { 726void ContactEditor::slotAddress2Change( const QString &textChanged ) {
727 727
728 if ( cmbAddress->currentItem() == 0 ) { 728 if ( cmbAddress->currentItem() == 0 ) {
729 slBusinessAddress[1] = textChanged; 729 slBusinessAddress[1] = textChanged;
730 } else { 730 } else {
731 slHomeAddress[1] = textChanged; 731 slHomeAddress[1] = textChanged;
732 } 732 }
733} 733}
734 734
735void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 735void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
736 736
737 if ( cmbAddress->currentItem() == 0 ) { 737 if ( cmbAddress->currentItem() == 0 ) {
738 slBusinessAddress[2] = textChanged; 738 slBusinessAddress[2] = textChanged;
739 } else { 739 } else {
740 slHomeAddress[2] = textChanged; 740 slHomeAddress[2] = textChanged;
741 } 741 }
742} 742}
743 743
744void ContactEditor::slotCityChange( const QString &textChanged ) { 744void ContactEditor::slotCityChange( const QString &textChanged ) {
745 745
746 if ( cmbAddress->currentItem() == 0 ) { 746 if ( cmbAddress->currentItem() == 0 ) {
747 slBusinessAddress[3] = textChanged; 747 slBusinessAddress[3] = textChanged;
748 } else { 748 } else {
749 slHomeAddress[3] = textChanged; 749 slHomeAddress[3] = textChanged;
750 } 750 }
751} 751}
752 752
753void ContactEditor::slotStateChange( const QString &textChanged ) { 753void ContactEditor::slotStateChange( const QString &textChanged ) {
754 754
755 755
756 if ( cmbAddress->currentItem() == 0 ) { 756 if ( cmbAddress->currentItem() == 0 ) {
757 slBusinessAddress[4] = textChanged; 757 slBusinessAddress[4] = textChanged;
758 } else { 758 } else {
759 slHomeAddress[4] = textChanged; 759 slHomeAddress[4] = textChanged;
760 } 760 }
761} 761}
762 762
763void ContactEditor::slotZipChange( const QString &textChanged ) { 763void ContactEditor::slotZipChange( const QString &textChanged ) {
764 764
765 if ( cmbAddress->currentItem() == 0 ) { 765 if ( cmbAddress->currentItem() == 0 ) {
766 slBusinessAddress[5] = textChanged; 766 slBusinessAddress[5] = textChanged;
767 } else { 767 } else {
768 slHomeAddress[5] = textChanged; 768 slHomeAddress[5] = textChanged;
769 } 769 }
770} 770}
771 771
772void ContactEditor::slotCountryChange( const QString &textChanged ) { 772void ContactEditor::slotCountryChange( const QString &textChanged ) {
773 773
774 if ( cmbAddress->currentItem() == 0 ) { 774 if ( cmbAddress->currentItem() == 0 ) {
775 slBusinessAddress[6] = textChanged; 775 slBusinessAddress[6] = textChanged;
776 } else { 776 } else {
777 slHomeAddress[6] = textChanged; 777 slHomeAddress[6] = textChanged;
778 } 778 }
779} 779}
780 780
781 781
782void ContactEditor::slotCmbChooser1Change( int index ) { 782void ContactEditor::slotCmbChooser1Change( int index ) {
783 783
784 txtChooserField1->setText( slChooserValues[index] ); 784 txtChooserField1->setText( slChooserValues[index] );
785 txtChooserField1->setFocus(); 785 txtChooserField1->setFocus();
786} 786}
787 787
788void ContactEditor::slotCmbChooser2Change( int index ) { 788void ContactEditor::slotCmbChooser2Change( int index ) {
789 789
790 txtChooserField2->setText( slChooserValues[index] ); 790 txtChooserField2->setText( slChooserValues[index] );
791 txtChooserField2->setFocus(); 791 txtChooserField2->setFocus();
792} 792}
793 793
794void ContactEditor::slotCmbChooser3Change( int index ) { 794void ContactEditor::slotCmbChooser3Change( int index ) {
795 795
796 txtChooserField3->setText( slChooserValues[index] ); 796 txtChooserField3->setText( slChooserValues[index] );
797 txtChooserField3->setFocus(); 797 txtChooserField3->setFocus();
798 798
799} 799}
800 800
801void ContactEditor::slotCmbChooser4Change( int index ) { 801void ContactEditor::slotCmbChooser4Change( int index ) {
802 802
803 txtChooserField4->setText( slChooserValues[index] ); 803 txtChooserField4->setText( slChooserValues[index] );
804 txtChooserField4->setFocus(); 804 txtChooserField4->setFocus();
805 805
806} 806}
807 807
808void ContactEditor::slotAddressTypeChange( int index ) { 808void ContactEditor::slotAddressTypeChange( int index ) {
809 809
810 if ( index == 0 ) { 810 if ( index == 0 ) {
811 811
812 txtAddress->setText( slBusinessAddress[0] ); 812 txtAddress->setText( slBusinessAddress[0] );
813 //txtAddress2->setText( (*slBusinessAddress)[1] ); 813 //txtAddress2->setText( (*slBusinessAddress)[1] );
814 //txtPOBox->setText( (*slBusinessAddress)[2] ); 814 //txtPOBox->setText( (*slBusinessAddress)[2] );
815 txtCity->setText( slBusinessAddress[3] ); 815 txtCity->setText( slBusinessAddress[3] );
816 txtState->setText( slBusinessAddress[4] ); 816 txtState->setText( slBusinessAddress[4] );
817 txtZip->setText( slBusinessAddress[5] ); 817 txtZip->setText( slBusinessAddress[5] );
818 QLineEdit *txtTmp = cmbCountry->lineEdit(); 818 QLineEdit *txtTmp = cmbCountry->lineEdit();
819 txtTmp->setText( slBusinessAddress[6] ); 819 txtTmp->setText( slBusinessAddress[6] );
820 820
821 } else { 821 } else {
822 822
823 txtAddress->setText( slHomeAddress[0] ); 823 txtAddress->setText( slHomeAddress[0] );
824 //txtAddress2->setText( (*slHomeAddress)[1] ); 824 //txtAddress2->setText( (*slHomeAddress)[1] );
825 //txtPOBox->setText( (*slHomeAddress)[2] ); 825 //txtPOBox->setText( (*slHomeAddress)[2] );
826 txtCity->setText( slHomeAddress[3] ); 826 txtCity->setText( slHomeAddress[3] );
827 txtState->setText( slHomeAddress[4] ); 827 txtState->setText( slHomeAddress[4] );
828 txtZip->setText( slHomeAddress[5] ); 828 txtZip->setText( slHomeAddress[5] );
829 QLineEdit *txtTmp = cmbCountry->lineEdit(); 829 QLineEdit *txtTmp = cmbCountry->lineEdit();
830 txtTmp->setText( slHomeAddress[6] ); 830 txtTmp->setText( slHomeAddress[6] );
831 831
832 } 832 }
833 833
834} 834}
835 835
836void ContactEditor::slotFullNameChange( const QString &textChanged ) { 836void ContactEditor::slotFullNameChange( const QString &textChanged ) {
837 837
838 int index = cmbFileAs->currentItem(); 838 int index = cmbFileAs->currentItem();
839 839
840 cmbFileAs->clear(); 840 cmbFileAs->clear();
841 841
842 cmbFileAs->insertItem( parseName( textChanged, 0 ) ); 842 cmbFileAs->insertItem( parseName( textChanged, 0 ) );
843 cmbFileAs->insertItem( parseName( textChanged, 1 ) ); 843 cmbFileAs->insertItem( parseName( textChanged, 1 ) );
844 cmbFileAs->insertItem( parseName( textChanged, 2 ) ); 844 cmbFileAs->insertItem( parseName( textChanged, 2 ) );
845 cmbFileAs->insertItem( parseName( textChanged, 3 ) ); 845 cmbFileAs->insertItem( parseName( textChanged, 3 ) );
846 846
847 cmbFileAs->setCurrentItem( index ); 847 cmbFileAs->setCurrentItem( index );
848 848
849 useFullName = true; 849 useFullName = true;
850 850
851} 851}
852 852
853void ContactEditor::accept() { 853void ContactEditor::accept() {
854 854
855 if ( isEmpty() ) { 855 if ( isEmpty() ) {
856 cleanupFields(); 856 cleanupFields();
857 reject(); 857 reject();
858 } else { 858 } else {
859 saveEntry(); 859 saveEntry();
860 cleanupFields(); 860 cleanupFields();
861 QDialog::accept(); 861 QDialog::accept();
862 } 862 }
863 863
864} 864}
865 865
866void ContactEditor::slotNote() { 866void ContactEditor::slotNote() {
867 867
868 dlgNote->showMaximized(); 868 dlgNote->showMaximized();
869 if ( !dlgNote->exec() ) { 869 if ( !dlgNote->exec() ) {
870 txtNote->setText( ent.notes() ); 870 txtNote->setText( ent.notes() );
871 } 871 }
872} 872}
873 873
874void ContactEditor::slotName() { 874void ContactEditor::slotName() {
875 875
876 QString tmpName; 876 QString tmpName;
877 if (useFullName) { 877 if (useFullName) {
878 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); 878 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
879 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); 879 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
880 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 880 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
881 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 881 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
882 } 882 }
883 dlgName->showMaximized(); 883 dlgName->showMaximized();
884 if ( dlgName->exec() ) { 884 if ( dlgName->exec() ) {
885 885
886 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); 886 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text();
887 txtFullName->setText( tmpName.simplifyWhiteSpace() ); 887 txtFullName->setText( tmpName.simplifyWhiteSpace() );
888 slotFullNameChange( txtFullName->text() ); 888 slotFullNameChange( txtFullName->text() );
889 useFullName = false; 889 useFullName = false;
890 } 890 }
891 891
892} 892}
893 893
894void ContactEditor::setNameFocus() { 894void ContactEditor::setNameFocus() {
895 895
896 txtFullName->setFocus(); 896 txtFullName->setFocus();
897 897
898} 898}
899 899
900bool ContactEditor::isEmpty() { 900bool ContactEditor::isEmpty() {
901 // Test and see if the record should be saved. 901 // Test and see if the record should be saved.
902 // More strict than the original qtopia, needs name or fileas to save 902 // More strict than the original qtopia, needs name or fileas to save
903 903
904 QString t = txtFullName->text(); 904 QString t = txtFullName->text();
905 if ( !t.isEmpty() && containsAlphaNum( t ) ) 905 if ( !t.isEmpty() && containsAlphaNum( t ) )
906 return false; 906 return false;
907 907
908 t = cmbFileAs->currentText(); 908 t = cmbFileAs->currentText();
909 if ( !t.isEmpty() && containsAlphaNum( t ) ) 909 if ( !t.isEmpty() && containsAlphaNum( t ) )
910 return false; 910 return false;
911 911
912 return true; 912 return true;
913 913
914} 914}
915 915
916QString ContactEditor::parseName( const QString fullName, int type ) { 916QString ContactEditor::parseName( const QString fullName, int type ) {
917 917
918 QString simplifiedName( fullName.simplifyWhiteSpace() ); 918 QString simplifiedName( fullName.simplifyWhiteSpace() );
919 QString strFirstName; 919 QString strFirstName;
920 QString strMiddleName; 920 QString strMiddleName;
921 QString strLastName; 921 QString strLastName;
922 QString strSuffix; 922 QString strSuffix;
923 QString strTitle; 923 QString strTitle;
924 int commapos; 924 int commapos;
925 int spCount; 925 int spCount;
926 int spPos; 926 int spPos;
927 int spPos2; 927 int spPos2;
928 928
929 929
930 commapos = simplifiedName.find( ',', 0, TRUE); 930 commapos = simplifiedName.find( ',', 0, TRUE);
931 spCount = simplifiedName.contains( ' ', TRUE ); 931 spCount = simplifiedName.contains( ' ', TRUE );
932 932
933 if ( commapos == -1 ) { 933 if ( commapos == -1 ) {
934 934
935 switch (spCount) { 935 switch (spCount) {
936 case 0: 936 case 0:
937 //return simplifiedName; 937 //return simplifiedName;
938 if (txtLastName->text() != "") { 938 if (txtLastName->text() != "") {
939 strLastName = simplifiedName; 939 strLastName = simplifiedName;
940 break; 940 break;
941 } 941 }
942 if (txtMiddleName->text() != "") { 942 if (txtMiddleName->text() != "") {
943 strMiddleName = simplifiedName; 943 strMiddleName = simplifiedName;
944 break; 944 break;
945 } 945 }
946 if (txtSuffix->text() != "") { 946 if (txtSuffix->text() != "") {
947 strSuffix = simplifiedName; 947 strSuffix = simplifiedName;
948 break; 948 break;
949 } 949 }
950 strFirstName = simplifiedName; 950 strFirstName = simplifiedName;