summaryrefslogtreecommitdiff
authortux_mike <tux_mike>2002-03-26 17:39:54 (UTC)
committer tux_mike <tux_mike>2002-03-26 17:39:54 (UTC)
commite91f77a9ebf359c0fbf4f8d1a0de50bf0dcf81d8 (patch) (unidiff)
treef3214c3c9dac147f43e127371e3f547f30c97dbf
parent7c55845eb070ce39eb0673be191130be64e96cfb (diff)
downloadopie-e91f77a9ebf359c0fbf4f8d1a0de50bf0dcf81d8.zip
opie-e91f77a9ebf359c0fbf4f8d1a0de50bf0dcf81d8.tar.gz
opie-e91f77a9ebf359c0fbf4f8d1a0de50bf0dcf81d8.tar.bz2
Mike Crawford <mike@tuxnami.org>
Changed addressbook input screen to be a little more user friendly, divided all the options into 3 tabs.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abeditor.cpp2
-rw-r--r--core/pim/addressbook/addressbook.cpp8
-rw-r--r--core/pim/addressbook/addressbook.h4
-rw-r--r--core/pim/addressbook/addressbook.pro4
4 files changed, 9 insertions, 9 deletions
diff --git a/core/pim/addressbook/abeditor.cpp b/core/pim/addressbook/abeditor.cpp
index 94baa71..6354db9 100644
--- a/core/pim/addressbook/abeditor.cpp
+++ b/core/pim/addressbook/abeditor.cpp
@@ -1,120 +1,120 @@
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** Contact info@trolltech.com if any conditions of this licensing are 16** Contact 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#include "abeditor.h" 21#include "abeditor.h"
22#include "addresspicker.h" 22#include "addresspicker.h"
23 23
24#include <qpe/categoryselect.h> 24#include <qpe/categoryselect.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/qpedialog.h> 26#include <qpe/qpedialog.h>
27 27
28#include <qcombobox.h> 28#include <qcombobox.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qlayout.h> 30#include <qlayout.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qmultilineedit.h> 32#include <qmultilineedit.h>
33#include <qscrollview.h> 33#include <qscrollview.h>
34#include <qtoolbutton.h> 34#include <qtoolbutton.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qmainwindow.h> 36#include <qmainwindow.h>
37 37
38 38
39static inline bool containsAlphaNum( const QString &str ); 39static inline bool containsAlphaNum( const QString &str );
40static inline bool constainsWhiteSpace( const QString &str ); 40static inline bool constainsWhiteSpace( const QString &str );
41 41
42 42
43// helper functions, convert our comma delimited list to proper 43// helper functions, convert our comma delimited list to proper
44// file format... 44// file format...
45void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 45void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
46 QString &strAll ); 46 QString &strAll );
47 47
48// helper convert from file format to comma delimited... 48// helper convert from file format to comma delimited...
49void parseEmailTo( const QString &strDefaultEmail, 49void parseEmailTo( const QString &strDefaultEmail,
50 const QString &strOtherEmail, QString &strBack ); 50 const QString &strOtherEmail, QString &strBack );
51 51
52 52
53 53
54AbEditor::AbEditor( const Contact &entry, const QValueList<int> *newOrdered, 54AbEditor::AbEditor( const Contact &entry, const QValueList<int> *newOrdered,
55 QStringList *slNewOrdered, 55 QStringList *slNewOrdered,
56 QWidget *parent, const char *name, WFlags fl ) 56 QWidget *parent = 0, const char *name = 0, WFlags fl = 0 )
57 : QDialog( parent, name, TRUE, fl ), 57 : QDialog( parent, name, TRUE, fl ),
58 orderedValues( newOrdered ), 58 orderedValues( newOrdered ),
59 slOrdered( slNewOrdered ) 59 slOrdered( slNewOrdered )
60{ 60{
61 init(); 61 init();
62 initMap(); 62 initMap();
63 setEntry( entry ); 63 setEntry( entry );
64} 64}
65 65
66AbEditor::~AbEditor() 66AbEditor::~AbEditor()
67{ 67{
68} 68}
69 69
70void AbEditor::init() 70void AbEditor::init()
71{ 71{
72 middleEdit = 0; 72 middleEdit = 0;
73 QVBoxLayout *vb = new QVBoxLayout( this ); 73 QVBoxLayout *vb = new QVBoxLayout( this );
74 svPage = new QScrollView( this ); 74 svPage = new QScrollView( this );
75 svPage->setHScrollBarMode( QScrollView::AlwaysOff ); 75 svPage->setHScrollBarMode( QScrollView::AlwaysOff );
76 vb->addWidget( svPage ); 76 vb->addWidget( svPage );
77 svPage->setResizePolicy( QScrollView::AutoOneFit ); 77 svPage->setResizePolicy( QScrollView::AutoOneFit );
78 svPage->setFrameStyle( QFrame::NoFrame ); 78 svPage->setFrameStyle( QFrame::NoFrame );
79 79
80 QWidget *container = new QWidget( svPage->viewport() ); 80 QWidget *container = new QWidget( svPage->viewport() );
81 svPage->addChild( container ); 81 svPage->addChild( container );
82 82
83 QGridLayout *gl = new QGridLayout( container, 20, 2, 4, 2 ); 83 QGridLayout *gl = new QGridLayout( container, 20, 2, 4, 2 );
84 84
85 QLabel *l = new QLabel( tr("First Name"), container ); 85 QLabel *l = new QLabel( tr("First Name"), container );
86 gl->addWidget( l, 0, 0 ); 86 gl->addWidget( l, 0, 0 );
87 firstEdit = new QLineEdit( container ); 87 firstEdit = new QLineEdit( container );
88 gl->addWidget( firstEdit, 0, 1 ); 88 gl->addWidget( firstEdit, 0, 1 );
89 89
90 l = new QLabel( tr("Last Name"), container ); 90 l = new QLabel( tr("Last Name"), container );
91 gl->addWidget( l, 1, 0 ); 91 gl->addWidget( l, 1, 0 );
92 lastEdit = new QLineEdit( container ); 92 lastEdit = new QLineEdit( container );
93 gl->addWidget( lastEdit, 1, 1 ); 93 gl->addWidget( lastEdit, 1, 1 );
94 94
95 l = new QLabel( tr("Categories"), container ); 95 l = new QLabel( tr("Categories"), container );
96 gl->addWidget( l, 2, 0 ); 96 gl->addWidget( l, 2, 0 );
97 97
98 cmbCat = new CategorySelect( container ); 98 cmbCat = new CategorySelect( container );
99 gl->addWidget( cmbCat, 2, 1 ); 99 gl->addWidget( cmbCat, 2, 1 );
100 100
101 int i; 101 int i;
102 bool foundGender, 102 bool foundGender,
103 foundNotes; 103 foundNotes;
104 foundGender = foundNotes = false; 104 foundGender = foundNotes = false;
105 QStringList::ConstIterator it = slOrdered->begin(); 105 QStringList::ConstIterator it = slOrdered->begin();
106 for ( i = 0; it != slOrdered->end(); i++, ++it ) { 106 for ( i = 0; it != slOrdered->end(); i++, ++it ) {
107 if ( !foundGender && *it == tr("Gender") ) { 107 if ( !foundGender && *it == tr("Gender") ) {
108 foundGender = true; 108 foundGender = true;
109 } else if ( !foundNotes && *it == tr("Notes") ) { 109 } else if ( !foundNotes && *it == tr("Notes") ) {
110 foundNotes = true; 110 foundNotes = true;
111 } else { 111 } else {
112 l = new QLabel( *it, container ); 112 l = new QLabel( *it, container );
113 listName.append( l ); 113 listName.append( l );
114 gl->addWidget( l, i + 3, 0 ); 114 gl->addWidget( l, i + 3, 0 );
115 QLineEdit *e = new QLineEdit( container ); 115 QLineEdit *e = new QLineEdit( container );
116 listValue.append( e ); 116 listValue.append( e );
117 gl->addWidget( e, i + 3, 1 ); 117 gl->addWidget( e, i + 3, 1 );
118 if ( *it == tr( "Middle Name" ) ) 118 if ( *it == tr( "Middle Name" ) )
119 middleEdit = e; 119 middleEdit = e;
120 } 120 }
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index a2b8276..e8fa37c 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -1,87 +1,87 @@
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** Contact info@trolltech.com if any conditions of this licensing are 16** Contact 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 "abeditor.h" 23#include "contacteditor.h"
24#include "ablabel.h" 24#include "ablabel.h"
25#include "abtable.h" 25#include "abtable.h"
26#include "addresssettings.h" 26#include "addresssettings.h"
27#include "addressbook.h" 27#include "addressbook.h"
28 28
29#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
30#include <qpe/config.h> 30#include <qpe/config.h>
31#include <qpe/contact.h> 31#include <qpe/contact.h>
32#include <qpe/finddialog.h> 32#include <qpe/finddialog.h>
33#include <qpe/global.h> 33#include <qpe/global.h>
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35#include <qpe/ir.h> 35#include <qpe/ir.h>
36#include <qpe/qpemessagebox.h> 36#include <qpe/qpemessagebox.h>
37#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
38 38
39#include <qaction.h> 39#include <qaction.h>
40#include <qdialog.h> 40#include <qdialog.h>
41#include <qdir.h> 41#include <qdir.h>
42#include <qfile.h> 42#include <qfile.h>
43#include <qimage.h> 43#include <qimage.h>
44#include <qlayout.h> 44#include <qlayout.h>
45#include <qpe/qpemenubar.h> 45#include <qpe/qpemenubar.h>
46#include <qmessagebox.h> 46#include <qmessagebox.h>
47#include <qpixmap.h> 47#include <qpixmap.h>
48#include <qpopupmenu.h> 48#include <qpopupmenu.h>
49#include <qpe/qpetoolbar.h> 49#include <qpe/qpetoolbar.h>
50#include <qstringlist.h> 50#include <qstringlist.h>
51#include <qtoolbutton.h> 51#include <qtoolbutton.h>
52#include <qwhatsthis.h> 52#include <qwhatsthis.h>
53 53
54#include <stdlib.h> 54#include <stdlib.h>
55#include <sys/stat.h> 55#include <sys/stat.h>
56#include <sys/types.h> 56#include <sys/types.h>
57#include <fcntl.h> 57#include <fcntl.h>
58#include <unistd.h> 58#include <unistd.h>
59 59
60#include <qdatetime.h> 60#include <qdatetime.h>
61 61
62static QString addressbookOldXMLFilename() 62static QString addressbookOldXMLFilename()
63{ 63{
64 QString filename = QPEApplication::documentDir() + "addressbook.xml"; 64 QString filename = QPEApplication::documentDir() + "addressbook.xml";
65 return filename; 65 return filename;
66} 66}
67 67
68static QString addressbookXMLFilename() 68static QString addressbookXMLFilename()
69{ 69{
70 QString filename = Global::applicationFileName("addressbook", 70 QString filename = Global::applicationFileName("addressbook",
71 "addressbook.xml"); 71 "addressbook.xml");
72 return filename; 72 return filename;
73} 73}
74 74
75static QString addressbookPersonalVCardName() 75static QString addressbookPersonalVCardName()
76{ 76{
77 QString filename = Global::applicationFileName("addressbook", 77 QString filename = Global::applicationFileName("addressbook",
78 "businesscard.vcf"); 78 "businesscard.vcf");
79 return filename; 79 return filename;
80} 80}
81 81
82 82
83AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, 83AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
84 WFlags f ) 84 WFlags f )
85 : QMainWindow( parent, name, f ), 85 : QMainWindow( parent, name, f ),
86 abEditor(0), 86 abEditor(0),
87 bAbEditFirstTime(TRUE), 87 bAbEditFirstTime(TRUE),
@@ -368,240 +368,240 @@ void AddressbookWindow::slotBeam()
368 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 368 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
369 QString description = c.fullName(); 369 QString description = c.fullName();
370 ir->send( filename, description, "text/x-vCard" ); 370 ir->send( filename, description, "text/x-vCard" );
371} 371}
372 372
373void AddressbookWindow::beamDone( Ir *ir ) 373void AddressbookWindow::beamDone( Ir *ir )
374{ 374{
375 delete ir; 375 delete ir;
376 unlink( beamfile ); 376 unlink( beamfile );
377} 377}
378 378
379 379
380static void parseName( const QString& name, QString *first, QString *middle, 380static void parseName( const QString& name, QString *first, QString *middle,
381 QString * last ) 381 QString * last )
382{ 382{
383 383
384 int comma = name.find ( "," ); 384 int comma = name.find ( "," );
385 QString rest; 385 QString rest;
386 if ( comma > 0 ) { 386 if ( comma > 0 ) {
387 *last = name.left( comma ); 387 *last = name.left( comma );
388 comma++; 388 comma++;
389 while ( comma < int(name.length()) && name[comma] == ' ' ) 389 while ( comma < int(name.length()) && name[comma] == ' ' )
390 comma++; 390 comma++;
391 rest = name.mid( comma ); 391 rest = name.mid( comma );
392 } else { 392 } else {
393 int space = name.findRev( ' ' ); 393 int space = name.findRev( ' ' );
394 *last = name.mid( space+1 ); 394 *last = name.mid( space+1 );
395 rest = name.left( space ); 395 rest = name.left( space );
396 } 396 }
397 int space = rest.find( ' ' ); 397 int space = rest.find( ' ' );
398 if ( space <= 0 ) { 398 if ( space <= 0 ) {
399 *first = rest; 399 *first = rest;
400 } else { 400 } else {
401 *first = rest.left( space ); 401 *first = rest.left( space );
402 *middle = rest.mid( space+1 ); 402 *middle = rest.mid( space+1 );
403 } 403 }
404 404
405} 405}
406 406
407 407
408void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) 408void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
409{ 409{
410 if (msg == "editPersonal()") { 410 if (msg == "editPersonal()") {
411 editPersonal(); 411 editPersonal();
412 } else if (msg == "editPersonalAndClose()") { 412 } else if (msg == "editPersonalAndClose()") {
413 editPersonal(); 413 editPersonal();
414 close(); 414 close();
415 } else if ( msg == "addContact(QString,QString)" ) { 415 } else if ( msg == "addContact(QString,QString)" ) {
416 QDataStream stream(data,IO_ReadOnly); 416 QDataStream stream(data,IO_ReadOnly);
417 QString name, email; 417 QString name, email;
418 stream >> name >> email; 418 stream >> name >> email;
419 419
420 Contact cnt; 420 Contact cnt;
421 QString fn, mn, ln; 421 QString fn, mn, ln;
422 parseName( name, &fn, &mn, &ln ); 422 parseName( name, &fn, &mn, &ln );
423 //qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); 423 //qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() );
424 cnt.setFirstName( fn ); 424 cnt.setFirstName( fn );
425 cnt.setMiddleName( mn ); 425 cnt.setMiddleName( mn );
426 cnt.setLastName( ln ); 426 cnt.setLastName( ln );
427 cnt.setEmails( email ); 427 cnt.setEmails( email );
428 cnt.setDefaultEmail( email ); 428 cnt.setDefaultEmail( email );
429 cnt.setFileAs(); 429 cnt.setFileAs();
430 430
431 if ( bAbEditFirstTime ) { 431 if ( bAbEditFirstTime ) {
432 abEditor = new AbEditor( cnt, &orderedFields, &slOrderedFields, 432 abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields,
433 this, "editor" ); 433 this, "editor" );
434 bAbEditFirstTime = FALSE; 434 bAbEditFirstTime = FALSE;
435 } else { 435 } else {
436 abEditor->setEntry( cnt ); 436 abEditor->setEntry( cnt );
437 } 437 }
438 abView()->init( cnt ); 438 abView()->init( cnt );
439 editEntry( NewEntry ); 439 editEntry( NewEntry );
440 440
441 441
442 442
443 } 443 }
444#if 0 444#if 0
445 else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { 445 else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) {
446 QDataStream stream(data,IO_ReadOnly); 446 QDataStream stream(data,IO_ReadOnly);
447 QCString ch,m; 447 QCString ch,m;
448 QStringList types; 448 QStringList types;
449 stream >> ch >> m >> types; 449 stream >> ch >> m >> types;
450 AddressPicker picker(abList,this,0,TRUE); 450 AddressPicker picker(abList,this,0,TRUE);
451 picker.showMaximized(); 451 picker.showMaximized();
452 picker.setChoiceNames(types); 452 picker.setChoiceNames(types);
453 int i=0; 453 int i=0;
454 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { 454 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
455 QStringList sel; 455 QStringList sel;
456 stream >> sel; 456 stream >> sel;
457 picker.setSelection(i++,sel); 457 picker.setSelection(i++,sel);
458 } 458 }
459 picker.showMaximized(); 459 picker.showMaximized();
460 picker.exec(); 460 picker.exec();
461 461
462 // ###### note: contacts may have been added - save here! 462 // ###### note: contacts may have been added - save here!
463 463
464 setCentralWidget(abList); 464 setCentralWidget(abList);
465 QCopEnvelope e(ch,m); 465 QCopEnvelope e(ch,m);
466 i=0; 466 i=0;
467 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { 467 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
468 QStringList sel = picker.selection(i++); 468 QStringList sel = picker.selection(i++);
469 e << sel; 469 e << sel;
470 } 470 }
471 } 471 }
472#endif 472#endif
473 473
474} 474}
475 475
476void AddressbookWindow::editPersonal() 476void AddressbookWindow::editPersonal()
477{ 477{
478 QString filename = addressbookPersonalVCardName(); 478 QString filename = addressbookPersonalVCardName();
479 Contact me; 479 Contact me;
480 if (QFile::exists(filename)) 480 if (QFile::exists(filename))
481 me = Contact::readVCard( filename )[0]; 481 me = Contact::readVCard( filename )[0];
482 if (bAbEditFirstTime) { 482 if (bAbEditFirstTime) {
483 abEditor = new AbEditor( me, &orderedFields, &slOrderedFields, 483 abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields,
484 this, "editor" ); 484 this, "editor" );
485 // don't create a new editor every time 485 // don't create a new editor every time
486 bAbEditFirstTime = FALSE; 486 bAbEditFirstTime = FALSE;
487 } else 487 } else
488 abEditor->setEntry( me ); 488 abEditor->setEntry( me );
489 489
490 abEditor->setCaption(tr("Edit My Personal Details")); 490 abEditor->setCaption(tr("Edit My Personal Details"));
491 abEditor->showMaximized(); 491 abEditor->showMaximized();
492 492
493 // fix the foxus... 493 // fix the foxus...
494 abEditor->setNameFocus(); 494 abEditor->setNameFocus();
495 if ( abEditor->exec() ) { 495 if ( abEditor->exec() ) {
496 setFocus(); 496 setFocus();
497 Contact new_personal = abEditor->entry(); 497 Contact new_personal = abEditor->entry();
498 QString fname = addressbookPersonalVCardName(); 498 QString fname = addressbookPersonalVCardName();
499 Contact::writeVCard( fname, new_personal ); 499 Contact::writeVCard( fname, new_personal );
500 abView()->init(new_personal); 500 abView()->init(new_personal);
501 abView()->sync(); 501 abView()->sync();
502 } 502 }
503 abEditor->setCaption( tr("Edit Address") ); 503 abEditor->setCaption( tr("Edit Address") );
504} 504}
505 505
506void AddressbookWindow::slotPersonalView() 506void AddressbookWindow::slotPersonalView()
507{ 507{
508 if (!actionPersonal->isOn()) { 508 if (!actionPersonal->isOn()) {
509 // we just turned it off 509 // we just turned it off
510 setCaption( tr("Contacts") ); 510 setCaption( tr("Contacts") );
511 actionNew->setEnabled(TRUE); 511 actionNew->setEnabled(TRUE);
512 actionTrash->setEnabled(TRUE); 512 actionTrash->setEnabled(TRUE);
513 actionFind->setEnabled(TRUE); 513 actionFind->setEnabled(TRUE);
514 slotUpdateToolbar(); // maybe some of the above could be moved there 514 slotUpdateToolbar(); // maybe some of the above could be moved there
515 showList(); 515 showList();
516 return; 516 return;
517 } 517 }
518 518
519 // XXX need to disable some QActions. 519 // XXX need to disable some QActions.
520 actionNew->setEnabled(FALSE); 520 actionNew->setEnabled(FALSE);
521 actionTrash->setEnabled(FALSE); 521 actionTrash->setEnabled(FALSE);
522 actionFind->setEnabled(FALSE); 522 actionFind->setEnabled(FALSE);
523 actionMail->setEnabled(FALSE); 523 actionMail->setEnabled(FALSE);
524 524
525 setCaption( tr("Contacts - My Personal Details") ); 525 setCaption( tr("Contacts - My Personal Details") );
526 QString filename = addressbookPersonalVCardName(); 526 QString filename = addressbookPersonalVCardName();
527 Contact me; 527 Contact me;
528 if (QFile::exists(filename)) 528 if (QFile::exists(filename))
529 me = Contact::readVCard( filename )[0]; 529 me = Contact::readVCard( filename )[0];
530 530
531 abView()->init( me ); 531 abView()->init( me );
532 abView()->sync(); 532 abView()->sync();
533 abList->hide(); 533 abList->hide();
534 setCentralWidget( abView() ); 534 setCentralWidget( abView() );
535 mView->show(); 535 mView->show();
536 mView->setFocus(); 536 mView->setFocus();
537} 537}
538 538
539void AddressbookWindow::editEntry( EntryMode entryMode ) 539void AddressbookWindow::editEntry( EntryMode entryMode )
540{ 540{
541 Contact entry; 541 Contact entry;
542 if ( bAbEditFirstTime ) { 542 if ( bAbEditFirstTime ) {
543 abEditor = new AbEditor( entry, &orderedFields, &slOrderedFields, 543 abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields,
544 this, "editor" ); 544 this, "editor" );
545 bAbEditFirstTime = FALSE; 545 bAbEditFirstTime = FALSE;
546 if ( entryMode == EditEntry ) 546 if ( entryMode == EditEntry )
547 abEditor->setEntry( abList->currentEntry() ); 547 abEditor->setEntry( abList->currentEntry() );
548 } 548 }
549 // other things may chane the caption. 549 // other things may chane the caption.
550 abEditor->setCaption( tr("Edit Address") ); 550 abEditor->setCaption( tr("Edit Address") );
551 551
552#if defined(Q_WS_QWS) || defined(_WS_QWS_) 552#if defined(Q_WS_QWS) || defined(_WS_QWS_)
553 abEditor->showMaximized(); 553 abEditor->showMaximized();
554#endif 554#endif
555 // fix the foxus... 555 // fix the foxus...
556 abEditor->setNameFocus(); 556 abEditor->setNameFocus();
557 if ( abEditor->exec() ) { 557 if ( abEditor->exec() ) {
558 setFocus(); 558 setFocus();
559 if ( entryMode == NewEntry ) { 559 if ( entryMode == NewEntry ) {
560 Contact insertEntry = abEditor->entry(); 560 Contact insertEntry = abEditor->entry();
561 insertEntry.assignUid(); 561 insertEntry.assignUid();
562 abList->addEntry( insertEntry ); 562 abList->addEntry( insertEntry );
563 } else { 563 } else {
564 Contact replaceEntry = abEditor->entry(); 564 Contact replaceEntry = abEditor->entry();
565 if ( !replaceEntry.isValidUid() ) 565 if ( !replaceEntry.isValidUid() )
566 replaceEntry.assignUid(); 566 replaceEntry.assignUid();
567 abList->replaceCurrentEntry( replaceEntry ); 567 abList->replaceCurrentEntry( replaceEntry );
568 } 568 }
569 } 569 }
570 populateCategories(); 570 populateCategories();
571 showList(); 571 showList();
572} 572}
573 573
574void AddressbookWindow::listIsEmpty( bool empty ) 574void AddressbookWindow::listIsEmpty( bool empty )
575{ 575{
576 if ( !empty ) { 576 if ( !empty ) {
577 deleteButton->setEnabled( TRUE ); 577 deleteButton->setEnabled( TRUE );
578 } 578 }
579} 579}
580 580
581void AddressbookWindow::reload() 581void AddressbookWindow::reload()
582{ 582{
583 syncing = FALSE; 583 syncing = FALSE;
584 abList->clear(); 584 abList->clear();
585 abList->load( addressbookXMLFilename() ); 585 abList->load( addressbookXMLFilename() );
586} 586}
587 587
588void AddressbookWindow::flush() 588void AddressbookWindow::flush()
589{ 589{
590 syncing = TRUE; 590 syncing = TRUE;
591 abList->save( addressbookXMLFilename() ); 591 abList->save( addressbookXMLFilename() );
592} 592}
593 593
594 594
595void AddressbookWindow::closeEvent( QCloseEvent *e ) 595void AddressbookWindow::closeEvent( QCloseEvent *e )
596{ 596{
597 if ( centralWidget() == mView ) { 597 if ( centralWidget() == mView ) {
598 if (actionPersonal->isOn()) { 598 if (actionPersonal->isOn()) {
599 // pretend we clicked it off 599 // pretend we clicked it off
600 actionPersonal->setOn(FALSE); 600 actionPersonal->setOn(FALSE);
601 slotPersonalView(); 601 slotPersonalView();
602 } else { 602 } else {
603 showList(); 603 showList();
604 } 604 }
605 e->ignore(); 605 e->ignore();
606 return; 606 return;
607 } 607 }
diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h
index 9694465..342077f 100644
--- a/core/pim/addressbook/addressbook.h
+++ b/core/pim/addressbook/addressbook.h
@@ -1,99 +1,99 @@
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** Contact info@trolltech.com if any conditions of this licensing are 16** Contact 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#ifndef Addressbook_H 20#ifndef Addressbook_H
21#define Addressbook_H 21#define Addressbook_H
22 22
23#include <qmainwindow.h> 23#include <qmainwindow.h>
24 24
25class AbEditor; 25class ContactEditor;
26class AbLabel; 26class AbLabel;
27class AbTable; 27class AbTable;
28class QPEToolBar; 28class QPEToolBar;
29class QPopupMenu; 29class QPopupMenu;
30class QToolButton; 30class QToolButton;
31class QDialog; 31class QDialog;
32class Ir; 32class Ir;
33class QAction; 33class QAction;
34 34
35class AddressbookWindow: public QMainWindow 35class AddressbookWindow: public QMainWindow
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38public: 38public:
39 AddressbookWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 39 AddressbookWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
40 ~AddressbookWindow(); 40 ~AddressbookWindow();
41 41
42protected: 42protected:
43 void resizeEvent( QResizeEvent * e ); 43 void resizeEvent( QResizeEvent * e );
44 void showList(); 44 void showList();
45 void showView(); 45 void showView();
46 enum EntryMode { NewEntry=0, EditEntry }; 46 enum EntryMode { NewEntry=0, EditEntry };
47 void editPersonal(); 47 void editPersonal();
48 void editEntry( EntryMode ); 48 void editEntry( EntryMode );
49 void closeEvent( QCloseEvent *e ); 49 void closeEvent( QCloseEvent *e );
50 bool save(); 50 bool save();
51 51
52public slots: 52public slots:
53 void flush(); 53 void flush();
54 void reload(); 54 void reload();
55 void appMessage(const QCString &, const QByteArray &); 55 void appMessage(const QCString &, const QByteArray &);
56 void setDocument( const QString & ); 56 void setDocument( const QString & );
57 57
58private slots: 58private slots:
59 void slotListNew(); 59 void slotListNew();
60 void slotListView(); 60 void slotListView();
61 void slotListDelete(); 61 void slotListDelete();
62 void slotViewBack(); 62 void slotViewBack();
63 void slotViewEdit(); 63 void slotViewEdit();
64 void slotPersonalView(); 64 void slotPersonalView();
65 void listIsEmpty( bool ); 65 void listIsEmpty( bool );
66 void slotSettings(); 66 void slotSettings();
67 void writeMail(); 67 void writeMail();
68 void slotBeam(); 68 void slotBeam();
69 void beamDone( Ir * ); 69 void beamDone( Ir * );
70 void slotFind(); 70 void slotFind();
71 void slotSetCategory( int ); 71 void slotSetCategory( int );
72 void slotUpdateToolbar(); 72 void slotUpdateToolbar();
73 73
74private: 74private:
75 void initFields();// inititialize our fields... 75 void initFields();// inititialize our fields...
76 AbLabel *abView(); 76 AbLabel *abView();
77 void populateCategories(); 77 void populateCategories();
78 78
79 QPopupMenu *catMenu; 79 QPopupMenu *catMenu;
80 QPEToolBar *listTools; 80 QPEToolBar *listTools;
81 QToolButton *deleteButton; 81 QToolButton *deleteButton;
82 QValueList<int> allFields, 82 QValueList<int> allFields,
83 orderedFields; 83 orderedFields;
84 QStringList slOrderedFields; 84 QStringList slOrderedFields;
85 enum Panes { paneList=0, paneView, paneEdit }; 85 enum Panes { paneList=0, paneView, paneEdit };
86 AbEditor *abEditor; 86 ContactEditor *abEditor;
87 AbLabel *mView; 87 AbLabel *mView;
88 AbTable *abList; 88 AbTable *abList;
89 89
90 QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, 90 QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam,
91 *actionPersonal, *actionMail; 91 *actionPersonal, *actionMail;
92 92
93 bool bAbEditFirstTime; 93 bool bAbEditFirstTime;
94 int viewMargin; 94 int viewMargin;
95 95
96 bool syncing; 96 bool syncing;
97}; 97};
98 98
99#endif 99#endif
diff --git a/core/pim/addressbook/addressbook.pro b/core/pim/addressbook/addressbook.pro
index 31de2a3..180b401 100644
--- a/core/pim/addressbook/addressbook.pro
+++ b/core/pim/addressbook/addressbook.pro
@@ -1,23 +1,23 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on release 2 CONFIG = qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin 3 DESTDIR = $(OPIEDIR)/bin
4 HEADERS= addressbook.h \ 4 HEADERS= addressbook.h \
5 abeditor.h \ 5 contacteditor.h \
6 ablabel.h \ 6 ablabel.h \
7 abtable.h \ 7 abtable.h \
8 addresssettings.h 8 addresssettings.h
9 SOURCES= main.cpp \ 9 SOURCES= main.cpp \
10 addressbook.cpp \ 10 addressbook.cpp \
11 abeditor.cpp \ 11 contacteditor.cpp \
12 ablabel.cpp \ 12 ablabel.cpp \
13 abtable.cpp \ 13 abtable.cpp \
14 addresssettings.cpp 14 addresssettings.cpp
15 INTERFACES= addresssettingsbase.ui 15 INTERFACES= addresssettingsbase.ui
16 16
17 TARGET = addressbook 17 TARGET = addressbook
18INCLUDEPATH += $(OPIEDIR)/include 18INCLUDEPATH += $(OPIEDIR)/include
19 DEPENDPATH+= $(OPIEDIR)/include 19 DEPENDPATH+= $(OPIEDIR)/include
20LIBS += -lqpe 20LIBS += -lqpe
21 21
22TRANSLATIONS = ../i18n/de/addressbook.ts 22TRANSLATIONS = ../i18n/de/addressbook.ts
23TRANSLATIONS += ../i18n/pt_BR/addressbook.ts 23TRANSLATIONS += ../i18n/pt_BR/addressbook.ts