-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,1751 +1,1752 @@ | |||
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; |
1139 | 1140 | ||
1140 | commapos = simplifiedName.find( ',', 0, TRUE); | 1141 | commapos = simplifiedName.find( ',', 0, TRUE); |
1141 | if ( commapos >= 0 ) { | 1142 | if ( commapos >= 0 ) { |
1142 | owarn << " Commapos: " << commapos << oendl; | 1143 | owarn << " Commapos: " << commapos << oendl; |
1143 | 1144 | ||
1144 | // A comma (",") separates the lastname from one or | 1145 | // A comma (",") separates the lastname from one or |
1145 | // many first names. Thus, remove the lastname from the | 1146 | // many first names. Thus, remove the lastname from the |
1146 | // String and parse the firstnames. | 1147 | // String and parse the firstnames. |
1147 | 1148 | ||
1148 | strLastName = simplifiedName.left( commapos ); | 1149 | strLastName = simplifiedName.left( commapos ); |
1149 | simplifiedName= simplifiedName.mid( commapos + 1 ); | 1150 | simplifiedName= simplifiedName.mid( commapos + 1 ); |
1150 | haveLastName = true; | 1151 | haveLastName = true; |
1151 | owarn << "Fullname without ',': " << simplifiedName << oendl; | 1152 | owarn << "Fullname without ',': " << simplifiedName << oendl; |
1152 | 1153 | ||
1153 | // If we have any lastname, we should now split all first names. | 1154 | // If we have any lastname, we should now split all first names. |
1154 | // The first one will be the used as first, the rest as "middle names" | 1155 | // The first one will be the used as first, the rest as "middle names" |
1155 | 1156 | ||
1156 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); | 1157 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); |
1157 | QStringList::Iterator it = allFirstNames.begin(); | 1158 | QStringList::Iterator it = allFirstNames.begin(); |
1158 | strFirstName = *it++; | 1159 | strFirstName = *it++; |
1159 | QStringList allSecondNames; | 1160 | QStringList allSecondNames; |
1160 | for ( ; it != allFirstNames.end(); ++it ) | 1161 | for ( ; it != allFirstNames.end(); ++it ) |
1161 | allSecondNames.append( *it ); | 1162 | allSecondNames.append( *it ); |
1162 | 1163 | ||
1163 | strMiddleName = allSecondNames.join(" "); | 1164 | strMiddleName = allSecondNames.join(" "); |
1164 | 1165 | ||
1165 | } else { | 1166 | } else { |
1166 | 1167 | ||
1167 | // No comma separator used: We use the first word as firstname, the | 1168 | // No comma separator used: We use the first word as firstname, the |
1168 | // last as second/lastname and everything in the middle as middlename | 1169 | // last as second/lastname and everything in the middle as middlename |
1169 | 1170 | ||
1170 | QStringList allNames = QStringList::split(" ", simplifiedName); | 1171 | QStringList allNames = QStringList::split(" ", simplifiedName); |
1171 | QStringList::Iterator it = allNames.begin(); | 1172 | QStringList::Iterator it = allNames.begin(); |
1172 | strFirstName = *it++; | 1173 | strFirstName = *it++; |
1173 | QStringList allSecondNames; | 1174 | QStringList allSecondNames; |
1174 | for ( ; it != --allNames.end(); ++it ) | 1175 | for ( ; it != --allNames.end(); ++it ) |
1175 | allSecondNames.append( *it ); | 1176 | allSecondNames.append( *it ); |
1176 | 1177 | ||
1177 | strMiddleName = allSecondNames.join(" "); | 1178 | strMiddleName = allSecondNames.join(" "); |
1178 | strLastName = *(--allNames.end()); | 1179 | strLastName = *(--allNames.end()); |
1179 | 1180 | ||
1180 | } | 1181 | } |
1181 | 1182 | ||
1182 | if ( strFirstName == strLastName ) | 1183 | if ( strFirstName == strLastName ) |
1183 | strFirstName = ""; | 1184 | strFirstName = ""; |
1184 | 1185 | ||
1185 | owarn << "strFirstName: " << strFirstName << oendl; | 1186 | owarn << "strFirstName: " << strFirstName << oendl; |
1186 | owarn << "strMiddletName: " << strMiddleName << oendl; | 1187 | owarn << "strMiddletName: " << strMiddleName << oendl; |
1187 | owarn << "strLastName: " << strLastName << oendl; | 1188 | owarn << "strLastName: " << strLastName << oendl; |
1188 | owarn << "strTitle: " << strTitle << oendl; | 1189 | owarn << "strTitle: " << strTitle << oendl; |
1189 | 1190 | ||
1190 | switch (type) { | 1191 | switch (type) { |
1191 | case NAME_FL: | 1192 | case NAME_FL: |
1192 | return strFirstName + " " + strLastName; | 1193 | return strFirstName + " " + strLastName; |
1193 | 1194 | ||
1194 | case NAME_LF: | 1195 | case NAME_LF: |
1195 | return strLastName + ", " + strFirstName; | 1196 | return strLastName + ", " + strFirstName; |
1196 | 1197 | ||
1197 | case NAME_LFM: | 1198 | case NAME_LFM: |
1198 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1199 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1199 | 1200 | ||
1200 | case NAME_FML: | 1201 | case NAME_FML: |
1201 | return strFirstName + " " + strMiddleName + " " + strLastName ; | 1202 | return strFirstName + " " + strMiddleName + " " + strLastName ; |
1202 | 1203 | ||
1203 | case NAME_F: | 1204 | case NAME_F: |
1204 | return strFirstName; | 1205 | return strFirstName; |
1205 | 1206 | ||
1206 | case NAME_M: | 1207 | case NAME_M: |
1207 | return strMiddleName; | 1208 | return strMiddleName; |
1208 | 1209 | ||
1209 | case NAME_L: | 1210 | case NAME_L: |
1210 | return strLastName; | 1211 | return strLastName; |
1211 | 1212 | ||
1212 | case NAME_S: | 1213 | case NAME_S: |
1213 | return txtSuffix->text(); | 1214 | return txtSuffix->text(); |
1214 | 1215 | ||
1215 | } | 1216 | } |
1216 | return QString::null; | 1217 | return QString::null; |
1217 | } | 1218 | } |
1218 | 1219 | ||
1219 | void ContactEditor::cleanupFields() { | 1220 | void ContactEditor::cleanupFields() { |
1220 | QStringList::Iterator it = slChooserValues.begin(); | 1221 | QStringList::Iterator it = slChooserValues.begin(); |
1221 | 1222 | ||
1222 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1223 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1223 | (*it) = ""; | 1224 | (*it) = ""; |
1224 | } | 1225 | } |
1225 | 1226 | ||
1226 | for ( int i = 0; i < 7; i++ ) { | 1227 | for ( int i = 0; i < 7; i++ ) { |
1227 | slHomeAddress[i] = ""; | 1228 | slHomeAddress[i] = ""; |
1228 | slBusinessAddress[i] = ""; | 1229 | slBusinessAddress[i] = ""; |
1229 | } | 1230 | } |
1230 | 1231 | ||
1231 | QListIterator<QLineEdit> itLV( listValue ); | 1232 | QListIterator<QLineEdit> itLV( listValue ); |
1232 | for ( ; itLV.current(); ++itLV ) { | 1233 | for ( ; itLV.current(); ++itLV ) { |
1233 | (*itLV)->setText( "" ); | 1234 | (*itLV)->setText( "" ); |
1234 | } | 1235 | } |
1235 | 1236 | ||
1236 | txtFirstName->setText(""); | 1237 | txtFirstName->setText(""); |
1237 | txtMiddleName->setText(""); | 1238 | txtMiddleName->setText(""); |
1238 | txtLastName->setText(""); | 1239 | txtLastName->setText(""); |
1239 | txtSuffix->setText(""); | 1240 | txtSuffix->setText(""); |
1240 | txtNote->setText(""); | 1241 | txtNote->setText(""); |
1241 | txtFullName->setText(""); | 1242 | txtFullName->setText(""); |
1242 | txtJobTitle->setText(""); | 1243 | txtJobTitle->setText(""); |
1243 | txtOrganization->setText(""); | 1244 | txtOrganization->setText(""); |
1244 | txtChooserField1->setText(""); | 1245 | txtChooserField1->setText(""); |
1245 | txtChooserField2->setText(""); | 1246 | txtChooserField2->setText(""); |
1246 | txtChooserField3->setText(""); | 1247 | txtChooserField3->setText(""); |
1247 | txtAddress->setText(""); | 1248 | txtAddress->setText(""); |
1248 | txtCity->setText(""); | 1249 | txtCity->setText(""); |
1249 | txtState->setText(""); | 1250 | txtState->setText(""); |
1250 | txtZip->setText(""); | 1251 | txtZip->setText(""); |
1251 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1252 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1252 | txtTmp->setText(""); | 1253 | txtTmp->setText(""); |
1253 | txtTmp = cmbFileAs->lineEdit(); | 1254 | txtTmp = cmbFileAs->lineEdit(); |
1254 | txtTmp->setText(""); | 1255 | txtTmp->setText(""); |
1255 | 1256 | ||
1256 | } | 1257 | } |
1257 | 1258 | ||
1258 | void ContactEditor::setEntry( const Opie::OPimContact &entry ) { | 1259 | void ContactEditor::setEntry( const Opie::OPimContact &entry ) { |
1259 | 1260 | ||
1260 | initializing = true; | 1261 | initializing = true; |
1261 | 1262 | ||
1262 | // Cleanup and activate the general Page .. | 1263 | // Cleanup and activate the general Page .. |
1263 | cleanupFields(); | 1264 | cleanupFields(); |
1264 | tabMain->setCurrentPage( 0 ); | 1265 | tabMain->setCurrentPage( 0 ); |
1265 | 1266 | ||
1266 | ent = entry; | 1267 | ent = entry; |
1267 | 1268 | ||
1268 | emails = QStringList(ent.emailList()); | 1269 | emails = QStringList(ent.emailList()); |
1269 | defaultEmail = ent.defaultEmail(); | 1270 | defaultEmail = ent.defaultEmail(); |
1270 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1271 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1271 | odebug << "default email=" << defaultEmail << oendl; | 1272 | odebug << "default email=" << defaultEmail << oendl; |
1272 | 1273 | ||
1273 | txtFirstName->setText( ent.firstName() ); | 1274 | txtFirstName->setText( ent.firstName() ); |
1274 | txtMiddleName->setText( ent.middleName() ); | 1275 | txtMiddleName->setText( ent.middleName() ); |
1275 | txtLastName->setText( ent.lastName() ); | 1276 | txtLastName->setText( ent.lastName() ); |
1276 | txtSuffix->setText( ent.suffix() ); | 1277 | txtSuffix->setText( ent.suffix() ); |
1277 | 1278 | ||
1278 | // QString *tmpString = new QString; | 1279 | // QString *tmpString = new QString; |
1279 | // *tmpString = ent.firstName() + " " + ent.middleName() + | 1280 | // *tmpString = ent.firstName() + " " + ent.middleName() + |
1280 | // + " " + ent.lastName() + " " + ent.suffix(); | 1281 | // + " " + ent.lastName() + " " + ent.suffix(); |
1281 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1282 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1282 | 1283 | ||
1283 | if ( !ent.isEmpty() ){ | 1284 | if ( !ent.isEmpty() ){ |
1284 | // Lastnames with multiple words need to be protected by a comma ! | 1285 | // Lastnames with multiple words need to be protected by a comma ! |
1285 | if ( ent.lastName().contains( ' ', TRUE ) ) | 1286 | if ( ent.lastName().contains( ' ', TRUE ) ) |
1286 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); | 1287 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); |
1287 | else | 1288 | else |
1288 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | 1289 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); |
1289 | } | 1290 | } |
1290 | 1291 | ||
1291 | cmbFileAs->setEditText( ent.fileAs() ); | 1292 | cmbFileAs->setEditText( ent.fileAs() ); |
1292 | 1293 | ||
1293 | //if (hasTitle) | 1294 | //if (hasTitle) |
1294 | txtJobTitle->setText( ent.jobTitle() ); | 1295 | txtJobTitle->setText( ent.jobTitle() ); |
1295 | 1296 | ||
1296 | //if (hasCompany) | 1297 | //if (hasCompany) |
1297 | txtOrganization->setText( ent.company() ); | 1298 | txtOrganization->setText( ent.company() ); |
1298 | 1299 | ||
1299 | //if (hasNotes) | 1300 | //if (hasNotes) |
1300 | txtNote->setText( ent.notes() ); | 1301 | txtNote->setText( ent.notes() ); |
1301 | 1302 | ||
1302 | //if (hasStreet) { | 1303 | //if (hasStreet) { |
1303 | slHomeAddress[0] = ent.homeStreet(); | 1304 | slHomeAddress[0] = ent.homeStreet(); |
1304 | slBusinessAddress[0] = ent.businessStreet(); | 1305 | slBusinessAddress[0] = ent.businessStreet(); |
1305 | //} | 1306 | //} |
1306 | 1307 | ||
1307 | //if (hasCity) { | 1308 | //if (hasCity) { |
1308 | slHomeAddress[3] = ent.homeCity(); | 1309 | slHomeAddress[3] = ent.homeCity(); |
1309 | slBusinessAddress[3] = ent.businessCity(); | 1310 | slBusinessAddress[3] = ent.businessCity(); |
1310 | //} | 1311 | //} |
1311 | 1312 | ||
1312 | //if (hasState) { | 1313 | //if (hasState) { |
1313 | slHomeAddress[4] = ent.homeState(); | 1314 | slHomeAddress[4] = ent.homeState(); |
1314 | slBusinessAddress[4] = ent.businessState(); | 1315 | slBusinessAddress[4] = ent.businessState(); |
1315 | //} | 1316 | //} |
1316 | 1317 | ||
1317 | //if (hasZip) { | 1318 | //if (hasZip) { |
1318 | slHomeAddress[5] = ent.homeZip(); | 1319 | slHomeAddress[5] = ent.homeZip(); |
1319 | slBusinessAddress[5] = ent.businessZip(); | 1320 | slBusinessAddress[5] = ent.businessZip(); |
1320 | //} | 1321 | //} |
1321 | 1322 | ||
1322 | //if (hasCountry) { | 1323 | //if (hasCountry) { |
1323 | slHomeAddress[6] = ent.homeCountry(); | 1324 | slHomeAddress[6] = ent.homeCountry(); |
1324 | slBusinessAddress[6] = ent.businessCountry(); | 1325 | slBusinessAddress[6] = ent.businessCountry(); |
1325 | //} | 1326 | //} |
1326 | 1327 | ||
1327 | QStringList::ConstIterator it; | 1328 | QStringList::ConstIterator it; |
1328 | QListIterator<QLineEdit> itLE( listValue ); | 1329 | QListIterator<QLineEdit> itLE( listValue ); |
1329 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { | 1330 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1330 | 1331 | ||
1331 | owarn << " Filling dynamic Field: " << (*it) << oendl; | 1332 | owarn << " Filling dynamic Field: " << (*it) << oendl; |
1332 | 1333 | ||
1333 | if ( *it == "Department" ) | 1334 | if ( *it == "Department" ) |
1334 | (*itLE)->setText( ent.department() ); | 1335 | (*itLE)->setText( ent.department() ); |
1335 | 1336 | ||
1336 | if ( *it == "Company" ) | 1337 | if ( *it == "Company" ) |
1337 | (*itLE)->setText( ent.company() ); | 1338 | (*itLE)->setText( ent.company() ); |
1338 | 1339 | ||
1339 | if ( *it == "Office" ) | 1340 | if ( *it == "Office" ) |
1340 | (*itLE)->setText( ent.office() ); | 1341 | (*itLE)->setText( ent.office() ); |
1341 | 1342 | ||
1342 | if ( *it == "Profession" ) | 1343 | if ( *it == "Profession" ) |
1343 | (*itLE)->setText( ent.profession() ); | 1344 | (*itLE)->setText( ent.profession() ); |
1344 | 1345 | ||
1345 | if ( *it == "Assistant" ) | 1346 | if ( *it == "Assistant" ) |
1346 | (*itLE)->setText( ent.assistant() ); | 1347 | (*itLE)->setText( ent.assistant() ); |
1347 | 1348 | ||
1348 | if ( *it == "Manager" ) | 1349 | if ( *it == "Manager" ) |
1349 | (*itLE)->setText( ent.manager() ); | 1350 | (*itLE)->setText( ent.manager() ); |
1350 | 1351 | ||
1351 | if ( *it == "Spouse" ) | 1352 | if ( *it == "Spouse" ) |
1352 | (*itLE)->setText( ent.spouse() ); | 1353 | (*itLE)->setText( ent.spouse() ); |
1353 | 1354 | ||
1354 | if ( *it == "Nickname" ){ | 1355 | if ( *it == "Nickname" ){ |
1355 | owarn << "**** Nichname: " << ent.nickname() << oendl; | 1356 | owarn << "**** Nichname: " << ent.nickname() << oendl; |
1356 | (*itLE)->setText( ent.nickname() ); | 1357 | (*itLE)->setText( ent.nickname() ); |
1357 | } | 1358 | } |
1358 | 1359 | ||
1359 | if ( *it == "Children" ) | 1360 | if ( *it == "Children" ) |
1360 | (*itLE)->setText( ent.children() ); | 1361 | (*itLE)->setText( ent.children() ); |
1361 | 1362 | ||
1362 | } | 1363 | } |
1363 | 1364 | ||
1364 | QStringList::Iterator itV; | 1365 | QStringList::Iterator itV; |
1365 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1366 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1366 | 1367 | ||
1367 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1368 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1368 | *itV = ent.businessPhone(); | 1369 | *itV = ent.businessPhone(); |
1369 | /* | 1370 | /* |
1370 | if ( *it == "Business 2 Phone" ) | 1371 | if ( *it == "Business 2 Phone" ) |
1371 | *itV = ent.business2Phone(); | 1372 | *itV = ent.business2Phone(); |
1372 | */ | 1373 | */ |
1373 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1374 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1374 | *itV = ent.businessFax(); | 1375 | *itV = ent.businessFax(); |
1375 | 1376 | ||
1376 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1377 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1377 | *itV = ent.businessMobile(); | 1378 | *itV = ent.businessMobile(); |
1378 | /* | 1379 | /* |
1379 | if ( *it == "Company Phone" ) | 1380 | if ( *it == "Company Phone" ) |
1380 | *itV = ent.companyPhone(); | 1381 | *itV = ent.companyPhone(); |
1381 | */ | 1382 | */ |
1382 | if ( *it == "Default Email" ) | 1383 | if ( *it == "Default Email" ) |
1383 | *itV = ent.defaultEmail(); | 1384 | *itV = ent.defaultEmail(); |
1384 | 1385 | ||
1385 | if ( *it == "Emails" ) | 1386 | if ( *it == "Emails" ) |
1386 | *itV = ent.emailList().join(", "); // :SX | 1387 | *itV = ent.emailList().join(", "); // :SX |
1387 | 1388 | ||
1388 | if ( *it == "Home Phone" ) | 1389 | if ( *it == "Home Phone" ) |
1389 | *itV = ent.homePhone(); | 1390 | *itV = ent.homePhone(); |
1390 | /* | 1391 | /* |
1391 | if ( *it == "Home 2 Phone" ) | 1392 | if ( *it == "Home 2 Phone" ) |
1392 | *itV = ent.home2Phone(); | 1393 | *itV = ent.home2Phone(); |
1393 | */ | 1394 | */ |
1394 | if ( *it == "Home Fax" ) | 1395 | if ( *it == "Home Fax" ) |
1395 | *itV = ent.homeFax(); | 1396 | *itV = ent.homeFax(); |
1396 | 1397 | ||
1397 | if ( *it == "Home Mobile" ) | 1398 | if ( *it == "Home Mobile" ) |
1398 | *itV = ent.homeMobile(); | 1399 | *itV = ent.homeMobile(); |
1399 | /* | 1400 | /* |
1400 | if ( *it == "Car Phone" ) | 1401 | if ( *it == "Car Phone" ) |
1401 | *itV = ent.carPhone(); | 1402 | *itV = ent.carPhone(); |
1402 | 1403 | ||
1403 | if ( *it == "ISDN Phone" ) | 1404 | if ( *it == "ISDN Phone" ) |
1404 | *itV = ent.ISDNPhone(); | 1405 | *itV = ent.ISDNPhone(); |
1405 | 1406 | ||
1406 | if ( *it == "Other Phone" ) | 1407 | if ( *it == "Other Phone" ) |
1407 | *itV = ent.otherPhone(); | 1408 | *itV = ent.otherPhone(); |
1408 | */ | 1409 | */ |
1409 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1410 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1410 | *itV = ent.businessPager(); | 1411 | *itV = ent.businessPager(); |
1411 | /* | 1412 | /* |
1412 | if ( *it == "Home Pager") | 1413 | if ( *it == "Home Pager") |
1413 | *itV = ent.homePager(); | 1414 | *itV = ent.homePager(); |
1414 | 1415 | ||
1415 | if ( *it == "AIM IM" ) | 1416 | if ( *it == "AIM IM" ) |
1416 | *itV = ent.AIMIM(); | 1417 | *itV = ent.AIMIM(); |
1417 | 1418 | ||
1418 | if ( *it == "ICQ IM" ) | 1419 | if ( *it == "ICQ IM" ) |
1419 | *itV = ent.ICQIM(); | 1420 | *itV = ent.ICQIM(); |
1420 | 1421 | ||
1421 | if ( *it == "Jabber IM" ) | 1422 | if ( *it == "Jabber IM" ) |
1422 | *itV = ent.jabberIM(); | 1423 | *itV = ent.jabberIM(); |
1423 | 1424 | ||
1424 | if ( *it == "MSN IM" ) | 1425 | if ( *it == "MSN IM" ) |
1425 | *itV = ent.MSNIM(); | 1426 | *itV = ent.MSNIM(); |
1426 | 1427 | ||
1427 | if ( *it == "Yahoo IM" ) | 1428 | if ( *it == "Yahoo IM" ) |
1428 | *itV = ent.yahooIM(); | 1429 | *itV = ent.yahooIM(); |
1429 | */ | 1430 | */ |
1430 | if ( *it == "Home Web Page" ) | 1431 | if ( *it == "Home Web Page" ) |
1431 | *itV = ent.homeWebpage(); | 1432 | *itV = ent.homeWebpage(); |
1432 | 1433 | ||
1433 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1434 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1434 | *itV = ent.businessWebpage(); | 1435 | *itV = ent.businessWebpage(); |
1435 | 1436 | ||
1436 | 1437 | ||
1437 | } | 1438 | } |
1438 | 1439 | ||
1439 | 1440 | ||
1440 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1441 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1441 | 1442 | ||
1442 | QString gender = ent.gender(); | 1443 | QString gender = ent.gender(); |
1443 | cmbGender->setCurrentItem( gender.toInt() ); | 1444 | cmbGender->setCurrentItem( gender.toInt() ); |
1444 | 1445 | ||
1445 | txtNote->setText( ent.notes() ); | 1446 | txtNote->setText( ent.notes() ); |
1446 | 1447 | ||
1447 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1448 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1448 | 1449 | ||
1449 | // Get combo-settings from contact and set preset.. | 1450 | // Get combo-settings from contact and set preset.. |
1450 | contactfields.loadFromRecord( ent ); | 1451 | contactfields.loadFromRecord( ent ); |
1451 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); | 1452 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); |
1452 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); | 1453 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); |
1453 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); | 1454 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); |
1454 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); | 1455 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); |
1455 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); | 1456 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); |
1456 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1457 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1457 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1458 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1458 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1459 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1459 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); | 1460 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); |
1460 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1461 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1461 | 1462 | ||
1462 | updateDatePicker(); | 1463 | updateDatePicker(); |
1463 | 1464 | ||
1464 | initializing = false; | 1465 | initializing = false; |
1465 | } | 1466 | } |
1466 | void ContactEditor::updateDatePicker() | 1467 | void ContactEditor::updateDatePicker() |
1467 | { | 1468 | { |
1468 | // Set DatePicker | 1469 | // Set DatePicker |
1469 | if ( !ent.birthday().isNull() ){ | 1470 | if ( !ent.birthday().isNull() ){ |
1470 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); | 1471 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); |
1471 | birthdayPicker->setDate( ent.birthday() ); | 1472 | birthdayPicker->setDate( ent.birthday() ); |
1472 | } else | 1473 | } else |
1473 | birthdayButton->setText( tr ("Unknown") ); | 1474 | birthdayButton->setText( tr ("Unknown") ); |
1474 | 1475 | ||
1475 | if ( !ent.anniversary().isNull() ){ | 1476 | if ( !ent.anniversary().isNull() ){ |
1476 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); | 1477 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); |
1477 | anniversaryPicker->setDate( ent.anniversary() ); | 1478 | anniversaryPicker->setDate( ent.anniversary() ); |
1478 | } else | 1479 | } else |
1479 | anniversaryButton->setText( tr ("Unknown") ); | 1480 | anniversaryButton->setText( tr ("Unknown") ); |
1480 | 1481 | ||
1481 | } | 1482 | } |
1482 | 1483 | ||
1483 | void ContactEditor::saveEntry() { | 1484 | void ContactEditor::saveEntry() { |
1484 | 1485 | ||
1485 | // Store current combo into contact | 1486 | // Store current combo into contact |
1486 | contactfields.saveToRecord( ent ); | 1487 | contactfields.saveToRecord( ent ); |
1487 | 1488 | ||
1488 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1489 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1489 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1490 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1490 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1491 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1491 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1492 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1492 | 1493 | ||
1493 | ent.setFirstName( txtFirstName->text() ); | 1494 | ent.setFirstName( txtFirstName->text() ); |
1494 | ent.setLastName( txtLastName->text() ); | 1495 | ent.setLastName( txtLastName->text() ); |
1495 | ent.setMiddleName( txtMiddleName->text() ); | 1496 | ent.setMiddleName( txtMiddleName->text() ); |
1496 | ent.setSuffix( txtSuffix->text() ); | 1497 | ent.setSuffix( txtSuffix->text() ); |
1497 | 1498 | ||
1498 | ent.setFileAs( cmbFileAs->currentText() ); | 1499 | ent.setFileAs( cmbFileAs->currentText() ); |
1499 | 1500 | ||
1500 | ent.setCategories( cmbCat->currentCategories() ); | 1501 | ent.setCategories( cmbCat->currentCategories() ); |
1501 | 1502 | ||
1502 | 1503 | ||
1503 | //if (hasTitle) | 1504 | //if (hasTitle) |
1504 | ent.setJobTitle( txtJobTitle->text() ); | 1505 | ent.setJobTitle( txtJobTitle->text() ); |
1505 | 1506 | ||
1506 | //if (hasCompany) | 1507 | //if (hasCompany) |
1507 | ent.setCompany( txtOrganization->text() ); | 1508 | ent.setCompany( txtOrganization->text() ); |
1508 | 1509 | ||
1509 | //if (hasNotes) | 1510 | //if (hasNotes) |
1510 | ent.setNotes( txtNote->text() ); | 1511 | ent.setNotes( txtNote->text() ); |
1511 | 1512 | ||
1512 | //if (hasStreet) { | 1513 | //if (hasStreet) { |
1513 | ent.setHomeStreet( slHomeAddress[0] ); | 1514 | ent.setHomeStreet( slHomeAddress[0] ); |
1514 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1515 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1515 | //} | 1516 | //} |
1516 | 1517 | ||
1517 | //if (hasCity) { | 1518 | //if (hasCity) { |
1518 | ent.setHomeCity( slHomeAddress[3] ); | 1519 | ent.setHomeCity( slHomeAddress[3] ); |
1519 | ent.setBusinessCity( slBusinessAddress[3] ); | 1520 | ent.setBusinessCity( slBusinessAddress[3] ); |
1520 | //} | 1521 | //} |
1521 | 1522 | ||
1522 | //if (hasState) { | 1523 | //if (hasState) { |
1523 | ent.setHomeState( slHomeAddress[4] ); | 1524 | ent.setHomeState( slHomeAddress[4] ); |
1524 | ent.setBusinessState( slBusinessAddress[4] ); | 1525 | ent.setBusinessState( slBusinessAddress[4] ); |
1525 | //} | 1526 | //} |
1526 | 1527 | ||
1527 | //if (hasZip) { | 1528 | //if (hasZip) { |
1528 | ent.setHomeZip( slHomeAddress[5] ); | 1529 | ent.setHomeZip( slHomeAddress[5] ); |
1529 | ent.setBusinessZip( slBusinessAddress[5] ); | 1530 | ent.setBusinessZip( slBusinessAddress[5] ); |
1530 | //} | 1531 | //} |
1531 | 1532 | ||
1532 | //if (hasCountry) { | 1533 | //if (hasCountry) { |
1533 | ent.setHomeCountry( slHomeAddress[6] ); | 1534 | ent.setHomeCountry( slHomeAddress[6] ); |
1534 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1535 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1535 | //} | 1536 | //} |
1536 | 1537 | ||
1537 | QStringList::ConstIterator it; | 1538 | QStringList::ConstIterator it; |
1538 | QListIterator<QLineEdit> itLE( listValue ); | 1539 | QListIterator<QLineEdit> itLE( listValue ); |
1539 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { | 1540 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { |
1540 | 1541 | ||
1541 | if ( *it == "Department" ) | 1542 | if ( *it == "Department" ) |
1542 | ent.setDepartment( (*itLE)->text() ); | 1543 | ent.setDepartment( (*itLE)->text() ); |
1543 | 1544 | ||
1544 | if ( *it == "Company" ) | 1545 | if ( *it == "Company" ) |
1545 | ent.setCompany( (*itLE)->text() ); | 1546 | ent.setCompany( (*itLE)->text() ); |
1546 | 1547 | ||
1547 | if ( *it == "Office" ) | 1548 | if ( *it == "Office" ) |
1548 | ent.setOffice( (*itLE)->text() ); | 1549 | ent.setOffice( (*itLE)->text() ); |
1549 | 1550 | ||
1550 | if ( *it == "Profession" ) | 1551 | if ( *it == "Profession" ) |
1551 | ent.setProfession( (*itLE)->text() ); | 1552 | ent.setProfession( (*itLE)->text() ); |
1552 | 1553 | ||
1553 | if ( *it == "Assistant" ) | 1554 | if ( *it == "Assistant" ) |
1554 | ent.setAssistant( (*itLE)->text() ); | 1555 | ent.setAssistant( (*itLE)->text() ); |
1555 | 1556 | ||
1556 | if ( *it == "Manager" ) | 1557 | if ( *it == "Manager" ) |
1557 | ent.setManager( (*itLE)->text() ); | 1558 | ent.setManager( (*itLE)->text() ); |
1558 | 1559 | ||
1559 | if ( *it == "Spouse" ) | 1560 | if ( *it == "Spouse" ) |
1560 | ent.setSpouse( (*itLE)->text() ); | 1561 | ent.setSpouse( (*itLE)->text() ); |
1561 | 1562 | ||
1562 | if ( *it == "Nickname" ) | 1563 | if ( *it == "Nickname" ) |
1563 | ent.setNickname( (*itLE)->text() ); | 1564 | ent.setNickname( (*itLE)->text() ); |
1564 | 1565 | ||
1565 | if ( *it == "Children" ) | 1566 | if ( *it == "Children" ) |
1566 | ent.setChildren( (*itLE)->text() ); | 1567 | ent.setChildren( (*itLE)->text() ); |
1567 | 1568 | ||
1568 | } | 1569 | } |
1569 | 1570 | ||
1570 | 1571 | ||
1571 | QStringList::ConstIterator itV; | 1572 | QStringList::ConstIterator itV; |
1572 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1573 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1573 | 1574 | ||
1574 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1575 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1575 | ent.setBusinessPhone( *itV ); | 1576 | ent.setBusinessPhone( *itV ); |
1576 | 1577 | ||
1577 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1578 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1578 | ent.setBusinessFax( *itV ); | 1579 | ent.setBusinessFax( *itV ); |
1579 | 1580 | ||
1580 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1581 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1581 | ent.setBusinessMobile( *itV ); | 1582 | ent.setBusinessMobile( *itV ); |
1582 | 1583 | ||
1583 | if ( *it == "Emails" ){ | 1584 | if ( *it == "Emails" ){ |
1584 | QString allemail; | 1585 | QString allemail; |
1585 | QString defaultmail; | 1586 | QString defaultmail; |
1586 | parseEmailFrom( emails.join(","), defaultmail, allemail ); | 1587 | parseEmailFrom( emails.join(","), defaultmail, allemail ); |
1587 | if ( defaultEmail.isEmpty() ){ | 1588 | if ( defaultEmail.isEmpty() ){ |
1588 | owarn << "Default email was not set by user!" << oendl; | 1589 | owarn << "Default email was not set by user!" << oendl; |
1589 | owarn << "Using first email in list: " << defaultmail << oendl; | 1590 | owarn << "Using first email in list: " << defaultmail << oendl; |
1590 | ent.setDefaultEmail( defaultmail ); | 1591 | ent.setDefaultEmail( defaultmail ); |
1591 | } | 1592 | } |
1592 | ent.setEmails( allemail ); | 1593 | ent.setEmails( allemail ); |
1593 | } | 1594 | } |
1594 | 1595 | ||
1595 | if ( *it == "Default Email") | 1596 | if ( *it == "Default Email") |
1596 | ent.setDefaultEmail( defaultEmail /* *itV */ ); | 1597 | ent.setDefaultEmail( defaultEmail /* *itV */ ); |
1597 | 1598 | ||
1598 | if ( *it == "Home Phone" ) | 1599 | if ( *it == "Home Phone" ) |
1599 | ent.setHomePhone( *itV ); | 1600 | ent.setHomePhone( *itV ); |
1600 | 1601 | ||
1601 | if ( *it == "Home Fax" ) | 1602 | if ( *it == "Home Fax" ) |
1602 | ent.setHomeFax( *itV ); | 1603 | ent.setHomeFax( *itV ); |
1603 | 1604 | ||
1604 | if ( *it == "Home Mobile" ) | 1605 | if ( *it == "Home Mobile" ) |
1605 | ent.setHomeMobile( *itV ); | 1606 | ent.setHomeMobile( *itV ); |
1606 | 1607 | ||
1607 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1608 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1608 | ent.setBusinessPager( *itV ); | 1609 | ent.setBusinessPager( *itV ); |
1609 | 1610 | ||
1610 | if ( *it == "Home Web Page" ) | 1611 | if ( *it == "Home Web Page" ) |
1611 | ent.setHomeWebpage( *itV ); | 1612 | ent.setHomeWebpage( *itV ); |
1612 | 1613 | ||
1613 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1614 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1614 | ent.setBusinessWebpage( *itV ); | 1615 | ent.setBusinessWebpage( *itV ); |
1615 | 1616 | ||
1616 | 1617 | ||
1617 | } | 1618 | } |
1618 | 1619 | ||
1619 | int gender = cmbGender->currentItem(); | 1620 | int gender = cmbGender->currentItem(); |
1620 | ent.setGender( QString::number( gender ) ); | 1621 | ent.setGender( QString::number( gender ) ); |
1621 | 1622 | ||
1622 | QString str = txtNote->text(); | 1623 | QString str = txtNote->text(); |
1623 | if ( !str.isNull() ) | 1624 | if ( !str.isNull() ) |
1624 | ent.setNotes( str ); | 1625 | ent.setNotes( str ); |
1625 | 1626 | ||
1626 | } | 1627 | } |
1627 | 1628 | ||
1628 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1629 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1629 | QString &strAll ) | 1630 | QString &strAll ) |
1630 | { | 1631 | { |
1631 | int where, | 1632 | int where, |
1632 | start; | 1633 | start; |
1633 | if ( txt.isEmpty() ) | 1634 | if ( txt.isEmpty() ) |
1634 | return; | 1635 | return; |
1635 | // find the first | 1636 | // find the first |
1636 | where = txt.find( ',' ); | 1637 | where = txt.find( ',' ); |
1637 | if ( where < 0 ) { | 1638 | if ( where < 0 ) { |
1638 | strDefaultEmail = txt; | 1639 | strDefaultEmail = txt; |
1639 | strAll = txt; | 1640 | strAll = txt; |
1640 | } else { | 1641 | } else { |
1641 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1642 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1642 | strAll = strDefaultEmail; | 1643 | strAll = strDefaultEmail; |
1643 | while ( where > -1 ) { | 1644 | while ( where > -1 ) { |
1644 | strAll.append(" "); | 1645 | strAll.append(" "); |
1645 | start = where; | 1646 | start = where; |
1646 | where = txt.find( ',', where + 1 ); | 1647 | where = txt.find( ',', where + 1 ); |
1647 | if ( where > - 1 ) | 1648 | if ( where > - 1 ) |
1648 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1649 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1649 | else // grab until the end... | 1650 | else // grab until the end... |
1650 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1651 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1651 | } | 1652 | } |
1652 | } | 1653 | } |
1653 | } | 1654 | } |
1654 | 1655 | ||
1655 | void parseEmailTo( const QString &strDefaultEmail, | 1656 | void parseEmailTo( const QString &strDefaultEmail, |
1656 | const QString &strOtherEmail, QString &strBack ) | 1657 | const QString &strOtherEmail, QString &strBack ) |
1657 | { | 1658 | { |
1658 | // create a comma dilimeted set of emails... | 1659 | // create a comma dilimeted set of emails... |
1659 | // use the power of short circuiting... | 1660 | // use the power of short circuiting... |
1660 | bool foundDefault = false; | 1661 | bool foundDefault = false; |
1661 | QString strTmp; | 1662 | QString strTmp; |
1662 | int start = 0; | 1663 | int start = 0; |
1663 | int where; | 1664 | int where; |
1664 | // start at the beginng. | 1665 | // start at the beginng. |
1665 | strBack = strDefaultEmail; | 1666 | strBack = strDefaultEmail; |
1666 | where = 0; | 1667 | where = 0; |
1667 | while ( where > -1 ) { | 1668 | while ( where > -1 ) { |
1668 | start = where; | 1669 | start = where; |
1669 | where = strOtherEmail.find( ' ', where + 1 ); | 1670 | where = strOtherEmail.find( ' ', where + 1 ); |
1670 | if ( where > 0 ) { | 1671 | if ( where > 0 ) { |
1671 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1672 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1672 | } else | 1673 | } else |
1673 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 1674 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
1674 | if ( foundDefault || strTmp != strDefaultEmail ) { | 1675 | if ( foundDefault || strTmp != strDefaultEmail ) { |
1675 | strBack.append( ", " ); | 1676 | strBack.append( ", " ); |
1676 | strBack.append( strTmp ); | 1677 | strBack.append( strTmp ); |
1677 | } else | 1678 | } else |
1678 | foundDefault = true; | 1679 | foundDefault = true; |
1679 | } | 1680 | } |
1680 | } | 1681 | } |
1681 | 1682 | ||
1682 | 1683 | ||
1683 | static inline bool containsAlphaNum( const QString &str ) | 1684 | static inline bool containsAlphaNum( const QString &str ) |
1684 | { | 1685 | { |
1685 | int i, | 1686 | int i, |
1686 | count = str.length(); | 1687 | count = str.length(); |
1687 | for ( i = 0; i < count; i++ ) | 1688 | for ( i = 0; i < count; i++ ) |
1688 | if ( !str[i].isSpace() ) | 1689 | if ( !str[i].isSpace() ) |
1689 | return TRUE; | 1690 | return TRUE; |
1690 | return FALSE; | 1691 | return FALSE; |
1691 | } | 1692 | } |
1692 | 1693 | ||
1693 | static inline bool constainsWhiteSpace( const QString &str ) | 1694 | static inline bool constainsWhiteSpace( const QString &str ) |
1694 | { | 1695 | { |
1695 | int i, | 1696 | int i, |
1696 | count = str.length(); | 1697 | count = str.length(); |
1697 | for (i = 0; i < count; i++ ) | 1698 | for (i = 0; i < count; i++ ) |
1698 | if ( str[i].isSpace() ) | 1699 | if ( str[i].isSpace() ) |
1699 | return TRUE; | 1700 | return TRUE; |
1700 | return FALSE; | 1701 | return FALSE; |
1701 | } | 1702 | } |
1702 | 1703 | ||
1703 | void ContactEditor::setPersonalView( bool personal ) | 1704 | void ContactEditor::setPersonalView( bool personal ) |
1704 | { | 1705 | { |
1705 | m_personalView = personal; | 1706 | m_personalView = personal; |
1706 | 1707 | ||
1707 | // Currently disbled due to the fact that | 1708 | // Currently disbled due to the fact that |
1708 | // show will not work... | 1709 | // show will not work... |
1709 | return; | 1710 | return; |
1710 | 1711 | ||
1711 | if ( personal ){ | 1712 | if ( personal ){ |
1712 | cmbCat->hide(); | 1713 | cmbCat->hide(); |
1713 | labCat->hide(); | 1714 | labCat->hide(); |
1714 | 1715 | ||
1715 | } else{ | 1716 | } else{ |
1716 | cmbCat->show(); | 1717 | cmbCat->show(); |
1717 | labCat->show(); | 1718 | labCat->show(); |
1718 | } | 1719 | } |
1719 | } | 1720 | } |
1720 | 1721 | ||
1721 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) | 1722 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) |
1722 | { | 1723 | { |
1723 | QDate date; | 1724 | QDate date; |
1724 | date.setYMD( year, month, day ); | 1725 | date.setYMD( year, month, day ); |
1725 | QString dateString = TimeString::numberDateString( date ); | 1726 | QString dateString = TimeString::numberDateString( date ); |
1726 | anniversaryButton->setText( dateString ); | 1727 | anniversaryButton->setText( dateString ); |
1727 | ent.setAnniversary ( date ); | 1728 | ent.setAnniversary ( date ); |
1728 | } | 1729 | } |
1729 | 1730 | ||
1730 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) | 1731 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) |
1731 | { | 1732 | { |
1732 | QDate date; | 1733 | QDate date; |
1733 | date.setYMD( year, month, day ); | 1734 | date.setYMD( year, month, day ); |
1734 | QString dateString = TimeString::numberDateString( date ); | 1735 | QString dateString = TimeString::numberDateString( date ); |
1735 | birthdayButton->setText( dateString ); | 1736 | birthdayButton->setText( dateString ); |
1736 | ent.setBirthday ( date ); | 1737 | ent.setBirthday ( date ); |
1737 | } | 1738 | } |
1738 | 1739 | ||
1739 | void ContactEditor::slotRemoveBirthday() | 1740 | void ContactEditor::slotRemoveBirthday() |
1740 | { | 1741 | { |
1741 | owarn << "void ContactEditor::slotRemoveBirthday()" << oendl; | 1742 | owarn << "void ContactEditor::slotRemoveBirthday()" << oendl; |
1742 | ent.setBirthday( QDate() ); | 1743 | ent.setBirthday( QDate() ); |
1743 | updateDatePicker(); | 1744 | updateDatePicker(); |
1744 | } | 1745 | } |
1745 | 1746 | ||
1746 | void ContactEditor::slotRemoveAnniversary() | 1747 | void ContactEditor::slotRemoveAnniversary() |
1747 | { | 1748 | { |
1748 | owarn << "void ContactEditor::slotRemoveAnniversary()" << oendl; | 1749 | owarn << "void ContactEditor::slotRemoveAnniversary()" << oendl; |
1749 | ent.setAnniversary( QDate() ); | 1750 | ent.setAnniversary( QDate() ); |
1750 | updateDatePicker(); | 1751 | updateDatePicker(); |
1751 | } | 1752 | } |
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 | ||