-rw-r--r-- | core/pim/addressbook/TODO | 21 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 107 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 8 | ||||
-rw-r--r-- | core/pim/addressbook/ocontactfields.cpp | 4 | ||||
-rw-r--r-- | core/pim/addressbook/version.h | 2 |
5 files changed, 82 insertions, 60 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index 719b720..a0d50a3 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO | |||
@@ -1,119 +1,116 @@ | |||
1 | Stuff todo until OPIE 1.0 : | 1 | Stuff todo until OPIE 1.0 : |
2 | =========================== | 2 | =========================== |
3 | 3 | ||
4 | Feature requests: | 4 | Feature requests: |
5 | ----------------- | 5 | ----------------- |
6 | - Dial by mobile phone by tapping the number.. | 6 | - Dial by mobile phone by tapping the number.. |
7 | (Maybe using gsmtool. And we may | 7 | (Maybe using gsmtool. And we may |
8 | add a library class for this) | 8 | add a library class for this) |
9 | - dial with dtmfdial in case it's installed and there's no mobile | 9 | - dial with dtmfdial in case it's installed and there's no mobile |
10 | - 3rd column for 2. Contact | 10 | - 3rd column for 2. Contact |
11 | - Implementing additional Views (Phonebook, ...) | 11 | - Implementing additional Views (Phonebook, ...) |
12 | - Birthday & Anniversary Reminder | 12 | - Birthday & Anniversary Reminder |
13 | - Beaming of multiple contacts (current list/ by search or by category) | 13 | - Beaming of multiple contacts (current list/ by search or by category) |
14 | - Configure the letter-picker: lastname/fullname search | 14 | - Configure the letter-picker: lastname/fullname search |
15 | - User center of the joypad to switch back from card to listview ! | 15 | - User center of the joypad to switch back from card to listview ! |
16 | - Cursor-UP/Down: Should additionally scroll cardview if it is too large | 16 | - Cursor-UP/Down: Should additionally scroll cardview if it is too large |
17 | (behaviour should be selectable by configuration) | 17 | (behaviour should be selectable by configuration) |
18 | 18 | ||
19 | Known Bugs: | 19 | Known Bugs: |
20 | ----------- | 20 | ----------- |
21 | - Default Email-button: A lot of problems: | ||
22 | If on second tab: The combo chooser is on the top left of the screen ! :( | ||
23 | - Default Email-Button: Sometimes not hiding the textfields completely | ||
24 | 21 | ||
25 | Bugs but not in addressbook: | 22 | Bugs but not in addressbook: |
26 | ----------------------------- | 23 | ----------------------------- |
27 | - VCARD: If umlaut (äöüß) in address, the parser gets confused.. | 24 | - VCARD: If umlaut (äöüß) in address, the parser gets confused.. |
28 | 25 | ||
29 | - Exporting and reimporting of Jobtitle was reported to fail (Could not reproduce this ! (se)) | ||
30 | |||
31 | 26 | ||
32 | Urgent: | 27 | Urgent: |
33 | -------- | 28 | -------- |
34 | ContactEditor: | ||
35 | - Contact-Editor is temporarely reenabled. Wait for replacement. | ||
36 | - Redesign of Contacteditor | ||
37 | - Category is on the wrong position after changing to personal and back to normal | 29 | - Category is on the wrong position after changing to personal and back to normal |
38 | ( Temporarily workaround: Category is never deactivated.. :S ) | 30 | ( Temporarily workaround: Category is never deactivated.. :S ) |
39 | 31 | ||
40 | - Fix handling of 3 Firstnames | 32 | - Fix handling of 3 Firstnames |
41 | 33 | ||
42 | Important: | 34 | Important: |
43 | ---------- | 35 | ---------- |
44 | 36 | ||
45 | - If new contact is added (contacteditor closed): focus (table, card) to | ||
46 | this entry ! | ||
47 | - After search (Started with Return): KeyFocus should be on Tabelle | ||
48 | |||
49 | - "What's this" should be added (Deleyed after Feature Freeze) | 37 | - "What's this" should be added (Deleyed after Feature Freeze) |
50 | 38 | ||
51 | Less important: | 39 | Less important: |
52 | --------------- | 40 | --------------- |
53 | - Reload if contacts were changed externally | 41 | - Reload if contacts were changed externally |
54 | - The picker (alphabetical sort widget) should be | 42 | - The picker (alphabetical sort widget) should be |
55 | placed verticaly or horizontally (configurable) | 43 | placed verticaly or horizontally (configurable) |
56 | - Find a smart solution for activating/deactivating the "send email" event | 44 | - Find a smart solution for activating/deactivating the "send email" event |
45 | - If new contact is added (contacteditor closed): focus (table, card) to | ||
46 | this entry ! | ||
47 | - After search (Started with Return): KeyFocus should be on Tabelle | ||
48 | |||
49 | ContactEditor: | ||
50 | - Redesign of Contacteditor | ||
57 | 51 | ||
58 | Should be Fixed (not absolute sure, need further validation): | 52 | Should be Fixed (not absolute sure, need further validation): |
59 | ------------------------------------------------------------- | 53 | ------------------------------------------------------------- |
60 | 54 | ||
61 | 55 | ||
62 | Fixed/Ready: | 56 | Fixed/Ready: |
63 | ------- | 57 | ------- |
64 | - Syncing: abtable not reloaded after sync. | 58 | - Syncing: abtable not reloaded after sync. |
65 | - Find widget should be replaced by something like | 59 | - Find widget should be replaced by something like |
66 | qpdf has. | 60 | qpdf has. |
67 | - Adding a configuration dialog | 61 | - Adding a configuration dialog |
68 | - Picker: Activated letter schould be more visible | 62 | - Picker: Activated letter schould be more visible |
69 | - Advanced handling of cursor keys (search..) | 63 | - Advanced handling of cursor keys (search..) |
70 | - Mail-Icon is missing | 64 | - Mail-Icon is missing |
71 | - Use opie-mail insted of qt-mail if possible. | 65 | - Use opie-mail insted of qt-mail if possible. |
72 | - Font menu is invisible using german translation | 66 | - Font menu is invisible using german translation |
73 | - Personal contact editor: Disable categories | 67 | - Personal contact editor: Disable categories |
74 | - "Nonenglish" translation bug has to be fixed. | 68 | - "Nonenglish" translation bug has to be fixed. |
75 | - contacteditor: Birthday, annyversary, ... : Use Dateselector | 69 | - contacteditor: Birthday, annyversary, ... : Use Dateselector |
76 | - The names of the countries are sorted by there english names, only.. | 70 | - The names of the countries are sorted by there english names, only.. |
77 | Even if they are translated.. :S | 71 | Even if they are translated.. :S |
78 | - Cursor keys should work in detail-view (ablabel) | 72 | - Cursor keys should work in detail-view (ablabel) |
79 | -> Ablabel should be removed and Abtable should be increased with | 73 | -> Ablabel should be removed and Abtable should be increased with |
80 | different views (as started by darwin zins).. | 74 | different views (as started by darwin zins).. |
81 | - Use advanced database functions in abtable to decrease | 75 | - Use advanced database functions in abtable to decrease |
82 | memory footprint and to make everything more easy ! | 76 | memory footprint and to make everything more easy ! |
83 | (abtable should store Iterator for selected Category) | 77 | (abtable should store Iterator for selected Category) |
84 | - Abtable: Configure Contact column (internally already available, | 78 | - Abtable: Configure Contact column (internally already available, |
85 | need configuration) | 79 | need configuration) |
86 | - Select of primary contact (see #274 on mantis) | 80 | - Select of primary contact (see #274 on mantis) |
87 | - Category-select does not work completely: "Unfiled" is always in listview .. | 81 | - Category-select does not work completely: "Unfiled" is always in listview .. |
88 | - Return from Contacteditor: Category resettet to all | 82 | - Return from Contacteditor: Category resettet to all |
89 | - Personal Details not working | 83 | - Personal Details not working |
90 | - If category changed, the letterpicker should be resetted | 84 | - If category changed, the letterpicker should be resetted |
91 | - There should be some icons for List and Cardview | 85 | - There should be some icons for List and Cardview |
92 | - If in Cardview and a category change removes all entries: | 86 | - If in Cardview and a category change removes all entries: |
93 | There are already entries in Cardview after up/down | 87 | There are already entries in Cardview after up/down |
94 | - Personal Details: Anniversary zeigt Fantasie-Werte | 88 | - Personal Details: Anniversary zeigt Fantasie-Werte |
95 | - Unfiled shown just in Category "All" and "Unfiled". | 89 | - Unfiled shown just in Category "All" and "Unfiled". |
96 | - After finising search and after Edit: Clear Picker | 90 | - After finising search and after Edit: Clear Picker |
97 | - After Edit: Table position back to edited entry. | 91 | - After Edit: Table position back to edited entry. |
98 | - Optimize Table Update... | 92 | - Optimize Table Update... |
99 | - Change MyDialog to Config | 93 | - Change MyDialog to Config |
100 | - Store position and state of toolbar | 94 | - Store position and state of toolbar |
101 | - Searchwidget closed: Selected user is jumping | 95 | - Searchwidget closed: Selected user is jumping |
102 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) | 96 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) |
103 | zu lange.. | 97 | zu lange.. |
104 | - VCARD: Import of Anniversary does not work correctly (currently disabled) | 98 | - VCARD: Import of Anniversary does not work correctly (currently disabled) |
105 | - Name order selected in "contacteditor" not used in list view. | 99 | - Name order selected in "contacteditor" not used in list view. |
106 | - OK-Key does not switch from Detailview (ablable) to Listview | 100 | - OK-Key does not switch from Detailview (ablable) to Listview |
107 | - Receiving of beams should open a dialog | 101 | - Receiving of beams should open a dialog |
108 | - Fix start of opie-mail | 102 | - Fix start of opie-mail |
109 | - Implement Button Pics | 103 | - Implement Button Pics |
110 | - Add a dialog to accept and optionally edit received contacts by IRDA. | 104 | - Add a dialog to accept and optionally edit received contacts by IRDA. |
111 | - Language not English (tested with german opie-translation): | 105 | - Language not English (tested with german opie-translation): |
112 | 1. Configure nicht übersetzt (alles leer). | 106 | 1. Configure nicht übersetzt (alles leer). |
113 | 2. Contacteditor nur teilweise übersetzt. | 107 | 2. Contacteditor nur teilweise übersetzt. |
114 | 3. Kategorie-Picker geht nicht. | 108 | 3. Kategorie-Picker geht nicht. |
115 | - Plugin for Today for Birthdays and Anniversaries | 109 | - Plugin for Today for Birthdays and Anniversaries |
116 | - Implement a picker/combo for the default email. | 110 | - Implement a picker/combo for the default email. |
117 | - Overview window cleanup needed.. | 111 | - Overview window cleanup needed.. |
118 | - Store last settings of combo-boxes | 112 | - Store last settings of combo-boxes |
119 | - Personal and Business Web-page is not editable | 113 | - Personal and Business Web-page is not editable |
114 | - Default Email-button: A lot of problems: | ||
115 | If on second tab: The combo chooser is on the top left of the screen ! :( | ||
116 | - Default Email-Button: Sometimes not hiding the textfields completely | ||
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index b60f2dd..d1338f6 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -1,1724 +1,1743 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) | 3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) |
4 | * | 4 | * |
5 | * This file is an add-on for the OPIE Palmtop Environment | 5 | * This file is an add-on for the OPIE Palmtop Environment |
6 | * | 6 | * |
7 | * This file may be distributed and/or modified under the terms of the | 7 | * This file may be distributed and/or modified under the terms of the |
8 | * GNU General Public License version 2 as published by the Free Software | 8 | * GNU General Public License version 2 as published by the Free Software |
9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging | 9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
10 | * of this file. | 10 | * of this file. |
11 | * | 11 | * |
12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | * | 14 | * |
15 | * | 15 | * |
16 | * This is a rewrite of the abeditor.h file, modified to provide a more | 16 | * This is a rewrite of the abeditor.h file, modified to provide a more |
17 | * intuitive interface to TrollTech's original Address Book editor. This | 17 | * intuitive interface to TrollTech's original Address Book editor. This |
18 | * is made to operate exactly in interface with the exception of name. | 18 | * is made to operate exactly in interface with the exception of name. |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "contacteditor.h" | 22 | #include "contacteditor.h" |
23 | #include "addresspicker.h" | 23 | #include "addresspicker.h" |
24 | #include "ocontactfields.h" | 24 | #include "ocontactfields.h" |
25 | 25 | ||
26 | #include <qpe/categoryselect.h> | 26 | #include <qpe/categoryselect.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/qpedialog.h> | 28 | #include <qpe/qpedialog.h> |
29 | #include <qpe/timeconversion.h> | 29 | #include <qpe/timeconversion.h> |
30 | #include <opie/ocontact.h> | 30 | #include <opie/ocontact.h> |
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | 32 | ||
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qlabel.h> | 34 | #include <qlabel.h> |
35 | #include <qtabwidget.h> | 35 | #include <qtabwidget.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qlineedit.h> | 37 | #include <qlineedit.h> |
38 | #include <qmultilineedit.h> | 38 | #include <qmultilineedit.h> |
39 | #include <qscrollview.h> | 39 | #include <qscrollview.h> |
40 | #include <qtoolbutton.h> | 40 | #include <qtoolbutton.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qmainwindow.h> | 42 | #include <qmainwindow.h> |
43 | #include <qvaluelist.h> | 43 | #include <qvaluelist.h> |
44 | #include <qpopupmenu.h> | 44 | #include <qpopupmenu.h> |
45 | #include <qlistbox.h> | 45 | #include <qlistbox.h> |
46 | #include <qhbox.h> | 46 | #include <qhbox.h> |
47 | #include <qaction.h> | 47 | #include <qaction.h> |
48 | #include <qiconset.h> | 48 | #include <qiconset.h> |
49 | #include <qmessagebox.h> | 49 | #include <qmessagebox.h> |
50 | 50 | ||
51 | #include <assert.h> | 51 | #include <assert.h> |
52 | 52 | ||
53 | static inline bool containsAlphaNum( const QString &str ); | 53 | static inline bool containsAlphaNum( const QString &str ); |
54 | static inline bool constainsWhiteSpace( const QString &str ); | 54 | static inline bool constainsWhiteSpace( const QString &str ); |
55 | 55 | ||
56 | // helper functions, convert our comma delimited list to proper | 56 | // helper functions, convert our comma delimited list to proper |
57 | // file format... | 57 | // file format... |
58 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 58 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
59 | QString &strAll ); | 59 | QString &strAll ); |
60 | 60 | ||
61 | // helper convert from file format to comma delimited... | 61 | // helper convert from file format to comma delimited... |
62 | void parseEmailTo( const QString &strDefaultEmail, | 62 | void parseEmailTo( const QString &strDefaultEmail, |
63 | const QString &strOtherEmail, QString &strBack ); | 63 | const QString &strOtherEmail, QString &strBack ); |
64 | 64 | ||
65 | ContactEditor::ContactEditor(const OContact &entry, | 65 | ContactEditor::ContactEditor(const OContact &entry, |
66 | QWidget *parent, | 66 | QWidget *parent, |
67 | const char *name, | 67 | const char *name, |
68 | WFlags fl ) | 68 | WFlags fl ) |
69 | : QDialog( parent, name, TRUE, fl ), | 69 | : QDialog( parent, name, TRUE, fl ), |
70 | defaultEmailChooserPosition( -1 ), | 70 | defaultEmailChooserPosition( -1 ), |
71 | m_personalView ( false ), | 71 | m_personalView ( false ), |
72 | cmbDefaultEmail( 0 ), | 72 | cmbDefaultEmail( 0 ), |
73 | initializing ( false ) | 73 | initializing ( false ) |
74 | { | 74 | { |
75 | 75 | ||
76 | initializing = true; | 76 | initializing = true; |
77 | 77 | ||
78 | init(); | 78 | init(); |
79 | setEntry( entry ); | 79 | setEntry( entry ); |
80 | // cmbDefaultEmail = 0; | 80 | // cmbDefaultEmail = 0; |
81 | // defaultEmailChooserPosition = -1; | 81 | // defaultEmailChooserPosition = -1; |
82 | 82 | ||
83 | initializing = false; | 83 | initializing = false; |
84 | } | 84 | } |
85 | 85 | ||
86 | ContactEditor::~ContactEditor() { | 86 | ContactEditor::~ContactEditor() { |
87 | } | 87 | } |
88 | 88 | ||
89 | void ContactEditor::init() { | 89 | void ContactEditor::init() { |
90 | qWarning("init() START"); | 90 | qWarning("init() START"); |
91 | 91 | ||
92 | useFullName = true; | 92 | useFullName = true; |
93 | 93 | ||
94 | uint i = 0; | 94 | uint i = 0; |
95 | 95 | ||
96 | QStringList trlChooserNames; | 96 | QStringList trlChooserNames; |
97 | 97 | ||
98 | for (i = 0; i <= 6; i++) { | 98 | for (i = 0; i <= 6; i++) { |
99 | slHomeAddress.append( "" ); | 99 | slHomeAddress.append( "" ); |
100 | slBusinessAddress.append( "" ); | 100 | slBusinessAddress.append( "" ); |
101 | } | 101 | } |
102 | 102 | ||
103 | trlChooserNames = OContactFields::trphonefields( false ); | 103 | trlChooserNames = OContactFields::trphonefields( false ); |
104 | slChooserNames = OContactFields::untrphonefields( false ); | 104 | slChooserNames = OContactFields::untrphonefields( false ); |
105 | slDynamicEntries = OContactFields::untrdetailsfields( false ); | 105 | slDynamicEntries = OContactFields::untrdetailsfields( false ); |
106 | trlDynamicEntries = OContactFields::trdetailsfields( false ); | 106 | trlDynamicEntries = OContactFields::trdetailsfields( false ); |
107 | 107 | ||
108 | // Ok, we have to remove elements from the list of dynamic entries | 108 | // Ok, we have to remove elements from the list of dynamic entries |
109 | // which are now stored in special (not dynamic) widgets.. | 109 | // which are now stored in special (not dynamic) widgets.. |
110 | // Otherwise we will get problems with field assignments! (se) | 110 | // Otherwise we will get problems with field assignments! (se) |
111 | slDynamicEntries.remove("Anniversary"); | 111 | slDynamicEntries.remove("Anniversary"); |
112 | slDynamicEntries.remove("Birthday"); | 112 | slDynamicEntries.remove("Birthday"); |
113 | slDynamicEntries.remove("Gender"); | 113 | slDynamicEntries.remove("Gender"); |
114 | 114 | ||
115 | // The same with translated fields.. But I will | 115 | // The same with translated fields.. But I will |
116 | // use the translation map to avoid mismatches.. | 116 | // use the translation map to avoid mismatches.. |
117 | QMap<int, QString> translMap = OContactFields::idToTrFields(); | 117 | QMap<int, QString> translMap = OContactFields::idToTrFields(); |
118 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); | 118 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); |
119 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); | 119 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); |
120 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); | 120 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); |
121 | 121 | ||
122 | // Last Check to be sure.. | 122 | // Last Check to be sure.. |
123 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); | 123 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); |
124 | assert( slChooserNames.count() == trlChooserNames.count() ); | 124 | assert( slChooserNames.count() == trlChooserNames.count() ); |
125 | 125 | ||
126 | for (i = 0; i < slChooserNames.count(); i++) | 126 | for (i = 0; i < slChooserNames.count(); i++) |
127 | slChooserValues.append(""); | 127 | slChooserValues.append(""); |
128 | 128 | ||
129 | 129 | ||
130 | QVBoxLayout *vb = new QVBoxLayout( this ); | 130 | QVBoxLayout *vb = new QVBoxLayout( this ); |
131 | 131 | ||
132 | tabMain = new QTabWidget( this ); | 132 | tabMain = new QTabWidget( this ); |
133 | vb->addWidget( tabMain ); | 133 | vb->addWidget( tabMain ); |
134 | 134 | ||
135 | QWidget *tabViewport = new QWidget ( tabMain ); | 135 | QWidget *tabViewport = new QWidget ( tabMain ); |
136 | 136 | ||
137 | vb = new QVBoxLayout( tabViewport ); | 137 | vb = new QVBoxLayout( tabViewport ); |
138 | 138 | ||
139 | svGeneral = new QScrollView( tabViewport ); | 139 | svGeneral = new QScrollView( tabViewport ); |
140 | vb->addWidget( svGeneral, 0, 0 ); | 140 | vb->addWidget( svGeneral, 0, 0 ); |
141 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 141 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
142 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 142 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
143 | 143 | ||
144 | QWidget *container = new QWidget( svGeneral->viewport() ); | 144 | QWidget *container = new QWidget( svGeneral->viewport() ); |
145 | svGeneral->addChild( container ); | 145 | svGeneral->addChild( container ); |
146 | 146 | ||
147 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 147 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); |
148 | gl->setResizeMode( QLayout::FreeResize ); | 148 | gl->setResizeMode( QLayout::FreeResize ); |
149 | 149 | ||
150 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 150 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
151 | gl->addWidget( btnFullName, 0, 0 ); | 151 | gl->addWidget( btnFullName, 0, 0 ); |
152 | txtFullName = new QLineEdit( container ); | 152 | txtFullName = new QLineEdit( container ); |
153 | gl->addWidget( txtFullName, 0, 1 ); | 153 | gl->addWidget( txtFullName, 0, 1 ); |
154 | 154 | ||
155 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 155 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
156 | gl->addWidget( l, 1, 0 ); | 156 | gl->addWidget( l, 1, 0 ); |
157 | txtJobTitle = new QLineEdit( container ); | 157 | txtJobTitle = new QLineEdit( container ); |
158 | gl->addWidget( txtJobTitle, 1, 1 ); | 158 | gl->addWidget( txtJobTitle, 1, 1 ); |
159 | 159 | ||
160 | l = new QLabel( tr( "Organization" ), container ); | 160 | l = new QLabel( tr( "Organization" ), container ); |
161 | gl->addWidget( l, 2, 0 ); | 161 | gl->addWidget( l, 2, 0 ); |
162 | txtOrganization = new QLineEdit( container ); | 162 | txtOrganization = new QLineEdit( container ); |
163 | gl->addWidget( txtOrganization, 2, 1 ); | 163 | gl->addWidget( txtOrganization, 2, 1 ); |
164 | 164 | ||
165 | // Chooser 1 | ||
165 | cmbChooserField1 = new QComboBox( FALSE, container ); | 166 | cmbChooserField1 = new QComboBox( FALSE, container ); |
166 | cmbChooserField1->setMaximumWidth( 90 ); | 167 | cmbChooserField1->setMaximumWidth( 90 ); |
167 | gl->addWidget( cmbChooserField1, 3, 0 ); | 168 | gl->addWidget( cmbChooserField1, 3, 0 ); |
168 | txtChooserField1 = new QLineEdit( container ); | 169 | // Textfield for chooser 1. |
169 | gl->addWidget( txtChooserField1, 3, 1 ); | 170 | // Now use Widgetstack to contain the textfield and the default-email combo ! |
170 | 171 | m_widgetStack1 = new QWidgetStack( container ); | |
172 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); | ||
173 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); | ||
174 | gl->addWidget( m_widgetStack1, 3, 1 ); | ||
175 | m_widgetStack1 -> raiseWidget( TextField ); | ||
176 | |||
177 | // Chooser 2 | ||
171 | cmbChooserField2 = new QComboBox( FALSE, container ); | 178 | cmbChooserField2 = new QComboBox( FALSE, container ); |
172 | cmbChooserField2->setMaximumWidth( 90 ); | 179 | cmbChooserField2->setMaximumWidth( 90 ); |
173 | gl->addWidget( cmbChooserField2, 4, 0 ); | 180 | gl->addWidget( cmbChooserField2, 4, 0 ); |
174 | txtChooserField2 = new QLineEdit( container ); | 181 | // Textfield for chooser 2 |
175 | gl->addWidget( txtChooserField2, 4, 1 ); | 182 | // Now use WidgetStack to contain the textfield and the default-email combo! |
176 | 183 | m_widgetStack2 = new QWidgetStack( container ); | |
184 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); | ||
185 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); | ||
186 | gl->addWidget( m_widgetStack2, 4, 1 ); | ||
187 | m_widgetStack2 -> raiseWidget( TextField ); | ||
188 | |||
189 | // Chooser 3 | ||
177 | cmbChooserField3 = new QComboBox( FALSE, container ); | 190 | cmbChooserField3 = new QComboBox( FALSE, container ); |
178 | cmbChooserField3->setMaximumWidth( 90 ); | 191 | cmbChooserField3->setMaximumWidth( 90 ); |
179 | gl->addWidget( cmbChooserField3, 5, 0 ); | 192 | gl->addWidget( cmbChooserField3, 5, 0 ); |
180 | txtChooserField3 = new QLineEdit( container ); | 193 | // Textfield for chooser 2 |
181 | gl->addWidget( txtChooserField3, 5, 1 ); | 194 | // Now use WidgetStack to contain the textfield and the default-email combo! |
195 | m_widgetStack3 = new QWidgetStack( container ); | ||
196 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); | ||
197 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); | ||
198 | gl->addWidget( m_widgetStack3, 5, 1 ); | ||
199 | m_widgetStack3 -> raiseWidget( TextField ); | ||
182 | 200 | ||
183 | l = new QLabel( tr( "File As" ), container ); | 201 | l = new QLabel( tr( "File As" ), container ); |
184 | gl->addWidget( l, 6, 0 ); | 202 | gl->addWidget( l, 6, 0 ); |
185 | cmbFileAs = new QComboBox( TRUE, container ); | 203 | cmbFileAs = new QComboBox( TRUE, container ); |
186 | gl->addWidget( cmbFileAs, 6, 1 ); | 204 | gl->addWidget( cmbFileAs, 6, 1 ); |
187 | 205 | ||
188 | labCat = new QLabel( tr( "Category" ), container ); | 206 | labCat = new QLabel( tr( "Category" ), container ); |
189 | gl->addWidget( labCat, 7, 0 ); | 207 | gl->addWidget( labCat, 7, 0 ); |
190 | cmbCat = new CategorySelect( container ); | 208 | cmbCat = new CategorySelect( container ); |
191 | gl->addWidget( cmbCat, 7, 1 ); | 209 | gl->addWidget( cmbCat, 7, 1 ); |
192 | labCat->show(); | 210 | labCat->show(); |
193 | cmbCat->show(); | 211 | cmbCat->show(); |
194 | 212 | ||
195 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 213 | btnNote = new QPushButton( tr( "Notes..." ), container ); |
196 | gl->addWidget( btnNote, 8, 1 ); | 214 | gl->addWidget( btnNote, 8, 1 ); |
197 | 215 | ||
198 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 216 | tabMain->insertTab( tabViewport, tr( "General" ) ); |
199 | 217 | ||
200 | tabViewport = new QWidget ( tabMain ); | 218 | tabViewport = new QWidget ( tabMain ); |
201 | 219 | ||
202 | vb = new QVBoxLayout( tabViewport ); | 220 | vb = new QVBoxLayout( tabViewport ); |
203 | 221 | ||
204 | svAddress = new QScrollView( tabViewport ); | 222 | svAddress = new QScrollView( tabViewport ); |
205 | vb->addWidget( svAddress, 0, 0 ); | 223 | vb->addWidget( svAddress, 0, 0 ); |
206 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 224 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
207 | svAddress->setFrameStyle( QFrame::NoFrame ); | 225 | svAddress->setFrameStyle( QFrame::NoFrame ); |
208 | 226 | ||
209 | container = new QWidget( svAddress->viewport() ); | 227 | container = new QWidget( svAddress->viewport() ); |
210 | svAddress->addChild( container ); | 228 | svAddress->addChild( container ); |
211 | 229 | ||
212 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 230 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
213 | 231 | ||
214 | cmbAddress = new QComboBox( FALSE, container ); | 232 | cmbAddress = new QComboBox( FALSE, container ); |
215 | cmbAddress->insertItem( tr( "Business" ) ); | 233 | cmbAddress->insertItem( tr( "Business" ) ); |
216 | cmbAddress->insertItem( tr( "Home" ) ); | 234 | cmbAddress->insertItem( tr( "Home" ) ); |
217 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 235 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
218 | 236 | ||
219 | l = new QLabel( tr( "Address" ), container ); | 237 | l = new QLabel( tr( "Address" ), container ); |
220 | gl->addWidget( l, 1, 0 ); | 238 | gl->addWidget( l, 1, 0 ); |
221 | txtAddress = new QLineEdit( container ); | 239 | txtAddress = new QLineEdit( container ); |
222 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 240 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
223 | 241 | ||
224 | l = new QLabel( tr( "City" ), container ); | 242 | l = new QLabel( tr( "City" ), container ); |
225 | gl->addWidget( l, 2, 0 ); | 243 | gl->addWidget( l, 2, 0 ); |
226 | txtCity = new QLineEdit( container ); | 244 | txtCity = new QLineEdit( container ); |
227 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 245 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
228 | 246 | ||
229 | l = new QLabel( tr( "State" ), container ); | 247 | l = new QLabel( tr( "State" ), container ); |
230 | gl->addWidget( l, 3, 0 ); | 248 | gl->addWidget( l, 3, 0 ); |
231 | txtState = new QLineEdit( container ); | 249 | txtState = new QLineEdit( container ); |
232 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 250 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
233 | 251 | ||
234 | l = new QLabel( tr( "Zip Code" ), container ); | 252 | l = new QLabel( tr( "Zip Code" ), container ); |
235 | gl->addWidget( l, 4, 0 ); | 253 | gl->addWidget( l, 4, 0 ); |
236 | txtZip = new QLineEdit( container ); | 254 | txtZip = new QLineEdit( container ); |
237 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 255 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
238 | 256 | ||
239 | l = new QLabel( tr( "Country" ), container ); | 257 | l = new QLabel( tr( "Country" ), container ); |
240 | gl->addWidget( l, 5, 0 ); | 258 | gl->addWidget( l, 5, 0 ); |
241 | cmbCountry = new QComboBox( TRUE, container ); | 259 | cmbCountry = new QComboBox( TRUE, container ); |
242 | cmbCountry->insertItem( tr( "" ) ); | 260 | cmbCountry->insertItem( tr( "" ) ); |
243 | cmbCountry->insertItem( tr ( "United States" ) ); | 261 | cmbCountry->insertItem( tr ( "United States" ) ); |
244 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 262 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
245 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); | 263 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); |
246 | cmbCountry->insertItem( tr ( "Albania" ) ); | 264 | cmbCountry->insertItem( tr ( "Albania" ) ); |
247 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 265 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
248 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 266 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
249 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 267 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
250 | cmbCountry->insertItem( tr ( "Angola" ) ); | 268 | cmbCountry->insertItem( tr ( "Angola" ) ); |
251 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 269 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
252 | cmbCountry->insertItem( tr ( "Antarctica" ) ); | 270 | cmbCountry->insertItem( tr ( "Antarctica" ) ); |
253 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 271 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
254 | cmbCountry->insertItem( tr ( "Armenia" ) ); | 272 | cmbCountry->insertItem( tr ( "Armenia" ) ); |
255 | cmbCountry->insertItem( tr ( "Aruba" ) ); | 273 | cmbCountry->insertItem( tr ( "Aruba" ) ); |
256 | cmbCountry->insertItem( tr ( "Australia" ) ); | 274 | cmbCountry->insertItem( tr ( "Australia" ) ); |
257 | cmbCountry->insertItem( tr ( "Austria" ) ); | 275 | cmbCountry->insertItem( tr ( "Austria" ) ); |
258 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); | 276 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); |
259 | cmbCountry->insertItem( tr ( "Bahamas" ) ); | 277 | cmbCountry->insertItem( tr ( "Bahamas" ) ); |
260 | cmbCountry->insertItem( tr ( "Bahrain" ) ); | 278 | cmbCountry->insertItem( tr ( "Bahrain" ) ); |
261 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); | 279 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); |
262 | cmbCountry->insertItem( tr ( "Barbados" ) ); | 280 | cmbCountry->insertItem( tr ( "Barbados" ) ); |
263 | cmbCountry->insertItem( tr ( "Belarus" ) ); | 281 | cmbCountry->insertItem( tr ( "Belarus" ) ); |
264 | cmbCountry->insertItem( tr ( "Belgium" ) ); | 282 | cmbCountry->insertItem( tr ( "Belgium" ) ); |
265 | cmbCountry->insertItem( tr ( "Belize" ) ); | 283 | cmbCountry->insertItem( tr ( "Belize" ) ); |
266 | cmbCountry->insertItem( tr ( "Benin" ) ); | 284 | cmbCountry->insertItem( tr ( "Benin" ) ); |
267 | cmbCountry->insertItem( tr ( "Bermuda" ) ); | 285 | cmbCountry->insertItem( tr ( "Bermuda" ) ); |
268 | cmbCountry->insertItem( tr ( "Bhutan" ) ); | 286 | cmbCountry->insertItem( tr ( "Bhutan" ) ); |
269 | cmbCountry->insertItem( tr ( "Bolivia" ) ); | 287 | cmbCountry->insertItem( tr ( "Bolivia" ) ); |
270 | cmbCountry->insertItem( tr ( "Botswana" ) ); | 288 | cmbCountry->insertItem( tr ( "Botswana" ) ); |
271 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); | 289 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); |
272 | cmbCountry->insertItem( tr ( "Brazil" ) ); | 290 | cmbCountry->insertItem( tr ( "Brazil" ) ); |
273 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); | 291 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); |
274 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); | 292 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); |
275 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); | 293 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); |
276 | cmbCountry->insertItem( tr ( "Burundi" ) ); | 294 | cmbCountry->insertItem( tr ( "Burundi" ) ); |
277 | cmbCountry->insertItem( tr ( "Cambodia" ) ); | 295 | cmbCountry->insertItem( tr ( "Cambodia" ) ); |
278 | cmbCountry->insertItem( tr ( "Cameroon" ) ); | 296 | cmbCountry->insertItem( tr ( "Cameroon" ) ); |
279 | cmbCountry->insertItem( tr ( "Canada" ) ); | 297 | cmbCountry->insertItem( tr ( "Canada" ) ); |
280 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); | 298 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); |
281 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); | 299 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); |
282 | cmbCountry->insertItem( tr ( "Chad" ) ); | 300 | cmbCountry->insertItem( tr ( "Chad" ) ); |
283 | cmbCountry->insertItem( tr ( "Chile" ) ); | 301 | cmbCountry->insertItem( tr ( "Chile" ) ); |
284 | cmbCountry->insertItem( tr ( "China" ) ); | 302 | cmbCountry->insertItem( tr ( "China" ) ); |
285 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); | 303 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); |
286 | cmbCountry->insertItem( tr ( "Colombia" ) ); | 304 | cmbCountry->insertItem( tr ( "Colombia" ) ); |
287 | cmbCountry->insertItem( tr ( "Comoros" ) ); | 305 | cmbCountry->insertItem( tr ( "Comoros" ) ); |
288 | cmbCountry->insertItem( tr ( "Congo" ) ); | 306 | cmbCountry->insertItem( tr ( "Congo" ) ); |
289 | cmbCountry->insertItem( tr ( "Cook Island" ) ); | 307 | cmbCountry->insertItem( tr ( "Cook Island" ) ); |
290 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); | 308 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); |
291 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); | 309 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); |
292 | cmbCountry->insertItem( tr ( "Croatia" ) ); | 310 | cmbCountry->insertItem( tr ( "Croatia" ) ); |
293 | cmbCountry->insertItem( tr ( "Cuba" ) ); | 311 | cmbCountry->insertItem( tr ( "Cuba" ) ); |
294 | cmbCountry->insertItem( tr ( "Cyprus" ) ); | 312 | cmbCountry->insertItem( tr ( "Cyprus" ) ); |
295 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); | 313 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); |
296 | cmbCountry->insertItem( tr ( "Denmark" ) ); | 314 | cmbCountry->insertItem( tr ( "Denmark" ) ); |
297 | cmbCountry->insertItem( tr ( "Djibouti" ) ); | 315 | cmbCountry->insertItem( tr ( "Djibouti" ) ); |
298 | cmbCountry->insertItem( tr ( "Dominica" ) ); | 316 | cmbCountry->insertItem( tr ( "Dominica" ) ); |
299 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); | 317 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); |
300 | cmbCountry->insertItem( tr ( "East Timor" ) ); | 318 | cmbCountry->insertItem( tr ( "East Timor" ) ); |
301 | cmbCountry->insertItem( tr ( "Ecuador" ) ); | 319 | cmbCountry->insertItem( tr ( "Ecuador" ) ); |
302 | cmbCountry->insertItem( tr ( "Egypt" ) ); | 320 | cmbCountry->insertItem( tr ( "Egypt" ) ); |
303 | cmbCountry->insertItem( tr ( "El Salvador" ) ); | 321 | cmbCountry->insertItem( tr ( "El Salvador" ) ); |
304 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); | 322 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); |
305 | cmbCountry->insertItem( tr ( "Eritrea" ) ); | 323 | cmbCountry->insertItem( tr ( "Eritrea" ) ); |
306 | cmbCountry->insertItem( tr ( "Estonia" ) ); | 324 | cmbCountry->insertItem( tr ( "Estonia" ) ); |
307 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); | 325 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); |
308 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); | 326 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); |
309 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); | 327 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); |
310 | cmbCountry->insertItem( tr ( "Fiji" ) ); | 328 | cmbCountry->insertItem( tr ( "Fiji" ) ); |
311 | cmbCountry->insertItem( tr ( "Finland" ) ); | 329 | cmbCountry->insertItem( tr ( "Finland" ) ); |
312 | cmbCountry->insertItem( tr ( "France" ) ); | 330 | cmbCountry->insertItem( tr ( "France" ) ); |
313 | cmbCountry->insertItem( tr ( "French Guiana" ) ); | 331 | cmbCountry->insertItem( tr ( "French Guiana" ) ); |
314 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); | 332 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); |
315 | cmbCountry->insertItem( tr ( "Gabon" ) ); | 333 | cmbCountry->insertItem( tr ( "Gabon" ) ); |
316 | cmbCountry->insertItem( tr ( "Gambia" ) ); | 334 | cmbCountry->insertItem( tr ( "Gambia" ) ); |
317 | cmbCountry->insertItem( tr ( "Georgia" ) ); | 335 | cmbCountry->insertItem( tr ( "Georgia" ) ); |
318 | cmbCountry->insertItem( tr ( "Germany" ) ); | 336 | cmbCountry->insertItem( tr ( "Germany" ) ); |
319 | cmbCountry->insertItem( tr ( "Ghana" ) ); | 337 | cmbCountry->insertItem( tr ( "Ghana" ) ); |
320 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); | 338 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); |
321 | cmbCountry->insertItem( tr ( "Greece" ) ); | 339 | cmbCountry->insertItem( tr ( "Greece" ) ); |
322 | cmbCountry->insertItem( tr ( "Greenland" ) ); | 340 | cmbCountry->insertItem( tr ( "Greenland" ) ); |
323 | cmbCountry->insertItem( tr ( "Grenada" ) ); | 341 | cmbCountry->insertItem( tr ( "Grenada" ) ); |
324 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); | 342 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); |
325 | cmbCountry->insertItem( tr ( "Guam" ) ); | 343 | cmbCountry->insertItem( tr ( "Guam" ) ); |
326 | cmbCountry->insertItem( tr ( "Guatemala" ) ); | 344 | cmbCountry->insertItem( tr ( "Guatemala" ) ); |
327 | cmbCountry->insertItem( tr ( "Guinea" ) ); | 345 | cmbCountry->insertItem( tr ( "Guinea" ) ); |
328 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); | 346 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); |
329 | cmbCountry->insertItem( tr ( "Guyana" ) ); | 347 | cmbCountry->insertItem( tr ( "Guyana" ) ); |
330 | cmbCountry->insertItem( tr ( "Haiti" ) ); | 348 | cmbCountry->insertItem( tr ( "Haiti" ) ); |
331 | cmbCountry->insertItem( tr ( "Holy See" ) ); | 349 | cmbCountry->insertItem( tr ( "Holy See" ) ); |
332 | cmbCountry->insertItem( tr ( "Honduras" ) ); | 350 | cmbCountry->insertItem( tr ( "Honduras" ) ); |
333 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); | 351 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); |
334 | cmbCountry->insertItem( tr ( "Hungary" ) ); | 352 | cmbCountry->insertItem( tr ( "Hungary" ) ); |
335 | cmbCountry->insertItem( tr ( "Iceland" ) ); | 353 | cmbCountry->insertItem( tr ( "Iceland" ) ); |
336 | cmbCountry->insertItem( tr ( "India" ) ); | 354 | cmbCountry->insertItem( tr ( "India" ) ); |
337 | cmbCountry->insertItem( tr ( "Indonesia" ) ); | 355 | cmbCountry->insertItem( tr ( "Indonesia" ) ); |
338 | cmbCountry->insertItem( tr ( "Ireland" ) ); | 356 | cmbCountry->insertItem( tr ( "Ireland" ) ); |
339 | cmbCountry->insertItem( tr ( "Israel" ) ); | 357 | cmbCountry->insertItem( tr ( "Israel" ) ); |
340 | cmbCountry->insertItem( tr ( "Italy" ) ); | 358 | cmbCountry->insertItem( tr ( "Italy" ) ); |
341 | cmbCountry->insertItem( tr ( "Jamaica" ) ); | 359 | cmbCountry->insertItem( tr ( "Jamaica" ) ); |
342 | cmbCountry->insertItem( tr ( "Japan" ) ); | 360 | cmbCountry->insertItem( tr ( "Japan" ) ); |
343 | cmbCountry->insertItem( tr ( "Jordan" ) ); | 361 | cmbCountry->insertItem( tr ( "Jordan" ) ); |
344 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); | 362 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); |
345 | cmbCountry->insertItem( tr ( "Kenya" ) ); | 363 | cmbCountry->insertItem( tr ( "Kenya" ) ); |
346 | cmbCountry->insertItem( tr ( "Kiribati" ) ); | 364 | cmbCountry->insertItem( tr ( "Kiribati" ) ); |
347 | cmbCountry->insertItem( tr ( "Korea" ) ); | 365 | cmbCountry->insertItem( tr ( "Korea" ) ); |
348 | cmbCountry->insertItem( tr ( "Kuwait" ) ); | 366 | cmbCountry->insertItem( tr ( "Kuwait" ) ); |
349 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); | 367 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); |
350 | cmbCountry->insertItem( tr ( "Laos" ) ); | 368 | cmbCountry->insertItem( tr ( "Laos" ) ); |
351 | cmbCountry->insertItem( tr ( "Latvia" ) ); | 369 | cmbCountry->insertItem( tr ( "Latvia" ) ); |
352 | cmbCountry->insertItem( tr ( "Lebanon" ) ); | 370 | cmbCountry->insertItem( tr ( "Lebanon" ) ); |
353 | cmbCountry->insertItem( tr ( "Lesotho" ) ); | 371 | cmbCountry->insertItem( tr ( "Lesotho" ) ); |
354 | cmbCountry->insertItem( tr ( "Liberia" ) ); | 372 | cmbCountry->insertItem( tr ( "Liberia" ) ); |
355 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); | 373 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); |
356 | cmbCountry->insertItem( tr ( "Lithuania" ) ); | 374 | cmbCountry->insertItem( tr ( "Lithuania" ) ); |
357 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); | 375 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); |
358 | cmbCountry->insertItem( tr ( "Macau" ) ); | 376 | cmbCountry->insertItem( tr ( "Macau" ) ); |
359 | cmbCountry->insertItem( tr ( "Macedonia" ) ); | 377 | cmbCountry->insertItem( tr ( "Macedonia" ) ); |
360 | cmbCountry->insertItem( tr ( "Madagascar" ) ); | 378 | cmbCountry->insertItem( tr ( "Madagascar" ) ); |
361 | cmbCountry->insertItem( tr ( "Malawi" ) ); | 379 | cmbCountry->insertItem( tr ( "Malawi" ) ); |
362 | cmbCountry->insertItem( tr ( "Malaysia" ) ); | 380 | cmbCountry->insertItem( tr ( "Malaysia" ) ); |
363 | cmbCountry->insertItem( tr ( "Maldives" ) ); | 381 | cmbCountry->insertItem( tr ( "Maldives" ) ); |
364 | cmbCountry->insertItem( tr ( "Mali" ) ); | 382 | cmbCountry->insertItem( tr ( "Mali" ) ); |
365 | cmbCountry->insertItem( tr ( "Malta" ) ); | 383 | cmbCountry->insertItem( tr ( "Malta" ) ); |
366 | cmbCountry->insertItem( tr ( "Martinique" ) ); | 384 | cmbCountry->insertItem( tr ( "Martinique" ) ); |
367 | cmbCountry->insertItem( tr ( "Mauritania" ) ); | 385 | cmbCountry->insertItem( tr ( "Mauritania" ) ); |
368 | cmbCountry->insertItem( tr ( "Mauritius" ) ); | 386 | cmbCountry->insertItem( tr ( "Mauritius" ) ); |
369 | cmbCountry->insertItem( tr ( "Mayotte" ) ); | 387 | cmbCountry->insertItem( tr ( "Mayotte" ) ); |
370 | cmbCountry->insertItem( tr ( "Mexico" ) ); | 388 | cmbCountry->insertItem( tr ( "Mexico" ) ); |
371 | cmbCountry->insertItem( tr ( "Micronesia" ) ); | 389 | cmbCountry->insertItem( tr ( "Micronesia" ) ); |
372 | cmbCountry->insertItem( tr ( "Moldova" ) ); | 390 | cmbCountry->insertItem( tr ( "Moldova" ) ); |
373 | cmbCountry->insertItem( tr ( "Monaco" ) ); | 391 | cmbCountry->insertItem( tr ( "Monaco" ) ); |
374 | cmbCountry->insertItem( tr ( "Mongolia" ) ); | 392 | cmbCountry->insertItem( tr ( "Mongolia" ) ); |
375 | cmbCountry->insertItem( tr ( "Montserrat" ) ); | 393 | cmbCountry->insertItem( tr ( "Montserrat" ) ); |
376 | cmbCountry->insertItem( tr ( "Morocco" ) ); | 394 | cmbCountry->insertItem( tr ( "Morocco" ) ); |
377 | cmbCountry->insertItem( tr ( "Mozambique" ) ); | 395 | cmbCountry->insertItem( tr ( "Mozambique" ) ); |
378 | cmbCountry->insertItem( tr ( "Myanmar" ) ); | 396 | cmbCountry->insertItem( tr ( "Myanmar" ) ); |
379 | cmbCountry->insertItem( tr ( "Namibia" ) ); | 397 | cmbCountry->insertItem( tr ( "Namibia" ) ); |
380 | cmbCountry->insertItem( tr ( "Nauru" ) ); | 398 | cmbCountry->insertItem( tr ( "Nauru" ) ); |
381 | cmbCountry->insertItem( tr ( "Nepal" ) ); | 399 | cmbCountry->insertItem( tr ( "Nepal" ) ); |
382 | cmbCountry->insertItem( tr ( "Netherlands" ) ); | 400 | cmbCountry->insertItem( tr ( "Netherlands" ) ); |
383 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); | 401 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); |
384 | cmbCountry->insertItem( tr ( "New Zealand" ) ); | 402 | cmbCountry->insertItem( tr ( "New Zealand" ) ); |
385 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); | 403 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); |
386 | cmbCountry->insertItem( tr ( "Niger" ) ); | 404 | cmbCountry->insertItem( tr ( "Niger" ) ); |
387 | cmbCountry->insertItem( tr ( "Nigeria" ) ); | 405 | cmbCountry->insertItem( tr ( "Nigeria" ) ); |
388 | cmbCountry->insertItem( tr ( "Niue" ) ); | 406 | cmbCountry->insertItem( tr ( "Niue" ) ); |
389 | cmbCountry->insertItem( tr ( "Norway" ) ); | 407 | cmbCountry->insertItem( tr ( "Norway" ) ); |
390 | cmbCountry->insertItem( tr ( "Oman" ) ); | 408 | cmbCountry->insertItem( tr ( "Oman" ) ); |
391 | cmbCountry->insertItem( tr ( "Pakistan" ) ); | 409 | cmbCountry->insertItem( tr ( "Pakistan" ) ); |
392 | cmbCountry->insertItem( tr ( "Palau" ) ); | 410 | cmbCountry->insertItem( tr ( "Palau" ) ); |
393 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); | 411 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); |
394 | cmbCountry->insertItem( tr ( "Panama" ) ); | 412 | cmbCountry->insertItem( tr ( "Panama" ) ); |
395 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); | 413 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); |
396 | cmbCountry->insertItem( tr ( "Paraguay" ) ); | 414 | cmbCountry->insertItem( tr ( "Paraguay" ) ); |
397 | cmbCountry->insertItem( tr ( "Peru" ) ); | 415 | cmbCountry->insertItem( tr ( "Peru" ) ); |
398 | cmbCountry->insertItem( tr ( "Philippines" ) ); | 416 | cmbCountry->insertItem( tr ( "Philippines" ) ); |
399 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); | 417 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); |
400 | cmbCountry->insertItem( tr ( "Poland" ) ); | 418 | cmbCountry->insertItem( tr ( "Poland" ) ); |
401 | cmbCountry->insertItem( tr ( "Portugal" ) ); | 419 | cmbCountry->insertItem( tr ( "Portugal" ) ); |
402 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); | 420 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); |
403 | cmbCountry->insertItem( tr ( "Qatar" ) ); | 421 | cmbCountry->insertItem( tr ( "Qatar" ) ); |
404 | cmbCountry->insertItem( tr ( "Reunion" ) ); | 422 | cmbCountry->insertItem( tr ( "Reunion" ) ); |
405 | cmbCountry->insertItem( tr ( "Romania" ) ); | 423 | cmbCountry->insertItem( tr ( "Romania" ) ); |
406 | cmbCountry->insertItem( tr ( "Russia" ) ); | 424 | cmbCountry->insertItem( tr ( "Russia" ) ); |
407 | cmbCountry->insertItem( tr ( "Rwanda" ) ); | 425 | cmbCountry->insertItem( tr ( "Rwanda" ) ); |
408 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); | 426 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); |
409 | cmbCountry->insertItem( tr ( "Samoa" ) ); | 427 | cmbCountry->insertItem( tr ( "Samoa" ) ); |
410 | cmbCountry->insertItem( tr ( "San Marino" ) ); | 428 | cmbCountry->insertItem( tr ( "San Marino" ) ); |
411 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); | 429 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); |
412 | cmbCountry->insertItem( tr ( "Senegal" ) ); | 430 | cmbCountry->insertItem( tr ( "Senegal" ) ); |
413 | cmbCountry->insertItem( tr ( "Seychelles" ) ); | 431 | cmbCountry->insertItem( tr ( "Seychelles" ) ); |
414 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); | 432 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); |
415 | cmbCountry->insertItem( tr ( "Singapore" ) ); | 433 | cmbCountry->insertItem( tr ( "Singapore" ) ); |
416 | cmbCountry->insertItem( tr ( "Slovakia" ) ); | 434 | cmbCountry->insertItem( tr ( "Slovakia" ) ); |
417 | cmbCountry->insertItem( tr ( "Slovenia" ) ); | 435 | cmbCountry->insertItem( tr ( "Slovenia" ) ); |
418 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); | 436 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); |
419 | cmbCountry->insertItem( tr ( "Somalia" ) ); | 437 | cmbCountry->insertItem( tr ( "Somalia" ) ); |
420 | cmbCountry->insertItem( tr ( "South Africa" ) ); | 438 | cmbCountry->insertItem( tr ( "South Africa" ) ); |
421 | cmbCountry->insertItem( tr ( "Spain" ) ); | 439 | cmbCountry->insertItem( tr ( "Spain" ) ); |
422 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); | 440 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); |
423 | cmbCountry->insertItem( tr ( "St. Helena" ) ); | 441 | cmbCountry->insertItem( tr ( "St. Helena" ) ); |
424 | cmbCountry->insertItem( tr ( "Sudan" ) ); | 442 | cmbCountry->insertItem( tr ( "Sudan" ) ); |
425 | cmbCountry->insertItem( tr ( "Suriname" ) ); | 443 | cmbCountry->insertItem( tr ( "Suriname" ) ); |
426 | cmbCountry->insertItem( tr ( "Swaziland" ) ); | 444 | cmbCountry->insertItem( tr ( "Swaziland" ) ); |
427 | cmbCountry->insertItem( tr ( "Sweden" ) ); | 445 | cmbCountry->insertItem( tr ( "Sweden" ) ); |
428 | cmbCountry->insertItem( tr ( "Switzerland" ) ); | 446 | cmbCountry->insertItem( tr ( "Switzerland" ) ); |
429 | cmbCountry->insertItem( tr ( "Taiwan" ) ); | 447 | cmbCountry->insertItem( tr ( "Taiwan" ) ); |
430 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); | 448 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); |
431 | cmbCountry->insertItem( tr ( "Tanzania" ) ); | 449 | cmbCountry->insertItem( tr ( "Tanzania" ) ); |
432 | cmbCountry->insertItem( tr ( "Thailand" ) ); | 450 | cmbCountry->insertItem( tr ( "Thailand" ) ); |
433 | cmbCountry->insertItem( tr ( "Togo" ) ); | 451 | cmbCountry->insertItem( tr ( "Togo" ) ); |
434 | cmbCountry->insertItem( tr ( "Tokelau" ) ); | 452 | cmbCountry->insertItem( tr ( "Tokelau" ) ); |
435 | cmbCountry->insertItem( tr ( "Tonga" ) ); | 453 | cmbCountry->insertItem( tr ( "Tonga" ) ); |
436 | cmbCountry->insertItem( tr ( "Tunisia" ) ); | 454 | cmbCountry->insertItem( tr ( "Tunisia" ) ); |
437 | cmbCountry->insertItem( tr ( "Turkey" ) ); | 455 | cmbCountry->insertItem( tr ( "Turkey" ) ); |
438 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); | 456 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); |
439 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); | 457 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); |
440 | cmbCountry->insertItem( tr ( "Uganda" ) ); | 458 | cmbCountry->insertItem( tr ( "Uganda" ) ); |
441 | cmbCountry->insertItem( tr ( "Ukraine" ) ); | 459 | cmbCountry->insertItem( tr ( "Ukraine" ) ); |
442 | cmbCountry->insertItem( tr ( "Uruguay" ) ); | 460 | cmbCountry->insertItem( tr ( "Uruguay" ) ); |
443 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); | 461 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); |
444 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); | 462 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); |
445 | cmbCountry->insertItem( tr ( "Venezuela" ) ); | 463 | cmbCountry->insertItem( tr ( "Venezuela" ) ); |
446 | cmbCountry->insertItem( tr ( "Vietnam" ) ); | 464 | cmbCountry->insertItem( tr ( "Vietnam" ) ); |
447 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); | 465 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); |
448 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); | 466 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); |
449 | cmbCountry->insertItem( tr ( "Yemen" ) ); | 467 | cmbCountry->insertItem( tr ( "Yemen" ) ); |
450 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); | 468 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); |
451 | cmbCountry->insertItem( tr ( "Zambia" ) ); | 469 | cmbCountry->insertItem( tr ( "Zambia" ) ); |
452 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); | 470 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); |
453 | if (cmbCountry->listBox()!=0) | 471 | if (cmbCountry->listBox()!=0) |
454 | cmbCountry->listBox()->sort(); | 472 | cmbCountry->listBox()->sort(); |
455 | 473 | ||
456 | cmbCountry->setMaximumWidth( 135 ); | 474 | cmbCountry->setMaximumWidth( 135 ); |
457 | 475 | ||
458 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 476 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
459 | 477 | ||
478 | // Chooser 4 | ||
460 | cmbChooserField4 = new QComboBox( FALSE, container ); | 479 | cmbChooserField4 = new QComboBox( FALSE, container ); |
461 | cmbChooserField4->setMaximumWidth( 90 ); | 480 | cmbChooserField4->setMaximumWidth( 90 ); |
462 | gl->addWidget( cmbChooserField4, 6, 0 ); | 481 | gl->addWidget( cmbChooserField4, 6, 0 ); |
463 | txtChooserField4 = new QLineEdit( container ); | 482 | // Textfield for chooser 2 |
464 | gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); | 483 | // Now use WidgetStack to contain the textfield and the default-email combo! |
484 | m_widgetStack4 = new QWidgetStack( container ); | ||
485 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); | ||
486 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); | ||
487 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); | ||
488 | m_widgetStack4 -> raiseWidget( TextField ); | ||
465 | 489 | ||
466 | QSpacerItem *space = new QSpacerItem(1,1, | 490 | QSpacerItem *space = new QSpacerItem(1,1, |
467 | QSizePolicy::Maximum, | 491 | QSizePolicy::Maximum, |
468 | QSizePolicy::MinimumExpanding ); | 492 | QSizePolicy::MinimumExpanding ); |
469 | gl->addItem( space, 7, 0 ); | 493 | gl->addItem( space, 7, 0 ); |
470 | 494 | ||
471 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 495 | tabMain->insertTab( tabViewport, tr( "Address" ) ); |
472 | 496 | ||
473 | tabViewport = new QWidget ( tabMain ); | 497 | tabViewport = new QWidget ( tabMain ); |
474 | 498 | ||
475 | vb = new QVBoxLayout( tabViewport ); | 499 | vb = new QVBoxLayout( tabViewport ); |
476 | 500 | ||
477 | svDetails = new QScrollView( tabViewport ); | 501 | svDetails = new QScrollView( tabViewport ); |
478 | vb->addWidget( svDetails, 0, 0 ); | 502 | vb->addWidget( svDetails, 0, 0 ); |
479 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 503 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
480 | svDetails->setFrameStyle( QFrame::NoFrame ); | 504 | svDetails->setFrameStyle( QFrame::NoFrame ); |
481 | 505 | ||
482 | container = new QWidget( svDetails->viewport() ); | 506 | container = new QWidget( svDetails->viewport() ); |
483 | svDetails->addChild( container ); | 507 | svDetails->addChild( container ); |
484 | 508 | ||
485 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 509 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
486 | 510 | ||
487 | int counter = 0; | 511 | int counter = 0; |
488 | 512 | ||
489 | // Birthday | 513 | // Birthday |
490 | QHBox* hBox = new QHBox( container ); | 514 | QHBox* hBox = new QHBox( container ); |
491 | l = new QLabel( tr("Birthday"), container ); | 515 | l = new QLabel( tr("Birthday"), container ); |
492 | gl->addWidget( l, counter, 0 ); | 516 | gl->addWidget( l, counter, 0 ); |
493 | 517 | ||
494 | QPopupMenu* m1 = new QPopupMenu( container ); | 518 | QPopupMenu* m1 = new QPopupMenu( container ); |
495 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | 519 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); |
496 | m1->insertItem( birthdayPicker ); | 520 | m1->insertItem( birthdayPicker ); |
497 | 521 | ||
498 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 522 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
499 | birthdayButton->setPopup( m1 ); | 523 | birthdayButton->setPopup( m1 ); |
500 | birthdayButton->setPopupDelay(0); | 524 | birthdayButton->setPopupDelay(0); |
501 | 525 | ||
502 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 526 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
503 | tr( "Delete" ), | 527 | tr( "Delete" ), |
504 | hBox, 0 ); | 528 | hBox, 0 ); |
505 | 529 | ||
506 | gl->addWidget( hBox, counter , 1 ); | 530 | gl->addWidget( hBox, counter , 1 ); |
507 | 531 | ||
508 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), | 532 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), |
509 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); | 533 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); |
510 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | 534 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); |
511 | 535 | ||
512 | ++counter; | 536 | ++counter; |
513 | 537 | ||
514 | // Anniversary | 538 | // Anniversary |
515 | hBox = new QHBox( container ); | 539 | hBox = new QHBox( container ); |
516 | l = new QLabel( tr("Anniversary"), container ); | 540 | l = new QLabel( tr("Anniversary"), container ); |
517 | gl->addWidget( l, counter, 0 ); | 541 | gl->addWidget( l, counter, 0 ); |
518 | 542 | ||
519 | m1 = new QPopupMenu( container ); | 543 | m1 = new QPopupMenu( container ); |
520 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 544 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); |
521 | m1->insertItem( anniversaryPicker ); | 545 | m1->insertItem( anniversaryPicker ); |
522 | 546 | ||
523 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 547 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
524 | anniversaryButton->setPopup( m1 ); | 548 | anniversaryButton->setPopup( m1 ); |
525 | anniversaryButton->setPopupDelay(0); | 549 | anniversaryButton->setPopupDelay(0); |
526 | 550 | ||
527 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 551 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
528 | tr( "Delete" ), | 552 | tr( "Delete" ), |
529 | hBox, 0 ); | 553 | hBox, 0 ); |
530 | gl->addWidget( hBox, counter , 1 ); | 554 | gl->addWidget( hBox, counter , 1 ); |
531 | 555 | ||
532 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), | 556 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), |
533 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); | 557 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); |
534 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); | 558 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); |
535 | 559 | ||
536 | ++counter; | 560 | ++counter; |
537 | 561 | ||
538 | // Gender | 562 | // Gender |
539 | l = new QLabel( tr("Gender"), container ); | 563 | l = new QLabel( tr("Gender"), container ); |
540 | gl->addWidget( l, counter, 0 ); | 564 | gl->addWidget( l, counter, 0 ); |
541 | cmbGender = new QComboBox( container ); | 565 | cmbGender = new QComboBox( container ); |
542 | cmbGender->insertItem( "", 0 ); | 566 | cmbGender->insertItem( "", 0 ); |
543 | cmbGender->insertItem( tr("Male"), 1); | 567 | cmbGender->insertItem( tr("Male"), 1); |
544 | cmbGender->insertItem( tr("Female"), 2); | 568 | cmbGender->insertItem( tr("Female"), 2); |
545 | gl->addWidget( cmbGender, counter, 1 ); | 569 | gl->addWidget( cmbGender, counter, 1 ); |
546 | 570 | ||
547 | ++counter; | 571 | ++counter; |
548 | 572 | ||
549 | // Create Labels and lineedit fields for every dynamic entry | 573 | // Create Labels and lineedit fields for every dynamic entry |
550 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 574 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
551 | QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); | 575 | QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); |
552 | QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); | 576 | QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); |
553 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { | 577 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { |
554 | 578 | ||
555 | if (((*it) == "Anniversary") || | 579 | if (((*it) == "Anniversary") || |
556 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | 580 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; |
557 | 581 | ||
558 | l = new QLabel( mapIdToStr[mapStrToID[*it]].utf8() , container ); | 582 | l = new QLabel( mapIdToStr[mapStrToID[*it]].utf8() , container ); |
559 | listName.append( l ); | 583 | listName.append( l ); |
560 | gl->addWidget( l, i, 0 ); | 584 | gl->addWidget( l, i, 0 ); |
561 | QLineEdit *e = new QLineEdit( container ); | 585 | QLineEdit *e = new QLineEdit( container ); |
562 | listValue.append( e ); | 586 | listValue.append( e ); |
563 | gl->addWidget( e, i, 1); | 587 | gl->addWidget( e, i, 1); |
564 | } | 588 | } |
565 | // Fill labels with names.. | 589 | // Fill labels with names.. |
566 | //loadFields(); | 590 | //loadFields(); |
567 | 591 | ||
568 | 592 | ||
569 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 593 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
570 | 594 | ||
571 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 595 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
572 | dlgNote->setCaption( tr("Enter Note") ); | 596 | dlgNote->setCaption( tr("Enter Note") ); |
573 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 597 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
574 | txtNote = new QMultiLineEdit( dlgNote ); | 598 | txtNote = new QMultiLineEdit( dlgNote ); |
575 | vbNote->addWidget( txtNote ); | 599 | vbNote->addWidget( txtNote ); |
576 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 600 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
577 | 601 | ||
578 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 602 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
579 | dlgName->setCaption( tr("Edit Name") ); | 603 | dlgName->setCaption( tr("Edit Name") ); |
580 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 604 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
581 | 605 | ||
582 | l = new QLabel( tr("First Name"), dlgName ); | 606 | l = new QLabel( tr("First Name"), dlgName ); |
583 | gl->addWidget( l, 0, 0 ); | 607 | gl->addWidget( l, 0, 0 ); |
584 | txtFirstName = new QLineEdit( dlgName ); | 608 | txtFirstName = new QLineEdit( dlgName ); |
585 | gl->addWidget( txtFirstName, 0, 1 ); | 609 | gl->addWidget( txtFirstName, 0, 1 ); |
586 | 610 | ||
587 | l = new QLabel( tr("Middle Name"), dlgName ); | 611 | l = new QLabel( tr("Middle Name"), dlgName ); |
588 | gl->addWidget( l, 1, 0 ); | 612 | gl->addWidget( l, 1, 0 ); |
589 | txtMiddleName = new QLineEdit( dlgName ); | 613 | txtMiddleName = new QLineEdit( dlgName ); |
590 | gl->addWidget( txtMiddleName, 1, 1 ); | 614 | gl->addWidget( txtMiddleName, 1, 1 ); |
591 | 615 | ||
592 | l = new QLabel( tr("Last Name"), dlgName ); | 616 | l = new QLabel( tr("Last Name"), dlgName ); |
593 | gl->addWidget( l, 2, 0 ); | 617 | gl->addWidget( l, 2, 0 ); |
594 | txtLastName = new QLineEdit( dlgName ); | 618 | txtLastName = new QLineEdit( dlgName ); |
595 | gl->addWidget( txtLastName, 2, 1 ); | 619 | gl->addWidget( txtLastName, 2, 1 ); |
596 | 620 | ||
597 | l = new QLabel( tr("Suffix"), dlgName ); | 621 | l = new QLabel( tr("Suffix"), dlgName ); |
598 | gl->addWidget( l, 3, 0 ); | 622 | gl->addWidget( l, 3, 0 ); |
599 | txtSuffix = new QLineEdit( dlgName ); | 623 | txtSuffix = new QLineEdit( dlgName ); |
600 | gl->addWidget( txtSuffix, 3, 1 ); | 624 | gl->addWidget( txtSuffix, 3, 1 ); |
601 | space = new QSpacerItem(1,1, | 625 | space = new QSpacerItem(1,1, |
602 | QSizePolicy::Maximum, | 626 | QSizePolicy::Maximum, |
603 | QSizePolicy::MinimumExpanding ); | 627 | QSizePolicy::MinimumExpanding ); |
604 | gl->addItem( space, 4, 0 ); | 628 | gl->addItem( space, 4, 0 ); |
605 | 629 | ||
606 | cmbChooserField1->insertStringList( trlChooserNames ); | 630 | cmbChooserField1->insertStringList( trlChooserNames ); |
607 | cmbChooserField2->insertStringList( trlChooserNames ); | 631 | cmbChooserField2->insertStringList( trlChooserNames ); |
608 | cmbChooserField3->insertStringList( trlChooserNames ); | 632 | cmbChooserField3->insertStringList( trlChooserNames ); |
609 | cmbChooserField4->insertStringList( trlChooserNames ); | 633 | cmbChooserField4->insertStringList( trlChooserNames ); |
610 | 634 | ||
611 | cmbChooserField1->setCurrentItem( 0 ); | 635 | cmbChooserField1->setCurrentItem( 0 ); |
612 | cmbChooserField2->setCurrentItem( 1 ); | 636 | cmbChooserField2->setCurrentItem( 1 ); |
613 | cmbChooserField3->setCurrentItem( 2 ); | 637 | cmbChooserField3->setCurrentItem( 2 ); |
614 | 638 | ||
615 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 639 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
616 | 640 | ||
617 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); | 641 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); |
618 | 642 | ||
619 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), | 643 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), |
620 | this, SLOT(slotChooser1Change(const QString &)) ); | 644 | this, SLOT(slotChooser1Change(const QString &)) ); |
621 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), | 645 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), |
622 | this, SLOT(slotChooser2Change(const QString &)) ); | 646 | this, SLOT(slotChooser2Change(const QString &)) ); |
623 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), | 647 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), |
624 | this, SLOT(slotChooser3Change(const QString &)) ); | 648 | this, SLOT(slotChooser3Change(const QString &)) ); |
625 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), | 649 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), |
626 | this, SLOT(slotChooser4Change(const QString &)) ); | 650 | this, SLOT(slotChooser4Change(const QString &)) ); |
627 | connect( txtAddress, SIGNAL(textChanged(const QString &)), | 651 | connect( txtAddress, SIGNAL(textChanged(const QString &)), |
628 | this, SLOT(slotAddressChange(const QString &)) ); | 652 | this, SLOT(slotAddressChange(const QString &)) ); |
629 | connect( txtCity, SIGNAL(textChanged(const QString &)), | 653 | connect( txtCity, SIGNAL(textChanged(const QString &)), |
630 | this, SLOT(slotCityChange(const QString &)) ); | 654 | this, SLOT(slotCityChange(const QString &)) ); |
631 | connect( txtState, SIGNAL(textChanged(const QString &)), | 655 | connect( txtState, SIGNAL(textChanged(const QString &)), |
632 | this, SLOT(slotStateChange(const QString &)) ); | 656 | this, SLOT(slotStateChange(const QString &)) ); |
633 | connect( txtZip, SIGNAL(textChanged(const QString &)), | 657 | connect( txtZip, SIGNAL(textChanged(const QString &)), |
634 | this, SLOT(slotZipChange(const QString &)) ); | 658 | this, SLOT(slotZipChange(const QString &)) ); |
635 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), | 659 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), |
636 | this, SLOT(slotCountryChange(const QString &)) ); | 660 | this, SLOT(slotCountryChange(const QString &)) ); |
637 | connect( cmbCountry, SIGNAL(activated(const QString &)), | 661 | connect( cmbCountry, SIGNAL(activated(const QString &)), |
638 | this, SLOT(slotCountryChange(const QString &)) ); | 662 | this, SLOT(slotCountryChange(const QString &)) ); |
639 | connect( cmbChooserField1, SIGNAL(activated(int)), | 663 | connect( cmbChooserField1, SIGNAL(activated(int)), |
640 | this, SLOT(slotCmbChooser1Change(int)) ); | 664 | this, SLOT(slotCmbChooser1Change(int)) ); |
641 | connect( cmbChooserField2, SIGNAL(activated(int)), | 665 | connect( cmbChooserField2, SIGNAL(activated(int)), |
642 | this, SLOT(slotCmbChooser2Change(int)) ); | 666 | this, SLOT(slotCmbChooser2Change(int)) ); |
643 | connect( cmbChooserField3, SIGNAL(activated(int)), | 667 | connect( cmbChooserField3, SIGNAL(activated(int)), |
644 | this, SLOT(slotCmbChooser3Change(int)) ); | 668 | this, SLOT(slotCmbChooser3Change(int)) ); |
645 | connect( cmbChooserField4, SIGNAL(activated(int)), | 669 | connect( cmbChooserField4, SIGNAL(activated(int)), |
646 | this, SLOT(slotCmbChooser4Change(int)) ); | 670 | this, SLOT(slotCmbChooser4Change(int)) ); |
647 | connect( cmbAddress, SIGNAL(activated(int)), | 671 | connect( cmbAddress, SIGNAL(activated(int)), |
648 | this, SLOT(slotAddressTypeChange(int)) ); | 672 | this, SLOT(slotAddressTypeChange(int)) ); |
649 | 673 | ||
650 | new QPEDialogListener(this); | 674 | new QPEDialogListener(this); |
651 | 675 | ||
652 | setPersonalView ( m_personalView ); | 676 | setPersonalView ( m_personalView ); |
653 | 677 | ||
654 | qWarning("init() END"); | 678 | qWarning("init() END"); |
655 | } | 679 | } |
656 | 680 | ||
657 | void ContactEditor::defaultEmailChanged(int i){ | 681 | void ContactEditor::defaultEmailChanged(int i){ |
658 | qDebug("defaultEmailChanged"); | 682 | qDebug("defaultEmailChanged"); |
659 | 683 | ||
660 | // was sollte das ? (se) | 684 | // was sollte das ? (se) |
661 | // int index = cmbChooserField1->currentItem(); | 685 | // int index = cmbChooserField1->currentItem(); |
662 | // slChooserValues[index] = cmbDefaultEmail->text(i); | 686 | // slChooserValues[index] = cmbDefaultEmail->text(i); |
663 | 687 | ||
664 | defaultEmail = cmbDefaultEmail->text(i); | 688 | defaultEmail = cmbDefaultEmail->text(i); |
665 | qDebug ("Changed to: %s", defaultEmail.latin1()); | 689 | qDebug ("Changed to: %s", defaultEmail.latin1()); |
666 | 690 | ||
667 | } | 691 | } |
668 | 692 | ||
669 | void ContactEditor::populateDefaultEmailCmb(){ | 693 | void ContactEditor::populateDefaultEmailCmb(){ |
670 | 694 | ||
671 | // if the default-email combo was not selected and therfore not created | 695 | // if the default-email combo was not selected and therfore not created |
672 | // we get a lot of trouble.. Therfore create an invisible one.. | 696 | // we get a lot of trouble.. Therfore create an invisible one.. |
673 | if ( !cmbDefaultEmail ){ | 697 | if ( !cmbDefaultEmail ){ |
674 | cmbDefaultEmail = new QComboBox(this); | 698 | cmbDefaultEmail = new QComboBox(this); |
675 | cmbDefaultEmail -> hide(); | 699 | cmbDefaultEmail -> hide(); |
676 | } | 700 | } |
677 | cmbDefaultEmail->clear(); | 701 | cmbDefaultEmail->clear(); |
678 | cmbDefaultEmail->insertStringList( emails ); | 702 | cmbDefaultEmail->insertStringList( emails ); |
679 | // cmbDefaultEmail->show(); | 703 | // cmbDefaultEmail->show(); |
680 | 704 | ||
681 | // Select default email in combo.. | 705 | // Select default email in combo.. |
682 | bool found = false; | 706 | bool found = false; |
683 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 707 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
684 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", | 708 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", |
685 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); | 709 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); |
686 | 710 | ||
687 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 711 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
688 | cmbDefaultEmail->setCurrentItem( i ); | 712 | cmbDefaultEmail->setCurrentItem( i ); |
689 | qDebug("set"); | 713 | qDebug("set"); |
690 | found = true; | 714 | found = true; |
691 | } | 715 | } |
692 | } | 716 | } |
693 | 717 | ||
694 | // If the current default email is not found in the list, we choose the | 718 | // If the current default email is not found in the list, we choose the |
695 | // first one.. | 719 | // first one.. |
696 | if ( !found ) | 720 | if ( !found ) |
697 | defaultEmail = cmbDefaultEmail->text(0); | 721 | defaultEmail = cmbDefaultEmail->text(0); |
698 | } | 722 | } |
699 | 723 | ||
700 | // Called when any combobox was changed. | 724 | // Called when any combobox was changed. |
701 | // "true" returned if the change was chandled by this function, else it should | 725 | // "true" returned if the change was chandled by this function, else it should |
702 | // be handled by something else.. | 726 | // be handled by something else.. |
703 | bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widgetPos ) { | 727 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { |
704 | QString type = slChooserNames[index]; | 728 | QString type = slChooserNames[index]; |
705 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); | 729 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); |
706 | 730 | ||
707 | if ( !initializing ) | 731 | if ( !initializing ) |
708 | contactfields.setFieldOrder( widgetPos-1, index ); | 732 | contactfields.setFieldOrder( widgetPos-1, index ); |
709 | 733 | ||
710 | // Create and connect combobox for selecting the default email | 734 | // Create and connect combobox for selecting the default email |
711 | if ( type == "Default Email"){ | 735 | if ( type == "Default Email"){ |
712 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); | 736 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); |
713 | 737 | ||
714 | // More than one defaul-email chooser is not allowed ! | 738 | // More than one default-email chooser is not allowed ! |
715 | if ( ( defaultEmailChooserPosition != -1 ) && | 739 | if ( ( defaultEmailChooserPosition != -1 ) && |
716 | defaultEmailChooserPosition != widgetPos && !initializing){ | 740 | defaultEmailChooserPosition != widgetPos && !initializing){ |
717 | chooserError( widgetPos ); | 741 | chooserError( widgetPos ); |
718 | return true; | 742 | return true; |
719 | } | 743 | } |
720 | 744 | ||
721 | if ( cmbDefaultEmail ){ | 745 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
722 | delete cmbDefaultEmail; | 746 | if ( cmbo ){ |
723 | cmbDefaultEmail = 0l; | 747 | inputStack->raiseWidget( TextField ); |
748 | inputStack -> removeWidget( cmbo ); | ||
749 | delete cmbo; | ||
724 | } | 750 | } |
725 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); | 751 | cmbo = new QComboBox( inputStack ); |
726 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); /* :SX */ | 752 | cmbo -> insertStringList( emails ); |
727 | |||
728 | QRect rect = inputWid->frameGeometry(); | ||
729 | qWarning("Geometrie: X=%d, Y=%d, Left=%d, Top=%d, Right=%d, Bottom=%d", | ||
730 | rect.x(), rect.y(), rect.left(), rect.top(), rect.right(), rect.bottom()); | ||
731 | QPoint pnt = inputWid->pos(); | ||
732 | qWarning("Position : X=%d, Y=%d", pnt.x(), pnt.y() ); | ||
733 | |||
734 | connect( cmbDefaultEmail,SIGNAL( activated(int) ), | ||
735 | SLOT( defaultEmailChanged(int) ) ); | ||
736 | 753 | ||
737 | cmbDefaultEmail->clear(); | 754 | inputStack -> addWidget( cmbo, Combo ); |
738 | cmbDefaultEmail->insertStringList( emails ); | 755 | inputStack -> raiseWidget( Combo ); |
739 | cmbDefaultEmail->show(); | ||
740 | 756 | ||
741 | defaultEmailChooserPosition = widgetPos; | 757 | defaultEmailChooserPosition = widgetPos; |
758 | cmbDefaultEmail = cmbo; | ||
759 | |||
760 | connect( cmbo,SIGNAL( activated(int) ), | ||
761 | SLOT( defaultEmailChanged(int) ) ); | ||
742 | 762 | ||
743 | // Set current default email | 763 | // Set current default email |
744 | populateDefaultEmailCmb(); | 764 | populateDefaultEmailCmb(); |
745 | 765 | ||
746 | 766 | ||
747 | } else { | 767 | } else { |
748 | // Something else was selected: Hide combo.. | 768 | // Something else was selected: Hide combo.. |
749 | qWarning(" Hiding default-email combo" ); | 769 | qWarning(" Hiding default-email combo" ); |
750 | if ( defaultEmailChooserPosition == widgetPos ){ | 770 | if ( defaultEmailChooserPosition == widgetPos ){ |
751 | defaultEmailChooserPosition = -1; | 771 | defaultEmailChooserPosition = -1; |
752 | if ( cmbDefaultEmail ) | 772 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
753 | cmbDefaultEmail->hide(); | 773 | if ( cmbo ){ |
774 | inputStack->raiseWidget( TextField ); | ||
775 | inputStack -> removeWidget( cmbo ); | ||
776 | cmbDefaultEmail = 0l; | ||
777 | delete cmbo; | ||
778 | } | ||
754 | 779 | ||
755 | } | 780 | } |
756 | 781 | ||
757 | // Caller should initialize the responsible textfield, therefore | 782 | // Caller should initialize the responsible textfield, therefore |
758 | // "false" is returned | 783 | // "false" is returned |
759 | return false; | 784 | return false; |
760 | } | 785 | } |
761 | 786 | ||
762 | // Everything is worked off .. | 787 | // Everything is worked off .. |
763 | return true; | 788 | return true; |
764 | 789 | ||
765 | } | 790 | } |
766 | 791 | ||
767 | // Currently accessed when we select default-email more than once ! | 792 | // Currently accessed when we select default-email more than once ! |
768 | void ContactEditor::chooserError( int index ) | 793 | void ContactEditor::chooserError( int index ) |
769 | { | 794 | { |
770 | qWarning("ContactEditor::chooserError( %d )", index); | 795 | qWarning("ContactEditor::chooserError( %d )", index); |
771 | QMessageBox::warning( this, "Chooser Error", | 796 | QMessageBox::warning( this, "Chooser Error", |
772 | "Multiple selection of this\n" | 797 | "Multiple selection of this\n" |
773 | "Item is not allowed !\n\n" | 798 | "Item is not allowed !\n\n" |
774 | "First deselect the previous one !", | 799 | "First deselect the previous one !", |
775 | "&OK", 0, 0, | 800 | "&OK", 0, 0, |
776 | 0, 0 ); | 801 | 0, 0 ); |
777 | 802 | ||
778 | // Reset the selected Chooser. Unfortunately the chooser | 803 | // Reset the selected Chooser. Unfortunately the chooser |
779 | // generates no signal, therfore we have to | 804 | // generates no signal, therfore we have to |
780 | // call the cmbChooserChange function manually.. | 805 | // call the cmbChooserChange function manually.. |
781 | switch( index ){ | 806 | switch( index ){ |
782 | case 1: | 807 | case 1: |
783 | cmbChooserField1 -> setCurrentItem( 0 ); | 808 | cmbChooserField1 -> setCurrentItem( 0 ); |
784 | slotCmbChooser1Change( 0 ); | 809 | slotCmbChooser1Change( 0 ); |
785 | break; | 810 | break; |
786 | case 2: | 811 | case 2: |
787 | cmbChooserField2 -> setCurrentItem( 0 ); | 812 | cmbChooserField2 -> setCurrentItem( 0 ); |
788 | slotCmbChooser2Change( 0 ); | 813 | slotCmbChooser2Change( 0 ); |
789 | break; | 814 | break; |
790 | case 3: | 815 | case 3: |
791 | cmbChooserField3 -> setCurrentItem( 0 ); | 816 | cmbChooserField3 -> setCurrentItem( 0 ); |
792 | slotCmbChooser3Change( 0 ); | 817 | slotCmbChooser3Change( 0 ); |
793 | break; | 818 | break; |
794 | case 4: | 819 | case 4: |
795 | cmbChooserField4 -> setCurrentItem( 0 ); | 820 | cmbChooserField4 -> setCurrentItem( 0 ); |
796 | slotCmbChooser4Change( 0 ); | 821 | slotCmbChooser4Change( 0 ); |
797 | break; | 822 | break; |
798 | } | 823 | } |
799 | } | 824 | } |
800 | 825 | ||
801 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) | 826 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
802 | void ContactEditor::chooserChange( const QString &textChanged, int index, | 827 | void ContactEditor::chooserChange( const QString &textChanged, int index, |
803 | QLineEdit* , int widgetPos ) { | 828 | QLineEdit* , int widgetPos ) { |
804 | 829 | ||
805 | QString type = slChooserNames[index]; | 830 | QString type = slChooserNames[index]; // :SX |
806 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", | 831 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", |
807 | type.latin1(),textChanged.latin1(), index, widgetPos ); | 832 | type.latin1(),textChanged.latin1(), index, widgetPos ); |
808 | 833 | ||
809 | if ( type == "Default Email"){ | 834 | if ( type == "Default Email"){ |
810 | qWarning ("??? Wozu??: %s", textChanged.latin1()); | 835 | qWarning ("??? Wozu??: %s", textChanged.latin1()); |
811 | defaultEmail = textChanged; | 836 | defaultEmail = textChanged; |
812 | 837 | ||
813 | populateDefaultEmailCmb(); | 838 | populateDefaultEmailCmb(); |
814 | 839 | ||
815 | }else if (defaultEmailChooserPosition == widgetPos){ | 840 | }else if (type == "Emails"){ |
816 | qDebug("cmbDefaultEmail->hide()"); | ||
817 | |||
818 | if (cmbDefaultEmail) cmbDefaultEmail->hide(); | ||
819 | widgetPos=-1; | ||
820 | |||
821 | }else if (type == "Emails"){ | ||
822 | qDebug("emails"); | 841 | qDebug("emails"); |
823 | 842 | ||
824 | QString de; | 843 | QString de; |
825 | emails = QStringList::split (",", textChanged ); | 844 | emails = QStringList::split (",", textChanged ); |
826 | 845 | ||
827 | populateDefaultEmailCmb(); | 846 | populateDefaultEmailCmb(); |
828 | } | 847 | } |
829 | 848 | ||
830 | slChooserValues[index] = textChanged; | 849 | slChooserValues[index] = textChanged; |
831 | 850 | ||
832 | } | 851 | } |
833 | 852 | ||
834 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 853 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
835 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); | 854 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); |
836 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 855 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
837 | } | 856 | } |
838 | 857 | ||
839 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 858 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
840 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); | 859 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); |
841 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 860 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
842 | 861 | ||
843 | } | 862 | } |
844 | 863 | ||
845 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 864 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
846 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); | 865 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); |
847 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 866 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
848 | } | 867 | } |
849 | 868 | ||
850 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 869 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
851 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); | 870 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); |
852 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 871 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
853 | } | 872 | } |
854 | 873 | ||
855 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 874 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
856 | 875 | ||
857 | if ( cmbAddress->currentItem() == 0 ) { | 876 | if ( cmbAddress->currentItem() == 0 ) { |
858 | slBusinessAddress[0] = textChanged; | 877 | slBusinessAddress[0] = textChanged; |
859 | } else { | 878 | } else { |
860 | slHomeAddress[0] = textChanged; | 879 | slHomeAddress[0] = textChanged; |
861 | } | 880 | } |
862 | } | 881 | } |
863 | 882 | ||
864 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 883 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
865 | 884 | ||
866 | if ( cmbAddress->currentItem() == 0 ) { | 885 | if ( cmbAddress->currentItem() == 0 ) { |
867 | slBusinessAddress[1] = textChanged; | 886 | slBusinessAddress[1] = textChanged; |
868 | } else { | 887 | } else { |
869 | slHomeAddress[1] = textChanged; | 888 | slHomeAddress[1] = textChanged; |
870 | } | 889 | } |
871 | } | 890 | } |
872 | 891 | ||
873 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 892 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
874 | 893 | ||
875 | if ( cmbAddress->currentItem() == 0 ) { | 894 | if ( cmbAddress->currentItem() == 0 ) { |
876 | slBusinessAddress[2] = textChanged; | 895 | slBusinessAddress[2] = textChanged; |
877 | } else { | 896 | } else { |
878 | slHomeAddress[2] = textChanged; | 897 | slHomeAddress[2] = textChanged; |
879 | } | 898 | } |
880 | } | 899 | } |
881 | 900 | ||
882 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 901 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
883 | 902 | ||
884 | if ( cmbAddress->currentItem() == 0 ) { | 903 | if ( cmbAddress->currentItem() == 0 ) { |
885 | slBusinessAddress[3] = textChanged; | 904 | slBusinessAddress[3] = textChanged; |
886 | } else { | 905 | } else { |
887 | slHomeAddress[3] = textChanged; | 906 | slHomeAddress[3] = textChanged; |
888 | } | 907 | } |
889 | } | 908 | } |
890 | 909 | ||
891 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 910 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
892 | 911 | ||
893 | 912 | ||
894 | if ( cmbAddress->currentItem() == 0 ) { | 913 | if ( cmbAddress->currentItem() == 0 ) { |
895 | slBusinessAddress[4] = textChanged; | 914 | slBusinessAddress[4] = textChanged; |
896 | } else { | 915 | } else { |
897 | slHomeAddress[4] = textChanged; | 916 | slHomeAddress[4] = textChanged; |
898 | } | 917 | } |
899 | } | 918 | } |
900 | 919 | ||
901 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 920 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
902 | 921 | ||
903 | if ( cmbAddress->currentItem() == 0 ) { | 922 | if ( cmbAddress->currentItem() == 0 ) { |
904 | slBusinessAddress[5] = textChanged; | 923 | slBusinessAddress[5] = textChanged; |
905 | } else { | 924 | } else { |
906 | slHomeAddress[5] = textChanged; | 925 | slHomeAddress[5] = textChanged; |
907 | } | 926 | } |
908 | } | 927 | } |
909 | 928 | ||
910 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 929 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
911 | 930 | ||
912 | if ( cmbAddress->currentItem() == 0 ) { | 931 | if ( cmbAddress->currentItem() == 0 ) { |
913 | slBusinessAddress[6] = textChanged; | 932 | slBusinessAddress[6] = textChanged; |
914 | } else { | 933 | } else { |
915 | slHomeAddress[6] = textChanged; | 934 | slHomeAddress[6] = textChanged; |
916 | } | 935 | } |
917 | } | 936 | } |
918 | 937 | ||
919 | 938 | ||
920 | void ContactEditor::slotCmbChooser1Change( int index ) { | 939 | void ContactEditor::slotCmbChooser1Change( int index ) { |
921 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); | 940 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); |
922 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), txtChooserField1, 1) ){ | 941 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ |
923 | 942 | ||
924 | txtChooserField1->setText( slChooserValues[index] ); | 943 | txtChooserField1->setText( slChooserValues[index] ); |
925 | txtChooserField1->setFocus(); | 944 | txtChooserField1->setFocus(); |
926 | 945 | ||
927 | } | 946 | } |
928 | 947 | ||
929 | } | 948 | } |
930 | 949 | ||
931 | void ContactEditor::slotCmbChooser2Change( int index ) { | 950 | void ContactEditor::slotCmbChooser2Change( int index ) { |
932 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); | 951 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); |
933 | 952 | ||
934 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), txtChooserField2, 2) ){ | 953 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ |
935 | 954 | ||
936 | txtChooserField2->setText( slChooserValues[index] ); | 955 | txtChooserField2->setText( slChooserValues[index] ); |
937 | txtChooserField2->setFocus(); | 956 | txtChooserField2->setFocus(); |
938 | 957 | ||
939 | } | 958 | } |
940 | } | 959 | } |
941 | 960 | ||
942 | void ContactEditor::slotCmbChooser3Change( int index ) { | 961 | void ContactEditor::slotCmbChooser3Change( int index ) { |
943 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); | 962 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); |
944 | 963 | ||
945 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), txtChooserField3, 3) ){ | 964 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ |
946 | 965 | ||
947 | txtChooserField3->setText( slChooserValues[index] ); | 966 | txtChooserField3->setText( slChooserValues[index] ); |
948 | txtChooserField3->setFocus(); | 967 | txtChooserField3->setFocus(); |
949 | 968 | ||
950 | } | 969 | } |
951 | } | 970 | } |
952 | 971 | ||
953 | void ContactEditor::slotCmbChooser4Change( int index ) { | 972 | void ContactEditor::slotCmbChooser4Change( int index ) { |
954 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); | 973 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); |
955 | 974 | ||
956 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), txtChooserField4, 4) ){ | 975 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ |
957 | 976 | ||
958 | txtChooserField4->setText( slChooserValues[index] ); | 977 | txtChooserField4->setText( slChooserValues[index] ); |
959 | txtChooserField4->setFocus(); | 978 | txtChooserField4->setFocus(); |
960 | 979 | ||
961 | } | 980 | } |
962 | } | 981 | } |
963 | 982 | ||
964 | void ContactEditor::slotAddressTypeChange( int index ) { | 983 | void ContactEditor::slotAddressTypeChange( int index ) { |
965 | 984 | ||
966 | 985 | ||
967 | if ( !initializing ) | 986 | if ( !initializing ) |
968 | contactfields.setFieldOrder( 4, index ); | 987 | contactfields.setFieldOrder( 4, index ); |
969 | 988 | ||
970 | 989 | ||
971 | if ( index == 0 ) { | 990 | if ( index == 0 ) { |
972 | 991 | ||
973 | txtAddress->setText( slBusinessAddress[0] ); | 992 | txtAddress->setText( slBusinessAddress[0] ); |
974 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 993 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
975 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 994 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
976 | txtCity->setText( slBusinessAddress[3] ); | 995 | txtCity->setText( slBusinessAddress[3] ); |
977 | txtState->setText( slBusinessAddress[4] ); | 996 | txtState->setText( slBusinessAddress[4] ); |
978 | txtZip->setText( slBusinessAddress[5] ); | 997 | txtZip->setText( slBusinessAddress[5] ); |
979 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 998 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
980 | txtTmp->setText( slBusinessAddress[6] ); | 999 | txtTmp->setText( slBusinessAddress[6] ); |
981 | 1000 | ||
982 | } else { | 1001 | } else { |
983 | 1002 | ||
984 | txtAddress->setText( slHomeAddress[0] ); | 1003 | txtAddress->setText( slHomeAddress[0] ); |
985 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 1004 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
986 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 1005 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
987 | txtCity->setText( slHomeAddress[3] ); | 1006 | txtCity->setText( slHomeAddress[3] ); |
988 | txtState->setText( slHomeAddress[4] ); | 1007 | txtState->setText( slHomeAddress[4] ); |
989 | txtZip->setText( slHomeAddress[5] ); | 1008 | txtZip->setText( slHomeAddress[5] ); |
990 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1009 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
991 | txtTmp->setText( slHomeAddress[6] ); | 1010 | txtTmp->setText( slHomeAddress[6] ); |
992 | 1011 | ||
993 | } | 1012 | } |
994 | 1013 | ||
995 | } | 1014 | } |
996 | 1015 | ||
997 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1016 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
998 | 1017 | ||
999 | int index = cmbFileAs->currentItem(); | 1018 | int index = cmbFileAs->currentItem(); |
1000 | 1019 | ||
1001 | cmbFileAs->clear(); | 1020 | cmbFileAs->clear(); |
1002 | 1021 | ||
1003 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); | 1022 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); |
1004 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); | 1023 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); |
1005 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); | 1024 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); |
1006 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); | 1025 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); |
1007 | 1026 | ||
1008 | cmbFileAs->setCurrentItem( index ); | 1027 | cmbFileAs->setCurrentItem( index ); |
1009 | 1028 | ||
1010 | useFullName = true; | 1029 | useFullName = true; |
1011 | 1030 | ||
1012 | } | 1031 | } |
1013 | 1032 | ||
1014 | void ContactEditor::accept() { | 1033 | void ContactEditor::accept() { |
1015 | 1034 | ||
1016 | if ( isEmpty() ) { | 1035 | if ( isEmpty() ) { |
1017 | cleanupFields(); | 1036 | cleanupFields(); |
1018 | reject(); | 1037 | reject(); |
1019 | } else { | 1038 | } else { |
1020 | saveEntry(); | 1039 | saveEntry(); |
1021 | cleanupFields(); | 1040 | cleanupFields(); |
1022 | QDialog::accept(); | 1041 | QDialog::accept(); |
1023 | } | 1042 | } |
1024 | 1043 | ||
1025 | } | 1044 | } |
1026 | 1045 | ||
1027 | void ContactEditor::slotNote() { | 1046 | void ContactEditor::slotNote() { |
1028 | 1047 | ||
1029 | dlgNote->showMaximized(); | 1048 | dlgNote->showMaximized(); |
1030 | if ( !dlgNote->exec() ) { | 1049 | if ( !dlgNote->exec() ) { |
1031 | txtNote->setText( ent.notes() ); | 1050 | txtNote->setText( ent.notes() ); |
1032 | } | 1051 | } |
1033 | } | 1052 | } |
1034 | 1053 | ||
1035 | void ContactEditor::slotName() { | 1054 | void ContactEditor::slotName() { |
1036 | 1055 | ||
1037 | QString tmpName; | 1056 | QString tmpName; |
1038 | if (useFullName) { | 1057 | if (useFullName) { |
1039 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1058 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1040 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1059 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1041 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1060 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1042 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1061 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1043 | } | 1062 | } |
1044 | dlgName->showMaximized(); | 1063 | dlgName->showMaximized(); |
1045 | if ( dlgName->exec() ) { | 1064 | if ( dlgName->exec() ) { |
1046 | 1065 | ||
1047 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); | 1066 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); |
1048 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1067 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1049 | slotFullNameChange( txtFullName->text() ); | 1068 | slotFullNameChange( txtFullName->text() ); |
1050 | useFullName = false; | 1069 | useFullName = false; |
1051 | } | 1070 | } |
1052 | 1071 | ||
1053 | } | 1072 | } |
1054 | 1073 | ||
1055 | void ContactEditor::setNameFocus() { | 1074 | void ContactEditor::setNameFocus() { |
1056 | 1075 | ||
1057 | txtFullName->setFocus(); | 1076 | txtFullName->setFocus(); |
1058 | 1077 | ||
1059 | } | 1078 | } |
1060 | 1079 | ||
1061 | bool ContactEditor::isEmpty() { | 1080 | bool ContactEditor::isEmpty() { |
1062 | // Test and see if the record should be saved. | 1081 | // Test and see if the record should be saved. |
1063 | // More strict than the original qtopia, needs name or fileas to save | 1082 | // More strict than the original qtopia, needs name or fileas to save |
1064 | 1083 | ||
1065 | QString t = txtFullName->text(); | 1084 | QString t = txtFullName->text(); |
1066 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1085 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1067 | return false; | 1086 | return false; |
1068 | 1087 | ||
1069 | t = cmbFileAs->currentText(); | 1088 | t = cmbFileAs->currentText(); |
1070 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1089 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1071 | return false; | 1090 | return false; |
1072 | 1091 | ||
1073 | return true; | 1092 | return true; |
1074 | 1093 | ||
1075 | } | 1094 | } |
1076 | 1095 | ||
1077 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1096 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1078 | 1097 | ||
1079 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1098 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1080 | QString strFirstName; | 1099 | QString strFirstName; |
1081 | QString strMiddleName; | 1100 | QString strMiddleName; |
1082 | QString strLastName; | 1101 | QString strLastName; |
1083 | QString strSuffix; | 1102 | QString strSuffix; |
1084 | QString strTitle; | 1103 | QString strTitle; |
1085 | int commapos; | 1104 | int commapos; |
1086 | int spCount; | 1105 | int spCount; |
1087 | int spPos; | 1106 | int spPos; |
1088 | int spPos2; | 1107 | int spPos2; |
1089 | 1108 | ||
1090 | 1109 | ||
1091 | commapos = simplifiedName.find( ',', 0, TRUE); | 1110 | commapos = simplifiedName.find( ',', 0, TRUE); |
1092 | spCount = simplifiedName.contains( ' ', TRUE ); | 1111 | spCount = simplifiedName.contains( ' ', TRUE ); |
1093 | 1112 | ||
1094 | if ( commapos == -1 ) { | 1113 | if ( commapos == -1 ) { |
1095 | 1114 | ||
1096 | switch (spCount) { | 1115 | switch (spCount) { |
1097 | case 0: | 1116 | case 0: |
1098 | //return simplifiedName; | 1117 | //return simplifiedName; |
1099 | if (txtLastName->text() != "") { | 1118 | if (txtLastName->text() != "") { |
1100 | strLastName = simplifiedName; | 1119 | strLastName = simplifiedName; |
1101 | break; | 1120 | break; |
1102 | } | 1121 | } |
1103 | if (txtMiddleName->text() != "") { | 1122 | if (txtMiddleName->text() != "") { |
1104 | strMiddleName = simplifiedName; | 1123 | strMiddleName = simplifiedName; |
1105 | break; | 1124 | break; |
1106 | } | 1125 | } |
1107 | if (txtSuffix->text() != "") { | 1126 | if (txtSuffix->text() != "") { |
1108 | strSuffix = simplifiedName; | 1127 | strSuffix = simplifiedName; |
1109 | break; | 1128 | break; |
1110 | } | 1129 | } |
1111 | strFirstName = simplifiedName; | 1130 | strFirstName = simplifiedName; |
1112 | break; | 1131 | break; |
1113 | 1132 | ||
1114 | case 1: | 1133 | case 1: |
1115 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1134 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1116 | strFirstName = simplifiedName.left( spPos ); | 1135 | strFirstName = simplifiedName.left( spPos ); |
1117 | strLastName = simplifiedName.mid( spPos + 1 ); | 1136 | strLastName = simplifiedName.mid( spPos + 1 ); |
1118 | break; | 1137 | break; |
1119 | 1138 | ||
1120 | case 2: | 1139 | case 2: |
1121 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1140 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1122 | strFirstName = simplifiedName.left( spPos ); | 1141 | strFirstName = simplifiedName.left( spPos ); |
1123 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1142 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1124 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1143 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1125 | strLastName = simplifiedName.mid( spPos2 + 1 ); | 1144 | strLastName = simplifiedName.mid( spPos2 + 1 ); |
1126 | break; | 1145 | break; |
1127 | 1146 | ||
1128 | case 3: | 1147 | case 3: |
1129 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1148 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1130 | strFirstName = simplifiedName.left( spPos ); | 1149 | strFirstName = simplifiedName.left( spPos ); |
1131 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1150 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1132 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1151 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1133 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1152 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1134 | strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1153 | strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1135 | strSuffix = simplifiedName.mid( spPos + 1 ); | 1154 | strSuffix = simplifiedName.mid( spPos + 1 ); |
1136 | break; | 1155 | break; |
1137 | 1156 | ||
1138 | case 4: | 1157 | case 4: |
1139 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1158 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1140 | strTitle = simplifiedName.left( spPos ); | 1159 | strTitle = simplifiedName.left( spPos ); |
1141 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1160 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1142 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1161 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1143 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1162 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1144 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1163 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1145 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1164 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1146 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1165 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1147 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1166 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1148 | break; | 1167 | break; |
1149 | 1168 | ||
1150 | default: | 1169 | default: |
1151 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1170 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1152 | strTitle = simplifiedName.left( spPos ); | 1171 | strTitle = simplifiedName.left( spPos ); |
1153 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1172 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1154 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1173 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1155 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1174 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1156 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1175 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1157 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1176 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1158 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1177 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1159 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1178 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1160 | break; | 1179 | break; |
1161 | } | 1180 | } |
1162 | } else { | 1181 | } else { |
1163 | simplifiedName.replace( commapos, 1, " " ); | 1182 | simplifiedName.replace( commapos, 1, " " ); |
1164 | simplifiedName = simplifiedName.simplifyWhiteSpace(); | 1183 | simplifiedName = simplifiedName.simplifyWhiteSpace(); |
1165 | 1184 | ||
1166 | switch (spCount) { | 1185 | switch (spCount) { |
1167 | case 0: | 1186 | case 0: |
1168 | //return simplifiedName; | 1187 | //return simplifiedName; |
1169 | if (txtLastName->text() != "") { | 1188 | if (txtLastName->text() != "") { |
1170 | strLastName = simplifiedName; | 1189 | strLastName = simplifiedName; |
1171 | break; | 1190 | break; |
1172 | } | 1191 | } |
1173 | if (txtMiddleName->text() != "") { | 1192 | if (txtMiddleName->text() != "") { |
1174 | strMiddleName = simplifiedName; | 1193 | strMiddleName = simplifiedName; |
1175 | break; | 1194 | break; |
1176 | } | 1195 | } |
1177 | if (txtSuffix->text() != "") { | 1196 | if (txtSuffix->text() != "") { |
1178 | strSuffix = simplifiedName; | 1197 | strSuffix = simplifiedName; |
1179 | break; | 1198 | break; |
1180 | } | 1199 | } |
1181 | strFirstName = simplifiedName; | 1200 | strFirstName = simplifiedName; |
1182 | break; | 1201 | break; |
1183 | 1202 | ||
1184 | case 1: | 1203 | case 1: |
1185 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1204 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1186 | strLastName = simplifiedName.left( spPos ); | 1205 | strLastName = simplifiedName.left( spPos ); |
1187 | strFirstName = simplifiedName.mid( spPos + 1 ); | 1206 | strFirstName = simplifiedName.mid( spPos + 1 ); |
1188 | break; | 1207 | break; |
1189 | 1208 | ||
1190 | case 2: | 1209 | case 2: |
1191 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1210 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1192 | strLastName = simplifiedName.left( spPos ); | 1211 | strLastName = simplifiedName.left( spPos ); |
1193 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1212 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1194 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1213 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1195 | strMiddleName = simplifiedName.mid( spPos2 + 1 ); | 1214 | strMiddleName = simplifiedName.mid( spPos2 + 1 ); |
1196 | break; | 1215 | break; |
1197 | 1216 | ||
1198 | case 3: | 1217 | case 3: |
1199 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1218 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1200 | strLastName = simplifiedName.left( spPos ); | 1219 | strLastName = simplifiedName.left( spPos ); |
1201 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1220 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1202 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1221 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1203 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1222 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1204 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1223 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1205 | strSuffix = simplifiedName.mid( spPos + 1 ); | 1224 | strSuffix = simplifiedName.mid( spPos + 1 ); |
1206 | break; | 1225 | break; |
1207 | 1226 | ||
1208 | case 4: | 1227 | case 4: |
1209 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1228 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1210 | strLastName = simplifiedName.left( spPos ); | 1229 | strLastName = simplifiedName.left( spPos ); |
1211 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1230 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1212 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1231 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1213 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1232 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1214 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1233 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1215 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1234 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1216 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1235 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1217 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1236 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1218 | break; | 1237 | break; |
1219 | 1238 | ||
1220 | default: | 1239 | default: |
1221 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1240 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1222 | strLastName = simplifiedName.left( spPos ); | 1241 | strLastName = simplifiedName.left( spPos ); |
1223 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1242 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1224 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1243 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1225 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1244 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1226 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 1245 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); |
1227 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1246 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1228 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1247 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1229 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1248 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1230 | break; | 1249 | break; |
1231 | } | 1250 | } |
1232 | } | 1251 | } |
1233 | switch (type) { | 1252 | switch (type) { |
1234 | case NAME_FL: | 1253 | case NAME_FL: |
1235 | return strFirstName + " " + strLastName; | 1254 | return strFirstName + " " + strLastName; |
1236 | 1255 | ||
1237 | case NAME_LF: | 1256 | case NAME_LF: |
1238 | return strLastName + ", " + strFirstName; | 1257 | return strLastName + ", " + strFirstName; |
1239 | 1258 | ||
1240 | case NAME_LFM: | 1259 | case NAME_LFM: |
1241 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1260 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1242 | 1261 | ||
1243 | case NAME_FMLS: | 1262 | case NAME_FMLS: |
1244 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; | 1263 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; |
1245 | 1264 | ||
1246 | case NAME_F: | 1265 | case NAME_F: |
1247 | return strFirstName; | 1266 | return strFirstName; |
1248 | 1267 | ||
1249 | case NAME_M: | 1268 | case NAME_M: |
1250 | return strMiddleName; | 1269 | return strMiddleName; |
1251 | 1270 | ||
1252 | case NAME_L: | 1271 | case NAME_L: |
1253 | return strLastName; | 1272 | return strLastName; |
1254 | 1273 | ||
1255 | case NAME_S: | 1274 | case NAME_S: |
1256 | return strSuffix; | 1275 | return strSuffix; |
1257 | 1276 | ||
1258 | } | 1277 | } |
1259 | return QString::null; | 1278 | return QString::null; |
1260 | } | 1279 | } |
1261 | 1280 | ||
1262 | void ContactEditor::cleanupFields() { | 1281 | void ContactEditor::cleanupFields() { |
1263 | QStringList::Iterator it = slChooserValues.begin(); | 1282 | QStringList::Iterator it = slChooserValues.begin(); |
1264 | 1283 | ||
1265 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1284 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1266 | (*it) = ""; | 1285 | (*it) = ""; |
1267 | } | 1286 | } |
1268 | 1287 | ||
1269 | for ( int i = 0; i < 7; i++ ) { | 1288 | for ( int i = 0; i < 7; i++ ) { |
1270 | slHomeAddress[i] = ""; | 1289 | slHomeAddress[i] = ""; |
1271 | slBusinessAddress[i] = ""; | 1290 | slBusinessAddress[i] = ""; |
1272 | } | 1291 | } |
1273 | 1292 | ||
1274 | QListIterator<QLineEdit> itLV( listValue ); | 1293 | QListIterator<QLineEdit> itLV( listValue ); |
1275 | for ( ; itLV.current(); ++itLV ) { | 1294 | for ( ; itLV.current(); ++itLV ) { |
1276 | (*itLV)->setText( "" ); | 1295 | (*itLV)->setText( "" ); |
1277 | } | 1296 | } |
1278 | 1297 | ||
1279 | txtFirstName->setText(""); | 1298 | txtFirstName->setText(""); |
1280 | txtMiddleName->setText(""); | 1299 | txtMiddleName->setText(""); |
1281 | txtLastName->setText(""); | 1300 | txtLastName->setText(""); |
1282 | txtSuffix->setText(""); | 1301 | txtSuffix->setText(""); |
1283 | txtNote->setText(""); | 1302 | txtNote->setText(""); |
1284 | txtFullName->setText(""); | 1303 | txtFullName->setText(""); |
1285 | txtJobTitle->setText(""); | 1304 | txtJobTitle->setText(""); |
1286 | txtOrganization->setText(""); | 1305 | txtOrganization->setText(""); |
1287 | txtChooserField1->setText(""); | 1306 | txtChooserField1->setText(""); |
1288 | txtChooserField2->setText(""); | 1307 | txtChooserField2->setText(""); |
1289 | txtChooserField3->setText(""); | 1308 | txtChooserField3->setText(""); |
1290 | txtAddress->setText(""); | 1309 | txtAddress->setText(""); |
1291 | txtCity->setText(""); | 1310 | txtCity->setText(""); |
1292 | txtState->setText(""); | 1311 | txtState->setText(""); |
1293 | txtZip->setText(""); | 1312 | txtZip->setText(""); |
1294 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1313 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1295 | txtTmp->setText(""); | 1314 | txtTmp->setText(""); |
1296 | txtTmp = cmbFileAs->lineEdit(); | 1315 | txtTmp = cmbFileAs->lineEdit(); |
1297 | txtTmp->setText(""); | 1316 | txtTmp->setText(""); |
1298 | 1317 | ||
1299 | } | 1318 | } |
1300 | 1319 | ||
1301 | void ContactEditor::setEntry( const OContact &entry ) { | 1320 | void ContactEditor::setEntry( const OContact &entry ) { |
1302 | 1321 | ||
1303 | initializing = true; | 1322 | initializing = true; |
1304 | 1323 | ||
1305 | cleanupFields(); | 1324 | cleanupFields(); |
1306 | 1325 | ||
1307 | ent = entry; | 1326 | ent = entry; |
1308 | 1327 | ||
1309 | emails = QStringList(ent.emailList()); | 1328 | emails = QStringList(ent.emailList()); |
1310 | defaultEmail = ent.defaultEmail(); | 1329 | defaultEmail = ent.defaultEmail(); |
1311 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1330 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1312 | qDebug("default email=%s",defaultEmail.latin1()); | 1331 | qDebug("default email=%s",defaultEmail.latin1()); |
1313 | 1332 | ||
1314 | useFullName = false; | 1333 | useFullName = false; |
1315 | txtFirstName->setText( ent.firstName() ); | 1334 | txtFirstName->setText( ent.firstName() ); |
1316 | txtMiddleName->setText( ent.middleName() ); | 1335 | txtMiddleName->setText( ent.middleName() ); |
1317 | txtLastName->setText( ent.lastName() ); | 1336 | txtLastName->setText( ent.lastName() ); |
1318 | txtSuffix->setText( ent.suffix() ); | 1337 | txtSuffix->setText( ent.suffix() ); |
1319 | 1338 | ||
1320 | QString *tmpString = new QString; | 1339 | QString *tmpString = new QString; |
1321 | *tmpString = ent.firstName() + " " + ent.middleName() + | 1340 | *tmpString = ent.firstName() + " " + ent.middleName() + |
1322 | + " " + ent.lastName() + " " + ent.suffix(); | 1341 | + " " + ent.lastName() + " " + ent.suffix(); |
1323 | 1342 | ||
1324 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1343 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1325 | 1344 | ||
1326 | cmbFileAs->setEditText( ent.fileAs() ); | 1345 | cmbFileAs->setEditText( ent.fileAs() ); |
1327 | 1346 | ||
1328 | //if (hasTitle) | 1347 | //if (hasTitle) |
1329 | txtJobTitle->setText( ent.jobTitle() ); | 1348 | txtJobTitle->setText( ent.jobTitle() ); |
1330 | 1349 | ||
1331 | //if (hasCompany) | 1350 | //if (hasCompany) |
1332 | txtOrganization->setText( ent.company() ); | 1351 | txtOrganization->setText( ent.company() ); |
1333 | 1352 | ||
1334 | //if (hasNotes) | 1353 | //if (hasNotes) |
1335 | txtNote->setText( ent.notes() ); | 1354 | txtNote->setText( ent.notes() ); |
1336 | 1355 | ||
1337 | //if (hasStreet) { | 1356 | //if (hasStreet) { |
1338 | slHomeAddress[0] = ent.homeStreet(); | 1357 | slHomeAddress[0] = ent.homeStreet(); |
1339 | slBusinessAddress[0] = ent.businessStreet(); | 1358 | slBusinessAddress[0] = ent.businessStreet(); |
1340 | //} | 1359 | //} |
1341 | 1360 | ||
1342 | //if (hasCity) { | 1361 | //if (hasCity) { |
1343 | slHomeAddress[3] = ent.homeCity(); | 1362 | slHomeAddress[3] = ent.homeCity(); |
1344 | slBusinessAddress[3] = ent.businessCity(); | 1363 | slBusinessAddress[3] = ent.businessCity(); |
1345 | //} | 1364 | //} |
1346 | 1365 | ||
1347 | //if (hasState) { | 1366 | //if (hasState) { |
1348 | slHomeAddress[4] = ent.homeState(); | 1367 | slHomeAddress[4] = ent.homeState(); |
1349 | slBusinessAddress[4] = ent.businessState(); | 1368 | slBusinessAddress[4] = ent.businessState(); |
1350 | //} | 1369 | //} |
1351 | 1370 | ||
1352 | //if (hasZip) { | 1371 | //if (hasZip) { |
1353 | slHomeAddress[5] = ent.homeZip(); | 1372 | slHomeAddress[5] = ent.homeZip(); |
1354 | slBusinessAddress[5] = ent.businessZip(); | 1373 | slBusinessAddress[5] = ent.businessZip(); |
1355 | //} | 1374 | //} |
1356 | 1375 | ||
1357 | //if (hasCountry) { | 1376 | //if (hasCountry) { |
1358 | slHomeAddress[6] = ent.homeCountry(); | 1377 | slHomeAddress[6] = ent.homeCountry(); |
1359 | slBusinessAddress[6] = ent.businessCountry(); | 1378 | slBusinessAddress[6] = ent.businessCountry(); |
1360 | //} | 1379 | //} |
1361 | 1380 | ||
1362 | QStringList::ConstIterator it; | 1381 | QStringList::ConstIterator it; |
1363 | QListIterator<QLineEdit> itLE( listValue ); | 1382 | QListIterator<QLineEdit> itLE( listValue ); |
1364 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { | 1383 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1365 | 1384 | ||
1366 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); | 1385 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); |
1367 | 1386 | ||
1368 | if ( *it == "Department" ) | 1387 | if ( *it == "Department" ) |
1369 | (*itLE)->setText( ent.department() ); | 1388 | (*itLE)->setText( ent.department() ); |
1370 | 1389 | ||
1371 | if ( *it == "Company" ) | 1390 | if ( *it == "Company" ) |
1372 | (*itLE)->setText( ent.company() ); | 1391 | (*itLE)->setText( ent.company() ); |
1373 | 1392 | ||
1374 | if ( *it == "Office" ) | 1393 | if ( *it == "Office" ) |
1375 | (*itLE)->setText( ent.office() ); | 1394 | (*itLE)->setText( ent.office() ); |
1376 | 1395 | ||
1377 | if ( *it == "Profession" ) | 1396 | if ( *it == "Profession" ) |
1378 | (*itLE)->setText( ent.profession() ); | 1397 | (*itLE)->setText( ent.profession() ); |
1379 | 1398 | ||
1380 | if ( *it == "Assistant" ) | 1399 | if ( *it == "Assistant" ) |
1381 | (*itLE)->setText( ent.assistant() ); | 1400 | (*itLE)->setText( ent.assistant() ); |
1382 | 1401 | ||
1383 | if ( *it == "Manager" ) | 1402 | if ( *it == "Manager" ) |
1384 | (*itLE)->setText( ent.manager() ); | 1403 | (*itLE)->setText( ent.manager() ); |
1385 | 1404 | ||
1386 | if ( *it == "Spouse" ) | 1405 | if ( *it == "Spouse" ) |
1387 | (*itLE)->setText( ent.spouse() ); | 1406 | (*itLE)->setText( ent.spouse() ); |
1388 | 1407 | ||
1389 | if ( *it == "Nickname" ){ | 1408 | if ( *it == "Nickname" ){ |
1390 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); | 1409 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); |
1391 | (*itLE)->setText( ent.nickname() ); | 1410 | (*itLE)->setText( ent.nickname() ); |
1392 | } | 1411 | } |
1393 | 1412 | ||
1394 | if ( *it == "Children" ) | 1413 | if ( *it == "Children" ) |
1395 | (*itLE)->setText( ent.children() ); | 1414 | (*itLE)->setText( ent.children() ); |
1396 | 1415 | ||
1397 | } | 1416 | } |
1398 | 1417 | ||
1399 | QStringList::Iterator itV; | 1418 | QStringList::Iterator itV; |
1400 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1419 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1401 | 1420 | ||
1402 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1421 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1403 | *itV = ent.businessPhone(); | 1422 | *itV = ent.businessPhone(); |
1404 | /* | 1423 | /* |
1405 | if ( *it == "Business 2 Phone" ) | 1424 | if ( *it == "Business 2 Phone" ) |
1406 | *itV = ent.business2Phone(); | 1425 | *itV = ent.business2Phone(); |
1407 | */ | 1426 | */ |
1408 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1427 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1409 | *itV = ent.businessFax(); | 1428 | *itV = ent.businessFax(); |
1410 | 1429 | ||
1411 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1430 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1412 | *itV = ent.businessMobile(); | 1431 | *itV = ent.businessMobile(); |
1413 | /* | 1432 | /* |
1414 | if ( *it == "Company Phone" ) | 1433 | if ( *it == "Company Phone" ) |
1415 | *itV = ent.companyPhone(); | 1434 | *itV = ent.companyPhone(); |
1416 | */ | 1435 | */ |
1417 | if ( *it == "Default Email" ) | 1436 | if ( *it == "Default Email" ) |
1418 | *itV = ent.defaultEmail(); | 1437 | *itV = ent.defaultEmail(); |
1419 | 1438 | ||
1420 | if ( *it == "Emails" ) | 1439 | if ( *it == "Emails" ) |
1421 | *itV = ent.emailList().join(", "); // :SX | 1440 | *itV = ent.emailList().join(", "); // :SX |
1422 | 1441 | ||
1423 | if ( *it == "Home Phone" ) | 1442 | if ( *it == "Home Phone" ) |
1424 | *itV = ent.homePhone(); | 1443 | *itV = ent.homePhone(); |
1425 | /* | 1444 | /* |
1426 | if ( *it == "Home 2 Phone" ) | 1445 | if ( *it == "Home 2 Phone" ) |
1427 | *itV = ent.home2Phone(); | 1446 | *itV = ent.home2Phone(); |
1428 | */ | 1447 | */ |
1429 | if ( *it == "Home Fax" ) | 1448 | if ( *it == "Home Fax" ) |
1430 | *itV = ent.homeFax(); | 1449 | *itV = ent.homeFax(); |
1431 | 1450 | ||
1432 | if ( *it == "Home Mobile" ) | 1451 | if ( *it == "Home Mobile" ) |
1433 | *itV = ent.homeMobile(); | 1452 | *itV = ent.homeMobile(); |
1434 | /* | 1453 | /* |
1435 | if ( *it == "Car Phone" ) | 1454 | if ( *it == "Car Phone" ) |
1436 | *itV = ent.carPhone(); | 1455 | *itV = ent.carPhone(); |
1437 | 1456 | ||
1438 | if ( *it == "ISDN Phone" ) | 1457 | if ( *it == "ISDN Phone" ) |
1439 | *itV = ent.ISDNPhone(); | 1458 | *itV = ent.ISDNPhone(); |
1440 | 1459 | ||
1441 | if ( *it == "Other Phone" ) | 1460 | if ( *it == "Other Phone" ) |
1442 | *itV = ent.otherPhone(); | 1461 | *itV = ent.otherPhone(); |
1443 | */ | 1462 | */ |
1444 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1463 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1445 | *itV = ent.businessPager(); | 1464 | *itV = ent.businessPager(); |
1446 | /* | 1465 | /* |
1447 | if ( *it == "Home Pager") | 1466 | if ( *it == "Home Pager") |
1448 | *itV = ent.homePager(); | 1467 | *itV = ent.homePager(); |
1449 | 1468 | ||
1450 | if ( *it == "AIM IM" ) | 1469 | if ( *it == "AIM IM" ) |
1451 | *itV = ent.AIMIM(); | 1470 | *itV = ent.AIMIM(); |
1452 | 1471 | ||
1453 | if ( *it == "ICQ IM" ) | 1472 | if ( *it == "ICQ IM" ) |
1454 | *itV = ent.ICQIM(); | 1473 | *itV = ent.ICQIM(); |
1455 | 1474 | ||
1456 | if ( *it == "Jabber IM" ) | 1475 | if ( *it == "Jabber IM" ) |
1457 | *itV = ent.jabberIM(); | 1476 | *itV = ent.jabberIM(); |
1458 | 1477 | ||
1459 | if ( *it == "MSN IM" ) | 1478 | if ( *it == "MSN IM" ) |
1460 | *itV = ent.MSNIM(); | 1479 | *itV = ent.MSNIM(); |
1461 | 1480 | ||
1462 | if ( *it == "Yahoo IM" ) | 1481 | if ( *it == "Yahoo IM" ) |
1463 | *itV = ent.yahooIM(); | 1482 | *itV = ent.yahooIM(); |
1464 | */ | 1483 | */ |
1465 | if ( *it == "Home Web Page" ) | 1484 | if ( *it == "Home Web Page" ) |
1466 | *itV = ent.homeWebpage(); | 1485 | *itV = ent.homeWebpage(); |
1467 | 1486 | ||
1468 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1487 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1469 | *itV = ent.businessWebpage(); | 1488 | *itV = ent.businessWebpage(); |
1470 | 1489 | ||
1471 | 1490 | ||
1472 | } | 1491 | } |
1473 | 1492 | ||
1474 | 1493 | ||
1475 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1494 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1476 | 1495 | ||
1477 | QString gender = ent.gender(); | 1496 | QString gender = ent.gender(); |
1478 | cmbGender->setCurrentItem( gender.toInt() ); | 1497 | cmbGender->setCurrentItem( gender.toInt() ); |
1479 | 1498 | ||
1480 | txtNote->setText( ent.notes() ); | 1499 | txtNote->setText( ent.notes() ); |
1481 | 1500 | ||
1482 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1501 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1483 | 1502 | ||
1484 | // Calling "show()" to arrange all widgets. Otherwise we will get | 1503 | // Calling "show()" to arrange all widgets. Otherwise we will get |
1485 | // a wrong position of the textfields and are unable to put our | 1504 | // a wrong position of the textfields and are unable to put our |
1486 | // default-email combo over it.. This is very ugly ! | 1505 | // default-email combo over it.. This is very ugly ! |
1487 | // Does anybody has a better solution ? | 1506 | // Does anybody has a better solution ? |
1488 | // Basically we should rethink the strategy to hide | 1507 | // Basically we should rethink the strategy to hide |
1489 | // a textfield with overwriting.. (se) | 1508 | // a textfield with overwriting.. (se) |
1490 | show(); | 1509 | show(); |
1491 | 1510 | ||
1492 | // Get combo-settings from contact and set preset.. | 1511 | // Get combo-settings from contact and set preset.. |
1493 | contactfields.loadFromRecord( ent ); | 1512 | contactfields.loadFromRecord( ent ); |
1494 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); | 1513 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); |
1495 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); | 1514 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); |
1496 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); | 1515 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); |
1497 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); | 1516 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); |
1498 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); | 1517 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); |
1499 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1518 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1500 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1519 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1501 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1520 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1502 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); | 1521 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); |
1503 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1522 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1504 | 1523 | ||
1505 | updateDatePicker(); | 1524 | updateDatePicker(); |
1506 | 1525 | ||
1507 | initializing = false; | 1526 | initializing = false; |
1508 | } | 1527 | } |
1509 | void ContactEditor::updateDatePicker() | 1528 | void ContactEditor::updateDatePicker() |
1510 | { | 1529 | { |
1511 | // Set DatePicker | 1530 | // Set DatePicker |
1512 | if ( !ent.birthday().isNull() ){ | 1531 | if ( !ent.birthday().isNull() ){ |
1513 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); | 1532 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); |
1514 | birthdayPicker->setDate( ent.birthday() ); | 1533 | birthdayPicker->setDate( ent.birthday() ); |
1515 | } else | 1534 | } else |
1516 | birthdayButton->setText( tr ("Unknown") ); | 1535 | birthdayButton->setText( tr ("Unknown") ); |
1517 | 1536 | ||
1518 | if ( !ent.anniversary().isNull() ){ | 1537 | if ( !ent.anniversary().isNull() ){ |
1519 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); | 1538 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); |
1520 | anniversaryPicker->setDate( ent.anniversary() ); | 1539 | anniversaryPicker->setDate( ent.anniversary() ); |
1521 | } else | 1540 | } else |
1522 | anniversaryButton->setText( tr ("Unknown") ); | 1541 | anniversaryButton->setText( tr ("Unknown") ); |
1523 | 1542 | ||
1524 | } | 1543 | } |
1525 | 1544 | ||
1526 | void ContactEditor::saveEntry() { | 1545 | void ContactEditor::saveEntry() { |
1527 | 1546 | ||
1528 | // Store current combo into contact | 1547 | // Store current combo into contact |
1529 | contactfields.saveToRecord( ent ); | 1548 | contactfields.saveToRecord( ent ); |
1530 | 1549 | ||
1531 | if ( useFullName ) { | 1550 | if ( useFullName ) { |
1532 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1551 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1533 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1552 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1534 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1553 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1535 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1554 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1536 | 1555 | ||
1537 | useFullName = false; | 1556 | useFullName = false; |
1538 | } | 1557 | } |
1539 | 1558 | ||
1540 | ent.setFirstName( txtFirstName->text() ); | 1559 | ent.setFirstName( txtFirstName->text() ); |
1541 | ent.setLastName( txtLastName->text() ); | 1560 | ent.setLastName( txtLastName->text() ); |
1542 | ent.setMiddleName( txtMiddleName->text() ); | 1561 | ent.setMiddleName( txtMiddleName->text() ); |
1543 | ent.setSuffix( txtSuffix->text() ); | 1562 | ent.setSuffix( txtSuffix->text() ); |
1544 | 1563 | ||
1545 | ent.setFileAs( cmbFileAs->currentText() ); | 1564 | ent.setFileAs( cmbFileAs->currentText() ); |
1546 | 1565 | ||
1547 | ent.setCategories( cmbCat->currentCategories() ); | 1566 | ent.setCategories( cmbCat->currentCategories() ); |
1548 | 1567 | ||
1549 | 1568 | ||
1550 | //if (hasTitle) | 1569 | //if (hasTitle) |
1551 | ent.setJobTitle( txtJobTitle->text() ); | 1570 | ent.setJobTitle( txtJobTitle->text() ); |
1552 | 1571 | ||
1553 | //if (hasCompany) | 1572 | //if (hasCompany) |
1554 | ent.setCompany( txtOrganization->text() ); | 1573 | ent.setCompany( txtOrganization->text() ); |
1555 | 1574 | ||
1556 | //if (hasNotes) | 1575 | //if (hasNotes) |
1557 | ent.setNotes( txtNote->text() ); | 1576 | ent.setNotes( txtNote->text() ); |
1558 | 1577 | ||
1559 | //if (hasStreet) { | 1578 | //if (hasStreet) { |
1560 | ent.setHomeStreet( slHomeAddress[0] ); | 1579 | ent.setHomeStreet( slHomeAddress[0] ); |
1561 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1580 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1562 | //} | 1581 | //} |
1563 | 1582 | ||
1564 | //if (hasCity) { | 1583 | //if (hasCity) { |
1565 | ent.setHomeCity( slHomeAddress[3] ); | 1584 | ent.setHomeCity( slHomeAddress[3] ); |
1566 | ent.setBusinessCity( slBusinessAddress[3] ); | 1585 | ent.setBusinessCity( slBusinessAddress[3] ); |
1567 | //} | 1586 | //} |
1568 | 1587 | ||
1569 | //if (hasState) { | 1588 | //if (hasState) { |
1570 | ent.setHomeState( slHomeAddress[4] ); | 1589 | ent.setHomeState( slHomeAddress[4] ); |
1571 | ent.setBusinessState( slBusinessAddress[4] ); | 1590 | ent.setBusinessState( slBusinessAddress[4] ); |
1572 | //} | 1591 | //} |
1573 | 1592 | ||
1574 | //if (hasZip) { | 1593 | //if (hasZip) { |
1575 | ent.setHomeZip( slHomeAddress[5] ); | 1594 | ent.setHomeZip( slHomeAddress[5] ); |
1576 | ent.setBusinessZip( slBusinessAddress[5] ); | 1595 | ent.setBusinessZip( slBusinessAddress[5] ); |
1577 | //} | 1596 | //} |
1578 | 1597 | ||
1579 | //if (hasCountry) { | 1598 | //if (hasCountry) { |
1580 | ent.setHomeCountry( slHomeAddress[6] ); | 1599 | ent.setHomeCountry( slHomeAddress[6] ); |
1581 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1600 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1582 | //} | 1601 | //} |
1583 | 1602 | ||
1584 | QStringList::ConstIterator it; | 1603 | QStringList::ConstIterator it; |
1585 | QListIterator<QLineEdit> itLE( listValue ); | 1604 | QListIterator<QLineEdit> itLE( listValue ); |
1586 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { | 1605 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { |
1587 | 1606 | ||
1588 | if ( *it == "Department" ) | 1607 | if ( *it == "Department" ) |
1589 | ent.setDepartment( (*itLE)->text() ); | 1608 | ent.setDepartment( (*itLE)->text() ); |
1590 | 1609 | ||
1591 | if ( *it == "Company" ) | 1610 | if ( *it == "Company" ) |
1592 | ent.setCompany( (*itLE)->text() ); | 1611 | ent.setCompany( (*itLE)->text() ); |
1593 | 1612 | ||
1594 | if ( *it == "Office" ) | 1613 | if ( *it == "Office" ) |
1595 | ent.setOffice( (*itLE)->text() ); | 1614 | ent.setOffice( (*itLE)->text() ); |
1596 | 1615 | ||
1597 | if ( *it == "Profession" ) | 1616 | if ( *it == "Profession" ) |
1598 | ent.setProfession( (*itLE)->text() ); | 1617 | ent.setProfession( (*itLE)->text() ); |
1599 | 1618 | ||
1600 | if ( *it == "Assistant" ) | 1619 | if ( *it == "Assistant" ) |
1601 | ent.setAssistant( (*itLE)->text() ); | 1620 | ent.setAssistant( (*itLE)->text() ); |
1602 | 1621 | ||
1603 | if ( *it == "Manager" ) | 1622 | if ( *it == "Manager" ) |
1604 | ent.setManager( (*itLE)->text() ); | 1623 | ent.setManager( (*itLE)->text() ); |
1605 | 1624 | ||
1606 | if ( *it == "Spouse" ) | 1625 | if ( *it == "Spouse" ) |
1607 | ent.setSpouse( (*itLE)->text() ); | 1626 | ent.setSpouse( (*itLE)->text() ); |
1608 | 1627 | ||
1609 | if ( *it == "Nickname" ) | 1628 | if ( *it == "Nickname" ) |
1610 | ent.setNickname( (*itLE)->text() ); | 1629 | ent.setNickname( (*itLE)->text() ); |
1611 | 1630 | ||
1612 | if ( *it == "Children" ) | 1631 | if ( *it == "Children" ) |
1613 | ent.setChildren( (*itLE)->text() ); | 1632 | ent.setChildren( (*itLE)->text() ); |
1614 | 1633 | ||
1615 | } | 1634 | } |
1616 | 1635 | ||
1617 | 1636 | ||
1618 | QStringList::ConstIterator itV; | 1637 | QStringList::ConstIterator itV; |
1619 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1638 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1620 | 1639 | ||
1621 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1640 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1622 | ent.setBusinessPhone( *itV ); | 1641 | ent.setBusinessPhone( *itV ); |
1623 | 1642 | ||
1624 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1643 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1625 | ent.setBusinessFax( *itV ); | 1644 | ent.setBusinessFax( *itV ); |
1626 | 1645 | ||
1627 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1646 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1628 | ent.setBusinessMobile( *itV ); | 1647 | ent.setBusinessMobile( *itV ); |
1629 | 1648 | ||
1630 | if ( *it == "Emails" ){ | 1649 | if ( *it == "Emails" ){ |
1631 | QString allemail; | 1650 | QString allemail; |
1632 | QString defaultmail; | 1651 | QString defaultmail; |
1633 | parseEmailFrom( emails.join(","), defaultmail, allemail ); | 1652 | parseEmailFrom( emails.join(","), defaultmail, allemail ); |
1634 | if ( defaultEmail.isEmpty() ){ | 1653 | if ( defaultEmail.isEmpty() ){ |
1635 | qWarning("Default email was not set by user!"); | 1654 | qWarning("Default email was not set by user!"); |
1636 | qWarning("Using first email in list: %s", defaultmail.latin1()); | 1655 | qWarning("Using first email in list: %s", defaultmail.latin1()); |
1637 | ent.setDefaultEmail( defaultmail ); | 1656 | ent.setDefaultEmail( defaultmail ); |
1638 | } | 1657 | } |
1639 | ent.setEmails( allemail ); | 1658 | ent.setEmails( allemail ); |
1640 | } | 1659 | } |
1641 | 1660 | ||
1642 | if ( *it == "Default Email") | 1661 | if ( *it == "Default Email") |
1643 | ent.setDefaultEmail( defaultEmail /* *itV */ ); | 1662 | ent.setDefaultEmail( defaultEmail /* *itV */ ); |
1644 | 1663 | ||
1645 | if ( *it == "Home Phone" ) | 1664 | if ( *it == "Home Phone" ) |
1646 | ent.setHomePhone( *itV ); | 1665 | ent.setHomePhone( *itV ); |
1647 | 1666 | ||
1648 | if ( *it == "Home Fax" ) | 1667 | if ( *it == "Home Fax" ) |
1649 | ent.setHomeFax( *itV ); | 1668 | ent.setHomeFax( *itV ); |
1650 | 1669 | ||
1651 | if ( *it == "Home Mobile" ) | 1670 | if ( *it == "Home Mobile" ) |
1652 | ent.setHomeMobile( *itV ); | 1671 | ent.setHomeMobile( *itV ); |
1653 | 1672 | ||
1654 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1673 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1655 | ent.setBusinessPager( *itV ); | 1674 | ent.setBusinessPager( *itV ); |
1656 | 1675 | ||
1657 | if ( *it == "Home Web Page" ) | 1676 | if ( *it == "Home Web Page" ) |
1658 | ent.setHomeWebpage( *itV ); | 1677 | ent.setHomeWebpage( *itV ); |
1659 | 1678 | ||
1660 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1679 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1661 | ent.setBusinessWebpage( *itV ); | 1680 | ent.setBusinessWebpage( *itV ); |
1662 | 1681 | ||
1663 | 1682 | ||
1664 | } | 1683 | } |
1665 | 1684 | ||
1666 | int gender = cmbGender->currentItem(); | 1685 | int gender = cmbGender->currentItem(); |
1667 | ent.setGender( QString::number( gender ) ); | 1686 | ent.setGender( QString::number( gender ) ); |
1668 | 1687 | ||
1669 | QString str = txtNote->text(); | 1688 | QString str = txtNote->text(); |
1670 | if ( !str.isNull() ) | 1689 | if ( !str.isNull() ) |
1671 | ent.setNotes( str ); | 1690 | ent.setNotes( str ); |
1672 | 1691 | ||
1673 | } | 1692 | } |
1674 | 1693 | ||
1675 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1694 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1676 | QString &strAll ) | 1695 | QString &strAll ) |
1677 | { | 1696 | { |
1678 | int where, | 1697 | int where, |
1679 | start; | 1698 | start; |
1680 | if ( txt.isEmpty() ) | 1699 | if ( txt.isEmpty() ) |
1681 | return; | 1700 | return; |
1682 | // find the first | 1701 | // find the first |
1683 | where = txt.find( ',' ); | 1702 | where = txt.find( ',' ); |
1684 | if ( where < 0 ) { | 1703 | if ( where < 0 ) { |
1685 | strDefaultEmail = txt; | 1704 | strDefaultEmail = txt; |
1686 | strAll = txt; | 1705 | strAll = txt; |
1687 | } else { | 1706 | } else { |
1688 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1707 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1689 | strAll = strDefaultEmail; | 1708 | strAll = strDefaultEmail; |
1690 | while ( where > -1 ) { | 1709 | while ( where > -1 ) { |
1691 | strAll.append(" "); | 1710 | strAll.append(" "); |
1692 | start = where; | 1711 | start = where; |
1693 | where = txt.find( ',', where + 1 ); | 1712 | where = txt.find( ',', where + 1 ); |
1694 | if ( where > - 1 ) | 1713 | if ( where > - 1 ) |
1695 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1714 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1696 | else // grab until the end... | 1715 | else // grab until the end... |
1697 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1716 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1698 | } | 1717 | } |
1699 | } | 1718 | } |
1700 | } | 1719 | } |
1701 | 1720 | ||
1702 | void parseEmailTo( const QString &strDefaultEmail, | 1721 | void parseEmailTo( const QString &strDefaultEmail, |
1703 | const QString &strOtherEmail, QString &strBack ) | 1722 | const QString &strOtherEmail, QString &strBack ) |
1704 | { | 1723 | { |
1705 | // create a comma dilimeted set of emails... | 1724 | // create a comma dilimeted set of emails... |
1706 | // use the power of short circuiting... | 1725 | // use the power of short circuiting... |
1707 | bool foundDefault = false; | 1726 | bool foundDefault = false; |
1708 | QString strTmp; | 1727 | QString strTmp; |
1709 | int start = 0; | 1728 | int start = 0; |
1710 | int where; | 1729 | int where; |
1711 | // start at the beginng. | 1730 | // start at the beginng. |
1712 | strBack = strDefaultEmail; | 1731 | strBack = strDefaultEmail; |
1713 | where = 0; | 1732 | where = 0; |
1714 | while ( where > -1 ) { | 1733 | while ( where > -1 ) { |
1715 | start = where; | 1734 | start = where; |
1716 | where = strOtherEmail.find( ' ', where + 1 ); | 1735 | where = strOtherEmail.find( ' ', where + 1 ); |
1717 | if ( where > 0 ) { | 1736 | if ( where > 0 ) { |
1718 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1737 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1719 | } else | 1738 | } else |
1720 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 1739 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
1721 | if ( foundDefault || strTmp != strDefaultEmail ) { | 1740 | if ( foundDefault || strTmp != strDefaultEmail ) { |
1722 | strBack.append( ", " ); | 1741 | strBack.append( ", " ); |
1723 | strBack.append( strTmp ); | 1742 | strBack.append( strTmp ); |
1724 | } else | 1743 | } else |
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index 95f9f2d..703e702 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h | |||
@@ -1,186 +1,192 @@ | |||
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> | 26 | #include <qpe/datebookmonth.h> |
27 | 27 | ||
28 | #include <qdialog.h> | 28 | #include <qdialog.h> |
29 | #include <qlist.h> | 29 | #include <qlist.h> |
30 | #include <qmap.h> | 30 | #include <qmap.h> |
31 | #include <qstringlist.h> | 31 | #include <qstringlist.h> |
32 | #include <qwidgetstack.h> | ||
32 | 33 | ||
33 | #include "ocontactfields.h" | 34 | #include "ocontactfields.h" |
34 | 35 | ||
35 | const int NAME_LF = 0; | 36 | const int NAME_LF = 0; |
36 | const int NAME_LFM = 1; | 37 | const int NAME_LFM = 1; |
37 | const int NAME_FL = 2; | 38 | const int NAME_FL = 2; |
38 | const int NAME_FMLS = 3; | 39 | const int NAME_FMLS = 3; |
39 | 40 | ||
40 | const int NAME_F = 4; | 41 | const int NAME_F = 4; |
41 | const int NAME_M = 5; | 42 | const int NAME_M = 5; |
42 | const int NAME_L = 6; | 43 | const int NAME_L = 6; |
43 | const int NAME_S = 7; | 44 | const int NAME_S = 7; |
44 | 45 | ||
45 | 46 | ||
46 | class QScrollView; | 47 | class QScrollView; |
47 | class QTabWidget; | 48 | class QTabWidget; |
48 | class QMultiLineEdit; | 49 | class QMultiLineEdit; |
49 | class QLineEdit; | 50 | class QLineEdit; |
50 | class QComboBox; | 51 | class QComboBox; |
51 | class QPushButton; | 52 | class QPushButton; |
52 | class CategorySelect; | 53 | class CategorySelect; |
53 | class QLabel; | 54 | class QLabel; |
54 | 55 | ||
55 | class ContactEditor : public QDialog { | 56 | class ContactEditor : public QDialog { |
56 | Q_OBJECT | 57 | Q_OBJECT |
57 | 58 | ||
58 | public: | 59 | public: |
59 | ContactEditor(const OContact &entry, | 60 | ContactEditor(const OContact &entry, |
60 | QWidget *parent = 0, | 61 | QWidget *parent = 0, |
61 | const char *name = 0, | 62 | const char *name = 0, |
62 | WFlags fl = 0 ); | 63 | WFlags fl = 0 ); |
63 | ~ContactEditor(); | 64 | ~ContactEditor(); |
64 | void setNameFocus(); | 65 | void setNameFocus(); |
65 | void setPersonalView( bool personal = true ); | 66 | void setPersonalView( bool personal = true ); |
66 | OContact entry() const { return ent; } | 67 | OContact entry() const { return ent; } |
67 | 68 | ||
68 | public slots: | 69 | public slots: |
69 | void slotNote(); | 70 | void slotNote(); |
70 | void slotName(); | 71 | void slotName(); |
71 | void setEntry(const OContact &entry); | 72 | void setEntry(const OContact &entry); |
72 | 73 | ||
73 | protected slots: | 74 | protected slots: |
74 | void accept(); | 75 | void accept(); |
75 | 76 | ||
76 | private: | 77 | private: |
77 | void init(); | 78 | void init(); |
78 | void saveEntry(); | 79 | void saveEntry(); |
79 | bool isEmpty(); | 80 | bool isEmpty(); |
80 | void cleanupFields(); | 81 | void cleanupFields(); |
81 | void updateDatePicker(); | 82 | void updateDatePicker(); |
82 | QString parseName( QString fullName, int type ); | 83 | QString parseName( QString fullName, int type ); |
83 | void chooserError( int index ); | 84 | void chooserError( int index ); |
84 | private slots: | 85 | private slots: |
85 | void slotChooser1Change( const QString &textChanged ); | 86 | void slotChooser1Change( const QString &textChanged ); |
86 | void slotChooser2Change( const QString &textChanged ); | 87 | void slotChooser2Change( const QString &textChanged ); |
87 | void slotChooser3Change( const QString &textChanged ); | 88 | void slotChooser3Change( const QString &textChanged ); |
88 | void slotChooser4Change( const QString &textChanged ); | 89 | void slotChooser4Change( const QString &textChanged ); |
89 | void slotCmbChooser1Change( int index ); | 90 | void slotCmbChooser1Change( int index ); |
90 | void slotCmbChooser2Change( int index ); | 91 | void slotCmbChooser2Change( int index ); |
91 | void slotCmbChooser3Change( int index ); | 92 | void slotCmbChooser3Change( int index ); |
92 | void slotCmbChooser4Change( int index ); | 93 | void slotCmbChooser4Change( int index ); |
93 | void slotAddressTypeChange( int index ); | 94 | void slotAddressTypeChange( int index ); |
94 | void slotAddressChange( const QString &textChanged ); | 95 | void slotAddressChange( const QString &textChanged ); |
95 | void slotAddress2Change( const QString &textChanged ); | 96 | void slotAddress2Change( const QString &textChanged ); |
96 | void slotPOBoxChange( const QString &textChanged ); | 97 | void slotPOBoxChange( const QString &textChanged ); |
97 | void slotCityChange( const QString &textChanged ); | 98 | void slotCityChange( const QString &textChanged ); |
98 | void slotStateChange( const QString &textChanged ); | 99 | void slotStateChange( const QString &textChanged ); |
99 | void slotZipChange( const QString &textChanged ); | 100 | void slotZipChange( const QString &textChanged ); |
100 | void slotCountryChange( const QString &textChanged ); | 101 | void slotCountryChange( const QString &textChanged ); |
101 | void slotFullNameChange( const QString &textChanged ); | 102 | void slotFullNameChange( const QString &textChanged ); |
102 | void slotAnniversaryDateChanged( int year, int month, int day); | 103 | void slotAnniversaryDateChanged( int year, int month, int day); |
103 | void slotBirthdayDateChanged( int year, int month, int day); | 104 | void slotBirthdayDateChanged( int year, int month, int day); |
104 | void slotRemoveBirthday(); | 105 | void slotRemoveBirthday(); |
105 | void slotRemoveAnniversary(); | 106 | void slotRemoveAnniversary(); |
106 | void defaultEmailChanged(int); | 107 | void defaultEmailChanged(int); |
107 | 108 | ||
108 | private: | 109 | private: |
110 | enum StackWidgets { TextField = 1, Combo }; | ||
109 | int defaultEmailChooserPosition; | 111 | int defaultEmailChooserPosition; |
110 | void populateDefaultEmailCmb(); | 112 | void populateDefaultEmailCmb(); |
111 | void chooserChange( const QString&, int , QLineEdit*, int ); | 113 | void chooserChange( const QString&, int , QLineEdit*, int ); |
112 | bool cmbChooserChange( int , QLineEdit*, int ); | 114 | bool cmbChooserChange( int , QWidgetStack*, int ); |
113 | OContactFields contactfields; | 115 | OContactFields contactfields; |
114 | 116 | ||
115 | bool useFullName; | 117 | bool useFullName; |
116 | 118 | ||
117 | OContact ent; | 119 | OContact ent; |
118 | 120 | ||
119 | QDialog *dlgNote; | 121 | QDialog *dlgNote; |
120 | QDialog *dlgName; | 122 | QDialog *dlgName; |
121 | 123 | ||
122 | QList<QLineEdit> listValue; | 124 | QList<QLineEdit> listValue; |
123 | QList<QLabel> listName; | 125 | QList<QLabel> listName; |
124 | 126 | ||
125 | QStringList slDynamicEntries; | 127 | QStringList slDynamicEntries; |
126 | QStringList trlDynamicEntries; | 128 | QStringList trlDynamicEntries; |
127 | 129 | ||
128 | bool m_personalView; | 130 | bool m_personalView; |
129 | 131 | ||
130 | QStringList slHomeAddress; | 132 | QStringList slHomeAddress; |
131 | QStringList slBusinessAddress; | 133 | QStringList slBusinessAddress; |
132 | QStringList slChooserNames; | 134 | QStringList slChooserNames; |
133 | QStringList slChooserValues; | 135 | QStringList slChooserValues; |
134 | QStringList emails; | 136 | QStringList emails; |
135 | QString defaultEmail; | 137 | QString defaultEmail; |
136 | 138 | ||
137 | QMultiLineEdit *txtNote; | 139 | QMultiLineEdit *txtNote; |
138 | QLabel *lblNote; | 140 | QLabel *lblNote; |
139 | 141 | ||
140 | //QLineEdit *txtTitle; | 142 | //QLineEdit *txtTitle; |
141 | QLineEdit *txtFirstName; | 143 | QLineEdit *txtFirstName; |
142 | QLineEdit *txtMiddleName; | 144 | QLineEdit *txtMiddleName; |
143 | QLineEdit *txtLastName; | 145 | QLineEdit *txtLastName; |
144 | QLineEdit *txtSuffix; | 146 | QLineEdit *txtSuffix; |
145 | 147 | ||
146 | QTabWidget *tabMain; | 148 | QTabWidget *tabMain; |
147 | QScrollView *svGeneral; | 149 | QScrollView *svGeneral; |
148 | QPushButton *btnFullName; | 150 | QPushButton *btnFullName; |
149 | QPushButton *btnNote; | 151 | QPushButton *btnNote; |
150 | QLineEdit *txtFullName; | 152 | QLineEdit *txtFullName; |
151 | QLineEdit *txtJobTitle; | 153 | QLineEdit *txtJobTitle; |
152 | QLineEdit *txtOrganization; | 154 | QLineEdit *txtOrganization; |
153 | QLineEdit *txtChooserField1; | 155 | QLineEdit *txtChooserField1; |
154 | QLineEdit *txtChooserField2; | 156 | QLineEdit *txtChooserField2; |
155 | QLineEdit *txtChooserField3; | 157 | QLineEdit *txtChooserField3; |
156 | QLineEdit *txtChooserField4; | 158 | QLineEdit *txtChooserField4; |
159 | QWidgetStack* m_widgetStack1; | ||
160 | QWidgetStack* m_widgetStack2; | ||
161 | QWidgetStack* m_widgetStack3; | ||
162 | QWidgetStack* m_widgetStack4; | ||
157 | QComboBox *cmbChooserField1; | 163 | QComboBox *cmbChooserField1; |
158 | QComboBox *cmbChooserField2; | 164 | QComboBox *cmbChooserField2; |
159 | QComboBox *cmbChooserField3; | 165 | QComboBox *cmbChooserField3; |
160 | QComboBox *cmbChooserField4; | 166 | QComboBox *cmbChooserField4; |
161 | QComboBox *cmbDefaultEmail; | 167 | QComboBox *cmbDefaultEmail; |
162 | QComboBox *cmbFileAs; | 168 | QComboBox *cmbFileAs; |
163 | CategorySelect *cmbCat; | 169 | CategorySelect *cmbCat; |
164 | QLabel *labCat; | 170 | QLabel *labCat; |
165 | 171 | ||
166 | QScrollView *svAddress; | 172 | QScrollView *svAddress; |
167 | QLineEdit *txtAddress; | 173 | QLineEdit *txtAddress; |
168 | //QLineEdit *txtAddress2; | 174 | //QLineEdit *txtAddress2; |
169 | //QLineEdit *txtPOBox; | 175 | //QLineEdit *txtPOBox; |
170 | QLineEdit *txtCity; | 176 | QLineEdit *txtCity; |
171 | QLineEdit *txtState; | 177 | QLineEdit *txtState; |
172 | QLineEdit *txtZip; | 178 | QLineEdit *txtZip; |
173 | QComboBox *cmbAddress; | 179 | QComboBox *cmbAddress; |
174 | QComboBox *cmbCountry; | 180 | QComboBox *cmbCountry; |
175 | 181 | ||
176 | QScrollView *svDetails; | 182 | QScrollView *svDetails; |
177 | QComboBox *cmbGender; | 183 | QComboBox *cmbGender; |
178 | DateBookMonth* birthdayPicker; | 184 | DateBookMonth* birthdayPicker; |
179 | QToolButton* birthdayButton; | 185 | QToolButton* birthdayButton; |
180 | DateBookMonth* anniversaryPicker; | 186 | DateBookMonth* anniversaryPicker; |
181 | QToolButton* anniversaryButton; | 187 | QToolButton* anniversaryButton; |
182 | 188 | ||
183 | bool initializing; | 189 | bool initializing; |
184 | }; | 190 | }; |
185 | 191 | ||
186 | #endif | 192 | #endif |
diff --git a/core/pim/addressbook/ocontactfields.cpp b/core/pim/addressbook/ocontactfields.cpp index ffb88e8..831a596 100644 --- a/core/pim/addressbook/ocontactfields.cpp +++ b/core/pim/addressbook/ocontactfields.cpp | |||
@@ -1,456 +1,456 @@ | |||
1 | 1 | ||
2 | #include "ocontactfields.h" | 2 | #include "ocontactfields.h" |
3 | 3 | ||
4 | #include <qstringlist.h> | 4 | #include <qstringlist.h> |
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | 6 | ||
7 | // We should use our own enum in the future .. | 7 | // We should use our own enum in the future .. |
8 | #include <qpe/recordfields.h> | 8 | #include <qpe/recordfields.h> |
9 | #include <qpe/config.h> | 9 | #include <qpe/config.h> |
10 | #include <opie/ocontact.h> | 10 | #include <opie/ocontact.h> |
11 | 11 | ||
12 | /*! | 12 | /*! |
13 | \internal | 13 | \internal |
14 | Returns a list of details field names for a contact. | 14 | Returns a list of details field names for a contact. |
15 | */ | 15 | */ |
16 | QStringList OContactFields::untrdetailsfields( bool sorted ) | 16 | QStringList OContactFields::untrdetailsfields( bool sorted ) |
17 | { | 17 | { |
18 | QStringList list; | 18 | QStringList list; |
19 | QMap<int, QString> mapIdToStr = idToUntrFields(); | 19 | QMap<int, QString> mapIdToStr = idToUntrFields(); |
20 | 20 | ||
21 | list.append( mapIdToStr[ Qtopia::Office ] ); | 21 | list.append( mapIdToStr[ Qtopia::Office ] ); |
22 | list.append( mapIdToStr[ Qtopia::Profession ] ); | 22 | list.append( mapIdToStr[ Qtopia::Profession ] ); |
23 | list.append( mapIdToStr[ Qtopia::Assistant ] ); | 23 | list.append( mapIdToStr[ Qtopia::Assistant ] ); |
24 | list.append( mapIdToStr[ Qtopia::Manager ] ); | 24 | list.append( mapIdToStr[ Qtopia::Manager ] ); |
25 | 25 | ||
26 | list.append( mapIdToStr[ Qtopia::Spouse ] ); | 26 | list.append( mapIdToStr[ Qtopia::Spouse ] ); |
27 | list.append( mapIdToStr[ Qtopia::Gender ] ); | 27 | list.append( mapIdToStr[ Qtopia::Gender ] ); |
28 | list.append( mapIdToStr[ Qtopia::Birthday ] ); | 28 | list.append( mapIdToStr[ Qtopia::Birthday ] ); |
29 | list.append( mapIdToStr[ Qtopia::Anniversary ] ); | 29 | list.append( mapIdToStr[ Qtopia::Anniversary ] ); |
30 | list.append( mapIdToStr[ Qtopia::Nickname ] ); | 30 | list.append( mapIdToStr[ Qtopia::Nickname ] ); |
31 | list.append( mapIdToStr[ Qtopia::Children ] ); | 31 | list.append( mapIdToStr[ Qtopia::Children ] ); |
32 | 32 | ||
33 | if (sorted) list.sort(); | 33 | if (sorted) list.sort(); |
34 | return list; | 34 | return list; |
35 | } | 35 | } |
36 | 36 | ||
37 | /*! | 37 | /*! |
38 | \internal | 38 | \internal |
39 | Returns a translated list of details field names for a contact. | 39 | Returns a translated list of details field names for a contact. |
40 | */ | 40 | */ |
41 | QStringList OContactFields::trdetailsfields( bool sorted ) | 41 | QStringList OContactFields::trdetailsfields( bool sorted ) |
42 | { | 42 | { |
43 | QStringList list; | 43 | QStringList list; |
44 | QMap<int, QString> mapIdToStr = idToTrFields(); | 44 | QMap<int, QString> mapIdToStr = idToTrFields(); |
45 | 45 | ||
46 | list.append( mapIdToStr[Qtopia::Office] ); | 46 | list.append( mapIdToStr[Qtopia::Office] ); |
47 | list.append( mapIdToStr[Qtopia::Profession] ); | 47 | list.append( mapIdToStr[Qtopia::Profession] ); |
48 | list.append( mapIdToStr[Qtopia::Assistant] ); | 48 | list.append( mapIdToStr[Qtopia::Assistant] ); |
49 | list.append( mapIdToStr[Qtopia::Manager] ); | 49 | list.append( mapIdToStr[Qtopia::Manager] ); |
50 | 50 | ||
51 | list.append( mapIdToStr[Qtopia::Spouse] ); | 51 | list.append( mapIdToStr[Qtopia::Spouse] ); |
52 | list.append( mapIdToStr[Qtopia::Gender] ); | 52 | list.append( mapIdToStr[Qtopia::Gender] ); |
53 | list.append( mapIdToStr[Qtopia::Birthday] ); | 53 | list.append( mapIdToStr[Qtopia::Birthday] ); |
54 | list.append( mapIdToStr[Qtopia::Anniversary] ); | 54 | list.append( mapIdToStr[Qtopia::Anniversary] ); |
55 | list.append( mapIdToStr[Qtopia::Nickname] ); | 55 | list.append( mapIdToStr[Qtopia::Nickname] ); |
56 | list.append( mapIdToStr[Qtopia::Children] ); | 56 | list.append( mapIdToStr[Qtopia::Children] ); |
57 | 57 | ||
58 | if (sorted) list.sort(); | 58 | if (sorted) list.sort(); |
59 | return list; | 59 | return list; |
60 | } | 60 | } |
61 | 61 | ||
62 | 62 | ||
63 | /*! | 63 | /*! |
64 | \internal | 64 | \internal |
65 | Returns a translated list of phone field names for a contact. | 65 | Returns a translated list of phone field names for a contact. |
66 | */ | 66 | */ |
67 | QStringList OContactFields::trphonefields( bool sorted ) | 67 | QStringList OContactFields::trphonefields( bool sorted ) |
68 | { | 68 | { |
69 | QStringList list; | 69 | QStringList list; |
70 | QMap<int, QString> mapIdToStr = idToTrFields(); | 70 | QMap<int, QString> mapIdToStr = idToTrFields(); |
71 | 71 | ||
72 | list.append( mapIdToStr[Qtopia::BusinessPhone] ); | 72 | list.append( mapIdToStr[Qtopia::BusinessPhone] ); |
73 | list.append( mapIdToStr[Qtopia::BusinessFax] ); | 73 | list.append( mapIdToStr[Qtopia::BusinessFax] ); |
74 | list.append( mapIdToStr[Qtopia::BusinessMobile] ); | 74 | list.append( mapIdToStr[Qtopia::BusinessMobile] ); |
75 | list.append( mapIdToStr[Qtopia::BusinessPager] ); | 75 | list.append( mapIdToStr[Qtopia::BusinessPager] ); |
76 | list.append( mapIdToStr[Qtopia::BusinessWebPage] ); | 76 | list.append( mapIdToStr[Qtopia::BusinessWebPage] ); |
77 | 77 | ||
78 | list.append( mapIdToStr[Qtopia::DefaultEmail] ); | 78 | list.append( mapIdToStr[Qtopia::DefaultEmail] ); |
79 | list.append( mapIdToStr[Qtopia::Emails] ); | 79 | list.append( mapIdToStr[Qtopia::Emails] ); |
80 | 80 | ||
81 | list.append( mapIdToStr[Qtopia::HomePhone] ); | 81 | list.append( mapIdToStr[Qtopia::HomePhone] ); |
82 | list.append( mapIdToStr[Qtopia::HomeFax] ); | 82 | list.append( mapIdToStr[Qtopia::HomeFax] ); |
83 | list.append( mapIdToStr[Qtopia::HomeMobile] ); | 83 | list.append( mapIdToStr[Qtopia::HomeMobile] ); |
84 | // list.append( mapIdToStr[Qtopia::HomePager] ); | 84 | // list.append( mapIdToStr[Qtopia::HomePager] ); |
85 | list.append( mapIdToStr[Qtopia::HomeWebPage] ); | 85 | list.append( mapIdToStr[Qtopia::HomeWebPage] ); |
86 | 86 | ||
87 | if (sorted) list.sort(); | 87 | if (sorted) list.sort(); |
88 | 88 | ||
89 | return list; | 89 | return list; |
90 | } | 90 | } |
91 | 91 | ||
92 | 92 | ||
93 | /*! | 93 | /*! |
94 | \internal | 94 | \internal |
95 | Returns a list of phone field names for a contact. | 95 | Returns a list of phone field names for a contact. |
96 | */ | 96 | */ |
97 | QStringList OContactFields::untrphonefields( bool sorted ) | 97 | QStringList OContactFields::untrphonefields( bool sorted ) |
98 | { | 98 | { |
99 | QStringList list; | 99 | QStringList list; |
100 | QMap<int, QString> mapIdToStr = idToUntrFields(); | 100 | QMap<int, QString> mapIdToStr = idToUntrFields(); |
101 | 101 | ||
102 | list.append( mapIdToStr[ Qtopia::BusinessPhone ] ); | 102 | list.append( mapIdToStr[ Qtopia::BusinessPhone ] ); |
103 | list.append( mapIdToStr[ Qtopia::BusinessFax ] ); | 103 | list.append( mapIdToStr[ Qtopia::BusinessFax ] ); |
104 | list.append( mapIdToStr[ Qtopia::BusinessMobile ] ); | 104 | list.append( mapIdToStr[ Qtopia::BusinessMobile ] ); |
105 | list.append( mapIdToStr[ Qtopia::BusinessPager ] ); | 105 | list.append( mapIdToStr[ Qtopia::BusinessPager ] ); |
106 | list.append( mapIdToStr[ Qtopia::BusinessWebPage ] ); | 106 | list.append( mapIdToStr[ Qtopia::BusinessWebPage ] ); |
107 | 107 | ||
108 | list.append( mapIdToStr[ Qtopia::DefaultEmail ] ); | 108 | list.append( mapIdToStr[ Qtopia::DefaultEmail ] ); |
109 | list.append( mapIdToStr[ Qtopia::Emails ] ); | 109 | list.append( mapIdToStr[ Qtopia::Emails ] ); |
110 | 110 | ||
111 | list.append( mapIdToStr[ Qtopia::HomePhone ] ); | 111 | list.append( mapIdToStr[ Qtopia::HomePhone ] ); |
112 | list.append( mapIdToStr[ Qtopia::HomeFax ] ); | 112 | list.append( mapIdToStr[ Qtopia::HomeFax ] ); |
113 | list.append( mapIdToStr[ Qtopia::HomeMobile ] ); | 113 | list.append( mapIdToStr[ Qtopia::HomeMobile ] ); |
114 | //list.append( mapIdToStr[Qtopia::HomePager] ); | 114 | //list.append( mapIdToStr[Qtopia::HomePager] ); |
115 | list.append( mapIdToStr[Qtopia::HomeWebPage] ); | 115 | list.append( mapIdToStr[Qtopia::HomeWebPage] ); |
116 | 116 | ||
117 | if (sorted) list.sort(); | 117 | if (sorted) list.sort(); |
118 | 118 | ||
119 | return list; | 119 | return list; |
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | /*! | 123 | /*! |
124 | \internal | 124 | \internal |
125 | Returns a translated list of field names for a contact. | 125 | Returns a translated list of field names for a contact. |
126 | */ | 126 | */ |
127 | QStringList OContactFields::trfields( bool sorted ) | 127 | QStringList OContactFields::trfields( bool sorted ) |
128 | { | 128 | { |
129 | QStringList list; | 129 | QStringList list; |
130 | QMap<int, QString> mapIdToStr = idToTrFields(); | 130 | QMap<int, QString> mapIdToStr = idToTrFields(); |
131 | 131 | ||
132 | list.append( mapIdToStr[Qtopia::Title]); | 132 | list.append( mapIdToStr[Qtopia::Title]); |
133 | list.append( mapIdToStr[Qtopia::FirstName] ); | 133 | list.append( mapIdToStr[Qtopia::FirstName] ); |
134 | list.append( mapIdToStr[Qtopia::MiddleName] ); | 134 | list.append( mapIdToStr[Qtopia::MiddleName] ); |
135 | list.append( mapIdToStr[Qtopia::LastName] ); | 135 | list.append( mapIdToStr[Qtopia::LastName] ); |
136 | list.append( mapIdToStr[Qtopia::Suffix] ); | 136 | list.append( mapIdToStr[Qtopia::Suffix] ); |
137 | list.append( mapIdToStr[Qtopia::FileAs] ); | 137 | list.append( mapIdToStr[Qtopia::FileAs] ); |
138 | 138 | ||
139 | list.append( mapIdToStr[Qtopia::JobTitle] ); | 139 | list.append( mapIdToStr[Qtopia::JobTitle] ); |
140 | list.append( mapIdToStr[Qtopia::Department] ); | 140 | list.append( mapIdToStr[Qtopia::Department] ); |
141 | list.append( mapIdToStr[Qtopia::Company] ); | 141 | list.append( mapIdToStr[Qtopia::Company] ); |
142 | 142 | ||
143 | list += trphonefields( sorted ); | 143 | list += trphonefields( sorted ); |
144 | 144 | ||
145 | list.append( mapIdToStr[Qtopia::BusinessStreet] ); | 145 | list.append( mapIdToStr[Qtopia::BusinessStreet] ); |
146 | list.append( mapIdToStr[Qtopia::BusinessCity] ); | 146 | list.append( mapIdToStr[Qtopia::BusinessCity] ); |
147 | list.append( mapIdToStr[Qtopia::BusinessState] ); | 147 | list.append( mapIdToStr[Qtopia::BusinessState] ); |
148 | list.append( mapIdToStr[Qtopia::BusinessZip] ); | 148 | list.append( mapIdToStr[Qtopia::BusinessZip] ); |
149 | list.append( mapIdToStr[Qtopia::BusinessCountry] ); | 149 | list.append( mapIdToStr[Qtopia::BusinessCountry] ); |
150 | 150 | ||
151 | list.append( mapIdToStr[Qtopia::HomeStreet] ); | 151 | list.append( mapIdToStr[Qtopia::HomeStreet] ); |
152 | list.append( mapIdToStr[Qtopia::HomeCity] ); | 152 | list.append( mapIdToStr[Qtopia::HomeCity] ); |
153 | list.append( mapIdToStr[Qtopia::HomeState] ); | 153 | list.append( mapIdToStr[Qtopia::HomeState] ); |
154 | list.append( mapIdToStr[Qtopia::HomeZip] ); | 154 | list.append( mapIdToStr[Qtopia::HomeZip] ); |
155 | list.append( mapIdToStr[Qtopia::HomeCountry] ); | 155 | list.append( mapIdToStr[Qtopia::HomeCountry] ); |
156 | 156 | ||
157 | list += trdetailsfields( sorted ); | 157 | list += trdetailsfields( sorted ); |
158 | 158 | ||
159 | list.append( mapIdToStr[Qtopia::Notes] ); | 159 | list.append( mapIdToStr[Qtopia::Notes] ); |
160 | list.append( mapIdToStr[Qtopia::Groups] ); | 160 | list.append( mapIdToStr[Qtopia::Groups] ); |
161 | 161 | ||
162 | if (sorted) list.sort(); | 162 | if (sorted) list.sort(); |
163 | 163 | ||
164 | return list; | 164 | return list; |
165 | } | 165 | } |
166 | 166 | ||
167 | /*! | 167 | /*! |
168 | \internal | 168 | \internal |
169 | Returns an untranslated list of field names for a contact. | 169 | Returns an untranslated list of field names for a contact. |
170 | */ | 170 | */ |
171 | QStringList OContactFields::untrfields( bool sorted ) | 171 | QStringList OContactFields::untrfields( bool sorted ) |
172 | { | 172 | { |
173 | QStringList list; | 173 | QStringList list; |
174 | QMap<int, QString> mapIdToStr = idToUntrFields(); | 174 | QMap<int, QString> mapIdToStr = idToUntrFields(); |
175 | 175 | ||
176 | list.append( mapIdToStr[ Qtopia::Title ] ); | 176 | list.append( mapIdToStr[ Qtopia::Title ] ); |
177 | list.append( mapIdToStr[ Qtopia::FirstName ] ); | 177 | list.append( mapIdToStr[ Qtopia::FirstName ] ); |
178 | list.append( mapIdToStr[ Qtopia::MiddleName ] ); | 178 | list.append( mapIdToStr[ Qtopia::MiddleName ] ); |
179 | list.append( mapIdToStr[ Qtopia::LastName ] ); | 179 | list.append( mapIdToStr[ Qtopia::LastName ] ); |
180 | list.append( mapIdToStr[ Qtopia::Suffix ] ); | 180 | list.append( mapIdToStr[ Qtopia::Suffix ] ); |
181 | list.append( mapIdToStr[ Qtopia::FileAs ] ); | 181 | list.append( mapIdToStr[ Qtopia::FileAs ] ); |
182 | 182 | ||
183 | list.append( mapIdToStr[ Qtopia::JobTitle ] ); | 183 | list.append( mapIdToStr[ Qtopia::JobTitle ] ); |
184 | list.append( mapIdToStr[ Qtopia::Department ] ); | 184 | list.append( mapIdToStr[ Qtopia::Department ] ); |
185 | list.append( mapIdToStr[ Qtopia::Company ] ); | 185 | list.append( mapIdToStr[ Qtopia::Company ] ); |
186 | 186 | ||
187 | list += untrphonefields( sorted ); | 187 | list += untrphonefields( sorted ); |
188 | 188 | ||
189 | list.append( mapIdToStr[ Qtopia::BusinessStreet ] ); | 189 | list.append( mapIdToStr[ Qtopia::BusinessStreet ] ); |
190 | list.append( mapIdToStr[ Qtopia::BusinessCity ] ); | 190 | list.append( mapIdToStr[ Qtopia::BusinessCity ] ); |
191 | list.append( mapIdToStr[ Qtopia::BusinessState ] ); | 191 | list.append( mapIdToStr[ Qtopia::BusinessState ] ); |
192 | list.append( mapIdToStr[ Qtopia::BusinessZip ] ); | 192 | list.append( mapIdToStr[ Qtopia::BusinessZip ] ); |
193 | list.append( mapIdToStr[ Qtopia::BusinessCountry ] ); | 193 | list.append( mapIdToStr[ Qtopia::BusinessCountry ] ); |
194 | 194 | ||
195 | list.append( mapIdToStr[ Qtopia::HomeStreet ] ); | 195 | list.append( mapIdToStr[ Qtopia::HomeStreet ] ); |
196 | list.append( mapIdToStr[ Qtopia::HomeCity ] ); | 196 | list.append( mapIdToStr[ Qtopia::HomeCity ] ); |
197 | list.append( mapIdToStr[ Qtopia::HomeState ] ); | 197 | list.append( mapIdToStr[ Qtopia::HomeState ] ); |
198 | list.append( mapIdToStr[ Qtopia::HomeZip ] ); | 198 | list.append( mapIdToStr[ Qtopia::HomeZip ] ); |
199 | list.append( mapIdToStr[ Qtopia::HomeCountry ] ); | 199 | list.append( mapIdToStr[ Qtopia::HomeCountry ] ); |
200 | 200 | ||
201 | list += untrdetailsfields( sorted ); | 201 | list += untrdetailsfields( sorted ); |
202 | 202 | ||
203 | list.append( mapIdToStr[ Qtopia::Notes ] ); | 203 | list.append( mapIdToStr[ Qtopia::Notes ] ); |
204 | list.append( mapIdToStr[ Qtopia::Groups ] ); | 204 | list.append( mapIdToStr[ Qtopia::Groups ] ); |
205 | 205 | ||
206 | if (sorted) list.sort(); | 206 | if (sorted) list.sort(); |
207 | 207 | ||
208 | return list; | 208 | return list; |
209 | } | 209 | } |
210 | QMap<int, QString> OContactFields::idToTrFields() | 210 | QMap<int, QString> OContactFields::idToTrFields() |
211 | { | 211 | { |
212 | QMap<int, QString> ret_map; | 212 | QMap<int, QString> ret_map; |
213 | 213 | ||
214 | ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") ); | 214 | ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") ); |
215 | ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) ); | 215 | ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) ); |
216 | ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) ); | 216 | ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) ); |
217 | ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) ); | 217 | ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) ); |
218 | ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" )); | 218 | ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" )); |
219 | ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) ); | 219 | ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) ); |
220 | 220 | ||
221 | ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) ); | 221 | ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) ); |
222 | ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) ); | 222 | ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) ); |
223 | ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) ); | 223 | ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) ); |
224 | ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) ); | 224 | ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) ); |
225 | ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) ); | 225 | ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) ); |
226 | ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" )); | 226 | ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" )); |
227 | 227 | ||
228 | 228 | ||
229 | ret_map.insert( Qtopia::DefaultEmail, QObject::tr( "Default Email" ) ); | 229 | ret_map.insert( Qtopia::DefaultEmail, QObject::tr( "Default Email" ) ); |
230 | ret_map.insert( Qtopia::Emails, QObject::tr( "Emails" ) ); | 230 | ret_map.insert( Qtopia::Emails, QObject::tr( "Emails" ) ); |
231 | 231 | ||
232 | ret_map.insert( Qtopia::HomePhone, QObject::tr( "Home Phone" ) ); | 232 | ret_map.insert( Qtopia::HomePhone, QObject::tr( "Home Phone" ) ); |
233 | ret_map.insert( Qtopia::HomeFax, QObject::tr( "Home Fax" ) ); | 233 | ret_map.insert( Qtopia::HomeFax, QObject::tr( "Home Fax" ) ); |
234 | ret_map.insert( Qtopia::HomeMobile, QObject::tr( "Home Mobile" ) ); | 234 | ret_map.insert( Qtopia::HomeMobile, QObject::tr( "Home Mobile" ) ); |
235 | 235 | ||
236 | // business | 236 | // business |
237 | ret_map.insert( Qtopia::BusinessStreet, QObject::tr( "Business Street" ) ); | 237 | ret_map.insert( Qtopia::BusinessStreet, QObject::tr( "Business Street" ) ); |
238 | ret_map.insert( Qtopia::BusinessCity, QObject::tr( "Business City" ) ); | 238 | ret_map.insert( Qtopia::BusinessCity, QObject::tr( "Business City" ) ); |
239 | ret_map.insert( Qtopia::BusinessState, QObject::tr( "Business State" ) ); | 239 | ret_map.insert( Qtopia::BusinessState, QObject::tr( "Business State" ) ); |
240 | ret_map.insert( Qtopia::BusinessZip, QObject::tr( "Business Zip" ) ); | 240 | ret_map.insert( Qtopia::BusinessZip, QObject::tr( "Business Zip" ) ); |
241 | ret_map.insert( Qtopia::BusinessCountry, QObject::tr( "Business Country" ) ); | 241 | ret_map.insert( Qtopia::BusinessCountry, QObject::tr( "Business Country" ) ); |
242 | ret_map.insert( Qtopia::BusinessPager, QObject::tr( "Business Pager" ) ); | 242 | ret_map.insert( Qtopia::BusinessPager, QObject::tr( "Business Pager" ) ); |
243 | ret_map.insert( Qtopia::BusinessWebPage, QObject::tr( "Business WebPage" ) ); | 243 | ret_map.insert( Qtopia::BusinessWebPage, QObject::tr( "Business WebPage" ) ); |
244 | 244 | ||
245 | ret_map.insert( Qtopia::Office, QObject::tr( "Office" ) ); | 245 | ret_map.insert( Qtopia::Office, QObject::tr( "Office" ) ); |
246 | ret_map.insert( Qtopia::Profession, QObject::tr( "Profession" ) ); | 246 | ret_map.insert( Qtopia::Profession, QObject::tr( "Profession" ) ); |
247 | ret_map.insert( Qtopia::Assistant, QObject::tr( "Assistant" ) ); | 247 | ret_map.insert( Qtopia::Assistant, QObject::tr( "Assistant" ) ); |
248 | ret_map.insert( Qtopia::Manager, QObject::tr( "Manager" ) ); | 248 | ret_map.insert( Qtopia::Manager, QObject::tr( "Manager" ) ); |
249 | 249 | ||
250 | // home | 250 | // home |
251 | ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) ); | 251 | ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) ); |
252 | ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) ); | 252 | ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) ); |
253 | ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) ); | 253 | ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) ); |
254 | ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) ); | 254 | ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) ); |
255 | ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) ); | 255 | ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) ); |
256 | ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) ); | 256 | ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) ); |
257 | 257 | ||
258 | //personal | 258 | //personal |
259 | ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) ); | 259 | ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) ); |
260 | ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) ); | 260 | ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) ); |
261 | ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) ); | 261 | ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) ); |
262 | ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) ); | 262 | ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) ); |
263 | ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) ); | 263 | ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) ); |
264 | ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) ); | 264 | ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) ); |
265 | 265 | ||
266 | // other | 266 | // other |
267 | ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) ); | 267 | ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) ); |
268 | 268 | ||
269 | 269 | ||
270 | return ret_map; | 270 | return ret_map; |
271 | } | 271 | } |
272 | 272 | ||
273 | QMap<int, QString> OContactFields::idToUntrFields() | 273 | QMap<int, QString> OContactFields::idToUntrFields() |
274 | { | 274 | { |
275 | QMap<int, QString> ret_map; | 275 | QMap<int, QString> ret_map; |
276 | 276 | ||
277 | ret_map.insert( Qtopia::Title, "Name Title" ); | 277 | ret_map.insert( Qtopia::Title, "Name Title" ); |
278 | ret_map.insert( Qtopia::FirstName, "First Name" ); | 278 | ret_map.insert( Qtopia::FirstName, "First Name" ); |
279 | ret_map.insert( Qtopia::MiddleName, "Middle Name" ); | 279 | ret_map.insert( Qtopia::MiddleName, "Middle Name" ); |
280 | ret_map.insert( Qtopia::LastName, "Last Name" ); | 280 | ret_map.insert( Qtopia::LastName, "Last Name" ); |
281 | ret_map.insert( Qtopia::Suffix, "Suffix" ); | 281 | ret_map.insert( Qtopia::Suffix, "Suffix" ); |
282 | ret_map.insert( Qtopia::FileAs, "File As" ); | 282 | ret_map.insert( Qtopia::FileAs, "File As" ); |
283 | 283 | ||
284 | ret_map.insert( Qtopia::JobTitle, "Job Title" ); | 284 | ret_map.insert( Qtopia::JobTitle, "Job Title" ); |
285 | ret_map.insert( Qtopia::Department, "Department" ); | 285 | ret_map.insert( Qtopia::Department, "Department" ); |
286 | ret_map.insert( Qtopia::Company, "Company" ); | 286 | ret_map.insert( Qtopia::Company, "Company" ); |
287 | ret_map.insert( Qtopia::BusinessPhone, "Business Phone" ); | 287 | ret_map.insert( Qtopia::BusinessPhone, "Business Phone" ); |
288 | ret_map.insert( Qtopia::BusinessFax, "Business Fax" ); | 288 | ret_map.insert( Qtopia::BusinessFax, "Business Fax" ); |
289 | ret_map.insert( Qtopia::BusinessMobile, "Business Mobile" ); | 289 | ret_map.insert( Qtopia::BusinessMobile, "Business Mobile" ); |
290 | 290 | ||
291 | 291 | ||
292 | ret_map.insert( Qtopia::DefaultEmail, "Default Email" ); | 292 | ret_map.insert( Qtopia::DefaultEmail, "Default Email" ); |
293 | ret_map.insert( Qtopia::Emails, "Emails" ); | 293 | ret_map.insert( Qtopia::Emails, "Emails" ); |
294 | 294 | ||
295 | ret_map.insert( Qtopia::HomePhone, "Home Phone" ); | 295 | ret_map.insert( Qtopia::HomePhone, "Home Phone" ); |
296 | ret_map.insert( Qtopia::HomeFax, "Home Fax" ); | 296 | ret_map.insert( Qtopia::HomeFax, "Home Fax" ); |
297 | ret_map.insert( Qtopia::HomeMobile, "Home Mobile" ); | 297 | ret_map.insert( Qtopia::HomeMobile, "Home Mobile" ); |
298 | 298 | ||
299 | // business | 299 | // business |
300 | ret_map.insert( Qtopia::BusinessStreet, "Business Street" ); | 300 | ret_map.insert( Qtopia::BusinessStreet, "Business Street" ); |
301 | ret_map.insert( Qtopia::BusinessCity, "Business City" ); | 301 | ret_map.insert( Qtopia::BusinessCity, "Business City" ); |
302 | ret_map.insert( Qtopia::BusinessState, "Business State" ); | 302 | ret_map.insert( Qtopia::BusinessState, "Business State" ); |
303 | ret_map.insert( Qtopia::BusinessZip, "Business Zip" ); | 303 | ret_map.insert( Qtopia::BusinessZip, "Business Zip" ); |
304 | ret_map.insert( Qtopia::BusinessCountry, "Business Country" ); | 304 | ret_map.insert( Qtopia::BusinessCountry, "Business Country" ); |
305 | ret_map.insert( Qtopia::BusinessPager, "Business Pager" ); | 305 | ret_map.insert( Qtopia::BusinessPager, "Business Pager" ); |
306 | ret_map.insert( Qtopia::BusinessWebPage, "Business WebPage" ); | 306 | ret_map.insert( Qtopia::BusinessWebPage, "Business WebPage" ); |
307 | 307 | ||
308 | ret_map.insert( Qtopia::Office, "Office" ); | 308 | ret_map.insert( Qtopia::Office, "Office" ); |
309 | ret_map.insert( Qtopia::Profession, "Profession" ); | 309 | ret_map.insert( Qtopia::Profession, "Profession" ); |
310 | ret_map.insert( Qtopia::Assistant, "Assistant" ); | 310 | ret_map.insert( Qtopia::Assistant, "Assistant" ); |
311 | ret_map.insert( Qtopia::Manager, "Manager" ); | 311 | ret_map.insert( Qtopia::Manager, "Manager" ); |
312 | 312 | ||
313 | // home | 313 | // home |
314 | ret_map.insert( Qtopia::HomeStreet, "Home Street" ); | 314 | ret_map.insert( Qtopia::HomeStreet, "Home Street" ); |
315 | ret_map.insert( Qtopia::HomeCity, "Home City" ); | 315 | ret_map.insert( Qtopia::HomeCity, "Home City" ); |
316 | ret_map.insert( Qtopia::HomeState, "Home State" ); | 316 | ret_map.insert( Qtopia::HomeState, "Home State" ); |
317 | ret_map.insert( Qtopia::HomeZip, "Home Zip" ); | 317 | ret_map.insert( Qtopia::HomeZip, "Home Zip" ); |
318 | ret_map.insert( Qtopia::HomeCountry, "Home Country" ); | 318 | ret_map.insert( Qtopia::HomeCountry, "Home Country" ); |
319 | ret_map.insert( Qtopia::HomeWebPage, "Home Web Page" ); | 319 | ret_map.insert( Qtopia::HomeWebPage, "Home Web Page" ); |
320 | 320 | ||
321 | //personal | 321 | //personal |
322 | ret_map.insert( Qtopia::Spouse, "Spouse" ); | 322 | ret_map.insert( Qtopia::Spouse, "Spouse" ); |
323 | ret_map.insert( Qtopia::Gender, "Gender" ); | 323 | ret_map.insert( Qtopia::Gender, "Gender" ); |
324 | ret_map.insert( Qtopia::Birthday, "Birthday" ); | 324 | ret_map.insert( Qtopia::Birthday, "Birthday" ); |
325 | ret_map.insert( Qtopia::Anniversary, "Anniversary" ); | 325 | ret_map.insert( Qtopia::Anniversary, "Anniversary" ); |
326 | ret_map.insert( Qtopia::Nickname, "Nickname" ); | 326 | ret_map.insert( Qtopia::Nickname, "Nickname" ); |
327 | ret_map.insert( Qtopia::Children, "Children" ); | 327 | ret_map.insert( Qtopia::Children, "Children" ); |
328 | 328 | ||
329 | // other | 329 | // other |
330 | ret_map.insert( Qtopia::Notes, "Notes" ); | 330 | ret_map.insert( Qtopia::Notes, "Notes" ); |
331 | 331 | ||
332 | 332 | ||
333 | return ret_map; | 333 | return ret_map; |
334 | } | 334 | } |
335 | 335 | ||
336 | QMap<QString, int> OContactFields::trFieldsToId() | 336 | QMap<QString, int> OContactFields::trFieldsToId() |
337 | { | 337 | { |
338 | QMap<int, QString> idtostr = idToTrFields(); | 338 | QMap<int, QString> idtostr = idToTrFields(); |
339 | QMap<QString, int> ret_map; | 339 | QMap<QString, int> ret_map; |
340 | 340 | ||
341 | 341 | ||
342 | QMap<int, QString>::Iterator it; | 342 | QMap<int, QString>::Iterator it; |
343 | for( it = idtostr.begin(); it != idtostr.end(); ++it ) | 343 | for( it = idtostr.begin(); it != idtostr.end(); ++it ) |
344 | ret_map.insert( *it, it.key() ); | 344 | ret_map.insert( *it, it.key() ); |
345 | 345 | ||
346 | 346 | ||
347 | return ret_map; | 347 | return ret_map; |
348 | } | 348 | } |
349 | 349 | ||
350 | QMap<QString, int> OContactFields::untrFieldsToId() | 350 | QMap<QString, int> OContactFields::untrFieldsToId() |
351 | { | 351 | { |
352 | QMap<int, QString> idtostr = idToUntrFields(); | 352 | QMap<int, QString> idtostr = idToUntrFields(); |
353 | QMap<QString, int> ret_map; | 353 | QMap<QString, int> ret_map; |
354 | 354 | ||
355 | 355 | ||
356 | QMap<int, QString>::Iterator it; | 356 | QMap<int, QString>::Iterator it; |
357 | for( it = idtostr.begin(); it != idtostr.end(); ++it ) | 357 | for( it = idtostr.begin(); it != idtostr.end(); ++it ) |
358 | ret_map.insert( *it, it.key() ); | 358 | ret_map.insert( *it, it.key() ); |
359 | 359 | ||
360 | 360 | ||
361 | return ret_map; | 361 | return ret_map; |
362 | } | 362 | } |
363 | 363 | ||
364 | 364 | ||
365 | OContactFields::OContactFields(): | 365 | OContactFields::OContactFields(): |
366 | fieldOrder( DEFAULT_FIELD_ORDER ), | 366 | fieldOrder( DEFAULT_FIELD_ORDER ), |
367 | changedFieldOrder( false ) | 367 | changedFieldOrder( false ) |
368 | { | 368 | { |
369 | // Get the global field order from the config file and | 369 | // Get the global field order from the config file and |
370 | // use it as a start pattern | 370 | // use it as a start pattern |
371 | Config cfg ( "AddressBook" ); | 371 | Config cfg ( "AddressBook" ); |
372 | cfg.setGroup( "ContactFieldOrder" ); | 372 | cfg.setGroup( "ContactFieldOrder" ); |
373 | globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER ); | 373 | globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER ); |
374 | } | 374 | } |
375 | 375 | ||
376 | OContactFields::~OContactFields(){ | 376 | OContactFields::~OContactFields(){ |
377 | 377 | ||
378 | // We will store the fieldorder into the config file | 378 | // We will store the fieldorder into the config file |
379 | // to reuse it for the future.. | 379 | // to reuse it for the future.. |
380 | if ( changedFieldOrder ){ | 380 | if ( changedFieldOrder ){ |
381 | Config cfg ( "AddressBook" ); | 381 | Config cfg ( "AddressBook" ); |
382 | cfg.setGroup( "ContactFieldOrder" ); | 382 | cfg.setGroup( "ContactFieldOrder" ); |
383 | cfg.writeEntry( "General", globalFieldOrder ); | 383 | cfg.writeEntry( "General", globalFieldOrder ); |
384 | } | 384 | } |
385 | } | 385 | } |
386 | 386 | ||
387 | 387 | ||
388 | 388 | ||
389 | void OContactFields::saveToRecord( OContact &cnt ){ | 389 | void OContactFields::saveToRecord( OContact &cnt ){ |
390 | 390 | ||
391 | qDebug("ocontactfields saveToRecord: >%s<",fieldOrder.latin1()); | 391 | qDebug("ocontactfields saveToRecord: >%s<",fieldOrder.latin1()); |
392 | 392 | ||
393 | // Store fieldorder into this contact. | 393 | // Store fieldorder into this contact. |
394 | cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder ); | 394 | cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder ); |
395 | 395 | ||
396 | globalFieldOrder = fieldOrder; | 396 | globalFieldOrder = fieldOrder; |
397 | changedFieldOrder = true; | 397 | changedFieldOrder = true; |
398 | 398 | ||
399 | } | 399 | } |
400 | 400 | ||
401 | void OContactFields::loadFromRecord( const OContact &cnt ){ | 401 | void OContactFields::loadFromRecord( const OContact &cnt ){ |
402 | qDebug("ocontactfields loadFromRecord"); | 402 | qDebug("ocontactfields loadFromRecord"); |
403 | qDebug("loading >%s<",cnt.fullName().latin1()); | 403 | qDebug("loading >%s<",cnt.fullName().latin1()); |
404 | 404 | ||
405 | // Get fieldorder for this contact. If none is defined, | 405 | // Get fieldorder for this contact. If none is defined, |
406 | // we will use the global one from the config file.. | 406 | // we will use the global one from the config file.. |
407 | 407 | ||
408 | fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME ); | 408 | fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME ); |
409 | 409 | ||
410 | qDebug("fieldOrder from contact>%s<",fieldOrder.latin1()); | 410 | qDebug("fieldOrder from contact>%s<",fieldOrder.latin1()); |
411 | 411 | ||
412 | if (fieldOrder.isEmpty()){ | 412 | if (fieldOrder.isEmpty()){ |
413 | fieldOrder = globalFieldOrder; | 413 | fieldOrder = globalFieldOrder; |
414 | } | 414 | } |
415 | 415 | ||
416 | 416 | ||
417 | qDebug("effective fieldOrder in loadFromRecord >%s<",fieldOrder.latin1()); | 417 | qDebug("effective fieldOrder in loadFromRecord >%s<",fieldOrder.latin1()); |
418 | } | 418 | } |
419 | 419 | ||
420 | void OContactFields::setFieldOrder( int num, int index ){ | 420 | void OContactFields::setFieldOrder( int num, int index ){ |
421 | qDebug("qcontactfields setfieldorder pos %i -> %i",num,index); | 421 | qDebug("qcontactfields setfieldorder pos %i -> %i",num,index); |
422 | 422 | ||
423 | fieldOrder[num] = QString::number( index )[0]; | 423 | fieldOrder[num] = QString::number( index, 16 )[0]; |
424 | 424 | ||
425 | // We will store this new fieldorder globally to | 425 | // We will store this new fieldorder globally to |
426 | // remember it for contacts which have none | 426 | // remember it for contacts which have none |
427 | globalFieldOrder = fieldOrder; | 427 | globalFieldOrder = fieldOrder; |
428 | changedFieldOrder = true; | 428 | changedFieldOrder = true; |
429 | 429 | ||
430 | qDebug("fieldOrder >%s<",fieldOrder.latin1()); | 430 | qDebug("fieldOrder >%s<",fieldOrder.latin1()); |
431 | } | 431 | } |
432 | 432 | ||
433 | int OContactFields::getFieldOrder( int num, int defIndex ){ | 433 | int OContactFields::getFieldOrder( int num, int defIndex ){ |
434 | qDebug("ocontactfields getFieldOrder"); | 434 | qDebug("ocontactfields getFieldOrder"); |
435 | qDebug("fieldOrder >%s<",fieldOrder.latin1()); | 435 | qDebug("fieldOrder >%s<",fieldOrder.latin1()); |
436 | 436 | ||
437 | // Get index of combo as char.. | 437 | // Get index of combo as char.. |
438 | QChar poschar = fieldOrder[num]; | 438 | QChar poschar = fieldOrder[num]; |
439 | 439 | ||
440 | bool ok; | 440 | bool ok; |
441 | int ret = 0; | 441 | int ret = 0; |
442 | // Convert char to number.. | 442 | // Convert char to number.. |
443 | if ( !( poschar == QChar::null ) ) | 443 | if ( !( poschar == QChar::null ) ) |
444 | ret = QString( poschar ).toInt(&ok, 10); | 444 | ret = QString( poschar ).toInt(&ok, 16); |
445 | else | 445 | else |
446 | ok = false; | 446 | ok = false; |
447 | 447 | ||
448 | // Return default value if index for | 448 | // Return default value if index for |
449 | // num was not set or if anything else happened.. | 449 | // num was not set or if anything else happened.. |
450 | if ( !ok ) ret = defIndex; | 450 | if ( !ok ) ret = defIndex; |
451 | 451 | ||
452 | qDebug("returning >%i<",ret); | 452 | qDebug("returning >%i<",ret); |
453 | 453 | ||
454 | return ret; | 454 | return ret; |
455 | 455 | ||
456 | } | 456 | } |
diff --git a/core/pim/addressbook/version.h b/core/pim/addressbook/version.h index 3c1e5ee..3becfdc 100644 --- a/core/pim/addressbook/version.h +++ b/core/pim/addressbook/version.h | |||
@@ -1,10 +1,10 @@ | |||
1 | #ifndef _VERSION_H_ | 1 | #ifndef _VERSION_H_ |
2 | #define _VERSION_H_ | 2 | #define _VERSION_H_ |
3 | 3 | ||
4 | #define MAINVERSION "0" | 4 | #define MAINVERSION "0" |
5 | #define SUBVERSION "2" | 5 | #define SUBVERSION "2" |
6 | #define PATCHVERSION "1" | 6 | #define PATCHVERSION "2" |
7 | 7 | ||
8 | #define APPNAME "OPIE_ADDRESSBOOK" | 8 | #define APPNAME "OPIE_ADDRESSBOOK" |
9 | 9 | ||
10 | #endif | 10 | #endif |