author | eilers <eilers> | 2003-02-23 15:29:19 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-02-23 15:29:19 (UTC) |
commit | 3756fa1506f6cbf782a9ea38036fd7ea965a83d8 (patch) (unidiff) | |
tree | 41ca42c2606ada15ecaebfde033de2eefab42c00 | |
parent | 20224076b50a7426e9c6c88ed245f54283108eff (diff) | |
download | opie-3756fa1506f6cbf782a9ea38036fd7ea965a83d8.zip opie-3756fa1506f6cbf782a9ea38036fd7ea965a83d8.tar.gz opie-3756fa1506f6cbf782a9ea38036fd7ea965a83d8.tar.bz2 |
Added icons. Especially the main-contact table has an icon
to show whether it is a work-, home- number or if it
is a mobile...
The pictures may need improvements due to my incompetence in creating pictures..
Do we have anyone who may paint such stuff ?
-rw-r--r-- | core/pim/addressbook/TODO | 5 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 137 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.h | 12 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 5 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg.cpp | 11 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 3 | ||||
-rw-r--r-- | core/pim/addressbook/ocontactfields.cpp | 14 |
7 files changed, 122 insertions, 65 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index f62b075..906b462 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO | |||
@@ -1,117 +1,118 @@ | |||
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 | - Email-button: A lot of problems.. :( | 21 | - Default Email-button: A lot of problems: |
22 | If on second tab: The combo chooser is on the top left of the screen ! :( | ||
22 | - Default Email-Button: Sometimes not hiding the textfields completely | 23 | - Default Email-Button: Sometimes not hiding the textfields completely |
23 | 24 | ||
24 | Bugs but not in addressbook: | 25 | Bugs but not in addressbook: |
25 | ----------------------------- | 26 | ----------------------------- |
26 | - VCARD: If umlaut (äöüß) in address, the parser gets confused.. | 27 | - VCARD: If umlaut (äöüß) in address, the parser gets confused.. |
27 | 28 | ||
28 | - Exporting and reimporting of Jobtitle was reported to fail (Could not reproduce this ! (se)) | 29 | - Exporting and reimporting of Jobtitle was reported to fail (Could not reproduce this ! (se)) |
29 | 30 | ||
30 | 31 | ||
31 | Urgent: | 32 | Urgent: |
32 | -------- | 33 | -------- |
33 | ContactEditor: | 34 | ContactEditor: |
34 | - Contact-Editor is temporarely reenabled. Wait for replacement. | 35 | - Contact-Editor is temporarely reenabled. Wait for replacement. |
35 | - Redesign of Contacteditor | 36 | - Redesign of Contacteditor |
36 | - Category is on the wrong position after changing to personal and back to normal | 37 | - Category is on the wrong position after changing to personal and back to normal |
37 | ( Temporarily workaround: Category is never deactivated.. :S ) | 38 | ( Temporarily workaround: Category is never deactivated.. :S ) |
38 | 39 | ||
39 | - Personal and Business Web-page is not editable | ||
40 | 40 | ||
41 | Important: | 41 | Important: |
42 | ---------- | 42 | ---------- |
43 | 43 | ||
44 | - If new contact is added (contacteditor closed): focus (table, card) to | 44 | - If new contact is added (contacteditor closed): focus (table, card) to |
45 | this entry ! | 45 | this entry ! |
46 | - After search (Started with Return): KeyFocus should be on Tabelle | 46 | - After search (Started with Return): KeyFocus should be on Tabelle |
47 | 47 | ||
48 | - "What's this" should be added (Deleyed after Feature Freeze) | 48 | - "What's this" should be added (Deleyed after Feature Freeze) |
49 | 49 | ||
50 | Less important: | 50 | Less important: |
51 | --------------- | 51 | --------------- |
52 | - Reload if contacts were changed externally | 52 | - Reload if contacts were changed externally |
53 | - The picker (alphabetical sort widget) should be | 53 | - The picker (alphabetical sort widget) should be |
54 | placed verticaly or horizontally (configurable) | 54 | placed verticaly or horizontally (configurable) |
55 | - Find a smart solution for activating/deactivating the "send email" event | 55 | - Find a smart solution for activating/deactivating the "send email" event |
56 | 56 | ||
57 | Should be Fixed (not absolute sure, need further validation): | 57 | Should be Fixed (not absolute sure, need further validation): |
58 | ------------------------------------------------------------- | 58 | ------------------------------------------------------------- |
59 | 59 | ||
60 | 60 | ||
61 | Fixed/Ready: | 61 | Fixed/Ready: |
62 | ------- | 62 | ------- |
63 | - Syncing: abtable not reloaded after sync. | 63 | - Syncing: abtable not reloaded after sync. |
64 | - Find widget should be replaced by something like | 64 | - Find widget should be replaced by something like |
65 | qpdf has. | 65 | qpdf has. |
66 | - Adding a configuration dialog | 66 | - Adding a configuration dialog |
67 | - Picker: Activated letter schould be more visible | 67 | - Picker: Activated letter schould be more visible |
68 | - Advanced handling of cursor keys (search..) | 68 | - Advanced handling of cursor keys (search..) |
69 | - Mail-Icon is missing | 69 | - Mail-Icon is missing |
70 | - Use opie-mail insted of qt-mail if possible. | 70 | - Use opie-mail insted of qt-mail if possible. |
71 | - Font menu is invisible using german translation | 71 | - Font menu is invisible using german translation |
72 | - Personal contact editor: Disable categories | 72 | - Personal contact editor: Disable categories |
73 | - "Nonenglish" translation bug has to be fixed. | 73 | - "Nonenglish" translation bug has to be fixed. |
74 | - contacteditor: Birthday, annyversary, ... : Use Dateselector | 74 | - contacteditor: Birthday, annyversary, ... : Use Dateselector |
75 | - The names of the countries are sorted by there english names, only.. | 75 | - The names of the countries are sorted by there english names, only.. |
76 | Even if they are translated.. :S | 76 | Even if they are translated.. :S |
77 | - Cursor keys should work in detail-view (ablabel) | 77 | - Cursor keys should work in detail-view (ablabel) |
78 | -> Ablabel should be removed and Abtable should be increased with | 78 | -> Ablabel should be removed and Abtable should be increased with |
79 | different views (as started by darwin zins).. | 79 | different views (as started by darwin zins).. |
80 | - Use advanced database functions in abtable to decrease | 80 | - Use advanced database functions in abtable to decrease |
81 | memory footprint and to make everything more easy ! | 81 | memory footprint and to make everything more easy ! |
82 | (abtable should store Iterator for selected Category) | 82 | (abtable should store Iterator for selected Category) |
83 | - Abtable: Configure Contact column (internally already available, | 83 | - Abtable: Configure Contact column (internally already available, |
84 | need configuration) | 84 | need configuration) |
85 | - Select of primary contact (see #274 on mantis) | 85 | - Select of primary contact (see #274 on mantis) |
86 | - Category-select does not work completely: "Unfiled" is always in listview .. | 86 | - Category-select does not work completely: "Unfiled" is always in listview .. |
87 | - Return from Contacteditor: Category resettet to all | 87 | - Return from Contacteditor: Category resettet to all |
88 | - Personal Details not working | 88 | - Personal Details not working |
89 | - If category changed, the letterpicker should be resetted | 89 | - If category changed, the letterpicker should be resetted |
90 | - There should be some icons for List and Cardview | 90 | - There should be some icons for List and Cardview |
91 | - If in Cardview and a category change removes all entries: | 91 | - If in Cardview and a category change removes all entries: |
92 | There are already entries in Cardview after up/down | 92 | There are already entries in Cardview after up/down |
93 | - Personal Details: Anniversary zeigt Fantasie-Werte | 93 | - Personal Details: Anniversary zeigt Fantasie-Werte |
94 | - Unfiled shown just in Category "All" and "Unfiled". | 94 | - Unfiled shown just in Category "All" and "Unfiled". |
95 | - After finising search and after Edit: Clear Picker | 95 | - After finising search and after Edit: Clear Picker |
96 | - After Edit: Table position back to edited entry. | 96 | - After Edit: Table position back to edited entry. |
97 | - Optimize Table Update... | 97 | - Optimize Table Update... |
98 | - Change MyDialog to Config | 98 | - Change MyDialog to Config |
99 | - Store position and state of toolbar | 99 | - Store position and state of toolbar |
100 | - Searchwidget closed: Selected user is jumping | 100 | - Searchwidget closed: Selected user is jumping |
101 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) | 101 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) |
102 | zu lange.. | 102 | zu lange.. |
103 | - VCARD: Import of Anniversary does not work correctly (currently disabled) | 103 | - VCARD: Import of Anniversary does not work correctly (currently disabled) |
104 | - Name order selected in "contacteditor" not used in list view. | 104 | - Name order selected in "contacteditor" not used in list view. |
105 | - OK-Key does not switch from Detailview (ablable) to Listview | 105 | - OK-Key does not switch from Detailview (ablable) to Listview |
106 | - Receiving of beams should open a dialog | 106 | - Receiving of beams should open a dialog |
107 | - Fix start of opie-mail | 107 | - Fix start of opie-mail |
108 | - Implement Button Pics | 108 | - Implement Button Pics |
109 | - Add a dialog to accept and optionally edit received contacts by IRDA. | 109 | - Add a dialog to accept and optionally edit received contacts by IRDA. |
110 | - Language not English (tested with german opie-translation): | 110 | - Language not English (tested with german opie-translation): |
111 | 1. Configure nicht übersetzt (alles leer). | 111 | 1. Configure nicht übersetzt (alles leer). |
112 | 2. Contacteditor nur teilweise übersetzt. | 112 | 2. Contacteditor nur teilweise übersetzt. |
113 | 3. Kategorie-Picker geht nicht. | 113 | 3. Kategorie-Picker geht nicht. |
114 | - Plugin for Today for Birthdays and Anniversaries | 114 | - Plugin for Today for Birthdays and Anniversaries |
115 | - Implement a picker/combo for the default email. | 115 | - Implement a picker/combo for the default email. |
116 | - Overview window cleanup needed.. | 116 | - Overview window cleanup needed.. |
117 | - Store last settings of combo-boxes | 117 | - Store last settings of combo-boxes |
118 | - Personal and Business Web-page is not editable | ||
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index aec390d..55b1ba1 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -1,747 +1,780 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) | 3 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) |
4 | ** | 4 | ** |
5 | ** This file is part of Qt Palmtop Environment. | 5 | ** This file is part of Qt 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 | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging 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 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | 22 | ||
23 | #include <qpe/categoryselect.h> | 23 | #include <qpe/categoryselect.h> |
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qpe/stringutil.h> | 25 | #include <qpe/stringutil.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
27 | #include <qpe/timestring.h> | 27 | #include <qpe/timestring.h> |
28 | #include <qpe/resource.h> | ||
28 | 29 | ||
29 | #include <opie/orecordlist.h> | 30 | #include <opie/orecordlist.h> |
30 | 31 | ||
31 | #include <qasciidict.h> | 32 | #include <qasciidict.h> |
32 | #include <qdatetime.h> | 33 | #include <qdatetime.h> |
33 | #include <qfile.h> | 34 | #include <qfile.h> |
34 | #include <qregexp.h> | 35 | #include <qregexp.h> |
35 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
36 | 37 | ||
37 | #include "abtable.h" | 38 | #include "abtable.h" |
38 | 39 | ||
39 | #include <errno.h> | 40 | #include <errno.h> |
40 | #include <fcntl.h> | 41 | #include <fcntl.h> |
41 | #include <unistd.h> | 42 | #include <unistd.h> |
42 | #include <stdlib.h> | 43 | #include <stdlib.h> |
43 | 44 | ||
44 | #include <ctype.h> //toupper() for key hack | 45 | #include <ctype.h> //toupper() for key hack |
45 | 46 | ||
46 | /*! | 47 | /*! |
47 | \class AbTableItem abtable.h | 48 | \class AbTableItem abtable.h |
48 | 49 | ||
49 | \brief QTableItem based class for showing a field of an entry | 50 | \brief QTableItem based class for showing a field of an entry |
50 | */ | 51 | */ |
51 | 52 | ||
52 | AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, | 53 | AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, |
53 | const QString &secondSortKey) | 54 | const QString &secondSortKey) |
54 | : QTableItem( t, et, s ) | 55 | : QTableItem( t, et, s ) |
55 | { | 56 | { |
56 | // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); | 57 | // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); |
57 | sortKey = Qtopia::buildSortKey( s, secondSortKey ); | 58 | sortKey = Qtopia::buildSortKey( s, secondSortKey ); |
58 | } | 59 | } |
59 | 60 | ||
60 | int AbTableItem::alignment() const | 61 | int AbTableItem::alignment() const |
61 | { | 62 | { |
62 | return AlignLeft|AlignVCenter; | 63 | return AlignLeft|AlignVCenter; |
63 | } | 64 | } |
64 | 65 | ||
65 | QString AbTableItem::key() const | 66 | QString AbTableItem::key() const |
66 | { | 67 | { |
67 | return sortKey; | 68 | return sortKey; |
68 | } | 69 | } |
69 | 70 | ||
70 | // A way to reset the item, without out doing a delete or a new... | 71 | // A way to reset the item, without out doing a delete or a new... |
71 | void AbTableItem::setItem( const QString &txt, const QString &secondKey ) | 72 | void AbTableItem::setItem( const QString &txt, const QString &secondKey ) |
72 | { | 73 | { |
73 | setText( txt ); | 74 | setText( txt ); |
74 | sortKey = Qtopia::buildSortKey( txt, secondKey ); | 75 | sortKey = Qtopia::buildSortKey( txt, secondKey ); |
75 | 76 | ||
76 | // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); | 77 | // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); |
77 | } | 78 | } |
78 | 79 | ||
79 | /*! | 80 | /*! |
80 | \class AbPickItem abtable.h | 81 | \class AbPickItem abtable.h |
81 | 82 | ||
82 | \brief QTableItem based class for showing slection of an entry | 83 | \brief QTableItem based class for showing slection of an entry |
83 | */ | 84 | */ |
84 | 85 | ||
85 | AbPickItem::AbPickItem( QTable *t ) : | 86 | AbPickItem::AbPickItem( QTable *t ) : |
86 | QTableItem(t, WhenCurrent, "?") | 87 | QTableItem(t, WhenCurrent, "?") |
87 | { | 88 | { |
88 | } | 89 | } |
89 | 90 | ||
90 | QWidget *AbPickItem::createEditor() const | 91 | QWidget *AbPickItem::createEditor() const |
91 | { | 92 | { |
92 | QComboBox* combo = new QComboBox( table()->viewport() ); | 93 | QComboBox* combo = new QComboBox( table()->viewport() ); |
93 | ( (AbPickItem*)this )->cb = combo; | 94 | ( (AbPickItem*)this )->cb = combo; |
94 | AbTable* t = static_cast<AbTable*>(table()); | 95 | AbTable* t = static_cast<AbTable*>(table()); |
95 | QStringList c = t->choiceNames(); | 96 | QStringList c = t->choiceNames(); |
96 | int cur = 0; | 97 | int cur = 0; |
97 | for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { | 98 | for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { |
98 | if ( *it == text() ) | 99 | if ( *it == text() ) |
99 | cur = combo->count(); | 100 | cur = combo->count(); |
100 | combo->insertItem(*it); | 101 | combo->insertItem(*it); |
101 | } | 102 | } |
102 | combo->setCurrentItem(cur); | 103 | combo->setCurrentItem(cur); |
103 | return combo; | 104 | return combo; |
104 | } | 105 | } |
105 | 106 | ||
106 | void AbPickItem::setContentFromEditor( QWidget *w ) | 107 | void AbPickItem::setContentFromEditor( QWidget *w ) |
107 | { | 108 | { |
108 | if ( w->inherits("QComboBox") ) | 109 | if ( w->inherits("QComboBox") ) |
109 | setText( ( (QComboBox*)w )->currentText() ); | 110 | setText( ( (QComboBox*)w )->currentText() ); |
110 | else | 111 | else |
111 | QTableItem::setContentFromEditor( w ); | 112 | QTableItem::setContentFromEditor( w ); |
112 | } | 113 | } |
113 | 114 | ||
114 | /*! | 115 | /*! |
115 | \class AbTable abtable.h | 116 | \class AbTable abtable.h |
116 | 117 | ||
117 | \brief QTable based class for showing a list of entries | 118 | \brief QTable based class for showing a list of entries |
118 | */ | 119 | */ |
119 | 120 | ||
120 | AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name ) | 121 | AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name ) |
121 | : QTable( parent, name ), | 122 | : QTable( parent, name ), |
122 | lastSortCol( -1 ), | 123 | lastSortCol( -1 ), |
123 | asc( TRUE ), | 124 | asc( TRUE ), |
124 | intFields( order ), | 125 | intFields( order ), |
125 | enablePainting( true ), | 126 | enablePainting( true ), |
126 | columnVisible( true ), | 127 | columnVisible( true ), |
127 | countNested( 0 ) | 128 | countNested( 0 ) |
128 | { | 129 | { |
129 | //qWarning("C'tor start"); | 130 | //qWarning("C'tor start"); |
130 | 131 | ||
131 | setSelectionMode( NoSelection ); | 132 | setSelectionMode( NoSelection ); |
132 | init(); | 133 | init(); |
133 | setSorting( TRUE ); | 134 | setSorting( TRUE ); |
134 | connect( this, SIGNAL(clicked(int,int,int,const QPoint &)), | 135 | connect( this, SIGNAL(clicked(int,int,int,const QPoint &)), |
135 | this, SLOT(itemClicked(int,int)) ); | 136 | this, SLOT(itemClicked(int,int)) ); |
136 | 137 | ||
137 | contactList.clear(); | 138 | contactList.clear(); |
138 | //qWarning("C'tor end"); | 139 | //qWarning("C'tor end"); |
139 | } | 140 | } |
140 | 141 | ||
141 | AbTable::~AbTable() | 142 | AbTable::~AbTable() |
142 | { | 143 | { |
143 | } | 144 | } |
144 | 145 | ||
145 | void AbTable::init() | 146 | void AbTable::init() |
146 | { | 147 | { |
147 | // :SX showChar = '\0'; | 148 | // :SX showChar = '\0'; |
148 | setNumRows( 0 ); | 149 | setNumRows( 0 ); |
149 | setNumCols( 2 ); | 150 | setNumCols( 2 ); |
150 | 151 | ||
151 | horizontalHeader()->setLabel( 0, tr( "Full Name" )); | 152 | horizontalHeader()->setLabel( 0, tr( "Full Name" )); |
152 | horizontalHeader()->setLabel( 1, tr( "Contact" )); | 153 | horizontalHeader()->setLabel( 1, tr( "Contact" )); |
153 | setLeftMargin( 0 ); | 154 | setLeftMargin( 0 ); |
154 | verticalHeader()->hide(); | 155 | verticalHeader()->hide(); |
155 | columnVisible = true; | 156 | columnVisible = true; |
156 | } | 157 | } |
157 | 158 | ||
158 | void AbTable::setContacts( const OContactAccess::List& viewList ) | 159 | void AbTable::setContacts( const OContactAccess::List& viewList ) |
159 | { | 160 | { |
160 | //qWarning("AbTable::setContacts()"); | 161 | //qWarning("AbTable::setContacts()"); |
161 | 162 | ||
162 | clear(); | 163 | clear(); |
163 | m_viewList = viewList; | 164 | m_viewList = viewList; |
164 | 165 | ||
165 | setSorting( false ); | 166 | setSorting( false ); |
166 | setPaintingEnabled( FALSE ); | 167 | setPaintingEnabled( FALSE ); |
167 | 168 | ||
168 | OContactAccess::List::Iterator it; | 169 | OContactAccess::List::Iterator it; |
169 | setNumRows( m_viewList.count() ); | 170 | setNumRows( m_viewList.count() ); |
170 | int row = 0; | 171 | int row = 0; |
171 | for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) | 172 | for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) |
172 | insertIntoTable( *it, row++ ); | 173 | insertIntoTable( *it, row++ ); |
173 | 174 | ||
174 | setSorting( true ); | 175 | setSorting( true ); |
175 | 176 | ||
176 | resort(); | 177 | resort(); |
177 | 178 | ||
178 | updateVisible(); | 179 | updateVisible(); |
179 | 180 | ||
180 | setPaintingEnabled( TRUE ); | 181 | setPaintingEnabled( TRUE ); |
181 | 182 | ||
182 | } | 183 | } |
183 | 184 | ||
184 | bool AbTable::selectContact( int UID ) | 185 | bool AbTable::selectContact( int UID ) |
185 | { | 186 | { |
186 | //qWarning( "AbTable::selectContact( %d )", UID ); | 187 | //qWarning( "AbTable::selectContact( %d )", UID ); |
187 | int rows = numRows(); | 188 | int rows = numRows(); |
188 | AbTableItem *abi; | 189 | AbTableItem *abi; |
189 | OContact* foundContact = 0l; | 190 | OContact* foundContact = 0l; |
190 | bool found = false; | 191 | bool found = false; |
191 | 192 | ||
192 | setPaintingEnabled( FALSE ); | 193 | setPaintingEnabled( FALSE ); |
193 | for ( int r = 0; r < rows; ++r ) { | 194 | for ( int r = 0; r < rows; ++r ) { |
194 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 195 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
195 | foundContact = &contactList[abi]; | 196 | foundContact = &contactList[abi]; |
196 | if ( foundContact -> uid() == UID ){ | 197 | if ( foundContact -> uid() == UID ){ |
197 | ensureCellVisible( r, 0 ); | 198 | ensureCellVisible( r, 0 ); |
198 | setCurrentCell( r, 0 ); | 199 | setCurrentCell( r, 0 ); |
199 | found = true; | 200 | found = true; |
200 | break; | 201 | break; |
201 | } | 202 | } |
202 | } | 203 | } |
203 | 204 | ||
204 | if ( !found ){ | 205 | if ( !found ){ |
205 | ensureCellVisible( 0,0 ); | 206 | ensureCellVisible( 0,0 ); |
206 | setCurrentCell( 0, 0 ); | 207 | setCurrentCell( 0, 0 ); |
207 | } | 208 | } |
208 | 209 | ||
209 | setPaintingEnabled( TRUE ); | 210 | setPaintingEnabled( TRUE ); |
210 | 211 | ||
211 | return true; | 212 | return true; |
212 | } | 213 | } |
213 | 214 | ||
214 | void AbTable::insertIntoTable( const OContact& cnt, int row ) | 215 | void AbTable::insertIntoTable( const OContact& cnt, int row ) |
215 | { | 216 | { |
216 | //qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); | 217 | //qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); |
217 | QString strName, | 218 | QString strName; |
218 | strContact; | 219 | ContactItem contactItem; |
219 | 220 | ||
220 | strName = findContactName( cnt ); | 221 | strName = findContactName( cnt ); |
221 | strContact = findContactContact( cnt, row ); | 222 | contactItem = findContactContact( cnt, row ); |
222 | 223 | ||
223 | AbTableItem *ati; | 224 | AbTableItem *ati; |
224 | ati = new AbTableItem( this, QTableItem::Never, strName, strContact); | 225 | ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value ); |
225 | contactList.insert( ati, cnt ); | 226 | contactList.insert( ati, cnt ); |
226 | setItem( row, 0, ati ); | 227 | setItem( row, 0, ati ); |
227 | ati = new AbTableItem( this, QTableItem::Never, strContact, strName); | 228 | ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName); |
229 | if ( !contactItem.icon.isNull() ) | ||
230 | ati->setPixmap( contactItem.icon ); | ||
228 | setItem( row, 1, ati ); | 231 | setItem( row, 1, ati ); |
229 | 232 | ||
230 | //### cannot do this; table only has two columns at this point | 233 | //### cannot do this; table only has two columns at this point |
231 | // setItem( row, 2, new AbPickItem( this ) ); | 234 | // setItem( row, 2, new AbPickItem( this ) ); |
232 | 235 | ||
233 | } | 236 | } |
234 | 237 | ||
235 | 238 | ||
236 | 239 | ||
237 | void AbTable::columnClicked( int col ) | 240 | void AbTable::columnClicked( int col ) |
238 | { | 241 | { |
239 | if ( !sorting() ) | 242 | if ( !sorting() ) |
240 | return; | 243 | return; |
241 | 244 | ||
242 | if ( lastSortCol == -1 ) | 245 | if ( lastSortCol == -1 ) |
243 | lastSortCol = col; | 246 | lastSortCol = col; |
244 | 247 | ||
245 | if ( col == lastSortCol ) { | 248 | if ( col == lastSortCol ) { |
246 | asc = !asc; | 249 | asc = !asc; |
247 | } else { | 250 | } else { |
248 | lastSortCol = col; | 251 | lastSortCol = col; |
249 | asc = TRUE; | 252 | asc = TRUE; |
250 | } | 253 | } |
251 | //QMessageBox::information( this, "resort", "columnClicked" ); | 254 | //QMessageBox::information( this, "resort", "columnClicked" ); |
252 | resort(); | 255 | resort(); |
253 | } | 256 | } |
254 | 257 | ||
255 | void AbTable::resort() | 258 | void AbTable::resort() |
256 | { | 259 | { |
257 | //qWarning( "void AbTable::resort()" ); | 260 | //qWarning( "void AbTable::resort()" ); |
258 | setPaintingEnabled( FALSE ); | 261 | setPaintingEnabled( FALSE ); |
259 | if ( sorting() ) { | 262 | if ( sorting() ) { |
260 | if ( lastSortCol == -1 ) | 263 | if ( lastSortCol == -1 ) |
261 | lastSortCol = 0; | 264 | lastSortCol = 0; |
262 | sortColumn( lastSortCol, asc, TRUE ); | 265 | sortColumn( lastSortCol, asc, TRUE ); |
263 | //QMessageBox::information( this, "resort", "resort" ); | 266 | //QMessageBox::information( this, "resort", "resort" ); |
264 | updateVisible(); | 267 | updateVisible(); |
265 | } | 268 | } |
266 | setPaintingEnabled( TRUE ); | 269 | setPaintingEnabled( TRUE ); |
267 | } | 270 | } |
268 | 271 | ||
269 | OContact AbTable::currentEntry() | 272 | OContact AbTable::currentEntry() |
270 | { | 273 | { |
271 | //qWarning( "OContact AbTable::currentEntry()" ); | 274 | //qWarning( "OContact AbTable::currentEntry()" ); |
272 | OContact cnt; | 275 | OContact cnt; |
273 | AbTableItem *abItem; | 276 | AbTableItem *abItem; |
274 | abItem = static_cast<AbTableItem*>(item( currentRow(), 0 )); | 277 | abItem = static_cast<AbTableItem*>(item( currentRow(), 0 )); |
275 | if ( abItem ) { | 278 | if ( abItem ) { |
276 | cnt = contactList[abItem]; | 279 | cnt = contactList[abItem]; |
277 | //cnt = contactList[currentRow()]; | 280 | //cnt = contactList[currentRow()]; |
278 | } | 281 | } |
279 | return cnt; | 282 | return cnt; |
280 | } | 283 | } |
281 | 284 | ||
282 | int AbTable::currentEntry_UID() | 285 | int AbTable::currentEntry_UID() |
283 | { | 286 | { |
284 | return ( currentEntry().uid() ); | 287 | return ( currentEntry().uid() ); |
285 | } | 288 | } |
286 | 289 | ||
287 | void AbTable::clear() | 290 | void AbTable::clear() |
288 | { | 291 | { |
289 | //qWarning( "void AbTable::clear()" ); | 292 | //qWarning( "void AbTable::clear()" ); |
290 | contactList.clear(); | 293 | contactList.clear(); |
291 | 294 | ||
292 | setPaintingEnabled( FALSE ); | 295 | setPaintingEnabled( FALSE ); |
293 | for ( int r = 0; r < numRows(); ++r ) { | 296 | for ( int r = 0; r < numRows(); ++r ) { |
294 | for ( int c = 0; c < numCols(); ++c ) { | 297 | for ( int c = 0; c < numCols(); ++c ) { |
295 | if ( cellWidget( r, c ) ) | 298 | if ( cellWidget( r, c ) ) |
296 | clearCellWidget( r, c ); | 299 | clearCellWidget( r, c ); |
297 | clearCell( r, c ); | 300 | clearCell( r, c ); |
298 | } | 301 | } |
299 | } | 302 | } |
300 | setNumRows( 0 ); | 303 | setNumRows( 0 ); |
301 | setPaintingEnabled( TRUE ); | 304 | setPaintingEnabled( TRUE ); |
302 | } | 305 | } |
303 | 306 | ||
304 | // Refresh updates column 2 if the contactsettings changed | 307 | // Refresh updates column 2 if the contactsettings changed |
305 | void AbTable::refresh() | 308 | void AbTable::refresh() |
306 | { | 309 | { |
307 | //qWarning( "void AbTable::refresh()" ); | 310 | //qWarning( "void AbTable::refresh()" ); |
308 | int rows = numRows(); | 311 | int rows = numRows(); |
309 | QString value; | ||
310 | AbTableItem *abi; | 312 | AbTableItem *abi; |
313 | ContactItem contactItem; | ||
311 | 314 | ||
312 | setPaintingEnabled( FALSE ); | 315 | setPaintingEnabled( FALSE ); |
313 | for ( int r = 0; r < rows; ++r ) { | 316 | for ( int r = 0; r < rows; ++r ) { |
314 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 317 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
315 | value = findContactContact( contactList[abi], r ); | 318 | contactItem = findContactContact( contactList[abi], r ); |
316 | static_cast<AbTableItem*>( item(r, 1) )->setItem( value, abi->text() ); | 319 | static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() ); |
320 | if ( !contactItem.icon.isNull() ) | ||
321 | static_cast<AbTableItem*>( item(r, 1) )-> | ||
322 | setPixmap( contactItem.icon ); | ||
323 | |||
317 | } | 324 | } |
318 | resort(); | 325 | resort(); |
319 | setPaintingEnabled( TRUE ); | 326 | setPaintingEnabled( TRUE ); |
320 | } | 327 | } |
321 | 328 | ||
322 | void AbTable::keyPressEvent( QKeyEvent *e ) | 329 | void AbTable::keyPressEvent( QKeyEvent *e ) |
323 | { | 330 | { |
324 | char key = toupper( e->ascii() ); | 331 | char key = toupper( e->ascii() ); |
325 | 332 | ||
326 | if ( key >= 'A' && key <= 'Z' ) | 333 | if ( key >= 'A' && key <= 'Z' ) |
327 | moveTo( key ); | 334 | moveTo( key ); |
328 | 335 | ||
329 | //qWarning("Received key .."); | 336 | //qWarning("Received key .."); |
330 | switch( e->key() ) { | 337 | switch( e->key() ) { |
331 | case Qt::Key_Space: | 338 | case Qt::Key_Space: |
332 | case Qt::Key_Return: | 339 | case Qt::Key_Return: |
333 | case Qt::Key_Enter: | 340 | case Qt::Key_Enter: |
334 | emit signalSwitch(); | 341 | emit signalSwitch(); |
335 | break; | 342 | break; |
336 | // case Qt::Key_Up: | 343 | // case Qt::Key_Up: |
337 | // qWarning("a"); | 344 | // qWarning("a"); |
338 | // emit signalKeyUp(); | 345 | // emit signalKeyUp(); |
339 | // break; | 346 | // break; |
340 | // case Qt::Key_Down: | 347 | // case Qt::Key_Down: |
341 | // qWarning("b"); | 348 | // qWarning("b"); |
342 | // emit signalKeyDown(); | 349 | // emit signalKeyDown(); |
343 | // break; | 350 | // break; |
344 | default: | 351 | default: |
345 | QTable::keyPressEvent( e ); | 352 | QTable::keyPressEvent( e ); |
346 | } | 353 | } |
347 | 354 | ||
348 | } | 355 | } |
349 | 356 | ||
350 | void AbTable::moveTo( char c ) | 357 | void AbTable::moveTo( char c ) |
351 | { | 358 | { |
352 | qWarning( "void AbTable::moveTo( char c )" ); | 359 | qWarning( "void AbTable::moveTo( char c )" ); |
353 | 360 | ||
354 | int rows = numRows(); | 361 | int rows = numRows(); |
355 | QString value; | 362 | QString value; |
356 | AbTableItem *abi; | 363 | AbTableItem *abi; |
357 | int r; | 364 | int r; |
358 | if ( asc ) { | 365 | if ( asc ) { |
359 | r = 0; | 366 | r = 0; |
360 | while ( r < rows-1) { | 367 | while ( r < rows-1) { |
361 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 368 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
362 | QChar first = abi->key()[0]; | 369 | QChar first = abi->key()[0]; |
363 | //### is there a bug in QChar to char comparison??? | 370 | //### is there a bug in QChar to char comparison??? |
364 | if ( first.row() || first.cell() >= c ) | 371 | if ( first.row() || first.cell() >= c ) |
365 | break; | 372 | break; |
366 | r++; | 373 | r++; |
367 | } | 374 | } |
368 | } else { | 375 | } else { |
369 | //### should probably disable reverse sorting instead | 376 | //### should probably disable reverse sorting instead |
370 | r = rows - 1; | 377 | r = rows - 1; |
371 | while ( r > 0 ) { | 378 | while ( r > 0 ) { |
372 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 379 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
373 | QChar first = abi->key()[0]; | 380 | QChar first = abi->key()[0]; |
374 | //### is there a bug in QChar to char comparison??? | 381 | //### is there a bug in QChar to char comparison??? |
375 | if ( first.row() || first.cell() >= c ) | 382 | if ( first.row() || first.cell() >= c ) |
376 | break; | 383 | break; |
377 | r--; | 384 | r--; |
378 | } | 385 | } |
379 | } | 386 | } |
380 | setCurrentCell( r, currentColumn() ); | 387 | setCurrentCell( r, currentColumn() ); |
381 | } | 388 | } |
382 | 389 | ||
383 | 390 | ||
384 | QString AbTable::findContactName( const OContact &entry ) | 391 | QString AbTable::findContactName( const OContact &entry ) |
385 | { | 392 | { |
386 | // We use the fileAs, then company, defaultEmail | 393 | // We use the fileAs, then company, defaultEmail |
387 | QString str; | 394 | QString str; |
388 | str = entry.fileAs(); | 395 | str = entry.fileAs(); |
389 | if ( str.isEmpty() ) { | 396 | if ( str.isEmpty() ) { |
390 | str = entry.company(); | 397 | str = entry.company(); |
391 | if ( str.isEmpty() ) { | 398 | if ( str.isEmpty() ) { |
392 | str = entry.defaultEmail(); | 399 | str = entry.defaultEmail(); |
393 | } | 400 | } |
394 | } | 401 | } |
395 | return str; | 402 | return str; |
396 | } | 403 | } |
397 | 404 | ||
398 | 405 | ||
399 | 406 | ||
400 | void AbTable::resizeRows() { | 407 | void AbTable::resizeRows() { |
401 | /* | 408 | /* |
402 | if (numRows()) { | 409 | if (numRows()) { |
403 | for (int i = 0; i < numRows(); i++) { | 410 | for (int i = 0; i < numRows(); i++) { |
404 | setRowHeight( i, size ); | 411 | setRowHeight( i, size ); |
405 | } | 412 | } |
406 | } | 413 | } |
407 | updateVisible(); | 414 | updateVisible(); |
408 | */ | 415 | */ |
409 | } | 416 | } |
410 | 417 | ||
411 | 418 | ||
412 | void AbTable::realignTable() | 419 | void AbTable::realignTable() |
413 | { | 420 | { |
414 | //qWarning( "void AbTable::realignTable()" ); | 421 | //qWarning( "void AbTable::realignTable()" ); |
415 | 422 | ||
416 | setPaintingEnabled( FALSE ); | 423 | setPaintingEnabled( FALSE ); |
417 | 424 | ||
418 | resizeRows(); | 425 | resizeRows(); |
419 | fitColumns(); | 426 | fitColumns(); |
420 | 427 | ||
421 | setPaintingEnabled( TRUE ); | 428 | setPaintingEnabled( TRUE ); |
422 | 429 | ||
423 | } | 430 | } |
424 | 431 | ||
425 | 432 | ||
426 | 433 | ||
427 | 434 | ||
428 | #if QT_VERSION <= 230 | 435 | #if QT_VERSION <= 230 |
429 | #ifndef SINGLE_APP | 436 | #ifndef SINGLE_APP |
430 | void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) | 437 | void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) |
431 | { | 438 | { |
432 | // Region of the rect we should draw | 439 | // Region of the rect we should draw |
433 | QRegion reg( QRect( cx, cy, cw, ch ) ); | 440 | QRegion reg( QRect( cx, cy, cw, ch ) ); |
434 | // Subtract the table from it | 441 | // Subtract the table from it |
435 | reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); | 442 | reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); |
436 | // And draw the rectangles (transformed as needed) | 443 | // And draw the rectangles (transformed as needed) |
437 | QArray<QRect> r = reg.rects(); | 444 | QArray<QRect> r = reg.rects(); |
438 | for (unsigned int i=0; i<r.count(); i++) | 445 | for (unsigned int i=0; i<r.count(); i++) |
439 | p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); | 446 | p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); |
440 | } | 447 | } |
441 | #endif | 448 | #endif |
442 | #endif | 449 | #endif |
443 | 450 | ||
444 | 451 | ||
445 | // int AbTable::rowHeight( int ) const | 452 | // int AbTable::rowHeight( int ) const |
446 | // { | 453 | // { |
447 | // return 18; | 454 | // return 18; |
448 | // } | 455 | // } |
449 | 456 | ||
450 | // int AbTable::rowPos( int row ) const | 457 | // int AbTable::rowPos( int row ) const |
451 | // { | 458 | // { |
452 | // return 18*row; | 459 | // return 18*row; |
453 | // } | 460 | // } |
454 | 461 | ||
455 | // int AbTable::rowAt( int pos ) const | 462 | // int AbTable::rowAt( int pos ) const |
456 | // { | 463 | // { |
457 | // return QMIN( pos/18, numRows()-1 ); | 464 | // return QMIN( pos/18, numRows()-1 ); |
458 | // } | 465 | // } |
459 | 466 | ||
460 | 467 | ||
461 | 468 | ||
462 | void AbTable::fitColumns() | 469 | void AbTable::fitColumns() |
463 | { | 470 | { |
464 | //qWarning( "void AbTable::fitColumns()" ); | 471 | //qWarning( "void AbTable::fitColumns()" ); |
465 | int contentsWidth = visibleWidth() / 2; // :SX Why too low | 472 | int contentsWidth = visibleWidth() / 2; // :SX Why too low |
466 | // Fix to better value | 473 | // Fix to better value |
467 | // contentsWidth = 130; | 474 | // contentsWidth = 130; |
468 | 475 | ||
469 | setPaintingEnabled( FALSE ); | 476 | setPaintingEnabled( FALSE ); |
470 | 477 | ||
471 | if ( columnVisible == false ){ | 478 | if ( columnVisible == false ){ |
472 | showColumn(0); | 479 | showColumn(0); |
473 | columnVisible = true; | 480 | columnVisible = true; |
474 | } | 481 | } |
475 | 482 | ||
476 | //qWarning("Width: %d", contentsWidth); | 483 | //qWarning("Width: %d", contentsWidth); |
477 | 484 | ||
478 | setColumnWidth( 0, contentsWidth ); | 485 | setColumnWidth( 0, contentsWidth ); |
479 | adjustColumn(1); | 486 | adjustColumn(1); |
480 | if ( columnWidth(1) < contentsWidth ) | 487 | if ( columnWidth(1) < contentsWidth ) |
481 | setColumnWidth( 1, contentsWidth ); | 488 | setColumnWidth( 1, contentsWidth ); |
482 | 489 | ||
483 | setPaintingEnabled( TRUE ); | 490 | setPaintingEnabled( TRUE ); |
484 | } | 491 | } |
485 | 492 | ||
486 | void AbTable::show() | 493 | void AbTable::show() |
487 | { | 494 | { |
488 | //qWarning( "void AbTable::show()" ); | 495 | //qWarning( "void AbTable::show()" ); |
489 | realignTable(); | 496 | realignTable(); |
490 | QTable::show(); | 497 | QTable::show(); |
491 | } | 498 | } |
492 | 499 | ||
493 | void AbTable::setChoiceNames( const QStringList& list) | 500 | void AbTable::setChoiceNames( const QStringList& list) |
494 | { | 501 | { |
495 | choicenames = list; | 502 | choicenames = list; |
496 | if ( choicenames.isEmpty() ) { | 503 | if ( choicenames.isEmpty() ) { |
497 | // hide pick column | 504 | // hide pick column |
498 | setNumCols( 2 ); | 505 | setNumCols( 2 ); |
499 | } else { | 506 | } else { |
500 | // show pick column | 507 | // show pick column |
501 | setNumCols( 3 ); | 508 | setNumCols( 3 ); |
502 | setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); | 509 | setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); |
503 | horizontalHeader()->setLabel( 2, tr( "Pick" )); | 510 | horizontalHeader()->setLabel( 2, tr( "Pick" )); |
504 | } | 511 | } |
505 | fitColumns(); | 512 | fitColumns(); |
506 | } | 513 | } |
507 | 514 | ||
508 | void AbTable::itemClicked(int,int col) | 515 | void AbTable::itemClicked(int,int col) |
509 | { | 516 | { |
510 | //qWarning( "AbTable::itemClicked(int, col:%d)", col); | 517 | //qWarning( "AbTable::itemClicked(int, col:%d)", col); |
511 | if ( col == 2 ) { | 518 | if ( col == 2 ) { |
512 | return; | 519 | return; |
513 | } else { | 520 | } else { |
514 | // qWarning ("Emitting signalSwitch()"); | 521 | // qWarning ("Emitting signalSwitch()"); |
515 | emit signalSwitch(); | 522 | emit signalSwitch(); |
516 | } | 523 | } |
517 | } | 524 | } |
518 | 525 | ||
519 | QStringList AbTable::choiceNames() const | 526 | QStringList AbTable::choiceNames() const |
520 | { | 527 | { |
521 | return choicenames; | 528 | return choicenames; |
522 | } | 529 | } |
523 | 530 | ||
524 | void AbTable::setChoiceSelection( const QValueList<int>& list ) | 531 | void AbTable::setChoiceSelection( const QValueList<int>& list ) |
525 | { | 532 | { |
526 | intFields = list; | 533 | intFields = list; |
527 | } | 534 | } |
528 | 535 | ||
529 | QStringList AbTable::choiceSelection(int /*index*/) const | 536 | QStringList AbTable::choiceSelection(int /*index*/) const |
530 | { | 537 | { |
531 | QStringList r; | 538 | QStringList r; |
532 | /* ###### | 539 | /* ###### |
533 | 540 | ||
534 | QString selname = choicenames.at(index); | 541 | QString selname = choicenames.at(index); |
535 | for (each row) { | 542 | for (each row) { |
536 | OContact *c = contactForRow(row); | 543 | OContact *c = contactForRow(row); |
537 | if ( text(row,2) == selname ) { | 544 | if ( text(row,2) == selname ) { |
538 | r.append(c->email); | 545 | r.append(c->email); |
539 | } | 546 | } |
540 | } | 547 | } |
541 | 548 | ||
542 | */ | 549 | */ |
543 | return r; | 550 | return r; |
544 | } | 551 | } |
545 | 552 | ||
546 | 553 | ||
547 | 554 | ||
548 | 555 | ||
549 | void AbTable::updateVisible() | 556 | void AbTable::updateVisible() |
550 | { | 557 | { |
551 | //qWarning("void AbTable::updateVisible()"); | 558 | //qWarning("void AbTable::updateVisible()"); |
552 | 559 | ||
553 | int visible, | 560 | int visible, |
554 | totalRows, | 561 | totalRows, |
555 | row, | 562 | row, |
556 | selectedRow = 0; | 563 | selectedRow = 0; |
557 | 564 | ||
558 | visible = 0; | 565 | visible = 0; |
559 | 566 | ||
560 | setPaintingEnabled( FALSE ); | 567 | setPaintingEnabled( FALSE ); |
561 | 568 | ||
562 | realignTable(); | 569 | realignTable(); |
563 | 570 | ||
564 | totalRows = numRows(); | 571 | totalRows = numRows(); |
565 | for ( row = 0; row < totalRows; row++ ) { | 572 | for ( row = 0; row < totalRows; row++ ) { |
566 | if ( rowHeight(row) == 0 ) { | 573 | if ( rowHeight(row) == 0 ) { |
567 | showRow( row ); | 574 | showRow( row ); |
568 | adjustRow( row ); | 575 | adjustRow( row ); |
569 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) | 576 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) |
570 | selectedRow = row; | 577 | selectedRow = row; |
571 | } | 578 | } |
572 | visible++; | 579 | visible++; |
573 | } | 580 | } |
574 | 581 | ||
575 | if ( selectedRow ) | 582 | if ( selectedRow ) |
576 | setCurrentCell( selectedRow, 0 ); | 583 | setCurrentCell( selectedRow, 0 ); |
577 | 584 | ||
578 | if ( !visible ) | 585 | if ( !visible ) |
579 | setCurrentCell( -1, 0 ); | 586 | setCurrentCell( -1, 0 ); |
580 | 587 | ||
581 | setPaintingEnabled( TRUE ); | 588 | setPaintingEnabled( TRUE ); |
582 | 589 | ||
583 | 590 | ||
584 | } | 591 | } |
585 | 592 | ||
586 | 593 | ||
587 | void AbTable::setPaintingEnabled( bool e ) | 594 | void AbTable::setPaintingEnabled( bool e ) |
588 | { | 595 | { |
589 | //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); | 596 | //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); |
590 | 597 | ||
591 | if ( e ) { | 598 | if ( e ) { |
592 | if ( countNested > 0 ) | 599 | if ( countNested > 0 ) |
593 | --countNested; | 600 | --countNested; |
594 | if ( ! countNested ){ | 601 | if ( ! countNested ){ |
595 | setUpdatesEnabled( true ); | 602 | setUpdatesEnabled( true ); |
596 | enablePainting = true; | 603 | enablePainting = true; |
597 | rowHeightChanged( 0 ); | 604 | rowHeightChanged( 0 ); |
598 | viewport()->update(); | 605 | viewport()->update(); |
599 | } | 606 | } |
600 | } else { | 607 | } else { |
601 | ++countNested; | 608 | ++countNested; |
602 | enablePainting = false; | 609 | enablePainting = false; |
603 | setUpdatesEnabled( false ); | 610 | setUpdatesEnabled( false ); |
604 | } | 611 | } |
605 | //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); | 612 | //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); |
606 | } | 613 | } |
607 | 614 | ||
608 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { | 615 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { |
609 | //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); | 616 | //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); |
610 | if ( enablePainting ) | 617 | if ( enablePainting ) |
611 | QTable::viewportPaintEvent( e ); | 618 | QTable::viewportPaintEvent( e ); |
612 | } | 619 | } |
613 | 620 | ||
614 | 621 | ||
615 | 622 | ||
616 | void AbTable::rowHeightChanged( int row ) | 623 | void AbTable::rowHeightChanged( int row ) |
617 | { | 624 | { |
618 | if ( enablePainting ) | 625 | if ( enablePainting ) |
619 | QTable::rowHeightChanged( row ); | 626 | QTable::rowHeightChanged( row ); |
620 | } | 627 | } |
621 | QString AbTable::findContactContact( const OContact &entry, int /* row */ ) | 628 | ContactItem AbTable::findContactContact( const OContact &entry, int /* row */ ) |
622 | { | 629 | { |
623 | QString value; | 630 | |
624 | value = ""; | 631 | ContactItem item; |
632 | |||
633 | item.value = ""; | ||
634 | |||
625 | for ( QValueList<int>::ConstIterator it = intFields.begin(); | 635 | for ( QValueList<int>::ConstIterator it = intFields.begin(); |
626 | it != intFields.end(); ++it ) { | 636 | it != intFields.end(); ++it ) { |
627 | switch ( *it ) { | 637 | switch ( *it ) { |
628 | default: | 638 | default: |
629 | break; | 639 | break; |
630 | case Qtopia::Title: | 640 | case Qtopia::Title: |
631 | value = entry.title(); | 641 | item.value = entry.title(); |
632 | break; | 642 | break; |
633 | case Qtopia::Suffix: | 643 | case Qtopia::Suffix: |
634 | value = entry.suffix(); | 644 | item.value = entry.suffix(); |
635 | break; | 645 | break; |
636 | case Qtopia::FileAs: | 646 | case Qtopia::FileAs: |
637 | value = entry.fileAs(); | 647 | item.value = entry.fileAs(); |
638 | break; | 648 | break; |
639 | case Qtopia::DefaultEmail: | 649 | case Qtopia::DefaultEmail: |
640 | value = entry.defaultEmail(); | 650 | item.value = entry.defaultEmail(); |
651 | if ( !item.value.isEmpty() ) | ||
652 | item.icon = Resource::loadPixmap( "addressbook/email" ); | ||
653 | break; | ||
641 | case Qtopia::Emails: | 654 | case Qtopia::Emails: |
642 | value = entry.emails(); | 655 | item.value = entry.emails(); |
656 | if ( !item.value.isEmpty() ) | ||
657 | item.icon = Resource::loadPixmap( "addressbook/email" ); | ||
643 | break; | 658 | break; |
644 | case Qtopia::HomeStreet: | 659 | case Qtopia::HomeStreet: |
645 | value = entry.homeStreet(); | 660 | item.value = entry.homeStreet(); |
646 | break; | 661 | break; |
647 | case Qtopia::HomeCity: | 662 | case Qtopia::HomeCity: |
648 | value = entry.homeCity(); | 663 | item.value = entry.homeCity(); |
649 | break; | 664 | break; |
650 | case Qtopia::HomeState: | 665 | case Qtopia::HomeState: |
651 | value = entry.homeState(); | 666 | item.value = entry.homeState(); |
652 | break; | 667 | break; |
653 | case Qtopia::HomeZip: | 668 | case Qtopia::HomeZip: |
654 | value = entry.homeZip(); | 669 | item.value = entry.homeZip(); |
655 | break; | 670 | break; |
656 | case Qtopia::HomeCountry: | 671 | case Qtopia::HomeCountry: |
657 | value = entry.homeCountry(); | 672 | item.value = entry.homeCountry(); |
658 | break; | 673 | break; |
659 | case Qtopia::HomePhone: | 674 | case Qtopia::HomePhone: |
660 | value = entry.homePhone(); | 675 | item.value = entry.homePhone(); |
676 | if ( !item.value.isEmpty() ) | ||
677 | item.icon = Resource::loadPixmap( "addressbook/phonehome" ); | ||
661 | break; | 678 | break; |
662 | case Qtopia::HomeFax: | 679 | case Qtopia::HomeFax: |
663 | value = entry.homeFax(); | 680 | item.value = entry.homeFax(); |
681 | if ( !item.value.isEmpty() ) | ||
682 | item.icon = Resource::loadPixmap( "addressbook/faxhome" ); | ||
664 | break; | 683 | break; |
665 | case Qtopia::HomeMobile: | 684 | case Qtopia::HomeMobile: |
666 | value = entry.homeMobile(); | 685 | item.value = entry.homeMobile(); |
686 | if ( !item.value.isEmpty() ) | ||
687 | item.icon = Resource::loadPixmap( "addressbook/mobilehome" ); | ||
667 | break; | 688 | break; |
668 | case Qtopia::HomeWebPage: | 689 | case Qtopia::HomeWebPage: |
669 | value = entry.homeWebpage(); | 690 | item.value = entry.homeWebpage(); |
691 | if ( !item.value.isEmpty() ) | ||
692 | item.icon = Resource::loadPixmap( "addressbook/webpagehome" ); | ||
670 | break; | 693 | break; |
671 | case Qtopia::Company: | 694 | case Qtopia::Company: |
672 | value = entry.company(); | 695 | item.value = entry.company(); |
673 | break; | 696 | break; |
674 | case Qtopia::BusinessCity: | 697 | case Qtopia::BusinessCity: |
675 | value = entry.businessCity(); | 698 | item.value = entry.businessCity(); |
676 | break; | 699 | break; |
677 | case Qtopia::BusinessStreet: | 700 | case Qtopia::BusinessStreet: |
678 | value = entry.businessStreet(); | 701 | item.value = entry.businessStreet(); |
679 | break; | 702 | break; |
680 | case Qtopia::BusinessZip: | 703 | case Qtopia::BusinessZip: |
681 | value = entry.businessZip(); | 704 | item.value = entry.businessZip(); |
682 | break; | 705 | break; |
683 | case Qtopia::BusinessCountry: | 706 | case Qtopia::BusinessCountry: |
684 | value = entry.businessCountry(); | 707 | item.value = entry.businessCountry(); |
685 | break; | 708 | break; |
686 | case Qtopia::BusinessWebPage: | 709 | case Qtopia::BusinessWebPage: |
687 | value = entry.businessWebpage(); | 710 | item.value = entry.businessWebpage(); |
711 | if ( !item.value.isEmpty() ) | ||
712 | item.icon = Resource::loadPixmap( "addressbook/webpagework" ); | ||
688 | break; | 713 | break; |
689 | case Qtopia::JobTitle: | 714 | case Qtopia::JobTitle: |
690 | value = entry.jobTitle(); | 715 | item.value = entry.jobTitle(); |
691 | break; | 716 | break; |
692 | case Qtopia::Department: | 717 | case Qtopia::Department: |
693 | value = entry.department(); | 718 | item.value = entry.department(); |
694 | break; | 719 | break; |
695 | case Qtopia::Office: | 720 | case Qtopia::Office: |
696 | value = entry.office(); | 721 | item.value = entry.office(); |
697 | break; | 722 | break; |
698 | case Qtopia::BusinessPhone: | 723 | case Qtopia::BusinessPhone: |
699 | value = entry.businessPhone(); | 724 | item.value = entry.businessPhone(); |
725 | if ( !item.value.isEmpty() ) | ||
726 | item.icon = Resource::loadPixmap( "addressbook/phonework" ); | ||
700 | break; | 727 | break; |
701 | case Qtopia::BusinessFax: | 728 | case Qtopia::BusinessFax: |
702 | value = entry.businessFax(); | 729 | item.value = entry.businessFax(); |
730 | if ( !item.value.isEmpty() ) | ||
731 | item.icon = Resource::loadPixmap( "addressbook/faxwork" ); | ||
703 | break; | 732 | break; |
704 | case Qtopia::BusinessMobile: | 733 | case Qtopia::BusinessMobile: |
705 | value = entry.businessMobile(); | 734 | item.value = entry.businessMobile(); |
735 | if ( !item.value.isEmpty() ) | ||
736 | item.icon = Resource::loadPixmap( "addressbook/mobilework" ); | ||
706 | break; | 737 | break; |
707 | case Qtopia::BusinessPager: | 738 | case Qtopia::BusinessPager: |
708 | value = entry.businessPager(); | 739 | item.value = entry.businessPager(); |
709 | break; | 740 | break; |
710 | case Qtopia::Profession: | 741 | case Qtopia::Profession: |
711 | value = entry.profession(); | 742 | item.value = entry.profession(); |
712 | break; | 743 | break; |
713 | case Qtopia::Assistant: | 744 | case Qtopia::Assistant: |
714 | value = entry.assistant(); | 745 | item.value = entry.assistant(); |
715 | break; | 746 | break; |
716 | case Qtopia::Manager: | 747 | case Qtopia::Manager: |
717 | value = entry.manager(); | 748 | item.value = entry.manager(); |
718 | break; | 749 | break; |
719 | case Qtopia::Spouse: | 750 | case Qtopia::Spouse: |
720 | value = entry.spouse(); | 751 | item.value = entry.spouse(); |
721 | break; | 752 | break; |
722 | case Qtopia::Gender: | 753 | case Qtopia::Gender: |
723 | value = entry.gender(); | 754 | item.value = entry.gender(); |
724 | break; | 755 | break; |
725 | case Qtopia::Birthday: | 756 | case Qtopia::Birthday: |
726 | if ( ! entry.birthday().isNull() ) | 757 | if ( ! entry.birthday().isNull() ){ |
727 | value = TimeString::numberDateString( entry.birthday() ); | 758 | item.value = TimeString::numberDateString( entry.birthday() ); |
759 | } | ||
728 | break; | 760 | break; |
729 | case Qtopia::Anniversary: | 761 | case Qtopia::Anniversary: |
730 | if ( ! entry.anniversary().isNull() ) | 762 | if ( ! entry.anniversary().isNull() ){ |
731 | value = TimeString::numberDateString( entry.anniversary() ); | 763 | item.value = TimeString::numberDateString( entry.anniversary() ); |
764 | } | ||
732 | break; | 765 | break; |
733 | case Qtopia::Nickname: | 766 | case Qtopia::Nickname: |
734 | value = entry.nickname(); | 767 | item.value = entry.nickname(); |
735 | break; | 768 | break; |
736 | case Qtopia::Children: | 769 | case Qtopia::Children: |
737 | value = entry.children(); | 770 | item.value = entry.children(); |
738 | break; | 771 | break; |
739 | case Qtopia::Notes: | 772 | case Qtopia::Notes: |
740 | value = entry.notes(); | 773 | item.value = entry.notes(); |
741 | break; | 774 | break; |
742 | } | 775 | } |
743 | if ( !value.isEmpty() ) | 776 | if ( !item.value.isEmpty() ) |
744 | break; | 777 | break; |
745 | } | 778 | } |
746 | return value; | 779 | return item; |
747 | } | 780 | } |
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h index 9825665..092e86f 100644 --- a/core/pim/addressbook/abtable.h +++ b/core/pim/addressbook/abtable.h | |||
@@ -1,137 +1,147 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) | 3 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) |
4 | ** | 4 | ** |
5 | ** This file is part of Qt Palmtop Environment. | 5 | ** This file is part of Qt 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 | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging 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 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | #ifndef ABTABLE_H | 22 | #ifndef ABTABLE_H |
23 | #define ABTABLE_H | 23 | #define ABTABLE_H |
24 | 24 | ||
25 | #include <qpe/categories.h> | 25 | #include <qpe/categories.h> |
26 | #include <opie/ocontact.h> | 26 | #include <opie/ocontact.h> |
27 | #include <opie/ocontactaccess.h> | 27 | #include <opie/ocontactaccess.h> |
28 | 28 | ||
29 | #include <qmap.h> | 29 | #include <qmap.h> |
30 | #include <qtable.h> | 30 | #include <qtable.h> |
31 | #include <qstringlist.h> | 31 | #include <qstringlist.h> |
32 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
33 | #include <qpixmap.h> | ||
33 | 34 | ||
34 | class AbTableItem : public QTableItem | 35 | class AbTableItem : public QTableItem |
35 | { | 36 | { |
36 | public: | 37 | public: |
37 | AbTableItem( QTable *t, EditType et, const QString &s, | 38 | AbTableItem( QTable *t, EditType et, const QString &s, |
38 | const QString &secondSortKey); | 39 | const QString &secondSortKey); |
39 | QString entryKey() const; | 40 | QString entryKey() const; |
40 | void setEntryKey( const QString & k ); | 41 | void setEntryKey( const QString & k ); |
41 | virtual int alignment() const; | 42 | virtual int alignment() const; |
42 | virtual QString key() const; | 43 | virtual QString key() const; |
43 | void setItem( const QString &txt, const QString &secondKey ); | 44 | void setItem( const QString &txt, const QString &secondKey ); |
44 | 45 | ||
45 | private: | 46 | private: |
46 | QString sortKey; | 47 | QString sortKey; |
47 | }; | 48 | }; |
48 | 49 | ||
50 | // This is a simple container, storing all contact | ||
51 | // information | ||
52 | class ContactItem | ||
53 | { | ||
54 | public: | ||
55 | QPixmap icon; | ||
56 | QString value; | ||
57 | }; | ||
58 | |||
49 | class AbPickItem : public QTableItem | 59 | class AbPickItem : public QTableItem |
50 | { | 60 | { |
51 | public: | 61 | public: |
52 | AbPickItem( QTable *t ); | 62 | AbPickItem( QTable *t ); |
53 | 63 | ||
54 | QWidget *createEditor() const; | 64 | QWidget *createEditor() const; |
55 | void setContentFromEditor( QWidget *w ); | 65 | void setContentFromEditor( QWidget *w ); |
56 | 66 | ||
57 | private: | 67 | private: |
58 | QGuardedPtr<QComboBox> cb; | 68 | QGuardedPtr<QComboBox> cb; |
59 | }; | 69 | }; |
60 | 70 | ||
61 | class AbTable : public QTable | 71 | class AbTable : public QTable |
62 | { | 72 | { |
63 | Q_OBJECT | 73 | Q_OBJECT |
64 | 74 | ||
65 | public: | 75 | public: |
66 | AbTable( const QValueList<int> ordered, QWidget *parent, const char *name=0 ); | 76 | AbTable( const QValueList<int> ordered, QWidget *parent, const char *name=0 ); |
67 | ~AbTable(); | 77 | ~AbTable(); |
68 | 78 | ||
69 | // Set the contacts shown in the table | 79 | // Set the contacts shown in the table |
70 | void setContacts( const OContactAccess::List& viewList ); | 80 | void setContacts( const OContactAccess::List& viewList ); |
71 | // Selects a contact of a specific UID | 81 | // Selects a contact of a specific UID |
72 | bool selectContact( int UID ); | 82 | bool selectContact( int UID ); |
73 | 83 | ||
74 | // Get the current selected entry | 84 | // Get the current selected entry |
75 | OContact currentEntry(); | 85 | OContact currentEntry(); |
76 | 86 | ||
77 | // Get the UID of the current selected Entry | 87 | // Get the UID of the current selected Entry |
78 | int currentEntry_UID(); | 88 | int currentEntry_UID(); |
79 | 89 | ||
80 | QString findContactName( const OContact &entry ); | 90 | QString findContactName( const OContact &entry ); |
81 | 91 | ||
82 | void init(); | 92 | void init(); |
83 | void clear(); | 93 | void clear(); |
84 | void refresh(); | 94 | void refresh(); |
85 | 95 | ||
86 | void show(); | 96 | void show(); |
87 | void setPaintingEnabled( bool e ); | 97 | void setPaintingEnabled( bool e ); |
88 | void viewportPaintEvent( QPaintEvent* e); | 98 | void viewportPaintEvent( QPaintEvent* e); |
89 | 99 | ||
90 | // addresspicker mode (What's that ? se) | 100 | // addresspicker mode (What's that ? se) |
91 | void setChoiceNames( const QStringList& list); | 101 | void setChoiceNames( const QStringList& list); |
92 | QStringList choiceNames() const; | 102 | QStringList choiceNames() const; |
93 | void setChoiceSelection( const QValueList<int>& list ); | 103 | void setChoiceSelection( const QValueList<int>& list ); |
94 | QStringList choiceSelection(int index) const; | 104 | QStringList choiceSelection(int index) const; |
95 | 105 | ||
96 | signals: | 106 | signals: |
97 | void signalSwitch(); | 107 | void signalSwitch(); |
98 | void signalEditor(); | 108 | void signalEditor(); |
99 | void signalKeyDown(); | 109 | void signalKeyDown(); |
100 | void signalKeyUp(); | 110 | void signalKeyUp(); |
101 | 111 | ||
102 | protected: | 112 | protected: |
103 | virtual void keyPressEvent( QKeyEvent *e ); | 113 | virtual void keyPressEvent( QKeyEvent *e ); |
104 | 114 | ||
105 | // int rowHeight( int ) const; | 115 | // int rowHeight( int ) const; |
106 | // int rowPos( int row ) const; | 116 | // int rowPos( int row ) const; |
107 | // virtual int rowAt( int pos ) const; | 117 | // virtual int rowAt( int pos ) const; |
108 | 118 | ||
109 | 119 | ||
110 | protected slots: | 120 | protected slots: |
111 | void moveTo( char ); | 121 | void moveTo( char ); |
112 | virtual void columnClicked( int col ); | 122 | virtual void columnClicked( int col ); |
113 | void itemClicked(int,int col); | 123 | void itemClicked(int,int col); |
114 | void rowHeightChanged( int row ); | 124 | void rowHeightChanged( int row ); |
115 | 125 | ||
116 | private: | 126 | private: |
117 | void insertIntoTable( const OContact &cnt, int row ); | 127 | void insertIntoTable( const OContact &cnt, int row ); |
118 | QString findContactContact( const OContact &entry, int row ); | 128 | ContactItem findContactContact( const OContact &entry, int row ); |
119 | void fitColumns(); | 129 | void fitColumns(); |
120 | void resizeRows(); | 130 | void resizeRows(); |
121 | void realignTable(); | 131 | void realignTable(); |
122 | void resort(); | 132 | void resort(); |
123 | void updateVisible(); | 133 | void updateVisible(); |
124 | 134 | ||
125 | int lastSortCol; | 135 | int lastSortCol; |
126 | bool asc; | 136 | bool asc; |
127 | QMap<AbTableItem*, OContact> contactList; | 137 | QMap<AbTableItem*, OContact> contactList; |
128 | QValueList<int> intFields; | 138 | QValueList<int> intFields; |
129 | QStringList choicenames; | 139 | QStringList choicenames; |
130 | bool enablePainting; | 140 | bool enablePainting; |
131 | bool columnVisible; | 141 | bool columnVisible; |
132 | int countNested; | 142 | int countNested; |
133 | 143 | ||
134 | OContactAccess::List m_viewList; | 144 | OContactAccess::List m_viewList; |
135 | 145 | ||
136 | }; | 146 | }; |
137 | #endif // ABTABLE_H | 147 | #endif // ABTABLE_H |
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index ad8315d..881b839 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -1,985 +1,986 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** OContact info@trolltech.com if any conditions of this licensing are | 16 | ** OContact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define QTOPIA_INTERNAL_FD | 21 | #define QTOPIA_INTERNAL_FD |
22 | 22 | ||
23 | #include "contacteditor.h" | 23 | #include "contacteditor.h" |
24 | #include "ablabel.h" | 24 | #include "ablabel.h" |
25 | #include "abview.h" | 25 | #include "abview.h" |
26 | #include "abtable.h" | 26 | #include "abtable.h" |
27 | // #include "addresssettings.h" | 27 | // #include "addresssettings.h" |
28 | #include "addressbook.h" | 28 | #include "addressbook.h" |
29 | 29 | ||
30 | 30 | ||
31 | #include <opie/ofileselector.h> | 31 | #include <opie/ofileselector.h> |
32 | #include <opie/ofiledialog.h> | 32 | #include <opie/ofiledialog.h> |
33 | #include <opie/ocontact.h> | 33 | #include <opie/ocontact.h> |
34 | #include <opie/ocontactaccessbackend_vcard.h> | 34 | #include <opie/ocontactaccessbackend_vcard.h> |
35 | 35 | ||
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <qpe/ir.h> | 37 | #include <qpe/ir.h> |
38 | #include <qpe/qpemessagebox.h> | 38 | #include <qpe/qpemessagebox.h> |
39 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
40 | #include <qpe/qpetoolbar.h> | 40 | #include <qpe/qpetoolbar.h> |
41 | #include <qpe/qpemenubar.h> | 41 | #include <qpe/qpemenubar.h> |
42 | // #include <qtoolbar.h> | 42 | // #include <qtoolbar.h> |
43 | // #include <qmenubar.h> | 43 | // #include <qmenubar.h> |
44 | #include <qpe/qpeapplication.h> | 44 | #include <qpe/qpeapplication.h> |
45 | #include <qpe/config.h> | 45 | #include <qpe/config.h> |
46 | 46 | ||
47 | #include <qaction.h> | 47 | #include <qaction.h> |
48 | #include <qdialog.h> | 48 | #include <qdialog.h> |
49 | #include <qdir.h> | 49 | #include <qdir.h> |
50 | #include <qfile.h> | 50 | #include <qfile.h> |
51 | #include <qimage.h> | 51 | #include <qimage.h> |
52 | #include <qlayout.h> | 52 | #include <qlayout.h> |
53 | #include <qmessagebox.h> | 53 | #include <qmessagebox.h> |
54 | #include <qpixmap.h> | 54 | #include <qpixmap.h> |
55 | #include <qpopupmenu.h> | 55 | #include <qpopupmenu.h> |
56 | #include <qstringlist.h> | 56 | #include <qstringlist.h> |
57 | #include <qtoolbutton.h> | 57 | #include <qtoolbutton.h> |
58 | #include <qwhatsthis.h> | 58 | #include <qwhatsthis.h> |
59 | #include <qdatetime.h> | 59 | #include <qdatetime.h> |
60 | 60 | ||
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | #include <sys/stat.h> | 62 | #include <sys/stat.h> |
63 | #include <sys/types.h> | 63 | #include <sys/types.h> |
64 | #include <fcntl.h> | 64 | #include <fcntl.h> |
65 | #include <unistd.h> | 65 | #include <unistd.h> |
66 | 66 | ||
67 | 67 | ||
68 | #include "picker.h" | 68 | #include "picker.h" |
69 | #include "configdlg.h" | 69 | #include "configdlg.h" |
70 | 70 | ||
71 | extern QString addressbookPersonalVCardName(); | 71 | extern QString addressbookPersonalVCardName(); |
72 | 72 | ||
73 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | 73 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, |
74 | WFlags f ) | 74 | WFlags f ) |
75 | : QMainWindow( parent, name, f ), | 75 | : QMainWindow( parent, name, f ), |
76 | catMenu (0l), | 76 | catMenu (0l), |
77 | abEditor(0l), | 77 | abEditor(0l), |
78 | syncing(FALSE), | 78 | syncing(FALSE), |
79 | m_tableViewButton(0l), | 79 | m_tableViewButton(0l), |
80 | m_cardViewButton(0l) | 80 | m_cardViewButton(0l) |
81 | { | 81 | { |
82 | isLoading = true; | 82 | isLoading = true; |
83 | 83 | ||
84 | m_config.load(); | 84 | m_config.load(); |
85 | 85 | ||
86 | setCaption( tr("Contacts") ); | 86 | setCaption( tr("Contacts") ); |
87 | setIcon( Resource::loadPixmap( "AddressBook" ) ); | 87 | setIcon( Resource::loadPixmap( "AddressBook" ) ); |
88 | 88 | ||
89 | // Settings for Main Menu | 89 | // Settings for Main Menu |
90 | setToolBarsMovable( true ); | 90 | setToolBarsMovable( true ); |
91 | setRightJustification( true ); | 91 | setRightJustification( true ); |
92 | 92 | ||
93 | // Create Toolbar | 93 | // Create Toolbar |
94 | listTools = new QPEToolBar( this, "list operations" ); | 94 | listTools = new QPEToolBar( this, "list operations" ); |
95 | listTools->setHorizontalStretchable( true ); | 95 | listTools->setHorizontalStretchable( true ); |
96 | addToolBar( listTools ); | 96 | addToolBar( listTools ); |
97 | moveToolBar( listTools, m_config.getToolBarPos() ); | 97 | moveToolBar( listTools, m_config.getToolBarPos() ); |
98 | 98 | ||
99 | QPEMenuBar *mbList = new QPEMenuBar( this ); | 99 | QPEMenuBar *mbList = new QPEMenuBar( this ); |
100 | mbList->setMargin( 0 ); | 100 | mbList->setMargin( 0 ); |
101 | 101 | ||
102 | QPopupMenu *edit = new QPopupMenu( mbList ); | 102 | QPopupMenu *edit = new QPopupMenu( mbList ); |
103 | mbList->insertItem( tr( "Contact" ), edit ); | 103 | mbList->insertItem( tr( "Contact" ), edit ); |
104 | 104 | ||
105 | 105 | ||
106 | // View Icons | 106 | // View Icons |
107 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/weeklst" ), | 107 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/weeklst" ), |
108 | QString::null, 0, this, 0 ); | 108 | QString::null, 0, this, 0 ); |
109 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); | 109 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); |
110 | m_tableViewButton->setToggleAction( true ); | 110 | m_tableViewButton->setToggleAction( true ); |
111 | m_tableViewButton->addTo( listTools ); | 111 | m_tableViewButton->addTo( listTools ); |
112 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 ); | 112 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 ); |
113 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); | 113 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); |
114 | m_cardViewButton->setToggleAction( true ); | 114 | m_cardViewButton->setToggleAction( true ); |
115 | m_cardViewButton->addTo( listTools ); | 115 | m_cardViewButton->addTo( listTools ); |
116 | 116 | ||
117 | listTools->addSeparator(); | 117 | listTools->addSeparator(); |
118 | 118 | ||
119 | // Other Buttons | 119 | // Other Buttons |
120 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, | 120 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, |
121 | 0, this, 0 ); | 121 | 0, this, 0 ); |
122 | actionNew = a; | 122 | actionNew = a; |
123 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); | 123 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); |
124 | a->addTo( edit ); | 124 | a->addTo( edit ); |
125 | a->addTo( listTools ); | 125 | a->addTo( listTools ); |
126 | 126 | ||
127 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | 127 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, |
128 | 0, this, 0 ); | 128 | 0, this, 0 ); |
129 | actionEdit = a; | 129 | actionEdit = a; |
130 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); | 130 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); |
131 | a->addTo( edit ); | 131 | a->addTo( edit ); |
132 | a->addTo( listTools ); | 132 | a->addTo( listTools ); |
133 | 133 | ||
134 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 134 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
135 | 0, this, 0 ); | 135 | 0, this, 0 ); |
136 | actionTrash = a; | 136 | actionTrash = a; |
137 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); | 137 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); |
138 | a->addTo( edit ); | 138 | a->addTo( edit ); |
139 | a->addTo( listTools ); | 139 | a->addTo( listTools ); |
140 | 140 | ||
141 | 141 | ||
142 | // make it possible to go directly to businesscard via qcop call | 142 | // make it possible to go directly to businesscard via qcop call |
143 | //#if defined(Q_WS_QWS) // Why this ? (se) | 143 | //#if defined(Q_WS_QWS) // Why this ? (se) |
144 | #if !defined(QT_NO_COP) | 144 | #if !defined(QT_NO_COP) |
145 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); | 145 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); |
146 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), | 146 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), |
147 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); | 147 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); |
148 | #endif | 148 | #endif |
149 | // #endif | 149 | // #endif |
150 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), | 150 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), |
151 | QString::null, 0, this, 0 ); | 151 | QString::null, 0, this, 0 ); |
152 | actionFind = a; | 152 | actionFind = a; |
153 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); | 153 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); |
154 | a->addTo( edit ); | 154 | a->addTo( edit ); |
155 | a->addTo( listTools ); | 155 | a->addTo( listTools ); |
156 | 156 | ||
157 | // Much better search widget, taken from QTReader.. (se) | 157 | // Much better search widget, taken from QTReader.. (se) |
158 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); | 158 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); |
159 | searchBar->setHorizontalStretchable( TRUE ); | 159 | searchBar->setHorizontalStretchable( TRUE ); |
160 | searchBar->hide(); | 160 | searchBar->hide(); |
161 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 161 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
162 | 162 | ||
163 | // QFont f("unifont", 16 /*, QFont::Bold*/); | 163 | // QFont f("unifont", 16 /*, QFont::Bold*/); |
164 | // searchEdit->setFont( f ); | 164 | // searchEdit->setFont( f ); |
165 | 165 | ||
166 | searchBar->setStretchableWidget( searchEdit ); | 166 | searchBar->setStretchableWidget( searchEdit ); |
167 | connect( searchEdit, SIGNAL( returnPressed( ) ), | 167 | connect( searchEdit, SIGNAL( returnPressed( ) ), |
168 | this, SLOT( slotFind( ) ) ); | 168 | this, SLOT( slotFind( ) ) ); |
169 | 169 | ||
170 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | 170 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); |
171 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | 171 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); |
172 | a->addTo( searchBar ); | 172 | a->addTo( searchBar ); |
173 | 173 | ||
174 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 174 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
175 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); | 175 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); |
176 | a->addTo( searchBar ); | 176 | a->addTo( searchBar ); |
177 | 177 | ||
178 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), | 178 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), |
179 | QString::null, 0, this, 0 ); | 179 | QString::null, 0, this, 0 ); |
180 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 180 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
181 | actionMail = a; | 181 | actionMail = a; |
182 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 182 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
183 | a->addTo( edit ); | 183 | a->addTo( edit ); |
184 | a->addTo( listTools ); | 184 | a->addTo( listTools ); |
185 | 185 | ||
186 | if ( Ir::supported() ) { | 186 | if ( Ir::supported() ) { |
187 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | 187 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, |
188 | 0, this, 0 ); | 188 | 0, this, 0 ); |
189 | actionBeam = a; | 189 | actionBeam = a; |
190 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 190 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
191 | a->addTo( edit ); | 191 | a->addTo( edit ); |
192 | a->addTo( listTools ); | 192 | a->addTo( listTools ); |
193 | } | 193 | } |
194 | 194 | ||
195 | edit->insertSeparator(); | 195 | edit->insertSeparator(); |
196 | 196 | ||
197 | a = new QAction( tr("Import vCard"), QString::null, 0, 0); | 197 | a = new QAction( tr("Import vCard"), QString::null, 0, 0); |
198 | actionPersonal = a; | 198 | actionPersonal = a; |
199 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); | 199 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); |
200 | a->addTo( edit ); | 200 | a->addTo( edit ); |
201 | 201 | ||
202 | edit->insertSeparator(); | 202 | edit->insertSeparator(); |
203 | 203 | ||
204 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); | 204 | a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), |
205 | QString::null, 0, this, 0 ); | ||
205 | actionPersonal = a; | 206 | actionPersonal = a; |
206 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); | 207 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); |
207 | a->addTo( edit ); | 208 | a->addTo( edit ); |
208 | 209 | ||
209 | 210 | ||
210 | #ifdef __DEBUG_RELEASE | 211 | #ifdef __DEBUG_RELEASE |
211 | // Remove this function for public Release ! This is only | 212 | // Remove this function for public Release ! This is only |
212 | // for debug purposes .. | 213 | // for debug purposes .. |
213 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); | 214 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); |
214 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); | 215 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); |
215 | a->addTo( edit ); | 216 | a->addTo( edit ); |
216 | #endif | 217 | #endif |
217 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, | 218 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "addressbook/configure" ), QString::null, |
218 | 0, this, 0 ); | 219 | 0, this, 0 ); |
219 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); | 220 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); |
220 | a->addTo( edit ); | 221 | a->addTo( edit ); |
221 | 222 | ||
222 | // Create Views | 223 | // Create Views |
223 | listContainer = new QWidget( this ); | 224 | listContainer = new QWidget( this ); |
224 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | 225 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); |
225 | 226 | ||
226 | m_abView = new AbView( listContainer, m_config.orderList() ); | 227 | m_abView = new AbView( listContainer, m_config.orderList() ); |
227 | vb->addWidget( m_abView ); | 228 | vb->addWidget( m_abView ); |
228 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 229 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
229 | connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), | 230 | connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), |
230 | this, SLOT( slotViewSwitched( int ) ) ); | 231 | this, SLOT( slotViewSwitched( int ) ) ); |
231 | 232 | ||
232 | 233 | ||
233 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); | 234 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); |
234 | 235 | ||
235 | m_abView->load(); | 236 | m_abView->load(); |
236 | 237 | ||
237 | // Letter Picker | 238 | // Letter Picker |
238 | pLabel = new LetterPicker( listContainer ); | 239 | pLabel = new LetterPicker( listContainer ); |
239 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 240 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
240 | connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); | 241 | connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); |
241 | 242 | ||
242 | vb->addWidget( pLabel ); | 243 | vb->addWidget( pLabel ); |
243 | 244 | ||
244 | // Category Menu | 245 | // Category Menu |
245 | catMenu = new QPopupMenu( this ); | 246 | catMenu = new QPopupMenu( this ); |
246 | catMenu->setCheckable( TRUE ); | 247 | catMenu->setCheckable( TRUE ); |
247 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 248 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
248 | populateCategories(); | 249 | populateCategories(); |
249 | mbList->insertItem( tr("View"), catMenu ); | 250 | mbList->insertItem( tr("View"), catMenu ); |
250 | 251 | ||
251 | defaultFont = new QFont( m_abView->font() ); | 252 | defaultFont = new QFont( m_abView->font() ); |
252 | slotSetFont(m_config.fontSize()); | 253 | slotSetFont(m_config.fontSize()); |
253 | m_curFontSize = m_config.fontSize(); | 254 | m_curFontSize = m_config.fontSize(); |
254 | 255 | ||
255 | setCentralWidget(listContainer); | 256 | setCentralWidget(listContainer); |
256 | 257 | ||
257 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 258 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
258 | 259 | ||
259 | 260 | ||
260 | isLoading = false; | 261 | isLoading = false; |
261 | } | 262 | } |
262 | 263 | ||
263 | 264 | ||
264 | void AddressbookWindow::slotConfig() | 265 | void AddressbookWindow::slotConfig() |
265 | { | 266 | { |
266 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); | 267 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); |
267 | dlg -> setConfig( m_config ); | 268 | dlg -> setConfig( m_config ); |
268 | dlg -> showMaximized(); | 269 | dlg -> showMaximized(); |
269 | if ( dlg -> exec() ) { | 270 | if ( dlg -> exec() ) { |
270 | qWarning ("Config Dialog accepted!"); | 271 | qWarning ("Config Dialog accepted!"); |
271 | m_config = dlg -> getConfig(); | 272 | m_config = dlg -> getConfig(); |
272 | if ( m_curFontSize != m_config.fontSize() ){ | 273 | if ( m_curFontSize != m_config.fontSize() ){ |
273 | qWarning("Font was changed!"); | 274 | qWarning("Font was changed!"); |
274 | m_curFontSize = m_config.fontSize(); | 275 | m_curFontSize = m_config.fontSize(); |
275 | emit slotSetFont( m_curFontSize ); | 276 | emit slotSetFont( m_curFontSize ); |
276 | } | 277 | } |
277 | m_abView -> setListOrder( m_config.orderList() ); | 278 | m_abView -> setListOrder( m_config.orderList() ); |
278 | } | 279 | } |
279 | 280 | ||
280 | delete dlg; | 281 | delete dlg; |
281 | } | 282 | } |
282 | 283 | ||
283 | 284 | ||
284 | void AddressbookWindow::slotSetFont( int size ) | 285 | void AddressbookWindow::slotSetFont( int size ) |
285 | { | 286 | { |
286 | qWarning("void AddressbookWindow::slotSetFont( %d )", size); | 287 | qWarning("void AddressbookWindow::slotSetFont( %d )", size); |
287 | 288 | ||
288 | if (size > 2 || size < 0) | 289 | if (size > 2 || size < 0) |
289 | size = 1; | 290 | size = 1; |
290 | 291 | ||
291 | m_config.setFontSize( size ); | 292 | m_config.setFontSize( size ); |
292 | 293 | ||
293 | QFont *currentFont; | 294 | QFont *currentFont; |
294 | 295 | ||
295 | switch (size) { | 296 | switch (size) { |
296 | case 0: | 297 | case 0: |
297 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); | 298 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); |
298 | currentFont = new QFont (m_abView->font()); | 299 | currentFont = new QFont (m_abView->font()); |
299 | // abList->resizeRows(currentFont->pixelSize() + 7); :SX | 300 | // abList->resizeRows(currentFont->pixelSize() + 7); :SX |
300 | // abList->resizeRows(); | 301 | // abList->resizeRows(); |
301 | break; | 302 | break; |
302 | case 1: | 303 | case 1: |
303 | m_abView->setFont( *defaultFont ); | 304 | m_abView->setFont( *defaultFont ); |
304 | currentFont = new QFont (m_abView->font()); | 305 | currentFont = new QFont (m_abView->font()); |
305 | // // abList->resizeRows(currentFont->pixelSize() + 7); | 306 | // // abList->resizeRows(currentFont->pixelSize() + 7); |
306 | // abList->resizeRows(); | 307 | // abList->resizeRows(); |
307 | break; | 308 | break; |
308 | case 2: | 309 | case 2: |
309 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); | 310 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); |
310 | currentFont = new QFont (m_abView->font()); | 311 | currentFont = new QFont (m_abView->font()); |
311 | // //abList->resizeRows(currentFont->pixelSize() + 7); | 312 | // //abList->resizeRows(currentFont->pixelSize() + 7); |
312 | // abList->resizeRows(); | 313 | // abList->resizeRows(); |
313 | break; | 314 | break; |
314 | } | 315 | } |
315 | } | 316 | } |
316 | 317 | ||
317 | 318 | ||
318 | 319 | ||
319 | void AddressbookWindow::importvCard() { | 320 | void AddressbookWindow::importvCard() { |
320 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); | 321 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); |
321 | if(!str.isEmpty() ){ | 322 | if(!str.isEmpty() ){ |
322 | setDocument((const QString&) str ); | 323 | setDocument((const QString&) str ); |
323 | } | 324 | } |
324 | 325 | ||
325 | } | 326 | } |
326 | 327 | ||
327 | void AddressbookWindow::setDocument( const QString &filename ) | 328 | void AddressbookWindow::setDocument( const QString &filename ) |
328 | { | 329 | { |
329 | qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); | 330 | qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); |
330 | 331 | ||
331 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ | 332 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ |
332 | 333 | ||
333 | 334 | ||
334 | 335 | ||
335 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), | 336 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), |
336 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), | 337 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), |
337 | tr( "&Yes" ), tr( "&No" ), QString::null, | 338 | tr( "&Yes" ), tr( "&No" ), QString::null, |
338 | 0, // Enter == button 0 | 339 | 0, // Enter == button 0 |
339 | 2 ) ) { // Escape == button 2 | 340 | 2 ) ) { // Escape == button 2 |
340 | case 0: | 341 | case 0: |
341 | qWarning("YES clicked"); | 342 | qWarning("YES clicked"); |
342 | break; | 343 | break; |
343 | case 1: | 344 | case 1: |
344 | qWarning("NO clicked"); | 345 | qWarning("NO clicked"); |
345 | return; | 346 | return; |
346 | break; | 347 | break; |
347 | } | 348 | } |
348 | } | 349 | } |
349 | 350 | ||
350 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 351 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
351 | filename ); | 352 | filename ); |
352 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 353 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
353 | OContactAccess::List allList = access->allRecords(); | 354 | OContactAccess::List allList = access->allRecords(); |
354 | qWarning( "Found number of contacts in File: %d", allList.count() ); | 355 | qWarning( "Found number of contacts in File: %d", allList.count() ); |
355 | 356 | ||
356 | if ( !allList.count() ) { | 357 | if ( !allList.count() ) { |
357 | QMessageBox::information( this, "Import VCard", | 358 | QMessageBox::information( this, "Import VCard", |
358 | "It was impossible to import\nthe VCard.\n" | 359 | "It was impossible to import\nthe VCard.\n" |
359 | "The VCard may be corrupted!" ); | 360 | "The VCard may be corrupted!" ); |
360 | } | 361 | } |
361 | 362 | ||
362 | bool doAsk = true; | 363 | bool doAsk = true; |
363 | OContactAccess::List::Iterator it; | 364 | OContactAccess::List::Iterator it; |
364 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 365 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
365 | qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); | 366 | qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); |
366 | if ( doAsk ){ | 367 | if ( doAsk ){ |
367 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), | 368 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), |
368 | tr( "Do you really want add contact for \n%1?" ) | 369 | tr( "Do you really want add contact for \n%1?" ) |
369 | .arg( (*it).fullName().latin1() ), | 370 | .arg( (*it).fullName().latin1() ), |
370 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), | 371 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), |
371 | 0, // Enter == button 0 | 372 | 0, // Enter == button 0 |
372 | 2 ) ) { // Escape == button 2 | 373 | 2 ) ) { // Escape == button 2 |
373 | case 0: | 374 | case 0: |
374 | qWarning("YES clicked"); | 375 | qWarning("YES clicked"); |
375 | m_abView->addEntry( *it ); | 376 | m_abView->addEntry( *it ); |
376 | break; | 377 | break; |
377 | case 1: | 378 | case 1: |
378 | qWarning("NO clicked"); | 379 | qWarning("NO clicked"); |
379 | break; | 380 | break; |
380 | case 2: | 381 | case 2: |
381 | qWarning("YesAll clicked"); | 382 | qWarning("YesAll clicked"); |
382 | doAsk = false; | 383 | doAsk = false; |
383 | break; | 384 | break; |
384 | } | 385 | } |
385 | }else | 386 | }else |
386 | m_abView->addEntry( *it ); | 387 | m_abView->addEntry( *it ); |
387 | 388 | ||
388 | } | 389 | } |
389 | 390 | ||
390 | delete access; | 391 | delete access; |
391 | } | 392 | } |
392 | 393 | ||
393 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 394 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
394 | { | 395 | { |
395 | QMainWindow::resizeEvent( e ); | 396 | QMainWindow::resizeEvent( e ); |
396 | 397 | ||
397 | 398 | ||
398 | } | 399 | } |
399 | 400 | ||
400 | AddressbookWindow::~AddressbookWindow() | 401 | AddressbookWindow::~AddressbookWindow() |
401 | { | 402 | { |
402 | ToolBarDock dock; | 403 | ToolBarDock dock; |
403 | int dummy; | 404 | int dummy; |
404 | bool bDummy; | 405 | bool bDummy; |
405 | getLocation ( listTools, dock, dummy, bDummy, dummy ); | 406 | getLocation ( listTools, dock, dummy, bDummy, dummy ); |
406 | m_config.setToolBarDock( dock ); | 407 | m_config.setToolBarDock( dock ); |
407 | m_config.save(); | 408 | m_config.save(); |
408 | } | 409 | } |
409 | 410 | ||
410 | void AddressbookWindow::slotUpdateToolbar() | 411 | void AddressbookWindow::slotUpdateToolbar() |
411 | { | 412 | { |
412 | OContact ce = m_abView->currentEntry(); | 413 | OContact ce = m_abView->currentEntry(); |
413 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 414 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
414 | } | 415 | } |
415 | 416 | ||
416 | void AddressbookWindow::slotListNew() | 417 | void AddressbookWindow::slotListNew() |
417 | { | 418 | { |
418 | OContact cnt; | 419 | OContact cnt; |
419 | if( !syncing ) { | 420 | if( !syncing ) { |
420 | editEntry( NewEntry ); | 421 | editEntry( NewEntry ); |
421 | } else { | 422 | } else { |
422 | QMessageBox::warning(this, tr("Contacts"), | 423 | QMessageBox::warning(this, tr("Contacts"), |
423 | tr("Can not edit data, currently syncing")); | 424 | tr("Can not edit data, currently syncing")); |
424 | } | 425 | } |
425 | } | 426 | } |
426 | 427 | ||
427 | // void AddressbookWindow::slotListView() | 428 | // void AddressbookWindow::slotListView() |
428 | // { | 429 | // { |
429 | // m_abView -> init( abList->currentEntry() ); | 430 | // m_abView -> init( abList->currentEntry() ); |
430 | // // :SX mView->sync(); | 431 | // // :SX mView->sync(); |
431 | // //:SXshowView(); | 432 | // //:SXshowView(); |
432 | // } | 433 | // } |
433 | 434 | ||
434 | void AddressbookWindow::slotListDelete() | 435 | void AddressbookWindow::slotListDelete() |
435 | { | 436 | { |
436 | if(!syncing) { | 437 | if(!syncing) { |
437 | OContact tmpEntry = m_abView ->currentEntry(); | 438 | OContact tmpEntry = m_abView ->currentEntry(); |
438 | 439 | ||
439 | // get a name, do the best we can... | 440 | // get a name, do the best we can... |
440 | QString strName = tmpEntry.fullName(); | 441 | QString strName = tmpEntry.fullName(); |
441 | if ( strName.isEmpty() ) { | 442 | if ( strName.isEmpty() ) { |
442 | strName = tmpEntry.company(); | 443 | strName = tmpEntry.company(); |
443 | if ( strName.isEmpty() ) | 444 | if ( strName.isEmpty() ) |
444 | strName = "No Name"; | 445 | strName = "No Name"; |
445 | } | 446 | } |
446 | 447 | ||
447 | 448 | ||
448 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), | 449 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), |
449 | strName ) ) { | 450 | strName ) ) { |
450 | m_abView->removeEntry( tmpEntry.uid() ); | 451 | m_abView->removeEntry( tmpEntry.uid() ); |
451 | } | 452 | } |
452 | } else { | 453 | } else { |
453 | QMessageBox::warning( this, tr("Contacts"), | 454 | QMessageBox::warning( this, tr("Contacts"), |
454 | tr("Can not edit data, currently syncing") ); | 455 | tr("Can not edit data, currently syncing") ); |
455 | } | 456 | } |
456 | } | 457 | } |
457 | 458 | ||
458 | void AddressbookWindow::slotFindOpen() | 459 | void AddressbookWindow::slotFindOpen() |
459 | { | 460 | { |
460 | searchBar->show(); | 461 | searchBar->show(); |
461 | m_abView -> inSearch(); | 462 | m_abView -> inSearch(); |
462 | searchEdit->setFocus(); | 463 | searchEdit->setFocus(); |
463 | } | 464 | } |
464 | void AddressbookWindow::slotFindClose() | 465 | void AddressbookWindow::slotFindClose() |
465 | { | 466 | { |
466 | searchBar->hide(); | 467 | searchBar->hide(); |
467 | m_abView -> offSearch(); | 468 | m_abView -> offSearch(); |
468 | // m_abView->setFocus(); | 469 | // m_abView->setFocus(); |
469 | } | 470 | } |
470 | 471 | ||
471 | 472 | ||
472 | void AddressbookWindow::slotFind() | 473 | void AddressbookWindow::slotFind() |
473 | { | 474 | { |
474 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); | 475 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); |
475 | 476 | ||
476 | searchEdit->clearFocus(); | 477 | searchEdit->clearFocus(); |
477 | // m_abView->setFocus(); | 478 | // m_abView->setFocus(); |
478 | 479 | ||
479 | } | 480 | } |
480 | 481 | ||
481 | void AddressbookWindow::slotViewBack() | 482 | void AddressbookWindow::slotViewBack() |
482 | { | 483 | { |
483 | // :SX showList(); | 484 | // :SX showList(); |
484 | } | 485 | } |
485 | 486 | ||
486 | void AddressbookWindow::slotViewEdit() | 487 | void AddressbookWindow::slotViewEdit() |
487 | { | 488 | { |
488 | if(!syncing) { | 489 | if(!syncing) { |
489 | if (actionPersonal->isOn()) { | 490 | if (actionPersonal->isOn()) { |
490 | editPersonal(); | 491 | editPersonal(); |
491 | } else { | 492 | } else { |
492 | editEntry( EditEntry ); | 493 | editEntry( EditEntry ); |
493 | } | 494 | } |
494 | } else { | 495 | } else { |
495 | QMessageBox::warning( this, tr("Contacts"), | 496 | QMessageBox::warning( this, tr("Contacts"), |
496 | tr("Can not edit data, currently syncing") ); | 497 | tr("Can not edit data, currently syncing") ); |
497 | } | 498 | } |
498 | } | 499 | } |
499 | 500 | ||
500 | 501 | ||
501 | 502 | ||
502 | void AddressbookWindow::writeMail() | 503 | void AddressbookWindow::writeMail() |
503 | { | 504 | { |
504 | OContact c = m_abView -> currentEntry(); | 505 | OContact c = m_abView -> currentEntry(); |
505 | QString name = c.fileAs(); | 506 | QString name = c.fileAs(); |
506 | QString email = c.defaultEmail(); | 507 | QString email = c.defaultEmail(); |
507 | 508 | ||
508 | // I prefer the OPIE-Environment variable before the | 509 | // I prefer the OPIE-Environment variable before the |
509 | // QPE-one.. | 510 | // QPE-one.. |
510 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); | 511 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); |
511 | if ( basepath.isEmpty() ) | 512 | if ( basepath.isEmpty() ) |
512 | basepath = QString::fromLatin1( getenv("QPEDIR") ); | 513 | basepath = QString::fromLatin1( getenv("QPEDIR") ); |
513 | 514 | ||
514 | // Try to access the preferred. If not possible, try to | 515 | // Try to access the preferred. If not possible, try to |
515 | // switch to the other one.. | 516 | // switch to the other one.. |
516 | if ( m_config.useQtMail() ){ | 517 | if ( m_config.useQtMail() ){ |
517 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); | 518 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); |
518 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ | 519 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ |
519 | qWarning ("QCop"); | 520 | qWarning ("QCop"); |
520 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 521 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); |
521 | e << name << email; | 522 | e << name << email; |
522 | return; | 523 | return; |
523 | } else | 524 | } else |
524 | m_config.setUseOpieMail( true ); | 525 | m_config.setUseOpieMail( true ); |
525 | } | 526 | } |
526 | if ( m_config.useOpieMail() ){ | 527 | if ( m_config.useOpieMail() ){ |
527 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); | 528 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); |
528 | if ( QFile::exists( basepath + "/bin/mail" ) ){ | 529 | if ( QFile::exists( basepath + "/bin/mail" ) ){ |
529 | qWarning ("QCop"); | 530 | qWarning ("QCop"); |
530 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); | 531 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); |
531 | e << name << email; | 532 | e << name << email; |
532 | return; | 533 | return; |
533 | } else | 534 | } else |
534 | m_config.setUseQtMail( true ); | 535 | m_config.setUseQtMail( true ); |
535 | } | 536 | } |
536 | 537 | ||
537 | } | 538 | } |
538 | 539 | ||
539 | static const char * beamfile = "/tmp/obex/contact.vcf"; | 540 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
540 | 541 | ||
541 | void AddressbookWindow::slotBeam() | 542 | void AddressbookWindow::slotBeam() |
542 | { | 543 | { |
543 | QString filename; | 544 | QString filename; |
544 | OContact c; | 545 | OContact c; |
545 | if ( actionPersonal->isOn() ) { | 546 | if ( actionPersonal->isOn() ) { |
546 | filename = addressbookPersonalVCardName(); | 547 | filename = addressbookPersonalVCardName(); |
547 | if (!QFile::exists(filename)) | 548 | if (!QFile::exists(filename)) |
548 | return; // can't beam a non-existent file | 549 | return; // can't beam a non-existent file |
549 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 550 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
550 | filename ); | 551 | filename ); |
551 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 552 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
552 | OContactAccess::List allList = access->allRecords(); | 553 | OContactAccess::List allList = access->allRecords(); |
553 | OContactAccess::List::Iterator it = allList.begin(); // Just take first | 554 | OContactAccess::List::Iterator it = allList.begin(); // Just take first |
554 | c = *it; | 555 | c = *it; |
555 | 556 | ||
556 | delete access; | 557 | delete access; |
557 | } else { | 558 | } else { |
558 | unlink( beamfile ); // delete if exists | 559 | unlink( beamfile ); // delete if exists |
559 | mkdir("/tmp/obex/", 0755); | 560 | mkdir("/tmp/obex/", 0755); |
560 | c = m_abView -> currentEntry(); | 561 | c = m_abView -> currentEntry(); |
561 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 562 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
562 | beamfile ); | 563 | beamfile ); |
563 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 564 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
564 | access->add( c ); | 565 | access->add( c ); |
565 | access->save(); | 566 | access->save(); |
566 | delete access; | 567 | delete access; |
567 | 568 | ||
568 | filename = beamfile; | 569 | filename = beamfile; |
569 | } | 570 | } |
570 | 571 | ||
571 | 572 | ||
572 | Ir *ir = new Ir( this ); | 573 | Ir *ir = new Ir( this ); |
573 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 574 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
574 | QString description = c.fullName(); | 575 | QString description = c.fullName(); |
575 | ir->send( filename, description, "text/x-vCard" ); | 576 | ir->send( filename, description, "text/x-vCard" ); |
576 | } | 577 | } |
577 | 578 | ||
578 | void AddressbookWindow::beamDone( Ir *ir ) | 579 | void AddressbookWindow::beamDone( Ir *ir ) |
579 | { | 580 | { |
580 | delete ir; | 581 | delete ir; |
581 | unlink( beamfile ); | 582 | unlink( beamfile ); |
582 | } | 583 | } |
583 | 584 | ||
584 | 585 | ||
585 | static void parseName( const QString& name, QString *first, QString *middle, | 586 | static void parseName( const QString& name, QString *first, QString *middle, |
586 | QString * last ) | 587 | QString * last ) |
587 | { | 588 | { |
588 | 589 | ||
589 | int comma = name.find ( "," ); | 590 | int comma = name.find ( "," ); |
590 | QString rest; | 591 | QString rest; |
591 | if ( comma > 0 ) { | 592 | if ( comma > 0 ) { |
592 | *last = name.left( comma ); | 593 | *last = name.left( comma ); |
593 | comma++; | 594 | comma++; |
594 | while ( comma < int(name.length()) && name[comma] == ' ' ) | 595 | while ( comma < int(name.length()) && name[comma] == ' ' ) |
595 | comma++; | 596 | comma++; |
596 | rest = name.mid( comma ); | 597 | rest = name.mid( comma ); |
597 | } else { | 598 | } else { |
598 | int space = name.findRev( ' ' ); | 599 | int space = name.findRev( ' ' ); |
599 | *last = name.mid( space+1 ); | 600 | *last = name.mid( space+1 ); |
600 | rest = name.left( space ); | 601 | rest = name.left( space ); |
601 | } | 602 | } |
602 | int space = rest.find( ' ' ); | 603 | int space = rest.find( ' ' ); |
603 | if ( space <= 0 ) { | 604 | if ( space <= 0 ) { |
604 | *first = rest; | 605 | *first = rest; |
605 | } else { | 606 | } else { |
606 | *first = rest.left( space ); | 607 | *first = rest.left( space ); |
607 | *middle = rest.mid( space+1 ); | 608 | *middle = rest.mid( space+1 ); |
608 | } | 609 | } |
609 | 610 | ||
610 | } | 611 | } |
611 | 612 | ||
612 | 613 | ||
613 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 614 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
614 | { | 615 | { |
615 | if (msg == "editPersonal()") { | 616 | if (msg == "editPersonal()") { |
616 | editPersonal(); | 617 | editPersonal(); |
617 | } else if (msg == "editPersonalAndClose()") { | 618 | } else if (msg == "editPersonalAndClose()") { |
618 | editPersonal(); | 619 | editPersonal(); |
619 | close(); | 620 | close(); |
620 | } else if ( msg == "addContact(QString,QString)" ) { | 621 | } else if ( msg == "addContact(QString,QString)" ) { |
621 | QDataStream stream(data,IO_ReadOnly); | 622 | QDataStream stream(data,IO_ReadOnly); |
622 | QString name, email; | 623 | QString name, email; |
623 | stream >> name >> email; | 624 | stream >> name >> email; |
624 | 625 | ||
625 | OContact cnt; | 626 | OContact cnt; |
626 | QString fn, mn, ln; | 627 | QString fn, mn, ln; |
627 | parseName( name, &fn, &mn, &ln ); | 628 | parseName( name, &fn, &mn, &ln ); |
628 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 629 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
629 | cnt.setFirstName( fn ); | 630 | cnt.setFirstName( fn ); |
630 | cnt.setMiddleName( mn ); | 631 | cnt.setMiddleName( mn ); |
631 | cnt.setLastName( ln ); | 632 | cnt.setLastName( ln ); |
632 | cnt.insertEmails( email ); | 633 | cnt.insertEmails( email ); |
633 | cnt.setDefaultEmail( email ); | 634 | cnt.setDefaultEmail( email ); |
634 | cnt.setFileAs(); | 635 | cnt.setFileAs(); |
635 | 636 | ||
636 | m_abView -> addEntry( cnt ); | 637 | m_abView -> addEntry( cnt ); |
637 | 638 | ||
638 | // :SXm_abView()->init( cnt ); | 639 | // :SXm_abView()->init( cnt ); |
639 | editEntry( EditEntry ); | 640 | editEntry( EditEntry ); |
640 | 641 | ||
641 | 642 | ||
642 | 643 | ||
643 | } | 644 | } |
644 | #if 0 | 645 | #if 0 |
645 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { | 646 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { |
646 | QDataStream stream(data,IO_ReadOnly); | 647 | QDataStream stream(data,IO_ReadOnly); |
647 | QCString ch,m; | 648 | QCString ch,m; |
648 | QStringList types; | 649 | QStringList types; |
649 | stream >> ch >> m >> types; | 650 | stream >> ch >> m >> types; |
650 | AddressPicker picker(abList,this,0,TRUE); | 651 | AddressPicker picker(abList,this,0,TRUE); |
651 | picker.showMaximized(); | 652 | picker.showMaximized(); |
652 | picker.setChoiceNames(types); | 653 | picker.setChoiceNames(types); |
653 | int i=0; | 654 | int i=0; |
654 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 655 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
655 | QStringList sel; | 656 | QStringList sel; |
656 | stream >> sel; | 657 | stream >> sel; |
657 | picker.setSelection(i++,sel); | 658 | picker.setSelection(i++,sel); |
658 | } | 659 | } |
659 | picker.showMaximized(); | 660 | picker.showMaximized(); |
660 | picker.exec(); | 661 | picker.exec(); |
661 | 662 | ||
662 | // ###### note: contacts may have been added - save here! | 663 | // ###### note: contacts may have been added - save here! |
663 | 664 | ||
664 | setCentralWidget(abList); | 665 | setCentralWidget(abList); |
665 | QCopEnvelope e(ch,m); | 666 | QCopEnvelope e(ch,m); |
666 | i=0; | 667 | i=0; |
667 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 668 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
668 | QStringList sel = picker.selection(i++); | 669 | QStringList sel = picker.selection(i++); |
669 | e << sel; | 670 | e << sel; |
670 | } | 671 | } |
671 | } | 672 | } |
672 | #endif | 673 | #endif |
673 | 674 | ||
674 | } | 675 | } |
675 | 676 | ||
676 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 677 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
677 | { | 678 | { |
678 | OContact entry; | 679 | OContact entry; |
679 | if ( !abEditor ) { | 680 | if ( !abEditor ) { |
680 | abEditor = new ContactEditor( entry, this, "editor" ); | 681 | abEditor = new ContactEditor( entry, this, "editor" ); |
681 | } | 682 | } |
682 | if ( entryMode == EditEntry ) | 683 | if ( entryMode == EditEntry ) |
683 | abEditor->setEntry( m_abView -> currentEntry() ); | 684 | abEditor->setEntry( m_abView -> currentEntry() ); |
684 | else if ( entryMode == NewEntry ) | 685 | else if ( entryMode == NewEntry ) |
685 | abEditor->setEntry( entry ); | 686 | abEditor->setEntry( entry ); |
686 | // other things may change the caption. | 687 | // other things may change the caption. |
687 | abEditor->setCaption( tr("Edit Address") ); | 688 | abEditor->setCaption( tr("Edit Address") ); |
688 | 689 | ||
689 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 690 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
690 | abEditor->showMaximized(); | 691 | abEditor->showMaximized(); |
691 | #endif | 692 | #endif |
692 | // fix the foxus... | 693 | // fix the foxus... |
693 | abEditor->setNameFocus(); | 694 | abEditor->setNameFocus(); |
694 | if ( abEditor->exec() ) { | 695 | if ( abEditor->exec() ) { |
695 | setFocus(); | 696 | setFocus(); |
696 | if ( entryMode == NewEntry ) { | 697 | if ( entryMode == NewEntry ) { |
697 | OContact insertEntry = abEditor->entry(); | 698 | OContact insertEntry = abEditor->entry(); |
698 | insertEntry.assignUid(); | 699 | insertEntry.assignUid(); |
699 | m_abView -> addEntry( insertEntry ); | 700 | m_abView -> addEntry( insertEntry ); |
700 | } else { | 701 | } else { |
701 | OContact replEntry = abEditor->entry(); | 702 | OContact replEntry = abEditor->entry(); |
702 | 703 | ||
703 | if ( !replEntry.isValidUid() ) | 704 | if ( !replEntry.isValidUid() ) |
704 | replEntry.assignUid(); | 705 | replEntry.assignUid(); |
705 | 706 | ||
706 | m_abView -> replaceEntry( replEntry ); | 707 | m_abView -> replaceEntry( replEntry ); |
707 | } | 708 | } |
708 | } | 709 | } |
709 | // populateCategories(); | 710 | // populateCategories(); |
710 | 711 | ||
711 | } | 712 | } |
712 | 713 | ||
713 | void AddressbookWindow::editPersonal() | 714 | void AddressbookWindow::editPersonal() |
714 | { | 715 | { |
715 | OContact entry; | 716 | OContact entry; |
716 | 717 | ||
717 | // Switch to personal view if not selected | 718 | // Switch to personal view if not selected |
718 | // but take care of the menu, too | 719 | // but take care of the menu, too |
719 | if ( ! actionPersonal->isOn() ){ | 720 | if ( ! actionPersonal->isOn() ){ |
720 | qWarning("*** ++++"); | 721 | qWarning("*** ++++"); |
721 | actionPersonal->setOn( true ); | 722 | actionPersonal->setOn( true ); |
722 | slotPersonalView(); | 723 | slotPersonalView(); |
723 | } | 724 | } |
724 | 725 | ||
725 | if ( !abEditor ) { | 726 | if ( !abEditor ) { |
726 | abEditor = new ContactEditor( entry, this, "editor" ); | 727 | abEditor = new ContactEditor( entry, this, "editor" ); |
727 | } | 728 | } |
728 | 729 | ||
729 | abEditor->setCaption(tr("Edit My Personal Details")); | 730 | abEditor->setCaption(tr("Edit My Personal Details")); |
730 | abEditor->setPersonalView( true ); | 731 | abEditor->setPersonalView( true ); |
731 | editEntry( EditEntry ); | 732 | editEntry( EditEntry ); |
732 | abEditor->setPersonalView( false ); | 733 | abEditor->setPersonalView( false ); |
733 | 734 | ||
734 | } | 735 | } |
735 | 736 | ||
736 | 737 | ||
737 | void AddressbookWindow::slotPersonalView() | 738 | void AddressbookWindow::slotPersonalView() |
738 | { | 739 | { |
739 | qWarning("slotPersonalView()"); | 740 | qWarning("slotPersonalView()"); |
740 | if (!actionPersonal->isOn()) { | 741 | if (!actionPersonal->isOn()) { |
741 | // we just turned it off | 742 | // we just turned it off |
742 | qWarning("slotPersonalView()-> OFF"); | 743 | qWarning("slotPersonalView()-> OFF"); |
743 | setCaption( tr("Contacts") ); | 744 | setCaption( tr("Contacts") ); |
744 | actionNew->setEnabled(TRUE); | 745 | actionNew->setEnabled(TRUE); |
745 | actionTrash->setEnabled(TRUE); | 746 | actionTrash->setEnabled(TRUE); |
746 | actionFind->setEnabled(TRUE); | 747 | actionFind->setEnabled(TRUE); |
747 | actionMail->setEnabled(TRUE); | 748 | actionMail->setEnabled(TRUE); |
748 | // slotUpdateToolbar(); | 749 | // slotUpdateToolbar(); |
749 | 750 | ||
750 | m_abView->showPersonal( false ); | 751 | m_abView->showPersonal( false ); |
751 | 752 | ||
752 | return; | 753 | return; |
753 | } | 754 | } |
754 | 755 | ||
755 | qWarning("slotPersonalView()-> ON"); | 756 | qWarning("slotPersonalView()-> ON"); |
756 | // XXX need to disable some QActions. | 757 | // XXX need to disable some QActions. |
757 | actionNew->setEnabled(FALSE); | 758 | actionNew->setEnabled(FALSE); |
758 | actionTrash->setEnabled(FALSE); | 759 | actionTrash->setEnabled(FALSE); |
759 | actionFind->setEnabled(FALSE); | 760 | actionFind->setEnabled(FALSE); |
760 | actionMail->setEnabled(FALSE); | 761 | actionMail->setEnabled(FALSE); |
761 | 762 | ||
762 | setCaption( tr("Contacts - My Personal Details") ); | 763 | setCaption( tr("Contacts - My Personal Details") ); |
763 | 764 | ||
764 | m_abView->showPersonal( true ); | 765 | m_abView->showPersonal( true ); |
765 | 766 | ||
766 | } | 767 | } |
767 | 768 | ||
768 | 769 | ||
769 | void AddressbookWindow::listIsEmpty( bool empty ) | 770 | void AddressbookWindow::listIsEmpty( bool empty ) |
770 | { | 771 | { |
771 | if ( !empty ) { | 772 | if ( !empty ) { |
772 | deleteButton->setEnabled( TRUE ); | 773 | deleteButton->setEnabled( TRUE ); |
773 | } | 774 | } |
774 | } | 775 | } |
775 | 776 | ||
776 | void AddressbookWindow::reload() | 777 | void AddressbookWindow::reload() |
777 | { | 778 | { |
778 | syncing = FALSE; | 779 | syncing = FALSE; |
779 | m_abView->clear(); | 780 | m_abView->clear(); |
780 | m_abView->reload(); | 781 | m_abView->reload(); |
781 | } | 782 | } |
782 | 783 | ||
783 | void AddressbookWindow::flush() | 784 | void AddressbookWindow::flush() |
784 | { | 785 | { |
785 | syncing = TRUE; | 786 | syncing = TRUE; |
786 | m_abView->save(); | 787 | m_abView->save(); |
787 | } | 788 | } |
788 | 789 | ||
789 | 790 | ||
790 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 791 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
791 | { | 792 | { |
792 | if(active_view == AbView::CardView){ | 793 | if(active_view == AbView::CardView){ |
793 | slotViewSwitched( AbView::TableView ); | 794 | slotViewSwitched( AbView::TableView ); |
794 | e->ignore(); | 795 | e->ignore(); |
795 | return; | 796 | return; |
796 | } | 797 | } |
797 | if(syncing) { | 798 | if(syncing) { |
798 | /* shouldn't we save, I hear you say? well its already been set | 799 | /* shouldn't we save, I hear you say? well its already been set |
799 | so that an edit can not occur during a sync, and we flushed | 800 | so that an edit can not occur during a sync, and we flushed |
800 | at the start of the sync, so there is no need to save | 801 | at the start of the sync, so there is no need to save |
801 | Saving however itself would cause problems. */ | 802 | Saving however itself would cause problems. */ |
802 | e->accept(); | 803 | e->accept(); |
803 | return; | 804 | return; |
804 | } | 805 | } |
805 | //################## shouldn't always save | 806 | //################## shouldn't always save |
806 | // True, but the database handles this automatically ! (se) | 807 | // True, but the database handles this automatically ! (se) |
807 | if ( save() ) | 808 | if ( save() ) |
808 | e->accept(); | 809 | e->accept(); |
809 | else | 810 | else |
810 | e->ignore(); | 811 | e->ignore(); |
811 | } | 812 | } |
812 | 813 | ||
813 | /* | 814 | /* |
814 | Returns TRUE if it is OK to exit | 815 | Returns TRUE if it is OK to exit |
815 | */ | 816 | */ |
816 | 817 | ||
817 | bool AddressbookWindow::save() | 818 | bool AddressbookWindow::save() |
818 | { | 819 | { |
819 | if ( !m_abView->save() ) { | 820 | if ( !m_abView->save() ) { |
820 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 821 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
821 | tr("Unable to save information.\n" | 822 | tr("Unable to save information.\n" |
822 | "Free up some space\n" | 823 | "Free up some space\n" |
823 | "and try again.\n" | 824 | "and try again.\n" |
824 | "\nQuit anyway?"), | 825 | "\nQuit anyway?"), |
825 | QMessageBox::Yes|QMessageBox::Escape, | 826 | QMessageBox::Yes|QMessageBox::Escape, |
826 | QMessageBox::No|QMessageBox::Default ) | 827 | QMessageBox::No|QMessageBox::Default ) |
827 | != QMessageBox::No ) | 828 | != QMessageBox::No ) |
828 | return TRUE; | 829 | return TRUE; |
829 | else | 830 | else |
830 | return FALSE; | 831 | return FALSE; |
831 | } | 832 | } |
832 | return TRUE; | 833 | return TRUE; |
833 | } | 834 | } |
834 | 835 | ||
835 | #ifdef __DEBUG_RELEASE | 836 | #ifdef __DEBUG_RELEASE |
836 | void AddressbookWindow::slotSave() | 837 | void AddressbookWindow::slotSave() |
837 | { | 838 | { |
838 | save(); | 839 | save(); |
839 | } | 840 | } |
840 | #endif | 841 | #endif |
841 | 842 | ||
842 | 843 | ||
843 | void AddressbookWindow::slotNotFound() | 844 | void AddressbookWindow::slotNotFound() |
844 | { | 845 | { |
845 | qWarning("Got notfound signal!"); | 846 | qWarning("Got notfound signal!"); |
846 | QMessageBox::information( this, tr( "Not Found" ), | 847 | QMessageBox::information( this, tr( "Not Found" ), |
847 | tr( "Unable to find a contact for this \n search pattern!" ) ); | 848 | tr( "Unable to find a contact for this \n search pattern!" ) ); |
848 | 849 | ||
849 | 850 | ||
850 | } | 851 | } |
851 | void AddressbookWindow::slotWrapAround() | 852 | void AddressbookWindow::slotWrapAround() |
852 | { | 853 | { |
853 | qWarning("Got wrap signal!"); | 854 | qWarning("Got wrap signal!"); |
854 | // if ( doNotifyWrapAround ) | 855 | // if ( doNotifyWrapAround ) |
855 | // QMessageBox::information( this, tr( "End of list" ), | 856 | // QMessageBox::information( this, tr( "End of list" ), |
856 | // tr( "End of list. Wrap around now...!" ) + "\n" ); | 857 | // tr( "End of list. Wrap around now...!" ) + "\n" ); |
857 | 858 | ||
858 | } | 859 | } |
859 | 860 | ||
860 | void AddressbookWindow::slotSetCategory( int c ) | 861 | void AddressbookWindow::slotSetCategory( int c ) |
861 | { | 862 | { |
862 | qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); | 863 | qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); |
863 | 864 | ||
864 | QString cat, book; | 865 | QString cat, book; |
865 | AbView::Views view = AbView::TableView; | 866 | AbView::Views view = AbView::TableView; |
866 | 867 | ||
867 | if ( c <= 0 ) | 868 | if ( c <= 0 ) |
868 | return; | 869 | return; |
869 | 870 | ||
870 | // Switch view | 871 | // Switch view |
871 | if ( c < 3 ) | 872 | if ( c < 3 ) |
872 | for ( unsigned int i = 1; i < 3; i++ ){ | 873 | for ( unsigned int i = 1; i < 3; i++ ){ |
873 | if ( catMenu ) | 874 | if ( catMenu ) |
874 | catMenu->setItemChecked( i, c == (int)i ); | 875 | catMenu->setItemChecked( i, c == (int)i ); |
875 | } | 876 | } |
876 | else | 877 | else |
877 | // Checkmark Category Menu Item Selected | 878 | // Checkmark Category Menu Item Selected |
878 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) | 879 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) |
879 | catMenu->setItemChecked( i, c == (int)i ); | 880 | catMenu->setItemChecked( i, c == (int)i ); |
880 | 881 | ||
881 | // Now switch to the selected category | 882 | // Now switch to the selected category |
882 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { | 883 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { |
883 | if (catMenu->isItemChecked( i )) { | 884 | if (catMenu->isItemChecked( i )) { |
884 | if ( i == 1 ){ // default List view | 885 | if ( i == 1 ){ // default List view |
885 | book = QString::null; | 886 | book = QString::null; |
886 | view = AbView::TableView; | 887 | view = AbView::TableView; |
887 | }else if ( i == 2 ){ | 888 | }else if ( i == 2 ){ |
888 | book = tr( "Cards" ); | 889 | book = tr( "Cards" ); |
889 | view = AbView::CardView; | 890 | view = AbView::CardView; |
890 | // }else if ( i == 3 ){ | 891 | // }else if ( i == 3 ){ |
891 | // book = tr( "Personal" ); | 892 | // book = tr( "Personal" ); |
892 | // view = AbView:: PersonalView; | 893 | // view = AbView:: PersonalView; |
893 | }else if ( i == 3 ){ // default All Categories | 894 | }else if ( i == 3 ){ // default All Categories |
894 | cat = QString::null; | 895 | cat = QString::null; |
895 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled | 896 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled |
896 | cat = "Unfiled"; | 897 | cat = "Unfiled"; |
897 | qWarning ("Unfiled selected!!!"); | 898 | qWarning ("Unfiled selected!!!"); |
898 | }else{ | 899 | }else{ |
899 | cat = m_abView->categories()[i - 4]; | 900 | cat = m_abView->categories()[i - 4]; |
900 | } | 901 | } |
901 | } | 902 | } |
902 | } | 903 | } |
903 | 904 | ||
904 | // Switch to the selected View | 905 | // Switch to the selected View |
905 | slotViewSwitched( view ); | 906 | slotViewSwitched( view ); |
906 | 907 | ||
907 | // Tell the view about the selected category | 908 | // Tell the view about the selected category |
908 | m_abView -> setShowByCategory( cat ); | 909 | m_abView -> setShowByCategory( cat ); |
909 | 910 | ||
910 | if ( book.isEmpty() ) | 911 | if ( book.isEmpty() ) |
911 | book = "List"; | 912 | book = "List"; |
912 | if ( cat.isEmpty() ) | 913 | if ( cat.isEmpty() ) |
913 | cat = "All"; | 914 | cat = "All"; |
914 | 915 | ||
915 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); | 916 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); |
916 | } | 917 | } |
917 | 918 | ||
918 | void AddressbookWindow::slotViewSwitched( int view ) | 919 | void AddressbookWindow::slotViewSwitched( int view ) |
919 | { | 920 | { |
920 | qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); | 921 | qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); |
921 | int menu = 0; | 922 | int menu = 0; |
922 | 923 | ||
923 | // Switch to selected view | 924 | // Switch to selected view |
924 | switch ( view ){ | 925 | switch ( view ){ |
925 | case AbView::TableView: | 926 | case AbView::TableView: |
926 | menu = 1; | 927 | menu = 1; |
927 | m_tableViewButton->setOn(true); | 928 | m_tableViewButton->setOn(true); |
928 | m_cardViewButton->setOn(false); | 929 | m_cardViewButton->setOn(false); |
929 | break; | 930 | break; |
930 | case AbView::CardView: | 931 | case AbView::CardView: |
931 | menu = 2; | 932 | menu = 2; |
932 | m_tableViewButton->setOn(false); | 933 | m_tableViewButton->setOn(false); |
933 | m_cardViewButton->setOn(true); | 934 | m_cardViewButton->setOn(true); |
934 | break; | 935 | break; |
935 | } | 936 | } |
936 | for ( unsigned int i = 1; i < 3; i++ ){ | 937 | for ( unsigned int i = 1; i < 3; i++ ){ |
937 | if ( catMenu ) | 938 | if ( catMenu ) |
938 | catMenu->setItemChecked( i, menu == (int)i ); | 939 | catMenu->setItemChecked( i, menu == (int)i ); |
939 | } | 940 | } |
940 | 941 | ||
941 | // Tell the view about the selected view | 942 | // Tell the view about the selected view |
942 | m_abView -> setShowToView ( (AbView::Views) view ); | 943 | m_abView -> setShowToView ( (AbView::Views) view ); |
943 | active_view = view; | 944 | active_view = view; |
944 | } | 945 | } |
945 | 946 | ||
946 | 947 | ||
947 | void AddressbookWindow::slotListView() | 948 | void AddressbookWindow::slotListView() |
948 | { | 949 | { |
949 | slotViewSwitched( AbView::TableView ); | 950 | slotViewSwitched( AbView::TableView ); |
950 | } | 951 | } |
951 | 952 | ||
952 | void AddressbookWindow::slotCardView() | 953 | void AddressbookWindow::slotCardView() |
953 | { | 954 | { |
954 | slotViewSwitched( AbView::CardView ); | 955 | slotViewSwitched( AbView::CardView ); |
955 | } | 956 | } |
956 | 957 | ||
957 | void AddressbookWindow::slotSetLetter( char c ) { | 958 | void AddressbookWindow::slotSetLetter( char c ) { |
958 | 959 | ||
959 | m_abView->setShowByLetter( c ); | 960 | m_abView->setShowByLetter( c ); |
960 | 961 | ||
961 | } | 962 | } |
962 | 963 | ||
963 | 964 | ||
964 | void AddressbookWindow::populateCategories() | 965 | void AddressbookWindow::populateCategories() |
965 | { | 966 | { |
966 | catMenu->clear(); | 967 | catMenu->clear(); |
967 | 968 | ||
968 | int id, rememberId; | 969 | int id, rememberId; |
969 | id = 1; | 970 | id = 1; |
970 | rememberId = 0; | 971 | rememberId = 0; |
971 | 972 | ||
972 | catMenu->insertItem( Resource::loadPixmap( "datebook/weeklst" ), tr( "List" ), id++ ); | 973 | catMenu->insertItem( Resource::loadPixmap( "datebook/weeklst" ), tr( "List" ), id++ ); |
973 | catMenu->insertItem( Resource::loadPixmap( "day" ), tr( "Cards" ), id++ ); | 974 | catMenu->insertItem( Resource::loadPixmap( "day" ), tr( "Cards" ), id++ ); |
974 | // catMenu->insertItem( tr( "Personal" ), id++ ); | 975 | // catMenu->insertItem( tr( "Personal" ), id++ ); |
975 | catMenu->insertSeparator(); | 976 | catMenu->insertSeparator(); |
976 | 977 | ||
977 | catMenu->insertItem( tr( "All" ), id++ ); | 978 | catMenu->insertItem( tr( "All" ), id++ ); |
978 | QStringList categories = m_abView->categories(); | 979 | QStringList categories = m_abView->categories(); |
979 | categories.append( tr( "Unfiled" ) ); | 980 | categories.append( tr( "Unfiled" ) ); |
980 | for ( QStringList::Iterator it = categories.begin(); | 981 | for ( QStringList::Iterator it = categories.begin(); |
981 | it != categories.end(); ++it ) { | 982 | it != categories.end(); ++it ) { |
982 | catMenu->insertItem( *it, id ); | 983 | catMenu->insertItem( *it, id ); |
983 | if ( *it == m_abView -> showCategory() ) | 984 | if ( *it == m_abView -> showCategory() ) |
984 | rememberId = id; | 985 | rememberId = id; |
985 | ++id; | 986 | ++id; |
diff --git a/core/pim/addressbook/configdlg.cpp b/core/pim/addressbook/configdlg.cpp index afba688..f5c0c5b 100644 --- a/core/pim/addressbook/configdlg.cpp +++ b/core/pim/addressbook/configdlg.cpp | |||
@@ -1,137 +1,148 @@ | |||
1 | #include "configdlg.h" | 1 | #include "configdlg.h" |
2 | #include "ocontactfields.h" | 2 | #include "ocontactfields.h" |
3 | |||
3 | #include <qcheckbox.h> | 4 | #include <qcheckbox.h> |
4 | #include <qradiobutton.h> | 5 | #include <qradiobutton.h> |
5 | #include <qlistbox.h> | 6 | #include <qlistbox.h> |
6 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qiconset.h> | ||
9 | |||
10 | #include <qpe/resource.h> | ||
7 | 11 | ||
8 | #include <opie/ocontact.h> | 12 | #include <opie/ocontact.h> |
9 | 13 | ||
10 | ConfigDlg::ConfigDlg( QWidget *parent, const char *name): | 14 | ConfigDlg::ConfigDlg( QWidget *parent, const char *name): |
11 | ConfigDlg_Base(parent, name, true ) | 15 | ConfigDlg_Base(parent, name, true ) |
12 | { | 16 | { |
13 | contFields = OContactFields::trfields(); | 17 | contFields = OContactFields::trfields(); |
14 | 18 | ||
15 | // We add all Fields into the Listbox | 19 | // We add all Fields into the Listbox |
16 | for (uint i=0; i < contFields.count(); i++) { | 20 | for (uint i=0; i < contFields.count(); i++) { |
17 | allFieldListBox->insertItem( contFields[i] ); | 21 | allFieldListBox->insertItem( contFields[i] ); |
18 | } | 22 | } |
19 | 23 | ||
24 | // Set Pics to Buttons and Tabs | ||
25 | m_upButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/up" ) ) ); | ||
26 | m_downButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/down" ) ) ); | ||
27 | m_addButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/add" ) ) ); | ||
28 | m_removeButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/sub" ) ) ); | ||
29 | |||
30 | |||
20 | // Get the translation maps between Field ID and translated strings | 31 | // Get the translation maps between Field ID and translated strings |
21 | m_mapStrToID = OContactFields::trFieldsToId(); | 32 | m_mapStrToID = OContactFields::trFieldsToId(); |
22 | m_mapIDToStr = OContactFields::idToTrFields(); | 33 | m_mapIDToStr = OContactFields::idToTrFields(); |
23 | 34 | ||
24 | connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); | 35 | connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); |
25 | connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); | 36 | connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); |
26 | connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); | 37 | connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); |
27 | connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); | 38 | connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); |
28 | } | 39 | } |
29 | 40 | ||
30 | void ConfigDlg::slotItemUp() | 41 | void ConfigDlg::slotItemUp() |
31 | { | 42 | { |
32 | qWarning( "void ConfigDlg::slotItemUp()" ); | 43 | qWarning( "void ConfigDlg::slotItemUp()" ); |
33 | 44 | ||
34 | int i = fieldListBox->currentItem(); | 45 | int i = fieldListBox->currentItem(); |
35 | if ( i > 0 ) { | 46 | if ( i > 0 ) { |
36 | QString item = fieldListBox->currentText(); | 47 | QString item = fieldListBox->currentText(); |
37 | fieldListBox->removeItem( i ); | 48 | fieldListBox->removeItem( i ); |
38 | fieldListBox->insertItem( item, i-1 ); | 49 | fieldListBox->insertItem( item, i-1 ); |
39 | fieldListBox->setCurrentItem( i-1 ); | 50 | fieldListBox->setCurrentItem( i-1 ); |
40 | } | 51 | } |
41 | 52 | ||
42 | } | 53 | } |
43 | 54 | ||
44 | void ConfigDlg::slotItemDown() | 55 | void ConfigDlg::slotItemDown() |
45 | { | 56 | { |
46 | qWarning( "void ConfigDlg::slotItemDown()" ); | 57 | qWarning( "void ConfigDlg::slotItemDown()" ); |
47 | 58 | ||
48 | int i = fieldListBox->currentItem(); | 59 | int i = fieldListBox->currentItem(); |
49 | if ( i < (int)fieldListBox->count() - 1 ) { | 60 | if ( i < (int)fieldListBox->count() - 1 ) { |
50 | QString item = fieldListBox->currentText(); | 61 | QString item = fieldListBox->currentText(); |
51 | fieldListBox->removeItem( i ); | 62 | fieldListBox->removeItem( i ); |
52 | fieldListBox->insertItem( item, i+1 ); | 63 | fieldListBox->insertItem( item, i+1 ); |
53 | fieldListBox->setCurrentItem( i+1 ); | 64 | fieldListBox->setCurrentItem( i+1 ); |
54 | } | 65 | } |
55 | } | 66 | } |
56 | 67 | ||
57 | void ConfigDlg::slotItemAdd() | 68 | void ConfigDlg::slotItemAdd() |
58 | { | 69 | { |
59 | qWarning( "void ConfigDlg::slotItemAdd()" ); | 70 | qWarning( "void ConfigDlg::slotItemAdd()" ); |
60 | 71 | ||
61 | int i = allFieldListBox->currentItem(); | 72 | int i = allFieldListBox->currentItem(); |
62 | if ( i > 0 ) { | 73 | if ( i > 0 ) { |
63 | QString item = allFieldListBox->currentText(); | 74 | QString item = allFieldListBox->currentText(); |
64 | qWarning("ADding %s", item.latin1()); | 75 | qWarning("ADding %s", item.latin1()); |
65 | fieldListBox->insertItem( item ); | 76 | fieldListBox->insertItem( item ); |
66 | } | 77 | } |
67 | } | 78 | } |
68 | 79 | ||
69 | void ConfigDlg::slotItemRemove() | 80 | void ConfigDlg::slotItemRemove() |
70 | { | 81 | { |
71 | qWarning( "void ConfigDlg::slotItemRemove()" ); | 82 | qWarning( "void ConfigDlg::slotItemRemove()" ); |
72 | 83 | ||
73 | int i = fieldListBox->currentItem(); | 84 | int i = fieldListBox->currentItem(); |
74 | if ( i > 0 ) { | 85 | if ( i > 0 ) { |
75 | fieldListBox->removeItem( i ); | 86 | fieldListBox->removeItem( i ); |
76 | } | 87 | } |
77 | } | 88 | } |
78 | 89 | ||
79 | void ConfigDlg::setConfig( const AbConfig& cnf ) | 90 | void ConfigDlg::setConfig( const AbConfig& cnf ) |
80 | { | 91 | { |
81 | m_config = cnf; | 92 | m_config = cnf; |
82 | 93 | ||
83 | m_useRegExp->setChecked( m_config.useRegExp() ); | 94 | m_useRegExp->setChecked( m_config.useRegExp() ); |
84 | m_useWildCard->setChecked( m_config.useWildCards() ); | 95 | m_useWildCard->setChecked( m_config.useWildCards() ); |
85 | m_useQtMail->setChecked( m_config.useQtMail() ); | 96 | m_useQtMail->setChecked( m_config.useQtMail() ); |
86 | m_useOpieMail->setChecked( m_config.useOpieMail() ); | 97 | m_useOpieMail->setChecked( m_config.useOpieMail() ); |
87 | m_useCaseSensitive->setChecked( m_config.beCaseSensitive() ); | 98 | m_useCaseSensitive->setChecked( m_config.beCaseSensitive() ); |
88 | 99 | ||
89 | switch( m_config.fontSize() ){ | 100 | switch( m_config.fontSize() ){ |
90 | case 0: | 101 | case 0: |
91 | m_smallFont->setChecked( true ); | 102 | m_smallFont->setChecked( true ); |
92 | m_normalFont->setChecked( false ); | 103 | m_normalFont->setChecked( false ); |
93 | m_largeFont->setChecked( false ); | 104 | m_largeFont->setChecked( false ); |
94 | break; | 105 | break; |
95 | case 1: | 106 | case 1: |
96 | m_smallFont->setChecked( false ); | 107 | m_smallFont->setChecked( false ); |
97 | m_normalFont->setChecked( true ); | 108 | m_normalFont->setChecked( true ); |
98 | m_largeFont->setChecked( false ); | 109 | m_largeFont->setChecked( false ); |
99 | break; | 110 | break; |
100 | case 2: | 111 | case 2: |
101 | m_smallFont->setChecked( false ); | 112 | m_smallFont->setChecked( false ); |
102 | m_normalFont->setChecked( false ); | 113 | m_normalFont->setChecked( false ); |
103 | m_largeFont->setChecked( true ); | 114 | m_largeFont->setChecked( true ); |
104 | break; | 115 | break; |
105 | } | 116 | } |
106 | 117 | ||
107 | for( uint i = 0; i < m_config.orderList().count(); i++ ) { | 118 | for( uint i = 0; i < m_config.orderList().count(); i++ ) { |
108 | fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); | 119 | fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); |
109 | } | 120 | } |
110 | 121 | ||
111 | 122 | ||
112 | } | 123 | } |
113 | 124 | ||
114 | AbConfig ConfigDlg::getConfig() | 125 | AbConfig ConfigDlg::getConfig() |
115 | { | 126 | { |
116 | m_config.setUseRegExp( m_useRegExp->isOn() ); | 127 | m_config.setUseRegExp( m_useRegExp->isOn() ); |
117 | m_config.setUseWildCards( m_useWildCard->isOn() ); | 128 | m_config.setUseWildCards( m_useWildCard->isOn() ); |
118 | m_config.setUseQtMail( m_useQtMail->isOn() ); | 129 | m_config.setUseQtMail( m_useQtMail->isOn() ); |
119 | m_config.setUseOpieMail( m_useOpieMail->isOn() ); | 130 | m_config.setUseOpieMail( m_useOpieMail->isOn() ); |
120 | m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() ); | 131 | m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() ); |
121 | 132 | ||
122 | if ( m_smallFont->isChecked() ) | 133 | if ( m_smallFont->isChecked() ) |
123 | m_config.setFontSize( 0 ); | 134 | m_config.setFontSize( 0 ); |
124 | if ( m_normalFont->isChecked() ) | 135 | if ( m_normalFont->isChecked() ) |
125 | m_config.setFontSize( 1 ); | 136 | m_config.setFontSize( 1 ); |
126 | if ( m_largeFont->isChecked() ) | 137 | if ( m_largeFont->isChecked() ) |
127 | m_config.setFontSize( 2 ); | 138 | m_config.setFontSize( 2 ); |
128 | 139 | ||
129 | QValueList<int> orderlist; | 140 | QValueList<int> orderlist; |
130 | for( int i = 0; i < (int)fieldListBox->count(); i++ ) { | 141 | for( int i = 0; i < (int)fieldListBox->count(); i++ ) { |
131 | orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] ); | 142 | orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] ); |
132 | } | 143 | } |
133 | m_config.setOrderList( orderlist ); | 144 | m_config.setOrderList( orderlist ); |
134 | 145 | ||
135 | return m_config; | 146 | return m_config; |
136 | } | 147 | } |
137 | 148 | ||
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 9efb8c0..97573af 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -1,1322 +1,1321 @@ | |||
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 | cmbChooserField1 = new QComboBox( FALSE, container ); | 165 | cmbChooserField1 = new QComboBox( FALSE, container ); |
166 | cmbChooserField1->setMaximumWidth( 90 ); | 166 | cmbChooserField1->setMaximumWidth( 90 ); |
167 | gl->addWidget( cmbChooserField1, 3, 0 ); | 167 | gl->addWidget( cmbChooserField1, 3, 0 ); |
168 | txtChooserField1 = new QLineEdit( container ); | 168 | txtChooserField1 = new QLineEdit( container ); |
169 | gl->addWidget( txtChooserField1, 3, 1 ); | 169 | gl->addWidget( txtChooserField1, 3, 1 ); |
170 | 170 | ||
171 | cmbChooserField2 = new QComboBox( FALSE, container ); | 171 | cmbChooserField2 = new QComboBox( FALSE, container ); |
172 | cmbChooserField2->setMaximumWidth( 90 ); | 172 | cmbChooserField2->setMaximumWidth( 90 ); |
173 | gl->addWidget( cmbChooserField2, 4, 0 ); | 173 | gl->addWidget( cmbChooserField2, 4, 0 ); |
174 | txtChooserField2 = new QLineEdit( container ); | 174 | txtChooserField2 = new QLineEdit( container ); |
175 | gl->addWidget( txtChooserField2, 4, 1 ); | 175 | gl->addWidget( txtChooserField2, 4, 1 ); |
176 | 176 | ||
177 | cmbChooserField3 = new QComboBox( FALSE, container ); | 177 | cmbChooserField3 = new QComboBox( FALSE, container ); |
178 | cmbChooserField3->setMaximumWidth( 90 ); | 178 | cmbChooserField3->setMaximumWidth( 90 ); |
179 | gl->addWidget( cmbChooserField3, 5, 0 ); | 179 | gl->addWidget( cmbChooserField3, 5, 0 ); |
180 | txtChooserField3 = new QLineEdit( container ); | 180 | txtChooserField3 = new QLineEdit( container ); |
181 | gl->addWidget( txtChooserField3, 5, 1 ); | 181 | gl->addWidget( txtChooserField3, 5, 1 ); |
182 | 182 | ||
183 | l = new QLabel( tr( "File As" ), container ); | 183 | l = new QLabel( tr( "File As" ), container ); |
184 | gl->addWidget( l, 6, 0 ); | 184 | gl->addWidget( l, 6, 0 ); |
185 | cmbFileAs = new QComboBox( TRUE, container ); | 185 | cmbFileAs = new QComboBox( TRUE, container ); |
186 | gl->addWidget( cmbFileAs, 6, 1 ); | 186 | gl->addWidget( cmbFileAs, 6, 1 ); |
187 | 187 | ||
188 | labCat = new QLabel( tr( "Category" ), container ); | 188 | labCat = new QLabel( tr( "Category" ), container ); |
189 | gl->addWidget( labCat, 7, 0 ); | 189 | gl->addWidget( labCat, 7, 0 ); |
190 | cmbCat = new CategorySelect( container ); | 190 | cmbCat = new CategorySelect( container ); |
191 | gl->addWidget( cmbCat, 7, 1 ); | 191 | gl->addWidget( cmbCat, 7, 1 ); |
192 | labCat->show(); | 192 | labCat->show(); |
193 | cmbCat->show(); | 193 | cmbCat->show(); |
194 | 194 | ||
195 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 195 | btnNote = new QPushButton( tr( "Notes..." ), container ); |
196 | gl->addWidget( btnNote, 8, 1 ); | 196 | gl->addWidget( btnNote, 8, 1 ); |
197 | 197 | ||
198 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 198 | tabMain->insertTab( tabViewport, tr( "General" ) ); |
199 | 199 | ||
200 | tabViewport = new QWidget ( tabMain ); | 200 | tabViewport = new QWidget ( tabMain ); |
201 | 201 | ||
202 | vb = new QVBoxLayout( tabViewport ); | 202 | vb = new QVBoxLayout( tabViewport ); |
203 | 203 | ||
204 | svAddress = new QScrollView( tabViewport ); | 204 | svAddress = new QScrollView( tabViewport ); |
205 | vb->addWidget( svAddress, 0, 0 ); | 205 | vb->addWidget( svAddress, 0, 0 ); |
206 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 206 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
207 | svAddress->setFrameStyle( QFrame::NoFrame ); | 207 | svAddress->setFrameStyle( QFrame::NoFrame ); |
208 | 208 | ||
209 | container = new QWidget( svAddress->viewport() ); | 209 | container = new QWidget( svAddress->viewport() ); |
210 | svAddress->addChild( container ); | 210 | svAddress->addChild( container ); |
211 | 211 | ||
212 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 212 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
213 | 213 | ||
214 | cmbAddress = new QComboBox( FALSE, container ); | 214 | cmbAddress = new QComboBox( FALSE, container ); |
215 | cmbAddress->insertItem( tr( "Business" ) ); | 215 | cmbAddress->insertItem( tr( "Business" ) ); |
216 | cmbAddress->insertItem( tr( "Home" ) ); | 216 | cmbAddress->insertItem( tr( "Home" ) ); |
217 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 217 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
218 | 218 | ||
219 | l = new QLabel( tr( "Address" ), container ); | 219 | l = new QLabel( tr( "Address" ), container ); |
220 | gl->addWidget( l, 1, 0 ); | 220 | gl->addWidget( l, 1, 0 ); |
221 | txtAddress = new QLineEdit( container ); | 221 | txtAddress = new QLineEdit( container ); |
222 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 222 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
223 | 223 | ||
224 | l = new QLabel( tr( "City" ), container ); | 224 | l = new QLabel( tr( "City" ), container ); |
225 | gl->addWidget( l, 2, 0 ); | 225 | gl->addWidget( l, 2, 0 ); |
226 | txtCity = new QLineEdit( container ); | 226 | txtCity = new QLineEdit( container ); |
227 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 227 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
228 | 228 | ||
229 | l = new QLabel( tr( "State" ), container ); | 229 | l = new QLabel( tr( "State" ), container ); |
230 | gl->addWidget( l, 3, 0 ); | 230 | gl->addWidget( l, 3, 0 ); |
231 | txtState = new QLineEdit( container ); | 231 | txtState = new QLineEdit( container ); |
232 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 232 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
233 | 233 | ||
234 | l = new QLabel( tr( "Zip Code" ), container ); | 234 | l = new QLabel( tr( "Zip Code" ), container ); |
235 | gl->addWidget( l, 4, 0 ); | 235 | gl->addWidget( l, 4, 0 ); |
236 | txtZip = new QLineEdit( container ); | 236 | txtZip = new QLineEdit( container ); |
237 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 237 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
238 | 238 | ||
239 | l = new QLabel( tr( "Country" ), container ); | 239 | l = new QLabel( tr( "Country" ), container ); |
240 | gl->addWidget( l, 5, 0 ); | 240 | gl->addWidget( l, 5, 0 ); |
241 | cmbCountry = new QComboBox( TRUE, container ); | 241 | cmbCountry = new QComboBox( TRUE, container ); |
242 | cmbCountry->insertItem( tr( "" ) ); | 242 | cmbCountry->insertItem( tr( "" ) ); |
243 | cmbCountry->insertItem( tr ( "United States" ) ); | 243 | cmbCountry->insertItem( tr ( "United States" ) ); |
244 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 244 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
245 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); | 245 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); |
246 | cmbCountry->insertItem( tr ( "Albania" ) ); | 246 | cmbCountry->insertItem( tr ( "Albania" ) ); |
247 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 247 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
248 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 248 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
249 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 249 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
250 | cmbCountry->insertItem( tr ( "Angola" ) ); | 250 | cmbCountry->insertItem( tr ( "Angola" ) ); |
251 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 251 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
252 | cmbCountry->insertItem( tr ( "Antarctica" ) ); | 252 | cmbCountry->insertItem( tr ( "Antarctica" ) ); |
253 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 253 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
254 | cmbCountry->insertItem( tr ( "Armenia" ) ); | 254 | cmbCountry->insertItem( tr ( "Armenia" ) ); |
255 | cmbCountry->insertItem( tr ( "Aruba" ) ); | 255 | cmbCountry->insertItem( tr ( "Aruba" ) ); |
256 | cmbCountry->insertItem( tr ( "Australia" ) ); | 256 | cmbCountry->insertItem( tr ( "Australia" ) ); |
257 | cmbCountry->insertItem( tr ( "Austria" ) ); | 257 | cmbCountry->insertItem( tr ( "Austria" ) ); |
258 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); | 258 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); |
259 | cmbCountry->insertItem( tr ( "Bahamas" ) ); | 259 | cmbCountry->insertItem( tr ( "Bahamas" ) ); |
260 | cmbCountry->insertItem( tr ( "Bahrain" ) ); | 260 | cmbCountry->insertItem( tr ( "Bahrain" ) ); |
261 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); | 261 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); |
262 | cmbCountry->insertItem( tr ( "Barbados" ) ); | 262 | cmbCountry->insertItem( tr ( "Barbados" ) ); |
263 | cmbCountry->insertItem( tr ( "Belarus" ) ); | 263 | cmbCountry->insertItem( tr ( "Belarus" ) ); |
264 | cmbCountry->insertItem( tr ( "Belgium" ) ); | 264 | cmbCountry->insertItem( tr ( "Belgium" ) ); |
265 | cmbCountry->insertItem( tr ( "Belize" ) ); | 265 | cmbCountry->insertItem( tr ( "Belize" ) ); |
266 | cmbCountry->insertItem( tr ( "Benin" ) ); | 266 | cmbCountry->insertItem( tr ( "Benin" ) ); |
267 | cmbCountry->insertItem( tr ( "Bermuda" ) ); | 267 | cmbCountry->insertItem( tr ( "Bermuda" ) ); |
268 | cmbCountry->insertItem( tr ( "Bhutan" ) ); | 268 | cmbCountry->insertItem( tr ( "Bhutan" ) ); |
269 | cmbCountry->insertItem( tr ( "Bolivia" ) ); | 269 | cmbCountry->insertItem( tr ( "Bolivia" ) ); |
270 | cmbCountry->insertItem( tr ( "Botswana" ) ); | 270 | cmbCountry->insertItem( tr ( "Botswana" ) ); |
271 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); | 271 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); |
272 | cmbCountry->insertItem( tr ( "Brazil" ) ); | 272 | cmbCountry->insertItem( tr ( "Brazil" ) ); |
273 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); | 273 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); |
274 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); | 274 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); |
275 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); | 275 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); |
276 | cmbCountry->insertItem( tr ( "Burundi" ) ); | 276 | cmbCountry->insertItem( tr ( "Burundi" ) ); |
277 | cmbCountry->insertItem( tr ( "Cambodia" ) ); | 277 | cmbCountry->insertItem( tr ( "Cambodia" ) ); |
278 | cmbCountry->insertItem( tr ( "Cameroon" ) ); | 278 | cmbCountry->insertItem( tr ( "Cameroon" ) ); |
279 | cmbCountry->insertItem( tr ( "Canada" ) ); | 279 | cmbCountry->insertItem( tr ( "Canada" ) ); |
280 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); | 280 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); |
281 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); | 281 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); |
282 | cmbCountry->insertItem( tr ( "Chad" ) ); | 282 | cmbCountry->insertItem( tr ( "Chad" ) ); |
283 | cmbCountry->insertItem( tr ( "Chile" ) ); | 283 | cmbCountry->insertItem( tr ( "Chile" ) ); |
284 | cmbCountry->insertItem( tr ( "China" ) ); | 284 | cmbCountry->insertItem( tr ( "China" ) ); |
285 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); | 285 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); |
286 | cmbCountry->insertItem( tr ( "Colombia" ) ); | 286 | cmbCountry->insertItem( tr ( "Colombia" ) ); |
287 | cmbCountry->insertItem( tr ( "Comoros" ) ); | 287 | cmbCountry->insertItem( tr ( "Comoros" ) ); |
288 | cmbCountry->insertItem( tr ( "Congo" ) ); | 288 | cmbCountry->insertItem( tr ( "Congo" ) ); |
289 | cmbCountry->insertItem( tr ( "Cook Island" ) ); | 289 | cmbCountry->insertItem( tr ( "Cook Island" ) ); |
290 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); | 290 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); |
291 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); | 291 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); |
292 | cmbCountry->insertItem( tr ( "Croatia" ) ); | 292 | cmbCountry->insertItem( tr ( "Croatia" ) ); |
293 | cmbCountry->insertItem( tr ( "Cuba" ) ); | 293 | cmbCountry->insertItem( tr ( "Cuba" ) ); |
294 | cmbCountry->insertItem( tr ( "Cyprus" ) ); | 294 | cmbCountry->insertItem( tr ( "Cyprus" ) ); |
295 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); | 295 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); |
296 | cmbCountry->insertItem( tr ( "Denmark" ) ); | 296 | cmbCountry->insertItem( tr ( "Denmark" ) ); |
297 | cmbCountry->insertItem( tr ( "Djibouti" ) ); | 297 | cmbCountry->insertItem( tr ( "Djibouti" ) ); |
298 | cmbCountry->insertItem( tr ( "Dominica" ) ); | 298 | cmbCountry->insertItem( tr ( "Dominica" ) ); |
299 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); | 299 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); |
300 | cmbCountry->insertItem( tr ( "East Timor" ) ); | 300 | cmbCountry->insertItem( tr ( "East Timor" ) ); |
301 | cmbCountry->insertItem( tr ( "Ecuador" ) ); | 301 | cmbCountry->insertItem( tr ( "Ecuador" ) ); |
302 | cmbCountry->insertItem( tr ( "Egypt" ) ); | 302 | cmbCountry->insertItem( tr ( "Egypt" ) ); |
303 | cmbCountry->insertItem( tr ( "El Salvador" ) ); | 303 | cmbCountry->insertItem( tr ( "El Salvador" ) ); |
304 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); | 304 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); |
305 | cmbCountry->insertItem( tr ( "Eritrea" ) ); | 305 | cmbCountry->insertItem( tr ( "Eritrea" ) ); |
306 | cmbCountry->insertItem( tr ( "Estonia" ) ); | 306 | cmbCountry->insertItem( tr ( "Estonia" ) ); |
307 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); | 307 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); |
308 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); | 308 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); |
309 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); | 309 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); |
310 | cmbCountry->insertItem( tr ( "Fiji" ) ); | 310 | cmbCountry->insertItem( tr ( "Fiji" ) ); |
311 | cmbCountry->insertItem( tr ( "Finland" ) ); | 311 | cmbCountry->insertItem( tr ( "Finland" ) ); |
312 | cmbCountry->insertItem( tr ( "France" ) ); | 312 | cmbCountry->insertItem( tr ( "France" ) ); |
313 | cmbCountry->insertItem( tr ( "French Guiana" ) ); | 313 | cmbCountry->insertItem( tr ( "French Guiana" ) ); |
314 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); | 314 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); |
315 | cmbCountry->insertItem( tr ( "Gabon" ) ); | 315 | cmbCountry->insertItem( tr ( "Gabon" ) ); |
316 | cmbCountry->insertItem( tr ( "Gambia" ) ); | 316 | cmbCountry->insertItem( tr ( "Gambia" ) ); |
317 | cmbCountry->insertItem( tr ( "Georgia" ) ); | 317 | cmbCountry->insertItem( tr ( "Georgia" ) ); |
318 | cmbCountry->insertItem( tr ( "Germany" ) ); | 318 | cmbCountry->insertItem( tr ( "Germany" ) ); |
319 | cmbCountry->insertItem( tr ( "Ghana" ) ); | 319 | cmbCountry->insertItem( tr ( "Ghana" ) ); |
320 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); | 320 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); |
321 | cmbCountry->insertItem( tr ( "Greece" ) ); | 321 | cmbCountry->insertItem( tr ( "Greece" ) ); |
322 | cmbCountry->insertItem( tr ( "Greenland" ) ); | 322 | cmbCountry->insertItem( tr ( "Greenland" ) ); |
323 | cmbCountry->insertItem( tr ( "Grenada" ) ); | 323 | cmbCountry->insertItem( tr ( "Grenada" ) ); |
324 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); | 324 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); |
325 | cmbCountry->insertItem( tr ( "Guam" ) ); | 325 | cmbCountry->insertItem( tr ( "Guam" ) ); |
326 | cmbCountry->insertItem( tr ( "Guatemala" ) ); | 326 | cmbCountry->insertItem( tr ( "Guatemala" ) ); |
327 | cmbCountry->insertItem( tr ( "Guinea" ) ); | 327 | cmbCountry->insertItem( tr ( "Guinea" ) ); |
328 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); | 328 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); |
329 | cmbCountry->insertItem( tr ( "Guyana" ) ); | 329 | cmbCountry->insertItem( tr ( "Guyana" ) ); |
330 | cmbCountry->insertItem( tr ( "Haiti" ) ); | 330 | cmbCountry->insertItem( tr ( "Haiti" ) ); |
331 | cmbCountry->insertItem( tr ( "Holy See" ) ); | 331 | cmbCountry->insertItem( tr ( "Holy See" ) ); |
332 | cmbCountry->insertItem( tr ( "Honduras" ) ); | 332 | cmbCountry->insertItem( tr ( "Honduras" ) ); |
333 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); | 333 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); |
334 | cmbCountry->insertItem( tr ( "Hungary" ) ); | 334 | cmbCountry->insertItem( tr ( "Hungary" ) ); |
335 | cmbCountry->insertItem( tr ( "Iceland" ) ); | 335 | cmbCountry->insertItem( tr ( "Iceland" ) ); |
336 | cmbCountry->insertItem( tr ( "India" ) ); | 336 | cmbCountry->insertItem( tr ( "India" ) ); |
337 | cmbCountry->insertItem( tr ( "Indonesia" ) ); | 337 | cmbCountry->insertItem( tr ( "Indonesia" ) ); |
338 | cmbCountry->insertItem( tr ( "Ireland" ) ); | 338 | cmbCountry->insertItem( tr ( "Ireland" ) ); |
339 | cmbCountry->insertItem( tr ( "Israel" ) ); | 339 | cmbCountry->insertItem( tr ( "Israel" ) ); |
340 | cmbCountry->insertItem( tr ( "Italy" ) ); | 340 | cmbCountry->insertItem( tr ( "Italy" ) ); |
341 | cmbCountry->insertItem( tr ( "Jamaica" ) ); | 341 | cmbCountry->insertItem( tr ( "Jamaica" ) ); |
342 | cmbCountry->insertItem( tr ( "Japan" ) ); | 342 | cmbCountry->insertItem( tr ( "Japan" ) ); |
343 | cmbCountry->insertItem( tr ( "Jordan" ) ); | 343 | cmbCountry->insertItem( tr ( "Jordan" ) ); |
344 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); | 344 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); |
345 | cmbCountry->insertItem( tr ( "Kenya" ) ); | 345 | cmbCountry->insertItem( tr ( "Kenya" ) ); |
346 | cmbCountry->insertItem( tr ( "Kiribati" ) ); | 346 | cmbCountry->insertItem( tr ( "Kiribati" ) ); |
347 | cmbCountry->insertItem( tr ( "Korea" ) ); | 347 | cmbCountry->insertItem( tr ( "Korea" ) ); |
348 | cmbCountry->insertItem( tr ( "Kuwait" ) ); | 348 | cmbCountry->insertItem( tr ( "Kuwait" ) ); |
349 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); | 349 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); |
350 | cmbCountry->insertItem( tr ( "Laos" ) ); | 350 | cmbCountry->insertItem( tr ( "Laos" ) ); |
351 | cmbCountry->insertItem( tr ( "Latvia" ) ); | 351 | cmbCountry->insertItem( tr ( "Latvia" ) ); |
352 | cmbCountry->insertItem( tr ( "Lebanon" ) ); | 352 | cmbCountry->insertItem( tr ( "Lebanon" ) ); |
353 | cmbCountry->insertItem( tr ( "Lesotho" ) ); | 353 | cmbCountry->insertItem( tr ( "Lesotho" ) ); |
354 | cmbCountry->insertItem( tr ( "Liberia" ) ); | 354 | cmbCountry->insertItem( tr ( "Liberia" ) ); |
355 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); | 355 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); |
356 | cmbCountry->insertItem( tr ( "Lithuania" ) ); | 356 | cmbCountry->insertItem( tr ( "Lithuania" ) ); |
357 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); | 357 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); |
358 | cmbCountry->insertItem( tr ( "Macau" ) ); | 358 | cmbCountry->insertItem( tr ( "Macau" ) ); |
359 | cmbCountry->insertItem( tr ( "Macedonia" ) ); | 359 | cmbCountry->insertItem( tr ( "Macedonia" ) ); |
360 | cmbCountry->insertItem( tr ( "Madagascar" ) ); | 360 | cmbCountry->insertItem( tr ( "Madagascar" ) ); |
361 | cmbCountry->insertItem( tr ( "Malawi" ) ); | 361 | cmbCountry->insertItem( tr ( "Malawi" ) ); |
362 | cmbCountry->insertItem( tr ( "Malaysia" ) ); | 362 | cmbCountry->insertItem( tr ( "Malaysia" ) ); |
363 | cmbCountry->insertItem( tr ( "Maldives" ) ); | 363 | cmbCountry->insertItem( tr ( "Maldives" ) ); |
364 | cmbCountry->insertItem( tr ( "Mali" ) ); | 364 | cmbCountry->insertItem( tr ( "Mali" ) ); |
365 | cmbCountry->insertItem( tr ( "Malta" ) ); | 365 | cmbCountry->insertItem( tr ( "Malta" ) ); |
366 | cmbCountry->insertItem( tr ( "Martinique" ) ); | 366 | cmbCountry->insertItem( tr ( "Martinique" ) ); |
367 | cmbCountry->insertItem( tr ( "Mauritania" ) ); | 367 | cmbCountry->insertItem( tr ( "Mauritania" ) ); |
368 | cmbCountry->insertItem( tr ( "Mauritius" ) ); | 368 | cmbCountry->insertItem( tr ( "Mauritius" ) ); |
369 | cmbCountry->insertItem( tr ( "Mayotte" ) ); | 369 | cmbCountry->insertItem( tr ( "Mayotte" ) ); |
370 | cmbCountry->insertItem( tr ( "Mexico" ) ); | 370 | cmbCountry->insertItem( tr ( "Mexico" ) ); |
371 | cmbCountry->insertItem( tr ( "Micronesia" ) ); | 371 | cmbCountry->insertItem( tr ( "Micronesia" ) ); |
372 | cmbCountry->insertItem( tr ( "Moldova" ) ); | 372 | cmbCountry->insertItem( tr ( "Moldova" ) ); |
373 | cmbCountry->insertItem( tr ( "Monaco" ) ); | 373 | cmbCountry->insertItem( tr ( "Monaco" ) ); |
374 | cmbCountry->insertItem( tr ( "Mongolia" ) ); | 374 | cmbCountry->insertItem( tr ( "Mongolia" ) ); |
375 | cmbCountry->insertItem( tr ( "Montserrat" ) ); | 375 | cmbCountry->insertItem( tr ( "Montserrat" ) ); |
376 | cmbCountry->insertItem( tr ( "Morocco" ) ); | 376 | cmbCountry->insertItem( tr ( "Morocco" ) ); |
377 | cmbCountry->insertItem( tr ( "Mozambique" ) ); | 377 | cmbCountry->insertItem( tr ( "Mozambique" ) ); |
378 | cmbCountry->insertItem( tr ( "Myanmar" ) ); | 378 | cmbCountry->insertItem( tr ( "Myanmar" ) ); |
379 | cmbCountry->insertItem( tr ( "Namibia" ) ); | 379 | cmbCountry->insertItem( tr ( "Namibia" ) ); |
380 | cmbCountry->insertItem( tr ( "Nauru" ) ); | 380 | cmbCountry->insertItem( tr ( "Nauru" ) ); |
381 | cmbCountry->insertItem( tr ( "Nepal" ) ); | 381 | cmbCountry->insertItem( tr ( "Nepal" ) ); |
382 | cmbCountry->insertItem( tr ( "Netherlands" ) ); | 382 | cmbCountry->insertItem( tr ( "Netherlands" ) ); |
383 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); | 383 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); |
384 | cmbCountry->insertItem( tr ( "New Zealand" ) ); | 384 | cmbCountry->insertItem( tr ( "New Zealand" ) ); |
385 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); | 385 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); |
386 | cmbCountry->insertItem( tr ( "Niger" ) ); | 386 | cmbCountry->insertItem( tr ( "Niger" ) ); |
387 | cmbCountry->insertItem( tr ( "Nigeria" ) ); | 387 | cmbCountry->insertItem( tr ( "Nigeria" ) ); |
388 | cmbCountry->insertItem( tr ( "Niue" ) ); | 388 | cmbCountry->insertItem( tr ( "Niue" ) ); |
389 | cmbCountry->insertItem( tr ( "Norway" ) ); | 389 | cmbCountry->insertItem( tr ( "Norway" ) ); |
390 | cmbCountry->insertItem( tr ( "Oman" ) ); | 390 | cmbCountry->insertItem( tr ( "Oman" ) ); |
391 | cmbCountry->insertItem( tr ( "Pakistan" ) ); | 391 | cmbCountry->insertItem( tr ( "Pakistan" ) ); |
392 | cmbCountry->insertItem( tr ( "Palau" ) ); | 392 | cmbCountry->insertItem( tr ( "Palau" ) ); |
393 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); | 393 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); |
394 | cmbCountry->insertItem( tr ( "Panama" ) ); | 394 | cmbCountry->insertItem( tr ( "Panama" ) ); |
395 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); | 395 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); |
396 | cmbCountry->insertItem( tr ( "Paraguay" ) ); | 396 | cmbCountry->insertItem( tr ( "Paraguay" ) ); |
397 | cmbCountry->insertItem( tr ( "Peru" ) ); | 397 | cmbCountry->insertItem( tr ( "Peru" ) ); |
398 | cmbCountry->insertItem( tr ( "Philippines" ) ); | 398 | cmbCountry->insertItem( tr ( "Philippines" ) ); |
399 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); | 399 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); |
400 | cmbCountry->insertItem( tr ( "Poland" ) ); | 400 | cmbCountry->insertItem( tr ( "Poland" ) ); |
401 | cmbCountry->insertItem( tr ( "Portugal" ) ); | 401 | cmbCountry->insertItem( tr ( "Portugal" ) ); |
402 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); | 402 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); |
403 | cmbCountry->insertItem( tr ( "Qatar" ) ); | 403 | cmbCountry->insertItem( tr ( "Qatar" ) ); |
404 | cmbCountry->insertItem( tr ( "Reunion" ) ); | 404 | cmbCountry->insertItem( tr ( "Reunion" ) ); |
405 | cmbCountry->insertItem( tr ( "Romania" ) ); | 405 | cmbCountry->insertItem( tr ( "Romania" ) ); |
406 | cmbCountry->insertItem( tr ( "Russia" ) ); | 406 | cmbCountry->insertItem( tr ( "Russia" ) ); |
407 | cmbCountry->insertItem( tr ( "Rwanda" ) ); | 407 | cmbCountry->insertItem( tr ( "Rwanda" ) ); |
408 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); | 408 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); |
409 | cmbCountry->insertItem( tr ( "Samoa" ) ); | 409 | cmbCountry->insertItem( tr ( "Samoa" ) ); |
410 | cmbCountry->insertItem( tr ( "San Marino" ) ); | 410 | cmbCountry->insertItem( tr ( "San Marino" ) ); |
411 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); | 411 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); |
412 | cmbCountry->insertItem( tr ( "Senegal" ) ); | 412 | cmbCountry->insertItem( tr ( "Senegal" ) ); |
413 | cmbCountry->insertItem( tr ( "Seychelles" ) ); | 413 | cmbCountry->insertItem( tr ( "Seychelles" ) ); |
414 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); | 414 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); |
415 | cmbCountry->insertItem( tr ( "Singapore" ) ); | 415 | cmbCountry->insertItem( tr ( "Singapore" ) ); |
416 | cmbCountry->insertItem( tr ( "Slovakia" ) ); | 416 | cmbCountry->insertItem( tr ( "Slovakia" ) ); |
417 | cmbCountry->insertItem( tr ( "Slovenia" ) ); | 417 | cmbCountry->insertItem( tr ( "Slovenia" ) ); |
418 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); | 418 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); |
419 | cmbCountry->insertItem( tr ( "Somalia" ) ); | 419 | cmbCountry->insertItem( tr ( "Somalia" ) ); |
420 | cmbCountry->insertItem( tr ( "South Africa" ) ); | 420 | cmbCountry->insertItem( tr ( "South Africa" ) ); |
421 | cmbCountry->insertItem( tr ( "Spain" ) ); | 421 | cmbCountry->insertItem( tr ( "Spain" ) ); |
422 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); | 422 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); |
423 | cmbCountry->insertItem( tr ( "St. Helena" ) ); | 423 | cmbCountry->insertItem( tr ( "St. Helena" ) ); |
424 | cmbCountry->insertItem( tr ( "Sudan" ) ); | 424 | cmbCountry->insertItem( tr ( "Sudan" ) ); |
425 | cmbCountry->insertItem( tr ( "Suriname" ) ); | 425 | cmbCountry->insertItem( tr ( "Suriname" ) ); |
426 | cmbCountry->insertItem( tr ( "Swaziland" ) ); | 426 | cmbCountry->insertItem( tr ( "Swaziland" ) ); |
427 | cmbCountry->insertItem( tr ( "Sweden" ) ); | 427 | cmbCountry->insertItem( tr ( "Sweden" ) ); |
428 | cmbCountry->insertItem( tr ( "Switzerland" ) ); | 428 | cmbCountry->insertItem( tr ( "Switzerland" ) ); |
429 | cmbCountry->insertItem( tr ( "Taiwan" ) ); | 429 | cmbCountry->insertItem( tr ( "Taiwan" ) ); |
430 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); | 430 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); |
431 | cmbCountry->insertItem( tr ( "Tanzania" ) ); | 431 | cmbCountry->insertItem( tr ( "Tanzania" ) ); |
432 | cmbCountry->insertItem( tr ( "Thailand" ) ); | 432 | cmbCountry->insertItem( tr ( "Thailand" ) ); |
433 | cmbCountry->insertItem( tr ( "Togo" ) ); | 433 | cmbCountry->insertItem( tr ( "Togo" ) ); |
434 | cmbCountry->insertItem( tr ( "Tokelau" ) ); | 434 | cmbCountry->insertItem( tr ( "Tokelau" ) ); |
435 | cmbCountry->insertItem( tr ( "Tonga" ) ); | 435 | cmbCountry->insertItem( tr ( "Tonga" ) ); |
436 | cmbCountry->insertItem( tr ( "Tunisia" ) ); | 436 | cmbCountry->insertItem( tr ( "Tunisia" ) ); |
437 | cmbCountry->insertItem( tr ( "Turkey" ) ); | 437 | cmbCountry->insertItem( tr ( "Turkey" ) ); |
438 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); | 438 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); |
439 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); | 439 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); |
440 | cmbCountry->insertItem( tr ( "Uganda" ) ); | 440 | cmbCountry->insertItem( tr ( "Uganda" ) ); |
441 | cmbCountry->insertItem( tr ( "Ukraine" ) ); | 441 | cmbCountry->insertItem( tr ( "Ukraine" ) ); |
442 | cmbCountry->insertItem( tr ( "Uruguay" ) ); | 442 | cmbCountry->insertItem( tr ( "Uruguay" ) ); |
443 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); | 443 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); |
444 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); | 444 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); |
445 | cmbCountry->insertItem( tr ( "Venezuela" ) ); | 445 | cmbCountry->insertItem( tr ( "Venezuela" ) ); |
446 | cmbCountry->insertItem( tr ( "Vietnam" ) ); | 446 | cmbCountry->insertItem( tr ( "Vietnam" ) ); |
447 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); | 447 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); |
448 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); | 448 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); |
449 | cmbCountry->insertItem( tr ( "Yemen" ) ); | 449 | cmbCountry->insertItem( tr ( "Yemen" ) ); |
450 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); | 450 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); |
451 | cmbCountry->insertItem( tr ( "Zambia" ) ); | 451 | cmbCountry->insertItem( tr ( "Zambia" ) ); |
452 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); | 452 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); |
453 | if (cmbCountry->listBox()!=0) | 453 | if (cmbCountry->listBox()!=0) |
454 | cmbCountry->listBox()->sort(); | 454 | cmbCountry->listBox()->sort(); |
455 | 455 | ||
456 | cmbCountry->setMaximumWidth( 135 ); | 456 | cmbCountry->setMaximumWidth( 135 ); |
457 | 457 | ||
458 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 458 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
459 | 459 | ||
460 | cmbChooserField4 = new QComboBox( FALSE, container ); | 460 | cmbChooserField4 = new QComboBox( FALSE, container ); |
461 | cmbChooserField4->setMaximumWidth( 90 ); | 461 | cmbChooserField4->setMaximumWidth( 90 ); |
462 | gl->addWidget( cmbChooserField4, 6, 0 ); | 462 | gl->addWidget( cmbChooserField4, 6, 0 ); |
463 | txtChooserField4 = new QLineEdit( container ); | 463 | txtChooserField4 = new QLineEdit( container ); |
464 | gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); | 464 | gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); |
465 | 465 | ||
466 | QSpacerItem *space = new QSpacerItem(1,1, | 466 | QSpacerItem *space = new QSpacerItem(1,1, |
467 | QSizePolicy::Maximum, | 467 | QSizePolicy::Maximum, |
468 | QSizePolicy::MinimumExpanding ); | 468 | QSizePolicy::MinimumExpanding ); |
469 | gl->addItem( space, 7, 0 ); | 469 | gl->addItem( space, 7, 0 ); |
470 | 470 | ||
471 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 471 | tabMain->insertTab( tabViewport, tr( "Address" ) ); |
472 | 472 | ||
473 | tabViewport = new QWidget ( tabMain ); | 473 | tabViewport = new QWidget ( tabMain ); |
474 | 474 | ||
475 | vb = new QVBoxLayout( tabViewport ); | 475 | vb = new QVBoxLayout( tabViewport ); |
476 | 476 | ||
477 | svDetails = new QScrollView( tabViewport ); | 477 | svDetails = new QScrollView( tabViewport ); |
478 | vb->addWidget( svDetails, 0, 0 ); | 478 | vb->addWidget( svDetails, 0, 0 ); |
479 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 479 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
480 | svDetails->setFrameStyle( QFrame::NoFrame ); | 480 | svDetails->setFrameStyle( QFrame::NoFrame ); |
481 | 481 | ||
482 | container = new QWidget( svDetails->viewport() ); | 482 | container = new QWidget( svDetails->viewport() ); |
483 | svDetails->addChild( container ); | 483 | svDetails->addChild( container ); |
484 | 484 | ||
485 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 485 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
486 | 486 | ||
487 | int counter = 0; | 487 | int counter = 0; |
488 | 488 | ||
489 | // Birthday | 489 | // Birthday |
490 | QHBox* hBox = new QHBox( container ); | 490 | QHBox* hBox = new QHBox( container ); |
491 | l = new QLabel( tr("Birthday"), container ); | 491 | l = new QLabel( tr("Birthday"), container ); |
492 | gl->addWidget( l, counter, 0 ); | 492 | gl->addWidget( l, counter, 0 ); |
493 | 493 | ||
494 | QPopupMenu* m1 = new QPopupMenu( container ); | 494 | QPopupMenu* m1 = new QPopupMenu( container ); |
495 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | 495 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); |
496 | m1->insertItem( birthdayPicker ); | 496 | m1->insertItem( birthdayPicker ); |
497 | 497 | ||
498 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 498 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
499 | birthdayButton->setPopup( m1 ); | 499 | birthdayButton->setPopup( m1 ); |
500 | birthdayButton->setPopupDelay(0); | 500 | birthdayButton->setPopupDelay(0); |
501 | 501 | ||
502 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 502 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
503 | tr( "Delete" ), | 503 | tr( "Delete" ), |
504 | hBox, 0 ); | 504 | hBox, 0 ); |
505 | 505 | ||
506 | gl->addWidget( hBox, counter , 1 ); | 506 | gl->addWidget( hBox, counter , 1 ); |
507 | 507 | ||
508 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), | 508 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), |
509 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); | 509 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); |
510 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | 510 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); |
511 | 511 | ||
512 | ++counter; | 512 | ++counter; |
513 | 513 | ||
514 | // Anniversary | 514 | // Anniversary |
515 | hBox = new QHBox( container ); | 515 | hBox = new QHBox( container ); |
516 | l = new QLabel( tr("Anniversary"), container ); | 516 | l = new QLabel( tr("Anniversary"), container ); |
517 | gl->addWidget( l, counter, 0 ); | 517 | gl->addWidget( l, counter, 0 ); |
518 | 518 | ||
519 | m1 = new QPopupMenu( container ); | 519 | m1 = new QPopupMenu( container ); |
520 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 520 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); |
521 | m1->insertItem( anniversaryPicker ); | 521 | m1->insertItem( anniversaryPicker ); |
522 | 522 | ||
523 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 523 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
524 | anniversaryButton->setPopup( m1 ); | 524 | anniversaryButton->setPopup( m1 ); |
525 | anniversaryButton->setPopupDelay(0); | 525 | anniversaryButton->setPopupDelay(0); |
526 | 526 | ||
527 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 527 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
528 | tr( "Delete" ), | 528 | tr( "Delete" ), |
529 | hBox, 0 ); | 529 | hBox, 0 ); |
530 | gl->addWidget( hBox, counter , 1 ); | 530 | gl->addWidget( hBox, counter , 1 ); |
531 | 531 | ||
532 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), | 532 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), |
533 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); | 533 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); |
534 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); | 534 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); |
535 | 535 | ||
536 | ++counter; | 536 | ++counter; |
537 | 537 | ||
538 | // Gender | 538 | // Gender |
539 | l = new QLabel( tr("Gender"), container ); | 539 | l = new QLabel( tr("Gender"), container ); |
540 | gl->addWidget( l, counter, 0 ); | 540 | gl->addWidget( l, counter, 0 ); |
541 | cmbGender = new QComboBox( container ); | 541 | cmbGender = new QComboBox( container ); |
542 | cmbGender->insertItem( "", 0 ); | 542 | cmbGender->insertItem( "", 0 ); |
543 | cmbGender->insertItem( tr("Male"), 1); | 543 | cmbGender->insertItem( tr("Male"), 1); |
544 | cmbGender->insertItem( tr("Female"), 2); | 544 | cmbGender->insertItem( tr("Female"), 2); |
545 | gl->addWidget( cmbGender, counter, 1 ); | 545 | gl->addWidget( cmbGender, counter, 1 ); |
546 | 546 | ||
547 | ++counter; | 547 | ++counter; |
548 | 548 | ||
549 | // Create Labels and lineedit fields for every dynamic entry | 549 | // Create Labels and lineedit fields for every dynamic entry |
550 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 550 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
551 | QStringList::ConstIterator trit = trlDynamicEntries.begin(); | ||
552 | QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); | 551 | QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); |
553 | QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); | 552 | QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); |
554 | for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) { | 553 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { |
555 | 554 | ||
556 | if (((*it) == "Anniversary") || | 555 | if (((*it) == "Anniversary") || |
557 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | 556 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; |
558 | 557 | ||
559 | l = new QLabel( mapIdToStr[mapStrToID[*it]].utf8() , container ); | 558 | l = new QLabel( mapIdToStr[mapStrToID[*it]].utf8() , container ); |
560 | listName.append( l ); | 559 | listName.append( l ); |
561 | gl->addWidget( l, i, 0 ); | 560 | gl->addWidget( l, i, 0 ); |
562 | QLineEdit *e = new QLineEdit( container ); | 561 | QLineEdit *e = new QLineEdit( container ); |
563 | listValue.append( e ); | 562 | listValue.append( e ); |
564 | gl->addWidget( e, i, 1); | 563 | gl->addWidget( e, i, 1); |
565 | } | 564 | } |
566 | // Fill labels with names.. | 565 | // Fill labels with names.. |
567 | //loadFields(); | 566 | //loadFields(); |
568 | 567 | ||
569 | 568 | ||
570 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 569 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
571 | 570 | ||
572 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 571 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
573 | dlgNote->setCaption( tr("Enter Note") ); | 572 | dlgNote->setCaption( tr("Enter Note") ); |
574 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 573 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
575 | txtNote = new QMultiLineEdit( dlgNote ); | 574 | txtNote = new QMultiLineEdit( dlgNote ); |
576 | vbNote->addWidget( txtNote ); | 575 | vbNote->addWidget( txtNote ); |
577 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 576 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
578 | 577 | ||
579 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 578 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
580 | dlgName->setCaption( tr("Edit Name") ); | 579 | dlgName->setCaption( tr("Edit Name") ); |
581 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 580 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
582 | 581 | ||
583 | l = new QLabel( tr("First Name"), dlgName ); | 582 | l = new QLabel( tr("First Name"), dlgName ); |
584 | gl->addWidget( l, 0, 0 ); | 583 | gl->addWidget( l, 0, 0 ); |
585 | txtFirstName = new QLineEdit( dlgName ); | 584 | txtFirstName = new QLineEdit( dlgName ); |
586 | gl->addWidget( txtFirstName, 0, 1 ); | 585 | gl->addWidget( txtFirstName, 0, 1 ); |
587 | 586 | ||
588 | l = new QLabel( tr("Middle Name"), dlgName ); | 587 | l = new QLabel( tr("Middle Name"), dlgName ); |
589 | gl->addWidget( l, 1, 0 ); | 588 | gl->addWidget( l, 1, 0 ); |
590 | txtMiddleName = new QLineEdit( dlgName ); | 589 | txtMiddleName = new QLineEdit( dlgName ); |
591 | gl->addWidget( txtMiddleName, 1, 1 ); | 590 | gl->addWidget( txtMiddleName, 1, 1 ); |
592 | 591 | ||
593 | l = new QLabel( tr("Last Name"), dlgName ); | 592 | l = new QLabel( tr("Last Name"), dlgName ); |
594 | gl->addWidget( l, 2, 0 ); | 593 | gl->addWidget( l, 2, 0 ); |
595 | txtLastName = new QLineEdit( dlgName ); | 594 | txtLastName = new QLineEdit( dlgName ); |
596 | gl->addWidget( txtLastName, 2, 1 ); | 595 | gl->addWidget( txtLastName, 2, 1 ); |
597 | 596 | ||
598 | l = new QLabel( tr("Suffix"), dlgName ); | 597 | l = new QLabel( tr("Suffix"), dlgName ); |
599 | gl->addWidget( l, 3, 0 ); | 598 | gl->addWidget( l, 3, 0 ); |
600 | txtSuffix = new QLineEdit( dlgName ); | 599 | txtSuffix = new QLineEdit( dlgName ); |
601 | gl->addWidget( txtSuffix, 3, 1 ); | 600 | gl->addWidget( txtSuffix, 3, 1 ); |
602 | space = new QSpacerItem(1,1, | 601 | space = new QSpacerItem(1,1, |
603 | QSizePolicy::Maximum, | 602 | QSizePolicy::Maximum, |
604 | QSizePolicy::MinimumExpanding ); | 603 | QSizePolicy::MinimumExpanding ); |
605 | gl->addItem( space, 4, 0 ); | 604 | gl->addItem( space, 4, 0 ); |
606 | 605 | ||
607 | cmbChooserField1->insertStringList( trlChooserNames ); | 606 | cmbChooserField1->insertStringList( trlChooserNames ); |
608 | cmbChooserField2->insertStringList( trlChooserNames ); | 607 | cmbChooserField2->insertStringList( trlChooserNames ); |
609 | cmbChooserField3->insertStringList( trlChooserNames ); | 608 | cmbChooserField3->insertStringList( trlChooserNames ); |
610 | cmbChooserField4->insertStringList( trlChooserNames ); | 609 | cmbChooserField4->insertStringList( trlChooserNames ); |
611 | 610 | ||
612 | cmbChooserField1->setCurrentItem( 0 ); | 611 | cmbChooserField1->setCurrentItem( 0 ); |
613 | cmbChooserField2->setCurrentItem( 1 ); | 612 | cmbChooserField2->setCurrentItem( 1 ); |
614 | cmbChooserField3->setCurrentItem( 2 ); | 613 | cmbChooserField3->setCurrentItem( 2 ); |
615 | 614 | ||
616 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 615 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
617 | 616 | ||
618 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); | 617 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); |
619 | 618 | ||
620 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), | 619 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), |
621 | this, SLOT(slotChooser1Change(const QString &)) ); | 620 | this, SLOT(slotChooser1Change(const QString &)) ); |
622 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), | 621 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), |
623 | this, SLOT(slotChooser2Change(const QString &)) ); | 622 | this, SLOT(slotChooser2Change(const QString &)) ); |
624 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), | 623 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), |
625 | this, SLOT(slotChooser3Change(const QString &)) ); | 624 | this, SLOT(slotChooser3Change(const QString &)) ); |
626 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), | 625 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), |
627 | this, SLOT(slotChooser4Change(const QString &)) ); | 626 | this, SLOT(slotChooser4Change(const QString &)) ); |
628 | connect( txtAddress, SIGNAL(textChanged(const QString &)), | 627 | connect( txtAddress, SIGNAL(textChanged(const QString &)), |
629 | this, SLOT(slotAddressChange(const QString &)) ); | 628 | this, SLOT(slotAddressChange(const QString &)) ); |
630 | connect( txtCity, SIGNAL(textChanged(const QString &)), | 629 | connect( txtCity, SIGNAL(textChanged(const QString &)), |
631 | this, SLOT(slotCityChange(const QString &)) ); | 630 | this, SLOT(slotCityChange(const QString &)) ); |
632 | connect( txtState, SIGNAL(textChanged(const QString &)), | 631 | connect( txtState, SIGNAL(textChanged(const QString &)), |
633 | this, SLOT(slotStateChange(const QString &)) ); | 632 | this, SLOT(slotStateChange(const QString &)) ); |
634 | connect( txtZip, SIGNAL(textChanged(const QString &)), | 633 | connect( txtZip, SIGNAL(textChanged(const QString &)), |
635 | this, SLOT(slotZipChange(const QString &)) ); | 634 | this, SLOT(slotZipChange(const QString &)) ); |
636 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), | 635 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), |
637 | this, SLOT(slotCountryChange(const QString &)) ); | 636 | this, SLOT(slotCountryChange(const QString &)) ); |
638 | connect( cmbCountry, SIGNAL(activated(const QString &)), | 637 | connect( cmbCountry, SIGNAL(activated(const QString &)), |
639 | this, SLOT(slotCountryChange(const QString &)) ); | 638 | this, SLOT(slotCountryChange(const QString &)) ); |
640 | connect( cmbChooserField1, SIGNAL(activated(int)), | 639 | connect( cmbChooserField1, SIGNAL(activated(int)), |
641 | this, SLOT(slotCmbChooser1Change(int)) ); | 640 | this, SLOT(slotCmbChooser1Change(int)) ); |
642 | connect( cmbChooserField2, SIGNAL(activated(int)), | 641 | connect( cmbChooserField2, SIGNAL(activated(int)), |
643 | this, SLOT(slotCmbChooser2Change(int)) ); | 642 | this, SLOT(slotCmbChooser2Change(int)) ); |
644 | connect( cmbChooserField3, SIGNAL(activated(int)), | 643 | connect( cmbChooserField3, SIGNAL(activated(int)), |
645 | this, SLOT(slotCmbChooser3Change(int)) ); | 644 | this, SLOT(slotCmbChooser3Change(int)) ); |
646 | connect( cmbChooserField4, SIGNAL(activated(int)), | 645 | connect( cmbChooserField4, SIGNAL(activated(int)), |
647 | this, SLOT(slotCmbChooser4Change(int)) ); | 646 | this, SLOT(slotCmbChooser4Change(int)) ); |
648 | connect( cmbAddress, SIGNAL(activated(int)), | 647 | connect( cmbAddress, SIGNAL(activated(int)), |
649 | this, SLOT(slotAddressTypeChange(int)) ); | 648 | this, SLOT(slotAddressTypeChange(int)) ); |
650 | 649 | ||
651 | new QPEDialogListener(this); | 650 | new QPEDialogListener(this); |
652 | 651 | ||
653 | setPersonalView ( m_personalView ); | 652 | setPersonalView ( m_personalView ); |
654 | 653 | ||
655 | qWarning("init() END"); | 654 | qWarning("init() END"); |
656 | } | 655 | } |
657 | 656 | ||
658 | void ContactEditor::defaultEmailChanged(int i){ | 657 | void ContactEditor::defaultEmailChanged(int i){ |
659 | qDebug("defaultEmailChanged"); | 658 | qDebug("defaultEmailChanged"); |
660 | 659 | ||
661 | // was sollte das ? (se) | 660 | // was sollte das ? (se) |
662 | // int index = cmbChooserField1->currentItem(); | 661 | // int index = cmbChooserField1->currentItem(); |
663 | // slChooserValues[index] = cmbDefaultEmail->text(i); | 662 | // slChooserValues[index] = cmbDefaultEmail->text(i); |
664 | 663 | ||
665 | defaultEmail = cmbDefaultEmail->text(i); | 664 | defaultEmail = cmbDefaultEmail->text(i); |
666 | qDebug ("Changed to: %s", defaultEmail.latin1()); | 665 | qDebug ("Changed to: %s", defaultEmail.latin1()); |
667 | 666 | ||
668 | } | 667 | } |
669 | 668 | ||
670 | void ContactEditor::populateDefaultEmailCmb(){ | 669 | void ContactEditor::populateDefaultEmailCmb(){ |
671 | 670 | ||
672 | // if the default-email combo was not selected and therfore not created | 671 | // if the default-email combo was not selected and therfore not created |
673 | // we get a lot of trouble.. Therfore create an invisible one.. | 672 | // we get a lot of trouble.. Therfore create an invisible one.. |
674 | if ( !cmbDefaultEmail ){ | 673 | if ( !cmbDefaultEmail ){ |
675 | cmbDefaultEmail = new QComboBox(this); | 674 | cmbDefaultEmail = new QComboBox(this); |
676 | cmbDefaultEmail -> hide(); | 675 | cmbDefaultEmail -> hide(); |
677 | } | 676 | } |
678 | cmbDefaultEmail->clear(); | 677 | cmbDefaultEmail->clear(); |
679 | cmbDefaultEmail->insertStringList( emails ); | 678 | cmbDefaultEmail->insertStringList( emails ); |
680 | // cmbDefaultEmail->show(); | 679 | // cmbDefaultEmail->show(); |
681 | 680 | ||
682 | // Select default email in combo.. | 681 | // Select default email in combo.. |
683 | bool found = false; | 682 | bool found = false; |
684 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 683 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
685 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", | 684 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", |
686 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); | 685 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); |
687 | 686 | ||
688 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 687 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
689 | cmbDefaultEmail->setCurrentItem( i ); | 688 | cmbDefaultEmail->setCurrentItem( i ); |
690 | qDebug("set"); | 689 | qDebug("set"); |
691 | found = true; | 690 | found = true; |
692 | } | 691 | } |
693 | } | 692 | } |
694 | 693 | ||
695 | // If the current default email is not found in the list, we choose the | 694 | // If the current default email is not found in the list, we choose the |
696 | // first one.. | 695 | // first one.. |
697 | if ( !found ) | 696 | if ( !found ) |
698 | defaultEmail = cmbDefaultEmail->text(0); | 697 | defaultEmail = cmbDefaultEmail->text(0); |
699 | } | 698 | } |
700 | 699 | ||
701 | // Called when any combobox was changed. | 700 | // Called when any combobox was changed. |
702 | // "true" returned if the change was chandled by this function, else it should | 701 | // "true" returned if the change was chandled by this function, else it should |
703 | // be handled by something else.. | 702 | // be handled by something else.. |
704 | bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widgetPos ) { | 703 | bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widgetPos ) { |
705 | QString type = slChooserNames[index]; | 704 | QString type = slChooserNames[index]; |
706 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); | 705 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); |
707 | 706 | ||
708 | if ( !initializing ) | 707 | if ( !initializing ) |
709 | contactfields.setFieldOrder( widgetPos-1, index ); | 708 | contactfields.setFieldOrder( widgetPos-1, index ); |
710 | 709 | ||
711 | // Create and connect combobox for selecting the default email | 710 | // Create and connect combobox for selecting the default email |
712 | if ( type == "Default Email"){ | 711 | if ( type == "Default Email"){ |
713 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); | 712 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); |
714 | 713 | ||
715 | // More than one defaul-email chooser is not allowed ! | 714 | // More than one defaul-email chooser is not allowed ! |
716 | if ( ( defaultEmailChooserPosition != -1 ) && | 715 | if ( ( defaultEmailChooserPosition != -1 ) && |
717 | defaultEmailChooserPosition != widgetPos && !initializing){ | 716 | defaultEmailChooserPosition != widgetPos && !initializing){ |
718 | chooserError( widgetPos ); | 717 | chooserError( widgetPos ); |
719 | return true; | 718 | return true; |
720 | } | 719 | } |
721 | 720 | ||
722 | if ( cmbDefaultEmail ){ | 721 | if ( cmbDefaultEmail ){ |
723 | delete cmbDefaultEmail; | 722 | delete cmbDefaultEmail; |
724 | cmbDefaultEmail = 0l; | 723 | cmbDefaultEmail = 0l; |
725 | } | 724 | } |
726 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); | 725 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); |
727 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); /* :SX */ | 726 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); /* :SX */ |
728 | 727 | ||
729 | QRect rect = inputWid->frameGeometry(); | 728 | QRect rect = inputWid->frameGeometry(); |
730 | qWarning("Geometrie: X=%d, Y=%d, Left=%d, Top=%d, Right=%d, Bottom=%d", | 729 | qWarning("Geometrie: X=%d, Y=%d, Left=%d, Top=%d, Right=%d, Bottom=%d", |
731 | rect.x(), rect.y(), rect.left(), rect.top(), rect.right(), rect.bottom()); | 730 | rect.x(), rect.y(), rect.left(), rect.top(), rect.right(), rect.bottom()); |
732 | QPoint pnt = inputWid->pos(); | 731 | QPoint pnt = inputWid->pos(); |
733 | qWarning("Position : X=%d, Y=%d", pnt.x(), pnt.y() ); | 732 | qWarning("Position : X=%d, Y=%d", pnt.x(), pnt.y() ); |
734 | 733 | ||
735 | connect( cmbDefaultEmail,SIGNAL( activated(int) ), | 734 | connect( cmbDefaultEmail,SIGNAL( activated(int) ), |
736 | SLOT( defaultEmailChanged(int) ) ); | 735 | SLOT( defaultEmailChanged(int) ) ); |
737 | 736 | ||
738 | cmbDefaultEmail->clear(); | 737 | cmbDefaultEmail->clear(); |
739 | cmbDefaultEmail->insertStringList( emails ); | 738 | cmbDefaultEmail->insertStringList( emails ); |
740 | cmbDefaultEmail->show(); | 739 | cmbDefaultEmail->show(); |
741 | 740 | ||
742 | defaultEmailChooserPosition = widgetPos; | 741 | defaultEmailChooserPosition = widgetPos; |
743 | 742 | ||
744 | // Set current default email | 743 | // Set current default email |
745 | populateDefaultEmailCmb(); | 744 | populateDefaultEmailCmb(); |
746 | 745 | ||
747 | 746 | ||
748 | } else { | 747 | } else { |
749 | // Something else was selected: Hide combo.. | 748 | // Something else was selected: Hide combo.. |
750 | qWarning(" Hiding default-email combo" ); | 749 | qWarning(" Hiding default-email combo" ); |
751 | if ( defaultEmailChooserPosition == widgetPos ){ | 750 | if ( defaultEmailChooserPosition == widgetPos ){ |
752 | defaultEmailChooserPosition = -1; | 751 | defaultEmailChooserPosition = -1; |
753 | if ( cmbDefaultEmail ) | 752 | if ( cmbDefaultEmail ) |
754 | cmbDefaultEmail->hide(); | 753 | cmbDefaultEmail->hide(); |
755 | 754 | ||
756 | } | 755 | } |
757 | 756 | ||
758 | // Caller should initialize the responsible textfield, therefore | 757 | // Caller should initialize the responsible textfield, therefore |
759 | // "false" is returned | 758 | // "false" is returned |
760 | return false; | 759 | return false; |
761 | } | 760 | } |
762 | 761 | ||
763 | // Everything is worked off .. | 762 | // Everything is worked off .. |
764 | return true; | 763 | return true; |
765 | 764 | ||
766 | } | 765 | } |
767 | 766 | ||
768 | // Currently accessed when we select default-email more than once ! | 767 | // Currently accessed when we select default-email more than once ! |
769 | void ContactEditor::chooserError( int index ) | 768 | void ContactEditor::chooserError( int index ) |
770 | { | 769 | { |
771 | qWarning("ContactEditor::chooserError( %d )", index); | 770 | qWarning("ContactEditor::chooserError( %d )", index); |
772 | QMessageBox::warning( this, "Chooser Error", | 771 | QMessageBox::warning( this, "Chooser Error", |
773 | "Multiple selection of this\n" | 772 | "Multiple selection of this\n" |
774 | "Item is not allowed !\n\n" | 773 | "Item is not allowed !\n\n" |
775 | "First deselect the previous one !", | 774 | "First deselect the previous one !", |
776 | "&OK", 0, 0, | 775 | "&OK", 0, 0, |
777 | 0, 0 ); | 776 | 0, 0 ); |
778 | 777 | ||
779 | // Reset the selected Chooser. Unfortunately the chooser | 778 | // Reset the selected Chooser. Unfortunately the chooser |
780 | // generates no signal, therfore we have to | 779 | // generates no signal, therfore we have to |
781 | // call the cmbChooserChange function manually.. | 780 | // call the cmbChooserChange function manually.. |
782 | switch( index ){ | 781 | switch( index ){ |
783 | case 1: | 782 | case 1: |
784 | cmbChooserField1 -> setCurrentItem( 0 ); | 783 | cmbChooserField1 -> setCurrentItem( 0 ); |
785 | slotCmbChooser1Change( 0 ); | 784 | slotCmbChooser1Change( 0 ); |
786 | break; | 785 | break; |
787 | case 2: | 786 | case 2: |
788 | cmbChooserField2 -> setCurrentItem( 0 ); | 787 | cmbChooserField2 -> setCurrentItem( 0 ); |
789 | slotCmbChooser2Change( 0 ); | 788 | slotCmbChooser2Change( 0 ); |
790 | break; | 789 | break; |
791 | case 3: | 790 | case 3: |
792 | cmbChooserField3 -> setCurrentItem( 0 ); | 791 | cmbChooserField3 -> setCurrentItem( 0 ); |
793 | slotCmbChooser3Change( 0 ); | 792 | slotCmbChooser3Change( 0 ); |
794 | break; | 793 | break; |
795 | case 4: | 794 | case 4: |
796 | cmbChooserField4 -> setCurrentItem( 0 ); | 795 | cmbChooserField4 -> setCurrentItem( 0 ); |
797 | slotCmbChooser4Change( 0 ); | 796 | slotCmbChooser4Change( 0 ); |
798 | break; | 797 | break; |
799 | } | 798 | } |
800 | } | 799 | } |
801 | 800 | ||
802 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) | 801 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
803 | void ContactEditor::chooserChange( const QString &textChanged, int index, | 802 | void ContactEditor::chooserChange( const QString &textChanged, int index, |
804 | QLineEdit* , int widgetPos ) { | 803 | QLineEdit* , int widgetPos ) { |
805 | 804 | ||
806 | QString type = slChooserNames[index]; | 805 | QString type = slChooserNames[index]; |
807 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", | 806 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", |
808 | type.latin1(),textChanged.latin1(), index, widgetPos ); | 807 | type.latin1(),textChanged.latin1(), index, widgetPos ); |
809 | 808 | ||
810 | if ( type == "Default Email"){ | 809 | if ( type == "Default Email"){ |
811 | qWarning ("??? Wozu??: %s", textChanged.latin1()); | 810 | qWarning ("??? Wozu??: %s", textChanged.latin1()); |
812 | defaultEmail = textChanged; | 811 | defaultEmail = textChanged; |
813 | 812 | ||
814 | populateDefaultEmailCmb(); | 813 | populateDefaultEmailCmb(); |
815 | 814 | ||
816 | }else if (defaultEmailChooserPosition == widgetPos){ | 815 | }else if (defaultEmailChooserPosition == widgetPos){ |
817 | qDebug("cmbDefaultEmail->hide()"); | 816 | qDebug("cmbDefaultEmail->hide()"); |
818 | 817 | ||
819 | if (cmbDefaultEmail) cmbDefaultEmail->hide(); | 818 | if (cmbDefaultEmail) cmbDefaultEmail->hide(); |
820 | widgetPos=-1; | 819 | widgetPos=-1; |
821 | 820 | ||
822 | }else if (type == "Emails"){ | 821 | }else if (type == "Emails"){ |
823 | qDebug("emails"); | 822 | qDebug("emails"); |
824 | 823 | ||
825 | QString de; | 824 | QString de; |
826 | emails = QStringList::split (",", textChanged ); | 825 | emails = QStringList::split (",", textChanged ); |
827 | 826 | ||
828 | populateDefaultEmailCmb(); | 827 | populateDefaultEmailCmb(); |
829 | } | 828 | } |
830 | 829 | ||
831 | slChooserValues[index] = textChanged; | 830 | slChooserValues[index] = textChanged; |
832 | 831 | ||
833 | } | 832 | } |
834 | 833 | ||
835 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 834 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
836 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); | 835 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); |
837 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 836 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
838 | } | 837 | } |
839 | 838 | ||
840 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 839 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
841 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); | 840 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); |
842 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 841 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
843 | 842 | ||
844 | } | 843 | } |
845 | 844 | ||
846 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 845 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
847 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); | 846 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); |
848 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 847 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
849 | } | 848 | } |
850 | 849 | ||
851 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 850 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
852 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); | 851 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); |
853 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 852 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
854 | } | 853 | } |
855 | 854 | ||
856 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 855 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
857 | 856 | ||
858 | if ( cmbAddress->currentItem() == 0 ) { | 857 | if ( cmbAddress->currentItem() == 0 ) { |
859 | slBusinessAddress[0] = textChanged; | 858 | slBusinessAddress[0] = textChanged; |
860 | } else { | 859 | } else { |
861 | slHomeAddress[0] = textChanged; | 860 | slHomeAddress[0] = textChanged; |
862 | } | 861 | } |
863 | } | 862 | } |
864 | 863 | ||
865 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 864 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
866 | 865 | ||
867 | if ( cmbAddress->currentItem() == 0 ) { | 866 | if ( cmbAddress->currentItem() == 0 ) { |
868 | slBusinessAddress[1] = textChanged; | 867 | slBusinessAddress[1] = textChanged; |
869 | } else { | 868 | } else { |
870 | slHomeAddress[1] = textChanged; | 869 | slHomeAddress[1] = textChanged; |
871 | } | 870 | } |
872 | } | 871 | } |
873 | 872 | ||
874 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 873 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
875 | 874 | ||
876 | if ( cmbAddress->currentItem() == 0 ) { | 875 | if ( cmbAddress->currentItem() == 0 ) { |
877 | slBusinessAddress[2] = textChanged; | 876 | slBusinessAddress[2] = textChanged; |
878 | } else { | 877 | } else { |
879 | slHomeAddress[2] = textChanged; | 878 | slHomeAddress[2] = textChanged; |
880 | } | 879 | } |
881 | } | 880 | } |
882 | 881 | ||
883 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 882 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
884 | 883 | ||
885 | if ( cmbAddress->currentItem() == 0 ) { | 884 | if ( cmbAddress->currentItem() == 0 ) { |
886 | slBusinessAddress[3] = textChanged; | 885 | slBusinessAddress[3] = textChanged; |
887 | } else { | 886 | } else { |
888 | slHomeAddress[3] = textChanged; | 887 | slHomeAddress[3] = textChanged; |
889 | } | 888 | } |
890 | } | 889 | } |
891 | 890 | ||
892 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 891 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
893 | 892 | ||
894 | 893 | ||
895 | if ( cmbAddress->currentItem() == 0 ) { | 894 | if ( cmbAddress->currentItem() == 0 ) { |
896 | slBusinessAddress[4] = textChanged; | 895 | slBusinessAddress[4] = textChanged; |
897 | } else { | 896 | } else { |
898 | slHomeAddress[4] = textChanged; | 897 | slHomeAddress[4] = textChanged; |
899 | } | 898 | } |
900 | } | 899 | } |
901 | 900 | ||
902 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 901 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
903 | 902 | ||
904 | if ( cmbAddress->currentItem() == 0 ) { | 903 | if ( cmbAddress->currentItem() == 0 ) { |
905 | slBusinessAddress[5] = textChanged; | 904 | slBusinessAddress[5] = textChanged; |
906 | } else { | 905 | } else { |
907 | slHomeAddress[5] = textChanged; | 906 | slHomeAddress[5] = textChanged; |
908 | } | 907 | } |
909 | } | 908 | } |
910 | 909 | ||
911 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 910 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
912 | 911 | ||
913 | if ( cmbAddress->currentItem() == 0 ) { | 912 | if ( cmbAddress->currentItem() == 0 ) { |
914 | slBusinessAddress[6] = textChanged; | 913 | slBusinessAddress[6] = textChanged; |
915 | } else { | 914 | } else { |
916 | slHomeAddress[6] = textChanged; | 915 | slHomeAddress[6] = textChanged; |
917 | } | 916 | } |
918 | } | 917 | } |
919 | 918 | ||
920 | 919 | ||
921 | void ContactEditor::slotCmbChooser1Change( int index ) { | 920 | void ContactEditor::slotCmbChooser1Change( int index ) { |
922 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); | 921 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); |
923 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), txtChooserField1, 1) ){ | 922 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), txtChooserField1, 1) ){ |
924 | 923 | ||
925 | txtChooserField1->setText( slChooserValues[index] ); | 924 | txtChooserField1->setText( slChooserValues[index] ); |
926 | txtChooserField1->setFocus(); | 925 | txtChooserField1->setFocus(); |
927 | 926 | ||
928 | } | 927 | } |
929 | 928 | ||
930 | } | 929 | } |
931 | 930 | ||
932 | void ContactEditor::slotCmbChooser2Change( int index ) { | 931 | void ContactEditor::slotCmbChooser2Change( int index ) { |
933 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); | 932 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); |
934 | 933 | ||
935 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), txtChooserField2, 2) ){ | 934 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), txtChooserField2, 2) ){ |
936 | 935 | ||
937 | txtChooserField2->setText( slChooserValues[index] ); | 936 | txtChooserField2->setText( slChooserValues[index] ); |
938 | txtChooserField2->setFocus(); | 937 | txtChooserField2->setFocus(); |
939 | 938 | ||
940 | } | 939 | } |
941 | } | 940 | } |
942 | 941 | ||
943 | void ContactEditor::slotCmbChooser3Change( int index ) { | 942 | void ContactEditor::slotCmbChooser3Change( int index ) { |
944 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); | 943 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); |
945 | 944 | ||
946 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), txtChooserField3, 3) ){ | 945 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), txtChooserField3, 3) ){ |
947 | 946 | ||
948 | txtChooserField3->setText( slChooserValues[index] ); | 947 | txtChooserField3->setText( slChooserValues[index] ); |
949 | txtChooserField3->setFocus(); | 948 | txtChooserField3->setFocus(); |
950 | 949 | ||
951 | } | 950 | } |
952 | } | 951 | } |
953 | 952 | ||
954 | void ContactEditor::slotCmbChooser4Change( int index ) { | 953 | void ContactEditor::slotCmbChooser4Change( int index ) { |
955 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); | 954 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); |
956 | 955 | ||
957 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), txtChooserField4, 4) ){ | 956 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), txtChooserField4, 4) ){ |
958 | 957 | ||
959 | txtChooserField4->setText( slChooserValues[index] ); | 958 | txtChooserField4->setText( slChooserValues[index] ); |
960 | txtChooserField4->setFocus(); | 959 | txtChooserField4->setFocus(); |
961 | 960 | ||
962 | } | 961 | } |
963 | } | 962 | } |
964 | 963 | ||
965 | void ContactEditor::slotAddressTypeChange( int index ) { | 964 | void ContactEditor::slotAddressTypeChange( int index ) { |
966 | 965 | ||
967 | 966 | ||
968 | if ( !initializing ) | 967 | if ( !initializing ) |
969 | contactfields.setFieldOrder( 4, index ); | 968 | contactfields.setFieldOrder( 4, index ); |
970 | 969 | ||
971 | 970 | ||
972 | if ( index == 0 ) { | 971 | if ( index == 0 ) { |
973 | 972 | ||
974 | txtAddress->setText( slBusinessAddress[0] ); | 973 | txtAddress->setText( slBusinessAddress[0] ); |
975 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 974 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
976 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 975 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
977 | txtCity->setText( slBusinessAddress[3] ); | 976 | txtCity->setText( slBusinessAddress[3] ); |
978 | txtState->setText( slBusinessAddress[4] ); | 977 | txtState->setText( slBusinessAddress[4] ); |
979 | txtZip->setText( slBusinessAddress[5] ); | 978 | txtZip->setText( slBusinessAddress[5] ); |
980 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 979 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
981 | txtTmp->setText( slBusinessAddress[6] ); | 980 | txtTmp->setText( slBusinessAddress[6] ); |
982 | 981 | ||
983 | } else { | 982 | } else { |
984 | 983 | ||
985 | txtAddress->setText( slHomeAddress[0] ); | 984 | txtAddress->setText( slHomeAddress[0] ); |
986 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 985 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
987 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 986 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
988 | txtCity->setText( slHomeAddress[3] ); | 987 | txtCity->setText( slHomeAddress[3] ); |
989 | txtState->setText( slHomeAddress[4] ); | 988 | txtState->setText( slHomeAddress[4] ); |
990 | txtZip->setText( slHomeAddress[5] ); | 989 | txtZip->setText( slHomeAddress[5] ); |
991 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 990 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
992 | txtTmp->setText( slHomeAddress[6] ); | 991 | txtTmp->setText( slHomeAddress[6] ); |
993 | 992 | ||
994 | } | 993 | } |
995 | 994 | ||
996 | } | 995 | } |
997 | 996 | ||
998 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 997 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
999 | 998 | ||
1000 | int index = cmbFileAs->currentItem(); | 999 | int index = cmbFileAs->currentItem(); |
1001 | 1000 | ||
1002 | cmbFileAs->clear(); | 1001 | cmbFileAs->clear(); |
1003 | 1002 | ||
1004 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); | 1003 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); |
1005 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); | 1004 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); |
1006 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); | 1005 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); |
1007 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); | 1006 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); |
1008 | 1007 | ||
1009 | cmbFileAs->setCurrentItem( index ); | 1008 | cmbFileAs->setCurrentItem( index ); |
1010 | 1009 | ||
1011 | useFullName = true; | 1010 | useFullName = true; |
1012 | 1011 | ||
1013 | } | 1012 | } |
1014 | 1013 | ||
1015 | void ContactEditor::accept() { | 1014 | void ContactEditor::accept() { |
1016 | 1015 | ||
1017 | if ( isEmpty() ) { | 1016 | if ( isEmpty() ) { |
1018 | cleanupFields(); | 1017 | cleanupFields(); |
1019 | reject(); | 1018 | reject(); |
1020 | } else { | 1019 | } else { |
1021 | saveEntry(); | 1020 | saveEntry(); |
1022 | cleanupFields(); | 1021 | cleanupFields(); |
1023 | QDialog::accept(); | 1022 | QDialog::accept(); |
1024 | } | 1023 | } |
1025 | 1024 | ||
1026 | } | 1025 | } |
1027 | 1026 | ||
1028 | void ContactEditor::slotNote() { | 1027 | void ContactEditor::slotNote() { |
1029 | 1028 | ||
1030 | dlgNote->showMaximized(); | 1029 | dlgNote->showMaximized(); |
1031 | if ( !dlgNote->exec() ) { | 1030 | if ( !dlgNote->exec() ) { |
1032 | txtNote->setText( ent.notes() ); | 1031 | txtNote->setText( ent.notes() ); |
1033 | } | 1032 | } |
1034 | } | 1033 | } |
1035 | 1034 | ||
1036 | void ContactEditor::slotName() { | 1035 | void ContactEditor::slotName() { |
1037 | 1036 | ||
1038 | QString tmpName; | 1037 | QString tmpName; |
1039 | if (useFullName) { | 1038 | if (useFullName) { |
1040 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1039 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1041 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1040 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1042 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1041 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1043 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1042 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1044 | } | 1043 | } |
1045 | dlgName->showMaximized(); | 1044 | dlgName->showMaximized(); |
1046 | if ( dlgName->exec() ) { | 1045 | if ( dlgName->exec() ) { |
1047 | 1046 | ||
1048 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); | 1047 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); |
1049 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1048 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1050 | slotFullNameChange( txtFullName->text() ); | 1049 | slotFullNameChange( txtFullName->text() ); |
1051 | useFullName = false; | 1050 | useFullName = false; |
1052 | } | 1051 | } |
1053 | 1052 | ||
1054 | } | 1053 | } |
1055 | 1054 | ||
1056 | void ContactEditor::setNameFocus() { | 1055 | void ContactEditor::setNameFocus() { |
1057 | 1056 | ||
1058 | txtFullName->setFocus(); | 1057 | txtFullName->setFocus(); |
1059 | 1058 | ||
1060 | } | 1059 | } |
1061 | 1060 | ||
1062 | bool ContactEditor::isEmpty() { | 1061 | bool ContactEditor::isEmpty() { |
1063 | // Test and see if the record should be saved. | 1062 | // Test and see if the record should be saved. |
1064 | // More strict than the original qtopia, needs name or fileas to save | 1063 | // More strict than the original qtopia, needs name or fileas to save |
1065 | 1064 | ||
1066 | QString t = txtFullName->text(); | 1065 | QString t = txtFullName->text(); |
1067 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1066 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1068 | return false; | 1067 | return false; |
1069 | 1068 | ||
1070 | t = cmbFileAs->currentText(); | 1069 | t = cmbFileAs->currentText(); |
1071 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1070 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1072 | return false; | 1071 | return false; |
1073 | 1072 | ||
1074 | return true; | 1073 | return true; |
1075 | 1074 | ||
1076 | } | 1075 | } |
1077 | 1076 | ||
1078 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1077 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1079 | 1078 | ||
1080 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1079 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1081 | QString strFirstName; | 1080 | QString strFirstName; |
1082 | QString strMiddleName; | 1081 | QString strMiddleName; |
1083 | QString strLastName; | 1082 | QString strLastName; |
1084 | QString strSuffix; | 1083 | QString strSuffix; |
1085 | QString strTitle; | 1084 | QString strTitle; |
1086 | int commapos; | 1085 | int commapos; |
1087 | int spCount; | 1086 | int spCount; |
1088 | int spPos; | 1087 | int spPos; |
1089 | int spPos2; | 1088 | int spPos2; |
1090 | 1089 | ||
1091 | 1090 | ||
1092 | commapos = simplifiedName.find( ',', 0, TRUE); | 1091 | commapos = simplifiedName.find( ',', 0, TRUE); |
1093 | spCount = simplifiedName.contains( ' ', TRUE ); | 1092 | spCount = simplifiedName.contains( ' ', TRUE ); |
1094 | 1093 | ||
1095 | if ( commapos == -1 ) { | 1094 | if ( commapos == -1 ) { |
1096 | 1095 | ||
1097 | switch (spCount) { | 1096 | switch (spCount) { |
1098 | case 0: | 1097 | case 0: |
1099 | //return simplifiedName; | 1098 | //return simplifiedName; |
1100 | if (txtLastName->text() != "") { | 1099 | if (txtLastName->text() != "") { |
1101 | strLastName = simplifiedName; | 1100 | strLastName = simplifiedName; |
1102 | break; | 1101 | break; |
1103 | } | 1102 | } |
1104 | if (txtMiddleName->text() != "") { | 1103 | if (txtMiddleName->text() != "") { |
1105 | strMiddleName = simplifiedName; | 1104 | strMiddleName = simplifiedName; |
1106 | break; | 1105 | break; |
1107 | } | 1106 | } |
1108 | if (txtSuffix->text() != "") { | 1107 | if (txtSuffix->text() != "") { |
1109 | strSuffix = simplifiedName; | 1108 | strSuffix = simplifiedName; |
1110 | break; | 1109 | break; |
1111 | } | 1110 | } |
1112 | strFirstName = simplifiedName; | 1111 | strFirstName = simplifiedName; |
1113 | break; | 1112 | break; |
1114 | 1113 | ||
1115 | case 1: | 1114 | case 1: |
1116 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1115 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1117 | strFirstName = simplifiedName.left( spPos ); | 1116 | strFirstName = simplifiedName.left( spPos ); |
1118 | strLastName = simplifiedName.mid( spPos + 1 ); | 1117 | strLastName = simplifiedName.mid( spPos + 1 ); |
1119 | break; | 1118 | break; |
1120 | 1119 | ||
1121 | case 2: | 1120 | case 2: |
1122 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1121 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1123 | strFirstName = simplifiedName.left( spPos ); | 1122 | strFirstName = simplifiedName.left( spPos ); |
1124 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1123 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1125 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1124 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1126 | strLastName = simplifiedName.mid( spPos2 + 1 ); | 1125 | strLastName = simplifiedName.mid( spPos2 + 1 ); |
1127 | break; | 1126 | break; |
1128 | 1127 | ||
1129 | case 3: | 1128 | case 3: |
1130 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1129 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1131 | strFirstName = simplifiedName.left( spPos ); | 1130 | strFirstName = simplifiedName.left( spPos ); |
1132 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1131 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1133 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1132 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1134 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1133 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1135 | strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1134 | strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1136 | strSuffix = simplifiedName.mid( spPos + 1 ); | 1135 | strSuffix = simplifiedName.mid( spPos + 1 ); |
1137 | break; | 1136 | break; |
1138 | 1137 | ||
1139 | case 4: | 1138 | case 4: |
1140 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1139 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1141 | strTitle = simplifiedName.left( spPos ); | 1140 | strTitle = simplifiedName.left( spPos ); |
1142 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1141 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1143 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1142 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1144 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1143 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1145 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1144 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1146 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1145 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1147 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1146 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1148 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1147 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1149 | break; | 1148 | break; |
1150 | 1149 | ||
1151 | default: | 1150 | default: |
1152 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1151 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1153 | strTitle = simplifiedName.left( spPos ); | 1152 | strTitle = simplifiedName.left( spPos ); |
1154 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1153 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1155 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1154 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1156 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1155 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1157 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1156 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1158 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1157 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1159 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1158 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1160 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1159 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1161 | break; | 1160 | break; |
1162 | } | 1161 | } |
1163 | } else { | 1162 | } else { |
1164 | simplifiedName.replace( commapos, 1, " " ); | 1163 | simplifiedName.replace( commapos, 1, " " ); |
1165 | simplifiedName = simplifiedName.simplifyWhiteSpace(); | 1164 | simplifiedName = simplifiedName.simplifyWhiteSpace(); |
1166 | 1165 | ||
1167 | switch (spCount) { | 1166 | switch (spCount) { |
1168 | case 0: | 1167 | case 0: |
1169 | //return simplifiedName; | 1168 | //return simplifiedName; |
1170 | if (txtLastName->text() != "") { | 1169 | if (txtLastName->text() != "") { |
1171 | strLastName = simplifiedName; | 1170 | strLastName = simplifiedName; |
1172 | break; | 1171 | break; |
1173 | } | 1172 | } |
1174 | if (txtMiddleName->text() != "") { | 1173 | if (txtMiddleName->text() != "") { |
1175 | strMiddleName = simplifiedName; | 1174 | strMiddleName = simplifiedName; |
1176 | break; | 1175 | break; |
1177 | } | 1176 | } |
1178 | if (txtSuffix->text() != "") { | 1177 | if (txtSuffix->text() != "") { |
1179 | strSuffix = simplifiedName; | 1178 | strSuffix = simplifiedName; |
1180 | break; | 1179 | break; |
1181 | } | 1180 | } |
1182 | strFirstName = simplifiedName; | 1181 | strFirstName = simplifiedName; |
1183 | break; | 1182 | break; |
1184 | 1183 | ||
1185 | case 1: | 1184 | case 1: |
1186 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1185 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1187 | strLastName = simplifiedName.left( spPos ); | 1186 | strLastName = simplifiedName.left( spPos ); |
1188 | strFirstName = simplifiedName.mid( spPos + 1 ); | 1187 | strFirstName = simplifiedName.mid( spPos + 1 ); |
1189 | break; | 1188 | break; |
1190 | 1189 | ||
1191 | case 2: | 1190 | case 2: |
1192 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1191 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1193 | strLastName = simplifiedName.left( spPos ); | 1192 | strLastName = simplifiedName.left( spPos ); |
1194 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1193 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1195 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1194 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1196 | strMiddleName = simplifiedName.mid( spPos2 + 1 ); | 1195 | strMiddleName = simplifiedName.mid( spPos2 + 1 ); |
1197 | break; | 1196 | break; |
1198 | 1197 | ||
1199 | case 3: | 1198 | case 3: |
1200 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1199 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1201 | strLastName = simplifiedName.left( spPos ); | 1200 | strLastName = simplifiedName.left( spPos ); |
1202 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1201 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1203 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1202 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1204 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1203 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1205 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1204 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1206 | strSuffix = simplifiedName.mid( spPos + 1 ); | 1205 | strSuffix = simplifiedName.mid( spPos + 1 ); |
1207 | break; | 1206 | break; |
1208 | 1207 | ||
1209 | case 4: | 1208 | case 4: |
1210 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1209 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1211 | strLastName = simplifiedName.left( spPos ); | 1210 | strLastName = simplifiedName.left( spPos ); |
1212 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1211 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1213 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1212 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1214 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1213 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1215 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1214 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1216 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1215 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1217 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1216 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1218 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1217 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1219 | break; | 1218 | break; |
1220 | 1219 | ||
1221 | default: | 1220 | default: |
1222 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1221 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1223 | strLastName = simplifiedName.left( spPos ); | 1222 | strLastName = simplifiedName.left( spPos ); |
1224 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1223 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1225 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1224 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1226 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1225 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1227 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 1226 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); |
1228 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1227 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1229 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1228 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1230 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1229 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1231 | break; | 1230 | break; |
1232 | } | 1231 | } |
1233 | } | 1232 | } |
1234 | switch (type) { | 1233 | switch (type) { |
1235 | case NAME_FL: | 1234 | case NAME_FL: |
1236 | return strFirstName + " " + strLastName; | 1235 | return strFirstName + " " + strLastName; |
1237 | 1236 | ||
1238 | case NAME_LF: | 1237 | case NAME_LF: |
1239 | return strLastName + ", " + strFirstName; | 1238 | return strLastName + ", " + strFirstName; |
1240 | 1239 | ||
1241 | case NAME_LFM: | 1240 | case NAME_LFM: |
1242 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1241 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1243 | 1242 | ||
1244 | case NAME_FMLS: | 1243 | case NAME_FMLS: |
1245 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; | 1244 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; |
1246 | 1245 | ||
1247 | case NAME_F: | 1246 | case NAME_F: |
1248 | return strFirstName; | 1247 | return strFirstName; |
1249 | 1248 | ||
1250 | case NAME_M: | 1249 | case NAME_M: |
1251 | return strMiddleName; | 1250 | return strMiddleName; |
1252 | 1251 | ||
1253 | case NAME_L: | 1252 | case NAME_L: |
1254 | return strLastName; | 1253 | return strLastName; |
1255 | 1254 | ||
1256 | case NAME_S: | 1255 | case NAME_S: |
1257 | return strSuffix; | 1256 | return strSuffix; |
1258 | 1257 | ||
1259 | } | 1258 | } |
1260 | return QString::null; | 1259 | return QString::null; |
1261 | } | 1260 | } |
1262 | 1261 | ||
1263 | void ContactEditor::cleanupFields() { | 1262 | void ContactEditor::cleanupFields() { |
1264 | QStringList::Iterator it = slChooserValues.begin(); | 1263 | QStringList::Iterator it = slChooserValues.begin(); |
1265 | 1264 | ||
1266 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1265 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1267 | (*it) = ""; | 1266 | (*it) = ""; |
1268 | } | 1267 | } |
1269 | 1268 | ||
1270 | for ( int i = 0; i < 7; i++ ) { | 1269 | for ( int i = 0; i < 7; i++ ) { |
1271 | slHomeAddress[i] = ""; | 1270 | slHomeAddress[i] = ""; |
1272 | slBusinessAddress[i] = ""; | 1271 | slBusinessAddress[i] = ""; |
1273 | } | 1272 | } |
1274 | 1273 | ||
1275 | QListIterator<QLineEdit> itLV( listValue ); | 1274 | QListIterator<QLineEdit> itLV( listValue ); |
1276 | for ( ; itLV.current(); ++itLV ) { | 1275 | for ( ; itLV.current(); ++itLV ) { |
1277 | (*itLV)->setText( "" ); | 1276 | (*itLV)->setText( "" ); |
1278 | } | 1277 | } |
1279 | 1278 | ||
1280 | txtFirstName->setText(""); | 1279 | txtFirstName->setText(""); |
1281 | txtMiddleName->setText(""); | 1280 | txtMiddleName->setText(""); |
1282 | txtLastName->setText(""); | 1281 | txtLastName->setText(""); |
1283 | txtSuffix->setText(""); | 1282 | txtSuffix->setText(""); |
1284 | txtNote->setText(""); | 1283 | txtNote->setText(""); |
1285 | txtFullName->setText(""); | 1284 | txtFullName->setText(""); |
1286 | txtJobTitle->setText(""); | 1285 | txtJobTitle->setText(""); |
1287 | txtOrganization->setText(""); | 1286 | txtOrganization->setText(""); |
1288 | txtChooserField1->setText(""); | 1287 | txtChooserField1->setText(""); |
1289 | txtChooserField2->setText(""); | 1288 | txtChooserField2->setText(""); |
1290 | txtChooserField3->setText(""); | 1289 | txtChooserField3->setText(""); |
1291 | txtAddress->setText(""); | 1290 | txtAddress->setText(""); |
1292 | txtCity->setText(""); | 1291 | txtCity->setText(""); |
1293 | txtState->setText(""); | 1292 | txtState->setText(""); |
1294 | txtZip->setText(""); | 1293 | txtZip->setText(""); |
1295 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1294 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1296 | txtTmp->setText(""); | 1295 | txtTmp->setText(""); |
1297 | txtTmp = cmbFileAs->lineEdit(); | 1296 | txtTmp = cmbFileAs->lineEdit(); |
1298 | txtTmp->setText(""); | 1297 | txtTmp->setText(""); |
1299 | 1298 | ||
1300 | } | 1299 | } |
1301 | 1300 | ||
1302 | void ContactEditor::setEntry( const OContact &entry ) { | 1301 | void ContactEditor::setEntry( const OContact &entry ) { |
1303 | 1302 | ||
1304 | initializing = true; | 1303 | initializing = true; |
1305 | 1304 | ||
1306 | cleanupFields(); | 1305 | cleanupFields(); |
1307 | 1306 | ||
1308 | ent = entry; | 1307 | ent = entry; |
1309 | 1308 | ||
1310 | emails = QStringList(ent.emailList()); | 1309 | emails = QStringList(ent.emailList()); |
1311 | defaultEmail = ent.defaultEmail(); | 1310 | defaultEmail = ent.defaultEmail(); |
1312 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1311 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1313 | qDebug("default email=%s",defaultEmail.latin1()); | 1312 | qDebug("default email=%s",defaultEmail.latin1()); |
1314 | 1313 | ||
1315 | useFullName = false; | 1314 | useFullName = false; |
1316 | txtFirstName->setText( ent.firstName() ); | 1315 | txtFirstName->setText( ent.firstName() ); |
1317 | txtMiddleName->setText( ent.middleName() ); | 1316 | txtMiddleName->setText( ent.middleName() ); |
1318 | txtLastName->setText( ent.lastName() ); | 1317 | txtLastName->setText( ent.lastName() ); |
1319 | txtSuffix->setText( ent.suffix() ); | 1318 | txtSuffix->setText( ent.suffix() ); |
1320 | 1319 | ||
1321 | QString *tmpString = new QString; | 1320 | QString *tmpString = new QString; |
1322 | *tmpString = ent.firstName() + " " + ent.middleName() + | 1321 | *tmpString = ent.firstName() + " " + ent.middleName() + |
diff --git a/core/pim/addressbook/ocontactfields.cpp b/core/pim/addressbook/ocontactfields.cpp index 18b68c4..ffb88e8 100644 --- a/core/pim/addressbook/ocontactfields.cpp +++ b/core/pim/addressbook/ocontactfields.cpp | |||
@@ -1,454 +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] ); | ||
76 | list.append( mapIdToStr[Qtopia::BusinessWebPage] ); | ||
75 | 77 | ||
76 | list.append( mapIdToStr[Qtopia::DefaultEmail] ); | 78 | list.append( mapIdToStr[Qtopia::DefaultEmail] ); |
77 | list.append( mapIdToStr[Qtopia::Emails] ); | 79 | list.append( mapIdToStr[Qtopia::Emails] ); |
78 | 80 | ||
79 | list.append( mapIdToStr[Qtopia::HomePhone] ); | 81 | list.append( mapIdToStr[Qtopia::HomePhone] ); |
80 | list.append( mapIdToStr[Qtopia::HomeFax] ); | 82 | list.append( mapIdToStr[Qtopia::HomeFax] ); |
81 | list.append( mapIdToStr[Qtopia::HomeMobile] ); | 83 | list.append( mapIdToStr[Qtopia::HomeMobile] ); |
84 | // list.append( mapIdToStr[Qtopia::HomePager] ); | ||
85 | list.append( mapIdToStr[Qtopia::HomeWebPage] ); | ||
82 | 86 | ||
83 | if (sorted) list.sort(); | 87 | if (sorted) list.sort(); |
84 | 88 | ||
85 | return list; | 89 | return list; |
86 | } | 90 | } |
87 | 91 | ||
88 | 92 | ||
89 | /*! | 93 | /*! |
90 | \internal | 94 | \internal |
91 | Returns a list of phone field names for a contact. | 95 | Returns a list of phone field names for a contact. |
92 | */ | 96 | */ |
93 | QStringList OContactFields::untrphonefields( bool sorted ) | 97 | QStringList OContactFields::untrphonefields( bool sorted ) |
94 | { | 98 | { |
95 | QStringList list; | 99 | QStringList list; |
96 | QMap<int, QString> mapIdToStr = idToUntrFields(); | 100 | QMap<int, QString> mapIdToStr = idToUntrFields(); |
97 | 101 | ||
98 | list.append( mapIdToStr[ Qtopia::BusinessPhone ] ); | 102 | list.append( mapIdToStr[ Qtopia::BusinessPhone ] ); |
99 | list.append( mapIdToStr[ Qtopia::BusinessFax ] ); | 103 | list.append( mapIdToStr[ Qtopia::BusinessFax ] ); |
100 | list.append( mapIdToStr[ Qtopia::BusinessMobile ] ); | 104 | list.append( mapIdToStr[ Qtopia::BusinessMobile ] ); |
105 | list.append( mapIdToStr[ Qtopia::BusinessPager ] ); | ||
106 | list.append( mapIdToStr[ Qtopia::BusinessWebPage ] ); | ||
101 | 107 | ||
102 | list.append( mapIdToStr[ Qtopia::DefaultEmail ] ); | 108 | list.append( mapIdToStr[ Qtopia::DefaultEmail ] ); |
103 | list.append( mapIdToStr[ Qtopia::Emails ] ); | 109 | list.append( mapIdToStr[ Qtopia::Emails ] ); |
104 | 110 | ||
105 | list.append( mapIdToStr[ Qtopia::HomePhone ] ); | 111 | list.append( mapIdToStr[ Qtopia::HomePhone ] ); |
106 | list.append( mapIdToStr[ Qtopia::HomeFax ] ); | 112 | list.append( mapIdToStr[ Qtopia::HomeFax ] ); |
107 | list.append( mapIdToStr[ Qtopia::HomeMobile ] ); | 113 | list.append( mapIdToStr[ Qtopia::HomeMobile ] ); |
114 | //list.append( mapIdToStr[Qtopia::HomePager] ); | ||
115 | list.append( mapIdToStr[Qtopia::HomeWebPage] ); | ||
108 | 116 | ||
109 | if (sorted) list.sort(); | 117 | if (sorted) list.sort(); |
110 | 118 | ||
111 | return list; | 119 | return list; |
112 | } | 120 | } |
113 | 121 | ||
114 | 122 | ||
115 | /*! | 123 | /*! |
116 | \internal | 124 | \internal |
117 | Returns a translated list of field names for a contact. | 125 | Returns a translated list of field names for a contact. |
118 | */ | 126 | */ |
119 | QStringList OContactFields::trfields( bool sorted ) | 127 | QStringList OContactFields::trfields( bool sorted ) |
120 | { | 128 | { |
121 | QStringList list; | 129 | QStringList list; |
122 | QMap<int, QString> mapIdToStr = idToTrFields(); | 130 | QMap<int, QString> mapIdToStr = idToTrFields(); |
123 | 131 | ||
124 | list.append( mapIdToStr[Qtopia::Title]); | 132 | list.append( mapIdToStr[Qtopia::Title]); |
125 | list.append( mapIdToStr[Qtopia::FirstName] ); | 133 | list.append( mapIdToStr[Qtopia::FirstName] ); |
126 | list.append( mapIdToStr[Qtopia::MiddleName] ); | 134 | list.append( mapIdToStr[Qtopia::MiddleName] ); |
127 | list.append( mapIdToStr[Qtopia::LastName] ); | 135 | list.append( mapIdToStr[Qtopia::LastName] ); |
128 | list.append( mapIdToStr[Qtopia::Suffix] ); | 136 | list.append( mapIdToStr[Qtopia::Suffix] ); |
129 | list.append( mapIdToStr[Qtopia::FileAs] ); | 137 | list.append( mapIdToStr[Qtopia::FileAs] ); |
130 | 138 | ||
131 | list.append( mapIdToStr[Qtopia::JobTitle] ); | 139 | list.append( mapIdToStr[Qtopia::JobTitle] ); |
132 | list.append( mapIdToStr[Qtopia::Department] ); | 140 | list.append( mapIdToStr[Qtopia::Department] ); |
133 | list.append( mapIdToStr[Qtopia::Company] ); | 141 | list.append( mapIdToStr[Qtopia::Company] ); |
134 | 142 | ||
135 | list += trphonefields( sorted ); | 143 | list += trphonefields( sorted ); |
136 | 144 | ||
137 | list.append( mapIdToStr[Qtopia::BusinessStreet] ); | 145 | list.append( mapIdToStr[Qtopia::BusinessStreet] ); |
138 | list.append( mapIdToStr[Qtopia::BusinessCity] ); | 146 | list.append( mapIdToStr[Qtopia::BusinessCity] ); |
139 | list.append( mapIdToStr[Qtopia::BusinessState] ); | 147 | list.append( mapIdToStr[Qtopia::BusinessState] ); |
140 | list.append( mapIdToStr[Qtopia::BusinessZip] ); | 148 | list.append( mapIdToStr[Qtopia::BusinessZip] ); |
141 | list.append( mapIdToStr[Qtopia::BusinessCountry] ); | 149 | list.append( mapIdToStr[Qtopia::BusinessCountry] ); |
142 | list.append( mapIdToStr[Qtopia::BusinessPager] ); | ||
143 | list.append( mapIdToStr[Qtopia::BusinessWebPage] ); | ||
144 | 150 | ||
145 | list.append( mapIdToStr[Qtopia::HomeStreet] ); | 151 | list.append( mapIdToStr[Qtopia::HomeStreet] ); |
146 | list.append( mapIdToStr[Qtopia::HomeCity] ); | 152 | list.append( mapIdToStr[Qtopia::HomeCity] ); |
147 | list.append( mapIdToStr[Qtopia::HomeState] ); | 153 | list.append( mapIdToStr[Qtopia::HomeState] ); |
148 | list.append( mapIdToStr[Qtopia::HomeZip] ); | 154 | list.append( mapIdToStr[Qtopia::HomeZip] ); |
149 | list.append( mapIdToStr[Qtopia::HomeCountry] ); | 155 | list.append( mapIdToStr[Qtopia::HomeCountry] ); |
150 | list.append( mapIdToStr[Qtopia::HomeWebPage] ); | ||
151 | 156 | ||
152 | list += trdetailsfields( sorted ); | 157 | list += trdetailsfields( sorted ); |
153 | 158 | ||
154 | list.append( mapIdToStr[Qtopia::Notes] ); | 159 | list.append( mapIdToStr[Qtopia::Notes] ); |
155 | list.append( mapIdToStr[Qtopia::Groups] ); | 160 | list.append( mapIdToStr[Qtopia::Groups] ); |
156 | 161 | ||
157 | if (sorted) list.sort(); | 162 | if (sorted) list.sort(); |
158 | 163 | ||
159 | return list; | 164 | return list; |
160 | } | 165 | } |
161 | 166 | ||
162 | /*! | 167 | /*! |
163 | \internal | 168 | \internal |
164 | Returns an untranslated list of field names for a contact. | 169 | Returns an untranslated list of field names for a contact. |
165 | */ | 170 | */ |
166 | QStringList OContactFields::untrfields( bool sorted ) | 171 | QStringList OContactFields::untrfields( bool sorted ) |
167 | { | 172 | { |
168 | QStringList list; | 173 | QStringList list; |
169 | QMap<int, QString> mapIdToStr = idToUntrFields(); | 174 | QMap<int, QString> mapIdToStr = idToUntrFields(); |
170 | 175 | ||
171 | list.append( mapIdToStr[ Qtopia::Title ] ); | 176 | list.append( mapIdToStr[ Qtopia::Title ] ); |
172 | list.append( mapIdToStr[ Qtopia::FirstName ] ); | 177 | list.append( mapIdToStr[ Qtopia::FirstName ] ); |
173 | list.append( mapIdToStr[ Qtopia::MiddleName ] ); | 178 | list.append( mapIdToStr[ Qtopia::MiddleName ] ); |
174 | list.append( mapIdToStr[ Qtopia::LastName ] ); | 179 | list.append( mapIdToStr[ Qtopia::LastName ] ); |
175 | list.append( mapIdToStr[ Qtopia::Suffix ] ); | 180 | list.append( mapIdToStr[ Qtopia::Suffix ] ); |
176 | list.append( mapIdToStr[ Qtopia::FileAs ] ); | 181 | list.append( mapIdToStr[ Qtopia::FileAs ] ); |
177 | 182 | ||
178 | list.append( mapIdToStr[ Qtopia::JobTitle ] ); | 183 | list.append( mapIdToStr[ Qtopia::JobTitle ] ); |
179 | list.append( mapIdToStr[ Qtopia::Department ] ); | 184 | list.append( mapIdToStr[ Qtopia::Department ] ); |
180 | list.append( mapIdToStr[ Qtopia::Company ] ); | 185 | list.append( mapIdToStr[ Qtopia::Company ] ); |
181 | 186 | ||
182 | list += untrphonefields( sorted ); | 187 | list += untrphonefields( sorted ); |
183 | 188 | ||
184 | list.append( mapIdToStr[ Qtopia::BusinessStreet ] ); | 189 | list.append( mapIdToStr[ Qtopia::BusinessStreet ] ); |
185 | list.append( mapIdToStr[ Qtopia::BusinessCity ] ); | 190 | list.append( mapIdToStr[ Qtopia::BusinessCity ] ); |
186 | list.append( mapIdToStr[ Qtopia::BusinessState ] ); | 191 | list.append( mapIdToStr[ Qtopia::BusinessState ] ); |
187 | list.append( mapIdToStr[ Qtopia::BusinessZip ] ); | 192 | list.append( mapIdToStr[ Qtopia::BusinessZip ] ); |
188 | list.append( mapIdToStr[ Qtopia::BusinessCountry ] ); | 193 | list.append( mapIdToStr[ Qtopia::BusinessCountry ] ); |
189 | list.append( mapIdToStr[ Qtopia::BusinessPager ] ); | ||
190 | list.append( mapIdToStr[ Qtopia::BusinessWebPage ] ); | ||
191 | 194 | ||
192 | list.append( mapIdToStr[ Qtopia::HomeStreet ] ); | 195 | list.append( mapIdToStr[ Qtopia::HomeStreet ] ); |
193 | list.append( mapIdToStr[ Qtopia::HomeCity ] ); | 196 | list.append( mapIdToStr[ Qtopia::HomeCity ] ); |
194 | list.append( mapIdToStr[ Qtopia::HomeState ] ); | 197 | list.append( mapIdToStr[ Qtopia::HomeState ] ); |
195 | list.append( mapIdToStr[ Qtopia::HomeZip ] ); | 198 | list.append( mapIdToStr[ Qtopia::HomeZip ] ); |
196 | list.append( mapIdToStr[ Qtopia::HomeCountry ] ); | 199 | list.append( mapIdToStr[ Qtopia::HomeCountry ] ); |
197 | list.append( mapIdToStr[ Qtopia::HomeWebPage] ); | ||
198 | 200 | ||
199 | list += untrdetailsfields( sorted ); | 201 | list += untrdetailsfields( sorted ); |
200 | 202 | ||
201 | list.append( mapIdToStr[ Qtopia::Notes ] ); | 203 | list.append( mapIdToStr[ Qtopia::Notes ] ); |
202 | list.append( mapIdToStr[ Qtopia::Groups ] ); | 204 | list.append( mapIdToStr[ Qtopia::Groups ] ); |
203 | 205 | ||
204 | if (sorted) list.sort(); | 206 | if (sorted) list.sort(); |
205 | 207 | ||
206 | return list; | 208 | return list; |
207 | } | 209 | } |
208 | QMap<int, QString> OContactFields::idToTrFields() | 210 | QMap<int, QString> OContactFields::idToTrFields() |
209 | { | 211 | { |
210 | QMap<int, QString> ret_map; | 212 | QMap<int, QString> ret_map; |
211 | 213 | ||
212 | ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") ); | 214 | ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") ); |
213 | ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) ); | 215 | ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) ); |
214 | ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) ); | 216 | ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) ); |
215 | ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) ); | 217 | ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) ); |
216 | ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" )); | 218 | ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" )); |
217 | ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) ); | 219 | ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) ); |
218 | 220 | ||
219 | ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) ); | 221 | ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) ); |
220 | ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) ); | 222 | ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) ); |
221 | ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) ); | 223 | ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) ); |
222 | ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) ); | 224 | ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) ); |
223 | ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) ); | 225 | ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) ); |
224 | ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" )); | 226 | ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" )); |
225 | 227 | ||
226 | 228 | ||
227 | ret_map.insert( Qtopia::DefaultEmail, QObject::tr( "Default Email" ) ); | 229 | ret_map.insert( Qtopia::DefaultEmail, QObject::tr( "Default Email" ) ); |
228 | ret_map.insert( Qtopia::Emails, QObject::tr( "Emails" ) ); | 230 | ret_map.insert( Qtopia::Emails, QObject::tr( "Emails" ) ); |
229 | 231 | ||
230 | ret_map.insert( Qtopia::HomePhone, QObject::tr( "Home Phone" ) ); | 232 | ret_map.insert( Qtopia::HomePhone, QObject::tr( "Home Phone" ) ); |
231 | ret_map.insert( Qtopia::HomeFax, QObject::tr( "Home Fax" ) ); | 233 | ret_map.insert( Qtopia::HomeFax, QObject::tr( "Home Fax" ) ); |
232 | ret_map.insert( Qtopia::HomeMobile, QObject::tr( "Home Mobile" ) ); | 234 | ret_map.insert( Qtopia::HomeMobile, QObject::tr( "Home Mobile" ) ); |
233 | 235 | ||
234 | // business | 236 | // business |
235 | ret_map.insert( Qtopia::BusinessStreet, QObject::tr( "Business Street" ) ); | 237 | ret_map.insert( Qtopia::BusinessStreet, QObject::tr( "Business Street" ) ); |
236 | ret_map.insert( Qtopia::BusinessCity, QObject::tr( "Business City" ) ); | 238 | ret_map.insert( Qtopia::BusinessCity, QObject::tr( "Business City" ) ); |
237 | ret_map.insert( Qtopia::BusinessState, QObject::tr( "Business State" ) ); | 239 | ret_map.insert( Qtopia::BusinessState, QObject::tr( "Business State" ) ); |
238 | ret_map.insert( Qtopia::BusinessZip, QObject::tr( "Business Zip" ) ); | 240 | ret_map.insert( Qtopia::BusinessZip, QObject::tr( "Business Zip" ) ); |
239 | ret_map.insert( Qtopia::BusinessCountry, QObject::tr( "Business Country" ) ); | 241 | ret_map.insert( Qtopia::BusinessCountry, QObject::tr( "Business Country" ) ); |
240 | ret_map.insert( Qtopia::BusinessPager, QObject::tr( "Business Pager" ) ); | 242 | ret_map.insert( Qtopia::BusinessPager, QObject::tr( "Business Pager" ) ); |
241 | ret_map.insert( Qtopia::BusinessWebPage, QObject::tr( "Business WebPage" ) ); | 243 | ret_map.insert( Qtopia::BusinessWebPage, QObject::tr( "Business WebPage" ) ); |
242 | 244 | ||
243 | ret_map.insert( Qtopia::Office, QObject::tr( "Office" ) ); | 245 | ret_map.insert( Qtopia::Office, QObject::tr( "Office" ) ); |
244 | ret_map.insert( Qtopia::Profession, QObject::tr( "Profession" ) ); | 246 | ret_map.insert( Qtopia::Profession, QObject::tr( "Profession" ) ); |
245 | ret_map.insert( Qtopia::Assistant, QObject::tr( "Assistant" ) ); | 247 | ret_map.insert( Qtopia::Assistant, QObject::tr( "Assistant" ) ); |
246 | ret_map.insert( Qtopia::Manager, QObject::tr( "Manager" ) ); | 248 | ret_map.insert( Qtopia::Manager, QObject::tr( "Manager" ) ); |
247 | 249 | ||
248 | // home | 250 | // home |
249 | ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) ); | 251 | ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) ); |
250 | ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) ); | 252 | ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) ); |
251 | ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) ); | 253 | ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) ); |
252 | ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) ); | 254 | ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) ); |
253 | ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) ); | 255 | ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) ); |
254 | ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) ); | 256 | ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) ); |
255 | 257 | ||
256 | //personal | 258 | //personal |
257 | ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) ); | 259 | ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) ); |
258 | ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) ); | 260 | ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) ); |
259 | ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) ); | 261 | ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) ); |
260 | ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) ); | 262 | ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) ); |
261 | ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) ); | 263 | ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) ); |
262 | ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) ); | 264 | ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) ); |
263 | 265 | ||
264 | // other | 266 | // other |
265 | ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) ); | 267 | ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) ); |
266 | 268 | ||
267 | 269 | ||
268 | return ret_map; | 270 | return ret_map; |
269 | } | 271 | } |
270 | 272 | ||
271 | QMap<int, QString> OContactFields::idToUntrFields() | 273 | QMap<int, QString> OContactFields::idToUntrFields() |
272 | { | 274 | { |
273 | QMap<int, QString> ret_map; | 275 | QMap<int, QString> ret_map; |
274 | 276 | ||
275 | ret_map.insert( Qtopia::Title, "Name Title" ); | 277 | ret_map.insert( Qtopia::Title, "Name Title" ); |
276 | ret_map.insert( Qtopia::FirstName, "First Name" ); | 278 | ret_map.insert( Qtopia::FirstName, "First Name" ); |
277 | ret_map.insert( Qtopia::MiddleName, "Middle Name" ); | 279 | ret_map.insert( Qtopia::MiddleName, "Middle Name" ); |
278 | ret_map.insert( Qtopia::LastName, "Last Name" ); | 280 | ret_map.insert( Qtopia::LastName, "Last Name" ); |
279 | ret_map.insert( Qtopia::Suffix, "Suffix" ); | 281 | ret_map.insert( Qtopia::Suffix, "Suffix" ); |
280 | ret_map.insert( Qtopia::FileAs, "File As" ); | 282 | ret_map.insert( Qtopia::FileAs, "File As" ); |
281 | 283 | ||
282 | ret_map.insert( Qtopia::JobTitle, "Job Title" ); | 284 | ret_map.insert( Qtopia::JobTitle, "Job Title" ); |
283 | ret_map.insert( Qtopia::Department, "Department" ); | 285 | ret_map.insert( Qtopia::Department, "Department" ); |
284 | ret_map.insert( Qtopia::Company, "Company" ); | 286 | ret_map.insert( Qtopia::Company, "Company" ); |
285 | ret_map.insert( Qtopia::BusinessPhone, "Business Phone" ); | 287 | ret_map.insert( Qtopia::BusinessPhone, "Business Phone" ); |
286 | ret_map.insert( Qtopia::BusinessFax, "Business Fax" ); | 288 | ret_map.insert( Qtopia::BusinessFax, "Business Fax" ); |
287 | ret_map.insert( Qtopia::BusinessMobile, "Business Mobile" ); | 289 | ret_map.insert( Qtopia::BusinessMobile, "Business Mobile" ); |
288 | 290 | ||
289 | 291 | ||
290 | ret_map.insert( Qtopia::DefaultEmail, "Default Email" ); | 292 | ret_map.insert( Qtopia::DefaultEmail, "Default Email" ); |
291 | ret_map.insert( Qtopia::Emails, "Emails" ); | 293 | ret_map.insert( Qtopia::Emails, "Emails" ); |
292 | 294 | ||
293 | ret_map.insert( Qtopia::HomePhone, "Home Phone" ); | 295 | ret_map.insert( Qtopia::HomePhone, "Home Phone" ); |
294 | ret_map.insert( Qtopia::HomeFax, "Home Fax" ); | 296 | ret_map.insert( Qtopia::HomeFax, "Home Fax" ); |
295 | ret_map.insert( Qtopia::HomeMobile, "Home Mobile" ); | 297 | ret_map.insert( Qtopia::HomeMobile, "Home Mobile" ); |
296 | 298 | ||
297 | // business | 299 | // business |
298 | ret_map.insert( Qtopia::BusinessStreet, "Business Street" ); | 300 | ret_map.insert( Qtopia::BusinessStreet, "Business Street" ); |
299 | ret_map.insert( Qtopia::BusinessCity, "Business City" ); | 301 | ret_map.insert( Qtopia::BusinessCity, "Business City" ); |
300 | ret_map.insert( Qtopia::BusinessState, "Business State" ); | 302 | ret_map.insert( Qtopia::BusinessState, "Business State" ); |
301 | ret_map.insert( Qtopia::BusinessZip, "Business Zip" ); | 303 | ret_map.insert( Qtopia::BusinessZip, "Business Zip" ); |
302 | ret_map.insert( Qtopia::BusinessCountry, "Business Country" ); | 304 | ret_map.insert( Qtopia::BusinessCountry, "Business Country" ); |
303 | ret_map.insert( Qtopia::BusinessPager, "Business Pager" ); | 305 | ret_map.insert( Qtopia::BusinessPager, "Business Pager" ); |
304 | ret_map.insert( Qtopia::BusinessWebPage, "Business WebPage" ); | 306 | ret_map.insert( Qtopia::BusinessWebPage, "Business WebPage" ); |
305 | 307 | ||
306 | ret_map.insert( Qtopia::Office, "Office" ); | 308 | ret_map.insert( Qtopia::Office, "Office" ); |
307 | ret_map.insert( Qtopia::Profession, "Profession" ); | 309 | ret_map.insert( Qtopia::Profession, "Profession" ); |
308 | ret_map.insert( Qtopia::Assistant, "Assistant" ); | 310 | ret_map.insert( Qtopia::Assistant, "Assistant" ); |
309 | ret_map.insert( Qtopia::Manager, "Manager" ); | 311 | ret_map.insert( Qtopia::Manager, "Manager" ); |
310 | 312 | ||
311 | // home | 313 | // home |
312 | ret_map.insert( Qtopia::HomeStreet, "Home Street" ); | 314 | ret_map.insert( Qtopia::HomeStreet, "Home Street" ); |
313 | ret_map.insert( Qtopia::HomeCity, "Home City" ); | 315 | ret_map.insert( Qtopia::HomeCity, "Home City" ); |
314 | ret_map.insert( Qtopia::HomeState, "Home State" ); | 316 | ret_map.insert( Qtopia::HomeState, "Home State" ); |
315 | ret_map.insert( Qtopia::HomeZip, "Home Zip" ); | 317 | ret_map.insert( Qtopia::HomeZip, "Home Zip" ); |
316 | ret_map.insert( Qtopia::HomeCountry, "Home Country" ); | 318 | ret_map.insert( Qtopia::HomeCountry, "Home Country" ); |
317 | ret_map.insert( Qtopia::HomeWebPage, "Home Web Page" ); | 319 | ret_map.insert( Qtopia::HomeWebPage, "Home Web Page" ); |
318 | 320 | ||
319 | //personal | 321 | //personal |
320 | ret_map.insert( Qtopia::Spouse, "Spouse" ); | 322 | ret_map.insert( Qtopia::Spouse, "Spouse" ); |
321 | ret_map.insert( Qtopia::Gender, "Gender" ); | 323 | ret_map.insert( Qtopia::Gender, "Gender" ); |
322 | ret_map.insert( Qtopia::Birthday, "Birthday" ); | 324 | ret_map.insert( Qtopia::Birthday, "Birthday" ); |
323 | ret_map.insert( Qtopia::Anniversary, "Anniversary" ); | 325 | ret_map.insert( Qtopia::Anniversary, "Anniversary" ); |
324 | ret_map.insert( Qtopia::Nickname, "Nickname" ); | 326 | ret_map.insert( Qtopia::Nickname, "Nickname" ); |
325 | ret_map.insert( Qtopia::Children, "Children" ); | 327 | ret_map.insert( Qtopia::Children, "Children" ); |
326 | 328 | ||
327 | // other | 329 | // other |
328 | ret_map.insert( Qtopia::Notes, "Notes" ); | 330 | ret_map.insert( Qtopia::Notes, "Notes" ); |
329 | 331 | ||
330 | 332 | ||
331 | return ret_map; | 333 | return ret_map; |
332 | } | 334 | } |
333 | 335 | ||
334 | QMap<QString, int> OContactFields::trFieldsToId() | 336 | QMap<QString, int> OContactFields::trFieldsToId() |
335 | { | 337 | { |
336 | QMap<int, QString> idtostr = idToTrFields(); | 338 | QMap<int, QString> idtostr = idToTrFields(); |
337 | QMap<QString, int> ret_map; | 339 | QMap<QString, int> ret_map; |
338 | 340 | ||
339 | 341 | ||
340 | QMap<int, QString>::Iterator it; | 342 | QMap<int, QString>::Iterator it; |
341 | for( it = idtostr.begin(); it != idtostr.end(); ++it ) | 343 | for( it = idtostr.begin(); it != idtostr.end(); ++it ) |
342 | ret_map.insert( *it, it.key() ); | 344 | ret_map.insert( *it, it.key() ); |
343 | 345 | ||
344 | 346 | ||
345 | return ret_map; | 347 | return ret_map; |
346 | } | 348 | } |
347 | 349 | ||
348 | QMap<QString, int> OContactFields::untrFieldsToId() | 350 | QMap<QString, int> OContactFields::untrFieldsToId() |
349 | { | 351 | { |
350 | QMap<int, QString> idtostr = idToUntrFields(); | 352 | QMap<int, QString> idtostr = idToUntrFields(); |
351 | QMap<QString, int> ret_map; | 353 | QMap<QString, int> ret_map; |
352 | 354 | ||
353 | 355 | ||
354 | QMap<int, QString>::Iterator it; | 356 | QMap<int, QString>::Iterator it; |
355 | for( it = idtostr.begin(); it != idtostr.end(); ++it ) | 357 | for( it = idtostr.begin(); it != idtostr.end(); ++it ) |
356 | ret_map.insert( *it, it.key() ); | 358 | ret_map.insert( *it, it.key() ); |
357 | 359 | ||
358 | 360 | ||
359 | return ret_map; | 361 | return ret_map; |
360 | } | 362 | } |
361 | 363 | ||
362 | 364 | ||
363 | OContactFields::OContactFields(): | 365 | OContactFields::OContactFields(): |
364 | fieldOrder( DEFAULT_FIELD_ORDER ), | 366 | fieldOrder( DEFAULT_FIELD_ORDER ), |
365 | changedFieldOrder( false ) | 367 | changedFieldOrder( false ) |
366 | { | 368 | { |
367 | // Get the global field order from the config file and | 369 | // Get the global field order from the config file and |
368 | // use it as a start pattern | 370 | // use it as a start pattern |
369 | Config cfg ( "AddressBook" ); | 371 | Config cfg ( "AddressBook" ); |
370 | cfg.setGroup( "ContactFieldOrder" ); | 372 | cfg.setGroup( "ContactFieldOrder" ); |
371 | globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER ); | 373 | globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER ); |
372 | } | 374 | } |
373 | 375 | ||
374 | OContactFields::~OContactFields(){ | 376 | OContactFields::~OContactFields(){ |
375 | 377 | ||
376 | // We will store the fieldorder into the config file | 378 | // We will store the fieldorder into the config file |
377 | // to reuse it for the future.. | 379 | // to reuse it for the future.. |
378 | if ( changedFieldOrder ){ | 380 | if ( changedFieldOrder ){ |
379 | Config cfg ( "AddressBook" ); | 381 | Config cfg ( "AddressBook" ); |
380 | cfg.setGroup( "ContactFieldOrder" ); | 382 | cfg.setGroup( "ContactFieldOrder" ); |
381 | cfg.writeEntry( "General", globalFieldOrder ); | 383 | cfg.writeEntry( "General", globalFieldOrder ); |
382 | } | 384 | } |
383 | } | 385 | } |
384 | 386 | ||
385 | 387 | ||
386 | 388 | ||
387 | void OContactFields::saveToRecord( OContact &cnt ){ | 389 | void OContactFields::saveToRecord( OContact &cnt ){ |
388 | 390 | ||
389 | qDebug("ocontactfields saveToRecord: >%s<",fieldOrder.latin1()); | 391 | qDebug("ocontactfields saveToRecord: >%s<",fieldOrder.latin1()); |
390 | 392 | ||
391 | // Store fieldorder into this contact. | 393 | // Store fieldorder into this contact. |
392 | cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder ); | 394 | cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder ); |
393 | 395 | ||
394 | globalFieldOrder = fieldOrder; | 396 | globalFieldOrder = fieldOrder; |
395 | changedFieldOrder = true; | 397 | changedFieldOrder = true; |
396 | 398 | ||
397 | } | 399 | } |
398 | 400 | ||
399 | void OContactFields::loadFromRecord( const OContact &cnt ){ | 401 | void OContactFields::loadFromRecord( const OContact &cnt ){ |
400 | qDebug("ocontactfields loadFromRecord"); | 402 | qDebug("ocontactfields loadFromRecord"); |
401 | qDebug("loading >%s<",cnt.fullName().latin1()); | 403 | qDebug("loading >%s<",cnt.fullName().latin1()); |
402 | 404 | ||
403 | // Get fieldorder for this contact. If none is defined, | 405 | // Get fieldorder for this contact. If none is defined, |
404 | // we will use the global one from the config file.. | 406 | // we will use the global one from the config file.. |
405 | 407 | ||
406 | fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME ); | 408 | fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME ); |
407 | 409 | ||
408 | qDebug("fieldOrder from contact>%s<",fieldOrder.latin1()); | 410 | qDebug("fieldOrder from contact>%s<",fieldOrder.latin1()); |
409 | 411 | ||
410 | if (fieldOrder.isEmpty()){ | 412 | if (fieldOrder.isEmpty()){ |
411 | fieldOrder = globalFieldOrder; | 413 | fieldOrder = globalFieldOrder; |
412 | } | 414 | } |
413 | 415 | ||
414 | 416 | ||
415 | qDebug("effective fieldOrder in loadFromRecord >%s<",fieldOrder.latin1()); | 417 | qDebug("effective fieldOrder in loadFromRecord >%s<",fieldOrder.latin1()); |
416 | } | 418 | } |
417 | 419 | ||
418 | void OContactFields::setFieldOrder( int num, int index ){ | 420 | void OContactFields::setFieldOrder( int num, int index ){ |
419 | qDebug("qcontactfields setfieldorder pos %i -> %i",num,index); | 421 | qDebug("qcontactfields setfieldorder pos %i -> %i",num,index); |
420 | 422 | ||
421 | fieldOrder[num] = QString::number( index )[0]; | 423 | fieldOrder[num] = QString::number( index )[0]; |
422 | 424 | ||
423 | // We will store this new fieldorder globally to | 425 | // We will store this new fieldorder globally to |
424 | // remember it for contacts which have none | 426 | // remember it for contacts which have none |
425 | globalFieldOrder = fieldOrder; | 427 | globalFieldOrder = fieldOrder; |
426 | changedFieldOrder = true; | 428 | changedFieldOrder = true; |
427 | 429 | ||
428 | qDebug("fieldOrder >%s<",fieldOrder.latin1()); | 430 | qDebug("fieldOrder >%s<",fieldOrder.latin1()); |
429 | } | 431 | } |
430 | 432 | ||
431 | int OContactFields::getFieldOrder( int num, int defIndex ){ | 433 | int OContactFields::getFieldOrder( int num, int defIndex ){ |
432 | qDebug("ocontactfields getFieldOrder"); | 434 | qDebug("ocontactfields getFieldOrder"); |
433 | qDebug("fieldOrder >%s<",fieldOrder.latin1()); | 435 | qDebug("fieldOrder >%s<",fieldOrder.latin1()); |
434 | 436 | ||
435 | // Get index of combo as char.. | 437 | // Get index of combo as char.. |
436 | QChar poschar = fieldOrder[num]; | 438 | QChar poschar = fieldOrder[num]; |
437 | 439 | ||
438 | bool ok; | 440 | bool ok; |
439 | int ret = 0; | 441 | int ret = 0; |
440 | // Convert char to number.. | 442 | // Convert char to number.. |
441 | if ( !( poschar == QChar::null ) ) | 443 | if ( !( poschar == QChar::null ) ) |
442 | ret = QString( poschar ).toInt(&ok, 10); | 444 | ret = QString( poschar ).toInt(&ok, 10); |
443 | else | 445 | else |
444 | ok = false; | 446 | ok = false; |
445 | 447 | ||
446 | // Return default value if index for | 448 | // Return default value if index for |
447 | // num was not set or if anything else happened.. | 449 | // num was not set or if anything else happened.. |
448 | if ( !ok ) ret = defIndex; | 450 | if ( !ok ) ret = defIndex; |
449 | 451 | ||
450 | qDebug("returning >%i<",ret); | 452 | qDebug("returning >%i<",ret); |
451 | 453 | ||
452 | return ret; | 454 | return ret; |
453 | 455 | ||
454 | } | 456 | } |