-rw-r--r-- | kaddressbook/addresseeeditorwidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index 4db0a20..012780b 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp | |||
@@ -1,1344 +1,1344 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qhbox.h> | 25 | #include <qhbox.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qlistbox.h> | 28 | #include <qlistbox.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qtabwidget.h> | 30 | #include <qtabwidget.h> |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | 32 | ||
33 | #ifndef KAB_EMBEDDED | 33 | #ifndef KAB_EMBEDDED |
34 | #include <qtextedit.h> | 34 | #include <qtextedit.h> |
35 | 35 | ||
36 | #include <kaccelmanager.h> | 36 | #include <kaccelmanager.h> |
37 | #include "keywidget.h" | 37 | #include "keywidget.h" |
38 | #include "soundwidget.h" | 38 | #include "soundwidget.h" |
39 | 39 | ||
40 | #else //KAB_EMBEDDED | 40 | #else //KAB_EMBEDDED |
41 | #include <qmultilineedit.h> | 41 | #include <qmultilineedit.h> |
42 | #endif //KAB_EMBEDDED | 42 | #endif //KAB_EMBEDDED |
43 | 43 | ||
44 | 44 | ||
45 | #include "keywidget.h" | 45 | #include "keywidget.h" |
46 | #include "geowidget.h" | 46 | #include "geowidget.h" |
47 | #include "imagewidget.h" | 47 | #include "imagewidget.h" |
48 | #include "nameeditdialog.h" | 48 | #include "nameeditdialog.h" |
49 | #include "phoneeditwidget.h" | 49 | #include "phoneeditwidget.h" |
50 | #include "secrecywidget.h" | 50 | #include "secrecywidget.h" |
51 | 51 | ||
52 | 52 | ||
53 | #include <qtoolbutton.h> | 53 | #include <qtoolbutton.h> |
54 | #include <qtooltip.h> | 54 | #include <qtooltip.h> |
55 | 55 | ||
56 | #include <kapplication.h> | 56 | #include <kapplication.h> |
57 | #include <kconfig.h> | 57 | #include <kconfig.h> |
58 | #include <kcombobox.h> | 58 | #include <kcombobox.h> |
59 | #include <kdebug.h> | 59 | #include <kdebug.h> |
60 | #include <kdialogbase.h> | 60 | #include <kdialogbase.h> |
61 | #include <kglobal.h> | 61 | #include <kglobal.h> |
62 | #include <kiconloader.h> | 62 | #include <kiconloader.h> |
63 | #include <klineedit.h> | 63 | #include <klineedit.h> |
64 | #include <klocale.h> | 64 | #include <klocale.h> |
65 | #include <kmessagebox.h> | 65 | #include <kmessagebox.h> |
66 | #include <kseparator.h> | 66 | #include <kseparator.h> |
67 | #include <ksqueezedtextlabel.h> | 67 | #include <ksqueezedtextlabel.h> |
68 | 68 | ||
69 | #include <libkdepim/categoryeditdialog.h> | 69 | #include <libkdepim/categoryeditdialog.h> |
70 | #include <libkdepim/categoryselectdialog.h> | 70 | #include <libkdepim/categoryselectdialog.h> |
71 | 71 | ||
72 | #include <libkdepim/kdateedit.h> | 72 | #include <libkdepim/kdateedit.h> |
73 | 73 | ||
74 | #include "addresseditwidget.h" | 74 | #include "addresseditwidget.h" |
75 | #include "emaileditwidget.h" | 75 | #include "emaileditwidget.h" |
76 | #include "kabcore.h" | 76 | #include "kabcore.h" |
77 | #include "kabprefs.h" | 77 | #include "kabprefs.h" |
78 | 78 | ||
79 | #include "addresseeeditorwidget.h" | 79 | #include "addresseeeditorwidget.h" |
80 | 80 | ||
81 | 81 | ||
82 | 82 | ||
83 | AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension, | 83 | AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension, |
84 | QWidget *parent, const char *name ) | 84 | QWidget *parent, const char *name ) |
85 | : ExtensionWidget( core, parent, name ), mIsExtension( isExtension ), | 85 | : ExtensionWidget( core, parent, name ), mIsExtension( isExtension ), |
86 | mBlockSignals( false ) | 86 | mBlockSignals( false ) |
87 | { | 87 | { |
88 | 88 | ||
89 | mAConfig = AddresseeConfig::instance(); | 89 | mAConfig = AddresseeConfig::instance(); |
90 | 90 | ||
91 | mFormattedNameType = NameEditDialog::CustomName; | 91 | mFormattedNameType = NameEditDialog::CustomName; |
92 | initGUI(); | 92 | initGUI(); |
93 | mCategoryDialog = 0; | 93 | mCategoryDialog = 0; |
94 | mCategoryEditDialog = 0; | 94 | mCategoryEditDialog = 0; |
95 | 95 | ||
96 | // Load the empty addressee as defaults | 96 | // Load the empty addressee as defaults |
97 | load(); | 97 | load(); |
98 | 98 | ||
99 | mDirty = false; | 99 | mDirty = false; |
100 | } | 100 | } |
101 | 101 | ||
102 | AddresseeEditorWidget::~AddresseeEditorWidget() | 102 | AddresseeEditorWidget::~AddresseeEditorWidget() |
103 | { | 103 | { |
104 | kdDebug(5720) << "~AddresseeEditorWidget()" << endl; | 104 | kdDebug(5720) << "~AddresseeEditorWidget()" << endl; |
105 | } | 105 | } |
106 | 106 | ||
107 | void AddresseeEditorWidget::contactsSelectionChanged() | 107 | void AddresseeEditorWidget::contactsSelectionChanged() |
108 | { | 108 | { |
109 | KABC::Addressee::List list = selectedContacts(); | 109 | KABC::Addressee::List list = selectedContacts(); |
110 | 110 | ||
111 | mAddressee = list[ 0 ]; | 111 | mAddressee = list[ 0 ]; |
112 | load(); | 112 | load(); |
113 | } | 113 | } |
114 | 114 | ||
115 | void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr ) | 115 | void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr ) |
116 | { | 116 | { |
117 | mAddressee = addr; | 117 | mAddressee = addr; |
118 | load(); | 118 | load(); |
119 | } | 119 | } |
120 | 120 | ||
121 | const KABC::Addressee &AddresseeEditorWidget::addressee() | 121 | const KABC::Addressee &AddresseeEditorWidget::addressee() |
122 | { | 122 | { |
123 | return mAddressee; | 123 | return mAddressee; |
124 | } | 124 | } |
125 | 125 | ||
126 | void AddresseeEditorWidget::textChanged( const QString& ) | 126 | void AddresseeEditorWidget::textChanged( const QString& ) |
127 | { | 127 | { |
128 | emitModified(); | 128 | emitModified(); |
129 | } | 129 | } |
130 | 130 | ||
131 | void AddresseeEditorWidget::initGUI() | 131 | void AddresseeEditorWidget::initGUI() |
132 | { | 132 | { |
133 | QVBoxLayout *layout = new QVBoxLayout( this ); | 133 | QVBoxLayout *layout = new QVBoxLayout( this ); |
134 | 134 | ||
135 | mTabWidget = new QTabWidget( this ); | 135 | mTabWidget = new QTabWidget( this ); |
136 | layout->addWidget( mTabWidget ); | 136 | layout->addWidget( mTabWidget ); |
137 | 137 | ||
138 | setupTab1(); | 138 | setupTab1(); |
139 | setupTab1_1(); | 139 | setupTab1_1(); |
140 | setupTab2(); | 140 | setupTab2(); |
141 | setupTab2_1(); | 141 | setupTab2_1(); |
142 | setupTab3(); | 142 | setupTab3(); |
143 | setupTab3_1(); | 143 | setupTab3_1(); |
144 | 144 | ||
145 | mNameEdit->setFocus(); | 145 | mNameEdit->setFocus(); |
146 | 146 | ||
147 | connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ), | 147 | connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ), |
148 | SLOT( pageChanged(QWidget*) ) ); | 148 | SLOT( pageChanged(QWidget*) ) ); |
149 | } | 149 | } |
150 | 150 | ||
151 | void AddresseeEditorWidget::setupTab1() | 151 | void AddresseeEditorWidget::setupTab1() |
152 | { | 152 | { |
153 | // This is the General tab | 153 | // This is the General tab |
154 | QWidget *tab1 = new QWidget( mTabWidget ); | 154 | QWidget *tab1 = new QWidget( mTabWidget ); |
155 | 155 | ||
156 | //US QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); | 156 | //US QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); |
157 | QGridLayout *layout = new QGridLayout( tab1, 7, 1 ); | 157 | QGridLayout *layout = new QGridLayout( tab1, 7, 1 ); |
158 | layout->setMargin( KDialogBase::marginHintSmall() ); | 158 | layout->setMargin( KDialogBase::marginHintSmall() ); |
159 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 159 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
160 | 160 | ||
161 | QLabel *label; | 161 | QLabel *label; |
162 | KSeparator* bar; | 162 | KSeparator* bar; |
163 | QPushButton *button; | 163 | QPushButton *button; |
164 | 164 | ||
165 | ////////////////////////////////// | 165 | ////////////////////////////////// |
166 | // Upper left group (person info) | 166 | // Upper left group (person info) |
167 | 167 | ||
168 | // Person icon | 168 | // Person icon |
169 | /* LR | 169 | /* LR |
170 | label = new QLabel( tab1 ); | 170 | label = new QLabel( tab1 ); |
171 | //US ambiguous call. Add one more parameter | 171 | //US ambiguous call. Add one more parameter |
172 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); | 172 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); |
173 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); | 173 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); |
174 | layout->addMultiCellWidget( label, 0, 1, 0, 0 ); | 174 | layout->addMultiCellWidget( label, 0, 1, 0, 0 ); |
175 | */ | 175 | */ |
176 | // First name | 176 | // First name |
177 | button = new QPushButton( i18n( "Name..." ), tab1 ); | 177 | button = new QPushButton( i18n( "Name..." ), tab1 ); |
178 | //US QToolTip::add( button, i18n( "Edit the contact's name" ) ); | 178 | //US QToolTip::add( button, i18n( "Edit the contact's name" ) ); |
179 | mNameEdit = new KLineEdit( tab1, "mNameEdit" ); | 179 | mNameEdit = new KLineEdit( tab1, "mNameEdit" ); |
180 | connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), | 180 | connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), |
181 | SLOT( nameTextChanged( const QString& ) ) ); | 181 | SLOT( nameTextChanged( const QString& ) ) ); |
182 | connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); | 182 | connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); |
183 | 183 | ||
184 | mNameLabel = new KSqueezedTextLabel( tab1 ); | 184 | mNameLabel = new KSqueezedTextLabel( tab1 ); |
185 | mNameLabel->hide(); | 185 | mNameLabel->hide(); |
186 | 186 | ||
187 | layout->addWidget( button, 0, 0 ); | 187 | layout->addWidget( button, 0, 0 ); |
188 | layout->addWidget( mNameEdit, 0, 1 ); | 188 | layout->addWidget( mNameEdit, 0, 1 ); |
189 | layout->addWidget( mNameLabel, 0, 1 ); | 189 | layout->addWidget( mNameLabel, 0, 1 ); |
190 | 190 | ||
191 | label = new QLabel( i18n( "Role:" ), tab1 ); | 191 | label = new QLabel( i18n( "Role:" ), tab1 ); |
192 | mRoleEdit = new KLineEdit( tab1 ); | 192 | mRoleEdit = new KLineEdit( tab1 ); |
193 | connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), | 193 | connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), |
194 | SLOT( textChanged( const QString& ) ) ); | 194 | SLOT( textChanged( const QString& ) ) ); |
195 | label->setBuddy( mRoleEdit ); | 195 | label->setBuddy( mRoleEdit ); |
196 | layout->addWidget( label, 1, 0 ); | 196 | layout->addWidget( label, 1, 0 ); |
197 | layout->addWidget( mRoleEdit, 1, 1 ); | 197 | layout->addWidget( mRoleEdit, 1, 1 ); |
198 | 198 | ||
199 | // Organization | 199 | // Organization |
200 | label = new QLabel( i18n( "Organization:" ), tab1 ); | 200 | label = new QLabel( i18n( "Organization:" ), tab1 ); |
201 | mOrgEdit = new KLineEdit( tab1 ); | 201 | mOrgEdit = new KLineEdit( tab1 ); |
202 | label->setBuddy( mOrgEdit ); | 202 | label->setBuddy( mOrgEdit ); |
203 | connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), | 203 | connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), |
204 | SLOT( textChanged( const QString& ) ) ); | 204 | SLOT( textChanged( const QString& ) ) ); |
205 | layout->addWidget( label, 2, 0 ); | 205 | layout->addWidget( label, 2, 0 ); |
206 | layout->addWidget( mOrgEdit, 2, 1 ); | 206 | layout->addWidget( mOrgEdit, 2, 1 ); |
207 | 207 | ||
208 | // File as (formatted name) | 208 | // File as (formatted name) |
209 | label = new QLabel( i18n( "Formatted name:" ), tab1 ); | 209 | label = new QLabel( i18n( "Formatted name:" ), tab1 ); |
210 | mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); | 210 | mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); |
211 | layout->addWidget( label, 3, 0 ); | 211 | layout->addWidget( label, 3, 0 ); |
212 | layout->addWidget( mFormattedNameLabel, 3, 1 ); | 212 | layout->addWidget( mFormattedNameLabel, 3, 1 ); |
213 | /* LR | 213 | /* LR |
214 | // Left hand separator. This separator doesn't go all the way | 214 | // Left hand separator. This separator doesn't go all the way |
215 | // across so the dialog still flows from top to bottom | 215 | // across so the dialog still flows from top to bottom |
216 | bar = new KSeparator( KSeparator::HLine, tab1 ); | 216 | bar = new KSeparator( KSeparator::HLine, tab1 ); |
217 | layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); | 217 | layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); |
218 | */ | 218 | */ |
219 | ////////////////////////////////////// | 219 | ////////////////////////////////////// |
220 | 220 | ||
221 | /* LR | 221 | /* LR |
222 | // Phone numbers (upper right) | 222 | // Phone numbers (upper right) |
223 | label = new QLabel( tab1 ); | 223 | label = new QLabel( tab1 ); |
224 | //US loadIcon call is ambiguous. Add one more parameter | 224 | //US loadIcon call is ambiguous. Add one more parameter |
225 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); | 225 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); |
226 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); | 226 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); |
227 | //US layout->addMultiCellWidget( label, 0, 1, 3, 3 ); | 227 | //US layout->addMultiCellWidget( label, 0, 1, 3, 3 ); |
228 | layout->addMultiCellWidget( label, 5, 6, 0, 0 ); | 228 | layout->addMultiCellWidget( label, 5, 6, 0, 0 ); |
229 | */ | 229 | */ |
230 | mPhoneEditWidget = new PhoneEditWidget( tab1 ); | 230 | mPhoneEditWidget = new PhoneEditWidget( tab1 ); |
231 | connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); | 231 | connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); |
232 | //US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); | 232 | //US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); |
233 | int iii; | 233 | int iii; |
234 | #ifndef DESKTOP_VERSION | 234 | #ifndef DESKTOP_VERSION |
235 | iii = 7; | 235 | iii = 7; |
236 | #else | 236 | #else |
237 | iii = 8; | 237 | iii = 8; |
238 | #endif | 238 | #endif |
239 | layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, 1 ); | 239 | layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, 1 ); |
240 | ++iii; | 240 | ++iii; |
241 | /* LR | 241 | /* LR |
242 | bar = new KSeparator( KSeparator::HLine, tab1 ); | 242 | bar = new KSeparator( KSeparator::HLine, tab1 ); |
243 | //US layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); | 243 | //US layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); |
244 | layout->addMultiCellWidget( bar, 9, 9, 0, 2 ); | 244 | layout->addMultiCellWidget( bar, 9, 9, 0, 2 ); |
245 | */ | 245 | */ |
246 | /*US | 246 | /*US |
247 | ////////////////////////////////////// | 247 | ////////////////////////////////////// |
248 | // Addresses (lower left) | 248 | // Addresses (lower left) |
249 | label = new QLabel( tab1 ); | 249 | label = new QLabel( tab1 ); |
250 | //US loadIcon call is ambiguous. Add one more parameter | 250 | //US loadIcon call is ambiguous. Add one more parameter |
251 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); | 251 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); |
252 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); | 252 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); |
253 | layout->addMultiCellWidget( label, 5, 6, 0, 0 ); | 253 | layout->addMultiCellWidget( label, 5, 6, 0, 0 ); |
254 | 254 | ||
255 | mAddressEditWidget = new AddressEditWidget( tab1 ); | 255 | mAddressEditWidget = new AddressEditWidget( tab1 ); |
256 | connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); | 256 | connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); |
257 | layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); | 257 | layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); |
258 | 258 | ||
259 | ////////////////////////////////////// | 259 | ////////////////////////////////////// |
260 | // Email / Web (lower right) | 260 | // Email / Web (lower right) |
261 | label = new QLabel( tab1 ); | 261 | label = new QLabel( tab1 ); |
262 | //US loadIcon call is ambiguous. Add one more parameter | 262 | //US loadIcon call is ambiguous. Add one more parameter |
263 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); | 263 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); |
264 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); | 264 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); |
265 | layout->addMultiCellWidget( label, 5, 6, 3, 3 ); | 265 | layout->addMultiCellWidget( label, 5, 6, 3, 3 ); |
266 | 266 | ||
267 | mEmailWidget = new EmailEditWidget( tab1 ); | 267 | mEmailWidget = new EmailEditWidget( tab1 ); |
268 | connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); | 268 | connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); |
269 | layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); | 269 | layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); |
270 | 270 | ||
271 | // add the separator | 271 | // add the separator |
272 | bar = new KSeparator( KSeparator::HLine, tab1 ); | 272 | bar = new KSeparator( KSeparator::HLine, tab1 ); |
273 | layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); | 273 | layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); |
274 | 274 | ||
275 | label = new QLabel( tab1 ); | 275 | label = new QLabel( tab1 ); |
276 | //US loadIcon call is ambiguous. Add one more parameter | 276 | //US loadIcon call is ambiguous. Add one more parameter |
277 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); | 277 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); |
278 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); | 278 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); |
279 | layout->addMultiCellWidget( label, 8, 9, 3, 3 ); | 279 | layout->addMultiCellWidget( label, 8, 9, 3, 3 ); |
280 | 280 | ||
281 | label = new QLabel( i18n( "URL:" ), tab1 ); | 281 | label = new QLabel( i18n( "URL:" ), tab1 ); |
282 | mURLEdit = new KLineEdit( tab1 ); | 282 | mURLEdit = new KLineEdit( tab1 ); |
283 | connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), | 283 | connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), |
284 | SLOT( textChanged( const QString& ) ) ); | 284 | SLOT( textChanged( const QString& ) ) ); |
285 | label->setBuddy( mURLEdit ); | 285 | label->setBuddy( mURLEdit ); |
286 | layout->addWidget( label, 8, 4 ); | 286 | layout->addWidget( label, 8, 4 ); |
287 | layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); | 287 | layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); |
288 | 288 | ||
289 | label = new QLabel( i18n( "&IM address:" ), tab1 ); | 289 | label = new QLabel( i18n( "&IM address:" ), tab1 ); |
290 | mIMAddressEdit = new KLineEdit( tab1 ); | 290 | mIMAddressEdit = new KLineEdit( tab1 ); |
291 | connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), | 291 | connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), |
292 | SLOT( textChanged( const QString& ) ) ); | 292 | SLOT( textChanged( const QString& ) ) ); |
293 | label->setBuddy( mIMAddressEdit ); | 293 | label->setBuddy( mIMAddressEdit ); |
294 | layout->addWidget( label, 9, 4 ); | 294 | layout->addWidget( label, 9, 4 ); |
295 | layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); | 295 | layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); |
296 | 296 | ||
297 | layout->addColSpacing( 6, 50 ); | 297 | layout->addColSpacing( 6, 50 ); |
298 | 298 | ||
299 | bar = new KSeparator( KSeparator::HLine, tab1 ); | 299 | bar = new KSeparator( KSeparator::HLine, tab1 ); |
300 | layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); | 300 | layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); |
301 | */ | 301 | */ |
302 | /////////////////////////////////////// | 302 | /////////////////////////////////////// |
303 | QHBox *categoryBox = new QHBox( tab1 ,"cato"); | 303 | QHBox *categoryBox = new QHBox( tab1 ,"cato"); |
304 | categoryBox->setSpacing( KDialogBase::spacingHint() ); | 304 | categoryBox->setSpacing( KDialogBase::spacingHint() ); |
305 | categoryBox->setMargin( KDialogBase::marginHintSmall() ); | 305 | categoryBox->setMargin( KDialogBase::marginHintSmall() ); |
306 | 306 | ||
307 | // Categories | 307 | // Categories |
308 | button = new QPushButton( i18n( "Categories" ), categoryBox ); | 308 | button = new QPushButton( i18n( "Categories" ), categoryBox ); |
309 | connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); | 309 | connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); |
310 | 310 | ||
311 | mCategoryEdit = new KLineEdit( categoryBox ); | 311 | mCategoryEdit = new KLineEdit( categoryBox ); |
312 | mCategoryEdit->setReadOnly( true ); | 312 | mCategoryEdit->setReadOnly( true ); |
313 | connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), | 313 | connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), |
314 | SLOT( textChanged( const QString& ) ) ); | 314 | SLOT( textChanged( const QString& ) ) ); |
315 | 315 | ||
316 | mSecrecyWidget = new SecrecyWidget( categoryBox ); | 316 | mSecrecyWidget = new SecrecyWidget( categoryBox ); |
317 | connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 317 | connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
318 | 318 | ||
319 | //US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); | 319 | //US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); |
320 | layout->addMultiCellWidget( categoryBox, iii, iii, 0, 1 ); | 320 | layout->addMultiCellWidget( categoryBox, iii, iii, 0, 1 ); |
321 | 321 | ||
322 | // Build the layout and add to the tab widget | 322 | // Build the layout and add to the tab widget |
323 | layout->activate(); // required | 323 | layout->activate(); // required |
324 | 324 | ||
325 | mTabWidget->addTab( tab1, i18n( "&General" ) ); | 325 | mTabWidget->addTab( tab1, i18n( "&General" ) ); |
326 | } | 326 | } |
327 | 327 | ||
328 | 328 | ||
329 | void AddresseeEditorWidget::setupTab1_1() | 329 | void AddresseeEditorWidget::setupTab1_1() |
330 | { | 330 | { |
331 | // This is the Address tab | 331 | // This is the Address tab |
332 | QWidget *tab1_1 = new QWidget( mTabWidget ); | 332 | QWidget *tab1_1 = new QWidget( mTabWidget ); |
333 | 333 | ||
334 | //US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 ); | 334 | //US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 ); |
335 | QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 ); | 335 | QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 ); |
336 | layout->setMargin( KDialogBase::marginHintSmall() ); | 336 | layout->setMargin( KDialogBase::marginHintSmall() ); |
337 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 337 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
338 | 338 | ||
339 | QLabel *label; | 339 | QLabel *label; |
340 | KSeparator* bar; | 340 | KSeparator* bar; |
341 | QPushButton *button; | 341 | QPushButton *button; |
342 | 342 | ||
343 | /*US | 343 | /*US |
344 | ////////////////////////////////// | 344 | ////////////////////////////////// |
345 | // Upper left group (person info) | 345 | // Upper left group (person info) |
346 | 346 | ||
347 | // Person icon | 347 | // Person icon |
348 | label = new QLabel( tab1 ); | 348 | label = new QLabel( tab1 ); |
349 | //US ambiguous call. Add one more parameter | 349 | //US ambiguous call. Add one more parameter |
350 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); | 350 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); |
351 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); | 351 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); |
352 | layout->addMultiCellWidget( label, 0, 1, 0, 0 ); | 352 | layout->addMultiCellWidget( label, 0, 1, 0, 0 ); |
353 | 353 | ||
354 | // First name | 354 | // First name |
355 | button = new QPushButton( i18n( "Name..." ), tab1 ); | 355 | button = new QPushButton( i18n( "Name..." ), tab1 ); |
356 | QToolTip::add( button, i18n( "Edit the contact's name" ) ); | 356 | QToolTip::add( button, i18n( "Edit the contact's name" ) ); |
357 | mNameEdit = new KLineEdit( tab1, "mNameEdit" ); | 357 | mNameEdit = new KLineEdit( tab1, "mNameEdit" ); |
358 | connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), | 358 | connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), |
359 | SLOT( nameTextChanged( const QString& ) ) ); | 359 | SLOT( nameTextChanged( const QString& ) ) ); |
360 | connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); | 360 | connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); |
361 | 361 | ||
362 | #ifndef KAB_EMBEDDED | 362 | #ifndef KAB_EMBEDDED |
363 | mNameLabel = new KSqueezedTextLabel( tab1 ); | 363 | mNameLabel = new KSqueezedTextLabel( tab1 ); |
364 | mNameLabel->hide(); | 364 | mNameLabel->hide(); |
365 | #else //KAB_EMBEDDED | 365 | #else //KAB_EMBEDDED |
366 | qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); | 366 | qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); |
367 | #endif //KAB_EMBEDDED | 367 | #endif //KAB_EMBEDDED |
368 | 368 | ||
369 | layout->addWidget( button, 0, 1 ); | 369 | layout->addWidget( button, 0, 1 ); |
370 | layout->addWidget( mNameEdit, 0, 2 ); | 370 | layout->addWidget( mNameEdit, 0, 2 ); |
371 | 371 | ||
372 | #ifndef KAB_EMBEDDED | 372 | #ifndef KAB_EMBEDDED |
373 | layout->addWidget( mNameLabel, 0, 2 ); | 373 | layout->addWidget( mNameLabel, 0, 2 ); |
374 | #else //KAB_EMBEDDED | 374 | #else //KAB_EMBEDDED |
375 | qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); | 375 | qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); |
376 | #endif //KAB_EMBEDDED | 376 | #endif //KAB_EMBEDDED |
377 | 377 | ||
378 | label = new QLabel( i18n( "Role:" ), tab1 ); | 378 | label = new QLabel( i18n( "Role:" ), tab1 ); |
379 | mRoleEdit = new KLineEdit( tab1 ); | 379 | mRoleEdit = new KLineEdit( tab1 ); |
380 | connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), | 380 | connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), |
381 | SLOT( textChanged( const QString& ) ) ); | 381 | SLOT( textChanged( const QString& ) ) ); |
382 | label->setBuddy( mRoleEdit ); | 382 | label->setBuddy( mRoleEdit ); |
383 | layout->addWidget( label, 1, 1 ); | 383 | layout->addWidget( label, 1, 1 ); |
384 | layout->addWidget( mRoleEdit, 1, 2 ); | 384 | layout->addWidget( mRoleEdit, 1, 2 ); |
385 | 385 | ||
386 | // Organization | 386 | // Organization |
387 | label = new QLabel( i18n( "Organization:" ), tab1 ); | 387 | label = new QLabel( i18n( "Organization:" ), tab1 ); |
388 | mOrgEdit = new KLineEdit( tab1 ); | 388 | mOrgEdit = new KLineEdit( tab1 ); |
389 | label->setBuddy( mOrgEdit ); | 389 | label->setBuddy( mOrgEdit ); |
390 | connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), | 390 | connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), |
391 | SLOT( textChanged( const QString& ) ) ); | 391 | SLOT( textChanged( const QString& ) ) ); |
392 | layout->addWidget( label, 2, 1 ); | 392 | layout->addWidget( label, 2, 1 ); |
393 | layout->addWidget( mOrgEdit, 2, 2 ); | 393 | layout->addWidget( mOrgEdit, 2, 2 ); |
394 | 394 | ||
395 | // File as (formatted name) | 395 | // File as (formatted name) |
396 | label = new QLabel( i18n( "Formatted name:" ), tab1 ); | 396 | label = new QLabel( i18n( "Formatted name:" ), tab1 ); |
397 | #ifndef KAB_EMBEDDED | 397 | #ifndef KAB_EMBEDDED |
398 | mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); | 398 | mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); |
399 | #else //KAB_EMBEDDED | 399 | #else //KAB_EMBEDDED |
400 | qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); | 400 | qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); |
401 | #endif //KAB_EMBEDDED | 401 | #endif //KAB_EMBEDDED |
402 | layout->addWidget( label, 3, 1 ); | 402 | layout->addWidget( label, 3, 1 ); |
403 | #ifndef KAB_EMBEDDED | 403 | #ifndef KAB_EMBEDDED |
404 | layout->addWidget( mFormattedNameLabel, 3, 2 ); | 404 | layout->addWidget( mFormattedNameLabel, 3, 2 ); |
405 | #else //KAB_EMBEDDED | 405 | #else //KAB_EMBEDDED |
406 | qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); | 406 | qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); |
407 | #endif //KAB_EMBEDDED | 407 | #endif //KAB_EMBEDDED |
408 | 408 | ||
409 | // Left hand separator. This separator doesn't go all the way | 409 | // Left hand separator. This separator doesn't go all the way |
410 | // across so the dialog still flows from top to bottom | 410 | // across so the dialog still flows from top to bottom |
411 | bar = new KSeparator( KSeparator::HLine, tab1 ); | 411 | bar = new KSeparator( KSeparator::HLine, tab1 ); |
412 | layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); | 412 | layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); |
413 | 413 | ||
414 | ////////////////////////////////////// | 414 | ////////////////////////////////////// |
415 | // Phone numbers (upper right) | 415 | // Phone numbers (upper right) |
416 | label = new QLabel( tab1 ); | 416 | label = new QLabel( tab1 ); |
417 | //US loadIcon call is ambiguous. Add one more parameter | 417 | //US loadIcon call is ambiguous. Add one more parameter |
418 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); | 418 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); |
419 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); | 419 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); |
420 | layout->addMultiCellWidget( label, 0, 1, 3, 3 ); | 420 | layout->addMultiCellWidget( label, 0, 1, 3, 3 ); |
421 | 421 | ||
422 | mPhoneEditWidget = new PhoneEditWidget( tab1 ); | 422 | mPhoneEditWidget = new PhoneEditWidget( tab1 ); |
423 | connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); | 423 | connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); |
424 | layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); | 424 | layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); |
425 | 425 | ||
426 | bar = new KSeparator( KSeparator::HLine, tab1 ); | 426 | bar = new KSeparator( KSeparator::HLine, tab1 ); |
427 | layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); | 427 | layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); |
428 | */ | 428 | */ |
429 | ////////////////////////////////////// | 429 | ////////////////////////////////////// |
430 | // Addresses (lower left) | 430 | // Addresses (lower left) |
431 | /* LR | 431 | /* LR |
432 | label = new QLabel( tab1_1 ); | 432 | label = new QLabel( tab1_1 ); |
433 | //US loadIcon call is ambiguous. Add one more parameter | 433 | //US loadIcon call is ambiguous. Add one more parameter |
434 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); | 434 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); |
435 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); | 435 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); |
436 | //US layout->addMultiCellWidget( label, 5, 6, 0, 0 ); | 436 | //US layout->addMultiCellWidget( label, 5, 6, 0, 0 ); |
437 | layout->addMultiCellWidget( label, 0, 1, 0, 0 ); | 437 | layout->addMultiCellWidget( label, 0, 1, 0, 0 ); |
438 | */ | 438 | */ |
439 | 439 | ||
440 | mAddressEditWidget = new AddressEditWidget( tab1_1 ); | 440 | mAddressEditWidget = new AddressEditWidget( tab1_1 ); |
441 | connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); | 441 | connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); |
442 | //US layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); | 442 | //US layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); |
443 | layout->addMultiCellWidget( mAddressEditWidget, 0, 4, 0, 1 ); | 443 | layout->addMultiCellWidget( mAddressEditWidget, 0, 4, 0, 1 ); |
444 | 444 | ||
445 | //US | 445 | //US |
446 | /* LR | 446 | /* LR |
447 | bar = new KSeparator( KSeparator::HLine, tab1_1 ); | 447 | bar = new KSeparator( KSeparator::HLine, tab1_1 ); |
448 | layout->addMultiCellWidget( bar, 5, 5, 0, 3 ); | 448 | layout->addMultiCellWidget( bar, 5, 5, 0, 3 ); |
449 | */ | 449 | */ |
450 | 450 | ||
451 | ////////////////////////////////////// | 451 | ////////////////////////////////////// |
452 | // Email / Web (lower right) | 452 | // Email / Web (lower right) |
453 | /* LR | 453 | /* LR |
454 | label = new QLabel( tab1_1 ); | 454 | label = new QLabel( tab1_1 ); |
455 | //US loadIcon call is ambiguous. Add one more parameter | 455 | //US loadIcon call is ambiguous. Add one more parameter |
456 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); | 456 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); |
457 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); | 457 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); |
458 | //US layout->addMultiCellWidget( label, 5, 6, 3, 3 ); | 458 | //US layout->addMultiCellWidget( label, 5, 6, 3, 3 ); |
459 | layout->addMultiCellWidget( label, 6, 7, 0, 0 ); | 459 | layout->addMultiCellWidget( label, 6, 7, 0, 0 ); |
460 | */ | 460 | */ |
461 | mEmailWidget = new EmailEditWidget( tab1_1 ); | 461 | mEmailWidget = new EmailEditWidget( tab1_1 ); |
462 | connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); | 462 | connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); |
463 | //US layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); | 463 | //US layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); |
464 | layout->addMultiCellWidget( mEmailWidget, 5, 6, 0, 1 ); | 464 | layout->addMultiCellWidget( mEmailWidget, 5, 6, 0, 1 ); |
465 | 465 | ||
466 | /* LR | 466 | /* LR |
467 | // add the separator | 467 | // add the separator |
468 | bar = new KSeparator( KSeparator::HLine, tab1_1 ); | 468 | bar = new KSeparator( KSeparator::HLine, tab1_1 ); |
469 | //US layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); | 469 | //US layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); |
470 | layout->addMultiCellWidget( bar, 8, 8, 0, 3 ); | 470 | layout->addMultiCellWidget( bar, 8, 8, 0, 3 ); |
471 | 471 | ||
472 | label = new QLabel( tab1_1 ); | 472 | label = new QLabel( tab1_1 ); |
473 | //US loadIcon call is ambiguous. Add one more parameter | 473 | //US loadIcon call is ambiguous. Add one more parameter |
474 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); | 474 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); |
475 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); | 475 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); |
476 | //US layout->addMultiCellWidget( label, 8, 9, 3, 3 ); | 476 | //US layout->addMultiCellWidget( label, 8, 9, 3, 3 ); |
477 | layout->addMultiCellWidget( label, 9, 10, 0, 0 ); | 477 | layout->addMultiCellWidget( label, 9, 10, 0, 0 ); |
478 | */ | 478 | */ |
479 | label = new QLabel( i18n( "URL:" ), tab1_1 ); | 479 | label = new QLabel( i18n( "URL:" ), tab1_1 ); |
480 | mURLEdit = new KLineEdit( tab1_1 ); | 480 | mURLEdit = new KLineEdit( tab1_1 ); |
481 | connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), | 481 | connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), |
482 | SLOT( textChanged( const QString& ) ) ); | 482 | SLOT( textChanged( const QString& ) ) ); |
483 | label->setBuddy( mURLEdit ); | 483 | label->setBuddy( mURLEdit ); |
484 | //US layout->addWidget( label, 8, 4 ); | 484 | //US layout->addWidget( label, 8, 4 ); |
485 | layout->addWidget( label, 7,0 ); | 485 | layout->addWidget( label, 7,0 ); |
486 | //US layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); | 486 | //US layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); |
487 | layout->addWidget( mURLEdit, 7, 1); | 487 | layout->addWidget( mURLEdit, 7, 1); |
488 | 488 | ||
489 | label = new QLabel( i18n( "&IM address:" ), tab1_1 ); | 489 | label = new QLabel( i18n( "&IM address:" ), tab1_1 ); |
490 | mIMAddressEdit = new KLineEdit( tab1_1 ); | 490 | mIMAddressEdit = new KLineEdit( tab1_1 ); |
491 | connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), | 491 | connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), |
492 | SLOT( textChanged( const QString& ) ) ); | 492 | SLOT( textChanged( const QString& ) ) ); |
493 | label->setBuddy( mIMAddressEdit ); | 493 | label->setBuddy( mIMAddressEdit ); |
494 | //US layout->addWidget( label, 9, 4 ); | 494 | //US layout->addWidget( label, 9, 4 ); |
495 | layout->addWidget( label, 8, 0 ); | 495 | layout->addWidget( label, 8, 0 ); |
496 | //US layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); | 496 | //US layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); |
497 | layout->addWidget( mIMAddressEdit, 8,1 ); | 497 | layout->addWidget( mIMAddressEdit, 8,1 ); |
498 | 498 | ||
499 | //US layout->addColSpacing( 6, 50 ); | 499 | //US layout->addColSpacing( 6, 50 ); |
500 | 500 | ||
501 | //US bar = new KSeparator( KSeparator::HLine, tab1_1 ); | 501 | //US bar = new KSeparator( KSeparator::HLine, tab1_1 ); |
502 | //US layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); | 502 | //US layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); |
503 | 503 | ||
504 | /*US | 504 | /*US |
505 | /////////////////////////////////////// | 505 | /////////////////////////////////////// |
506 | QHBox *categoryBox = new QHBox( tab1 ); | 506 | QHBox *categoryBox = new QHBox( tab1 ); |
507 | categoryBox->setSpacing( KDialogBase::spacingHintSmall() ); | 507 | categoryBox->setSpacing( KDialogBase::spacingHintSmall() ); |
508 | 508 | ||
509 | // Categories | 509 | // Categories |
510 | button = new QPushButton( i18n( "Categories" ), categoryBox ); | 510 | button = new QPushButton( i18n( "Categories" ), categoryBox ); |
511 | connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); | 511 | connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); |
512 | 512 | ||
513 | mCategoryEdit = new KLineEdit( categoryBox ); | 513 | mCategoryEdit = new KLineEdit( categoryBox ); |
514 | mCategoryEdit->setReadOnly( true ); | 514 | mCategoryEdit->setReadOnly( true ); |
515 | connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), | 515 | connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), |
516 | SLOT( textChanged( const QString& ) ) ); | 516 | SLOT( textChanged( const QString& ) ) ); |
517 | 517 | ||
518 | mSecrecyWidget = new SecrecyWidget( categoryBox ); | 518 | mSecrecyWidget = new SecrecyWidget( categoryBox ); |
519 | connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 519 | connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
520 | 520 | ||
521 | layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); | 521 | layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); |
522 | */ | 522 | */ |
523 | // Build the layout and add to the tab widget | 523 | // Build the layout and add to the tab widget |
524 | layout->activate(); // required | 524 | layout->activate(); // required |
525 | 525 | ||
526 | mTabWidget->addTab( tab1_1, i18n( "&Address" ) ); | 526 | mTabWidget->addTab( tab1_1, i18n( "&Address" ) ); |
527 | } | 527 | } |
528 | 528 | ||
529 | 529 | ||
530 | 530 | ||
531 | void AddresseeEditorWidget::setupTab2() | 531 | void AddresseeEditorWidget::setupTab2() |
532 | { | 532 | { |
533 | // This is the Details tab | 533 | // This is the Details tab |
534 | QWidget *tab2 = new QWidget( mTabWidget ); | 534 | QWidget *tab2 = new QWidget( mTabWidget ); |
535 | 535 | ||
536 | QGridLayout *layout = new QGridLayout( tab2, 8, 3 ); | 536 | QGridLayout *layout = new QGridLayout( tab2, 8, 3 ); |
537 | layout->setMargin( KDialogBase::marginHintSmall() ); | 537 | layout->setMargin( KDialogBase::marginHintSmall() ); |
538 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 538 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
539 | 539 | ||
540 | QLabel *label; | 540 | QLabel *label; |
541 | KSeparator* bar; | 541 | KSeparator* bar; |
542 | 542 | ||
543 | /////////////////////// | 543 | /////////////////////// |
544 | // Office info | 544 | // Office info |
545 | 545 | ||
546 | // Department | 546 | // Department |
547 | label = new QLabel( tab2 ); | 547 | label = new QLabel( tab2 ); |
548 | //US loadIcon call is ambiguous. Add one more parameter | 548 | //US loadIcon call is ambiguous. Add one more parameter |
549 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); | 549 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); |
550 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); | 550 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); |
551 | layout->addMultiCellWidget( label, 0, 1, 0, 0 ); | 551 | layout->addMultiCellWidget( label, 0, 1, 0, 0 ); |
552 | 552 | ||
553 | label = new QLabel( i18n( "Department:" ), tab2 ); | 553 | label = new QLabel( i18n( "Department:" ), tab2 ); |
554 | layout->addWidget( label, 0, 1 ); | 554 | layout->addWidget( label, 0, 1 ); |
555 | mDepartmentEdit = new KLineEdit( tab2 ); | 555 | mDepartmentEdit = new KLineEdit( tab2 ); |
556 | connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), | 556 | connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), |
557 | SLOT( textChanged( const QString& ) ) ); | 557 | SLOT( textChanged( const QString& ) ) ); |
558 | label->setBuddy( mDepartmentEdit ); | 558 | label->setBuddy( mDepartmentEdit ); |
559 | layout->addWidget( mDepartmentEdit, 0, 2 ); | 559 | layout->addWidget( mDepartmentEdit, 0, 2 ); |
560 | 560 | ||
561 | label = new QLabel( i18n( "Office:" ), tab2 ); | 561 | label = new QLabel( i18n( "Office:" ), tab2 ); |
562 | layout->addWidget( label, 1, 1 ); | 562 | layout->addWidget( label, 1, 1 ); |
563 | mOfficeEdit = new KLineEdit( tab2 ); | 563 | mOfficeEdit = new KLineEdit( tab2 ); |
564 | connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), | 564 | connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), |
565 | SLOT( textChanged( const QString& ) ) ); | 565 | SLOT( textChanged( const QString& ) ) ); |
566 | label->setBuddy( mOfficeEdit ); | 566 | label->setBuddy( mOfficeEdit ); |
567 | layout->addWidget( mOfficeEdit, 1, 2 ); | 567 | layout->addWidget( mOfficeEdit, 1, 2 ); |
568 | 568 | ||
569 | label = new QLabel( i18n( "Profession:" ), tab2 ); | 569 | label = new QLabel( i18n( "Profession:" ), tab2 ); |
570 | layout->addWidget( label, 2, 1 ); | 570 | layout->addWidget( label, 2, 1 ); |
571 | mProfessionEdit = new KLineEdit( tab2 ); | 571 | mProfessionEdit = new KLineEdit( tab2 ); |
572 | connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), | 572 | connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), |
573 | SLOT( textChanged( const QString& ) ) ); | 573 | SLOT( textChanged( const QString& ) ) ); |
574 | label->setBuddy( mProfessionEdit ); | 574 | label->setBuddy( mProfessionEdit ); |
575 | layout->addWidget( mProfessionEdit, 2, 2 ); | 575 | layout->addWidget( mProfessionEdit, 2, 2 ); |
576 | 576 | ||
577 | label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); | 577 | label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); |
578 | //US layout->addWidget( label, 0, 3 ); | 578 | //US layout->addWidget( label, 0, 3 ); |
579 | layout->addWidget( label, 3, 1 ); | 579 | layout->addWidget( label, 3, 1 ); |
580 | mManagerEdit = new KLineEdit( tab2 ); | 580 | mManagerEdit = new KLineEdit( tab2 ); |
581 | connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), | 581 | connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), |
582 | SLOT( textChanged( const QString& ) ) ); | 582 | SLOT( textChanged( const QString& ) ) ); |
583 | label->setBuddy( mManagerEdit ); | 583 | label->setBuddy( mManagerEdit ); |
584 | //US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); | 584 | //US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); |
585 | layout->addWidget( mManagerEdit, 3, 2 ); | 585 | layout->addWidget( mManagerEdit, 3, 2 ); |
586 | 586 | ||
587 | label = new QLabel( i18n( "Assistant's name:" ), tab2 ); | 587 | label = new QLabel( i18n( "Assistant's name:" ), tab2 ); |
588 | //US layout->addWidget( label, 1, 3 ); | 588 | //US layout->addWidget( label, 1, 3 ); |
589 | layout->addWidget( label, 4, 1 ); | 589 | layout->addWidget( label, 4, 1 ); |
590 | mAssistantEdit = new KLineEdit( tab2 ); | 590 | mAssistantEdit = new KLineEdit( tab2 ); |
591 | connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), | 591 | connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), |
592 | SLOT( textChanged( const QString& ) ) ); | 592 | SLOT( textChanged( const QString& ) ) ); |
593 | label->setBuddy( mAssistantEdit ); | 593 | label->setBuddy( mAssistantEdit ); |
594 | //US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); | 594 | //US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); |
595 | layout->addWidget( mAssistantEdit, 4, 2 ); | 595 | layout->addWidget( mAssistantEdit, 4, 2 ); |
596 | 596 | ||
597 | bar = new KSeparator( KSeparator::HLine, tab2 ); | 597 | bar = new KSeparator( KSeparator::HLine, tab2 ); |
598 | //US layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); | 598 | //US layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); |
599 | layout->addMultiCellWidget( bar, 5, 5, 0, 2 ); | 599 | layout->addMultiCellWidget( bar, 5, 5, 0, 2 ); |
600 | 600 | ||
601 | ///////////////////////////////////////////////// | 601 | ///////////////////////////////////////////////// |
602 | // Personal info | 602 | // Personal info |
603 | 603 | ||
604 | //label = new QLabel( tab2 ); | 604 | //label = new QLabel( tab2 ); |
605 | //US loadIcon call is ambiguous. Add one more parameter | 605 | //US loadIcon call is ambiguous. Add one more parameter |
606 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); | 606 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); |
607 | //label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); | 607 | //label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); |
608 | //US layout->addMultiCellWidget( label, 4, 5, 0, 0 ); | 608 | //US layout->addMultiCellWidget( label, 4, 5, 0, 0 ); |
609 | //layout->addMultiCellWidget( label, 6, 7, 0, 0 ); | 609 | //layout->addMultiCellWidget( label, 6, 7, 0, 0 ); |
610 | 610 | ||
611 | 611 | ||
612 | int iii = 6; | 612 | int iii = 6; |
613 | 613 | ||
614 | if ( QApplication::desktop()->width() == 640 ) { | 614 | if ( QApplication::desktop()->width() == 640 ) { |
615 | QHBox * nbox = new QHBox ( tab2 ); | 615 | QHBox * nbox = new QHBox ( tab2 ); |
616 | label = new QLabel( i18n( "Nick name:" )+" ", nbox ); | 616 | label = new QLabel( i18n( "Nick name:" )+" ", nbox ); |
617 | mNicknameEdit = new KLineEdit( nbox ); | 617 | mNicknameEdit = new KLineEdit( nbox ); |
618 | connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), | 618 | connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), |
619 | SLOT( textChanged( const QString& ) ) ); | 619 | SLOT( textChanged( const QString& ) ) ); |
620 | label->setBuddy( mNicknameEdit ); | 620 | label->setBuddy( mNicknameEdit ); |
621 | 621 | ||
622 | label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox ); | 622 | label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox ); |
623 | mSpouseEdit = new KLineEdit( nbox ); | 623 | mSpouseEdit = new KLineEdit( nbox ); |
624 | connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), | 624 | connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), |
625 | SLOT( textChanged( const QString& ) ) ); | 625 | SLOT( textChanged( const QString& ) ) ); |
626 | label->setBuddy( mSpouseEdit ); | 626 | label->setBuddy( mSpouseEdit ); |
627 | layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); | 627 | layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); |
628 | ++iii; | 628 | ++iii; |
629 | 629 | ||
630 | } else { | 630 | } else { |
631 | label = new QLabel( i18n( "Nick name:" ), tab2 ); | 631 | label = new QLabel( i18n( "Nick name:" ), tab2 ); |
632 | layout->addWidget( label, iii, 1 ); | 632 | layout->addWidget( label, iii, 1 ); |
633 | mNicknameEdit = new KLineEdit( tab2 ); | 633 | mNicknameEdit = new KLineEdit( tab2 ); |
634 | connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), | 634 | connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), |
635 | SLOT( textChanged( const QString& ) ) ); | 635 | SLOT( textChanged( const QString& ) ) ); |
636 | label->setBuddy( mNicknameEdit ); | 636 | label->setBuddy( mNicknameEdit ); |
637 | layout->addWidget( mNicknameEdit, iii, 2 ); | 637 | layout->addWidget( mNicknameEdit, iii, 2 ); |
638 | ++iii; | 638 | ++iii; |
639 | 639 | ||
640 | label = new QLabel( i18n( "Spouse's name:" ), tab2 ); | 640 | label = new QLabel( i18n( "Spouse's name:" ), tab2 ); |
641 | layout->addWidget( label, iii, 1 ); | 641 | layout->addWidget( label, iii, 1 ); |
642 | mSpouseEdit = new KLineEdit( tab2 ); | 642 | mSpouseEdit = new KLineEdit( tab2 ); |
643 | connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), | 643 | connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), |
644 | SLOT( textChanged( const QString& ) ) ); | 644 | SLOT( textChanged( const QString& ) ) ); |
645 | label->setBuddy( mSpouseEdit ); | 645 | label->setBuddy( mSpouseEdit ); |
646 | layout->addWidget( mSpouseEdit, iii, 2 ); | 646 | layout->addWidget( mSpouseEdit, iii, 2 ); |
647 | ++iii; | 647 | ++iii; |
648 | } | 648 | } |
649 | 649 | ||
650 | label = new QLabel( i18n( "Children's names:" ), tab2 ); | 650 | label = new QLabel( i18n( "Children's names:" ), tab2 ); |
651 | layout->addWidget( label, iii, 1 ); | 651 | layout->addWidget( label, iii, 1 ); |
652 | mChildEdit = new KLineEdit( tab2 ); | 652 | mChildEdit = new KLineEdit( tab2 ); |
653 | connect( mChildEdit, SIGNAL( textChanged( const QString& ) ), | 653 | connect( mChildEdit, SIGNAL( textChanged( const QString& ) ), |
654 | SLOT( textChanged( const QString& ) ) ); | 654 | SLOT( textChanged( const QString& ) ) ); |
655 | label->setBuddy( mChildEdit ); | 655 | label->setBuddy( mChildEdit ); |
656 | layout->addWidget( mChildEdit, iii, 2 ); | 656 | layout->addWidget( mChildEdit, iii, 2 ); |
657 | ++iii; | 657 | ++iii; |
658 | if ( QApplication::desktop()->width() == 640 ) { | 658 | if ( QApplication::desktop()->width() == 640 ) { |
659 | QHBox * nbox = new QHBox ( tab2 ); | 659 | QHBox * nbox = new QHBox ( tab2 ); |
660 | label = new QLabel( i18n( "Birthday:" )+" ", nbox ); | 660 | label = new QLabel( i18n( "Birthday:" )+" ", nbox ); |
661 | mBirthdayPicker = new KDateEdit( nbox ); | 661 | mBirthdayPicker = new KDateEdit( nbox ); |
662 | mBirthdayPicker->toggleDateFormat(); | 662 | mBirthdayPicker->toggleDateFormat(); |
663 | mBirthdayPicker->setHandleInvalid( true ); | 663 | mBirthdayPicker->setHandleInvalid( true ); |
664 | connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), | 664 | connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), |
665 | SLOT( dateChanged( QDate ) ) ); | 665 | SLOT( dateChanged( QDate ) ) ); |
666 | 666 | ||
667 | label->setBuddy( mBirthdayPicker ); | 667 | label->setBuddy( mBirthdayPicker ); |
668 | 668 | ||
669 | label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox ); | 669 | label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox ); |
670 | mAnniversaryPicker = new KDateEdit( nbox ); | 670 | mAnniversaryPicker = new KDateEdit( nbox ); |
671 | mAnniversaryPicker->setHandleInvalid( true ); | 671 | mAnniversaryPicker->setHandleInvalid( true ); |
672 | connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), | 672 | connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), |
673 | SLOT( dateChanged( QDate ) ) ); | 673 | SLOT( dateChanged( QDate ) ) ); |
674 | 674 | ||
675 | label->setBuddy( mAnniversaryPicker ); | 675 | label->setBuddy( mAnniversaryPicker ); |
676 | layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); | 676 | layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); |
677 | ++iii; | 677 | ++iii; |
678 | 678 | ||
679 | } else { | 679 | } else { |
680 | 680 | ||
681 | label = new QLabel( i18n( "Birthday:" ), tab2 ); | 681 | label = new QLabel( i18n( "Birthday:" ), tab2 ); |
682 | layout->addWidget( label, iii, 1 ); | 682 | layout->addWidget( label, iii, 1 ); |
683 | mBirthdayPicker = new KDateEdit( tab2 ); | 683 | mBirthdayPicker = new KDateEdit( tab2 ); |
684 | mBirthdayPicker->toggleDateFormat(); | 684 | mBirthdayPicker->toggleDateFormat(); |
685 | mBirthdayPicker->setHandleInvalid( true ); | 685 | mBirthdayPicker->setHandleInvalid( true ); |
686 | connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), | 686 | connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), |
687 | SLOT( dateChanged( QDate ) ) ); | 687 | SLOT( dateChanged( QDate ) ) ); |
688 | 688 | ||
689 | label->setBuddy( mBirthdayPicker ); | 689 | label->setBuddy( mBirthdayPicker ); |
690 | layout->addWidget( mBirthdayPicker, iii, 2 ); | 690 | layout->addWidget( mBirthdayPicker, iii, 2 ); |
691 | ++iii; | 691 | ++iii; |
692 | 692 | ||
693 | label = new QLabel( i18n( "Anniversary:" ), tab2 ); | 693 | label = new QLabel( i18n( "Anniversary:" ), tab2 ); |
694 | layout->addWidget( label, iii, 1 ); | 694 | layout->addWidget( label, iii, 1 ); |
695 | mAnniversaryPicker = new KDateEdit( tab2 ); | 695 | mAnniversaryPicker = new KDateEdit( tab2 ); |
696 | mAnniversaryPicker->setHandleInvalid( true ); | 696 | mAnniversaryPicker->setHandleInvalid( true ); |
697 | connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), | 697 | connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), |
698 | SLOT( dateChanged( QDate ) ) ); | 698 | SLOT( dateChanged( QDate ) ) ); |
699 | 699 | ||
700 | label->setBuddy( mAnniversaryPicker ); | 700 | label->setBuddy( mAnniversaryPicker ); |
701 | layout->addWidget( mAnniversaryPicker, iii, 2 ); | 701 | layout->addWidget( mAnniversaryPicker, iii, 2 ); |
702 | ++iii; | 702 | ++iii; |
703 | 703 | ||
704 | } | 704 | } |
705 | 705 | ||
706 | label = new QLabel( i18n( "Gender:" ), tab2 ); | 706 | label = new QLabel( i18n( "Gender:" ), tab2 ); |
707 | layout->addWidget( label, iii, 1 ); | 707 | layout->addWidget( label, iii, 1 ); |
708 | mGenderBox = new QComboBox ( tab2 ); | 708 | mGenderBox = new QComboBox ( tab2 ); |
709 | mGenderBox->insertItem ( i18n( "ALIEN (gender undefined)" )); | 709 | mGenderBox->insertItem ( i18n( "ALIEN (gender undefined)" )); |
710 | mGenderBox->insertItem ( i18n( "female" )); | 710 | mGenderBox->insertItem ( i18n( "female" )); |
711 | mGenderBox->insertItem ( i18n( "male" )); | 711 | mGenderBox->insertItem ( i18n( "male" )); |
712 | connect( mGenderBox, SIGNAL( activated ( const QString & ) ), | 712 | connect( mGenderBox, SIGNAL( activated ( const QString & ) ), |
713 | SLOT( textChanged( const QString& ) ) ); | 713 | SLOT( textChanged( const QString& ) ) ); |
714 | label->setBuddy( mGenderBox ); | 714 | label->setBuddy( mGenderBox ); |
715 | layout->addWidget( mGenderBox, iii, 2 ); | 715 | layout->addWidget( mGenderBox, iii, 2 ); |
716 | ++iii; | 716 | ++iii; |
717 | // Build the layout and add to the tab widget | 717 | // Build the layout and add to the tab widget |
718 | layout->activate(); // required | 718 | layout->activate(); // required |
719 | 719 | ||
720 | mTabWidget->addTab( tab2, i18n( "&Details" ) ); | 720 | mTabWidget->addTab( tab2, i18n( "&Details" ) ); |
721 | } | 721 | } |
722 | 722 | ||
723 | void AddresseeEditorWidget::setupTab2_1() | 723 | void AddresseeEditorWidget::setupTab2_1() |
724 | { | 724 | { |
725 | // This is the Details tab | 725 | // This is the Details tab |
726 | QWidget *tab2_2 = new QWidget( mTabWidget ); | 726 | QWidget *tab2_2 = new QWidget( mTabWidget ); |
727 | 727 | ||
728 | QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 ); | 728 | QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 ); |
729 | layout->setMargin( KDialogBase::marginHintSmall() ); | 729 | layout->setMargin( KDialogBase::marginHintSmall() ); |
730 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 730 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
731 | 731 | ||
732 | QLabel *label; | 732 | QLabel *label; |
733 | KSeparator* bar; | 733 | KSeparator* bar; |
734 | 734 | ||
735 | /*US | 735 | /*US |
736 | /////////////////////// | 736 | /////////////////////// |
737 | // Office info | 737 | // Office info |
738 | 738 | ||
739 | // Department | 739 | // Department |
740 | label = new QLabel( tab2 ); | 740 | label = new QLabel( tab2 ); |
741 | //US loadIcon call is ambiguous. Add one more parameter | 741 | //US loadIcon call is ambiguous. Add one more parameter |
742 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); | 742 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); |
743 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); | 743 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); |
744 | layout->addMultiCellWidget( label, 0, 1, 0, 0 ); | 744 | layout->addMultiCellWidget( label, 0, 1, 0, 0 ); |
745 | 745 | ||
746 | label = new QLabel( i18n( "Department:" ), tab2 ); | 746 | label = new QLabel( i18n( "Department:" ), tab2 ); |
747 | layout->addWidget( label, 0, 1 ); | 747 | layout->addWidget( label, 0, 1 ); |
748 | mDepartmentEdit = new KLineEdit( tab2 ); | 748 | mDepartmentEdit = new KLineEdit( tab2 ); |
749 | connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), | 749 | connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), |
750 | SLOT( textChanged( const QString& ) ) ); | 750 | SLOT( textChanged( const QString& ) ) ); |
751 | label->setBuddy( mDepartmentEdit ); | 751 | label->setBuddy( mDepartmentEdit ); |
752 | layout->addWidget( mDepartmentEdit, 0, 2 ); | 752 | layout->addWidget( mDepartmentEdit, 0, 2 ); |
753 | 753 | ||
754 | label = new QLabel( i18n( "Office:" ), tab2 ); | 754 | label = new QLabel( i18n( "Office:" ), tab2 ); |
755 | layout->addWidget( label, 1, 1 ); | 755 | layout->addWidget( label, 1, 1 ); |
756 | mOfficeEdit = new KLineEdit( tab2 ); | 756 | mOfficeEdit = new KLineEdit( tab2 ); |
757 | connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), | 757 | connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), |
758 | SLOT( textChanged( const QString& ) ) ); | 758 | SLOT( textChanged( const QString& ) ) ); |
759 | label->setBuddy( mOfficeEdit ); | 759 | label->setBuddy( mOfficeEdit ); |
760 | layout->addWidget( mOfficeEdit, 1, 2 ); | 760 | layout->addWidget( mOfficeEdit, 1, 2 ); |
761 | 761 | ||
762 | label = new QLabel( i18n( "Profession:" ), tab2 ); | 762 | label = new QLabel( i18n( "Profession:" ), tab2 ); |
763 | layout->addWidget( label, 2, 1 ); | 763 | layout->addWidget( label, 2, 1 ); |
764 | mProfessionEdit = new KLineEdit( tab2 ); | 764 | mProfessionEdit = new KLineEdit( tab2 ); |
765 | connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), | 765 | connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), |
766 | SLOT( textChanged( const QString& ) ) ); | 766 | SLOT( textChanged( const QString& ) ) ); |
767 | label->setBuddy( mProfessionEdit ); | 767 | label->setBuddy( mProfessionEdit ); |
768 | layout->addWidget( mProfessionEdit, 2, 2 ); | 768 | layout->addWidget( mProfessionEdit, 2, 2 ); |
769 | 769 | ||
770 | label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); | 770 | label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); |
771 | layout->addWidget( label, 0, 3 ); | 771 | layout->addWidget( label, 0, 3 ); |
772 | mManagerEdit = new KLineEdit( tab2 ); | 772 | mManagerEdit = new KLineEdit( tab2 ); |
773 | connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), | 773 | connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), |
774 | SLOT( textChanged( const QString& ) ) ); | 774 | SLOT( textChanged( const QString& ) ) ); |
775 | label->setBuddy( mManagerEdit ); | 775 | label->setBuddy( mManagerEdit ); |
776 | layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); | 776 | layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); |
777 | 777 | ||
778 | label = new QLabel( i18n( "Assistant's name:" ), tab2 ); | 778 | label = new QLabel( i18n( "Assistant's name:" ), tab2 ); |
779 | layout->addWidget( label, 1, 3 ); | 779 | layout->addWidget( label, 1, 3 ); |
780 | mAssistantEdit = new KLineEdit( tab2 ); | 780 | mAssistantEdit = new KLineEdit( tab2 ); |
781 | connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), | 781 | connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), |
782 | SLOT( textChanged( const QString& ) ) ); | 782 | SLOT( textChanged( const QString& ) ) ); |
783 | label->setBuddy( mAssistantEdit ); | 783 | label->setBuddy( mAssistantEdit ); |
784 | layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); | 784 | layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); |
785 | 785 | ||
786 | bar = new KSeparator( KSeparator::HLine, tab2 ); | 786 | bar = new KSeparator( KSeparator::HLine, tab2 ); |
787 | layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); | 787 | layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); |
788 | 788 | ||
789 | ///////////////////////////////////////////////// | 789 | ///////////////////////////////////////////////// |
790 | // Personal info | 790 | // Personal info |
791 | 791 | ||
792 | label = new QLabel( tab2 ); | 792 | label = new QLabel( tab2 ); |
793 | //US loadIcon call is ambiguous. Add one more parameter | 793 | //US loadIcon call is ambiguous. Add one more parameter |
794 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); | 794 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); |
795 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); | 795 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); |
796 | layout->addMultiCellWidget( label, 4, 5, 0, 0 ); | 796 | layout->addMultiCellWidget( label, 4, 5, 0, 0 ); |
797 | 797 | ||
798 | label = new QLabel( i18n( "Nick name:" ), tab2 ); | 798 | label = new QLabel( i18n( "Nick name:" ), tab2 ); |
799 | layout->addWidget( label, 4, 1 ); | 799 | layout->addWidget( label, 4, 1 ); |
800 | mNicknameEdit = new KLineEdit( tab2 ); | 800 | mNicknameEdit = new KLineEdit( tab2 ); |
801 | connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), | 801 | connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), |
802 | SLOT( textChanged( const QString& ) ) ); | 802 | SLOT( textChanged( const QString& ) ) ); |
803 | label->setBuddy( mNicknameEdit ); | 803 | label->setBuddy( mNicknameEdit ); |
804 | layout->addWidget( mNicknameEdit, 4, 2 ); | 804 | layout->addWidget( mNicknameEdit, 4, 2 ); |
805 | 805 | ||
806 | label = new QLabel( i18n( "Spouse's name:" ), tab2 ); | 806 | label = new QLabel( i18n( "Spouse's name:" ), tab2 ); |
807 | layout->addWidget( label, 5, 1 ); | 807 | layout->addWidget( label, 5, 1 ); |
808 | mSpouseEdit = new KLineEdit( tab2 ); | 808 | mSpouseEdit = new KLineEdit( tab2 ); |
809 | connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), | 809 | connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), |
810 | SLOT( textChanged( const QString& ) ) ); | 810 | SLOT( textChanged( const QString& ) ) ); |
811 | label->setBuddy( mSpouseEdit ); | 811 | label->setBuddy( mSpouseEdit ); |
812 | layout->addWidget( mSpouseEdit, 5, 2 ); | 812 | layout->addWidget( mSpouseEdit, 5, 2 ); |
813 | 813 | ||
814 | label = new QLabel( i18n( "Birthday:" ), tab2 ); | 814 | label = new QLabel( i18n( "Birthday:" ), tab2 ); |
815 | layout->addWidget( label, 4, 3 ); | 815 | layout->addWidget( label, 4, 3 ); |
816 | mBirthdayPicker = new KDateEdit( tab2 ); | 816 | mBirthdayPicker = new KDateEdit( tab2 ); |
817 | mBirthdayPicker->setHandleInvalid( true ); | 817 | mBirthdayPicker->setHandleInvalid( true ); |
818 | connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), | 818 | connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), |
819 | SLOT( dateChanged( QDate ) ) ); | 819 | SLOT( dateChanged( QDate ) ) ); |
820 | connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ), | 820 | connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ), |
821 | SLOT( invalidDate() ) ); | 821 | SLOT( invalidDate() ) ); |
822 | connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ), | 822 | connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ), |
823 | SLOT( emitModified() ) ); | 823 | SLOT( emitModified() ) ); |
824 | label->setBuddy( mBirthdayPicker ); | 824 | label->setBuddy( mBirthdayPicker ); |
825 | layout->addWidget( mBirthdayPicker, 4, 4 ); | 825 | layout->addWidget( mBirthdayPicker, 4, 4 ); |
826 | 826 | ||
827 | label = new QLabel( i18n( "Anniversary:" ), tab2 ); | 827 | label = new QLabel( i18n( "Anniversary:" ), tab2 ); |
828 | layout->addWidget( label, 5, 3 ); | 828 | layout->addWidget( label, 5, 3 ); |
829 | mAnniversaryPicker = new KDateEdit( tab2 ); | 829 | mAnniversaryPicker = new KDateEdit( tab2 ); |
830 | mAnniversaryPicker->setHandleInvalid( true ); | 830 | mAnniversaryPicker->setHandleInvalid( true ); |
831 | connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), | 831 | connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), |
832 | SLOT( dateChanged( QDate ) ) ); | 832 | SLOT( dateChanged( QDate ) ) ); |
833 | connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ), | 833 | connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ), |
834 | SLOT( invalidDate() ) ); | 834 | SLOT( invalidDate() ) ); |
835 | connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ), | 835 | connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ), |
836 | SLOT( emitModified() ) ); | 836 | SLOT( emitModified() ) ); |
837 | label->setBuddy( mAnniversaryPicker ); | 837 | label->setBuddy( mAnniversaryPicker ); |
838 | layout->addWidget( mAnniversaryPicker, 5, 4 ); | 838 | layout->addWidget( mAnniversaryPicker, 5, 4 ); |
839 | 839 | ||
840 | bar = new KSeparator( KSeparator::HLine, tab2 ); | 840 | bar = new KSeparator( KSeparator::HLine, tab2 ); |
841 | layout->addMultiCellWidget( bar, 6, 6, 0, 5 ); | 841 | layout->addMultiCellWidget( bar, 6, 6, 0, 5 ); |
842 | */ | 842 | */ |
843 | ////////////////////////////////////// | 843 | ////////////////////////////////////// |
844 | // Notes | 844 | // Notes |
845 | label = new QLabel( i18n( "Note:" ), tab2_2 ); | 845 | label = new QLabel( i18n( "Note:" ), tab2_2 ); |
846 | label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); | 846 | label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); |
847 | //US layout->addWidget( label, 7, 0 ); | 847 | //US layout->addWidget( label, 7, 0 ); |
848 | layout->addWidget( label, 0, 0 ); | 848 | layout->addWidget( label, 0, 0 ); |
849 | #ifndef KAB_EMBEDDED | 849 | #ifndef KAB_EMBEDDED |
850 | mNoteEdit = new QTextEdit( tab2_2 ); | 850 | mNoteEdit = new QTextEdit( tab2_2 ); |
851 | mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); | 851 | mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); |
852 | mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); | 852 | mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); |
853 | #else //KAB_EMBEDDED | 853 | #else //KAB_EMBEDDED |
854 | mNoteEdit = new QMultiLineEdit( tab2_2 ); | 854 | mNoteEdit = new QMultiLineEdit( tab2_2 ); |
855 | mNoteEdit->setWordWrap( QMultiLineEdit::WidgetWidth ); | 855 | mNoteEdit->setWordWrap( QMultiLineEdit::WidgetWidth ); |
856 | mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); | 856 | mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); |
857 | #endif //KAB_EMBEDDED | 857 | #endif //KAB_EMBEDDED |
858 | 858 | ||
859 | connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) ); | 859 | connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) ); |
860 | label->setBuddy( mNoteEdit ); | 860 | label->setBuddy( mNoteEdit ); |
861 | //US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 ); | 861 | //US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 ); |
862 | layout->addWidget( mNoteEdit, 1, 0); | 862 | layout->addWidget( mNoteEdit, 1, 0); |
863 | 863 | ||
864 | // Build the layout and add to the tab widget | 864 | // Build the layout and add to the tab widget |
865 | layout->activate(); // required | 865 | layout->activate(); // required |
866 | 866 | ||
867 | mTabWidget->addTab( tab2_2, i18n( "&Notes" ) ); | 867 | mTabWidget->addTab( tab2_2, i18n( "&Notes" ) ); |
868 | } | 868 | } |
869 | 869 | ||
870 | 870 | ||
871 | 871 | ||
872 | void AddresseeEditorWidget::setupTab3() | 872 | void AddresseeEditorWidget::setupTab3() |
873 | { | 873 | { |
874 | // This is the Misc tab | 874 | // This is the Misc tab |
875 | QWidget *tab3 = new QWidget( mTabWidget ); | 875 | QWidget *tab3 = new QWidget( mTabWidget ); |
876 | 876 | ||
877 | QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); | 877 | QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); |
878 | layout->setMargin( KDialogBase::marginHintSmall() ); | 878 | layout->setMargin( KDialogBase::marginHintSmall() ); |
879 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 879 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
880 | //US layout->setColStretch( 2, 1 ); | 880 | //US layout->setColStretch( 2, 1 ); |
881 | 881 | ||
882 | ////////////////////////////////////// | 882 | ////////////////////////////////////// |
883 | // Geo | 883 | // Geo |
884 | mGeoWidget = new GeoWidget( tab3 ); | 884 | mGeoWidget = new GeoWidget( tab3 ); |
885 | // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); | 885 | // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); |
886 | connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 886 | connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
887 | layout->addWidget( mGeoWidget, 0, 0 ); | 887 | layout->addWidget( mGeoWidget, 0, 0 ); |
888 | /*US | 888 | /*US |
889 | ////////////////////////////////////// | 889 | ////////////////////////////////////// |
890 | // Sound | 890 | // Sound |
891 | #ifndef KAB_EMBEDDED | 891 | #ifndef KAB_EMBEDDED |
892 | mSoundWidget = new SoundWidget( tab3 ); | 892 | mSoundWidget = new SoundWidget( tab3 ); |
893 | mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); | 893 | mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); |
894 | connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 894 | connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
895 | layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); | 895 | layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); |
896 | #else //KAB_EMBEDDED | 896 | #else //KAB_EMBEDDED |
897 | qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); | 897 | qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); |
898 | #endif //KAB_EMBEDDED | 898 | #endif //KAB_EMBEDDED |
899 | 899 | ||
900 | ////////////////////////////////////// | 900 | ////////////////////////////////////// |
901 | // Images | 901 | // Images |
902 | mImageWidget = new ImageWidget( tab3 ); | 902 | mImageWidget = new ImageWidget( tab3 ); |
903 | mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); | 903 | mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); |
904 | connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 904 | connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
905 | layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop ); | 905 | layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop ); |
906 | */ | 906 | */ |
907 | //US | 907 | //US |
908 | /* | 908 | /* |
909 | KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 ); | 909 | KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 ); |
910 | layout->addMultiCellWidget( bar, 1, 1, 0, 0 ); | 910 | layout->addMultiCellWidget( bar, 1, 1, 0, 0 ); |
911 | */ | 911 | */ |
912 | ////////////////////////////////////// | 912 | ////////////////////////////////////// |
913 | // Keys | 913 | // Keys |
914 | mKeyWidget = new KeyWidget( tab3 ); | 914 | mKeyWidget = new KeyWidget( tab3 ); |
915 | //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); | 915 | //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); |
916 | connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 916 | connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
917 | //US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); | 917 | //US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); |
918 | layout->addWidget( mKeyWidget, 1, 0 ); | 918 | layout->addWidget( mKeyWidget, 1, 0 ); |
919 | 919 | ||
920 | mTabWidget->addTab( tab3, i18n( "&Misc" ) ); | 920 | mTabWidget->addTab( tab3, i18n( "&Misc" ) ); |
921 | } | 921 | } |
922 | 922 | ||
923 | void AddresseeEditorWidget::setupTab3_1() | 923 | void AddresseeEditorWidget::setupTab3_1() |
924 | { | 924 | { |
925 | // This is the Misc tab | 925 | // This is the Misc tab |
926 | QWidget *tab3 = new QWidget( mTabWidget ); | 926 | QWidget *tab3 = new QWidget( mTabWidget ); |
927 | 927 | ||
928 | //US QGridLayout *layout = new QGridLayout( tab3, 2, 3 ); | 928 | //US QGridLayout *layout = new QGridLayout( tab3, 2, 3 ); |
929 | QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); | 929 | QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); |
930 | layout->setMargin( KDialogBase::marginHint() ); | 930 | layout->setMargin( KDialogBase::marginHint() ); |
931 | layout->setSpacing( KDialogBase::spacingHint() ); | 931 | layout->setSpacing( KDialogBase::spacingHint() ); |
932 | //US layout->setColStretch( 2, 1 ); | 932 | //US layout->setColStretch( 2, 1 ); |
933 | 933 | ||
934 | /*US | 934 | /*US |
935 | ////////////////////////////////////// | 935 | ////////////////////////////////////// |
936 | // Geo | 936 | // Geo |
937 | mGeoWidget = new GeoWidget( tab3 ); | 937 | mGeoWidget = new GeoWidget( tab3 ); |
938 | mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); | 938 | mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); |
939 | connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 939 | connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
940 | layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop ); | 940 | layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop ); |
941 | */ | 941 | */ |
942 | ////////////////////////////////////// | 942 | ////////////////////////////////////// |
943 | // Sound | 943 | // Sound |
944 | #ifndef KAB_EMBEDDED | 944 | #ifndef KAB_EMBEDDED |
945 | mSoundWidget = new SoundWidget( tab3 ); | 945 | mSoundWidget = new SoundWidget( tab3 ); |
946 | mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); | 946 | mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); |
947 | connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 947 | connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
948 | layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); | 948 | layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); |
949 | #else //KAB_EMBEDDED | 949 | #else //KAB_EMBEDDED |
950 | //US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); | 950 | //US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); |
951 | #endif //KAB_EMBEDDED | 951 | #endif //KAB_EMBEDDED |
952 | 952 | ||
953 | ////////////////////////////////////// | 953 | ////////////////////////////////////// |
954 | // Images | 954 | // Images |
955 | mImageWidget = new ImageWidget( tab3 ); | 955 | mImageWidget = new ImageWidget( tab3 ); |
956 | mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); | 956 | mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); |
957 | connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 957 | connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
958 | layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop ); | 958 | layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop ); |
959 | /*US | 959 | /*US |
960 | ////////////////////////////////////// | 960 | ////////////////////////////////////// |
961 | // Keys | 961 | // Keys |
962 | mKeyWidget = new KeyWidget( tab3 ); | 962 | mKeyWidget = new KeyWidget( tab3 ); |
963 | mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); | 963 | mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); |
964 | connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 964 | connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
965 | layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); | 965 | layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); |
966 | */ | 966 | */ |
967 | mTabWidget->addTab( tab3, i18n( "&Images" ) ); | 967 | mTabWidget->addTab( tab3, i18n( "&Images" ) ); |
968 | } | 968 | } |
969 | 969 | ||
970 | 970 | ||
971 | void AddresseeEditorWidget::load() | 971 | void AddresseeEditorWidget::load() |
972 | { | 972 | { |
973 | 973 | ||
974 | // Block signals in case anything tries to emit modified | 974 | // Block signals in case anything tries to emit modified |
975 | // CS: This doesn't seem to work. | 975 | // CS: This doesn't seem to work. |
976 | bool block = signalsBlocked(); | 976 | bool block = signalsBlocked(); |
977 | blockSignals( true ); | 977 | blockSignals( true ); |
978 | mBlockSignals = true; // used for internal signal blocking | 978 | mBlockSignals = true; // used for internal signal blocking |
979 | 979 | ||
980 | mNameEdit->setText( mAddressee.assembledName() ); | 980 | mNameEdit->setText( mAddressee.assembledName() ); |
981 | 981 | ||
982 | if ( mAddressee.formattedName().isEmpty() ) { | 982 | if ( mAddressee.formattedName().isEmpty() ) { |
983 | //US KConfig config( "kaddressbookrc" ); | 983 | //US KConfig config( "kaddressbookrc" ); |
984 | KConfig config( locateLocal("config", "kaddressbookrc") ); | 984 | KConfig config( locateLocal("config", "kaddressbookrc") ); |
985 | config.setGroup( "General" ); | 985 | config.setGroup( "General" ); |
986 | mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 ); | 986 | mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 ); |
987 | mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); | 987 | mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); |
988 | } else { | 988 | } else { |
989 | if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) ) | 989 | if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) ) |
990 | mFormattedNameType = NameEditDialog::SimpleName; | 990 | mFormattedNameType = NameEditDialog::SimpleName; |
991 | else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) ) | 991 | else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) ) |
992 | mFormattedNameType = NameEditDialog::FullName; | 992 | mFormattedNameType = NameEditDialog::FullName; |
993 | else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) ) | 993 | else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) ) |
994 | mFormattedNameType = NameEditDialog::ReverseName; | 994 | mFormattedNameType = NameEditDialog::ReverseName; |
995 | else | 995 | else |
996 | mFormattedNameType = NameEditDialog::CustomName; | 996 | mFormattedNameType = NameEditDialog::CustomName; |
997 | } | 997 | } |
998 | 998 | ||
999 | mFormattedNameLabel->setText( mAddressee.formattedName() ); | 999 | mFormattedNameLabel->setText( mAddressee.formattedName() ); |
1000 | 1000 | ||
1001 | mRoleEdit->setText( mAddressee.role() ); | 1001 | mRoleEdit->setText( mAddressee.role() ); |
1002 | mOrgEdit->setText( mAddressee.organization() ); | 1002 | mOrgEdit->setText( mAddressee.organization() ); |
1003 | 1003 | ||
1004 | //US mURLEdit->setURL( mAddressee.url().url() ); | 1004 | //US mURLEdit->setURL( mAddressee.url().url() ); |
1005 | mURLEdit->setText( mAddressee.url().prettyURL() ); | 1005 | mURLEdit->setText( mAddressee.url().prettyURL() ); |
1006 | //US?? mURLEdit->home( false ); | 1006 | //US?? mURLEdit->home( false ); |
1007 | 1007 | ||
1008 | // mNoteEdit->setText( mAddressee.note() ); | 1008 | // mNoteEdit->setText( mAddressee.note() ); |
1009 | mNoteEdit->setText( mAddressee.note() ); | 1009 | mNoteEdit->setText( mAddressee.note() ); |
1010 | mEmailWidget->setEmails( mAddressee.emails() ); | 1010 | mEmailWidget->setEmails( mAddressee.emails() ); |
1011 | mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() ); | 1011 | mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() ); |
1012 | mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() ); | 1012 | mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() ); |
1013 | mBirthdayPicker->setDate( mAddressee.birthday().date() ); | 1013 | mBirthdayPicker->setDate( mAddressee.birthday().date() ); |
1014 | 1014 | ||
1015 | //US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom( | 1015 | //US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom( |
1016 | //US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) ); | 1016 | //US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) ); |
1017 | QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), | 1017 | QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), |
1018 | "%Y-%m-%d"); // = Qt::ISODate | 1018 | "%Y-%m-%d"); // = Qt::ISODate |
1019 | mAnniversaryPicker->setDate( dt ); | 1019 | mAnniversaryPicker->setDate( dt ); |
1020 | 1020 | ||
1021 | 1021 | ||
1022 | mNicknameEdit->setText( mAddressee.nickName() ); | 1022 | mNicknameEdit->setText( mAddressee.nickName() ); |
1023 | mCategoryEdit->setText( mAddressee.categories().join( "," ) ); | 1023 | mCategoryEdit->setText( mAddressee.categories().join( "," ) ); |
1024 | 1024 | ||
1025 | mGeoWidget->setGeo( mAddressee.geo() ); | 1025 | mGeoWidget->setGeo( mAddressee.geo() ); |
1026 | mImageWidget->setPhoto( mAddressee.photo() ); | 1026 | mImageWidget->setPhoto( mAddressee.photo() ); |
1027 | mImageWidget->setLogo( mAddressee.logo() ); | 1027 | mImageWidget->setLogo( mAddressee.logo() ); |
1028 | mKeyWidget->setKeys( mAddressee.keys() ); | 1028 | mKeyWidget->setKeys( mAddressee.keys() ); |
1029 | mSecrecyWidget->setSecrecy( mAddressee.secrecy() ); | 1029 | mSecrecyWidget->setSecrecy( mAddressee.secrecy() ); |
1030 | #ifndef KAB_EMBEDDED | 1030 | #ifndef KAB_EMBEDDED |
1031 | mSoundWidget->setSound( mAddressee.sound() ); | 1031 | mSoundWidget->setSound( mAddressee.sound() ); |
1032 | #else //KAB_EMBEDDED | 1032 | #else //KAB_EMBEDDED |
1033 | //US qDebug("AddresseeEditorWidget::load has to be changed 2"); | 1033 | //US qDebug("AddresseeEditorWidget::load has to be changed 2"); |
1034 | #endif //KAB_EMBEDDED | 1034 | #endif //KAB_EMBEDDED |
1035 | 1035 | ||
1036 | // Load customs | 1036 | // Load customs |
1037 | mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); | 1037 | mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); |
1038 | mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); | 1038 | mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); |
1039 | mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) ); | 1039 | mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) ); |
1040 | mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); | 1040 | mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); |
1041 | mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); | 1041 | mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); |
1042 | mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); | 1042 | mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); |
1043 | mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); | 1043 | mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); |
1044 | mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); | 1044 | mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); |
1045 | QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); | 1045 | QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); |
1046 | if ( gen == "female" ) | 1046 | if ( gen == "female" ) |
1047 | mGenderBox->setCurrentItem ( 1 ); | 1047 | mGenderBox->setCurrentItem ( 1 ); |
1048 | else if ( gen == "male" ) | 1048 | else if ( gen == "male" ) |
1049 | mGenderBox->setCurrentItem ( 2 ); | 1049 | mGenderBox->setCurrentItem ( 2 ); |
1050 | else | 1050 | else |
1051 | mGenderBox->setCurrentItem ( 0 ); | 1051 | mGenderBox->setCurrentItem ( 0 ); |
1052 | blockSignals( block ); | 1052 | blockSignals( block ); |
1053 | mBlockSignals = false; | 1053 | mBlockSignals = false; |
1054 | 1054 | ||
1055 | mDirty = false; | 1055 | mDirty = false; |
1056 | } | 1056 | } |
1057 | 1057 | ||
1058 | void AddresseeEditorWidget::save() | 1058 | void AddresseeEditorWidget::save() |
1059 | { | 1059 | { |
1060 | if ( !dirty() ) { | 1060 | if ( !dirty() ) { |
1061 | return; | 1061 | return; |
1062 | } | 1062 | } |
1063 | 1063 | ||
1064 | mAddressee.setRole( mRoleEdit->text() ); | 1064 | mAddressee.setRole( mRoleEdit->text() ); |
1065 | mAddressee.setOrganization( mOrgEdit->text() ); | 1065 | mAddressee.setOrganization( mOrgEdit->text() ); |
1066 | mAddressee.setUrl( KURL( mURLEdit->text() ) ); | 1066 | mAddressee.setUrl( KURL( mURLEdit->text() ) ); |
1067 | mAddressee.setNote( mNoteEdit->text() ); | 1067 | mAddressee.setNote( mNoteEdit->text() ); |
1068 | if ( mBirthdayPicker->inputIsValid() ) { | 1068 | if ( mBirthdayPicker->inputIsValid() ) { |
1069 | QDate da = mBirthdayPicker->date(); | 1069 | QDate da = mBirthdayPicker->date(); |
1070 | if ( da > QDate::currentDate() ) | 1070 | if ( da > QDate::currentDate() ) |
1071 | da.setYMD(da.year()-100, da.month(), da.day() ); | 1071 | da.setYMD(da.year()-100, da.month(), da.day() ); |
1072 | mAddressee.setBirthday( QDateTime( da ) ); | 1072 | mAddressee.setBirthday( QDateTime( da ) ); |
1073 | qDebug("bday %s ",da.toString().latin1()); | 1073 | //qDebug("bday %s ",da.toString().latin1()); |
1074 | } | 1074 | } |
1075 | else { | 1075 | else { |
1076 | mAddressee.setBirthday( QDateTime() ); | 1076 | mAddressee.setBirthday( QDateTime() ); |
1077 | mBirthdayPicker->clear(); | 1077 | mBirthdayPicker->clear(); |
1078 | } | 1078 | } |
1079 | mAddressee.setNickName( mNicknameEdit->text() ); | 1079 | mAddressee.setNickName( mNicknameEdit->text() ); |
1080 | mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); | 1080 | mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); |
1081 | 1081 | ||
1082 | mAddressee.setGeo( mGeoWidget->geo() ); | 1082 | mAddressee.setGeo( mGeoWidget->geo() ); |
1083 | mAddressee.setPhoto( mImageWidget->photo() ); | 1083 | mAddressee.setPhoto( mImageWidget->photo() ); |
1084 | mAddressee.setLogo( mImageWidget->logo() ); | 1084 | mAddressee.setLogo( mImageWidget->logo() ); |
1085 | mAddressee.setKeys( mKeyWidget->keys() ); | 1085 | mAddressee.setKeys( mKeyWidget->keys() ); |
1086 | #ifndef KAB_EMBEDDED | 1086 | #ifndef KAB_EMBEDDED |
1087 | mAddressee.setSound( mSoundWidget->sound() ); | 1087 | mAddressee.setSound( mSoundWidget->sound() ); |
1088 | #else //KAB_EMBEDDED | 1088 | #else //KAB_EMBEDDED |
1089 | //US qDebug("AddresseeEditorWidget::save sound not supported"); | 1089 | //US qDebug("AddresseeEditorWidget::save sound not supported"); |
1090 | #endif //KAB_EMBEDDED | 1090 | #endif //KAB_EMBEDDED |
1091 | mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); | 1091 | mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); |
1092 | 1092 | ||
1093 | // save custom fields | 1093 | // save custom fields |
1094 | mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); | 1094 | mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); |
1095 | mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); | 1095 | mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); |
1096 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() ); | 1096 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() ); |
1097 | mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); | 1097 | mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); |
1098 | mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); | 1098 | mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); |
1099 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); | 1099 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); |
1100 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); | 1100 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); |
1101 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); | 1101 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); |
1102 | if ( mAnniversaryPicker->inputIsValid() ) { | 1102 | if ( mAnniversaryPicker->inputIsValid() ) { |
1103 | QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); | 1103 | QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); |
1104 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); | 1104 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); |
1105 | } | 1105 | } |
1106 | else { | 1106 | else { |
1107 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); | 1107 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); |
1108 | mAnniversaryPicker->clear(); | 1108 | mAnniversaryPicker->clear(); |
1109 | } | 1109 | } |
1110 | int gen = mGenderBox->currentItem (); | 1110 | int gen = mGenderBox->currentItem (); |
1111 | if ( gen == 1 ) | 1111 | if ( gen == 1 ) |
1112 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); | 1112 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); |
1113 | else if ( gen == 2 ) | 1113 | else if ( gen == 2 ) |
1114 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); | 1114 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); |
1115 | else | 1115 | else |
1116 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" ); | 1116 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" ); |
1117 | 1117 | ||
1118 | // Save the email addresses | 1118 | // Save the email addresses |
1119 | QStringList emails = mAddressee.emails(); | 1119 | QStringList emails = mAddressee.emails(); |
1120 | QStringList::Iterator iter; | 1120 | QStringList::Iterator iter; |
1121 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) | 1121 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) |
1122 | mAddressee.removeEmail( *iter ); | 1122 | mAddressee.removeEmail( *iter ); |
1123 | 1123 | ||
1124 | emails = mEmailWidget->emails(); | 1124 | emails = mEmailWidget->emails(); |
1125 | bool first = true; | 1125 | bool first = true; |
1126 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) { | 1126 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) { |
1127 | mAddressee.insertEmail( *iter, first ); | 1127 | mAddressee.insertEmail( *iter, first ); |
1128 | first = false; | 1128 | first = false; |
1129 | } | 1129 | } |
1130 | 1130 | ||
1131 | // Save the phone numbers | 1131 | // Save the phone numbers |
1132 | KABC::PhoneNumber::List phoneNumbers; | 1132 | KABC::PhoneNumber::List phoneNumbers; |
1133 | KABC::PhoneNumber::List::Iterator phoneIter; | 1133 | KABC::PhoneNumber::List::Iterator phoneIter; |
1134 | phoneNumbers = mAddressee.phoneNumbers(); | 1134 | phoneNumbers = mAddressee.phoneNumbers(); |
1135 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); | 1135 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); |
1136 | ++phoneIter ) | 1136 | ++phoneIter ) |
1137 | mAddressee.removePhoneNumber( *phoneIter ); | 1137 | mAddressee.removePhoneNumber( *phoneIter ); |
1138 | 1138 | ||
1139 | phoneNumbers = mPhoneEditWidget->phoneNumbers(); | 1139 | phoneNumbers = mPhoneEditWidget->phoneNumbers(); |
1140 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); | 1140 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); |
1141 | ++phoneIter ) | 1141 | ++phoneIter ) |
1142 | mAddressee.insertPhoneNumber( *phoneIter ); | 1142 | mAddressee.insertPhoneNumber( *phoneIter ); |
1143 | 1143 | ||
1144 | // Save the addresses | 1144 | // Save the addresses |
1145 | KABC::Address::List addresses; | 1145 | KABC::Address::List addresses; |
1146 | KABC::Address::List::Iterator addressIter; | 1146 | KABC::Address::List::Iterator addressIter; |
1147 | addresses = mAddressee.addresses(); | 1147 | addresses = mAddressee.addresses(); |
1148 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); | 1148 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); |
1149 | ++addressIter ) | 1149 | ++addressIter ) |
1150 | mAddressee.removeAddress( *addressIter ); | 1150 | mAddressee.removeAddress( *addressIter ); |
1151 | 1151 | ||
1152 | addresses = mAddressEditWidget->addresses(); | 1152 | addresses = mAddressEditWidget->addresses(); |
1153 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); | 1153 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); |
1154 | ++addressIter ) | 1154 | ++addressIter ) |
1155 | mAddressee.insertAddress( *addressIter ); | 1155 | mAddressee.insertAddress( *addressIter ); |
1156 | mDirty = false; | 1156 | mDirty = false; |
1157 | } | 1157 | } |
1158 | 1158 | ||
1159 | bool AddresseeEditorWidget::dirty() | 1159 | bool AddresseeEditorWidget::dirty() |
1160 | { | 1160 | { |
1161 | 1161 | ||
1162 | if ( ! mDirty ) { | 1162 | if ( ! mDirty ) { |
1163 | if ( mBirthdayPicker->inputIsValid() ) { | 1163 | if ( mBirthdayPicker->inputIsValid() ) { |
1164 | QDate da = mBirthdayPicker->date(); | 1164 | QDate da = mBirthdayPicker->date(); |
1165 | if ( !(da == mAddressee.birthday().date())) | 1165 | if ( !(da == mAddressee.birthday().date())) |
1166 | mDirty = true; | 1166 | mDirty = true; |
1167 | } | 1167 | } |
1168 | else { | 1168 | else { |
1169 | mBirthdayPicker->clear(); | 1169 | mBirthdayPicker->clear(); |
1170 | } | 1170 | } |
1171 | if ( mAnniversaryPicker->inputIsValid() ) { | 1171 | if ( mAnniversaryPicker->inputIsValid() ) { |
1172 | QDate da = mAnniversaryPicker->date(); | 1172 | QDate da = mAnniversaryPicker->date(); |
1173 | if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), | 1173 | if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), |
1174 | "%Y-%m-%d")) | 1174 | "%Y-%m-%d")) |
1175 | mDirty = true; | 1175 | mDirty = true; |
1176 | } | 1176 | } |
1177 | else { | 1177 | else { |
1178 | mAnniversaryPicker->clear(); | 1178 | mAnniversaryPicker->clear(); |
1179 | } | 1179 | } |
1180 | } | 1180 | } |
1181 | return mDirty; | 1181 | return mDirty; |
1182 | } | 1182 | } |
1183 | 1183 | ||
1184 | void AddresseeEditorWidget::nameTextChanged( const QString &text ) | 1184 | void AddresseeEditorWidget::nameTextChanged( const QString &text ) |
1185 | { | 1185 | { |
1186 | // use the addressee class to parse the name for us | 1186 | // use the addressee class to parse the name for us |
1187 | mAConfig->setUid( mAddressee.uid() ); | 1187 | mAConfig->setUid( mAddressee.uid() ); |
1188 | if ( mAConfig->automaticNameParsing() ) { | 1188 | if ( mAConfig->automaticNameParsing() ) { |
1189 | if ( !mAddressee.formattedName().isEmpty() ) { | 1189 | if ( !mAddressee.formattedName().isEmpty() ) { |
1190 | QString fn = mAddressee.formattedName(); | 1190 | QString fn = mAddressee.formattedName(); |
1191 | mAddressee.setNameFromString( text ); | 1191 | mAddressee.setNameFromString( text ); |
1192 | mAddressee.setFormattedName( fn ); | 1192 | mAddressee.setFormattedName( fn ); |
1193 | } else { | 1193 | } else { |
1194 | // use extra addressee to avoid a formatted name assignment | 1194 | // use extra addressee to avoid a formatted name assignment |
1195 | Addressee addr; | 1195 | Addressee addr; |
1196 | addr.setNameFromString( text ); | 1196 | addr.setNameFromString( text ); |
1197 | mAddressee.setPrefix( addr.prefix() ); | 1197 | mAddressee.setPrefix( addr.prefix() ); |
1198 | mAddressee.setGivenName( addr.givenName() ); | 1198 | mAddressee.setGivenName( addr.givenName() ); |
1199 | mAddressee.setAdditionalName( addr.additionalName() ); | 1199 | mAddressee.setAdditionalName( addr.additionalName() ); |
1200 | mAddressee.setFamilyName( addr.familyName() ); | 1200 | mAddressee.setFamilyName( addr.familyName() ); |
1201 | mAddressee.setSuffix( addr.suffix() ); | 1201 | mAddressee.setSuffix( addr.suffix() ); |
1202 | } | 1202 | } |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | nameBoxChanged(); | 1205 | nameBoxChanged(); |
1206 | 1206 | ||
1207 | emitModified(); | 1207 | emitModified(); |
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | void AddresseeEditorWidget::nameBoxChanged() | 1210 | void AddresseeEditorWidget::nameBoxChanged() |
1211 | { | 1211 | { |
1212 | KABC::Addressee addr; | 1212 | KABC::Addressee addr; |
1213 | mAConfig->setUid( mAddressee.uid() ); | 1213 | mAConfig->setUid( mAddressee.uid() ); |
1214 | if ( mAConfig->automaticNameParsing() ) { | 1214 | if ( mAConfig->automaticNameParsing() ) { |
1215 | addr.setNameFromString( mNameEdit->text() ); | 1215 | addr.setNameFromString( mNameEdit->text() ); |
1216 | mNameLabel->hide(); | 1216 | mNameLabel->hide(); |
1217 | mNameEdit->show(); | 1217 | mNameEdit->show(); |
1218 | } else { | 1218 | } else { |
1219 | addr = mAddressee; | 1219 | addr = mAddressee; |
1220 | mNameEdit->hide(); | 1220 | mNameEdit->hide(); |
1221 | mNameLabel->setText( mNameEdit->text() ); | 1221 | mNameLabel->setText( mNameEdit->text() ); |
1222 | mNameLabel->show(); | 1222 | mNameLabel->show(); |
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | if ( mFormattedNameType != NameEditDialog::CustomName ) { | 1225 | if ( mFormattedNameType != NameEditDialog::CustomName ) { |
1226 | mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); | 1226 | mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); |
1227 | mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); | 1227 | mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); |
1228 | } | 1228 | } |
1229 | } | 1229 | } |
1230 | 1230 | ||
1231 | void AddresseeEditorWidget::nameButtonClicked() | 1231 | void AddresseeEditorWidget::nameButtonClicked() |
1232 | { | 1232 | { |
1233 | // show the name dialog. | 1233 | // show the name dialog. |
1234 | NameEditDialog dialog( mAddressee, mFormattedNameType, this ); | 1234 | NameEditDialog dialog( mAddressee, mFormattedNameType, this ); |
1235 | 1235 | ||
1236 | if ( KApplication::execDialog( &dialog) ) { | 1236 | if ( KApplication::execDialog( &dialog) ) { |
1237 | if ( dialog.changed() ) { | 1237 | if ( dialog.changed() ) { |
1238 | mAddressee.setFamilyName( dialog.familyName() ); | 1238 | mAddressee.setFamilyName( dialog.familyName() ); |
1239 | mAddressee.setGivenName( dialog.givenName() ); | 1239 | mAddressee.setGivenName( dialog.givenName() ); |
1240 | mAddressee.setPrefix( dialog.prefix() ); | 1240 | mAddressee.setPrefix( dialog.prefix() ); |
1241 | mAddressee.setSuffix( dialog.suffix() ); | 1241 | mAddressee.setSuffix( dialog.suffix() ); |
1242 | mAddressee.setAdditionalName( dialog.additionalName() ); | 1242 | mAddressee.setAdditionalName( dialog.additionalName() ); |
1243 | mFormattedNameType = dialog.formattedNameType(); | 1243 | mFormattedNameType = dialog.formattedNameType(); |
1244 | if ( mFormattedNameType == NameEditDialog::CustomName ) { | 1244 | if ( mFormattedNameType == NameEditDialog::CustomName ) { |
1245 | mFormattedNameLabel->setText( dialog.customFormattedName() ); | 1245 | mFormattedNameLabel->setText( dialog.customFormattedName() ); |
1246 | mAddressee.setFormattedName( dialog.customFormattedName() ); | 1246 | mAddressee.setFormattedName( dialog.customFormattedName() ); |
1247 | } | 1247 | } |
1248 | // Update the name edit. | 1248 | // Update the name edit. |
1249 | bool block = mNameEdit->signalsBlocked(); | 1249 | bool block = mNameEdit->signalsBlocked(); |
1250 | mNameEdit->blockSignals( true ); | 1250 | mNameEdit->blockSignals( true ); |
1251 | mNameEdit->setText( mAddressee.assembledName() ); | 1251 | mNameEdit->setText( mAddressee.assembledName() ); |
1252 | mNameEdit->blockSignals( block ); | 1252 | mNameEdit->blockSignals( block ); |
1253 | 1253 | ||
1254 | // Update the combo box. | 1254 | // Update the combo box. |
1255 | nameBoxChanged(); | 1255 | nameBoxChanged(); |
1256 | 1256 | ||
1257 | emitModified(); | 1257 | emitModified(); |
1258 | } | 1258 | } |
1259 | } | 1259 | } |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | void AddresseeEditorWidget::categoryButtonClicked() | 1262 | void AddresseeEditorWidget::categoryButtonClicked() |
1263 | { | 1263 | { |
1264 | // Show the category dialog | 1264 | // Show the category dialog |
1265 | if ( mCategoryDialog == 0 ) { | 1265 | if ( mCategoryDialog == 0 ) { |
1266 | mCategoryDialog = new KPIM::CategorySelectDialog( KABPrefs::instance(), this ); | 1266 | mCategoryDialog = new KPIM::CategorySelectDialog( KABPrefs::instance(), this ); |
1267 | connect( mCategoryDialog, SIGNAL( categoriesSelected( const QStringList& ) ), | 1267 | connect( mCategoryDialog, SIGNAL( categoriesSelected( const QStringList& ) ), |
1268 | SLOT(categoriesSelected( const QStringList& ) ) ); | 1268 | SLOT(categoriesSelected( const QStringList& ) ) ); |
1269 | connect( mCategoryDialog, SIGNAL( editCategories() ), SLOT( editCategories() ) ); | 1269 | connect( mCategoryDialog, SIGNAL( editCategories() ), SLOT( editCategories() ) ); |
1270 | } | 1270 | } |
1271 | 1271 | ||
1272 | mCategoryDialog->setCategories(); | 1272 | mCategoryDialog->setCategories(); |
1273 | mCategoryDialog->setSelected( QStringList::split( ",", mCategoryEdit->text() ) ); | 1273 | mCategoryDialog->setSelected( QStringList::split( ",", mCategoryEdit->text() ) ); |
1274 | mCategoryDialog->show(); | 1274 | mCategoryDialog->show(); |
1275 | mCategoryDialog->raise(); | 1275 | mCategoryDialog->raise(); |
1276 | } | 1276 | } |
1277 | 1277 | ||
1278 | void AddresseeEditorWidget::categoriesSelected( const QStringList &list ) | 1278 | void AddresseeEditorWidget::categoriesSelected( const QStringList &list ) |
1279 | { | 1279 | { |
1280 | mCategoryEdit->setText( list.join( "," ) ); | 1280 | mCategoryEdit->setText( list.join( "," ) ); |
1281 | } | 1281 | } |
1282 | 1282 | ||
1283 | void AddresseeEditorWidget::editCategories() | 1283 | void AddresseeEditorWidget::editCategories() |
1284 | { | 1284 | { |
1285 | if ( mCategoryEditDialog == 0 ) { | 1285 | if ( mCategoryEditDialog == 0 ) { |
1286 | mCategoryEditDialog = new KPIM::CategoryEditDialog( KABPrefs::instance(), this ); | 1286 | mCategoryEditDialog = new KPIM::CategoryEditDialog( KABPrefs::instance(), this ); |
1287 | connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ), | 1287 | connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ), |
1288 | SLOT( categoryButtonClicked() ) ); | 1288 | SLOT( categoryButtonClicked() ) ); |
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | mCategoryEditDialog->show(); | 1291 | mCategoryEditDialog->show(); |
1292 | mCategoryEditDialog->raise(); | 1292 | mCategoryEditDialog->raise(); |
1293 | } | 1293 | } |
1294 | 1294 | ||
1295 | void AddresseeEditorWidget::emitModified() | 1295 | void AddresseeEditorWidget::emitModified() |
1296 | { | 1296 | { |
1297 | mDirty = true; | 1297 | mDirty = true; |
1298 | 1298 | ||
1299 | KABC::Addressee::List list; | 1299 | KABC::Addressee::List list; |
1300 | 1300 | ||
1301 | if ( mIsExtension && !mBlockSignals ) { | 1301 | if ( mIsExtension && !mBlockSignals ) { |
1302 | save(); | 1302 | save(); |
1303 | list.append( mAddressee ); | 1303 | list.append( mAddressee ); |
1304 | } | 1304 | } |
1305 | 1305 | ||
1306 | emit modified( list ); | 1306 | emit modified( list ); |
1307 | } | 1307 | } |
1308 | 1308 | ||
1309 | void AddresseeEditorWidget::dateChanged( QDate ) | 1309 | void AddresseeEditorWidget::dateChanged( QDate ) |
1310 | { | 1310 | { |
1311 | emitModified(); | 1311 | emitModified(); |
1312 | } | 1312 | } |
1313 | 1313 | ||
1314 | //US invalid dates are handdled by the KDateEdit widget itself | 1314 | //US invalid dates are handdled by the KDateEdit widget itself |
1315 | void AddresseeEditorWidget::invalidDate() | 1315 | void AddresseeEditorWidget::invalidDate() |
1316 | { | 1316 | { |
1317 | KMessageBox::sorry( this, i18n( "You must specify a valid date" ) ); | 1317 | KMessageBox::sorry( this, i18n( "You must specify a valid date" ) ); |
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | 1320 | ||
1321 | void AddresseeEditorWidget::pageChanged( QWidget *wdg ) | 1321 | void AddresseeEditorWidget::pageChanged( QWidget *wdg ) |
1322 | { | 1322 | { |
1323 | #ifndef KAB_EMBEDDED | 1323 | #ifndef KAB_EMBEDDED |
1324 | if ( wdg ) | 1324 | if ( wdg ) |
1325 | KAcceleratorManager::manage( wdg ); | 1325 | KAcceleratorManager::manage( wdg ); |
1326 | #else //KAB_EMBEDDED | 1326 | #else //KAB_EMBEDDED |
1327 | //US | 1327 | //US |
1328 | #endif //KAB_EMBEDDED | 1328 | #endif //KAB_EMBEDDED |
1329 | 1329 | ||
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | QString AddresseeEditorWidget::title() const | 1332 | QString AddresseeEditorWidget::title() const |
1333 | { | 1333 | { |
1334 | return i18n( "Contact Editor" ); | 1334 | return i18n( "Contact Editor" ); |
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | QString AddresseeEditorWidget::identifier() const | 1337 | QString AddresseeEditorWidget::identifier() const |
1338 | { | 1338 | { |
1339 | return i18n( "contact_editor" ); | 1339 | return i18n( "contact_editor" ); |
1340 | } | 1340 | } |
1341 | 1341 | ||
1342 | #ifndef KAB_EMBEDDED | 1342 | #ifndef KAB_EMBEDDED |
1343 | #include "addresseeeditorwidget.moc" | 1343 | #include "addresseeeditorwidget.moc" |
1344 | #endif //KAB_EMBEDDED | 1344 | #endif //KAB_EMBEDDED |