author | zecke <zecke> | 2004-05-01 17:21:57 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-05-01 17:21:57 (UTC) |
commit | 8dd2d693000c916346f0bb7d94cbc02b8456c65b (patch) (unidiff) | |
tree | 4246b70152d010a8c0e3e7d5268e462f8630be82 | |
parent | fd2bbf9a09aa7a13bd8a43db351b9153e5a4b7ab (diff) | |
download | opie-8dd2d693000c916346f0bb7d94cbc02b8456c65b.zip opie-8dd2d693000c916346f0bb7d94cbc02b8456c65b.tar.gz opie-8dd2d693000c916346f0bb7d94cbc02b8456c65b.tar.bz2 |
A new LineEdit to assis entering names.
so holger hans peter freyther will get Holger Hans Peter Freyther on the fly
but you can also change the letter later...
-rw-r--r-- | core/pim/addressbook/addressbook.pro | 6 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 9 | ||||
-rw-r--r-- | core/pim/addressbook/namelineedit.cpp | 55 | ||||
-rw-r--r-- | core/pim/addressbook/namelineedit.h | 33 |
4 files changed, 97 insertions, 6 deletions
diff --git a/core/pim/addressbook/addressbook.pro b/core/pim/addressbook/addressbook.pro index b27e4b8..bcfdb62 100644 --- a/core/pim/addressbook/addressbook.pro +++ b/core/pim/addressbook/addressbook.pro | |||
@@ -1,28 +1,30 @@ | |||
1 | #CONFIG = qt warn_on quick-app | 1 | #CONFIG = qt warn_on quick-app |
2 | CONFIG = qt warn_on quick-app | 2 | CONFIG = qt warn_on quick-app |
3 | HEADERS= addressbook.h \ | 3 | HEADERS= addressbook.h \ |
4 | contacteditor.h \ | 4 | contacteditor.h \ |
5 | ablabel.h \ | 5 | ablabel.h \ |
6 | abtable.h \ | 6 | abtable.h \ |
7 | picker.h \ | 7 | picker.h \ |
8 | ofloatbar.h \ | 8 | ofloatbar.h \ |
9 | configdlg.h \ | 9 | configdlg.h \ |
10 | abconfig.h \ | 10 | abconfig.h \ |
11 | abview.h | 11 | abview.h \ |
12 | namelineedit.h | ||
12 | SOURCES= main.cpp \ | 13 | SOURCES= main.cpp \ |
13 | addressbook.cpp \ | 14 | addressbook.cpp \ |
14 | contacteditor.cpp \ | 15 | contacteditor.cpp \ |
15 | ablabel.cpp \ | 16 | ablabel.cpp \ |
16 | abtable.cpp \ | 17 | abtable.cpp \ |
17 | picker.cpp \ | 18 | picker.cpp \ |
18 | configdlg.cpp \ | 19 | configdlg.cpp \ |
19 | abconfig.cpp \ | 20 | abconfig.cpp \ |
20 | abview.cpp | 21 | abview.cpp \ |
22 | namelineedit.cpp | ||
21 | 23 | ||
22 | INTERFACES= configdlg_base.ui | 24 | INTERFACES= configdlg_base.ui |
23 | TARGET = addressbook | 25 | TARGET = addressbook |
24 | INCLUDEPATH += $(OPIEDIR)/include | 26 | INCLUDEPATH += $(OPIEDIR)/include |
25 | DEPENDPATH+= $(OPIEDIR)/include | 27 | DEPENDPATH+= $(OPIEDIR)/include |
26 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiepim2 | 28 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiepim2 |
27 | 29 | ||
28 | include ( $(OPIEDIR)/include.pro ) | 30 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 72c8bd3..9c13017 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -1,1138 +1,1139 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) | 3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) |
4 | * | 4 | * |
5 | * This file is an add-on for the OPIE Palmtop Environment | 5 | * This file is an add-on for the OPIE Palmtop Environment |
6 | * | 6 | * |
7 | * This file may be distributed and/or modified under the terms of the | 7 | * This file may be distributed and/or modified under the terms of the |
8 | * GNU General Public License version 2 as published by the Free Software | 8 | * GNU General Public License version 2 as published by the Free Software |
9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging | 9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
10 | * of this file. | 10 | * of this file. |
11 | * | 11 | * |
12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | * | 14 | * |
15 | * | 15 | * |
16 | * This is a rewrite of the abeditor.h file, modified to provide a more | 16 | * This is a rewrite of the abeditor.h file, modified to provide a more |
17 | * intuitive interface to TrollTech's original Address Book editor. This | 17 | * intuitive interface to TrollTech's original Address Book editor. This |
18 | * is made to operate exactly in interface with the exception of name. | 18 | * is made to operate exactly in interface with the exception of name. |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "contacteditor.h" | 22 | #include "contacteditor.h" |
23 | #include "namelineedit.h" | ||
23 | 24 | ||
24 | #include <opie2/odebug.h> | 25 | #include <opie2/odebug.h> |
25 | #include <opie2/opimcontact.h> | 26 | #include <opie2/opimcontact.h> |
26 | 27 | ||
27 | #include <qpe/categoryselect.h> | 28 | #include <qpe/categoryselect.h> |
28 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
29 | #include <qpe/qpedialog.h> | 30 | #include <qpe/qpedialog.h> |
30 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
31 | 32 | ||
32 | #include <qlabel.h> | 33 | #include <qlabel.h> |
33 | #include <qtabwidget.h> | 34 | #include <qtabwidget.h> |
34 | #include <qlayout.h> | 35 | #include <qlayout.h> |
35 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
36 | #include <qmultilineedit.h> | 37 | #include <qmultilineedit.h> |
37 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
38 | #include <qlistbox.h> | 39 | #include <qlistbox.h> |
39 | #include <qmessagebox.h> | 40 | #include <qmessagebox.h> |
40 | #include <qwhatsthis.h> | 41 | #include <qwhatsthis.h> |
41 | 42 | ||
42 | #include <assert.h> | 43 | #include <assert.h> |
43 | 44 | ||
44 | static inline bool containsAlphaNum( const QString &str ); | 45 | static inline bool containsAlphaNum( const QString &str ); |
45 | static inline bool constainsWhiteSpace( const QString &str ); | 46 | static inline bool constainsWhiteSpace( const QString &str ); |
46 | 47 | ||
47 | // helper functions, convert our comma delimited list to proper | 48 | // helper functions, convert our comma delimited list to proper |
48 | // file format... | 49 | // file format... |
49 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 50 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
50 | QString &strAll ); | 51 | QString &strAll ); |
51 | 52 | ||
52 | // helper convert from file format to comma delimited... | 53 | // helper convert from file format to comma delimited... |
53 | void parseEmailTo( const QString &strDefaultEmail, | 54 | void parseEmailTo( const QString &strDefaultEmail, |
54 | const QString &strOtherEmail, QString &strBack ); | 55 | const QString &strOtherEmail, QString &strBack ); |
55 | 56 | ||
56 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, | 57 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, |
57 | QWidget *parent, | 58 | QWidget *parent, |
58 | const char *name, | 59 | const char *name, |
59 | WFlags ) | 60 | WFlags ) |
60 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), | 61 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), |
61 | defaultEmailChooserPosition( -1 ), | 62 | defaultEmailChooserPosition( -1 ), |
62 | m_personalView ( false ), | 63 | m_personalView ( false ), |
63 | cmbDefaultEmail( 0 ), | 64 | cmbDefaultEmail( 0 ), |
64 | initializing ( false ) | 65 | initializing ( false ) |
65 | { | 66 | { |
66 | 67 | ||
67 | initializing = true; | 68 | initializing = true; |
68 | 69 | ||
69 | init(); | 70 | init(); |
70 | setEntry( entry ); | 71 | setEntry( entry ); |
71 | // cmbDefaultEmail = 0; | 72 | // cmbDefaultEmail = 0; |
72 | // defaultEmailChooserPosition = -1; | 73 | // defaultEmailChooserPosition = -1; |
73 | 74 | ||
74 | initializing = false; | 75 | initializing = false; |
75 | } | 76 | } |
76 | 77 | ||
77 | ContactEditor::~ContactEditor() { | 78 | ContactEditor::~ContactEditor() { |
78 | } | 79 | } |
79 | 80 | ||
80 | void ContactEditor::init() { | 81 | void ContactEditor::init() { |
81 | owarn << "init() START" << oendl; | 82 | owarn << "init() START" << oendl; |
82 | 83 | ||
83 | uint i = 0; | 84 | uint i = 0; |
84 | 85 | ||
85 | QStringList trlChooserNames; | 86 | QStringList trlChooserNames; |
86 | 87 | ||
87 | for (i = 0; i <= 6; i++) { | 88 | for (i = 0; i <= 6; i++) { |
88 | slHomeAddress.append( "" ); | 89 | slHomeAddress.append( "" ); |
89 | slBusinessAddress.append( "" ); | 90 | slBusinessAddress.append( "" ); |
90 | } | 91 | } |
91 | 92 | ||
92 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); | 93 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); |
93 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); | 94 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); |
94 | slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); | 95 | slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); |
95 | trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); | 96 | trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); |
96 | 97 | ||
97 | // Ok, we have to remove elements from the list of dynamic entries | 98 | // Ok, we have to remove elements from the list of dynamic entries |
98 | // which are now stored in special (not dynamic) widgets.. | 99 | // which are now stored in special (not dynamic) widgets.. |
99 | // Otherwise we will get problems with field assignments! (se) | 100 | // Otherwise we will get problems with field assignments! (se) |
100 | slDynamicEntries.remove("Anniversary"); | 101 | slDynamicEntries.remove("Anniversary"); |
101 | slDynamicEntries.remove("Birthday"); | 102 | slDynamicEntries.remove("Birthday"); |
102 | slDynamicEntries.remove("Gender"); | 103 | slDynamicEntries.remove("Gender"); |
103 | 104 | ||
104 | // The same with translated fields.. But I will | 105 | // The same with translated fields.. But I will |
105 | // use the translation map to avoid mismatches.. | 106 | // use the translation map to avoid mismatches.. |
106 | QMap<int, QString> translMap = Opie::OPimContactFields::idToTrFields(); | 107 | QMap<int, QString> translMap = Opie::OPimContactFields::idToTrFields(); |
107 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); | 108 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); |
108 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); | 109 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); |
109 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); | 110 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); |
110 | 111 | ||
111 | // Last Check to be sure.. | 112 | // Last Check to be sure.. |
112 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); | 113 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); |
113 | assert( slChooserNames.count() == trlChooserNames.count() ); | 114 | assert( slChooserNames.count() == trlChooserNames.count() ); |
114 | 115 | ||
115 | for (i = 0; i < slChooserNames.count(); i++) | 116 | for (i = 0; i < slChooserNames.count(); i++) |
116 | slChooserValues.append(""); | 117 | slChooserValues.append(""); |
117 | 118 | ||
118 | 119 | ||
119 | QVBoxLayout *vb = new QVBoxLayout( this ); | 120 | QVBoxLayout *vb = new QVBoxLayout( this ); |
120 | 121 | ||
121 | tabMain = new QTabWidget( this ); | 122 | tabMain = new QTabWidget( this ); |
122 | vb->addWidget( tabMain ); | 123 | vb->addWidget( tabMain ); |
123 | 124 | ||
124 | QWidget *tabViewport = new QWidget ( tabMain ); | 125 | QWidget *tabViewport = new QWidget ( tabMain ); |
125 | 126 | ||
126 | vb = new QVBoxLayout( tabViewport ); | 127 | vb = new QVBoxLayout( tabViewport ); |
127 | 128 | ||
128 | svGeneral = new QScrollView( tabViewport ); | 129 | svGeneral = new QScrollView( tabViewport ); |
129 | vb->addWidget( svGeneral, 0, 0 ); | 130 | vb->addWidget( svGeneral, 0, 0 ); |
130 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 131 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
131 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); | 132 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); |
132 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); | 133 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); |
133 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 134 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
134 | 135 | ||
135 | QWidget *container = new QWidget( svGeneral->viewport() ); | 136 | QWidget *container = new QWidget( svGeneral->viewport() ); |
136 | svGeneral->addChild( container ); | 137 | svGeneral->addChild( container ); |
137 | 138 | ||
138 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 139 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); |
139 | gl->setResizeMode( QLayout::FreeResize ); | 140 | gl->setResizeMode( QLayout::FreeResize ); |
140 | 141 | ||
141 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 142 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
142 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); | 143 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); |
143 | gl->addWidget( btnFullName, 0, 0 ); | 144 | gl->addWidget( btnFullName, 0, 0 ); |
144 | txtFullName = new QLineEdit( container ); | 145 | txtFullName = new ABOOK::NameLineEdit( container ); |
145 | QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); | 146 | QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); |
146 | gl->addWidget( txtFullName, 0, 1 ); | 147 | gl->addWidget( txtFullName, 0, 1 ); |
147 | 148 | ||
148 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 149 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
149 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); | 150 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); |
150 | gl->addWidget( l, 1, 0 ); | 151 | gl->addWidget( l, 1, 0 ); |
151 | txtJobTitle = new QLineEdit( container ); | 152 | txtJobTitle = new QLineEdit( container ); |
152 | QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); | 153 | QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); |
153 | gl->addWidget( txtJobTitle, 1, 1 ); | 154 | gl->addWidget( txtJobTitle, 1, 1 ); |
154 | 155 | ||
155 | l = new QLabel( tr("Suffix"), container ); | 156 | l = new QLabel( tr("Suffix"), container ); |
156 | QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); | 157 | QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); |
157 | gl->addWidget( l, 2, 0 ); | 158 | gl->addWidget( l, 2, 0 ); |
158 | txtSuffix = new QLineEdit( container ); | 159 | txtSuffix = new QLineEdit( container ); |
159 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); | 160 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); |
160 | gl->addWidget( txtSuffix, 2, 1 ); | 161 | gl->addWidget( txtSuffix, 2, 1 ); |
161 | 162 | ||
162 | l = new QLabel( tr( "Organization" ), container ); | 163 | l = new QLabel( tr( "Organization" ), container ); |
163 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); | 164 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); |
164 | gl->addWidget( l, 3, 0 ); | 165 | gl->addWidget( l, 3, 0 ); |
165 | txtOrganization = new QLineEdit( container ); | 166 | txtOrganization = new QLineEdit( container ); |
166 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); | 167 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); |
167 | gl->addWidget( txtOrganization, 3, 1 ); | 168 | gl->addWidget( txtOrganization, 3, 1 ); |
168 | 169 | ||
169 | // Chooser 1 | 170 | // Chooser 1 |
170 | cmbChooserField1 = new QComboBox( FALSE, container ); | 171 | cmbChooserField1 = new QComboBox( FALSE, container ); |
171 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); | 172 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); |
172 | cmbChooserField1->setMaximumWidth( 90 ); | 173 | cmbChooserField1->setMaximumWidth( 90 ); |
173 | gl->addWidget( cmbChooserField1, 4, 0 ); | 174 | gl->addWidget( cmbChooserField1, 4, 0 ); |
174 | // Textfield for chooser 1. | 175 | // Textfield for chooser 1. |
175 | // Now use Widgetstack to contain the textfield and the default-email combo ! | 176 | // Now use Widgetstack to contain the textfield and the default-email combo ! |
176 | m_widgetStack1 = new QWidgetStack( container ); | 177 | m_widgetStack1 = new QWidgetStack( container ); |
177 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); | 178 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); |
178 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); | 179 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); |
179 | gl->addWidget( m_widgetStack1, 4, 1 ); | 180 | gl->addWidget( m_widgetStack1, 4, 1 ); |
180 | m_widgetStack1 -> raiseWidget( TextField ); | 181 | m_widgetStack1 -> raiseWidget( TextField ); |
181 | 182 | ||
182 | // Chooser 2 | 183 | // Chooser 2 |
183 | cmbChooserField2 = new QComboBox( FALSE, container ); | 184 | cmbChooserField2 = new QComboBox( FALSE, container ); |
184 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); | 185 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); |
185 | cmbChooserField2->setMaximumWidth( 90 ); | 186 | cmbChooserField2->setMaximumWidth( 90 ); |
186 | gl->addWidget( cmbChooserField2, 5, 0 ); | 187 | gl->addWidget( cmbChooserField2, 5, 0 ); |
187 | // Textfield for chooser 2 | 188 | // Textfield for chooser 2 |
188 | // Now use WidgetStack to contain the textfield and the default-email combo! | 189 | // Now use WidgetStack to contain the textfield and the default-email combo! |
189 | m_widgetStack2 = new QWidgetStack( container ); | 190 | m_widgetStack2 = new QWidgetStack( container ); |
190 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); | 191 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); |
191 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); | 192 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); |
192 | gl->addWidget( m_widgetStack2, 5, 1 ); | 193 | gl->addWidget( m_widgetStack2, 5, 1 ); |
193 | m_widgetStack2 -> raiseWidget( TextField ); | 194 | m_widgetStack2 -> raiseWidget( TextField ); |
194 | 195 | ||
195 | // Chooser 3 | 196 | // Chooser 3 |
196 | cmbChooserField3 = new QComboBox( FALSE, container ); | 197 | cmbChooserField3 = new QComboBox( FALSE, container ); |
197 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); | 198 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); |
198 | cmbChooserField3->setMaximumWidth( 90 ); | 199 | cmbChooserField3->setMaximumWidth( 90 ); |
199 | gl->addWidget( cmbChooserField3, 6, 0 ); | 200 | gl->addWidget( cmbChooserField3, 6, 0 ); |
200 | // Textfield for chooser 2 | 201 | // Textfield for chooser 2 |
201 | // Now use WidgetStack to contain the textfield and the default-email combo! | 202 | // Now use WidgetStack to contain the textfield and the default-email combo! |
202 | m_widgetStack3 = new QWidgetStack( container ); | 203 | m_widgetStack3 = new QWidgetStack( container ); |
203 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); | 204 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); |
204 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); | 205 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); |
205 | gl->addWidget( m_widgetStack3, 6, 1 ); | 206 | gl->addWidget( m_widgetStack3, 6, 1 ); |
206 | m_widgetStack3 -> raiseWidget( TextField ); | 207 | m_widgetStack3 -> raiseWidget( TextField ); |
207 | 208 | ||
208 | l = new QLabel( tr( "File As" ), container ); | 209 | l = new QLabel( tr( "File As" ), container ); |
209 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); | 210 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); |
210 | gl->addWidget( l, 7, 0 ); | 211 | gl->addWidget( l, 7, 0 ); |
211 | cmbFileAs = new QComboBox( TRUE, container ); | 212 | cmbFileAs = new QComboBox( TRUE, container ); |
212 | gl->addWidget( cmbFileAs, 7, 1 ); | 213 | gl->addWidget( cmbFileAs, 7, 1 ); |
213 | 214 | ||
214 | labCat = new QLabel( tr( "Category" ), container ); | 215 | labCat = new QLabel( tr( "Category" ), container ); |
215 | gl->addWidget( labCat, 8, 0 ); | 216 | gl->addWidget( labCat, 8, 0 ); |
216 | cmbCat = new CategorySelect( container ); | 217 | cmbCat = new CategorySelect( container ); |
217 | gl->addWidget( cmbCat, 8, 1 ); | 218 | gl->addWidget( cmbCat, 8, 1 ); |
218 | labCat->show(); | 219 | labCat->show(); |
219 | cmbCat->show(); | 220 | cmbCat->show(); |
220 | 221 | ||
221 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 222 | btnNote = new QPushButton( tr( "Notes..." ), container ); |
222 | gl->addWidget( btnNote, 9, 1 ); | 223 | gl->addWidget( btnNote, 9, 1 ); |
223 | 224 | ||
224 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 225 | tabMain->insertTab( tabViewport, tr( "General" ) ); |
225 | 226 | ||
226 | tabViewport = new QWidget ( tabMain ); | 227 | tabViewport = new QWidget ( tabMain ); |
227 | 228 | ||
228 | vb = new QVBoxLayout( tabViewport ); | 229 | vb = new QVBoxLayout( tabViewport ); |
229 | 230 | ||
230 | svAddress = new QScrollView( tabViewport ); | 231 | svAddress = new QScrollView( tabViewport ); |
231 | vb->addWidget( svAddress, 0, 0 ); | 232 | vb->addWidget( svAddress, 0, 0 ); |
232 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 233 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
233 | svAddress->setFrameStyle( QFrame::NoFrame ); | 234 | svAddress->setFrameStyle( QFrame::NoFrame ); |
234 | 235 | ||
235 | container = new QWidget( svAddress->viewport() ); | 236 | container = new QWidget( svAddress->viewport() ); |
236 | svAddress->addChild( container ); | 237 | svAddress->addChild( container ); |
237 | 238 | ||
238 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 239 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
239 | 240 | ||
240 | cmbAddress = new QComboBox( FALSE, container ); | 241 | cmbAddress = new QComboBox( FALSE, container ); |
241 | cmbAddress->insertItem( tr( "Business" ) ); | 242 | cmbAddress->insertItem( tr( "Business" ) ); |
242 | cmbAddress->insertItem( tr( "Home" ) ); | 243 | cmbAddress->insertItem( tr( "Home" ) ); |
243 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 244 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
244 | 245 | ||
245 | l = new QLabel( tr( "Address" ), container ); | 246 | l = new QLabel( tr( "Address" ), container ); |
246 | gl->addWidget( l, 1, 0 ); | 247 | gl->addWidget( l, 1, 0 ); |
247 | txtAddress = new QLineEdit( container ); | 248 | txtAddress = new QLineEdit( container ); |
248 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 249 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
249 | 250 | ||
250 | l = new QLabel( tr( "City" ), container ); | 251 | l = new QLabel( tr( "City" ), container ); |
251 | gl->addWidget( l, 2, 0 ); | 252 | gl->addWidget( l, 2, 0 ); |
252 | txtCity = new QLineEdit( container ); | 253 | txtCity = new QLineEdit( container ); |
253 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 254 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
254 | 255 | ||
255 | l = new QLabel( tr( "State" ), container ); | 256 | l = new QLabel( tr( "State" ), container ); |
256 | gl->addWidget( l, 3, 0 ); | 257 | gl->addWidget( l, 3, 0 ); |
257 | txtState = new QLineEdit( container ); | 258 | txtState = new QLineEdit( container ); |
258 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 259 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
259 | 260 | ||
260 | l = new QLabel( tr( "Zip Code" ), container ); | 261 | l = new QLabel( tr( "Zip Code" ), container ); |
261 | gl->addWidget( l, 4, 0 ); | 262 | gl->addWidget( l, 4, 0 ); |
262 | txtZip = new QLineEdit( container ); | 263 | txtZip = new QLineEdit( container ); |
263 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 264 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
264 | 265 | ||
265 | l = new QLabel( tr( "Country" ), container ); | 266 | l = new QLabel( tr( "Country" ), container ); |
266 | gl->addWidget( l, 5, 0 ); | 267 | gl->addWidget( l, 5, 0 ); |
267 | cmbCountry = new QComboBox( TRUE, container ); | 268 | cmbCountry = new QComboBox( TRUE, container ); |
268 | cmbCountry->insertItem( tr( "" ) ); | 269 | cmbCountry->insertItem( tr( "" ) ); |
269 | cmbCountry->insertItem( tr ( "United States" ) ); | 270 | cmbCountry->insertItem( tr ( "United States" ) ); |
270 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 271 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
271 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); | 272 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); |
272 | cmbCountry->insertItem( tr ( "Albania" ) ); | 273 | cmbCountry->insertItem( tr ( "Albania" ) ); |
273 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 274 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
274 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 275 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
275 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 276 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
276 | cmbCountry->insertItem( tr ( "Angola" ) ); | 277 | cmbCountry->insertItem( tr ( "Angola" ) ); |
277 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 278 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
278 | cmbCountry->insertItem( tr ( "Antarctica" ) ); | 279 | cmbCountry->insertItem( tr ( "Antarctica" ) ); |
279 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 280 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
280 | cmbCountry->insertItem( tr ( "Armenia" ) ); | 281 | cmbCountry->insertItem( tr ( "Armenia" ) ); |
281 | cmbCountry->insertItem( tr ( "Aruba" ) ); | 282 | cmbCountry->insertItem( tr ( "Aruba" ) ); |
282 | cmbCountry->insertItem( tr ( "Australia" ) ); | 283 | cmbCountry->insertItem( tr ( "Australia" ) ); |
283 | cmbCountry->insertItem( tr ( "Austria" ) ); | 284 | cmbCountry->insertItem( tr ( "Austria" ) ); |
284 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); | 285 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); |
285 | cmbCountry->insertItem( tr ( "Bahamas" ) ); | 286 | cmbCountry->insertItem( tr ( "Bahamas" ) ); |
286 | cmbCountry->insertItem( tr ( "Bahrain" ) ); | 287 | cmbCountry->insertItem( tr ( "Bahrain" ) ); |
287 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); | 288 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); |
288 | cmbCountry->insertItem( tr ( "Barbados" ) ); | 289 | cmbCountry->insertItem( tr ( "Barbados" ) ); |
289 | cmbCountry->insertItem( tr ( "Belarus" ) ); | 290 | cmbCountry->insertItem( tr ( "Belarus" ) ); |
290 | cmbCountry->insertItem( tr ( "Belgium" ) ); | 291 | cmbCountry->insertItem( tr ( "Belgium" ) ); |
291 | cmbCountry->insertItem( tr ( "Belize" ) ); | 292 | cmbCountry->insertItem( tr ( "Belize" ) ); |
292 | cmbCountry->insertItem( tr ( "Benin" ) ); | 293 | cmbCountry->insertItem( tr ( "Benin" ) ); |
293 | cmbCountry->insertItem( tr ( "Bermuda" ) ); | 294 | cmbCountry->insertItem( tr ( "Bermuda" ) ); |
294 | cmbCountry->insertItem( tr ( "Bhutan" ) ); | 295 | cmbCountry->insertItem( tr ( "Bhutan" ) ); |
295 | cmbCountry->insertItem( tr ( "Bolivia" ) ); | 296 | cmbCountry->insertItem( tr ( "Bolivia" ) ); |
296 | cmbCountry->insertItem( tr ( "Botswana" ) ); | 297 | cmbCountry->insertItem( tr ( "Botswana" ) ); |
297 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); | 298 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); |
298 | cmbCountry->insertItem( tr ( "Brazil" ) ); | 299 | cmbCountry->insertItem( tr ( "Brazil" ) ); |
299 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); | 300 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); |
300 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); | 301 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); |
301 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); | 302 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); |
302 | cmbCountry->insertItem( tr ( "Burundi" ) ); | 303 | cmbCountry->insertItem( tr ( "Burundi" ) ); |
303 | cmbCountry->insertItem( tr ( "Cambodia" ) ); | 304 | cmbCountry->insertItem( tr ( "Cambodia" ) ); |
304 | cmbCountry->insertItem( tr ( "Cameroon" ) ); | 305 | cmbCountry->insertItem( tr ( "Cameroon" ) ); |
305 | cmbCountry->insertItem( tr ( "Canada" ) ); | 306 | cmbCountry->insertItem( tr ( "Canada" ) ); |
306 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); | 307 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); |
307 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); | 308 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); |
308 | cmbCountry->insertItem( tr ( "Chad" ) ); | 309 | cmbCountry->insertItem( tr ( "Chad" ) ); |
309 | cmbCountry->insertItem( tr ( "Chile" ) ); | 310 | cmbCountry->insertItem( tr ( "Chile" ) ); |
310 | cmbCountry->insertItem( tr ( "China" ) ); | 311 | cmbCountry->insertItem( tr ( "China" ) ); |
311 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); | 312 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); |
312 | cmbCountry->insertItem( tr ( "Colombia" ) ); | 313 | cmbCountry->insertItem( tr ( "Colombia" ) ); |
313 | cmbCountry->insertItem( tr ( "Comoros" ) ); | 314 | cmbCountry->insertItem( tr ( "Comoros" ) ); |
314 | cmbCountry->insertItem( tr ( "Congo" ) ); | 315 | cmbCountry->insertItem( tr ( "Congo" ) ); |
315 | cmbCountry->insertItem( tr ( "Cook Island" ) ); | 316 | cmbCountry->insertItem( tr ( "Cook Island" ) ); |
316 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); | 317 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); |
317 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); | 318 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); |
318 | cmbCountry->insertItem( tr ( "Croatia" ) ); | 319 | cmbCountry->insertItem( tr ( "Croatia" ) ); |
319 | cmbCountry->insertItem( tr ( "Cuba" ) ); | 320 | cmbCountry->insertItem( tr ( "Cuba" ) ); |
320 | cmbCountry->insertItem( tr ( "Cyprus" ) ); | 321 | cmbCountry->insertItem( tr ( "Cyprus" ) ); |
321 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); | 322 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); |
322 | cmbCountry->insertItem( tr ( "Denmark" ) ); | 323 | cmbCountry->insertItem( tr ( "Denmark" ) ); |
323 | cmbCountry->insertItem( tr ( "Djibouti" ) ); | 324 | cmbCountry->insertItem( tr ( "Djibouti" ) ); |
324 | cmbCountry->insertItem( tr ( "Dominica" ) ); | 325 | cmbCountry->insertItem( tr ( "Dominica" ) ); |
325 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); | 326 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); |
326 | cmbCountry->insertItem( tr ( "East Timor" ) ); | 327 | cmbCountry->insertItem( tr ( "East Timor" ) ); |
327 | cmbCountry->insertItem( tr ( "Ecuador" ) ); | 328 | cmbCountry->insertItem( tr ( "Ecuador" ) ); |
328 | cmbCountry->insertItem( tr ( "Egypt" ) ); | 329 | cmbCountry->insertItem( tr ( "Egypt" ) ); |
329 | cmbCountry->insertItem( tr ( "El Salvador" ) ); | 330 | cmbCountry->insertItem( tr ( "El Salvador" ) ); |
330 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); | 331 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); |
331 | cmbCountry->insertItem( tr ( "Eritrea" ) ); | 332 | cmbCountry->insertItem( tr ( "Eritrea" ) ); |
332 | cmbCountry->insertItem( tr ( "Estonia" ) ); | 333 | cmbCountry->insertItem( tr ( "Estonia" ) ); |
333 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); | 334 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); |
334 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); | 335 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); |
335 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); | 336 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); |
336 | cmbCountry->insertItem( tr ( "Fiji" ) ); | 337 | cmbCountry->insertItem( tr ( "Fiji" ) ); |
337 | cmbCountry->insertItem( tr ( "Finland" ) ); | 338 | cmbCountry->insertItem( tr ( "Finland" ) ); |
338 | cmbCountry->insertItem( tr ( "France" ) ); | 339 | cmbCountry->insertItem( tr ( "France" ) ); |
339 | cmbCountry->insertItem( tr ( "French Guiana" ) ); | 340 | cmbCountry->insertItem( tr ( "French Guiana" ) ); |
340 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); | 341 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); |
341 | cmbCountry->insertItem( tr ( "Gabon" ) ); | 342 | cmbCountry->insertItem( tr ( "Gabon" ) ); |
342 | cmbCountry->insertItem( tr ( "Gambia" ) ); | 343 | cmbCountry->insertItem( tr ( "Gambia" ) ); |
343 | cmbCountry->insertItem( tr ( "Georgia" ) ); | 344 | cmbCountry->insertItem( tr ( "Georgia" ) ); |
344 | cmbCountry->insertItem( tr ( "Germany" ) ); | 345 | cmbCountry->insertItem( tr ( "Germany" ) ); |
345 | cmbCountry->insertItem( tr ( "Ghana" ) ); | 346 | cmbCountry->insertItem( tr ( "Ghana" ) ); |
346 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); | 347 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); |
347 | cmbCountry->insertItem( tr ( "Greece" ) ); | 348 | cmbCountry->insertItem( tr ( "Greece" ) ); |
348 | cmbCountry->insertItem( tr ( "Greenland" ) ); | 349 | cmbCountry->insertItem( tr ( "Greenland" ) ); |
349 | cmbCountry->insertItem( tr ( "Grenada" ) ); | 350 | cmbCountry->insertItem( tr ( "Grenada" ) ); |
350 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); | 351 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); |
351 | cmbCountry->insertItem( tr ( "Guam" ) ); | 352 | cmbCountry->insertItem( tr ( "Guam" ) ); |
352 | cmbCountry->insertItem( tr ( "Guatemala" ) ); | 353 | cmbCountry->insertItem( tr ( "Guatemala" ) ); |
353 | cmbCountry->insertItem( tr ( "Guinea" ) ); | 354 | cmbCountry->insertItem( tr ( "Guinea" ) ); |
354 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); | 355 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); |
355 | cmbCountry->insertItem( tr ( "Guyana" ) ); | 356 | cmbCountry->insertItem( tr ( "Guyana" ) ); |
356 | cmbCountry->insertItem( tr ( "Haiti" ) ); | 357 | cmbCountry->insertItem( tr ( "Haiti" ) ); |
357 | cmbCountry->insertItem( tr ( "Holy See" ) ); | 358 | cmbCountry->insertItem( tr ( "Holy See" ) ); |
358 | cmbCountry->insertItem( tr ( "Honduras" ) ); | 359 | cmbCountry->insertItem( tr ( "Honduras" ) ); |
359 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); | 360 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); |
360 | cmbCountry->insertItem( tr ( "Hungary" ) ); | 361 | cmbCountry->insertItem( tr ( "Hungary" ) ); |
361 | cmbCountry->insertItem( tr ( "Iceland" ) ); | 362 | cmbCountry->insertItem( tr ( "Iceland" ) ); |
362 | cmbCountry->insertItem( tr ( "India" ) ); | 363 | cmbCountry->insertItem( tr ( "India" ) ); |
363 | cmbCountry->insertItem( tr ( "Indonesia" ) ); | 364 | cmbCountry->insertItem( tr ( "Indonesia" ) ); |
364 | cmbCountry->insertItem( tr ( "Ireland" ) ); | 365 | cmbCountry->insertItem( tr ( "Ireland" ) ); |
365 | cmbCountry->insertItem( tr ( "Israel" ) ); | 366 | cmbCountry->insertItem( tr ( "Israel" ) ); |
366 | cmbCountry->insertItem( tr ( "Italy" ) ); | 367 | cmbCountry->insertItem( tr ( "Italy" ) ); |
367 | cmbCountry->insertItem( tr ( "Jamaica" ) ); | 368 | cmbCountry->insertItem( tr ( "Jamaica" ) ); |
368 | cmbCountry->insertItem( tr ( "Japan" ) ); | 369 | cmbCountry->insertItem( tr ( "Japan" ) ); |
369 | cmbCountry->insertItem( tr ( "Jordan" ) ); | 370 | cmbCountry->insertItem( tr ( "Jordan" ) ); |
370 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); | 371 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); |
371 | cmbCountry->insertItem( tr ( "Kenya" ) ); | 372 | cmbCountry->insertItem( tr ( "Kenya" ) ); |
372 | cmbCountry->insertItem( tr ( "Kiribati" ) ); | 373 | cmbCountry->insertItem( tr ( "Kiribati" ) ); |
373 | cmbCountry->insertItem( tr ( "Korea" ) ); | 374 | cmbCountry->insertItem( tr ( "Korea" ) ); |
374 | cmbCountry->insertItem( tr ( "Kuwait" ) ); | 375 | cmbCountry->insertItem( tr ( "Kuwait" ) ); |
375 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); | 376 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); |
376 | cmbCountry->insertItem( tr ( "Laos" ) ); | 377 | cmbCountry->insertItem( tr ( "Laos" ) ); |
377 | cmbCountry->insertItem( tr ( "Latvia" ) ); | 378 | cmbCountry->insertItem( tr ( "Latvia" ) ); |
378 | cmbCountry->insertItem( tr ( "Lebanon" ) ); | 379 | cmbCountry->insertItem( tr ( "Lebanon" ) ); |
379 | cmbCountry->insertItem( tr ( "Lesotho" ) ); | 380 | cmbCountry->insertItem( tr ( "Lesotho" ) ); |
380 | cmbCountry->insertItem( tr ( "Liberia" ) ); | 381 | cmbCountry->insertItem( tr ( "Liberia" ) ); |
381 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); | 382 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); |
382 | cmbCountry->insertItem( tr ( "Lithuania" ) ); | 383 | cmbCountry->insertItem( tr ( "Lithuania" ) ); |
383 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); | 384 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); |
384 | cmbCountry->insertItem( tr ( "Macau" ) ); | 385 | cmbCountry->insertItem( tr ( "Macau" ) ); |
385 | cmbCountry->insertItem( tr ( "Macedonia" ) ); | 386 | cmbCountry->insertItem( tr ( "Macedonia" ) ); |
386 | cmbCountry->insertItem( tr ( "Madagascar" ) ); | 387 | cmbCountry->insertItem( tr ( "Madagascar" ) ); |
387 | cmbCountry->insertItem( tr ( "Malawi" ) ); | 388 | cmbCountry->insertItem( tr ( "Malawi" ) ); |
388 | cmbCountry->insertItem( tr ( "Malaysia" ) ); | 389 | cmbCountry->insertItem( tr ( "Malaysia" ) ); |
389 | cmbCountry->insertItem( tr ( "Maldives" ) ); | 390 | cmbCountry->insertItem( tr ( "Maldives" ) ); |
390 | cmbCountry->insertItem( tr ( "Mali" ) ); | 391 | cmbCountry->insertItem( tr ( "Mali" ) ); |
391 | cmbCountry->insertItem( tr ( "Malta" ) ); | 392 | cmbCountry->insertItem( tr ( "Malta" ) ); |
392 | cmbCountry->insertItem( tr ( "Martinique" ) ); | 393 | cmbCountry->insertItem( tr ( "Martinique" ) ); |
393 | cmbCountry->insertItem( tr ( "Mauritania" ) ); | 394 | cmbCountry->insertItem( tr ( "Mauritania" ) ); |
394 | cmbCountry->insertItem( tr ( "Mauritius" ) ); | 395 | cmbCountry->insertItem( tr ( "Mauritius" ) ); |
395 | cmbCountry->insertItem( tr ( "Mayotte" ) ); | 396 | cmbCountry->insertItem( tr ( "Mayotte" ) ); |
396 | cmbCountry->insertItem( tr ( "Mexico" ) ); | 397 | cmbCountry->insertItem( tr ( "Mexico" ) ); |
397 | cmbCountry->insertItem( tr ( "Micronesia" ) ); | 398 | cmbCountry->insertItem( tr ( "Micronesia" ) ); |
398 | cmbCountry->insertItem( tr ( "Moldova" ) ); | 399 | cmbCountry->insertItem( tr ( "Moldova" ) ); |
399 | cmbCountry->insertItem( tr ( "Monaco" ) ); | 400 | cmbCountry->insertItem( tr ( "Monaco" ) ); |
400 | cmbCountry->insertItem( tr ( "Mongolia" ) ); | 401 | cmbCountry->insertItem( tr ( "Mongolia" ) ); |
401 | cmbCountry->insertItem( tr ( "Montserrat" ) ); | 402 | cmbCountry->insertItem( tr ( "Montserrat" ) ); |
402 | cmbCountry->insertItem( tr ( "Morocco" ) ); | 403 | cmbCountry->insertItem( tr ( "Morocco" ) ); |
403 | cmbCountry->insertItem( tr ( "Mozambique" ) ); | 404 | cmbCountry->insertItem( tr ( "Mozambique" ) ); |
404 | cmbCountry->insertItem( tr ( "Myanmar" ) ); | 405 | cmbCountry->insertItem( tr ( "Myanmar" ) ); |
405 | cmbCountry->insertItem( tr ( "Namibia" ) ); | 406 | cmbCountry->insertItem( tr ( "Namibia" ) ); |
406 | cmbCountry->insertItem( tr ( "Nauru" ) ); | 407 | cmbCountry->insertItem( tr ( "Nauru" ) ); |
407 | cmbCountry->insertItem( tr ( "Nepal" ) ); | 408 | cmbCountry->insertItem( tr ( "Nepal" ) ); |
408 | cmbCountry->insertItem( tr ( "Netherlands" ) ); | 409 | cmbCountry->insertItem( tr ( "Netherlands" ) ); |
409 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); | 410 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); |
410 | cmbCountry->insertItem( tr ( "New Zealand" ) ); | 411 | cmbCountry->insertItem( tr ( "New Zealand" ) ); |
411 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); | 412 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); |
412 | cmbCountry->insertItem( tr ( "Niger" ) ); | 413 | cmbCountry->insertItem( tr ( "Niger" ) ); |
413 | cmbCountry->insertItem( tr ( "Nigeria" ) ); | 414 | cmbCountry->insertItem( tr ( "Nigeria" ) ); |
414 | cmbCountry->insertItem( tr ( "Niue" ) ); | 415 | cmbCountry->insertItem( tr ( "Niue" ) ); |
415 | cmbCountry->insertItem( tr ( "Norway" ) ); | 416 | cmbCountry->insertItem( tr ( "Norway" ) ); |
416 | cmbCountry->insertItem( tr ( "Oman" ) ); | 417 | cmbCountry->insertItem( tr ( "Oman" ) ); |
417 | cmbCountry->insertItem( tr ( "Pakistan" ) ); | 418 | cmbCountry->insertItem( tr ( "Pakistan" ) ); |
418 | cmbCountry->insertItem( tr ( "Palau" ) ); | 419 | cmbCountry->insertItem( tr ( "Palau" ) ); |
419 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); | 420 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); |
420 | cmbCountry->insertItem( tr ( "Panama" ) ); | 421 | cmbCountry->insertItem( tr ( "Panama" ) ); |
421 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); | 422 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); |
422 | cmbCountry->insertItem( tr ( "Paraguay" ) ); | 423 | cmbCountry->insertItem( tr ( "Paraguay" ) ); |
423 | cmbCountry->insertItem( tr ( "Peru" ) ); | 424 | cmbCountry->insertItem( tr ( "Peru" ) ); |
424 | cmbCountry->insertItem( tr ( "Philippines" ) ); | 425 | cmbCountry->insertItem( tr ( "Philippines" ) ); |
425 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); | 426 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); |
426 | cmbCountry->insertItem( tr ( "Poland" ) ); | 427 | cmbCountry->insertItem( tr ( "Poland" ) ); |
427 | cmbCountry->insertItem( tr ( "Portugal" ) ); | 428 | cmbCountry->insertItem( tr ( "Portugal" ) ); |
428 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); | 429 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); |
429 | cmbCountry->insertItem( tr ( "Qatar" ) ); | 430 | cmbCountry->insertItem( tr ( "Qatar" ) ); |
430 | cmbCountry->insertItem( tr ( "Reunion" ) ); | 431 | cmbCountry->insertItem( tr ( "Reunion" ) ); |
431 | cmbCountry->insertItem( tr ( "Romania" ) ); | 432 | cmbCountry->insertItem( tr ( "Romania" ) ); |
432 | cmbCountry->insertItem( tr ( "Russia" ) ); | 433 | cmbCountry->insertItem( tr ( "Russia" ) ); |
433 | cmbCountry->insertItem( tr ( "Rwanda" ) ); | 434 | cmbCountry->insertItem( tr ( "Rwanda" ) ); |
434 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); | 435 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); |
435 | cmbCountry->insertItem( tr ( "Samoa" ) ); | 436 | cmbCountry->insertItem( tr ( "Samoa" ) ); |
436 | cmbCountry->insertItem( tr ( "San Marino" ) ); | 437 | cmbCountry->insertItem( tr ( "San Marino" ) ); |
437 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); | 438 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); |
438 | cmbCountry->insertItem( tr ( "Senegal" ) ); | 439 | cmbCountry->insertItem( tr ( "Senegal" ) ); |
439 | cmbCountry->insertItem( tr ( "Seychelles" ) ); | 440 | cmbCountry->insertItem( tr ( "Seychelles" ) ); |
440 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); | 441 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); |
441 | cmbCountry->insertItem( tr ( "Singapore" ) ); | 442 | cmbCountry->insertItem( tr ( "Singapore" ) ); |
442 | cmbCountry->insertItem( tr ( "Slovakia" ) ); | 443 | cmbCountry->insertItem( tr ( "Slovakia" ) ); |
443 | cmbCountry->insertItem( tr ( "Slovenia" ) ); | 444 | cmbCountry->insertItem( tr ( "Slovenia" ) ); |
444 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); | 445 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); |
445 | cmbCountry->insertItem( tr ( "Somalia" ) ); | 446 | cmbCountry->insertItem( tr ( "Somalia" ) ); |
446 | cmbCountry->insertItem( tr ( "South Africa" ) ); | 447 | cmbCountry->insertItem( tr ( "South Africa" ) ); |
447 | cmbCountry->insertItem( tr ( "Spain" ) ); | 448 | cmbCountry->insertItem( tr ( "Spain" ) ); |
448 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); | 449 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); |
449 | cmbCountry->insertItem( tr ( "St. Helena" ) ); | 450 | cmbCountry->insertItem( tr ( "St. Helena" ) ); |
450 | cmbCountry->insertItem( tr ( "Sudan" ) ); | 451 | cmbCountry->insertItem( tr ( "Sudan" ) ); |
451 | cmbCountry->insertItem( tr ( "Suriname" ) ); | 452 | cmbCountry->insertItem( tr ( "Suriname" ) ); |
452 | cmbCountry->insertItem( tr ( "Swaziland" ) ); | 453 | cmbCountry->insertItem( tr ( "Swaziland" ) ); |
453 | cmbCountry->insertItem( tr ( "Sweden" ) ); | 454 | cmbCountry->insertItem( tr ( "Sweden" ) ); |
454 | cmbCountry->insertItem( tr ( "Switzerland" ) ); | 455 | cmbCountry->insertItem( tr ( "Switzerland" ) ); |
455 | cmbCountry->insertItem( tr ( "Taiwan" ) ); | 456 | cmbCountry->insertItem( tr ( "Taiwan" ) ); |
456 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); | 457 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); |
457 | cmbCountry->insertItem( tr ( "Tanzania" ) ); | 458 | cmbCountry->insertItem( tr ( "Tanzania" ) ); |
458 | cmbCountry->insertItem( tr ( "Thailand" ) ); | 459 | cmbCountry->insertItem( tr ( "Thailand" ) ); |
459 | cmbCountry->insertItem( tr ( "Togo" ) ); | 460 | cmbCountry->insertItem( tr ( "Togo" ) ); |
460 | cmbCountry->insertItem( tr ( "Tokelau" ) ); | 461 | cmbCountry->insertItem( tr ( "Tokelau" ) ); |
461 | cmbCountry->insertItem( tr ( "Tonga" ) ); | 462 | cmbCountry->insertItem( tr ( "Tonga" ) ); |
462 | cmbCountry->insertItem( tr ( "Tunisia" ) ); | 463 | cmbCountry->insertItem( tr ( "Tunisia" ) ); |
463 | cmbCountry->insertItem( tr ( "Turkey" ) ); | 464 | cmbCountry->insertItem( tr ( "Turkey" ) ); |
464 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); | 465 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); |
465 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); | 466 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); |
466 | cmbCountry->insertItem( tr ( "Uganda" ) ); | 467 | cmbCountry->insertItem( tr ( "Uganda" ) ); |
467 | cmbCountry->insertItem( tr ( "Ukraine" ) ); | 468 | cmbCountry->insertItem( tr ( "Ukraine" ) ); |
468 | cmbCountry->insertItem( tr ( "Uruguay" ) ); | 469 | cmbCountry->insertItem( tr ( "Uruguay" ) ); |
469 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); | 470 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); |
470 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); | 471 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); |
471 | cmbCountry->insertItem( tr ( "Venezuela" ) ); | 472 | cmbCountry->insertItem( tr ( "Venezuela" ) ); |
472 | cmbCountry->insertItem( tr ( "Vietnam" ) ); | 473 | cmbCountry->insertItem( tr ( "Vietnam" ) ); |
473 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); | 474 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); |
474 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); | 475 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); |
475 | cmbCountry->insertItem( tr ( "Yemen" ) ); | 476 | cmbCountry->insertItem( tr ( "Yemen" ) ); |
476 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); | 477 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); |
477 | cmbCountry->insertItem( tr ( "Zambia" ) ); | 478 | cmbCountry->insertItem( tr ( "Zambia" ) ); |
478 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); | 479 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); |
479 | if (cmbCountry->listBox()!=0) | 480 | if (cmbCountry->listBox()!=0) |
480 | cmbCountry->listBox()->sort(); | 481 | cmbCountry->listBox()->sort(); |
481 | 482 | ||
482 | cmbCountry->setMaximumWidth( 135 ); | 483 | cmbCountry->setMaximumWidth( 135 ); |
483 | 484 | ||
484 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 485 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
485 | 486 | ||
486 | // Chooser 4 | 487 | // Chooser 4 |
487 | cmbChooserField4 = new QComboBox( FALSE, container ); | 488 | cmbChooserField4 = new QComboBox( FALSE, container ); |
488 | cmbChooserField4->setMaximumWidth( 90 ); | 489 | cmbChooserField4->setMaximumWidth( 90 ); |
489 | gl->addWidget( cmbChooserField4, 6, 0 ); | 490 | gl->addWidget( cmbChooserField4, 6, 0 ); |
490 | // Textfield for chooser 2 | 491 | // Textfield for chooser 2 |
491 | // Now use WidgetStack to contain the textfield and the default-email combo! | 492 | // Now use WidgetStack to contain the textfield and the default-email combo! |
492 | m_widgetStack4 = new QWidgetStack( container ); | 493 | m_widgetStack4 = new QWidgetStack( container ); |
493 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); | 494 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); |
494 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); | 495 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); |
495 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); | 496 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); |
496 | m_widgetStack4 -> raiseWidget( TextField ); | 497 | m_widgetStack4 -> raiseWidget( TextField ); |
497 | 498 | ||
498 | QSpacerItem *space = new QSpacerItem(1,1, | 499 | QSpacerItem *space = new QSpacerItem(1,1, |
499 | QSizePolicy::Maximum, | 500 | QSizePolicy::Maximum, |
500 | QSizePolicy::MinimumExpanding ); | 501 | QSizePolicy::MinimumExpanding ); |
501 | gl->addItem( space, 7, 0 ); | 502 | gl->addItem( space, 7, 0 ); |
502 | 503 | ||
503 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 504 | tabMain->insertTab( tabViewport, tr( "Address" ) ); |
504 | 505 | ||
505 | tabViewport = new QWidget ( tabMain ); | 506 | tabViewport = new QWidget ( tabMain ); |
506 | 507 | ||
507 | vb = new QVBoxLayout( tabViewport ); | 508 | vb = new QVBoxLayout( tabViewport ); |
508 | 509 | ||
509 | svDetails = new QScrollView( tabViewport ); | 510 | svDetails = new QScrollView( tabViewport ); |
510 | vb->addWidget( svDetails, 0, 0 ); | 511 | vb->addWidget( svDetails, 0, 0 ); |
511 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 512 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
512 | svDetails->setFrameStyle( QFrame::NoFrame ); | 513 | svDetails->setFrameStyle( QFrame::NoFrame ); |
513 | 514 | ||
514 | container = new QWidget( svDetails->viewport() ); | 515 | container = new QWidget( svDetails->viewport() ); |
515 | svDetails->addChild( container ); | 516 | svDetails->addChild( container ); |
516 | 517 | ||
517 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 518 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
518 | 519 | ||
519 | int counter = 0; | 520 | int counter = 0; |
520 | 521 | ||
521 | // Birthday | 522 | // Birthday |
522 | QHBox* hBox = new QHBox( container ); | 523 | QHBox* hBox = new QHBox( container ); |
523 | l = new QLabel( tr("Birthday"), container ); | 524 | l = new QLabel( tr("Birthday"), container ); |
524 | gl->addWidget( l, counter, 0 ); | 525 | gl->addWidget( l, counter, 0 ); |
525 | 526 | ||
526 | QPopupMenu* m1 = new QPopupMenu( container ); | 527 | QPopupMenu* m1 = new QPopupMenu( container ); |
527 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | 528 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); |
528 | m1->insertItem( birthdayPicker ); | 529 | m1->insertItem( birthdayPicker ); |
529 | 530 | ||
530 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 531 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
531 | birthdayButton->setPopup( m1 ); | 532 | birthdayButton->setPopup( m1 ); |
532 | birthdayButton->setPopupDelay(0); | 533 | birthdayButton->setPopupDelay(0); |
533 | 534 | ||
534 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 535 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
535 | tr( "Delete" ), | 536 | tr( "Delete" ), |
536 | hBox, 0 ); | 537 | hBox, 0 ); |
537 | 538 | ||
538 | gl->addWidget( hBox, counter , 1 ); | 539 | gl->addWidget( hBox, counter , 1 ); |
539 | 540 | ||
540 | connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), | 541 | connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), |
541 | this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); | 542 | this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); |
542 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | 543 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); |
543 | 544 | ||
544 | ++counter; | 545 | ++counter; |
545 | 546 | ||
546 | // Anniversary | 547 | // Anniversary |
547 | hBox = new QHBox( container ); | 548 | hBox = new QHBox( container ); |
548 | l = new QLabel( tr("Anniversary"), container ); | 549 | l = new QLabel( tr("Anniversary"), container ); |
549 | gl->addWidget( l, counter, 0 ); | 550 | gl->addWidget( l, counter, 0 ); |
550 | 551 | ||
551 | m1 = new QPopupMenu( container ); | 552 | m1 = new QPopupMenu( container ); |
552 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 553 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); |
553 | m1->insertItem( anniversaryPicker ); | 554 | m1->insertItem( anniversaryPicker ); |
554 | 555 | ||
555 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 556 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
556 | anniversaryButton->setPopup( m1 ); | 557 | anniversaryButton->setPopup( m1 ); |
557 | anniversaryButton->setPopupDelay(0); | 558 | anniversaryButton->setPopupDelay(0); |
558 | 559 | ||
559 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 560 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
560 | tr( "Delete" ), | 561 | tr( "Delete" ), |
561 | hBox, 0 ); | 562 | hBox, 0 ); |
562 | gl->addWidget( hBox, counter , 1 ); | 563 | gl->addWidget( hBox, counter , 1 ); |
563 | 564 | ||
564 | connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), | 565 | connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), |
565 | this, SLOT( slotAnniversaryDateChanged(int,int,int) ) ); | 566 | this, SLOT( slotAnniversaryDateChanged(int,int,int) ) ); |
566 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); | 567 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); |
567 | 568 | ||
568 | ++counter; | 569 | ++counter; |
569 | 570 | ||
570 | // Gender | 571 | // Gender |
571 | l = new QLabel( tr("Gender"), container ); | 572 | l = new QLabel( tr("Gender"), container ); |
572 | gl->addWidget( l, counter, 0 ); | 573 | gl->addWidget( l, counter, 0 ); |
573 | cmbGender = new QComboBox( container ); | 574 | cmbGender = new QComboBox( container ); |
574 | cmbGender->insertItem( "", 0 ); | 575 | cmbGender->insertItem( "", 0 ); |
575 | cmbGender->insertItem( tr("Male"), 1); | 576 | cmbGender->insertItem( tr("Male"), 1); |
576 | cmbGender->insertItem( tr("Female"), 2); | 577 | cmbGender->insertItem( tr("Female"), 2); |
577 | gl->addWidget( cmbGender, counter, 1 ); | 578 | gl->addWidget( cmbGender, counter, 1 ); |
578 | 579 | ||
579 | ++counter; | 580 | ++counter; |
580 | 581 | ||
581 | // Create Labels and lineedit fields for every dynamic entry | 582 | // Create Labels and lineedit fields for every dynamic entry |
582 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 583 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
583 | QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId(); | 584 | QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId(); |
584 | QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields(); | 585 | QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields(); |
585 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { | 586 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { |
586 | 587 | ||
587 | if (((*it) == "Anniversary") || | 588 | if (((*it) == "Anniversary") || |
588 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | 589 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; |
589 | 590 | ||
590 | l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); | 591 | l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); |
591 | listName.append( l ); | 592 | listName.append( l ); |
592 | gl->addWidget( l, i, 0 ); | 593 | gl->addWidget( l, i, 0 ); |
593 | QLineEdit *e = new QLineEdit( container ); | 594 | QLineEdit *e = new QLineEdit( container ); |
594 | listValue.append( e ); | 595 | listValue.append( e ); |
595 | gl->addWidget( e, i, 1); | 596 | gl->addWidget( e, i, 1); |
596 | } | 597 | } |
597 | // Fill labels with names.. | 598 | // Fill labels with names.. |
598 | //loadFields(); | 599 | //loadFields(); |
599 | 600 | ||
600 | 601 | ||
601 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 602 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
602 | 603 | ||
603 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 604 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
604 | dlgNote->setCaption( tr("Enter Note") ); | 605 | dlgNote->setCaption( tr("Enter Note") ); |
605 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 606 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
606 | txtNote = new QMultiLineEdit( dlgNote ); | 607 | txtNote = new QMultiLineEdit( dlgNote ); |
607 | vbNote->addWidget( txtNote ); | 608 | vbNote->addWidget( txtNote ); |
608 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 609 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
609 | 610 | ||
610 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 611 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
611 | dlgName->setCaption( tr("Edit Name") ); | 612 | dlgName->setCaption( tr("Edit Name") ); |
612 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 613 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
613 | 614 | ||
614 | l = new QLabel( tr("First Name"), dlgName ); | 615 | l = new QLabel( tr("First Name"), dlgName ); |
615 | gl->addWidget( l, 0, 0 ); | 616 | gl->addWidget( l, 0, 0 ); |
616 | txtFirstName = new QLineEdit( dlgName ); | 617 | txtFirstName = new ABOOK::NameLineEdit( dlgName ); |
617 | gl->addWidget( txtFirstName, 0, 1 ); | 618 | gl->addWidget( txtFirstName, 0, 1 ); |
618 | 619 | ||
619 | l = new QLabel( tr("Middle Name"), dlgName ); | 620 | l = new QLabel( tr("Middle Name"), dlgName ); |
620 | gl->addWidget( l, 1, 0 ); | 621 | gl->addWidget( l, 1, 0 ); |
621 | txtMiddleName = new QLineEdit( dlgName ); | 622 | txtMiddleName = new ABOOK::NameLineEdit( dlgName ); |
622 | gl->addWidget( txtMiddleName, 1, 1 ); | 623 | gl->addWidget( txtMiddleName, 1, 1 ); |
623 | 624 | ||
624 | l = new QLabel( tr("Last Name"), dlgName ); | 625 | l = new QLabel( tr("Last Name"), dlgName ); |
625 | gl->addWidget( l, 2, 0 ); | 626 | gl->addWidget( l, 2, 0 ); |
626 | txtLastName = new QLineEdit( dlgName ); | 627 | txtLastName = new ABOOK::NameLineEdit( dlgName ); |
627 | gl->addWidget( txtLastName, 2, 1 ); | 628 | gl->addWidget( txtLastName, 2, 1 ); |
628 | 629 | ||
629 | // l = new QLabel( tr("Suffix"), dlgName ); | 630 | // l = new QLabel( tr("Suffix"), dlgName ); |
630 | // gl->addWidget( l, 3, 0 ); | 631 | // gl->addWidget( l, 3, 0 ); |
631 | // txtSuffix = new QLineEdit( dlgName ); | 632 | // txtSuffix = new QLineEdit( dlgName ); |
632 | // gl->addWidget( txtSuffix, 3, 1 ); | 633 | // gl->addWidget( txtSuffix, 3, 1 ); |
633 | space = new QSpacerItem(1,1, | 634 | space = new QSpacerItem(1,1, |
634 | QSizePolicy::Maximum, | 635 | QSizePolicy::Maximum, |
635 | QSizePolicy::MinimumExpanding ); | 636 | QSizePolicy::MinimumExpanding ); |
636 | gl->addItem( space, 4, 0 ); | 637 | gl->addItem( space, 4, 0 ); |
637 | 638 | ||
638 | cmbChooserField1->insertStringList( trlChooserNames ); | 639 | cmbChooserField1->insertStringList( trlChooserNames ); |
639 | cmbChooserField2->insertStringList( trlChooserNames ); | 640 | cmbChooserField2->insertStringList( trlChooserNames ); |
640 | cmbChooserField3->insertStringList( trlChooserNames ); | 641 | cmbChooserField3->insertStringList( trlChooserNames ); |
641 | cmbChooserField4->insertStringList( trlChooserNames ); | 642 | cmbChooserField4->insertStringList( trlChooserNames ); |
642 | 643 | ||
643 | cmbChooserField1->setCurrentItem( 0 ); | 644 | cmbChooserField1->setCurrentItem( 0 ); |
644 | cmbChooserField2->setCurrentItem( 1 ); | 645 | cmbChooserField2->setCurrentItem( 1 ); |
645 | cmbChooserField3->setCurrentItem( 2 ); | 646 | cmbChooserField3->setCurrentItem( 2 ); |
646 | 647 | ||
647 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 648 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
648 | 649 | ||
649 | connect( txtFullName, SIGNAL(textChanged(const QString&)), | 650 | connect( txtFullName, SIGNAL(textChanged(const QString&)), |
650 | this, SLOT(slotFullNameChange(const QString&)) ); | 651 | this, SLOT(slotFullNameChange(const QString&)) ); |
651 | connect( txtSuffix, SIGNAL(textChanged(const QString&)), | 652 | connect( txtSuffix, SIGNAL(textChanged(const QString&)), |
652 | this, SLOT(slotSuffixChange(const QString&)) ); | 653 | this, SLOT(slotSuffixChange(const QString&)) ); |
653 | connect( txtOrganization, SIGNAL(textChanged(const QString&)), | 654 | connect( txtOrganization, SIGNAL(textChanged(const QString&)), |
654 | this, SLOT(slotOrganizationChange(const QString&)) ); | 655 | this, SLOT(slotOrganizationChange(const QString&)) ); |
655 | connect( txtChooserField1, SIGNAL(textChanged(const QString&)), | 656 | connect( txtChooserField1, SIGNAL(textChanged(const QString&)), |
656 | this, SLOT(slotChooser1Change(const QString&)) ); | 657 | this, SLOT(slotChooser1Change(const QString&)) ); |
657 | connect( txtChooserField2, SIGNAL(textChanged(const QString&)), | 658 | connect( txtChooserField2, SIGNAL(textChanged(const QString&)), |
658 | this, SLOT(slotChooser2Change(const QString&)) ); | 659 | this, SLOT(slotChooser2Change(const QString&)) ); |
659 | connect( txtChooserField3, SIGNAL(textChanged(const QString&)), | 660 | connect( txtChooserField3, SIGNAL(textChanged(const QString&)), |
660 | this, SLOT(slotChooser3Change(const QString&)) ); | 661 | this, SLOT(slotChooser3Change(const QString&)) ); |
661 | connect( txtChooserField4, SIGNAL(textChanged(const QString&)), | 662 | connect( txtChooserField4, SIGNAL(textChanged(const QString&)), |
662 | this, SLOT(slotChooser4Change(const QString&)) ); | 663 | this, SLOT(slotChooser4Change(const QString&)) ); |
663 | connect( txtAddress, SIGNAL(textChanged(const QString&)), | 664 | connect( txtAddress, SIGNAL(textChanged(const QString&)), |
664 | this, SLOT(slotAddressChange(const QString&)) ); | 665 | this, SLOT(slotAddressChange(const QString&)) ); |
665 | connect( txtCity, SIGNAL(textChanged(const QString&)), | 666 | connect( txtCity, SIGNAL(textChanged(const QString&)), |
666 | this, SLOT(slotCityChange(const QString&)) ); | 667 | this, SLOT(slotCityChange(const QString&)) ); |
667 | connect( txtState, SIGNAL(textChanged(const QString&)), | 668 | connect( txtState, SIGNAL(textChanged(const QString&)), |
668 | this, SLOT(slotStateChange(const QString&)) ); | 669 | this, SLOT(slotStateChange(const QString&)) ); |
669 | connect( txtZip, SIGNAL(textChanged(const QString&)), | 670 | connect( txtZip, SIGNAL(textChanged(const QString&)), |
670 | this, SLOT(slotZipChange(const QString&)) ); | 671 | this, SLOT(slotZipChange(const QString&)) ); |
671 | connect( cmbCountry, SIGNAL(textChanged(const QString&)), | 672 | connect( cmbCountry, SIGNAL(textChanged(const QString&)), |
672 | this, SLOT(slotCountryChange(const QString&)) ); | 673 | this, SLOT(slotCountryChange(const QString&)) ); |
673 | connect( cmbCountry, SIGNAL(activated(const QString&)), | 674 | connect( cmbCountry, SIGNAL(activated(const QString&)), |
674 | this, SLOT(slotCountryChange(const QString&)) ); | 675 | this, SLOT(slotCountryChange(const QString&)) ); |
675 | connect( cmbChooserField1, SIGNAL(activated(int)), | 676 | connect( cmbChooserField1, SIGNAL(activated(int)), |
676 | this, SLOT(slotCmbChooser1Change(int)) ); | 677 | this, SLOT(slotCmbChooser1Change(int)) ); |
677 | connect( cmbChooserField2, SIGNAL(activated(int)), | 678 | connect( cmbChooserField2, SIGNAL(activated(int)), |
678 | this, SLOT(slotCmbChooser2Change(int)) ); | 679 | this, SLOT(slotCmbChooser2Change(int)) ); |
679 | connect( cmbChooserField3, SIGNAL(activated(int)), | 680 | connect( cmbChooserField3, SIGNAL(activated(int)), |
680 | this, SLOT(slotCmbChooser3Change(int)) ); | 681 | this, SLOT(slotCmbChooser3Change(int)) ); |
681 | connect( cmbChooserField4, SIGNAL(activated(int)), | 682 | connect( cmbChooserField4, SIGNAL(activated(int)), |
682 | this, SLOT(slotCmbChooser4Change(int)) ); | 683 | this, SLOT(slotCmbChooser4Change(int)) ); |
683 | connect( cmbAddress, SIGNAL(activated(int)), | 684 | connect( cmbAddress, SIGNAL(activated(int)), |
684 | this, SLOT(slotAddressTypeChange(int)) ); | 685 | this, SLOT(slotAddressTypeChange(int)) ); |
685 | 686 | ||
686 | new QPEDialogListener(this); | 687 | new QPEDialogListener(this); |
687 | 688 | ||
688 | setPersonalView ( m_personalView ); | 689 | setPersonalView ( m_personalView ); |
689 | 690 | ||
690 | owarn << "init() END" << oendl; | 691 | owarn << "init() END" << oendl; |
691 | } | 692 | } |
692 | 693 | ||
693 | void ContactEditor::defaultEmailChanged(int i){ | 694 | void ContactEditor::defaultEmailChanged(int i){ |
694 | odebug << "defaultEmailChanged" << oendl; | 695 | odebug << "defaultEmailChanged" << oendl; |
695 | 696 | ||
696 | // was sollte das ? (se) | 697 | // was sollte das ? (se) |
697 | // int index = cmbChooserField1->currentItem(); | 698 | // int index = cmbChooserField1->currentItem(); |
698 | // slChooserValues[index] = cmbDefaultEmail->text(i); | 699 | // slChooserValues[index] = cmbDefaultEmail->text(i); |
699 | 700 | ||
700 | defaultEmail = cmbDefaultEmail->text(i); | 701 | defaultEmail = cmbDefaultEmail->text(i); |
701 | odebug << "Changed to: " << defaultEmail << oendl; | 702 | odebug << "Changed to: " << defaultEmail << oendl; |
702 | 703 | ||
703 | } | 704 | } |
704 | 705 | ||
705 | void ContactEditor::populateDefaultEmailCmb(){ | 706 | void ContactEditor::populateDefaultEmailCmb(){ |
706 | 707 | ||
707 | // if the default-email combo was not selected and therfore not created | 708 | // if the default-email combo was not selected and therfore not created |
708 | // we get a lot of trouble.. Therfore create an invisible one.. | 709 | // we get a lot of trouble.. Therfore create an invisible one.. |
709 | if ( !cmbDefaultEmail ){ | 710 | if ( !cmbDefaultEmail ){ |
710 | cmbDefaultEmail = new QComboBox(this); | 711 | cmbDefaultEmail = new QComboBox(this); |
711 | cmbDefaultEmail -> hide(); | 712 | cmbDefaultEmail -> hide(); |
712 | } | 713 | } |
713 | cmbDefaultEmail->clear(); | 714 | cmbDefaultEmail->clear(); |
714 | cmbDefaultEmail->insertStringList( emails ); | 715 | cmbDefaultEmail->insertStringList( emails ); |
715 | // cmbDefaultEmail->show(); | 716 | // cmbDefaultEmail->show(); |
716 | 717 | ||
717 | // Select default email in combo.. | 718 | // Select default email in combo.. |
718 | bool found = false; | 719 | bool found = false; |
719 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 720 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
720 | odebug << " populateDefaultEmailCmb text >" << cmbDefaultEmail->text( i ) | 721 | odebug << " populateDefaultEmailCmb text >" << cmbDefaultEmail->text( i ) |
721 | << "< defaultEmail >" << defaultEmail << "<" << oendl; | 722 | << "< defaultEmail >" << defaultEmail << "<" << oendl; |
722 | 723 | ||
723 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 724 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
724 | cmbDefaultEmail->setCurrentItem( i ); | 725 | cmbDefaultEmail->setCurrentItem( i ); |
725 | odebug << "set" << oendl; | 726 | odebug << "set" << oendl; |
726 | found = true; | 727 | found = true; |
727 | } | 728 | } |
728 | } | 729 | } |
729 | 730 | ||
730 | // If the current default email is not found in the list, we choose the | 731 | // If the current default email is not found in the list, we choose the |
731 | // first one.. | 732 | // first one.. |
732 | if ( !found ) | 733 | if ( !found ) |
733 | defaultEmail = cmbDefaultEmail->text(0); | 734 | defaultEmail = cmbDefaultEmail->text(0); |
734 | } | 735 | } |
735 | 736 | ||
736 | // Called when any combobox was changed. | 737 | // Called when any combobox was changed. |
737 | // "true" returned if the change was chandled by this function, else it should | 738 | // "true" returned if the change was chandled by this function, else it should |
738 | // be handled by something else.. | 739 | // be handled by something else.. |
739 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { | 740 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { |
740 | QString type = slChooserNames[index]; | 741 | QString type = slChooserNames[index]; |
741 | owarn << "ContactEditor::cmbChooserChange -> Type: " << type | 742 | owarn << "ContactEditor::cmbChooserChange -> Type: " << type |
742 | << ", WidgetPos: " << widgetPos << oendl; | 743 | << ", WidgetPos: " << widgetPos << oendl; |
743 | 744 | ||
744 | if ( !initializing ) | 745 | if ( !initializing ) |
745 | contactfields.setFieldOrder( widgetPos-1, index ); | 746 | contactfields.setFieldOrder( widgetPos-1, index ); |
746 | 747 | ||
747 | // Create and connect combobox for selecting the default email | 748 | // Create and connect combobox for selecting the default email |
748 | if ( type == "Default Email"){ | 749 | if ( type == "Default Email"){ |
749 | owarn << "Choosing default-email (defaultEmailChooserPosition= " | 750 | owarn << "Choosing default-email (defaultEmailChooserPosition= " |
750 | << defaultEmailChooserPosition << ") " << oendl; | 751 | << defaultEmailChooserPosition << ") " << oendl; |
751 | 752 | ||
752 | // More than one default-email chooser is not allowed ! | 753 | // More than one default-email chooser is not allowed ! |
753 | if ( ( defaultEmailChooserPosition != -1 ) && | 754 | if ( ( defaultEmailChooserPosition != -1 ) && |
754 | defaultEmailChooserPosition != widgetPos && !initializing){ | 755 | defaultEmailChooserPosition != widgetPos && !initializing){ |
755 | chooserError( widgetPos ); | 756 | chooserError( widgetPos ); |
756 | return true; | 757 | return true; |
757 | } | 758 | } |
758 | 759 | ||
759 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 760 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
760 | if ( cmbo ){ | 761 | if ( cmbo ){ |
761 | inputStack->raiseWidget( TextField ); | 762 | inputStack->raiseWidget( TextField ); |
762 | inputStack -> removeWidget( cmbo ); | 763 | inputStack -> removeWidget( cmbo ); |
763 | delete cmbo; | 764 | delete cmbo; |
764 | } | 765 | } |
765 | cmbo = new QComboBox( inputStack ); | 766 | cmbo = new QComboBox( inputStack ); |
766 | cmbo -> insertStringList( emails ); | 767 | cmbo -> insertStringList( emails ); |
767 | 768 | ||
768 | inputStack -> addWidget( cmbo, Combo ); | 769 | inputStack -> addWidget( cmbo, Combo ); |
769 | inputStack -> raiseWidget( Combo ); | 770 | inputStack -> raiseWidget( Combo ); |
770 | 771 | ||
771 | defaultEmailChooserPosition = widgetPos; | 772 | defaultEmailChooserPosition = widgetPos; |
772 | cmbDefaultEmail = cmbo; | 773 | cmbDefaultEmail = cmbo; |
773 | 774 | ||
774 | connect( cmbo,SIGNAL( activated(int) ), | 775 | connect( cmbo,SIGNAL( activated(int) ), |
775 | SLOT( defaultEmailChanged(int) ) ); | 776 | SLOT( defaultEmailChanged(int) ) ); |
776 | 777 | ||
777 | // Set current default email | 778 | // Set current default email |
778 | populateDefaultEmailCmb(); | 779 | populateDefaultEmailCmb(); |
779 | 780 | ||
780 | 781 | ||
781 | } else { | 782 | } else { |
782 | // Something else was selected: Hide combo.. | 783 | // Something else was selected: Hide combo.. |
783 | owarn << " Hiding default-email combo" << oendl; | 784 | owarn << " Hiding default-email combo" << oendl; |
784 | if ( defaultEmailChooserPosition == widgetPos ){ | 785 | if ( defaultEmailChooserPosition == widgetPos ){ |
785 | defaultEmailChooserPosition = -1; | 786 | defaultEmailChooserPosition = -1; |
786 | } | 787 | } |
787 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 788 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
788 | if ( cmbo ){ | 789 | if ( cmbo ){ |
789 | inputStack->raiseWidget( TextField ); | 790 | inputStack->raiseWidget( TextField ); |
790 | inputStack -> removeWidget( cmbo ); | 791 | inputStack -> removeWidget( cmbo ); |
791 | cmbDefaultEmail = 0l; | 792 | cmbDefaultEmail = 0l; |
792 | delete cmbo; | 793 | delete cmbo; |
793 | } | 794 | } |
794 | 795 | ||
795 | // Caller should initialize the responsible textfield, therefore | 796 | // Caller should initialize the responsible textfield, therefore |
796 | // "false" is returned | 797 | // "false" is returned |
797 | return false; | 798 | return false; |
798 | } | 799 | } |
799 | 800 | ||
800 | // Everything is worked off .. | 801 | // Everything is worked off .. |
801 | return true; | 802 | return true; |
802 | 803 | ||
803 | } | 804 | } |
804 | 805 | ||
805 | // Currently accessed when we select default-email more than once ! | 806 | // Currently accessed when we select default-email more than once ! |
806 | void ContactEditor::chooserError( int index ) | 807 | void ContactEditor::chooserError( int index ) |
807 | { | 808 | { |
808 | owarn << "ContactEditor::chooserError( " << index << " )" << oendl; | 809 | owarn << "ContactEditor::chooserError( " << index << " )" << oendl; |
809 | QMessageBox::warning( this, "Chooser Error", | 810 | QMessageBox::warning( this, "Chooser Error", |
810 | "Multiple selection of this\n" | 811 | "Multiple selection of this\n" |
811 | "Item is not allowed !\n\n" | 812 | "Item is not allowed !\n\n" |
812 | "First deselect the previous one !", | 813 | "First deselect the previous one !", |
813 | "&OK", 0, 0, | 814 | "&OK", 0, 0, |
814 | 0, 0 ); | 815 | 0, 0 ); |
815 | 816 | ||
816 | // Reset the selected Chooser. Unfortunately the chooser | 817 | // Reset the selected Chooser. Unfortunately the chooser |
817 | // generates no signal, therfore we have to | 818 | // generates no signal, therfore we have to |
818 | // call the cmbChooserChange function manually.. | 819 | // call the cmbChooserChange function manually.. |
819 | switch( index ){ | 820 | switch( index ){ |
820 | case 1: | 821 | case 1: |
821 | cmbChooserField1 -> setCurrentItem( 0 ); | 822 | cmbChooserField1 -> setCurrentItem( 0 ); |
822 | slotCmbChooser1Change( 0 ); | 823 | slotCmbChooser1Change( 0 ); |
823 | break; | 824 | break; |
824 | case 2: | 825 | case 2: |
825 | cmbChooserField2 -> setCurrentItem( 0 ); | 826 | cmbChooserField2 -> setCurrentItem( 0 ); |
826 | slotCmbChooser2Change( 0 ); | 827 | slotCmbChooser2Change( 0 ); |
827 | break; | 828 | break; |
828 | case 3: | 829 | case 3: |
829 | cmbChooserField3 -> setCurrentItem( 0 ); | 830 | cmbChooserField3 -> setCurrentItem( 0 ); |
830 | slotCmbChooser3Change( 0 ); | 831 | slotCmbChooser3Change( 0 ); |
831 | break; | 832 | break; |
832 | case 4: | 833 | case 4: |
833 | cmbChooserField4 -> setCurrentItem( 0 ); | 834 | cmbChooserField4 -> setCurrentItem( 0 ); |
834 | slotCmbChooser4Change( 0 ); | 835 | slotCmbChooser4Change( 0 ); |
835 | break; | 836 | break; |
836 | } | 837 | } |
837 | } | 838 | } |
838 | 839 | ||
839 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) | 840 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
840 | void ContactEditor::chooserChange( const QString &textChanged, int index, | 841 | void ContactEditor::chooserChange( const QString &textChanged, int index, |
841 | QLineEdit* , int widgetPos ) { | 842 | QLineEdit* , int widgetPos ) { |
842 | 843 | ||
843 | QString type = slChooserNames[index]; // :SX | 844 | QString type = slChooserNames[index]; // :SX |
844 | odebug << "ContactEditor::chooserChange( type=>" << type << "<, textChanged=>" | 845 | odebug << "ContactEditor::chooserChange( type=>" << type << "<, textChanged=>" |
845 | << textChanged << "< index=" << index << ", widgetPos=" << widgetPos | 846 | << textChanged << "< index=" << index << ", widgetPos=" << widgetPos |
846 | << " )" << oendl; | 847 | << " )" << oendl; |
847 | 848 | ||
848 | if ( type == "Default Email"){ | 849 | if ( type == "Default Email"){ |
849 | owarn << "??? Wozu??: " << textChanged << oendl; | 850 | owarn << "??? Wozu??: " << textChanged << oendl; |
850 | defaultEmail = textChanged; | 851 | defaultEmail = textChanged; |
851 | 852 | ||
852 | populateDefaultEmailCmb(); | 853 | populateDefaultEmailCmb(); |
853 | 854 | ||
854 | }else if (type == "Emails"){ | 855 | }else if (type == "Emails"){ |
855 | odebug << "emails" << oendl; | 856 | odebug << "emails" << oendl; |
856 | 857 | ||
857 | QString de; | 858 | QString de; |
858 | emails = QStringList::split (",", textChanged ); | 859 | emails = QStringList::split (",", textChanged ); |
859 | 860 | ||
860 | populateDefaultEmailCmb(); | 861 | populateDefaultEmailCmb(); |
861 | } | 862 | } |
862 | 863 | ||
863 | slChooserValues[index] = textChanged; | 864 | slChooserValues[index] = textChanged; |
864 | 865 | ||
865 | } | 866 | } |
866 | 867 | ||
867 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 868 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
868 | owarn << "ContactEditor::slotChooser1Change( " << textChanged << " )" << oendl; | 869 | owarn << "ContactEditor::slotChooser1Change( " << textChanged << " )" << oendl; |
869 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 870 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
870 | } | 871 | } |
871 | 872 | ||
872 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 873 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
873 | owarn << "ContactEditor::slotChooser2Change( " << textChanged << " )" << oendl; | 874 | owarn << "ContactEditor::slotChooser2Change( " << textChanged << " )" << oendl; |
874 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 875 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
875 | 876 | ||
876 | } | 877 | } |
877 | 878 | ||
878 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 879 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
879 | owarn << "ContactEditor::slotChooser3Change( " << textChanged << " )" << oendl; | 880 | owarn << "ContactEditor::slotChooser3Change( " << textChanged << " )" << oendl; |
880 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 881 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
881 | } | 882 | } |
882 | 883 | ||
883 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 884 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
884 | owarn << "ContactEditor::slotChooser4Change( " << textChanged << " )" << oendl; | 885 | owarn << "ContactEditor::slotChooser4Change( " << textChanged << " )" << oendl; |
885 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 886 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
886 | } | 887 | } |
887 | 888 | ||
888 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 889 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
889 | 890 | ||
890 | if ( cmbAddress->currentItem() == 0 ) { | 891 | if ( cmbAddress->currentItem() == 0 ) { |
891 | slBusinessAddress[0] = textChanged; | 892 | slBusinessAddress[0] = textChanged; |
892 | } else { | 893 | } else { |
893 | slHomeAddress[0] = textChanged; | 894 | slHomeAddress[0] = textChanged; |
894 | } | 895 | } |
895 | } | 896 | } |
896 | 897 | ||
897 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 898 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
898 | 899 | ||
899 | if ( cmbAddress->currentItem() == 0 ) { | 900 | if ( cmbAddress->currentItem() == 0 ) { |
900 | slBusinessAddress[1] = textChanged; | 901 | slBusinessAddress[1] = textChanged; |
901 | } else { | 902 | } else { |
902 | slHomeAddress[1] = textChanged; | 903 | slHomeAddress[1] = textChanged; |
903 | } | 904 | } |
904 | } | 905 | } |
905 | 906 | ||
906 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 907 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
907 | 908 | ||
908 | if ( cmbAddress->currentItem() == 0 ) { | 909 | if ( cmbAddress->currentItem() == 0 ) { |
909 | slBusinessAddress[2] = textChanged; | 910 | slBusinessAddress[2] = textChanged; |
910 | } else { | 911 | } else { |
911 | slHomeAddress[2] = textChanged; | 912 | slHomeAddress[2] = textChanged; |
912 | } | 913 | } |
913 | } | 914 | } |
914 | 915 | ||
915 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 916 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
916 | 917 | ||
917 | if ( cmbAddress->currentItem() == 0 ) { | 918 | if ( cmbAddress->currentItem() == 0 ) { |
918 | slBusinessAddress[3] = textChanged; | 919 | slBusinessAddress[3] = textChanged; |
919 | } else { | 920 | } else { |
920 | slHomeAddress[3] = textChanged; | 921 | slHomeAddress[3] = textChanged; |
921 | } | 922 | } |
922 | } | 923 | } |
923 | 924 | ||
924 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 925 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
925 | 926 | ||
926 | 927 | ||
927 | if ( cmbAddress->currentItem() == 0 ) { | 928 | if ( cmbAddress->currentItem() == 0 ) { |
928 | slBusinessAddress[4] = textChanged; | 929 | slBusinessAddress[4] = textChanged; |
929 | } else { | 930 | } else { |
930 | slHomeAddress[4] = textChanged; | 931 | slHomeAddress[4] = textChanged; |
931 | } | 932 | } |
932 | } | 933 | } |
933 | 934 | ||
934 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 935 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
935 | 936 | ||
936 | if ( cmbAddress->currentItem() == 0 ) { | 937 | if ( cmbAddress->currentItem() == 0 ) { |
937 | slBusinessAddress[5] = textChanged; | 938 | slBusinessAddress[5] = textChanged; |
938 | } else { | 939 | } else { |
939 | slHomeAddress[5] = textChanged; | 940 | slHomeAddress[5] = textChanged; |
940 | } | 941 | } |
941 | } | 942 | } |
942 | 943 | ||
943 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 944 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
944 | 945 | ||
945 | if ( cmbAddress->currentItem() == 0 ) { | 946 | if ( cmbAddress->currentItem() == 0 ) { |
946 | slBusinessAddress[6] = textChanged; | 947 | slBusinessAddress[6] = textChanged; |
947 | } else { | 948 | } else { |
948 | slHomeAddress[6] = textChanged; | 949 | slHomeAddress[6] = textChanged; |
949 | } | 950 | } |
950 | } | 951 | } |
951 | 952 | ||
952 | 953 | ||
953 | void ContactEditor::slotCmbChooser1Change( int index ) { | 954 | void ContactEditor::slotCmbChooser1Change( int index ) { |
954 | owarn << "ContactEditor::slotCmbChooser1Change( " << index << " )" << oendl; | 955 | owarn << "ContactEditor::slotCmbChooser1Change( " << index << " )" << oendl; |
955 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ | 956 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ |
956 | 957 | ||
957 | txtChooserField1->setText( slChooserValues[index] ); | 958 | txtChooserField1->setText( slChooserValues[index] ); |
958 | txtChooserField1->setFocus(); | 959 | txtChooserField1->setFocus(); |
959 | 960 | ||
960 | } | 961 | } |
961 | 962 | ||
962 | } | 963 | } |
963 | 964 | ||
964 | void ContactEditor::slotCmbChooser2Change( int index ) { | 965 | void ContactEditor::slotCmbChooser2Change( int index ) { |
965 | owarn << "ContactEditor::slotCmbChooser2Change( " << index << " )" << oendl; | 966 | owarn << "ContactEditor::slotCmbChooser2Change( " << index << " )" << oendl; |
966 | 967 | ||
967 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ | 968 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ |
968 | 969 | ||
969 | txtChooserField2->setText( slChooserValues[index] ); | 970 | txtChooserField2->setText( slChooserValues[index] ); |
970 | txtChooserField2->setFocus(); | 971 | txtChooserField2->setFocus(); |
971 | 972 | ||
972 | } | 973 | } |
973 | } | 974 | } |
974 | 975 | ||
975 | void ContactEditor::slotCmbChooser3Change( int index ) { | 976 | void ContactEditor::slotCmbChooser3Change( int index ) { |
976 | owarn << "ContactEditor::slotCmbChooser3Change( " << index << " )" << oendl; | 977 | owarn << "ContactEditor::slotCmbChooser3Change( " << index << " )" << oendl; |
977 | 978 | ||
978 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ | 979 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ |
979 | 980 | ||
980 | txtChooserField3->setText( slChooserValues[index] ); | 981 | txtChooserField3->setText( slChooserValues[index] ); |
981 | txtChooserField3->setFocus(); | 982 | txtChooserField3->setFocus(); |
982 | 983 | ||
983 | } | 984 | } |
984 | } | 985 | } |
985 | 986 | ||
986 | void ContactEditor::slotCmbChooser4Change( int index ) { | 987 | void ContactEditor::slotCmbChooser4Change( int index ) { |
987 | owarn << "ContactEditor::slotCmbChooser4Change( " << index << " )" << oendl; | 988 | owarn << "ContactEditor::slotCmbChooser4Change( " << index << " )" << oendl; |
988 | 989 | ||
989 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ | 990 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ |
990 | 991 | ||
991 | txtChooserField4->setText( slChooserValues[index] ); | 992 | txtChooserField4->setText( slChooserValues[index] ); |
992 | txtChooserField4->setFocus(); | 993 | txtChooserField4->setFocus(); |
993 | 994 | ||
994 | } | 995 | } |
995 | } | 996 | } |
996 | 997 | ||
997 | void ContactEditor::slotAddressTypeChange( int index ) { | 998 | void ContactEditor::slotAddressTypeChange( int index ) { |
998 | 999 | ||
999 | 1000 | ||
1000 | if ( !initializing ) | 1001 | if ( !initializing ) |
1001 | contactfields.setFieldOrder( 4, index ); | 1002 | contactfields.setFieldOrder( 4, index ); |
1002 | 1003 | ||
1003 | 1004 | ||
1004 | if ( index == 0 ) { | 1005 | if ( index == 0 ) { |
1005 | 1006 | ||
1006 | txtAddress->setText( slBusinessAddress[0] ); | 1007 | txtAddress->setText( slBusinessAddress[0] ); |
1007 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 1008 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
1008 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 1009 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
1009 | txtCity->setText( slBusinessAddress[3] ); | 1010 | txtCity->setText( slBusinessAddress[3] ); |
1010 | txtState->setText( slBusinessAddress[4] ); | 1011 | txtState->setText( slBusinessAddress[4] ); |
1011 | txtZip->setText( slBusinessAddress[5] ); | 1012 | txtZip->setText( slBusinessAddress[5] ); |
1012 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1013 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1013 | txtTmp->setText( slBusinessAddress[6] ); | 1014 | txtTmp->setText( slBusinessAddress[6] ); |
1014 | 1015 | ||
1015 | } else { | 1016 | } else { |
1016 | 1017 | ||
1017 | txtAddress->setText( slHomeAddress[0] ); | 1018 | txtAddress->setText( slHomeAddress[0] ); |
1018 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 1019 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
1019 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 1020 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
1020 | txtCity->setText( slHomeAddress[3] ); | 1021 | txtCity->setText( slHomeAddress[3] ); |
1021 | txtState->setText( slHomeAddress[4] ); | 1022 | txtState->setText( slHomeAddress[4] ); |
1022 | txtZip->setText( slHomeAddress[5] ); | 1023 | txtZip->setText( slHomeAddress[5] ); |
1023 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1024 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1024 | txtTmp->setText( slHomeAddress[6] ); | 1025 | txtTmp->setText( slHomeAddress[6] ); |
1025 | 1026 | ||
1026 | } | 1027 | } |
1027 | 1028 | ||
1028 | } | 1029 | } |
1029 | 1030 | ||
1030 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1031 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
1031 | 1032 | ||
1032 | owarn << "ContactEditor::slotFullNameChange( " << textChanged << " )" << oendl; | 1033 | owarn << "ContactEditor::slotFullNameChange( " << textChanged << " )" << oendl; |
1033 | 1034 | ||
1034 | int index = cmbFileAs->currentItem(); | 1035 | int index = cmbFileAs->currentItem(); |
1035 | 1036 | ||
1036 | cmbFileAs->clear(); | 1037 | cmbFileAs->clear(); |
1037 | 1038 | ||
1038 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); | 1039 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); |
1039 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); | 1040 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); |
1040 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); | 1041 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); |
1041 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); | 1042 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); |
1042 | if ( ! txtSuffix->text().isEmpty() ) | 1043 | if ( ! txtSuffix->text().isEmpty() ) |
1043 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); | 1044 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); |
1044 | 1045 | ||
1045 | cmbFileAs->setCurrentItem( index ); | 1046 | cmbFileAs->setCurrentItem( index ); |
1046 | 1047 | ||
1047 | 1048 | ||
1048 | } | 1049 | } |
1049 | 1050 | ||
1050 | void ContactEditor::slotSuffixChange( const QString& ) { | 1051 | void ContactEditor::slotSuffixChange( const QString& ) { |
1051 | // Just want to update the FileAs combo if the suffix was changed.. | 1052 | // Just want to update the FileAs combo if the suffix was changed.. |
1052 | slotFullNameChange( txtFullName->text() ); | 1053 | slotFullNameChange( txtFullName->text() ); |
1053 | } | 1054 | } |
1054 | 1055 | ||
1055 | void ContactEditor::slotOrganizationChange( const QString &textChanged ){ | 1056 | void ContactEditor::slotOrganizationChange( const QString &textChanged ){ |
1056 | owarn << "ContactEditor::slotOrganizationChange( " << textChanged << " )" << oendl; | 1057 | owarn << "ContactEditor::slotOrganizationChange( " << textChanged << " )" << oendl; |
1057 | // Special handling for storing Companies: | 1058 | // Special handling for storing Companies: |
1058 | // If no Fullname is given, we store the Company-Name as lastname | 1059 | // If no Fullname is given, we store the Company-Name as lastname |
1059 | // to handle it like a person.. | 1060 | // to handle it like a person.. |
1060 | if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) | 1061 | if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) |
1061 | txtFullName->setText( textChanged ); | 1062 | txtFullName->setText( textChanged ); |
1062 | 1063 | ||
1063 | } | 1064 | } |
1064 | 1065 | ||
1065 | void ContactEditor::accept() { | 1066 | void ContactEditor::accept() { |
1066 | 1067 | ||
1067 | if ( isEmpty() ) { | 1068 | if ( isEmpty() ) { |
1068 | cleanupFields(); | 1069 | cleanupFields(); |
1069 | reject(); | 1070 | reject(); |
1070 | } else { | 1071 | } else { |
1071 | saveEntry(); | 1072 | saveEntry(); |
1072 | cleanupFields(); | 1073 | cleanupFields(); |
1073 | QDialog::accept(); | 1074 | QDialog::accept(); |
1074 | } | 1075 | } |
1075 | 1076 | ||
1076 | } | 1077 | } |
1077 | 1078 | ||
1078 | void ContactEditor::slotNote() { | 1079 | void ContactEditor::slotNote() { |
1079 | 1080 | ||
1080 | if ( ! QPEApplication::execDialog( dlgNote ) ) { | 1081 | if ( ! QPEApplication::execDialog( dlgNote ) ) { |
1081 | txtNote->setText( ent.notes() ); | 1082 | txtNote->setText( ent.notes() ); |
1082 | } | 1083 | } |
1083 | } | 1084 | } |
1084 | 1085 | ||
1085 | void ContactEditor::slotName() { | 1086 | void ContactEditor::slotName() { |
1086 | 1087 | ||
1087 | QString tmpName; | 1088 | QString tmpName; |
1088 | 1089 | ||
1089 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1090 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1090 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1091 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1091 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1092 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1092 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1093 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1093 | 1094 | ||
1094 | if ( QPEApplication::execDialog( dlgName ) ) { | 1095 | if ( QPEApplication::execDialog( dlgName ) ) { |
1095 | if ( txtLastName->text().contains( ' ', TRUE ) ) | 1096 | if ( txtLastName->text().contains( ' ', TRUE ) ) |
1096 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); | 1097 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); |
1097 | else | 1098 | else |
1098 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); | 1099 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); |
1099 | 1100 | ||
1100 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1101 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1101 | slotFullNameChange( txtFullName->text() ); | 1102 | slotFullNameChange( txtFullName->text() ); |
1102 | } | 1103 | } |
1103 | 1104 | ||
1104 | } | 1105 | } |
1105 | 1106 | ||
1106 | void ContactEditor::setNameFocus() { | 1107 | void ContactEditor::setNameFocus() { |
1107 | 1108 | ||
1108 | txtFullName->setFocus(); | 1109 | txtFullName->setFocus(); |
1109 | 1110 | ||
1110 | } | 1111 | } |
1111 | 1112 | ||
1112 | bool ContactEditor::isEmpty() { | 1113 | bool ContactEditor::isEmpty() { |
1113 | // Test and see if the record should be saved. | 1114 | // Test and see if the record should be saved. |
1114 | // More strict than the original qtopia, needs name or fileas to save | 1115 | // More strict than the original qtopia, needs name or fileas to save |
1115 | 1116 | ||
1116 | QString t = txtFullName->text(); | 1117 | QString t = txtFullName->text(); |
1117 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1118 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1118 | return false; | 1119 | return false; |
1119 | 1120 | ||
1120 | t = cmbFileAs->currentText(); | 1121 | t = cmbFileAs->currentText(); |
1121 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1122 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1122 | return false; | 1123 | return false; |
1123 | 1124 | ||
1124 | return true; | 1125 | return true; |
1125 | 1126 | ||
1126 | } | 1127 | } |
1127 | 1128 | ||
1128 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1129 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1129 | 1130 | ||
1130 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1131 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1131 | QString strFirstName; | 1132 | QString strFirstName; |
1132 | QString strMiddleName; | 1133 | QString strMiddleName; |
1133 | QString strLastName; | 1134 | QString strLastName; |
1134 | QString strTitle; | 1135 | QString strTitle; |
1135 | int commapos; | 1136 | int commapos; |
1136 | bool haveLastName = false; | 1137 | bool haveLastName = false; |
1137 | 1138 | ||
1138 | owarn << "Fullname: " << simplifiedName << oendl; | 1139 | owarn << "Fullname: " << simplifiedName << oendl; |
diff --git a/core/pim/addressbook/namelineedit.cpp b/core/pim/addressbook/namelineedit.cpp new file mode 100644 index 0000000..ba16e2c --- a/dev/null +++ b/core/pim/addressbook/namelineedit.cpp | |||
@@ -0,0 +1,55 @@ | |||
1 | #include "namelineedit.h" | ||
2 | |||
3 | namespace ABOOK { | ||
4 | NameLineEdit::NameLineEdit( QWidget* parent, const char* name ) | ||
5 | : QLineEdit( parent, name ), m_prevSpace( true ) { | ||
6 | } | ||
7 | |||
8 | NameLineEdit::NameLineEdit( const QString& str, QWidget* par, | ||
9 | const char* name ) | ||
10 | : QLineEdit( str, par, name ),m_prevSpace( true ) { | ||
11 | } | ||
12 | |||
13 | NameLineEdit::~NameLineEdit() { | ||
14 | } | ||
15 | |||
16 | void NameLineEdit::keyPressEvent( QKeyEvent* ev ) { | ||
17 | QString t = ev->text(); | ||
18 | int key = ev->key(); | ||
19 | int ascii = ev->ascii(); | ||
20 | |||
21 | // ### FIXME with composed events | ||
22 | if ( !t.isEmpty() && ( !ev->ascii() || ev->ascii()>=32 ) && | ||
23 | key != Key_Delete && key != Key_Backspace && | ||
24 | key != Key_Return && key != Key_Enter ) { | ||
25 | qWarning( "str " + ev->text() + " %d", m_prevSpace ); | ||
26 | |||
27 | if ( m_prevSpace ) { | ||
28 | t = t.upper(); | ||
29 | m_prevSpace = false; | ||
30 | } | ||
31 | if ( key == Key_Space ) | ||
32 | m_prevSpace = true; | ||
33 | |||
34 | |||
35 | QKeyEvent nEv(ev->type(), key, ascii, ev->state(), | ||
36 | t, ev->isAutoRepeat(), ev->count() ); | ||
37 | QLineEdit::keyPressEvent( &nEv ); | ||
38 | if ( !nEv.isAccepted() ) | ||
39 | ev->ignore(); | ||
40 | }else { | ||
41 | QLineEdit::keyPressEvent( ev ); | ||
42 | /* if key was a backspace lets see if we should | ||
43 | * capitalize the next letter | ||
44 | */ | ||
45 | if ( key == Key_Backspace ) { | ||
46 | QString te = text(); | ||
47 | /* if string is empty capitalize the first letter */ | ||
48 | /* else see if we're at the end of the string */ | ||
49 | if ( te.isEmpty() || cursorPosition() == te.length() ) | ||
50 | m_prevSpace = true; | ||
51 | } | ||
52 | } | ||
53 | } | ||
54 | |||
55 | } | ||
diff --git a/core/pim/addressbook/namelineedit.h b/core/pim/addressbook/namelineedit.h new file mode 100644 index 0000000..c719579 --- a/dev/null +++ b/core/pim/addressbook/namelineedit.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * (C) 2004 | ||
3 | * GPLv2 zecke@handhelds.org | ||
4 | * | ||
5 | */ | ||
6 | |||
7 | #ifndef ABOOK_NAME_LINE_EDIT | ||
8 | #define ABOOK_NAME_LINE_EDIT | ||
9 | |||
10 | #include <qlineedit.h> | ||
11 | |||
12 | namespace ABOOK { | ||
13 | /** | ||
14 | * small class to ease the input of names to capitalize them | ||
15 | * | ||
16 | */ | ||
17 | class NameLineEdit : public QLineEdit { | ||
18 | Q_OBJECT | ||
19 | public: | ||
20 | NameLineEdit( QWidget* parent, const char* name = 0 ); | ||
21 | NameLineEdit( const QString& str, QWidget* par, | ||
22 | const char *name = 0); | ||
23 | ~NameLineEdit(); | ||
24 | |||
25 | protected: | ||
26 | void keyPressEvent( QKeyEvent* ev ); | ||
27 | |||
28 | private: | ||
29 | bool m_prevSpace : 1; | ||
30 | }; | ||
31 | } | ||
32 | |||
33 | #endif | ||