summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 7c52ef2..75e539a 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -169,384 +169,396 @@ void AddressbookWindow::slotSetFont( int size )
169 case 1: 169 case 1:
170 m_abView->setFont( *defaultFont ); 170 m_abView->setFont( *defaultFont );
171 currentFont = new QFont (m_abView->font()); 171 currentFont = new QFont (m_abView->font());
172 // // abList->resizeRows(currentFont->pixelSize() + 7); 172 // // abList->resizeRows(currentFont->pixelSize() + 7);
173 // abList->resizeRows(); 173 // abList->resizeRows();
174 break; 174 break;
175 case 2: 175 case 2:
176 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); 176 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) );
177 currentFont = new QFont (m_abView->font()); 177 currentFont = new QFont (m_abView->font());
178 // //abList->resizeRows(currentFont->pixelSize() + 7); 178 // //abList->resizeRows(currentFont->pixelSize() + 7);
179 // abList->resizeRows(); 179 // abList->resizeRows();
180 break; 180 break;
181 } 181 }
182} 182}
183 183
184 184
185 185
186void AddressbookWindow::importvCard() { 186void AddressbookWindow::importvCard() {
187 QString str = Opie::Ui::OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); 187 QString str = Opie::Ui::OFileDialog::getOpenFileName( 1,"/");//,"", "*", this );
188 if(!str.isEmpty() ){ 188 if(!str.isEmpty() ){
189 setDocument((const QString&) str ); 189 setDocument((const QString&) str );
190 } 190 }
191 191
192} 192}
193void AddressbookWindow::exportvCard() 193void AddressbookWindow::exportvCard()
194{ 194{
195 odebug << "void AddressbookWindow::exportvCard()" << oendl; 195 odebug << "void AddressbookWindow::exportvCard()" << oendl;
196 QString filename = Opie::Ui::OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this ); 196 QString filename = Opie::Ui::OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this );
197 if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){ 197 if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){
198 odebug << " Save to file " << filename << ", (" << filename.length()-1 << ")" << oendl; 198 odebug << " Save to file " << filename << ", (" << filename.length()-1 << ")" << oendl;
199 Opie::OPimContact curCont = m_abView->currentEntry(); 199 Opie::OPimContact curCont = m_abView->currentEntry();
200 if ( !curCont.isEmpty() ){ 200 if ( !curCont.isEmpty() ){
201 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 201 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
202 filename ); 202 filename );
203 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook_exp", QString::null , vcard_backend, true ); 203 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook_exp", QString::null , vcard_backend, true );
204 if ( access ){ 204 if ( access ){
205 access->add( curCont ); 205 access->add( curCont );
206 access->save(); 206 access->save();
207 } 207 }
208 delete access; 208 delete access;
209 }else 209 }else
210 QMessageBox::critical( 0, "Export VCard", 210 QMessageBox::critical( 0, "Export VCard",
211 QString( tr( "You have to select a contact !") ) ); 211 QString( tr( "You have to select a contact !") ) );
212 212
213 }else 213 }else
214 QMessageBox::critical( 0, "Export VCard", 214 QMessageBox::critical( 0, "Export VCard",
215 QString( tr( "You have to set a filename !") ) ); 215 QString( tr( "You have to set a filename !") ) );
216} 216}
217 217
218void AddressbookWindow::setDocument( const QString &filename ) 218void AddressbookWindow::setDocument( const QString &filename )
219{ 219{
220 odebug << "void AddressbookWindow::setDocument( " << filename << " )" << oendl; 220 odebug << "void AddressbookWindow::setDocument( " << filename << " )" << oendl;
221 221
222 // Switch to default backend. This should avoid to import into 222 // Switch to default backend. This should avoid to import into
223 // the personal database accidently. 223 // the personal database accidently.
224 if ( m_actionPersonal->isOn() ){ 224 if ( m_actionPersonal->isOn() ){
225 m_actionPersonal->setOn( false ); 225 m_actionPersonal->setOn( false );
226 slotPersonalView(); 226 slotPersonalView();
227 } 227 }
228 228
229 if ( filename.find(".vcf") != int(filename.length()) - 4 ){ 229 if ( filename.find(".vcf") != int(filename.length()) - 4 ){
230 230
231 231
232 232
233 switch( QMessageBox::information( this, tr ( "Right file type ?" ), 233 switch( QMessageBox::information( this, tr ( "Right file type ?" ),
234 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), 234 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ),
235 tr( "&Yes" ), tr( "&No" ), QString::null, 235 tr( "&Yes" ), tr( "&No" ), QString::null,
236 0, // Enter == button 0 236 0, // Enter == button 0
237 2 ) ) { // Escape == button 2 237 2 ) ) { // Escape == button 2
238 case 0: 238 case 0:
239 odebug << "YES clicked" << oendl; 239 odebug << "YES clicked" << oendl;
240 break; 240 break;
241 case 1: 241 case 1:
242 odebug << "NO clicked" << oendl; 242 odebug << "NO clicked" << oendl;
243 return; 243 return;
244 break; 244 break;
245 } 245 }
246 } 246 }
247 247
248 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 248 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
249 filename ); 249 filename );
250 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 250 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
251 Opie::OPimContactAccess::List allList = access->allRecords(); 251 Opie::OPimContactAccess::List allList = access->allRecords();
252 odebug << "Found number of contacts in File: " << allList.count() << oendl; 252 odebug << "Found number of contacts in File: " << allList.count() << oendl;
253 253
254 if ( !allList.count() ) { 254 if ( !allList.count() ) {
255 QMessageBox::information( this, "Import VCard", 255 QMessageBox::information( this, "Import VCard",
256 "It was impossible to import\nthe VCard.\n" 256 "It was impossible to import\nthe VCard.\n"
257 "The VCard may be corrupted!" ); 257 "The VCard may be corrupted!" );
258 } 258 }
259 259
260 bool doAsk = true; 260 bool doAsk = true;
261 Opie::OPimContactAccess::List::Iterator it; 261 Opie::OPimContactAccess::List::Iterator it;
262 for ( it = allList.begin(); it != allList.end(); ++it ){ 262 for ( it = allList.begin(); it != allList.end(); ++it ){
263 odebug << "Adding Contact from: " << (*it).fullName() << oendl; 263 odebug << "Adding Contact from: " << (*it).fullName() << oendl;
264 if ( doAsk ){ 264 if ( doAsk ){
265 switch( QMessageBox::information( this, tr ( "Add Contact?" ), 265 switch( QMessageBox::information( this, tr ( "Add Contact?" ),
266 tr( "Do you really want add contact for \n%1?" ) 266 tr( "Do you really want add contact for \n%1?" )
267 .arg( (*it).fullName().latin1() ), 267 .arg( (*it).fullName().latin1() ),
268 tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), 268 tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"),
269 0, // Enter == button 0 269 0, // Enter == button 0
270 2 ) ) { // Escape == button 2 270 2 ) ) { // Escape == button 2
271 case 0: 271 case 0:
272 odebug << "YES clicked" << oendl; 272 odebug << "YES clicked" << oendl;
273 m_abView->addEntry( *it ); 273 m_abView->addEntry( *it );
274 break; 274 break;
275 case 1: 275 case 1:
276 odebug << "NO clicked" << oendl; 276 odebug << "NO clicked" << oendl;
277 break; 277 break;
278 case 2: 278 case 2:
279 odebug << "YesAll clicked" << oendl; 279 odebug << "YesAll clicked" << oendl;
280 doAsk = false; 280 doAsk = false;
281 break; 281 break;
282 } 282 }
283 }else 283 }else
284 m_abView->addEntry( *it ); 284 m_abView->addEntry( *it );
285 285
286 } 286 }
287 287
288 delete access; 288 delete access;
289} 289}
290 290
291void AddressbookWindow::resizeEvent( QResizeEvent *e ) 291void AddressbookWindow::resizeEvent( QResizeEvent *e )
292{ 292{
293 QMainWindow::resizeEvent( e ); 293 QMainWindow::resizeEvent( e );
294 294
295 295
296} 296}
297 297
298AddressbookWindow::~AddressbookWindow() 298AddressbookWindow::~AddressbookWindow()
299{ 299{
300 ToolBarDock dock; 300 ToolBarDock dock;
301 int dummy; 301 int dummy;
302 bool bDummy; 302 bool bDummy;
303 getLocation ( listTools, dock, dummy, bDummy, dummy ); 303 getLocation ( listTools, dock, dummy, bDummy, dummy );
304 m_config.setToolBarDock( dock ); 304 m_config.setToolBarDock( dock );
305 m_config.save(); 305 m_config.save();
306} 306}
307 307
308int AddressbookWindow::create() 308int AddressbookWindow::create()
309{ 309{
310 return 0; 310 return 0;
311} 311}
312 312
313bool AddressbookWindow::remove( int /*uid*/ ) 313bool AddressbookWindow::remove( int /*uid*/ )
314{ 314{
315 return false; 315 return false;
316} 316}
317 317
318void AddressbookWindow::beam( int /*uid*/ ) 318void AddressbookWindow::beam( int /*uid*/ )
319{ 319{
320} 320}
321 321
322void AddressbookWindow::show( int /*uid*/ ) 322void AddressbookWindow::show( int /*uid*/ )
323{ 323{
324} 324}
325 325
326void AddressbookWindow::edit( int /*uid*/ ) 326void AddressbookWindow::edit( int /*uid*/ )
327{ 327{
328} 328}
329 329
330void AddressbookWindow::add( const Opie::OPimRecord& ) 330void AddressbookWindow::add( const Opie::OPimRecord& )
331{ 331{
332} 332}
333 333
334void AddressbookWindow::slotItemNew() 334void AddressbookWindow::slotItemNew()
335{ 335{
336 Opie::OPimContact cnt; 336 Opie::OPimContact cnt;
337 if( !syncing ) { 337 if( !syncing ) {
338 editEntry( NewEntry ); 338 editEntry( NewEntry );
339 } else { 339 } else {
340 QMessageBox::warning(this, tr("Contacts"), 340 QMessageBox::warning(this, tr("Contacts"),
341 tr("Can not edit data, currently syncing")); 341 tr("Can not edit data, currently syncing"));
342 } 342 }
343} 343}
344 344
345void AddressbookWindow::slotItemEdit() 345void AddressbookWindow::slotItemEdit()
346{ 346{
347 if(!syncing) { 347 if(!syncing) {
348 if (m_actionPersonal->isOn()) { 348 if (m_actionPersonal->isOn()) {
349 editPersonal(); 349 editPersonal();
350 } else { 350 } else {
351 editEntry( EditEntry ); 351 editEntry( EditEntry );
352 } 352 }
353 } else { 353 } else {
354 QMessageBox::warning( this, tr("Contacts"), 354 QMessageBox::warning( this, tr("Contacts"),
355 tr("Can not edit data, currently syncing") ); 355 tr("Can not edit data, currently syncing") );
356 } 356 }
357} 357}
358 358
359void AddressbookWindow::slotItemDuplicate() 359void AddressbookWindow::slotItemDuplicate()
360{ 360{
361 if(!syncing)
362 {
363 Opie::OPimContact entry = m_abView->currentEntry();
364 entry.assignUid();
365 m_abView->addEntry( entry );
366 m_abView->setCurrentUid( entry.uid() );
367 }
368 else
369 {
370 QMessageBox::warning( this, tr("Contacts"),
371 tr("Can not edit data, currently syncing") );
372 }
361} 373}
362 374
363void AddressbookWindow::slotItemDelete() 375void AddressbookWindow::slotItemDelete()
364{ 376{
365 if(!syncing) { 377 if(!syncing) {
366 Opie::OPimContact tmpEntry = m_abView ->currentEntry(); 378 Opie::OPimContact tmpEntry = m_abView ->currentEntry();
367 379
368 // get a name, do the best we can... 380 // get a name, do the best we can...
369 QString strName = tmpEntry.fullName(); 381 QString strName = tmpEntry.fullName();
370 if ( strName.isEmpty() ) { 382 if ( strName.isEmpty() ) {
371 strName = tmpEntry.company(); 383 strName = tmpEntry.company();
372 if ( strName.isEmpty() ) 384 if ( strName.isEmpty() )
373 strName = "No Name"; 385 strName = "No Name";
374 } 386 }
375 387
376 388
377 if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), 389 if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ),
378 strName ) ) { 390 strName ) ) {
379 m_abView->removeEntry( tmpEntry.uid() ); 391 m_abView->removeEntry( tmpEntry.uid() );
380 } 392 }
381 } else { 393 } else {
382 QMessageBox::warning( this, tr("Contacts"), 394 QMessageBox::warning( this, tr("Contacts"),
383 tr("Can not edit data, currently syncing") ); 395 tr("Can not edit data, currently syncing") );
384 } 396 }
385} 397}
386 398
387static const char * beamfile = "/tmp/obex/contact.vcf"; 399static const char * beamfile = "/tmp/obex/contact.vcf";
388 400
389void AddressbookWindow::slotItemBeam() 401void AddressbookWindow::slotItemBeam()
390{ 402{
391 QString beamFilename; 403 QString beamFilename;
392 Opie::OPimContact c; 404 Opie::OPimContact c;
393 if ( m_actionPersonal->isOn() ) { 405 if ( m_actionPersonal->isOn() ) {
394 beamFilename = addressbookPersonalVCardName(); 406 beamFilename = addressbookPersonalVCardName();
395 if ( !QFile::exists( beamFilename ) ) 407 if ( !QFile::exists( beamFilename ) )
396 return; // can't beam a non-existent file 408 return; // can't beam a non-existent file
397 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 409 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
398 beamFilename ); 410 beamFilename );
399 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 411 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
400 Opie::OPimContactAccess::List allList = access->allRecords(); 412 Opie::OPimContactAccess::List allList = access->allRecords();
401 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first 413 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
402 c = *it; 414 c = *it;
403 415
404 delete access; 416 delete access;
405 } else { 417 } else {
406 unlink( beamfile ); // delete if exists 418 unlink( beamfile ); // delete if exists
407 mkdir("/tmp/obex/", 0755); 419 mkdir("/tmp/obex/", 0755);
408 c = m_abView -> currentEntry(); 420 c = m_abView -> currentEntry();
409 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 421 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
410 beamfile ); 422 beamfile );
411 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 423 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
412 access->add( c ); 424 access->add( c );
413 access->save(); 425 access->save();
414 delete access; 426 delete access;
415 427
416 beamFilename = beamfile; 428 beamFilename = beamfile;
417 } 429 }
418 430
419 odebug << "Beaming: " << beamFilename << oendl; 431 odebug << "Beaming: " << beamFilename << oendl;
420 432
421 Ir *ir = new Ir( this ); 433 Ir *ir = new Ir( this );
422 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 434 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
423 QString description = c.fullName(); 435 QString description = c.fullName();
424 ir->send( beamFilename, description, "text/x-vCard" ); 436 ir->send( beamFilename, description, "text/x-vCard" );
425} 437}
426 438
427void AddressbookWindow::slotItemFind() 439void AddressbookWindow::slotItemFind()
428{ 440{
429} 441}
430 442
431void AddressbookWindow::slotConfigure() 443void AddressbookWindow::slotConfigure()
432{ 444{
433 ConfigDlg* dlg = new ConfigDlg( this, "Config" ); 445 ConfigDlg* dlg = new ConfigDlg( this, "Config" );
434 dlg -> setConfig( m_config ); 446 dlg -> setConfig( m_config );
435 if ( QPEApplication::execDialog( dlg ) ) { 447 if ( QPEApplication::execDialog( dlg ) ) {
436 odebug << "Config Dialog accepted!" << oendl; 448 odebug << "Config Dialog accepted!" << oendl;
437 m_config = dlg -> getConfig(); 449 m_config = dlg -> getConfig();
438 if ( m_curFontSize != m_config.fontSize() ){ 450 if ( m_curFontSize != m_config.fontSize() ){
439 odebug << "Font was changed!" << oendl; 451 odebug << "Font was changed!" << oendl;
440 m_curFontSize = m_config.fontSize(); 452 m_curFontSize = m_config.fontSize();
441 emit slotSetFont( m_curFontSize ); 453 emit slotSetFont( m_curFontSize );
442 } 454 }
443 m_abView -> setListOrder( m_config.orderList() ); 455 m_abView -> setListOrder( m_config.orderList() );
444 } 456 }
445 457
446 delete dlg; 458 delete dlg;
447} 459}
448 460
449void AddressbookWindow::slotShowFind( bool show ) 461void AddressbookWindow::slotShowFind( bool show )
450{ 462{
451 if ( show ) 463 if ( show )
452 { 464 {
453 // Display search bar 465 // Display search bar
454 m_searchBar->show(); 466 m_searchBar->show();
455 m_abView -> inSearch(); 467 m_abView -> inSearch();
456 m_searchEdit->setFocus(); 468 m_searchEdit->setFocus();
457 } 469 }
458 else 470 else
459 { 471 {
460 // Hide search bar 472 // Hide search bar
461 m_searchBar->hide(); 473 m_searchBar->hide();
462 m_abView -> offSearch(); 474 m_abView -> offSearch();
463 } 475 }
464} 476}
465 477
466void AddressbookWindow::slotFind() 478void AddressbookWindow::slotFind()
467{ 479{
468 m_abView->slotDoFind( m_searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); 480 m_abView->slotDoFind( m_searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false);
469 481
470 m_searchEdit->clearFocus(); 482 m_searchEdit->clearFocus();
471 // m_abView->setFocus(); 483 // m_abView->setFocus();
472 484
473} 485}
474 486
475void AddressbookWindow::slotViewBack() 487void AddressbookWindow::slotViewBack()
476{ 488{
477 // :SX showList(); 489 // :SX showList();
478} 490}
479 491
480void AddressbookWindow::writeMail() 492void AddressbookWindow::writeMail()
481{ 493{
482 Opie::OPimContact c = m_abView -> currentEntry(); 494 Opie::OPimContact c = m_abView -> currentEntry();
483 QString name = c.fileAs(); 495 QString name = c.fileAs();
484 QString email = c.defaultEmail(); 496 QString email = c.defaultEmail();
485 497
486 // I prefer the OPIE-Environment variable before the 498 // I prefer the OPIE-Environment variable before the
487 // QPE-one.. 499 // QPE-one..
488 QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); 500 QString basepath = QString::fromLatin1( getenv("OPIEDIR") );
489 if ( basepath.isEmpty() ) 501 if ( basepath.isEmpty() )
490 basepath = QString::fromLatin1( getenv("QPEDIR") ); 502 basepath = QString::fromLatin1( getenv("QPEDIR") );
491 503
492 // Try to access the preferred. If not possible, try to 504 // Try to access the preferred. If not possible, try to
493 // switch to the other one.. 505 // switch to the other one..
494 if ( m_config.useQtMail() ){ 506 if ( m_config.useQtMail() ){
495 odebug << "Accessing: " << (basepath + "/bin/qtmail") << oendl; 507 odebug << "Accessing: " << (basepath + "/bin/qtmail") << oendl;
496 if ( QFile::exists( basepath + "/bin/qtmail" ) ){ 508 if ( QFile::exists( basepath + "/bin/qtmail" ) ){
497 odebug << "QCop" << oendl; 509 odebug << "QCop" << oendl;
498 QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); 510 QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)");
499 e << name << email; 511 e << name << email;
500 return; 512 return;
501 } else 513 } else
502 m_config.setUseOpieMail( true ); 514 m_config.setUseOpieMail( true );
503 } 515 }
504 if ( m_config.useOpieMail() ){ 516 if ( m_config.useOpieMail() ){
505 odebug << "Accessing: " << (basepath + "/bin/opiemail") << oendl; 517 odebug << "Accessing: " << (basepath + "/bin/opiemail") << oendl;
506 if ( QFile::exists( basepath + "/bin/opiemail" ) ){ 518 if ( QFile::exists( basepath + "/bin/opiemail" ) ){
507 odebug << "QCop" << oendl; 519 odebug << "QCop" << oendl;
508 QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)"); 520 QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)");
509 e << name << email; 521 e << name << email;
510 return; 522 return;
511 } else 523 } else
512 m_config.setUseQtMail( true ); 524 m_config.setUseQtMail( true );
513 } 525 }
514 526
515} 527}
516 528
517void AddressbookWindow::beamDone( Ir *ir ) 529void AddressbookWindow::beamDone( Ir *ir )
518{ 530{
519 531
520 delete ir; 532 delete ir;
521 unlink( beamfile ); 533 unlink( beamfile );
522} 534}
523 535
524 536
525static void parseName( const QString& name, QString *first, QString *middle, 537static void parseName( const QString& name, QString *first, QString *middle,
526 QString * last ) 538 QString * last )
527{ 539{
528 540
529 int comma = name.find ( "," ); 541 int comma = name.find ( "," );
530 QString rest; 542 QString rest;
531 if ( comma > 0 ) { 543 if ( comma > 0 ) {
532 *last = name.left( comma ); 544 *last = name.left( comma );
533 comma++; 545 comma++;
534 while ( comma < int(name.length()) && name[comma] == ' ' ) 546 while ( comma < int(name.length()) && name[comma] == ' ' )
535 comma++; 547 comma++;
536 rest = name.mid( comma ); 548 rest = name.mid( comma );
537 } else { 549 } else {
538 int space = name.findRev( ' ' ); 550 int space = name.findRev( ' ' );
539 *last = name.mid( space+1 ); 551 *last = name.mid( space+1 );
540 rest = name.left( space ); 552 rest = name.left( space );
541 } 553 }
542 int space = rest.find( ' ' ); 554 int space = rest.find( ' ' );
543 if ( space <= 0 ) { 555 if ( space <= 0 ) {
544 *first = rest; 556 *first = rest;
545 } else { 557 } else {
546 *first = rest.left( space ); 558 *first = rest.left( space );
547 *middle = rest.mid( space+1 ); 559 *middle = rest.mid( space+1 );
548 } 560 }
549 561
550} 562}
551 563
552 564