author | eilers <eilers> | 2002-10-25 13:06:09 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-10-25 13:06:09 (UTC) |
commit | 3421736c248c6ca7171bafdf3af9e2edf94eb593 (patch) (unidiff) | |
tree | d07fb1c6ae99109aec6e483b1e848533a61d7b6d | |
parent | 2f2c23d398b6a47bd06aaf329a55bb455cf5ddd1 (diff) | |
download | opie-3421736c248c6ca7171bafdf3af9e2edf94eb593.zip opie-3421736c248c6ca7171bafdf3af9e2edf94eb593.tar.gz opie-3421736c248c6ca7171bafdf3af9e2edf94eb593.tar.bz2 |
If I want to edit my personal settings, category is disabled.
Now using Datepicker for birthday and annyversary..
-rw-r--r-- | core/pim/addressbook/TODO | 11 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 9 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg_base.ui | 6 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 153 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 16 |
5 files changed, 154 insertions, 41 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index 96134f4..100a6fd 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO | |||
@@ -1,43 +1,46 @@ | |||
1 | Stuff todo until OPIE 1.0 : | 1 | Stuff todo until OPIE 1.0 : |
2 | 2 | ||
3 | Pending bugfixes from previous work: | 3 | Pending bugfixes from previous work: |
4 | 4 | ||
5 | Urgent: | 5 | Urgent: |
6 | 6 | ||
7 | 7 | ||
8 | Important: | 8 | Important: |
9 | 9 | ||
10 | - Personal contact editor: Disable categories | ||
11 | - Name order selected in "contacteditor" not used in list view. | 10 | - Name order selected in "contacteditor" not used in list view. |
12 | - contacteditor: Birthday, annyversary, ... : Use Dateselector | ||
13 | 11 | ||
14 | - Overview window cleanup needed.. | 12 | - Overview window cleanup needed.. |
15 | - Cursor keys should work in detail-view (ablabel) | 13 | - Cursor keys should work in detail-view (ablabel) |
16 | - "What's this" should be added | 14 | -> Ablabel should be removed and Abtable should be increased with |
15 | different views (as started by darwin zins).. | ||
17 | - Store last settings of combo-boxes | 16 | - Store last settings of combo-boxes |
18 | - Finishing of new View functions (List, Phonebook...) | 17 | - Finishing of new View functions (List, Phonebook...) |
19 | - The names of the countries are sorted by there english names, only.. | 18 | - The names of the countries are sorted by there english names, only.. |
20 | Even if they are translated.. :S | 19 | Even if they are translated.. :S |
21 | - Reload if contacts were changed externally | 20 | - Reload if contacts were changed externally |
21 | - "What's this" should be added | ||
22 | 22 | ||
23 | Less important: | 23 | Less important: |
24 | 24 | ||
25 | - The picker (alphabetical sort widget) should be | 25 | - The picker (alphabetical sort widget) should be |
26 | placed verticaly or horizontally (configurable) | 26 | placed verticaly or horizontally (configurable) |
27 | - Use advanced database functions in abtable to decrease | 27 | - Use advanced database functions in abtable to decrease |
28 | memory footprint and to make everything more easy ! | 28 | memory footprint and to make everything more easy ! |
29 | (abtable should store Iterator for selected Category) | 29 | (abtable should store Iterator for selected Category) |
30 | 30 | ||
31 | Should be Fixed (not absolute sure, need further validation): | 31 | Should be Fixed (not absolute sure, need further validation): |
32 | - "Nonenglish" translation bug has to be fixed. | 32 | |
33 | 33 | ||
34 | Fixed: | 34 | Fixed: |
35 | - Syncing: abtable not reloaded after sync. | 35 | - Syncing: abtable not reloaded after sync. |
36 | - Find widget should be replaced by something like | 36 | - Find widget should be replaced by something like |
37 | qpdf has. | 37 | qpdf has. |
38 | - Adding a configuration dialog | 38 | - Adding a configuration dialog |
39 | - Picker: Activated letter schould be more visible | 39 | - Picker: Activated letter schould be more visible |
40 | - Advanced handling of cursor keys (search..) | 40 | - Advanced handling of cursor keys (search..) |
41 | - Mail-Icon is missing | 41 | - Mail-Icon is missing |
42 | - Use opie-mail insted of qt-mail if possible. | 42 | - Use opie-mail insted of qt-mail if possible. |
43 | - Font menu is invisible using german translation | 43 | - Font menu is invisible using german translation |
44 | - Personal contact editor: Disable categories | ||
45 | - "Nonenglish" translation bug has to be fixed. | ||
46 | - contacteditor: Birthday, annyversary, ... : Use Dateselector | ||
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 39d8321..108e66d 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -1,1129 +1,1134 @@ | |||
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 "abtable.h" | 25 | #include "abtable.h" |
26 | #include "addresssettings.h" | 26 | #include "addresssettings.h" |
27 | #include "addressbook.h" | 27 | #include "addressbook.h" |
28 | 28 | ||
29 | 29 | ||
30 | #include <opie/ofileselector.h> | 30 | #include <opie/ofileselector.h> |
31 | #include <opie/ofiledialog.h> | 31 | #include <opie/ofiledialog.h> |
32 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/config.h> | 33 | #include <qpe/config.h> |
34 | #include <opie/ocontact.h> | 34 | #include <opie/ocontact.h> |
35 | 35 | ||
36 | #include <qpe/global.h> | 36 | #include <qpe/global.h> |
37 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
38 | #include <qpe/ir.h> | 38 | #include <qpe/ir.h> |
39 | #include <qpe/qpemessagebox.h> | 39 | #include <qpe/qpemessagebox.h> |
40 | #include <qpe/qcopenvelope_qws.h> | 40 | #include <qpe/qcopenvelope_qws.h> |
41 | 41 | ||
42 | #include <qaction.h> | 42 | #include <qaction.h> |
43 | #include <qdialog.h> | 43 | #include <qdialog.h> |
44 | #include <qdir.h> | 44 | #include <qdir.h> |
45 | #include <qfile.h> | 45 | #include <qfile.h> |
46 | #include <qimage.h> | 46 | #include <qimage.h> |
47 | #include <qlayout.h> | 47 | #include <qlayout.h> |
48 | #include <qpe/qpemenubar.h> | 48 | #include <qpe/qpemenubar.h> |
49 | #include <qmessagebox.h> | 49 | #include <qmessagebox.h> |
50 | #include <qpixmap.h> | 50 | #include <qpixmap.h> |
51 | #include <qpopupmenu.h> | 51 | #include <qpopupmenu.h> |
52 | #include <qpe/qpetoolbar.h> | 52 | #include <qpe/qpetoolbar.h> |
53 | #include <qstringlist.h> | 53 | #include <qstringlist.h> |
54 | #include <qtoolbutton.h> | 54 | #include <qtoolbutton.h> |
55 | #include <qwhatsthis.h> | 55 | #include <qwhatsthis.h> |
56 | 56 | ||
57 | #include <stdlib.h> | 57 | #include <stdlib.h> |
58 | #include <sys/stat.h> | 58 | #include <sys/stat.h> |
59 | #include <sys/types.h> | 59 | #include <sys/types.h> |
60 | #include <fcntl.h> | 60 | #include <fcntl.h> |
61 | #include <unistd.h> | 61 | #include <unistd.h> |
62 | 62 | ||
63 | #include <qdatetime.h> | 63 | #include <qdatetime.h> |
64 | 64 | ||
65 | #include "picker.h" | 65 | #include "picker.h" |
66 | #include "configdlg.h" | 66 | #include "configdlg.h" |
67 | 67 | ||
68 | static QString addressbookPersonalVCardName() | 68 | static QString addressbookPersonalVCardName() |
69 | { | 69 | { |
70 | QString filename = Global::applicationFileName("addressbook", | 70 | QString filename = Global::applicationFileName("addressbook", |
71 | "businesscard.vcf"); | 71 | "businesscard.vcf"); |
72 | return filename; | 72 | return filename; |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | 76 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, |
77 | WFlags f ) | 77 | WFlags f ) |
78 | : QMainWindow( parent, name, f ), | 78 | : QMainWindow( parent, name, f ), |
79 | abEditor(0), | 79 | abEditor(0), |
80 | useRegExp(false), | 80 | useRegExp(false), |
81 | doNotifyWrapAround(true), | 81 | doNotifyWrapAround(true), |
82 | caseSensitive(false), | 82 | caseSensitive(false), |
83 | m_useQtMail(true), | 83 | m_useQtMail(true), |
84 | m_useOpieMail(false), | 84 | m_useOpieMail(false), |
85 | bAbEditFirstTime(TRUE), | 85 | bAbEditFirstTime(TRUE), |
86 | syncing(FALSE) | 86 | syncing(FALSE) |
87 | { | 87 | { |
88 | isLoading = true; | 88 | isLoading = true; |
89 | 89 | ||
90 | // Read Config settings | 90 | // Read Config settings |
91 | Config cfg("AddressBook"); | 91 | Config cfg("AddressBook"); |
92 | cfg.setGroup("Search"); | 92 | cfg.setGroup("Search"); |
93 | useRegExp = cfg.readBoolEntry( "useRegExp" ); | 93 | useRegExp = cfg.readBoolEntry( "useRegExp" ); |
94 | caseSensitive = cfg.readBoolEntry( "caseSensitive" ); | 94 | caseSensitive = cfg.readBoolEntry( "caseSensitive" ); |
95 | doNotifyWrapAround = cfg.readBoolEntry( "doNotifyWrapAround" ); | 95 | doNotifyWrapAround = cfg.readBoolEntry( "doNotifyWrapAround" ); |
96 | cfg.setGroup("Mail"); | 96 | cfg.setGroup("Mail"); |
97 | m_useQtMail = cfg.readBoolEntry( "useQtMail" ); | 97 | m_useQtMail = cfg.readBoolEntry( "useQtMail", true ); |
98 | m_useOpieMail=cfg.readBoolEntry( "useOpieMail" ); | 98 | m_useOpieMail=cfg.readBoolEntry( "useOpieMail" ); |
99 | 99 | ||
100 | 100 | ||
101 | initFields(); | 101 | initFields(); |
102 | 102 | ||
103 | setCaption( tr("Contacts") ); | 103 | setCaption( tr("Contacts") ); |
104 | setIcon( Resource::loadPixmap( "AddressBook" ) ); | 104 | setIcon( Resource::loadPixmap( "AddressBook" ) ); |
105 | 105 | ||
106 | setToolBarsMovable( FALSE ); | 106 | setToolBarsMovable( FALSE ); |
107 | 107 | ||
108 | // Create Toolbars | 108 | // Create Toolbars |
109 | 109 | ||
110 | QPEToolBar *bar = new QPEToolBar( this ); | 110 | QPEToolBar *bar = new QPEToolBar( this ); |
111 | bar->setHorizontalStretchable( TRUE ); | 111 | bar->setHorizontalStretchable( TRUE ); |
112 | 112 | ||
113 | QPEMenuBar *mbList = new QPEMenuBar( bar ); | 113 | QPEMenuBar *mbList = new QPEMenuBar( bar ); |
114 | mbList->setMargin( 0 ); | 114 | mbList->setMargin( 0 ); |
115 | 115 | ||
116 | QPopupMenu *edit = new QPopupMenu( this ); | 116 | QPopupMenu *edit = new QPopupMenu( this ); |
117 | mbList->insertItem( tr( "Contact" ), edit ); | 117 | mbList->insertItem( tr( "Contact" ), edit ); |
118 | 118 | ||
119 | listTools = new QPEToolBar( this, "list operations" ); | 119 | listTools = new QPEToolBar( this, "list operations" ); |
120 | 120 | ||
121 | 121 | ||
122 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, | 122 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, |
123 | 0, this, 0 ); | 123 | 0, this, 0 ); |
124 | actionNew = a; | 124 | actionNew = a; |
125 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); | 125 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); |
126 | a->addTo( edit ); | 126 | a->addTo( edit ); |
127 | a->addTo( listTools ); | 127 | a->addTo( listTools ); |
128 | 128 | ||
129 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | 129 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, |
130 | 0, this, 0 ); | 130 | 0, this, 0 ); |
131 | actionEdit = a; | 131 | actionEdit = a; |
132 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); | 132 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); |
133 | a->addTo( edit ); | 133 | a->addTo( edit ); |
134 | a->addTo( listTools ); | 134 | a->addTo( listTools ); |
135 | 135 | ||
136 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 136 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
137 | 0, this, 0 ); | 137 | 0, this, 0 ); |
138 | actionTrash = a; | 138 | actionTrash = a; |
139 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); | 139 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); |
140 | a->addTo( edit ); | 140 | a->addTo( edit ); |
141 | a->addTo( listTools ); | 141 | a->addTo( listTools ); |
142 | 142 | ||
143 | 143 | ||
144 | // make it possible to go directly to businesscard via qcop call | 144 | // make it possible to go directly to businesscard via qcop call |
145 | #if defined(Q_WS_QWS) | 145 | #if defined(Q_WS_QWS) |
146 | #if !defined(QT_NO_COP) | 146 | #if !defined(QT_NO_COP) |
147 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); | 147 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); |
148 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), | 148 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), |
149 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); | 149 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); |
150 | #endif | 150 | #endif |
151 | #endif | 151 | #endif |
152 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), | 152 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), |
153 | QString::null, 0, this, 0 ); | 153 | QString::null, 0, this, 0 ); |
154 | actionFind = a; | 154 | actionFind = a; |
155 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); | 155 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); |
156 | a->addTo( edit ); | 156 | a->addTo( edit ); |
157 | a->addTo( listTools ); | 157 | a->addTo( listTools ); |
158 | 158 | ||
159 | // Much better search widget, taken from QTReader.. (se) | 159 | // Much better search widget, taken from QTReader.. (se) |
160 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); | 160 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); |
161 | searchBar->setHorizontalStretchable( TRUE ); | 161 | searchBar->setHorizontalStretchable( TRUE ); |
162 | searchBar->hide(); | 162 | searchBar->hide(); |
163 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 163 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
164 | // QFont f("unifont", 16 /*, QFont::Bold*/); | 164 | // QFont f("unifont", 16 /*, QFont::Bold*/); |
165 | // searchEdit->setFont( f ); | 165 | // searchEdit->setFont( f ); |
166 | searchBar->setStretchableWidget( searchEdit ); | 166 | searchBar->setStretchableWidget( searchEdit ); |
167 | connect( searchEdit, SIGNAL( returnPressed( ) ), | 167 | connect( searchEdit, SIGNAL( returnPressed( ) ), |
168 | this, SLOT( slotFind( ) ) ); | 168 | this, SLOT( slotFind( ) ) ); |
169 | 169 | ||
170 | a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); | 170 | a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); |
171 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindNext() ) ); | 171 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindNext() ) ); |
172 | a->addTo( searchBar ); | 172 | a->addTo( searchBar ); |
173 | 173 | ||
174 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 174 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
175 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); | 175 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); |
176 | a->addTo( searchBar ); | 176 | a->addTo( searchBar ); |
177 | 177 | ||
178 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "mail/sendmail" ), | 178 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "mail/sendmail" ), |
179 | QString::null, 0, this, 0 ); | 179 | QString::null, 0, this, 0 ); |
180 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 180 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
181 | actionMail = a; | 181 | actionMail = a; |
182 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 182 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
183 | a->addTo( edit ); | 183 | a->addTo( edit ); |
184 | a->addTo( listTools ); | 184 | a->addTo( listTools ); |
185 | 185 | ||
186 | 186 | ||
187 | 187 | ||
188 | if ( Ir::supported() ) { | 188 | if ( Ir::supported() ) { |
189 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | 189 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, |
190 | 0, this, 0 ); | 190 | 0, this, 0 ); |
191 | actionBeam = a; | 191 | actionBeam = a; |
192 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 192 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
193 | a->addTo( edit ); | 193 | a->addTo( edit ); |
194 | a->addTo( listTools ); | 194 | a->addTo( listTools ); |
195 | } | 195 | } |
196 | 196 | ||
197 | edit->insertSeparator(); | 197 | edit->insertSeparator(); |
198 | 198 | ||
199 | a = new QAction( tr("Import vCard"), QString::null, 0, 0, 0, TRUE ); | 199 | a = new QAction( tr("Import vCard"), QString::null, 0, 0, 0, TRUE ); |
200 | actionPersonal = a; | 200 | actionPersonal = a; |
201 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); | 201 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); |
202 | a->addTo( edit ); | 202 | a->addTo( edit ); |
203 | 203 | ||
204 | edit->insertSeparator(); | 204 | edit->insertSeparator(); |
205 | 205 | ||
206 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); | 206 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); |
207 | actionPersonal = a; | 207 | actionPersonal = a; |
208 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); | 208 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); |
209 | a->addTo( edit ); | 209 | a->addTo( edit ); |
210 | 210 | ||
211 | // Do we need this function ? (se) | 211 | // Do we need this function ? (se) |
212 | // a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); | 212 | // a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); |
213 | // connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 213 | // connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
214 | // a->addTo( edit ); | 214 | // a->addTo( edit ); |
215 | 215 | ||
216 | 216 | ||
217 | #ifdef __DEBUG_RELEASE | 217 | #ifdef __DEBUG_RELEASE |
218 | // Remove this function for public Release ! This is only | 218 | // Remove this function for public Release ! This is only |
219 | // for debug purposes .. | 219 | // for debug purposes .. |
220 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); | 220 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); |
221 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); | 221 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); |
222 | a->addTo( edit ); | 222 | a->addTo( edit ); |
223 | #endif | 223 | #endif |
224 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, | 224 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, |
225 | 0, this, 0 ); | 225 | 0, this, 0 ); |
226 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); | 226 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); |
227 | a->addTo( edit ); | 227 | a->addTo( edit ); |
228 | 228 | ||
229 | // Create Views | 229 | // Create Views |
230 | listContainer = new QWidget( this ); | 230 | listContainer = new QWidget( this ); |
231 | 231 | ||
232 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | 232 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); |
233 | 233 | ||
234 | abList = new AbTable( &orderedFields, listContainer, "table" ); | 234 | abList = new AbTable( &orderedFields, listContainer, "table" ); |
235 | vb->addWidget(abList); | 235 | vb->addWidget(abList); |
236 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 236 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
237 | connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); | 237 | connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); |
238 | connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) ); | 238 | connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) ); |
239 | connect( abList, SIGNAL( currentChanged(int,int) ), this, SLOT( slotUpdateToolbar() ) ); | 239 | connect( abList, SIGNAL( currentChanged(int,int) ), this, SLOT( slotUpdateToolbar() ) ); |
240 | connect( abList, SIGNAL( signalSearchNext() ), this, SLOT( slotFindNext() ) ); | 240 | connect( abList, SIGNAL( signalSearchNext() ), this, SLOT( slotFindNext() ) ); |
241 | connect( abList, SIGNAL( signalSearchBackward() ), this, SLOT( slotFindPrevious() ) ); | 241 | connect( abList, SIGNAL( signalSearchBackward() ), this, SLOT( slotFindPrevious() ) ); |
242 | 242 | ||
243 | // Maybe we should react on Wraparound and notfound ? | 243 | // Maybe we should react on Wraparound and notfound ? |
244 | QObject::connect( abList, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); | 244 | QObject::connect( abList, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); |
245 | QObject::connect( abList, SIGNAL(signalWrapAround()), this, SLOT(slotWrapAround()) ); | 245 | QObject::connect( abList, SIGNAL(signalWrapAround()), this, SLOT(slotWrapAround()) ); |
246 | 246 | ||
247 | mView = 0; | 247 | mView = 0; |
248 | 248 | ||
249 | abList->load(); | 249 | abList->load(); |
250 | 250 | ||
251 | pLabel = new LetterPicker( listContainer ); | 251 | pLabel = new LetterPicker( listContainer ); |
252 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 252 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
253 | vb->addWidget(pLabel); | 253 | vb->addWidget(pLabel); |
254 | catMenu = new QPopupMenu( this ); | 254 | catMenu = new QPopupMenu( this ); |
255 | catMenu->setCheckable( TRUE ); | 255 | catMenu->setCheckable( TRUE ); |
256 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 256 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
257 | populateCategories(); | 257 | populateCategories(); |
258 | 258 | ||
259 | mbList->insertItem( tr("View"), catMenu ); | 259 | mbList->insertItem( tr("View"), catMenu ); |
260 | // setCentralWidget( listContainer ); | 260 | // setCentralWidget( listContainer ); |
261 | 261 | ||
262 | fontMenu = new QPopupMenu(this); | 262 | fontMenu = new QPopupMenu(this); |
263 | fontMenu->setCheckable( true ); | 263 | fontMenu->setCheckable( true ); |
264 | connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); | 264 | connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); |
265 | 265 | ||
266 | fontMenu->insertItem(tr( "Small" ), 0); | 266 | fontMenu->insertItem(tr( "Small" ), 0); |
267 | fontMenu->insertItem(tr( "Normal" ), 1); | 267 | fontMenu->insertItem(tr( "Normal" ), 1); |
268 | fontMenu->insertItem(tr( "Large" ), 2); | 268 | fontMenu->insertItem(tr( "Large" ), 2); |
269 | 269 | ||
270 | defaultFont = new QFont( abList->font() ); | 270 | defaultFont = new QFont( abList->font() ); |
271 | 271 | ||
272 | slotSetFont(startFontSize); | 272 | slotSetFont(startFontSize); |
273 | 273 | ||
274 | mbList->insertItem( tr("Font"), fontMenu); | 274 | mbList->insertItem( tr("Font"), fontMenu); |
275 | setCentralWidget(listContainer); | 275 | setCentralWidget(listContainer); |
276 | 276 | ||
277 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 277 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
278 | 278 | ||
279 | abList->setCurrentCell( 0, 0 ); | 279 | abList->setCurrentCell( 0, 0 ); |
280 | 280 | ||
281 | isLoading = false; | 281 | isLoading = false; |
282 | } | 282 | } |
283 | 283 | ||
284 | 284 | ||
285 | void AddressbookWindow::slotConfig() | 285 | void AddressbookWindow::slotConfig() |
286 | { | 286 | { |
287 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); | 287 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); |
288 | dlg -> setUseRegExp ( useRegExp ); | 288 | dlg -> setUseRegExp ( useRegExp ); |
289 | dlg -> setBeCaseSensitive( caseSensitive ); | 289 | dlg -> setBeCaseSensitive( caseSensitive ); |
290 | dlg -> setSignalWrapAround( doNotifyWrapAround ); | 290 | dlg -> setSignalWrapAround( doNotifyWrapAround ); |
291 | dlg -> setQtMail ( m_useQtMail ); | 291 | dlg -> setQtMail ( m_useQtMail ); |
292 | dlg -> setOpieMail ( m_useOpieMail ); | 292 | dlg -> setOpieMail ( m_useOpieMail ); |
293 | dlg -> showMaximized(); | 293 | dlg -> showMaximized(); |
294 | if ( dlg -> exec() ) { | 294 | if ( dlg -> exec() ) { |
295 | qWarning ("Config Dialog accepted !"); | 295 | qWarning ("Config Dialog accepted !"); |
296 | useRegExp = dlg -> useRegExp(); | 296 | useRegExp = dlg -> useRegExp(); |
297 | caseSensitive = dlg -> beCaseSensitive(); | 297 | caseSensitive = dlg -> beCaseSensitive(); |
298 | doNotifyWrapAround = dlg -> signalWrapAround(); | 298 | doNotifyWrapAround = dlg -> signalWrapAround(); |
299 | m_useQtMail = dlg -> useQtMail(); | 299 | m_useQtMail = dlg -> useQtMail(); |
300 | m_useOpieMail= dlg -> useOpieMail(); | 300 | m_useOpieMail= dlg -> useOpieMail(); |
301 | } | 301 | } |
302 | 302 | ||
303 | delete dlg; | 303 | delete dlg; |
304 | } | 304 | } |
305 | 305 | ||
306 | 306 | ||
307 | void AddressbookWindow::slotSetFont( int size ) { | 307 | void AddressbookWindow::slotSetFont( int size ) { |
308 | 308 | ||
309 | if (size > 2 || size < 0) | 309 | if (size > 2 || size < 0) |
310 | size = 1; | 310 | size = 1; |
311 | 311 | ||
312 | startFontSize = size; | 312 | startFontSize = size; |
313 | 313 | ||
314 | QFont *currentFont; | 314 | QFont *currentFont; |
315 | 315 | ||
316 | switch (size) { | 316 | switch (size) { |
317 | case 0: | 317 | case 0: |
318 | fontMenu->setItemChecked(0, true); | 318 | fontMenu->setItemChecked(0, true); |
319 | fontMenu->setItemChecked(1, false); | 319 | fontMenu->setItemChecked(1, false); |
320 | fontMenu->setItemChecked(2, false); | 320 | fontMenu->setItemChecked(2, false); |
321 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); | 321 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); |
322 | currentFont = new QFont (abList->font()); | 322 | currentFont = new QFont (abList->font()); |
323 | // abList->resizeRows(currentFont->pixelSize() + 7); | 323 | // abList->resizeRows(currentFont->pixelSize() + 7); |
324 | abList->resizeRows(); | 324 | abList->resizeRows(); |
325 | break; | 325 | break; |
326 | case 1: | 326 | case 1: |
327 | fontMenu->setItemChecked(0, false); | 327 | fontMenu->setItemChecked(0, false); |
328 | fontMenu->setItemChecked(1, true); | 328 | fontMenu->setItemChecked(1, true); |
329 | fontMenu->setItemChecked(2, false); | 329 | fontMenu->setItemChecked(2, false); |
330 | abList->setFont( *defaultFont ); | 330 | abList->setFont( *defaultFont ); |
331 | currentFont = new QFont (abList->font()); | 331 | currentFont = new QFont (abList->font()); |
332 | // abList->resizeRows(currentFont->pixelSize() + 7); | 332 | // abList->resizeRows(currentFont->pixelSize() + 7); |
333 | abList->resizeRows(); | 333 | abList->resizeRows(); |
334 | break; | 334 | break; |
335 | case 2: | 335 | case 2: |
336 | fontMenu->setItemChecked(0, false); | 336 | fontMenu->setItemChecked(0, false); |
337 | fontMenu->setItemChecked(1, false); | 337 | fontMenu->setItemChecked(1, false); |
338 | fontMenu->setItemChecked(2, true); | 338 | fontMenu->setItemChecked(2, true); |
339 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); | 339 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); |
340 | currentFont = new QFont (abList->font()); | 340 | currentFont = new QFont (abList->font()); |
341 | //abList->resizeRows(currentFont->pixelSize() + 7); | 341 | //abList->resizeRows(currentFont->pixelSize() + 7); |
342 | abList->resizeRows(); | 342 | abList->resizeRows(); |
343 | break; | 343 | break; |
344 | } | 344 | } |
345 | } | 345 | } |
346 | 346 | ||
347 | 347 | ||
348 | 348 | ||
349 | void AddressbookWindow::importvCard() { | 349 | void AddressbookWindow::importvCard() { |
350 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); | 350 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); |
351 | if(!str.isEmpty() ) | 351 | if(!str.isEmpty() ) |
352 | setDocument((const QString&) str ); | 352 | setDocument((const QString&) str ); |
353 | 353 | ||
354 | } | 354 | } |
355 | 355 | ||
356 | void AddressbookWindow::setDocument( const QString &filename ) | 356 | void AddressbookWindow::setDocument( const QString &filename ) |
357 | { | 357 | { |
358 | if ( filename.find(".vcf") != int(filename.length()) - 4 ) | 358 | if ( filename.find(".vcf") != int(filename.length()) - 4 ) |
359 | return; | 359 | return; |
360 | 360 | ||
361 | QValueList<OContact> cl = OContact::readVCard( filename ); | 361 | QValueList<OContact> cl = OContact::readVCard( filename ); |
362 | for( QValueList<OContact>::Iterator it = cl.begin(); it != cl.end(); ++it ) { | 362 | for( QValueList<OContact>::Iterator it = cl.begin(); it != cl.end(); ++it ) { |
363 | // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?") | 363 | // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?") |
364 | // .arg( (*it).fullName() ); | 364 | // .arg( (*it).fullName() ); |
365 | // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == | 365 | // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == |
366 | // QMessageBox::Ok ) { | 366 | // QMessageBox::Ok ) { |
367 | abList->addEntry( *it ); | 367 | abList->addEntry( *it ); |
368 | // } | 368 | // } |
369 | } | 369 | } |
370 | 370 | ||
371 | } | 371 | } |
372 | 372 | ||
373 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 373 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
374 | { | 374 | { |
375 | QMainWindow::resizeEvent( e ); | 375 | QMainWindow::resizeEvent( e ); |
376 | 376 | ||
377 | if ( centralWidget() == listContainer ) | 377 | if ( centralWidget() == listContainer ) |
378 | showList(); | 378 | showList(); |
379 | else if ( centralWidget() == mView ) | 379 | else if ( centralWidget() == mView ) |
380 | showView(); | 380 | showView(); |
381 | } | 381 | } |
382 | 382 | ||
383 | AddressbookWindow::~AddressbookWindow() | 383 | AddressbookWindow::~AddressbookWindow() |
384 | { | 384 | { |
385 | Config cfg("AddressBook"); | 385 | Config cfg("AddressBook"); |
386 | cfg.setGroup("Font"); | 386 | cfg.setGroup("Font"); |
387 | cfg.writeEntry("fontSize", startFontSize); | 387 | cfg.writeEntry("fontSize", startFontSize); |
388 | 388 | ||
389 | cfg.setGroup("Search"); | 389 | cfg.setGroup("Search"); |
390 | cfg.writeEntry("useRegExp", useRegExp); | 390 | cfg.writeEntry("useRegExp", useRegExp); |
391 | cfg.writeEntry("caseSensitive", caseSensitive); | 391 | cfg.writeEntry("caseSensitive", caseSensitive); |
392 | cfg.writeEntry("doNotifyWrapAround", doNotifyWrapAround); | 392 | cfg.writeEntry("doNotifyWrapAround", doNotifyWrapAround); |
393 | cfg.setGroup("Mail"); | 393 | cfg.setGroup("Mail"); |
394 | cfg.writeEntry( "useQtMail", m_useQtMail ); | 394 | cfg.writeEntry( "useQtMail", m_useQtMail ); |
395 | cfg.writeEntry( "useOpieMail", m_useOpieMail); | 395 | cfg.writeEntry( "useOpieMail", m_useOpieMail); |
396 | } | 396 | } |
397 | 397 | ||
398 | void AddressbookWindow::slotUpdateToolbar() | 398 | void AddressbookWindow::slotUpdateToolbar() |
399 | { | 399 | { |
400 | OContact ce = abList->currentEntry(); | 400 | OContact ce = abList->currentEntry(); |
401 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 401 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
402 | } | 402 | } |
403 | 403 | ||
404 | void AddressbookWindow::showList() | 404 | void AddressbookWindow::showList() |
405 | { | 405 | { |
406 | bool visiblemView; | 406 | bool visiblemView; |
407 | 407 | ||
408 | visiblemView = false; | 408 | visiblemView = false; |
409 | if ( mView ) { | 409 | if ( mView ) { |
410 | mView->hide(); | 410 | mView->hide(); |
411 | visiblemView = true; | 411 | visiblemView = true; |
412 | } | 412 | } |
413 | setCentralWidget( listContainer ); | 413 | setCentralWidget( listContainer ); |
414 | listContainer->show(); | 414 | listContainer->show(); |
415 | // update our focues... (or use a stack widget!); | 415 | // update our focues... (or use a stack widget!); |
416 | abList->setFocus(); | 416 | abList->setFocus(); |
417 | 417 | ||
418 | // This makes sure we are scrolled all the way to the left | 418 | // This makes sure we are scrolled all the way to the left |
419 | abList->setContentsPos( 0, abList->contentsY() ); | 419 | abList->setContentsPos( 0, abList->contentsY() ); |
420 | 420 | ||
421 | //if ( visiblemView && abList->showBook() == "Cards" ) | 421 | //if ( visiblemView && abList->showBook() == "Cards" ) |
422 | //abList->setShowCategory( abList->showBook(), abList->showCategory() ); | 422 | //abList->setShowCategory( abList->showBook(), abList->showCategory() ); |
423 | 423 | ||
424 | } | 424 | } |
425 | 425 | ||
426 | void AddressbookWindow::showView() | 426 | void AddressbookWindow::showView() |
427 | { | 427 | { |
428 | if ( abList->numRows() > 0 ) { | 428 | if ( abList->numRows() > 0 ) { |
429 | listContainer->hide(); | 429 | listContainer->hide(); |
430 | setCentralWidget( abView() ); | 430 | setCentralWidget( abView() ); |
431 | mView->show(); | 431 | mView->show(); |
432 | mView->setFocus(); | 432 | mView->setFocus(); |
433 | } | 433 | } |
434 | } | 434 | } |
435 | 435 | ||
436 | void AddressbookWindow::slotListNew() | 436 | void AddressbookWindow::slotListNew() |
437 | { | 437 | { |
438 | OContact cnt; | 438 | OContact cnt; |
439 | if( !syncing ) { | 439 | if( !syncing ) { |
440 | if ( abEditor ) | 440 | if ( abEditor ) |
441 | abEditor->setEntry( cnt ); | 441 | abEditor->setEntry( cnt ); |
442 | abView()->init( cnt ); | 442 | abView()->init( cnt ); |
443 | editEntry( NewEntry ); | 443 | editEntry( NewEntry ); |
444 | } else { | 444 | } else { |
445 | QMessageBox::warning(this, tr("OContacts"), | 445 | QMessageBox::warning(this, tr("OContacts"), |
446 | tr("Can not edit data, currently syncing")); | 446 | tr("Can not edit data, currently syncing")); |
447 | } | 447 | } |
448 | } | 448 | } |
449 | 449 | ||
450 | void AddressbookWindow::slotListView() | 450 | void AddressbookWindow::slotListView() |
451 | { | 451 | { |
452 | abView()->init( abList->currentEntry() ); | 452 | abView()->init( abList->currentEntry() ); |
453 | mView->sync(); | 453 | mView->sync(); |
454 | showView(); | 454 | showView(); |
455 | } | 455 | } |
456 | 456 | ||
457 | void AddressbookWindow::slotListDelete() | 457 | void AddressbookWindow::slotListDelete() |
458 | { | 458 | { |
459 | if(!syncing) { | 459 | if(!syncing) { |
460 | OContact tmpEntry = abList->currentEntry(); | 460 | OContact tmpEntry = abList->currentEntry(); |
461 | 461 | ||
462 | // get a name, do the best we can... | 462 | // get a name, do the best we can... |
463 | QString strName = tmpEntry.fullName(); | 463 | QString strName = tmpEntry.fullName(); |
464 | if ( strName.isEmpty() ) { | 464 | if ( strName.isEmpty() ) { |
465 | strName = tmpEntry.company(); | 465 | strName = tmpEntry.company(); |
466 | if ( strName.isEmpty() ) | 466 | if ( strName.isEmpty() ) |
467 | strName = "No Name"; | 467 | strName = "No Name"; |
468 | } | 468 | } |
469 | 469 | ||
470 | 470 | ||
471 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), | 471 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), |
472 | strName ) ) { | 472 | strName ) ) { |
473 | abList->deleteCurrentEntry(); | 473 | abList->deleteCurrentEntry(); |
474 | showList(); | 474 | showList(); |
475 | } | 475 | } |
476 | } else { | 476 | } else { |
477 | QMessageBox::warning( this, tr("Contacts"), | 477 | QMessageBox::warning( this, tr("Contacts"), |
478 | tr("Can not edit data, currently syncing") ); | 478 | tr("Can not edit data, currently syncing") ); |
479 | } | 479 | } |
480 | } | 480 | } |
481 | 481 | ||
482 | void AddressbookWindow::slotViewBack() | 482 | void AddressbookWindow::slotViewBack() |
483 | { | 483 | { |
484 | showList(); | 484 | showList(); |
485 | } | 485 | } |
486 | 486 | ||
487 | void AddressbookWindow::slotViewEdit() | 487 | void AddressbookWindow::slotViewEdit() |
488 | { | 488 | { |
489 | if(!syncing) { | 489 | if(!syncing) { |
490 | if (actionPersonal->isOn()) { | 490 | if (actionPersonal->isOn()) { |
491 | editPersonal(); | 491 | editPersonal(); |
492 | } else { | 492 | } else { |
493 | if ( !bAbEditFirstTime ) | 493 | if ( !bAbEditFirstTime ) |
494 | abEditor->setEntry( abList->currentEntry() ); | 494 | abEditor->setEntry( abList->currentEntry() ); |
495 | editEntry( EditEntry ); | 495 | editEntry( EditEntry ); |
496 | } | 496 | } |
497 | } else { | 497 | } else { |
498 | QMessageBox::warning( this, tr("Contacts"), | 498 | QMessageBox::warning( this, tr("Contacts"), |
499 | tr("Can not edit data, currently syncing") ); | 499 | tr("Can not edit data, currently syncing") ); |
500 | } | 500 | } |
501 | } | 501 | } |
502 | 502 | ||
503 | 503 | ||
504 | 504 | ||
505 | void AddressbookWindow::writeMail() | 505 | void AddressbookWindow::writeMail() |
506 | { | 506 | { |
507 | OContact c = abList->currentEntry(); | 507 | OContact c = abList->currentEntry(); |
508 | QString name = c.fileAs(); | 508 | QString name = c.fileAs(); |
509 | QString email = c.defaultEmail(); | 509 | QString email = c.defaultEmail(); |
510 | 510 | ||
511 | // I prefer the OPIE-Environment variable before the | 511 | // I prefer the OPIE-Environment variable before the |
512 | // QPE-one.. | 512 | // QPE-one.. |
513 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); | 513 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); |
514 | if ( basepath.isEmpty() ) | 514 | if ( basepath.isEmpty() ) |
515 | basepath = QString::fromLatin1( getenv("QPEDIR") ); | 515 | basepath = QString::fromLatin1( getenv("QPEDIR") ); |
516 | 516 | ||
517 | // Try to access the preferred. If not possible, try to | 517 | // Try to access the preferred. If not possible, try to |
518 | // switch to the other one.. | 518 | // switch to the other one.. |
519 | if ( m_useQtMail ){ | 519 | if ( m_useQtMail ){ |
520 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); | 520 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); |
521 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ | 521 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ |
522 | qWarning ("QCop"); | 522 | qWarning ("QCop"); |
523 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 523 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); |
524 | e << name << email; | 524 | e << name << email; |
525 | return; | 525 | return; |
526 | } else | 526 | } else |
527 | m_useOpieMail = true; | 527 | m_useOpieMail = true; |
528 | } | 528 | } |
529 | if ( m_useOpieMail ){ | 529 | if ( m_useOpieMail ){ |
530 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); | 530 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); |
531 | if ( QFile::exists( basepath + "/bin/mail" ) ){ | 531 | if ( QFile::exists( basepath + "/bin/mail" ) ){ |
532 | qWarning ("QCop"); | 532 | qWarning ("QCop"); |
533 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); | 533 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); |
534 | e << name << email; | 534 | e << name << email; |
535 | return; | 535 | return; |
536 | } else | 536 | } else |
537 | m_useQtMail = true; | 537 | m_useQtMail = true; |
538 | } | 538 | } |
539 | 539 | ||
540 | } | 540 | } |
541 | 541 | ||
542 | static const char * beamfile = "/tmp/obex/contact.vcf"; | 542 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
543 | 543 | ||
544 | void AddressbookWindow::slotBeam() | 544 | void AddressbookWindow::slotBeam() |
545 | { | 545 | { |
546 | QString filename; | 546 | QString filename; |
547 | OContact c; | 547 | OContact c; |
548 | if ( actionPersonal->isOn() ) { | 548 | if ( actionPersonal->isOn() ) { |
549 | filename = addressbookPersonalVCardName(); | 549 | filename = addressbookPersonalVCardName(); |
550 | if (!QFile::exists(filename)) | 550 | if (!QFile::exists(filename)) |
551 | return; // can't beam a non-existent file | 551 | return; // can't beam a non-existent file |
552 | c = OContact::readVCard( filename )[0]; | 552 | c = OContact::readVCard( filename )[0]; |
553 | } else { | 553 | } else { |
554 | unlink( beamfile ); // delete if exists | 554 | unlink( beamfile ); // delete if exists |
555 | c = abList->currentEntry(); | 555 | c = abList->currentEntry(); |
556 | mkdir("/tmp/obex/", 0755); | 556 | mkdir("/tmp/obex/", 0755); |
557 | OContact::writeVCard( beamfile, c ); | 557 | OContact::writeVCard( beamfile, c ); |
558 | filename = beamfile; | 558 | filename = beamfile; |
559 | } | 559 | } |
560 | Ir *ir = new Ir( this ); | 560 | Ir *ir = new Ir( this ); |
561 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 561 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
562 | QString description = c.fullName(); | 562 | QString description = c.fullName(); |
563 | ir->send( filename, description, "text/x-vCard" ); | 563 | ir->send( filename, description, "text/x-vCard" ); |
564 | } | 564 | } |
565 | 565 | ||
566 | void AddressbookWindow::beamDone( Ir *ir ) | 566 | void AddressbookWindow::beamDone( Ir *ir ) |
567 | { | 567 | { |
568 | delete ir; | 568 | delete ir; |
569 | unlink( beamfile ); | 569 | unlink( beamfile ); |
570 | } | 570 | } |
571 | 571 | ||
572 | 572 | ||
573 | static void parseName( const QString& name, QString *first, QString *middle, | 573 | static void parseName( const QString& name, QString *first, QString *middle, |
574 | QString * last ) | 574 | QString * last ) |
575 | { | 575 | { |
576 | 576 | ||
577 | int comma = name.find ( "," ); | 577 | int comma = name.find ( "," ); |
578 | QString rest; | 578 | QString rest; |
579 | if ( comma > 0 ) { | 579 | if ( comma > 0 ) { |
580 | *last = name.left( comma ); | 580 | *last = name.left( comma ); |
581 | comma++; | 581 | comma++; |
582 | while ( comma < int(name.length()) && name[comma] == ' ' ) | 582 | while ( comma < int(name.length()) && name[comma] == ' ' ) |
583 | comma++; | 583 | comma++; |
584 | rest = name.mid( comma ); | 584 | rest = name.mid( comma ); |
585 | } else { | 585 | } else { |
586 | int space = name.findRev( ' ' ); | 586 | int space = name.findRev( ' ' ); |
587 | *last = name.mid( space+1 ); | 587 | *last = name.mid( space+1 ); |
588 | rest = name.left( space ); | 588 | rest = name.left( space ); |
589 | } | 589 | } |
590 | int space = rest.find( ' ' ); | 590 | int space = rest.find( ' ' ); |
591 | if ( space <= 0 ) { | 591 | if ( space <= 0 ) { |
592 | *first = rest; | 592 | *first = rest; |
593 | } else { | 593 | } else { |
594 | *first = rest.left( space ); | 594 | *first = rest.left( space ); |
595 | *middle = rest.mid( space+1 ); | 595 | *middle = rest.mid( space+1 ); |
596 | } | 596 | } |
597 | 597 | ||
598 | } | 598 | } |
599 | 599 | ||
600 | 600 | ||
601 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 601 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
602 | { | 602 | { |
603 | if (msg == "editPersonal()") { | 603 | if (msg == "editPersonal()") { |
604 | editPersonal(); | 604 | editPersonal(); |
605 | } else if (msg == "editPersonalAndClose()") { | 605 | } else if (msg == "editPersonalAndClose()") { |
606 | editPersonal(); | 606 | editPersonal(); |
607 | close(); | 607 | close(); |
608 | } else if ( msg == "addContact(QString,QString)" ) { | 608 | } else if ( msg == "addContact(QString,QString)" ) { |
609 | QDataStream stream(data,IO_ReadOnly); | 609 | QDataStream stream(data,IO_ReadOnly); |
610 | QString name, email; | 610 | QString name, email; |
611 | stream >> name >> email; | 611 | stream >> name >> email; |
612 | 612 | ||
613 | OContact cnt; | 613 | OContact cnt; |
614 | QString fn, mn, ln; | 614 | QString fn, mn, ln; |
615 | parseName( name, &fn, &mn, &ln ); | 615 | parseName( name, &fn, &mn, &ln ); |
616 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 616 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
617 | cnt.setFirstName( fn ); | 617 | cnt.setFirstName( fn ); |
618 | cnt.setMiddleName( mn ); | 618 | cnt.setMiddleName( mn ); |
619 | cnt.setLastName( ln ); | 619 | cnt.setLastName( ln ); |
620 | cnt.insertEmails( email ); | 620 | cnt.insertEmails( email ); |
621 | cnt.setDefaultEmail( email ); | 621 | cnt.setDefaultEmail( email ); |
622 | cnt.setFileAs(); | 622 | cnt.setFileAs(); |
623 | 623 | ||
624 | if ( bAbEditFirstTime ) { | 624 | if ( bAbEditFirstTime ) { |
625 | abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields, | 625 | abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields, |
626 | this, "editor" ); | 626 | this, "editor" ); |
627 | bAbEditFirstTime = FALSE; | 627 | bAbEditFirstTime = FALSE; |
628 | } else { | 628 | } else { |
629 | abEditor->setEntry( cnt ); | 629 | abEditor->setEntry( cnt ); |
630 | } | 630 | } |
631 | abView()->init( cnt ); | 631 | abView()->init( cnt ); |
632 | editEntry( NewEntry ); | 632 | editEntry( NewEntry ); |
633 | 633 | ||
634 | 634 | ||
635 | 635 | ||
636 | } | 636 | } |
637 | #if 0 | 637 | #if 0 |
638 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { | 638 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { |
639 | QDataStream stream(data,IO_ReadOnly); | 639 | QDataStream stream(data,IO_ReadOnly); |
640 | QCString ch,m; | 640 | QCString ch,m; |
641 | QStringList types; | 641 | QStringList types; |
642 | stream >> ch >> m >> types; | 642 | stream >> ch >> m >> types; |
643 | AddressPicker picker(abList,this,0,TRUE); | 643 | AddressPicker picker(abList,this,0,TRUE); |
644 | picker.showMaximized(); | 644 | picker.showMaximized(); |
645 | picker.setChoiceNames(types); | 645 | picker.setChoiceNames(types); |
646 | int i=0; | 646 | int i=0; |
647 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 647 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
648 | QStringList sel; | 648 | QStringList sel; |
649 | stream >> sel; | 649 | stream >> sel; |
650 | picker.setSelection(i++,sel); | 650 | picker.setSelection(i++,sel); |
651 | } | 651 | } |
652 | picker.showMaximized(); | 652 | picker.showMaximized(); |
653 | picker.exec(); | 653 | picker.exec(); |
654 | 654 | ||
655 | // ###### note: contacts may have been added - save here! | 655 | // ###### note: contacts may have been added - save here! |
656 | 656 | ||
657 | setCentralWidget(abList); | 657 | setCentralWidget(abList); |
658 | QCopEnvelope e(ch,m); | 658 | QCopEnvelope e(ch,m); |
659 | i=0; | 659 | i=0; |
660 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 660 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
661 | QStringList sel = picker.selection(i++); | 661 | QStringList sel = picker.selection(i++); |
662 | e << sel; | 662 | e << sel; |
663 | } | 663 | } |
664 | } | 664 | } |
665 | #endif | 665 | #endif |
666 | 666 | ||
667 | } | 667 | } |
668 | 668 | ||
669 | void AddressbookWindow::editPersonal() | 669 | void AddressbookWindow::editPersonal() |
670 | { | 670 | { |
671 | QString filename = addressbookPersonalVCardName(); | 671 | QString filename = addressbookPersonalVCardName(); |
672 | OContact me; | 672 | OContact me; |
673 | if (QFile::exists(filename)) | 673 | if (QFile::exists(filename)) |
674 | me = OContact::readVCard( filename )[0]; | 674 | me = OContact::readVCard( filename )[0]; |
675 | if (bAbEditFirstTime) { | 675 | if (bAbEditFirstTime) { |
676 | qWarning("Editing personal data"); | ||
676 | abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, | 677 | abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, |
677 | this, "editor" ); | 678 | this, "editor" ); |
678 | // don't create a new editor every time | 679 | // don't create a new editor every time |
679 | bAbEditFirstTime = FALSE; | 680 | bAbEditFirstTime = FALSE; |
680 | } else | 681 | } else{ |
681 | abEditor->setEntry( me ); | 682 | abEditor->setEntry( me ); |
683 | } | ||
684 | |||
685 | abEditor->setPersonalView( true ); | ||
682 | 686 | ||
683 | abEditor->setCaption(tr("Edit My Personal Details")); | 687 | abEditor->setCaption(tr("Edit My Personal Details")); |
684 | abEditor->showMaximized(); | 688 | abEditor->showMaximized(); |
685 | 689 | ||
686 | // fix the foxus... | 690 | // fix the foxus... |
687 | abEditor->setNameFocus(); | 691 | abEditor->setNameFocus(); |
688 | if ( abEditor->exec() ) { | 692 | if ( abEditor->exec() ) { |
689 | setFocus(); | 693 | setFocus(); |
690 | OContact new_personal = abEditor->entry(); | 694 | OContact new_personal = abEditor->entry(); |
691 | QString fname = addressbookPersonalVCardName(); | 695 | QString fname = addressbookPersonalVCardName(); |
692 | OContact::writeVCard( fname, new_personal ); | 696 | OContact::writeVCard( fname, new_personal ); |
693 | abView()->init(new_personal); | 697 | abView()->init(new_personal); |
694 | abView()->sync(); | 698 | abView()->sync(); |
695 | } | 699 | } |
696 | abEditor->setCaption( tr("Edit Address") ); | 700 | abEditor->setCaption( tr("Edit Address") ); |
701 | abEditor->setPersonalView( false ); | ||
697 | } | 702 | } |
698 | 703 | ||
699 | void AddressbookWindow::slotPersonalView() | 704 | void AddressbookWindow::slotPersonalView() |
700 | { | 705 | { |
701 | if (!actionPersonal->isOn()) { | 706 | if (!actionPersonal->isOn()) { |
702 | // we just turned it off | 707 | // we just turned it off |
703 | setCaption( tr("Contacts") ); | 708 | setCaption( tr("Contacts") ); |
704 | actionNew->setEnabled(TRUE); | 709 | actionNew->setEnabled(TRUE); |
705 | actionTrash->setEnabled(TRUE); | 710 | actionTrash->setEnabled(TRUE); |
706 | actionFind->setEnabled(TRUE); | 711 | actionFind->setEnabled(TRUE); |
707 | slotUpdateToolbar(); // maybe some of the above could be moved there | 712 | slotUpdateToolbar(); // maybe some of the above could be moved there |
708 | showList(); | 713 | showList(); |
709 | return; | 714 | return; |
710 | } | 715 | } |
711 | 716 | ||
712 | // XXX need to disable some QActions. | 717 | // XXX need to disable some QActions. |
713 | actionNew->setEnabled(FALSE); | 718 | actionNew->setEnabled(FALSE); |
714 | actionTrash->setEnabled(FALSE); | 719 | actionTrash->setEnabled(FALSE); |
715 | #ifndef MAKE_FOR_SHARP_ROM | 720 | #ifndef MAKE_FOR_SHARP_ROM |
716 | actionFind->setEnabled(FALSE); | 721 | actionFind->setEnabled(FALSE); |
717 | #endif | 722 | #endif |
718 | actionMail->setEnabled(FALSE); | 723 | actionMail->setEnabled(FALSE); |
719 | 724 | ||
720 | setCaption( tr("Contacts - My Personal Details") ); | 725 | setCaption( tr("Contacts - My Personal Details") ); |
721 | QString filename = addressbookPersonalVCardName(); | 726 | QString filename = addressbookPersonalVCardName(); |
722 | OContact me; | 727 | OContact me; |
723 | if (QFile::exists(filename)) | 728 | if (QFile::exists(filename)) |
724 | me = OContact::readVCard( filename )[0]; | 729 | me = OContact::readVCard( filename )[0]; |
725 | 730 | ||
726 | abView()->init( me ); | 731 | abView()->init( me ); |
727 | abView()->sync(); | 732 | abView()->sync(); |
728 | listContainer->hide(); | 733 | listContainer->hide(); |
729 | setCentralWidget( abView() ); | 734 | setCentralWidget( abView() ); |
730 | mView->show(); | 735 | mView->show(); |
731 | mView->setFocus(); | 736 | mView->setFocus(); |
732 | } | 737 | } |
733 | 738 | ||
734 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 739 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
735 | { | 740 | { |
736 | OContact entry; | 741 | OContact entry; |
737 | if ( bAbEditFirstTime ) { | 742 | if ( bAbEditFirstTime ) { |
738 | abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields, | 743 | abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields, |
739 | this, "editor" ); | 744 | this, "editor" ); |
740 | bAbEditFirstTime = FALSE; | 745 | bAbEditFirstTime = FALSE; |
741 | if ( entryMode == EditEntry ) | 746 | if ( entryMode == EditEntry ) |
742 | abEditor->setEntry( abList->currentEntry() ); | 747 | abEditor->setEntry( abList->currentEntry() ); |
743 | } | 748 | } |
744 | // other things may chane the caption. | 749 | // other things may chane the caption. |
745 | abEditor->setCaption( tr("Edit Address") ); | 750 | abEditor->setCaption( tr("Edit Address") ); |
746 | 751 | ||
747 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 752 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
748 | abEditor->showMaximized(); | 753 | abEditor->showMaximized(); |
749 | #endif | 754 | #endif |
750 | // fix the foxus... | 755 | // fix the foxus... |
751 | abEditor->setNameFocus(); | 756 | abEditor->setNameFocus(); |
752 | if ( abEditor->exec() ) { | 757 | if ( abEditor->exec() ) { |
753 | setFocus(); | 758 | setFocus(); |
754 | if ( entryMode == NewEntry ) { | 759 | if ( entryMode == NewEntry ) { |
755 | OContact insertEntry = abEditor->entry(); | 760 | OContact insertEntry = abEditor->entry(); |
756 | insertEntry.assignUid(); | 761 | insertEntry.assignUid(); |
757 | abList->addEntry( insertEntry ); | 762 | abList->addEntry( insertEntry ); |
758 | } else { | 763 | } else { |
759 | OContact replaceEntry = abEditor->entry(); | 764 | OContact replaceEntry = abEditor->entry(); |
760 | if ( !replaceEntry.isValidUid() ) | 765 | if ( !replaceEntry.isValidUid() ) |
761 | replaceEntry.assignUid(); | 766 | replaceEntry.assignUid(); |
762 | abList->replaceCurrentEntry( replaceEntry ); | 767 | abList->replaceCurrentEntry( replaceEntry ); |
763 | } | 768 | } |
764 | } | 769 | } |
765 | populateCategories(); | 770 | populateCategories(); |
766 | showList(); | 771 | showList(); |
767 | } | 772 | } |
768 | 773 | ||
769 | void AddressbookWindow::listIsEmpty( bool empty ) | 774 | void AddressbookWindow::listIsEmpty( bool empty ) |
770 | { | 775 | { |
771 | if ( !empty ) { | 776 | if ( !empty ) { |
772 | deleteButton->setEnabled( TRUE ); | 777 | deleteButton->setEnabled( TRUE ); |
773 | } | 778 | } |
774 | } | 779 | } |
775 | 780 | ||
776 | void AddressbookWindow::reload() | 781 | void AddressbookWindow::reload() |
777 | { | 782 | { |
778 | syncing = FALSE; | 783 | syncing = FALSE; |
779 | abList->clear(); | 784 | abList->clear(); |
780 | abList->reload(); | 785 | abList->reload(); |
781 | } | 786 | } |
782 | 787 | ||
783 | void AddressbookWindow::flush() | 788 | void AddressbookWindow::flush() |
784 | { | 789 | { |
785 | syncing = TRUE; | 790 | syncing = TRUE; |
786 | abList->save(); | 791 | abList->save(); |
787 | } | 792 | } |
788 | 793 | ||
789 | 794 | ||
790 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 795 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
791 | { | 796 | { |
792 | if ( centralWidget() == mView ) { | 797 | if ( centralWidget() == mView ) { |
793 | if (actionPersonal->isOn()) { | 798 | if (actionPersonal->isOn()) { |
794 | // pretend we clicked it off | 799 | // pretend we clicked it off |
795 | actionPersonal->setOn(FALSE); | 800 | actionPersonal->setOn(FALSE); |
796 | slotPersonalView(); | 801 | slotPersonalView(); |
797 | } else { | 802 | } else { |
798 | showList(); | 803 | showList(); |
799 | } | 804 | } |
800 | e->ignore(); | 805 | e->ignore(); |
801 | return; | 806 | return; |
802 | } | 807 | } |
803 | 808 | ||
804 | if(syncing) { | 809 | if(syncing) { |
805 | /* shouldn't we save, I hear you say? well its already been set | 810 | /* shouldn't we save, I hear you say? well its already been set |
806 | so that an edit can not occur during a sync, and we flushed | 811 | so that an edit can not occur during a sync, and we flushed |
807 | at the start of the sync, so there is no need to save | 812 | at the start of the sync, so there is no need to save |
808 | Saving however itself would cause problems. */ | 813 | Saving however itself would cause problems. */ |
809 | e->accept(); | 814 | e->accept(); |
810 | return; | 815 | return; |
811 | } | 816 | } |
812 | //################## shouldn't always save | 817 | //################## shouldn't always save |
813 | // True, but the database handles this automatically ! (se) | 818 | // True, but the database handles this automatically ! (se) |
814 | if ( save() ) | 819 | if ( save() ) |
815 | e->accept(); | 820 | e->accept(); |
816 | else | 821 | else |
817 | e->ignore(); | 822 | e->ignore(); |
818 | } | 823 | } |
819 | 824 | ||
820 | /* | 825 | /* |
821 | Returns TRUE if it is OK to exit | 826 | Returns TRUE if it is OK to exit |
822 | */ | 827 | */ |
823 | 828 | ||
824 | bool AddressbookWindow::save() | 829 | bool AddressbookWindow::save() |
825 | { | 830 | { |
826 | if ( !abList->save() ) { | 831 | if ( !abList->save() ) { |
827 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 832 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
828 | tr("Unable to save information.\n" | 833 | tr("Unable to save information.\n" |
829 | "Free up some space\n" | 834 | "Free up some space\n" |
830 | "and try again.\n" | 835 | "and try again.\n" |
831 | "\nQuit anyway?"), | 836 | "\nQuit anyway?"), |
832 | QMessageBox::Yes|QMessageBox::Escape, | 837 | QMessageBox::Yes|QMessageBox::Escape, |
833 | QMessageBox::No|QMessageBox::Default ) | 838 | QMessageBox::No|QMessageBox::Default ) |
834 | != QMessageBox::No ) | 839 | != QMessageBox::No ) |
835 | return TRUE; | 840 | return TRUE; |
836 | else | 841 | else |
837 | return FALSE; | 842 | return FALSE; |
838 | } | 843 | } |
839 | return TRUE; | 844 | return TRUE; |
840 | } | 845 | } |
841 | 846 | ||
842 | #ifdef __DEBUG_RELEASE | 847 | #ifdef __DEBUG_RELEASE |
843 | void AddressbookWindow::slotSave() | 848 | void AddressbookWindow::slotSave() |
844 | { | 849 | { |
845 | save(); | 850 | save(); |
846 | } | 851 | } |
847 | #endif | 852 | #endif |
848 | 853 | ||
849 | void AddressbookWindow::slotSettings() | 854 | void AddressbookWindow::slotSettings() |
850 | { | 855 | { |
851 | AddressSettings frmSettings( this ); | 856 | AddressSettings frmSettings( this ); |
852 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 857 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
853 | frmSettings.showMaximized(); | 858 | frmSettings.showMaximized(); |
854 | #endif | 859 | #endif |
855 | 860 | ||
856 | if ( frmSettings.exec() ) { | 861 | if ( frmSettings.exec() ) { |
857 | allFields.clear(); | 862 | allFields.clear(); |
858 | orderedFields.clear(); | 863 | orderedFields.clear(); |
859 | slOrderedFields.clear(); | 864 | slOrderedFields.clear(); |
860 | initFields(); | 865 | initFields(); |
861 | if ( abEditor ) | 866 | if ( abEditor ) |
862 | abEditor->loadFields(); | 867 | abEditor->loadFields(); |
863 | abList->refresh(); | 868 | abList->refresh(); |
864 | } | 869 | } |
865 | } | 870 | } |
866 | 871 | ||
867 | 872 | ||
868 | void AddressbookWindow::initFields() | 873 | void AddressbookWindow::initFields() |
869 | { | 874 | { |
870 | // we really don't need the things from the configuration, anymore | 875 | // we really don't need the things from the configuration, anymore |
871 | // only thing that is important are the important categories. So, | 876 | // only thing that is important are the important categories. So, |
872 | // Call the contact functions that correspond to these old functions... | 877 | // Call the contact functions that correspond to these old functions... |
873 | 878 | ||
874 | QStringList xmlFields = OContact::fields(); | 879 | QStringList xmlFields = OContact::fields(); |
875 | QStringList visibleFields = OContact::untrfields(); | 880 | QStringList visibleFields = OContact::untrfields(); |
876 | // QStringList trFields = OContact::trfields(); | 881 | // QStringList trFields = OContact::trfields(); |
877 | 882 | ||
878 | xmlFields.remove( "Title" ); | 883 | xmlFields.remove( "Title" ); |
879 | visibleFields.remove( "Name Title" ); | 884 | visibleFields.remove( "Name Title" ); |
880 | visibleFields.remove( "Notes" ); | 885 | visibleFields.remove( "Notes" ); |
881 | 886 | ||
882 | int i, version; | 887 | int i, version; |
883 | Config cfg( "AddressBook" ); | 888 | Config cfg( "AddressBook" ); |
884 | QString zn; | 889 | QString zn; |
885 | 890 | ||
886 | // ### Write a function to keep this from happening again... | 891 | // ### Write a function to keep this from happening again... |
887 | QStringList::ConstIterator it; | 892 | QStringList::ConstIterator it; |
888 | for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) { | 893 | for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) { |
889 | allFields.append( i + 3 ); | 894 | allFields.append( i + 3 ); |
890 | } | 895 | } |
891 | 896 | ||
892 | cfg.setGroup( "Version" ); | 897 | cfg.setGroup( "Version" ); |
893 | version = cfg.readNumEntry( "version" ); | 898 | version = cfg.readNumEntry( "version" ); |
894 | i = 0; | 899 | i = 0; |
895 | startFontSize = 1; | 900 | startFontSize = 1; |
896 | 901 | ||
897 | if ( version >= ADDRESSVERSION ) { | 902 | if ( version >= ADDRESSVERSION ) { |
898 | 903 | ||
899 | cfg.setGroup( "ImportantCategory" ); | 904 | cfg.setGroup( "ImportantCategory" ); |
900 | 905 | ||
901 | zn = cfg.readEntry( "Category" + QString::number(i), QString::null ); | 906 | zn = cfg.readEntry( "Category" + QString::number(i), QString::null ); |
902 | while ( !zn.isNull() ) { | 907 | while ( !zn.isNull() ) { |
903 | if ( zn.contains( "Work" ) || zn.contains( "Mb" ) ) { | 908 | if ( zn.contains( "Work" ) || zn.contains( "Mb" ) ) { |
904 | slOrderedFields.clear(); | 909 | slOrderedFields.clear(); |
905 | break; | 910 | break; |
906 | } | 911 | } |
907 | slOrderedFields.append( zn ); | 912 | slOrderedFields.append( zn ); |
908 | zn = cfg.readEntry( "Category" + QString::number(++i), QString::null ); | 913 | zn = cfg.readEntry( "Category" + QString::number(++i), QString::null ); |
909 | } | 914 | } |
910 | cfg.setGroup( "Font" ); | 915 | cfg.setGroup( "Font" ); |
911 | startFontSize = cfg.readNumEntry( "fontSize", 1 ); | 916 | startFontSize = cfg.readNumEntry( "fontSize", 1 ); |
912 | 917 | ||
913 | 918 | ||
914 | } else { | 919 | } else { |
915 | QString str; | 920 | QString str; |
916 | str = getenv("HOME"); | 921 | str = getenv("HOME"); |
917 | str += "/Settings/AddressBook.conf"; | 922 | str += "/Settings/AddressBook.conf"; |
918 | QFile::remove( str ); | 923 | QFile::remove( str ); |
919 | } | 924 | } |
920 | 925 | ||
921 | if ( slOrderedFields.count() > 0 ) { | 926 | if ( slOrderedFields.count() > 0 ) { |
922 | for( QStringList::ConstIterator it = slOrderedFields.begin(); | 927 | for( QStringList::ConstIterator it = slOrderedFields.begin(); |
923 | it != slOrderedFields.end(); ++it ) { | 928 | it != slOrderedFields.end(); ++it ) { |
924 | QValueList<int>::ConstIterator itVl; | 929 | QValueList<int>::ConstIterator itVl; |
925 | QStringList::ConstIterator itVis; | 930 | QStringList::ConstIterator itVis; |
926 | itVl = allFields.begin(); | 931 | itVl = allFields.begin(); |
927 | for ( itVis = visibleFields.begin(); | 932 | for ( itVis = visibleFields.begin(); |
928 | itVis != visibleFields.end() && itVl != allFields.end(); | 933 | itVis != visibleFields.end() && itVl != allFields.end(); |
929 | ++itVis, ++itVl ) { | 934 | ++itVis, ++itVl ) { |
930 | if ( *it == *itVis && itVl != allFields.end() ) { | 935 | if ( *it == *itVis && itVl != allFields.end() ) { |
931 | orderedFields.append( *itVl ); | 936 | orderedFields.append( *itVl ); |
932 | } | 937 | } |
933 | } | 938 | } |
934 | } | 939 | } |
935 | } else { | 940 | } else { |
936 | QValueList<int>::ConstIterator it; | 941 | QValueList<int>::ConstIterator it; |
937 | for ( it = allFields.begin(); it != allFields.end(); ++it ) | 942 | for ( it = allFields.begin(); it != allFields.end(); ++it ) |
938 | orderedFields.append( *it ); | 943 | orderedFields.append( *it ); |
939 | 944 | ||
940 | slOrderedFields = visibleFields; | 945 | slOrderedFields = visibleFields; |
941 | orderedFields.remove( Qtopia::AddressUid ); | 946 | orderedFields.remove( Qtopia::AddressUid ); |
942 | orderedFields.remove( Qtopia::Title ); | 947 | orderedFields.remove( Qtopia::Title ); |
943 | orderedFields.remove( Qtopia::Groups ); | 948 | orderedFields.remove( Qtopia::Groups ); |
944 | orderedFields.remove( Qtopia::AddressCategory ); | 949 | orderedFields.remove( Qtopia::AddressCategory ); |
945 | orderedFields.remove( Qtopia::FirstName ); | 950 | orderedFields.remove( Qtopia::FirstName ); |
946 | orderedFields.remove( Qtopia::LastName ); | 951 | orderedFields.remove( Qtopia::LastName ); |
947 | orderedFields.remove( Qtopia::DefaultEmail ); | 952 | orderedFields.remove( Qtopia::DefaultEmail ); |
948 | orderedFields.remove( Qtopia::FileAs ); | 953 | orderedFields.remove( Qtopia::FileAs ); |
949 | orderedFields.remove( Qtopia::Notes ); | 954 | orderedFields.remove( Qtopia::Notes ); |
950 | orderedFields.remove( Qtopia::Gender ); | 955 | orderedFields.remove( Qtopia::Gender ); |
951 | slOrderedFields.remove( "Name Title" ); | 956 | slOrderedFields.remove( "Name Title" ); |
952 | slOrderedFields.remove( "First Name" ); | 957 | slOrderedFields.remove( "First Name" ); |
953 | slOrderedFields.remove( "Last Name" ); | 958 | slOrderedFields.remove( "Last Name" ); |
954 | slOrderedFields.remove( "File As" ); | 959 | slOrderedFields.remove( "File As" ); |
955 | slOrderedFields.remove( "Default Email" ); | 960 | slOrderedFields.remove( "Default Email" ); |
956 | slOrderedFields.remove( "Notes" ); | 961 | slOrderedFields.remove( "Notes" ); |
957 | slOrderedFields.remove( "Gender" ); | 962 | slOrderedFields.remove( "Gender" ); |
958 | 963 | ||
959 | } | 964 | } |
960 | } | 965 | } |
961 | 966 | ||
962 | 967 | ||
963 | AbLabel *AddressbookWindow::abView() | 968 | AbLabel *AddressbookWindow::abView() |
964 | { | 969 | { |
965 | if ( !mView ) { | 970 | if ( !mView ) { |
966 | mView = new AbLabel( this, "viewer" ); | 971 | mView = new AbLabel( this, "viewer" ); |
967 | mView->init( OContact() ); | 972 | mView->init( OContact() ); |
968 | connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); | 973 | connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); |
969 | } | 974 | } |
970 | return mView; | 975 | return mView; |
971 | } | 976 | } |
972 | 977 | ||
973 | void AddressbookWindow::slotFindOpen() | 978 | void AddressbookWindow::slotFindOpen() |
974 | { | 979 | { |
975 | searchBar->show(); | 980 | searchBar->show(); |
976 | abList -> inSearch(); | 981 | abList -> inSearch(); |
977 | searchEdit->setFocus(); | 982 | searchEdit->setFocus(); |
978 | } | 983 | } |
979 | void AddressbookWindow::slotFindClose() | 984 | void AddressbookWindow::slotFindClose() |
980 | { | 985 | { |
981 | searchBar->hide(); | 986 | searchBar->hide(); |
982 | abList -> offSearch(); | 987 | abList -> offSearch(); |
983 | abList->setFocus(); | 988 | abList->setFocus(); |
984 | } | 989 | } |
985 | void AddressbookWindow::slotFindNext() | 990 | void AddressbookWindow::slotFindNext() |
986 | { | 991 | { |
987 | if ( centralWidget() == abView() ) | 992 | if ( centralWidget() == abView() ) |
988 | showList(); | 993 | showList(); |
989 | 994 | ||
990 | abList->slotDoFind( searchEdit->text(), caseSensitive, useRegExp, false); | 995 | abList->slotDoFind( searchEdit->text(), caseSensitive, useRegExp, false); |
991 | 996 | ||
992 | searchEdit->clearFocus(); | 997 | searchEdit->clearFocus(); |
993 | abList->setFocus(); | 998 | abList->setFocus(); |
994 | if ( abList->numSelections() ) | 999 | if ( abList->numSelections() ) |
995 | abList->clearSelection(); | 1000 | abList->clearSelection(); |
996 | 1001 | ||
997 | } | 1002 | } |
998 | void AddressbookWindow::slotFindPrevious() | 1003 | void AddressbookWindow::slotFindPrevious() |
999 | { | 1004 | { |
1000 | if ( centralWidget() == abView() ) | 1005 | if ( centralWidget() == abView() ) |
1001 | showList(); | 1006 | showList(); |
1002 | 1007 | ||
1003 | abList->slotDoFind( searchEdit->text(), caseSensitive, useRegExp, true); | 1008 | abList->slotDoFind( searchEdit->text(), caseSensitive, useRegExp, true); |
1004 | 1009 | ||
1005 | if ( abList->numSelections() ) | 1010 | if ( abList->numSelections() ) |
1006 | abList->clearSelection(); | 1011 | abList->clearSelection(); |
1007 | 1012 | ||
1008 | } | 1013 | } |
1009 | 1014 | ||
1010 | void AddressbookWindow::slotFind() | 1015 | void AddressbookWindow::slotFind() |
1011 | { | 1016 | { |
1012 | 1017 | ||
1013 | abList->clearFindRow(); | 1018 | abList->clearFindRow(); |
1014 | slotFindNext(); | 1019 | slotFindNext(); |
1015 | } | 1020 | } |
1016 | 1021 | ||
1017 | void AddressbookWindow::slotNotFound() | 1022 | void AddressbookWindow::slotNotFound() |
1018 | { | 1023 | { |
1019 | qWarning("Got notfound signal !"); | 1024 | qWarning("Got notfound signal !"); |
1020 | QMessageBox::information( this, tr( "Not Found" ), | 1025 | QMessageBox::information( this, tr( "Not Found" ), |
1021 | tr( "Unable to find a contact for this" ) + "\n" | 1026 | tr( "Unable to find a contact for this" ) + "\n" |
1022 | + tr( "search pattern !" ) ); | 1027 | + tr( "search pattern !" ) ); |
1023 | 1028 | ||
1024 | 1029 | ||
1025 | } | 1030 | } |
1026 | void AddressbookWindow::slotWrapAround() | 1031 | void AddressbookWindow::slotWrapAround() |
1027 | { | 1032 | { |
1028 | qWarning("Got wrap signal !"); | 1033 | qWarning("Got wrap signal !"); |
1029 | if ( doNotifyWrapAround ) | 1034 | if ( doNotifyWrapAround ) |
1030 | QMessageBox::information( this, tr( "End of list" ), | 1035 | QMessageBox::information( this, tr( "End of list" ), |
1031 | tr( "End of list. Wrap around now.. !" ) + "\n" ); | 1036 | tr( "End of list. Wrap around now.. !" ) + "\n" ); |
1032 | 1037 | ||
1033 | } | 1038 | } |
1034 | 1039 | ||
1035 | void AddressbookWindow::slotSetCategory( int c ) | 1040 | void AddressbookWindow::slotSetCategory( int c ) |
1036 | { | 1041 | { |
1037 | 1042 | ||
1038 | QString cat, book; | 1043 | QString cat, book; |
1039 | 1044 | ||
1040 | if ( c <= 0 ) | 1045 | if ( c <= 0 ) |
1041 | return; | 1046 | return; |
1042 | 1047 | ||
1043 | // Set checkItem for selected one | 1048 | // Set checkItem for selected one |
1044 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) | 1049 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) |
1045 | catMenu->setItemChecked( i, c == (int)i ); | 1050 | catMenu->setItemChecked( i, c == (int)i ); |
1046 | 1051 | ||
1047 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { | 1052 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { |
1048 | if (catMenu->isItemChecked( i )) { | 1053 | if (catMenu->isItemChecked( i )) { |
1049 | if ( i == 1 ) // default List view | 1054 | if ( i == 1 ) // default List view |
1050 | book = QString::null; | 1055 | book = QString::null; |
1051 | else if ( i == 2 ) | 1056 | else if ( i == 2 ) |
1052 | book = "Phone"; | 1057 | book = "Phone"; |
1053 | else if ( i == 3 ) | 1058 | else if ( i == 3 ) |
1054 | book = "Company"; | 1059 | book = "Company"; |
1055 | else if ( i == 4 ) | 1060 | else if ( i == 4 ) |
1056 | book = "Email"; | 1061 | book = "Email"; |
1057 | else if ( i == 5 ) | 1062 | else if ( i == 5 ) |
1058 | book = "Cards"; | 1063 | book = "Cards"; |
1059 | else if ( i == 6 ) // default All Categories | 1064 | else if ( i == 6 ) // default All Categories |
1060 | cat = QString::null; | 1065 | cat = QString::null; |
1061 | else if ( i == (unsigned int)catMenu->count() ) // last menu option will be Unfiled | 1066 | else if ( i == (unsigned int)catMenu->count() ) // last menu option will be Unfiled |
1062 | cat = "Unfiled"; | 1067 | cat = "Unfiled"; |
1063 | else | 1068 | else |
1064 | cat = abList->categories()[i - 7]; | 1069 | cat = abList->categories()[i - 7]; |
1065 | } | 1070 | } |
1066 | } | 1071 | } |
1067 | 1072 | ||
1068 | abList->setShowCategory( book, cat ); | 1073 | abList->setShowCategory( book, cat ); |
1069 | 1074 | ||
1070 | if ( book.isEmpty() ) | 1075 | if ( book.isEmpty() ) |
1071 | book = "List"; | 1076 | book = "List"; |
1072 | if ( cat.isEmpty() ) | 1077 | if ( cat.isEmpty() ) |
1073 | cat = "All"; | 1078 | cat = "All"; |
1074 | 1079 | ||
1075 | setCaption( tr( "Contacts" ) + " - " + tr( book ) + " - " + tr( cat ) ); | 1080 | setCaption( tr( "Contacts" ) + " - " + tr( book ) + " - " + tr( cat ) ); |
1076 | } | 1081 | } |
1077 | 1082 | ||
1078 | void AddressbookWindow::slotSetLetter( char c ) { | 1083 | void AddressbookWindow::slotSetLetter( char c ) { |
1079 | 1084 | ||
1080 | abList->setShowByLetter( c ); | 1085 | abList->setShowByLetter( c ); |
1081 | 1086 | ||
1082 | } | 1087 | } |
1083 | 1088 | ||
1084 | void AddressbookWindow::populateCategories() | 1089 | void AddressbookWindow::populateCategories() |
1085 | { | 1090 | { |
1086 | catMenu->clear(); | 1091 | catMenu->clear(); |
1087 | 1092 | ||
1088 | int id, rememberId; | 1093 | int id, rememberId; |
1089 | id = 1; | 1094 | id = 1; |
1090 | rememberId = 0; | 1095 | rememberId = 0; |
1091 | 1096 | ||
1092 | catMenu->insertItem( tr( "List" ), id++ ); | 1097 | catMenu->insertItem( tr( "List" ), id++ ); |
1093 | catMenu->insertItem( tr( "Phone Book" ), id++ ); | 1098 | catMenu->insertItem( tr( "Phone Book" ), id++ ); |
1094 | catMenu->insertItem( tr( "Company Book" ), id++ ); | 1099 | catMenu->insertItem( tr( "Company Book" ), id++ ); |
1095 | catMenu->insertItem( tr( "Email Book" ), id++ ); | 1100 | catMenu->insertItem( tr( "Email Book" ), id++ ); |
1096 | catMenu->insertItem( tr( "Cards" ), id++ ); | 1101 | catMenu->insertItem( tr( "Cards" ), id++ ); |
1097 | catMenu->insertSeparator(); | 1102 | catMenu->insertSeparator(); |
1098 | 1103 | ||
1099 | catMenu->insertItem( tr( "All" ), id++ ); | 1104 | catMenu->insertItem( tr( "All" ), id++ ); |
1100 | QStringList categories = abList->categories(); | 1105 | QStringList categories = abList->categories(); |
1101 | categories.append( tr( "Unfiled" ) ); | 1106 | categories.append( tr( "Unfiled" ) ); |
1102 | for ( QStringList::Iterator it = categories.begin(); | 1107 | for ( QStringList::Iterator it = categories.begin(); |
1103 | it != categories.end(); ++it ) { | 1108 | it != categories.end(); ++it ) { |
1104 | catMenu->insertItem( *it, id ); | 1109 | catMenu->insertItem( *it, id ); |
1105 | if ( *it == abList->showCategory() ) | 1110 | if ( *it == abList->showCategory() ) |
1106 | rememberId = id; | 1111 | rememberId = id; |
1107 | ++id; | 1112 | ++id; |
1108 | } | 1113 | } |
1109 | 1114 | ||
1110 | if ( abList->showBook().isEmpty() ) { | 1115 | if ( abList->showBook().isEmpty() ) { |
1111 | catMenu->setItemChecked( 1, true ); | 1116 | catMenu->setItemChecked( 1, true ); |
1112 | } else if ( abList->showBook() == "Phone" ) { | 1117 | } else if ( abList->showBook() == "Phone" ) { |
1113 | catMenu->setItemChecked( 2, true ); | 1118 | catMenu->setItemChecked( 2, true ); |
1114 | } else if ( abList->showBook() == "Company" ) { | 1119 | } else if ( abList->showBook() == "Company" ) { |
1115 | catMenu->setItemChecked( 3, true ); | 1120 | catMenu->setItemChecked( 3, true ); |
1116 | } else if ( abList->showBook() == "Email" ) { | 1121 | } else if ( abList->showBook() == "Email" ) { |
1117 | catMenu->setItemChecked( 4, true ); | 1122 | catMenu->setItemChecked( 4, true ); |
1118 | } else if ( abList->showBook() == "Cards" ) { | 1123 | } else if ( abList->showBook() == "Cards" ) { |
1119 | catMenu->setItemChecked( 5, true ); | 1124 | catMenu->setItemChecked( 5, true ); |
1120 | } | 1125 | } |
1121 | 1126 | ||
1122 | if ( abList->showCategory().isEmpty() ) { | 1127 | if ( abList->showCategory().isEmpty() ) { |
1123 | slotSetCategory( 6 ); | 1128 | slotSetCategory( 6 ); |
1124 | } | 1129 | } |
1125 | else { | 1130 | else { |
1126 | slotSetCategory( rememberId ); | 1131 | slotSetCategory( rememberId ); |
1127 | } | 1132 | } |
1128 | } | 1133 | } |
1129 | 1134 | ||
diff --git a/core/pim/addressbook/configdlg_base.ui b/core/pim/addressbook/configdlg_base.ui index d3ea12e..a6fcffa 100644 --- a/core/pim/addressbook/configdlg_base.ui +++ b/core/pim/addressbook/configdlg_base.ui | |||
@@ -1,335 +1,337 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>ConfigDlg_Base</class> | 2 | <class>ConfigDlg_Base</class> |
3 | <author>Stefan Eilers</author> | 3 | <author>Stefan Eilers</author> |
4 | <widget> | 4 | <widget> |
5 | <class>QDialog</class> | 5 | <class>QDialog</class> |
6 | <property stdset="1"> | 6 | <property stdset="1"> |
7 | <name>name</name> | 7 | <name>name</name> |
8 | <cstring>Configuration</cstring> | 8 | <cstring>Configuration</cstring> |
9 | </property> | 9 | </property> |
10 | <property stdset="1"> | 10 | <property stdset="1"> |
11 | <name>geometry</name> | 11 | <name>geometry</name> |
12 | <rect> | 12 | <rect> |
13 | <x>0</x> | 13 | <x>0</x> |
14 | <y>0</y> | 14 | <y>0</y> |
15 | <width>217</width> | 15 | <width>244</width> |
16 | <height>287</height> | 16 | <height>298</height> |
17 | </rect> | 17 | </rect> |
18 | </property> | 18 | </property> |
19 | <property stdset="1"> | 19 | <property stdset="1"> |
20 | <name>caption</name> | 20 | <name>caption</name> |
21 | <string>MyDialog1</string> | 21 | <string>MyDialog1</string> |
22 | </property> | 22 | </property> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>sizeGripEnabled</name> | 24 | <name>sizeGripEnabled</name> |
25 | <bool>true</bool> | 25 | <bool>true</bool> |
26 | </property> | 26 | </property> |
27 | <vbox> | 27 | <vbox> |
28 | <property stdset="1"> | 28 | <property stdset="1"> |
29 | <name>margin</name> | 29 | <name>margin</name> |
30 | <number>11</number> | 30 | <number>11</number> |
31 | </property> | 31 | </property> |
32 | <property stdset="1"> | 32 | <property stdset="1"> |
33 | <name>spacing</name> | 33 | <name>spacing</name> |
34 | <number>6</number> | 34 | <number>6</number> |
35 | </property> | 35 | </property> |
36 | <widget> | 36 | <widget> |
37 | <class>QTabWidget</class> | 37 | <class>QTabWidget</class> |
38 | <property stdset="1"> | 38 | <property stdset="1"> |
39 | <name>name</name> | 39 | <name>name</name> |
40 | <cstring>configDlg_base</cstring> | 40 | <cstring>configDlg_base</cstring> |
41 | </property> | 41 | </property> |
42 | <property> | 42 | <property> |
43 | <name>layoutMargin</name> | 43 | <name>layoutMargin</name> |
44 | </property> | 44 | </property> |
45 | <widget> | 45 | <widget> |
46 | <class>QWidget</class> | 46 | <class>QWidget</class> |
47 | <property stdset="1"> | 47 | <property stdset="1"> |
48 | <name>name</name> | 48 | <name>name</name> |
49 | <cstring>Widget5</cstring> | 49 | <cstring>Widget5</cstring> |
50 | </property> | 50 | </property> |
51 | <attribute> | 51 | <attribute> |
52 | <name>title</name> | 52 | <name>title</name> |
53 | <string>Search</string> | 53 | <string>Search</string> |
54 | </attribute> | 54 | </attribute> |
55 | <vbox> | 55 | <vbox> |
56 | <property stdset="1"> | 56 | <property stdset="1"> |
57 | <name>margin</name> | 57 | <name>margin</name> |
58 | <number>5</number> | 58 | <number>5</number> |
59 | </property> | 59 | </property> |
60 | <property stdset="1"> | 60 | <property stdset="1"> |
61 | <name>spacing</name> | 61 | <name>spacing</name> |
62 | <number>6</number> | 62 | <number>6</number> |
63 | </property> | 63 | </property> |
64 | <widget> | 64 | <widget> |
65 | <class>QButtonGroup</class> | 65 | <class>QButtonGroup</class> |
66 | <property stdset="1"> | 66 | <property stdset="1"> |
67 | <name>name</name> | 67 | <name>name</name> |
68 | <cstring>ButtonGroup1</cstring> | 68 | <cstring>ButtonGroup1</cstring> |
69 | </property> | 69 | </property> |
70 | <property stdset="1"> | 70 | <property stdset="1"> |
71 | <name>title</name> | 71 | <name>title</name> |
72 | <string>Query Style</string> | 72 | <string>Query Style</string> |
73 | </property> | 73 | </property> |
74 | <vbox> | 74 | <vbox> |
75 | <property stdset="1"> | 75 | <property stdset="1"> |
76 | <name>margin</name> | 76 | <name>margin</name> |
77 | <number>11</number> | 77 | <number>11</number> |
78 | </property> | 78 | </property> |
79 | <property stdset="1"> | 79 | <property stdset="1"> |
80 | <name>spacing</name> | 80 | <name>spacing</name> |
81 | <number>6</number> | 81 | <number>6</number> |
82 | </property> | 82 | </property> |
83 | <widget> | 83 | <widget> |
84 | <class>QRadioButton</class> | 84 | <class>QRadioButton</class> |
85 | <property stdset="1"> | 85 | <property stdset="1"> |
86 | <name>name</name> | 86 | <name>name</name> |
87 | <cstring>m_useRegExp</cstring> | 87 | <cstring>m_useRegExp</cstring> |
88 | </property> | 88 | </property> |
89 | <property stdset="1"> | 89 | <property stdset="1"> |
90 | <name>text</name> | 90 | <name>text</name> |
91 | <string>Use Regular Expressions</string> | 91 | <string>Use Regular Expressions</string> |
92 | </property> | 92 | </property> |
93 | </widget> | 93 | </widget> |
94 | <widget> | 94 | <widget> |
95 | <class>QRadioButton</class> | 95 | <class>QRadioButton</class> |
96 | <property stdset="1"> | 96 | <property stdset="1"> |
97 | <name>name</name> | 97 | <name>name</name> |
98 | <cstring>m_useWildCard</cstring> | 98 | <cstring>m_useWildCard</cstring> |
99 | </property> | 99 | </property> |
100 | <property stdset="1"> | 100 | <property stdset="1"> |
101 | <name>text</name> | 101 | <name>text</name> |
102 | <string>Use Wildcards (*,?)</string> | 102 | <string>Use Wildcards (*,?)</string> |
103 | </property> | 103 | </property> |
104 | <property stdset="1"> | 104 | <property stdset="1"> |
105 | <name>checked</name> | 105 | <name>checked</name> |
106 | <bool>true</bool> | 106 | <bool>true</bool> |
107 | </property> | 107 | </property> |
108 | </widget> | 108 | </widget> |
109 | </vbox> | 109 | </vbox> |
110 | </widget> | 110 | </widget> |
111 | <widget> | 111 | <widget> |
112 | <class>QCheckBox</class> | 112 | <class>QCheckBox</class> |
113 | <property stdset="1"> | 113 | <property stdset="1"> |
114 | <name>name</name> | 114 | <name>name</name> |
115 | <cstring>m_useCaseSensitive</cstring> | 115 | <cstring>m_useCaseSensitive</cstring> |
116 | </property> | 116 | </property> |
117 | <property stdset="1"> | 117 | <property stdset="1"> |
118 | <name>text</name> | 118 | <name>text</name> |
119 | <string>Case Sensitive</string> | 119 | <string>Case Sensitive</string> |
120 | </property> | 120 | </property> |
121 | </widget> | 121 | </widget> |
122 | <widget> | 122 | <widget> |
123 | <class>QCheckBox</class> | 123 | <class>QCheckBox</class> |
124 | <property stdset="1"> | 124 | <property stdset="1"> |
125 | <name>name</name> | 125 | <name>name</name> |
126 | <cstring>m_signalWrapAround</cstring> | 126 | <cstring>m_signalWrapAround</cstring> |
127 | </property> | 127 | </property> |
128 | <property stdset="1"> | 128 | <property stdset="1"> |
129 | <name>text</name> | 129 | <name>text</name> |
130 | <string>Signal Wrap Around</string> | 130 | <string>Signal Wrap Around</string> |
131 | </property> | 131 | </property> |
132 | </widget> | 132 | </widget> |
133 | <spacer> | 133 | <spacer> |
134 | <property> | 134 | <property> |
135 | <name>name</name> | 135 | <name>name</name> |
136 | <cstring>Spacer3</cstring> | 136 | <cstring>Spacer3</cstring> |
137 | </property> | 137 | </property> |
138 | <property stdset="1"> | 138 | <property stdset="1"> |
139 | <name>orientation</name> | 139 | <name>orientation</name> |
140 | <enum>Vertical</enum> | 140 | <enum>Vertical</enum> |
141 | </property> | 141 | </property> |
142 | <property stdset="1"> | 142 | <property stdset="1"> |
143 | <name>sizeType</name> | 143 | <name>sizeType</name> |
144 | <enum>Expanding</enum> | 144 | <enum>Expanding</enum> |
145 | </property> | 145 | </property> |
146 | <property> | 146 | <property> |
147 | <name>sizeHint</name> | 147 | <name>sizeHint</name> |
148 | <size> | 148 | <size> |
149 | <width>20</width> | 149 | <width>20</width> |
150 | <height>20</height> | 150 | <height>20</height> |
151 | </size> | 151 | </size> |
152 | </property> | 152 | </property> |
153 | </spacer> | 153 | </spacer> |
154 | </vbox> | 154 | </vbox> |
155 | </widget> | 155 | </widget> |
156 | <widget> | 156 | <widget> |
157 | <class>QWidget</class> | 157 | <class>QWidget</class> |
158 | <property stdset="1"> | 158 | <property stdset="1"> |
159 | <name>name</name> | 159 | <name>name</name> |
160 | <cstring>tab</cstring> | 160 | <cstring>tab</cstring> |
161 | </property> | 161 | </property> |
162 | <attribute> | 162 | <attribute> |
163 | <name>title</name> | 163 | <name>title</name> |
164 | <string>Mail</string> | 164 | <string>Mail</string> |
165 | </attribute> | 165 | </attribute> |
166 | <vbox> | 166 | <vbox> |
167 | <property stdset="1"> | 167 | <property stdset="1"> |
168 | <name>margin</name> | 168 | <name>margin</name> |
169 | <number>5</number> | 169 | <number>5</number> |
170 | </property> | 170 | </property> |
171 | <property stdset="1"> | 171 | <property stdset="1"> |
172 | <name>spacing</name> | 172 | <name>spacing</name> |
173 | <number>6</number> | 173 | <number>6</number> |
174 | </property> | 174 | </property> |
175 | <widget> | 175 | <widget> |
176 | <class>QButtonGroup</class> | 176 | <class>QButtonGroup</class> |
177 | <property stdset="1"> | 177 | <property stdset="1"> |
178 | <name>name</name> | 178 | <name>name</name> |
179 | <cstring>ButtonGroup2</cstring> | 179 | <cstring>ButtonGroup2</cstring> |
180 | </property> | 180 | </property> |
181 | <property stdset="1"> | 181 | <property stdset="1"> |
182 | <name>title</name> | 182 | <name>title</name> |
183 | <string>Mail</string> | 183 | <string>Mail</string> |
184 | </property> | 184 | </property> |
185 | <vbox> | 185 | <vbox> |
186 | <property stdset="1"> | 186 | <property stdset="1"> |
187 | <name>margin</name> | 187 | <name>margin</name> |
188 | <number>11</number> | 188 | <number>11</number> |
189 | </property> | 189 | </property> |
190 | <property stdset="1"> | 190 | <property stdset="1"> |
191 | <name>spacing</name> | 191 | <name>spacing</name> |
192 | <number>6</number> | 192 | <number>6</number> |
193 | </property> | 193 | </property> |
194 | <widget> | 194 | <widget> |
195 | <class>QRadioButton</class> | 195 | <class>QRadioButton</class> |
196 | <property stdset="1"> | 196 | <property stdset="1"> |
197 | <name>name</name> | 197 | <name>name</name> |
198 | <cstring>m_useQtMail</cstring> | 198 | <cstring>m_useQtMail</cstring> |
199 | </property> | 199 | </property> |
200 | <property stdset="1"> | 200 | <property stdset="1"> |
201 | <name>text</name> | 201 | <name>text</name> |
202 | <string>Prefer QT-Mail </string> | 202 | <string>Prefer QT-Mail </string> |
203 | </property> | 203 | </property> |
204 | <property stdset="1"> | 204 | <property stdset="1"> |
205 | <name>checked</name> | 205 | <name>checked</name> |
206 | <bool>true</bool> | 206 | <bool>true</bool> |
207 | </property> | 207 | </property> |
208 | </widget> | 208 | </widget> |
209 | <widget> | 209 | <widget> |
210 | <class>QRadioButton</class> | 210 | <class>QRadioButton</class> |
211 | <property stdset="1"> | 211 | <property stdset="1"> |
212 | <name>name</name> | 212 | <name>name</name> |
213 | <cstring>m_useOpieMail</cstring> | 213 | <cstring>m_useOpieMail</cstring> |
214 | </property> | 214 | </property> |
215 | <property stdset="1"> | 215 | <property stdset="1"> |
216 | <name>text</name> | 216 | <name>text</name> |
217 | <string>Prefer Opie-Mail</string> | 217 | <string>Prefer Opie-Mail</string> |
218 | </property> | 218 | </property> |
219 | </widget> | 219 | </widget> |
220 | <widget> | 220 | <widget> |
221 | <class>QLabel</class> | 221 | <class>QLabel</class> |
222 | <property stdset="1"> | 222 | <property stdset="1"> |
223 | <name>name</name> | 223 | <name>name</name> |
224 | <cstring>TextLabel1</cstring> | 224 | <cstring>TextLabel1</cstring> |
225 | </property> | 225 | </property> |
226 | <property stdset="1"> | 226 | <property stdset="1"> |
227 | <name>text</name> | 227 | <name>text</name> |
228 | <string>Notice: QT-Mail is just | 228 | <string>Notice: QT-Mail is just |
229 | provided in the SHARP | 229 | provided in the SHARP |
230 | default ROM. Opie-Mail | 230 | default ROM. Opie-Mail |
231 | is provided free !</string> | 231 | is provided free !</string> |
232 | </property> | 232 | </property> |
233 | </widget> | 233 | </widget> |
234 | </vbox> | 234 | </vbox> |
235 | </widget> | 235 | </widget> |
236 | <spacer> | 236 | <spacer> |
237 | <property> | 237 | <property> |
238 | <name>name</name> | 238 | <name>name</name> |
239 | <cstring>Spacer2</cstring> | 239 | <cstring>Spacer2</cstring> |
240 | </property> | 240 | </property> |
241 | <property stdset="1"> | 241 | <property stdset="1"> |
242 | <name>orientation</name> | 242 | <name>orientation</name> |
243 | <enum>Vertical</enum> | 243 | <enum>Vertical</enum> |
244 | </property> | 244 | </property> |
245 | <property stdset="1"> | 245 | <property stdset="1"> |
246 | <name>sizeType</name> | 246 | <name>sizeType</name> |
247 | <enum>Expanding</enum> | 247 | <enum>Expanding</enum> |
248 | </property> | 248 | </property> |
249 | <property> | 249 | <property> |
250 | <name>sizeHint</name> | 250 | <name>sizeHint</name> |
251 | <size> | 251 | <size> |
252 | <width>20</width> | 252 | <width>20</width> |
253 | <height>20</height> | 253 | <height>20</height> |
254 | </size> | 254 | </size> |
255 | </property> | 255 | </property> |
256 | </spacer> | 256 | </spacer> |
257 | </vbox> | 257 | </vbox> |
258 | </widget> | 258 | </widget> |
259 | </widget> | 259 | </widget> |
260 | <widget> | 260 | <widget> |
261 | <class>QLayoutWidget</class> | 261 | <class>QLayoutWidget</class> |
262 | <property stdset="1"> | 262 | <property stdset="1"> |
263 | <name>name</name> | 263 | <name>name</name> |
264 | <cstring>Layout1</cstring> | 264 | <cstring>Layout1</cstring> |
265 | </property> | 265 | </property> |
266 | <hbox> | 266 | <hbox> |
267 | <property stdset="1"> | 267 | <property stdset="1"> |
268 | <name>margin</name> | 268 | <name>margin</name> |
269 | <number>0</number> | 269 | <number>0</number> |
270 | </property> | 270 | </property> |
271 | <property stdset="1"> | 271 | <property stdset="1"> |
272 | <name>spacing</name> | 272 | <name>spacing</name> |
273 | <number>6</number> | 273 | <number>6</number> |
274 | </property> | 274 | </property> |
275 | <widget> | 275 | <widget> |
276 | <class>QPushButton</class> | 276 | <class>QPushButton</class> |
277 | <property stdset="1"> | 277 | <property stdset="1"> |
278 | <name>name</name> | 278 | <name>name</name> |
279 | <cstring>buttonOk</cstring> | 279 | <cstring>buttonOk</cstring> |
280 | </property> | 280 | </property> |
281 | <property stdset="1"> | 281 | <property stdset="1"> |
282 | <name>text</name> | 282 | <name>text</name> |
283 | <string>&OK</string> | 283 | <string>&OK</string> |
284 | </property> | 284 | </property> |
285 | <property stdset="1"> | 285 | <property stdset="1"> |
286 | <name>autoDefault</name> | 286 | <name>autoDefault</name> |
287 | <bool>true</bool> | 287 | <bool>true</bool> |
288 | </property> | 288 | </property> |
289 | <property stdset="1"> | 289 | <property stdset="1"> |
290 | <name>default</name> | 290 | <name>default</name> |
291 | <bool>true</bool> | 291 | <bool>true</bool> |
292 | </property> | 292 | </property> |
293 | </widget> | 293 | </widget> |
294 | <widget> | 294 | <widget> |
295 | <class>QPushButton</class> | 295 | <class>QPushButton</class> |
296 | <property stdset="1"> | 296 | <property stdset="1"> |
297 | <name>name</name> | 297 | <name>name</name> |
298 | <cstring>buttonCancel</cstring> | 298 | <cstring>buttonCancel</cstring> |
299 | </property> | 299 | </property> |
300 | <property stdset="1"> | 300 | <property stdset="1"> |
301 | <name>text</name> | 301 | <name>text</name> |
302 | <string>&Cancel</string> | 302 | <string>&Cancel</string> |
303 | </property> | 303 | </property> |
304 | <property stdset="1"> | 304 | <property stdset="1"> |
305 | <name>autoDefault</name> | 305 | <name>autoDefault</name> |
306 | <bool>true</bool> | 306 | <bool>true</bool> |
307 | </property> | 307 | </property> |
308 | </widget> | 308 | </widget> |
309 | </hbox> | 309 | </hbox> |
310 | </widget> | 310 | </widget> |
311 | </vbox> | 311 | </vbox> |
312 | </widget> | 312 | </widget> |
313 | <connections> | 313 | <connections> |
314 | <connection> | 314 | <connection> |
315 | <sender>buttonOk</sender> | 315 | <sender>buttonOk</sender> |
316 | <signal>clicked()</signal> | 316 | <signal>clicked()</signal> |
317 | <receiver>Configuration</receiver> | 317 | <receiver>Configuration</receiver> |
318 | <slot>accept()</slot> | 318 | <slot>accept()</slot> |
319 | </connection> | 319 | </connection> |
320 | <connection> | 320 | <connection> |
321 | <sender>buttonCancel</sender> | 321 | <sender>buttonCancel</sender> |
322 | <signal>clicked()</signal> | 322 | <signal>clicked()</signal> |
323 | <receiver>Configuration</receiver> | 323 | <receiver>Configuration</receiver> |
324 | <slot>reject()</slot> | 324 | <slot>reject()</slot> |
325 | </connection> | 325 | </connection> |
326 | </connections> | 326 | </connections> |
327 | <tabstops> | 327 | <tabstops> |
328 | <tabstop>configDlg_base</tabstop> | 328 | <tabstop>configDlg_base</tabstop> |
329 | <tabstop>m_useWildCard</tabstop> | 329 | <tabstop>m_useWildCard</tabstop> |
330 | <tabstop>m_useCaseSensitive</tabstop> | 330 | <tabstop>m_useCaseSensitive</tabstop> |
331 | <tabstop>m_signalWrapAround</tabstop> | 331 | <tabstop>m_signalWrapAround</tabstop> |
332 | <tabstop>m_useQtMail</tabstop> | ||
333 | <tabstop>m_useOpieMail</tabstop> | ||
332 | <tabstop>buttonOk</tabstop> | 334 | <tabstop>buttonOk</tabstop> |
333 | <tabstop>buttonCancel</tabstop> | 335 | <tabstop>buttonCancel</tabstop> |
334 | </tabstops> | 336 | </tabstops> |
335 | </UI> | 337 | </UI> |
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index e7f2ebd..a59a927 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -1,1808 +1,1901 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * | 3 | * |
4 | * This file is an add-on for the OPIE Palmtop Environment | 4 | * This file is an add-on for the OPIE Palmtop Environment |
5 | * | 5 | * |
6 | * This file may be distributed and/or modified under the terms of the | 6 | * This file may be distributed and/or modified under the terms of the |
7 | * GNU General Public License version 2 as published by the Free Software | 7 | * GNU General Public License version 2 as published by the Free Software |
8 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging | 8 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
9 | * of this file. | 9 | * of this file. |
10 | * | 10 | * |
11 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | * | 13 | * |
14 | * | 14 | * |
15 | * This is a rewrite of the abeditor.h file, modified to provide a more | 15 | * This is a rewrite of the abeditor.h file, modified to provide a more |
16 | * intuitive interface to TrollTech's original Address Book editor. This | 16 | * intuitive interface to TrollTech's original Address Book editor. This |
17 | * is made to operate exactly in interface with the exception of name. | 17 | * is made to operate exactly in interface with the exception of name. |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "contacteditor.h" | 21 | #include "contacteditor.h" |
22 | #include "addresspicker.h" | 22 | #include "addresspicker.h" |
23 | 23 | ||
24 | #include <qpe/categoryselect.h> | 24 | #include <qpe/categoryselect.h> |
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/qpedialog.h> | 26 | #include <qpe/qpedialog.h> |
27 | #include <qpe/timeconversion.h> | ||
27 | 28 | ||
28 | #include <qcombobox.h> | 29 | #include <qcombobox.h> |
29 | #include <qlabel.h> | 30 | #include <qlabel.h> |
30 | #include <qtabwidget.h> | 31 | #include <qtabwidget.h> |
31 | #include <qlayout.h> | 32 | #include <qlayout.h> |
32 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
33 | #include <qmultilineedit.h> | 34 | #include <qmultilineedit.h> |
34 | #include <qscrollview.h> | 35 | #include <qscrollview.h> |
35 | #include <qtoolbutton.h> | 36 | #include <qtoolbutton.h> |
36 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
37 | #include <qmainwindow.h> | 38 | #include <qmainwindow.h> |
38 | #include <qvaluelist.h> | 39 | #include <qvaluelist.h> |
40 | #include <qpopupmenu.h> | ||
39 | 41 | ||
40 | static inline bool containsAlphaNum( const QString &str ); | 42 | static inline bool containsAlphaNum( const QString &str ); |
41 | static inline bool constainsWhiteSpace( const QString &str ); | 43 | static inline bool constainsWhiteSpace( const QString &str ); |
42 | 44 | ||
43 | // helper functions, convert our comma delimited list to proper | 45 | // helper functions, convert our comma delimited list to proper |
44 | // file format... | 46 | // file format... |
45 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 47 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
46 | QString &strAll ); | 48 | QString &strAll ); |
47 | 49 | ||
48 | // helper convert from file format to comma delimited... | 50 | // helper convert from file format to comma delimited... |
49 | void parseEmailTo( const QString &strDefaultEmail, | 51 | void parseEmailTo( const QString &strDefaultEmail, |
50 | const QString &strOtherEmail, QString &strBack ); | 52 | const QString &strOtherEmail, QString &strBack ); |
51 | 53 | ||
52 | ContactEditor::ContactEditor(const OContact &entry, | 54 | ContactEditor::ContactEditor(const OContact &entry, |
53 | const QValueList<int> *newOrderedValues, | 55 | const QValueList<int> *newOrderedValues, |
54 | QStringList *slNewOrdered, | 56 | QStringList *slNewOrdered, |
55 | QWidget *parent, | 57 | QWidget *parent, |
56 | const char *name, | 58 | const char *name, |
57 | WFlags fl ) | 59 | WFlags fl ) |
58 | : QDialog( parent, name, TRUE, fl ), | 60 | : QDialog( parent, name, TRUE, fl ), |
59 | orderedValues( newOrderedValues ), | 61 | orderedValues( newOrderedValues ), |
60 | slOrdered( *slNewOrdered ) | 62 | slOrdered( *slNewOrdered ), |
63 | m_personalView ( false ) | ||
61 | { | 64 | { |
62 | 65 | ||
63 | init(); | 66 | init(); |
64 | initMap(); | 67 | initMap(); |
65 | setEntry( entry ); | 68 | setEntry( entry ); |
66 | qDebug("finish"); | 69 | qDebug("finish"); |
67 | } | 70 | } |
68 | 71 | ||
69 | ContactEditor::~ContactEditor() { | 72 | ContactEditor::~ContactEditor() { |
70 | } | 73 | } |
71 | 74 | ||
72 | void ContactEditor::init() { | 75 | void ContactEditor::init() { |
73 | 76 | ||
74 | useFullName = TRUE; | 77 | useFullName = TRUE; |
75 | 78 | ||
76 | int i = 0; | 79 | int i = 0; |
77 | /** SHut up and stop leaking | 80 | /** SHut up and stop leaking |
78 | slHomeAddress = new QStringList; | 81 | slHomeAddress = new QStringList; |
79 | slBusinessAddress = new QStringList; | 82 | slBusinessAddress = new QStringList; |
80 | slChooserNames = new QStringList; | 83 | slChooserNames = new QStringList; |
81 | slChooserValues = new QStringList; | 84 | slChooserValues = new QStringList; |
82 | 85 | ||
83 | slDynamicEntries = new QStringList; | 86 | slDynamicEntries = new QStringList; |
84 | */ | 87 | */ |
85 | //*slDynamicEntries = *slOrdered; | 88 | //*slDynamicEntries = *slOrdered; |
86 | 89 | ||
87 | QStringList trlChooserNames; | 90 | QStringList trlChooserNames; |
88 | 91 | ||
89 | for (i = 0; i <= 6; i++) { | 92 | for (i = 0; i <= 6; i++) { |
90 | slHomeAddress.append( "" ); | 93 | slHomeAddress.append( "" ); |
91 | slBusinessAddress.append( "" ); | 94 | slBusinessAddress.append( "" ); |
92 | } | 95 | } |
93 | 96 | ||
94 | { | 97 | { |
95 | hasGender = FALSE; | 98 | hasGender = FALSE; |
96 | hasTitle = FALSE; | 99 | hasTitle = FALSE; |
97 | hasCompany = FALSE; | 100 | hasCompany = FALSE; |
98 | hasNotes = FALSE; | 101 | hasNotes = FALSE; |
99 | hasStreet = FALSE; | 102 | hasStreet = FALSE; |
100 | hasStreet2 = FALSE; | 103 | hasStreet2 = FALSE; |
101 | hasPOBox = FALSE; | 104 | hasPOBox = FALSE; |
102 | hasCity = FALSE; | 105 | hasCity = FALSE; |
103 | hasState = FALSE; | 106 | hasState = FALSE; |
104 | hasZip = FALSE; | 107 | hasZip = FALSE; |
105 | hasCountry = FALSE; | 108 | hasCountry = FALSE; |
106 | 109 | ||
107 | QStringList::ConstIterator it = slOrdered.begin(); | 110 | QStringList::ConstIterator it = slOrdered.begin(); |
108 | 111 | ||
109 | for ( i = 0; it != slOrdered.end(); i++, ++it ) { | 112 | for ( i = 0; it != slOrdered.end(); i++, ++it ) { |
110 | 113 | ||
111 | if ( (*it) == "Business Fax" ) { | 114 | if ( (*it) == "Business Fax" ) { |
112 | trlChooserNames.append( tr( "Business Fax" ) ); | 115 | trlChooserNames.append( tr( "Business Fax" ) ); |
113 | slChooserNames.append( *it ); | 116 | slChooserNames.append( *it ); |
114 | slChooserValues.append("" ); | 117 | slChooserValues.append("" ); |
115 | //slDynamicEntries->remove( it ); | 118 | //slDynamicEntries->remove( it ); |
116 | continue; | 119 | continue; |
117 | } | 120 | } |
118 | 121 | ||
119 | if ( (*it) == "Home Fax" ) { | 122 | if ( (*it) == "Home Fax" ) { |
120 | trlChooserNames.append( tr( "Home Fax" ) ); | 123 | trlChooserNames.append( tr( "Home Fax" ) ); |
121 | slChooserNames.append( *it ); | 124 | slChooserNames.append( *it ); |
122 | slChooserValues.append("" ); | 125 | slChooserValues.append("" ); |
123 | //slDynamicEntries->remove( it ); | 126 | //slDynamicEntries->remove( it ); |
124 | continue; | 127 | continue; |
125 | } | 128 | } |
126 | 129 | ||
127 | 130 | ||
128 | if ( (*it) == "Business Phone" ) { | 131 | if ( (*it) == "Business Phone" ) { |
129 | trlChooserNames.append( tr( "Business Phone" ) ); | 132 | trlChooserNames.append( tr( "Business Phone" ) ); |
130 | slChooserNames.append( *it ); | 133 | slChooserNames.append( *it ); |
131 | slChooserValues.append( "" ); | 134 | slChooserValues.append( "" ); |
132 | //slDynamicEntries->remove( it ); | 135 | //slDynamicEntries->remove( it ); |
133 | continue; | 136 | continue; |
134 | } | 137 | } |
135 | 138 | ||
136 | if ( (*it) == "Home Phone" ) { | 139 | if ( (*it) == "Home Phone" ) { |
137 | trlChooserNames.append( tr( "Home Phone" ) ); | 140 | trlChooserNames.append( tr( "Home Phone" ) ); |
138 | slChooserNames.append( *it ); | 141 | slChooserNames.append( *it ); |
139 | slChooserValues.append( "" ); | 142 | slChooserValues.append( "" ); |
140 | //slDynamicEntries->remove( it ); | 143 | //slDynamicEntries->remove( it ); |
141 | continue; | 144 | continue; |
142 | } | 145 | } |
143 | 146 | ||
144 | /* | 147 | /* |
145 | if ( (*it).right( 2 ) == tr( "IM" ) ) { | 148 | if ( (*it).right( 2 ) == tr( "IM" ) ) { |
146 | slChooserNames.append( *it ); | 149 | slChooserNames.append( *it ); |
147 | slChooserValues.append( "" ); | 150 | slChooserValues.append( "" ); |
148 | //slDynamicEntries->remove( it ); | 151 | //slDynamicEntries->remove( it ); |
149 | continue; | 152 | continue; |
150 | } */ | 153 | } */ |
151 | 154 | ||
152 | if ( (*it) == "Business Mobile" ) { | 155 | if ( (*it) == "Business Mobile" ) { |
153 | trlChooserNames.append( tr( "Business Mobile" ) ); | 156 | trlChooserNames.append( tr( "Business Mobile" ) ); |
154 | slChooserNames.append( *it ); | 157 | slChooserNames.append( *it ); |
155 | slChooserValues.append( "" ); | 158 | slChooserValues.append( "" ); |
156 | //slDynamicEntries->remove( it ); | 159 | //slDynamicEntries->remove( it ); |
157 | continue; | 160 | continue; |
158 | } | 161 | } |
159 | 162 | ||
160 | if ( (*it) == "Home Mobile" ) { | 163 | if ( (*it) == "Home Mobile" ) { |
161 | trlChooserNames.append( tr( "Home Mobile" ) ); | 164 | trlChooserNames.append( tr( "Home Mobile" ) ); |
162 | slChooserNames.append( *it ); | 165 | slChooserNames.append( *it ); |
163 | slChooserValues.append( "" ); | 166 | slChooserValues.append( "" ); |
164 | //slDynamicEntries->remove( it ); | 167 | //slDynamicEntries->remove( it ); |
165 | continue; | 168 | continue; |
166 | } | 169 | } |
167 | 170 | ||
168 | 171 | ||
169 | if ( (*it) == "Business WebPage" ) { | 172 | if ( (*it) == "Business WebPage" ) { |
170 | trlChooserNames.append( tr( "Business WebPage" ) ); | 173 | trlChooserNames.append( tr( "Business WebPage" ) ); |
171 | slChooserNames.append( *it ); | 174 | slChooserNames.append( *it ); |
172 | slChooserValues.append( "" ); | 175 | slChooserValues.append( "" ); |
173 | //slDynamicEntries->remove( it ); | 176 | //slDynamicEntries->remove( it ); |
174 | continue; | 177 | continue; |
175 | } | 178 | } |
176 | 179 | ||
177 | if ( (*it) == "Home Web Page" ) { | 180 | if ( (*it) == "Home Web Page" ) { |
178 | trlChooserNames.append( tr( "Home Web Page" ) ); | 181 | trlChooserNames.append( tr( "Home Web Page" ) ); |
179 | slChooserNames.append( *it ); | 182 | slChooserNames.append( *it ); |
180 | slChooserValues.append( "" ); | 183 | slChooserValues.append( "" ); |
181 | //slDynamicEntries->remove( it ); | 184 | //slDynamicEntries->remove( it ); |
182 | continue; | 185 | continue; |
183 | } | 186 | } |
184 | 187 | ||
185 | if ( (*it) == "Business Pager" ) { | 188 | if ( (*it) == "Business Pager" ) { |
186 | trlChooserNames.append( tr( "Business Pager" ) ); | 189 | trlChooserNames.append( tr( "Business Pager" ) ); |
187 | slChooserNames.append( *it ); | 190 | slChooserNames.append( *it ); |
188 | slChooserValues.append( "" ); | 191 | slChooserValues.append( "" ); |
189 | //slDynamicEntries->remove( it ); | 192 | //slDynamicEntries->remove( it ); |
190 | continue; | 193 | continue; |
191 | } | 194 | } |
192 | 195 | ||
193 | if ( *it == "Default Email" ) { | 196 | if ( *it == "Default Email" ) { |
194 | trlChooserNames.append( tr( "Default Email" ) ); | 197 | trlChooserNames.append( tr( "Default Email" ) ); |
195 | slChooserNames.append( *it ); | 198 | slChooserNames.append( *it ); |
196 | slChooserValues.append( "" ); | 199 | slChooserValues.append( "" ); |
197 | //slDynamicEntries->remove( it ); | 200 | //slDynamicEntries->remove( it ); |
198 | continue; | 201 | continue; |
199 | } | 202 | } |
200 | 203 | ||
201 | if ( *it == "Emails" ) { | 204 | if ( *it == "Emails" ) { |
202 | trlChooserNames.append( tr( "Emails" ) ); | 205 | trlChooserNames.append( tr( "Emails" ) ); |
203 | slChooserNames.append( *it ); | 206 | slChooserNames.append( *it ); |
204 | slChooserValues.append( "" ); | 207 | slChooserValues.append( "" ); |
205 | //slDynamicEntries->remove( it ); | 208 | //slDynamicEntries->remove( it ); |
206 | continue; | 209 | continue; |
207 | } | 210 | } |
208 | 211 | ||
209 | if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" ) | 212 | if ( *it == "Name Title" || |
213 | *it == "First Name" || | ||
214 | *it == "Middle Name" || | ||
215 | *it == "Last Name" || | ||
216 | *it == "File As" || | ||
217 | *it == "Default Email" || | ||
218 | *it == "Emails" || | ||
219 | *it == "Groups" || | ||
220 | *it == "Anniversary" || | ||
221 | *it == "Birthday" ) | ||
210 | continue; | 222 | continue; |
211 | 223 | ||
212 | if ( *it == "Name Title" ) { | 224 | if ( *it == "Name Title" ) { |
213 | //slDynamicEntries->remove( it ); | 225 | //slDynamicEntries->remove( it ); |
214 | continue; | 226 | continue; |
215 | } | 227 | } |
216 | 228 | ||
217 | if ( *it == "First Name" ) { | 229 | if ( *it == "First Name" ) { |
218 | //slDynamicEntries->remove( it ); | 230 | //slDynamicEntries->remove( it ); |
219 | continue; | 231 | continue; |
220 | } | 232 | } |
221 | 233 | ||
222 | if ( *it == "Middle Name" ) { | 234 | if ( *it == "Middle Name" ) { |
223 | //slDynamicEntries->remove( it ); | 235 | //slDynamicEntries->remove( it ); |
224 | continue; | 236 | continue; |
225 | } | 237 | } |
226 | 238 | ||
227 | if ( *it == "Last Name" ) { | 239 | if ( *it == "Last Name" ) { |
228 | //slDynamicEntries->remove( it ); | 240 | //slDynamicEntries->remove( it ); |
229 | continue; | 241 | continue; |
230 | } | 242 | } |
231 | 243 | ||
232 | if ( *it == "Suffix" ) { | 244 | if ( *it == "Suffix" ) { |
233 | //slDynamicEntries->remove( it ); | 245 | //slDynamicEntries->remove( it ); |
234 | continue; | 246 | continue; |
235 | } | 247 | } |
236 | 248 | ||
237 | if ( *it == "File As" ) { | 249 | if ( *it == "File As" ) { |
238 | //slDynamicEntries->remove( it ); | 250 | //slDynamicEntries->remove( it ); |
239 | continue; | 251 | continue; |
240 | } | 252 | } |
241 | 253 | ||
242 | if ( *it == "Gender" ) { | 254 | if ( *it == "Gender" ) { |
243 | hasGender = TRUE; | 255 | hasGender = TRUE; |
244 | //slDynamicEntries->remove( it ); | 256 | //slDynamicEntries->remove( it ); |
245 | continue; | 257 | continue; |
246 | } | 258 | } |
247 | 259 | ||
248 | if ( *it == "Job Title" ) { | 260 | if ( *it == "Job Title" ) { |
249 | hasTitle = TRUE; | 261 | hasTitle = TRUE; |
250 | //slDynamicEntries->remove( it ); | 262 | //slDynamicEntries->remove( it ); |
251 | continue; | 263 | continue; |
252 | } | 264 | } |
253 | 265 | ||
254 | if ( ( *it == "Company") || (*it == "Organization" ) ) { | 266 | if ( ( *it == "Company") || (*it == "Organization" ) ) { |
255 | hasCompany = TRUE; | 267 | hasCompany = TRUE; |
256 | //slDynamicEntries->remove( it ); | 268 | //slDynamicEntries->remove( it ); |
257 | continue; | 269 | continue; |
258 | } | 270 | } |
259 | 271 | ||
260 | if ( *it == "Notes" ) { | 272 | if ( *it == "Notes" ) { |
261 | hasNotes = TRUE; | 273 | hasNotes = TRUE; |
262 | //slDynamicEntries->remove( it ); | 274 | //slDynamicEntries->remove( it ); |
263 | continue; | 275 | continue; |
264 | } | 276 | } |
265 | 277 | ||
266 | if ( *it == "Groups" ) { | 278 | if ( *it == "Groups" ) { |
267 | //slDynamicEntries->remove( it ); | 279 | //slDynamicEntries->remove( it ); |
268 | continue; | 280 | continue; |
269 | } | 281 | } |
270 | 282 | ||
271 | if ( (*it) == "Business Street" ) { | 283 | if ( (*it) == "Business Street" ) { |
272 | hasStreet = TRUE; | 284 | hasStreet = TRUE; |
273 | //slDynamicEntries->remove( it ); | 285 | //slDynamicEntries->remove( it ); |
274 | continue; | 286 | continue; |
275 | } | 287 | } |
276 | 288 | ||
277 | if ( (*it) == "Home Street" ) { | 289 | if ( (*it) == "Home Street" ) { |
278 | hasStreet = TRUE; | 290 | hasStreet = TRUE; |
279 | //slDynamicEntries->remove( it ); | 291 | //slDynamicEntries->remove( it ); |
280 | continue; | 292 | continue; |
281 | } | 293 | } |
282 | /* | 294 | /* |
283 | if ( (*it).right( 8 ) == tr( "Street 2" ) ) { | 295 | if ( (*it).right( 8 ) == tr( "Street 2" ) ) { |
284 | hasStreet2 = TRUE; | 296 | hasStreet2 = TRUE; |
285 | //slDynamicEntries->remove( it ); | 297 | //slDynamicEntries->remove( it ); |
286 | continue; | 298 | continue; |
287 | } | 299 | } |
288 | 300 | ||
289 | if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { | 301 | if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { |
290 | hasPOBox = TRUE; | 302 | hasPOBox = TRUE; |
291 | //slDynamicEntries->remove( it ); | 303 | //slDynamicEntries->remove( it ); |
292 | continue; | 304 | continue; |
293 | } */ | 305 | } */ |
294 | 306 | ||
295 | if ( (*it) == "Business City" ) { | 307 | if ( (*it) == "Business City" ) { |
296 | hasCity = TRUE; | 308 | hasCity = TRUE; |
297 | //slDynamicEntries->remove( it ); | 309 | //slDynamicEntries->remove( it ); |
298 | continue; | 310 | continue; |
299 | } | 311 | } |
300 | 312 | ||
301 | if ( (*it) == "Business State" ) { | 313 | if ( (*it) == "Business State" ) { |
302 | hasState = TRUE; | 314 | hasState = TRUE; |
303 | //slDynamicEntries->remove( it ); | 315 | //slDynamicEntries->remove( it ); |
304 | continue; | 316 | continue; |
305 | } | 317 | } |
306 | 318 | ||
307 | if ( (*it) == "Business Zip" ) { | 319 | if ( (*it) == "Business Zip" ) { |
308 | hasZip = TRUE; | 320 | hasZip = TRUE; |
309 | //slDynamicEntries->remove( it ); | 321 | //slDynamicEntries->remove( it ); |
310 | continue; | 322 | continue; |
311 | } | 323 | } |
312 | 324 | ||
313 | if ( (*it) == "Business Country" ) { | 325 | if ( (*it) == "Business Country" ) { |
314 | hasCountry = TRUE; | 326 | hasCountry = TRUE; |
315 | //slDynamicEntries->remove( it ); | 327 | //slDynamicEntries->remove( it ); |
316 | continue; | 328 | continue; |
317 | } | 329 | } |
318 | 330 | ||
319 | if ( (*it) == "Home City" ) { | 331 | if ( (*it) == "Home City" ) { |
320 | hasCity = TRUE; | 332 | hasCity = TRUE; |
321 | //slDynamicEntries->remove( it ); | 333 | //slDynamicEntries->remove( it ); |
322 | continue; | 334 | continue; |
323 | } | 335 | } |
324 | 336 | ||
325 | if ( (*it) == "Home State" ) { | 337 | if ( (*it) == "Home State" ) { |
326 | hasState = TRUE; | 338 | hasState = TRUE; |
327 | //slDynamicEntries->remove( it ); | 339 | //slDynamicEntries->remove( it ); |
328 | continue; | 340 | continue; |
329 | } | 341 | } |
330 | 342 | ||
331 | if ( (*it) == "Home Zip" ) { | 343 | if ( (*it) == "Home Zip" ) { |
332 | hasZip = TRUE; | 344 | hasZip = TRUE; |
333 | //slDynamicEntries->remove( it ); | 345 | //slDynamicEntries->remove( it ); |
334 | continue; | 346 | continue; |
335 | } | 347 | } |
336 | 348 | ||
337 | if ( (*it) == "Home Country" ) { | 349 | if ( (*it) == "Home Country" ) { |
338 | hasCountry = TRUE; | 350 | hasCountry = TRUE; |
339 | //slDynamicEntries->remove( it ); | 351 | //slDynamicEntries->remove( it ); |
340 | continue; | 352 | continue; |
341 | } | 353 | } |
342 | 354 | ||
343 | slDynamicEntries.append( *it ); | 355 | slDynamicEntries.append( *it ); |
344 | } | 356 | } |
345 | } | 357 | } |
346 | 358 | ||
347 | QVBoxLayout *vb = new QVBoxLayout( this ); | 359 | QVBoxLayout *vb = new QVBoxLayout( this ); |
348 | 360 | ||
349 | tabMain = new QTabWidget( this ); | 361 | tabMain = new QTabWidget( this ); |
350 | vb->addWidget( tabMain ); | 362 | vb->addWidget( tabMain ); |
351 | 363 | ||
352 | QWidget *tabViewport = new QWidget ( tabMain ); | 364 | QWidget *tabViewport = new QWidget ( tabMain ); |
353 | 365 | ||
354 | vb = new QVBoxLayout( tabViewport ); | 366 | vb = new QVBoxLayout( tabViewport ); |
355 | 367 | ||
356 | svGeneral = new QScrollView( tabViewport ); | 368 | svGeneral = new QScrollView( tabViewport ); |
357 | vb->addWidget( svGeneral, 0, 0 ); | 369 | vb->addWidget( svGeneral, 0, 0 ); |
358 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 370 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
359 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 371 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
360 | 372 | ||
361 | QWidget *container = new QWidget( svGeneral->viewport() ); | 373 | QWidget *container = new QWidget( svGeneral->viewport() ); |
362 | svGeneral->addChild( container ); | 374 | svGeneral->addChild( container ); |
363 | 375 | ||
364 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 376 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); |
365 | gl->setResizeMode( QLayout::FreeResize ); | 377 | gl->setResizeMode( QLayout::FreeResize ); |
366 | 378 | ||
367 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 379 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
368 | gl->addWidget( btnFullName, 0, 0 ); | 380 | gl->addWidget( btnFullName, 0, 0 ); |
369 | txtFullName = new QLineEdit( container ); | 381 | txtFullName = new QLineEdit( container ); |
370 | gl->addWidget( txtFullName, 0, 1 ); | 382 | gl->addWidget( txtFullName, 0, 1 ); |
371 | 383 | ||
372 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 384 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
373 | gl->addWidget( l, 1, 0 ); | 385 | gl->addWidget( l, 1, 0 ); |
374 | txtJobTitle = new QLineEdit( container ); | 386 | txtJobTitle = new QLineEdit( container ); |
375 | gl->addWidget( txtJobTitle, 1, 1 ); | 387 | gl->addWidget( txtJobTitle, 1, 1 ); |
376 | 388 | ||
377 | l = new QLabel( tr( "Organization" ), container ); | 389 | l = new QLabel( tr( "Organization" ), container ); |
378 | gl->addWidget( l, 2, 0 ); | 390 | gl->addWidget( l, 2, 0 ); |
379 | txtOrganization = new QLineEdit( container ); | 391 | txtOrganization = new QLineEdit( container ); |
380 | gl->addWidget( txtOrganization, 2, 1 ); | 392 | gl->addWidget( txtOrganization, 2, 1 ); |
381 | 393 | ||
382 | cmbChooserField1 = new QComboBox( FALSE, container ); | 394 | cmbChooserField1 = new QComboBox( FALSE, container ); |
383 | cmbChooserField1->setMaximumWidth( 90 ); | 395 | cmbChooserField1->setMaximumWidth( 90 ); |
384 | gl->addWidget( cmbChooserField1, 3, 0 ); | 396 | gl->addWidget( cmbChooserField1, 3, 0 ); |
385 | txtChooserField1 = new QLineEdit( container ); | 397 | txtChooserField1 = new QLineEdit( container ); |
386 | gl->addWidget( txtChooserField1, 3, 1 ); | 398 | gl->addWidget( txtChooserField1, 3, 1 ); |
387 | 399 | ||
388 | cmbChooserField2 = new QComboBox( FALSE, container ); | 400 | cmbChooserField2 = new QComboBox( FALSE, container ); |
389 | cmbChooserField2->setMaximumWidth( 90 ); | 401 | cmbChooserField2->setMaximumWidth( 90 ); |
390 | gl->addWidget( cmbChooserField2, 4, 0 ); | 402 | gl->addWidget( cmbChooserField2, 4, 0 ); |
391 | txtChooserField2 = new QLineEdit( container ); | 403 | txtChooserField2 = new QLineEdit( container ); |
392 | gl->addWidget( txtChooserField2, 4, 1 ); | 404 | gl->addWidget( txtChooserField2, 4, 1 ); |
393 | 405 | ||
394 | cmbChooserField3 = new QComboBox( FALSE, container ); | 406 | cmbChooserField3 = new QComboBox( FALSE, container ); |
395 | cmbChooserField3->setMaximumWidth( 90 ); | 407 | cmbChooserField3->setMaximumWidth( 90 ); |
396 | gl->addWidget( cmbChooserField3, 5, 0 ); | 408 | gl->addWidget( cmbChooserField3, 5, 0 ); |
397 | txtChooserField3 = new QLineEdit( container ); | 409 | txtChooserField3 = new QLineEdit( container ); |
398 | gl->addWidget( txtChooserField3, 5, 1 ); | 410 | gl->addWidget( txtChooserField3, 5, 1 ); |
399 | 411 | ||
400 | l = new QLabel( tr( "File As" ), container ); | 412 | l = new QLabel( tr( "File As" ), container ); |
401 | gl->addWidget( l, 6, 0 ); | 413 | gl->addWidget( l, 6, 0 ); |
402 | cmbFileAs = new QComboBox( TRUE, container ); | 414 | cmbFileAs = new QComboBox( TRUE, container ); |
403 | gl->addWidget( cmbFileAs, 6, 1 ); | 415 | gl->addWidget( cmbFileAs, 6, 1 ); |
404 | 416 | ||
405 | l = new QLabel( tr( "Category" ), container ); | 417 | labCat = new QLabel( tr( "Category" ), container ); |
406 | gl->addWidget( l, 7, 0 ); | 418 | gl->addWidget( labCat, 7, 0 ); |
407 | cmbCat = new CategorySelect( container ); | 419 | cmbCat = new CategorySelect( container ); |
408 | gl->addWidget( cmbCat, 7, 1 ); | 420 | gl->addWidget( cmbCat, 7, 1 ); |
409 | 421 | ||
422 | // We don't need categories for the personal view | ||
423 | if ( m_personalView ){ | ||
424 | qWarning("Disable Category.."); | ||
425 | labCat->hide(); | ||
426 | cmbCat->hide(); | ||
427 | } else { | ||
428 | labCat->show(); | ||
429 | cmbCat->show(); | ||
430 | } | ||
431 | |||
410 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 432 | btnNote = new QPushButton( tr( "Notes..." ), container ); |
411 | gl->addWidget( btnNote, 8, 1 ); | 433 | gl->addWidget( btnNote, 8, 1 ); |
412 | 434 | ||
413 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 435 | tabMain->insertTab( tabViewport, tr( "General" ) ); |
414 | 436 | ||
415 | tabViewport = new QWidget ( tabMain ); | 437 | tabViewport = new QWidget ( tabMain ); |
416 | 438 | ||
417 | vb = new QVBoxLayout( tabViewport ); | 439 | vb = new QVBoxLayout( tabViewport ); |
418 | 440 | ||
419 | svAddress = new QScrollView( tabViewport ); | 441 | svAddress = new QScrollView( tabViewport ); |
420 | vb->addWidget( svAddress, 0, 0 ); | 442 | vb->addWidget( svAddress, 0, 0 ); |
421 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 443 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
422 | svAddress->setFrameStyle( QFrame::NoFrame ); | 444 | svAddress->setFrameStyle( QFrame::NoFrame ); |
423 | 445 | ||
424 | container = new QWidget( svAddress->viewport() ); | 446 | container = new QWidget( svAddress->viewport() ); |
425 | svAddress->addChild( container ); | 447 | svAddress->addChild( container ); |
426 | 448 | ||
427 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 449 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
428 | 450 | ||
429 | cmbAddress = new QComboBox( FALSE, container ); | 451 | cmbAddress = new QComboBox( FALSE, container ); |
430 | cmbAddress->insertItem( tr( "Business" ) ); | 452 | cmbAddress->insertItem( tr( "Business" ) ); |
431 | cmbAddress->insertItem( tr( "Home" ) ); | 453 | cmbAddress->insertItem( tr( "Home" ) ); |
432 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 454 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
433 | 455 | ||
434 | l = new QLabel( tr( "Address" ), container ); | 456 | l = new QLabel( tr( "Address" ), container ); |
435 | gl->addWidget( l, 1, 0 ); | 457 | gl->addWidget( l, 1, 0 ); |
436 | txtAddress = new QLineEdit( container ); | 458 | txtAddress = new QLineEdit( container ); |
437 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 459 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
438 | /* | 460 | /* |
439 | l = new QLabel( tr( "Address 2" ), container ); | 461 | l = new QLabel( tr( "Address 2" ), container ); |
440 | gl->addWidget( l, 2, 0 ); | 462 | gl->addWidget( l, 2, 0 ); |
441 | txtAddress2 = new QLineEdit( container ); | 463 | txtAddress2 = new QLineEdit( container ); |
442 | gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 ); | 464 | gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 ); |
443 | 465 | ||
444 | l = new QLabel( tr( "P.O. Box" ), container ); | 466 | l = new QLabel( tr( "P.O. Box" ), container ); |
445 | gl->addWidget( l, 3, 0 ); | 467 | gl->addWidget( l, 3, 0 ); |
446 | txtPOBox = new QLineEdit( container ); | 468 | txtPOBox = new QLineEdit( container ); |
447 | gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 ); | 469 | gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 ); |
448 | */ | 470 | */ |
449 | l = new QLabel( tr( "City" ), container ); | 471 | l = new QLabel( tr( "City" ), container ); |
450 | gl->addWidget( l, 2, 0 ); | 472 | gl->addWidget( l, 2, 0 ); |
451 | txtCity = new QLineEdit( container ); | 473 | txtCity = new QLineEdit( container ); |
452 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 474 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
453 | 475 | ||
454 | l = new QLabel( tr( "State" ), container ); | 476 | l = new QLabel( tr( "State" ), container ); |
455 | gl->addWidget( l, 3, 0 ); | 477 | gl->addWidget( l, 3, 0 ); |
456 | txtState = new QLineEdit( container ); | 478 | txtState = new QLineEdit( container ); |
457 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 479 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
458 | 480 | ||
459 | l = new QLabel( tr( "Zip Code" ), container ); | 481 | l = new QLabel( tr( "Zip Code" ), container ); |
460 | gl->addWidget( l, 4, 0 ); | 482 | gl->addWidget( l, 4, 0 ); |
461 | txtZip = new QLineEdit( container ); | 483 | txtZip = new QLineEdit( container ); |
462 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 484 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
463 | 485 | ||
464 | l = new QLabel( tr( "Country" ), container ); | 486 | l = new QLabel( tr( "Country" ), container ); |
465 | gl->addWidget( l, 5, 0 ); | 487 | gl->addWidget( l, 5, 0 ); |
466 | cmbCountry = new QComboBox( TRUE, container ); | 488 | cmbCountry = new QComboBox( TRUE, container ); |
467 | cmbCountry->insertItem( tr( "" ) ); | 489 | cmbCountry->insertItem( tr( "" ) ); |
468 | cmbCountry->insertItem( tr ( "United States" ) ); | 490 | cmbCountry->insertItem( tr ( "United States" ) ); |
469 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 491 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
470 | cmbCountry->insertItem( tr ( "Afganistan" ) ); | 492 | cmbCountry->insertItem( tr ( "Afganistan" ) ); |
471 | cmbCountry->insertItem( tr ( "Albania" ) ); | 493 | cmbCountry->insertItem( tr ( "Albania" ) ); |
472 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 494 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
473 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 495 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
474 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 496 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
475 | cmbCountry->insertItem( tr ( "Angola" ) ); | 497 | cmbCountry->insertItem( tr ( "Angola" ) ); |
476 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 498 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
477 | cmbCountry->insertItem( tr ( "Antartica" ) ); | 499 | cmbCountry->insertItem( tr ( "Antartica" ) ); |
478 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 500 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
479 | cmbCountry->insertItem( tr ( "Armania" ) ); | 501 | cmbCountry->insertItem( tr ( "Armania" ) ); |
480 | cmbCountry->insertItem( tr ( "Aruba" ) ); | 502 | cmbCountry->insertItem( tr ( "Aruba" ) ); |
481 | cmbCountry->insertItem( tr ( "Australia" ) ); | 503 | cmbCountry->insertItem( tr ( "Australia" ) ); |
482 | cmbCountry->insertItem( tr ( "Austria" ) ); | 504 | cmbCountry->insertItem( tr ( "Austria" ) ); |
483 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); | 505 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); |
484 | cmbCountry->insertItem( tr ( "Bahamas" ) ); | 506 | cmbCountry->insertItem( tr ( "Bahamas" ) ); |
485 | cmbCountry->insertItem( tr ( "Bahrain" ) ); | 507 | cmbCountry->insertItem( tr ( "Bahrain" ) ); |
486 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); | 508 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); |
487 | cmbCountry->insertItem( tr ( "Barbados" ) ); | 509 | cmbCountry->insertItem( tr ( "Barbados" ) ); |
488 | cmbCountry->insertItem( tr ( "Belarus" ) ); | 510 | cmbCountry->insertItem( tr ( "Belarus" ) ); |
489 | cmbCountry->insertItem( tr ( "Belgium" ) ); | 511 | cmbCountry->insertItem( tr ( "Belgium" ) ); |
490 | cmbCountry->insertItem( tr ( "Belize" ) ); | 512 | cmbCountry->insertItem( tr ( "Belize" ) ); |
491 | cmbCountry->insertItem( tr ( "Benin" ) ); | 513 | cmbCountry->insertItem( tr ( "Benin" ) ); |
492 | cmbCountry->insertItem( tr ( "Bermuda" ) ); | 514 | cmbCountry->insertItem( tr ( "Bermuda" ) ); |
493 | cmbCountry->insertItem( tr ( "Bhutan" ) ); | 515 | cmbCountry->insertItem( tr ( "Bhutan" ) ); |
494 | cmbCountry->insertItem( tr ( "Boliva" ) ); | 516 | cmbCountry->insertItem( tr ( "Boliva" ) ); |
495 | cmbCountry->insertItem( tr ( "Botswana" ) ); | 517 | cmbCountry->insertItem( tr ( "Botswana" ) ); |
496 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); | 518 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); |
497 | cmbCountry->insertItem( tr ( "Brazil" ) ); | 519 | cmbCountry->insertItem( tr ( "Brazil" ) ); |
498 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); | 520 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); |
499 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); | 521 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); |
500 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); | 522 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); |
501 | cmbCountry->insertItem( tr ( "Burundi" ) ); | 523 | cmbCountry->insertItem( tr ( "Burundi" ) ); |
502 | cmbCountry->insertItem( tr ( "Cambodia" ) ); | 524 | cmbCountry->insertItem( tr ( "Cambodia" ) ); |
503 | cmbCountry->insertItem( tr ( "Camaroon" ) ); | 525 | cmbCountry->insertItem( tr ( "Camaroon" ) ); |
504 | cmbCountry->insertItem( tr ( "Canada" ) ); | 526 | cmbCountry->insertItem( tr ( "Canada" ) ); |
505 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); | 527 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); |
506 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); | 528 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); |
507 | cmbCountry->insertItem( tr ( "Chad" ) ); | 529 | cmbCountry->insertItem( tr ( "Chad" ) ); |
508 | cmbCountry->insertItem( tr ( "Chile" ) ); | 530 | cmbCountry->insertItem( tr ( "Chile" ) ); |
509 | cmbCountry->insertItem( tr ( "China" ) ); | 531 | cmbCountry->insertItem( tr ( "China" ) ); |
510 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); | 532 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); |
511 | cmbCountry->insertItem( tr ( "Colombia" ) ); | 533 | cmbCountry->insertItem( tr ( "Colombia" ) ); |
512 | cmbCountry->insertItem( tr ( "Comoros" ) ); | 534 | cmbCountry->insertItem( tr ( "Comoros" ) ); |
513 | cmbCountry->insertItem( tr ( "Congo" ) ); | 535 | cmbCountry->insertItem( tr ( "Congo" ) ); |
514 | cmbCountry->insertItem( tr ( "Cook Island" ) ); | 536 | cmbCountry->insertItem( tr ( "Cook Island" ) ); |
515 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); | 537 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); |
516 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); | 538 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); |
517 | cmbCountry->insertItem( tr ( "Croatia" ) ); | 539 | cmbCountry->insertItem( tr ( "Croatia" ) ); |
518 | cmbCountry->insertItem( tr ( "Cuba" ) ); | 540 | cmbCountry->insertItem( tr ( "Cuba" ) ); |
519 | cmbCountry->insertItem( tr ( "Cyprus" ) ); | 541 | cmbCountry->insertItem( tr ( "Cyprus" ) ); |
520 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); | 542 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); |
521 | cmbCountry->insertItem( tr ( "Denmark" ) ); | 543 | cmbCountry->insertItem( tr ( "Denmark" ) ); |
522 | cmbCountry->insertItem( tr ( "Djibouti" ) ); | 544 | cmbCountry->insertItem( tr ( "Djibouti" ) ); |
523 | cmbCountry->insertItem( tr ( "Dominica" ) ); | 545 | cmbCountry->insertItem( tr ( "Dominica" ) ); |
524 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); | 546 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); |
525 | cmbCountry->insertItem( tr ( "East Timor" ) ); | 547 | cmbCountry->insertItem( tr ( "East Timor" ) ); |
526 | cmbCountry->insertItem( tr ( "Ecuador" ) ); | 548 | cmbCountry->insertItem( tr ( "Ecuador" ) ); |
527 | cmbCountry->insertItem( tr ( "Egypt" ) ); | 549 | cmbCountry->insertItem( tr ( "Egypt" ) ); |
528 | cmbCountry->insertItem( tr ( "El Salvador" ) ); | 550 | cmbCountry->insertItem( tr ( "El Salvador" ) ); |
529 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); | 551 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); |
530 | cmbCountry->insertItem( tr ( "Eritrea" ) ); | 552 | cmbCountry->insertItem( tr ( "Eritrea" ) ); |
531 | cmbCountry->insertItem( tr ( "Estonia" ) ); | 553 | cmbCountry->insertItem( tr ( "Estonia" ) ); |
532 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); | 554 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); |
533 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); | 555 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); |
534 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); | 556 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); |
535 | cmbCountry->insertItem( tr ( "Fiji" ) ); | 557 | cmbCountry->insertItem( tr ( "Fiji" ) ); |
536 | cmbCountry->insertItem( tr ( "Finland" ) ); | 558 | cmbCountry->insertItem( tr ( "Finland" ) ); |
537 | cmbCountry->insertItem( tr ( "France" ) ); | 559 | cmbCountry->insertItem( tr ( "France" ) ); |
538 | cmbCountry->insertItem( tr ( "French Guiana" ) ); | 560 | cmbCountry->insertItem( tr ( "French Guiana" ) ); |
539 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); | 561 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); |
540 | cmbCountry->insertItem( tr ( "Gabon" ) ); | 562 | cmbCountry->insertItem( tr ( "Gabon" ) ); |
541 | cmbCountry->insertItem( tr ( "Gambia" ) ); | 563 | cmbCountry->insertItem( tr ( "Gambia" ) ); |
542 | cmbCountry->insertItem( tr ( "Georgia" ) ); | 564 | cmbCountry->insertItem( tr ( "Georgia" ) ); |
543 | cmbCountry->insertItem( tr ( "Germany" ) ); | 565 | cmbCountry->insertItem( tr ( "Germany" ) ); |
544 | cmbCountry->insertItem( tr ( "Gahna" ) ); | 566 | cmbCountry->insertItem( tr ( "Gahna" ) ); |
545 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); | 567 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); |
546 | cmbCountry->insertItem( tr ( "Greece" ) ); | 568 | cmbCountry->insertItem( tr ( "Greece" ) ); |
547 | cmbCountry->insertItem( tr ( "Greenland" ) ); | 569 | cmbCountry->insertItem( tr ( "Greenland" ) ); |
548 | cmbCountry->insertItem( tr ( "Grenada" ) ); | 570 | cmbCountry->insertItem( tr ( "Grenada" ) ); |
549 | cmbCountry->insertItem( tr ( "Guadelupe" ) ); | 571 | cmbCountry->insertItem( tr ( "Guadelupe" ) ); |
550 | cmbCountry->insertItem( tr ( "Guam" ) ); | 572 | cmbCountry->insertItem( tr ( "Guam" ) ); |
551 | cmbCountry->insertItem( tr ( "Guatemala" ) ); | 573 | cmbCountry->insertItem( tr ( "Guatemala" ) ); |
552 | cmbCountry->insertItem( tr ( "Guinea" ) ); | 574 | cmbCountry->insertItem( tr ( "Guinea" ) ); |
553 | cmbCountry->insertItem( tr ( "Guinea-bissau" ) ); | 575 | cmbCountry->insertItem( tr ( "Guinea-bissau" ) ); |
554 | cmbCountry->insertItem( tr ( "Guyana" ) ); | 576 | cmbCountry->insertItem( tr ( "Guyana" ) ); |
555 | cmbCountry->insertItem( tr ( "Haiti" ) ); | 577 | cmbCountry->insertItem( tr ( "Haiti" ) ); |
556 | cmbCountry->insertItem( tr ( "Holy See" ) ); | 578 | cmbCountry->insertItem( tr ( "Holy See" ) ); |
557 | cmbCountry->insertItem( tr ( "Honduras" ) ); | 579 | cmbCountry->insertItem( tr ( "Honduras" ) ); |
558 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); | 580 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); |
559 | cmbCountry->insertItem( tr ( "Hungary" ) ); | 581 | cmbCountry->insertItem( tr ( "Hungary" ) ); |
560 | cmbCountry->insertItem( tr ( "Iceland" ) ); | 582 | cmbCountry->insertItem( tr ( "Iceland" ) ); |
561 | cmbCountry->insertItem( tr ( "India" ) ); | 583 | cmbCountry->insertItem( tr ( "India" ) ); |
562 | cmbCountry->insertItem( tr ( "Indonesia" ) ); | 584 | cmbCountry->insertItem( tr ( "Indonesia" ) ); |
563 | cmbCountry->insertItem( tr ( "Ireland" ) ); | 585 | cmbCountry->insertItem( tr ( "Ireland" ) ); |
564 | cmbCountry->insertItem( tr ( "Israel" ) ); | 586 | cmbCountry->insertItem( tr ( "Israel" ) ); |
565 | cmbCountry->insertItem( tr ( "Italy" ) ); | 587 | cmbCountry->insertItem( tr ( "Italy" ) ); |
566 | cmbCountry->insertItem( tr ( "Jamacia" ) ); | 588 | cmbCountry->insertItem( tr ( "Jamacia" ) ); |
567 | cmbCountry->insertItem( tr ( "Japan" ) ); | 589 | cmbCountry->insertItem( tr ( "Japan" ) ); |
568 | cmbCountry->insertItem( tr ( "Jordan" ) ); | 590 | cmbCountry->insertItem( tr ( "Jordan" ) ); |
569 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); | 591 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); |
570 | cmbCountry->insertItem( tr ( "Kenya" ) ); | 592 | cmbCountry->insertItem( tr ( "Kenya" ) ); |
571 | cmbCountry->insertItem( tr ( "Kribati" ) ); | 593 | cmbCountry->insertItem( tr ( "Kribati" ) ); |
572 | cmbCountry->insertItem( tr ( "Korea" ) ); | 594 | cmbCountry->insertItem( tr ( "Korea" ) ); |
573 | cmbCountry->insertItem( tr ( "Kuwait" ) ); | 595 | cmbCountry->insertItem( tr ( "Kuwait" ) ); |
574 | cmbCountry->insertItem( tr ( "Kyrgystan" ) ); | 596 | cmbCountry->insertItem( tr ( "Kyrgystan" ) ); |
575 | cmbCountry->insertItem( tr ( "Laos" ) ); | 597 | cmbCountry->insertItem( tr ( "Laos" ) ); |
576 | cmbCountry->insertItem( tr ( "Latvia" ) ); | 598 | cmbCountry->insertItem( tr ( "Latvia" ) ); |
577 | cmbCountry->insertItem( tr ( "Lebanon" ) ); | 599 | cmbCountry->insertItem( tr ( "Lebanon" ) ); |
578 | cmbCountry->insertItem( tr ( "Lesotho" ) ); | 600 | cmbCountry->insertItem( tr ( "Lesotho" ) ); |
579 | cmbCountry->insertItem( tr ( "Liberia" ) ); | 601 | cmbCountry->insertItem( tr ( "Liberia" ) ); |
580 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); | 602 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); |
581 | cmbCountry->insertItem( tr ( "Lithuania" ) ); | 603 | cmbCountry->insertItem( tr ( "Lithuania" ) ); |
582 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); | 604 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); |
583 | cmbCountry->insertItem( tr ( "Macau" ) ); | 605 | cmbCountry->insertItem( tr ( "Macau" ) ); |
584 | cmbCountry->insertItem( tr ( "Macedonia" ) ); | 606 | cmbCountry->insertItem( tr ( "Macedonia" ) ); |
585 | cmbCountry->insertItem( tr ( "Madagascar" ) ); | 607 | cmbCountry->insertItem( tr ( "Madagascar" ) ); |
586 | cmbCountry->insertItem( tr ( "Malawi" ) ); | 608 | cmbCountry->insertItem( tr ( "Malawi" ) ); |
587 | cmbCountry->insertItem( tr ( "Malaysia" ) ); | 609 | cmbCountry->insertItem( tr ( "Malaysia" ) ); |
588 | cmbCountry->insertItem( tr ( "Maldives" ) ); | 610 | cmbCountry->insertItem( tr ( "Maldives" ) ); |
589 | cmbCountry->insertItem( tr ( "Mali" ) ); | 611 | cmbCountry->insertItem( tr ( "Mali" ) ); |
590 | cmbCountry->insertItem( tr ( "Malta" ) ); | 612 | cmbCountry->insertItem( tr ( "Malta" ) ); |
591 | cmbCountry->insertItem( tr ( "Martinique" ) ); | 613 | cmbCountry->insertItem( tr ( "Martinique" ) ); |
592 | cmbCountry->insertItem( tr ( "Mauritania" ) ); | 614 | cmbCountry->insertItem( tr ( "Mauritania" ) ); |
593 | cmbCountry->insertItem( tr ( "Mauritius" ) ); | 615 | cmbCountry->insertItem( tr ( "Mauritius" ) ); |
594 | cmbCountry->insertItem( tr ( "Mayotte" ) ); | 616 | cmbCountry->insertItem( tr ( "Mayotte" ) ); |
595 | cmbCountry->insertItem( tr ( "Mexico" ) ); | 617 | cmbCountry->insertItem( tr ( "Mexico" ) ); |
596 | cmbCountry->insertItem( tr ( "Micronesia" ) ); | 618 | cmbCountry->insertItem( tr ( "Micronesia" ) ); |
597 | cmbCountry->insertItem( tr ( "Moldova" ) ); | 619 | cmbCountry->insertItem( tr ( "Moldova" ) ); |
598 | cmbCountry->insertItem( tr ( "Monaco" ) ); | 620 | cmbCountry->insertItem( tr ( "Monaco" ) ); |
599 | cmbCountry->insertItem( tr ( "Mongolia" ) ); | 621 | cmbCountry->insertItem( tr ( "Mongolia" ) ); |
600 | cmbCountry->insertItem( tr ( "Montserrat" ) ); | 622 | cmbCountry->insertItem( tr ( "Montserrat" ) ); |
601 | cmbCountry->insertItem( tr ( "Morocco" ) ); | 623 | cmbCountry->insertItem( tr ( "Morocco" ) ); |
602 | cmbCountry->insertItem( tr ( "Mozambique" ) ); | 624 | cmbCountry->insertItem( tr ( "Mozambique" ) ); |
603 | cmbCountry->insertItem( tr ( "Myanmar" ) ); | 625 | cmbCountry->insertItem( tr ( "Myanmar" ) ); |
604 | cmbCountry->insertItem( tr ( "Namibia" ) ); | 626 | cmbCountry->insertItem( tr ( "Namibia" ) ); |
605 | cmbCountry->insertItem( tr ( "Nauru" ) ); | 627 | cmbCountry->insertItem( tr ( "Nauru" ) ); |
606 | cmbCountry->insertItem( tr ( "Nepal" ) ); | 628 | cmbCountry->insertItem( tr ( "Nepal" ) ); |
607 | cmbCountry->insertItem( tr ( "Netherlands" ) ); | 629 | cmbCountry->insertItem( tr ( "Netherlands" ) ); |
608 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); | 630 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); |
609 | cmbCountry->insertItem( tr ( "New Zealand" ) ); | 631 | cmbCountry->insertItem( tr ( "New Zealand" ) ); |
610 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); | 632 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); |
611 | cmbCountry->insertItem( tr ( "Niger" ) ); | 633 | cmbCountry->insertItem( tr ( "Niger" ) ); |
612 | cmbCountry->insertItem( tr ( "Nigeria" ) ); | 634 | cmbCountry->insertItem( tr ( "Nigeria" ) ); |
613 | cmbCountry->insertItem( tr ( "Niue" ) ); | 635 | cmbCountry->insertItem( tr ( "Niue" ) ); |
614 | cmbCountry->insertItem( tr ( "Norway" ) ); | 636 | cmbCountry->insertItem( tr ( "Norway" ) ); |
615 | cmbCountry->insertItem( tr ( "Oman" ) ); | 637 | cmbCountry->insertItem( tr ( "Oman" ) ); |
616 | cmbCountry->insertItem( tr ( "Pakistan" ) ); | 638 | cmbCountry->insertItem( tr ( "Pakistan" ) ); |
617 | cmbCountry->insertItem( tr ( "Palau" ) ); | 639 | cmbCountry->insertItem( tr ( "Palau" ) ); |
618 | cmbCountry->insertItem( tr ( "Palestinian Territory" ) ); | 640 | cmbCountry->insertItem( tr ( "Palestinian Territory" ) ); |
619 | cmbCountry->insertItem( tr ( "Panama" ) ); | 641 | cmbCountry->insertItem( tr ( "Panama" ) ); |
620 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); | 642 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); |
621 | cmbCountry->insertItem( tr ( "Paraguay" ) ); | 643 | cmbCountry->insertItem( tr ( "Paraguay" ) ); |
622 | cmbCountry->insertItem( tr ( "Peru" ) ); | 644 | cmbCountry->insertItem( tr ( "Peru" ) ); |
623 | cmbCountry->insertItem( tr ( "Philippines" ) ); | 645 | cmbCountry->insertItem( tr ( "Philippines" ) ); |
624 | cmbCountry->insertItem( tr ( "Pitcairn" ) ); | 646 | cmbCountry->insertItem( tr ( "Pitcairn" ) ); |
625 | cmbCountry->insertItem( tr ( "Poland" ) ); | 647 | cmbCountry->insertItem( tr ( "Poland" ) ); |
626 | cmbCountry->insertItem( tr ( "Portugal" ) ); | 648 | cmbCountry->insertItem( tr ( "Portugal" ) ); |
627 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); | 649 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); |
628 | cmbCountry->insertItem( tr ( "Qatar" ) ); | 650 | cmbCountry->insertItem( tr ( "Qatar" ) ); |
629 | cmbCountry->insertItem( tr ( "Reunion" ) ); | 651 | cmbCountry->insertItem( tr ( "Reunion" ) ); |
630 | cmbCountry->insertItem( tr ( "Romania" ) ); | 652 | cmbCountry->insertItem( tr ( "Romania" ) ); |
631 | cmbCountry->insertItem( tr ( "Russia" ) ); | 653 | cmbCountry->insertItem( tr ( "Russia" ) ); |
632 | cmbCountry->insertItem( tr ( "Rwanda" ) ); | 654 | cmbCountry->insertItem( tr ( "Rwanda" ) ); |
633 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); | 655 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); |
634 | cmbCountry->insertItem( tr ( "Samoa" ) ); | 656 | cmbCountry->insertItem( tr ( "Samoa" ) ); |
635 | cmbCountry->insertItem( tr ( "San Marino" ) ); | 657 | cmbCountry->insertItem( tr ( "San Marino" ) ); |
636 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); | 658 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); |
637 | cmbCountry->insertItem( tr ( "Senegal" ) ); | 659 | cmbCountry->insertItem( tr ( "Senegal" ) ); |
638 | cmbCountry->insertItem( tr ( "Seychelles" ) ); | 660 | cmbCountry->insertItem( tr ( "Seychelles" ) ); |
639 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); | 661 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); |
640 | cmbCountry->insertItem( tr ( "Singapore" ) ); | 662 | cmbCountry->insertItem( tr ( "Singapore" ) ); |
641 | cmbCountry->insertItem( tr ( "Slovakia" ) ); | 663 | cmbCountry->insertItem( tr ( "Slovakia" ) ); |
642 | cmbCountry->insertItem( tr ( "Slovenia" ) ); | 664 | cmbCountry->insertItem( tr ( "Slovenia" ) ); |
643 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); | 665 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); |
644 | cmbCountry->insertItem( tr ( "Somalia" ) ); | 666 | cmbCountry->insertItem( tr ( "Somalia" ) ); |
645 | cmbCountry->insertItem( tr ( "South Africa" ) ); | 667 | cmbCountry->insertItem( tr ( "South Africa" ) ); |
646 | cmbCountry->insertItem( tr ( "Spain" ) ); | 668 | cmbCountry->insertItem( tr ( "Spain" ) ); |
647 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); | 669 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); |
648 | cmbCountry->insertItem( tr ( "St. Helena" ) ); | 670 | cmbCountry->insertItem( tr ( "St. Helena" ) ); |
649 | cmbCountry->insertItem( tr ( "Sudan" ) ); | 671 | cmbCountry->insertItem( tr ( "Sudan" ) ); |
650 | cmbCountry->insertItem( tr ( "Suriname" ) ); | 672 | cmbCountry->insertItem( tr ( "Suriname" ) ); |
651 | cmbCountry->insertItem( tr ( "Swaziland" ) ); | 673 | cmbCountry->insertItem( tr ( "Swaziland" ) ); |
652 | cmbCountry->insertItem( tr ( "Sweden" ) ); | 674 | cmbCountry->insertItem( tr ( "Sweden" ) ); |
653 | cmbCountry->insertItem( tr ( "Switzerland" ) ); | 675 | cmbCountry->insertItem( tr ( "Switzerland" ) ); |
654 | cmbCountry->insertItem( tr ( "Taiwan" ) ); | 676 | cmbCountry->insertItem( tr ( "Taiwan" ) ); |
655 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); | 677 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); |
656 | cmbCountry->insertItem( tr ( "Tanzania" ) ); | 678 | cmbCountry->insertItem( tr ( "Tanzania" ) ); |
657 | cmbCountry->insertItem( tr ( "Thailand" ) ); | 679 | cmbCountry->insertItem( tr ( "Thailand" ) ); |
658 | cmbCountry->insertItem( tr ( "Togo" ) ); | 680 | cmbCountry->insertItem( tr ( "Togo" ) ); |
659 | cmbCountry->insertItem( tr ( "Tokelau" ) ); | 681 | cmbCountry->insertItem( tr ( "Tokelau" ) ); |
660 | cmbCountry->insertItem( tr ( "Tonga" ) ); | 682 | cmbCountry->insertItem( tr ( "Tonga" ) ); |
661 | cmbCountry->insertItem( tr ( "Tunisia" ) ); | 683 | cmbCountry->insertItem( tr ( "Tunisia" ) ); |
662 | cmbCountry->insertItem( tr ( "Turkey" ) ); | 684 | cmbCountry->insertItem( tr ( "Turkey" ) ); |
663 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); | 685 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); |
664 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); | 686 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); |
665 | cmbCountry->insertItem( tr ( "Uganda" ) ); | 687 | cmbCountry->insertItem( tr ( "Uganda" ) ); |
666 | cmbCountry->insertItem( tr ( "Ukraine" ) ); | 688 | cmbCountry->insertItem( tr ( "Ukraine" ) ); |
667 | cmbCountry->insertItem( tr ( "Uruguay" ) ); | 689 | cmbCountry->insertItem( tr ( "Uruguay" ) ); |
668 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); | 690 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); |
669 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); | 691 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); |
670 | cmbCountry->insertItem( tr ( "Venezuela" ) ); | 692 | cmbCountry->insertItem( tr ( "Venezuela" ) ); |
671 | cmbCountry->insertItem( tr ( "Viet Nam" ) ); | 693 | cmbCountry->insertItem( tr ( "Viet Nam" ) ); |
672 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); | 694 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); |
673 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); | 695 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); |
674 | cmbCountry->insertItem( tr ( "Yemen" ) ); | 696 | cmbCountry->insertItem( tr ( "Yemen" ) ); |
675 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); | 697 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); |
676 | cmbCountry->insertItem( tr ( "Zambia" ) ); | 698 | cmbCountry->insertItem( tr ( "Zambia" ) ); |
677 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); | 699 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); |
678 | 700 | ||
679 | cmbCountry->setMaximumWidth( 135 ); | 701 | cmbCountry->setMaximumWidth( 135 ); |
680 | 702 | ||
681 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 703 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
682 | 704 | ||
683 | cmbChooserField4 = new QComboBox( FALSE, container ); | 705 | cmbChooserField4 = new QComboBox( FALSE, container ); |
684 | cmbChooserField4->setMaximumWidth( 90 ); | 706 | cmbChooserField4->setMaximumWidth( 90 ); |
685 | gl->addWidget( cmbChooserField4, 6, 0 ); | 707 | gl->addWidget( cmbChooserField4, 6, 0 ); |
686 | txtChooserField4 = new QLineEdit( container ); | 708 | txtChooserField4 = new QLineEdit( container ); |
687 | gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); | 709 | gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); |
688 | 710 | ||
689 | QSpacerItem *space = new QSpacerItem(1,1, | 711 | QSpacerItem *space = new QSpacerItem(1,1, |
690 | QSizePolicy::Maximum, | 712 | QSizePolicy::Maximum, |
691 | QSizePolicy::MinimumExpanding ); | 713 | QSizePolicy::MinimumExpanding ); |
692 | gl->addItem( space, 7, 0 ); | 714 | gl->addItem( space, 7, 0 ); |
693 | 715 | ||
694 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 716 | tabMain->insertTab( tabViewport, tr( "Address" ) ); |
695 | 717 | ||
696 | tabViewport = new QWidget ( tabMain ); | 718 | tabViewport = new QWidget ( tabMain ); |
697 | 719 | ||
698 | vb = new QVBoxLayout( tabViewport ); | 720 | vb = new QVBoxLayout( tabViewport ); |
699 | 721 | ||
700 | svDetails = new QScrollView( tabViewport ); | 722 | svDetails = new QScrollView( tabViewport ); |
701 | vb->addWidget( svDetails, 0, 0 ); | 723 | vb->addWidget( svDetails, 0, 0 ); |
702 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 724 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
703 | svDetails->setFrameStyle( QFrame::NoFrame ); | 725 | svDetails->setFrameStyle( QFrame::NoFrame ); |
704 | 726 | ||
705 | container = new QWidget( svDetails->viewport() ); | 727 | container = new QWidget( svDetails->viewport() ); |
706 | svDetails->addChild( container ); | 728 | svDetails->addChild( container ); |
707 | 729 | ||
708 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 730 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
709 | 731 | ||
732 | int counter = 0; | ||
733 | |||
734 | // Birthday | ||
735 | l = new QLabel( tr("Birthday"), container ); | ||
736 | gl->addWidget( l, counter, 0 ); | ||
737 | |||
738 | QPopupMenu* m1 = new QPopupMenu( container ); | ||
739 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | ||
740 | m1->insertItem( birthdayPicker ); | ||
741 | |||
742 | birthdayButton= new QToolButton( container, "buttonStart" ); | ||
743 | birthdayButton->setPopup( m1 ); | ||
744 | birthdayButton->setPopupDelay(0); | ||
745 | gl->addWidget( birthdayButton, counter , 1 ); | ||
746 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), | ||
747 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); | ||
748 | |||
749 | ++counter; | ||
750 | |||
751 | // Anniversary | ||
752 | l = new QLabel( tr("Anniversary"), container ); | ||
753 | gl->addWidget( l, counter, 0 ); | ||
754 | |||
755 | m1 = new QPopupMenu( container ); | ||
756 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | ||
757 | m1->insertItem( anniversaryPicker ); | ||
758 | |||
759 | anniversaryButton= new QToolButton( container, "buttonStart" ); | ||
760 | anniversaryButton->setPopup( m1 ); | ||
761 | anniversaryButton->setPopupDelay(0); | ||
762 | gl->addWidget( anniversaryButton, counter , 1 ); | ||
763 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), | ||
764 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); | ||
765 | |||
766 | ++counter; | ||
767 | |||
768 | // Gender | ||
769 | l = new QLabel( tr("Gender"), container ); | ||
770 | gl->addWidget( l, counter, 0 ); | ||
771 | cmbGender = new QComboBox( container ); | ||
772 | cmbGender->insertItem( "", 0 ); | ||
773 | cmbGender->insertItem( tr("Male"), 1); | ||
774 | cmbGender->insertItem( tr("Female"), 2); | ||
775 | gl->addWidget( cmbGender, counter, 1 ); | ||
776 | |||
777 | ++counter; | ||
778 | |||
710 | // Create Labels and lineedit fields for every dynamic entry | 779 | // Create Labels and lineedit fields for every dynamic entry |
711 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 780 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
712 | for (i = 0; it != slDynamicEntries.end(); i++, ++it) { | 781 | for (i = counter; it != slDynamicEntries.end(); i++, ++it) { |
713 | l = new QLabel( QString::null , container ); | 782 | l = new QLabel( QString::null , container ); |
714 | listName.append( l ); | 783 | listName.append( l ); |
715 | gl->addWidget( l, i, 0 ); | 784 | gl->addWidget( l, i, 0 ); |
716 | QLineEdit *e = new QLineEdit( container ); | 785 | QLineEdit *e = new QLineEdit( container ); |
717 | listValue.append( e ); | 786 | listValue.append( e ); |
718 | gl->addWidget( e, i, 1); | 787 | gl->addWidget( e, i, 1); |
719 | } | 788 | } |
720 | // Fill labels with names.. | 789 | // Fill labels with names.. |
721 | loadFields(); | 790 | loadFields(); |
722 | 791 | ||
723 | l = new QLabel( tr("Gender"), container ); | ||
724 | gl->addWidget( l, slDynamicEntries.count(), 0 ); | ||
725 | cmbGender = new QComboBox( container ); | ||
726 | cmbGender->insertItem( "", 0 ); | ||
727 | cmbGender->insertItem( tr("Male"), 1); | ||
728 | cmbGender->insertItem( tr("Female"), 2); | ||
729 | gl->addWidget( cmbGender, slDynamicEntries.count(), 1 ); | ||
730 | 792 | ||
731 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 793 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
732 | 794 | ||
733 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 795 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
734 | dlgNote->setCaption( tr("Enter Note") ); | 796 | dlgNote->setCaption( tr("Enter Note") ); |
735 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 797 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
736 | txtNote = new QMultiLineEdit( dlgNote ); | 798 | txtNote = new QMultiLineEdit( dlgNote ); |
737 | vbNote->addWidget( txtNote ); | 799 | vbNote->addWidget( txtNote ); |
738 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 800 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
739 | 801 | ||
740 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 802 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
741 | dlgName->setCaption( tr("Edit Name") ); | 803 | dlgName->setCaption( tr("Edit Name") ); |
742 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 804 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
743 | 805 | ||
744 | l = new QLabel( tr("First Name"), dlgName ); | 806 | l = new QLabel( tr("First Name"), dlgName ); |
745 | gl->addWidget( l, 0, 0 ); | 807 | gl->addWidget( l, 0, 0 ); |
746 | txtFirstName = new QLineEdit( dlgName ); | 808 | txtFirstName = new QLineEdit( dlgName ); |
747 | gl->addWidget( txtFirstName, 0, 1 ); | 809 | gl->addWidget( txtFirstName, 0, 1 ); |
748 | 810 | ||
749 | l = new QLabel( tr("Middle Name"), dlgName ); | 811 | l = new QLabel( tr("Middle Name"), dlgName ); |
750 | gl->addWidget( l, 1, 0 ); | 812 | gl->addWidget( l, 1, 0 ); |
751 | txtMiddleName = new QLineEdit( dlgName ); | 813 | txtMiddleName = new QLineEdit( dlgName ); |
752 | gl->addWidget( txtMiddleName, 1, 1 ); | 814 | gl->addWidget( txtMiddleName, 1, 1 ); |
753 | 815 | ||
754 | l = new QLabel( tr("Last Name"), dlgName ); | 816 | l = new QLabel( tr("Last Name"), dlgName ); |
755 | gl->addWidget( l, 2, 0 ); | 817 | gl->addWidget( l, 2, 0 ); |
756 | txtLastName = new QLineEdit( dlgName ); | 818 | txtLastName = new QLineEdit( dlgName ); |
757 | gl->addWidget( txtLastName, 2, 1 ); | 819 | gl->addWidget( txtLastName, 2, 1 ); |
758 | 820 | ||
759 | l = new QLabel( tr("Suffix"), dlgName ); | 821 | l = new QLabel( tr("Suffix"), dlgName ); |
760 | gl->addWidget( l, 3, 0 ); | 822 | gl->addWidget( l, 3, 0 ); |
761 | txtSuffix = new QLineEdit( dlgName ); | 823 | txtSuffix = new QLineEdit( dlgName ); |
762 | gl->addWidget( txtSuffix, 3, 1 ); | 824 | gl->addWidget( txtSuffix, 3, 1 ); |
763 | space = new QSpacerItem(1,1, | 825 | space = new QSpacerItem(1,1, |
764 | QSizePolicy::Maximum, | 826 | QSizePolicy::Maximum, |
765 | QSizePolicy::MinimumExpanding ); | 827 | QSizePolicy::MinimumExpanding ); |
766 | gl->addItem( space, 4, 0 ); | 828 | gl->addItem( space, 4, 0 ); |
767 | 829 | ||
768 | cmbChooserField1->insertStringList( trlChooserNames ); | 830 | cmbChooserField1->insertStringList( trlChooserNames ); |
769 | cmbChooserField2->insertStringList( trlChooserNames ); | 831 | cmbChooserField2->insertStringList( trlChooserNames ); |
770 | cmbChooserField3->insertStringList( trlChooserNames ); | 832 | cmbChooserField3->insertStringList( trlChooserNames ); |
771 | cmbChooserField4->insertStringList( trlChooserNames ); | 833 | cmbChooserField4->insertStringList( trlChooserNames ); |
772 | 834 | ||
773 | cmbChooserField1->setCurrentItem( 0 ); | 835 | cmbChooserField1->setCurrentItem( 0 ); |
774 | cmbChooserField2->setCurrentItem( 1 ); | 836 | cmbChooserField2->setCurrentItem( 1 ); |
775 | cmbChooserField3->setCurrentItem( 2 ); | 837 | cmbChooserField3->setCurrentItem( 2 ); |
776 | 838 | ||
777 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 839 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
778 | 840 | ||
779 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); | 841 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); |
780 | 842 | ||
781 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), | 843 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), |
782 | this, SLOT(slotChooser1Change(const QString &)) ); | 844 | this, SLOT(slotChooser1Change(const QString &)) ); |
783 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), | 845 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), |
784 | this, SLOT(slotChooser2Change(const QString &)) ); | 846 | this, SLOT(slotChooser2Change(const QString &)) ); |
785 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), | 847 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), |
786 | this, SLOT(slotChooser3Change(const QString &)) ); | 848 | this, SLOT(slotChooser3Change(const QString &)) ); |
787 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), | 849 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), |
788 | this, SLOT(slotChooser4Change(const QString &)) ); | 850 | this, SLOT(slotChooser4Change(const QString &)) ); |
789 | connect( txtAddress, SIGNAL(textChanged(const QString &)), | 851 | connect( txtAddress, SIGNAL(textChanged(const QString &)), |
790 | this, SLOT(slotAddressChange(const QString &)) ); | 852 | this, SLOT(slotAddressChange(const QString &)) ); |
791 | //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); | 853 | //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); |
792 | //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); | 854 | //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); |
793 | connect( txtCity, SIGNAL(textChanged(const QString &)), | 855 | connect( txtCity, SIGNAL(textChanged(const QString &)), |
794 | this, SLOT(slotCityChange(const QString &)) ); | 856 | this, SLOT(slotCityChange(const QString &)) ); |
795 | connect( txtState, SIGNAL(textChanged(const QString &)), | 857 | connect( txtState, SIGNAL(textChanged(const QString &)), |
796 | this, SLOT(slotStateChange(const QString &)) ); | 858 | this, SLOT(slotStateChange(const QString &)) ); |
797 | connect( txtZip, SIGNAL(textChanged(const QString &)), | 859 | connect( txtZip, SIGNAL(textChanged(const QString &)), |
798 | this, SLOT(slotZipChange(const QString &)) ); | 860 | this, SLOT(slotZipChange(const QString &)) ); |
799 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), | 861 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), |
800 | this, SLOT(slotCountryChange(const QString &)) ); | 862 | this, SLOT(slotCountryChange(const QString &)) ); |
801 | connect( cmbCountry, SIGNAL(activated(const QString &)), | 863 | connect( cmbCountry, SIGNAL(activated(const QString &)), |
802 | this, SLOT(slotCountryChange(const QString &)) ); | 864 | this, SLOT(slotCountryChange(const QString &)) ); |
803 | connect( cmbChooserField1, SIGNAL(activated(int)), | 865 | connect( cmbChooserField1, SIGNAL(activated(int)), |
804 | this, SLOT(slotCmbChooser1Change(int)) ); | 866 | this, SLOT(slotCmbChooser1Change(int)) ); |
805 | connect( cmbChooserField2, SIGNAL(activated(int)), | 867 | connect( cmbChooserField2, SIGNAL(activated(int)), |
806 | this, SLOT(slotCmbChooser2Change(int)) ); | 868 | this, SLOT(slotCmbChooser2Change(int)) ); |
807 | connect( cmbChooserField3, SIGNAL(activated(int)), | 869 | connect( cmbChooserField3, SIGNAL(activated(int)), |
808 | this, SLOT(slotCmbChooser3Change(int)) ); | 870 | this, SLOT(slotCmbChooser3Change(int)) ); |
809 | connect( cmbChooserField4, SIGNAL(activated(int)), | 871 | connect( cmbChooserField4, SIGNAL(activated(int)), |
810 | this, SLOT(slotCmbChooser4Change(int)) ); | 872 | this, SLOT(slotCmbChooser4Change(int)) ); |
811 | connect( cmbAddress, SIGNAL(activated(int)), | 873 | connect( cmbAddress, SIGNAL(activated(int)), |
812 | this, SLOT(slotAddressTypeChange(int)) ); | 874 | this, SLOT(slotAddressTypeChange(int)) ); |
813 | 875 | ||
814 | new QPEDialogListener(this); | 876 | new QPEDialogListener(this); |
815 | } | 877 | } |
816 | 878 | ||
817 | void ContactEditor::initMap() | 879 | void ContactEditor::initMap() |
818 | { | 880 | { |
819 | /* | 881 | /* |
820 | // since the fields and the XML fields exist, create a map | 882 | // since the fields and the XML fields exist, create a map |
821 | // between them... | 883 | // between them... |
822 | Config cfg1( "AddressBook" ); | 884 | Config cfg1( "AddressBook" ); |
823 | Config cfg2( "AddressBook" ); | 885 | Config cfg2( "AddressBook" ); |
824 | QString strCfg1, | 886 | QString strCfg1, |
825 | strCfg2; | 887 | strCfg2; |
826 | int i; | 888 | int i; |
827 | 889 | ||
828 | // This stuff better exist... | 890 | // This stuff better exist... |
829 | cfg1.setGroup( "AddressFields" ); | 891 | cfg1.setGroup( "AddressFields" ); |
830 | o cfg2.setGroup( "XMLFields" ); | 892 | o cfg2.setGroup( "XMLFields" ); |
831 | i = 0; | 893 | i = 0; |
832 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); | 894 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); |
833 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), | 895 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), |
834 | QString::null ); | 896 | QString::null ); |
835 | while ( !strCfg1.isNull() && !strCfg2.isNull() ) { | 897 | while ( !strCfg1.isNull() && !strCfg2.isNull() ) { |
836 | mapField.insert( strCfg1, strCfg2 ); | 898 | mapField.insert( strCfg1, strCfg2 ); |
837 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), | 899 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), |
838 | QString::null ); | 900 | QString::null ); |
839 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), | 901 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), |
840 | QString::null ); | 902 | QString::null ); |
841 | } | 903 | } |
842 | */ | 904 | */ |
843 | } | 905 | } |
844 | 906 | ||
845 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 907 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
846 | 908 | ||
847 | int index = cmbChooserField1->currentItem(); | 909 | int index = cmbChooserField1->currentItem(); |
848 | 910 | ||
849 | slChooserValues[index] = textChanged; | 911 | slChooserValues[index] = textChanged; |
850 | 912 | ||
851 | } | 913 | } |
852 | 914 | ||
853 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 915 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
854 | 916 | ||
855 | int index = cmbChooserField2->currentItem(); | 917 | int index = cmbChooserField2->currentItem(); |
856 | 918 | ||
857 | slChooserValues[index] = textChanged; | 919 | slChooserValues[index] = textChanged; |
858 | 920 | ||
859 | } | 921 | } |
860 | 922 | ||
861 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 923 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
862 | 924 | ||
863 | int index = cmbChooserField3->currentItem(); | 925 | int index = cmbChooserField3->currentItem(); |
864 | 926 | ||
865 | slChooserValues[index] = textChanged; | 927 | slChooserValues[index] = textChanged; |
866 | 928 | ||
867 | } | 929 | } |
868 | 930 | ||
869 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 931 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
870 | 932 | ||
871 | int index = cmbChooserField4->currentItem(); | 933 | int index = cmbChooserField4->currentItem(); |
872 | 934 | ||
873 | slChooserValues[index] = textChanged; | 935 | slChooserValues[index] = textChanged; |
874 | 936 | ||
875 | } | 937 | } |
876 | 938 | ||
877 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 939 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
878 | 940 | ||
879 | if ( cmbAddress->currentItem() == 0 ) { | 941 | if ( cmbAddress->currentItem() == 0 ) { |
880 | slBusinessAddress[0] = textChanged; | 942 | slBusinessAddress[0] = textChanged; |
881 | } else { | 943 | } else { |
882 | slHomeAddress[0] = textChanged; | 944 | slHomeAddress[0] = textChanged; |
883 | } | 945 | } |
884 | } | 946 | } |
885 | 947 | ||
886 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 948 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
887 | 949 | ||
888 | if ( cmbAddress->currentItem() == 0 ) { | 950 | if ( cmbAddress->currentItem() == 0 ) { |
889 | slBusinessAddress[1] = textChanged; | 951 | slBusinessAddress[1] = textChanged; |
890 | } else { | 952 | } else { |
891 | slHomeAddress[1] = textChanged; | 953 | slHomeAddress[1] = textChanged; |
892 | } | 954 | } |
893 | } | 955 | } |
894 | 956 | ||
895 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 957 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
896 | 958 | ||
897 | if ( cmbAddress->currentItem() == 0 ) { | 959 | if ( cmbAddress->currentItem() == 0 ) { |
898 | slBusinessAddress[2] = textChanged; | 960 | slBusinessAddress[2] = textChanged; |
899 | } else { | 961 | } else { |
900 | slHomeAddress[2] = textChanged; | 962 | slHomeAddress[2] = textChanged; |
901 | } | 963 | } |
902 | } | 964 | } |
903 | 965 | ||
904 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 966 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
905 | 967 | ||
906 | if ( cmbAddress->currentItem() == 0 ) { | 968 | if ( cmbAddress->currentItem() == 0 ) { |
907 | slBusinessAddress[3] = textChanged; | 969 | slBusinessAddress[3] = textChanged; |
908 | } else { | 970 | } else { |
909 | slHomeAddress[3] = textChanged; | 971 | slHomeAddress[3] = textChanged; |
910 | } | 972 | } |
911 | } | 973 | } |
912 | 974 | ||
913 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 975 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
914 | 976 | ||
915 | 977 | ||
916 | if ( cmbAddress->currentItem() == 0 ) { | 978 | if ( cmbAddress->currentItem() == 0 ) { |
917 | slBusinessAddress[4] = textChanged; | 979 | slBusinessAddress[4] = textChanged; |
918 | } else { | 980 | } else { |
919 | slHomeAddress[4] = textChanged; | 981 | slHomeAddress[4] = textChanged; |
920 | } | 982 | } |
921 | } | 983 | } |
922 | 984 | ||
923 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 985 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
924 | 986 | ||
925 | if ( cmbAddress->currentItem() == 0 ) { | 987 | if ( cmbAddress->currentItem() == 0 ) { |
926 | slBusinessAddress[5] = textChanged; | 988 | slBusinessAddress[5] = textChanged; |
927 | } else { | 989 | } else { |
928 | slHomeAddress[5] = textChanged; | 990 | slHomeAddress[5] = textChanged; |
929 | } | 991 | } |
930 | } | 992 | } |
931 | 993 | ||
932 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 994 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
933 | 995 | ||
934 | if ( cmbAddress->currentItem() == 0 ) { | 996 | if ( cmbAddress->currentItem() == 0 ) { |
935 | slBusinessAddress[6] = textChanged; | 997 | slBusinessAddress[6] = textChanged; |
936 | } else { | 998 | } else { |
937 | slHomeAddress[6] = textChanged; | 999 | slHomeAddress[6] = textChanged; |
938 | } | 1000 | } |
939 | } | 1001 | } |
940 | 1002 | ||
941 | void ContactEditor::slotCmbChooser1Change( int index ) { | 1003 | void ContactEditor::slotCmbChooser1Change( int index ) { |
942 | 1004 | ||
943 | txtChooserField1->setText( slChooserValues[index] ); | 1005 | txtChooserField1->setText( slChooserValues[index] ); |
944 | txtChooserField1->setFocus(); | 1006 | txtChooserField1->setFocus(); |
945 | } | 1007 | } |
946 | 1008 | ||
947 | void ContactEditor::slotCmbChooser2Change( int index ) { | 1009 | void ContactEditor::slotCmbChooser2Change( int index ) { |
948 | 1010 | ||
949 | txtChooserField2->setText( slChooserValues[index] ); | 1011 | txtChooserField2->setText( slChooserValues[index] ); |
950 | txtChooserField2->setFocus(); | 1012 | txtChooserField2->setFocus(); |
951 | } | 1013 | } |
952 | 1014 | ||
953 | void ContactEditor::slotCmbChooser3Change( int index ) { | 1015 | void ContactEditor::slotCmbChooser3Change( int index ) { |
954 | 1016 | ||
955 | txtChooserField3->setText( slChooserValues[index] ); | 1017 | txtChooserField3->setText( slChooserValues[index] ); |
956 | txtChooserField3->setFocus(); | 1018 | txtChooserField3->setFocus(); |
957 | 1019 | ||
958 | } | 1020 | } |
959 | 1021 | ||
960 | void ContactEditor::slotCmbChooser4Change( int index ) { | 1022 | void ContactEditor::slotCmbChooser4Change( int index ) { |
961 | 1023 | ||
962 | txtChooserField4->setText( slChooserValues[index] ); | 1024 | txtChooserField4->setText( slChooserValues[index] ); |
963 | txtChooserField4->setFocus(); | 1025 | txtChooserField4->setFocus(); |
964 | 1026 | ||
965 | } | 1027 | } |
966 | 1028 | ||
967 | void ContactEditor::slotAddressTypeChange( int index ) { | 1029 | void ContactEditor::slotAddressTypeChange( int index ) { |
968 | 1030 | ||
969 | if ( index == 0 ) { | 1031 | if ( index == 0 ) { |
970 | 1032 | ||
971 | txtAddress->setText( slBusinessAddress[0] ); | 1033 | txtAddress->setText( slBusinessAddress[0] ); |
972 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 1034 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
973 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 1035 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
974 | txtCity->setText( slBusinessAddress[3] ); | 1036 | txtCity->setText( slBusinessAddress[3] ); |
975 | txtState->setText( slBusinessAddress[4] ); | 1037 | txtState->setText( slBusinessAddress[4] ); |
976 | txtZip->setText( slBusinessAddress[5] ); | 1038 | txtZip->setText( slBusinessAddress[5] ); |
977 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1039 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
978 | txtTmp->setText( slBusinessAddress[6] ); | 1040 | txtTmp->setText( slBusinessAddress[6] ); |
979 | 1041 | ||
980 | } else { | 1042 | } else { |
981 | 1043 | ||
982 | txtAddress->setText( slHomeAddress[0] ); | 1044 | txtAddress->setText( slHomeAddress[0] ); |
983 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 1045 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
984 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 1046 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
985 | txtCity->setText( slHomeAddress[3] ); | 1047 | txtCity->setText( slHomeAddress[3] ); |
986 | txtState->setText( slHomeAddress[4] ); | 1048 | txtState->setText( slHomeAddress[4] ); |
987 | txtZip->setText( slHomeAddress[5] ); | 1049 | txtZip->setText( slHomeAddress[5] ); |
988 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1050 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
989 | txtTmp->setText( slHomeAddress[6] ); | 1051 | txtTmp->setText( slHomeAddress[6] ); |
990 | 1052 | ||
991 | } | 1053 | } |
992 | 1054 | ||
993 | } | 1055 | } |
994 | 1056 | ||
995 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1057 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
996 | 1058 | ||
997 | int index = cmbFileAs->currentItem(); | 1059 | int index = cmbFileAs->currentItem(); |
998 | 1060 | ||
999 | cmbFileAs->clear(); | 1061 | cmbFileAs->clear(); |
1000 | 1062 | ||
1001 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); | 1063 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); |
1002 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); | 1064 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); |
1003 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); | 1065 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); |
1004 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); | 1066 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); |
1005 | 1067 | ||
1006 | cmbFileAs->setCurrentItem( index ); | 1068 | cmbFileAs->setCurrentItem( index ); |
1007 | 1069 | ||
1008 | useFullName = TRUE; | 1070 | useFullName = TRUE; |
1009 | 1071 | ||
1010 | } | 1072 | } |
1011 | 1073 | ||
1074 | // Loads the detail fields | ||
1012 | void ContactEditor::loadFields() { | 1075 | void ContactEditor::loadFields() { |
1013 | 1076 | ||
1014 | QStringList::ConstIterator it; | 1077 | QStringList::ConstIterator it; |
1015 | QListIterator<QLabel> lit( listName ); | 1078 | QListIterator<QLabel> lit( listName ); |
1016 | for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { | 1079 | for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { |
1017 | 1080 | ||
1018 | if ( *it == "Department" ) | 1081 | if ( *it == "Department" ) |
1019 | (*lit)->setText( tr( "Department" ) ); | 1082 | (*lit)->setText( tr( "Department" ) ); |
1020 | 1083 | ||
1021 | if ( *it == "Company" ) | 1084 | if ( *it == "Company" ) |
1022 | (*lit)->setText( tr( "Company" ) ); | 1085 | (*lit)->setText( tr( "Company" ) ); |
1023 | 1086 | ||
1024 | if ( *it == "Office" ) | 1087 | if ( *it == "Office" ) |
1025 | (*lit)->setText( tr( "Office" ) ); | 1088 | (*lit)->setText( tr( "Office" ) ); |
1026 | 1089 | ||
1027 | if ( *it == "Profession" ) | 1090 | if ( *it == "Profession" ) |
1028 | (*lit)->setText( tr( "Profession" ) ); | 1091 | (*lit)->setText( tr( "Profession" ) ); |
1029 | 1092 | ||
1030 | if ( *it == "Assistant" ) | 1093 | if ( *it == "Assistant" ) |
1031 | (*lit)->setText( tr( "Assistant" ) ); | 1094 | (*lit)->setText( tr( "Assistant" ) ); |
1032 | 1095 | ||
1033 | if ( *it == "Manager" ) | 1096 | if ( *it == "Manager" ) |
1034 | (*lit)->setText( tr( "Manager" ) ); | 1097 | (*lit)->setText( tr( "Manager" ) ); |
1035 | 1098 | ||
1036 | if ( *it == "Spouse" ) | 1099 | if ( *it == "Spouse" ) |
1037 | (*lit)->setText( tr( "Spouse" ) ); | 1100 | (*lit)->setText( tr( "Spouse" ) ); |
1038 | 1101 | ||
1039 | if ( *it == "Birthday" ) | ||
1040 | (*lit)->setText( tr( "Birthday" ) ); | ||
1041 | |||
1042 | if ( *it == "Anniversary" ) | ||
1043 | (*lit)->setText( tr( "Anniversary" ) ); | ||
1044 | |||
1045 | if ( *it == "Nickname" ) | 1102 | if ( *it == "Nickname" ) |
1046 | (*lit)->setText( tr( "Nickname" ) ); | 1103 | (*lit)->setText( tr( "Nickname" ) ); |
1047 | 1104 | ||
1048 | if ( *it == "Children" ) | 1105 | if ( *it == "Children" ) |
1049 | (*lit)->setText( tr( "Children" ) ); | 1106 | (*lit)->setText( tr( "Children" ) ); |
1050 | } | 1107 | } |
1108 | // Set DatePicker | ||
1109 | qWarning ("**Info: %s", ent.birthday().latin1() ); | ||
1110 | if ( !ent.birthday().isEmpty() ){ | ||
1111 | birthdayButton->setText( ent.birthday() ); | ||
1112 | birthdayPicker->setDate( TimeConversion::fromString ( ent.birthday() ) ); | ||
1113 | } else | ||
1114 | birthdayButton->setText( tr ("Unknown") ); | ||
1115 | |||
1116 | qWarning ("**Info: %s", ent.anniversary().latin1() ); | ||
1117 | if ( !ent.anniversary().isEmpty() ){ | ||
1118 | anniversaryButton->setText( ent.anniversary() ); | ||
1119 | anniversaryPicker->setDate( TimeConversion::fromString ( ent.birthday() ) ); | ||
1120 | } else | ||
1121 | anniversaryButton->setText( tr ("Unknown") ); | ||
1122 | |||
1051 | } | 1123 | } |
1052 | 1124 | ||
1053 | void ContactEditor::accept() { | 1125 | void ContactEditor::accept() { |
1054 | 1126 | ||
1055 | if ( isEmpty() ) { | 1127 | if ( isEmpty() ) { |
1056 | cleanupFields(); | 1128 | cleanupFields(); |
1057 | reject(); | 1129 | reject(); |
1058 | } else { | 1130 | } else { |
1059 | saveEntry(); | 1131 | saveEntry(); |
1060 | cleanupFields(); | 1132 | cleanupFields(); |
1061 | QDialog::accept(); | 1133 | QDialog::accept(); |
1062 | } | 1134 | } |
1063 | 1135 | ||
1064 | } | 1136 | } |
1065 | 1137 | ||
1066 | void ContactEditor::slotNote() { | 1138 | void ContactEditor::slotNote() { |
1067 | 1139 | ||
1068 | dlgNote->showMaximized(); | 1140 | dlgNote->showMaximized(); |
1069 | if ( !dlgNote->exec() ) { | 1141 | if ( !dlgNote->exec() ) { |
1070 | txtNote->setText( ent.notes() ); | 1142 | txtNote->setText( ent.notes() ); |
1071 | } | 1143 | } |
1072 | } | 1144 | } |
1073 | 1145 | ||
1074 | void ContactEditor::slotName() { | 1146 | void ContactEditor::slotName() { |
1075 | 1147 | ||
1076 | QString tmpName; | 1148 | QString tmpName; |
1077 | if (useFullName == TRUE) { | 1149 | if (useFullName == TRUE) { |
1078 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1150 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1079 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1151 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1080 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1152 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1081 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1153 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1082 | } | 1154 | } |
1083 | dlgName->showMaximized(); | 1155 | dlgName->showMaximized(); |
1084 | if ( dlgName->exec() ) { | 1156 | if ( dlgName->exec() ) { |
1085 | 1157 | ||
1086 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); | 1158 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); |
1087 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1159 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1088 | slotFullNameChange( txtFullName->text() ); | 1160 | slotFullNameChange( txtFullName->text() ); |
1089 | useFullName = FALSE; | 1161 | useFullName = FALSE; |
1090 | } | 1162 | } |
1091 | 1163 | ||
1092 | } | 1164 | } |
1093 | 1165 | ||
1094 | void ContactEditor::setNameFocus() { | 1166 | void ContactEditor::setNameFocus() { |
1095 | 1167 | ||
1096 | txtFullName->setFocus(); | 1168 | txtFullName->setFocus(); |
1097 | 1169 | ||
1098 | } | 1170 | } |
1099 | 1171 | ||
1100 | bool ContactEditor::isEmpty() { | 1172 | bool ContactEditor::isEmpty() { |
1101 | // Test and see if the record should be saved. | 1173 | // Test and see if the record should be saved. |
1102 | // More strict than the original qtopia, needs name or fileas to save | 1174 | // More strict than the original qtopia, needs name or fileas to save |
1103 | 1175 | ||
1104 | QString t = txtFullName->text(); | 1176 | QString t = txtFullName->text(); |
1105 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1177 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1106 | return false; | 1178 | return false; |
1107 | 1179 | ||
1108 | t = cmbFileAs->currentText(); | 1180 | t = cmbFileAs->currentText(); |
1109 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1181 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1110 | return false; | 1182 | return false; |
1111 | 1183 | ||
1112 | return true; | 1184 | return true; |
1113 | 1185 | ||
1114 | } | 1186 | } |
1115 | 1187 | ||
1116 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1188 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1117 | 1189 | ||
1118 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1190 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1119 | QString strFirstName; | 1191 | QString strFirstName; |
1120 | QString strMiddleName; | 1192 | QString strMiddleName; |
1121 | QString strLastName; | 1193 | QString strLastName; |
1122 | QString strSuffix; | 1194 | QString strSuffix; |
1123 | QString strTitle; | 1195 | QString strTitle; |
1124 | int commapos; | 1196 | int commapos; |
1125 | int spCount; | 1197 | int spCount; |
1126 | int spPos; | 1198 | int spPos; |
1127 | int spPos2; | 1199 | int spPos2; |
1128 | 1200 | ||
1129 | 1201 | ||
1130 | commapos = simplifiedName.find( ',', 0, TRUE); | 1202 | commapos = simplifiedName.find( ',', 0, TRUE); |
1131 | spCount = simplifiedName.contains( ' ', TRUE ); | 1203 | spCount = simplifiedName.contains( ' ', TRUE ); |
1132 | 1204 | ||
1133 | if ( commapos == -1 ) { | 1205 | if ( commapos == -1 ) { |
1134 | 1206 | ||
1135 | switch (spCount) { | 1207 | switch (spCount) { |
1136 | case 0: | 1208 | case 0: |
1137 | //return simplifiedName; | 1209 | //return simplifiedName; |
1138 | if (txtLastName->text() != "") { | 1210 | if (txtLastName->text() != "") { |
1139 | strLastName = simplifiedName; | 1211 | strLastName = simplifiedName; |
1140 | break; | 1212 | break; |
1141 | } | 1213 | } |
1142 | if (txtMiddleName->text() != "") { | 1214 | if (txtMiddleName->text() != "") { |
1143 | strMiddleName = simplifiedName; | 1215 | strMiddleName = simplifiedName; |
1144 | break; | 1216 | break; |
1145 | } | 1217 | } |
1146 | if (txtSuffix->text() != "") { | 1218 | if (txtSuffix->text() != "") { |
1147 | strSuffix = simplifiedName; | 1219 | strSuffix = simplifiedName; |
1148 | break; | 1220 | break; |
1149 | } | 1221 | } |
1150 | strFirstName = simplifiedName; | 1222 | strFirstName = simplifiedName; |
1151 | break; | 1223 | break; |
1152 | 1224 | ||
1153 | case 1: | 1225 | case 1: |
1154 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1226 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1155 | strFirstName = simplifiedName.left( spPos ); | 1227 | strFirstName = simplifiedName.left( spPos ); |
1156 | strLastName = simplifiedName.mid( spPos + 1 ); | 1228 | strLastName = simplifiedName.mid( spPos + 1 ); |
1157 | break; | 1229 | break; |
1158 | 1230 | ||
1159 | case 2: | 1231 | case 2: |
1160 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1232 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1161 | strFirstName = simplifiedName.left( spPos ); | 1233 | strFirstName = simplifiedName.left( spPos ); |
1162 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1234 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1163 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1235 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1164 | strLastName = simplifiedName.mid( spPos2 + 1 ); | 1236 | strLastName = simplifiedName.mid( spPos2 + 1 ); |
1165 | break; | 1237 | break; |
1166 | 1238 | ||
1167 | case 3: | 1239 | case 3: |
1168 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1240 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1169 | strFirstName = simplifiedName.left( spPos ); | 1241 | strFirstName = simplifiedName.left( spPos ); |
1170 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1242 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1171 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1243 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1172 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1244 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1173 | strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1245 | strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1174 | strSuffix = simplifiedName.mid( spPos + 1 ); | 1246 | strSuffix = simplifiedName.mid( spPos + 1 ); |
1175 | break; | 1247 | break; |
1176 | 1248 | ||
1177 | case 4: | 1249 | case 4: |
1178 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1250 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1179 | strTitle = simplifiedName.left( spPos ); | 1251 | strTitle = simplifiedName.left( spPos ); |
1180 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1252 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1181 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1253 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1182 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1254 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1183 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1255 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1184 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1256 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1185 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1257 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1186 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1258 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1187 | break; | 1259 | break; |
1188 | 1260 | ||
1189 | default: | 1261 | default: |
1190 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1262 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1191 | strTitle = simplifiedName.left( spPos ); | 1263 | strTitle = simplifiedName.left( spPos ); |
1192 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1264 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1193 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1265 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1194 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1266 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1195 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1267 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1196 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1268 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1197 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1269 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1198 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1270 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1199 | break; | 1271 | break; |
1200 | } | 1272 | } |
1201 | } else { | 1273 | } else { |
1202 | simplifiedName.replace( commapos, 1, " " ); | 1274 | simplifiedName.replace( commapos, 1, " " ); |
1203 | simplifiedName = simplifiedName.simplifyWhiteSpace(); | 1275 | simplifiedName = simplifiedName.simplifyWhiteSpace(); |
1204 | 1276 | ||
1205 | switch (spCount) { | 1277 | switch (spCount) { |
1206 | case 0: | 1278 | case 0: |
1207 | //return simplifiedName; | 1279 | //return simplifiedName; |
1208 | if (txtLastName->text() != "") { | 1280 | if (txtLastName->text() != "") { |
1209 | strLastName = simplifiedName; | 1281 | strLastName = simplifiedName; |
1210 | break; | 1282 | break; |
1211 | } | 1283 | } |
1212 | if (txtMiddleName->text() != "") { | 1284 | if (txtMiddleName->text() != "") { |
1213 | strMiddleName = simplifiedName; | 1285 | strMiddleName = simplifiedName; |
1214 | break; | 1286 | break; |
1215 | } | 1287 | } |
1216 | if (txtSuffix->text() != "") { | 1288 | if (txtSuffix->text() != "") { |
1217 | strSuffix = simplifiedName; | 1289 | strSuffix = simplifiedName; |
1218 | break; | 1290 | break; |
1219 | } | 1291 | } |
1220 | strFirstName = simplifiedName; | 1292 | strFirstName = simplifiedName; |
1221 | break; | 1293 | break; |
1222 | 1294 | ||
1223 | case 1: | 1295 | case 1: |
1224 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1296 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1225 | strLastName = simplifiedName.left( spPos ); | 1297 | strLastName = simplifiedName.left( spPos ); |
1226 | strFirstName = simplifiedName.mid( spPos + 1 ); | 1298 | strFirstName = simplifiedName.mid( spPos + 1 ); |
1227 | break; | 1299 | break; |
1228 | 1300 | ||
1229 | case 2: | 1301 | case 2: |
1230 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1302 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1231 | strLastName = simplifiedName.left( spPos ); | 1303 | strLastName = simplifiedName.left( spPos ); |
1232 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1304 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1233 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1305 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1234 | strMiddleName = simplifiedName.mid( spPos2 + 1 ); | 1306 | strMiddleName = simplifiedName.mid( spPos2 + 1 ); |
1235 | break; | 1307 | break; |
1236 | 1308 | ||
1237 | case 3: | 1309 | case 3: |
1238 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1310 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1239 | strLastName = simplifiedName.left( spPos ); | 1311 | strLastName = simplifiedName.left( spPos ); |
1240 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1312 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1241 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1313 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1242 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1314 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1243 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1315 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1244 | strSuffix = simplifiedName.mid( spPos + 1 ); | 1316 | strSuffix = simplifiedName.mid( spPos + 1 ); |
1245 | break; | 1317 | break; |
1246 | 1318 | ||
1247 | case 4: | 1319 | case 4: |
1248 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1320 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1249 | strLastName = simplifiedName.left( spPos ); | 1321 | strLastName = simplifiedName.left( spPos ); |
1250 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1322 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1251 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1323 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1252 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1324 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1253 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1325 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1254 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1326 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1255 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1327 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1256 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1328 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1257 | break; | 1329 | break; |
1258 | 1330 | ||
1259 | default: | 1331 | default: |
1260 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1332 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1261 | strLastName = simplifiedName.left( spPos ); | 1333 | strLastName = simplifiedName.left( spPos ); |
1262 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1334 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1263 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1335 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1264 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1336 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1265 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 1337 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); |
1266 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1338 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1267 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1339 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1268 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1340 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1269 | break; | 1341 | break; |
1270 | } | 1342 | } |
1271 | } | 1343 | } |
1272 | switch (type) { | 1344 | switch (type) { |
1273 | case NAME_FL: | 1345 | case NAME_FL: |
1274 | return strFirstName + " " + strLastName; | 1346 | return strFirstName + " " + strLastName; |
1275 | 1347 | ||
1276 | case NAME_LF: | 1348 | case NAME_LF: |
1277 | return strLastName + ", " + strFirstName; | 1349 | return strLastName + ", " + strFirstName; |
1278 | 1350 | ||
1279 | case NAME_LFM: | 1351 | case NAME_LFM: |
1280 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1352 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1281 | 1353 | ||
1282 | case NAME_FMLS: | 1354 | case NAME_FMLS: |
1283 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; | 1355 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; |
1284 | 1356 | ||
1285 | case NAME_F: | 1357 | case NAME_F: |
1286 | return strFirstName; | 1358 | return strFirstName; |
1287 | 1359 | ||
1288 | case NAME_M: | 1360 | case NAME_M: |
1289 | return strMiddleName; | 1361 | return strMiddleName; |
1290 | 1362 | ||
1291 | case NAME_L: | 1363 | case NAME_L: |
1292 | return strLastName; | 1364 | return strLastName; |
1293 | 1365 | ||
1294 | case NAME_S: | 1366 | case NAME_S: |
1295 | return strSuffix; | 1367 | return strSuffix; |
1296 | 1368 | ||
1297 | } | 1369 | } |
1298 | return QString::null; | 1370 | return QString::null; |
1299 | } | 1371 | } |
1300 | 1372 | ||
1301 | void ContactEditor::cleanupFields() { | 1373 | void ContactEditor::cleanupFields() { |
1302 | 1374 | ||
1303 | QStringList::Iterator it = slChooserValues.begin(); | 1375 | QStringList::Iterator it = slChooserValues.begin(); |
1304 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1376 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1305 | (*it) = ""; | 1377 | (*it) = ""; |
1306 | } | 1378 | } |
1307 | 1379 | ||
1308 | for ( int i = 0; i < 7; i++ ) { | 1380 | for ( int i = 0; i < 7; i++ ) { |
1309 | slHomeAddress[i] = ""; | 1381 | slHomeAddress[i] = ""; |
1310 | slBusinessAddress[i] = ""; | 1382 | slBusinessAddress[i] = ""; |
1311 | } | 1383 | } |
1312 | 1384 | ||
1313 | QStringList::ConstIterator cit; | 1385 | QStringList::ConstIterator cit; |
1314 | QListIterator<QLineEdit> itLE( listValue ); | 1386 | QListIterator<QLineEdit> itLE( listValue ); |
1315 | for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) { | 1387 | for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) { |
1316 | (*itLE)->setText( "" ); | 1388 | (*itLE)->setText( "" ); |
1317 | } | 1389 | } |
1318 | 1390 | ||
1319 | txtFirstName->setText(""); | 1391 | txtFirstName->setText(""); |
1320 | txtMiddleName->setText(""); | 1392 | txtMiddleName->setText(""); |
1321 | txtLastName->setText(""); | 1393 | txtLastName->setText(""); |
1322 | txtSuffix->setText(""); | 1394 | txtSuffix->setText(""); |
1323 | txtNote->setText(""); | 1395 | txtNote->setText(""); |
1324 | txtFullName->setText(""); | 1396 | txtFullName->setText(""); |
1325 | txtJobTitle->setText(""); | 1397 | txtJobTitle->setText(""); |
1326 | txtOrganization->setText(""); | 1398 | txtOrganization->setText(""); |
1327 | txtChooserField1->setText(""); | 1399 | txtChooserField1->setText(""); |
1328 | txtChooserField2->setText(""); | 1400 | txtChooserField2->setText(""); |
1329 | txtChooserField3->setText(""); | 1401 | txtChooserField3->setText(""); |
1330 | txtAddress->setText(""); | 1402 | txtAddress->setText(""); |
1331 | //txtAddress2->setText(""); | 1403 | //txtAddress2->setText(""); |
1332 | txtCity->setText(""); | 1404 | txtCity->setText(""); |
1333 | //txtPOBox->setText(""); | 1405 | //txtPOBox->setText(""); |
1334 | txtState->setText(""); | 1406 | txtState->setText(""); |
1335 | txtZip->setText(""); | 1407 | txtZip->setText(""); |
1336 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1408 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1337 | txtTmp->setText(""); | 1409 | txtTmp->setText(""); |
1338 | txtTmp = cmbFileAs->lineEdit(); | 1410 | txtTmp = cmbFileAs->lineEdit(); |
1339 | txtTmp->setText(""); | 1411 | txtTmp->setText(""); |
1340 | 1412 | ||
1341 | } | 1413 | } |
1342 | 1414 | ||
1343 | void ContactEditor::setEntry( const OContact &entry ) { | 1415 | void ContactEditor::setEntry( const OContact &entry ) { |
1344 | 1416 | ||
1345 | cleanupFields(); | 1417 | cleanupFields(); |
1346 | 1418 | ||
1347 | 1419 | ||
1348 | ent = entry; | 1420 | ent = entry; |
1349 | 1421 | ||
1350 | useFullName = FALSE; | 1422 | useFullName = FALSE; |
1351 | txtFirstName->setText( ent.firstName() ); | 1423 | txtFirstName->setText( ent.firstName() ); |
1352 | txtMiddleName->setText( ent.middleName() ); | 1424 | txtMiddleName->setText( ent.middleName() ); |
1353 | txtLastName->setText( ent.lastName() ); | 1425 | txtLastName->setText( ent.lastName() ); |
1354 | txtSuffix->setText( ent.suffix() ); | 1426 | txtSuffix->setText( ent.suffix() ); |
1355 | 1427 | ||
1356 | QString *tmpString = new QString; | 1428 | QString *tmpString = new QString; |
1357 | *tmpString = ent.firstName() + " " + ent.middleName() + | 1429 | *tmpString = ent.firstName() + " " + ent.middleName() + |
1358 | + " " + ent.lastName() + " " + ent.suffix(); | 1430 | + " " + ent.lastName() + " " + ent.suffix(); |
1359 | 1431 | ||
1360 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1432 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1361 | 1433 | ||
1362 | cmbFileAs->setEditText( ent.fileAs() ); | 1434 | cmbFileAs->setEditText( ent.fileAs() ); |
1363 | 1435 | ||
1364 | if (hasTitle) | 1436 | if (hasTitle) |
1365 | txtJobTitle->setText( ent.jobTitle() ); | 1437 | txtJobTitle->setText( ent.jobTitle() ); |
1366 | 1438 | ||
1367 | if (hasCompany) | 1439 | if (hasCompany) |
1368 | txtOrganization->setText( ent.company() ); | 1440 | txtOrganization->setText( ent.company() ); |
1369 | 1441 | ||
1370 | if (hasNotes) | 1442 | if (hasNotes) |
1371 | txtNote->setText( ent.notes() ); | 1443 | txtNote->setText( ent.notes() ); |
1372 | 1444 | ||
1373 | if (hasStreet) { | 1445 | if (hasStreet) { |
1374 | slHomeAddress[0] = ent.homeStreet(); | 1446 | slHomeAddress[0] = ent.homeStreet(); |
1375 | slBusinessAddress[0] = ent.businessStreet(); | 1447 | slBusinessAddress[0] = ent.businessStreet(); |
1376 | } | 1448 | } |
1377 | /* | 1449 | /* |
1378 | if (hasStreet2) { | 1450 | if (hasStreet2) { |
1379 | (*slHomeAddress)[1] = ent.homeStreet2(); | 1451 | (*slHomeAddress)[1] = ent.homeStreet2(); |
1380 | (*slBusinessAddress)[1] = ent.businessStreet2(); | 1452 | (*slBusinessAddress)[1] = ent.businessStreet2(); |
1381 | } | 1453 | } |
1382 | 1454 | ||
1383 | if (hasPOBox) { | 1455 | if (hasPOBox) { |
1384 | (*slHomeAddress)[2] = ent.homePOBox(); | 1456 | (*slHomeAddress)[2] = ent.homePOBox(); |
1385 | (*slBusinessAddress)[2] = ent.businessPOBox(); | 1457 | (*slBusinessAddress)[2] = ent.businessPOBox(); |
1386 | } | 1458 | } |
1387 | */ | 1459 | */ |
1388 | if (hasCity) { | 1460 | if (hasCity) { |
1389 | slHomeAddress[3] = ent.homeCity(); | 1461 | slHomeAddress[3] = ent.homeCity(); |
1390 | slBusinessAddress[3] = ent.businessCity(); | 1462 | slBusinessAddress[3] = ent.businessCity(); |
1391 | } | 1463 | } |
1392 | 1464 | ||
1393 | if (hasState) { | 1465 | if (hasState) { |
1394 | slHomeAddress[4] = ent.homeState(); | 1466 | slHomeAddress[4] = ent.homeState(); |
1395 | slBusinessAddress[4] = ent.businessState(); | 1467 | slBusinessAddress[4] = ent.businessState(); |
1396 | } | 1468 | } |
1397 | 1469 | ||
1398 | if (hasZip) { | 1470 | if (hasZip) { |
1399 | slHomeAddress[5] = ent.homeZip(); | 1471 | slHomeAddress[5] = ent.homeZip(); |
1400 | slBusinessAddress[5] = ent.businessZip(); | 1472 | slBusinessAddress[5] = ent.businessZip(); |
1401 | } | 1473 | } |
1402 | 1474 | ||
1403 | if (hasCountry) { | 1475 | if (hasCountry) { |
1404 | slHomeAddress[6] = ent.homeCountry(); | 1476 | slHomeAddress[6] = ent.homeCountry(); |
1405 | slBusinessAddress[6] = ent.businessCountry(); | 1477 | slBusinessAddress[6] = ent.businessCountry(); |
1406 | } | 1478 | } |
1407 | 1479 | ||
1408 | QStringList::ConstIterator it; | 1480 | QStringList::ConstIterator it; |
1409 | QListIterator<QLineEdit> itLE( listValue ); | 1481 | QListIterator<QLineEdit> itLE( listValue ); |
1410 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { | 1482 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { |
1411 | if ( *it == "Department" ) | 1483 | if ( *it == "Department" ) |
1412 | (*itLE)->setText( ent.department() ); | 1484 | (*itLE)->setText( ent.department() ); |
1413 | 1485 | ||
1414 | if ( *it == "Company" ) | 1486 | if ( *it == "Company" ) |
1415 | (*itLE)->setText( ent.company() ); | 1487 | (*itLE)->setText( ent.company() ); |
1416 | 1488 | ||
1417 | if ( *it == "Office" ) | 1489 | if ( *it == "Office" ) |
1418 | (*itLE)->setText( ent.office() ); | 1490 | (*itLE)->setText( ent.office() ); |
1419 | 1491 | ||
1420 | if ( *it == "Profession" ) | 1492 | if ( *it == "Profession" ) |
1421 | (*itLE)->setText( ent.profession() ); | 1493 | (*itLE)->setText( ent.profession() ); |
1422 | 1494 | ||
1423 | if ( *it == "Assistant" ) | 1495 | if ( *it == "Assistant" ) |
1424 | (*itLE)->setText( ent.assistant() ); | 1496 | (*itLE)->setText( ent.assistant() ); |
1425 | 1497 | ||
1426 | if ( *it == "Manager" ) | 1498 | if ( *it == "Manager" ) |
1427 | (*itLE)->setText( ent.manager() ); | 1499 | (*itLE)->setText( ent.manager() ); |
1428 | 1500 | ||
1429 | if ( *it == "Spouse" ) | 1501 | if ( *it == "Spouse" ) |
1430 | (*itLE)->setText( ent.spouse() ); | 1502 | (*itLE)->setText( ent.spouse() ); |
1431 | 1503 | ||
1432 | if ( *it == "Birthday" ) | ||
1433 | (*itLE)->setText( ent.birthday() ); | ||
1434 | |||
1435 | if ( *it == "Anniversary" ) | ||
1436 | (*itLE)->setText( ent.anniversary() ); | ||
1437 | |||
1438 | if ( *it == "Nickname" ) | 1504 | if ( *it == "Nickname" ) |
1439 | (*itLE)->setText( ent.nickname() ); | 1505 | (*itLE)->setText( ent.nickname() ); |
1440 | 1506 | ||
1441 | if ( *it == "Children" ) | 1507 | if ( *it == "Children" ) |
1442 | (*itLE)->setText( ent.children() ); | 1508 | (*itLE)->setText( ent.children() ); |
1443 | 1509 | ||
1444 | } | 1510 | } |
1445 | 1511 | ||
1446 | QStringList::Iterator itV; | 1512 | QStringList::Iterator itV; |
1447 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1513 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1448 | 1514 | ||
1449 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1515 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1450 | *itV = ent.businessPhone(); | 1516 | *itV = ent.businessPhone(); |
1451 | /* | 1517 | /* |
1452 | if ( *it == "Business 2 Phone" ) | 1518 | if ( *it == "Business 2 Phone" ) |
1453 | *itV = ent.business2Phone(); | 1519 | *itV = ent.business2Phone(); |
1454 | */ | 1520 | */ |
1455 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1521 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1456 | *itV = ent.businessFax(); | 1522 | *itV = ent.businessFax(); |
1457 | 1523 | ||
1458 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1524 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1459 | *itV = ent.businessMobile(); | 1525 | *itV = ent.businessMobile(); |
1460 | /* | 1526 | /* |
1461 | if ( *it == "Company Phone" ) | 1527 | if ( *it == "Company Phone" ) |
1462 | *itV = ent.companyPhone(); | 1528 | *itV = ent.companyPhone(); |
1463 | */ | 1529 | */ |
1464 | if ( *it == "Default Email" ) | 1530 | if ( *it == "Default Email" ) |
1465 | *itV = ent.defaultEmail(); | 1531 | *itV = ent.defaultEmail(); |
1466 | 1532 | ||
1467 | if ( *it == "Emails" ) | 1533 | if ( *it == "Emails" ) |
1468 | *itV = ent.emailList().join(", "); // :SX | 1534 | *itV = ent.emailList().join(", "); // :SX |
1469 | 1535 | ||
1470 | if ( *it == "Home Phone" ) | 1536 | if ( *it == "Home Phone" ) |
1471 | *itV = ent.homePhone(); | 1537 | *itV = ent.homePhone(); |
1472 | /* | 1538 | /* |
1473 | if ( *it == "Home 2 Phone" ) | 1539 | if ( *it == "Home 2 Phone" ) |
1474 | *itV = ent.home2Phone(); | 1540 | *itV = ent.home2Phone(); |
1475 | */ | 1541 | */ |
1476 | if ( *it == "Home Fax" ) | 1542 | if ( *it == "Home Fax" ) |
1477 | *itV = ent.homeFax(); | 1543 | *itV = ent.homeFax(); |
1478 | 1544 | ||
1479 | if ( *it == "Home Mobile" ) | 1545 | if ( *it == "Home Mobile" ) |
1480 | *itV = ent.homeMobile(); | 1546 | *itV = ent.homeMobile(); |
1481 | /* | 1547 | /* |
1482 | if ( *it == "Car Phone" ) | 1548 | if ( *it == "Car Phone" ) |
1483 | *itV = ent.carPhone(); | 1549 | *itV = ent.carPhone(); |
1484 | 1550 | ||
1485 | if ( *it == "ISDN Phone" ) | 1551 | if ( *it == "ISDN Phone" ) |
1486 | *itV = ent.ISDNPhone(); | 1552 | *itV = ent.ISDNPhone(); |
1487 | 1553 | ||
1488 | if ( *it == "Other Phone" ) | 1554 | if ( *it == "Other Phone" ) |
1489 | *itV = ent.otherPhone(); | 1555 | *itV = ent.otherPhone(); |
1490 | */ | 1556 | */ |
1491 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1557 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1492 | *itV = ent.businessPager(); | 1558 | *itV = ent.businessPager(); |
1493 | /* | 1559 | /* |
1494 | if ( *it == "Home Pager") | 1560 | if ( *it == "Home Pager") |
1495 | *itV = ent.homePager(); | 1561 | *itV = ent.homePager(); |
1496 | 1562 | ||
1497 | if ( *it == "AIM IM" ) | 1563 | if ( *it == "AIM IM" ) |
1498 | *itV = ent.AIMIM(); | 1564 | *itV = ent.AIMIM(); |
1499 | 1565 | ||
1500 | if ( *it == "ICQ IM" ) | 1566 | if ( *it == "ICQ IM" ) |
1501 | *itV = ent.ICQIM(); | 1567 | *itV = ent.ICQIM(); |
1502 | 1568 | ||
1503 | if ( *it == "Jabber IM" ) | 1569 | if ( *it == "Jabber IM" ) |
1504 | *itV = ent.jabberIM(); | 1570 | *itV = ent.jabberIM(); |
1505 | 1571 | ||
1506 | if ( *it == "MSN IM" ) | 1572 | if ( *it == "MSN IM" ) |
1507 | *itV = ent.MSNIM(); | 1573 | *itV = ent.MSNIM(); |
1508 | 1574 | ||
1509 | if ( *it == "Yahoo IM" ) | 1575 | if ( *it == "Yahoo IM" ) |
1510 | *itV = ent.yahooIM(); | 1576 | *itV = ent.yahooIM(); |
1511 | */ | 1577 | */ |
1512 | if ( *it == "Home Web Page" ) | 1578 | if ( *it == "Home Web Page" ) |
1513 | *itV = ent.homeWebpage(); | 1579 | *itV = ent.homeWebpage(); |
1514 | 1580 | ||
1515 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1581 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1516 | *itV = ent.businessWebpage(); | 1582 | *itV = ent.businessWebpage(); |
1517 | 1583 | ||
1518 | 1584 | ||
1519 | } | 1585 | } |
1520 | 1586 | ||
1587 | |||
1521 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1588 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1522 | 1589 | ||
1523 | QString gender = ent.gender(); | 1590 | QString gender = ent.gender(); |
1524 | cmbGender->setCurrentItem( gender.toInt() ); | 1591 | cmbGender->setCurrentItem( gender.toInt() ); |
1525 | 1592 | ||
1526 | txtNote->setText( ent.notes() ); | 1593 | txtNote->setText( ent.notes() ); |
1527 | 1594 | ||
1528 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1595 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1529 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1596 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1530 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1597 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1531 | 1598 | ||
1532 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1599 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1533 | 1600 | ||
1601 | loadFields(); | ||
1602 | |||
1534 | } | 1603 | } |
1535 | 1604 | ||
1536 | void ContactEditor::saveEntry() { | 1605 | void ContactEditor::saveEntry() { |
1537 | 1606 | ||
1538 | if ( useFullName == TRUE ) { | 1607 | if ( useFullName == TRUE ) { |
1539 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1608 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1540 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1609 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1541 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1610 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1542 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1611 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1543 | 1612 | ||
1544 | useFullName = FALSE; | 1613 | useFullName = FALSE; |
1545 | } | 1614 | } |
1546 | 1615 | ||
1547 | /*if ( ent.firstName() != txtFirstName->text() || | 1616 | /*if ( ent.firstName() != txtFirstName->text() || |
1548 | ent.lastName != txtLastName->text() || | 1617 | ent.lastName != txtLastName->text() || |
1549 | ent.middleName != txtMiddleName->text() ) { | 1618 | ent.middleName != txtMiddleName->text() ) { |
1550 | */ | 1619 | */ |
1551 | ent.setFirstName( txtFirstName->text() ); | 1620 | ent.setFirstName( txtFirstName->text() ); |
1552 | ent.setLastName( txtLastName->text() ); | 1621 | ent.setLastName( txtLastName->text() ); |
1553 | ent.setMiddleName( txtMiddleName->text() ); | 1622 | ent.setMiddleName( txtMiddleName->text() ); |
1554 | ent.setSuffix( txtSuffix->text() ); | 1623 | ent.setSuffix( txtSuffix->text() ); |
1555 | 1624 | ||
1556 | //} | 1625 | //} |
1557 | 1626 | ||
1558 | ent.setFileAs( cmbFileAs->currentText() ); | 1627 | ent.setFileAs( cmbFileAs->currentText() ); |
1559 | 1628 | ||
1560 | ent.setCategories( cmbCat->currentCategories() ); | 1629 | ent.setCategories( cmbCat->currentCategories() ); |
1561 | 1630 | ||
1562 | if (hasTitle) | 1631 | if (hasTitle) |
1563 | ent.setJobTitle( txtJobTitle->text() ); | 1632 | ent.setJobTitle( txtJobTitle->text() ); |
1564 | 1633 | ||
1565 | if (hasCompany) | 1634 | if (hasCompany) |
1566 | ent.setCompany( txtOrganization->text() ); | 1635 | ent.setCompany( txtOrganization->text() ); |
1567 | 1636 | ||
1568 | if (hasNotes) | 1637 | if (hasNotes) |
1569 | ent.setNotes( txtNote->text() ); | 1638 | ent.setNotes( txtNote->text() ); |
1570 | 1639 | ||
1571 | if (hasStreet) { | 1640 | if (hasStreet) { |
1572 | ent.setHomeStreet( slHomeAddress[0] ); | 1641 | ent.setHomeStreet( slHomeAddress[0] ); |
1573 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1642 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1574 | } | 1643 | } |
1575 | /* | 1644 | /* |
1576 | if (hasStreet2) { | 1645 | if (hasStreet2) { |
1577 | ent.setHomeStreet2( (*slHomeAddress)[1] ); | 1646 | ent.setHomeStreet2( (*slHomeAddress)[1] ); |
1578 | ent.setBusinessStreet2( (*slBusinessAddress)[1] ); | 1647 | ent.setBusinessStreet2( (*slBusinessAddress)[1] ); |
1579 | } | 1648 | } |
1580 | 1649 | ||
1581 | if (hasPOBox) { | 1650 | if (hasPOBox) { |
1582 | ent.setHomePOBox( (*slHomeAddress)[2] ); | 1651 | ent.setHomePOBox( (*slHomeAddress)[2] ); |
1583 | ent.setBusinessPOBox( (*slBusinessAddress)[2] ); | 1652 | ent.setBusinessPOBox( (*slBusinessAddress)[2] ); |
1584 | } | 1653 | } |
1585 | */ | 1654 | */ |
1586 | if (hasCity) { | 1655 | if (hasCity) { |
1587 | ent.setHomeCity( slHomeAddress[3] ); | 1656 | ent.setHomeCity( slHomeAddress[3] ); |
1588 | ent.setBusinessCity( slBusinessAddress[3] ); | 1657 | ent.setBusinessCity( slBusinessAddress[3] ); |
1589 | } | 1658 | } |
1590 | 1659 | ||
1591 | if (hasState) { | 1660 | if (hasState) { |
1592 | ent.setHomeState( slHomeAddress[4] ); | 1661 | ent.setHomeState( slHomeAddress[4] ); |
1593 | ent.setBusinessState( slBusinessAddress[4] ); | 1662 | ent.setBusinessState( slBusinessAddress[4] ); |
1594 | } | 1663 | } |
1595 | 1664 | ||
1596 | if (hasZip) { | 1665 | if (hasZip) { |
1597 | ent.setHomeZip( slHomeAddress[5] ); | 1666 | ent.setHomeZip( slHomeAddress[5] ); |
1598 | ent.setBusinessZip( slBusinessAddress[5] ); | 1667 | ent.setBusinessZip( slBusinessAddress[5] ); |
1599 | } | 1668 | } |
1600 | 1669 | ||
1601 | if (hasCountry) { | 1670 | if (hasCountry) { |
1602 | ent.setHomeCountry( slHomeAddress[6] ); | 1671 | ent.setHomeCountry( slHomeAddress[6] ); |
1603 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1672 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1604 | } | 1673 | } |
1605 | 1674 | ||
1606 | QStringList::ConstIterator it; | 1675 | QStringList::ConstIterator it; |
1607 | QListIterator<QLineEdit> itLE( listValue ); | 1676 | QListIterator<QLineEdit> itLE( listValue ); |
1608 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { | 1677 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { |
1609 | if ( *it == "Department" ) | 1678 | if ( *it == "Department" ) |
1610 | ent.setDepartment( (*itLE)->text() ); | 1679 | ent.setDepartment( (*itLE)->text() ); |
1611 | 1680 | ||
1612 | if ( *it == "Company" ) | 1681 | if ( *it == "Company" ) |
1613 | ent.setCompany( (*itLE)->text() ); | 1682 | ent.setCompany( (*itLE)->text() ); |
1614 | 1683 | ||
1615 | if ( *it == "Office" ) | 1684 | if ( *it == "Office" ) |
1616 | ent.setOffice( (*itLE)->text() ); | 1685 | ent.setOffice( (*itLE)->text() ); |
1617 | 1686 | ||
1618 | if ( *it == "Profession" ) | 1687 | if ( *it == "Profession" ) |
1619 | ent.setProfession( (*itLE)->text() ); | 1688 | ent.setProfession( (*itLE)->text() ); |
1620 | 1689 | ||
1621 | if ( *it == "Assistant" ) | 1690 | if ( *it == "Assistant" ) |
1622 | ent.setAssistant( (*itLE)->text() ); | 1691 | ent.setAssistant( (*itLE)->text() ); |
1623 | 1692 | ||
1624 | if ( *it == "Manager" ) | 1693 | if ( *it == "Manager" ) |
1625 | ent.setManager( (*itLE)->text() ); | 1694 | ent.setManager( (*itLE)->text() ); |
1626 | 1695 | ||
1627 | if ( *it == "Spouse" ) | 1696 | if ( *it == "Spouse" ) |
1628 | ent.setSpouse( (*itLE)->text() ); | 1697 | ent.setSpouse( (*itLE)->text() ); |
1629 | 1698 | ||
1630 | if ( *it == "Birthday" ) | ||
1631 | ent.setBirthday( (*itLE)->text() ); | ||
1632 | |||
1633 | if ( *it == "Anniversary" ) | ||
1634 | ent.setAnniversary( (*itLE)->text() ); | ||
1635 | |||
1636 | if ( *it == "Nickname" ) | 1699 | if ( *it == "Nickname" ) |
1637 | ent.setNickname( (*itLE)->text() ); | 1700 | ent.setNickname( (*itLE)->text() ); |
1638 | 1701 | ||
1639 | if ( *it == "Children" ) | 1702 | if ( *it == "Children" ) |
1640 | ent.setChildren( (*itLE)->text() ); | 1703 | ent.setChildren( (*itLE)->text() ); |
1641 | 1704 | ||
1642 | } | 1705 | } |
1643 | 1706 | ||
1644 | QStringList::ConstIterator itV; | 1707 | QStringList::ConstIterator itV; |
1645 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1708 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1646 | 1709 | ||
1647 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1710 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1648 | ent.setBusinessPhone( *itV ); | 1711 | ent.setBusinessPhone( *itV ); |
1649 | /* | 1712 | /* |
1650 | if ( *it == tr("Business 2 Phone" ) | 1713 | if ( *it == tr("Business 2 Phone" ) |
1651 | ent.setBusiness2Phone( *itV ); | 1714 | ent.setBusiness2Phone( *itV ); |
1652 | */ | 1715 | */ |
1653 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1716 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1654 | ent.setBusinessFax( *itV ); | 1717 | ent.setBusinessFax( *itV ); |
1655 | 1718 | ||
1656 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1719 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1657 | ent.setBusinessMobile( *itV ); | 1720 | ent.setBusinessMobile( *itV ); |
1658 | /* | 1721 | /* |
1659 | if ( *it == "Company Phone" ) | 1722 | if ( *it == "Company Phone" ) |
1660 | ent.setCompanyPhone( *itV ); | 1723 | ent.setCompanyPhone( *itV ); |
1661 | */ | 1724 | */ |
1662 | //if ( *it == "Default Email" ) | 1725 | //if ( *it == "Default Email" ) |
1663 | //ent.setDefaultEmail( *itV ); | 1726 | //ent.setDefaultEmail( *itV ); |
1664 | 1727 | ||
1665 | if ( *it == "Emails" ){ | 1728 | if ( *it == "Emails" ){ |
1666 | QString allemail; | 1729 | QString allemail; |
1667 | QString defaultmail; | 1730 | QString defaultmail; |
1668 | parseEmailFrom( *itV, defaultmail, allemail ); | 1731 | parseEmailFrom( *itV, defaultmail, allemail ); |
1669 | // ent.clearEmails(); | 1732 | // ent.clearEmails(); |
1670 | ent.setDefaultEmail( defaultmail ); | 1733 | ent.setDefaultEmail( defaultmail ); |
1671 | ent.setEmails( allemail ); | 1734 | ent.setEmails( allemail ); |
1672 | } | 1735 | } |
1673 | 1736 | ||
1674 | if ( *it == "Home Phone" ) | 1737 | if ( *it == "Home Phone" ) |
1675 | ent.setHomePhone( *itV ); | 1738 | ent.setHomePhone( *itV ); |
1676 | /* | 1739 | /* |
1677 | if ( *it == "Home 2 Phone" ) | 1740 | if ( *it == "Home 2 Phone" ) |
1678 | ent.setHome2Phone( *itV ); | 1741 | ent.setHome2Phone( *itV ); |
1679 | */ | 1742 | */ |
1680 | if ( *it == "Home Fax" ) | 1743 | if ( *it == "Home Fax" ) |
1681 | ent.setHomeFax( *itV ); | 1744 | ent.setHomeFax( *itV ); |
1682 | 1745 | ||
1683 | if ( *it == "Home Mobile" ) | 1746 | if ( *it == "Home Mobile" ) |
1684 | ent.setHomeMobile( *itV ); | 1747 | ent.setHomeMobile( *itV ); |
1685 | /* | 1748 | /* |
1686 | if ( *it == "Car Phone" ) | 1749 | if ( *it == "Car Phone" ) |
1687 | ent.setCarPhone( *itV ); | 1750 | ent.setCarPhone( *itV ); |
1688 | 1751 | ||
1689 | if ( *it == "ISDN Phone" ) | 1752 | if ( *it == "ISDN Phone" ) |
1690 | ent.setISDNPhone( *itV ); | 1753 | ent.setISDNPhone( *itV ); |
1691 | 1754 | ||
1692 | if ( *it == "Other Phone" ) | 1755 | if ( *it == "Other Phone" ) |
1693 | ent.setOtherPhone( *itV ); | 1756 | ent.setOtherPhone( *itV ); |
1694 | */ | 1757 | */ |
1695 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1758 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1696 | ent.setBusinessPager( *itV ); | 1759 | ent.setBusinessPager( *itV ); |
1697 | /* | 1760 | /* |
1698 | if ( *it == "Home Pager" ) | 1761 | if ( *it == "Home Pager" ) |
1699 | ent.setHomePager( *itV ); | 1762 | ent.setHomePager( *itV ); |
1700 | 1763 | ||
1701 | if ( *it == "AIM IM" ) | 1764 | if ( *it == "AIM IM" ) |
1702 | ent.setAIMIM( *itV ); | 1765 | ent.setAIMIM( *itV ); |
1703 | 1766 | ||
1704 | if ( *it == "ICQ IM" ) | 1767 | if ( *it == "ICQ IM" ) |
1705 | ent.setICQIM( *itV ); | 1768 | ent.setICQIM( *itV ); |
1706 | 1769 | ||
1707 | if ( *it == "Jabber IM" ) | 1770 | if ( *it == "Jabber IM" ) |
1708 | ent.setJabberIM( *itV ); | 1771 | ent.setJabberIM( *itV ); |
1709 | 1772 | ||
1710 | if ( *it == "MSN IM" ) | 1773 | if ( *it == "MSN IM" ) |
1711 | ent.setMSNIM( *itV ); | 1774 | ent.setMSNIM( *itV ); |
1712 | 1775 | ||
1713 | if ( *it == "Yahoo IM" ) | 1776 | if ( *it == "Yahoo IM" ) |
1714 | ent.setYahooIM( *itV ); | 1777 | ent.setYahooIM( *itV ); |
1715 | */ | 1778 | */ |
1716 | if ( *it == "Home Web Page" ) | 1779 | if ( *it == "Home Web Page" ) |
1717 | ent.setHomeWebpage( *itV ); | 1780 | ent.setHomeWebpage( *itV ); |
1718 | 1781 | ||
1719 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1782 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1720 | ent.setBusinessWebpage( *itV ); | 1783 | ent.setBusinessWebpage( *itV ); |
1721 | 1784 | ||
1722 | 1785 | ||
1723 | } | 1786 | } |
1724 | 1787 | ||
1725 | int gender = cmbGender->currentItem(); | 1788 | int gender = cmbGender->currentItem(); |
1726 | ent.setGender( QString::number( gender ) ); | 1789 | ent.setGender( QString::number( gender ) ); |
1727 | 1790 | ||
1728 | QString str = txtNote->text(); | 1791 | QString str = txtNote->text(); |
1729 | if ( !str.isNull() ) | 1792 | if ( !str.isNull() ) |
1730 | ent.setNotes( str ); | 1793 | ent.setNotes( str ); |
1731 | 1794 | ||
1732 | } | 1795 | } |
1733 | 1796 | ||
1734 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1797 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1735 | QString &strAll ) | 1798 | QString &strAll ) |
1736 | { | 1799 | { |
1737 | int where, | 1800 | int where, |
1738 | start; | 1801 | start; |
1739 | if ( txt.isEmpty() ) | 1802 | if ( txt.isEmpty() ) |
1740 | return; | 1803 | return; |
1741 | // find the first | 1804 | // find the first |
1742 | where = txt.find( ',' ); | 1805 | where = txt.find( ',' ); |
1743 | if ( where < 0 ) { | 1806 | if ( where < 0 ) { |
1744 | strDefaultEmail = txt; | 1807 | strDefaultEmail = txt; |
1745 | strAll = txt; | 1808 | strAll = txt; |
1746 | } else { | 1809 | } else { |
1747 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1810 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1748 | strAll = strDefaultEmail; | 1811 | strAll = strDefaultEmail; |
1749 | while ( where > -1 ) { | 1812 | while ( where > -1 ) { |
1750 | strAll.append(" "); | 1813 | strAll.append(" "); |
1751 | start = where; | 1814 | start = where; |
1752 | where = txt.find( ',', where + 1 ); | 1815 | where = txt.find( ',', where + 1 ); |
1753 | if ( where > - 1 ) | 1816 | if ( where > - 1 ) |
1754 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1817 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1755 | else // grab until the end... | 1818 | else // grab until the end... |
1756 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1819 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1757 | } | 1820 | } |
1758 | } | 1821 | } |
1759 | } | 1822 | } |
1760 | 1823 | ||
1761 | void parseEmailTo( const QString &strDefaultEmail, | 1824 | void parseEmailTo( const QString &strDefaultEmail, |
1762 | const QString &strOtherEmail, QString &strBack ) | 1825 | const QString &strOtherEmail, QString &strBack ) |
1763 | { | 1826 | { |
1764 | // create a comma dilimeted set of emails... | 1827 | // create a comma dilimeted set of emails... |
1765 | // use the power of short circuiting... | 1828 | // use the power of short circuiting... |
1766 | bool foundDefault = false; | 1829 | bool foundDefault = false; |
1767 | QString strTmp; | 1830 | QString strTmp; |
1768 | int start = 0; | 1831 | int start = 0; |
1769 | int where; | 1832 | int where; |
1770 | // start at the beginng. | 1833 | // start at the beginng. |
1771 | strBack = strDefaultEmail; | 1834 | strBack = strDefaultEmail; |
1772 | where = 0; | 1835 | where = 0; |
1773 | while ( where > -1 ) { | 1836 | while ( where > -1 ) { |
1774 | start = where; | 1837 | start = where; |
1775 | where = strOtherEmail.find( ' ', where + 1 ); | 1838 | where = strOtherEmail.find( ' ', where + 1 ); |
1776 | if ( where > 0 ) { | 1839 | if ( where > 0 ) { |
1777 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1840 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1778 | } else | 1841 | } else |
1779 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 1842 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
1780 | if ( foundDefault || strTmp != strDefaultEmail ) { | 1843 | if ( foundDefault || strTmp != strDefaultEmail ) { |
1781 | strBack.append( ", " ); | 1844 | strBack.append( ", " ); |
1782 | strBack.append( strTmp ); | 1845 | strBack.append( strTmp ); |
1783 | } else | 1846 | } else |
1784 | foundDefault = true; | 1847 | foundDefault = true; |
1785 | } | 1848 | } |
1786 | } | 1849 | } |
1787 | 1850 | ||
1788 | 1851 | ||
1789 | static inline bool containsAlphaNum( const QString &str ) | 1852 | static inline bool containsAlphaNum( const QString &str ) |
1790 | { | 1853 | { |
1791 | int i, | 1854 | int i, |
1792 | count = str.length(); | 1855 | count = str.length(); |
1793 | for ( i = 0; i < count; i++ ) | 1856 | for ( i = 0; i < count; i++ ) |
1794 | if ( !str[i].isSpace() ) | 1857 | if ( !str[i].isSpace() ) |
1795 | return TRUE; | 1858 | return TRUE; |
1796 | return FALSE; | 1859 | return FALSE; |
1797 | } | 1860 | } |
1798 | 1861 | ||
1799 | static inline bool constainsWhiteSpace( const QString &str ) | 1862 | static inline bool constainsWhiteSpace( const QString &str ) |
1800 | { | 1863 | { |
1801 | int i, | 1864 | int i, |
1802 | count = str.length(); | 1865 | count = str.length(); |
1803 | for (i = 0; i < count; i++ ) | 1866 | for (i = 0; i < count; i++ ) |
1804 | if ( str[i].isSpace() ) | 1867 | if ( str[i].isSpace() ) |
1805 | return TRUE; | 1868 | return TRUE; |
1806 | return FALSE; | 1869 | return FALSE; |
1807 | } | 1870 | } |
1808 | 1871 | ||
1872 | void ContactEditor::setPersonalView( bool personal ) | ||
1873 | { | ||
1874 | m_personalView = personal; | ||
1875 | if ( personal ){ | ||
1876 | cmbCat->hide(); | ||
1877 | labCat->hide(); | ||
1878 | } else{ | ||
1879 | cmbCat->show(); | ||
1880 | labCat->show(); | ||
1881 | |||
1882 | } | ||
1883 | } | ||
1884 | |||
1885 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) | ||
1886 | { | ||
1887 | QDate date; | ||
1888 | date.setYMD( year, month, day ); | ||
1889 | QString dateString = TimeString::numberDateString( date ); | ||
1890 | anniversaryButton->setText( dateString ); | ||
1891 | ent.setAnniversary ( dateString ); | ||
1892 | } | ||
1893 | |||
1894 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) | ||
1895 | { | ||
1896 | QDate date; | ||
1897 | date.setYMD( year, month, day ); | ||
1898 | QString dateString = TimeString::numberDateString( date ); | ||
1899 | birthdayButton->setText( dateString ); | ||
1900 | ent.setBirthday ( dateString ); | ||
1901 | } | ||
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index 8ed8553..40ce864 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h | |||
@@ -1,162 +1,172 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * | 3 | * |
4 | * This file is an add-on for the OPIE Palmtop Environment | 4 | * This file is an add-on for the OPIE Palmtop Environment |
5 | * | 5 | * |
6 | * This file may be distributed and/or modified under the terms of the | 6 | * This file may be distributed and/or modified under the terms of the |
7 | * GNU General Public License version 2 as published by the Free Software | 7 | * GNU General Public License version 2 as published by the Free Software |
8 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging | 8 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
9 | * of this file. | 9 | * of this file. |
10 | * | 10 | * |
11 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | * | 13 | * |
14 | * | 14 | * |
15 | * This is a rewrite of the abeditor.h file, modified to provide a more | 15 | * This is a rewrite of the abeditor.h file, modified to provide a more |
16 | * intuitive interface to TrollTech's original Address Book editor. This | 16 | * intuitive interface to TrollTech's original Address Book editor. This |
17 | * is made to operate exactly in interface with the exception of name. | 17 | * is made to operate exactly in interface with the exception of name. |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef CONTACTEDITOR_H | 21 | #ifndef CONTACTEDITOR_H |
22 | #define CONTACTEDITOR_H | 22 | #define CONTACTEDITOR_H |
23 | 23 | ||
24 | #include <opie/ocontact.h> | 24 | #include <opie/ocontact.h> |
25 | 25 | ||
26 | #include <qpe/datebookmonth.h> | ||
27 | |||
26 | #include <qdialog.h> | 28 | #include <qdialog.h> |
27 | #include <qlist.h> | 29 | #include <qlist.h> |
28 | #include <qmap.h> | 30 | #include <qmap.h> |
29 | #include <qstringlist.h> | 31 | #include <qstringlist.h> |
30 | 32 | ||
31 | const int NAME_LF = 0; | 33 | const int NAME_LF = 0; |
32 | const int NAME_LFM = 1; | 34 | const int NAME_LFM = 1; |
33 | const int NAME_FL = 2; | 35 | const int NAME_FL = 2; |
34 | const int NAME_FMLS = 3; | 36 | const int NAME_FMLS = 3; |
35 | 37 | ||
36 | const int NAME_F = 4; | 38 | const int NAME_F = 4; |
37 | const int NAME_M = 5; | 39 | const int NAME_M = 5; |
38 | const int NAME_L = 6; | 40 | const int NAME_L = 6; |
39 | const int NAME_S = 7; | 41 | const int NAME_S = 7; |
40 | 42 | ||
41 | 43 | ||
42 | class QScrollView; | 44 | class QScrollView; |
43 | class QTabWidget; | 45 | class QTabWidget; |
44 | class QMultiLineEdit; | 46 | class QMultiLineEdit; |
45 | class QLineEdit; | 47 | class QLineEdit; |
46 | class QComboBox; | 48 | class QComboBox; |
47 | class QPushButton; | 49 | class QPushButton; |
48 | class CategorySelect; | 50 | class CategorySelect; |
49 | class QLabel; | 51 | class QLabel; |
50 | 52 | ||
51 | class ContactEditor : public QDialog { | 53 | class ContactEditor : public QDialog { |
52 | Q_OBJECT | 54 | Q_OBJECT |
53 | 55 | ||
54 | public: | 56 | public: |
55 | ContactEditor(const OContact &entry, | 57 | ContactEditor(const OContact &entry, |
56 | const QValueList<int> *newOrderedValues, | 58 | const QValueList<int> *newOrderedValues, |
57 | QStringList *slNewOrdered, | 59 | QStringList *slNewOrdered, |
58 | QWidget *parent = 0, | 60 | QWidget *parent = 0, |
59 | const char *name = 0, | 61 | const char *name = 0, |
60 | WFlags fl = 0 ); | 62 | WFlags fl = 0 ); |
61 | ~ContactEditor(); | 63 | ~ContactEditor(); |
62 | void loadFields(); | 64 | void loadFields(); |
63 | void setNameFocus(); | 65 | void setNameFocus(); |
66 | void setPersonalView( bool personal = true ); | ||
64 | OContact entry() const { return ent; } | 67 | OContact entry() const { return ent; } |
65 | 68 | ||
66 | public slots: | 69 | public slots: |
67 | void slotNote(); | 70 | void slotNote(); |
68 | void slotName(); | 71 | void slotName(); |
69 | void setEntry(const OContact &entry); | 72 | void setEntry(const OContact &entry); |
70 | 73 | ||
71 | protected slots: | 74 | protected slots: |
72 | void accept(); | 75 | void accept(); |
73 | 76 | ||
74 | private: | 77 | private: |
75 | void init(); | 78 | void init(); |
76 | void initMap(); | 79 | void initMap(); |
77 | void saveEntry(); | 80 | void saveEntry(); |
78 | bool isEmpty(); | 81 | bool isEmpty(); |
79 | void cleanupFields(); | 82 | void cleanupFields(); |
80 | QString parseName( QString fullName, int type ); | 83 | QString parseName( QString fullName, int type ); |
81 | |||
82 | private slots: | 84 | private slots: |
83 | void slotChooser1Change( const QString &textChanged ); | 85 | void slotChooser1Change( const QString &textChanged ); |
84 | void slotChooser2Change( const QString &textChanged ); | 86 | void slotChooser2Change( const QString &textChanged ); |
85 | void slotChooser3Change( const QString &textChanged ); | 87 | void slotChooser3Change( const QString &textChanged ); |
86 | void slotChooser4Change( const QString &textChanged ); | 88 | void slotChooser4Change( const QString &textChanged ); |
87 | void slotCmbChooser1Change( int index ); | 89 | void slotCmbChooser1Change( int index ); |
88 | void slotCmbChooser2Change( int index ); | 90 | void slotCmbChooser2Change( int index ); |
89 | void slotCmbChooser3Change( int index ); | 91 | void slotCmbChooser3Change( int index ); |
90 | void slotCmbChooser4Change( int index ); | 92 | void slotCmbChooser4Change( int index ); |
91 | void slotAddressTypeChange( int index ); | 93 | void slotAddressTypeChange( int index ); |
92 | void slotAddressChange( const QString &textChanged ); | 94 | void slotAddressChange( const QString &textChanged ); |
93 | void slotAddress2Change( const QString &textChanged ); | 95 | void slotAddress2Change( const QString &textChanged ); |
94 | void slotPOBoxChange( const QString &textChanged ); | 96 | void slotPOBoxChange( const QString &textChanged ); |
95 | void slotCityChange( const QString &textChanged ); | 97 | void slotCityChange( const QString &textChanged ); |
96 | void slotStateChange( const QString &textChanged ); | 98 | void slotStateChange( const QString &textChanged ); |
97 | void slotZipChange( const QString &textChanged ); | 99 | void slotZipChange( const QString &textChanged ); |
98 | void slotCountryChange( const QString &textChanged ); | 100 | void slotCountryChange( const QString &textChanged ); |
99 | void slotFullNameChange( const QString &textChanged ); | 101 | void slotFullNameChange( const QString &textChanged ); |
102 | void slotAnniversaryDateChanged( int year, int month, int day); | ||
103 | void slotBirthdayDateChanged( int year, int month, int day); | ||
100 | 104 | ||
101 | private: | 105 | private: |
102 | bool useFullName, hasGender, hasTitle, hasCompany, hasNotes, hasStreet, hasStreet2, hasPOBox, hasCity, hasState, hasZip, hasCountry; | 106 | bool useFullName, hasGender, hasTitle, hasCompany, hasNotes, hasStreet, hasStreet2, hasPOBox, hasCity, hasState, hasZip, hasCountry; |
103 | 107 | ||
104 | OContact ent; | 108 | OContact ent; |
105 | 109 | ||
106 | QDialog *dlgNote; | 110 | QDialog *dlgNote; |
107 | QDialog *dlgName; | 111 | QDialog *dlgName; |
108 | 112 | ||
109 | QList<QLineEdit> listValue; | 113 | QList<QLineEdit> listValue; |
110 | QList<QLabel> listName; | 114 | QList<QLabel> listName; |
111 | const QValueList<int> *orderedValues; | 115 | const QValueList<int> *orderedValues; |
112 | QStringList slOrdered; | 116 | QStringList slOrdered; |
113 | QStringList slDynamicEntries; | 117 | QStringList slDynamicEntries; |
114 | 118 | ||
119 | bool m_personalView; | ||
120 | |||
115 | QStringList slHomeAddress; | 121 | QStringList slHomeAddress; |
116 | QStringList slBusinessAddress; | 122 | QStringList slBusinessAddress; |
117 | QStringList slChooserNames; | 123 | QStringList slChooserNames; |
118 | QStringList slChooserValues; | 124 | QStringList slChooserValues; |
119 | 125 | ||
120 | QMultiLineEdit *txtNote; | 126 | QMultiLineEdit *txtNote; |
121 | QLabel *lblNote; | 127 | QLabel *lblNote; |
122 | 128 | ||
123 | //QLineEdit *txtTitle; | 129 | //QLineEdit *txtTitle; |
124 | QLineEdit *txtFirstName; | 130 | QLineEdit *txtFirstName; |
125 | QLineEdit *txtMiddleName; | 131 | QLineEdit *txtMiddleName; |
126 | QLineEdit *txtLastName; | 132 | QLineEdit *txtLastName; |
127 | QLineEdit *txtSuffix; | 133 | QLineEdit *txtSuffix; |
128 | 134 | ||
129 | QTabWidget *tabMain; | 135 | QTabWidget *tabMain; |
130 | QScrollView *svGeneral; | 136 | QScrollView *svGeneral; |
131 | QPushButton *btnFullName; | 137 | QPushButton *btnFullName; |
132 | QPushButton *btnNote; | 138 | QPushButton *btnNote; |
133 | QLineEdit *txtFullName; | 139 | QLineEdit *txtFullName; |
134 | QLineEdit *txtJobTitle; | 140 | QLineEdit *txtJobTitle; |
135 | QLineEdit *txtOrganization; | 141 | QLineEdit *txtOrganization; |
136 | QLineEdit *txtChooserField1; | 142 | QLineEdit *txtChooserField1; |
137 | QLineEdit *txtChooserField2; | 143 | QLineEdit *txtChooserField2; |
138 | QLineEdit *txtChooserField3; | 144 | QLineEdit *txtChooserField3; |
139 | QLineEdit *txtChooserField4; | 145 | QLineEdit *txtChooserField4; |
140 | QComboBox *cmbChooserField1; | 146 | QComboBox *cmbChooserField1; |
141 | QComboBox *cmbChooserField2; | 147 | QComboBox *cmbChooserField2; |
142 | QComboBox *cmbChooserField3; | 148 | QComboBox *cmbChooserField3; |
143 | QComboBox *cmbChooserField4; | 149 | QComboBox *cmbChooserField4; |
144 | QComboBox *cmbFileAs; | 150 | QComboBox *cmbFileAs; |
145 | CategorySelect *cmbCat; | 151 | CategorySelect *cmbCat; |
152 | QLabel *labCat; | ||
146 | 153 | ||
147 | QScrollView *svAddress; | 154 | QScrollView *svAddress; |
148 | QLineEdit *txtAddress; | 155 | QLineEdit *txtAddress; |
149 | //QLineEdit *txtAddress2; | 156 | //QLineEdit *txtAddress2; |
150 | //QLineEdit *txtPOBox; | 157 | //QLineEdit *txtPOBox; |
151 | QLineEdit *txtCity; | 158 | QLineEdit *txtCity; |
152 | QLineEdit *txtState; | 159 | QLineEdit *txtState; |
153 | QLineEdit *txtZip; | 160 | QLineEdit *txtZip; |
154 | QComboBox *cmbAddress; | 161 | QComboBox *cmbAddress; |
155 | QComboBox *cmbCountry; | 162 | QComboBox *cmbCountry; |
156 | 163 | ||
157 | QScrollView *svDetails; | 164 | QScrollView *svDetails; |
158 | QComboBox *cmbGender; | 165 | QComboBox *cmbGender; |
159 | 166 | DateBookMonth* birthdayPicker; | |
160 | }; | 167 | QToolButton* birthdayButton; |
168 | DateBookMonth* anniversaryPicker; | ||
169 | QToolButton* anniversaryButton; | ||
170 | }; | ||
161 | 171 | ||
162 | #endif | 172 | #endif |