author | eilers <eilers> | 2003-05-11 12:36:30 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-05-11 12:36:30 (UTC) |
commit | 37084d3961026893840ef9891132bdf193a312b3 (patch) (unidiff) | |
tree | 342792abd777eb11a378cc5e06e0436ab48f6d89 | |
parent | b068a42c89af19f5642b68060c1d085afa78e7b1 (diff) | |
download | opie-37084d3961026893840ef9891132bdf193a312b3.zip opie-37084d3961026893840ef9891132bdf193a312b3.tar.gz opie-37084d3961026893840ef9891132bdf193a312b3.tar.bz2 |
Some improvements in handling of organizations:
- If you enter a organization name and no Fullname is entered, the
organization name will be used.
Thus, the organization is shown correctly in the listview..
- The letterpicker now searches for the SaveAs Entry (configurable)
instead for lastname. Ths guarantees that the organization is found
as expected..
This addresses bugreport #590 and #895..
-rw-r--r-- | core/pim/addressbook/TODO | 13 | ||||
-rw-r--r-- | core/pim/addressbook/abconfig.cpp | 19 | ||||
-rw-r--r-- | core/pim/addressbook/abconfig.h | 11 | ||||
-rw-r--r-- | core/pim/addressbook/abview.cpp | 24 | ||||
-rw-r--r-- | core/pim/addressbook/abview.h | 3 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 3 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg_base.ui | 2 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 20 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 1 | ||||
-rw-r--r-- | core/pim/addressbook/version.h | 2 |
10 files changed, 79 insertions, 19 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index a3cffa7..383f8c5 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO | |||
@@ -1,112 +1,115 @@ | |||
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 | ||
15 | - Optionally put scrollbars left. | 14 | - Optionally put scrollbars left. |
16 | 15 | ||
17 | Known Bugs: | 16 | Known Bugs: |
18 | ----------- | 17 | ----------- |
19 | 18 | ||
20 | Urgent: | 19 | Urgent: |
21 | -------- | 20 | -------- |
22 | - Category is on the wrong position after changing to personal and back to normal | 21 | - Category is on the wrong position after changing to personal and back to normal |
23 | ( Temporarily workaround: Category is never deactivated.. :S ) | 22 | ( Temporarily workaround: Category is never deactivated.. :S ) |
24 | 23 | ||
25 | 24 | ||
26 | Important: | 25 | Important: |
27 | ---------- | 26 | ---------- |
28 | 27 | ||
29 | - "What's this" should be added (Deleyed after Feature Freeze) | 28 | - Configure the letter-picker: lastname/fullname search |
29 | -> Currently just behind the scenes .. | ||
30 | - Implement a correct handling of Organizations. They are currently | ||
31 | handled as normal persons.. :( | ||
30 | 32 | ||
31 | Less important: | 33 | Less important: |
32 | --------------- | 34 | --------------- |
33 | - Reload if contacts were changed externally | 35 | - Reload if contacts were changed externally |
34 | - The picker (alphabetical sort widget) should be | 36 | - The picker (alphabetical sort widget) should be |
35 | placed verticaly or horizontally (configurable) | 37 | placed verticaly or horizontally (configurable) |
36 | - Find a smart solution for activating/deactivating the "send email" event | ||
37 | - If new contact is added (contacteditor closed): focus (table, card) to | ||
38 | this entry ! | ||
39 | - After search (Started with Return): KeyFocus should be on Tabelle | 38 | - After search (Started with Return): KeyFocus should be on Tabelle |
39 | - Find a smart solution for activating/deactivating the "send email" event | ||
40 | 40 | ||
41 | ContactEditor: | 41 | ContactEditor: |
42 | - Redesign of Contacteditor | 42 | - Redesign of Contacteditor |
43 | 43 | ||
44 | Should be Fixed (not absolute sure, need further validation): | 44 | Should be Fixed (not absolute sure, need further validation): |
45 | ------------------------------------------------------------- | 45 | ------------------------------------------------------------- |
46 | 46 | ||
47 | 47 | ||
48 | Fixed/Ready: | 48 | Fixed/Ready: |
49 | ------- | 49 | ------- |
50 | - Syncing: abtable not reloaded after sync. | 50 | - Syncing: abtable not reloaded after sync. |
51 | - Find widget should be replaced by something like | 51 | - Find widget should be replaced by something like |
52 | qpdf has. | 52 | qpdf has. |
53 | - Adding a configuration dialog | 53 | - Adding a configuration dialog |
54 | - Picker: Activated letter schould be more visible | 54 | - Picker: Activated letter schould be more visible |
55 | - Advanced handling of cursor keys (search..) | 55 | - Advanced handling of cursor keys (search..) |
56 | - Mail-Icon is missing | 56 | - Mail-Icon is missing |
57 | - Use opie-mail insted of qt-mail if possible. | 57 | - Use opie-mail insted of qt-mail if possible. |
58 | - Font menu is invisible using german translation | 58 | - Font menu is invisible using german translation |
59 | - Personal contact editor: Disable categories | 59 | - Personal contact editor: Disable categories |
60 | - "Nonenglish" translation bug has to be fixed. | 60 | - "Nonenglish" translation bug has to be fixed. |
61 | - contacteditor: Birthday, annyversary, ... : Use Dateselector | 61 | - contacteditor: Birthday, annyversary, ... : Use Dateselector |
62 | - The names of the countries are sorted by there english names, only.. | 62 | - The names of the countries are sorted by there english names, only.. |
63 | Even if they are translated.. :S | 63 | Even if they are translated.. :S |
64 | - Cursor keys should work in detail-view (ablabel) | 64 | - Cursor keys should work in detail-view (ablabel) |
65 | -> Ablabel should be removed and Abtable should be increased with | 65 | -> Ablabel should be removed and Abtable should be increased with |
66 | different views (as started by darwin zins).. | 66 | different views (as started by darwin zins).. |
67 | - Use advanced database functions in abtable to decrease | 67 | - Use advanced database functions in abtable to decrease |
68 | memory footprint and to make everything more easy ! | 68 | memory footprint and to make everything more easy ! |
69 | (abtable should store Iterator for selected Category) | 69 | (abtable should store Iterator for selected Category) |
70 | - Abtable: Configure Contact column (internally already available, | 70 | - Abtable: Configure Contact column (internally already available, |
71 | need configuration) | 71 | need configuration) |
72 | - Select of primary contact (see #274 on mantis) | 72 | - Select of primary contact (see #274 on mantis) |
73 | - Category-select does not work completely: "Unfiled" is always in listview .. | 73 | - Category-select does not work completely: "Unfiled" is always in listview .. |
74 | - Return from Contacteditor: Category resettet to all | 74 | - Return from Contacteditor: Category resettet to all |
75 | - Personal Details not working | 75 | - Personal Details not working |
76 | - If category changed, the letterpicker should be resetted | 76 | - If category changed, the letterpicker should be resetted |
77 | - There should be some icons for List and Cardview | 77 | - There should be some icons for List and Cardview |
78 | - If in Cardview and a category change removes all entries: | 78 | - If in Cardview and a category change removes all entries: |
79 | There are already entries in Cardview after up/down | 79 | There are already entries in Cardview after up/down |
80 | - Personal Details: Anniversary zeigt Fantasie-Werte | 80 | - Personal Details: Anniversary zeigt Fantasie-Werte |
81 | - Unfiled shown just in Category "All" and "Unfiled". | 81 | - Unfiled shown just in Category "All" and "Unfiled". |
82 | - After finising search and after Edit: Clear Picker | 82 | - After finising search and after Edit: Clear Picker |
83 | - After Edit: Table position back to edited entry. | 83 | - After Edit: Table position back to edited entry. |
84 | - Optimize Table Update... | 84 | - Optimize Table Update... |
85 | - Change MyDialog to Config | 85 | - Change MyDialog to Config |
86 | - Store position and state of toolbar | 86 | - Store position and state of toolbar |
87 | - Searchwidget closed: Selected user is jumping | 87 | - Searchwidget closed: Selected user is jumping |
88 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) | 88 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) |
89 | zu lange.. | 89 | zu lange.. |
90 | - VCARD: Import of Anniversary does not work correctly (currently disabled) | 90 | - VCARD: Import of Anniversary does not work correctly (currently disabled) |
91 | - Name order selected in "contacteditor" not used in list view. | 91 | - Name order selected in "contacteditor" not used in list view. |
92 | - OK-Key does not switch from Detailview (ablable) to Listview | 92 | - OK-Key does not switch from Detailview (ablable) to Listview |
93 | - Receiving of beams should open a dialog | 93 | - Receiving of beams should open a dialog |
94 | - Fix start of opie-mail | 94 | - Fix start of opie-mail |
95 | - Implement Button Pics | 95 | - Implement Button Pics |
96 | - Add a dialog to accept and optionally edit received contacts by IRDA. | 96 | - Add a dialog to accept and optionally edit received contacts by IRDA. |
97 | - Language not English (tested with german opie-translation): | 97 | - Language not English (tested with german opie-translation): |
98 | 1. Configure nicht übersetzt (alles leer). | 98 | 1. Configure nicht übersetzt (alles leer). |
99 | 2. Contacteditor nur teilweise übersetzt. | 99 | 2. Contacteditor nur teilweise übersetzt. |
100 | 3. Kategorie-Picker geht nicht. | 100 | 3. Kategorie-Picker geht nicht. |
101 | - Plugin for Today for Birthdays and Anniversaries | 101 | - Plugin for Today for Birthdays and Anniversaries |
102 | - Implement a picker/combo for the default email. | 102 | - Implement a picker/combo for the default email. |
103 | - Overview window cleanup needed.. | 103 | - Overview window cleanup needed.. |
104 | - Store last settings of combo-boxes | 104 | - Store last settings of combo-boxes |
105 | - Personal and Business Web-page is not editable | 105 | - Personal and Business Web-page is not editable |
106 | - Default Email-button: A lot of problems: | 106 | - Default Email-button: A lot of problems: |
107 | If on second tab: The combo chooser is on the top left of the screen ! :( | 107 | If on second tab: The combo chooser is on the top left of the screen ! :( |
108 | - Default Email-Button: Sometimes not hiding the textfields completely | 108 | - Default Email-Button: Sometimes not hiding the textfields completely |
109 | - Fix handling of 3 Firstnames | 109 | - Fix handling of 3 Firstnames |
110 | - Cursor-UP/Down: Should additionally scroll cardview if it is too large | 110 | - Cursor-UP/Down: Should additionally scroll cardview if it is too large |
111 | (behaviour should be selectable by configuration) | 111 | (behaviour should be selectable by configuration) |
112 | - User center of the joypad to switch back from card to listview ! | 112 | - User center of the joypad to switch back from card to listview ! |
113 | - If new contact is added (contacteditor closed): focus (table, card) to | ||
114 | this entry ! | ||
115 | - Typo: Mov_e_able in Config-Dlg | ||
diff --git a/core/pim/addressbook/abconfig.cpp b/core/pim/addressbook/abconfig.cpp index 0b61614..4a0875b 100644 --- a/core/pim/addressbook/abconfig.cpp +++ b/core/pim/addressbook/abconfig.cpp | |||
@@ -1,198 +1,213 @@ | |||
1 | #include "abconfig.h" | 1 | #include "abconfig.h" |
2 | #include "version.h" | 2 | #include "version.h" |
3 | 3 | ||
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | #include <qpe/recordfields.h> | 5 | #include <qpe/recordfields.h> |
6 | 6 | ||
7 | AbConfig::AbConfig( ): | 7 | AbConfig::AbConfig( ): |
8 | m_useQtMail( true ), | 8 | m_useQtMail( true ), |
9 | m_useOpieMail( false ), | 9 | m_useOpieMail( false ), |
10 | m_useRegExp( false ), | 10 | m_useRegExp( false ), |
11 | m_beCaseSensitive( false ), | 11 | m_beCaseSensitive( false ), |
12 | m_fontSize( 1 ), | 12 | m_fontSize( 1 ), |
13 | m_barPos( QMainWindow::Top ), | 13 | m_barPos( QMainWindow::Top ), |
14 | m_fixedBars( true ), | 14 | m_fixedBars( true ), |
15 | m_lpSearchMode( LastName ), | ||
15 | m_changed( false ) | 16 | m_changed( false ) |
16 | { | 17 | { |
17 | } | 18 | } |
18 | 19 | ||
19 | AbConfig::~AbConfig() | 20 | AbConfig::~AbConfig() |
20 | { | 21 | { |
21 | } | 22 | } |
22 | 23 | ||
23 | bool AbConfig::useRegExp() const | 24 | bool AbConfig::useRegExp() const |
24 | { | 25 | { |
25 | return m_useRegExp; | 26 | return m_useRegExp; |
26 | } | 27 | } |
27 | bool AbConfig::useWildCards() const | 28 | bool AbConfig::useWildCards() const |
28 | { | 29 | { |
29 | return !m_useRegExp; | 30 | return !m_useRegExp; |
30 | } | 31 | } |
31 | bool AbConfig::useQtMail() const | 32 | bool AbConfig::useQtMail() const |
32 | { | 33 | { |
33 | return m_useQtMail; | 34 | return m_useQtMail; |
34 | } | 35 | } |
35 | bool AbConfig::useOpieMail() const | 36 | bool AbConfig::useOpieMail() const |
36 | { | 37 | { |
37 | return m_useOpieMail; | 38 | return m_useOpieMail; |
38 | } | 39 | } |
39 | bool AbConfig::beCaseSensitive() const | 40 | bool AbConfig::beCaseSensitive() const |
40 | { | 41 | { |
41 | return m_beCaseSensitive; | 42 | return m_beCaseSensitive; |
42 | } | 43 | } |
43 | int AbConfig::fontSize() const | 44 | int AbConfig::fontSize() const |
44 | { | 45 | { |
45 | return m_fontSize; | 46 | return m_fontSize; |
46 | } | 47 | } |
47 | 48 | ||
48 | QValueList<int> AbConfig::orderList() const | 49 | QValueList<int> AbConfig::orderList() const |
49 | { | 50 | { |
50 | return m_ordered; | 51 | return m_ordered; |
51 | } | 52 | } |
52 | 53 | ||
53 | QMainWindow::ToolBarDock AbConfig::getToolBarPos() const | 54 | QMainWindow::ToolBarDock AbConfig::getToolBarPos() const |
54 | { | 55 | { |
55 | return (QMainWindow::ToolBarDock) m_barPos; | 56 | return (QMainWindow::ToolBarDock) m_barPos; |
56 | } | 57 | } |
57 | 58 | ||
58 | bool AbConfig::fixedBars() const | 59 | bool AbConfig::fixedBars() const |
59 | { | 60 | { |
60 | return m_fixedBars; | 61 | return m_fixedBars; |
61 | } | 62 | } |
62 | 63 | ||
64 | AbConfig::LPSearchMode AbConfig::letterPickerSearch() const | ||
65 | { | ||
66 | return ( AbConfig::LPSearchMode ) m_lpSearchMode; | ||
67 | } | ||
68 | |||
63 | void AbConfig::setUseRegExp( bool v ) | 69 | void AbConfig::setUseRegExp( bool v ) |
64 | { | 70 | { |
65 | m_useRegExp = v ; | 71 | m_useRegExp = v ; |
66 | m_changed = true; | 72 | m_changed = true; |
67 | } | 73 | } |
68 | void AbConfig::setUseWildCards( bool v ) | 74 | void AbConfig::setUseWildCards( bool v ) |
69 | { | 75 | { |
70 | m_useRegExp = !v; | 76 | m_useRegExp = !v; |
71 | m_changed = true; | 77 | m_changed = true; |
72 | } | 78 | } |
73 | void AbConfig::setBeCaseSensitive( bool v ) | 79 | void AbConfig::setBeCaseSensitive( bool v ) |
74 | { | 80 | { |
75 | m_beCaseSensitive = v; | 81 | m_beCaseSensitive = v; |
76 | m_changed = true; | 82 | m_changed = true; |
77 | } | 83 | } |
78 | void AbConfig::setUseQtMail( bool v ) | 84 | void AbConfig::setUseQtMail( bool v ) |
79 | { | 85 | { |
80 | m_useQtMail = v; | 86 | m_useQtMail = v; |
81 | m_changed = true; | 87 | m_changed = true; |
82 | } | 88 | } |
83 | void AbConfig::setUseOpieMail( bool v ) | 89 | void AbConfig::setUseOpieMail( bool v ) |
84 | { | 90 | { |
85 | m_useOpieMail = v; | 91 | m_useOpieMail = v; |
86 | m_changed = true; | 92 | m_changed = true; |
87 | } | 93 | } |
88 | void AbConfig::setFontSize( int v ) | 94 | void AbConfig::setFontSize( int v ) |
89 | { | 95 | { |
90 | m_fontSize = v; | 96 | m_fontSize = v; |
91 | m_changed = true; | 97 | m_changed = true; |
92 | } | 98 | } |
93 | 99 | ||
94 | void AbConfig::setOrderList( const QValueList<int>& list ) | 100 | void AbConfig::setOrderList( const QValueList<int>& list ) |
95 | { | 101 | { |
96 | m_ordered = list; | 102 | m_ordered = list; |
97 | m_changed = true; | 103 | m_changed = true; |
98 | } | 104 | } |
99 | 105 | ||
100 | void AbConfig::setToolBarDock( const QMainWindow::ToolBarDock v ) | 106 | void AbConfig::setToolBarDock( const QMainWindow::ToolBarDock v ) |
101 | { | 107 | { |
102 | m_barPos = v; | 108 | m_barPos = v; |
103 | m_changed = true; | 109 | m_changed = true; |
104 | } | 110 | } |
105 | 111 | ||
106 | void AbConfig::setFixedBars( const bool fixed ) | 112 | void AbConfig::setFixedBars( const bool fixed ) |
107 | { | 113 | { |
108 | m_fixedBars = fixed; | 114 | m_fixedBars = fixed; |
109 | m_changed = true; | 115 | m_changed = true; |
110 | } | 116 | } |
111 | 117 | ||
118 | void AbConfig::setLetterPickerSearch( const AbConfig::LPSearchMode mode ) | ||
119 | { | ||
120 | m_lpSearchMode = mode; | ||
121 | m_changed = true; | ||
122 | } | ||
123 | |||
112 | void AbConfig::load() | 124 | void AbConfig::load() |
113 | { | 125 | { |
114 | // Read Config settings | 126 | // Read Config settings |
115 | Config cfg("AddressBook"); | 127 | Config cfg("AddressBook"); |
116 | 128 | ||
117 | cfg.setGroup("Font"); | 129 | cfg.setGroup("Font"); |
118 | m_fontSize = cfg.readNumEntry( "fontSize", 1 ); | 130 | m_fontSize = cfg.readNumEntry( "fontSize", 1 ); |
119 | 131 | ||
120 | cfg.setGroup("Search"); | 132 | cfg.setGroup("Search"); |
121 | m_useRegExp = cfg.readBoolEntry( "useRegExp" ); | 133 | m_useRegExp = cfg.readBoolEntry( "useRegExp", false ); |
122 | m_beCaseSensitive = cfg.readBoolEntry( "caseSensitive" ); | 134 | m_beCaseSensitive = cfg.readBoolEntry( "caseSensitive", false ); |
135 | m_lpSearchMode = cfg.readNumEntry( "lpSearchMode", FullName ); | ||
123 | 136 | ||
124 | cfg.setGroup("Mail"); | 137 | cfg.setGroup("Mail"); |
125 | m_useQtMail = cfg.readBoolEntry( "useQtMail", true ); | 138 | m_useQtMail = cfg.readBoolEntry( "useQtMail", true ); |
126 | m_useOpieMail=cfg.readBoolEntry( "useOpieMail" ); | 139 | m_useOpieMail=cfg.readBoolEntry( "useOpieMail" ); |
127 | 140 | ||
128 | cfg.setGroup("ContactOrder"); | 141 | cfg.setGroup("ContactOrder"); |
129 | int ID = 0; | 142 | int ID = 0; |
130 | int i = 0; | 143 | int i = 0; |
131 | ID = cfg.readNumEntry( "ContactID_"+QString::number(i++), 0 ); | 144 | ID = cfg.readNumEntry( "ContactID_"+QString::number(i++), 0 ); |
132 | while ( ID != 0 ){ | 145 | while ( ID != 0 ){ |
133 | m_ordered.append( ID ); | 146 | m_ordered.append( ID ); |
134 | ID = cfg.readNumEntry( "ContactID_"+QString::number(i++), 0 ); | 147 | ID = cfg.readNumEntry( "ContactID_"+QString::number(i++), 0 ); |
135 | } | 148 | } |
136 | 149 | ||
137 | // If no contact order is defined, we set the default | 150 | // If no contact order is defined, we set the default |
138 | if ( m_ordered.count() == 0 ) { | 151 | if ( m_ordered.count() == 0 ) { |
139 | m_ordered.append( Qtopia::DefaultEmail ); | 152 | m_ordered.append( Qtopia::DefaultEmail ); |
140 | m_ordered.append( Qtopia::HomePhone); | 153 | m_ordered.append( Qtopia::HomePhone); |
141 | m_ordered.append( Qtopia::HomeMobile); | 154 | m_ordered.append( Qtopia::HomeMobile); |
142 | m_ordered.append( Qtopia::BusinessPhone); | 155 | m_ordered.append( Qtopia::BusinessPhone); |
143 | } | 156 | } |
144 | 157 | ||
145 | cfg.setGroup("ToolBar"); | 158 | cfg.setGroup("ToolBar"); |
146 | m_barPos = cfg.readNumEntry( "Position", QMainWindow::Top ); | 159 | m_barPos = cfg.readNumEntry( "Position", QMainWindow::Top ); |
147 | m_fixedBars= cfg.readBoolEntry( "fixedBars", true ); | 160 | m_fixedBars= cfg.readBoolEntry( "fixedBars", true ); |
148 | 161 | ||
149 | m_changed = false; | 162 | m_changed = false; |
150 | } | 163 | } |
151 | 164 | ||
152 | void AbConfig::save() | 165 | void AbConfig::save() |
153 | { | 166 | { |
154 | if ( m_changed ){ | 167 | if ( m_changed ){ |
155 | Config cfg("AddressBook"); | 168 | Config cfg("AddressBook"); |
156 | cfg.setGroup("Font"); | 169 | cfg.setGroup("Font"); |
157 | cfg.writeEntry("fontSize", m_fontSize); | 170 | cfg.writeEntry("fontSize", m_fontSize); |
158 | 171 | ||
159 | cfg.setGroup("Search"); | 172 | cfg.setGroup("Search"); |
160 | cfg.writeEntry("useRegExp", m_useRegExp); | 173 | cfg.writeEntry("useRegExp", m_useRegExp); |
161 | cfg.writeEntry("caseSensitive", m_beCaseSensitive); | 174 | cfg.writeEntry("caseSensitive", m_beCaseSensitive); |
175 | cfg.writeEntry("lpSearchMode", m_lpSearchMode ); | ||
162 | 176 | ||
163 | cfg.setGroup("Mail"); | 177 | cfg.setGroup("Mail"); |
164 | cfg.writeEntry( "useQtMail", m_useQtMail ); | 178 | cfg.writeEntry( "useQtMail", m_useQtMail ); |
165 | cfg.writeEntry( "useOpieMail", m_useOpieMail); | 179 | cfg.writeEntry( "useOpieMail", m_useOpieMail); |
166 | 180 | ||
167 | cfg.setGroup("ContactOrder"); | 181 | cfg.setGroup("ContactOrder"); |
168 | cfg.clearGroup(); | 182 | cfg.clearGroup(); |
169 | for ( uint i = 0; i < m_ordered.count(); i++ ){ | 183 | for ( uint i = 0; i < m_ordered.count(); i++ ){ |
170 | cfg.writeEntry( "ContactID_"+QString::number(i), m_ordered[i] ); | 184 | cfg.writeEntry( "ContactID_"+QString::number(i), m_ordered[i] ); |
171 | } | 185 | } |
172 | 186 | ||
173 | cfg.setGroup("ToolBar"); | 187 | cfg.setGroup("ToolBar"); |
174 | cfg.writeEntry( "Position", m_barPos ); | 188 | cfg.writeEntry( "Position", m_barPos ); |
175 | cfg.writeEntry( "fixedBars", m_fixedBars ); | 189 | cfg.writeEntry( "fixedBars", m_fixedBars ); |
176 | 190 | ||
177 | cfg.setGroup("Version"); | 191 | cfg.setGroup("Version"); |
178 | cfg.writeEntry( "AppName", APPNAME + QString(" V" ) + MAINVERSION + QString(".") + SUBVERSION + QString(".") + PATCHVERSION); | 192 | cfg.writeEntry( "AppName", APPNAME + QString(" V" ) + MAINVERSION + QString(".") + SUBVERSION + QString(".") + PATCHVERSION); |
179 | cfg.writeEntry( "Mainversion", MAINVERSION ); | 193 | cfg.writeEntry( "Mainversion", MAINVERSION ); |
180 | cfg.writeEntry( "SubVersion", SUBVERSION ); | 194 | cfg.writeEntry( "SubVersion", SUBVERSION ); |
181 | cfg.writeEntry( "PatchVersion", PATCHVERSION ); | 195 | cfg.writeEntry( "PatchVersion", PATCHVERSION ); |
182 | 196 | ||
183 | } | 197 | } |
184 | 198 | ||
185 | } | 199 | } |
186 | 200 | ||
187 | void AbConfig::operator= ( const AbConfig& cnf ) | 201 | void AbConfig::operator= ( const AbConfig& cnf ) |
188 | { | 202 | { |
189 | m_useQtMail = cnf.m_useQtMail; | 203 | m_useQtMail = cnf.m_useQtMail; |
190 | m_useOpieMail = cnf.m_useOpieMail; | 204 | m_useOpieMail = cnf.m_useOpieMail; |
191 | m_useRegExp = cnf.m_useRegExp; | 205 | m_useRegExp = cnf.m_useRegExp; |
192 | m_beCaseSensitive = cnf.m_beCaseSensitive; | 206 | m_beCaseSensitive = cnf.m_beCaseSensitive; |
193 | m_fontSize = cnf.m_fontSize; | 207 | m_fontSize = cnf.m_fontSize; |
194 | m_ordered = cnf.m_ordered; | 208 | m_ordered = cnf.m_ordered; |
195 | m_barPos = cnf.m_barPos; | 209 | m_barPos = cnf.m_barPos; |
196 | m_fixedBars = cnf.m_fixedBars; | 210 | m_fixedBars = cnf.m_fixedBars; |
211 | m_lpSearchMode = cnf.m_lpSearchMode; | ||
197 | } | 212 | } |
198 | 213 | ||
diff --git a/core/pim/addressbook/abconfig.h b/core/pim/addressbook/abconfig.h index ce51b4c..93764f2 100644 --- a/core/pim/addressbook/abconfig.h +++ b/core/pim/addressbook/abconfig.h | |||
@@ -1,58 +1,69 @@ | |||
1 | #ifndef _ABCONFIG_H_ | 1 | #ifndef _ABCONFIG_H_ |
2 | #define _ABCONFIG_H_ | 2 | #define _ABCONFIG_H_ |
3 | 3 | ||
4 | #include <qstringlist.h> | 4 | #include <qstringlist.h> |
5 | #include <qmainwindow.h> | 5 | #include <qmainwindow.h> |
6 | 6 | ||
7 | class AbConfig | 7 | class AbConfig |
8 | { | 8 | { |
9 | public: | 9 | public: |
10 | enum LPSearchMode{ | ||
11 | LastName = 0, | ||
12 | FullName, | ||
13 | LASTELEMENT | ||
14 | }; | ||
15 | |||
16 | |||
17 | |||
10 | AbConfig(); | 18 | AbConfig(); |
11 | ~AbConfig(); | 19 | ~AbConfig(); |
12 | 20 | ||
13 | // Search Settings | 21 | // Search Settings |
14 | bool useRegExp() const; | 22 | bool useRegExp() const; |
15 | bool useWildCards() const; | 23 | bool useWildCards() const; |
16 | bool beCaseSensitive() const; | 24 | bool beCaseSensitive() const; |
17 | bool useQtMail() const; | 25 | bool useQtMail() const; |
18 | bool useOpieMail() const; | 26 | bool useOpieMail() const; |
19 | int fontSize() const; | 27 | int fontSize() const; |
20 | QValueList<int> orderList() const; | 28 | QValueList<int> orderList() const; |
21 | QMainWindow::ToolBarDock getToolBarPos() const; | 29 | QMainWindow::ToolBarDock getToolBarPos() const; |
22 | bool fixedBars() const; | 30 | bool fixedBars() const; |
31 | LPSearchMode letterPickerSearch() const; | ||
23 | 32 | ||
24 | void setUseRegExp( bool v ); | 33 | void setUseRegExp( bool v ); |
25 | void setUseWildCards( bool v ); | 34 | void setUseWildCards( bool v ); |
26 | void setBeCaseSensitive( bool v ); | 35 | void setBeCaseSensitive( bool v ); |
27 | void setUseQtMail( bool v ); | 36 | void setUseQtMail( bool v ); |
28 | void setUseOpieMail( bool v ); | 37 | void setUseOpieMail( bool v ); |
29 | void setFontSize( int v ); | 38 | void setFontSize( int v ); |
30 | void setOrderList( const QValueList<int>& list ); | 39 | void setOrderList( const QValueList<int>& list ); |
31 | void setToolBarDock( const QMainWindow::ToolBarDock v ); | 40 | void setToolBarDock( const QMainWindow::ToolBarDock v ); |
32 | void setFixedBars( const bool fixed ); | 41 | void setFixedBars( const bool fixed ); |
42 | void setLetterPickerSearch( const LPSearchMode mode ); | ||
33 | 43 | ||
34 | void operator= ( const AbConfig& cnf ); | 44 | void operator= ( const AbConfig& cnf ); |
35 | 45 | ||
36 | void load(); | 46 | void load(); |
37 | void save(); | 47 | void save(); |
38 | 48 | ||
39 | protected: | 49 | protected: |
40 | /* virtual void itemUp(); */ | 50 | /* virtual void itemUp(); */ |
41 | /* virtual void itemDown(); */ | 51 | /* virtual void itemDown(); */ |
42 | 52 | ||
43 | QStringList contFields; | 53 | QStringList contFields; |
44 | 54 | ||
45 | bool m_useQtMail; | 55 | bool m_useQtMail; |
46 | bool m_useOpieMail; | 56 | bool m_useOpieMail; |
47 | bool m_useRegExp; | 57 | bool m_useRegExp; |
48 | bool m_beCaseSensitive; | 58 | bool m_beCaseSensitive; |
49 | int m_fontSize; | 59 | int m_fontSize; |
50 | QValueList<int> m_ordered; | 60 | QValueList<int> m_ordered; |
51 | int m_barPos; | 61 | int m_barPos; |
52 | bool m_fixedBars; | 62 | bool m_fixedBars; |
63 | int m_lpSearchMode; | ||
53 | 64 | ||
54 | bool m_changed; | 65 | bool m_changed; |
55 | }; | 66 | }; |
56 | 67 | ||
57 | 68 | ||
58 | #endif | 69 | #endif |
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index d3ca783..664bd3f 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp | |||
@@ -1,486 +1,502 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) | 2 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) |
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 | ** | 14 | ** |
15 | **********************************************************************/ | 15 | **********************************************************************/ |
16 | 16 | ||
17 | #include "abview.h" | 17 | #include "abview.h" |
18 | 18 | ||
19 | #include <qlayout.h> | 19 | #include <qlayout.h> |
20 | 20 | ||
21 | #include <qpe/global.h> | 21 | #include <qpe/global.h> |
22 | 22 | ||
23 | #include <opie/ocontactaccessbackend_vcard.h> | 23 | #include <opie/ocontactaccessbackend_vcard.h> |
24 | 24 | ||
25 | #include <assert.h> | ||
26 | |||
25 | 27 | ||
26 | // Is defined in LibQPE | 28 | // Is defined in LibQPE |
27 | extern QString categoryFileName(); | 29 | extern QString categoryFileName(); |
28 | 30 | ||
29 | QString addressbookPersonalVCardName() | 31 | QString addressbookPersonalVCardName() |
30 | { | 32 | { |
31 | QString filename = Global::applicationFileName("addressbook", | 33 | QString filename = Global::applicationFileName("addressbook", |
32 | "businesscard.vcf"); | 34 | "businesscard.vcf"); |
33 | return filename; | 35 | return filename; |
34 | } | 36 | } |
35 | 37 | ||
36 | 38 | ||
37 | AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): | 39 | AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): |
38 | QWidget(parent), | 40 | QWidget(parent), |
39 | mCat(0), | 41 | mCat(0), |
40 | m_inSearch( false ), | 42 | m_inSearch( false ), |
41 | m_inPersonal( false ), | 43 | m_inPersonal( false ), |
42 | m_curr_category( -1 ), | 44 | m_curr_category( -1 ), |
43 | m_curr_View( TableView ), | 45 | m_curr_View( TableView ), |
44 | m_prev_View( TableView ), | 46 | m_prev_View( TableView ), |
45 | m_curr_Contact ( 0 ), | 47 | m_curr_Contact ( 0 ), |
46 | m_contactdb ( 0l ), | 48 | m_contactdb ( 0l ), |
47 | m_storedDB ( 0l ), | 49 | m_storedDB ( 0l ), |
48 | m_viewStack( 0l ), | 50 | m_viewStack( 0l ), |
49 | m_abTable( 0l ), | 51 | m_abTable( 0l ), |
50 | m_orderedFields( ordered ) | 52 | m_orderedFields( ordered ) |
51 | { | 53 | { |
52 | // Load default database and handle syncing myself.. ! | 54 | // Load default database and handle syncing myself.. ! |
53 | m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ), | 55 | m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ), |
54 | mCat.load( categoryFileName() ); | 56 | mCat.load( categoryFileName() ); |
55 | 57 | ||
56 | // Create Layout and put WidgetStack into it. | 58 | // Create Layout and put WidgetStack into it. |
57 | QVBoxLayout *vb = new QVBoxLayout( this ); | 59 | QVBoxLayout *vb = new QVBoxLayout( this ); |
58 | m_viewStack = new QWidgetStack( this ); | 60 | m_viewStack = new QWidgetStack( this ); |
59 | vb->addWidget( m_viewStack ); | 61 | vb->addWidget( m_viewStack ); |
60 | 62 | ||
61 | // Creat TableView | 63 | // Creat TableView |
62 | QVBox* tableBox = new QVBox( m_viewStack ); | 64 | QVBox* tableBox = new QVBox( m_viewStack ); |
63 | m_abTable = new AbTable( m_orderedFields, tableBox, "table" ); | 65 | m_abTable = new AbTable( m_orderedFields, tableBox, "table" ); |
64 | m_abTable->setCurrentCell( 0, 0 ); | 66 | m_abTable->setCurrentCell( 0, 0 ); |
65 | m_abTable->setFocus(); | 67 | m_abTable->setFocus(); |
66 | 68 | ||
67 | // Add TableView to WidgetStack and raise it | 69 | // Add TableView to WidgetStack and raise it |
68 | m_viewStack -> addWidget( tableBox , TableView ); | 70 | m_viewStack -> addWidget( tableBox , TableView ); |
69 | 71 | ||
70 | // Create CardView and add it to WidgetStack | 72 | // Create CardView and add it to WidgetStack |
71 | QVBox* cardBox = new QVBox( m_viewStack ); | 73 | QVBox* cardBox = new QVBox( m_viewStack ); |
72 | m_ablabel = new AbLabel( cardBox, "CardView"); | 74 | m_ablabel = new AbLabel( cardBox, "CardView"); |
73 | m_viewStack -> addWidget( cardBox , CardView ); | 75 | m_viewStack -> addWidget( cardBox , CardView ); |
74 | 76 | ||
75 | // Connect views to me | 77 | // Connect views to me |
76 | connect ( m_abTable, SIGNAL( signalSwitch( void ) ), | 78 | connect ( m_abTable, SIGNAL( signalSwitch( void ) ), |
77 | this, SLOT( slotSwitch( void ) ) ); | 79 | this, SLOT( slotSwitch( void ) ) ); |
78 | connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ), | 80 | connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ), |
79 | this, SLOT( slotSwitch( void ) ) ); | 81 | this, SLOT( slotSwitch( void ) ) ); |
80 | 82 | ||
81 | load(); | 83 | load(); |
82 | } | 84 | } |
83 | 85 | ||
84 | AbView::~AbView() | 86 | AbView::~AbView() |
85 | { | 87 | { |
86 | m_contactdb -> save(); | 88 | m_contactdb -> save(); |
87 | delete m_contactdb; | 89 | delete m_contactdb; |
88 | 90 | ||
89 | if ( m_storedDB ){ | 91 | if ( m_storedDB ){ |
90 | m_storedDB -> save(); | 92 | m_storedDB -> save(); |
91 | delete m_storedDB; | 93 | delete m_storedDB; |
92 | } | 94 | } |
93 | } | 95 | } |
94 | 96 | ||
95 | 97 | ||
96 | void AbView::setView( Views view ) | 98 | void AbView::setView( Views view ) |
97 | { | 99 | { |
98 | //qWarning("AbView::setView( Views view )"); | 100 | //qWarning("AbView::setView( Views view )"); |
99 | m_curr_View = view; | 101 | m_curr_View = view; |
100 | load(); | 102 | load(); |
101 | } | 103 | } |
102 | 104 | ||
103 | void AbView::addEntry( const OContact &newContact ) | 105 | void AbView::addEntry( const OContact &newContact ) |
104 | { | 106 | { |
105 | //qWarning("abview:AddContact"); | 107 | //qWarning("abview:AddContact"); |
106 | m_contactdb->add ( newContact ); | 108 | m_contactdb->add ( newContact ); |
107 | load(); | 109 | load(); |
108 | 110 | ||
109 | } | 111 | } |
110 | void AbView::removeEntry( const int UID ) | 112 | void AbView::removeEntry( const int UID ) |
111 | { | 113 | { |
112 | //qWarning("abview:RemoveContact"); | 114 | //qWarning("abview:RemoveContact"); |
113 | m_contactdb->remove( UID ); | 115 | m_contactdb->remove( UID ); |
114 | load(); | 116 | load(); |
115 | } | 117 | } |
116 | 118 | ||
117 | void AbView::replaceEntry( const OContact &contact ) | 119 | void AbView::replaceEntry( const OContact &contact ) |
118 | { | 120 | { |
119 | //qWarning("abview:ReplaceContact"); | 121 | //qWarning("abview:ReplaceContact"); |
120 | m_contactdb->replace( contact ); | 122 | m_contactdb->replace( contact ); |
121 | load(); | 123 | load(); |
122 | 124 | ||
123 | } | 125 | } |
124 | 126 | ||
125 | OContact AbView::currentEntry() | 127 | OContact AbView::currentEntry() |
126 | { | 128 | { |
127 | OContact currentContact; | 129 | OContact currentContact; |
128 | 130 | ||
129 | switch ( (int) m_curr_View ) { | 131 | switch ( (int) m_curr_View ) { |
130 | case TableView: | 132 | case TableView: |
131 | currentContact = m_abTable -> currentEntry(); | 133 | currentContact = m_abTable -> currentEntry(); |
132 | break; | 134 | break; |
133 | case CardView: | 135 | case CardView: |
134 | currentContact = m_ablabel -> currentEntry(); | 136 | currentContact = m_ablabel -> currentEntry(); |
135 | break; | 137 | break; |
136 | } | 138 | } |
137 | m_curr_Contact = currentContact.uid(); | 139 | m_curr_Contact = currentContact.uid(); |
138 | return currentContact; | 140 | return currentContact; |
139 | } | 141 | } |
140 | 142 | ||
141 | bool AbView::save() | 143 | bool AbView::save() |
142 | { | 144 | { |
143 | //qWarning("abView:Save data"); | 145 | //qWarning("abView:Save data"); |
144 | 146 | ||
145 | return m_contactdb->save(); | 147 | return m_contactdb->save(); |
146 | } | 148 | } |
147 | 149 | ||
148 | void AbView::load() | 150 | void AbView::load() |
149 | { | 151 | { |
150 | //qWarning("abView:Load data"); | 152 | //qWarning("abView:Load data"); |
151 | 153 | ||
152 | // Letter Search is stopped at this place | 154 | // Letter Search is stopped at this place |
153 | emit signalClearLetterPicker(); | 155 | emit signalClearLetterPicker(); |
154 | 156 | ||
155 | if ( m_inPersonal ) | 157 | if ( m_inPersonal ) |
156 | // VCard Backend does not sort.. | 158 | // VCard Backend does not sort.. |
157 | m_list = m_contactdb->allRecords(); | 159 | m_list = m_contactdb->allRecords(); |
158 | else{ | 160 | else{ |
159 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); | 161 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); |
160 | clearForCategory(); | 162 | clearForCategory(); |
161 | } | 163 | } |
162 | 164 | ||
163 | //qWarning ("Number of contacts: %d", m_list.count()); | 165 | qWarning ("Number of contacts: %d", m_list.count()); |
164 | 166 | ||
165 | updateView( true ); | 167 | updateView( true ); |
166 | 168 | ||
167 | } | 169 | } |
168 | 170 | ||
169 | void AbView::reload() | 171 | void AbView::reload() |
170 | { | 172 | { |
171 | //qWarning( "void AbView::reload()" ); | 173 | //qWarning( "void AbView::reload()" ); |
172 | 174 | ||
173 | m_contactdb->reload(); | 175 | m_contactdb->reload(); |
174 | load(); | 176 | load(); |
175 | } | 177 | } |
176 | 178 | ||
177 | void AbView::clear() | 179 | void AbView::clear() |
178 | { | 180 | { |
179 | // :SX | 181 | // :SX |
180 | } | 182 | } |
181 | 183 | ||
182 | void AbView::setShowByCategory( const QString& cat ) | 184 | void AbView::setShowByCategory( const QString& cat ) |
183 | { | 185 | { |
184 | //qWarning("AbView::setShowCategory( const QString& cat )"); | 186 | //qWarning("AbView::setShowCategory( const QString& cat )"); |
185 | 187 | ||
186 | int intCat = 0; | 188 | int intCat = 0; |
187 | 189 | ||
188 | // All (cat == NULL) will be stored as -1 | 190 | // All (cat == NULL) will be stored as -1 |
189 | if ( cat.isNull() ) | 191 | if ( cat.isNull() ) |
190 | intCat = -1; | 192 | intCat = -1; |
191 | else | 193 | else |
192 | intCat = mCat.id("Contacts", cat ); | 194 | intCat = mCat.id("Contacts", cat ); |
193 | 195 | ||
194 | // Just do anything if we really change the category | 196 | // Just do anything if we really change the category |
195 | if ( intCat != m_curr_category ){ | 197 | if ( intCat != m_curr_category ){ |
196 | // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); | 198 | // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); |
197 | 199 | ||
198 | m_curr_category = intCat; | 200 | m_curr_category = intCat; |
199 | emit signalClearLetterPicker(); | 201 | emit signalClearLetterPicker(); |
200 | 202 | ||
201 | load(); | 203 | load(); |
202 | } | 204 | } |
203 | 205 | ||
204 | } | 206 | } |
205 | 207 | ||
206 | void AbView::setShowToView( Views view ) | 208 | void AbView::setShowToView( Views view ) |
207 | { | 209 | { |
208 | //qWarning("void AbView::setShowToView( View %d )", view); | 210 | //qWarning("void AbView::setShowToView( View %d )", view); |
209 | 211 | ||
210 | //qWarning ("Change the View (Category is: %d)", m_curr_category); | 212 | //qWarning ("Change the View (Category is: %d)", m_curr_category); |
211 | 213 | ||
212 | if ( m_curr_View != view ){ | 214 | if ( m_curr_View != view ){ |
213 | m_prev_View = m_curr_View; | 215 | m_prev_View = m_curr_View; |
214 | m_curr_View = view; | 216 | m_curr_View = view; |
215 | 217 | ||
216 | updateView(); | 218 | updateView(); |
217 | } | 219 | } |
218 | 220 | ||
219 | } | 221 | } |
220 | 222 | ||
221 | void AbView::setShowByLetter( char c ) | 223 | void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) |
222 | { | 224 | { |
223 | //qWarning("void AbView::setShowByLetter( %c )", c ); | 225 | qWarning("void AbView::setShowByLetter( %c, %d )", c, mode ); |
226 | |||
227 | assert( mode < AbConfig::LASTELEMENT ); | ||
228 | |||
224 | OContact query; | 229 | OContact query; |
225 | if ( c == 0 ){ | 230 | if ( c == 0 ){ |
226 | load(); | 231 | load(); |
227 | return; | 232 | return; |
228 | }else{ | 233 | }else{ |
229 | // If the current Backend is unable to solve the query, we will | 234 | // If the current Backend is unable to solve the query, we will |
230 | // ignore the request .. | 235 | // ignore the request .. |
231 | if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){ | 236 | if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){ |
232 | return; | 237 | return; |
233 | } | 238 | } |
234 | 239 | ||
235 | query.setLastName( QString("%1*").arg(c) ); | 240 | switch( mode ){ |
241 | case AbConfig::LastName: | ||
242 | query.setLastName( QString("%1*").arg(c) ); | ||
243 | break; | ||
244 | case AbConfig::FullName: | ||
245 | query.setFileAs( QString("%1*").arg(c) ); | ||
246 | break; | ||
247 | default: | ||
248 | qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode ); | ||
249 | qWarning( "I will ignore it.." ); | ||
250 | return; | ||
251 | } | ||
236 | m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); | 252 | m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); |
237 | clearForCategory(); | 253 | clearForCategory(); |
238 | m_curr_Contact = 0; | 254 | m_curr_Contact = 0; |
239 | } | 255 | } |
240 | updateView( true ); | 256 | updateView( true ); |
241 | } | 257 | } |
242 | 258 | ||
243 | void AbView::setListOrder( const QValueList<int>& ordered ) | 259 | void AbView::setListOrder( const QValueList<int>& ordered ) |
244 | { | 260 | { |
245 | m_orderedFields = ordered; | 261 | m_orderedFields = ordered; |
246 | if ( m_abTable ){ | 262 | if ( m_abTable ){ |
247 | m_abTable->setOrderedList( ordered ); | 263 | m_abTable->setOrderedList( ordered ); |
248 | m_abTable->refresh(); | 264 | m_abTable->refresh(); |
249 | } | 265 | } |
250 | updateView(); | 266 | updateView(); |
251 | } | 267 | } |
252 | 268 | ||
253 | 269 | ||
254 | QString AbView::showCategory() const | 270 | QString AbView::showCategory() const |
255 | { | 271 | { |
256 | return mCat.label( "Contacts", m_curr_category ); | 272 | return mCat.label( "Contacts", m_curr_category ); |
257 | } | 273 | } |
258 | 274 | ||
259 | void AbView::showPersonal( bool personal ) | 275 | void AbView::showPersonal( bool personal ) |
260 | { | 276 | { |
261 | //qWarning ("void AbView::showPersonal( %d )", personal); | 277 | //qWarning ("void AbView::showPersonal( %d )", personal); |
262 | 278 | ||
263 | if ( personal ){ | 279 | if ( personal ){ |
264 | 280 | ||
265 | if ( m_inPersonal ) | 281 | if ( m_inPersonal ) |
266 | return; | 282 | return; |
267 | 283 | ||
268 | // Now switch to vCard Backend and load data. | 284 | // Now switch to vCard Backend and load data. |
269 | // The current default backend will be stored | 285 | // The current default backend will be stored |
270 | // to avoid unneeded load/stores. | 286 | // to avoid unneeded load/stores. |
271 | m_storedDB = m_contactdb; | 287 | m_storedDB = m_contactdb; |
272 | 288 | ||
273 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 289 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
274 | addressbookPersonalVCardName() ); | 290 | addressbookPersonalVCardName() ); |
275 | m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 291 | m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
276 | 292 | ||
277 | m_inPersonal = true; | 293 | m_inPersonal = true; |
278 | m_curr_View = CardView; | 294 | m_curr_View = CardView; |
279 | 295 | ||
280 | }else{ | 296 | }else{ |
281 | 297 | ||
282 | if ( !m_inPersonal ) | 298 | if ( !m_inPersonal ) |
283 | return; | 299 | return; |
284 | 300 | ||
285 | // Remove vCard Backend and restore default | 301 | // Remove vCard Backend and restore default |
286 | m_contactdb->save(); | 302 | m_contactdb->save(); |
287 | delete m_contactdb; | 303 | delete m_contactdb; |
288 | 304 | ||
289 | m_contactdb = m_storedDB; | 305 | m_contactdb = m_storedDB; |
290 | m_storedDB = 0l; | 306 | m_storedDB = 0l; |
291 | 307 | ||
292 | m_curr_View = TableView; | 308 | m_curr_View = TableView; |
293 | m_inPersonal = false; | 309 | m_inPersonal = false; |
294 | 310 | ||
295 | } | 311 | } |
296 | load(); | 312 | load(); |
297 | } | 313 | } |
298 | 314 | ||
299 | void AbView::setCurrentUid( int uid ){ | 315 | void AbView::setCurrentUid( int uid ){ |
300 | 316 | ||
301 | m_curr_Contact = uid; | 317 | m_curr_Contact = uid; |
302 | updateView( true ); //true: Don't modificate the UID ! | 318 | updateView( true ); //true: Don't modificate the UID ! |
303 | } | 319 | } |
304 | 320 | ||
305 | 321 | ||
306 | QStringList AbView::categories() | 322 | QStringList AbView::categories() |
307 | { | 323 | { |
308 | mCat.load( categoryFileName() ); | 324 | mCat.load( categoryFileName() ); |
309 | QStringList categoryList = mCat.labels( "Contacts" ); | 325 | QStringList categoryList = mCat.labels( "Contacts" ); |
310 | return categoryList; | 326 | return categoryList; |
311 | } | 327 | } |
312 | 328 | ||
313 | // BEGIN: Slots | 329 | // BEGIN: Slots |
314 | void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | 330 | void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, |
315 | bool , QString cat ) | 331 | bool , QString cat ) |
316 | { | 332 | { |
317 | //qWarning( "void AbView::slotDoFind" ); | 333 | //qWarning( "void AbView::slotDoFind" ); |
318 | 334 | ||
319 | // We reloading the data: Deselect Letterpicker | 335 | // We reloading the data: Deselect Letterpicker |
320 | emit signalClearLetterPicker(); | 336 | emit signalClearLetterPicker(); |
321 | 337 | ||
322 | // Use the current Category if nothing else selected | 338 | // Use the current Category if nothing else selected |
323 | int category = 0; | 339 | int category = 0; |
324 | 340 | ||
325 | if ( cat.isEmpty() ) | 341 | if ( cat.isEmpty() ) |
326 | category = m_curr_category; | 342 | category = m_curr_category; |
327 | else{ | 343 | else{ |
328 | category = mCat.id("Contacts", cat ); | 344 | category = mCat.id("Contacts", cat ); |
329 | } | 345 | } |
330 | 346 | ||
331 | //qWarning ("Find in Category %d", category); | 347 | //qWarning ("Find in Category %d", category); |
332 | 348 | ||
333 | QRegExp r( str ); | 349 | QRegExp r( str ); |
334 | r.setCaseSensitive( caseSensitive ); | 350 | r.setCaseSensitive( caseSensitive ); |
335 | r.setWildcard( !useRegExp ); | 351 | r.setWildcard( !useRegExp ); |
336 | 352 | ||
337 | // Get all matching entries out of the database | 353 | // Get all matching entries out of the database |
338 | m_list = m_contactdb->matchRegexp( r ); | 354 | m_list = m_contactdb->matchRegexp( r ); |
339 | 355 | ||
340 | //qWarning( "found: %d", m_list.count() ); | 356 | //qWarning( "found: %d", m_list.count() ); |
341 | if ( m_list.count() == 0 ){ | 357 | if ( m_list.count() == 0 ){ |
342 | emit signalNotFound(); | 358 | emit signalNotFound(); |
343 | return; | 359 | return; |
344 | } | 360 | } |
345 | 361 | ||
346 | // Now remove all contacts with wrong category (if any selected) | 362 | // Now remove all contacts with wrong category (if any selected) |
347 | // This algorithm is a litte bit ineffective, but | 363 | // This algorithm is a litte bit ineffective, but |
348 | // we will not have a lot of matching entries.. | 364 | // we will not have a lot of matching entries.. |
349 | clearForCategory(); | 365 | clearForCategory(); |
350 | 366 | ||
351 | // Now show all found entries | 367 | // Now show all found entries |
352 | updateView( true ); | 368 | updateView( true ); |
353 | } | 369 | } |
354 | 370 | ||
355 | void AbView::offSearch() | 371 | void AbView::offSearch() |
356 | { | 372 | { |
357 | m_inSearch = false; | 373 | m_inSearch = false; |
358 | 374 | ||
359 | load(); | 375 | load(); |
360 | } | 376 | } |
361 | 377 | ||
362 | void AbView::slotSwitch(){ | 378 | void AbView::slotSwitch(){ |
363 | //qWarning("AbView::slotSwitch()"); | 379 | //qWarning("AbView::slotSwitch()"); |
364 | 380 | ||
365 | m_prev_View = m_curr_View; | 381 | m_prev_View = m_curr_View; |
366 | switch ( (int) m_curr_View ){ | 382 | switch ( (int) m_curr_View ){ |
367 | case TableView: | 383 | case TableView: |
368 | qWarning("Switching to CardView"); | 384 | qWarning("Switching to CardView"); |
369 | m_curr_View = CardView; | 385 | m_curr_View = CardView; |
370 | break; | 386 | break; |
371 | case CardView: | 387 | case CardView: |
372 | qWarning("Switching to TableView"); | 388 | qWarning("Switching to TableView"); |
373 | m_curr_View = TableView; | 389 | m_curr_View = TableView; |
374 | break; | 390 | break; |
375 | } | 391 | } |
376 | updateView(); | 392 | updateView(); |
377 | 393 | ||
378 | } | 394 | } |
379 | 395 | ||
380 | // END: Slots | 396 | // END: Slots |
381 | 397 | ||
382 | void AbView::clearForCategory() | 398 | void AbView::clearForCategory() |
383 | { | 399 | { |
384 | OContactAccess::List::Iterator it; | 400 | OContactAccess::List::Iterator it; |
385 | // Now remove all contacts with wrong category if any category selected | 401 | // Now remove all contacts with wrong category if any category selected |
386 | 402 | ||
387 | OContactAccess::List allList = m_list; | 403 | OContactAccess::List allList = m_list; |
388 | if ( m_curr_category != -1 ){ | 404 | if ( m_curr_category != -1 ){ |
389 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 405 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
390 | if ( !contactCompare( *it, m_curr_category ) ){ | 406 | if ( !contactCompare( *it, m_curr_category ) ){ |
391 | // qWarning("Removing %d", (*it).uid()); | 407 | // qWarning("Removing %d", (*it).uid()); |
392 | m_list.remove( (*it).uid() ); | 408 | m_list.remove( (*it).uid() ); |
393 | } | 409 | } |
394 | } | 410 | } |
395 | } | 411 | } |
396 | 412 | ||
397 | } | 413 | } |
398 | 414 | ||
399 | bool AbView::contactCompare( const OContact &cnt, int category ) | 415 | bool AbView::contactCompare( const OContact &cnt, int category ) |
400 | { | 416 | { |
401 | //qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); | 417 | //qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); |
402 | 418 | ||
403 | bool returnMe; | 419 | bool returnMe; |
404 | QArray<int> cats; | 420 | QArray<int> cats; |
405 | cats = cnt.categories(); | 421 | cats = cnt.categories(); |
406 | 422 | ||
407 | //qWarning ("Number of categories: %d", cats.count() ); | 423 | //qWarning ("Number of categories: %d", cats.count() ); |
408 | 424 | ||
409 | returnMe = false; | 425 | returnMe = false; |
410 | if ( cats.count() == 0 && category == 0 ) | 426 | if ( cats.count() == 0 && category == 0 ) |
411 | // Contacts with no category will just shown on "All" and "Unfiled" | 427 | // Contacts with no category will just shown on "All" and "Unfiled" |
412 | returnMe = true; | 428 | returnMe = true; |
413 | else { | 429 | else { |
414 | int i; | 430 | int i; |
415 | for ( i = 0; i < int(cats.count()); i++ ) { | 431 | for ( i = 0; i < int(cats.count()); i++ ) { |
416 | // qWarning("Comparing %d with %d",cats[i],category ); | 432 | // qWarning("Comparing %d with %d",cats[i],category ); |
417 | if ( cats[i] == category ) { | 433 | if ( cats[i] == category ) { |
418 | returnMe = true; | 434 | returnMe = true; |
419 | break; | 435 | break; |
420 | } | 436 | } |
421 | } | 437 | } |
422 | } | 438 | } |
423 | //qWarning ("Return: %d", returnMe); | 439 | //qWarning ("Return: %d", returnMe); |
424 | return returnMe; | 440 | return returnMe; |
425 | } | 441 | } |
426 | 442 | ||
427 | // In Some rare cases we have to update all lists.. | 443 | // In Some rare cases we have to update all lists.. |
428 | void AbView::updateListinViews() | 444 | void AbView::updateListinViews() |
429 | { | 445 | { |
430 | m_abTable -> setContacts( m_list ); | 446 | m_abTable -> setContacts( m_list ); |
431 | m_ablabel -> setContacts( m_list ); | 447 | m_ablabel -> setContacts( m_list ); |
432 | } | 448 | } |
433 | 449 | ||
434 | void AbView::updateView( bool newdata ) | 450 | void AbView::updateView( bool newdata ) |
435 | { | 451 | { |
436 | //qWarning("AbView::updateView()"); | 452 | //qWarning("AbView::updateView()"); |
437 | 453 | ||
438 | if ( m_viewStack -> visibleWidget() ){ | 454 | if ( m_viewStack -> visibleWidget() ){ |
439 | m_viewStack -> visibleWidget() -> clearFocus(); | 455 | m_viewStack -> visibleWidget() -> clearFocus(); |
440 | } | 456 | } |
441 | 457 | ||
442 | // If we switching the view, we have to store some information | 458 | // If we switching the view, we have to store some information |
443 | if ( !newdata ){ | 459 | if ( !newdata ){ |
444 | if ( m_list.count() ){ | 460 | if ( m_list.count() ){ |
445 | switch ( (int) m_prev_View ) { | 461 | switch ( (int) m_prev_View ) { |
446 | case TableView: | 462 | case TableView: |
447 | m_curr_Contact = m_abTable -> currentEntry_UID(); | 463 | m_curr_Contact = m_abTable -> currentEntry_UID(); |
448 | break; | 464 | break; |
449 | case CardView: | 465 | case CardView: |
450 | m_curr_Contact = m_ablabel -> currentEntry_UID(); | 466 | m_curr_Contact = m_ablabel -> currentEntry_UID(); |
451 | break; | 467 | break; |
452 | } | 468 | } |
453 | }else | 469 | }else |
454 | m_curr_Contact = 0; | 470 | m_curr_Contact = 0; |
455 | } | 471 | } |
456 | 472 | ||
457 | // Feed all views with new lists | 473 | // Feed all views with new lists |
458 | if ( newdata ) | 474 | if ( newdata ) |
459 | updateListinViews(); | 475 | updateListinViews(); |
460 | 476 | ||
461 | // Tell the world that the view is changed | 477 | // Tell the world that the view is changed |
462 | if ( m_curr_View != m_prev_View ) | 478 | if ( m_curr_View != m_prev_View ) |
463 | emit signalViewSwitched ( (int) m_curr_View ); | 479 | emit signalViewSwitched ( (int) m_curr_View ); |
464 | 480 | ||
465 | m_prev_View = m_curr_View; | 481 | m_prev_View = m_curr_View; |
466 | 482 | ||
467 | // Switch to new View | 483 | // Switch to new View |
468 | switch ( (int) m_curr_View ) { | 484 | switch ( (int) m_curr_View ) { |
469 | case TableView: | 485 | case TableView: |
470 | m_abTable -> setChoiceSelection( m_orderedFields ); | 486 | m_abTable -> setChoiceSelection( m_orderedFields ); |
471 | if ( m_curr_Contact != 0 ) | 487 | if ( m_curr_Contact != 0 ) |
472 | m_abTable -> selectContact ( m_curr_Contact ); | 488 | m_abTable -> selectContact ( m_curr_Contact ); |
473 | m_abTable -> setFocus(); | 489 | m_abTable -> setFocus(); |
474 | break; | 490 | break; |
475 | case CardView: | 491 | case CardView: |
476 | if ( m_curr_Contact != 0 ) | 492 | if ( m_curr_Contact != 0 ) |
477 | m_ablabel -> selectContact( m_curr_Contact ); | 493 | m_ablabel -> selectContact( m_curr_Contact ); |
478 | m_ablabel -> setFocus(); | 494 | m_ablabel -> setFocus(); |
479 | break; | 495 | break; |
480 | } | 496 | } |
481 | 497 | ||
482 | // Raise the current View | 498 | // Raise the current View |
483 | m_viewStack -> raiseWidget( m_curr_View ); | 499 | m_viewStack -> raiseWidget( m_curr_View ); |
484 | } | 500 | } |
485 | 501 | ||
486 | 502 | ||
diff --git a/core/pim/addressbook/abview.h b/core/pim/addressbook/abview.h index 55c63cc..49bb4be 100644 --- a/core/pim/addressbook/abview.h +++ b/core/pim/addressbook/abview.h | |||
@@ -1,88 +1,89 @@ | |||
1 | #ifndef _ABVIEW_H_ | 1 | #ifndef _ABVIEW_H_ |
2 | #define _ABVIEW_H_ | 2 | #define _ABVIEW_H_ |
3 | 3 | ||
4 | #include <qwidget.h> | 4 | #include <qwidget.h> |
5 | #include <qwidgetstack.h> | 5 | #include <qwidgetstack.h> |
6 | 6 | ||
7 | #include <qpe/categories.h> | 7 | #include <qpe/categories.h> |
8 | #include <opie/ocontact.h> | 8 | #include <opie/ocontact.h> |
9 | #include <opie/ocontactaccess.h> | 9 | #include <opie/ocontactaccess.h> |
10 | 10 | ||
11 | #include "contacteditor.h" | 11 | #include "contacteditor.h" |
12 | #include "abtable.h" | 12 | #include "abtable.h" |
13 | #include "ablabel.h" | 13 | #include "ablabel.h" |
14 | #include "abconfig.h" | ||
14 | 15 | ||
15 | class AbView: public QWidget | 16 | class AbView: public QWidget |
16 | { | 17 | { |
17 | Q_OBJECT | 18 | Q_OBJECT |
18 | 19 | ||
19 | public: | 20 | public: |
20 | enum Views{ TableView=0, CardView, PersonalView }; | 21 | enum Views{ TableView=0, CardView, PersonalView }; |
21 | 22 | ||
22 | AbView( QWidget* parent, const QValueList<int>& ordered ); | 23 | AbView( QWidget* parent, const QValueList<int>& ordered ); |
23 | ~AbView(); | 24 | ~AbView(); |
24 | 25 | ||
25 | bool save(); | 26 | bool save(); |
26 | void load(); | 27 | void load(); |
27 | void reload(); | 28 | void reload(); |
28 | void clear(); | 29 | void clear(); |
29 | 30 | ||
30 | void setView( Views view ); | 31 | void setView( Views view ); |
31 | void showPersonal( bool personal ); | 32 | void showPersonal( bool personal ); |
32 | void setCurrentUid( int uid ); | 33 | void setCurrentUid( int uid ); |
33 | void setShowByCategory( const QString& cat ); | 34 | void setShowByCategory( const QString& cat ); |
34 | void setShowToView( Views view ); | 35 | void setShowToView( Views view ); |
35 | void setShowByLetter( char c ); | 36 | void setShowByLetter( char c, AbConfig::LPSearchMode mode = AbConfig::LastName ); |
36 | void setListOrder( const QValueList<int>& ordered ); | 37 | void setListOrder( const QValueList<int>& ordered ); |
37 | 38 | ||
38 | // Add Entry and put to current | 39 | // Add Entry and put to current |
39 | void addEntry( const OContact &newContact ); | 40 | void addEntry( const OContact &newContact ); |
40 | void removeEntry( const int UID ); | 41 | void removeEntry( const int UID ); |
41 | void replaceEntry( const OContact &contact ); | 42 | void replaceEntry( const OContact &contact ); |
42 | OContact currentEntry(); | 43 | OContact currentEntry(); |
43 | 44 | ||
44 | void inSearch() { m_inSearch = true; } | 45 | void inSearch() { m_inSearch = true; } |
45 | void offSearch(); | 46 | void offSearch(); |
46 | 47 | ||
47 | QString showCategory() const; | 48 | QString showCategory() const; |
48 | QStringList categories(); | 49 | QStringList categories(); |
49 | 50 | ||
50 | signals: | 51 | signals: |
51 | void signalNotFound(); | 52 | void signalNotFound(); |
52 | void signalClearLetterPicker(); | 53 | void signalClearLetterPicker(); |
53 | void signalViewSwitched ( int ); | 54 | void signalViewSwitched ( int ); |
54 | 55 | ||
55 | public slots: | 56 | public slots: |
56 | void slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | 57 | void slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, |
57 | bool backwards, QString category = QString::null ); | 58 | bool backwards, QString category = QString::null ); |
58 | void slotSwitch(); | 59 | void slotSwitch(); |
59 | 60 | ||
60 | private: | 61 | private: |
61 | void updateListinViews(); | 62 | void updateListinViews(); |
62 | void updateView( bool newdata = false ); | 63 | void updateView( bool newdata = false ); |
63 | void clearForCategory(); | 64 | void clearForCategory(); |
64 | bool contactCompare( const OContact &cnt, int category ); | 65 | bool contactCompare( const OContact &cnt, int category ); |
65 | void parseName( const QString& name, QString *first, QString *middle, | 66 | void parseName( const QString& name, QString *first, QString *middle, |
66 | QString * last ); | 67 | QString * last ); |
67 | 68 | ||
68 | Categories mCat; | 69 | Categories mCat; |
69 | bool m_inSearch; | 70 | bool m_inSearch; |
70 | bool m_inPersonal; | 71 | bool m_inPersonal; |
71 | int m_curr_category; | 72 | int m_curr_category; |
72 | Views m_curr_View; | 73 | Views m_curr_View; |
73 | Views m_prev_View; | 74 | Views m_prev_View; |
74 | int m_curr_Contact; | 75 | int m_curr_Contact; |
75 | 76 | ||
76 | OContactAccess* m_contactdb; | 77 | OContactAccess* m_contactdb; |
77 | OContactAccess* m_storedDB; | 78 | OContactAccess* m_storedDB; |
78 | OContactAccess::List m_list; | 79 | OContactAccess::List m_list; |
79 | 80 | ||
80 | QWidgetStack* m_viewStack; | 81 | QWidgetStack* m_viewStack; |
81 | AbTable* m_abTable; | 82 | AbTable* m_abTable; |
82 | AbLabel* m_ablabel; | 83 | AbLabel* m_ablabel; |
83 | 84 | ||
84 | QValueList<int> m_orderedFields; | 85 | QValueList<int> m_orderedFields; |
85 | }; | 86 | }; |
86 | 87 | ||
87 | 88 | ||
88 | #endif | 89 | #endif |
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 25c6f3a..34bf7f1 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -1,1051 +1,1052 @@ | |||
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( false ); | 90 | // setToolBarsMovable( false ); |
91 | setToolBarsMovable( !m_config.fixedBars() ); | 91 | setToolBarsMovable( !m_config.fixedBars() ); |
92 | setRightJustification( true ); | 92 | setRightJustification( true ); |
93 | 93 | ||
94 | QPEToolBar *bar = new QPEToolBar( this ); | 94 | QPEToolBar *bar = new QPEToolBar( this ); |
95 | bar->setHorizontalStretchable( TRUE ); | 95 | bar->setHorizontalStretchable( TRUE ); |
96 | 96 | ||
97 | QPEMenuBar *mbList = new QPEMenuBar( bar ); | 97 | QPEMenuBar *mbList = new QPEMenuBar( bar ); |
98 | mbList->setMargin( 0 ); | 98 | mbList->setMargin( 0 ); |
99 | 99 | ||
100 | QPopupMenu *edit = new QPopupMenu( mbList ); | 100 | QPopupMenu *edit = new QPopupMenu( mbList ); |
101 | mbList->insertItem( tr( "Contact" ), edit ); | 101 | mbList->insertItem( tr( "Contact" ), edit ); |
102 | 102 | ||
103 | // Category Menu | 103 | // Category Menu |
104 | catMenu = new QPopupMenu( this ); | 104 | catMenu = new QPopupMenu( this ); |
105 | catMenu->setCheckable( TRUE ); | 105 | catMenu->setCheckable( TRUE ); |
106 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 106 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
107 | mbList->insertItem( tr("View"), catMenu ); | 107 | mbList->insertItem( tr("View"), catMenu ); |
108 | 108 | ||
109 | // Create Toolbar | 109 | // Create Toolbar |
110 | listTools = new QPEToolBar( this, "list operations" ); | 110 | listTools = new QPEToolBar( this, "list operations" ); |
111 | listTools->setHorizontalStretchable( true ); | 111 | listTools->setHorizontalStretchable( true ); |
112 | addToolBar( listTools ); | 112 | addToolBar( listTools ); |
113 | moveToolBar( listTools, m_config.getToolBarPos() ); | 113 | moveToolBar( listTools, m_config.getToolBarPos() ); |
114 | 114 | ||
115 | // View Icons | 115 | // View Icons |
116 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/weeklst" ), | 116 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/weeklst" ), |
117 | QString::null, 0, this, 0 ); | 117 | QString::null, 0, this, 0 ); |
118 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); | 118 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); |
119 | m_tableViewButton->setToggleAction( true ); | 119 | m_tableViewButton->setToggleAction( true ); |
120 | m_tableViewButton->addTo( listTools ); | 120 | m_tableViewButton->addTo( listTools ); |
121 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 ); | 121 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 ); |
122 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); | 122 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); |
123 | m_cardViewButton->setToggleAction( true ); | 123 | m_cardViewButton->setToggleAction( true ); |
124 | m_cardViewButton->addTo( listTools ); | 124 | m_cardViewButton->addTo( listTools ); |
125 | 125 | ||
126 | listTools->addSeparator(); | 126 | listTools->addSeparator(); |
127 | 127 | ||
128 | // Other Buttons | 128 | // Other Buttons |
129 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, | 129 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, |
130 | 0, this, 0 ); | 130 | 0, this, 0 ); |
131 | actionNew = a; | 131 | actionNew = a; |
132 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); | 132 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); |
133 | a->addTo( edit ); | 133 | a->addTo( edit ); |
134 | a->addTo( listTools ); | 134 | a->addTo( listTools ); |
135 | 135 | ||
136 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | 136 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, |
137 | 0, this, 0 ); | 137 | 0, this, 0 ); |
138 | actionEdit = a; | 138 | actionEdit = a; |
139 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); | 139 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); |
140 | a->addTo( edit ); | 140 | a->addTo( edit ); |
141 | a->addTo( listTools ); | 141 | a->addTo( listTools ); |
142 | 142 | ||
143 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 143 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
144 | 0, this, 0 ); | 144 | 0, this, 0 ); |
145 | actionTrash = a; | 145 | actionTrash = a; |
146 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); | 146 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); |
147 | a->addTo( edit ); | 147 | a->addTo( edit ); |
148 | a->addTo( listTools ); | 148 | a->addTo( listTools ); |
149 | 149 | ||
150 | 150 | ||
151 | // make it possible to go directly to businesscard via qcop call | 151 | // make it possible to go directly to businesscard via qcop call |
152 | //#if defined(Q_WS_QWS) // Why this ? (se) | 152 | //#if defined(Q_WS_QWS) // Why this ? (se) |
153 | #if !defined(QT_NO_COP) | 153 | #if !defined(QT_NO_COP) |
154 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); | 154 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); |
155 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), | 155 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), |
156 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); | 156 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); |
157 | #endif | 157 | #endif |
158 | // #endif | 158 | // #endif |
159 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), | 159 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), |
160 | QString::null, 0, this, 0 ); | 160 | QString::null, 0, this, 0 ); |
161 | actionFind = a; | 161 | actionFind = a; |
162 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); | 162 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); |
163 | a->addTo( edit ); | 163 | a->addTo( edit ); |
164 | a->addTo( listTools ); | 164 | a->addTo( listTools ); |
165 | 165 | ||
166 | // Much better search widget, taken from QTReader.. (se) | 166 | // Much better search widget, taken from QTReader.. (se) |
167 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); | 167 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); |
168 | searchBar->setHorizontalStretchable( TRUE ); | 168 | searchBar->setHorizontalStretchable( TRUE ); |
169 | searchBar->hide(); | 169 | searchBar->hide(); |
170 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 170 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
171 | 171 | ||
172 | // QFont f("unifont", 16 /*, QFont::Bold*/); | 172 | // QFont f("unifont", 16 /*, QFont::Bold*/); |
173 | // searchEdit->setFont( f ); | 173 | // searchEdit->setFont( f ); |
174 | 174 | ||
175 | searchBar->setStretchableWidget( searchEdit ); | 175 | searchBar->setStretchableWidget( searchEdit ); |
176 | connect( searchEdit, SIGNAL( returnPressed( ) ), | 176 | connect( searchEdit, SIGNAL( returnPressed( ) ), |
177 | this, SLOT( slotFind( ) ) ); | 177 | this, SLOT( slotFind( ) ) ); |
178 | 178 | ||
179 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | 179 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); |
180 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | 180 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); |
181 | a->addTo( searchBar ); | 181 | a->addTo( searchBar ); |
182 | 182 | ||
183 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 183 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
184 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); | 184 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); |
185 | a->addTo( searchBar ); | 185 | a->addTo( searchBar ); |
186 | 186 | ||
187 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), | 187 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), |
188 | QString::null, 0, this, 0 ); | 188 | QString::null, 0, this, 0 ); |
189 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 189 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
190 | actionMail = a; | 190 | actionMail = a; |
191 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 191 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
192 | a->addTo( edit ); | 192 | a->addTo( edit ); |
193 | a->addTo( listTools ); | 193 | a->addTo( listTools ); |
194 | 194 | ||
195 | if ( Ir::supported() ) { | 195 | if ( Ir::supported() ) { |
196 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | 196 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, |
197 | 0, this, 0 ); | 197 | 0, this, 0 ); |
198 | actionBeam = a; | 198 | actionBeam = a; |
199 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 199 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
200 | a->addTo( edit ); | 200 | a->addTo( edit ); |
201 | a->addTo( listTools ); | 201 | a->addTo( listTools ); |
202 | } | 202 | } |
203 | 203 | ||
204 | edit->insertSeparator(); | 204 | edit->insertSeparator(); |
205 | 205 | ||
206 | a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null, | 206 | a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null, |
207 | 0, this, 0); | 207 | 0, this, 0); |
208 | actionPersonal = a; | 208 | actionPersonal = a; |
209 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); | 209 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); |
210 | a->addTo( edit ); | 210 | a->addTo( edit ); |
211 | 211 | ||
212 | a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), QString::null, | 212 | a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), QString::null, |
213 | 0, this, 0); | 213 | 0, this, 0); |
214 | actionPersonal = a; | 214 | actionPersonal = a; |
215 | connect( a, SIGNAL( activated() ), this, SLOT( exportvCard() ) ); | 215 | connect( a, SIGNAL( activated() ), this, SLOT( exportvCard() ) ); |
216 | a->addTo( edit ); | 216 | a->addTo( edit ); |
217 | 217 | ||
218 | edit->insertSeparator(); | 218 | edit->insertSeparator(); |
219 | 219 | ||
220 | a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), | 220 | a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), |
221 | QString::null, 0, this, 0 , TRUE ); | 221 | QString::null, 0, this, 0 , TRUE ); |
222 | actionPersonal = a; | 222 | actionPersonal = a; |
223 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); | 223 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); |
224 | a->addTo( edit ); | 224 | a->addTo( edit ); |
225 | 225 | ||
226 | 226 | ||
227 | #ifdef __DEBUG_RELEASE | 227 | #ifdef __DEBUG_RELEASE |
228 | // Remove this function for public Release ! This is only | 228 | // Remove this function for public Release ! This is only |
229 | // for debug purposes .. | 229 | // for debug purposes .. |
230 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); | 230 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); |
231 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); | 231 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); |
232 | a->addTo( edit ); | 232 | a->addTo( edit ); |
233 | #endif | 233 | #endif |
234 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, | 234 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, |
235 | 0, this, 0 ); | 235 | 0, this, 0 ); |
236 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); | 236 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); |
237 | a->addTo( edit ); | 237 | a->addTo( edit ); |
238 | 238 | ||
239 | // Create Views | 239 | // Create Views |
240 | listContainer = new QWidget( this ); | 240 | listContainer = new QWidget( this ); |
241 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | 241 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); |
242 | 242 | ||
243 | m_abView = new AbView( listContainer, m_config.orderList() ); | 243 | m_abView = new AbView( listContainer, m_config.orderList() ); |
244 | vb->addWidget( m_abView ); | 244 | vb->addWidget( m_abView ); |
245 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 245 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
246 | connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), | 246 | connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), |
247 | this, SLOT( slotViewSwitched( int ) ) ); | 247 | this, SLOT( slotViewSwitched( int ) ) ); |
248 | 248 | ||
249 | 249 | ||
250 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); | 250 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); |
251 | 251 | ||
252 | m_abView->load(); | 252 | m_abView->load(); |
253 | 253 | ||
254 | // Letter Picker | 254 | // Letter Picker |
255 | pLabel = new LetterPicker( listContainer ); | 255 | pLabel = new LetterPicker( listContainer ); |
256 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 256 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
257 | connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); | 257 | connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); |
258 | 258 | ||
259 | vb->addWidget( pLabel ); | 259 | vb->addWidget( pLabel ); |
260 | 260 | ||
261 | // All Categories into view-menu.. | 261 | // All Categories into view-menu.. |
262 | populateCategories(); | 262 | populateCategories(); |
263 | 263 | ||
264 | // Fontsize | 264 | // Fontsize |
265 | defaultFont = new QFont( m_abView->font() ); | 265 | defaultFont = new QFont( m_abView->font() ); |
266 | slotSetFont(m_config.fontSize()); | 266 | slotSetFont(m_config.fontSize()); |
267 | m_curFontSize = m_config.fontSize(); | 267 | m_curFontSize = m_config.fontSize(); |
268 | 268 | ||
269 | setCentralWidget(listContainer); | 269 | setCentralWidget(listContainer); |
270 | 270 | ||
271 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 271 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
272 | 272 | ||
273 | 273 | ||
274 | isLoading = false; | 274 | isLoading = false; |
275 | } | 275 | } |
276 | 276 | ||
277 | 277 | ||
278 | void AddressbookWindow::slotConfig() | 278 | void AddressbookWindow::slotConfig() |
279 | { | 279 | { |
280 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); | 280 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); |
281 | dlg -> setConfig( m_config ); | 281 | dlg -> setConfig( m_config ); |
282 | dlg -> showMaximized(); | 282 | dlg -> showMaximized(); |
283 | if ( dlg -> exec() ) { | 283 | if ( dlg -> exec() ) { |
284 | qWarning ("Config Dialog accepted!"); | 284 | qWarning ("Config Dialog accepted!"); |
285 | m_config = dlg -> getConfig(); | 285 | m_config = dlg -> getConfig(); |
286 | if ( m_curFontSize != m_config.fontSize() ){ | 286 | if ( m_curFontSize != m_config.fontSize() ){ |
287 | qWarning("Font was changed!"); | 287 | qWarning("Font was changed!"); |
288 | m_curFontSize = m_config.fontSize(); | 288 | m_curFontSize = m_config.fontSize(); |
289 | emit slotSetFont( m_curFontSize ); | 289 | emit slotSetFont( m_curFontSize ); |
290 | } | 290 | } |
291 | m_abView -> setListOrder( m_config.orderList() ); | 291 | m_abView -> setListOrder( m_config.orderList() ); |
292 | } | 292 | } |
293 | 293 | ||
294 | delete dlg; | 294 | delete dlg; |
295 | } | 295 | } |
296 | 296 | ||
297 | 297 | ||
298 | void AddressbookWindow::slotSetFont( int size ) | 298 | void AddressbookWindow::slotSetFont( int size ) |
299 | { | 299 | { |
300 | qWarning("void AddressbookWindow::slotSetFont( %d )", size); | 300 | qWarning("void AddressbookWindow::slotSetFont( %d )", size); |
301 | 301 | ||
302 | if (size > 2 || size < 0) | 302 | if (size > 2 || size < 0) |
303 | size = 1; | 303 | size = 1; |
304 | 304 | ||
305 | m_config.setFontSize( size ); | 305 | m_config.setFontSize( size ); |
306 | 306 | ||
307 | QFont *currentFont; | 307 | QFont *currentFont; |
308 | 308 | ||
309 | switch (size) { | 309 | switch (size) { |
310 | case 0: | 310 | case 0: |
311 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); | 311 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); |
312 | currentFont = new QFont (m_abView->font()); | 312 | currentFont = new QFont (m_abView->font()); |
313 | // abList->resizeRows(currentFont->pixelSize() + 7); :SX | 313 | // abList->resizeRows(currentFont->pixelSize() + 7); :SX |
314 | // abList->resizeRows(); | 314 | // abList->resizeRows(); |
315 | break; | 315 | break; |
316 | case 1: | 316 | case 1: |
317 | m_abView->setFont( *defaultFont ); | 317 | m_abView->setFont( *defaultFont ); |
318 | currentFont = new QFont (m_abView->font()); | 318 | currentFont = new QFont (m_abView->font()); |
319 | // // abList->resizeRows(currentFont->pixelSize() + 7); | 319 | // // abList->resizeRows(currentFont->pixelSize() + 7); |
320 | // abList->resizeRows(); | 320 | // abList->resizeRows(); |
321 | break; | 321 | break; |
322 | case 2: | 322 | case 2: |
323 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); | 323 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); |
324 | currentFont = new QFont (m_abView->font()); | 324 | currentFont = new QFont (m_abView->font()); |
325 | // //abList->resizeRows(currentFont->pixelSize() + 7); | 325 | // //abList->resizeRows(currentFont->pixelSize() + 7); |
326 | // abList->resizeRows(); | 326 | // abList->resizeRows(); |
327 | break; | 327 | break; |
328 | } | 328 | } |
329 | } | 329 | } |
330 | 330 | ||
331 | 331 | ||
332 | 332 | ||
333 | void AddressbookWindow::importvCard() { | 333 | void AddressbookWindow::importvCard() { |
334 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); | 334 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); |
335 | if(!str.isEmpty() ){ | 335 | if(!str.isEmpty() ){ |
336 | setDocument((const QString&) str ); | 336 | setDocument((const QString&) str ); |
337 | } | 337 | } |
338 | 338 | ||
339 | } | 339 | } |
340 | void AddressbookWindow::exportvCard() | 340 | void AddressbookWindow::exportvCard() |
341 | { | 341 | { |
342 | qWarning(" void AddressbookWindow::exportvCard()"); | 342 | qWarning(" void AddressbookWindow::exportvCard()"); |
343 | QString filename = OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this ); | 343 | QString filename = OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this ); |
344 | if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){ | 344 | if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){ |
345 | qWarning(" Save to file %s, (%d)", filename.latin1(), filename.length()-1 ); | 345 | qWarning(" Save to file %s, (%d)", filename.latin1(), filename.length()-1 ); |
346 | OContact curCont = m_abView->currentEntry(); | 346 | OContact curCont = m_abView->currentEntry(); |
347 | if ( !curCont.isEmpty() ){ | 347 | if ( !curCont.isEmpty() ){ |
348 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 348 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
349 | filename ); | 349 | filename ); |
350 | OContactAccess* access = new OContactAccess ( "addressbook_exp", QString::null , vcard_backend, true ); | 350 | OContactAccess* access = new OContactAccess ( "addressbook_exp", QString::null , vcard_backend, true ); |
351 | if ( access ){ | 351 | if ( access ){ |
352 | access->add( curCont ); | 352 | access->add( curCont ); |
353 | access->save(); | 353 | access->save(); |
354 | } | 354 | } |
355 | delete access; | 355 | delete access; |
356 | }else | 356 | }else |
357 | QMessageBox::critical( 0, "Export VCard", | 357 | QMessageBox::critical( 0, "Export VCard", |
358 | QString( tr( "You have to select a contact !") ) ); | 358 | QString( tr( "You have to select a contact !") ) ); |
359 | 359 | ||
360 | }else | 360 | }else |
361 | QMessageBox::critical( 0, "Export VCard", | 361 | QMessageBox::critical( 0, "Export VCard", |
362 | QString( tr( "You have to set a filename !") ) ); | 362 | QString( tr( "You have to set a filename !") ) ); |
363 | } | 363 | } |
364 | 364 | ||
365 | void AddressbookWindow::setDocument( const QString &filename ) | 365 | void AddressbookWindow::setDocument( const QString &filename ) |
366 | { | 366 | { |
367 | qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); | 367 | qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); |
368 | 368 | ||
369 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ | 369 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ |
370 | 370 | ||
371 | 371 | ||
372 | 372 | ||
373 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), | 373 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), |
374 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), | 374 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), |
375 | tr( "&Yes" ), tr( "&No" ), QString::null, | 375 | tr( "&Yes" ), tr( "&No" ), QString::null, |
376 | 0, // Enter == button 0 | 376 | 0, // Enter == button 0 |
377 | 2 ) ) { // Escape == button 2 | 377 | 2 ) ) { // Escape == button 2 |
378 | case 0: | 378 | case 0: |
379 | qWarning("YES clicked"); | 379 | qWarning("YES clicked"); |
380 | break; | 380 | break; |
381 | case 1: | 381 | case 1: |
382 | qWarning("NO clicked"); | 382 | qWarning("NO clicked"); |
383 | return; | 383 | return; |
384 | break; | 384 | break; |
385 | } | 385 | } |
386 | } | 386 | } |
387 | 387 | ||
388 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 388 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
389 | filename ); | 389 | filename ); |
390 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 390 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
391 | OContactAccess::List allList = access->allRecords(); | 391 | OContactAccess::List allList = access->allRecords(); |
392 | qWarning( "Found number of contacts in File: %d", allList.count() ); | 392 | qWarning( "Found number of contacts in File: %d", allList.count() ); |
393 | 393 | ||
394 | if ( !allList.count() ) { | 394 | if ( !allList.count() ) { |
395 | QMessageBox::information( this, "Import VCard", | 395 | QMessageBox::information( this, "Import VCard", |
396 | "It was impossible to import\nthe VCard.\n" | 396 | "It was impossible to import\nthe VCard.\n" |
397 | "The VCard may be corrupted!" ); | 397 | "The VCard may be corrupted!" ); |
398 | } | 398 | } |
399 | 399 | ||
400 | bool doAsk = true; | 400 | bool doAsk = true; |
401 | OContactAccess::List::Iterator it; | 401 | OContactAccess::List::Iterator it; |
402 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 402 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
403 | qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); | 403 | qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); |
404 | if ( doAsk ){ | 404 | if ( doAsk ){ |
405 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), | 405 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), |
406 | tr( "Do you really want add contact for \n%1?" ) | 406 | tr( "Do you really want add contact for \n%1?" ) |
407 | .arg( (*it).fullName().latin1() ), | 407 | .arg( (*it).fullName().latin1() ), |
408 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), | 408 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), |
409 | 0, // Enter == button 0 | 409 | 0, // Enter == button 0 |
410 | 2 ) ) { // Escape == button 2 | 410 | 2 ) ) { // Escape == button 2 |
411 | case 0: | 411 | case 0: |
412 | qWarning("YES clicked"); | 412 | qWarning("YES clicked"); |
413 | m_abView->addEntry( *it ); | 413 | m_abView->addEntry( *it ); |
414 | break; | 414 | break; |
415 | case 1: | 415 | case 1: |
416 | qWarning("NO clicked"); | 416 | qWarning("NO clicked"); |
417 | break; | 417 | break; |
418 | case 2: | 418 | case 2: |
419 | qWarning("YesAll clicked"); | 419 | qWarning("YesAll clicked"); |
420 | doAsk = false; | 420 | doAsk = false; |
421 | break; | 421 | break; |
422 | } | 422 | } |
423 | }else | 423 | }else |
424 | m_abView->addEntry( *it ); | 424 | m_abView->addEntry( *it ); |
425 | 425 | ||
426 | } | 426 | } |
427 | 427 | ||
428 | delete access; | 428 | delete access; |
429 | } | 429 | } |
430 | 430 | ||
431 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 431 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
432 | { | 432 | { |
433 | QMainWindow::resizeEvent( e ); | 433 | QMainWindow::resizeEvent( e ); |
434 | 434 | ||
435 | 435 | ||
436 | } | 436 | } |
437 | 437 | ||
438 | AddressbookWindow::~AddressbookWindow() | 438 | AddressbookWindow::~AddressbookWindow() |
439 | { | 439 | { |
440 | ToolBarDock dock; | 440 | ToolBarDock dock; |
441 | int dummy; | 441 | int dummy; |
442 | bool bDummy; | 442 | bool bDummy; |
443 | getLocation ( listTools, dock, dummy, bDummy, dummy ); | 443 | getLocation ( listTools, dock, dummy, bDummy, dummy ); |
444 | m_config.setToolBarDock( dock ); | 444 | m_config.setToolBarDock( dock ); |
445 | m_config.save(); | 445 | m_config.save(); |
446 | } | 446 | } |
447 | 447 | ||
448 | void AddressbookWindow::slotUpdateToolbar() | 448 | void AddressbookWindow::slotUpdateToolbar() |
449 | { | 449 | { |
450 | OContact ce = m_abView->currentEntry(); | 450 | OContact ce = m_abView->currentEntry(); |
451 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 451 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
452 | } | 452 | } |
453 | 453 | ||
454 | void AddressbookWindow::slotListNew() | 454 | void AddressbookWindow::slotListNew() |
455 | { | 455 | { |
456 | OContact cnt; | 456 | OContact cnt; |
457 | if( !syncing ) { | 457 | if( !syncing ) { |
458 | editEntry( NewEntry ); | 458 | editEntry( NewEntry ); |
459 | } else { | 459 | } else { |
460 | QMessageBox::warning(this, tr("Contacts"), | 460 | QMessageBox::warning(this, tr("Contacts"), |
461 | tr("Can not edit data, currently syncing")); | 461 | tr("Can not edit data, currently syncing")); |
462 | } | 462 | } |
463 | } | 463 | } |
464 | 464 | ||
465 | // void AddressbookWindow::slotListView() | 465 | // void AddressbookWindow::slotListView() |
466 | // { | 466 | // { |
467 | // m_abView -> init( abList->currentEntry() ); | 467 | // m_abView -> init( abList->currentEntry() ); |
468 | // // :SX mView->sync(); | 468 | // // :SX mView->sync(); |
469 | // //:SXshowView(); | 469 | // //:SXshowView(); |
470 | // } | 470 | // } |
471 | 471 | ||
472 | void AddressbookWindow::slotListDelete() | 472 | void AddressbookWindow::slotListDelete() |
473 | { | 473 | { |
474 | if(!syncing) { | 474 | if(!syncing) { |
475 | OContact tmpEntry = m_abView ->currentEntry(); | 475 | OContact tmpEntry = m_abView ->currentEntry(); |
476 | 476 | ||
477 | // get a name, do the best we can... | 477 | // get a name, do the best we can... |
478 | QString strName = tmpEntry.fullName(); | 478 | QString strName = tmpEntry.fullName(); |
479 | if ( strName.isEmpty() ) { | 479 | if ( strName.isEmpty() ) { |
480 | strName = tmpEntry.company(); | 480 | strName = tmpEntry.company(); |
481 | if ( strName.isEmpty() ) | 481 | if ( strName.isEmpty() ) |
482 | strName = "No Name"; | 482 | strName = "No Name"; |
483 | } | 483 | } |
484 | 484 | ||
485 | 485 | ||
486 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), | 486 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), |
487 | strName ) ) { | 487 | strName ) ) { |
488 | m_abView->removeEntry( tmpEntry.uid() ); | 488 | m_abView->removeEntry( tmpEntry.uid() ); |
489 | } | 489 | } |
490 | } else { | 490 | } else { |
491 | QMessageBox::warning( this, tr("Contacts"), | 491 | QMessageBox::warning( this, tr("Contacts"), |
492 | tr("Can not edit data, currently syncing") ); | 492 | tr("Can not edit data, currently syncing") ); |
493 | } | 493 | } |
494 | } | 494 | } |
495 | 495 | ||
496 | void AddressbookWindow::slotFindOpen() | 496 | void AddressbookWindow::slotFindOpen() |
497 | { | 497 | { |
498 | searchBar->show(); | 498 | searchBar->show(); |
499 | m_abView -> inSearch(); | 499 | m_abView -> inSearch(); |
500 | searchEdit->setFocus(); | 500 | searchEdit->setFocus(); |
501 | } | 501 | } |
502 | void AddressbookWindow::slotFindClose() | 502 | void AddressbookWindow::slotFindClose() |
503 | { | 503 | { |
504 | searchBar->hide(); | 504 | searchBar->hide(); |
505 | m_abView -> offSearch(); | 505 | m_abView -> offSearch(); |
506 | // m_abView->setFocus(); | 506 | // m_abView->setFocus(); |
507 | } | 507 | } |
508 | 508 | ||
509 | 509 | ||
510 | void AddressbookWindow::slotFind() | 510 | void AddressbookWindow::slotFind() |
511 | { | 511 | { |
512 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); | 512 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); |
513 | 513 | ||
514 | searchEdit->clearFocus(); | 514 | searchEdit->clearFocus(); |
515 | // m_abView->setFocus(); | 515 | // m_abView->setFocus(); |
516 | 516 | ||
517 | } | 517 | } |
518 | 518 | ||
519 | void AddressbookWindow::slotViewBack() | 519 | void AddressbookWindow::slotViewBack() |
520 | { | 520 | { |
521 | // :SX showList(); | 521 | // :SX showList(); |
522 | } | 522 | } |
523 | 523 | ||
524 | void AddressbookWindow::slotViewEdit() | 524 | void AddressbookWindow::slotViewEdit() |
525 | { | 525 | { |
526 | if(!syncing) { | 526 | if(!syncing) { |
527 | if (actionPersonal->isOn()) { | 527 | if (actionPersonal->isOn()) { |
528 | editPersonal(); | 528 | editPersonal(); |
529 | } else { | 529 | } else { |
530 | editEntry( EditEntry ); | 530 | editEntry( EditEntry ); |
531 | } | 531 | } |
532 | } else { | 532 | } else { |
533 | QMessageBox::warning( this, tr("Contacts"), | 533 | QMessageBox::warning( this, tr("Contacts"), |
534 | tr("Can not edit data, currently syncing") ); | 534 | tr("Can not edit data, currently syncing") ); |
535 | } | 535 | } |
536 | } | 536 | } |
537 | 537 | ||
538 | 538 | ||
539 | 539 | ||
540 | void AddressbookWindow::writeMail() | 540 | void AddressbookWindow::writeMail() |
541 | { | 541 | { |
542 | OContact c = m_abView -> currentEntry(); | 542 | OContact c = m_abView -> currentEntry(); |
543 | QString name = c.fileAs(); | 543 | QString name = c.fileAs(); |
544 | QString email = c.defaultEmail(); | 544 | QString email = c.defaultEmail(); |
545 | 545 | ||
546 | // I prefer the OPIE-Environment variable before the | 546 | // I prefer the OPIE-Environment variable before the |
547 | // QPE-one.. | 547 | // QPE-one.. |
548 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); | 548 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); |
549 | if ( basepath.isEmpty() ) | 549 | if ( basepath.isEmpty() ) |
550 | basepath = QString::fromLatin1( getenv("QPEDIR") ); | 550 | basepath = QString::fromLatin1( getenv("QPEDIR") ); |
551 | 551 | ||
552 | // Try to access the preferred. If not possible, try to | 552 | // Try to access the preferred. If not possible, try to |
553 | // switch to the other one.. | 553 | // switch to the other one.. |
554 | if ( m_config.useQtMail() ){ | 554 | if ( m_config.useQtMail() ){ |
555 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); | 555 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); |
556 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ | 556 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ |
557 | qWarning ("QCop"); | 557 | qWarning ("QCop"); |
558 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 558 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); |
559 | e << name << email; | 559 | e << name << email; |
560 | return; | 560 | return; |
561 | } else | 561 | } else |
562 | m_config.setUseOpieMail( true ); | 562 | m_config.setUseOpieMail( true ); |
563 | } | 563 | } |
564 | if ( m_config.useOpieMail() ){ | 564 | if ( m_config.useOpieMail() ){ |
565 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); | 565 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); |
566 | if ( QFile::exists( basepath + "/bin/mail" ) ){ | 566 | if ( QFile::exists( basepath + "/bin/mail" ) ){ |
567 | qWarning ("QCop"); | 567 | qWarning ("QCop"); |
568 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); | 568 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); |
569 | e << name << email; | 569 | e << name << email; |
570 | return; | 570 | return; |
571 | } else | 571 | } else |
572 | m_config.setUseQtMail( true ); | 572 | m_config.setUseQtMail( true ); |
573 | } | 573 | } |
574 | 574 | ||
575 | } | 575 | } |
576 | 576 | ||
577 | static const char * beamfile = "/tmp/obex/contact.vcf"; | 577 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
578 | 578 | ||
579 | void AddressbookWindow::slotBeam() | 579 | void AddressbookWindow::slotBeam() |
580 | { | 580 | { |
581 | QString beamFilename; | 581 | QString beamFilename; |
582 | OContact c; | 582 | OContact c; |
583 | if ( actionPersonal->isOn() ) { | 583 | if ( actionPersonal->isOn() ) { |
584 | beamFilename = addressbookPersonalVCardName(); | 584 | beamFilename = addressbookPersonalVCardName(); |
585 | if ( !QFile::exists( beamFilename ) ) | 585 | if ( !QFile::exists( beamFilename ) ) |
586 | return; // can't beam a non-existent file | 586 | return; // can't beam a non-existent file |
587 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 587 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
588 | beamFilename ); | 588 | beamFilename ); |
589 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 589 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
590 | OContactAccess::List allList = access->allRecords(); | 590 | OContactAccess::List allList = access->allRecords(); |
591 | OContactAccess::List::Iterator it = allList.begin(); // Just take first | 591 | OContactAccess::List::Iterator it = allList.begin(); // Just take first |
592 | c = *it; | 592 | c = *it; |
593 | 593 | ||
594 | delete access; | 594 | delete access; |
595 | } else { | 595 | } else { |
596 | unlink( beamfile ); // delete if exists | 596 | unlink( beamfile ); // delete if exists |
597 | mkdir("/tmp/obex/", 0755); | 597 | mkdir("/tmp/obex/", 0755); |
598 | c = m_abView -> currentEntry(); | 598 | c = m_abView -> currentEntry(); |
599 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 599 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
600 | beamfile ); | 600 | beamfile ); |
601 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 601 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
602 | access->add( c ); | 602 | access->add( c ); |
603 | access->save(); | 603 | access->save(); |
604 | delete access; | 604 | delete access; |
605 | 605 | ||
606 | beamFilename = beamfile; | 606 | beamFilename = beamfile; |
607 | } | 607 | } |
608 | 608 | ||
609 | qWarning("Beaming: %s", beamFilename.latin1() ); | 609 | qWarning("Beaming: %s", beamFilename.latin1() ); |
610 | 610 | ||
611 | Ir *ir = new Ir( this ); | 611 | Ir *ir = new Ir( this ); |
612 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 612 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
613 | QString description = c.fullName(); | 613 | QString description = c.fullName(); |
614 | ir->send( beamFilename, description, "text/x-vCard" ); | 614 | ir->send( beamFilename, description, "text/x-vCard" ); |
615 | } | 615 | } |
616 | 616 | ||
617 | void AddressbookWindow::beamDone( Ir *ir ) | 617 | void AddressbookWindow::beamDone( Ir *ir ) |
618 | { | 618 | { |
619 | 619 | ||
620 | delete ir; | 620 | delete ir; |
621 | unlink( beamfile ); | 621 | unlink( beamfile ); |
622 | } | 622 | } |
623 | 623 | ||
624 | 624 | ||
625 | static void parseName( const QString& name, QString *first, QString *middle, | 625 | static void parseName( const QString& name, QString *first, QString *middle, |
626 | QString * last ) | 626 | QString * last ) |
627 | { | 627 | { |
628 | 628 | ||
629 | int comma = name.find ( "," ); | 629 | int comma = name.find ( "," ); |
630 | QString rest; | 630 | QString rest; |
631 | if ( comma > 0 ) { | 631 | if ( comma > 0 ) { |
632 | *last = name.left( comma ); | 632 | *last = name.left( comma ); |
633 | comma++; | 633 | comma++; |
634 | while ( comma < int(name.length()) && name[comma] == ' ' ) | 634 | while ( comma < int(name.length()) && name[comma] == ' ' ) |
635 | comma++; | 635 | comma++; |
636 | rest = name.mid( comma ); | 636 | rest = name.mid( comma ); |
637 | } else { | 637 | } else { |
638 | int space = name.findRev( ' ' ); | 638 | int space = name.findRev( ' ' ); |
639 | *last = name.mid( space+1 ); | 639 | *last = name.mid( space+1 ); |
640 | rest = name.left( space ); | 640 | rest = name.left( space ); |
641 | } | 641 | } |
642 | int space = rest.find( ' ' ); | 642 | int space = rest.find( ' ' ); |
643 | if ( space <= 0 ) { | 643 | if ( space <= 0 ) { |
644 | *first = rest; | 644 | *first = rest; |
645 | } else { | 645 | } else { |
646 | *first = rest.left( space ); | 646 | *first = rest.left( space ); |
647 | *middle = rest.mid( space+1 ); | 647 | *middle = rest.mid( space+1 ); |
648 | } | 648 | } |
649 | 649 | ||
650 | } | 650 | } |
651 | 651 | ||
652 | 652 | ||
653 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 653 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
654 | { | 654 | { |
655 | qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); | 655 | qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); |
656 | 656 | ||
657 | if (msg == "editPersonal()") { | 657 | if (msg == "editPersonal()") { |
658 | editPersonal(); | 658 | editPersonal(); |
659 | } else if (msg == "editPersonalAndClose()") { | 659 | } else if (msg == "editPersonalAndClose()") { |
660 | editPersonal(); | 660 | editPersonal(); |
661 | close(); | 661 | close(); |
662 | } else if ( msg == "addContact(QString,QString)" ) { | 662 | } else if ( msg == "addContact(QString,QString)" ) { |
663 | QDataStream stream(data,IO_ReadOnly); | 663 | QDataStream stream(data,IO_ReadOnly); |
664 | QString name, email; | 664 | QString name, email; |
665 | stream >> name >> email; | 665 | stream >> name >> email; |
666 | 666 | ||
667 | OContact cnt; | 667 | OContact cnt; |
668 | QString fn, mn, ln; | 668 | QString fn, mn, ln; |
669 | parseName( name, &fn, &mn, &ln ); | 669 | parseName( name, &fn, &mn, &ln ); |
670 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 670 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
671 | cnt.setFirstName( fn ); | 671 | cnt.setFirstName( fn ); |
672 | cnt.setMiddleName( mn ); | 672 | cnt.setMiddleName( mn ); |
673 | cnt.setLastName( ln ); | 673 | cnt.setLastName( ln ); |
674 | cnt.insertEmails( email ); | 674 | cnt.insertEmails( email ); |
675 | cnt.setDefaultEmail( email ); | 675 | cnt.setDefaultEmail( email ); |
676 | cnt.setFileAs(); | 676 | cnt.setFileAs(); |
677 | 677 | ||
678 | m_abView -> addEntry( cnt ); | 678 | m_abView -> addEntry( cnt ); |
679 | 679 | ||
680 | // :SXm_abView()->init( cnt ); | 680 | // :SXm_abView()->init( cnt ); |
681 | editEntry( EditEntry ); | 681 | editEntry( EditEntry ); |
682 | } else if ( msg == "beamBusinessCard()" ) { | 682 | } else if ( msg == "beamBusinessCard()" ) { |
683 | QString beamFilename = addressbookPersonalVCardName(); | 683 | QString beamFilename = addressbookPersonalVCardName(); |
684 | if ( !QFile::exists( beamFilename ) ) | 684 | if ( !QFile::exists( beamFilename ) ) |
685 | return; // can't beam a non-existent file | 685 | return; // can't beam a non-existent file |
686 | 686 | ||
687 | Ir *ir = new Ir( this ); | 687 | Ir *ir = new Ir( this ); |
688 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 688 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
689 | QString description = "mycard.vcf"; | 689 | QString description = "mycard.vcf"; |
690 | ir->send( beamFilename, description, "text/x-vCard" ); | 690 | ir->send( beamFilename, description, "text/x-vCard" ); |
691 | } else if ( msg == "show(int)" ) { | 691 | } else if ( msg == "show(int)" ) { |
692 | QDataStream stream(data,IO_ReadOnly); | 692 | QDataStream stream(data,IO_ReadOnly); |
693 | int uid; | 693 | int uid; |
694 | stream >> uid; | 694 | stream >> uid; |
695 | 695 | ||
696 | qWarning( "Showing uid: %d" , uid ); | 696 | qWarning( "Showing uid: %d" , uid ); |
697 | 697 | ||
698 | // Deactivate Personal View.. | 698 | // Deactivate Personal View.. |
699 | if ( actionPersonal->isOn() ){ | 699 | if ( actionPersonal->isOn() ){ |
700 | actionPersonal->setOn( false ); | 700 | actionPersonal->setOn( false ); |
701 | slotPersonalView(); | 701 | slotPersonalView(); |
702 | } | 702 | } |
703 | 703 | ||
704 | // Reset category and show as card.. | 704 | // Reset category and show as card.. |
705 | m_abView -> setShowByCategory( QString::null ); | 705 | m_abView -> setShowByCategory( QString::null ); |
706 | m_abView -> setCurrentUid( uid ); | 706 | m_abView -> setCurrentUid( uid ); |
707 | slotViewSwitched ( AbView::CardView ); | 707 | slotViewSwitched ( AbView::CardView ); |
708 | 708 | ||
709 | showMaximized(); | 709 | showMaximized(); |
710 | qApp->exec(); | 710 | qApp->exec(); |
711 | 711 | ||
712 | } else if ( msg == "edit(int)" ) { | 712 | } else if ( msg == "edit(int)" ) { |
713 | QDataStream stream(data,IO_ReadOnly); | 713 | QDataStream stream(data,IO_ReadOnly); |
714 | int uid; | 714 | int uid; |
715 | stream >> uid; | 715 | stream >> uid; |
716 | 716 | ||
717 | // Deactivate Personal View.. | 717 | // Deactivate Personal View.. |
718 | if ( actionPersonal->isOn() ){ | 718 | if ( actionPersonal->isOn() ){ |
719 | actionPersonal->setOn( false ); | 719 | actionPersonal->setOn( false ); |
720 | slotPersonalView(); | 720 | slotPersonalView(); |
721 | } | 721 | } |
722 | 722 | ||
723 | // Reset category and edit.. | 723 | // Reset category and edit.. |
724 | m_abView -> setShowByCategory( QString::null ); | 724 | m_abView -> setShowByCategory( QString::null ); |
725 | m_abView -> setCurrentUid( uid ); | 725 | m_abView -> setCurrentUid( uid ); |
726 | slotViewEdit(); | 726 | slotViewEdit(); |
727 | } | 727 | } |
728 | 728 | ||
729 | } | 729 | } |
730 | 730 | ||
731 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 731 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
732 | { | 732 | { |
733 | OContact entry; | 733 | OContact entry; |
734 | if ( !abEditor ) { | 734 | if ( !abEditor ) { |
735 | abEditor = new ContactEditor( entry, this, "editor" ); | 735 | abEditor = new ContactEditor( entry, this, "editor" ); |
736 | } | 736 | } |
737 | if ( entryMode == EditEntry ) | 737 | if ( entryMode == EditEntry ) |
738 | abEditor->setEntry( m_abView -> currentEntry() ); | 738 | abEditor->setEntry( m_abView -> currentEntry() ); |
739 | else if ( entryMode == NewEntry ) | 739 | else if ( entryMode == NewEntry ) |
740 | abEditor->setEntry( entry ); | 740 | abEditor->setEntry( entry ); |
741 | // other things may change the caption. | 741 | // other things may change the caption. |
742 | abEditor->setCaption( tr("Edit Address") ); | 742 | abEditor->setCaption( tr("Edit Address") ); |
743 | 743 | ||
744 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 744 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
745 | abEditor->showMaximized(); | 745 | abEditor->showMaximized(); |
746 | #endif | 746 | #endif |
747 | // fix the foxus... | 747 | // fix the foxus... |
748 | abEditor->setNameFocus(); | 748 | abEditor->setNameFocus(); |
749 | if ( abEditor->exec() ) { | 749 | if ( abEditor->exec() ) { |
750 | setFocus(); | 750 | setFocus(); |
751 | if ( entryMode == NewEntry ) { | 751 | if ( entryMode == NewEntry ) { |
752 | OContact insertEntry = abEditor->entry(); | 752 | OContact insertEntry = abEditor->entry(); |
753 | insertEntry.assignUid(); | 753 | insertEntry.assignUid(); |
754 | m_abView -> addEntry( insertEntry ); | 754 | m_abView -> addEntry( insertEntry ); |
755 | m_abView -> setCurrentUid( insertEntry.uid() ); | ||
755 | } else { | 756 | } else { |
756 | OContact replEntry = abEditor->entry(); | 757 | OContact replEntry = abEditor->entry(); |
757 | 758 | ||
758 | if ( !replEntry.isValidUid() ) | 759 | if ( !replEntry.isValidUid() ) |
759 | replEntry.assignUid(); | 760 | replEntry.assignUid(); |
760 | 761 | ||
761 | m_abView -> replaceEntry( replEntry ); | 762 | m_abView -> replaceEntry( replEntry ); |
762 | } | 763 | } |
763 | } | 764 | } |
764 | // populateCategories(); | 765 | // populateCategories(); |
765 | 766 | ||
766 | } | 767 | } |
767 | 768 | ||
768 | void AddressbookWindow::editPersonal() | 769 | void AddressbookWindow::editPersonal() |
769 | { | 770 | { |
770 | OContact entry; | 771 | OContact entry; |
771 | 772 | ||
772 | // Switch to personal view if not selected | 773 | // Switch to personal view if not selected |
773 | // but take care of the menu, too | 774 | // but take care of the menu, too |
774 | if ( ! actionPersonal->isOn() ){ | 775 | if ( ! actionPersonal->isOn() ){ |
775 | qWarning("*** ++++"); | 776 | qWarning("*** ++++"); |
776 | actionPersonal->setOn( true ); | 777 | actionPersonal->setOn( true ); |
777 | slotPersonalView(); | 778 | slotPersonalView(); |
778 | } | 779 | } |
779 | 780 | ||
780 | if ( !abEditor ) { | 781 | if ( !abEditor ) { |
781 | abEditor = new ContactEditor( entry, this, "editor" ); | 782 | abEditor = new ContactEditor( entry, this, "editor" ); |
782 | } | 783 | } |
783 | 784 | ||
784 | abEditor->setCaption(tr("Edit My Personal Details")); | 785 | abEditor->setCaption(tr("Edit My Personal Details")); |
785 | abEditor->setPersonalView( true ); | 786 | abEditor->setPersonalView( true ); |
786 | editEntry( EditEntry ); | 787 | editEntry( EditEntry ); |
787 | abEditor->setPersonalView( false ); | 788 | abEditor->setPersonalView( false ); |
788 | 789 | ||
789 | } | 790 | } |
790 | 791 | ||
791 | 792 | ||
792 | void AddressbookWindow::slotPersonalView() | 793 | void AddressbookWindow::slotPersonalView() |
793 | { | 794 | { |
794 | qWarning("slotPersonalView()"); | 795 | qWarning("slotPersonalView()"); |
795 | if (!actionPersonal->isOn()) { | 796 | if (!actionPersonal->isOn()) { |
796 | // we just turned it off | 797 | // we just turned it off |
797 | qWarning("slotPersonalView()-> OFF"); | 798 | qWarning("slotPersonalView()-> OFF"); |
798 | setCaption( tr("Contacts") ); | 799 | setCaption( tr("Contacts") ); |
799 | actionNew->setEnabled(TRUE); | 800 | actionNew->setEnabled(TRUE); |
800 | actionTrash->setEnabled(TRUE); | 801 | actionTrash->setEnabled(TRUE); |
801 | actionFind->setEnabled(TRUE); | 802 | actionFind->setEnabled(TRUE); |
802 | actionMail->setEnabled(TRUE); | 803 | actionMail->setEnabled(TRUE); |
803 | // slotUpdateToolbar(); | 804 | // slotUpdateToolbar(); |
804 | 805 | ||
805 | m_abView->showPersonal( false ); | 806 | m_abView->showPersonal( false ); |
806 | 807 | ||
807 | return; | 808 | return; |
808 | } | 809 | } |
809 | 810 | ||
810 | qWarning("slotPersonalView()-> ON"); | 811 | qWarning("slotPersonalView()-> ON"); |
811 | // XXX need to disable some QActions. | 812 | // XXX need to disable some QActions. |
812 | actionNew->setEnabled(FALSE); | 813 | actionNew->setEnabled(FALSE); |
813 | actionTrash->setEnabled(FALSE); | 814 | actionTrash->setEnabled(FALSE); |
814 | actionFind->setEnabled(FALSE); | 815 | actionFind->setEnabled(FALSE); |
815 | actionMail->setEnabled(FALSE); | 816 | actionMail->setEnabled(FALSE); |
816 | 817 | ||
817 | setCaption( tr("Contacts - My Personal Details") ); | 818 | setCaption( tr("Contacts - My Personal Details") ); |
818 | 819 | ||
819 | m_abView->showPersonal( true ); | 820 | m_abView->showPersonal( true ); |
820 | 821 | ||
821 | } | 822 | } |
822 | 823 | ||
823 | 824 | ||
824 | void AddressbookWindow::listIsEmpty( bool empty ) | 825 | void AddressbookWindow::listIsEmpty( bool empty ) |
825 | { | 826 | { |
826 | if ( !empty ) { | 827 | if ( !empty ) { |
827 | deleteButton->setEnabled( TRUE ); | 828 | deleteButton->setEnabled( TRUE ); |
828 | } | 829 | } |
829 | } | 830 | } |
830 | 831 | ||
831 | void AddressbookWindow::reload() | 832 | void AddressbookWindow::reload() |
832 | { | 833 | { |
833 | syncing = FALSE; | 834 | syncing = FALSE; |
834 | m_abView->clear(); | 835 | m_abView->clear(); |
835 | m_abView->reload(); | 836 | m_abView->reload(); |
836 | } | 837 | } |
837 | 838 | ||
838 | void AddressbookWindow::flush() | 839 | void AddressbookWindow::flush() |
839 | { | 840 | { |
840 | syncing = TRUE; | 841 | syncing = TRUE; |
841 | m_abView->save(); | 842 | m_abView->save(); |
842 | } | 843 | } |
843 | 844 | ||
844 | 845 | ||
845 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 846 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
846 | { | 847 | { |
847 | if(active_view == AbView::CardView){ | 848 | if(active_view == AbView::CardView){ |
848 | slotViewSwitched( AbView::TableView ); | 849 | slotViewSwitched( AbView::TableView ); |
849 | e->ignore(); | 850 | e->ignore(); |
850 | return; | 851 | return; |
851 | } | 852 | } |
852 | if(syncing) { | 853 | if(syncing) { |
853 | /* shouldn't we save, I hear you say? well its already been set | 854 | /* shouldn't we save, I hear you say? well its already been set |
854 | so that an edit can not occur during a sync, and we flushed | 855 | so that an edit can not occur during a sync, and we flushed |
855 | at the start of the sync, so there is no need to save | 856 | at the start of the sync, so there is no need to save |
856 | Saving however itself would cause problems. */ | 857 | Saving however itself would cause problems. */ |
857 | e->accept(); | 858 | e->accept(); |
858 | return; | 859 | return; |
859 | } | 860 | } |
860 | //################## shouldn't always save | 861 | //################## shouldn't always save |
861 | // True, but the database handles this automatically ! (se) | 862 | // True, but the database handles this automatically ! (se) |
862 | if ( save() ) | 863 | if ( save() ) |
863 | e->accept(); | 864 | e->accept(); |
864 | else | 865 | else |
865 | e->ignore(); | 866 | e->ignore(); |
866 | } | 867 | } |
867 | 868 | ||
868 | /* | 869 | /* |
869 | Returns TRUE if it is OK to exit | 870 | Returns TRUE if it is OK to exit |
870 | */ | 871 | */ |
871 | 872 | ||
872 | bool AddressbookWindow::save() | 873 | bool AddressbookWindow::save() |
873 | { | 874 | { |
874 | if ( !m_abView->save() ) { | 875 | if ( !m_abView->save() ) { |
875 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 876 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
876 | tr("Unable to save information.\n" | 877 | tr("Unable to save information.\n" |
877 | "Free up some space\n" | 878 | "Free up some space\n" |
878 | "and try again.\n" | 879 | "and try again.\n" |
879 | "\nQuit anyway?"), | 880 | "\nQuit anyway?"), |
880 | QMessageBox::Yes|QMessageBox::Escape, | 881 | QMessageBox::Yes|QMessageBox::Escape, |
881 | QMessageBox::No|QMessageBox::Default ) | 882 | QMessageBox::No|QMessageBox::Default ) |
882 | != QMessageBox::No ) | 883 | != QMessageBox::No ) |
883 | return TRUE; | 884 | return TRUE; |
884 | else | 885 | else |
885 | return FALSE; | 886 | return FALSE; |
886 | } | 887 | } |
887 | return TRUE; | 888 | return TRUE; |
888 | } | 889 | } |
889 | 890 | ||
890 | #ifdef __DEBUG_RELEASE | 891 | #ifdef __DEBUG_RELEASE |
891 | void AddressbookWindow::slotSave() | 892 | void AddressbookWindow::slotSave() |
892 | { | 893 | { |
893 | save(); | 894 | save(); |
894 | } | 895 | } |
895 | #endif | 896 | #endif |
896 | 897 | ||
897 | 898 | ||
898 | void AddressbookWindow::slotNotFound() | 899 | void AddressbookWindow::slotNotFound() |
899 | { | 900 | { |
900 | qWarning("Got notfound signal!"); | 901 | qWarning("Got notfound signal!"); |
901 | QMessageBox::information( this, tr( "Not Found" ), | 902 | QMessageBox::information( this, tr( "Not Found" ), |
902 | tr( "Unable to find a contact for this \n search pattern!" ) ); | 903 | tr( "Unable to find a contact for this \n search pattern!" ) ); |
903 | 904 | ||
904 | 905 | ||
905 | } | 906 | } |
906 | void AddressbookWindow::slotWrapAround() | 907 | void AddressbookWindow::slotWrapAround() |
907 | { | 908 | { |
908 | qWarning("Got wrap signal!"); | 909 | qWarning("Got wrap signal!"); |
909 | // if ( doNotifyWrapAround ) | 910 | // if ( doNotifyWrapAround ) |
910 | // QMessageBox::information( this, tr( "End of list" ), | 911 | // QMessageBox::information( this, tr( "End of list" ), |
911 | // tr( "End of list. Wrap around now...!" ) + "\n" ); | 912 | // tr( "End of list. Wrap around now...!" ) + "\n" ); |
912 | 913 | ||
913 | } | 914 | } |
914 | 915 | ||
915 | void AddressbookWindow::slotSetCategory( int c ) | 916 | void AddressbookWindow::slotSetCategory( int c ) |
916 | { | 917 | { |
917 | qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); | 918 | qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); |
918 | 919 | ||
919 | QString cat, book; | 920 | QString cat, book; |
920 | AbView::Views view = AbView::TableView; | 921 | AbView::Views view = AbView::TableView; |
921 | 922 | ||
922 | if ( c <= 0 ) | 923 | if ( c <= 0 ) |
923 | return; | 924 | return; |
924 | 925 | ||
925 | // Switch view | 926 | // Switch view |
926 | if ( c < 3 ) | 927 | if ( c < 3 ) |
927 | for ( unsigned int i = 1; i < 3; i++ ){ | 928 | for ( unsigned int i = 1; i < 3; i++ ){ |
928 | if ( catMenu ) | 929 | if ( catMenu ) |
929 | catMenu->setItemChecked( i, c == (int)i ); | 930 | catMenu->setItemChecked( i, c == (int)i ); |
930 | } | 931 | } |
931 | else | 932 | else |
932 | // Checkmark Category Menu Item Selected | 933 | // Checkmark Category Menu Item Selected |
933 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) | 934 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) |
934 | catMenu->setItemChecked( i, c == (int)i ); | 935 | catMenu->setItemChecked( i, c == (int)i ); |
935 | 936 | ||
936 | // Now switch to the selected category | 937 | // Now switch to the selected category |
937 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { | 938 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { |
938 | if (catMenu->isItemChecked( i )) { | 939 | if (catMenu->isItemChecked( i )) { |
939 | if ( i == 1 ){ // default List view | 940 | if ( i == 1 ){ // default List view |
940 | book = QString::null; | 941 | book = QString::null; |
941 | view = AbView::TableView; | 942 | view = AbView::TableView; |
942 | }else if ( i == 2 ){ | 943 | }else if ( i == 2 ){ |
943 | book = tr( "Cards" ); | 944 | book = tr( "Cards" ); |
944 | view = AbView::CardView; | 945 | view = AbView::CardView; |
945 | // }else if ( i == 3 ){ | 946 | // }else if ( i == 3 ){ |
946 | // book = tr( "Personal" ); | 947 | // book = tr( "Personal" ); |
947 | // view = AbView:: PersonalView; | 948 | // view = AbView:: PersonalView; |
948 | }else if ( i == 3 ){ // default All Categories | 949 | }else if ( i == 3 ){ // default All Categories |
949 | cat = QString::null; | 950 | cat = QString::null; |
950 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled | 951 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled |
951 | cat = "Unfiled"; | 952 | cat = "Unfiled"; |
952 | qWarning ("Unfiled selected!!!"); | 953 | qWarning ("Unfiled selected!!!"); |
953 | }else{ | 954 | }else{ |
954 | cat = m_abView->categories()[i - 4]; | 955 | cat = m_abView->categories()[i - 4]; |
955 | } | 956 | } |
956 | } | 957 | } |
957 | } | 958 | } |
958 | 959 | ||
959 | // Switch to the selected View | 960 | // Switch to the selected View |
960 | slotViewSwitched( view ); | 961 | slotViewSwitched( view ); |
961 | 962 | ||
962 | // Tell the view about the selected category | 963 | // Tell the view about the selected category |
963 | m_abView -> setShowByCategory( cat ); | 964 | m_abView -> setShowByCategory( cat ); |
964 | 965 | ||
965 | if ( book.isEmpty() ) | 966 | if ( book.isEmpty() ) |
966 | book = "List"; | 967 | book = "List"; |
967 | if ( cat.isEmpty() ) | 968 | if ( cat.isEmpty() ) |
968 | cat = "All"; | 969 | cat = "All"; |
969 | 970 | ||
970 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); | 971 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); |
971 | } | 972 | } |
972 | 973 | ||
973 | void AddressbookWindow::slotViewSwitched( int view ) | 974 | void AddressbookWindow::slotViewSwitched( int view ) |
974 | { | 975 | { |
975 | qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); | 976 | qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); |
976 | int menu = 0; | 977 | int menu = 0; |
977 | 978 | ||
978 | // Switch to selected view | 979 | // Switch to selected view |
979 | switch ( view ){ | 980 | switch ( view ){ |
980 | case AbView::TableView: | 981 | case AbView::TableView: |
981 | menu = 1; | 982 | menu = 1; |
982 | m_tableViewButton->setOn(true); | 983 | m_tableViewButton->setOn(true); |
983 | m_cardViewButton->setOn(false); | 984 | m_cardViewButton->setOn(false); |
984 | break; | 985 | break; |
985 | case AbView::CardView: | 986 | case AbView::CardView: |
986 | menu = 2; | 987 | menu = 2; |
987 | m_tableViewButton->setOn(false); | 988 | m_tableViewButton->setOn(false); |
988 | m_cardViewButton->setOn(true); | 989 | m_cardViewButton->setOn(true); |
989 | break; | 990 | break; |
990 | } | 991 | } |
991 | for ( unsigned int i = 1; i < 3; i++ ){ | 992 | for ( unsigned int i = 1; i < 3; i++ ){ |
992 | if ( catMenu ) | 993 | if ( catMenu ) |
993 | catMenu->setItemChecked( i, menu == (int)i ); | 994 | catMenu->setItemChecked( i, menu == (int)i ); |
994 | } | 995 | } |
995 | 996 | ||
996 | // Tell the view about the selected view | 997 | // Tell the view about the selected view |
997 | m_abView -> setShowToView ( (AbView::Views) view ); | 998 | m_abView -> setShowToView ( (AbView::Views) view ); |
998 | active_view = view; | 999 | active_view = view; |
999 | } | 1000 | } |
1000 | 1001 | ||
1001 | 1002 | ||
1002 | void AddressbookWindow::slotListView() | 1003 | void AddressbookWindow::slotListView() |
1003 | { | 1004 | { |
1004 | slotViewSwitched( AbView::TableView ); | 1005 | slotViewSwitched( AbView::TableView ); |
1005 | } | 1006 | } |
1006 | 1007 | ||
1007 | void AddressbookWindow::slotCardView() | 1008 | void AddressbookWindow::slotCardView() |
1008 | { | 1009 | { |
1009 | slotViewSwitched( AbView::CardView ); | 1010 | slotViewSwitched( AbView::CardView ); |
1010 | } | 1011 | } |
1011 | 1012 | ||
1012 | void AddressbookWindow::slotSetLetter( char c ) { | 1013 | void AddressbookWindow::slotSetLetter( char c ) { |
1013 | 1014 | ||
1014 | m_abView->setShowByLetter( c ); | 1015 | m_abView->setShowByLetter( c, m_config.letterPickerSearch() ); |
1015 | 1016 | ||
1016 | } | 1017 | } |
1017 | 1018 | ||
1018 | 1019 | ||
1019 | void AddressbookWindow::populateCategories() | 1020 | void AddressbookWindow::populateCategories() |
1020 | { | 1021 | { |
1021 | catMenu->clear(); | 1022 | catMenu->clear(); |
1022 | 1023 | ||
1023 | int id, rememberId; | 1024 | int id, rememberId; |
1024 | id = 1; | 1025 | id = 1; |
1025 | rememberId = 0; | 1026 | rememberId = 0; |
1026 | 1027 | ||
1027 | catMenu->insertItem( Resource::loadPixmap( "datebook/weeklst" ), tr( "List" ), id++ ); | 1028 | catMenu->insertItem( Resource::loadPixmap( "datebook/weeklst" ), tr( "List" ), id++ ); |
1028 | catMenu->insertItem( Resource::loadPixmap( "day" ), tr( "Cards" ), id++ ); | 1029 | catMenu->insertItem( Resource::loadPixmap( "day" ), tr( "Cards" ), id++ ); |
1029 | // catMenu->insertItem( tr( "Personal" ), id++ ); | 1030 | // catMenu->insertItem( tr( "Personal" ), id++ ); |
1030 | catMenu->insertSeparator(); | 1031 | catMenu->insertSeparator(); |
1031 | 1032 | ||
1032 | catMenu->insertItem( tr( "All" ), id++ ); | 1033 | catMenu->insertItem( tr( "All" ), id++ ); |
1033 | QStringList categories = m_abView->categories(); | 1034 | QStringList categories = m_abView->categories(); |
1034 | categories.append( tr( "Unfiled" ) ); | 1035 | categories.append( tr( "Unfiled" ) ); |
1035 | for ( QStringList::Iterator it = categories.begin(); | 1036 | for ( QStringList::Iterator it = categories.begin(); |
1036 | it != categories.end(); ++it ) { | 1037 | it != categories.end(); ++it ) { |
1037 | catMenu->insertItem( *it, id ); | 1038 | catMenu->insertItem( *it, id ); |
1038 | if ( *it == m_abView -> showCategory() ) | 1039 | if ( *it == m_abView -> showCategory() ) |
1039 | rememberId = id; | 1040 | rememberId = id; |
1040 | ++id; | 1041 | ++id; |
1041 | } | 1042 | } |
1042 | 1043 | ||
1043 | 1044 | ||
1044 | if ( m_abView -> showCategory().isEmpty() ) { | 1045 | if ( m_abView -> showCategory().isEmpty() ) { |
1045 | slotSetCategory( 3 ); | 1046 | slotSetCategory( 3 ); |
1046 | } | 1047 | } |
1047 | else { | 1048 | else { |
1048 | slotSetCategory( rememberId ); | 1049 | slotSetCategory( rememberId ); |
1049 | } | 1050 | } |
1050 | } | 1051 | } |
1051 | 1052 | ||
diff --git a/core/pim/addressbook/configdlg_base.ui b/core/pim/addressbook/configdlg_base.ui index 1b5ac17..f892d08 100644 --- a/core/pim/addressbook/configdlg_base.ui +++ b/core/pim/addressbook/configdlg_base.ui | |||
@@ -1,679 +1,679 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>ConfigDlg_Base</class> | 2 | <class>ConfigDlg_Base</class> |
3 | <author>Stefan Eilers</author> | 3 | <author>Stefan Eilers</author> |
4 | <include location="global">qwhatsthis.h</include> | 4 | <include location="global">qwhatsthis.h</include> |
5 | <widget> | 5 | <widget> |
6 | <class>QDialog</class> | 6 | <class>QDialog</class> |
7 | <property stdset="1"> | 7 | <property stdset="1"> |
8 | <name>name</name> | 8 | <name>name</name> |
9 | <cstring>Configuration</cstring> | 9 | <cstring>Configuration</cstring> |
10 | </property> | 10 | </property> |
11 | <property stdset="1"> | 11 | <property stdset="1"> |
12 | <name>geometry</name> | 12 | <name>geometry</name> |
13 | <rect> | 13 | <rect> |
14 | <x>0</x> | 14 | <x>0</x> |
15 | <y>0</y> | 15 | <y>0</y> |
16 | <width>284</width> | 16 | <width>284</width> |
17 | <height>327</height> | 17 | <height>327</height> |
18 | </rect> | 18 | </rect> |
19 | </property> | 19 | </property> |
20 | <property stdset="1"> | 20 | <property stdset="1"> |
21 | <name>sizePolicy</name> | 21 | <name>sizePolicy</name> |
22 | <sizepolicy> | 22 | <sizepolicy> |
23 | <hsizetype>5</hsizetype> | 23 | <hsizetype>5</hsizetype> |
24 | <vsizetype>5</vsizetype> | 24 | <vsizetype>5</vsizetype> |
25 | </sizepolicy> | 25 | </sizepolicy> |
26 | </property> | 26 | </property> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>caption</name> | 28 | <name>caption</name> |
29 | <string>Configuration</string> | 29 | <string>Configuration</string> |
30 | </property> | 30 | </property> |
31 | <property stdset="1"> | 31 | <property stdset="1"> |
32 | <name>sizeGripEnabled</name> | 32 | <name>sizeGripEnabled</name> |
33 | <bool>true</bool> | 33 | <bool>true</bool> |
34 | </property> | 34 | </property> |
35 | <property> | 35 | <property> |
36 | <name>layoutMargin</name> | 36 | <name>layoutMargin</name> |
37 | </property> | 37 | </property> |
38 | <vbox> | 38 | <vbox> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>margin</name> | 40 | <name>margin</name> |
41 | <number>1</number> | 41 | <number>1</number> |
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
44 | <name>spacing</name> | 44 | <name>spacing</name> |
45 | <number>6</number> | 45 | <number>6</number> |
46 | </property> | 46 | </property> |
47 | <widget> | 47 | <widget> |
48 | <class>QTabWidget</class> | 48 | <class>QTabWidget</class> |
49 | <property stdset="1"> | 49 | <property stdset="1"> |
50 | <name>name</name> | 50 | <name>name</name> |
51 | <cstring>configDlg_base</cstring> | 51 | <cstring>configDlg_base</cstring> |
52 | </property> | 52 | </property> |
53 | <property stdset="1"> | 53 | <property stdset="1"> |
54 | <name>sizePolicy</name> | 54 | <name>sizePolicy</name> |
55 | <sizepolicy> | 55 | <sizepolicy> |
56 | <hsizetype>7</hsizetype> | 56 | <hsizetype>7</hsizetype> |
57 | <vsizetype>7</vsizetype> | 57 | <vsizetype>7</vsizetype> |
58 | </sizepolicy> | 58 | </sizepolicy> |
59 | </property> | 59 | </property> |
60 | <property> | 60 | <property> |
61 | <name>layoutMargin</name> | 61 | <name>layoutMargin</name> |
62 | </property> | 62 | </property> |
63 | <property> | 63 | <property> |
64 | <name>layoutSpacing</name> | 64 | <name>layoutSpacing</name> |
65 | </property> | 65 | </property> |
66 | <property> | 66 | <property> |
67 | <name>whatsThis</name> | 67 | <name>whatsThis</name> |
68 | <string>Click on tab to select one</string> | 68 | <string>Click on tab to select one</string> |
69 | </property> | 69 | </property> |
70 | <widget> | 70 | <widget> |
71 | <class>QWidget</class> | 71 | <class>QWidget</class> |
72 | <property stdset="1"> | 72 | <property stdset="1"> |
73 | <name>name</name> | 73 | <name>name</name> |
74 | <cstring>Widget5</cstring> | 74 | <cstring>Widget5</cstring> |
75 | </property> | 75 | </property> |
76 | <attribute> | 76 | <attribute> |
77 | <name>title</name> | 77 | <name>title</name> |
78 | <string>Misc</string> | 78 | <string>Misc</string> |
79 | </attribute> | 79 | </attribute> |
80 | <vbox> | 80 | <vbox> |
81 | <property stdset="1"> | 81 | <property stdset="1"> |
82 | <name>margin</name> | 82 | <name>margin</name> |
83 | <number>2</number> | 83 | <number>2</number> |
84 | </property> | 84 | </property> |
85 | <property stdset="1"> | 85 | <property stdset="1"> |
86 | <name>spacing</name> | 86 | <name>spacing</name> |
87 | <number>6</number> | 87 | <number>6</number> |
88 | </property> | 88 | </property> |
89 | <widget> | 89 | <widget> |
90 | <class>QGroupBox</class> | 90 | <class>QGroupBox</class> |
91 | <property stdset="1"> | 91 | <property stdset="1"> |
92 | <name>name</name> | 92 | <name>name</name> |
93 | <cstring>GroupBox2</cstring> | 93 | <cstring>GroupBox2</cstring> |
94 | </property> | 94 | </property> |
95 | <property stdset="1"> | 95 | <property stdset="1"> |
96 | <name>title</name> | 96 | <name>title</name> |
97 | <string>Search Settings</string> | 97 | <string>Search Settings</string> |
98 | </property> | 98 | </property> |
99 | <vbox> | 99 | <vbox> |
100 | <property stdset="1"> | 100 | <property stdset="1"> |
101 | <name>margin</name> | 101 | <name>margin</name> |
102 | <number>11</number> | 102 | <number>11</number> |
103 | </property> | 103 | </property> |
104 | <property stdset="1"> | 104 | <property stdset="1"> |
105 | <name>spacing</name> | 105 | <name>spacing</name> |
106 | <number>6</number> | 106 | <number>6</number> |
107 | </property> | 107 | </property> |
108 | <widget> | 108 | <widget> |
109 | <class>QButtonGroup</class> | 109 | <class>QButtonGroup</class> |
110 | <property stdset="1"> | 110 | <property stdset="1"> |
111 | <name>name</name> | 111 | <name>name</name> |
112 | <cstring>ButtonGroup1</cstring> | 112 | <cstring>ButtonGroup1</cstring> |
113 | </property> | 113 | </property> |
114 | <property stdset="1"> | 114 | <property stdset="1"> |
115 | <name>title</name> | 115 | <name>title</name> |
116 | <string>Query Style</string> | 116 | <string>Query Style</string> |
117 | </property> | 117 | </property> |
118 | <property> | 118 | <property> |
119 | <name>whatsThis</name> | 119 | <name>whatsThis</name> |
120 | <string>Settings for the search query style</string> | 120 | <string>Settings for the search query style</string> |
121 | </property> | 121 | </property> |
122 | <vbox> | 122 | <vbox> |
123 | <property stdset="1"> | 123 | <property stdset="1"> |
124 | <name>margin</name> | 124 | <name>margin</name> |
125 | <number>11</number> | 125 | <number>11</number> |
126 | </property> | 126 | </property> |
127 | <property stdset="1"> | 127 | <property stdset="1"> |
128 | <name>spacing</name> | 128 | <name>spacing</name> |
129 | <number>6</number> | 129 | <number>6</number> |
130 | </property> | 130 | </property> |
131 | <widget> | 131 | <widget> |
132 | <class>QRadioButton</class> | 132 | <class>QRadioButton</class> |
133 | <property stdset="1"> | 133 | <property stdset="1"> |
134 | <name>name</name> | 134 | <name>name</name> |
135 | <cstring>m_useRegExp</cstring> | 135 | <cstring>m_useRegExp</cstring> |
136 | </property> | 136 | </property> |
137 | <property stdset="1"> | 137 | <property stdset="1"> |
138 | <name>text</name> | 138 | <name>text</name> |
139 | <string>Use Regular Expressions</string> | 139 | <string>Use Regular Expressions</string> |
140 | </property> | 140 | </property> |
141 | <property> | 141 | <property> |
142 | <name>whatsThis</name> | 142 | <name>whatsThis</name> |
143 | <string>Search widget expects regular expressions if selected</string> | 143 | <string>Search widget expects regular expressions if selected</string> |
144 | </property> | 144 | </property> |
145 | </widget> | 145 | </widget> |
146 | <widget> | 146 | <widget> |
147 | <class>QRadioButton</class> | 147 | <class>QRadioButton</class> |
148 | <property stdset="1"> | 148 | <property stdset="1"> |
149 | <name>name</name> | 149 | <name>name</name> |
150 | <cstring>m_useWildCard</cstring> | 150 | <cstring>m_useWildCard</cstring> |
151 | </property> | 151 | </property> |
152 | <property stdset="1"> | 152 | <property stdset="1"> |
153 | <name>text</name> | 153 | <name>text</name> |
154 | <string>Use Wildcards (*,?)</string> | 154 | <string>Use Wildcards (*,?)</string> |
155 | </property> | 155 | </property> |
156 | <property stdset="1"> | 156 | <property stdset="1"> |
157 | <name>checked</name> | 157 | <name>checked</name> |
158 | <bool>true</bool> | 158 | <bool>true</bool> |
159 | </property> | 159 | </property> |
160 | <property> | 160 | <property> |
161 | <name>whatsThis</name> | 161 | <name>whatsThis</name> |
162 | <string>Search widget just expects simple wildcards</string> | 162 | <string>Search widget just expects simple wildcards</string> |
163 | </property> | 163 | </property> |
164 | </widget> | 164 | </widget> |
165 | </vbox> | 165 | </vbox> |
166 | </widget> | 166 | </widget> |
167 | <widget> | 167 | <widget> |
168 | <class>QCheckBox</class> | 168 | <class>QCheckBox</class> |
169 | <property stdset="1"> | 169 | <property stdset="1"> |
170 | <name>name</name> | 170 | <name>name</name> |
171 | <cstring>m_useCaseSensitive</cstring> | 171 | <cstring>m_useCaseSensitive</cstring> |
172 | </property> | 172 | </property> |
173 | <property stdset="1"> | 173 | <property stdset="1"> |
174 | <name>text</name> | 174 | <name>text</name> |
175 | <string>Case Sensitive</string> | 175 | <string>Case Sensitive</string> |
176 | </property> | 176 | </property> |
177 | <property> | 177 | <property> |
178 | <name>whatsThis</name> | 178 | <name>whatsThis</name> |
179 | <string>If selected, search differs between upper and lower chars</string> | 179 | <string>If selected, search differs between upper and lower chars</string> |
180 | </property> | 180 | </property> |
181 | </widget> | 181 | </widget> |
182 | </vbox> | 182 | </vbox> |
183 | </widget> | 183 | </widget> |
184 | <widget> | 184 | <widget> |
185 | <class>QButtonGroup</class> | 185 | <class>QButtonGroup</class> |
186 | <property stdset="1"> | 186 | <property stdset="1"> |
187 | <name>name</name> | 187 | <name>name</name> |
188 | <cstring>ButtonGroup3</cstring> | 188 | <cstring>ButtonGroup3</cstring> |
189 | </property> | 189 | </property> |
190 | <property stdset="1"> | 190 | <property stdset="1"> |
191 | <name>title</name> | 191 | <name>title</name> |
192 | <string>Font</string> | 192 | <string>Font</string> |
193 | </property> | 193 | </property> |
194 | <property> | 194 | <property> |
195 | <name>whatsThis</name> | 195 | <name>whatsThis</name> |
196 | <string></string> | 196 | <string></string> |
197 | </property> | 197 | </property> |
198 | <hbox> | 198 | <hbox> |
199 | <property stdset="1"> | 199 | <property stdset="1"> |
200 | <name>margin</name> | 200 | <name>margin</name> |
201 | <number>11</number> | 201 | <number>11</number> |
202 | </property> | 202 | </property> |
203 | <property stdset="1"> | 203 | <property stdset="1"> |
204 | <name>spacing</name> | 204 | <name>spacing</name> |
205 | <number>6</number> | 205 | <number>6</number> |
206 | </property> | 206 | </property> |
207 | <widget> | 207 | <widget> |
208 | <class>QRadioButton</class> | 208 | <class>QRadioButton</class> |
209 | <property stdset="1"> | 209 | <property stdset="1"> |
210 | <name>name</name> | 210 | <name>name</name> |
211 | <cstring>m_smallFont</cstring> | 211 | <cstring>m_smallFont</cstring> |
212 | </property> | 212 | </property> |
213 | <property stdset="1"> | 213 | <property stdset="1"> |
214 | <name>text</name> | 214 | <name>text</name> |
215 | <string>Small</string> | 215 | <string>Small</string> |
216 | </property> | 216 | </property> |
217 | <property> | 217 | <property> |
218 | <name>whatsThis</name> | 218 | <name>whatsThis</name> |
219 | <string>Font size for list- and card view</string> | 219 | <string>Font size for list- and card view</string> |
220 | </property> | 220 | </property> |
221 | </widget> | 221 | </widget> |
222 | <widget> | 222 | <widget> |
223 | <class>QRadioButton</class> | 223 | <class>QRadioButton</class> |
224 | <property stdset="1"> | 224 | <property stdset="1"> |
225 | <name>name</name> | 225 | <name>name</name> |
226 | <cstring>m_normalFont</cstring> | 226 | <cstring>m_normalFont</cstring> |
227 | </property> | 227 | </property> |
228 | <property stdset="1"> | 228 | <property stdset="1"> |
229 | <name>text</name> | 229 | <name>text</name> |
230 | <string>Normal</string> | 230 | <string>Normal</string> |
231 | </property> | 231 | </property> |
232 | <property stdset="1"> | 232 | <property stdset="1"> |
233 | <name>checked</name> | 233 | <name>checked</name> |
234 | <bool>true</bool> | 234 | <bool>true</bool> |
235 | </property> | 235 | </property> |
236 | <property> | 236 | <property> |
237 | <name>whatsThis</name> | 237 | <name>whatsThis</name> |
238 | <string>Font size for list- and card view</string> | 238 | <string>Font size for list- and card view</string> |
239 | </property> | 239 | </property> |
240 | </widget> | 240 | </widget> |
241 | <widget> | 241 | <widget> |
242 | <class>QRadioButton</class> | 242 | <class>QRadioButton</class> |
243 | <property stdset="1"> | 243 | <property stdset="1"> |
244 | <name>name</name> | 244 | <name>name</name> |
245 | <cstring>m_largeFont</cstring> | 245 | <cstring>m_largeFont</cstring> |
246 | </property> | 246 | </property> |
247 | <property stdset="1"> | 247 | <property stdset="1"> |
248 | <name>text</name> | 248 | <name>text</name> |
249 | <string>Large</string> | 249 | <string>Large</string> |
250 | </property> | 250 | </property> |
251 | <property> | 251 | <property> |
252 | <name>whatsThis</name> | 252 | <name>whatsThis</name> |
253 | <string>Font size for list- and card view</string> | 253 | <string>Font size for list- and card view</string> |
254 | </property> | 254 | </property> |
255 | </widget> | 255 | </widget> |
256 | </hbox> | 256 | </hbox> |
257 | </widget> | 257 | </widget> |
258 | <widget> | 258 | <widget> |
259 | <class>QButtonGroup</class> | 259 | <class>QButtonGroup</class> |
260 | <property stdset="1"> | 260 | <property stdset="1"> |
261 | <name>name</name> | 261 | <name>name</name> |
262 | <cstring>ButtonGroup4</cstring> | 262 | <cstring>ButtonGroup4</cstring> |
263 | </property> | 263 | </property> |
264 | <property stdset="1"> | 264 | <property stdset="1"> |
265 | <name>title</name> | 265 | <name>title</name> |
266 | <string>Tool-/Menubar</string> | 266 | <string>Tool-/Menubar</string> |
267 | </property> | 267 | </property> |
268 | <hbox> | 268 | <hbox> |
269 | <property stdset="1"> | 269 | <property stdset="1"> |
270 | <name>margin</name> | 270 | <name>margin</name> |
271 | <number>11</number> | 271 | <number>11</number> |
272 | </property> | 272 | </property> |
273 | <property stdset="1"> | 273 | <property stdset="1"> |
274 | <name>spacing</name> | 274 | <name>spacing</name> |
275 | <number>6</number> | 275 | <number>6</number> |
276 | </property> | 276 | </property> |
277 | <widget> | 277 | <widget> |
278 | <class>QRadioButton</class> | 278 | <class>QRadioButton</class> |
279 | <property stdset="1"> | 279 | <property stdset="1"> |
280 | <name>name</name> | 280 | <name>name</name> |
281 | <cstring>m_fixedBars</cstring> | 281 | <cstring>m_fixedBars</cstring> |
282 | </property> | 282 | </property> |
283 | <property stdset="1"> | 283 | <property stdset="1"> |
284 | <name>text</name> | 284 | <name>text</name> |
285 | <string>Fixed</string> | 285 | <string>Fixed</string> |
286 | </property> | 286 | </property> |
287 | <property stdset="1"> | 287 | <property stdset="1"> |
288 | <name>checked</name> | 288 | <name>checked</name> |
289 | <bool>true</bool> | 289 | <bool>true</bool> |
290 | </property> | 290 | </property> |
291 | <property> | 291 | <property> |
292 | <name>toolTip</name> | 292 | <name>toolTip</name> |
293 | <string></string> | 293 | <string></string> |
294 | </property> | 294 | </property> |
295 | <property> | 295 | <property> |
296 | <name>whatsThis</name> | 296 | <name>whatsThis</name> |
297 | <string>Switch to fixed menu-/toolbars after restarting application !</string> | 297 | <string>Switch to fixed menu-/toolbars after restarting application !</string> |
298 | </property> | 298 | </property> |
299 | </widget> | 299 | </widget> |
300 | <widget> | 300 | <widget> |
301 | <class>QRadioButton</class> | 301 | <class>QRadioButton</class> |
302 | <property stdset="1"> | 302 | <property stdset="1"> |
303 | <name>name</name> | 303 | <name>name</name> |
304 | <cstring>m_moveBars</cstring> | 304 | <cstring>m_moveBars</cstring> |
305 | </property> | 305 | </property> |
306 | <property stdset="1"> | 306 | <property stdset="1"> |
307 | <name>text</name> | 307 | <name>text</name> |
308 | <string>Movable</string> | 308 | <string>Moveable</string> |
309 | </property> | 309 | </property> |
310 | <property> | 310 | <property> |
311 | <name>whatsThis</name> | 311 | <name>whatsThis</name> |
312 | <string>Switch to moveable menu-/toolbars after restarting application !</string> | 312 | <string>Switch to moveable menu-/toolbars after restarting application !</string> |
313 | </property> | 313 | </property> |
314 | </widget> | 314 | </widget> |
315 | </hbox> | 315 | </hbox> |
316 | </widget> | 316 | </widget> |
317 | <spacer> | 317 | <spacer> |
318 | <property> | 318 | <property> |
319 | <name>name</name> | 319 | <name>name</name> |
320 | <cstring>Spacer3</cstring> | 320 | <cstring>Spacer3</cstring> |
321 | </property> | 321 | </property> |
322 | <property stdset="1"> | 322 | <property stdset="1"> |
323 | <name>orientation</name> | 323 | <name>orientation</name> |
324 | <enum>Vertical</enum> | 324 | <enum>Vertical</enum> |
325 | </property> | 325 | </property> |
326 | <property stdset="1"> | 326 | <property stdset="1"> |
327 | <name>sizeType</name> | 327 | <name>sizeType</name> |
328 | <enum>Expanding</enum> | 328 | <enum>Expanding</enum> |
329 | </property> | 329 | </property> |
330 | <property> | 330 | <property> |
331 | <name>sizeHint</name> | 331 | <name>sizeHint</name> |
332 | <size> | 332 | <size> |
333 | <width>20</width> | 333 | <width>20</width> |
334 | <height>20</height> | 334 | <height>20</height> |
335 | </size> | 335 | </size> |
336 | </property> | 336 | </property> |
337 | </spacer> | 337 | </spacer> |
338 | </vbox> | 338 | </vbox> |
339 | </widget> | 339 | </widget> |
340 | <widget> | 340 | <widget> |
341 | <class>QWidget</class> | 341 | <class>QWidget</class> |
342 | <property stdset="1"> | 342 | <property stdset="1"> |
343 | <name>name</name> | 343 | <name>name</name> |
344 | <cstring>tab</cstring> | 344 | <cstring>tab</cstring> |
345 | </property> | 345 | </property> |
346 | <attribute> | 346 | <attribute> |
347 | <name>title</name> | 347 | <name>title</name> |
348 | <string>Mail</string> | 348 | <string>Mail</string> |
349 | </attribute> | 349 | </attribute> |
350 | <vbox> | 350 | <vbox> |
351 | <property stdset="1"> | 351 | <property stdset="1"> |
352 | <name>margin</name> | 352 | <name>margin</name> |
353 | <number>5</number> | 353 | <number>5</number> |
354 | </property> | 354 | </property> |
355 | <property stdset="1"> | 355 | <property stdset="1"> |
356 | <name>spacing</name> | 356 | <name>spacing</name> |
357 | <number>6</number> | 357 | <number>6</number> |
358 | </property> | 358 | </property> |
359 | <widget> | 359 | <widget> |
360 | <class>QButtonGroup</class> | 360 | <class>QButtonGroup</class> |
361 | <property stdset="1"> | 361 | <property stdset="1"> |
362 | <name>name</name> | 362 | <name>name</name> |
363 | <cstring>ButtonGroup2</cstring> | 363 | <cstring>ButtonGroup2</cstring> |
364 | </property> | 364 | </property> |
365 | <property stdset="1"> | 365 | <property stdset="1"> |
366 | <name>title</name> | 366 | <name>title</name> |
367 | <string>Mail</string> | 367 | <string>Mail</string> |
368 | </property> | 368 | </property> |
369 | <property> | 369 | <property> |
370 | <name>whatsThis</name> | 370 | <name>whatsThis</name> |
371 | <string>Fontsettings for list and card view</string> | 371 | <string>Fontsettings for list and card view</string> |
372 | </property> | 372 | </property> |
373 | <vbox> | 373 | <vbox> |
374 | <property stdset="1"> | 374 | <property stdset="1"> |
375 | <name>margin</name> | 375 | <name>margin</name> |
376 | <number>11</number> | 376 | <number>11</number> |
377 | </property> | 377 | </property> |
378 | <property stdset="1"> | 378 | <property stdset="1"> |
379 | <name>spacing</name> | 379 | <name>spacing</name> |
380 | <number>6</number> | 380 | <number>6</number> |
381 | </property> | 381 | </property> |
382 | <widget> | 382 | <widget> |
383 | <class>QRadioButton</class> | 383 | <class>QRadioButton</class> |
384 | <property stdset="1"> | 384 | <property stdset="1"> |
385 | <name>name</name> | 385 | <name>name</name> |
386 | <cstring>m_useQtMail</cstring> | 386 | <cstring>m_useQtMail</cstring> |
387 | </property> | 387 | </property> |
388 | <property stdset="1"> | 388 | <property stdset="1"> |
389 | <name>text</name> | 389 | <name>text</name> |
390 | <string>Prefer QT-Mail </string> | 390 | <string>Prefer QT-Mail </string> |
391 | </property> | 391 | </property> |
392 | <property stdset="1"> | 392 | <property stdset="1"> |
393 | <name>checked</name> | 393 | <name>checked</name> |
394 | <bool>true</bool> | 394 | <bool>true</bool> |
395 | </property> | 395 | </property> |
396 | <property> | 396 | <property> |
397 | <name>whatsThis</name> | 397 | <name>whatsThis</name> |
398 | <string>Use Sharp's mail application if available</string> | 398 | <string>Use Sharp's mail application if available</string> |
399 | </property> | 399 | </property> |
400 | </widget> | 400 | </widget> |
401 | <widget> | 401 | <widget> |
402 | <class>QRadioButton</class> | 402 | <class>QRadioButton</class> |
403 | <property stdset="1"> | 403 | <property stdset="1"> |
404 | <name>name</name> | 404 | <name>name</name> |
405 | <cstring>m_useOpieMail</cstring> | 405 | <cstring>m_useOpieMail</cstring> |
406 | </property> | 406 | </property> |
407 | <property stdset="1"> | 407 | <property stdset="1"> |
408 | <name>text</name> | 408 | <name>text</name> |
409 | <string>Prefer Opie-Mail</string> | 409 | <string>Prefer Opie-Mail</string> |
410 | </property> | 410 | </property> |
411 | <property> | 411 | <property> |
412 | <name>whatsThis</name> | 412 | <name>whatsThis</name> |
413 | <string>Use OPIE mail if installed</string> | 413 | <string>Use OPIE mail if installed</string> |
414 | </property> | 414 | </property> |
415 | </widget> | 415 | </widget> |
416 | <widget> | 416 | <widget> |
417 | <class>QLabel</class> | 417 | <class>QLabel</class> |
418 | <property stdset="1"> | 418 | <property stdset="1"> |
419 | <name>name</name> | 419 | <name>name</name> |
420 | <cstring>TextLabel1</cstring> | 420 | <cstring>TextLabel1</cstring> |
421 | </property> | 421 | </property> |
422 | <property stdset="1"> | 422 | <property stdset="1"> |
423 | <name>text</name> | 423 | <name>text</name> |
424 | <string>Notice: QT-Mail is just | 424 | <string>Notice: QT-Mail is just |
425 | provided in the SHARP | 425 | provided in the SHARP |
426 | default ROM. Opie-Mail | 426 | default ROM. Opie-Mail |
427 | is provided free !</string> | 427 | is provided free !</string> |
428 | </property> | 428 | </property> |
429 | </widget> | 429 | </widget> |
430 | </vbox> | 430 | </vbox> |
431 | </widget> | 431 | </widget> |
432 | <spacer> | 432 | <spacer> |
433 | <property> | 433 | <property> |
434 | <name>name</name> | 434 | <name>name</name> |
435 | <cstring>Spacer2</cstring> | 435 | <cstring>Spacer2</cstring> |
436 | </property> | 436 | </property> |
437 | <property stdset="1"> | 437 | <property stdset="1"> |
438 | <name>orientation</name> | 438 | <name>orientation</name> |
439 | <enum>Vertical</enum> | 439 | <enum>Vertical</enum> |
440 | </property> | 440 | </property> |
441 | <property stdset="1"> | 441 | <property stdset="1"> |
442 | <name>sizeType</name> | 442 | <name>sizeType</name> |
443 | <enum>Expanding</enum> | 443 | <enum>Expanding</enum> |
444 | </property> | 444 | </property> |
445 | <property> | 445 | <property> |
446 | <name>sizeHint</name> | 446 | <name>sizeHint</name> |
447 | <size> | 447 | <size> |
448 | <width>20</width> | 448 | <width>20</width> |
449 | <height>20</height> | 449 | <height>20</height> |
450 | </size> | 450 | </size> |
451 | </property> | 451 | </property> |
452 | </spacer> | 452 | </spacer> |
453 | </vbox> | 453 | </vbox> |
454 | </widget> | 454 | </widget> |
455 | <widget> | 455 | <widget> |
456 | <class>QWidget</class> | 456 | <class>QWidget</class> |
457 | <property stdset="1"> | 457 | <property stdset="1"> |
458 | <name>name</name> | 458 | <name>name</name> |
459 | <cstring>tab</cstring> | 459 | <cstring>tab</cstring> |
460 | </property> | 460 | </property> |
461 | <attribute> | 461 | <attribute> |
462 | <name>title</name> | 462 | <name>title</name> |
463 | <string>Order</string> | 463 | <string>Order</string> |
464 | </attribute> | 464 | </attribute> |
465 | <vbox> | 465 | <vbox> |
466 | <property stdset="1"> | 466 | <property stdset="1"> |
467 | <name>margin</name> | 467 | <name>margin</name> |
468 | <number>2</number> | 468 | <number>2</number> |
469 | </property> | 469 | </property> |
470 | <property stdset="1"> | 470 | <property stdset="1"> |
471 | <name>spacing</name> | 471 | <name>spacing</name> |
472 | <number>2</number> | 472 | <number>2</number> |
473 | </property> | 473 | </property> |
474 | <widget> | 474 | <widget> |
475 | <class>QGroupBox</class> | 475 | <class>QGroupBox</class> |
476 | <property stdset="1"> | 476 | <property stdset="1"> |
477 | <name>name</name> | 477 | <name>name</name> |
478 | <cstring>GroupBox9</cstring> | 478 | <cstring>GroupBox9</cstring> |
479 | </property> | 479 | </property> |
480 | <property stdset="1"> | 480 | <property stdset="1"> |
481 | <name>title</name> | 481 | <name>title</name> |
482 | <string>Select Contact Order:</string> | 482 | <string>Select Contact Order:</string> |
483 | </property> | 483 | </property> |
484 | <grid> | 484 | <grid> |
485 | <property stdset="1"> | 485 | <property stdset="1"> |
486 | <name>margin</name> | 486 | <name>margin</name> |
487 | <number>11</number> | 487 | <number>11</number> |
488 | </property> | 488 | </property> |
489 | <property stdset="1"> | 489 | <property stdset="1"> |
490 | <name>spacing</name> | 490 | <name>spacing</name> |
491 | <number>6</number> | 491 | <number>6</number> |
492 | </property> | 492 | </property> |
493 | <widget row="0" column="2" > | 493 | <widget row="0" column="2" > |
494 | <class>QPushButton</class> | 494 | <class>QPushButton</class> |
495 | <property stdset="1"> | 495 | <property stdset="1"> |
496 | <name>name</name> | 496 | <name>name</name> |
497 | <cstring>m_upButton</cstring> | 497 | <cstring>m_upButton</cstring> |
498 | </property> | 498 | </property> |
499 | <property stdset="1"> | 499 | <property stdset="1"> |
500 | <name>sizePolicy</name> | 500 | <name>sizePolicy</name> |
501 | <sizepolicy> | 501 | <sizepolicy> |
502 | <hsizetype>1</hsizetype> | 502 | <hsizetype>1</hsizetype> |
503 | <vsizetype>0</vsizetype> | 503 | <vsizetype>0</vsizetype> |
504 | </sizepolicy> | 504 | </sizepolicy> |
505 | </property> | 505 | </property> |
506 | <property stdset="1"> | 506 | <property stdset="1"> |
507 | <name>text</name> | 507 | <name>text</name> |
508 | <string>Up</string> | 508 | <string>Up</string> |
509 | </property> | 509 | </property> |
510 | <property stdset="1"> | 510 | <property stdset="1"> |
511 | <name>autoRepeat</name> | 511 | <name>autoRepeat</name> |
512 | <bool>true</bool> | 512 | <bool>true</bool> |
513 | </property> | 513 | </property> |
514 | <property> | 514 | <property> |
515 | <name>whatsThis</name> | 515 | <name>whatsThis</name> |
516 | <string>Move selected attribute one line up</string> | 516 | <string>Move selected attribute one line up</string> |
517 | </property> | 517 | </property> |
518 | </widget> | 518 | </widget> |
519 | <widget row="1" column="2" > | 519 | <widget row="1" column="2" > |
520 | <class>QPushButton</class> | 520 | <class>QPushButton</class> |
521 | <property stdset="1"> | 521 | <property stdset="1"> |
522 | <name>name</name> | 522 | <name>name</name> |
523 | <cstring>m_downButton</cstring> | 523 | <cstring>m_downButton</cstring> |
524 | </property> | 524 | </property> |
525 | <property stdset="1"> | 525 | <property stdset="1"> |
526 | <name>sizePolicy</name> | 526 | <name>sizePolicy</name> |
527 | <sizepolicy> | 527 | <sizepolicy> |
528 | <hsizetype>1</hsizetype> | 528 | <hsizetype>1</hsizetype> |
529 | <vsizetype>0</vsizetype> | 529 | <vsizetype>0</vsizetype> |
530 | </sizepolicy> | 530 | </sizepolicy> |
531 | </property> | 531 | </property> |
532 | <property stdset="1"> | 532 | <property stdset="1"> |
533 | <name>text</name> | 533 | <name>text</name> |
534 | <string>Down</string> | 534 | <string>Down</string> |
535 | </property> | 535 | </property> |
536 | <property stdset="1"> | 536 | <property stdset="1"> |
537 | <name>autoRepeat</name> | 537 | <name>autoRepeat</name> |
538 | <bool>true</bool> | 538 | <bool>true</bool> |
539 | </property> | 539 | </property> |
540 | <property> | 540 | <property> |
541 | <name>whatsThis</name> | 541 | <name>whatsThis</name> |
542 | <string>Move selected attribute one line down</string> | 542 | <string>Move selected attribute one line down</string> |
543 | </property> | 543 | </property> |
544 | </widget> | 544 | </widget> |
545 | <widget row="4" column="0" rowspan="1" colspan="2" > | 545 | <widget row="4" column="0" rowspan="1" colspan="2" > |
546 | <class>QListBox</class> | 546 | <class>QListBox</class> |
547 | <property stdset="1"> | 547 | <property stdset="1"> |
548 | <name>name</name> | 548 | <name>name</name> |
549 | <cstring>allFieldListBox</cstring> | 549 | <cstring>allFieldListBox</cstring> |
550 | </property> | 550 | </property> |
551 | <property stdset="1"> | 551 | <property stdset="1"> |
552 | <name>sizePolicy</name> | 552 | <name>sizePolicy</name> |
553 | <sizepolicy> | 553 | <sizepolicy> |
554 | <hsizetype>7</hsizetype> | 554 | <hsizetype>7</hsizetype> |
555 | <vsizetype>7</vsizetype> | 555 | <vsizetype>7</vsizetype> |
556 | </sizepolicy> | 556 | </sizepolicy> |
557 | </property> | 557 | </property> |
558 | <property> | 558 | <property> |
559 | <name>whatsThis</name> | 559 | <name>whatsThis</name> |
560 | <string>List of all available attributes</string> | 560 | <string>List of all available attributes</string> |
561 | </property> | 561 | </property> |
562 | </widget> | 562 | </widget> |
563 | <widget row="3" column="0" > | 563 | <widget row="3" column="0" > |
564 | <class>QPushButton</class> | 564 | <class>QPushButton</class> |
565 | <property stdset="1"> | 565 | <property stdset="1"> |
566 | <name>name</name> | 566 | <name>name</name> |
567 | <cstring>m_addButton</cstring> | 567 | <cstring>m_addButton</cstring> |
568 | </property> | 568 | </property> |
569 | <property stdset="1"> | 569 | <property stdset="1"> |
570 | <name>sizePolicy</name> | 570 | <name>sizePolicy</name> |
571 | <sizepolicy> | 571 | <sizepolicy> |
572 | <hsizetype>1</hsizetype> | 572 | <hsizetype>1</hsizetype> |
573 | <vsizetype>0</vsizetype> | 573 | <vsizetype>0</vsizetype> |
574 | </sizepolicy> | 574 | </sizepolicy> |
575 | </property> | 575 | </property> |
576 | <property stdset="1"> | 576 | <property stdset="1"> |
577 | <name>text</name> | 577 | <name>text</name> |
578 | <string>Add</string> | 578 | <string>Add</string> |
579 | </property> | 579 | </property> |
580 | <property> | 580 | <property> |
581 | <name>whatsThis</name> | 581 | <name>whatsThis</name> |
582 | <string>Add selected attribute from list below to the upper list</string> | 582 | <string>Add selected attribute from list below to the upper list</string> |
583 | </property> | 583 | </property> |
584 | </widget> | 584 | </widget> |
585 | <widget row="3" column="1" > | 585 | <widget row="3" column="1" > |
586 | <class>QPushButton</class> | 586 | <class>QPushButton</class> |
587 | <property stdset="1"> | 587 | <property stdset="1"> |
588 | <name>name</name> | 588 | <name>name</name> |
589 | <cstring>m_removeButton</cstring> | 589 | <cstring>m_removeButton</cstring> |
590 | </property> | 590 | </property> |
591 | <property stdset="1"> | 591 | <property stdset="1"> |
592 | <name>sizePolicy</name> | 592 | <name>sizePolicy</name> |
593 | <sizepolicy> | 593 | <sizepolicy> |
594 | <hsizetype>1</hsizetype> | 594 | <hsizetype>1</hsizetype> |
595 | <vsizetype>0</vsizetype> | 595 | <vsizetype>0</vsizetype> |
596 | </sizepolicy> | 596 | </sizepolicy> |
597 | </property> | 597 | </property> |
598 | <property stdset="1"> | 598 | <property stdset="1"> |
599 | <name>text</name> | 599 | <name>text</name> |
600 | <string>Remove</string> | 600 | <string>Remove</string> |
601 | </property> | 601 | </property> |
602 | <property> | 602 | <property> |
603 | <name>whatsThis</name> | 603 | <name>whatsThis</name> |
604 | <string>Remove the selected attribute from the upper list</string> | 604 | <string>Remove the selected attribute from the upper list</string> |
605 | </property> | 605 | </property> |
606 | </widget> | 606 | </widget> |
607 | <spacer row="2" column="2" > | 607 | <spacer row="2" column="2" > |
608 | <property> | 608 | <property> |
609 | <name>name</name> | 609 | <name>name</name> |
610 | <cstring>Spacer23</cstring> | 610 | <cstring>Spacer23</cstring> |
611 | </property> | 611 | </property> |
612 | <property stdset="1"> | 612 | <property stdset="1"> |
613 | <name>orientation</name> | 613 | <name>orientation</name> |
614 | <enum>Vertical</enum> | 614 | <enum>Vertical</enum> |
615 | </property> | 615 | </property> |
616 | <property stdset="1"> | 616 | <property stdset="1"> |
617 | <name>sizeType</name> | 617 | <name>sizeType</name> |
618 | <enum>Expanding</enum> | 618 | <enum>Expanding</enum> |
619 | </property> | 619 | </property> |
620 | <property> | 620 | <property> |
621 | <name>sizeHint</name> | 621 | <name>sizeHint</name> |
622 | <size> | 622 | <size> |
623 | <width>20</width> | 623 | <width>20</width> |
624 | <height>20</height> | 624 | <height>20</height> |
625 | </size> | 625 | </size> |
626 | </property> | 626 | </property> |
627 | </spacer> | 627 | </spacer> |
628 | <spacer row="3" column="2" rowspan="2" colspan="1" > | 628 | <spacer row="3" column="2" rowspan="2" colspan="1" > |
629 | <property> | 629 | <property> |
630 | <name>name</name> | 630 | <name>name</name> |
631 | <cstring>Spacer2_2</cstring> | 631 | <cstring>Spacer2_2</cstring> |
632 | </property> | 632 | </property> |
633 | <property stdset="1"> | 633 | <property stdset="1"> |
634 | <name>orientation</name> | 634 | <name>orientation</name> |
635 | <enum>Vertical</enum> | 635 | <enum>Vertical</enum> |
636 | </property> | 636 | </property> |
637 | <property stdset="1"> | 637 | <property stdset="1"> |
638 | <name>sizeType</name> | 638 | <name>sizeType</name> |
639 | <enum>Expanding</enum> | 639 | <enum>Expanding</enum> |
640 | </property> | 640 | </property> |
641 | <property> | 641 | <property> |
642 | <name>sizeHint</name> | 642 | <name>sizeHint</name> |
643 | <size> | 643 | <size> |
644 | <width>20</width> | 644 | <width>20</width> |
645 | <height>20</height> | 645 | <height>20</height> |
646 | </size> | 646 | </size> |
647 | </property> | 647 | </property> |
648 | </spacer> | 648 | </spacer> |
649 | <widget row="0" column="0" rowspan="3" colspan="2" > | 649 | <widget row="0" column="0" rowspan="3" colspan="2" > |
650 | <class>QListBox</class> | 650 | <class>QListBox</class> |
651 | <property stdset="1"> | 651 | <property stdset="1"> |
652 | <name>name</name> | 652 | <name>name</name> |
653 | <cstring>fieldListBox</cstring> | 653 | <cstring>fieldListBox</cstring> |
654 | </property> | 654 | </property> |
655 | <property stdset="1"> | 655 | <property stdset="1"> |
656 | <name>sizePolicy</name> | 656 | <name>sizePolicy</name> |
657 | <sizepolicy> | 657 | <sizepolicy> |
658 | <hsizetype>7</hsizetype> | 658 | <hsizetype>7</hsizetype> |
659 | <vsizetype>7</vsizetype> | 659 | <vsizetype>7</vsizetype> |
660 | </sizepolicy> | 660 | </sizepolicy> |
661 | </property> | 661 | </property> |
662 | <property> | 662 | <property> |
663 | <name>whatsThis</name> | 663 | <name>whatsThis</name> |
664 | <string>Order (up -> down) defines the primary contact shown in the second column of the list view</string> | 664 | <string>Order (up -> down) defines the primary contact shown in the second column of the list view</string> |
665 | </property> | 665 | </property> |
666 | </widget> | 666 | </widget> |
667 | </grid> | 667 | </grid> |
668 | </widget> | 668 | </widget> |
669 | </vbox> | 669 | </vbox> |
670 | </widget> | 670 | </widget> |
671 | </widget> | 671 | </widget> |
672 | </vbox> | 672 | </vbox> |
673 | </widget> | 673 | </widget> |
674 | <tabstops> | 674 | <tabstops> |
675 | <tabstop>configDlg_base</tabstop> | 675 | <tabstop>configDlg_base</tabstop> |
676 | <tabstop>m_useQtMail</tabstop> | 676 | <tabstop>m_useQtMail</tabstop> |
677 | <tabstop>m_useOpieMail</tabstop> | 677 | <tabstop>m_useOpieMail</tabstop> |
678 | </tabstops> | 678 | </tabstops> |
679 | </UI> | 679 | </UI> |
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index f33ee0a..ce14f98 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -1,1748 +1,1760 @@ | |||
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 | #include <qwhatsthis.h> | 50 | #include <qwhatsthis.h> |
51 | 51 | ||
52 | #include <assert.h> | 52 | #include <assert.h> |
53 | 53 | ||
54 | static inline bool containsAlphaNum( const QString &str ); | 54 | static inline bool containsAlphaNum( const QString &str ); |
55 | static inline bool constainsWhiteSpace( const QString &str ); | 55 | static inline bool constainsWhiteSpace( const QString &str ); |
56 | 56 | ||
57 | // helper functions, convert our comma delimited list to proper | 57 | // helper functions, convert our comma delimited list to proper |
58 | // file format... | 58 | // file format... |
59 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 59 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
60 | QString &strAll ); | 60 | QString &strAll ); |
61 | 61 | ||
62 | // helper convert from file format to comma delimited... | 62 | // helper convert from file format to comma delimited... |
63 | void parseEmailTo( const QString &strDefaultEmail, | 63 | void parseEmailTo( const QString &strDefaultEmail, |
64 | const QString &strOtherEmail, QString &strBack ); | 64 | const QString &strOtherEmail, QString &strBack ); |
65 | 65 | ||
66 | ContactEditor::ContactEditor(const OContact &entry, | 66 | ContactEditor::ContactEditor(const OContact &entry, |
67 | QWidget *parent, | 67 | QWidget *parent, |
68 | const char *name, | 68 | const char *name, |
69 | WFlags ) | 69 | WFlags ) |
70 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), | 70 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), |
71 | defaultEmailChooserPosition( -1 ), | 71 | defaultEmailChooserPosition( -1 ), |
72 | m_personalView ( false ), | 72 | m_personalView ( false ), |
73 | cmbDefaultEmail( 0 ), | 73 | cmbDefaultEmail( 0 ), |
74 | initializing ( false ) | 74 | initializing ( false ) |
75 | { | 75 | { |
76 | 76 | ||
77 | initializing = true; | 77 | initializing = true; |
78 | 78 | ||
79 | init(); | 79 | init(); |
80 | setEntry( entry ); | 80 | setEntry( entry ); |
81 | // cmbDefaultEmail = 0; | 81 | // cmbDefaultEmail = 0; |
82 | // defaultEmailChooserPosition = -1; | 82 | // defaultEmailChooserPosition = -1; |
83 | 83 | ||
84 | initializing = false; | 84 | initializing = false; |
85 | } | 85 | } |
86 | 86 | ||
87 | ContactEditor::~ContactEditor() { | 87 | ContactEditor::~ContactEditor() { |
88 | } | 88 | } |
89 | 89 | ||
90 | void ContactEditor::init() { | 90 | void ContactEditor::init() { |
91 | qWarning("init() START"); | 91 | qWarning("init() START"); |
92 | 92 | ||
93 | uint i = 0; | 93 | uint i = 0; |
94 | 94 | ||
95 | QStringList trlChooserNames; | 95 | QStringList trlChooserNames; |
96 | 96 | ||
97 | for (i = 0; i <= 6; i++) { | 97 | for (i = 0; i <= 6; i++) { |
98 | slHomeAddress.append( "" ); | 98 | slHomeAddress.append( "" ); |
99 | slBusinessAddress.append( "" ); | 99 | slBusinessAddress.append( "" ); |
100 | } | 100 | } |
101 | 101 | ||
102 | trlChooserNames = OContactFields::trphonefields( false ); | 102 | trlChooserNames = OContactFields::trphonefields( false ); |
103 | slChooserNames = OContactFields::untrphonefields( false ); | 103 | slChooserNames = OContactFields::untrphonefields( false ); |
104 | slDynamicEntries = OContactFields::untrdetailsfields( false ); | 104 | slDynamicEntries = OContactFields::untrdetailsfields( false ); |
105 | trlDynamicEntries = OContactFields::trdetailsfields( false ); | 105 | trlDynamicEntries = OContactFields::trdetailsfields( false ); |
106 | 106 | ||
107 | // Ok, we have to remove elements from the list of dynamic entries | 107 | // Ok, we have to remove elements from the list of dynamic entries |
108 | // which are now stored in special (not dynamic) widgets.. | 108 | // which are now stored in special (not dynamic) widgets.. |
109 | // Otherwise we will get problems with field assignments! (se) | 109 | // Otherwise we will get problems with field assignments! (se) |
110 | slDynamicEntries.remove("Anniversary"); | 110 | slDynamicEntries.remove("Anniversary"); |
111 | slDynamicEntries.remove("Birthday"); | 111 | slDynamicEntries.remove("Birthday"); |
112 | slDynamicEntries.remove("Gender"); | 112 | slDynamicEntries.remove("Gender"); |
113 | 113 | ||
114 | // The same with translated fields.. But I will | 114 | // The same with translated fields.. But I will |
115 | // use the translation map to avoid mismatches.. | 115 | // use the translation map to avoid mismatches.. |
116 | QMap<int, QString> translMap = OContactFields::idToTrFields(); | 116 | QMap<int, QString> translMap = OContactFields::idToTrFields(); |
117 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); | 117 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); |
118 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); | 118 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); |
119 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); | 119 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); |
120 | 120 | ||
121 | // Last Check to be sure.. | 121 | // Last Check to be sure.. |
122 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); | 122 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); |
123 | assert( slChooserNames.count() == trlChooserNames.count() ); | 123 | assert( slChooserNames.count() == trlChooserNames.count() ); |
124 | 124 | ||
125 | for (i = 0; i < slChooserNames.count(); i++) | 125 | for (i = 0; i < slChooserNames.count(); i++) |
126 | slChooserValues.append(""); | 126 | slChooserValues.append(""); |
127 | 127 | ||
128 | 128 | ||
129 | QVBoxLayout *vb = new QVBoxLayout( this ); | 129 | QVBoxLayout *vb = new QVBoxLayout( this ); |
130 | 130 | ||
131 | tabMain = new QTabWidget( this ); | 131 | tabMain = new QTabWidget( this ); |
132 | vb->addWidget( tabMain ); | 132 | vb->addWidget( tabMain ); |
133 | 133 | ||
134 | QWidget *tabViewport = new QWidget ( tabMain ); | 134 | QWidget *tabViewport = new QWidget ( tabMain ); |
135 | 135 | ||
136 | vb = new QVBoxLayout( tabViewport ); | 136 | vb = new QVBoxLayout( tabViewport ); |
137 | 137 | ||
138 | svGeneral = new QScrollView( tabViewport ); | 138 | svGeneral = new QScrollView( tabViewport ); |
139 | vb->addWidget( svGeneral, 0, 0 ); | 139 | vb->addWidget( svGeneral, 0, 0 ); |
140 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 140 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
141 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); | 141 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); |
142 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); | 142 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); |
143 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 143 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
144 | 144 | ||
145 | QWidget *container = new QWidget( svGeneral->viewport() ); | 145 | QWidget *container = new QWidget( svGeneral->viewport() ); |
146 | svGeneral->addChild( container ); | 146 | svGeneral->addChild( container ); |
147 | 147 | ||
148 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 148 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); |
149 | gl->setResizeMode( QLayout::FreeResize ); | 149 | gl->setResizeMode( QLayout::FreeResize ); |
150 | 150 | ||
151 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 151 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
152 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); | 152 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); |
153 | gl->addWidget( btnFullName, 0, 0 ); | 153 | gl->addWidget( btnFullName, 0, 0 ); |
154 | txtFullName = new QLineEdit( container ); | 154 | txtFullName = new QLineEdit( container ); |
155 | QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); | 155 | QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); |
156 | gl->addWidget( txtFullName, 0, 1 ); | 156 | gl->addWidget( txtFullName, 0, 1 ); |
157 | 157 | ||
158 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 158 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
159 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); | 159 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); |
160 | gl->addWidget( l, 1, 0 ); | 160 | gl->addWidget( l, 1, 0 ); |
161 | txtJobTitle = new QLineEdit( container ); | 161 | txtJobTitle = new QLineEdit( container ); |
162 | QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); | 162 | QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); |
163 | gl->addWidget( txtJobTitle, 1, 1 ); | 163 | gl->addWidget( txtJobTitle, 1, 1 ); |
164 | 164 | ||
165 | l = new QLabel( tr("Suffix"), container ); | 165 | l = new QLabel( tr("Suffix"), container ); |
166 | QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); | 166 | QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); |
167 | gl->addWidget( l, 2, 0 ); | 167 | gl->addWidget( l, 2, 0 ); |
168 | txtSuffix = new QLineEdit( container ); | 168 | txtSuffix = new QLineEdit( container ); |
169 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); | 169 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); |
170 | gl->addWidget( txtSuffix, 2, 1 ); | 170 | gl->addWidget( txtSuffix, 2, 1 ); |
171 | 171 | ||
172 | l = new QLabel( tr( "Organization" ), container ); | 172 | l = new QLabel( tr( "Organization" ), container ); |
173 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); | 173 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); |
174 | gl->addWidget( l, 3, 0 ); | 174 | gl->addWidget( l, 3, 0 ); |
175 | txtOrganization = new QLineEdit( container ); | 175 | txtOrganization = new QLineEdit( container ); |
176 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); | 176 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); |
177 | gl->addWidget( txtOrganization, 3, 1 ); | 177 | gl->addWidget( txtOrganization, 3, 1 ); |
178 | 178 | ||
179 | // Chooser 1 | 179 | // Chooser 1 |
180 | cmbChooserField1 = new QComboBox( FALSE, container ); | 180 | cmbChooserField1 = new QComboBox( FALSE, container ); |
181 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); | 181 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); |
182 | cmbChooserField1->setMaximumWidth( 90 ); | 182 | cmbChooserField1->setMaximumWidth( 90 ); |
183 | gl->addWidget( cmbChooserField1, 4, 0 ); | 183 | gl->addWidget( cmbChooserField1, 4, 0 ); |
184 | // Textfield for chooser 1. | 184 | // Textfield for chooser 1. |
185 | // Now use Widgetstack to contain the textfield and the default-email combo ! | 185 | // Now use Widgetstack to contain the textfield and the default-email combo ! |
186 | m_widgetStack1 = new QWidgetStack( container ); | 186 | m_widgetStack1 = new QWidgetStack( container ); |
187 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); | 187 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); |
188 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); | 188 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); |
189 | gl->addWidget( m_widgetStack1, 4, 1 ); | 189 | gl->addWidget( m_widgetStack1, 4, 1 ); |
190 | m_widgetStack1 -> raiseWidget( TextField ); | 190 | m_widgetStack1 -> raiseWidget( TextField ); |
191 | 191 | ||
192 | // Chooser 2 | 192 | // Chooser 2 |
193 | cmbChooserField2 = new QComboBox( FALSE, container ); | 193 | cmbChooserField2 = new QComboBox( FALSE, container ); |
194 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); | 194 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); |
195 | cmbChooserField2->setMaximumWidth( 90 ); | 195 | cmbChooserField2->setMaximumWidth( 90 ); |
196 | gl->addWidget( cmbChooserField2, 5, 0 ); | 196 | gl->addWidget( cmbChooserField2, 5, 0 ); |
197 | // Textfield for chooser 2 | 197 | // Textfield for chooser 2 |
198 | // Now use WidgetStack to contain the textfield and the default-email combo! | 198 | // Now use WidgetStack to contain the textfield and the default-email combo! |
199 | m_widgetStack2 = new QWidgetStack( container ); | 199 | m_widgetStack2 = new QWidgetStack( container ); |
200 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); | 200 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); |
201 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); | 201 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); |
202 | gl->addWidget( m_widgetStack2, 5, 1 ); | 202 | gl->addWidget( m_widgetStack2, 5, 1 ); |
203 | m_widgetStack2 -> raiseWidget( TextField ); | 203 | m_widgetStack2 -> raiseWidget( TextField ); |
204 | 204 | ||
205 | // Chooser 3 | 205 | // Chooser 3 |
206 | cmbChooserField3 = new QComboBox( FALSE, container ); | 206 | cmbChooserField3 = new QComboBox( FALSE, container ); |
207 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); | 207 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); |
208 | cmbChooserField3->setMaximumWidth( 90 ); | 208 | cmbChooserField3->setMaximumWidth( 90 ); |
209 | gl->addWidget( cmbChooserField3, 6, 0 ); | 209 | gl->addWidget( cmbChooserField3, 6, 0 ); |
210 | // Textfield for chooser 2 | 210 | // Textfield for chooser 2 |
211 | // Now use WidgetStack to contain the textfield and the default-email combo! | 211 | // Now use WidgetStack to contain the textfield and the default-email combo! |
212 | m_widgetStack3 = new QWidgetStack( container ); | 212 | m_widgetStack3 = new QWidgetStack( container ); |
213 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); | 213 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); |
214 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); | 214 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); |
215 | gl->addWidget( m_widgetStack3, 6, 1 ); | 215 | gl->addWidget( m_widgetStack3, 6, 1 ); |
216 | m_widgetStack3 -> raiseWidget( TextField ); | 216 | m_widgetStack3 -> raiseWidget( TextField ); |
217 | 217 | ||
218 | l = new QLabel( tr( "File As" ), container ); | 218 | l = new QLabel( tr( "File As" ), container ); |
219 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); | 219 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); |
220 | gl->addWidget( l, 7, 0 ); | 220 | gl->addWidget( l, 7, 0 ); |
221 | cmbFileAs = new QComboBox( TRUE, container ); | 221 | cmbFileAs = new QComboBox( TRUE, container ); |
222 | gl->addWidget( cmbFileAs, 7, 1 ); | 222 | gl->addWidget( cmbFileAs, 7, 1 ); |
223 | 223 | ||
224 | labCat = new QLabel( tr( "Category" ), container ); | 224 | labCat = new QLabel( tr( "Category" ), container ); |
225 | gl->addWidget( labCat, 8, 0 ); | 225 | gl->addWidget( labCat, 8, 0 ); |
226 | cmbCat = new CategorySelect( container ); | 226 | cmbCat = new CategorySelect( container ); |
227 | gl->addWidget( cmbCat, 8, 1 ); | 227 | gl->addWidget( cmbCat, 8, 1 ); |
228 | labCat->show(); | 228 | labCat->show(); |
229 | cmbCat->show(); | 229 | cmbCat->show(); |
230 | 230 | ||
231 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 231 | btnNote = new QPushButton( tr( "Notes..." ), container ); |
232 | gl->addWidget( btnNote, 9, 1 ); | 232 | gl->addWidget( btnNote, 9, 1 ); |
233 | 233 | ||
234 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 234 | tabMain->insertTab( tabViewport, tr( "General" ) ); |
235 | 235 | ||
236 | tabViewport = new QWidget ( tabMain ); | 236 | tabViewport = new QWidget ( tabMain ); |
237 | 237 | ||
238 | vb = new QVBoxLayout( tabViewport ); | 238 | vb = new QVBoxLayout( tabViewport ); |
239 | 239 | ||
240 | svAddress = new QScrollView( tabViewport ); | 240 | svAddress = new QScrollView( tabViewport ); |
241 | vb->addWidget( svAddress, 0, 0 ); | 241 | vb->addWidget( svAddress, 0, 0 ); |
242 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 242 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
243 | svAddress->setFrameStyle( QFrame::NoFrame ); | 243 | svAddress->setFrameStyle( QFrame::NoFrame ); |
244 | 244 | ||
245 | container = new QWidget( svAddress->viewport() ); | 245 | container = new QWidget( svAddress->viewport() ); |
246 | svAddress->addChild( container ); | 246 | svAddress->addChild( container ); |
247 | 247 | ||
248 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 248 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
249 | 249 | ||
250 | cmbAddress = new QComboBox( FALSE, container ); | 250 | cmbAddress = new QComboBox( FALSE, container ); |
251 | cmbAddress->insertItem( tr( "Business" ) ); | 251 | cmbAddress->insertItem( tr( "Business" ) ); |
252 | cmbAddress->insertItem( tr( "Home" ) ); | 252 | cmbAddress->insertItem( tr( "Home" ) ); |
253 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 253 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
254 | 254 | ||
255 | l = new QLabel( tr( "Address" ), container ); | 255 | l = new QLabel( tr( "Address" ), container ); |
256 | gl->addWidget( l, 1, 0 ); | 256 | gl->addWidget( l, 1, 0 ); |
257 | txtAddress = new QLineEdit( container ); | 257 | txtAddress = new QLineEdit( container ); |
258 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 258 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
259 | 259 | ||
260 | l = new QLabel( tr( "City" ), container ); | 260 | l = new QLabel( tr( "City" ), container ); |
261 | gl->addWidget( l, 2, 0 ); | 261 | gl->addWidget( l, 2, 0 ); |
262 | txtCity = new QLineEdit( container ); | 262 | txtCity = new QLineEdit( container ); |
263 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 263 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
264 | 264 | ||
265 | l = new QLabel( tr( "State" ), container ); | 265 | l = new QLabel( tr( "State" ), container ); |
266 | gl->addWidget( l, 3, 0 ); | 266 | gl->addWidget( l, 3, 0 ); |
267 | txtState = new QLineEdit( container ); | 267 | txtState = new QLineEdit( container ); |
268 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 268 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
269 | 269 | ||
270 | l = new QLabel( tr( "Zip Code" ), container ); | 270 | l = new QLabel( tr( "Zip Code" ), container ); |
271 | gl->addWidget( l, 4, 0 ); | 271 | gl->addWidget( l, 4, 0 ); |
272 | txtZip = new QLineEdit( container ); | 272 | txtZip = new QLineEdit( container ); |
273 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 273 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
274 | 274 | ||
275 | l = new QLabel( tr( "Country" ), container ); | 275 | l = new QLabel( tr( "Country" ), container ); |
276 | gl->addWidget( l, 5, 0 ); | 276 | gl->addWidget( l, 5, 0 ); |
277 | cmbCountry = new QComboBox( TRUE, container ); | 277 | cmbCountry = new QComboBox( TRUE, container ); |
278 | cmbCountry->insertItem( tr( "" ) ); | 278 | cmbCountry->insertItem( tr( "" ) ); |
279 | cmbCountry->insertItem( tr ( "United States" ) ); | 279 | cmbCountry->insertItem( tr ( "United States" ) ); |
280 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 280 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
281 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); | 281 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); |
282 | cmbCountry->insertItem( tr ( "Albania" ) ); | 282 | cmbCountry->insertItem( tr ( "Albania" ) ); |
283 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 283 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
284 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 284 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
285 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 285 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
286 | cmbCountry->insertItem( tr ( "Angola" ) ); | 286 | cmbCountry->insertItem( tr ( "Angola" ) ); |
287 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 287 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
288 | cmbCountry->insertItem( tr ( "Antarctica" ) ); | 288 | cmbCountry->insertItem( tr ( "Antarctica" ) ); |
289 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 289 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
290 | cmbCountry->insertItem( tr ( "Armenia" ) ); | 290 | cmbCountry->insertItem( tr ( "Armenia" ) ); |
291 | cmbCountry->insertItem( tr ( "Aruba" ) ); | 291 | cmbCountry->insertItem( tr ( "Aruba" ) ); |
292 | cmbCountry->insertItem( tr ( "Australia" ) ); | 292 | cmbCountry->insertItem( tr ( "Australia" ) ); |
293 | cmbCountry->insertItem( tr ( "Austria" ) ); | 293 | cmbCountry->insertItem( tr ( "Austria" ) ); |
294 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); | 294 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); |
295 | cmbCountry->insertItem( tr ( "Bahamas" ) ); | 295 | cmbCountry->insertItem( tr ( "Bahamas" ) ); |
296 | cmbCountry->insertItem( tr ( "Bahrain" ) ); | 296 | cmbCountry->insertItem( tr ( "Bahrain" ) ); |
297 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); | 297 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); |
298 | cmbCountry->insertItem( tr ( "Barbados" ) ); | 298 | cmbCountry->insertItem( tr ( "Barbados" ) ); |
299 | cmbCountry->insertItem( tr ( "Belarus" ) ); | 299 | cmbCountry->insertItem( tr ( "Belarus" ) ); |
300 | cmbCountry->insertItem( tr ( "Belgium" ) ); | 300 | cmbCountry->insertItem( tr ( "Belgium" ) ); |
301 | cmbCountry->insertItem( tr ( "Belize" ) ); | 301 | cmbCountry->insertItem( tr ( "Belize" ) ); |
302 | cmbCountry->insertItem( tr ( "Benin" ) ); | 302 | cmbCountry->insertItem( tr ( "Benin" ) ); |
303 | cmbCountry->insertItem( tr ( "Bermuda" ) ); | 303 | cmbCountry->insertItem( tr ( "Bermuda" ) ); |
304 | cmbCountry->insertItem( tr ( "Bhutan" ) ); | 304 | cmbCountry->insertItem( tr ( "Bhutan" ) ); |
305 | cmbCountry->insertItem( tr ( "Bolivia" ) ); | 305 | cmbCountry->insertItem( tr ( "Bolivia" ) ); |
306 | cmbCountry->insertItem( tr ( "Botswana" ) ); | 306 | cmbCountry->insertItem( tr ( "Botswana" ) ); |
307 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); | 307 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); |
308 | cmbCountry->insertItem( tr ( "Brazil" ) ); | 308 | cmbCountry->insertItem( tr ( "Brazil" ) ); |
309 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); | 309 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); |
310 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); | 310 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); |
311 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); | 311 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); |
312 | cmbCountry->insertItem( tr ( "Burundi" ) ); | 312 | cmbCountry->insertItem( tr ( "Burundi" ) ); |
313 | cmbCountry->insertItem( tr ( "Cambodia" ) ); | 313 | cmbCountry->insertItem( tr ( "Cambodia" ) ); |
314 | cmbCountry->insertItem( tr ( "Cameroon" ) ); | 314 | cmbCountry->insertItem( tr ( "Cameroon" ) ); |
315 | cmbCountry->insertItem( tr ( "Canada" ) ); | 315 | cmbCountry->insertItem( tr ( "Canada" ) ); |
316 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); | 316 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); |
317 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); | 317 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); |
318 | cmbCountry->insertItem( tr ( "Chad" ) ); | 318 | cmbCountry->insertItem( tr ( "Chad" ) ); |
319 | cmbCountry->insertItem( tr ( "Chile" ) ); | 319 | cmbCountry->insertItem( tr ( "Chile" ) ); |
320 | cmbCountry->insertItem( tr ( "China" ) ); | 320 | cmbCountry->insertItem( tr ( "China" ) ); |
321 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); | 321 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); |
322 | cmbCountry->insertItem( tr ( "Colombia" ) ); | 322 | cmbCountry->insertItem( tr ( "Colombia" ) ); |
323 | cmbCountry->insertItem( tr ( "Comoros" ) ); | 323 | cmbCountry->insertItem( tr ( "Comoros" ) ); |
324 | cmbCountry->insertItem( tr ( "Congo" ) ); | 324 | cmbCountry->insertItem( tr ( "Congo" ) ); |
325 | cmbCountry->insertItem( tr ( "Cook Island" ) ); | 325 | cmbCountry->insertItem( tr ( "Cook Island" ) ); |
326 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); | 326 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); |
327 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); | 327 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); |
328 | cmbCountry->insertItem( tr ( "Croatia" ) ); | 328 | cmbCountry->insertItem( tr ( "Croatia" ) ); |
329 | cmbCountry->insertItem( tr ( "Cuba" ) ); | 329 | cmbCountry->insertItem( tr ( "Cuba" ) ); |
330 | cmbCountry->insertItem( tr ( "Cyprus" ) ); | 330 | cmbCountry->insertItem( tr ( "Cyprus" ) ); |
331 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); | 331 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); |
332 | cmbCountry->insertItem( tr ( "Denmark" ) ); | 332 | cmbCountry->insertItem( tr ( "Denmark" ) ); |
333 | cmbCountry->insertItem( tr ( "Djibouti" ) ); | 333 | cmbCountry->insertItem( tr ( "Djibouti" ) ); |
334 | cmbCountry->insertItem( tr ( "Dominica" ) ); | 334 | cmbCountry->insertItem( tr ( "Dominica" ) ); |
335 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); | 335 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); |
336 | cmbCountry->insertItem( tr ( "East Timor" ) ); | 336 | cmbCountry->insertItem( tr ( "East Timor" ) ); |
337 | cmbCountry->insertItem( tr ( "Ecuador" ) ); | 337 | cmbCountry->insertItem( tr ( "Ecuador" ) ); |
338 | cmbCountry->insertItem( tr ( "Egypt" ) ); | 338 | cmbCountry->insertItem( tr ( "Egypt" ) ); |
339 | cmbCountry->insertItem( tr ( "El Salvador" ) ); | 339 | cmbCountry->insertItem( tr ( "El Salvador" ) ); |
340 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); | 340 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); |
341 | cmbCountry->insertItem( tr ( "Eritrea" ) ); | 341 | cmbCountry->insertItem( tr ( "Eritrea" ) ); |
342 | cmbCountry->insertItem( tr ( "Estonia" ) ); | 342 | cmbCountry->insertItem( tr ( "Estonia" ) ); |
343 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); | 343 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); |
344 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); | 344 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); |
345 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); | 345 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); |
346 | cmbCountry->insertItem( tr ( "Fiji" ) ); | 346 | cmbCountry->insertItem( tr ( "Fiji" ) ); |
347 | cmbCountry->insertItem( tr ( "Finland" ) ); | 347 | cmbCountry->insertItem( tr ( "Finland" ) ); |
348 | cmbCountry->insertItem( tr ( "France" ) ); | 348 | cmbCountry->insertItem( tr ( "France" ) ); |
349 | cmbCountry->insertItem( tr ( "French Guiana" ) ); | 349 | cmbCountry->insertItem( tr ( "French Guiana" ) ); |
350 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); | 350 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); |
351 | cmbCountry->insertItem( tr ( "Gabon" ) ); | 351 | cmbCountry->insertItem( tr ( "Gabon" ) ); |
352 | cmbCountry->insertItem( tr ( "Gambia" ) ); | 352 | cmbCountry->insertItem( tr ( "Gambia" ) ); |
353 | cmbCountry->insertItem( tr ( "Georgia" ) ); | 353 | cmbCountry->insertItem( tr ( "Georgia" ) ); |
354 | cmbCountry->insertItem( tr ( "Germany" ) ); | 354 | cmbCountry->insertItem( tr ( "Germany" ) ); |
355 | cmbCountry->insertItem( tr ( "Ghana" ) ); | 355 | cmbCountry->insertItem( tr ( "Ghana" ) ); |
356 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); | 356 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); |
357 | cmbCountry->insertItem( tr ( "Greece" ) ); | 357 | cmbCountry->insertItem( tr ( "Greece" ) ); |
358 | cmbCountry->insertItem( tr ( "Greenland" ) ); | 358 | cmbCountry->insertItem( tr ( "Greenland" ) ); |
359 | cmbCountry->insertItem( tr ( "Grenada" ) ); | 359 | cmbCountry->insertItem( tr ( "Grenada" ) ); |
360 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); | 360 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); |
361 | cmbCountry->insertItem( tr ( "Guam" ) ); | 361 | cmbCountry->insertItem( tr ( "Guam" ) ); |
362 | cmbCountry->insertItem( tr ( "Guatemala" ) ); | 362 | cmbCountry->insertItem( tr ( "Guatemala" ) ); |
363 | cmbCountry->insertItem( tr ( "Guinea" ) ); | 363 | cmbCountry->insertItem( tr ( "Guinea" ) ); |
364 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); | 364 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); |
365 | cmbCountry->insertItem( tr ( "Guyana" ) ); | 365 | cmbCountry->insertItem( tr ( "Guyana" ) ); |
366 | cmbCountry->insertItem( tr ( "Haiti" ) ); | 366 | cmbCountry->insertItem( tr ( "Haiti" ) ); |
367 | cmbCountry->insertItem( tr ( "Holy See" ) ); | 367 | cmbCountry->insertItem( tr ( "Holy See" ) ); |
368 | cmbCountry->insertItem( tr ( "Honduras" ) ); | 368 | cmbCountry->insertItem( tr ( "Honduras" ) ); |
369 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); | 369 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); |
370 | cmbCountry->insertItem( tr ( "Hungary" ) ); | 370 | cmbCountry->insertItem( tr ( "Hungary" ) ); |
371 | cmbCountry->insertItem( tr ( "Iceland" ) ); | 371 | cmbCountry->insertItem( tr ( "Iceland" ) ); |
372 | cmbCountry->insertItem( tr ( "India" ) ); | 372 | cmbCountry->insertItem( tr ( "India" ) ); |
373 | cmbCountry->insertItem( tr ( "Indonesia" ) ); | 373 | cmbCountry->insertItem( tr ( "Indonesia" ) ); |
374 | cmbCountry->insertItem( tr ( "Ireland" ) ); | 374 | cmbCountry->insertItem( tr ( "Ireland" ) ); |
375 | cmbCountry->insertItem( tr ( "Israel" ) ); | 375 | cmbCountry->insertItem( tr ( "Israel" ) ); |
376 | cmbCountry->insertItem( tr ( "Italy" ) ); | 376 | cmbCountry->insertItem( tr ( "Italy" ) ); |
377 | cmbCountry->insertItem( tr ( "Jamaica" ) ); | 377 | cmbCountry->insertItem( tr ( "Jamaica" ) ); |
378 | cmbCountry->insertItem( tr ( "Japan" ) ); | 378 | cmbCountry->insertItem( tr ( "Japan" ) ); |
379 | cmbCountry->insertItem( tr ( "Jordan" ) ); | 379 | cmbCountry->insertItem( tr ( "Jordan" ) ); |
380 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); | 380 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); |
381 | cmbCountry->insertItem( tr ( "Kenya" ) ); | 381 | cmbCountry->insertItem( tr ( "Kenya" ) ); |
382 | cmbCountry->insertItem( tr ( "Kiribati" ) ); | 382 | cmbCountry->insertItem( tr ( "Kiribati" ) ); |
383 | cmbCountry->insertItem( tr ( "Korea" ) ); | 383 | cmbCountry->insertItem( tr ( "Korea" ) ); |
384 | cmbCountry->insertItem( tr ( "Kuwait" ) ); | 384 | cmbCountry->insertItem( tr ( "Kuwait" ) ); |
385 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); | 385 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); |
386 | cmbCountry->insertItem( tr ( "Laos" ) ); | 386 | cmbCountry->insertItem( tr ( "Laos" ) ); |
387 | cmbCountry->insertItem( tr ( "Latvia" ) ); | 387 | cmbCountry->insertItem( tr ( "Latvia" ) ); |
388 | cmbCountry->insertItem( tr ( "Lebanon" ) ); | 388 | cmbCountry->insertItem( tr ( "Lebanon" ) ); |
389 | cmbCountry->insertItem( tr ( "Lesotho" ) ); | 389 | cmbCountry->insertItem( tr ( "Lesotho" ) ); |
390 | cmbCountry->insertItem( tr ( "Liberia" ) ); | 390 | cmbCountry->insertItem( tr ( "Liberia" ) ); |
391 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); | 391 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); |
392 | cmbCountry->insertItem( tr ( "Lithuania" ) ); | 392 | cmbCountry->insertItem( tr ( "Lithuania" ) ); |
393 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); | 393 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); |
394 | cmbCountry->insertItem( tr ( "Macau" ) ); | 394 | cmbCountry->insertItem( tr ( "Macau" ) ); |
395 | cmbCountry->insertItem( tr ( "Macedonia" ) ); | 395 | cmbCountry->insertItem( tr ( "Macedonia" ) ); |
396 | cmbCountry->insertItem( tr ( "Madagascar" ) ); | 396 | cmbCountry->insertItem( tr ( "Madagascar" ) ); |
397 | cmbCountry->insertItem( tr ( "Malawi" ) ); | 397 | cmbCountry->insertItem( tr ( "Malawi" ) ); |
398 | cmbCountry->insertItem( tr ( "Malaysia" ) ); | 398 | cmbCountry->insertItem( tr ( "Malaysia" ) ); |
399 | cmbCountry->insertItem( tr ( "Maldives" ) ); | 399 | cmbCountry->insertItem( tr ( "Maldives" ) ); |
400 | cmbCountry->insertItem( tr ( "Mali" ) ); | 400 | cmbCountry->insertItem( tr ( "Mali" ) ); |
401 | cmbCountry->insertItem( tr ( "Malta" ) ); | 401 | cmbCountry->insertItem( tr ( "Malta" ) ); |
402 | cmbCountry->insertItem( tr ( "Martinique" ) ); | 402 | cmbCountry->insertItem( tr ( "Martinique" ) ); |
403 | cmbCountry->insertItem( tr ( "Mauritania" ) ); | 403 | cmbCountry->insertItem( tr ( "Mauritania" ) ); |
404 | cmbCountry->insertItem( tr ( "Mauritius" ) ); | 404 | cmbCountry->insertItem( tr ( "Mauritius" ) ); |
405 | cmbCountry->insertItem( tr ( "Mayotte" ) ); | 405 | cmbCountry->insertItem( tr ( "Mayotte" ) ); |
406 | cmbCountry->insertItem( tr ( "Mexico" ) ); | 406 | cmbCountry->insertItem( tr ( "Mexico" ) ); |
407 | cmbCountry->insertItem( tr ( "Micronesia" ) ); | 407 | cmbCountry->insertItem( tr ( "Micronesia" ) ); |
408 | cmbCountry->insertItem( tr ( "Moldova" ) ); | 408 | cmbCountry->insertItem( tr ( "Moldova" ) ); |
409 | cmbCountry->insertItem( tr ( "Monaco" ) ); | 409 | cmbCountry->insertItem( tr ( "Monaco" ) ); |
410 | cmbCountry->insertItem( tr ( "Mongolia" ) ); | 410 | cmbCountry->insertItem( tr ( "Mongolia" ) ); |
411 | cmbCountry->insertItem( tr ( "Montserrat" ) ); | 411 | cmbCountry->insertItem( tr ( "Montserrat" ) ); |
412 | cmbCountry->insertItem( tr ( "Morocco" ) ); | 412 | cmbCountry->insertItem( tr ( "Morocco" ) ); |
413 | cmbCountry->insertItem( tr ( "Mozambique" ) ); | 413 | cmbCountry->insertItem( tr ( "Mozambique" ) ); |
414 | cmbCountry->insertItem( tr ( "Myanmar" ) ); | 414 | cmbCountry->insertItem( tr ( "Myanmar" ) ); |
415 | cmbCountry->insertItem( tr ( "Namibia" ) ); | 415 | cmbCountry->insertItem( tr ( "Namibia" ) ); |
416 | cmbCountry->insertItem( tr ( "Nauru" ) ); | 416 | cmbCountry->insertItem( tr ( "Nauru" ) ); |
417 | cmbCountry->insertItem( tr ( "Nepal" ) ); | 417 | cmbCountry->insertItem( tr ( "Nepal" ) ); |
418 | cmbCountry->insertItem( tr ( "Netherlands" ) ); | 418 | cmbCountry->insertItem( tr ( "Netherlands" ) ); |
419 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); | 419 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); |
420 | cmbCountry->insertItem( tr ( "New Zealand" ) ); | 420 | cmbCountry->insertItem( tr ( "New Zealand" ) ); |
421 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); | 421 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); |
422 | cmbCountry->insertItem( tr ( "Niger" ) ); | 422 | cmbCountry->insertItem( tr ( "Niger" ) ); |
423 | cmbCountry->insertItem( tr ( "Nigeria" ) ); | 423 | cmbCountry->insertItem( tr ( "Nigeria" ) ); |
424 | cmbCountry->insertItem( tr ( "Niue" ) ); | 424 | cmbCountry->insertItem( tr ( "Niue" ) ); |
425 | cmbCountry->insertItem( tr ( "Norway" ) ); | 425 | cmbCountry->insertItem( tr ( "Norway" ) ); |
426 | cmbCountry->insertItem( tr ( "Oman" ) ); | 426 | cmbCountry->insertItem( tr ( "Oman" ) ); |
427 | cmbCountry->insertItem( tr ( "Pakistan" ) ); | 427 | cmbCountry->insertItem( tr ( "Pakistan" ) ); |
428 | cmbCountry->insertItem( tr ( "Palau" ) ); | 428 | cmbCountry->insertItem( tr ( "Palau" ) ); |
429 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); | 429 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); |
430 | cmbCountry->insertItem( tr ( "Panama" ) ); | 430 | cmbCountry->insertItem( tr ( "Panama" ) ); |
431 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); | 431 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); |
432 | cmbCountry->insertItem( tr ( "Paraguay" ) ); | 432 | cmbCountry->insertItem( tr ( "Paraguay" ) ); |
433 | cmbCountry->insertItem( tr ( "Peru" ) ); | 433 | cmbCountry->insertItem( tr ( "Peru" ) ); |
434 | cmbCountry->insertItem( tr ( "Philippines" ) ); | 434 | cmbCountry->insertItem( tr ( "Philippines" ) ); |
435 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); | 435 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); |
436 | cmbCountry->insertItem( tr ( "Poland" ) ); | 436 | cmbCountry->insertItem( tr ( "Poland" ) ); |
437 | cmbCountry->insertItem( tr ( "Portugal" ) ); | 437 | cmbCountry->insertItem( tr ( "Portugal" ) ); |
438 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); | 438 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); |
439 | cmbCountry->insertItem( tr ( "Qatar" ) ); | 439 | cmbCountry->insertItem( tr ( "Qatar" ) ); |
440 | cmbCountry->insertItem( tr ( "Reunion" ) ); | 440 | cmbCountry->insertItem( tr ( "Reunion" ) ); |
441 | cmbCountry->insertItem( tr ( "Romania" ) ); | 441 | cmbCountry->insertItem( tr ( "Romania" ) ); |
442 | cmbCountry->insertItem( tr ( "Russia" ) ); | 442 | cmbCountry->insertItem( tr ( "Russia" ) ); |
443 | cmbCountry->insertItem( tr ( "Rwanda" ) ); | 443 | cmbCountry->insertItem( tr ( "Rwanda" ) ); |
444 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); | 444 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); |
445 | cmbCountry->insertItem( tr ( "Samoa" ) ); | 445 | cmbCountry->insertItem( tr ( "Samoa" ) ); |
446 | cmbCountry->insertItem( tr ( "San Marino" ) ); | 446 | cmbCountry->insertItem( tr ( "San Marino" ) ); |
447 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); | 447 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); |
448 | cmbCountry->insertItem( tr ( "Senegal" ) ); | 448 | cmbCountry->insertItem( tr ( "Senegal" ) ); |
449 | cmbCountry->insertItem( tr ( "Seychelles" ) ); | 449 | cmbCountry->insertItem( tr ( "Seychelles" ) ); |
450 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); | 450 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); |
451 | cmbCountry->insertItem( tr ( "Singapore" ) ); | 451 | cmbCountry->insertItem( tr ( "Singapore" ) ); |
452 | cmbCountry->insertItem( tr ( "Slovakia" ) ); | 452 | cmbCountry->insertItem( tr ( "Slovakia" ) ); |
453 | cmbCountry->insertItem( tr ( "Slovenia" ) ); | 453 | cmbCountry->insertItem( tr ( "Slovenia" ) ); |
454 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); | 454 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); |
455 | cmbCountry->insertItem( tr ( "Somalia" ) ); | 455 | cmbCountry->insertItem( tr ( "Somalia" ) ); |
456 | cmbCountry->insertItem( tr ( "South Africa" ) ); | 456 | cmbCountry->insertItem( tr ( "South Africa" ) ); |
457 | cmbCountry->insertItem( tr ( "Spain" ) ); | 457 | cmbCountry->insertItem( tr ( "Spain" ) ); |
458 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); | 458 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); |
459 | cmbCountry->insertItem( tr ( "St. Helena" ) ); | 459 | cmbCountry->insertItem( tr ( "St. Helena" ) ); |
460 | cmbCountry->insertItem( tr ( "Sudan" ) ); | 460 | cmbCountry->insertItem( tr ( "Sudan" ) ); |
461 | cmbCountry->insertItem( tr ( "Suriname" ) ); | 461 | cmbCountry->insertItem( tr ( "Suriname" ) ); |
462 | cmbCountry->insertItem( tr ( "Swaziland" ) ); | 462 | cmbCountry->insertItem( tr ( "Swaziland" ) ); |
463 | cmbCountry->insertItem( tr ( "Sweden" ) ); | 463 | cmbCountry->insertItem( tr ( "Sweden" ) ); |
464 | cmbCountry->insertItem( tr ( "Switzerland" ) ); | 464 | cmbCountry->insertItem( tr ( "Switzerland" ) ); |
465 | cmbCountry->insertItem( tr ( "Taiwan" ) ); | 465 | cmbCountry->insertItem( tr ( "Taiwan" ) ); |
466 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); | 466 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); |
467 | cmbCountry->insertItem( tr ( "Tanzania" ) ); | 467 | cmbCountry->insertItem( tr ( "Tanzania" ) ); |
468 | cmbCountry->insertItem( tr ( "Thailand" ) ); | 468 | cmbCountry->insertItem( tr ( "Thailand" ) ); |
469 | cmbCountry->insertItem( tr ( "Togo" ) ); | 469 | cmbCountry->insertItem( tr ( "Togo" ) ); |
470 | cmbCountry->insertItem( tr ( "Tokelau" ) ); | 470 | cmbCountry->insertItem( tr ( "Tokelau" ) ); |
471 | cmbCountry->insertItem( tr ( "Tonga" ) ); | 471 | cmbCountry->insertItem( tr ( "Tonga" ) ); |
472 | cmbCountry->insertItem( tr ( "Tunisia" ) ); | 472 | cmbCountry->insertItem( tr ( "Tunisia" ) ); |
473 | cmbCountry->insertItem( tr ( "Turkey" ) ); | 473 | cmbCountry->insertItem( tr ( "Turkey" ) ); |
474 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); | 474 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); |
475 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); | 475 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); |
476 | cmbCountry->insertItem( tr ( "Uganda" ) ); | 476 | cmbCountry->insertItem( tr ( "Uganda" ) ); |
477 | cmbCountry->insertItem( tr ( "Ukraine" ) ); | 477 | cmbCountry->insertItem( tr ( "Ukraine" ) ); |
478 | cmbCountry->insertItem( tr ( "Uruguay" ) ); | 478 | cmbCountry->insertItem( tr ( "Uruguay" ) ); |
479 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); | 479 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); |
480 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); | 480 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); |
481 | cmbCountry->insertItem( tr ( "Venezuela" ) ); | 481 | cmbCountry->insertItem( tr ( "Venezuela" ) ); |
482 | cmbCountry->insertItem( tr ( "Vietnam" ) ); | 482 | cmbCountry->insertItem( tr ( "Vietnam" ) ); |
483 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); | 483 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); |
484 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); | 484 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); |
485 | cmbCountry->insertItem( tr ( "Yemen" ) ); | 485 | cmbCountry->insertItem( tr ( "Yemen" ) ); |
486 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); | 486 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); |
487 | cmbCountry->insertItem( tr ( "Zambia" ) ); | 487 | cmbCountry->insertItem( tr ( "Zambia" ) ); |
488 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); | 488 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); |
489 | if (cmbCountry->listBox()!=0) | 489 | if (cmbCountry->listBox()!=0) |
490 | cmbCountry->listBox()->sort(); | 490 | cmbCountry->listBox()->sort(); |
491 | 491 | ||
492 | cmbCountry->setMaximumWidth( 135 ); | 492 | cmbCountry->setMaximumWidth( 135 ); |
493 | 493 | ||
494 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 494 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
495 | 495 | ||
496 | // Chooser 4 | 496 | // Chooser 4 |
497 | cmbChooserField4 = new QComboBox( FALSE, container ); | 497 | cmbChooserField4 = new QComboBox( FALSE, container ); |
498 | cmbChooserField4->setMaximumWidth( 90 ); | 498 | cmbChooserField4->setMaximumWidth( 90 ); |
499 | gl->addWidget( cmbChooserField4, 6, 0 ); | 499 | gl->addWidget( cmbChooserField4, 6, 0 ); |
500 | // Textfield for chooser 2 | 500 | // Textfield for chooser 2 |
501 | // Now use WidgetStack to contain the textfield and the default-email combo! | 501 | // Now use WidgetStack to contain the textfield and the default-email combo! |
502 | m_widgetStack4 = new QWidgetStack( container ); | 502 | m_widgetStack4 = new QWidgetStack( container ); |
503 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); | 503 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); |
504 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); | 504 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); |
505 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); | 505 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); |
506 | m_widgetStack4 -> raiseWidget( TextField ); | 506 | m_widgetStack4 -> raiseWidget( TextField ); |
507 | 507 | ||
508 | QSpacerItem *space = new QSpacerItem(1,1, | 508 | QSpacerItem *space = new QSpacerItem(1,1, |
509 | QSizePolicy::Maximum, | 509 | QSizePolicy::Maximum, |
510 | QSizePolicy::MinimumExpanding ); | 510 | QSizePolicy::MinimumExpanding ); |
511 | gl->addItem( space, 7, 0 ); | 511 | gl->addItem( space, 7, 0 ); |
512 | 512 | ||
513 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 513 | tabMain->insertTab( tabViewport, tr( "Address" ) ); |
514 | 514 | ||
515 | tabViewport = new QWidget ( tabMain ); | 515 | tabViewport = new QWidget ( tabMain ); |
516 | 516 | ||
517 | vb = new QVBoxLayout( tabViewport ); | 517 | vb = new QVBoxLayout( tabViewport ); |
518 | 518 | ||
519 | svDetails = new QScrollView( tabViewport ); | 519 | svDetails = new QScrollView( tabViewport ); |
520 | vb->addWidget( svDetails, 0, 0 ); | 520 | vb->addWidget( svDetails, 0, 0 ); |
521 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 521 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
522 | svDetails->setFrameStyle( QFrame::NoFrame ); | 522 | svDetails->setFrameStyle( QFrame::NoFrame ); |
523 | 523 | ||
524 | container = new QWidget( svDetails->viewport() ); | 524 | container = new QWidget( svDetails->viewport() ); |
525 | svDetails->addChild( container ); | 525 | svDetails->addChild( container ); |
526 | 526 | ||
527 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 527 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
528 | 528 | ||
529 | int counter = 0; | 529 | int counter = 0; |
530 | 530 | ||
531 | // Birthday | 531 | // Birthday |
532 | QHBox* hBox = new QHBox( container ); | 532 | QHBox* hBox = new QHBox( container ); |
533 | l = new QLabel( tr("Birthday"), container ); | 533 | l = new QLabel( tr("Birthday"), container ); |
534 | gl->addWidget( l, counter, 0 ); | 534 | gl->addWidget( l, counter, 0 ); |
535 | 535 | ||
536 | QPopupMenu* m1 = new QPopupMenu( container ); | 536 | QPopupMenu* m1 = new QPopupMenu( container ); |
537 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | 537 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); |
538 | m1->insertItem( birthdayPicker ); | 538 | m1->insertItem( birthdayPicker ); |
539 | 539 | ||
540 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 540 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
541 | birthdayButton->setPopup( m1 ); | 541 | birthdayButton->setPopup( m1 ); |
542 | birthdayButton->setPopupDelay(0); | 542 | birthdayButton->setPopupDelay(0); |
543 | 543 | ||
544 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 544 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
545 | tr( "Delete" ), | 545 | tr( "Delete" ), |
546 | hBox, 0 ); | 546 | hBox, 0 ); |
547 | 547 | ||
548 | gl->addWidget( hBox, counter , 1 ); | 548 | gl->addWidget( hBox, counter , 1 ); |
549 | 549 | ||
550 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), | 550 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), |
551 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); | 551 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); |
552 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | 552 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); |
553 | 553 | ||
554 | ++counter; | 554 | ++counter; |
555 | 555 | ||
556 | // Anniversary | 556 | // Anniversary |
557 | hBox = new QHBox( container ); | 557 | hBox = new QHBox( container ); |
558 | l = new QLabel( tr("Anniversary"), container ); | 558 | l = new QLabel( tr("Anniversary"), container ); |
559 | gl->addWidget( l, counter, 0 ); | 559 | gl->addWidget( l, counter, 0 ); |
560 | 560 | ||
561 | m1 = new QPopupMenu( container ); | 561 | m1 = new QPopupMenu( container ); |
562 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 562 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); |
563 | m1->insertItem( anniversaryPicker ); | 563 | m1->insertItem( anniversaryPicker ); |
564 | 564 | ||
565 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 565 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
566 | anniversaryButton->setPopup( m1 ); | 566 | anniversaryButton->setPopup( m1 ); |
567 | anniversaryButton->setPopupDelay(0); | 567 | anniversaryButton->setPopupDelay(0); |
568 | 568 | ||
569 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 569 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
570 | tr( "Delete" ), | 570 | tr( "Delete" ), |
571 | hBox, 0 ); | 571 | hBox, 0 ); |
572 | gl->addWidget( hBox, counter , 1 ); | 572 | gl->addWidget( hBox, counter , 1 ); |
573 | 573 | ||
574 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), | 574 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), |
575 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); | 575 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); |
576 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); | 576 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); |
577 | 577 | ||
578 | ++counter; | 578 | ++counter; |
579 | 579 | ||
580 | // Gender | 580 | // Gender |
581 | l = new QLabel( tr("Gender"), container ); | 581 | l = new QLabel( tr("Gender"), container ); |
582 | gl->addWidget( l, counter, 0 ); | 582 | gl->addWidget( l, counter, 0 ); |
583 | cmbGender = new QComboBox( container ); | 583 | cmbGender = new QComboBox( container ); |
584 | cmbGender->insertItem( "", 0 ); | 584 | cmbGender->insertItem( "", 0 ); |
585 | cmbGender->insertItem( tr("Male"), 1); | 585 | cmbGender->insertItem( tr("Male"), 1); |
586 | cmbGender->insertItem( tr("Female"), 2); | 586 | cmbGender->insertItem( tr("Female"), 2); |
587 | gl->addWidget( cmbGender, counter, 1 ); | 587 | gl->addWidget( cmbGender, counter, 1 ); |
588 | 588 | ||
589 | ++counter; | 589 | ++counter; |
590 | 590 | ||
591 | // Create Labels and lineedit fields for every dynamic entry | 591 | // Create Labels and lineedit fields for every dynamic entry |
592 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 592 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
593 | QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); | 593 | QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); |
594 | QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); | 594 | QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); |
595 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { | 595 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { |
596 | 596 | ||
597 | if (((*it) == "Anniversary") || | 597 | if (((*it) == "Anniversary") || |
598 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | 598 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; |
599 | 599 | ||
600 | l = new QLabel( mapIdToStr[mapStrToID[*it]].utf8() , container ); | 600 | l = new QLabel( mapIdToStr[mapStrToID[*it]].utf8() , container ); |
601 | listName.append( l ); | 601 | listName.append( l ); |
602 | gl->addWidget( l, i, 0 ); | 602 | gl->addWidget( l, i, 0 ); |
603 | QLineEdit *e = new QLineEdit( container ); | 603 | QLineEdit *e = new QLineEdit( container ); |
604 | listValue.append( e ); | 604 | listValue.append( e ); |
605 | gl->addWidget( e, i, 1); | 605 | gl->addWidget( e, i, 1); |
606 | } | 606 | } |
607 | // Fill labels with names.. | 607 | // Fill labels with names.. |
608 | //loadFields(); | 608 | //loadFields(); |
609 | 609 | ||
610 | 610 | ||
611 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 611 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
612 | 612 | ||
613 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 613 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
614 | dlgNote->setCaption( tr("Enter Note") ); | 614 | dlgNote->setCaption( tr("Enter Note") ); |
615 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 615 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
616 | txtNote = new QMultiLineEdit( dlgNote ); | 616 | txtNote = new QMultiLineEdit( dlgNote ); |
617 | vbNote->addWidget( txtNote ); | 617 | vbNote->addWidget( txtNote ); |
618 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 618 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
619 | 619 | ||
620 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 620 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
621 | dlgName->setCaption( tr("Edit Name") ); | 621 | dlgName->setCaption( tr("Edit Name") ); |
622 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 622 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
623 | 623 | ||
624 | l = new QLabel( tr("First Name"), dlgName ); | 624 | l = new QLabel( tr("First Name"), dlgName ); |
625 | gl->addWidget( l, 0, 0 ); | 625 | gl->addWidget( l, 0, 0 ); |
626 | txtFirstName = new QLineEdit( dlgName ); | 626 | txtFirstName = new QLineEdit( dlgName ); |
627 | gl->addWidget( txtFirstName, 0, 1 ); | 627 | gl->addWidget( txtFirstName, 0, 1 ); |
628 | 628 | ||
629 | l = new QLabel( tr("Middle Name"), dlgName ); | 629 | l = new QLabel( tr("Middle Name"), dlgName ); |
630 | gl->addWidget( l, 1, 0 ); | 630 | gl->addWidget( l, 1, 0 ); |
631 | txtMiddleName = new QLineEdit( dlgName ); | 631 | txtMiddleName = new QLineEdit( dlgName ); |
632 | gl->addWidget( txtMiddleName, 1, 1 ); | 632 | gl->addWidget( txtMiddleName, 1, 1 ); |
633 | 633 | ||
634 | l = new QLabel( tr("Last Name"), dlgName ); | 634 | l = new QLabel( tr("Last Name"), dlgName ); |
635 | gl->addWidget( l, 2, 0 ); | 635 | gl->addWidget( l, 2, 0 ); |
636 | txtLastName = new QLineEdit( dlgName ); | 636 | txtLastName = new QLineEdit( dlgName ); |
637 | gl->addWidget( txtLastName, 2, 1 ); | 637 | gl->addWidget( txtLastName, 2, 1 ); |
638 | 638 | ||
639 | // l = new QLabel( tr("Suffix"), dlgName ); | 639 | // l = new QLabel( tr("Suffix"), dlgName ); |
640 | // gl->addWidget( l, 3, 0 ); | 640 | // gl->addWidget( l, 3, 0 ); |
641 | // txtSuffix = new QLineEdit( dlgName ); | 641 | // txtSuffix = new QLineEdit( dlgName ); |
642 | // gl->addWidget( txtSuffix, 3, 1 ); | 642 | // gl->addWidget( txtSuffix, 3, 1 ); |
643 | space = new QSpacerItem(1,1, | 643 | space = new QSpacerItem(1,1, |
644 | QSizePolicy::Maximum, | 644 | QSizePolicy::Maximum, |
645 | QSizePolicy::MinimumExpanding ); | 645 | QSizePolicy::MinimumExpanding ); |
646 | gl->addItem( space, 4, 0 ); | 646 | gl->addItem( space, 4, 0 ); |
647 | 647 | ||
648 | cmbChooserField1->insertStringList( trlChooserNames ); | 648 | cmbChooserField1->insertStringList( trlChooserNames ); |
649 | cmbChooserField2->insertStringList( trlChooserNames ); | 649 | cmbChooserField2->insertStringList( trlChooserNames ); |
650 | cmbChooserField3->insertStringList( trlChooserNames ); | 650 | cmbChooserField3->insertStringList( trlChooserNames ); |
651 | cmbChooserField4->insertStringList( trlChooserNames ); | 651 | cmbChooserField4->insertStringList( trlChooserNames ); |
652 | 652 | ||
653 | cmbChooserField1->setCurrentItem( 0 ); | 653 | cmbChooserField1->setCurrentItem( 0 ); |
654 | cmbChooserField2->setCurrentItem( 1 ); | 654 | cmbChooserField2->setCurrentItem( 1 ); |
655 | cmbChooserField3->setCurrentItem( 2 ); | 655 | cmbChooserField3->setCurrentItem( 2 ); |
656 | 656 | ||
657 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 657 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
658 | 658 | ||
659 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); | 659 | connect( txtFullName, SIGNAL(textChanged(const QString &)), |
660 | 660 | this, SLOT(slotFullNameChange(const QString &)) ); | |
661 | connect( txtSuffix, SIGNAL(textChanged(const QString &)), this, SLOT(slotSuffixChange(const QString &)) ); | 661 | connect( txtSuffix, SIGNAL(textChanged(const QString &)), |
662 | 662 | this, SLOT(slotSuffixChange(const QString &)) ); | |
663 | connect( txtOrganization, SIGNAL(textChanged(const QString &)), | ||
664 | this, SLOT(slotOrganizationChange(const QString &)) ); | ||
663 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), | 665 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), |
664 | this, SLOT(slotChooser1Change(const QString &)) ); | 666 | this, SLOT(slotChooser1Change(const QString &)) ); |
665 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), | 667 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), |
666 | this, SLOT(slotChooser2Change(const QString &)) ); | 668 | this, SLOT(slotChooser2Change(const QString &)) ); |
667 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), | 669 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), |
668 | this, SLOT(slotChooser3Change(const QString &)) ); | 670 | this, SLOT(slotChooser3Change(const QString &)) ); |
669 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), | 671 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), |
670 | this, SLOT(slotChooser4Change(const QString &)) ); | 672 | this, SLOT(slotChooser4Change(const QString &)) ); |
671 | connect( txtAddress, SIGNAL(textChanged(const QString &)), | 673 | connect( txtAddress, SIGNAL(textChanged(const QString &)), |
672 | this, SLOT(slotAddressChange(const QString &)) ); | 674 | this, SLOT(slotAddressChange(const QString &)) ); |
673 | connect( txtCity, SIGNAL(textChanged(const QString &)), | 675 | connect( txtCity, SIGNAL(textChanged(const QString &)), |
674 | this, SLOT(slotCityChange(const QString &)) ); | 676 | this, SLOT(slotCityChange(const QString &)) ); |
675 | connect( txtState, SIGNAL(textChanged(const QString &)), | 677 | connect( txtState, SIGNAL(textChanged(const QString &)), |
676 | this, SLOT(slotStateChange(const QString &)) ); | 678 | this, SLOT(slotStateChange(const QString &)) ); |
677 | connect( txtZip, SIGNAL(textChanged(const QString &)), | 679 | connect( txtZip, SIGNAL(textChanged(const QString &)), |
678 | this, SLOT(slotZipChange(const QString &)) ); | 680 | this, SLOT(slotZipChange(const QString &)) ); |
679 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), | 681 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), |
680 | this, SLOT(slotCountryChange(const QString &)) ); | 682 | this, SLOT(slotCountryChange(const QString &)) ); |
681 | connect( cmbCountry, SIGNAL(activated(const QString &)), | 683 | connect( cmbCountry, SIGNAL(activated(const QString &)), |
682 | this, SLOT(slotCountryChange(const QString &)) ); | 684 | this, SLOT(slotCountryChange(const QString &)) ); |
683 | connect( cmbChooserField1, SIGNAL(activated(int)), | 685 | connect( cmbChooserField1, SIGNAL(activated(int)), |
684 | this, SLOT(slotCmbChooser1Change(int)) ); | 686 | this, SLOT(slotCmbChooser1Change(int)) ); |
685 | connect( cmbChooserField2, SIGNAL(activated(int)), | 687 | connect( cmbChooserField2, SIGNAL(activated(int)), |
686 | this, SLOT(slotCmbChooser2Change(int)) ); | 688 | this, SLOT(slotCmbChooser2Change(int)) ); |
687 | connect( cmbChooserField3, SIGNAL(activated(int)), | 689 | connect( cmbChooserField3, SIGNAL(activated(int)), |
688 | this, SLOT(slotCmbChooser3Change(int)) ); | 690 | this, SLOT(slotCmbChooser3Change(int)) ); |
689 | connect( cmbChooserField4, SIGNAL(activated(int)), | 691 | connect( cmbChooserField4, SIGNAL(activated(int)), |
690 | this, SLOT(slotCmbChooser4Change(int)) ); | 692 | this, SLOT(slotCmbChooser4Change(int)) ); |
691 | connect( cmbAddress, SIGNAL(activated(int)), | 693 | connect( cmbAddress, SIGNAL(activated(int)), |
692 | this, SLOT(slotAddressTypeChange(int)) ); | 694 | this, SLOT(slotAddressTypeChange(int)) ); |
693 | 695 | ||
694 | new QPEDialogListener(this); | 696 | new QPEDialogListener(this); |
695 | 697 | ||
696 | setPersonalView ( m_personalView ); | 698 | setPersonalView ( m_personalView ); |
697 | 699 | ||
698 | qWarning("init() END"); | 700 | qWarning("init() END"); |
699 | } | 701 | } |
700 | 702 | ||
701 | void ContactEditor::defaultEmailChanged(int i){ | 703 | void ContactEditor::defaultEmailChanged(int i){ |
702 | qDebug("defaultEmailChanged"); | 704 | qDebug("defaultEmailChanged"); |
703 | 705 | ||
704 | // was sollte das ? (se) | 706 | // was sollte das ? (se) |
705 | // int index = cmbChooserField1->currentItem(); | 707 | // int index = cmbChooserField1->currentItem(); |
706 | // slChooserValues[index] = cmbDefaultEmail->text(i); | 708 | // slChooserValues[index] = cmbDefaultEmail->text(i); |
707 | 709 | ||
708 | defaultEmail = cmbDefaultEmail->text(i); | 710 | defaultEmail = cmbDefaultEmail->text(i); |
709 | qDebug ("Changed to: %s", defaultEmail.latin1()); | 711 | qDebug ("Changed to: %s", defaultEmail.latin1()); |
710 | 712 | ||
711 | } | 713 | } |
712 | 714 | ||
713 | void ContactEditor::populateDefaultEmailCmb(){ | 715 | void ContactEditor::populateDefaultEmailCmb(){ |
714 | 716 | ||
715 | // if the default-email combo was not selected and therfore not created | 717 | // if the default-email combo was not selected and therfore not created |
716 | // we get a lot of trouble.. Therfore create an invisible one.. | 718 | // we get a lot of trouble.. Therfore create an invisible one.. |
717 | if ( !cmbDefaultEmail ){ | 719 | if ( !cmbDefaultEmail ){ |
718 | cmbDefaultEmail = new QComboBox(this); | 720 | cmbDefaultEmail = new QComboBox(this); |
719 | cmbDefaultEmail -> hide(); | 721 | cmbDefaultEmail -> hide(); |
720 | } | 722 | } |
721 | cmbDefaultEmail->clear(); | 723 | cmbDefaultEmail->clear(); |
722 | cmbDefaultEmail->insertStringList( emails ); | 724 | cmbDefaultEmail->insertStringList( emails ); |
723 | // cmbDefaultEmail->show(); | 725 | // cmbDefaultEmail->show(); |
724 | 726 | ||
725 | // Select default email in combo.. | 727 | // Select default email in combo.. |
726 | bool found = false; | 728 | bool found = false; |
727 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 729 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
728 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", | 730 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", |
729 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); | 731 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); |
730 | 732 | ||
731 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 733 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
732 | cmbDefaultEmail->setCurrentItem( i ); | 734 | cmbDefaultEmail->setCurrentItem( i ); |
733 | qDebug("set"); | 735 | qDebug("set"); |
734 | found = true; | 736 | found = true; |
735 | } | 737 | } |
736 | } | 738 | } |
737 | 739 | ||
738 | // If the current default email is not found in the list, we choose the | 740 | // If the current default email is not found in the list, we choose the |
739 | // first one.. | 741 | // first one.. |
740 | if ( !found ) | 742 | if ( !found ) |
741 | defaultEmail = cmbDefaultEmail->text(0); | 743 | defaultEmail = cmbDefaultEmail->text(0); |
742 | } | 744 | } |
743 | 745 | ||
744 | // Called when any combobox was changed. | 746 | // Called when any combobox was changed. |
745 | // "true" returned if the change was chandled by this function, else it should | 747 | // "true" returned if the change was chandled by this function, else it should |
746 | // be handled by something else.. | 748 | // be handled by something else.. |
747 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { | 749 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { |
748 | QString type = slChooserNames[index]; | 750 | QString type = slChooserNames[index]; |
749 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); | 751 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); |
750 | 752 | ||
751 | if ( !initializing ) | 753 | if ( !initializing ) |
752 | contactfields.setFieldOrder( widgetPos-1, index ); | 754 | contactfields.setFieldOrder( widgetPos-1, index ); |
753 | 755 | ||
754 | // Create and connect combobox for selecting the default email | 756 | // Create and connect combobox for selecting the default email |
755 | if ( type == "Default Email"){ | 757 | if ( type == "Default Email"){ |
756 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); | 758 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); |
757 | 759 | ||
758 | // More than one default-email chooser is not allowed ! | 760 | // More than one default-email chooser is not allowed ! |
759 | if ( ( defaultEmailChooserPosition != -1 ) && | 761 | if ( ( defaultEmailChooserPosition != -1 ) && |
760 | defaultEmailChooserPosition != widgetPos && !initializing){ | 762 | defaultEmailChooserPosition != widgetPos && !initializing){ |
761 | chooserError( widgetPos ); | 763 | chooserError( widgetPos ); |
762 | return true; | 764 | return true; |
763 | } | 765 | } |
764 | 766 | ||
765 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 767 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
766 | if ( cmbo ){ | 768 | if ( cmbo ){ |
767 | inputStack->raiseWidget( TextField ); | 769 | inputStack->raiseWidget( TextField ); |
768 | inputStack -> removeWidget( cmbo ); | 770 | inputStack -> removeWidget( cmbo ); |
769 | delete cmbo; | 771 | delete cmbo; |
770 | } | 772 | } |
771 | cmbo = new QComboBox( inputStack ); | 773 | cmbo = new QComboBox( inputStack ); |
772 | cmbo -> insertStringList( emails ); | 774 | cmbo -> insertStringList( emails ); |
773 | 775 | ||
774 | inputStack -> addWidget( cmbo, Combo ); | 776 | inputStack -> addWidget( cmbo, Combo ); |
775 | inputStack -> raiseWidget( Combo ); | 777 | inputStack -> raiseWidget( Combo ); |
776 | 778 | ||
777 | defaultEmailChooserPosition = widgetPos; | 779 | defaultEmailChooserPosition = widgetPos; |
778 | cmbDefaultEmail = cmbo; | 780 | cmbDefaultEmail = cmbo; |
779 | 781 | ||
780 | connect( cmbo,SIGNAL( activated(int) ), | 782 | connect( cmbo,SIGNAL( activated(int) ), |
781 | SLOT( defaultEmailChanged(int) ) ); | 783 | SLOT( defaultEmailChanged(int) ) ); |
782 | 784 | ||
783 | // Set current default email | 785 | // Set current default email |
784 | populateDefaultEmailCmb(); | 786 | populateDefaultEmailCmb(); |
785 | 787 | ||
786 | 788 | ||
787 | } else { | 789 | } else { |
788 | // Something else was selected: Hide combo.. | 790 | // Something else was selected: Hide combo.. |
789 | qWarning(" Hiding default-email combo" ); | 791 | qWarning(" Hiding default-email combo" ); |
790 | if ( defaultEmailChooserPosition == widgetPos ){ | 792 | if ( defaultEmailChooserPosition == widgetPos ){ |
791 | defaultEmailChooserPosition = -1; | 793 | defaultEmailChooserPosition = -1; |
792 | } | 794 | } |
793 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 795 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
794 | if ( cmbo ){ | 796 | if ( cmbo ){ |
795 | inputStack->raiseWidget( TextField ); | 797 | inputStack->raiseWidget( TextField ); |
796 | inputStack -> removeWidget( cmbo ); | 798 | inputStack -> removeWidget( cmbo ); |
797 | cmbDefaultEmail = 0l; | 799 | cmbDefaultEmail = 0l; |
798 | delete cmbo; | 800 | delete cmbo; |
799 | } | 801 | } |
800 | 802 | ||
801 | // Caller should initialize the responsible textfield, therefore | 803 | // Caller should initialize the responsible textfield, therefore |
802 | // "false" is returned | 804 | // "false" is returned |
803 | return false; | 805 | return false; |
804 | } | 806 | } |
805 | 807 | ||
806 | // Everything is worked off .. | 808 | // Everything is worked off .. |
807 | return true; | 809 | return true; |
808 | 810 | ||
809 | } | 811 | } |
810 | 812 | ||
811 | // Currently accessed when we select default-email more than once ! | 813 | // Currently accessed when we select default-email more than once ! |
812 | void ContactEditor::chooserError( int index ) | 814 | void ContactEditor::chooserError( int index ) |
813 | { | 815 | { |
814 | qWarning("ContactEditor::chooserError( %d )", index); | 816 | qWarning("ContactEditor::chooserError( %d )", index); |
815 | QMessageBox::warning( this, "Chooser Error", | 817 | QMessageBox::warning( this, "Chooser Error", |
816 | "Multiple selection of this\n" | 818 | "Multiple selection of this\n" |
817 | "Item is not allowed !\n\n" | 819 | "Item is not allowed !\n\n" |
818 | "First deselect the previous one !", | 820 | "First deselect the previous one !", |
819 | "&OK", 0, 0, | 821 | "&OK", 0, 0, |
820 | 0, 0 ); | 822 | 0, 0 ); |
821 | 823 | ||
822 | // Reset the selected Chooser. Unfortunately the chooser | 824 | // Reset the selected Chooser. Unfortunately the chooser |
823 | // generates no signal, therfore we have to | 825 | // generates no signal, therfore we have to |
824 | // call the cmbChooserChange function manually.. | 826 | // call the cmbChooserChange function manually.. |
825 | switch( index ){ | 827 | switch( index ){ |
826 | case 1: | 828 | case 1: |
827 | cmbChooserField1 -> setCurrentItem( 0 ); | 829 | cmbChooserField1 -> setCurrentItem( 0 ); |
828 | slotCmbChooser1Change( 0 ); | 830 | slotCmbChooser1Change( 0 ); |
829 | break; | 831 | break; |
830 | case 2: | 832 | case 2: |
831 | cmbChooserField2 -> setCurrentItem( 0 ); | 833 | cmbChooserField2 -> setCurrentItem( 0 ); |
832 | slotCmbChooser2Change( 0 ); | 834 | slotCmbChooser2Change( 0 ); |
833 | break; | 835 | break; |
834 | case 3: | 836 | case 3: |
835 | cmbChooserField3 -> setCurrentItem( 0 ); | 837 | cmbChooserField3 -> setCurrentItem( 0 ); |
836 | slotCmbChooser3Change( 0 ); | 838 | slotCmbChooser3Change( 0 ); |
837 | break; | 839 | break; |
838 | case 4: | 840 | case 4: |
839 | cmbChooserField4 -> setCurrentItem( 0 ); | 841 | cmbChooserField4 -> setCurrentItem( 0 ); |
840 | slotCmbChooser4Change( 0 ); | 842 | slotCmbChooser4Change( 0 ); |
841 | break; | 843 | break; |
842 | } | 844 | } |
843 | } | 845 | } |
844 | 846 | ||
845 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) | 847 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
846 | void ContactEditor::chooserChange( const QString &textChanged, int index, | 848 | void ContactEditor::chooserChange( const QString &textChanged, int index, |
847 | QLineEdit* , int widgetPos ) { | 849 | QLineEdit* , int widgetPos ) { |
848 | 850 | ||
849 | QString type = slChooserNames[index]; // :SX | 851 | QString type = slChooserNames[index]; // :SX |
850 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", | 852 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", |
851 | type.latin1(),textChanged.latin1(), index, widgetPos ); | 853 | type.latin1(),textChanged.latin1(), index, widgetPos ); |
852 | 854 | ||
853 | if ( type == "Default Email"){ | 855 | if ( type == "Default Email"){ |
854 | qWarning ("??? Wozu??: %s", textChanged.latin1()); | 856 | qWarning ("??? Wozu??: %s", textChanged.latin1()); |
855 | defaultEmail = textChanged; | 857 | defaultEmail = textChanged; |
856 | 858 | ||
857 | populateDefaultEmailCmb(); | 859 | populateDefaultEmailCmb(); |
858 | 860 | ||
859 | }else if (type == "Emails"){ | 861 | }else if (type == "Emails"){ |
860 | qDebug("emails"); | 862 | qDebug("emails"); |
861 | 863 | ||
862 | QString de; | 864 | QString de; |
863 | emails = QStringList::split (",", textChanged ); | 865 | emails = QStringList::split (",", textChanged ); |
864 | 866 | ||
865 | populateDefaultEmailCmb(); | 867 | populateDefaultEmailCmb(); |
866 | } | 868 | } |
867 | 869 | ||
868 | slChooserValues[index] = textChanged; | 870 | slChooserValues[index] = textChanged; |
869 | 871 | ||
870 | } | 872 | } |
871 | 873 | ||
872 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 874 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
873 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); | 875 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); |
874 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 876 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
875 | } | 877 | } |
876 | 878 | ||
877 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 879 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
878 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); | 880 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); |
879 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 881 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
880 | 882 | ||
881 | } | 883 | } |
882 | 884 | ||
883 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 885 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
884 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); | 886 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); |
885 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 887 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
886 | } | 888 | } |
887 | 889 | ||
888 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 890 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
889 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); | 891 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); |
890 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 892 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
891 | } | 893 | } |
892 | 894 | ||
893 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 895 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
894 | 896 | ||
895 | if ( cmbAddress->currentItem() == 0 ) { | 897 | if ( cmbAddress->currentItem() == 0 ) { |
896 | slBusinessAddress[0] = textChanged; | 898 | slBusinessAddress[0] = textChanged; |
897 | } else { | 899 | } else { |
898 | slHomeAddress[0] = textChanged; | 900 | slHomeAddress[0] = textChanged; |
899 | } | 901 | } |
900 | } | 902 | } |
901 | 903 | ||
902 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 904 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
903 | 905 | ||
904 | if ( cmbAddress->currentItem() == 0 ) { | 906 | if ( cmbAddress->currentItem() == 0 ) { |
905 | slBusinessAddress[1] = textChanged; | 907 | slBusinessAddress[1] = textChanged; |
906 | } else { | 908 | } else { |
907 | slHomeAddress[1] = textChanged; | 909 | slHomeAddress[1] = textChanged; |
908 | } | 910 | } |
909 | } | 911 | } |
910 | 912 | ||
911 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 913 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
912 | 914 | ||
913 | if ( cmbAddress->currentItem() == 0 ) { | 915 | if ( cmbAddress->currentItem() == 0 ) { |
914 | slBusinessAddress[2] = textChanged; | 916 | slBusinessAddress[2] = textChanged; |
915 | } else { | 917 | } else { |
916 | slHomeAddress[2] = textChanged; | 918 | slHomeAddress[2] = textChanged; |
917 | } | 919 | } |
918 | } | 920 | } |
919 | 921 | ||
920 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 922 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
921 | 923 | ||
922 | if ( cmbAddress->currentItem() == 0 ) { | 924 | if ( cmbAddress->currentItem() == 0 ) { |
923 | slBusinessAddress[3] = textChanged; | 925 | slBusinessAddress[3] = textChanged; |
924 | } else { | 926 | } else { |
925 | slHomeAddress[3] = textChanged; | 927 | slHomeAddress[3] = textChanged; |
926 | } | 928 | } |
927 | } | 929 | } |
928 | 930 | ||
929 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 931 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
930 | 932 | ||
931 | 933 | ||
932 | if ( cmbAddress->currentItem() == 0 ) { | 934 | if ( cmbAddress->currentItem() == 0 ) { |
933 | slBusinessAddress[4] = textChanged; | 935 | slBusinessAddress[4] = textChanged; |
934 | } else { | 936 | } else { |
935 | slHomeAddress[4] = textChanged; | 937 | slHomeAddress[4] = textChanged; |
936 | } | 938 | } |
937 | } | 939 | } |
938 | 940 | ||
939 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 941 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
940 | 942 | ||
941 | if ( cmbAddress->currentItem() == 0 ) { | 943 | if ( cmbAddress->currentItem() == 0 ) { |
942 | slBusinessAddress[5] = textChanged; | 944 | slBusinessAddress[5] = textChanged; |
943 | } else { | 945 | } else { |
944 | slHomeAddress[5] = textChanged; | 946 | slHomeAddress[5] = textChanged; |
945 | } | 947 | } |
946 | } | 948 | } |
947 | 949 | ||
948 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 950 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
949 | 951 | ||
950 | if ( cmbAddress->currentItem() == 0 ) { | 952 | if ( cmbAddress->currentItem() == 0 ) { |
951 | slBusinessAddress[6] = textChanged; | 953 | slBusinessAddress[6] = textChanged; |
952 | } else { | 954 | } else { |
953 | slHomeAddress[6] = textChanged; | 955 | slHomeAddress[6] = textChanged; |
954 | } | 956 | } |
955 | } | 957 | } |
956 | 958 | ||
957 | 959 | ||
958 | void ContactEditor::slotCmbChooser1Change( int index ) { | 960 | void ContactEditor::slotCmbChooser1Change( int index ) { |
959 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); | 961 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); |
960 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ | 962 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ |
961 | 963 | ||
962 | txtChooserField1->setText( slChooserValues[index] ); | 964 | txtChooserField1->setText( slChooserValues[index] ); |
963 | txtChooserField1->setFocus(); | 965 | txtChooserField1->setFocus(); |
964 | 966 | ||
965 | } | 967 | } |
966 | 968 | ||
967 | } | 969 | } |
968 | 970 | ||
969 | void ContactEditor::slotCmbChooser2Change( int index ) { | 971 | void ContactEditor::slotCmbChooser2Change( int index ) { |
970 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); | 972 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); |
971 | 973 | ||
972 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ | 974 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ |
973 | 975 | ||
974 | txtChooserField2->setText( slChooserValues[index] ); | 976 | txtChooserField2->setText( slChooserValues[index] ); |
975 | txtChooserField2->setFocus(); | 977 | txtChooserField2->setFocus(); |
976 | 978 | ||
977 | } | 979 | } |
978 | } | 980 | } |
979 | 981 | ||
980 | void ContactEditor::slotCmbChooser3Change( int index ) { | 982 | void ContactEditor::slotCmbChooser3Change( int index ) { |
981 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); | 983 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); |
982 | 984 | ||
983 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ | 985 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ |
984 | 986 | ||
985 | txtChooserField3->setText( slChooserValues[index] ); | 987 | txtChooserField3->setText( slChooserValues[index] ); |
986 | txtChooserField3->setFocus(); | 988 | txtChooserField3->setFocus(); |
987 | 989 | ||
988 | } | 990 | } |
989 | } | 991 | } |
990 | 992 | ||
991 | void ContactEditor::slotCmbChooser4Change( int index ) { | 993 | void ContactEditor::slotCmbChooser4Change( int index ) { |
992 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); | 994 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); |
993 | 995 | ||
994 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ | 996 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ |
995 | 997 | ||
996 | txtChooserField4->setText( slChooserValues[index] ); | 998 | txtChooserField4->setText( slChooserValues[index] ); |
997 | txtChooserField4->setFocus(); | 999 | txtChooserField4->setFocus(); |
998 | 1000 | ||
999 | } | 1001 | } |
1000 | } | 1002 | } |
1001 | 1003 | ||
1002 | void ContactEditor::slotAddressTypeChange( int index ) { | 1004 | void ContactEditor::slotAddressTypeChange( int index ) { |
1003 | 1005 | ||
1004 | 1006 | ||
1005 | if ( !initializing ) | 1007 | if ( !initializing ) |
1006 | contactfields.setFieldOrder( 4, index ); | 1008 | contactfields.setFieldOrder( 4, index ); |
1007 | 1009 | ||
1008 | 1010 | ||
1009 | if ( index == 0 ) { | 1011 | if ( index == 0 ) { |
1010 | 1012 | ||
1011 | txtAddress->setText( slBusinessAddress[0] ); | 1013 | txtAddress->setText( slBusinessAddress[0] ); |
1012 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 1014 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
1013 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 1015 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
1014 | txtCity->setText( slBusinessAddress[3] ); | 1016 | txtCity->setText( slBusinessAddress[3] ); |
1015 | txtState->setText( slBusinessAddress[4] ); | 1017 | txtState->setText( slBusinessAddress[4] ); |
1016 | txtZip->setText( slBusinessAddress[5] ); | 1018 | txtZip->setText( slBusinessAddress[5] ); |
1017 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1019 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1018 | txtTmp->setText( slBusinessAddress[6] ); | 1020 | txtTmp->setText( slBusinessAddress[6] ); |
1019 | 1021 | ||
1020 | } else { | 1022 | } else { |
1021 | 1023 | ||
1022 | txtAddress->setText( slHomeAddress[0] ); | 1024 | txtAddress->setText( slHomeAddress[0] ); |
1023 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 1025 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
1024 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 1026 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
1025 | txtCity->setText( slHomeAddress[3] ); | 1027 | txtCity->setText( slHomeAddress[3] ); |
1026 | txtState->setText( slHomeAddress[4] ); | 1028 | txtState->setText( slHomeAddress[4] ); |
1027 | txtZip->setText( slHomeAddress[5] ); | 1029 | txtZip->setText( slHomeAddress[5] ); |
1028 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1030 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1029 | txtTmp->setText( slHomeAddress[6] ); | 1031 | txtTmp->setText( slHomeAddress[6] ); |
1030 | 1032 | ||
1031 | } | 1033 | } |
1032 | 1034 | ||
1033 | } | 1035 | } |
1034 | 1036 | ||
1035 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1037 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
1036 | 1038 | ||
1037 | qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); | 1039 | qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); |
1038 | 1040 | ||
1039 | int index = cmbFileAs->currentItem(); | 1041 | int index = cmbFileAs->currentItem(); |
1040 | 1042 | ||
1041 | cmbFileAs->clear(); | 1043 | cmbFileAs->clear(); |
1042 | 1044 | ||
1043 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); | 1045 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); |
1044 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); | 1046 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); |
1045 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); | 1047 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); |
1046 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); | 1048 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); |
1047 | if ( ! txtSuffix->text().isEmpty() ) | 1049 | if ( ! txtSuffix->text().isEmpty() ) |
1048 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); | 1050 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); |
1049 | 1051 | ||
1050 | cmbFileAs->setCurrentItem( index ); | 1052 | cmbFileAs->setCurrentItem( index ); |
1051 | 1053 | ||
1052 | 1054 | ||
1053 | } | 1055 | } |
1054 | 1056 | ||
1055 | void ContactEditor::slotSuffixChange( const QString& ) { | 1057 | void ContactEditor::slotSuffixChange( const QString& ) { |
1056 | // Just want to update the FileAs combo if the suffix was changed.. | 1058 | // Just want to update the FileAs combo if the suffix was changed.. |
1057 | slotFullNameChange( txtFullName->text() ); | 1059 | slotFullNameChange( txtFullName->text() ); |
1058 | } | 1060 | } |
1059 | 1061 | ||
1062 | void ContactEditor::slotOrganizationChange( const QString &textChanged ){ | ||
1063 | qWarning( "ContactEditor::slotOrganizationChange( %s )", textChanged.latin1() ); | ||
1064 | // Special handling for storing Companies: | ||
1065 | // If no Fullname is given, we store the Company-Name as lastname | ||
1066 | // to handle it like a person.. | ||
1067 | if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) | ||
1068 | txtFullName->setText( textChanged ); | ||
1069 | |||
1070 | } | ||
1071 | |||
1060 | void ContactEditor::accept() { | 1072 | void ContactEditor::accept() { |
1061 | 1073 | ||
1062 | if ( isEmpty() ) { | 1074 | if ( isEmpty() ) { |
1063 | cleanupFields(); | 1075 | cleanupFields(); |
1064 | reject(); | 1076 | reject(); |
1065 | } else { | 1077 | } else { |
1066 | saveEntry(); | 1078 | saveEntry(); |
1067 | cleanupFields(); | 1079 | cleanupFields(); |
1068 | QDialog::accept(); | 1080 | QDialog::accept(); |
1069 | } | 1081 | } |
1070 | 1082 | ||
1071 | } | 1083 | } |
1072 | 1084 | ||
1073 | void ContactEditor::slotNote() { | 1085 | void ContactEditor::slotNote() { |
1074 | 1086 | ||
1075 | dlgNote->showMaximized(); | 1087 | dlgNote->showMaximized(); |
1076 | if ( !dlgNote->exec() ) { | 1088 | if ( !dlgNote->exec() ) { |
1077 | txtNote->setText( ent.notes() ); | 1089 | txtNote->setText( ent.notes() ); |
1078 | } | 1090 | } |
1079 | } | 1091 | } |
1080 | 1092 | ||
1081 | void ContactEditor::slotName() { | 1093 | void ContactEditor::slotName() { |
1082 | 1094 | ||
1083 | QString tmpName; | 1095 | QString tmpName; |
1084 | 1096 | ||
1085 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1097 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1086 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1098 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1087 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1099 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1088 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1100 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1089 | 1101 | ||
1090 | dlgName->showMaximized(); | 1102 | dlgName->showMaximized(); |
1091 | if ( dlgName->exec() ) { | 1103 | if ( dlgName->exec() ) { |
1092 | if ( txtLastName->text().contains( ' ', TRUE ) ) | 1104 | if ( txtLastName->text().contains( ' ', TRUE ) ) |
1093 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); | 1105 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); |
1094 | else | 1106 | else |
1095 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); | 1107 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); |
1096 | 1108 | ||
1097 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1109 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1098 | slotFullNameChange( txtFullName->text() ); | 1110 | slotFullNameChange( txtFullName->text() ); |
1099 | } | 1111 | } |
1100 | 1112 | ||
1101 | } | 1113 | } |
1102 | 1114 | ||
1103 | void ContactEditor::setNameFocus() { | 1115 | void ContactEditor::setNameFocus() { |
1104 | 1116 | ||
1105 | txtFullName->setFocus(); | 1117 | txtFullName->setFocus(); |
1106 | 1118 | ||
1107 | } | 1119 | } |
1108 | 1120 | ||
1109 | bool ContactEditor::isEmpty() { | 1121 | bool ContactEditor::isEmpty() { |
1110 | // Test and see if the record should be saved. | 1122 | // Test and see if the record should be saved. |
1111 | // More strict than the original qtopia, needs name or fileas to save | 1123 | // More strict than the original qtopia, needs name or fileas to save |
1112 | 1124 | ||
1113 | QString t = txtFullName->text(); | 1125 | QString t = txtFullName->text(); |
1114 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1126 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1115 | return false; | 1127 | return false; |
1116 | 1128 | ||
1117 | t = cmbFileAs->currentText(); | 1129 | t = cmbFileAs->currentText(); |
1118 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1130 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1119 | return false; | 1131 | return false; |
1120 | 1132 | ||
1121 | return true; | 1133 | return true; |
1122 | 1134 | ||
1123 | } | 1135 | } |
1124 | 1136 | ||
1125 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1137 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1126 | 1138 | ||
1127 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1139 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1128 | QString strFirstName; | 1140 | QString strFirstName; |
1129 | QString strMiddleName; | 1141 | QString strMiddleName; |
1130 | QString strLastName; | 1142 | QString strLastName; |
1131 | QString strTitle; | 1143 | QString strTitle; |
1132 | int commapos; | 1144 | int commapos; |
1133 | bool haveLastName = false; | 1145 | bool haveLastName = false; |
1134 | 1146 | ||
1135 | qWarning("Fullname: %s", simplifiedName.latin1()); | 1147 | qWarning("Fullname: %s", simplifiedName.latin1()); |
1136 | 1148 | ||
1137 | commapos = simplifiedName.find( ',', 0, TRUE); | 1149 | commapos = simplifiedName.find( ',', 0, TRUE); |
1138 | if ( commapos >= 0 ) { | 1150 | if ( commapos >= 0 ) { |
1139 | qWarning(" Commapos: %d", commapos ); | 1151 | qWarning(" Commapos: %d", commapos ); |
1140 | 1152 | ||
1141 | // A comma (",") separates the lastname from one or | 1153 | // A comma (",") separates the lastname from one or |
1142 | // many first names. Thus, remove the lastname from the | 1154 | // many first names. Thus, remove the lastname from the |
1143 | // String and parse the firstnames. | 1155 | // String and parse the firstnames. |
1144 | 1156 | ||
1145 | strLastName = simplifiedName.left( commapos ); | 1157 | strLastName = simplifiedName.left( commapos ); |
1146 | simplifiedName= simplifiedName.mid( commapos + 1 ); | 1158 | simplifiedName= simplifiedName.mid( commapos + 1 ); |
1147 | haveLastName = true; | 1159 | haveLastName = true; |
1148 | qWarning("Fullname without ',': %s", simplifiedName.latin1()); | 1160 | qWarning("Fullname without ',': %s", simplifiedName.latin1()); |
1149 | 1161 | ||
1150 | // If we have any lastname, we should now split all first names. | 1162 | // If we have any lastname, we should now split all first names. |
1151 | // The first one will be the used as first, the rest as "middle names" | 1163 | // The first one will be the used as first, the rest as "middle names" |
1152 | 1164 | ||
1153 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); | 1165 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); |
1154 | QStringList::Iterator it = allFirstNames.begin(); | 1166 | QStringList::Iterator it = allFirstNames.begin(); |
1155 | strFirstName = *it++; | 1167 | strFirstName = *it++; |
1156 | QStringList allSecondNames; | 1168 | QStringList allSecondNames; |
1157 | for ( ; it != allFirstNames.end(); ++it ) | 1169 | for ( ; it != allFirstNames.end(); ++it ) |
1158 | allSecondNames.append( *it ); | 1170 | allSecondNames.append( *it ); |
1159 | 1171 | ||
1160 | strMiddleName = allSecondNames.join(" "); | 1172 | strMiddleName = allSecondNames.join(" "); |
1161 | 1173 | ||
1162 | } else { | 1174 | } else { |
1163 | 1175 | ||
1164 | // No comma separator used: We use the first word as firstname, the | 1176 | // No comma separator used: We use the first word as firstname, the |
1165 | // last as second/lastname and everything in the middle as middlename | 1177 | // last as second/lastname and everything in the middle as middlename |
1166 | 1178 | ||
1167 | QStringList allNames = QStringList::split(" ", simplifiedName); | 1179 | QStringList allNames = QStringList::split(" ", simplifiedName); |
1168 | QStringList::Iterator it = allNames.begin(); | 1180 | QStringList::Iterator it = allNames.begin(); |
1169 | strFirstName = *it++; | 1181 | strFirstName = *it++; |
1170 | QStringList allSecondNames; | 1182 | QStringList allSecondNames; |
1171 | for ( ; it != --allNames.end(); ++it ) | 1183 | for ( ; it != --allNames.end(); ++it ) |
1172 | allSecondNames.append( *it ); | 1184 | allSecondNames.append( *it ); |
1173 | 1185 | ||
1174 | strMiddleName = allSecondNames.join(" "); | 1186 | strMiddleName = allSecondNames.join(" "); |
1175 | strLastName = *(--allNames.end()); | 1187 | strLastName = *(--allNames.end()); |
1176 | 1188 | ||
1177 | } | 1189 | } |
1178 | 1190 | ||
1179 | if ( strFirstName == strLastName ) | 1191 | if ( strFirstName == strLastName ) |
1180 | strFirstName = ""; | 1192 | strFirstName = ""; |
1181 | 1193 | ||
1182 | qWarning(" strFirstName: %s", strFirstName.latin1()); | 1194 | qWarning(" strFirstName: %s", strFirstName.latin1()); |
1183 | qWarning(" strMiddleName: %s", strMiddleName.latin1()); | 1195 | qWarning(" strMiddleName: %s", strMiddleName.latin1()); |
1184 | qWarning(" strLastName: %s", strLastName.latin1()); | 1196 | qWarning(" strLastName: %s", strLastName.latin1()); |
1185 | qWarning(" strTitle: %s", strTitle.latin1()); | 1197 | qWarning(" strTitle: %s", strTitle.latin1()); |
1186 | 1198 | ||
1187 | switch (type) { | 1199 | switch (type) { |
1188 | case NAME_FL: | 1200 | case NAME_FL: |
1189 | return strFirstName + " " + strLastName; | 1201 | return strFirstName + " " + strLastName; |
1190 | 1202 | ||
1191 | case NAME_LF: | 1203 | case NAME_LF: |
1192 | return strLastName + ", " + strFirstName; | 1204 | return strLastName + ", " + strFirstName; |
1193 | 1205 | ||
1194 | case NAME_LFM: | 1206 | case NAME_LFM: |
1195 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1207 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1196 | 1208 | ||
1197 | case NAME_FML: | 1209 | case NAME_FML: |
1198 | return strFirstName + " " + strMiddleName + " " + strLastName ; | 1210 | return strFirstName + " " + strMiddleName + " " + strLastName ; |
1199 | 1211 | ||
1200 | case NAME_F: | 1212 | case NAME_F: |
1201 | return strFirstName; | 1213 | return strFirstName; |
1202 | 1214 | ||
1203 | case NAME_M: | 1215 | case NAME_M: |
1204 | return strMiddleName; | 1216 | return strMiddleName; |
1205 | 1217 | ||
1206 | case NAME_L: | 1218 | case NAME_L: |
1207 | return strLastName; | 1219 | return strLastName; |
1208 | 1220 | ||
1209 | case NAME_S: | 1221 | case NAME_S: |
1210 | return txtSuffix->text(); | 1222 | return txtSuffix->text(); |
1211 | 1223 | ||
1212 | } | 1224 | } |
1213 | return QString::null; | 1225 | return QString::null; |
1214 | } | 1226 | } |
1215 | 1227 | ||
1216 | void ContactEditor::cleanupFields() { | 1228 | void ContactEditor::cleanupFields() { |
1217 | QStringList::Iterator it = slChooserValues.begin(); | 1229 | QStringList::Iterator it = slChooserValues.begin(); |
1218 | 1230 | ||
1219 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1231 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1220 | (*it) = ""; | 1232 | (*it) = ""; |
1221 | } | 1233 | } |
1222 | 1234 | ||
1223 | for ( int i = 0; i < 7; i++ ) { | 1235 | for ( int i = 0; i < 7; i++ ) { |
1224 | slHomeAddress[i] = ""; | 1236 | slHomeAddress[i] = ""; |
1225 | slBusinessAddress[i] = ""; | 1237 | slBusinessAddress[i] = ""; |
1226 | } | 1238 | } |
1227 | 1239 | ||
1228 | QListIterator<QLineEdit> itLV( listValue ); | 1240 | QListIterator<QLineEdit> itLV( listValue ); |
1229 | for ( ; itLV.current(); ++itLV ) { | 1241 | for ( ; itLV.current(); ++itLV ) { |
1230 | (*itLV)->setText( "" ); | 1242 | (*itLV)->setText( "" ); |
1231 | } | 1243 | } |
1232 | 1244 | ||
1233 | txtFirstName->setText(""); | 1245 | txtFirstName->setText(""); |
1234 | txtMiddleName->setText(""); | 1246 | txtMiddleName->setText(""); |
1235 | txtLastName->setText(""); | 1247 | txtLastName->setText(""); |
1236 | txtSuffix->setText(""); | 1248 | txtSuffix->setText(""); |
1237 | txtNote->setText(""); | 1249 | txtNote->setText(""); |
1238 | txtFullName->setText(""); | 1250 | txtFullName->setText(""); |
1239 | txtJobTitle->setText(""); | 1251 | txtJobTitle->setText(""); |
1240 | txtOrganization->setText(""); | 1252 | txtOrganization->setText(""); |
1241 | txtChooserField1->setText(""); | 1253 | txtChooserField1->setText(""); |
1242 | txtChooserField2->setText(""); | 1254 | txtChooserField2->setText(""); |
1243 | txtChooserField3->setText(""); | 1255 | txtChooserField3->setText(""); |
1244 | txtAddress->setText(""); | 1256 | txtAddress->setText(""); |
1245 | txtCity->setText(""); | 1257 | txtCity->setText(""); |
1246 | txtState->setText(""); | 1258 | txtState->setText(""); |
1247 | txtZip->setText(""); | 1259 | txtZip->setText(""); |
1248 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1260 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1249 | txtTmp->setText(""); | 1261 | txtTmp->setText(""); |
1250 | txtTmp = cmbFileAs->lineEdit(); | 1262 | txtTmp = cmbFileAs->lineEdit(); |
1251 | txtTmp->setText(""); | 1263 | txtTmp->setText(""); |
1252 | 1264 | ||
1253 | } | 1265 | } |
1254 | 1266 | ||
1255 | void ContactEditor::setEntry( const OContact &entry ) { | 1267 | void ContactEditor::setEntry( const OContact &entry ) { |
1256 | 1268 | ||
1257 | initializing = true; | 1269 | initializing = true; |
1258 | 1270 | ||
1259 | // Cleanup and activate the general Page .. | 1271 | // Cleanup and activate the general Page .. |
1260 | cleanupFields(); | 1272 | cleanupFields(); |
1261 | tabMain->setCurrentPage( 0 ); | 1273 | tabMain->setCurrentPage( 0 ); |
1262 | 1274 | ||
1263 | ent = entry; | 1275 | ent = entry; |
1264 | 1276 | ||
1265 | emails = QStringList(ent.emailList()); | 1277 | emails = QStringList(ent.emailList()); |
1266 | defaultEmail = ent.defaultEmail(); | 1278 | defaultEmail = ent.defaultEmail(); |
1267 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1279 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1268 | qDebug("default email=%s",defaultEmail.latin1()); | 1280 | qDebug("default email=%s",defaultEmail.latin1()); |
1269 | 1281 | ||
1270 | txtFirstName->setText( ent.firstName() ); | 1282 | txtFirstName->setText( ent.firstName() ); |
1271 | txtMiddleName->setText( ent.middleName() ); | 1283 | txtMiddleName->setText( ent.middleName() ); |
1272 | txtLastName->setText( ent.lastName() ); | 1284 | txtLastName->setText( ent.lastName() ); |
1273 | txtSuffix->setText( ent.suffix() ); | 1285 | txtSuffix->setText( ent.suffix() ); |
1274 | 1286 | ||
1275 | // QString *tmpString = new QString; | 1287 | // QString *tmpString = new QString; |
1276 | // *tmpString = ent.firstName() + " " + ent.middleName() + | 1288 | // *tmpString = ent.firstName() + " " + ent.middleName() + |
1277 | // + " " + ent.lastName() + " " + ent.suffix(); | 1289 | // + " " + ent.lastName() + " " + ent.suffix(); |
1278 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1290 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1279 | 1291 | ||
1280 | if ( !ent.isEmpty() ){ | 1292 | if ( !ent.isEmpty() ){ |
1281 | // Lastnames with multiple words need to be protected by a comma ! | 1293 | // Lastnames with multiple words need to be protected by a comma ! |
1282 | if ( ent.lastName().contains( ' ', TRUE ) ) | 1294 | if ( ent.lastName().contains( ' ', TRUE ) ) |
1283 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); | 1295 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); |
1284 | else | 1296 | else |
1285 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | 1297 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); |
1286 | } | 1298 | } |
1287 | 1299 | ||
1288 | cmbFileAs->setEditText( ent.fileAs() ); | 1300 | cmbFileAs->setEditText( ent.fileAs() ); |
1289 | 1301 | ||
1290 | //if (hasTitle) | 1302 | //if (hasTitle) |
1291 | txtJobTitle->setText( ent.jobTitle() ); | 1303 | txtJobTitle->setText( ent.jobTitle() ); |
1292 | 1304 | ||
1293 | //if (hasCompany) | 1305 | //if (hasCompany) |
1294 | txtOrganization->setText( ent.company() ); | 1306 | txtOrganization->setText( ent.company() ); |
1295 | 1307 | ||
1296 | //if (hasNotes) | 1308 | //if (hasNotes) |
1297 | txtNote->setText( ent.notes() ); | 1309 | txtNote->setText( ent.notes() ); |
1298 | 1310 | ||
1299 | //if (hasStreet) { | 1311 | //if (hasStreet) { |
1300 | slHomeAddress[0] = ent.homeStreet(); | 1312 | slHomeAddress[0] = ent.homeStreet(); |
1301 | slBusinessAddress[0] = ent.businessStreet(); | 1313 | slBusinessAddress[0] = ent.businessStreet(); |
1302 | //} | 1314 | //} |
1303 | 1315 | ||
1304 | //if (hasCity) { | 1316 | //if (hasCity) { |
1305 | slHomeAddress[3] = ent.homeCity(); | 1317 | slHomeAddress[3] = ent.homeCity(); |
1306 | slBusinessAddress[3] = ent.businessCity(); | 1318 | slBusinessAddress[3] = ent.businessCity(); |
1307 | //} | 1319 | //} |
1308 | 1320 | ||
1309 | //if (hasState) { | 1321 | //if (hasState) { |
1310 | slHomeAddress[4] = ent.homeState(); | 1322 | slHomeAddress[4] = ent.homeState(); |
1311 | slBusinessAddress[4] = ent.businessState(); | 1323 | slBusinessAddress[4] = ent.businessState(); |
1312 | //} | 1324 | //} |
1313 | 1325 | ||
1314 | //if (hasZip) { | 1326 | //if (hasZip) { |
1315 | slHomeAddress[5] = ent.homeZip(); | 1327 | slHomeAddress[5] = ent.homeZip(); |
1316 | slBusinessAddress[5] = ent.businessZip(); | 1328 | slBusinessAddress[5] = ent.businessZip(); |
1317 | //} | 1329 | //} |
1318 | 1330 | ||
1319 | //if (hasCountry) { | 1331 | //if (hasCountry) { |
1320 | slHomeAddress[6] = ent.homeCountry(); | 1332 | slHomeAddress[6] = ent.homeCountry(); |
1321 | slBusinessAddress[6] = ent.businessCountry(); | 1333 | slBusinessAddress[6] = ent.businessCountry(); |
1322 | //} | 1334 | //} |
1323 | 1335 | ||
1324 | QStringList::ConstIterator it; | 1336 | QStringList::ConstIterator it; |
1325 | QListIterator<QLineEdit> itLE( listValue ); | 1337 | QListIterator<QLineEdit> itLE( listValue ); |
1326 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { | 1338 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1327 | 1339 | ||
1328 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); | 1340 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); |
1329 | 1341 | ||
1330 | if ( *it == "Department" ) | 1342 | if ( *it == "Department" ) |
1331 | (*itLE)->setText( ent.department() ); | 1343 | (*itLE)->setText( ent.department() ); |
1332 | 1344 | ||
1333 | if ( *it == "Company" ) | 1345 | if ( *it == "Company" ) |
1334 | (*itLE)->setText( ent.company() ); | 1346 | (*itLE)->setText( ent.company() ); |
1335 | 1347 | ||
1336 | if ( *it == "Office" ) | 1348 | if ( *it == "Office" ) |
1337 | (*itLE)->setText( ent.office() ); | 1349 | (*itLE)->setText( ent.office() ); |
1338 | 1350 | ||
1339 | if ( *it == "Profession" ) | 1351 | if ( *it == "Profession" ) |
1340 | (*itLE)->setText( ent.profession() ); | 1352 | (*itLE)->setText( ent.profession() ); |
1341 | 1353 | ||
1342 | if ( *it == "Assistant" ) | 1354 | if ( *it == "Assistant" ) |
1343 | (*itLE)->setText( ent.assistant() ); | 1355 | (*itLE)->setText( ent.assistant() ); |
1344 | 1356 | ||
1345 | if ( *it == "Manager" ) | 1357 | if ( *it == "Manager" ) |
1346 | (*itLE)->setText( ent.manager() ); | 1358 | (*itLE)->setText( ent.manager() ); |
1347 | 1359 | ||
1348 | if ( *it == "Spouse" ) | 1360 | if ( *it == "Spouse" ) |
1349 | (*itLE)->setText( ent.spouse() ); | 1361 | (*itLE)->setText( ent.spouse() ); |
1350 | 1362 | ||
1351 | if ( *it == "Nickname" ){ | 1363 | if ( *it == "Nickname" ){ |
1352 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); | 1364 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); |
1353 | (*itLE)->setText( ent.nickname() ); | 1365 | (*itLE)->setText( ent.nickname() ); |
1354 | } | 1366 | } |
1355 | 1367 | ||
1356 | if ( *it == "Children" ) | 1368 | if ( *it == "Children" ) |
1357 | (*itLE)->setText( ent.children() ); | 1369 | (*itLE)->setText( ent.children() ); |
1358 | 1370 | ||
1359 | } | 1371 | } |
1360 | 1372 | ||
1361 | QStringList::Iterator itV; | 1373 | QStringList::Iterator itV; |
1362 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1374 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1363 | 1375 | ||
1364 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1376 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1365 | *itV = ent.businessPhone(); | 1377 | *itV = ent.businessPhone(); |
1366 | /* | 1378 | /* |
1367 | if ( *it == "Business 2 Phone" ) | 1379 | if ( *it == "Business 2 Phone" ) |
1368 | *itV = ent.business2Phone(); | 1380 | *itV = ent.business2Phone(); |
1369 | */ | 1381 | */ |
1370 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1382 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1371 | *itV = ent.businessFax(); | 1383 | *itV = ent.businessFax(); |
1372 | 1384 | ||
1373 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1385 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1374 | *itV = ent.businessMobile(); | 1386 | *itV = ent.businessMobile(); |
1375 | /* | 1387 | /* |
1376 | if ( *it == "Company Phone" ) | 1388 | if ( *it == "Company Phone" ) |
1377 | *itV = ent.companyPhone(); | 1389 | *itV = ent.companyPhone(); |
1378 | */ | 1390 | */ |
1379 | if ( *it == "Default Email" ) | 1391 | if ( *it == "Default Email" ) |
1380 | *itV = ent.defaultEmail(); | 1392 | *itV = ent.defaultEmail(); |
1381 | 1393 | ||
1382 | if ( *it == "Emails" ) | 1394 | if ( *it == "Emails" ) |
1383 | *itV = ent.emailList().join(", "); // :SX | 1395 | *itV = ent.emailList().join(", "); // :SX |
1384 | 1396 | ||
1385 | if ( *it == "Home Phone" ) | 1397 | if ( *it == "Home Phone" ) |
1386 | *itV = ent.homePhone(); | 1398 | *itV = ent.homePhone(); |
1387 | /* | 1399 | /* |
1388 | if ( *it == "Home 2 Phone" ) | 1400 | if ( *it == "Home 2 Phone" ) |
1389 | *itV = ent.home2Phone(); | 1401 | *itV = ent.home2Phone(); |
1390 | */ | 1402 | */ |
1391 | if ( *it == "Home Fax" ) | 1403 | if ( *it == "Home Fax" ) |
1392 | *itV = ent.homeFax(); | 1404 | *itV = ent.homeFax(); |
1393 | 1405 | ||
1394 | if ( *it == "Home Mobile" ) | 1406 | if ( *it == "Home Mobile" ) |
1395 | *itV = ent.homeMobile(); | 1407 | *itV = ent.homeMobile(); |
1396 | /* | 1408 | /* |
1397 | if ( *it == "Car Phone" ) | 1409 | if ( *it == "Car Phone" ) |
1398 | *itV = ent.carPhone(); | 1410 | *itV = ent.carPhone(); |
1399 | 1411 | ||
1400 | if ( *it == "ISDN Phone" ) | 1412 | if ( *it == "ISDN Phone" ) |
1401 | *itV = ent.ISDNPhone(); | 1413 | *itV = ent.ISDNPhone(); |
1402 | 1414 | ||
1403 | if ( *it == "Other Phone" ) | 1415 | if ( *it == "Other Phone" ) |
1404 | *itV = ent.otherPhone(); | 1416 | *itV = ent.otherPhone(); |
1405 | */ | 1417 | */ |
1406 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1418 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1407 | *itV = ent.businessPager(); | 1419 | *itV = ent.businessPager(); |
1408 | /* | 1420 | /* |
1409 | if ( *it == "Home Pager") | 1421 | if ( *it == "Home Pager") |
1410 | *itV = ent.homePager(); | 1422 | *itV = ent.homePager(); |
1411 | 1423 | ||
1412 | if ( *it == "AIM IM" ) | 1424 | if ( *it == "AIM IM" ) |
1413 | *itV = ent.AIMIM(); | 1425 | *itV = ent.AIMIM(); |
1414 | 1426 | ||
1415 | if ( *it == "ICQ IM" ) | 1427 | if ( *it == "ICQ IM" ) |
1416 | *itV = ent.ICQIM(); | 1428 | *itV = ent.ICQIM(); |
1417 | 1429 | ||
1418 | if ( *it == "Jabber IM" ) | 1430 | if ( *it == "Jabber IM" ) |
1419 | *itV = ent.jabberIM(); | 1431 | *itV = ent.jabberIM(); |
1420 | 1432 | ||
1421 | if ( *it == "MSN IM" ) | 1433 | if ( *it == "MSN IM" ) |
1422 | *itV = ent.MSNIM(); | 1434 | *itV = ent.MSNIM(); |
1423 | 1435 | ||
1424 | if ( *it == "Yahoo IM" ) | 1436 | if ( *it == "Yahoo IM" ) |
1425 | *itV = ent.yahooIM(); | 1437 | *itV = ent.yahooIM(); |
1426 | */ | 1438 | */ |
1427 | if ( *it == "Home Web Page" ) | 1439 | if ( *it == "Home Web Page" ) |
1428 | *itV = ent.homeWebpage(); | 1440 | *itV = ent.homeWebpage(); |
1429 | 1441 | ||
1430 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1442 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1431 | *itV = ent.businessWebpage(); | 1443 | *itV = ent.businessWebpage(); |
1432 | 1444 | ||
1433 | 1445 | ||
1434 | } | 1446 | } |
1435 | 1447 | ||
1436 | 1448 | ||
1437 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1449 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1438 | 1450 | ||
1439 | QString gender = ent.gender(); | 1451 | QString gender = ent.gender(); |
1440 | cmbGender->setCurrentItem( gender.toInt() ); | 1452 | cmbGender->setCurrentItem( gender.toInt() ); |
1441 | 1453 | ||
1442 | txtNote->setText( ent.notes() ); | 1454 | txtNote->setText( ent.notes() ); |
1443 | 1455 | ||
1444 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1456 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1445 | 1457 | ||
1446 | // Get combo-settings from contact and set preset.. | 1458 | // Get combo-settings from contact and set preset.. |
1447 | contactfields.loadFromRecord( ent ); | 1459 | contactfields.loadFromRecord( ent ); |
1448 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); | 1460 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); |
1449 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); | 1461 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); |
1450 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); | 1462 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); |
1451 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); | 1463 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); |
1452 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); | 1464 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); |
1453 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1465 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1454 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1466 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1455 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1467 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1456 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); | 1468 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); |
1457 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1469 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1458 | 1470 | ||
1459 | updateDatePicker(); | 1471 | updateDatePicker(); |
1460 | 1472 | ||
1461 | initializing = false; | 1473 | initializing = false; |
1462 | } | 1474 | } |
1463 | void ContactEditor::updateDatePicker() | 1475 | void ContactEditor::updateDatePicker() |
1464 | { | 1476 | { |
1465 | // Set DatePicker | 1477 | // Set DatePicker |
1466 | if ( !ent.birthday().isNull() ){ | 1478 | if ( !ent.birthday().isNull() ){ |
1467 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); | 1479 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); |
1468 | birthdayPicker->setDate( ent.birthday() ); | 1480 | birthdayPicker->setDate( ent.birthday() ); |
1469 | } else | 1481 | } else |
1470 | birthdayButton->setText( tr ("Unknown") ); | 1482 | birthdayButton->setText( tr ("Unknown") ); |
1471 | 1483 | ||
1472 | if ( !ent.anniversary().isNull() ){ | 1484 | if ( !ent.anniversary().isNull() ){ |
1473 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); | 1485 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); |
1474 | anniversaryPicker->setDate( ent.anniversary() ); | 1486 | anniversaryPicker->setDate( ent.anniversary() ); |
1475 | } else | 1487 | } else |
1476 | anniversaryButton->setText( tr ("Unknown") ); | 1488 | anniversaryButton->setText( tr ("Unknown") ); |
1477 | 1489 | ||
1478 | } | 1490 | } |
1479 | 1491 | ||
1480 | void ContactEditor::saveEntry() { | 1492 | void ContactEditor::saveEntry() { |
1481 | 1493 | ||
1482 | // Store current combo into contact | 1494 | // Store current combo into contact |
1483 | contactfields.saveToRecord( ent ); | 1495 | contactfields.saveToRecord( ent ); |
1484 | 1496 | ||
1485 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1497 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1486 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1498 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1487 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1499 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1488 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1500 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1489 | 1501 | ||
1490 | ent.setFirstName( txtFirstName->text() ); | 1502 | ent.setFirstName( txtFirstName->text() ); |
1491 | ent.setLastName( txtLastName->text() ); | 1503 | ent.setLastName( txtLastName->text() ); |
1492 | ent.setMiddleName( txtMiddleName->text() ); | 1504 | ent.setMiddleName( txtMiddleName->text() ); |
1493 | ent.setSuffix( txtSuffix->text() ); | 1505 | ent.setSuffix( txtSuffix->text() ); |
1494 | 1506 | ||
1495 | ent.setFileAs( cmbFileAs->currentText() ); | 1507 | ent.setFileAs( cmbFileAs->currentText() ); |
1496 | 1508 | ||
1497 | ent.setCategories( cmbCat->currentCategories() ); | 1509 | ent.setCategories( cmbCat->currentCategories() ); |
1498 | 1510 | ||
1499 | 1511 | ||
1500 | //if (hasTitle) | 1512 | //if (hasTitle) |
1501 | ent.setJobTitle( txtJobTitle->text() ); | 1513 | ent.setJobTitle( txtJobTitle->text() ); |
1502 | 1514 | ||
1503 | //if (hasCompany) | 1515 | //if (hasCompany) |
1504 | ent.setCompany( txtOrganization->text() ); | 1516 | ent.setCompany( txtOrganization->text() ); |
1505 | 1517 | ||
1506 | //if (hasNotes) | 1518 | //if (hasNotes) |
1507 | ent.setNotes( txtNote->text() ); | 1519 | ent.setNotes( txtNote->text() ); |
1508 | 1520 | ||
1509 | //if (hasStreet) { | 1521 | //if (hasStreet) { |
1510 | ent.setHomeStreet( slHomeAddress[0] ); | 1522 | ent.setHomeStreet( slHomeAddress[0] ); |
1511 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1523 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1512 | //} | 1524 | //} |
1513 | 1525 | ||
1514 | //if (hasCity) { | 1526 | //if (hasCity) { |
1515 | ent.setHomeCity( slHomeAddress[3] ); | 1527 | ent.setHomeCity( slHomeAddress[3] ); |
1516 | ent.setBusinessCity( slBusinessAddress[3] ); | 1528 | ent.setBusinessCity( slBusinessAddress[3] ); |
1517 | //} | 1529 | //} |
1518 | 1530 | ||
1519 | //if (hasState) { | 1531 | //if (hasState) { |
1520 | ent.setHomeState( slHomeAddress[4] ); | 1532 | ent.setHomeState( slHomeAddress[4] ); |
1521 | ent.setBusinessState( slBusinessAddress[4] ); | 1533 | ent.setBusinessState( slBusinessAddress[4] ); |
1522 | //} | 1534 | //} |
1523 | 1535 | ||
1524 | //if (hasZip) { | 1536 | //if (hasZip) { |
1525 | ent.setHomeZip( slHomeAddress[5] ); | 1537 | ent.setHomeZip( slHomeAddress[5] ); |
1526 | ent.setBusinessZip( slBusinessAddress[5] ); | 1538 | ent.setBusinessZip( slBusinessAddress[5] ); |
1527 | //} | 1539 | //} |
1528 | 1540 | ||
1529 | //if (hasCountry) { | 1541 | //if (hasCountry) { |
1530 | ent.setHomeCountry( slHomeAddress[6] ); | 1542 | ent.setHomeCountry( slHomeAddress[6] ); |
1531 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1543 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1532 | //} | 1544 | //} |
1533 | 1545 | ||
1534 | QStringList::ConstIterator it; | 1546 | QStringList::ConstIterator it; |
1535 | QListIterator<QLineEdit> itLE( listValue ); | 1547 | QListIterator<QLineEdit> itLE( listValue ); |
1536 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { | 1548 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { |
1537 | 1549 | ||
1538 | if ( *it == "Department" ) | 1550 | if ( *it == "Department" ) |
1539 | ent.setDepartment( (*itLE)->text() ); | 1551 | ent.setDepartment( (*itLE)->text() ); |
1540 | 1552 | ||
1541 | if ( *it == "Company" ) | 1553 | if ( *it == "Company" ) |
1542 | ent.setCompany( (*itLE)->text() ); | 1554 | ent.setCompany( (*itLE)->text() ); |
1543 | 1555 | ||
1544 | if ( *it == "Office" ) | 1556 | if ( *it == "Office" ) |
1545 | ent.setOffice( (*itLE)->text() ); | 1557 | ent.setOffice( (*itLE)->text() ); |
1546 | 1558 | ||
1547 | if ( *it == "Profession" ) | 1559 | if ( *it == "Profession" ) |
1548 | ent.setProfession( (*itLE)->text() ); | 1560 | ent.setProfession( (*itLE)->text() ); |
1549 | 1561 | ||
1550 | if ( *it == "Assistant" ) | 1562 | if ( *it == "Assistant" ) |
1551 | ent.setAssistant( (*itLE)->text() ); | 1563 | ent.setAssistant( (*itLE)->text() ); |
1552 | 1564 | ||
1553 | if ( *it == "Manager" ) | 1565 | if ( *it == "Manager" ) |
1554 | ent.setManager( (*itLE)->text() ); | 1566 | ent.setManager( (*itLE)->text() ); |
1555 | 1567 | ||
1556 | if ( *it == "Spouse" ) | 1568 | if ( *it == "Spouse" ) |
1557 | ent.setSpouse( (*itLE)->text() ); | 1569 | ent.setSpouse( (*itLE)->text() ); |
1558 | 1570 | ||
1559 | if ( *it == "Nickname" ) | 1571 | if ( *it == "Nickname" ) |
1560 | ent.setNickname( (*itLE)->text() ); | 1572 | ent.setNickname( (*itLE)->text() ); |
1561 | 1573 | ||
1562 | if ( *it == "Children" ) | 1574 | if ( *it == "Children" ) |
1563 | ent.setChildren( (*itLE)->text() ); | 1575 | ent.setChildren( (*itLE)->text() ); |
1564 | 1576 | ||
1565 | } | 1577 | } |
1566 | 1578 | ||
1567 | 1579 | ||
1568 | QStringList::ConstIterator itV; | 1580 | QStringList::ConstIterator itV; |
1569 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1581 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1570 | 1582 | ||
1571 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1583 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1572 | ent.setBusinessPhone( *itV ); | 1584 | ent.setBusinessPhone( *itV ); |
1573 | 1585 | ||
1574 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1586 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1575 | ent.setBusinessFax( *itV ); | 1587 | ent.setBusinessFax( *itV ); |
1576 | 1588 | ||
1577 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1589 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1578 | ent.setBusinessMobile( *itV ); | 1590 | ent.setBusinessMobile( *itV ); |
1579 | 1591 | ||
1580 | if ( *it == "Emails" ){ | 1592 | if ( *it == "Emails" ){ |
1581 | QString allemail; | 1593 | QString allemail; |
1582 | QString defaultmail; | 1594 | QString defaultmail; |
1583 | parseEmailFrom( emails.join(","), defaultmail, allemail ); | 1595 | parseEmailFrom( emails.join(","), defaultmail, allemail ); |
1584 | if ( defaultEmail.isEmpty() ){ | 1596 | if ( defaultEmail.isEmpty() ){ |
1585 | qWarning("Default email was not set by user!"); | 1597 | qWarning("Default email was not set by user!"); |
1586 | qWarning("Using first email in list: %s", defaultmail.latin1()); | 1598 | qWarning("Using first email in list: %s", defaultmail.latin1()); |
1587 | ent.setDefaultEmail( defaultmail ); | 1599 | ent.setDefaultEmail( defaultmail ); |
1588 | } | 1600 | } |
1589 | ent.setEmails( allemail ); | 1601 | ent.setEmails( allemail ); |
1590 | } | 1602 | } |
1591 | 1603 | ||
1592 | if ( *it == "Default Email") | 1604 | if ( *it == "Default Email") |
1593 | ent.setDefaultEmail( defaultEmail /* *itV */ ); | 1605 | ent.setDefaultEmail( defaultEmail /* *itV */ ); |
1594 | 1606 | ||
1595 | if ( *it == "Home Phone" ) | 1607 | if ( *it == "Home Phone" ) |
1596 | ent.setHomePhone( *itV ); | 1608 | ent.setHomePhone( *itV ); |
1597 | 1609 | ||
1598 | if ( *it == "Home Fax" ) | 1610 | if ( *it == "Home Fax" ) |
1599 | ent.setHomeFax( *itV ); | 1611 | ent.setHomeFax( *itV ); |
1600 | 1612 | ||
1601 | if ( *it == "Home Mobile" ) | 1613 | if ( *it == "Home Mobile" ) |
1602 | ent.setHomeMobile( *itV ); | 1614 | ent.setHomeMobile( *itV ); |
1603 | 1615 | ||
1604 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1616 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1605 | ent.setBusinessPager( *itV ); | 1617 | ent.setBusinessPager( *itV ); |
1606 | 1618 | ||
1607 | if ( *it == "Home Web Page" ) | 1619 | if ( *it == "Home Web Page" ) |
1608 | ent.setHomeWebpage( *itV ); | 1620 | ent.setHomeWebpage( *itV ); |
1609 | 1621 | ||
1610 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1622 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1611 | ent.setBusinessWebpage( *itV ); | 1623 | ent.setBusinessWebpage( *itV ); |
1612 | 1624 | ||
1613 | 1625 | ||
1614 | } | 1626 | } |
1615 | 1627 | ||
1616 | int gender = cmbGender->currentItem(); | 1628 | int gender = cmbGender->currentItem(); |
1617 | ent.setGender( QString::number( gender ) ); | 1629 | ent.setGender( QString::number( gender ) ); |
1618 | 1630 | ||
1619 | QString str = txtNote->text(); | 1631 | QString str = txtNote->text(); |
1620 | if ( !str.isNull() ) | 1632 | if ( !str.isNull() ) |
1621 | ent.setNotes( str ); | 1633 | ent.setNotes( str ); |
1622 | 1634 | ||
1623 | } | 1635 | } |
1624 | 1636 | ||
1625 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1637 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1626 | QString &strAll ) | 1638 | QString &strAll ) |
1627 | { | 1639 | { |
1628 | int where, | 1640 | int where, |
1629 | start; | 1641 | start; |
1630 | if ( txt.isEmpty() ) | 1642 | if ( txt.isEmpty() ) |
1631 | return; | 1643 | return; |
1632 | // find the first | 1644 | // find the first |
1633 | where = txt.find( ',' ); | 1645 | where = txt.find( ',' ); |
1634 | if ( where < 0 ) { | 1646 | if ( where < 0 ) { |
1635 | strDefaultEmail = txt; | 1647 | strDefaultEmail = txt; |
1636 | strAll = txt; | 1648 | strAll = txt; |
1637 | } else { | 1649 | } else { |
1638 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1650 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1639 | strAll = strDefaultEmail; | 1651 | strAll = strDefaultEmail; |
1640 | while ( where > -1 ) { | 1652 | while ( where > -1 ) { |
1641 | strAll.append(" "); | 1653 | strAll.append(" "); |
1642 | start = where; | 1654 | start = where; |
1643 | where = txt.find( ',', where + 1 ); | 1655 | where = txt.find( ',', where + 1 ); |
1644 | if ( where > - 1 ) | 1656 | if ( where > - 1 ) |
1645 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1657 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1646 | else // grab until the end... | 1658 | else // grab until the end... |
1647 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1659 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1648 | } | 1660 | } |
1649 | } | 1661 | } |
1650 | } | 1662 | } |
1651 | 1663 | ||
1652 | void parseEmailTo( const QString &strDefaultEmail, | 1664 | void parseEmailTo( const QString &strDefaultEmail, |
1653 | const QString &strOtherEmail, QString &strBack ) | 1665 | const QString &strOtherEmail, QString &strBack ) |
1654 | { | 1666 | { |
1655 | // create a comma dilimeted set of emails... | 1667 | // create a comma dilimeted set of emails... |
1656 | // use the power of short circuiting... | 1668 | // use the power of short circuiting... |
1657 | bool foundDefault = false; | 1669 | bool foundDefault = false; |
1658 | QString strTmp; | 1670 | QString strTmp; |
1659 | int start = 0; | 1671 | int start = 0; |
1660 | int where; | 1672 | int where; |
1661 | // start at the beginng. | 1673 | // start at the beginng. |
1662 | strBack = strDefaultEmail; | 1674 | strBack = strDefaultEmail; |
1663 | where = 0; | 1675 | where = 0; |
1664 | while ( where > -1 ) { | 1676 | while ( where > -1 ) { |
1665 | start = where; | 1677 | start = where; |
1666 | where = strOtherEmail.find( ' ', where + 1 ); | 1678 | where = strOtherEmail.find( ' ', where + 1 ); |
1667 | if ( where > 0 ) { | 1679 | if ( where > 0 ) { |
1668 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1680 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1669 | } else | 1681 | } else |
1670 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 1682 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
1671 | if ( foundDefault || strTmp != strDefaultEmail ) { | 1683 | if ( foundDefault || strTmp != strDefaultEmail ) { |
1672 | strBack.append( ", " ); | 1684 | strBack.append( ", " ); |
1673 | strBack.append( strTmp ); | 1685 | strBack.append( strTmp ); |
1674 | } else | 1686 | } else |
1675 | foundDefault = true; | 1687 | foundDefault = true; |
1676 | } | 1688 | } |
1677 | } | 1689 | } |
1678 | 1690 | ||
1679 | 1691 | ||
1680 | static inline bool containsAlphaNum( const QString &str ) | 1692 | static inline bool containsAlphaNum( const QString &str ) |
1681 | { | 1693 | { |
1682 | int i, | 1694 | int i, |
1683 | count = str.length(); | 1695 | count = str.length(); |
1684 | for ( i = 0; i < count; i++ ) | 1696 | for ( i = 0; i < count; i++ ) |
1685 | if ( !str[i].isSpace() ) | 1697 | if ( !str[i].isSpace() ) |
1686 | return TRUE; | 1698 | return TRUE; |
1687 | return FALSE; | 1699 | return FALSE; |
1688 | } | 1700 | } |
1689 | 1701 | ||
1690 | static inline bool constainsWhiteSpace( const QString &str ) | 1702 | static inline bool constainsWhiteSpace( const QString &str ) |
1691 | { | 1703 | { |
1692 | int i, | 1704 | int i, |
1693 | count = str.length(); | 1705 | count = str.length(); |
1694 | for (i = 0; i < count; i++ ) | 1706 | for (i = 0; i < count; i++ ) |
1695 | if ( str[i].isSpace() ) | 1707 | if ( str[i].isSpace() ) |
1696 | return TRUE; | 1708 | return TRUE; |
1697 | return FALSE; | 1709 | return FALSE; |
1698 | } | 1710 | } |
1699 | 1711 | ||
1700 | void ContactEditor::setPersonalView( bool personal ) | 1712 | void ContactEditor::setPersonalView( bool personal ) |
1701 | { | 1713 | { |
1702 | m_personalView = personal; | 1714 | m_personalView = personal; |
1703 | 1715 | ||
1704 | // Currently disbled due to the fact that | 1716 | // Currently disbled due to the fact that |
1705 | // show will not work... | 1717 | // show will not work... |
1706 | return; | 1718 | return; |
1707 | 1719 | ||
1708 | if ( personal ){ | 1720 | if ( personal ){ |
1709 | cmbCat->hide(); | 1721 | cmbCat->hide(); |
1710 | labCat->hide(); | 1722 | labCat->hide(); |
1711 | 1723 | ||
1712 | } else{ | 1724 | } else{ |
1713 | cmbCat->show(); | 1725 | cmbCat->show(); |
1714 | labCat->show(); | 1726 | labCat->show(); |
1715 | } | 1727 | } |
1716 | } | 1728 | } |
1717 | 1729 | ||
1718 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) | 1730 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) |
1719 | { | 1731 | { |
1720 | QDate date; | 1732 | QDate date; |
1721 | date.setYMD( year, month, day ); | 1733 | date.setYMD( year, month, day ); |
1722 | QString dateString = TimeString::numberDateString( date ); | 1734 | QString dateString = TimeString::numberDateString( date ); |
1723 | anniversaryButton->setText( dateString ); | 1735 | anniversaryButton->setText( dateString ); |
1724 | ent.setAnniversary ( date ); | 1736 | ent.setAnniversary ( date ); |
1725 | } | 1737 | } |
1726 | 1738 | ||
1727 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) | 1739 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) |
1728 | { | 1740 | { |
1729 | QDate date; | 1741 | QDate date; |
1730 | date.setYMD( year, month, day ); | 1742 | date.setYMD( year, month, day ); |
1731 | QString dateString = TimeString::numberDateString( date ); | 1743 | QString dateString = TimeString::numberDateString( date ); |
1732 | birthdayButton->setText( dateString ); | 1744 | birthdayButton->setText( dateString ); |
1733 | ent.setBirthday ( date ); | 1745 | ent.setBirthday ( date ); |
1734 | } | 1746 | } |
1735 | 1747 | ||
1736 | void ContactEditor::slotRemoveBirthday() | 1748 | void ContactEditor::slotRemoveBirthday() |
1737 | { | 1749 | { |
1738 | qWarning("void ContactEditor::slotRemoveBirthday()"); | 1750 | qWarning("void ContactEditor::slotRemoveBirthday()"); |
1739 | ent.setBirthday( QDate() ); | 1751 | ent.setBirthday( QDate() ); |
1740 | updateDatePicker(); | 1752 | updateDatePicker(); |
1741 | } | 1753 | } |
1742 | 1754 | ||
1743 | void ContactEditor::slotRemoveAnniversary() | 1755 | void ContactEditor::slotRemoveAnniversary() |
1744 | { | 1756 | { |
1745 | qWarning("void ContactEditor::slotRemoveAnniversary()"); | 1757 | qWarning("void ContactEditor::slotRemoveAnniversary()"); |
1746 | ent.setAnniversary( QDate() ); | 1758 | ent.setAnniversary( QDate() ); |
1747 | updateDatePicker(); | 1759 | updateDatePicker(); |
1748 | } | 1760 | } |
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index c6fa48f..e7432ee 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h | |||
@@ -1,191 +1,192 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * | 3 | * |
4 | * This file is an add-on for the OPIE Palmtop Environment | 4 | * This file is an add-on for the OPIE Palmtop Environment |
5 | * | 5 | * |
6 | * This file may be distributed and/or modified under the terms of the | 6 | * This file may be distributed and/or modified under the terms of the |
7 | * GNU General Public License version 2 as published by the Free Software | 7 | * GNU General Public License version 2 as published by the Free Software |
8 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging | 8 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
9 | * of this file. | 9 | * of this file. |
10 | * | 10 | * |
11 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | * | 13 | * |
14 | * | 14 | * |
15 | * This is a rewrite of the abeditor.h file, modified to provide a more | 15 | * This is a rewrite of the abeditor.h file, modified to provide a more |
16 | * intuitive interface to TrollTech's original Address Book editor. This | 16 | * intuitive interface to TrollTech's original Address Book editor. This |
17 | * is made to operate exactly in interface with the exception of name. | 17 | * is made to operate exactly in interface with the exception of name. |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef CONTACTEDITOR_H | 21 | #ifndef CONTACTEDITOR_H |
22 | #define CONTACTEDITOR_H | 22 | #define CONTACTEDITOR_H |
23 | 23 | ||
24 | #include <opie/ocontact.h> | 24 | #include <opie/ocontact.h> |
25 | 25 | ||
26 | #include <qpe/datebookmonth.h> | 26 | #include <qpe/datebookmonth.h> |
27 | 27 | ||
28 | #include <qdialog.h> | 28 | #include <qdialog.h> |
29 | #include <qlist.h> | 29 | #include <qlist.h> |
30 | #include <qmap.h> | 30 | #include <qmap.h> |
31 | #include <qstringlist.h> | 31 | #include <qstringlist.h> |
32 | #include <qwidgetstack.h> | 32 | #include <qwidgetstack.h> |
33 | 33 | ||
34 | #include "ocontactfields.h" | 34 | #include "ocontactfields.h" |
35 | 35 | ||
36 | const int NAME_LF = 0; | 36 | const int NAME_LF = 0; |
37 | const int NAME_LFM = 1; | 37 | const int NAME_LFM = 1; |
38 | const int NAME_FL = 2; | 38 | const int NAME_FL = 2; |
39 | const int NAME_FML = 3; | 39 | const int NAME_FML = 3; |
40 | 40 | ||
41 | const int NAME_F = 4; | 41 | const int NAME_F = 4; |
42 | const int NAME_M = 5; | 42 | const int NAME_M = 5; |
43 | const int NAME_L = 6; | 43 | const int NAME_L = 6; |
44 | const int NAME_S = 7; | 44 | const int NAME_S = 7; |
45 | 45 | ||
46 | 46 | ||
47 | class QScrollView; | 47 | class QScrollView; |
48 | class QTabWidget; | 48 | class QTabWidget; |
49 | class QMultiLineEdit; | 49 | class QMultiLineEdit; |
50 | class QLineEdit; | 50 | class QLineEdit; |
51 | class QComboBox; | 51 | class QComboBox; |
52 | class QPushButton; | 52 | class QPushButton; |
53 | class CategorySelect; | 53 | class CategorySelect; |
54 | class QLabel; | 54 | class QLabel; |
55 | 55 | ||
56 | class ContactEditor : public QDialog { | 56 | class ContactEditor : public QDialog { |
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | 58 | ||
59 | public: | 59 | public: |
60 | ContactEditor(const OContact &entry, | 60 | ContactEditor(const OContact &entry, |
61 | QWidget *parent = 0, | 61 | QWidget *parent = 0, |
62 | const char *name = 0, | 62 | const char *name = 0, |
63 | WFlags fl = 0 ); | 63 | WFlags fl = 0 ); |
64 | ~ContactEditor(); | 64 | ~ContactEditor(); |
65 | void setNameFocus(); | 65 | void setNameFocus(); |
66 | void setPersonalView( bool personal = true ); | 66 | void setPersonalView( bool personal = true ); |
67 | OContact entry() const { return ent; } | 67 | OContact entry() const { return ent; } |
68 | 68 | ||
69 | public slots: | 69 | public slots: |
70 | void slotNote(); | 70 | void slotNote(); |
71 | void slotName(); | 71 | void slotName(); |
72 | void setEntry(const OContact &entry); | 72 | void setEntry(const OContact &entry); |
73 | 73 | ||
74 | protected slots: | 74 | protected slots: |
75 | void accept(); | 75 | void accept(); |
76 | 76 | ||
77 | private: | 77 | private: |
78 | void init(); | 78 | void init(); |
79 | void saveEntry(); | 79 | void saveEntry(); |
80 | bool isEmpty(); | 80 | bool isEmpty(); |
81 | void cleanupFields(); | 81 | void cleanupFields(); |
82 | void updateDatePicker(); | 82 | void updateDatePicker(); |
83 | QString parseName( QString fullName, int type ); | 83 | QString parseName( QString fullName, int type ); |
84 | void chooserError( int index ); | 84 | void chooserError( int index ); |
85 | private slots: | 85 | private slots: |
86 | void slotChooser1Change( const QString &textChanged ); | 86 | void slotChooser1Change( const QString &textChanged ); |
87 | void slotChooser2Change( const QString &textChanged ); | 87 | void slotChooser2Change( const QString &textChanged ); |
88 | void slotChooser3Change( const QString &textChanged ); | 88 | void slotChooser3Change( const QString &textChanged ); |
89 | void slotChooser4Change( const QString &textChanged ); | 89 | void slotChooser4Change( const QString &textChanged ); |
90 | void slotCmbChooser1Change( int index ); | 90 | void slotCmbChooser1Change( int index ); |
91 | void slotCmbChooser2Change( int index ); | 91 | void slotCmbChooser2Change( int index ); |
92 | void slotCmbChooser3Change( int index ); | 92 | void slotCmbChooser3Change( int index ); |
93 | void slotCmbChooser4Change( int index ); | 93 | void slotCmbChooser4Change( int index ); |
94 | void slotAddressTypeChange( int index ); | 94 | void slotAddressTypeChange( int index ); |
95 | void slotAddressChange( const QString &textChanged ); | 95 | void slotAddressChange( const QString &textChanged ); |
96 | void slotAddress2Change( const QString &textChanged ); | 96 | void slotAddress2Change( const QString &textChanged ); |
97 | void slotPOBoxChange( const QString &textChanged ); | 97 | void slotPOBoxChange( const QString &textChanged ); |
98 | void slotCityChange( const QString &textChanged ); | 98 | void slotCityChange( const QString &textChanged ); |
99 | void slotStateChange( const QString &textChanged ); | 99 | void slotStateChange( const QString &textChanged ); |
100 | void slotZipChange( const QString &textChanged ); | 100 | void slotZipChange( const QString &textChanged ); |
101 | void slotCountryChange( const QString &textChanged ); | 101 | void slotCountryChange( const QString &textChanged ); |
102 | void slotFullNameChange( const QString &textChanged ); | 102 | void slotFullNameChange( const QString &textChanged ); |
103 | void slotSuffixChange( const QString &textChanged ); | 103 | void slotSuffixChange( const QString &textChanged ); |
104 | void slotOrganizationChange( const QString &textChanged ); | ||
104 | void slotAnniversaryDateChanged( int year, int month, int day); | 105 | void slotAnniversaryDateChanged( int year, int month, int day); |
105 | void slotBirthdayDateChanged( int year, int month, int day); | 106 | void slotBirthdayDateChanged( int year, int month, int day); |
106 | void slotRemoveBirthday(); | 107 | void slotRemoveBirthday(); |
107 | void slotRemoveAnniversary(); | 108 | void slotRemoveAnniversary(); |
108 | void defaultEmailChanged(int); | 109 | void defaultEmailChanged(int); |
109 | 110 | ||
110 | private: | 111 | private: |
111 | enum StackWidgets { TextField = 1, Combo }; | 112 | enum StackWidgets { TextField = 1, Combo }; |
112 | int defaultEmailChooserPosition; | 113 | int defaultEmailChooserPosition; |
113 | void populateDefaultEmailCmb(); | 114 | void populateDefaultEmailCmb(); |
114 | void chooserChange( const QString&, int , QLineEdit*, int ); | 115 | void chooserChange( const QString&, int , QLineEdit*, int ); |
115 | bool cmbChooserChange( int , QWidgetStack*, int ); | 116 | bool cmbChooserChange( int , QWidgetStack*, int ); |
116 | OContactFields contactfields; | 117 | OContactFields contactfields; |
117 | 118 | ||
118 | OContact ent; | 119 | OContact ent; |
119 | 120 | ||
120 | QDialog *dlgNote; | 121 | QDialog *dlgNote; |
121 | QDialog *dlgName; | 122 | QDialog *dlgName; |
122 | 123 | ||
123 | QList<QLineEdit> listValue; | 124 | QList<QLineEdit> listValue; |
124 | QList<QLabel> listName; | 125 | QList<QLabel> listName; |
125 | 126 | ||
126 | QStringList slDynamicEntries; | 127 | QStringList slDynamicEntries; |
127 | QStringList trlDynamicEntries; | 128 | QStringList trlDynamicEntries; |
128 | 129 | ||
129 | bool m_personalView; | 130 | bool m_personalView; |
130 | 131 | ||
131 | QStringList slHomeAddress; | 132 | QStringList slHomeAddress; |
132 | QStringList slBusinessAddress; | 133 | QStringList slBusinessAddress; |
133 | QStringList slChooserNames; | 134 | QStringList slChooserNames; |
134 | QStringList slChooserValues; | 135 | QStringList slChooserValues; |
135 | QStringList emails; | 136 | QStringList emails; |
136 | QString defaultEmail; | 137 | QString defaultEmail; |
137 | 138 | ||
138 | QMultiLineEdit *txtNote; | 139 | QMultiLineEdit *txtNote; |
139 | QLabel *lblNote; | 140 | QLabel *lblNote; |
140 | 141 | ||
141 | //QLineEdit *txtTitle; | 142 | //QLineEdit *txtTitle; |
142 | QLineEdit *txtFirstName; | 143 | QLineEdit *txtFirstName; |
143 | QLineEdit *txtMiddleName; | 144 | QLineEdit *txtMiddleName; |
144 | QLineEdit *txtLastName; | 145 | QLineEdit *txtLastName; |
145 | QLineEdit *txtSuffix; | 146 | QLineEdit *txtSuffix; |
146 | 147 | ||
147 | QTabWidget *tabMain; | 148 | QTabWidget *tabMain; |
148 | QScrollView *svGeneral; | 149 | QScrollView *svGeneral; |
149 | QPushButton *btnFullName; | 150 | QPushButton *btnFullName; |
150 | QPushButton *btnNote; | 151 | QPushButton *btnNote; |
151 | QLineEdit *txtFullName; | 152 | QLineEdit *txtFullName; |
152 | QLineEdit *txtJobTitle; | 153 | QLineEdit *txtJobTitle; |
153 | QLineEdit *txtOrganization; | 154 | QLineEdit *txtOrganization; |
154 | QLineEdit *txtChooserField1; | 155 | QLineEdit *txtChooserField1; |
155 | QLineEdit *txtChooserField2; | 156 | QLineEdit *txtChooserField2; |
156 | QLineEdit *txtChooserField3; | 157 | QLineEdit *txtChooserField3; |
157 | QLineEdit *txtChooserField4; | 158 | QLineEdit *txtChooserField4; |
158 | QWidgetStack* m_widgetStack1; | 159 | QWidgetStack* m_widgetStack1; |
159 | QWidgetStack* m_widgetStack2; | 160 | QWidgetStack* m_widgetStack2; |
160 | QWidgetStack* m_widgetStack3; | 161 | QWidgetStack* m_widgetStack3; |
161 | QWidgetStack* m_widgetStack4; | 162 | QWidgetStack* m_widgetStack4; |
162 | QComboBox *cmbChooserField1; | 163 | QComboBox *cmbChooserField1; |
163 | QComboBox *cmbChooserField2; | 164 | QComboBox *cmbChooserField2; |
164 | QComboBox *cmbChooserField3; | 165 | QComboBox *cmbChooserField3; |
165 | QComboBox *cmbChooserField4; | 166 | QComboBox *cmbChooserField4; |
166 | QComboBox *cmbDefaultEmail; | 167 | QComboBox *cmbDefaultEmail; |
167 | QComboBox *cmbFileAs; | 168 | QComboBox *cmbFileAs; |
168 | CategorySelect *cmbCat; | 169 | CategorySelect *cmbCat; |
169 | QLabel *labCat; | 170 | QLabel *labCat; |
170 | 171 | ||
171 | QScrollView *svAddress; | 172 | QScrollView *svAddress; |
172 | QLineEdit *txtAddress; | 173 | QLineEdit *txtAddress; |
173 | //QLineEdit *txtAddress2; | 174 | //QLineEdit *txtAddress2; |
174 | //QLineEdit *txtPOBox; | 175 | //QLineEdit *txtPOBox; |
175 | QLineEdit *txtCity; | 176 | QLineEdit *txtCity; |
176 | QLineEdit *txtState; | 177 | QLineEdit *txtState; |
177 | QLineEdit *txtZip; | 178 | QLineEdit *txtZip; |
178 | QComboBox *cmbAddress; | 179 | QComboBox *cmbAddress; |
179 | QComboBox *cmbCountry; | 180 | QComboBox *cmbCountry; |
180 | 181 | ||
181 | QScrollView *svDetails; | 182 | QScrollView *svDetails; |
182 | QComboBox *cmbGender; | 183 | QComboBox *cmbGender; |
183 | DateBookMonth* birthdayPicker; | 184 | DateBookMonth* birthdayPicker; |
184 | QToolButton* birthdayButton; | 185 | QToolButton* birthdayButton; |
185 | DateBookMonth* anniversaryPicker; | 186 | DateBookMonth* anniversaryPicker; |
186 | QToolButton* anniversaryButton; | 187 | QToolButton* anniversaryButton; |
187 | 188 | ||
188 | bool initializing; | 189 | bool initializing; |
189 | }; | 190 | }; |
190 | 191 | ||
191 | #endif | 192 | #endif |
diff --git a/core/pim/addressbook/version.h b/core/pim/addressbook/version.h index c0465b5..4c93584 100644 --- a/core/pim/addressbook/version.h +++ b/core/pim/addressbook/version.h | |||
@@ -1,10 +1,10 @@ | |||
1 | #ifndef _VERSION_H_ | 1 | #ifndef _VERSION_H_ |
2 | #define _VERSION_H_ | 2 | #define _VERSION_H_ |
3 | 3 | ||
4 | #define MAINVERSION "0" | 4 | #define MAINVERSION "0" |
5 | #define SUBVERSION "9" | 5 | #define SUBVERSION "9" |
6 | #define PATCHVERSION "4" | 6 | #define PATCHVERSION "5" |
7 | 7 | ||
8 | #define APPNAME "OPIE_ADDRESSBOOK" | 8 | #define APPNAME "OPIE_ADDRESSBOOK" |
9 | 9 | ||
10 | #endif | 10 | #endif |