summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/TODO11
-rw-r--r--core/pim/addressbook/addressbook.cpp9
-rw-r--r--core/pim/addressbook/configdlg_base.ui6
-rw-r--r--core/pim/addressbook/contacteditor.cpp153
-rw-r--r--core/pim/addressbook/contacteditor.h16
5 files changed, 154 insertions, 41 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO
index 96134f4..100a6fd 100644
--- a/core/pim/addressbook/TODO
+++ b/core/pim/addressbook/TODO
@@ -1,43 +1,46 @@
1Stuff todo until OPIE 1.0 : 1Stuff todo until OPIE 1.0 :
2 2
3Pending bugfixes from previous work: 3Pending bugfixes from previous work:
4 4
5Urgent: 5Urgent:
6 6
7 7
8Important: 8Important:
9 9
10- Personal contact editor: Disable categories
11- Name order selected in "contacteditor" not used in list view. 10- Name order selected in "contacteditor" not used in list view.
12- contacteditor: Birthday, annyversary, ... : Use Dateselector
13 11
14- Overview window cleanup needed.. 12- Overview window cleanup needed..
15- Cursor keys should work in detail-view (ablabel) 13- Cursor keys should work in detail-view (ablabel)
16- "What's this" should be added 14 -> Ablabel should be removed and Abtable should be increased with
15 different views (as started by darwin zins)..
17- Store last settings of combo-boxes 16- Store last settings of combo-boxes
18- Finishing of new View functions (List, Phonebook...) 17- Finishing of new View functions (List, Phonebook...)
19- The names of the countries are sorted by there english names, only.. 18- The names of the countries are sorted by there english names, only..
20 Even if they are translated.. :S 19 Even if they are translated.. :S
21- Reload if contacts were changed externally 20- Reload if contacts were changed externally
21- "What's this" should be added
22 22
23Less important: 23Less important:
24 24
25- The picker (alphabetical sort widget) should be 25- The picker (alphabetical sort widget) should be
26 placed verticaly or horizontally (configurable) 26 placed verticaly or horizontally (configurable)
27- Use advanced database functions in abtable to decrease 27- Use advanced database functions in abtable to decrease
28 memory footprint and to make everything more easy ! 28 memory footprint and to make everything more easy !
29 (abtable should store Iterator for selected Category) 29 (abtable should store Iterator for selected Category)
30 30
31Should be Fixed (not absolute sure, need further validation): 31Should be Fixed (not absolute sure, need further validation):
32- "Nonenglish" translation bug has to be fixed. 32
33 33
34Fixed: 34Fixed:
35- Syncing: abtable not reloaded after sync. 35- Syncing: abtable not reloaded after sync.
36- Find widget should be replaced by something like 36- Find widget should be replaced by something like
37 qpdf has. 37 qpdf has.
38- Adding a configuration dialog 38- Adding a configuration dialog
39- Picker: Activated letter schould be more visible 39- Picker: Activated letter schould be more visible
40- Advanced handling of cursor keys (search..) 40- Advanced handling of cursor keys (search..)
41- Mail-Icon is missing 41- Mail-Icon is missing
42- Use opie-mail insted of qt-mail if possible. 42- Use opie-mail insted of qt-mail if possible.
43- Font menu is invisible using german translation 43- Font menu is invisible using german translation
44- Personal contact editor: Disable categories
45- "Nonenglish" translation bug has to be fixed.
46- contacteditor: Birthday, annyversary, ... : Use Dateselector
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 39d8321..108e66d 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -65,65 +65,65 @@
65#include "picker.h" 65#include "picker.h"
66#include "configdlg.h" 66#include "configdlg.h"
67 67
68static QString addressbookPersonalVCardName() 68static QString addressbookPersonalVCardName()
69{ 69{
70 QString filename = Global::applicationFileName("addressbook", 70 QString filename = Global::applicationFileName("addressbook",
71 "businesscard.vcf"); 71 "businesscard.vcf");
72 return filename; 72 return filename;
73} 73}
74 74
75 75
76AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, 76AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
77 WFlags f ) 77 WFlags f )
78 : QMainWindow( parent, name, f ), 78 : QMainWindow( parent, name, f ),
79 abEditor(0), 79 abEditor(0),
80 useRegExp(false), 80 useRegExp(false),
81 doNotifyWrapAround(true), 81 doNotifyWrapAround(true),
82 caseSensitive(false), 82 caseSensitive(false),
83 m_useQtMail(true), 83 m_useQtMail(true),
84 m_useOpieMail(false), 84 m_useOpieMail(false),
85 bAbEditFirstTime(TRUE), 85 bAbEditFirstTime(TRUE),
86 syncing(FALSE) 86 syncing(FALSE)
87{ 87{
88 isLoading = true; 88 isLoading = true;
89 89
90 // Read Config settings 90 // Read Config settings
91 Config cfg("AddressBook"); 91 Config cfg("AddressBook");
92 cfg.setGroup("Search"); 92 cfg.setGroup("Search");
93 useRegExp = cfg.readBoolEntry( "useRegExp" ); 93 useRegExp = cfg.readBoolEntry( "useRegExp" );
94 caseSensitive = cfg.readBoolEntry( "caseSensitive" ); 94 caseSensitive = cfg.readBoolEntry( "caseSensitive" );
95 doNotifyWrapAround = cfg.readBoolEntry( "doNotifyWrapAround" ); 95 doNotifyWrapAround = cfg.readBoolEntry( "doNotifyWrapAround" );
96 cfg.setGroup("Mail"); 96 cfg.setGroup("Mail");
97 m_useQtMail = cfg.readBoolEntry( "useQtMail" ); 97 m_useQtMail = cfg.readBoolEntry( "useQtMail", true );
98 m_useOpieMail=cfg.readBoolEntry( "useOpieMail" ); 98 m_useOpieMail=cfg.readBoolEntry( "useOpieMail" );
99 99
100 100
101 initFields(); 101 initFields();
102 102
103 setCaption( tr("Contacts") ); 103 setCaption( tr("Contacts") );
104 setIcon( Resource::loadPixmap( "AddressBook" ) ); 104 setIcon( Resource::loadPixmap( "AddressBook" ) );
105 105
106 setToolBarsMovable( FALSE ); 106 setToolBarsMovable( FALSE );
107 107
108 // Create Toolbars 108 // Create Toolbars
109 109
110 QPEToolBar *bar = new QPEToolBar( this ); 110 QPEToolBar *bar = new QPEToolBar( this );
111 bar->setHorizontalStretchable( TRUE ); 111 bar->setHorizontalStretchable( TRUE );
112 112
113 QPEMenuBar *mbList = new QPEMenuBar( bar ); 113 QPEMenuBar *mbList = new QPEMenuBar( bar );
114 mbList->setMargin( 0 ); 114 mbList->setMargin( 0 );
115 115
116 QPopupMenu *edit = new QPopupMenu( this ); 116 QPopupMenu *edit = new QPopupMenu( this );
117 mbList->insertItem( tr( "Contact" ), edit ); 117 mbList->insertItem( tr( "Contact" ), edit );
118 118
119 listTools = new QPEToolBar( this, "list operations" ); 119 listTools = new QPEToolBar( this, "list operations" );
120 120
121 121
122 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 122 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null,
123 0, this, 0 ); 123 0, this, 0 );
124 actionNew = a; 124 actionNew = a;
125 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); 125 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) );
126 a->addTo( edit ); 126 a->addTo( edit );
127 a->addTo( listTools ); 127 a->addTo( listTools );
128 128
129 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 129 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null,
@@ -644,85 +644,90 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
644 picker.showMaximized(); 644 picker.showMaximized();
645 picker.setChoiceNames(types); 645 picker.setChoiceNames(types);
646 int i=0; 646 int i=0;
647 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { 647 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
648 QStringList sel; 648 QStringList sel;
649 stream >> sel; 649 stream >> sel;
650 picker.setSelection(i++,sel); 650 picker.setSelection(i++,sel);
651 } 651 }
652 picker.showMaximized(); 652 picker.showMaximized();
653 picker.exec(); 653 picker.exec();
654 654
655 // ###### note: contacts may have been added - save here! 655 // ###### note: contacts may have been added - save here!
656 656
657 setCentralWidget(abList); 657 setCentralWidget(abList);
658 QCopEnvelope e(ch,m); 658 QCopEnvelope e(ch,m);
659 i=0; 659 i=0;
660 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { 660 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
661 QStringList sel = picker.selection(i++); 661 QStringList sel = picker.selection(i++);
662 e << sel; 662 e << sel;
663 } 663 }
664 } 664 }
665#endif 665#endif
666 666
667} 667}
668 668
669void AddressbookWindow::editPersonal() 669void AddressbookWindow::editPersonal()
670{ 670{
671 QString filename = addressbookPersonalVCardName(); 671 QString filename = addressbookPersonalVCardName();
672 OContact me; 672 OContact me;
673 if (QFile::exists(filename)) 673 if (QFile::exists(filename))
674 me = OContact::readVCard( filename )[0]; 674 me = OContact::readVCard( filename )[0];
675 if (bAbEditFirstTime) { 675 if (bAbEditFirstTime) {
676 qWarning("Editing personal data");
676 abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, 677 abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields,
677 this, "editor" ); 678 this, "editor" );
678 // don't create a new editor every time 679 // don't create a new editor every time
679 bAbEditFirstTime = FALSE; 680 bAbEditFirstTime = FALSE;
680 } else 681 } else{
681 abEditor->setEntry( me ); 682 abEditor->setEntry( me );
683 }
684
685 abEditor->setPersonalView( true );
682 686
683 abEditor->setCaption(tr("Edit My Personal Details")); 687 abEditor->setCaption(tr("Edit My Personal Details"));
684 abEditor->showMaximized(); 688 abEditor->showMaximized();
685 689
686 // fix the foxus... 690 // fix the foxus...
687 abEditor->setNameFocus(); 691 abEditor->setNameFocus();
688 if ( abEditor->exec() ) { 692 if ( abEditor->exec() ) {
689 setFocus(); 693 setFocus();
690 OContact new_personal = abEditor->entry(); 694 OContact new_personal = abEditor->entry();
691 QString fname = addressbookPersonalVCardName(); 695 QString fname = addressbookPersonalVCardName();
692 OContact::writeVCard( fname, new_personal ); 696 OContact::writeVCard( fname, new_personal );
693 abView()->init(new_personal); 697 abView()->init(new_personal);
694 abView()->sync(); 698 abView()->sync();
695 } 699 }
696 abEditor->setCaption( tr("Edit Address") ); 700 abEditor->setCaption( tr("Edit Address") );
701 abEditor->setPersonalView( false );
697} 702}
698 703
699void AddressbookWindow::slotPersonalView() 704void AddressbookWindow::slotPersonalView()
700{ 705{
701 if (!actionPersonal->isOn()) { 706 if (!actionPersonal->isOn()) {
702 // we just turned it off 707 // we just turned it off
703 setCaption( tr("Contacts") ); 708 setCaption( tr("Contacts") );
704 actionNew->setEnabled(TRUE); 709 actionNew->setEnabled(TRUE);
705 actionTrash->setEnabled(TRUE); 710 actionTrash->setEnabled(TRUE);
706 actionFind->setEnabled(TRUE); 711 actionFind->setEnabled(TRUE);
707 slotUpdateToolbar(); // maybe some of the above could be moved there 712 slotUpdateToolbar(); // maybe some of the above could be moved there
708 showList(); 713 showList();
709 return; 714 return;
710 } 715 }
711 716
712 // XXX need to disable some QActions. 717 // XXX need to disable some QActions.
713 actionNew->setEnabled(FALSE); 718 actionNew->setEnabled(FALSE);
714 actionTrash->setEnabled(FALSE); 719 actionTrash->setEnabled(FALSE);
715#ifndef MAKE_FOR_SHARP_ROM 720#ifndef MAKE_FOR_SHARP_ROM
716 actionFind->setEnabled(FALSE); 721 actionFind->setEnabled(FALSE);
717#endif 722#endif
718 actionMail->setEnabled(FALSE); 723 actionMail->setEnabled(FALSE);
719 724
720 setCaption( tr("Contacts - My Personal Details") ); 725 setCaption( tr("Contacts - My Personal Details") );
721 QString filename = addressbookPersonalVCardName(); 726 QString filename = addressbookPersonalVCardName();
722 OContact me; 727 OContact me;
723 if (QFile::exists(filename)) 728 if (QFile::exists(filename))
724 me = OContact::readVCard( filename )[0]; 729 me = OContact::readVCard( filename )[0];
725 730
726 abView()->init( me ); 731 abView()->init( me );
727 abView()->sync(); 732 abView()->sync();
728 listContainer->hide(); 733 listContainer->hide();
diff --git a/core/pim/addressbook/configdlg_base.ui b/core/pim/addressbook/configdlg_base.ui
index d3ea12e..a6fcffa 100644
--- a/core/pim/addressbook/configdlg_base.ui
+++ b/core/pim/addressbook/configdlg_base.ui
@@ -1,48 +1,48 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>ConfigDlg_Base</class> 2<class>ConfigDlg_Base</class>
3<author>Stefan Eilers</author> 3<author>Stefan Eilers</author>
4<widget> 4<widget>
5 <class>QDialog</class> 5 <class>QDialog</class>
6 <property stdset="1"> 6 <property stdset="1">
7 <name>name</name> 7 <name>name</name>
8 <cstring>Configuration</cstring> 8 <cstring>Configuration</cstring>
9 </property> 9 </property>
10 <property stdset="1"> 10 <property stdset="1">
11 <name>geometry</name> 11 <name>geometry</name>
12 <rect> 12 <rect>
13 <x>0</x> 13 <x>0</x>
14 <y>0</y> 14 <y>0</y>
15 <width>217</width> 15 <width>244</width>
16 <height>287</height> 16 <height>298</height>
17 </rect> 17 </rect>
18 </property> 18 </property>
19 <property stdset="1"> 19 <property stdset="1">
20 <name>caption</name> 20 <name>caption</name>
21 <string>MyDialog1</string> 21 <string>MyDialog1</string>
22 </property> 22 </property>
23 <property stdset="1"> 23 <property stdset="1">
24 <name>sizeGripEnabled</name> 24 <name>sizeGripEnabled</name>
25 <bool>true</bool> 25 <bool>true</bool>
26 </property> 26 </property>
27 <vbox> 27 <vbox>
28 <property stdset="1"> 28 <property stdset="1">
29 <name>margin</name> 29 <name>margin</name>
30 <number>11</number> 30 <number>11</number>
31 </property> 31 </property>
32 <property stdset="1"> 32 <property stdset="1">
33 <name>spacing</name> 33 <name>spacing</name>
34 <number>6</number> 34 <number>6</number>
35 </property> 35 </property>
36 <widget> 36 <widget>
37 <class>QTabWidget</class> 37 <class>QTabWidget</class>
38 <property stdset="1"> 38 <property stdset="1">
39 <name>name</name> 39 <name>name</name>
40 <cstring>configDlg_base</cstring> 40 <cstring>configDlg_base</cstring>
41 </property> 41 </property>
42 <property> 42 <property>
43 <name>layoutMargin</name> 43 <name>layoutMargin</name>
44 </property> 44 </property>
45 <widget> 45 <widget>
46 <class>QWidget</class> 46 <class>QWidget</class>
47 <property stdset="1"> 47 <property stdset="1">
48 <name>name</name> 48 <name>name</name>
@@ -300,36 +300,38 @@ is provided free !</string>
300 <property stdset="1"> 300 <property stdset="1">
301 <name>text</name> 301 <name>text</name>
302 <string>&amp;Cancel</string> 302 <string>&amp;Cancel</string>
303 </property> 303 </property>
304 <property stdset="1"> 304 <property stdset="1">
305 <name>autoDefault</name> 305 <name>autoDefault</name>
306 <bool>true</bool> 306 <bool>true</bool>
307 </property> 307 </property>
308 </widget> 308 </widget>
309 </hbox> 309 </hbox>
310 </widget> 310 </widget>
311 </vbox> 311 </vbox>
312</widget> 312</widget>
313<connections> 313<connections>
314 <connection> 314 <connection>
315 <sender>buttonOk</sender> 315 <sender>buttonOk</sender>
316 <signal>clicked()</signal> 316 <signal>clicked()</signal>
317 <receiver>Configuration</receiver> 317 <receiver>Configuration</receiver>
318 <slot>accept()</slot> 318 <slot>accept()</slot>
319 </connection> 319 </connection>
320 <connection> 320 <connection>
321 <sender>buttonCancel</sender> 321 <sender>buttonCancel</sender>
322 <signal>clicked()</signal> 322 <signal>clicked()</signal>
323 <receiver>Configuration</receiver> 323 <receiver>Configuration</receiver>
324 <slot>reject()</slot> 324 <slot>reject()</slot>
325 </connection> 325 </connection>
326</connections> 326</connections>
327<tabstops> 327<tabstops>
328 <tabstop>configDlg_base</tabstop> 328 <tabstop>configDlg_base</tabstop>
329 <tabstop>m_useWildCard</tabstop> 329 <tabstop>m_useWildCard</tabstop>
330 <tabstop>m_useCaseSensitive</tabstop> 330 <tabstop>m_useCaseSensitive</tabstop>
331 <tabstop>m_signalWrapAround</tabstop> 331 <tabstop>m_signalWrapAround</tabstop>
332 <tabstop>m_useQtMail</tabstop>
333 <tabstop>m_useOpieMail</tabstop>
332 <tabstop>buttonOk</tabstop> 334 <tabstop>buttonOk</tabstop>
333 <tabstop>buttonCancel</tabstop> 335 <tabstop>buttonCancel</tabstop>
334</tabstops> 336</tabstops>
335</UI> 337</UI>
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index e7f2ebd..a59a927 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,92 +1,95 @@
1/* 1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> 2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 * 3 *
4 * This file is an add-on for the OPIE Palmtop Environment 4 * This file is an add-on for the OPIE Palmtop Environment
5 * 5 *
6 * This file may be distributed and/or modified under the terms of the 6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software 7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging 8 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
9 * of this file. 9 * of this file.
10 * 10 *
11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 * 13 *
14 * 14 *
15 * This is a rewrite of the abeditor.h file, modified to provide a more 15 * This is a rewrite of the abeditor.h file, modified to provide a more
16 * intuitive interface to TrollTech's original Address Book editor. This 16 * intuitive interface to TrollTech's original Address Book editor. This
17 * is made to operate exactly in interface with the exception of name. 17 * is made to operate exactly in interface with the exception of name.
18 * 18 *
19 */ 19 */
20 20
21#include "contacteditor.h" 21#include "contacteditor.h"
22#include "addresspicker.h" 22#include "addresspicker.h"
23 23
24#include <qpe/categoryselect.h> 24#include <qpe/categoryselect.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/qpedialog.h> 26#include <qpe/qpedialog.h>
27#include <qpe/timeconversion.h>
27 28
28#include <qcombobox.h> 29#include <qcombobox.h>
29#include <qlabel.h> 30#include <qlabel.h>
30#include <qtabwidget.h> 31#include <qtabwidget.h>
31#include <qlayout.h> 32#include <qlayout.h>
32#include <qlineedit.h> 33#include <qlineedit.h>
33#include <qmultilineedit.h> 34#include <qmultilineedit.h>
34#include <qscrollview.h> 35#include <qscrollview.h>
35#include <qtoolbutton.h> 36#include <qtoolbutton.h>
36#include <qpushbutton.h> 37#include <qpushbutton.h>
37#include <qmainwindow.h> 38#include <qmainwindow.h>
38#include <qvaluelist.h> 39#include <qvaluelist.h>
40#include <qpopupmenu.h>
39 41
40static inline bool containsAlphaNum( const QString &str ); 42static inline bool containsAlphaNum( const QString &str );
41static inline bool constainsWhiteSpace( const QString &str ); 43static inline bool constainsWhiteSpace( const QString &str );
42 44
43// helper functions, convert our comma delimited list to proper 45// helper functions, convert our comma delimited list to proper
44// file format... 46// file format...
45void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 47void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
46 QString &strAll ); 48 QString &strAll );
47 49
48// helper convert from file format to comma delimited... 50// helper convert from file format to comma delimited...
49void parseEmailTo( const QString &strDefaultEmail, 51void parseEmailTo( const QString &strDefaultEmail,
50 const QString &strOtherEmail, QString &strBack ); 52 const QString &strOtherEmail, QString &strBack );
51 53
52 ContactEditor::ContactEditor(const OContact &entry, 54 ContactEditor::ContactEditor(const OContact &entry,
53 const QValueList<int> *newOrderedValues, 55 const QValueList<int> *newOrderedValues,
54 QStringList *slNewOrdered, 56 QStringList *slNewOrdered,
55 QWidget *parent, 57 QWidget *parent,
56 const char *name, 58 const char *name,
57 WFlags fl ) 59 WFlags fl )
58 : QDialog( parent, name, TRUE, fl ), 60 : QDialog( parent, name, TRUE, fl ),
59 orderedValues( newOrderedValues ), 61 orderedValues( newOrderedValues ),
60 slOrdered( *slNewOrdered ) 62 slOrdered( *slNewOrdered ),
63 m_personalView ( false )
61{ 64{
62 65
63 init(); 66 init();
64 initMap(); 67 initMap();
65 setEntry( entry ); 68 setEntry( entry );
66 qDebug("finish"); 69 qDebug("finish");
67} 70}
68 71
69ContactEditor::~ContactEditor() { 72ContactEditor::~ContactEditor() {
70} 73}
71 74
72void ContactEditor::init() { 75void ContactEditor::init() {
73 76
74 useFullName = TRUE; 77 useFullName = TRUE;
75 78
76 int i = 0; 79 int i = 0;
77/** SHut up and stop leaking 80/** SHut up and stop leaking
78 slHomeAddress = new QStringList; 81 slHomeAddress = new QStringList;
79 slBusinessAddress = new QStringList; 82 slBusinessAddress = new QStringList;
80 slChooserNames = new QStringList; 83 slChooserNames = new QStringList;
81 slChooserValues = new QStringList; 84 slChooserValues = new QStringList;
82 85
83 slDynamicEntries = new QStringList; 86 slDynamicEntries = new QStringList;
84*/ 87*/
85 //*slDynamicEntries = *slOrdered; 88 //*slDynamicEntries = *slOrdered;
86 89
87 QStringList trlChooserNames; 90 QStringList trlChooserNames;
88 91
89 for (i = 0; i <= 6; i++) { 92 for (i = 0; i <= 6; i++) {
90 slHomeAddress.append( "" ); 93 slHomeAddress.append( "" );
91 slBusinessAddress.append( "" ); 94 slBusinessAddress.append( "" );
92 } 95 }
@@ -177,65 +180,74 @@ void ContactEditor::init() {
177 if ( (*it) == "Home Web Page" ) { 180 if ( (*it) == "Home Web Page" ) {
178 trlChooserNames.append( tr( "Home Web Page" ) ); 181 trlChooserNames.append( tr( "Home Web Page" ) );
179 slChooserNames.append( *it ); 182 slChooserNames.append( *it );
180 slChooserValues.append( "" ); 183 slChooserValues.append( "" );
181 //slDynamicEntries->remove( it ); 184 //slDynamicEntries->remove( it );
182 continue; 185 continue;
183 } 186 }
184 187
185 if ( (*it) == "Business Pager" ) { 188 if ( (*it) == "Business Pager" ) {
186 trlChooserNames.append( tr( "Business Pager" ) ); 189 trlChooserNames.append( tr( "Business Pager" ) );
187 slChooserNames.append( *it ); 190 slChooserNames.append( *it );
188 slChooserValues.append( "" ); 191 slChooserValues.append( "" );
189 //slDynamicEntries->remove( it ); 192 //slDynamicEntries->remove( it );
190 continue; 193 continue;
191 } 194 }
192 195
193 if ( *it == "Default Email" ) { 196 if ( *it == "Default Email" ) {
194 trlChooserNames.append( tr( "Default Email" ) ); 197 trlChooserNames.append( tr( "Default Email" ) );
195 slChooserNames.append( *it ); 198 slChooserNames.append( *it );
196 slChooserValues.append( "" ); 199 slChooserValues.append( "" );
197 //slDynamicEntries->remove( it ); 200 //slDynamicEntries->remove( it );
198 continue; 201 continue;
199 } 202 }
200 203
201 if ( *it == "Emails" ) { 204 if ( *it == "Emails" ) {
202 trlChooserNames.append( tr( "Emails" ) ); 205 trlChooserNames.append( tr( "Emails" ) );
203 slChooserNames.append( *it ); 206 slChooserNames.append( *it );
204 slChooserValues.append( "" ); 207 slChooserValues.append( "" );
205 //slDynamicEntries->remove( it ); 208 //slDynamicEntries->remove( it );
206 continue; 209 continue;
207 } 210 }
208 211
209 if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" ) 212 if ( *it == "Name Title" ||
213 *it == "First Name" ||
214 *it == "Middle Name" ||
215 *it == "Last Name" ||
216 *it == "File As" ||
217 *it == "Default Email" ||
218 *it == "Emails" ||
219 *it == "Groups" ||
220 *it == "Anniversary" ||
221 *it == "Birthday" )
210 continue; 222 continue;
211 223
212 if ( *it == "Name Title" ) { 224 if ( *it == "Name Title" ) {
213 //slDynamicEntries->remove( it ); 225 //slDynamicEntries->remove( it );
214 continue; 226 continue;
215 } 227 }
216 228
217 if ( *it == "First Name" ) { 229 if ( *it == "First Name" ) {
218 //slDynamicEntries->remove( it ); 230 //slDynamicEntries->remove( it );
219 continue; 231 continue;
220 } 232 }
221 233
222 if ( *it == "Middle Name" ) { 234 if ( *it == "Middle Name" ) {
223 //slDynamicEntries->remove( it ); 235 //slDynamicEntries->remove( it );
224 continue; 236 continue;
225 } 237 }
226 238
227 if ( *it == "Last Name" ) { 239 if ( *it == "Last Name" ) {
228 //slDynamicEntries->remove( it ); 240 //slDynamicEntries->remove( it );
229 continue; 241 continue;
230 } 242 }
231 243
232 if ( *it == "Suffix" ) { 244 if ( *it == "Suffix" ) {
233 //slDynamicEntries->remove( it ); 245 //slDynamicEntries->remove( it );
234 continue; 246 continue;
235 } 247 }
236 248
237 if ( *it == "File As" ) { 249 if ( *it == "File As" ) {
238 //slDynamicEntries->remove( it ); 250 //slDynamicEntries->remove( it );
239 continue; 251 continue;
240 } 252 }
241 253
@@ -373,69 +385,79 @@ void ContactEditor::init() {
373 gl->addWidget( l, 1, 0 ); 385 gl->addWidget( l, 1, 0 );
374 txtJobTitle = new QLineEdit( container ); 386 txtJobTitle = new QLineEdit( container );
375 gl->addWidget( txtJobTitle, 1, 1 ); 387 gl->addWidget( txtJobTitle, 1, 1 );
376 388
377 l = new QLabel( tr( "Organization" ), container ); 389 l = new QLabel( tr( "Organization" ), container );
378 gl->addWidget( l, 2, 0 ); 390 gl->addWidget( l, 2, 0 );
379 txtOrganization = new QLineEdit( container ); 391 txtOrganization = new QLineEdit( container );
380 gl->addWidget( txtOrganization, 2, 1 ); 392 gl->addWidget( txtOrganization, 2, 1 );
381 393
382 cmbChooserField1 = new QComboBox( FALSE, container ); 394 cmbChooserField1 = new QComboBox( FALSE, container );
383 cmbChooserField1->setMaximumWidth( 90 ); 395 cmbChooserField1->setMaximumWidth( 90 );
384 gl->addWidget( cmbChooserField1, 3, 0 ); 396 gl->addWidget( cmbChooserField1, 3, 0 );
385 txtChooserField1 = new QLineEdit( container ); 397 txtChooserField1 = new QLineEdit( container );
386 gl->addWidget( txtChooserField1, 3, 1 ); 398 gl->addWidget( txtChooserField1, 3, 1 );
387 399
388 cmbChooserField2 = new QComboBox( FALSE, container ); 400 cmbChooserField2 = new QComboBox( FALSE, container );
389 cmbChooserField2->setMaximumWidth( 90 ); 401 cmbChooserField2->setMaximumWidth( 90 );
390 gl->addWidget( cmbChooserField2, 4, 0 ); 402 gl->addWidget( cmbChooserField2, 4, 0 );
391 txtChooserField2 = new QLineEdit( container ); 403 txtChooserField2 = new QLineEdit( container );
392 gl->addWidget( txtChooserField2, 4, 1 ); 404 gl->addWidget( txtChooserField2, 4, 1 );
393 405
394 cmbChooserField3 = new QComboBox( FALSE, container ); 406 cmbChooserField3 = new QComboBox( FALSE, container );
395 cmbChooserField3->setMaximumWidth( 90 ); 407 cmbChooserField3->setMaximumWidth( 90 );
396 gl->addWidget( cmbChooserField3, 5, 0 ); 408 gl->addWidget( cmbChooserField3, 5, 0 );
397 txtChooserField3 = new QLineEdit( container ); 409 txtChooserField3 = new QLineEdit( container );
398 gl->addWidget( txtChooserField3, 5, 1 ); 410 gl->addWidget( txtChooserField3, 5, 1 );
399 411
400 l = new QLabel( tr( "File As" ), container ); 412 l = new QLabel( tr( "File As" ), container );
401 gl->addWidget( l, 6, 0 ); 413 gl->addWidget( l, 6, 0 );
402 cmbFileAs = new QComboBox( TRUE, container ); 414 cmbFileAs = new QComboBox( TRUE, container );
403 gl->addWidget( cmbFileAs, 6, 1 ); 415 gl->addWidget( cmbFileAs, 6, 1 );
404 416
405 l = new QLabel( tr( "Category" ), container ); 417 labCat = new QLabel( tr( "Category" ), container );
406 gl->addWidget( l, 7, 0 ); 418 gl->addWidget( labCat, 7, 0 );
407 cmbCat = new CategorySelect( container ); 419 cmbCat = new CategorySelect( container );
408 gl->addWidget( cmbCat, 7, 1 ); 420 gl->addWidget( cmbCat, 7, 1 );
409 421
422 // We don't need categories for the personal view
423 if ( m_personalView ){
424 qWarning("Disable Category..");
425 labCat->hide();
426 cmbCat->hide();
427 } else {
428 labCat->show();
429 cmbCat->show();
430 }
431
410 btnNote = new QPushButton( tr( "Notes..." ), container ); 432 btnNote = new QPushButton( tr( "Notes..." ), container );
411 gl->addWidget( btnNote, 8, 1 ); 433 gl->addWidget( btnNote, 8, 1 );
412 434
413 tabMain->insertTab( tabViewport, tr( "General" ) ); 435 tabMain->insertTab( tabViewport, tr( "General" ) );
414 436
415 tabViewport = new QWidget ( tabMain ); 437 tabViewport = new QWidget ( tabMain );
416 438
417 vb = new QVBoxLayout( tabViewport ); 439 vb = new QVBoxLayout( tabViewport );
418 440
419 svAddress = new QScrollView( tabViewport ); 441 svAddress = new QScrollView( tabViewport );
420 vb->addWidget( svAddress, 0, 0 ); 442 vb->addWidget( svAddress, 0, 0 );
421 svAddress->setResizePolicy( QScrollView::AutoOneFit ); 443 svAddress->setResizePolicy( QScrollView::AutoOneFit );
422 svAddress->setFrameStyle( QFrame::NoFrame ); 444 svAddress->setFrameStyle( QFrame::NoFrame );
423 445
424 container = new QWidget( svAddress->viewport() ); 446 container = new QWidget( svAddress->viewport() );
425 svAddress->addChild( container ); 447 svAddress->addChild( container );
426 448
427 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem 449 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem
428 450
429 cmbAddress = new QComboBox( FALSE, container ); 451 cmbAddress = new QComboBox( FALSE, container );
430 cmbAddress->insertItem( tr( "Business" ) ); 452 cmbAddress->insertItem( tr( "Business" ) );
431 cmbAddress->insertItem( tr( "Home" ) ); 453 cmbAddress->insertItem( tr( "Home" ) );
432 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); 454 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 );
433 455
434 l = new QLabel( tr( "Address" ), container ); 456 l = new QLabel( tr( "Address" ), container );
435 gl->addWidget( l, 1, 0 ); 457 gl->addWidget( l, 1, 0 );
436 txtAddress = new QLineEdit( container ); 458 txtAddress = new QLineEdit( container );
437 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); 459 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 );
438/* 460/*
439 l = new QLabel( tr( "Address 2" ), container ); 461 l = new QLabel( tr( "Address 2" ), container );
440 gl->addWidget( l, 2, 0 ); 462 gl->addWidget( l, 2, 0 );
441 txtAddress2 = new QLineEdit( container ); 463 txtAddress2 = new QLineEdit( container );
@@ -678,84 +700,124 @@ void ContactEditor::init() {
678 700
679 cmbCountry->setMaximumWidth( 135 ); 701 cmbCountry->setMaximumWidth( 135 );
680 702
681 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); 703 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 );
682 704
683 cmbChooserField4 = new QComboBox( FALSE, container ); 705 cmbChooserField4 = new QComboBox( FALSE, container );
684 cmbChooserField4->setMaximumWidth( 90 ); 706 cmbChooserField4->setMaximumWidth( 90 );
685 gl->addWidget( cmbChooserField4, 6, 0 ); 707 gl->addWidget( cmbChooserField4, 6, 0 );
686 txtChooserField4 = new QLineEdit( container ); 708 txtChooserField4 = new QLineEdit( container );
687 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); 709 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 );
688 710
689 QSpacerItem *space = new QSpacerItem(1,1, 711 QSpacerItem *space = new QSpacerItem(1,1,
690 QSizePolicy::Maximum, 712 QSizePolicy::Maximum,
691 QSizePolicy::MinimumExpanding ); 713 QSizePolicy::MinimumExpanding );
692 gl->addItem( space, 7, 0 ); 714 gl->addItem( space, 7, 0 );
693 715
694 tabMain->insertTab( tabViewport, tr( "Address" ) ); 716 tabMain->insertTab( tabViewport, tr( "Address" ) );
695 717
696 tabViewport = new QWidget ( tabMain ); 718 tabViewport = new QWidget ( tabMain );
697 719
698 vb = new QVBoxLayout( tabViewport ); 720 vb = new QVBoxLayout( tabViewport );
699 721
700 svDetails = new QScrollView( tabViewport ); 722 svDetails = new QScrollView( tabViewport );
701 vb->addWidget( svDetails, 0, 0 ); 723 vb->addWidget( svDetails, 0, 0 );
702 svDetails->setResizePolicy( QScrollView::AutoOneFit ); 724 svDetails->setResizePolicy( QScrollView::AutoOneFit );
703 svDetails->setFrameStyle( QFrame::NoFrame ); 725 svDetails->setFrameStyle( QFrame::NoFrame );
704 726
705 container = new QWidget( svDetails->viewport() ); 727 container = new QWidget( svDetails->viewport() );
706 svDetails->addChild( container ); 728 svDetails->addChild( container );
707 729
708 gl = new QGridLayout( container, 1, 2, 2, 4 ); 730 gl = new QGridLayout( container, 1, 2, 2, 4 );
709 731
732 int counter = 0;
733
734 // Birthday
735 l = new QLabel( tr("Birthday"), container );
736 gl->addWidget( l, counter, 0 );
737
738 QPopupMenu* m1 = new QPopupMenu( container );
739 birthdayPicker = new DateBookMonth( m1, 0, TRUE );
740 m1->insertItem( birthdayPicker );
741
742 birthdayButton= new QToolButton( container, "buttonStart" );
743 birthdayButton->setPopup( m1 );
744 birthdayButton->setPopupDelay(0);
745 gl->addWidget( birthdayButton, counter , 1 );
746 connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ),
747 this, SLOT( slotBirthdayDateChanged( int, int, int ) ) );
748
749 ++counter;
750
751 // Anniversary
752 l = new QLabel( tr("Anniversary"), container );
753 gl->addWidget( l, counter, 0 );
754
755 m1 = new QPopupMenu( container );
756 anniversaryPicker = new DateBookMonth( m1, 0, TRUE );
757 m1->insertItem( anniversaryPicker );
758
759 anniversaryButton= new QToolButton( container, "buttonStart" );
760 anniversaryButton->setPopup( m1 );
761 anniversaryButton->setPopupDelay(0);
762 gl->addWidget( anniversaryButton, counter , 1 );
763 connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ),
764 this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) );
765
766 ++counter;
767
768 // Gender
769 l = new QLabel( tr("Gender"), container );
770 gl->addWidget( l, counter, 0 );
771 cmbGender = new QComboBox( container );
772 cmbGender->insertItem( "", 0 );
773 cmbGender->insertItem( tr("Male"), 1);
774 cmbGender->insertItem( tr("Female"), 2);
775 gl->addWidget( cmbGender, counter, 1 );
776
777 ++counter;
778
710 // Create Labels and lineedit fields for every dynamic entry 779 // Create Labels and lineedit fields for every dynamic entry
711 QStringList::ConstIterator it = slDynamicEntries.begin(); 780 QStringList::ConstIterator it = slDynamicEntries.begin();
712 for (i = 0; it != slDynamicEntries.end(); i++, ++it) { 781 for (i = counter; it != slDynamicEntries.end(); i++, ++it) {
713 l = new QLabel( QString::null , container ); 782 l = new QLabel( QString::null , container );
714 listName.append( l ); 783 listName.append( l );
715 gl->addWidget( l, i, 0 ); 784 gl->addWidget( l, i, 0 );
716 QLineEdit *e = new QLineEdit( container ); 785 QLineEdit *e = new QLineEdit( container );
717 listValue.append( e ); 786 listValue.append( e );
718 gl->addWidget( e, i, 1); 787 gl->addWidget( e, i, 1);
719 } 788 }
720 // Fill labels with names.. 789 // Fill labels with names..
721 loadFields(); 790 loadFields();
722 791
723 l = new QLabel( tr("Gender"), container );
724 gl->addWidget( l, slDynamicEntries.count(), 0 );
725 cmbGender = new QComboBox( container );
726 cmbGender->insertItem( "", 0 );
727 cmbGender->insertItem( tr("Male"), 1);
728 cmbGender->insertItem( tr("Female"), 2);
729 gl->addWidget( cmbGender, slDynamicEntries.count(), 1 );
730 792
731 tabMain->insertTab( tabViewport, tr( "Details" ) ); 793 tabMain->insertTab( tabViewport, tr( "Details" ) );
732 794
733 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 795 dlgNote = new QDialog( this, "Note Dialog", TRUE );
734 dlgNote->setCaption( tr("Enter Note") ); 796 dlgNote->setCaption( tr("Enter Note") );
735 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 797 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
736 txtNote = new QMultiLineEdit( dlgNote ); 798 txtNote = new QMultiLineEdit( dlgNote );
737 vbNote->addWidget( txtNote ); 799 vbNote->addWidget( txtNote );
738 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 800 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
739 801
740 dlgName = new QDialog( this, "Name Dialog", TRUE ); 802 dlgName = new QDialog( this, "Name Dialog", TRUE );
741 dlgName->setCaption( tr("Edit Name") ); 803 dlgName->setCaption( tr("Edit Name") );
742 gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); 804 gl = new QGridLayout( dlgName, 5, 2, 2, 3 );
743 805
744 l = new QLabel( tr("First Name"), dlgName ); 806 l = new QLabel( tr("First Name"), dlgName );
745 gl->addWidget( l, 0, 0 ); 807 gl->addWidget( l, 0, 0 );
746 txtFirstName = new QLineEdit( dlgName ); 808 txtFirstName = new QLineEdit( dlgName );
747 gl->addWidget( txtFirstName, 0, 1 ); 809 gl->addWidget( txtFirstName, 0, 1 );
748 810
749 l = new QLabel( tr("Middle Name"), dlgName ); 811 l = new QLabel( tr("Middle Name"), dlgName );
750 gl->addWidget( l, 1, 0 ); 812 gl->addWidget( l, 1, 0 );
751 txtMiddleName = new QLineEdit( dlgName ); 813 txtMiddleName = new QLineEdit( dlgName );
752 gl->addWidget( txtMiddleName, 1, 1 ); 814 gl->addWidget( txtMiddleName, 1, 1 );
753 815
754 l = new QLabel( tr("Last Name"), dlgName ); 816 l = new QLabel( tr("Last Name"), dlgName );
755 gl->addWidget( l, 2, 0 ); 817 gl->addWidget( l, 2, 0 );
756 txtLastName = new QLineEdit( dlgName ); 818 txtLastName = new QLineEdit( dlgName );
757 gl->addWidget( txtLastName, 2, 1 ); 819 gl->addWidget( txtLastName, 2, 1 );
758 820
759 l = new QLabel( tr("Suffix"), dlgName ); 821 l = new QLabel( tr("Suffix"), dlgName );
760 gl->addWidget( l, 3, 0 ); 822 gl->addWidget( l, 3, 0 );
761 txtSuffix = new QLineEdit( dlgName ); 823 txtSuffix = new QLineEdit( dlgName );
@@ -980,103 +1042,113 @@ void ContactEditor::slotAddressTypeChange( int index ) {
980 } else { 1042 } else {
981 1043
982 txtAddress->setText( slHomeAddress[0] ); 1044 txtAddress->setText( slHomeAddress[0] );
983 //txtAddress2->setText( (*slHomeAddress)[1] ); 1045 //txtAddress2->setText( (*slHomeAddress)[1] );
984 //txtPOBox->setText( (*slHomeAddress)[2] ); 1046 //txtPOBox->setText( (*slHomeAddress)[2] );
985 txtCity->setText( slHomeAddress[3] ); 1047 txtCity->setText( slHomeAddress[3] );
986 txtState->setText( slHomeAddress[4] ); 1048 txtState->setText( slHomeAddress[4] );
987 txtZip->setText( slHomeAddress[5] ); 1049 txtZip->setText( slHomeAddress[5] );
988 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1050 QLineEdit *txtTmp = cmbCountry->lineEdit();
989 txtTmp->setText( slHomeAddress[6] ); 1051 txtTmp->setText( slHomeAddress[6] );
990 1052
991 } 1053 }
992 1054
993} 1055}
994 1056
995void ContactEditor::slotFullNameChange( const QString &textChanged ) { 1057void ContactEditor::slotFullNameChange( const QString &textChanged ) {
996 1058
997 int index = cmbFileAs->currentItem(); 1059 int index = cmbFileAs->currentItem();
998 1060
999 cmbFileAs->clear(); 1061 cmbFileAs->clear();
1000 1062
1001 cmbFileAs->insertItem( parseName( textChanged, 0 ) ); 1063 cmbFileAs->insertItem( parseName( textChanged, 0 ) );
1002 cmbFileAs->insertItem( parseName( textChanged, 1 ) ); 1064 cmbFileAs->insertItem( parseName( textChanged, 1 ) );
1003 cmbFileAs->insertItem( parseName( textChanged, 2 ) ); 1065 cmbFileAs->insertItem( parseName( textChanged, 2 ) );
1004 cmbFileAs->insertItem( parseName( textChanged, 3 ) ); 1066 cmbFileAs->insertItem( parseName( textChanged, 3 ) );
1005 1067
1006 cmbFileAs->setCurrentItem( index ); 1068 cmbFileAs->setCurrentItem( index );
1007 1069
1008 useFullName = TRUE; 1070 useFullName = TRUE;
1009 1071
1010} 1072}
1011 1073
1074// Loads the detail fields
1012void ContactEditor::loadFields() { 1075void ContactEditor::loadFields() {
1013 1076
1014 QStringList::ConstIterator it; 1077 QStringList::ConstIterator it;
1015 QListIterator<QLabel> lit( listName ); 1078 QListIterator<QLabel> lit( listName );
1016 for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { 1079 for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) {
1017 1080
1018 if ( *it == "Department" ) 1081 if ( *it == "Department" )
1019 (*lit)->setText( tr( "Department" ) ); 1082 (*lit)->setText( tr( "Department" ) );
1020 1083
1021 if ( *it == "Company" ) 1084 if ( *it == "Company" )
1022 (*lit)->setText( tr( "Company" ) ); 1085 (*lit)->setText( tr( "Company" ) );
1023 1086
1024 if ( *it == "Office" ) 1087 if ( *it == "Office" )
1025 (*lit)->setText( tr( "Office" ) ); 1088 (*lit)->setText( tr( "Office" ) );
1026 1089
1027 if ( *it == "Profession" ) 1090 if ( *it == "Profession" )
1028 (*lit)->setText( tr( "Profession" ) ); 1091 (*lit)->setText( tr( "Profession" ) );
1029 1092
1030 if ( *it == "Assistant" ) 1093 if ( *it == "Assistant" )
1031 (*lit)->setText( tr( "Assistant" ) ); 1094 (*lit)->setText( tr( "Assistant" ) );
1032 1095
1033 if ( *it == "Manager" ) 1096 if ( *it == "Manager" )
1034 (*lit)->setText( tr( "Manager" ) ); 1097 (*lit)->setText( tr( "Manager" ) );
1035 1098
1036 if ( *it == "Spouse" ) 1099 if ( *it == "Spouse" )
1037 (*lit)->setText( tr( "Spouse" ) ); 1100 (*lit)->setText( tr( "Spouse" ) );
1038 1101
1039 if ( *it == "Birthday" )
1040 (*lit)->setText( tr( "Birthday" ) );
1041
1042 if ( *it == "Anniversary" )
1043 (*lit)->setText( tr( "Anniversary" ) );
1044
1045 if ( *it == "Nickname" ) 1102 if ( *it == "Nickname" )
1046 (*lit)->setText( tr( "Nickname" ) ); 1103 (*lit)->setText( tr( "Nickname" ) );
1047 1104
1048 if ( *it == "Children" ) 1105 if ( *it == "Children" )
1049 (*lit)->setText( tr( "Children" ) ); 1106 (*lit)->setText( tr( "Children" ) );
1050 } 1107 }
1108 // Set DatePicker
1109 qWarning ("**Info: %s", ent.birthday().latin1() );
1110 if ( !ent.birthday().isEmpty() ){
1111 birthdayButton->setText( ent.birthday() );
1112 birthdayPicker->setDate( TimeConversion::fromString ( ent.birthday() ) );
1113 } else
1114 birthdayButton->setText( tr ("Unknown") );
1115
1116 qWarning ("**Info: %s", ent.anniversary().latin1() );
1117 if ( !ent.anniversary().isEmpty() ){
1118 anniversaryButton->setText( ent.anniversary() );
1119 anniversaryPicker->setDate( TimeConversion::fromString ( ent.birthday() ) );
1120 } else
1121 anniversaryButton->setText( tr ("Unknown") );
1122
1051} 1123}
1052 1124
1053void ContactEditor::accept() { 1125void ContactEditor::accept() {
1054 1126
1055 if ( isEmpty() ) { 1127 if ( isEmpty() ) {
1056 cleanupFields(); 1128 cleanupFields();
1057 reject(); 1129 reject();
1058 } else { 1130 } else {
1059 saveEntry(); 1131 saveEntry();
1060 cleanupFields(); 1132 cleanupFields();
1061 QDialog::accept(); 1133 QDialog::accept();
1062 } 1134 }
1063 1135
1064} 1136}
1065 1137
1066void ContactEditor::slotNote() { 1138void ContactEditor::slotNote() {
1067 1139
1068 dlgNote->showMaximized(); 1140 dlgNote->showMaximized();
1069 if ( !dlgNote->exec() ) { 1141 if ( !dlgNote->exec() ) {
1070 txtNote->setText( ent.notes() ); 1142 txtNote->setText( ent.notes() );
1071 } 1143 }
1072} 1144}
1073 1145
1074void ContactEditor::slotName() { 1146void ContactEditor::slotName() {
1075 1147
1076 QString tmpName; 1148 QString tmpName;
1077 if (useFullName == TRUE) { 1149 if (useFullName == TRUE) {
1078 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); 1150 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
1079 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); 1151 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
1080 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 1152 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
1081 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 1153 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
1082 } 1154 }
@@ -1400,70 +1472,64 @@ void ContactEditor::setEntry( const OContact &entry ) {
1400 slBusinessAddress[5] = ent.businessZip(); 1472 slBusinessAddress[5] = ent.businessZip();
1401 } 1473 }
1402 1474
1403 if (hasCountry) { 1475 if (hasCountry) {
1404 slHomeAddress[6] = ent.homeCountry(); 1476 slHomeAddress[6] = ent.homeCountry();
1405 slBusinessAddress[6] = ent.businessCountry(); 1477 slBusinessAddress[6] = ent.businessCountry();
1406 } 1478 }
1407 1479
1408 QStringList::ConstIterator it; 1480 QStringList::ConstIterator it;
1409 QListIterator<QLineEdit> itLE( listValue ); 1481 QListIterator<QLineEdit> itLE( listValue );
1410 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { 1482 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) {
1411 if ( *it == "Department" ) 1483 if ( *it == "Department" )
1412 (*itLE)->setText( ent.department() ); 1484 (*itLE)->setText( ent.department() );
1413 1485
1414 if ( *it == "Company" ) 1486 if ( *it == "Company" )
1415 (*itLE)->setText( ent.company() ); 1487 (*itLE)->setText( ent.company() );
1416 1488
1417 if ( *it == "Office" ) 1489 if ( *it == "Office" )
1418 (*itLE)->setText( ent.office() ); 1490 (*itLE)->setText( ent.office() );
1419 1491
1420 if ( *it == "Profession" ) 1492 if ( *it == "Profession" )
1421 (*itLE)->setText( ent.profession() ); 1493 (*itLE)->setText( ent.profession() );
1422 1494
1423 if ( *it == "Assistant" ) 1495 if ( *it == "Assistant" )
1424 (*itLE)->setText( ent.assistant() ); 1496 (*itLE)->setText( ent.assistant() );
1425 1497
1426 if ( *it == "Manager" ) 1498 if ( *it == "Manager" )
1427 (*itLE)->setText( ent.manager() ); 1499 (*itLE)->setText( ent.manager() );
1428 1500
1429 if ( *it == "Spouse" ) 1501 if ( *it == "Spouse" )
1430 (*itLE)->setText( ent.spouse() ); 1502 (*itLE)->setText( ent.spouse() );
1431 1503
1432 if ( *it == "Birthday" )
1433 (*itLE)->setText( ent.birthday() );
1434
1435 if ( *it == "Anniversary" )
1436 (*itLE)->setText( ent.anniversary() );
1437
1438 if ( *it == "Nickname" ) 1504 if ( *it == "Nickname" )
1439 (*itLE)->setText( ent.nickname() ); 1505 (*itLE)->setText( ent.nickname() );
1440 1506
1441 if ( *it == "Children" ) 1507 if ( *it == "Children" )
1442 (*itLE)->setText( ent.children() ); 1508 (*itLE)->setText( ent.children() );
1443 1509
1444 } 1510 }
1445 1511
1446 QStringList::Iterator itV; 1512 QStringList::Iterator itV;
1447 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1513 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1448 1514
1449 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) 1515 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) )
1450 *itV = ent.businessPhone(); 1516 *itV = ent.businessPhone();
1451/* 1517/*
1452 if ( *it == "Business 2 Phone" ) 1518 if ( *it == "Business 2 Phone" )
1453 *itV = ent.business2Phone(); 1519 *itV = ent.business2Phone();
1454*/ 1520*/
1455 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) 1521 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) )
1456 *itV = ent.businessFax(); 1522 *itV = ent.businessFax();
1457 1523
1458 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) 1524 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) )
1459 *itV = ent.businessMobile(); 1525 *itV = ent.businessMobile();
1460/* 1526/*
1461 if ( *it == "Company Phone" ) 1527 if ( *it == "Company Phone" )
1462 *itV = ent.companyPhone(); 1528 *itV = ent.companyPhone();
1463*/ 1529*/
1464 if ( *it == "Default Email" ) 1530 if ( *it == "Default Email" )
1465 *itV = ent.defaultEmail(); 1531 *itV = ent.defaultEmail();
1466 1532
1467 if ( *it == "Emails" ) 1533 if ( *it == "Emails" )
1468 *itV = ent.emailList().join(", "); // :SX 1534 *itV = ent.emailList().join(", "); // :SX
1469 1535
@@ -1489,77 +1555,80 @@ void ContactEditor::setEntry( const OContact &entry ) {
1489 *itV = ent.otherPhone(); 1555 *itV = ent.otherPhone();
1490*/ 1556*/
1491 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1557 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1492 *itV = ent.businessPager(); 1558 *itV = ent.businessPager();
1493/* 1559/*
1494 if ( *it == "Home Pager") 1560 if ( *it == "Home Pager")
1495 *itV = ent.homePager(); 1561 *itV = ent.homePager();
1496 1562
1497 if ( *it == "AIM IM" ) 1563 if ( *it == "AIM IM" )
1498 *itV = ent.AIMIM(); 1564 *itV = ent.AIMIM();
1499 1565
1500 if ( *it == "ICQ IM" ) 1566 if ( *it == "ICQ IM" )
1501 *itV = ent.ICQIM(); 1567 *itV = ent.ICQIM();
1502 1568
1503 if ( *it == "Jabber IM" ) 1569 if ( *it == "Jabber IM" )
1504 *itV = ent.jabberIM(); 1570 *itV = ent.jabberIM();
1505 1571
1506 if ( *it == "MSN IM" ) 1572 if ( *it == "MSN IM" )
1507 *itV = ent.MSNIM(); 1573 *itV = ent.MSNIM();
1508 1574
1509 if ( *it == "Yahoo IM" ) 1575 if ( *it == "Yahoo IM" )
1510 *itV = ent.yahooIM(); 1576 *itV = ent.yahooIM();
1511*/ 1577*/
1512 if ( *it == "Home Web Page" ) 1578 if ( *it == "Home Web Page" )
1513 *itV = ent.homeWebpage(); 1579 *itV = ent.homeWebpage();
1514 1580
1515 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1581 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1516 *itV = ent.businessWebpage(); 1582 *itV = ent.businessWebpage();
1517 1583
1518 1584
1519 } 1585 }
1520 1586
1587
1521 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1588 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1522 1589
1523 QString gender = ent.gender(); 1590 QString gender = ent.gender();
1524 cmbGender->setCurrentItem( gender.toInt() ); 1591 cmbGender->setCurrentItem( gender.toInt() );
1525 1592
1526 txtNote->setText( ent.notes() ); 1593 txtNote->setText( ent.notes() );
1527 1594
1528 slotCmbChooser1Change( cmbChooserField1->currentItem() ); 1595 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1529 slotCmbChooser2Change( cmbChooserField2->currentItem() ); 1596 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1530 slotCmbChooser3Change( cmbChooserField3->currentItem() ); 1597 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1531 1598
1532 slotAddressTypeChange( cmbAddress->currentItem() ); 1599 slotAddressTypeChange( cmbAddress->currentItem() );
1533 1600
1601 loadFields();
1602
1534} 1603}
1535 1604
1536void ContactEditor::saveEntry() { 1605void ContactEditor::saveEntry() {
1537 1606
1538 if ( useFullName == TRUE ) { 1607 if ( useFullName == TRUE ) {
1539 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1608 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1540 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1609 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1541 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1610 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1542 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1611 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1543 1612
1544 useFullName = FALSE; 1613 useFullName = FALSE;
1545} 1614}
1546 1615
1547 /*if ( ent.firstName() != txtFirstName->text() || 1616 /*if ( ent.firstName() != txtFirstName->text() ||
1548 ent.lastName != txtLastName->text() || 1617 ent.lastName != txtLastName->text() ||
1549 ent.middleName != txtMiddleName->text() ) { 1618 ent.middleName != txtMiddleName->text() ) {
1550 */ 1619 */
1551 ent.setFirstName( txtFirstName->text() ); 1620 ent.setFirstName( txtFirstName->text() );
1552 ent.setLastName( txtLastName->text() ); 1621 ent.setLastName( txtLastName->text() );
1553 ent.setMiddleName( txtMiddleName->text() ); 1622 ent.setMiddleName( txtMiddleName->text() );
1554 ent.setSuffix( txtSuffix->text() ); 1623 ent.setSuffix( txtSuffix->text() );
1555 1624
1556 //} 1625 //}
1557 1626
1558 ent.setFileAs( cmbFileAs->currentText() ); 1627 ent.setFileAs( cmbFileAs->currentText() );
1559 1628
1560 ent.setCategories( cmbCat->currentCategories() ); 1629 ent.setCategories( cmbCat->currentCategories() );
1561 1630
1562 if (hasTitle) 1631 if (hasTitle)
1563 ent.setJobTitle( txtJobTitle->text() ); 1632 ent.setJobTitle( txtJobTitle->text() );
1564 1633
1565 if (hasCompany) 1634 if (hasCompany)
@@ -1598,70 +1667,64 @@ void ContactEditor::saveEntry() {
1598 ent.setBusinessZip( slBusinessAddress[5] ); 1667 ent.setBusinessZip( slBusinessAddress[5] );
1599 } 1668 }
1600 1669
1601 if (hasCountry) { 1670 if (hasCountry) {
1602 ent.setHomeCountry( slHomeAddress[6] ); 1671 ent.setHomeCountry( slHomeAddress[6] );
1603 ent.setBusinessCountry( slBusinessAddress[6] ); 1672 ent.setBusinessCountry( slBusinessAddress[6] );
1604 } 1673 }
1605 1674
1606 QStringList::ConstIterator it; 1675 QStringList::ConstIterator it;
1607 QListIterator<QLineEdit> itLE( listValue ); 1676 QListIterator<QLineEdit> itLE( listValue );
1608 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { 1677 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) {
1609 if ( *it == "Department" ) 1678 if ( *it == "Department" )
1610 ent.setDepartment( (*itLE)->text() ); 1679 ent.setDepartment( (*itLE)->text() );
1611 1680
1612 if ( *it == "Company" ) 1681 if ( *it == "Company" )
1613 ent.setCompany( (*itLE)->text() ); 1682 ent.setCompany( (*itLE)->text() );
1614 1683
1615 if ( *it == "Office" ) 1684 if ( *it == "Office" )
1616 ent.setOffice( (*itLE)->text() ); 1685 ent.setOffice( (*itLE)->text() );
1617 1686
1618 if ( *it == "Profession" ) 1687 if ( *it == "Profession" )
1619 ent.setProfession( (*itLE)->text() ); 1688 ent.setProfession( (*itLE)->text() );
1620 1689
1621 if ( *it == "Assistant" ) 1690 if ( *it == "Assistant" )
1622 ent.setAssistant( (*itLE)->text() ); 1691 ent.setAssistant( (*itLE)->text() );
1623 1692
1624 if ( *it == "Manager" ) 1693 if ( *it == "Manager" )
1625 ent.setManager( (*itLE)->text() ); 1694 ent.setManager( (*itLE)->text() );
1626 1695
1627 if ( *it == "Spouse" ) 1696 if ( *it == "Spouse" )
1628 ent.setSpouse( (*itLE)->text() ); 1697 ent.setSpouse( (*itLE)->text() );
1629 1698
1630 if ( *it == "Birthday" )
1631 ent.setBirthday( (*itLE)->text() );
1632
1633 if ( *it == "Anniversary" )
1634 ent.setAnniversary( (*itLE)->text() );
1635
1636 if ( *it == "Nickname" ) 1699 if ( *it == "Nickname" )
1637 ent.setNickname( (*itLE)->text() ); 1700 ent.setNickname( (*itLE)->text() );
1638 1701
1639 if ( *it == "Children" ) 1702 if ( *it == "Children" )
1640 ent.setChildren( (*itLE)->text() ); 1703 ent.setChildren( (*itLE)->text() );
1641 1704
1642 } 1705 }
1643 1706
1644 QStringList::ConstIterator itV; 1707 QStringList::ConstIterator itV;
1645 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1708 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1646 1709
1647 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) 1710 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) )
1648 ent.setBusinessPhone( *itV ); 1711 ent.setBusinessPhone( *itV );
1649/* 1712/*
1650 if ( *it == tr("Business 2 Phone" ) 1713 if ( *it == tr("Business 2 Phone" )
1651 ent.setBusiness2Phone( *itV ); 1714 ent.setBusiness2Phone( *itV );
1652*/ 1715*/
1653 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) 1716 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) )
1654 ent.setBusinessFax( *itV ); 1717 ent.setBusinessFax( *itV );
1655 1718
1656 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) 1719 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) )
1657 ent.setBusinessMobile( *itV ); 1720 ent.setBusinessMobile( *itV );
1658/* 1721/*
1659 if ( *it == "Company Phone" ) 1722 if ( *it == "Company Phone" )
1660 ent.setCompanyPhone( *itV ); 1723 ent.setCompanyPhone( *itV );
1661*/ 1724*/
1662 //if ( *it == "Default Email" ) 1725 //if ( *it == "Default Email" )
1663 //ent.setDefaultEmail( *itV ); 1726 //ent.setDefaultEmail( *itV );
1664 1727
1665 if ( *it == "Emails" ){ 1728 if ( *it == "Emails" ){
1666 QString allemail; 1729 QString allemail;
1667 QString defaultmail; 1730 QString defaultmail;
@@ -1777,32 +1840,62 @@ void parseEmailTo( const QString &strDefaultEmail,
1777 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); 1840 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace();
1778 } else 1841 } else
1779 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); 1842 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace();
1780 if ( foundDefault || strTmp != strDefaultEmail ) { 1843 if ( foundDefault || strTmp != strDefaultEmail ) {
1781 strBack.append( ", " ); 1844 strBack.append( ", " );
1782 strBack.append( strTmp ); 1845 strBack.append( strTmp );
1783 } else 1846 } else
1784 foundDefault = true; 1847 foundDefault = true;
1785 } 1848 }
1786} 1849}
1787 1850
1788 1851
1789static inline bool containsAlphaNum( const QString &str ) 1852static inline bool containsAlphaNum( const QString &str )
1790{ 1853{
1791 int i, 1854 int i,
1792 count = str.length(); 1855 count = str.length();
1793 for ( i = 0; i < count; i++ ) 1856 for ( i = 0; i < count; i++ )
1794 if ( !str[i].isSpace() ) 1857 if ( !str[i].isSpace() )
1795 return TRUE; 1858 return TRUE;
1796 return FALSE; 1859 return FALSE;
1797} 1860}
1798 1861
1799static inline bool constainsWhiteSpace( const QString &str ) 1862static inline bool constainsWhiteSpace( const QString &str )
1800{ 1863{
1801 int i, 1864 int i,
1802 count = str.length(); 1865 count = str.length();
1803 for (i = 0; i < count; i++ ) 1866 for (i = 0; i < count; i++ )
1804 if ( str[i].isSpace() ) 1867 if ( str[i].isSpace() )
1805 return TRUE; 1868 return TRUE;
1806 return FALSE; 1869 return FALSE;
1807} 1870}
1808 1871
1872void ContactEditor::setPersonalView( bool personal )
1873{
1874 m_personalView = personal;
1875 if ( personal ){
1876 cmbCat->hide();
1877 labCat->hide();
1878 } else{
1879 cmbCat->show();
1880 labCat->show();
1881
1882 }
1883}
1884
1885void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day)
1886{
1887 QDate date;
1888 date.setYMD( year, month, day );
1889 QString dateString = TimeString::numberDateString( date );
1890 anniversaryButton->setText( dateString );
1891 ent.setAnniversary ( dateString );
1892}
1893
1894void ContactEditor::slotBirthdayDateChanged( int year, int month, int day)
1895{
1896 QDate date;
1897 date.setYMD( year, month, day );
1898 QString dateString = TimeString::numberDateString( date );
1899 birthdayButton->setText( dateString );
1900 ent.setBirthday ( dateString );
1901}
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h
index 8ed8553..40ce864 100644
--- a/core/pim/addressbook/contacteditor.h
+++ b/core/pim/addressbook/contacteditor.h
@@ -1,162 +1,172 @@
1/* 1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> 2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 * 3 *
4 * This file is an add-on for the OPIE Palmtop Environment 4 * This file is an add-on for the OPIE Palmtop Environment
5 * 5 *
6 * This file may be distributed and/or modified under the terms of the 6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software 7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging 8 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
9 * of this file. 9 * of this file.
10 * 10 *
11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 * 13 *
14 * 14 *
15 * This is a rewrite of the abeditor.h file, modified to provide a more 15 * This is a rewrite of the abeditor.h file, modified to provide a more
16 * intuitive interface to TrollTech's original Address Book editor. This 16 * intuitive interface to TrollTech's original Address Book editor. This
17 * is made to operate exactly in interface with the exception of name. 17 * is made to operate exactly in interface with the exception of name.
18 * 18 *
19 */ 19 */
20 20
21#ifndef CONTACTEDITOR_H 21#ifndef CONTACTEDITOR_H
22#define CONTACTEDITOR_H 22#define CONTACTEDITOR_H
23 23
24#include <opie/ocontact.h> 24#include <opie/ocontact.h>
25 25
26#include <qpe/datebookmonth.h>
27
26#include <qdialog.h> 28#include <qdialog.h>
27#include <qlist.h> 29#include <qlist.h>
28#include <qmap.h> 30#include <qmap.h>
29#include <qstringlist.h> 31#include <qstringlist.h>
30 32
31const int NAME_LF = 0; 33const int NAME_LF = 0;
32const int NAME_LFM = 1; 34const int NAME_LFM = 1;
33const int NAME_FL = 2; 35const int NAME_FL = 2;
34const int NAME_FMLS = 3; 36const int NAME_FMLS = 3;
35 37
36const int NAME_F = 4; 38const int NAME_F = 4;
37const int NAME_M = 5; 39const int NAME_M = 5;
38const int NAME_L = 6; 40const int NAME_L = 6;
39const int NAME_S = 7; 41const int NAME_S = 7;
40 42
41 43
42class QScrollView; 44class QScrollView;
43class QTabWidget; 45class QTabWidget;
44class QMultiLineEdit; 46class QMultiLineEdit;
45class QLineEdit; 47class QLineEdit;
46class QComboBox; 48class QComboBox;
47class QPushButton; 49class QPushButton;
48class CategorySelect; 50class CategorySelect;
49class QLabel; 51class QLabel;
50 52
51class ContactEditor : public QDialog { 53class ContactEditor : public QDialog {
52 Q_OBJECT 54 Q_OBJECT
53 55
54 public: 56 public:
55 ContactEditor(const OContact &entry, 57 ContactEditor(const OContact &entry,
56 const QValueList<int> *newOrderedValues, 58 const QValueList<int> *newOrderedValues,
57 QStringList *slNewOrdered, 59 QStringList *slNewOrdered,
58 QWidget *parent = 0, 60 QWidget *parent = 0,
59 const char *name = 0, 61 const char *name = 0,
60 WFlags fl = 0 ); 62 WFlags fl = 0 );
61 ~ContactEditor(); 63 ~ContactEditor();
62 void loadFields(); 64 void loadFields();
63 void setNameFocus(); 65 void setNameFocus();
66 void setPersonalView( bool personal = true );
64 OContact entry() const { return ent; } 67 OContact entry() const { return ent; }
65 68
66 public slots: 69 public slots:
67 void slotNote(); 70 void slotNote();
68 void slotName(); 71 void slotName();
69 void setEntry(const OContact &entry); 72 void setEntry(const OContact &entry);
70 73
71 protected slots: 74 protected slots:
72 void accept(); 75 void accept();
73 76
74 private: 77 private:
75 void init(); 78 void init();
76 void initMap(); 79 void initMap();
77 void saveEntry(); 80 void saveEntry();
78 bool isEmpty(); 81 bool isEmpty();
79 void cleanupFields(); 82 void cleanupFields();
80 QString parseName( QString fullName, int type ); 83 QString parseName( QString fullName, int type );
81
82 private slots: 84 private slots:
83 void slotChooser1Change( const QString &textChanged ); 85 void slotChooser1Change( const QString &textChanged );
84 void slotChooser2Change( const QString &textChanged ); 86 void slotChooser2Change( const QString &textChanged );
85 void slotChooser3Change( const QString &textChanged ); 87 void slotChooser3Change( const QString &textChanged );
86 void slotChooser4Change( const QString &textChanged ); 88 void slotChooser4Change( const QString &textChanged );
87 void slotCmbChooser1Change( int index ); 89 void slotCmbChooser1Change( int index );
88 void slotCmbChooser2Change( int index ); 90 void slotCmbChooser2Change( int index );
89 void slotCmbChooser3Change( int index ); 91 void slotCmbChooser3Change( int index );
90 void slotCmbChooser4Change( int index ); 92 void slotCmbChooser4Change( int index );
91 void slotAddressTypeChange( int index ); 93 void slotAddressTypeChange( int index );
92 void slotAddressChange( const QString &textChanged ); 94 void slotAddressChange( const QString &textChanged );
93 void slotAddress2Change( const QString &textChanged ); 95 void slotAddress2Change( const QString &textChanged );
94 void slotPOBoxChange( const QString &textChanged ); 96 void slotPOBoxChange( const QString &textChanged );
95 void slotCityChange( const QString &textChanged ); 97 void slotCityChange( const QString &textChanged );
96 void slotStateChange( const QString &textChanged ); 98 void slotStateChange( const QString &textChanged );
97 void slotZipChange( const QString &textChanged ); 99 void slotZipChange( const QString &textChanged );
98 void slotCountryChange( const QString &textChanged ); 100 void slotCountryChange( const QString &textChanged );
99 void slotFullNameChange( const QString &textChanged ); 101 void slotFullNameChange( const QString &textChanged );
102 void slotAnniversaryDateChanged( int year, int month, int day);
103 void slotBirthdayDateChanged( int year, int month, int day);
100 104
101 private: 105 private:
102 bool useFullName, hasGender, hasTitle, hasCompany, hasNotes, hasStreet, hasStreet2, hasPOBox, hasCity, hasState, hasZip, hasCountry; 106 bool useFullName, hasGender, hasTitle, hasCompany, hasNotes, hasStreet, hasStreet2, hasPOBox, hasCity, hasState, hasZip, hasCountry;
103 107
104 OContact ent; 108 OContact ent;
105 109
106 QDialog *dlgNote; 110 QDialog *dlgNote;
107 QDialog *dlgName; 111 QDialog *dlgName;
108 112
109 QList<QLineEdit> listValue; 113 QList<QLineEdit> listValue;
110 QList<QLabel> listName; 114 QList<QLabel> listName;
111 const QValueList<int> *orderedValues; 115 const QValueList<int> *orderedValues;
112 QStringList slOrdered; 116 QStringList slOrdered;
113 QStringList slDynamicEntries; 117 QStringList slDynamicEntries;
114 118
119 bool m_personalView;
120
115 QStringList slHomeAddress; 121 QStringList slHomeAddress;
116 QStringList slBusinessAddress; 122 QStringList slBusinessAddress;
117 QStringList slChooserNames; 123 QStringList slChooserNames;
118 QStringList slChooserValues; 124 QStringList slChooserValues;
119 125
120 QMultiLineEdit *txtNote; 126 QMultiLineEdit *txtNote;
121 QLabel *lblNote; 127 QLabel *lblNote;
122 128
123 //QLineEdit *txtTitle; 129 //QLineEdit *txtTitle;
124 QLineEdit *txtFirstName; 130 QLineEdit *txtFirstName;
125 QLineEdit *txtMiddleName; 131 QLineEdit *txtMiddleName;
126 QLineEdit *txtLastName; 132 QLineEdit *txtLastName;
127 QLineEdit *txtSuffix; 133 QLineEdit *txtSuffix;
128 134
129 QTabWidget *tabMain; 135 QTabWidget *tabMain;
130 QScrollView *svGeneral; 136 QScrollView *svGeneral;
131 QPushButton *btnFullName; 137 QPushButton *btnFullName;
132 QPushButton *btnNote; 138 QPushButton *btnNote;
133 QLineEdit *txtFullName; 139 QLineEdit *txtFullName;
134 QLineEdit *txtJobTitle; 140 QLineEdit *txtJobTitle;
135 QLineEdit *txtOrganization; 141 QLineEdit *txtOrganization;
136 QLineEdit *txtChooserField1; 142 QLineEdit *txtChooserField1;
137 QLineEdit *txtChooserField2; 143 QLineEdit *txtChooserField2;
138 QLineEdit *txtChooserField3; 144 QLineEdit *txtChooserField3;
139 QLineEdit *txtChooserField4; 145 QLineEdit *txtChooserField4;
140 QComboBox *cmbChooserField1; 146 QComboBox *cmbChooserField1;
141 QComboBox *cmbChooserField2; 147 QComboBox *cmbChooserField2;
142 QComboBox *cmbChooserField3; 148 QComboBox *cmbChooserField3;
143 QComboBox *cmbChooserField4; 149 QComboBox *cmbChooserField4;
144 QComboBox *cmbFileAs; 150 QComboBox *cmbFileAs;
145 CategorySelect *cmbCat; 151 CategorySelect *cmbCat;
152 QLabel *labCat;
146 153
147 QScrollView *svAddress; 154 QScrollView *svAddress;
148 QLineEdit *txtAddress; 155 QLineEdit *txtAddress;
149 //QLineEdit *txtAddress2; 156 //QLineEdit *txtAddress2;
150 //QLineEdit *txtPOBox; 157 //QLineEdit *txtPOBox;
151 QLineEdit *txtCity; 158 QLineEdit *txtCity;
152 QLineEdit *txtState; 159 QLineEdit *txtState;
153 QLineEdit *txtZip; 160 QLineEdit *txtZip;
154 QComboBox *cmbAddress; 161 QComboBox *cmbAddress;
155 QComboBox *cmbCountry; 162 QComboBox *cmbCountry;
156 163
157 QScrollView *svDetails; 164 QScrollView *svDetails;
158 QComboBox *cmbGender; 165 QComboBox *cmbGender;
159 166 DateBookMonth* birthdayPicker;
160}; 167 QToolButton* birthdayButton;
168 DateBookMonth* anniversaryPicker;
169 QToolButton* anniversaryButton;
170 };
161 171
162#endif 172#endif