summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-10-28 13:24:38 (UTC)
committer zautrix <zautrix>2005-10-28 13:24:38 (UTC)
commit61a52cfdb0eda075dabde46984cf05b37856bbc2 (patch) (unidiff)
treecd587a374d62fa9b50143305f762c0ed995bd50c
parentcee83f70d8e4a6945f4456c55ab1b280d3425f0f (diff)
downloadkdepimpi-61a52cfdb0eda075dabde46984cf05b37856bbc2.zip
kdepimpi-61a52cfdb0eda075dabde46984cf05b37856bbc2.tar.gz
kdepimpi-61a52cfdb0eda075dabde46984cf05b37856bbc2.tar.bz2
commit
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--desktop/rpm/kdepim_rpm2
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp2
-rw-r--r--kaddressbook/phoneeditwidget.cpp80
-rw-r--r--kaddressbook/phoneeditwidget.h21
-rw-r--r--version2
5 files changed, 75 insertions, 32 deletions
diff --git a/desktop/rpm/kdepim_rpm b/desktop/rpm/kdepim_rpm
index 2b5b390..9076943 100644
--- a/desktop/rpm/kdepim_rpm
+++ b/desktop/rpm/kdepim_rpm
@@ -1,84 +1,84 @@
1Summary: A collection of PIM programs 1Summary: A collection of PIM programs
2Name: KDE-Pim-Pi 2Name: KDE-Pim-Pi
3Version: 2.2.5 3Version: 2.2.6
4Release: SuSE_9.2 4Release: SuSE_9.2
5Copyright:GPL 5Copyright:GPL
6Group: Productivity/Pim 6Group: Productivity/Pim
7Source:http://sourceforge.net/projects/kdepimpi/ 7Source:http://sourceforge.net/projects/kdepimpi/
8URL:http://sourceforge.net/projects/kdepimpi/ 8URL:http://sourceforge.net/projects/kdepimpi/
9Packager: zautrix 9Packager: zautrix
10 10
11%description 11%description
12This package contains the platform-independent PIM programs from 12This package contains the platform-independent PIM programs from
13www.pi-sync.info, compiled for SuSE 9.2: 13www.pi-sync.info, compiled for SuSE 9.2:
14KTimeTacker/Pi 14KTimeTacker/Pi
15KPhone/Pi 15KPhone/Pi
16KAddressbook/Pi 16KAddressbook/Pi
17KOrganizer/Pi 17KOrganizer/Pi
18PasswordManager/Pi 18PasswordManager/Pi
19KOPieMail/Pi 19KOPieMail/Pi
20 20
21These applications do not need anything from the KDE-desktop 21These applications do not need anything from the KDE-desktop
22at all to run on Linux. However, there is a dependency from 22at all to run on Linux. However, there is a dependency from
23two KDE libs, because a small command line program is included 23two KDE libs, because a small command line program is included
24to make it possible to sync with the KDE-desktop applications. 24to make it possible to sync with the KDE-desktop applications.
25 25
26These applications are independent from the KDE-desktop 26These applications are independent from the KDE-desktop
27environment. That means, nothing of your existing 27environment. That means, nothing of your existing
28KDE-desktop setup will be changed, or any data 28KDE-desktop setup will be changed, or any data
29(calendar-addressbook) used by the KDE-desktop 29(calendar-addressbook) used by the KDE-desktop
30applications will be changed or accessed. 30applications will be changed or accessed.
31These applications stores their data and config in 31These applications stores their data and config in
32$HOME/kdepim/ 32$HOME/kdepim/
33However, because the same file format is used, 33However, because the same file format is used,
34an easy exchange of data with the KDE-desktop 34an easy exchange of data with the KDE-desktop
35is possible. 35is possible.
36A small command line program is included 36A small command line program is included
37to make it possible to sync with the KDE-desktop applications. 37to make it possible to sync with the KDE-desktop applications.
38You do not need to call this program from the commandline, 38You do not need to call this program from the commandline,
39it is called from the KDE-Pim/Pi apps when you choose there: 39it is called from the KDE-Pim/Pi apps when you choose there:
40Sync with KDE_Desktop. 40Sync with KDE_Desktop.
41If something is going wrong, please start the 41If something is going wrong, please start the
42KDE-Pim/Pi program itself from the console to get detailed output. 42KDE-Pim/Pi program itself from the console to get detailed output.
43 43
44After installation, you should have a 44After installation, you should have a
45PIM-pi 45PIM-pi
46folder in your KDE start menu, where you can 46folder in your KDE start menu, where you can
47start the applications from. 47start the applications from.
48 48
49These programs makes it possible to sync your Zaurus easily 49These programs makes it possible to sync your Zaurus easily
50(with the KDE-Pim/Pi programs running on the Zaurus) 50(with the KDE-Pim/Pi programs running on the Zaurus)
51with the KDE-desktop calendar/addressbook data. 51with the KDE-desktop calendar/addressbook data.
52If you want to use that, you have to update your 52If you want to use that, you have to update your
53KDE-desktop to version 3.3.0 or higher. 53KDE-desktop to version 3.3.0 or higher.
54SuSE 9.2 contains KDE 3.3.0 such that no update is needed. 54SuSE 9.2 contains KDE 3.3.0 such that no update is needed.
55Actually - after the (non difficult) configuration is set up - 55Actually - after the (non difficult) configuration is set up -
56with two mouseklicks on the Zaurus, 56with two mouseklicks on the Zaurus,
57the Zaurus syncs with the corresponding KDE-Pim/Pi 57the Zaurus syncs with the corresponding KDE-Pim/Pi
58program on the Linux Desktop which syncs automatically 58program on the Linux Desktop which syncs automatically
59with the KDE-desktop data. 59with the KDE-desktop data.
60 60
61If you want to use the KDE-desktop calendar/addressbook applications, 61If you want to use the KDE-desktop calendar/addressbook applications,
62just install these apps in this package and use them as a syncing tool for the 62just install these apps in this package and use them as a syncing tool for the
63Zaurus <-> KDE-desktop sync. 63Zaurus <-> KDE-desktop sync.
64The sync requires a network connection from your Zaurus to 64The sync requires a network connection from your Zaurus to
65the PC. A detailed Sync HowTo is available in the 65the PC. A detailed Sync HowTo is available in the
66Help menu of the applications. 66Help menu of the applications.
67 67
68These applications makes it also possible, that you can sync 68These applications makes it also possible, that you can sync
69(or just export the data to) your mobile phone with your 69(or just export the data to) your mobile phone with your
70data of the KDE-desktop calendar/addressbook applications. 70data of the KDE-desktop calendar/addressbook applications.
71This is tested and working for Nokia mobile phones, 71This is tested and working for Nokia mobile phones,
72it may work with others as well. 72it may work with others as well.
73(More info about that: -> Sync HowTo) 73(More info about that: -> Sync HowTo)
74 74
75NOTE: 75NOTE:
76When using SuSE 9.1 you have to update your KDE to 3.3.x 76When using SuSE 9.1 you have to update your KDE to 3.3.x
77and you have to make an online update in SuSE 9.1 to make it 77and you have to make an online update in SuSE 9.1 to make it
78possible to get the infrared connection working, such that 78possible to get the infrared connection working, such that
79you can sync your (Nokia) mobile phone via infrared. 79you can sync your (Nokia) mobile phone via infrared.
80 80
81%files 81%files
82/opt/kde3/share/applnk/PIM-pi/ 82/opt/kde3/share/applnk/PIM-pi/
83/opt/kdepimpi/ 83/opt/kdepimpi/
84/usr/lib/libmicro* 84/usr/lib/libmicro*
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 9814cd5..966efa5 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -1,1394 +1,1394 @@
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
83AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension, 83AddresseeEditorWidget::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
102AddresseeEditorWidget::~AddresseeEditorWidget() 102AddresseeEditorWidget::~AddresseeEditorWidget()
103{ 103{
104 kdDebug(5720) << "~AddresseeEditorWidget()" << endl; 104 kdDebug(5720) << "~AddresseeEditorWidget()" << endl;
105} 105}
106 106
107void AddresseeEditorWidget::contactsSelectionChanged() 107void 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
115void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr ) 115void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr )
116{ 116{
117 mAddressee = addr; 117 mAddressee = addr;
118 load(); 118 load();
119} 119}
120 120
121const KABC::Addressee &AddresseeEditorWidget::addressee() 121const KABC::Addressee &AddresseeEditorWidget::addressee()
122{ 122{
123 return mAddressee; 123 return mAddressee;
124} 124}
125 125
126void AddresseeEditorWidget::textChanged( const QString& ) 126void AddresseeEditorWidget::textChanged( const QString& )
127{ 127{
128 emitModified(); 128 emitModified();
129} 129}
130 130
131void AddresseeEditorWidget::initGUI() 131void 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
151void AddresseeEditorWidget::setupTab1() 151void 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 bool horLayout = false; 157 bool horLayout = false;
158 int maxCol = 1; 158 int maxCol = 1;
159 if ( QApplication::desktop()->width() == 640 || QApplication::desktop()->width() == 320 ) { 159 if ( QApplication::desktop()->width() == 640 || QApplication::desktop()->width() == 320 ) {
160 horLayout = true; 160 horLayout = true;
161 maxCol = 3; 161 maxCol = 3;
162 } 162 }
163 QGridLayout *layout = new QGridLayout( tab1, 8-maxCol, maxCol ); 163 QGridLayout *layout = new QGridLayout( tab1, 8-maxCol, maxCol );
164 164
165 layout->setMargin( KDialogBase::marginHintSmall() ); 165 layout->setMargin( KDialogBase::marginHintSmall() );
166 layout->setSpacing( KDialogBase::spacingHintSmall() ); 166 layout->setSpacing( KDialogBase::spacingHintSmall() );
167 167
168 QLabel *label; 168 QLabel *label;
169 KSeparator* bar; 169 KSeparator* bar;
170 QPushButton *button; 170 QPushButton *button;
171 171
172 ////////////////////////////////// 172 //////////////////////////////////
173 // Upper left group (person info) 173 // Upper left group (person info)
174 174
175 // Person icon 175 // Person icon
176 /* LR 176 /* LR
177 label = new QLabel( tab1 ); 177 label = new QLabel( tab1 );
178//US ambiguous call. Add one more parameter 178//US ambiguous call. Add one more parameter
179//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 179//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
180 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 180 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
181 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 181 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
182 */ 182 */
183 // First name 183 // First name
184 button = new QPushButton( i18n( "Name..." ), tab1 ); 184 button = new QPushButton( i18n( "Name..." ), tab1 );
185//US QToolTip::add( button, i18n( "Edit the contact's name" ) ); 185//US QToolTip::add( button, i18n( "Edit the contact's name" ) );
186 mNameEdit = new KLineEdit( tab1, "mNameEdit" ); 186 mNameEdit = new KLineEdit( tab1, "mNameEdit" );
187 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), 187 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
188 SLOT( nameTextChanged( const QString& ) ) ); 188 SLOT( nameTextChanged( const QString& ) ) );
189 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); 189 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
190 190
191 mNameLabel = new KSqueezedTextLabel( tab1 ); 191 mNameLabel = new KSqueezedTextLabel( tab1 );
192 mNameLabel->hide(); 192 mNameLabel->hide();
193 193
194 layout->addWidget( button, 0, 0 ); 194 layout->addWidget( button, 0, 0 );
195 layout->addWidget( mNameEdit, 0, 1 ); 195 layout->addWidget( mNameEdit, 0, 1 );
196 layout->addWidget( mNameLabel, 0, 1 ); 196 layout->addWidget( mNameLabel, 0, 1 );
197 197
198 button = new QPushButton( i18n( "Role:" ), tab1 ); 198 button = new QPushButton( i18n( "Role:" ), tab1 );
199 connect( button, SIGNAL( clicked() ), SLOT( setRole2FN() ) ); 199 connect( button, SIGNAL( clicked() ), SLOT( setRole2FN() ) );
200 //label = new QLabel( i18n( "Role:" ), tab1 ); 200 //label = new QLabel( i18n( "Role:" ), tab1 );
201 mRoleEdit = new KLineEdit( tab1 ); 201 mRoleEdit = new KLineEdit( tab1 );
202 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), 202 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
203 SLOT( textChanged( const QString& ) ) ); 203 SLOT( textChanged( const QString& ) ) );
204 //label->setBuddy( mRoleEdit ); 204 //label->setBuddy( mRoleEdit );
205 layout->addWidget( button, 1, 0 ); 205 layout->addWidget( button, 1, 0 );
206 layout->addWidget( mRoleEdit, 1, 1 ); 206 layout->addWidget( mRoleEdit, 1, 1 );
207 207
208 // Organization 208 // Organization
209 button = new QPushButton( i18n( "Organization:" ), tab1 ); 209 button = new QPushButton( i18n( "Organization:" ), tab1 );
210 connect( button, SIGNAL( clicked() ), SLOT( setCompany2FN() ) ); 210 connect( button, SIGNAL( clicked() ), SLOT( setCompany2FN() ) );
211 //label = new QLabel( i18n( "Organization:" ), tab1 ); 211 //label = new QLabel( i18n( "Organization:" ), tab1 );
212 mOrgEdit = new KLineEdit( tab1 ); 212 mOrgEdit = new KLineEdit( tab1 );
213 //label->setBuddy( mOrgEdit ); 213 //label->setBuddy( mOrgEdit );
214 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), 214 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
215 SLOT( textChanged( const QString& ) ) ); 215 SLOT( textChanged( const QString& ) ) );
216 if ( horLayout ) { 216 if ( horLayout ) {
217 layout->addWidget( button, 1, 2 ); 217 layout->addWidget( button, 1, 2 );
218 layout->addWidget( mOrgEdit, 1, 3 ); 218 layout->addWidget( mOrgEdit, 1, 3 );
219 219
220 } else { 220 } else {
221 layout->addWidget( button, 2, 0 ); 221 layout->addWidget( button, 2, 0 );
222 layout->addWidget( mOrgEdit, 2, 1 ); 222 layout->addWidget( mOrgEdit, 2, 1 );
223 } 223 }
224 224
225 // File as (formatted name) 225 // File as (formatted name)
226 label = new QLabel( i18n( "Format.n.:" ), tab1 ); 226 label = new QLabel( i18n( "Format.n.:" ), tab1 );
227 mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); 227 mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
228 if ( horLayout ) { 228 if ( horLayout ) {
229 layout->addWidget( label, 0,2 ); 229 layout->addWidget( label, 0,2 );
230 layout->addWidget( mFormattedNameLabel, 0, 3 ); 230 layout->addWidget( mFormattedNameLabel, 0, 3 );
231 } else { 231 } else {
232 layout->addWidget( label, 3, 0 ); 232 layout->addWidget( label, 3, 0 );
233 layout->addWidget( mFormattedNameLabel, 3, 1 ); 233 layout->addWidget( mFormattedNameLabel, 3, 1 );
234 } 234 }
235 /* LR 235 /* LR
236 // Left hand separator. This separator doesn't go all the way 236 // Left hand separator. This separator doesn't go all the way
237 // across so the dialog still flows from top to bottom 237 // across so the dialog still flows from top to bottom
238 bar = new KSeparator( KSeparator::HLine, tab1 ); 238 bar = new KSeparator( KSeparator::HLine, tab1 );
239 layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); 239 layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
240 */ 240 */
241 ////////////////////////////////////// 241 //////////////////////////////////////
242 242
243 /* LR 243 /* LR
244 // Phone numbers (upper right) 244 // Phone numbers (upper right)
245 label = new QLabel( tab1 ); 245 label = new QLabel( tab1 );
246//US loadIcon call is ambiguous. Add one more parameter 246//US loadIcon call is ambiguous. Add one more parameter
247//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); 247//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
248 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 248 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
249//US layout->addMultiCellWidget( label, 0, 1, 3, 3 ); 249//US layout->addMultiCellWidget( label, 0, 1, 3, 3 );
250 layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 250 layout->addMultiCellWidget( label, 5, 6, 0, 0 );
251 */ 251 */
252 mPhoneEditWidget = new PhoneEditWidget( tab1 ); 252 mPhoneEditWidget = new PhoneEditWidget( tab1 );
253 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 253 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
254//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); 254//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );
255 int iii; 255 int iii;
256#ifndef DESKTOP_VERSION 256#ifndef DESKTOP_VERSION
257 iii = 7; 257 iii = 7;
258#else 258#else
259 iii = 8; 259 iii = 8;
260#endif 260#endif
261 layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, maxCol ); 261 layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, maxCol );
262 ++iii; 262 ++iii;
263 /* LR 263 /* LR
264 bar = new KSeparator( KSeparator::HLine, tab1 ); 264 bar = new KSeparator( KSeparator::HLine, tab1 );
265//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); 265//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 );
266 layout->addMultiCellWidget( bar, 9, 9, 0, 2 ); 266 layout->addMultiCellWidget( bar, 9, 9, 0, 2 );
267 */ 267 */
268/*US 268/*US
269 ////////////////////////////////////// 269 //////////////////////////////////////
270 // Addresses (lower left) 270 // Addresses (lower left)
271 label = new QLabel( tab1 ); 271 label = new QLabel( tab1 );
272//US loadIcon call is ambiguous. Add one more parameter 272//US loadIcon call is ambiguous. Add one more parameter
273//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); 273//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) );
274 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); 274 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
275 layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 275 layout->addMultiCellWidget( label, 5, 6, 0, 0 );
276 276
277 mAddressEditWidget = new AddressEditWidget( tab1 ); 277 mAddressEditWidget = new AddressEditWidget( tab1 );
278 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 278 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
279 layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); 279 layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 );
280 280
281 ////////////////////////////////////// 281 //////////////////////////////////////
282 // Email / Web (lower right) 282 // Email / Web (lower right)
283 label = new QLabel( tab1 ); 283 label = new QLabel( tab1 );
284//US loadIcon call is ambiguous. Add one more parameter 284//US loadIcon call is ambiguous. Add one more parameter
285//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); 285//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) );
286 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); 286 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) );
287 layout->addMultiCellWidget( label, 5, 6, 3, 3 ); 287 layout->addMultiCellWidget( label, 5, 6, 3, 3 );
288 288
289 mEmailWidget = new EmailEditWidget( tab1 ); 289 mEmailWidget = new EmailEditWidget( tab1 );
290 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 290 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
291 layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); 291 layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 );
292 292
293 // add the separator 293 // add the separator
294 bar = new KSeparator( KSeparator::HLine, tab1 ); 294 bar = new KSeparator( KSeparator::HLine, tab1 );
295 layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); 295 layout->addMultiCellWidget( bar, 7, 7, 3, 6 );
296 296
297 label = new QLabel( tab1 ); 297 label = new QLabel( tab1 );
298//US loadIcon call is ambiguous. Add one more parameter 298//US loadIcon call is ambiguous. Add one more parameter
299//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); 299//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) );
300 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); 300 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) );
301 layout->addMultiCellWidget( label, 8, 9, 3, 3 ); 301 layout->addMultiCellWidget( label, 8, 9, 3, 3 );
302 302
303 label = new QLabel( i18n( "URL:" ), tab1 ); 303 label = new QLabel( i18n( "URL:" ), tab1 );
304 mURLEdit = new KLineEdit( tab1 ); 304 mURLEdit = new KLineEdit( tab1 );
305 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), 305 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
306 SLOT( textChanged( const QString& ) ) ); 306 SLOT( textChanged( const QString& ) ) );
307 label->setBuddy( mURLEdit ); 307 label->setBuddy( mURLEdit );
308 layout->addWidget( label, 8, 4 ); 308 layout->addWidget( label, 8, 4 );
309 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); 309 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 );
310 310
311 label = new QLabel( i18n( "&IM address:" ), tab1 ); 311 label = new QLabel( i18n( "&IM address:" ), tab1 );
312 mIMAddressEdit = new KLineEdit( tab1 ); 312 mIMAddressEdit = new KLineEdit( tab1 );
313 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), 313 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ),
314 SLOT( textChanged( const QString& ) ) ); 314 SLOT( textChanged( const QString& ) ) );
315 label->setBuddy( mIMAddressEdit ); 315 label->setBuddy( mIMAddressEdit );
316 layout->addWidget( label, 9, 4 ); 316 layout->addWidget( label, 9, 4 );
317 layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); 317 layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 );
318 318
319 layout->addColSpacing( 6, 50 ); 319 layout->addColSpacing( 6, 50 );
320 320
321 bar = new KSeparator( KSeparator::HLine, tab1 ); 321 bar = new KSeparator( KSeparator::HLine, tab1 );
322 layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); 322 layout->addMultiCellWidget( bar, 10, 10, 0, 6 );
323*/ 323*/
324 /////////////////////////////////////// 324 ///////////////////////////////////////
325 QHBox *categoryBox = new QHBox( tab1 ,"cato"); 325 QHBox *categoryBox = new QHBox( tab1 ,"cato");
326 categoryBox->setSpacing( KDialogBase::spacingHint() ); 326 categoryBox->setSpacing( KDialogBase::spacingHint() );
327 categoryBox->setMargin( KDialogBase::marginHintSmall() ); 327 categoryBox->setMargin( KDialogBase::marginHintSmall() );
328 328
329 // Categories 329 // Categories
330 button = new QPushButton( i18n( "Categories" ), categoryBox ); 330 button = new QPushButton( i18n( "Categories" ), categoryBox );
331 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); 331 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
332 332
333 mCategoryEdit = new KLineEdit( categoryBox ); 333 mCategoryEdit = new KLineEdit( categoryBox );
334 mCategoryEdit->setReadOnly( true ); 334 mCategoryEdit->setReadOnly( true );
335 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), 335 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
336 SLOT( textChanged( const QString& ) ) ); 336 SLOT( textChanged( const QString& ) ) );
337 337
338 mSecrecyWidget = new SecrecyWidget( categoryBox ); 338 mSecrecyWidget = new SecrecyWidget( categoryBox );
339 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 339 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
340 340
341//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); 341//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
342 layout->addMultiCellWidget( categoryBox, iii, iii, 0, maxCol ); 342 layout->addMultiCellWidget( categoryBox, iii, iii, 0, maxCol );
343 343
344 // Build the layout and add to the tab widget 344 // Build the layout and add to the tab widget
345 layout->activate(); // required 345 layout->activate(); // required
346 346
347 mTabWidget->addTab( tab1, i18n( "&General" ) ); 347 mTabWidget->addTab( tab1, i18n( "&General" ) );
348} 348}
349 349
350void AddresseeEditorWidget::setRole2FN() 350void AddresseeEditorWidget::setRole2FN()
351{ 351{
352 if ( mRoleEdit->text().isEmpty() ) return; 352 if ( mRoleEdit->text().isEmpty() ) return;
353 mFormattedNameType = NameEditDialog::CustomName; 353 mFormattedNameType = NameEditDialog::CustomName;
354 mAddressee.setFormattedName( mRoleEdit->text() ); 354 mAddressee.setFormattedName( mRoleEdit->text() );
355 mFormattedNameLabel->setText( mRoleEdit->text() ); 355 mFormattedNameLabel->setText( mRoleEdit->text() );
356 mDirty = true; 356 mDirty = true;
357} 357}
358void AddresseeEditorWidget::setCompany2FN() 358void AddresseeEditorWidget::setCompany2FN()
359{ 359{
360 if ( mOrgEdit->text().isEmpty() ) return; 360 if ( mOrgEdit->text().isEmpty() ) return;
361 mFormattedNameType = NameEditDialog::CustomName; 361 mFormattedNameType = NameEditDialog::CustomName;
362 mAddressee.setFormattedName( mOrgEdit->text() ); 362 mAddressee.setFormattedName( mOrgEdit->text() );
363 mFormattedNameLabel->setText( mOrgEdit->text() ); 363 mFormattedNameLabel->setText( mOrgEdit->text() );
364 mDirty = true; 364 mDirty = true;
365} 365}
366 366
367void AddresseeEditorWidget::setupTab1_1() 367void AddresseeEditorWidget::setupTab1_1()
368{ 368{
369 // This is the Address tab 369 // This is the Address tab
370 QWidget *tab1_1 = new QWidget( mTabWidget ); 370 QWidget *tab1_1 = new QWidget( mTabWidget );
371 371
372//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 ); 372//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 );
373 QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 ); 373 QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 );
374 layout->setMargin( KDialogBase::marginHintSmall() ); 374 layout->setMargin( KDialogBase::marginHintSmall() );
375 layout->setSpacing( KDialogBase::spacingHintSmall() ); 375 layout->setSpacing( KDialogBase::spacingHintSmall() );
376 376
377 QLabel *label; 377 QLabel *label;
378 KSeparator* bar; 378 KSeparator* bar;
379 QPushButton *button; 379 QPushButton *button;
380 380
381/*US 381/*US
382 ////////////////////////////////// 382 //////////////////////////////////
383 // Upper left group (person info) 383 // Upper left group (person info)
384 384
385 // Person icon 385 // Person icon
386 label = new QLabel( tab1 ); 386 label = new QLabel( tab1 );
387//US ambiguous call. Add one more parameter 387//US ambiguous call. Add one more parameter
388//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 388//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
389 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 389 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
390 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 390 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
391 391
392 // First name 392 // First name
393 button = new QPushButton( i18n( "Name..." ), tab1 ); 393 button = new QPushButton( i18n( "Name..." ), tab1 );
394 QToolTip::add( button, i18n( "Edit the contact's name" ) ); 394 QToolTip::add( button, i18n( "Edit the contact's name" ) );
395 mNameEdit = new KLineEdit( tab1, "mNameEdit" ); 395 mNameEdit = new KLineEdit( tab1, "mNameEdit" );
396 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), 396 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
397 SLOT( nameTextChanged( const QString& ) ) ); 397 SLOT( nameTextChanged( const QString& ) ) );
398 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); 398 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
399 399
400#ifndef KAB_EMBEDDED 400#ifndef KAB_EMBEDDED
401 mNameLabel = new KSqueezedTextLabel( tab1 ); 401 mNameLabel = new KSqueezedTextLabel( tab1 );
402 mNameLabel->hide(); 402 mNameLabel->hide();
403#else //KAB_EMBEDDED 403#else //KAB_EMBEDDED
404qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 404qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
405#endif //KAB_EMBEDDED 405#endif //KAB_EMBEDDED
406 406
407 layout->addWidget( button, 0, 1 ); 407 layout->addWidget( button, 0, 1 );
408 layout->addWidget( mNameEdit, 0, 2 ); 408 layout->addWidget( mNameEdit, 0, 2 );
409 409
410#ifndef KAB_EMBEDDED 410#ifndef KAB_EMBEDDED
411 layout->addWidget( mNameLabel, 0, 2 ); 411 layout->addWidget( mNameLabel, 0, 2 );
412#else //KAB_EMBEDDED 412#else //KAB_EMBEDDED
413qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 413qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
414#endif //KAB_EMBEDDED 414#endif //KAB_EMBEDDED
415 415
416 label = new QLabel( i18n( "Role:" ), tab1 ); 416 label = new QLabel( i18n( "Role:" ), tab1 );
417 mRoleEdit = new KLineEdit( tab1 ); 417 mRoleEdit = new KLineEdit( tab1 );
418 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), 418 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
419 SLOT( textChanged( const QString& ) ) ); 419 SLOT( textChanged( const QString& ) ) );
420 label->setBuddy( mRoleEdit ); 420 label->setBuddy( mRoleEdit );
421 layout->addWidget( label, 1, 1 ); 421 layout->addWidget( label, 1, 1 );
422 layout->addWidget( mRoleEdit, 1, 2 ); 422 layout->addWidget( mRoleEdit, 1, 2 );
423 423
424 // Organization 424 // Organization
425 label = new QLabel( i18n( "Organization:" ), tab1 ); 425 label = new QLabel( i18n( "Organization:" ), tab1 );
426 mOrgEdit = new KLineEdit( tab1 ); 426 mOrgEdit = new KLineEdit( tab1 );
427 label->setBuddy( mOrgEdit ); 427 label->setBuddy( mOrgEdit );
428 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), 428 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
429 SLOT( textChanged( const QString& ) ) ); 429 SLOT( textChanged( const QString& ) ) );
430 layout->addWidget( label, 2, 1 ); 430 layout->addWidget( label, 2, 1 );
431 layout->addWidget( mOrgEdit, 2, 2 ); 431 layout->addWidget( mOrgEdit, 2, 2 );
432 432
433 // File as (formatted name) 433 // File as (formatted name)
434 label = new QLabel( i18n( "Formatted name:" ), tab1 ); 434 label = new QLabel( i18n( "Formatted name:" ), tab1 );
435#ifndef KAB_EMBEDDED 435#ifndef KAB_EMBEDDED
436 mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); 436 mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
437#else //KAB_EMBEDDED 437#else //KAB_EMBEDDED
438qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 438qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
439#endif //KAB_EMBEDDED 439#endif //KAB_EMBEDDED
440 layout->addWidget( label, 3, 1 ); 440 layout->addWidget( label, 3, 1 );
441#ifndef KAB_EMBEDDED 441#ifndef KAB_EMBEDDED
442 layout->addWidget( mFormattedNameLabel, 3, 2 ); 442 layout->addWidget( mFormattedNameLabel, 3, 2 );
443#else //KAB_EMBEDDED 443#else //KAB_EMBEDDED
444qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 444qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
445#endif //KAB_EMBEDDED 445#endif //KAB_EMBEDDED
446 446
447 // Left hand separator. This separator doesn't go all the way 447 // Left hand separator. This separator doesn't go all the way
448 // across so the dialog still flows from top to bottom 448 // across so the dialog still flows from top to bottom
449 bar = new KSeparator( KSeparator::HLine, tab1 ); 449 bar = new KSeparator( KSeparator::HLine, tab1 );
450 layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); 450 layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
451 451
452 ////////////////////////////////////// 452 //////////////////////////////////////
453 // Phone numbers (upper right) 453 // Phone numbers (upper right)
454 label = new QLabel( tab1 ); 454 label = new QLabel( tab1 );
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( "kaddressbook", KIcon::Desktop ) ); 456//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
457 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 457 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
458 layout->addMultiCellWidget( label, 0, 1, 3, 3 ); 458 layout->addMultiCellWidget( label, 0, 1, 3, 3 );
459 459
460 mPhoneEditWidget = new PhoneEditWidget( tab1 ); 460 mPhoneEditWidget = new PhoneEditWidget( tab1 );
461 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 461 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
462 layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); 462 layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );
463 463
464 bar = new KSeparator( KSeparator::HLine, tab1 ); 464 bar = new KSeparator( KSeparator::HLine, tab1 );
465 layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); 465 layout->addMultiCellWidget( bar, 4, 4, 3, 6 );
466*/ 466*/
467 ////////////////////////////////////// 467 //////////////////////////////////////
468 // Addresses (lower left) 468 // Addresses (lower left)
469 /* LR 469 /* LR
470 label = new QLabel( tab1_1 ); 470 label = new QLabel( tab1_1 );
471//US loadIcon call is ambiguous. Add one more parameter 471//US loadIcon call is ambiguous. Add one more parameter
472//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); 472//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) );
473 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); 473 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
474//US layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 474//US layout->addMultiCellWidget( label, 5, 6, 0, 0 );
475 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 475 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
476 */ 476 */
477 477
478 mAddressEditWidget = new AddressEditWidget( tab1_1 ); 478 mAddressEditWidget = new AddressEditWidget( tab1_1 );
479 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 479 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
480//US layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); 480//US layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 );
481 layout->addMultiCellWidget( mAddressEditWidget, 0, 4, 0, 1 ); 481 layout->addMultiCellWidget( mAddressEditWidget, 0, 4, 0, 1 );
482 482
483//US 483//US
484/* LR 484/* LR
485 bar = new KSeparator( KSeparator::HLine, tab1_1 ); 485 bar = new KSeparator( KSeparator::HLine, tab1_1 );
486 layout->addMultiCellWidget( bar, 5, 5, 0, 3 ); 486 layout->addMultiCellWidget( bar, 5, 5, 0, 3 );
487*/ 487*/
488 488
489 ////////////////////////////////////// 489 //////////////////////////////////////
490 // Email / Web (lower right) 490 // Email / Web (lower right)
491 /* LR 491 /* LR
492 label = new QLabel( tab1_1 ); 492 label = new QLabel( tab1_1 );
493//US loadIcon call is ambiguous. Add one more parameter 493//US loadIcon call is ambiguous. Add one more parameter
494//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); 494//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) );
495 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); 495 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) );
496//US layout->addMultiCellWidget( label, 5, 6, 3, 3 ); 496//US layout->addMultiCellWidget( label, 5, 6, 3, 3 );
497 layout->addMultiCellWidget( label, 6, 7, 0, 0 ); 497 layout->addMultiCellWidget( label, 6, 7, 0, 0 );
498 */ 498 */
499 mEmailWidget = new EmailEditWidget( tab1_1 ); 499 mEmailWidget = new EmailEditWidget( tab1_1 );
500 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 500 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
501//US layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); 501//US layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 );
502 layout->addMultiCellWidget( mEmailWidget, 5, 6, 0, 1 ); 502 layout->addMultiCellWidget( mEmailWidget, 5, 6, 0, 1 );
503 503
504 /* LR 504 /* LR
505 // add the separator 505 // add the separator
506 bar = new KSeparator( KSeparator::HLine, tab1_1 ); 506 bar = new KSeparator( KSeparator::HLine, tab1_1 );
507//US layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); 507//US layout->addMultiCellWidget( bar, 7, 7, 3, 6 );
508 layout->addMultiCellWidget( bar, 8, 8, 0, 3 ); 508 layout->addMultiCellWidget( bar, 8, 8, 0, 3 );
509 509
510 label = new QLabel( tab1_1 ); 510 label = new QLabel( tab1_1 );
511//US loadIcon call is ambiguous. Add one more parameter 511//US loadIcon call is ambiguous. Add one more parameter
512//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); 512//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) );
513 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); 513 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) );
514//US layout->addMultiCellWidget( label, 8, 9, 3, 3 ); 514//US layout->addMultiCellWidget( label, 8, 9, 3, 3 );
515 layout->addMultiCellWidget( label, 9, 10, 0, 0 ); 515 layout->addMultiCellWidget( label, 9, 10, 0, 0 );
516 */ 516 */
517 label = new QLabel( i18n( "URL:" ), tab1_1 ); 517 label = new QLabel( i18n( "URL:" ), tab1_1 );
518 mURLEdit = new KLineEdit( tab1_1 ); 518 mURLEdit = new KLineEdit( tab1_1 );
519 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), 519 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
520 SLOT( textChanged( const QString& ) ) ); 520 SLOT( textChanged( const QString& ) ) );
521 label->setBuddy( mURLEdit ); 521 label->setBuddy( mURLEdit );
522//US layout->addWidget( label, 8, 4 ); 522//US layout->addWidget( label, 8, 4 );
523 layout->addWidget( label, 7,0 ); 523 layout->addWidget( label, 7,0 );
524//US layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); 524//US layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 );
525 layout->addWidget( mURLEdit, 7, 1); 525 layout->addWidget( mURLEdit, 7, 1);
526 526
527 label = new QLabel( i18n( "&IM address:" ), tab1_1 ); 527 label = new QLabel( i18n( "&IM address:" ), tab1_1 );
528 mIMAddressEdit = new KLineEdit( tab1_1 ); 528 mIMAddressEdit = new KLineEdit( tab1_1 );
529 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), 529 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ),
530 SLOT( textChanged( const QString& ) ) ); 530 SLOT( textChanged( const QString& ) ) );
531 label->setBuddy( mIMAddressEdit ); 531 label->setBuddy( mIMAddressEdit );
532//US layout->addWidget( label, 9, 4 ); 532//US layout->addWidget( label, 9, 4 );
533 layout->addWidget( label, 8, 0 ); 533 layout->addWidget( label, 8, 0 );
534//US layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); 534//US layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 );
535 layout->addWidget( mIMAddressEdit, 8,1 ); 535 layout->addWidget( mIMAddressEdit, 8,1 );
536 536
537//US layout->addColSpacing( 6, 50 ); 537//US layout->addColSpacing( 6, 50 );
538 538
539//US bar = new KSeparator( KSeparator::HLine, tab1_1 ); 539//US bar = new KSeparator( KSeparator::HLine, tab1_1 );
540//US layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); 540//US layout->addMultiCellWidget( bar, 10, 10, 0, 6 );
541 541
542/*US 542/*US
543 /////////////////////////////////////// 543 ///////////////////////////////////////
544 QHBox *categoryBox = new QHBox( tab1 ); 544 QHBox *categoryBox = new QHBox( tab1 );
545 categoryBox->setSpacing( KDialogBase::spacingHintSmall() ); 545 categoryBox->setSpacing( KDialogBase::spacingHintSmall() );
546 546
547 // Categories 547 // Categories
548 button = new QPushButton( i18n( "Categories" ), categoryBox ); 548 button = new QPushButton( i18n( "Categories" ), categoryBox );
549 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); 549 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
550 550
551 mCategoryEdit = new KLineEdit( categoryBox ); 551 mCategoryEdit = new KLineEdit( categoryBox );
552 mCategoryEdit->setReadOnly( true ); 552 mCategoryEdit->setReadOnly( true );
553 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), 553 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
554 SLOT( textChanged( const QString& ) ) ); 554 SLOT( textChanged( const QString& ) ) );
555 555
556 mSecrecyWidget = new SecrecyWidget( categoryBox ); 556 mSecrecyWidget = new SecrecyWidget( categoryBox );
557 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 557 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
558 558
559 layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); 559 layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
560*/ 560*/
561 // Build the layout and add to the tab widget 561 // Build the layout and add to the tab widget
562 layout->activate(); // required 562 layout->activate(); // required
563 563
564 mTabWidget->addTab( tab1_1, i18n( "&Address" ) ); 564 mTabWidget->addTab( tab1_1, i18n( "&Address" ) );
565} 565}
566 566
567 567
568 568
569void AddresseeEditorWidget::setupTab2() 569void AddresseeEditorWidget::setupTab2()
570{ 570{
571 // This is the Details tab 571 // This is the Details tab
572 QWidget *tab2 = new QWidget( mTabWidget ); 572 QWidget *tab2 = new QWidget( mTabWidget );
573 573
574 QGridLayout *layout = new QGridLayout( tab2, 8, 3 ); 574 QGridLayout *layout = new QGridLayout( tab2, 8, 3 );
575 layout->setMargin( KDialogBase::marginHintSmall() ); 575 layout->setMargin( KDialogBase::marginHintSmall() );
576 layout->setSpacing( KDialogBase::spacingHintSmall() ); 576 layout->setSpacing( KDialogBase::spacingHintSmall() );
577 577
578 QLabel *label; 578 QLabel *label;
579 KSeparator* bar; 579 KSeparator* bar;
580 580
581 /////////////////////// 581 ///////////////////////
582 // Office info 582 // Office info
583 583
584 // Department 584 // Department
585 label = new QLabel( tab2 ); 585 label = new QLabel( tab2 );
586//US loadIcon call is ambiguous. Add one more parameter 586//US loadIcon call is ambiguous. Add one more parameter
587//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 587//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
588 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 588 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
589 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 589 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
590 590
591 label = new QLabel( i18n( "Department:" ), tab2 ); 591 label = new QLabel( i18n( "Department:" ), tab2 );
592 layout->addWidget( label, 0, 1 ); 592 layout->addWidget( label, 0, 1 );
593 mDepartmentEdit = new KLineEdit( tab2 ); 593 mDepartmentEdit = new KLineEdit( tab2 );
594 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 594 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
595 SLOT( textChanged( const QString& ) ) ); 595 SLOT( textChanged( const QString& ) ) );
596 label->setBuddy( mDepartmentEdit ); 596 label->setBuddy( mDepartmentEdit );
597 layout->addWidget( mDepartmentEdit, 0, 2 ); 597 layout->addWidget( mDepartmentEdit, 0, 2 );
598 598
599 label = new QLabel( i18n( "Office:" ), tab2 ); 599 label = new QLabel( i18n( "Office:" ), tab2 );
600 layout->addWidget( label, 1, 1 ); 600 layout->addWidget( label, 1, 1 );
601 mOfficeEdit = new KLineEdit( tab2 ); 601 mOfficeEdit = new KLineEdit( tab2 );
602 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), 602 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
603 SLOT( textChanged( const QString& ) ) ); 603 SLOT( textChanged( const QString& ) ) );
604 label->setBuddy( mOfficeEdit ); 604 label->setBuddy( mOfficeEdit );
605 layout->addWidget( mOfficeEdit, 1, 2 ); 605 layout->addWidget( mOfficeEdit, 1, 2 );
606 606
607 label = new QLabel( i18n( "Profession:" ), tab2 ); 607 label = new QLabel( i18n( "Profession:" ), tab2 );
608 layout->addWidget( label, 2, 1 ); 608 layout->addWidget( label, 2, 1 );
609 mProfessionEdit = new KLineEdit( tab2 ); 609 mProfessionEdit = new KLineEdit( tab2 );
610 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), 610 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ),
611 SLOT( textChanged( const QString& ) ) ); 611 SLOT( textChanged( const QString& ) ) );
612 label->setBuddy( mProfessionEdit ); 612 label->setBuddy( mProfessionEdit );
613 layout->addWidget( mProfessionEdit, 2, 2 ); 613 layout->addWidget( mProfessionEdit, 2, 2 );
614 614
615 label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); 615 label = new QLabel( i18n( "Manager\'s name:" ), tab2 );
616//US layout->addWidget( label, 0, 3 ); 616//US layout->addWidget( label, 0, 3 );
617 layout->addWidget( label, 3, 1 ); 617 layout->addWidget( label, 3, 1 );
618 mManagerEdit = new KLineEdit( tab2 ); 618 mManagerEdit = new KLineEdit( tab2 );
619 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), 619 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ),
620 SLOT( textChanged( const QString& ) ) ); 620 SLOT( textChanged( const QString& ) ) );
621 label->setBuddy( mManagerEdit ); 621 label->setBuddy( mManagerEdit );
622//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); 622//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
623 layout->addWidget( mManagerEdit, 3, 2 ); 623 layout->addWidget( mManagerEdit, 3, 2 );
624 624
625 label = new QLabel( i18n( "Assistant's name:" ), tab2 ); 625 label = new QLabel( i18n( "Assistant's name:" ), tab2 );
626//US layout->addWidget( label, 1, 3 ); 626//US layout->addWidget( label, 1, 3 );
627 layout->addWidget( label, 4, 1 ); 627 layout->addWidget( label, 4, 1 );
628 mAssistantEdit = new KLineEdit( tab2 ); 628 mAssistantEdit = new KLineEdit( tab2 );
629 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), 629 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
630 SLOT( textChanged( const QString& ) ) ); 630 SLOT( textChanged( const QString& ) ) );
631 label->setBuddy( mAssistantEdit ); 631 label->setBuddy( mAssistantEdit );
632//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); 632//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
633 layout->addWidget( mAssistantEdit, 4, 2 ); 633 layout->addWidget( mAssistantEdit, 4, 2 );
634 634
635 bar = new KSeparator( KSeparator::HLine, tab2 ); 635 bar = new KSeparator( KSeparator::HLine, tab2 );
636//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); 636//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
637 layout->addMultiCellWidget( bar, 5, 5, 0, 2 ); 637 layout->addMultiCellWidget( bar, 5, 5, 0, 2 );
638 638
639 ///////////////////////////////////////////////// 639 /////////////////////////////////////////////////
640 // Personal info 640 // Personal info
641 641
642 //label = new QLabel( tab2 ); 642 //label = new QLabel( tab2 );
643//US loadIcon call is ambiguous. Add one more parameter 643//US loadIcon call is ambiguous. Add one more parameter
644//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 644//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
645 //label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 645 //label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
646//US layout->addMultiCellWidget( label, 4, 5, 0, 0 ); 646//US layout->addMultiCellWidget( label, 4, 5, 0, 0 );
647 //layout->addMultiCellWidget( label, 6, 7, 0, 0 ); 647 //layout->addMultiCellWidget( label, 6, 7, 0, 0 );
648 648
649 649
650 int iii = 6; 650 int iii = 6;
651 651
652 if ( QApplication::desktop()->width() == 640 ) { 652 if ( QApplication::desktop()->width() == 640 ) {
653 QHBox * nbox = new QHBox ( tab2 ); 653 QHBox * nbox = new QHBox ( tab2 );
654 label = new QLabel( i18n( "Nick name:" )+" ", nbox ); 654 label = new QLabel( i18n( "Nick name:" )+" ", nbox );
655 mNicknameEdit = new KLineEdit( nbox ); 655 mNicknameEdit = new KLineEdit( nbox );
656 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 656 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
657 SLOT( textChanged( const QString& ) ) ); 657 SLOT( textChanged( const QString& ) ) );
658 label->setBuddy( mNicknameEdit ); 658 label->setBuddy( mNicknameEdit );
659 659
660 label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox ); 660 label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox );
661 mSpouseEdit = new KLineEdit( nbox ); 661 mSpouseEdit = new KLineEdit( nbox );
662 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 662 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
663 SLOT( textChanged( const QString& ) ) ); 663 SLOT( textChanged( const QString& ) ) );
664 label->setBuddy( mSpouseEdit ); 664 label->setBuddy( mSpouseEdit );
665 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); 665 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
666 ++iii; 666 ++iii;
667 667
668 } else { 668 } else {
669 label = new QLabel( i18n( "Nick name:" ), tab2 ); 669 label = new QLabel( i18n( "Nick name:" ), tab2 );
670 layout->addWidget( label, iii, 1 ); 670 layout->addWidget( label, iii, 1 );
671 mNicknameEdit = new KLineEdit( tab2 ); 671 mNicknameEdit = new KLineEdit( tab2 );
672 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 672 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
673 SLOT( textChanged( const QString& ) ) ); 673 SLOT( textChanged( const QString& ) ) );
674 label->setBuddy( mNicknameEdit ); 674 label->setBuddy( mNicknameEdit );
675 layout->addWidget( mNicknameEdit, iii, 2 ); 675 layout->addWidget( mNicknameEdit, iii, 2 );
676 ++iii; 676 ++iii;
677 677
678 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 678 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
679 layout->addWidget( label, iii, 1 ); 679 layout->addWidget( label, iii, 1 );
680 mSpouseEdit = new KLineEdit( tab2 ); 680 mSpouseEdit = new KLineEdit( tab2 );
681 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 681 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
682 SLOT( textChanged( const QString& ) ) ); 682 SLOT( textChanged( const QString& ) ) );
683 label->setBuddy( mSpouseEdit ); 683 label->setBuddy( mSpouseEdit );
684 layout->addWidget( mSpouseEdit, iii, 2 ); 684 layout->addWidget( mSpouseEdit, iii, 2 );
685 ++iii; 685 ++iii;
686 } 686 }
687 687
688 label = new QLabel( i18n( "Children's names:" ), tab2 ); 688 label = new QLabel( i18n( "Children's names:" ), tab2 );
689 layout->addWidget( label, iii, 1 ); 689 layout->addWidget( label, iii, 1 );
690 mChildEdit = new KLineEdit( tab2 ); 690 mChildEdit = new KLineEdit( tab2 );
691 connect( mChildEdit, SIGNAL( textChanged( const QString& ) ), 691 connect( mChildEdit, SIGNAL( textChanged( const QString& ) ),
692 SLOT( textChanged( const QString& ) ) ); 692 SLOT( textChanged( const QString& ) ) );
693 label->setBuddy( mChildEdit ); 693 label->setBuddy( mChildEdit );
694 layout->addWidget( mChildEdit, iii, 2 ); 694 layout->addWidget( mChildEdit, iii, 2 );
695 ++iii; 695 ++iii;
696 if ( QApplication::desktop()->width() == 640 ) { 696 if ( QApplication::desktop()->width() == 640 ) {
697 QHBox * nbox = new QHBox ( tab2 ); 697 QHBox * nbox = new QHBox ( tab2 );
698 label = new QLabel( i18n( "Birthday:" )+" ", nbox ); 698 label = new QLabel( i18n( "Birthday:" )+" ", nbox );
699 mBirthdayPicker = new KDateEdit( nbox ); 699 mBirthdayPicker = new KDateEdit( nbox );
700 //mBirthdayPicker->toggleDateFormat(); 700 //mBirthdayPicker->toggleDateFormat();
701 mBirthdayPicker->setHandleInvalid( true ); 701 mBirthdayPicker->setHandleInvalid( true );
702 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 702 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
703 SLOT( dateChanged( QDate ) ) ); 703 SLOT( dateChanged( QDate ) ) );
704 704
705 label->setBuddy( mBirthdayPicker ); 705 label->setBuddy( mBirthdayPicker );
706 706
707 label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox ); 707 label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox );
708 mAnniversaryPicker = new KDateEdit( nbox ); 708 mAnniversaryPicker = new KDateEdit( nbox );
709 mAnniversaryPicker->setHandleInvalid( true ); 709 mAnniversaryPicker->setHandleInvalid( true );
710 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 710 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
711 SLOT( dateChanged( QDate ) ) ); 711 SLOT( dateChanged( QDate ) ) );
712 712
713 label->setBuddy( mAnniversaryPicker ); 713 label->setBuddy( mAnniversaryPicker );
714 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); 714 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
715 ++iii; 715 ++iii;
716 716
717 } else { 717 } else {
718 718
719 label = new QLabel( i18n( "Birthday:" ), tab2 ); 719 label = new QLabel( i18n( "Birthday:" ), tab2 );
720 layout->addWidget( label, iii, 1 ); 720 layout->addWidget( label, iii, 1 );
721 mBirthdayPicker = new KDateEdit( tab2 ); 721 mBirthdayPicker = new KDateEdit( tab2 );
722 //mBirthdayPicker->toggleDateFormat(); 722 //mBirthdayPicker->toggleDateFormat();
723 mBirthdayPicker->setHandleInvalid( true ); 723 mBirthdayPicker->setHandleInvalid( true );
724 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 724 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
725 SLOT( dateChanged( QDate ) ) ); 725 SLOT( dateChanged( QDate ) ) );
726 726
727 label->setBuddy( mBirthdayPicker ); 727 label->setBuddy( mBirthdayPicker );
728 layout->addWidget( mBirthdayPicker, iii, 2 ); 728 layout->addWidget( mBirthdayPicker, iii, 2 );
729 ++iii; 729 ++iii;
730 730
731 label = new QLabel( i18n( "Anniversary:" ), tab2 ); 731 label = new QLabel( i18n( "Anniversary:" ), tab2 );
732 layout->addWidget( label, iii, 1 ); 732 layout->addWidget( label, iii, 1 );
733 mAnniversaryPicker = new KDateEdit( tab2 ); 733 mAnniversaryPicker = new KDateEdit( tab2 );
734 mAnniversaryPicker->setHandleInvalid( true ); 734 mAnniversaryPicker->setHandleInvalid( true );
735 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 735 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
736 SLOT( dateChanged( QDate ) ) ); 736 SLOT( dateChanged( QDate ) ) );
737 737
738 label->setBuddy( mAnniversaryPicker ); 738 label->setBuddy( mAnniversaryPicker );
739 layout->addWidget( mAnniversaryPicker, iii, 2 ); 739 layout->addWidget( mAnniversaryPicker, iii, 2 );
740 ++iii; 740 ++iii;
741 741
742 } 742 }
743 743
744 label = new QLabel( i18n( "Gender:" ), tab2 ); 744 label = new QLabel( i18n( "Gender:" ), tab2 );
745 layout->addWidget( label, iii, 1 ); 745 layout->addWidget( label, iii, 1 );
746 mGenderBox = new QComboBox ( tab2 ); 746 mGenderBox = new QComboBox ( tab2 );
747 mGenderBox->insertItem ( i18n( "ALIEN (undefined)" )); 747 mGenderBox->insertItem ( i18n( "ALIEN (undefined)" ));
748 mGenderBox->insertItem ( i18n( "female" )); 748 mGenderBox->insertItem ( i18n( "female" ));
749 mGenderBox->insertItem ( i18n( "male" )); 749 mGenderBox->insertItem ( i18n( "male" ));
750 connect( mGenderBox, SIGNAL( activated ( const QString & ) ), 750 connect( mGenderBox, SIGNAL( activated ( const QString & ) ),
751 SLOT( textChanged( const QString& ) ) ); 751 SLOT( textChanged( const QString& ) ) );
752 label->setBuddy( mGenderBox ); 752 label->setBuddy( mGenderBox );
753 layout->addWidget( mGenderBox, iii, 2 ); 753 layout->addWidget( mGenderBox, iii, 2 );
754 ++iii; 754 ++iii;
755 // Build the layout and add to the tab widget 755 // Build the layout and add to the tab widget
756 layout->activate(); // required 756 layout->activate(); // required
757 757
758 mTabWidget->addTab( tab2, i18n( "&Details" ) ); 758 mTabWidget->addTab( tab2, i18n( "&Details" ) );
759} 759}
760 760
761void AddresseeEditorWidget::setupTab2_1() 761void AddresseeEditorWidget::setupTab2_1()
762{ 762{
763 // This is the Details tab 763 // This is the Details tab
764 QWidget *tab2_2 = new QWidget( mTabWidget ); 764 QWidget *tab2_2 = new QWidget( mTabWidget );
765 765
766 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 ); 766 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 );
767 layout->setMargin( KDialogBase::marginHintSmall() ); 767 layout->setMargin( KDialogBase::marginHintSmall() );
768 layout->setSpacing( KDialogBase::spacingHintSmall() ); 768 layout->setSpacing( KDialogBase::spacingHintSmall() );
769 769
770 QLabel *label; 770 QLabel *label;
771 KSeparator* bar; 771 KSeparator* bar;
772 772
773/*US 773/*US
774 /////////////////////// 774 ///////////////////////
775 // Office info 775 // Office info
776 776
777 // Department 777 // Department
778 label = new QLabel( tab2 ); 778 label = new QLabel( tab2 );
779//US loadIcon call is ambiguous. Add one more parameter 779//US loadIcon call is ambiguous. Add one more parameter
780//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 780//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
781 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 781 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
782 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 782 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
783 783
784 label = new QLabel( i18n( "Department:" ), tab2 ); 784 label = new QLabel( i18n( "Department:" ), tab2 );
785 layout->addWidget( label, 0, 1 ); 785 layout->addWidget( label, 0, 1 );
786 mDepartmentEdit = new KLineEdit( tab2 ); 786 mDepartmentEdit = new KLineEdit( tab2 );
787 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 787 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
788 SLOT( textChanged( const QString& ) ) ); 788 SLOT( textChanged( const QString& ) ) );
789 label->setBuddy( mDepartmentEdit ); 789 label->setBuddy( mDepartmentEdit );
790 layout->addWidget( mDepartmentEdit, 0, 2 ); 790 layout->addWidget( mDepartmentEdit, 0, 2 );
791 791
792 label = new QLabel( i18n( "Office:" ), tab2 ); 792 label = new QLabel( i18n( "Office:" ), tab2 );
793 layout->addWidget( label, 1, 1 ); 793 layout->addWidget( label, 1, 1 );
794 mOfficeEdit = new KLineEdit( tab2 ); 794 mOfficeEdit = new KLineEdit( tab2 );
795 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), 795 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
796 SLOT( textChanged( const QString& ) ) ); 796 SLOT( textChanged( const QString& ) ) );
797 label->setBuddy( mOfficeEdit ); 797 label->setBuddy( mOfficeEdit );
798 layout->addWidget( mOfficeEdit, 1, 2 ); 798 layout->addWidget( mOfficeEdit, 1, 2 );
799 799
800 label = new QLabel( i18n( "Profession:" ), tab2 ); 800 label = new QLabel( i18n( "Profession:" ), tab2 );
801 layout->addWidget( label, 2, 1 ); 801 layout->addWidget( label, 2, 1 );
802 mProfessionEdit = new KLineEdit( tab2 ); 802 mProfessionEdit = new KLineEdit( tab2 );
803 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), 803 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ),
804 SLOT( textChanged( const QString& ) ) ); 804 SLOT( textChanged( const QString& ) ) );
805 label->setBuddy( mProfessionEdit ); 805 label->setBuddy( mProfessionEdit );
806 layout->addWidget( mProfessionEdit, 2, 2 ); 806 layout->addWidget( mProfessionEdit, 2, 2 );
807 807
808 label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); 808 label = new QLabel( i18n( "Manager\'s name:" ), tab2 );
809 layout->addWidget( label, 0, 3 ); 809 layout->addWidget( label, 0, 3 );
810 mManagerEdit = new KLineEdit( tab2 ); 810 mManagerEdit = new KLineEdit( tab2 );
811 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), 811 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ),
812 SLOT( textChanged( const QString& ) ) ); 812 SLOT( textChanged( const QString& ) ) );
813 label->setBuddy( mManagerEdit ); 813 label->setBuddy( mManagerEdit );
814 layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); 814 layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
815 815
816 label = new QLabel( i18n( "Assistant's name:" ), tab2 ); 816 label = new QLabel( i18n( "Assistant's name:" ), tab2 );
817 layout->addWidget( label, 1, 3 ); 817 layout->addWidget( label, 1, 3 );
818 mAssistantEdit = new KLineEdit( tab2 ); 818 mAssistantEdit = new KLineEdit( tab2 );
819 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), 819 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
820 SLOT( textChanged( const QString& ) ) ); 820 SLOT( textChanged( const QString& ) ) );
821 label->setBuddy( mAssistantEdit ); 821 label->setBuddy( mAssistantEdit );
822 layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); 822 layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
823 823
824 bar = new KSeparator( KSeparator::HLine, tab2 ); 824 bar = new KSeparator( KSeparator::HLine, tab2 );
825 layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); 825 layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
826 826
827 ///////////////////////////////////////////////// 827 /////////////////////////////////////////////////
828 // Personal info 828 // Personal info
829 829
830 label = new QLabel( tab2 ); 830 label = new QLabel( tab2 );
831//US loadIcon call is ambiguous. Add one more parameter 831//US loadIcon call is ambiguous. Add one more parameter
832//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 832//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
833 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 833 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
834 layout->addMultiCellWidget( label, 4, 5, 0, 0 ); 834 layout->addMultiCellWidget( label, 4, 5, 0, 0 );
835 835
836 label = new QLabel( i18n( "Nick name:" ), tab2 ); 836 label = new QLabel( i18n( "Nick name:" ), tab2 );
837 layout->addWidget( label, 4, 1 ); 837 layout->addWidget( label, 4, 1 );
838 mNicknameEdit = new KLineEdit( tab2 ); 838 mNicknameEdit = new KLineEdit( tab2 );
839 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 839 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
840 SLOT( textChanged( const QString& ) ) ); 840 SLOT( textChanged( const QString& ) ) );
841 label->setBuddy( mNicknameEdit ); 841 label->setBuddy( mNicknameEdit );
842 layout->addWidget( mNicknameEdit, 4, 2 ); 842 layout->addWidget( mNicknameEdit, 4, 2 );
843 843
844 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 844 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
845 layout->addWidget( label, 5, 1 ); 845 layout->addWidget( label, 5, 1 );
846 mSpouseEdit = new KLineEdit( tab2 ); 846 mSpouseEdit = new KLineEdit( tab2 );
847 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 847 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
848 SLOT( textChanged( const QString& ) ) ); 848 SLOT( textChanged( const QString& ) ) );
849 label->setBuddy( mSpouseEdit ); 849 label->setBuddy( mSpouseEdit );
850 layout->addWidget( mSpouseEdit, 5, 2 ); 850 layout->addWidget( mSpouseEdit, 5, 2 );
851 851
852 label = new QLabel( i18n( "Birthday:" ), tab2 ); 852 label = new QLabel( i18n( "Birthday:" ), tab2 );
853 layout->addWidget( label, 4, 3 ); 853 layout->addWidget( label, 4, 3 );
854 mBirthdayPicker = new KDateEdit( tab2 ); 854 mBirthdayPicker = new KDateEdit( tab2 );
855 mBirthdayPicker->setHandleInvalid( true ); 855 mBirthdayPicker->setHandleInvalid( true );
856 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 856 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
857 SLOT( dateChanged( QDate ) ) ); 857 SLOT( dateChanged( QDate ) ) );
858 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ), 858 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ),
859 SLOT( invalidDate() ) ); 859 SLOT( invalidDate() ) );
860 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ), 860 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ),
861 SLOT( emitModified() ) ); 861 SLOT( emitModified() ) );
862 label->setBuddy( mBirthdayPicker ); 862 label->setBuddy( mBirthdayPicker );
863 layout->addWidget( mBirthdayPicker, 4, 4 ); 863 layout->addWidget( mBirthdayPicker, 4, 4 );
864 864
865 label = new QLabel( i18n( "Anniversary:" ), tab2 ); 865 label = new QLabel( i18n( "Anniversary:" ), tab2 );
866 layout->addWidget( label, 5, 3 ); 866 layout->addWidget( label, 5, 3 );
867 mAnniversaryPicker = new KDateEdit( tab2 ); 867 mAnniversaryPicker = new KDateEdit( tab2 );
868 mAnniversaryPicker->setHandleInvalid( true ); 868 mAnniversaryPicker->setHandleInvalid( true );
869 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 869 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
870 SLOT( dateChanged( QDate ) ) ); 870 SLOT( dateChanged( QDate ) ) );
871 connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ), 871 connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ),
872 SLOT( invalidDate() ) ); 872 SLOT( invalidDate() ) );
873 connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ), 873 connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ),
874 SLOT( emitModified() ) ); 874 SLOT( emitModified() ) );
875 label->setBuddy( mAnniversaryPicker ); 875 label->setBuddy( mAnniversaryPicker );
876 layout->addWidget( mAnniversaryPicker, 5, 4 ); 876 layout->addWidget( mAnniversaryPicker, 5, 4 );
877 877
878 bar = new KSeparator( KSeparator::HLine, tab2 ); 878 bar = new KSeparator( KSeparator::HLine, tab2 );
879 layout->addMultiCellWidget( bar, 6, 6, 0, 5 ); 879 layout->addMultiCellWidget( bar, 6, 6, 0, 5 );
880*/ 880*/
881 ////////////////////////////////////// 881 //////////////////////////////////////
882 // Notes 882 // Notes
883 label = new QLabel( i18n( "Note:" ), tab2_2 ); 883 label = new QLabel( i18n( "Note:" ), tab2_2 );
884 label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); 884 label->setAlignment( Qt::AlignTop | Qt::AlignLeft );
885//US layout->addWidget( label, 7, 0 ); 885//US layout->addWidget( label, 7, 0 );
886 layout->addWidget( label, 0, 0 ); 886 layout->addWidget( label, 0, 0 );
887#ifndef KAB_EMBEDDED 887#ifndef KAB_EMBEDDED
888 mNoteEdit = new QTextEdit( tab2_2 ); 888 mNoteEdit = new QTextEdit( tab2_2 );
889 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); 889 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth );
890 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 890 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
891#else //KAB_EMBEDDED 891#else //KAB_EMBEDDED
892 mNoteEdit = new QMultiLineEdit( tab2_2 ); 892 mNoteEdit = new QMultiLineEdit( tab2_2 );
893 mNoteEdit->setWordWrap( QMultiLineEdit::WidgetWidth ); 893 mNoteEdit->setWordWrap( QMultiLineEdit::WidgetWidth );
894 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 894 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
895#endif //KAB_EMBEDDED 895#endif //KAB_EMBEDDED
896 896
897 connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) ); 897 connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) );
898 label->setBuddy( mNoteEdit ); 898 label->setBuddy( mNoteEdit );
899//US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 ); 899//US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 );
900 layout->addWidget( mNoteEdit, 1, 0); 900 layout->addWidget( mNoteEdit, 1, 0);
901 901
902 // Build the layout and add to the tab widget 902 // Build the layout and add to the tab widget
903 layout->activate(); // required 903 layout->activate(); // required
904 904
905 mTabWidget->addTab( tab2_2, i18n( "&Notes" ) ); 905 mTabWidget->addTab( tab2_2, i18n( "&Notes" ) );
906} 906}
907 907
908 908
909 909
910void AddresseeEditorWidget::setupTab3() 910void AddresseeEditorWidget::setupTab3()
911{ 911{
912 // This is the Misc tab 912 // This is the Misc tab
913 QWidget *tab3 = new QWidget( mTabWidget ); 913 QWidget *tab3 = new QWidget( mTabWidget );
914 914
915 QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); 915 QGridLayout *layout = new QGridLayout( tab3, 1, 1 );
916 layout->setMargin( KDialogBase::marginHintSmall() ); 916 layout->setMargin( KDialogBase::marginHintSmall() );
917 layout->setSpacing( KDialogBase::spacingHintSmall() ); 917 layout->setSpacing( KDialogBase::spacingHintSmall() );
918//US layout->setColStretch( 2, 1 ); 918//US layout->setColStretch( 2, 1 );
919 919
920 ////////////////////////////////////// 920 //////////////////////////////////////
921 // Geo 921 // Geo
922 mGeoWidget = new GeoWidget( tab3 ); 922 mGeoWidget = new GeoWidget( tab3 );
923 // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); 923 // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() );
924 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 924 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
925 layout->addWidget( mGeoWidget, 0, 0 ); 925 layout->addWidget( mGeoWidget, 0, 0 );
926/*US 926/*US
927 ////////////////////////////////////// 927 //////////////////////////////////////
928 // Sound 928 // Sound
929#ifndef KAB_EMBEDDED 929#ifndef KAB_EMBEDDED
930 mSoundWidget = new SoundWidget( tab3 ); 930 mSoundWidget = new SoundWidget( tab3 );
931 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); 931 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
932 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 932 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
933 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); 933 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
934#else //KAB_EMBEDDED 934#else //KAB_EMBEDDED
935qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); 935qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
936#endif //KAB_EMBEDDED 936#endif //KAB_EMBEDDED
937 937
938 ////////////////////////////////////// 938 //////////////////////////////////////
939 // Images 939 // Images
940 mImageWidget = new ImageWidget( tab3 ); 940 mImageWidget = new ImageWidget( tab3 );
941 mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); 941 mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
942 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 942 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
943 layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop ); 943 layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop );
944*/ 944*/
945//US 945//US
946/* 946/*
947 KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 ); 947 KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 );
948 layout->addMultiCellWidget( bar, 1, 1, 0, 0 ); 948 layout->addMultiCellWidget( bar, 1, 1, 0, 0 );
949*/ 949*/
950 ////////////////////////////////////// 950 //////////////////////////////////////
951 // Keys 951 // Keys
952 mKeyWidget = new KeyWidget( tab3 ); 952 mKeyWidget = new KeyWidget( tab3 );
953 //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); 953 //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
954 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 954 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
955//US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); 955//US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
956 layout->addWidget( mKeyWidget, 1, 0 ); 956 layout->addWidget( mKeyWidget, 1, 0 );
957 957
958 mTabWidget->addTab( tab3, i18n( "&Misc" ) ); 958 mTabWidget->addTab( tab3, i18n( "&Misc" ) );
959} 959}
960 960
961void AddresseeEditorWidget::setupTab3_1() 961void AddresseeEditorWidget::setupTab3_1()
962{ 962{
963 // This is the Misc tab 963 // This is the Misc tab
964 QWidget *tab3 = new QWidget( mTabWidget ); 964 QWidget *tab3 = new QWidget( mTabWidget );
965 965
966//US QGridLayout *layout = new QGridLayout( tab3, 2, 3 ); 966//US QGridLayout *layout = new QGridLayout( tab3, 2, 3 );
967 QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); 967 QGridLayout *layout = new QGridLayout( tab3, 1, 1 );
968 layout->setMargin( KDialogBase::marginHint() ); 968 layout->setMargin( KDialogBase::marginHint() );
969 layout->setSpacing( KDialogBase::spacingHint() ); 969 layout->setSpacing( KDialogBase::spacingHint() );
970//US layout->setColStretch( 2, 1 ); 970//US layout->setColStretch( 2, 1 );
971 971
972/*US 972/*US
973 ////////////////////////////////////// 973 //////////////////////////////////////
974 // Geo 974 // Geo
975 mGeoWidget = new GeoWidget( tab3 ); 975 mGeoWidget = new GeoWidget( tab3 );
976 mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); 976 mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() );
977 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 977 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
978 layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop ); 978 layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop );
979*/ 979*/
980 ////////////////////////////////////// 980 //////////////////////////////////////
981 // Sound 981 // Sound
982#ifndef KAB_EMBEDDED 982#ifndef KAB_EMBEDDED
983 mSoundWidget = new SoundWidget( tab3 ); 983 mSoundWidget = new SoundWidget( tab3 );
984 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); 984 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
985 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 985 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
986 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); 986 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
987#else //KAB_EMBEDDED 987#else //KAB_EMBEDDED
988//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); 988//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
989#endif //KAB_EMBEDDED 989#endif //KAB_EMBEDDED
990 990
991 ////////////////////////////////////// 991 //////////////////////////////////////
992 // Images 992 // Images
993 mImageWidget = new ImageWidget( tab3 ); 993 mImageWidget = new ImageWidget( tab3 );
994 mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); 994 mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
995 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 995 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
996 layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop ); 996 layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop );
997/*US 997/*US
998 ////////////////////////////////////// 998 //////////////////////////////////////
999 // Keys 999 // Keys
1000 mKeyWidget = new KeyWidget( tab3 ); 1000 mKeyWidget = new KeyWidget( tab3 );
1001 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); 1001 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
1002 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 1002 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
1003 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); 1003 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
1004*/ 1004*/
1005 mTabWidget->addTab( tab3, i18n( "&Images" ) ); 1005 mTabWidget->addTab( tab3, i18n( "&Images" ) );
1006} 1006}
1007 1007
1008 1008
1009void AddresseeEditorWidget::load() 1009void AddresseeEditorWidget::load()
1010{ 1010{
1011 1011
1012 // Block signals in case anything tries to emit modified 1012 // Block signals in case anything tries to emit modified
1013 // CS: This doesn't seem to work. 1013 // CS: This doesn't seem to work.
1014 bool block = signalsBlocked(); 1014 bool block = signalsBlocked();
1015 blockSignals( true ); 1015 blockSignals( true );
1016 mBlockSignals = true; // used for internal signal blocking 1016 mBlockSignals = true; // used for internal signal blocking
1017 1017
1018 mNameEdit->setText( mAddressee.assembledName() ); 1018 mNameEdit->setText( mAddressee.assembledName() );
1019 1019
1020 if ( mAddressee.formattedName().isEmpty() ) { 1020 if ( mAddressee.formattedName().isEmpty() ) {
1021//US KConfig config( "kaddressbookrc" ); 1021//US KConfig config( "kaddressbookrc" );
1022 KConfig config( locateLocal("config", "kabcrc") ); 1022 KConfig config( locateLocal("config", "kabcrc") );
1023 config.setGroup( "General" ); 1023 config.setGroup( "General" );
1024 mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 ); 1024 mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 );
1025 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1025 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1026 } else {; 1026 } else {;
1027 if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) ) 1027 if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) )
1028 mFormattedNameType = NameEditDialog::SimpleName; 1028 mFormattedNameType = NameEditDialog::SimpleName;
1029 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) ) 1029 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) )
1030 mFormattedNameType = NameEditDialog::FullName; 1030 mFormattedNameType = NameEditDialog::FullName;
1031 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) ) 1031 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) )
1032 mFormattedNameType = NameEditDialog::ReverseName; 1032 mFormattedNameType = NameEditDialog::ReverseName;
1033 else 1033 else
1034 mFormattedNameType = NameEditDialog::CustomName; 1034 mFormattedNameType = NameEditDialog::CustomName;
1035 } 1035 }
1036 1036
1037 mFormattedNameLabel->setText( mAddressee.formattedName() ); 1037 mFormattedNameLabel->setText( mAddressee.formattedName() );
1038 1038
1039 mAConfig->setUid( mAddressee.uid() ); 1039 mAConfig->setUid( mAddressee.uid() );
1040 if ( mAConfig->automaticNameParsing() ) { 1040 if ( mAConfig->automaticNameParsing() ) {
1041 mNameLabel->hide(); 1041 mNameLabel->hide();
1042 mNameEdit->show(); 1042 mNameEdit->show();
1043 } else { 1043 } else {
1044 mNameEdit->hide(); 1044 mNameEdit->hide();
1045 mNameLabel->setText( mNameEdit->text() ); 1045 mNameLabel->setText( mNameEdit->text() );
1046 mNameLabel->show(); 1046 mNameLabel->show();
1047 } 1047 }
1048 1048
1049 mRoleEdit->setText( mAddressee.role() ); 1049 mRoleEdit->setText( mAddressee.role() );
1050 mOrgEdit->setText( mAddressee.organization() ); 1050 mOrgEdit->setText( mAddressee.organization() );
1051 1051
1052//US mURLEdit->setURL( mAddressee.url().url() ); 1052//US mURLEdit->setURL( mAddressee.url().url() );
1053 mURLEdit->setText( mAddressee.url().prettyURL() ); 1053 mURLEdit->setText( mAddressee.url().prettyURL() );
1054//US?? mURLEdit->home( false ); 1054//US?? mURLEdit->home( false );
1055 1055
1056 // mNoteEdit->setText( mAddressee.note() ); 1056 // mNoteEdit->setText( mAddressee.note() );
1057 mNoteEdit->setText( mAddressee.note() ); 1057 mNoteEdit->setText( mAddressee.note() );
1058 mEmailWidget->setEmails( mAddressee.emails() ); 1058 mEmailWidget->setEmails( mAddressee.emails() );
1059 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() ); 1059 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() );
1060 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() ); 1060 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() );
1061 mBirthdayPicker->setDate( mAddressee.birthday().date() ); 1061 mBirthdayPicker->setDate( mAddressee.birthday().date() );
1062 1062
1063//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom( 1063//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom(
1064//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) ); 1064//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) );
1065 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), 1065 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
1066 "%Y-%m-%d"); // = Qt::ISODate 1066 "%Y-%m-%d"); // = Qt::ISODate
1067 mAnniversaryPicker->setDate( dt ); 1067 mAnniversaryPicker->setDate( dt );
1068 1068
1069 1069
1070 mNicknameEdit->setText( mAddressee.nickName() ); 1070 mNicknameEdit->setText( mAddressee.nickName() );
1071 mCategoryEdit->setText( mAddressee.categories().join( "," ) ); 1071 mCategoryEdit->setText( mAddressee.categories().join( "," ) );
1072 1072
1073 mGeoWidget->setGeo( mAddressee.geo() ); 1073 mGeoWidget->setGeo( mAddressee.geo() );
1074 mImageWidget->setPhoto( mAddressee.photo() ); 1074 mImageWidget->setPhoto( mAddressee.photo() );
1075 mImageWidget->setLogo( mAddressee.logo() ); 1075 mImageWidget->setLogo( mAddressee.logo() );
1076 mKeyWidget->setKeys( mAddressee.keys() ); 1076 mKeyWidget->setKeys( mAddressee.keys() );
1077 mSecrecyWidget->setSecrecy( mAddressee.secrecy() ); 1077 mSecrecyWidget->setSecrecy( mAddressee.secrecy() );
1078#ifndef KAB_EMBEDDED 1078#ifndef KAB_EMBEDDED
1079 mSoundWidget->setSound( mAddressee.sound() ); 1079 mSoundWidget->setSound( mAddressee.sound() );
1080#else //KAB_EMBEDDED 1080#else //KAB_EMBEDDED
1081//US qDebug("AddresseeEditorWidget::load has to be changed 2"); 1081//US qDebug("AddresseeEditorWidget::load has to be changed 2");
1082#endif //KAB_EMBEDDED 1082#endif //KAB_EMBEDDED
1083 1083
1084 // Load customs 1084 // Load customs
1085 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); 1085 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) );
1086 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); 1086 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) );
1087 mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) ); 1087 mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) );
1088 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); 1088 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) );
1089 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); 1089 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) );
1090 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); 1090 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) );
1091 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); 1091 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) );
1092 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); 1092 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) );
1093 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); 1093 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
1094 if ( gen == "female" ) 1094 if ( gen == "female" )
1095 mGenderBox->setCurrentItem ( 1 ); 1095 mGenderBox->setCurrentItem ( 1 );
1096 else if ( gen == "male" ) 1096 else if ( gen == "male" )
1097 mGenderBox->setCurrentItem ( 2 ); 1097 mGenderBox->setCurrentItem ( 2 );
1098 else 1098 else
1099 mGenderBox->setCurrentItem ( 0 ); 1099 mGenderBox->setCurrentItem ( 0 );
1100 blockSignals( block ); 1100 blockSignals( block );
1101 mBlockSignals = false; 1101 mBlockSignals = false;
1102 1102
1103 mDirty = false; 1103 mDirty = false;
1104} 1104}
1105 1105
1106void AddresseeEditorWidget::save() 1106void AddresseeEditorWidget::save()
1107{ 1107{
1108 if ( !dirty() ) { 1108 if ( !dirty() ) {
1109 return; 1109 return;
1110 } 1110 }
1111 1111
1112 mAddressee.setRevision( QDateTime::currentDateTime() ); 1112 mAddressee.setRevision( QDateTime::currentDateTime() );
1113 1113
1114 mAddressee.setRole( mRoleEdit->text() ); 1114 mAddressee.setRole( mRoleEdit->text() );
1115 mAddressee.setOrganization( mOrgEdit->text() ); 1115 mAddressee.setOrganization( mOrgEdit->text() );
1116 mAddressee.setUrl( KURL( mURLEdit->text() ) ); 1116 mAddressee.setUrl( KURL( mURLEdit->text() ) );
1117 mAddressee.setNote( mNoteEdit->text() ); 1117 mAddressee.setNote( mNoteEdit->text() );
1118 if ( mBirthdayPicker->inputIsValid() ) { 1118 if ( mBirthdayPicker->inputIsValid() ) {
1119 QDate da = mBirthdayPicker->date(); 1119 QDate da = mBirthdayPicker->date();
1120 mAddressee.setBirthday( QDateTime( da ) ); 1120 mAddressee.setBirthday( QDateTime( da ) );
1121 //qDebug("bday %s ",da.toString().latin1()); 1121 //qDebug("bday %s ",da.toString().latin1());
1122 } 1122 }
1123 else { 1123 else {
1124 mAddressee.setBirthday( QDateTime() ); 1124 mAddressee.setBirthday( QDateTime() );
1125 mBirthdayPicker->clear(); 1125 mBirthdayPicker->clear();
1126 } 1126 }
1127 mAddressee.setNickName( mNicknameEdit->text() ); 1127 mAddressee.setNickName( mNicknameEdit->text() );
1128 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); 1128 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) );
1129 1129
1130 mAddressee.setGeo( mGeoWidget->geo() ); 1130 mAddressee.setGeo( mGeoWidget->geo() );
1131 mAddressee.setPhoto( mImageWidget->photo() ); 1131 mAddressee.setPhoto( mImageWidget->photo() );
1132 mAddressee.setLogo( mImageWidget->logo() ); 1132 mAddressee.setLogo( mImageWidget->logo() );
1133 mAddressee.setKeys( mKeyWidget->keys() ); 1133 mAddressee.setKeys( mKeyWidget->keys() );
1134#ifndef KAB_EMBEDDED 1134#ifndef KAB_EMBEDDED
1135 mAddressee.setSound( mSoundWidget->sound() ); 1135 mAddressee.setSound( mSoundWidget->sound() );
1136#else //KAB_EMBEDDED 1136#else //KAB_EMBEDDED
1137//US qDebug("AddresseeEditorWidget::save sound not supported"); 1137//US qDebug("AddresseeEditorWidget::save sound not supported");
1138#endif //KAB_EMBEDDED 1138#endif //KAB_EMBEDDED
1139 mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); 1139 mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
1140 1140
1141 // save custom fields 1141 // save custom fields
1142 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); 1142 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() );
1143 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); 1143 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() );
1144 mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() ); 1144 mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() );
1145 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); 1145 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() );
1146 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); 1146 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() );
1147 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); 1147 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() );
1148 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); 1148 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
1149 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); 1149 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
1150 if ( mAnniversaryPicker->inputIsValid() ) { 1150 if ( mAnniversaryPicker->inputIsValid() ) {
1151 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); 1151 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
1152 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 1152 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
1153 } 1153 }
1154 else { 1154 else {
1155 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); 1155 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
1156 mAnniversaryPicker->clear(); 1156 mAnniversaryPicker->clear();
1157 } 1157 }
1158 int gen = mGenderBox->currentItem (); 1158 int gen = mGenderBox->currentItem ();
1159 if ( gen == 1 ) 1159 if ( gen == 1 )
1160 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); 1160 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female");
1161 else if ( gen == 2 ) 1161 else if ( gen == 2 )
1162 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); 1162 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male");
1163 else 1163 else
1164 mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" ); 1164 mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" );
1165 1165
1166 // Save the email addresses 1166 // Save the email addresses
1167 QStringList emails = mAddressee.emails(); 1167 QStringList emails = mAddressee.emails();
1168 QStringList::Iterator iter; 1168 QStringList::Iterator iter;
1169 for ( iter = emails.begin(); iter != emails.end(); ++iter ) 1169 for ( iter = emails.begin(); iter != emails.end(); ++iter )
1170 mAddressee.removeEmail( *iter ); 1170 mAddressee.removeEmail( *iter );
1171 1171
1172 emails = mEmailWidget->emails(); 1172 emails = mEmailWidget->emails();
1173 bool first = true; 1173 bool first = true;
1174 for ( iter = emails.begin(); iter != emails.end(); ++iter ) { 1174 for ( iter = emails.begin(); iter != emails.end(); ++iter ) {
1175 mAddressee.insertEmail( *iter, first ); 1175 mAddressee.insertEmail( *iter, first );
1176 first = false; 1176 first = false;
1177 } 1177 }
1178 1178
1179 // Save the phone numbers 1179 // Save the phone numbers
1180 KABC::PhoneNumber::List phoneNumbers; 1180 KABC::PhoneNumber::List phoneNumbers;
1181 KABC::PhoneNumber::List::Iterator phoneIter; 1181 KABC::PhoneNumber::List::Iterator phoneIter;
1182 phoneNumbers = mAddressee.phoneNumbers(); 1182 phoneNumbers = mAddressee.phoneNumbers();
1183 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1183 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1184 ++phoneIter ) 1184 ++phoneIter )
1185 mAddressee.removePhoneNumber( *phoneIter ); 1185 mAddressee.removePhoneNumber( *phoneIter );
1186 1186
1187 phoneNumbers = mPhoneEditWidget->phoneNumbers(); 1187 phoneNumbers = mPhoneEditWidget->phoneNumbers();
1188 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1188 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1189 ++phoneIter ) 1189 ++phoneIter )
1190 mAddressee.insertPhoneNumber( *phoneIter ); 1190 mAddressee.insertPhoneNumber( *phoneIter );
1191 1191 mAddressee.makePhoneNumbersOLcompatible();
1192 // Save the addresses 1192 // Save the addresses
1193 KABC::Address::List addresses; 1193 KABC::Address::List addresses;
1194 KABC::Address::List::Iterator addressIter; 1194 KABC::Address::List::Iterator addressIter;
1195 addresses = mAddressee.addresses(); 1195 addresses = mAddressee.addresses();
1196 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1196 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1197 ++addressIter ) 1197 ++addressIter )
1198 mAddressee.removeAddress( *addressIter ); 1198 mAddressee.removeAddress( *addressIter );
1199 1199
1200 addresses = mAddressEditWidget->addresses(); 1200 addresses = mAddressEditWidget->addresses();
1201 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1201 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1202 ++addressIter ) 1202 ++addressIter )
1203 mAddressee.insertAddress( *addressIter ); 1203 mAddressee.insertAddress( *addressIter );
1204 mDirty = false; 1204 mDirty = false;
1205} 1205}
1206 1206
1207bool AddresseeEditorWidget::dirty() 1207bool AddresseeEditorWidget::dirty()
1208{ 1208{
1209 1209
1210 if ( ! mDirty ) { 1210 if ( ! mDirty ) {
1211 if ( mBirthdayPicker->inputIsValid() ) { 1211 if ( mBirthdayPicker->inputIsValid() ) {
1212 QDate da = mBirthdayPicker->date(); 1212 QDate da = mBirthdayPicker->date();
1213 if ( !(da == mAddressee.birthday().date())) 1213 if ( !(da == mAddressee.birthday().date()))
1214 mDirty = true; 1214 mDirty = true;
1215 } 1215 }
1216 else { 1216 else {
1217 mBirthdayPicker->clear(); 1217 mBirthdayPicker->clear();
1218 } 1218 }
1219 if ( mAnniversaryPicker->inputIsValid() ) { 1219 if ( mAnniversaryPicker->inputIsValid() ) {
1220 QDate da = mAnniversaryPicker->date(); 1220 QDate da = mAnniversaryPicker->date();
1221 if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), 1221 if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
1222 "%Y-%m-%d")) 1222 "%Y-%m-%d"))
1223 mDirty = true; 1223 mDirty = true;
1224 } 1224 }
1225 else { 1225 else {
1226 mAnniversaryPicker->clear(); 1226 mAnniversaryPicker->clear();
1227 } 1227 }
1228 } 1228 }
1229 return mDirty; 1229 return mDirty;
1230} 1230}
1231 1231
1232void AddresseeEditorWidget::nameTextChanged( const QString &text ) 1232void AddresseeEditorWidget::nameTextChanged( const QString &text )
1233{ 1233{
1234 if ( mBlockSignals ) 1234 if ( mBlockSignals )
1235 return; 1235 return;
1236 // use the addressee class to parse the name for us 1236 // use the addressee class to parse the name for us
1237 mAConfig->setUid( mAddressee.uid() ); 1237 mAConfig->setUid( mAddressee.uid() );
1238 if ( mAConfig->automaticNameParsing() ) { 1238 if ( mAConfig->automaticNameParsing() ) {
1239 if ( !mAddressee.formattedName().isEmpty() ) { 1239 if ( !mAddressee.formattedName().isEmpty() ) {
1240 QString fn = mAddressee.formattedName(); 1240 QString fn = mAddressee.formattedName();
1241 mAddressee.setNameFromString( text ); 1241 mAddressee.setNameFromString( text );
1242 mAddressee.setFormattedName( fn ); 1242 mAddressee.setFormattedName( fn );
1243 } else { 1243 } else {
1244 // use extra addressee to avoid a formatted name assignment 1244 // use extra addressee to avoid a formatted name assignment
1245 Addressee addr; 1245 Addressee addr;
1246 addr.setNameFromString( text ); 1246 addr.setNameFromString( text );
1247 mAddressee.setPrefix( addr.prefix() ); 1247 mAddressee.setPrefix( addr.prefix() );
1248 mAddressee.setGivenName( addr.givenName() ); 1248 mAddressee.setGivenName( addr.givenName() );
1249 mAddressee.setAdditionalName( addr.additionalName() ); 1249 mAddressee.setAdditionalName( addr.additionalName() );
1250 mAddressee.setFamilyName( addr.familyName() ); 1250 mAddressee.setFamilyName( addr.familyName() );
1251 mAddressee.setSuffix( addr.suffix() ); 1251 mAddressee.setSuffix( addr.suffix() );
1252 } 1252 }
1253 } 1253 }
1254 nameBoxChanged(); 1254 nameBoxChanged();
1255 1255
1256 1256
1257 emitModified(); 1257 emitModified();
1258} 1258}
1259 1259
1260void AddresseeEditorWidget::nameBoxChanged() 1260void AddresseeEditorWidget::nameBoxChanged()
1261{ 1261{
1262 KABC::Addressee addr; 1262 KABC::Addressee addr;
1263 mAConfig->setUid( mAddressee.uid() ); 1263 mAConfig->setUid( mAddressee.uid() );
1264 if ( mAConfig->automaticNameParsing() ) { 1264 if ( mAConfig->automaticNameParsing() ) {
1265 addr.setNameFromString( mNameEdit->text() ); 1265 addr.setNameFromString( mNameEdit->text() );
1266 mNameLabel->hide(); 1266 mNameLabel->hide();
1267 mNameEdit->show(); 1267 mNameEdit->show();
1268 } else { 1268 } else {
1269 addr = mAddressee; 1269 addr = mAddressee;
1270 mNameEdit->hide(); 1270 mNameEdit->hide();
1271 mNameLabel->setText( mNameEdit->text() ); 1271 mNameLabel->setText( mNameEdit->text() );
1272 mNameLabel->show(); 1272 mNameLabel->show();
1273 } 1273 }
1274 1274
1275 if ( mFormattedNameType != NameEditDialog::CustomName ) { 1275 if ( mFormattedNameType != NameEditDialog::CustomName ) {
1276 mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1276 mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1277 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1277 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1278 } 1278 }
1279} 1279}
1280 1280
1281void AddresseeEditorWidget::nameButtonClicked() 1281void AddresseeEditorWidget::nameButtonClicked()
1282{ 1282{
1283 // show the name dialog. 1283 // show the name dialog.
1284 NameEditDialog dialog( mAddressee, mFormattedNameType, this ); 1284 NameEditDialog dialog( mAddressee, mFormattedNameType, this );
1285 1285
1286 if ( KApplication::execDialog( &dialog) ) { 1286 if ( KApplication::execDialog( &dialog) ) {
1287 if ( dialog.changed() ) { 1287 if ( dialog.changed() ) {
1288 mAddressee.setFamilyName( dialog.familyName() ); 1288 mAddressee.setFamilyName( dialog.familyName() );
1289 mAddressee.setGivenName( dialog.givenName() ); 1289 mAddressee.setGivenName( dialog.givenName() );
1290 mAddressee.setPrefix( dialog.prefix() ); 1290 mAddressee.setPrefix( dialog.prefix() );
1291 mAddressee.setSuffix( dialog.suffix() ); 1291 mAddressee.setSuffix( dialog.suffix() );
1292 mAddressee.setAdditionalName( dialog.additionalName() ); 1292 mAddressee.setAdditionalName( dialog.additionalName() );
1293 mFormattedNameType = dialog.formattedNameType(); 1293 mFormattedNameType = dialog.formattedNameType();
1294 if ( mFormattedNameType == NameEditDialog::CustomName ) { 1294 if ( mFormattedNameType == NameEditDialog::CustomName ) {
1295 mFormattedNameLabel->setText( dialog.customFormattedName() ); 1295 mFormattedNameLabel->setText( dialog.customFormattedName() );
1296 mAddressee.setFormattedName( dialog.customFormattedName() ); 1296 mAddressee.setFormattedName( dialog.customFormattedName() );
1297 } 1297 }
1298 // Update the name edit. 1298 // Update the name edit.
1299 bool block = mNameEdit->signalsBlocked(); 1299 bool block = mNameEdit->signalsBlocked();
1300 mNameEdit->blockSignals( true ); 1300 mNameEdit->blockSignals( true );
1301 mNameEdit->setText( mAddressee.assembledName() ); 1301 mNameEdit->setText( mAddressee.assembledName() );
1302 mNameEdit->blockSignals( block ); 1302 mNameEdit->blockSignals( block );
1303 1303
1304 // Update the combo box. 1304 // Update the combo box.
1305 nameBoxChanged(); 1305 nameBoxChanged();
1306 1306
1307 emitModified(); 1307 emitModified();
1308 } 1308 }
1309 } 1309 }
1310} 1310}
1311 1311
1312void AddresseeEditorWidget::categoryButtonClicked() 1312void AddresseeEditorWidget::categoryButtonClicked()
1313{ 1313{
1314 // Show the category dialog 1314 // Show the category dialog
1315 if ( mCategoryDialog == 0 ) { 1315 if ( mCategoryDialog == 0 ) {
1316 mCategoryDialog = new KPIM::CategorySelectDialog( KABPrefs::instance(), this ); 1316 mCategoryDialog = new KPIM::CategorySelectDialog( KABPrefs::instance(), this );
1317 connect( mCategoryDialog, SIGNAL( categoriesSelected( const QStringList& ) ), 1317 connect( mCategoryDialog, SIGNAL( categoriesSelected( const QStringList& ) ),
1318 SLOT(categoriesSelected( const QStringList& ) ) ); 1318 SLOT(categoriesSelected( const QStringList& ) ) );
1319 connect( mCategoryDialog, SIGNAL( editCategories() ), SLOT( editCategories() ) ); 1319 connect( mCategoryDialog, SIGNAL( editCategories() ), SLOT( editCategories() ) );
1320 } 1320 }
1321 1321
1322 mCategoryDialog->setCategories(); 1322 mCategoryDialog->setCategories();
1323 mCategoryDialog->setSelected( QStringList::split( ",", mCategoryEdit->text() ) ); 1323 mCategoryDialog->setSelected( QStringList::split( ",", mCategoryEdit->text() ) );
1324 mCategoryDialog->show(); 1324 mCategoryDialog->show();
1325 mCategoryDialog->raise(); 1325 mCategoryDialog->raise();
1326} 1326}
1327 1327
1328void AddresseeEditorWidget::categoriesSelected( const QStringList &list ) 1328void AddresseeEditorWidget::categoriesSelected( const QStringList &list )
1329{ 1329{
1330 mCategoryEdit->setText( list.join( "," ) ); 1330 mCategoryEdit->setText( list.join( "," ) );
1331} 1331}
1332 1332
1333void AddresseeEditorWidget::editCategories() 1333void AddresseeEditorWidget::editCategories()
1334{ 1334{
1335 if ( mCategoryEditDialog == 0 ) { 1335 if ( mCategoryEditDialog == 0 ) {
1336 mCategoryEditDialog = new KPIM::CategoryEditDialog( KABPrefs::instance(), this ); 1336 mCategoryEditDialog = new KPIM::CategoryEditDialog( KABPrefs::instance(), this );
1337 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ), 1337 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ),
1338 SLOT( categoryButtonClicked() ) ); 1338 SLOT( categoryButtonClicked() ) );
1339 } 1339 }
1340 1340
1341 mCategoryEditDialog->show(); 1341 mCategoryEditDialog->show();
1342 mCategoryEditDialog->raise(); 1342 mCategoryEditDialog->raise();
1343} 1343}
1344 1344
1345void AddresseeEditorWidget::emitModified() 1345void AddresseeEditorWidget::emitModified()
1346{ 1346{
1347 mDirty = true; 1347 mDirty = true;
1348 1348
1349 KABC::Addressee::List list; 1349 KABC::Addressee::List list;
1350 1350
1351 if ( mIsExtension && !mBlockSignals ) { 1351 if ( mIsExtension && !mBlockSignals ) {
1352 save(); 1352 save();
1353 list.append( mAddressee ); 1353 list.append( mAddressee );
1354 } 1354 }
1355 1355
1356 emit modified( list ); 1356 emit modified( list );
1357} 1357}
1358 1358
1359void AddresseeEditorWidget::dateChanged( QDate ) 1359void AddresseeEditorWidget::dateChanged( QDate )
1360{ 1360{
1361 emitModified(); 1361 emitModified();
1362} 1362}
1363 1363
1364//US invalid dates are handdled by the KDateEdit widget itself 1364//US invalid dates are handdled by the KDateEdit widget itself
1365void AddresseeEditorWidget::invalidDate() 1365void AddresseeEditorWidget::invalidDate()
1366{ 1366{
1367 KMessageBox::sorry( this, i18n( "You must specify a valid date" ) ); 1367 KMessageBox::sorry( this, i18n( "You must specify a valid date" ) );
1368} 1368}
1369 1369
1370 1370
1371void AddresseeEditorWidget::pageChanged( QWidget *wdg ) 1371void AddresseeEditorWidget::pageChanged( QWidget *wdg )
1372{ 1372{
1373#ifndef KAB_EMBEDDED 1373#ifndef KAB_EMBEDDED
1374 if ( wdg ) 1374 if ( wdg )
1375 KAcceleratorManager::manage( wdg ); 1375 KAcceleratorManager::manage( wdg );
1376#else //KAB_EMBEDDED 1376#else //KAB_EMBEDDED
1377//US 1377//US
1378#endif //KAB_EMBEDDED 1378#endif //KAB_EMBEDDED
1379 1379
1380} 1380}
1381 1381
1382QString AddresseeEditorWidget::title() const 1382QString AddresseeEditorWidget::title() const
1383{ 1383{
1384 return i18n( "Contact Editor" ); 1384 return i18n( "Contact Editor" );
1385} 1385}
1386 1386
1387QString AddresseeEditorWidget::identifier() const 1387QString AddresseeEditorWidget::identifier() const
1388{ 1388{
1389 return i18n( "contact_editor" ); 1389 return i18n( "contact_editor" );
1390} 1390}
1391 1391
1392#ifndef KAB_EMBEDDED 1392#ifndef KAB_EMBEDDED
1393#include "addresseeeditorwidget.moc" 1393#include "addresseeeditorwidget.moc"
1394#endif //KAB_EMBEDDED 1394#endif //KAB_EMBEDDED
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp
index 997fc05..9e7e221 100644
--- a/kaddressbook/phoneeditwidget.cpp
+++ b/kaddressbook/phoneeditwidget.cpp
@@ -1,673 +1,709 @@
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 <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qtooltip.h> 26#include <qtooltip.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28#include <qcheckbox.h> 28#include <qcheckbox.h>
29#include <qstring.h> 29#include <qstring.h>
30#include <qlistbox.h> 30#include <qlistbox.h>
31#include <qlistview.h> 31#include <qlistview.h>
32#include <qbuttongroup.h> 32#include <qbuttongroup.h>
33#include <qhbox.h> 33#include <qhbox.h>
34#include <qcursor.h>
34 35
35#include <kbuttonbox.h> 36#include <kbuttonbox.h>
36#include <klistview.h> 37#include <klistview.h>
37#include <kapplication.h> 38#include <kapplication.h>
38#include <qapplication.h> 39#include <qapplication.h>
39#include <kconfig.h> 40#include <kconfig.h>
40#include <klineedit.h> 41#include <klineedit.h>
41#include <kcombobox.h> 42#include <kcombobox.h>
42#include <klocale.h> 43#include <klocale.h>
43#include <kdebug.h> 44#include <kdebug.h>
44#include <kglobal.h> 45#include <kglobal.h>
45#include <kiconloader.h> 46#include <kiconloader.h>
46 47
47#include <kabc/phonenumber.h> 48#include <kabc/phonenumber.h>
48 49
49#include "typecombo.h" 50#include "typecombo.h"
50 51
51#include "phoneeditwidget.h" 52#include "phoneeditwidget.h"
52 53
53PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) 54PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
54 : QScrollView(parent,name) 55 : QWidget(parent,name)
55{ 56{
56 setFrameStyle ( QFrame::Panel | QFrame::Plain ); 57 QGridLayout* gridLayout = new QGridLayout ( this, 2,2 );
57 setLineWidth ( 1 ); 58
58 setMidLineWidth ( 1 ); 59 QLabel *temp = new QLabel( "", this );
59 mw = new QWidget ( viewport() ); 60 temp->setAlignment( Qt::AlignCenter );
60 addChild(mw); 61 temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
61 setResizePolicy( AutoOneFit ); 62 gridLayout->addWidget( temp, 1, 0 );
63 QPushButton *addBut = new QPushButton ( "add", this );
64 addBut->setPixmap ( SmallIcon("plus"));
65 addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() );
66 connect(addBut,SIGNAL(clicked ()),SLOT(addNumber()));
67 gridLayout->addWidget( addBut, 0, 0 );
68
69 sv = new QScrollView( this );
70 sv->setFrameStyle ( QFrame::Panel | QFrame::Plain );
71 sv->setLineWidth ( 1 );
72 sv->setMidLineWidth ( 1 );
73 mw = new QWidget ( sv->viewport() );
74 sv->addChild(mw);
75 sv->setResizePolicy( QScrollView::AutoOneFit );
62 mainLayout = new QVBoxLayout ( mw ); 76 mainLayout = new QVBoxLayout ( mw );
63 mainLayout->setMargin( 2 ); 77 mainLayout->setMargin( 2 );
64 mainLayout->setSpacing( 2 ); 78 mainLayout->setSpacing( 2 );
65 QWidget* hb = new QWidget ( mw ); 79 gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 );
66 mainLayout->add( hb );
67 QHBoxLayout* hbLayout = new QHBoxLayout ( hb );
68 QPushButton *addBut = new QPushButton ( "add", hb );
69 hbLayout->add( addBut );
70 addBut->setPixmap ( SmallIcon("plus"));
71 addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() );
72 connect(addBut,SIGNAL(clicked()),SLOT(addNumber()));
73 //QLabel * temp = new QLabel( i18n("Phone Type"), hb );
74 QLabel *temp = new QLabel( i18n("Phone Number"),hb );
75 temp->setAlignment( Qt::AlignCenter );
76 temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
77 hbLayout->add( temp );
78 setDefaults(); 80 setDefaults();
79 mTypeNumberEditList.setAutoDelete( true ); 81 mTypeNumberEditList.setAutoDelete( true );
82 mPopup = new QPopupMenu( this );
83 QStringList list = PhoneNumber::supportedTypeListNames();
84 mPopupCount = list.count();
85 int i = 0;
86 while ( i < mPopupCount ) {
87 mPopup->insertItem( list[ i ], i );
88 ++i;
89 }
90 connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int)));
91
80} 92}
81 93
82PhoneEditWidget::~PhoneEditWidget() 94PhoneEditWidget::~PhoneEditWidget()
83{ 95{
84} 96}
85void PhoneEditWidget::setDefaults() 97void PhoneEditWidget::setDefaults()
86{ 98{
87 mTypeNumberEditList.clear(); 99 mTypeNumberEditList.clear();
88 PhoneTypeNumberEdit* edit = appendEditCombo(); 100 PhoneTypeNumberEdit* edit = appendEditCombo();
89 KABC::PhoneNumber phoneNumber; 101 KABC::PhoneNumber phoneNumber;
90 phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref ); 102 phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref );
91 edit->setPhoneNumber( phoneNumber ); 103 edit->setPhoneNumber( phoneNumber );
92 edit = appendEditCombo(); 104 edit = appendEditCombo();
93 phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref ); 105 phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref );
94 edit->setPhoneNumber( phoneNumber ); 106 edit->setPhoneNumber( phoneNumber );
95 edit = appendEditCombo(); 107 edit = appendEditCombo();
96 phoneNumber.setType( KABC::PhoneNumber::Cell ); 108 phoneNumber.setType( KABC::PhoneNumber::Cell );
97 edit->setPhoneNumber( phoneNumber ); 109 edit->setPhoneNumber( phoneNumber );
98 110
99} 111}
112void PhoneEditWidget::addNumberInt( int index )
113{
114 PhoneTypeNumberEdit* edit = appendEditCombo();
115 KABC::PhoneNumber phoneNumber;
116 phoneNumber.setType( PhoneNumber::supportedTypeList()[index] );
117 edit->setPhoneNumber( phoneNumber );
118 //verticalScrollBar()->setValue( 1024);
119 QTimer::singleShot( 0, this, SLOT ( bottomVisible() ) );
120}
121void PhoneEditWidget::bottomVisible()
122{
123 sv->setContentsPos ( 0, 1024 );
124}
100void PhoneEditWidget::addNumber() 125void PhoneEditWidget::addNumber()
101{ 126{
102 127 int i = 0;
128 while ( i < mPopupCount ) {
129 mPopup->setItemEnabled( i, true );
130 ++i;
131 }
132 PhoneTypeNumberEdit* edit = mTypeNumberEditList.first();
133 while ( edit ) {
134 if ( edit->currentType() < mPopupCount -1 )
135 mPopup->setItemEnabled( edit->currentType(), false );
136 edit = mTypeNumberEditList.next();
137 }
138 mPopup->popup( QCursor::pos() );
103} 139}
104PhoneTypeNumberEdit* PhoneEditWidget::appendEditCombo() 140PhoneTypeNumberEdit* PhoneEditWidget::appendEditCombo()
105{ 141{
106 PhoneTypeNumberEdit* edit = new PhoneTypeNumberEdit( mw ); 142 PhoneTypeNumberEdit* edit = new PhoneTypeNumberEdit( mw );
107 connect ( edit, SIGNAL ( typeChange( int , int) ), this, SIGNAL ( typeChange( int , int)) ); 143 connect ( edit, SIGNAL ( typeChange( int , int) ), this, SIGNAL ( typeChange( int , int)) );
108 connect ( edit, SIGNAL ( modified() ), this, SIGNAL ( modified() ) ); 144 connect ( edit, SIGNAL ( modified() ), this, SIGNAL ( modified() ) );
109 connect ( edit, SIGNAL ( deleteMe( PhoneTypeNumberEdit* ) ), this, SLOT ( deleteEdit( PhoneTypeNumberEdit*) ) ); 145 connect ( edit, SIGNAL ( deleteMe( PhoneTypeNumberEdit* ) ), this, SLOT ( deleteEdit( PhoneTypeNumberEdit*) ) );
110 connect ( this, SIGNAL ( typeChange( int , int)), edit, SLOT ( typeExternalChanged( int, int)) ); 146 connect ( this, SIGNAL ( typeChange( int , int)), edit, SLOT ( typeExternalChanged( int, int)) );
111 147
112 mainLayout->add( edit ); 148 mainLayout->add( edit );
113 mTypeNumberEditList.append( edit ); 149 mTypeNumberEditList.append( edit );
114 return edit; 150 return edit;
115} 151}
116 152
117void PhoneEditWidget::deleteEdit( PhoneTypeNumberEdit* ew ) 153void PhoneEditWidget::deleteEdit( PhoneTypeNumberEdit* ew )
118{ 154{
119 mPendingDelete = ew; 155 mPendingDelete = ew;
120 QTimer::singleShot( 0, this, SLOT ( pendingDelete() ) ); 156 QTimer::singleShot( 0, this, SLOT ( pendingDelete() ) );
121} 157}
122void PhoneEditWidget::pendingDelete() 158void PhoneEditWidget::pendingDelete()
123{ 159{
124 mTypeNumberEditList.removeRef( mPendingDelete ); 160 mTypeNumberEditList.removeRef( mPendingDelete );
125 emit modified(); 161 emit modified();
126} 162}
127 163
128void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li ) 164void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li )
129{ 165{
130 if ( li.isEmpty() ) { 166 if ( li.isEmpty() ) {
131 setDefaults(); 167 setDefaults();
132 return; 168 return;
133 } 169 }
134 mTypeNumberEditList.clear(); 170 mTypeNumberEditList.clear();
135 KABC::PhoneNumber::List::Iterator it; 171 KABC::PhoneNumber::List::Iterator it;
136 KABC::PhoneNumber::List list = li; 172 KABC::PhoneNumber::List list = li;
137 PhoneTypeNumberEdit* edit = 0;//mTypeNumberEditList.first(); 173 PhoneTypeNumberEdit* edit = 0;//mTypeNumberEditList.first();
138 for ( it = list.begin(); it != list.end(); ++it ) { 174 for ( it = list.begin(); it != list.end(); ++it ) {
139 if ( edit ) { 175 if ( edit ) {
140 edit->setPhoneNumber( (*it ) ); 176 edit->setPhoneNumber( (*it ) );
141 edit = mTypeNumberEditList.next(); 177 edit = mTypeNumberEditList.next();
142 } else { 178 } else {
143 PhoneTypeNumberEdit* editNew = appendEditCombo(); 179 PhoneTypeNumberEdit* editNew = appendEditCombo();
144 editNew->setPhoneNumber( (*it ) ); 180 editNew->setPhoneNumber( (*it ) );
145 } 181 }
146 } 182 }
147 while ( edit ) { 183 while ( edit ) {
148 edit->hide(); 184 edit->hide();
149 edit = mTypeNumberEditList.next(); 185 edit = mTypeNumberEditList.next();
150 } 186 }
151} 187}
152KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers() 188KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers()
153{ 189{
154 KABC::PhoneNumber::List retList; 190 KABC::PhoneNumber::List retList;
155 191
156 PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); 192 PhoneTypeNumberEdit* edit = mTypeNumberEditList.first();
157 while ( edit ) { 193 while ( edit ) {
158 if ( edit->isValid() ) { 194 if ( edit->isValid() ) {
159 retList.append( edit->phoneNumber()); 195 retList.append( edit->phoneNumber());
160 } 196 }
161 edit = mTypeNumberEditList.next(); 197 edit = mTypeNumberEditList.next();
162 198
163 } 199 }
164 return retList; 200 return retList;
165} 201}
166 202
167#if 0 203#if 0
168PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) 204PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
169 : QWidget( parent, name ) 205 : QWidget( parent, name )
170{ 206{
171 QGridLayout *layout = new QGridLayout( this, 4, 1 ); 207 QGridLayout *layout = new QGridLayout( this, 4, 1 );
172//US layout->setSpacing( KDialog::spacingHint() ); 208//US layout->setSpacing( KDialog::spacingHint() );
173 layout->setSpacing( KDialogBase::spacingHintSmall() ); 209 layout->setSpacing( KDialogBase::spacingHintSmall() );
174 210
175 211
176 212
177 QLabel* label = new QLabel( this ); 213 QLabel* label = new QLabel( this );
178//US loadIcon call is ambiguous. Add one more parameter 214//US loadIcon call is ambiguous. Add one more parameter
179//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); 215//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
180 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 216 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
181 label->setAlignment( AlignCenter ); 217 label->setAlignment( AlignCenter );
182//US layout->addMultiCellWidget( label, 0, 1, 3, 3 ); 218//US layout->addMultiCellWidget( label, 0, 1, 3, 3 );
183 layout->addWidget( label, 0, 0 ); 219 layout->addWidget( label, 0, 0 );
184 220
185 QPushButton *editButton = new QPushButton( i18n( "Edit Phone Numbers..." ), 221 QPushButton *editButton = new QPushButton( i18n( "Edit Phone Numbers..." ),
186 this ); 222 this );
187 if ( QApplication::desktop()->width() < 640 ) 223 if ( QApplication::desktop()->width() < 640 )
188 layout->addWidget( editButton, 0, 1 ); 224 layout->addWidget( editButton, 0, 1 );
189 else 225 else
190 layout->addMultiCellWidget( editButton, 0, 0, 1, 3); 226 layout->addMultiCellWidget( editButton, 0, 0, 1, 3);
191 227
192 mPrefCombo = new PhoneTypeCombo( mPhoneList, this ); 228 mPrefCombo = new PhoneTypeCombo( mPhoneList, this );
193 mPrefEdit = new KLineEdit( this ); 229 mPrefEdit = new KLineEdit( this );
194 //mPrefEdit->setMinimumWidth( int(mPrefEdit->sizeHint().width() * 1.5) ); 230 //mPrefEdit->setMinimumWidth( int(mPrefEdit->sizeHint().width() * 1.5) );
195 mPrefCombo->setLineEdit( mPrefEdit ); 231 mPrefCombo->setLineEdit( mPrefEdit );
196 layout->addWidget( mPrefCombo, 1, 0 ); 232 layout->addWidget( mPrefCombo, 1, 0 );
197 layout->addWidget( mPrefEdit, 1, 1 ); 233 layout->addWidget( mPrefEdit, 1, 1 );
198 int x = 1, y = 2; 234 int x = 1, y = 2;
199 if ( QApplication::desktop()->width() < 640 ) { 235 if ( QApplication::desktop()->width() < 640 ) {
200 ++x; 236 ++x;
201 y = 0; 237 y = 0;
202 } 238 }
203 mSecondCombo = new PhoneTypeCombo( mPhoneList, this ); 239 mSecondCombo = new PhoneTypeCombo( mPhoneList, this );
204 mSecondEdit = new KLineEdit( this ); 240 mSecondEdit = new KLineEdit( this );
205 mSecondCombo->setLineEdit( mSecondEdit ); 241 mSecondCombo->setLineEdit( mSecondEdit );
206 layout->addWidget( mSecondCombo, x, y++ ); 242 layout->addWidget( mSecondCombo, x, y++ );
207 layout->addWidget( mSecondEdit, x, y++ ); 243 layout->addWidget( mSecondEdit, x, y++ );
208 244
209 y = 0; 245 y = 0;
210 ++x; 246 ++x;
211 mThirdCombo = new PhoneTypeCombo( mPhoneList, this ); 247 mThirdCombo = new PhoneTypeCombo( mPhoneList, this );
212 mThirdEdit = new KLineEdit( this ); 248 mThirdEdit = new KLineEdit( this );
213 mThirdCombo->setLineEdit( mThirdEdit ); 249 mThirdCombo->setLineEdit( mThirdEdit );
214 layout->addWidget( mThirdCombo, x, y++ ); 250 layout->addWidget( mThirdCombo, x, y++ );
215 layout->addWidget( mThirdEdit, x, y++ ); 251 layout->addWidget( mThirdEdit, x, y++ );
216 if ( QApplication::desktop()->width() < 640 ) { 252 if ( QApplication::desktop()->width() < 640 ) {
217 ++x; 253 ++x;
218 y = 0; 254 y = 0;
219 } 255 }
220 mFourthCombo = new PhoneTypeCombo( mPhoneList, this ); 256 mFourthCombo = new PhoneTypeCombo( mPhoneList, this );
221 mFourthEdit = new KLineEdit( this ); 257 mFourthEdit = new KLineEdit( this );
222 mFourthCombo->setLineEdit( mFourthEdit ); 258 mFourthCombo->setLineEdit( mFourthEdit );
223 layout->addWidget( mFourthCombo, x, y++ ); 259 layout->addWidget( mFourthCombo, x, y++ );
224 layout->addWidget( mFourthEdit, x, y++ ); 260 layout->addWidget( mFourthEdit, x, y++ );
225 261
226 // Four numbers don't fit in the current dialog 262 // Four numbers don't fit in the current dialog
227 if ( QApplication::desktop()->width() < 640 ) { 263 if ( QApplication::desktop()->width() < 640 ) {
228 mFourthCombo->hide(); 264 mFourthCombo->hide();
229 mFourthEdit->hide(); 265 mFourthEdit->hide();
230 } else { 266 } else {
231 QFontMetrics fm ( font () ) ; 267 QFontMetrics fm ( font () ) ;
232 int wid = fm.width( "Messenger" ) +60; 268 int wid = fm.width( "Messenger" ) +60;
233 mPrefCombo->setMaximumWidth( wid ); 269 mPrefCombo->setMaximumWidth( wid );
234 mSecondCombo->setMaximumWidth( wid ); 270 mSecondCombo->setMaximumWidth( wid );
235 mThirdCombo->setMaximumWidth( wid ); 271 mThirdCombo->setMaximumWidth( wid );
236 mFourthCombo->setMaximumWidth( wid ); 272 mFourthCombo->setMaximumWidth( wid );
237 } 273 }
238 274
239 275
240 connect( mPrefEdit, SIGNAL( textChanged( const QString& ) ), 276 connect( mPrefEdit, SIGNAL( textChanged( const QString& ) ),
241 SLOT( slotPrefEditChanged() ) ); 277 SLOT( slotPrefEditChanged() ) );
242 connect( mSecondEdit, SIGNAL( textChanged( const QString& ) ), 278 connect( mSecondEdit, SIGNAL( textChanged( const QString& ) ),
243 SLOT( slotSecondEditChanged() ) ); 279 SLOT( slotSecondEditChanged() ) );
244 connect( mThirdEdit, SIGNAL( textChanged( const QString& ) ), 280 connect( mThirdEdit, SIGNAL( textChanged( const QString& ) ),
245 SLOT( slotThirdEditChanged() ) ); 281 SLOT( slotThirdEditChanged() ) );
246 connect( mFourthEdit, SIGNAL( textChanged( const QString& ) ), 282 connect( mFourthEdit, SIGNAL( textChanged( const QString& ) ),
247 SLOT( slotFourthEditChanged() ) ); 283 SLOT( slotFourthEditChanged() ) );
248 284
249 connect( editButton, SIGNAL( clicked() ), SLOT( edit() ) ); 285 connect( editButton, SIGNAL( clicked() ), SLOT( edit() ) );
250 286
251 connect( mPrefCombo, SIGNAL( activated( int ) ), 287 connect( mPrefCombo, SIGNAL( activated( int ) ),
252 SLOT( updatePrefEdit() ) ); 288 SLOT( updatePrefEdit() ) );
253 connect( mSecondCombo, SIGNAL( activated( int ) ), 289 connect( mSecondCombo, SIGNAL( activated( int ) ),
254 SLOT( updateSecondEdit() ) ); 290 SLOT( updateSecondEdit() ) );
255 connect( mThirdCombo, SIGNAL( activated( int ) ), 291 connect( mThirdCombo, SIGNAL( activated( int ) ),
256 SLOT( updateThirdEdit() ) ); 292 SLOT( updateThirdEdit() ) );
257 connect( mFourthCombo, SIGNAL( activated( int ) ), 293 connect( mFourthCombo, SIGNAL( activated( int ) ),
258 SLOT( updateFourthEdit() ) ); 294 SLOT( updateFourthEdit() ) );
259} 295}
260 296
261PhoneEditWidget::~PhoneEditWidget() 297PhoneEditWidget::~PhoneEditWidget()
262{ 298{
263} 299}
264 300
265void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &list ) 301void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &list )
266{ 302{
267 mPhoneList.clear(); 303 mPhoneList.clear();
268 304
269 // Insert types for existing numbers. 305 // Insert types for existing numbers.
270 mPrefCombo->insertTypeList( list ); 306 mPrefCombo->insertTypeList( list );
271 307
272 QValueList<int> defaultTypes; 308 QValueList<int> defaultTypes;
273 defaultTypes << KABC::PhoneNumber::Home; 309 defaultTypes << KABC::PhoneNumber::Home;
274 defaultTypes << KABC::PhoneNumber::Work; 310 defaultTypes << KABC::PhoneNumber::Work;
275 defaultTypes << KABC::PhoneNumber::Cell; 311 defaultTypes << KABC::PhoneNumber::Cell;
276 defaultTypes << ( KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ); 312 defaultTypes << ( KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax );
277 defaultTypes << ( KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax ); 313 defaultTypes << ( KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax );
278 314
279 // Insert default types. 315 // Insert default types.
280 // Doing this for mPrefCombo is enough because the list is shared by all 316 // Doing this for mPrefCombo is enough because the list is shared by all
281 // combos. 317 // combos.
282 QValueList<int>::ConstIterator it; 318 QValueList<int>::ConstIterator it;
283 for( it = defaultTypes.begin(); it != defaultTypes.end(); ++it ) { 319 for( it = defaultTypes.begin(); it != defaultTypes.end(); ++it ) {
284 if ( !mPrefCombo->hasType( *it ) ) 320 if ( !mPrefCombo->hasType( *it ) )
285 mPrefCombo->insertType( list, *it, PhoneNumber( "", *it ) ); 321 mPrefCombo->insertType( list, *it, PhoneNumber( "", *it ) );
286 } 322 }
287 323
288 updateCombos(); 324 updateCombos();
289 325
290 mPrefCombo->selectType( defaultTypes[ 0 ] ); 326 mPrefCombo->selectType( defaultTypes[ 0 ] );
291 mSecondCombo->selectType( defaultTypes[ 1 ] ); 327 mSecondCombo->selectType( defaultTypes[ 1 ] );
292 mThirdCombo->selectType( defaultTypes[ 2 ] ); 328 mThirdCombo->selectType( defaultTypes[ 2 ] );
293 mFourthCombo->selectType( defaultTypes[ 3 ] ); 329 mFourthCombo->selectType( defaultTypes[ 3 ] );
294 330
295 updateLineEdits(); 331 updateLineEdits();
296} 332}
297 333
298void PhoneEditWidget::updateLineEdits() 334void PhoneEditWidget::updateLineEdits()
299{ 335{
300 updatePrefEdit(); 336 updatePrefEdit();
301 updateSecondEdit(); 337 updateSecondEdit();
302 updateThirdEdit(); 338 updateThirdEdit();
303 updateFourthEdit(); 339 updateFourthEdit();
304} 340}
305 341
306void PhoneEditWidget::updateCombos() 342void PhoneEditWidget::updateCombos()
307{ 343{
308 mPrefCombo->updateTypes(); 344 mPrefCombo->updateTypes();
309 mSecondCombo->updateTypes(); 345 mSecondCombo->updateTypes();
310 mThirdCombo->updateTypes(); 346 mThirdCombo->updateTypes();
311 mFourthCombo->updateTypes(); 347 mFourthCombo->updateTypes();
312} 348}
313 349
314KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers() 350KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers()
315{ 351{
316 KABC::PhoneNumber::List retList; 352 KABC::PhoneNumber::List retList;
317 353
318 KABC::PhoneNumber::List::Iterator it; 354 KABC::PhoneNumber::List::Iterator it;
319 for ( it = mPhoneList.begin(); it != mPhoneList.end(); ++it ) 355 for ( it = mPhoneList.begin(); it != mPhoneList.end(); ++it )
320 if ( !(*it).number().isEmpty() ) 356 if ( !(*it).number().isEmpty() )
321 retList.append( *it ); 357 retList.append( *it );
322 358
323 return retList; 359 return retList;
324} 360}
325 361
326void PhoneEditWidget::edit() 362void PhoneEditWidget::edit()
327{ 363{
328 PhoneEditDialog dlg( mPhoneList, this ); 364 PhoneEditDialog dlg( mPhoneList, this );
329 365
330 if ( dlg.exec() ) { 366 if ( dlg.exec() ) {
331 if ( dlg.changed() ) { 367 if ( dlg.changed() ) {
332 KABC::PhoneNumber::List list = dlg.phoneNumbers(); 368 KABC::PhoneNumber::List list = dlg.phoneNumbers();
333 setPhoneNumbers( list ); 369 setPhoneNumbers( list );
334 updateCombos(); 370 updateCombos();
335 updateLineEdits(); 371 updateLineEdits();
336 emit modified(); 372 emit modified();
337 } 373 }
338 } 374 }
339} 375}
340 376
341void PhoneEditWidget::updatePrefEdit() 377void PhoneEditWidget::updatePrefEdit()
342{ 378{
343 updateEdit( mPrefCombo ); 379 updateEdit( mPrefCombo );
344} 380}
345 381
346void PhoneEditWidget::updateSecondEdit() 382void PhoneEditWidget::updateSecondEdit()
347{ 383{
348 updateEdit( mSecondCombo ); 384 updateEdit( mSecondCombo );
349} 385}
350 386
351void PhoneEditWidget::updateThirdEdit() 387void PhoneEditWidget::updateThirdEdit()
352{ 388{
353 updateEdit( mThirdCombo ); 389 updateEdit( mThirdCombo );
354} 390}
355 391
356void PhoneEditWidget::updateFourthEdit() 392void PhoneEditWidget::updateFourthEdit()
357{ 393{
358 updateEdit( mFourthCombo ); 394 updateEdit( mFourthCombo );
359} 395}
360 396
361void PhoneEditWidget::updateEdit( PhoneTypeCombo *combo ) 397void PhoneEditWidget::updateEdit( PhoneTypeCombo *combo )
362{ 398{
363 QLineEdit *edit = combo->lineEdit(); 399 QLineEdit *edit = combo->lineEdit();
364 if ( !edit ) 400 if ( !edit )
365 return; 401 return;
366 402
367#if 0 403#if 0
368 if ( edit == mPrefEdit ) kdDebug(5720) << " prefEdit" << endl; 404 if ( edit == mPrefEdit ) kdDebug(5720) << " prefEdit" << endl;
369 if ( edit == mSecondEdit ) kdDebug(5720) << " secondEdit" << endl; 405 if ( edit == mSecondEdit ) kdDebug(5720) << " secondEdit" << endl;
370 if ( edit == mThirdEdit ) kdDebug(5720) << " thirdEdit" << endl; 406 if ( edit == mThirdEdit ) kdDebug(5720) << " thirdEdit" << endl;
371 if ( edit == mFourthEdit ) kdDebug(5720) << " fourthEdit" << endl; 407 if ( edit == mFourthEdit ) kdDebug(5720) << " fourthEdit" << endl;
372#endif 408#endif
373 409
374 PhoneNumber::List::Iterator it = combo->selectedElement(); 410 PhoneNumber::List::Iterator it = combo->selectedElement();
375 if ( it != mPhoneList.end() ) { 411 if ( it != mPhoneList.end() ) {
376 edit->setText( (*it).number() ); 412 edit->setText( (*it).number() );
377 } else { 413 } else {
378 kdDebug(5720) << "PhoneEditWidget::updateEdit(): no selected element" << endl; 414 kdDebug(5720) << "PhoneEditWidget::updateEdit(): no selected element" << endl;
379 } 415 }
380} 416}
381 417
382void PhoneEditWidget::slotPrefEditChanged() 418void PhoneEditWidget::slotPrefEditChanged()
383{ 419{
384 updatePhoneNumber( mPrefCombo ); 420 updatePhoneNumber( mPrefCombo );
385} 421}
386 422
387void PhoneEditWidget::slotSecondEditChanged() 423void PhoneEditWidget::slotSecondEditChanged()
388{ 424{
389 updatePhoneNumber( mSecondCombo ); 425 updatePhoneNumber( mSecondCombo );
390} 426}
391 427
392void PhoneEditWidget::slotThirdEditChanged() 428void PhoneEditWidget::slotThirdEditChanged()
393{ 429{
394 updatePhoneNumber( mThirdCombo ); 430 updatePhoneNumber( mThirdCombo );
395} 431}
396 432
397void PhoneEditWidget::slotFourthEditChanged() 433void PhoneEditWidget::slotFourthEditChanged()
398{ 434{
399 updatePhoneNumber( mFourthCombo ); 435 updatePhoneNumber( mFourthCombo );
400} 436}
401 437
402void PhoneEditWidget::updatePhoneNumber( PhoneTypeCombo *combo ) 438void PhoneEditWidget::updatePhoneNumber( PhoneTypeCombo *combo )
403{ 439{
404 QLineEdit *edit = combo->lineEdit(); 440 QLineEdit *edit = combo->lineEdit();
405 if ( !edit ) return; 441 if ( !edit ) return;
406 442
407 PhoneNumber::List::Iterator it = combo->selectedElement(); 443 PhoneNumber::List::Iterator it = combo->selectedElement();
408 if ( it != mPhoneList.end() ) { 444 if ( it != mPhoneList.end() ) {
409 (*it).setNumber( edit->text() ); 445 (*it).setNumber( edit->text() );
410 } 446 }
411 447
412 updateOtherEdit( combo, mPrefCombo ); 448 updateOtherEdit( combo, mPrefCombo );
413 updateOtherEdit( combo, mSecondCombo ); 449 updateOtherEdit( combo, mSecondCombo );
414 updateOtherEdit( combo, mThirdCombo ); 450 updateOtherEdit( combo, mThirdCombo );
415 updateOtherEdit( combo, mFourthCombo ); 451 updateOtherEdit( combo, mFourthCombo );
416 452
417 emit modified(); 453 emit modified();
418} 454}
419 455
420void PhoneEditWidget::updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo ) 456void PhoneEditWidget::updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo )
421{ 457{
422 if ( combo == otherCombo ) return; 458 if ( combo == otherCombo ) return;
423 459
424 if ( combo->currentItem() == otherCombo->currentItem() ) { 460 if ( combo->currentItem() == otherCombo->currentItem() ) {
425 updateEdit( otherCombo ); 461 updateEdit( otherCombo );
426 } 462 }
427} 463}
428 464
429/////////////////////////////////////////// 465///////////////////////////////////////////
430// PhoneEditDialog 466// PhoneEditDialog
431 467
432class PhoneViewItem : public QListViewItem 468class PhoneViewItem : public QListViewItem
433{ 469{
434public: 470public:
435 PhoneViewItem( QListView *parent, const KABC::PhoneNumber &number ); 471 PhoneViewItem( QListView *parent, const KABC::PhoneNumber &number );
436 472
437 void setPhoneNumber( const KABC::PhoneNumber &number ) 473 void setPhoneNumber( const KABC::PhoneNumber &number )
438 { 474 {
439 mPhoneNumber = number; 475 mPhoneNumber = number;
440 makeText(); 476 makeText();
441 } 477 }
442 478
443 QString key() { return mPhoneNumber.id(); } 479 QString key() { return mPhoneNumber.id(); }
444 QString country() { return ""; } 480 QString country() { return ""; }
445 QString region() { return ""; } 481 QString region() { return ""; }
446 QString number() { return ""; } 482 QString number() { return ""; }
447 483
448 KABC::PhoneNumber phoneNumber() { return mPhoneNumber; } 484 KABC::PhoneNumber phoneNumber() { return mPhoneNumber; }
449 485
450private: 486private:
451 void makeText(); 487 void makeText();
452 488
453 KABC::PhoneNumber mPhoneNumber; 489 KABC::PhoneNumber mPhoneNumber;
454}; 490};
455 491
456PhoneViewItem::PhoneViewItem( QListView *parent, const KABC::PhoneNumber &number ) 492PhoneViewItem::PhoneViewItem( QListView *parent, const KABC::PhoneNumber &number )
457 : QListViewItem( parent ), mPhoneNumber( number ) 493 : QListViewItem( parent ), mPhoneNumber( number )
458{ 494{
459#ifdef DESKTOP_VERSION 495#ifdef DESKTOP_VERSION
460 setRenameEnabled ( 0, true ); 496 setRenameEnabled ( 0, true );
461#endif 497#endif
462 makeText(); 498 makeText();
463} 499}
464 500
465void PhoneViewItem::makeText() 501void PhoneViewItem::makeText()
466{ 502{
467 /** 503 /**
468 * Will be used in future versions of kaddressbook/libkabc 504 * Will be used in future versions of kaddressbook/libkabc
469 505
470 setText( 0, mPhoneNumber.country() ); 506 setText( 0, mPhoneNumber.country() );
471 setText( 1, mPhoneNumber.region() ); 507 setText( 1, mPhoneNumber.region() );
472 setText( 2, mPhoneNumber.number() ); 508 setText( 2, mPhoneNumber.number() );
473 setText( 3, mPhoneNumber.typeLabel() ); 509 setText( 3, mPhoneNumber.typeLabel() );
474 */ 510 */
475 511
476 setText( 0, mPhoneNumber.number() ); 512 setText( 0, mPhoneNumber.number() );
477 setText( 1, mPhoneNumber.typeLabel() ); 513 setText( 1, mPhoneNumber.typeLabel() );
478} 514}
479 515
480PhoneEditDialog::PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name ) 516PhoneEditDialog::PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name )
481 : KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Numbers" ), 517 : KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Numbers" ),
482 KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, 518 KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok,
483 parent, name, true) 519 parent, name, true)
484{ 520{
485 mPhoneNumberList = list; 521 mPhoneNumberList = list;
486 522
487 QWidget *page = plainPage(); 523 QWidget *page = plainPage();
488 524
489 QGridLayout *layout = new QGridLayout( page, 1, 2 ); 525 QGridLayout *layout = new QGridLayout( page, 1, 2 );
490 layout->setSpacing( spacingHint() ); 526 layout->setSpacing( spacingHint() );
491 527
492 mListView = new KListView( page ); 528 mListView = new KListView( page );
493 mListView->setAllColumnsShowFocus( true ); 529 mListView->setAllColumnsShowFocus( true );
494 mListView->addColumn( i18n( "Number" ) ); 530 mListView->addColumn( i18n( "Number" ) );
495 mListView->addColumn( i18n( "Type" ) ); 531 mListView->addColumn( i18n( "Type" ) );
496 532
497 KButtonBox *buttonBox = new KButtonBox( page, Vertical ); 533 KButtonBox *buttonBox = new KButtonBox( page, Vertical );
498 534
499 buttonBox->addButton( i18n( "&Add..." ), this, SLOT( slotAddPhoneNumber() ) ); 535 buttonBox->addButton( i18n( "&Add..." ), this, SLOT( slotAddPhoneNumber() ) );
500 mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT( slotEditPhoneNumber() ) ); 536 mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT( slotEditPhoneNumber() ) );
501 mEditButton->setEnabled( false ); 537 mEditButton->setEnabled( false );
502 mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT( slotRemovePhoneNumber() ) ); 538 mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT( slotRemovePhoneNumber() ) );
503 mRemoveButton->setEnabled( false ); 539 mRemoveButton->setEnabled( false );
504 buttonBox->layout(); 540 buttonBox->layout();
505 541
506 layout->addWidget( mListView, 0, 0 ); 542 layout->addWidget( mListView, 0, 0 );
507 layout->addWidget( buttonBox, 0, 1 ); 543 layout->addWidget( buttonBox, 0, 1 );
508 544
509 connect( mListView, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()) ); 545 connect( mListView, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()) );
510 connect( mListView, SIGNAL(doubleClicked( QListViewItem *, const QPoint &, int )), this, SLOT( slotEditPhoneNumber())); 546 connect( mListView, SIGNAL(doubleClicked( QListViewItem *, const QPoint &, int )), this, SLOT( slotEditPhoneNumber()));
511 547
512 KABC::PhoneNumber::List::Iterator it; 548 KABC::PhoneNumber::List::Iterator it;
513 for ( it = mPhoneNumberList.begin(); it != mPhoneNumberList.end(); ++it ) 549 for ( it = mPhoneNumberList.begin(); it != mPhoneNumberList.end(); ++it )
514 new PhoneViewItem( mListView, *it ); 550 new PhoneViewItem( mListView, *it );
515 if (QApplication::desktop()->width() < 480 ) 551 if (QApplication::desktop()->width() < 480 )
516 showMaximized(); 552 showMaximized();
517 else 553 else
518 resize( 400, 400 ); 554 resize( 400, 400 );
519 mChanged = false; 555 mChanged = false;
520} 556}
521 557
522PhoneEditDialog::~PhoneEditDialog() 558PhoneEditDialog::~PhoneEditDialog()
523{ 559{
524 qDebug("PhoneEditDialog::~PhoneEditDialog() "); 560 qDebug("PhoneEditDialog::~PhoneEditDialog() ");
525} 561}
526 562
527void PhoneEditDialog::slotAddPhoneNumber() 563void PhoneEditDialog::slotAddPhoneNumber()
528{ 564{
529 KABC::PhoneNumber tmp( "", 0 ); 565 KABC::PhoneNumber tmp( "", 0 );
530 PhoneTypeDialog dlg( tmp, this ); 566 PhoneTypeDialog dlg( tmp, this );
531 567
532 if ( dlg.exec() ) { 568 if ( dlg.exec() ) {
533 QListViewItem* i = mListView->firstChild(); 569 QListViewItem* i = mListView->firstChild();
534 KABC::PhoneNumber phoneNumber = dlg.phoneNumber(); 570 KABC::PhoneNumber phoneNumber = dlg.phoneNumber();
535 bool insert = true; 571 bool insert = true;
536 while ( i ) { 572 while ( i ) {
537 PhoneViewItem* p = ( PhoneViewItem* ) i; 573 PhoneViewItem* p = ( PhoneViewItem* ) i;
538 KABC::PhoneNumber pn = p->phoneNumber(); 574 KABC::PhoneNumber pn = p->phoneNumber();
539 if ( (pn.type() | KABC::PhoneNumber::Pref) == (phoneNumber.type() | KABC::PhoneNumber::Pref) ) { 575 if ( (pn.type() | KABC::PhoneNumber::Pref) == (phoneNumber.type() | KABC::PhoneNumber::Pref) ) {
540 if ( p->text(0).isEmpty()) { 576 if ( p->text(0).isEmpty()) {
541 p->setPhoneNumber( phoneNumber ); 577 p->setPhoneNumber( phoneNumber );
542 mPhoneNumberList.remove( pn ); 578 mPhoneNumberList.remove( pn );
543 mPhoneNumberList.append( phoneNumber ); 579 mPhoneNumberList.append( phoneNumber );
544 insert = false; 580 insert = false;
545 break; 581 break;
546 } 582 }
547 } 583 }
548 i = i->nextSibling(); 584 i = i->nextSibling();
549 } 585 }
550 if ( insert ) { 586 if ( insert ) {
551 mPhoneNumberList.append( phoneNumber ); 587 mPhoneNumberList.append( phoneNumber );
552 new PhoneViewItem( mListView, phoneNumber ); 588 new PhoneViewItem( mListView, phoneNumber );
553 } 589 }
554 mChanged = true; 590 mChanged = true;
555 } 591 }
556} 592}
557 593
558void PhoneEditDialog::slotRemovePhoneNumber() 594void PhoneEditDialog::slotRemovePhoneNumber()
559{ 595{
560 PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() ); 596 PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() );
561 if ( !item ) 597 if ( !item )
562 return; 598 return;
563 599
564 mPhoneNumberList.remove( item->phoneNumber() ); 600 mPhoneNumberList.remove( item->phoneNumber() );
565 QListViewItem *currItem = mListView->currentItem(); 601 QListViewItem *currItem = mListView->currentItem();
566 mListView->takeItem( currItem ); 602 mListView->takeItem( currItem );
567 delete currItem; 603 delete currItem;
568 604
569 mChanged = true; 605 mChanged = true;
570} 606}
571 607
572void PhoneEditDialog::slotEditPhoneNumber() 608void PhoneEditDialog::slotEditPhoneNumber()
573{ 609{
574 PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() ); 610 PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() );
575 if ( !item ) 611 if ( !item )
576 return; 612 return;
577 613
578 PhoneTypeDialog dlg( item->phoneNumber(), this ); 614 PhoneTypeDialog dlg( item->phoneNumber(), this );
579 615
580 if ( dlg.exec() ) { 616 if ( dlg.exec() ) {
581 slotRemovePhoneNumber(); 617 slotRemovePhoneNumber();
582 KABC::PhoneNumber phoneNumber = dlg.phoneNumber(); 618 KABC::PhoneNumber phoneNumber = dlg.phoneNumber();
583 mPhoneNumberList.append( phoneNumber ); 619 mPhoneNumberList.append( phoneNumber );
584 new PhoneViewItem( mListView, phoneNumber ); 620 new PhoneViewItem( mListView, phoneNumber );
585 621
586 mChanged = true; 622 mChanged = true;
587 } 623 }
588} 624}
589 625
590void PhoneEditDialog::slotSelectionChanged() 626void PhoneEditDialog::slotSelectionChanged()
591{ 627{
592 bool state = ( mListView->currentItem() != 0 ); 628 bool state = ( mListView->currentItem() != 0 );
593 629
594 mRemoveButton->setEnabled( state ); 630 mRemoveButton->setEnabled( state );
595 mEditButton->setEnabled( state ); 631 mEditButton->setEnabled( state );
596} 632}
597 633
598const KABC::PhoneNumber::List &PhoneEditDialog::phoneNumbers() 634const KABC::PhoneNumber::List &PhoneEditDialog::phoneNumbers()
599{ 635{
600 return mPhoneNumberList; 636 return mPhoneNumberList;
601} 637}
602 638
603bool PhoneEditDialog::changed() const 639bool PhoneEditDialog::changed() const
604{ 640{
605 return mChanged; 641 return mChanged;
606} 642}
607 643
608/////////////////////////////////////////// 644///////////////////////////////////////////
609// PhoneTypeDialog 645// PhoneTypeDialog
610PhoneTypeDialog::PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, 646PhoneTypeDialog::PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber,
611 QWidget *parent, const char *name) 647 QWidget *parent, const char *name)
612 : KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Number" ), 648 : KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Number" ),
613 KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, 649 KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok,
614 parent, name, true), mPhoneNumber( phoneNumber ) 650 parent, name, true), mPhoneNumber( phoneNumber )
615{ 651{
616 QWidget *page = plainPage(); 652 QWidget *page = plainPage();
617 QLabel *label = 0; 653 QLabel *label = 0;
618 QGridLayout *layout = new QGridLayout( page, 3, 2, marginHint(), spacingHint() ); 654 QGridLayout *layout = new QGridLayout( page, 3, 2, marginHint(), spacingHint() );
619 655
620 label = new QLabel( i18n( "Number:" ), page ); 656 label = new QLabel( i18n( "Number:" ), page );
621 layout->addWidget( label, 0, 0 ); 657 layout->addWidget( label, 0, 0 );
622 mNumber = new KLineEdit( page ); 658 mNumber = new KLineEdit( page );
623 layout->addWidget( mNumber, 0, 1 ); 659 layout->addWidget( mNumber, 0, 1 );
624 660
625 mPreferredBox = new QCheckBox( i18n( "This is the preferred phone number" ), page ); 661 mPreferredBox = new QCheckBox( i18n( "This is the preferred phone number" ), page );
626 layout->addMultiCellWidget( mPreferredBox, 1, 1, 0, 1 ); 662 layout->addMultiCellWidget( mPreferredBox, 1, 1, 0, 1 );
627 663
628 mGroup = new QButtonGroup( 2, Horizontal, i18n( "Types" ), page ); 664 mGroup = new QButtonGroup( 2, Horizontal, i18n( "Types" ), page );
629 layout->addMultiCellWidget( mGroup, 2, 2, 0, 1 ); 665 layout->addMultiCellWidget( mGroup, 2, 2, 0, 1 );
630 666
631 // fill widgets 667 // fill widgets
632 mNumber->setText( mPhoneNumber.number() ); 668 mNumber->setText( mPhoneNumber.number() );
633 669
634 mTypeList = KABC::PhoneNumber::typeList(); 670 mTypeList = KABC::PhoneNumber::typeList();
635 mTypeList.remove( KABC::PhoneNumber::Pref ); 671 mTypeList.remove( KABC::PhoneNumber::Pref );
636 672
637 KABC::PhoneNumber::TypeList::Iterator it; 673 KABC::PhoneNumber::TypeList::Iterator it;
638 for ( it = mTypeList.begin(); it != mTypeList.end(); ++it ) 674 for ( it = mTypeList.begin(); it != mTypeList.end(); ++it )
639 new QCheckBox( KABC::PhoneNumber::typeLabel( *it ), mGroup ); 675 new QCheckBox( KABC::PhoneNumber::typeLabel( *it ), mGroup );
640 676
641 for ( int i = 0; i < mGroup->count(); ++i ) { 677 for ( int i = 0; i < mGroup->count(); ++i ) {
642 int type = mPhoneNumber.type(); 678 int type = mPhoneNumber.type();
643 QCheckBox *box = (QCheckBox*)mGroup->find( i ); 679 QCheckBox *box = (QCheckBox*)mGroup->find( i );
644 box->setChecked( type & mTypeList[ i ] ); 680 box->setChecked( type & mTypeList[ i ] );
645 } 681 }
646 682
647 mPreferredBox->setChecked( mPhoneNumber.type() & KABC::PhoneNumber::Pref ); 683 mPreferredBox->setChecked( mPhoneNumber.type() & KABC::PhoneNumber::Pref );
648 mNumber->setFocus(); 684 mNumber->setFocus();
649 mNumber->setSelection( 0, 1024); 685 mNumber->setSelection( 0, 1024);
650} 686}
651 687
652KABC::PhoneNumber PhoneTypeDialog::phoneNumber() 688KABC::PhoneNumber PhoneTypeDialog::phoneNumber()
653{ 689{
654 mPhoneNumber.setNumber( mNumber->text() ); 690 mPhoneNumber.setNumber( mNumber->text() );
655 691
656 int type = 0; 692 int type = 0;
657 for ( int i = 0; i < mGroup->count(); ++i ) { 693 for ( int i = 0; i < mGroup->count(); ++i ) {
658 QCheckBox *box = (QCheckBox*)mGroup->find( i ); 694 QCheckBox *box = (QCheckBox*)mGroup->find( i );
659 if ( box->isChecked() ) 695 if ( box->isChecked() )
660 type += mTypeList[ i ]; 696 type += mTypeList[ i ];
661 } 697 }
662 698
663 if ( mPreferredBox->isChecked() ) 699 if ( mPreferredBox->isChecked() )
664 mPhoneNumber.setType( type | KABC::PhoneNumber::Pref ); 700 mPhoneNumber.setType( type | KABC::PhoneNumber::Pref );
665 else 701 else
666 mPhoneNumber.setType( type & ~KABC::PhoneNumber::Pref ); 702 mPhoneNumber.setType( type & ~KABC::PhoneNumber::Pref );
667 703
668 return mPhoneNumber; 704 return mPhoneNumber;
669} 705}
670#endif 706#endif
671#ifndef KAB_EMBEDDED 707#ifndef KAB_EMBEDDED
672#include "phoneeditwidget.moc" 708#include "phoneeditwidget.moc"
673#endif //KAB_EMBEDDED 709#endif //KAB_EMBEDDED
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h
index c730c7b..df5aff9 100644
--- a/kaddressbook/phoneeditwidget.h
+++ b/kaddressbook/phoneeditwidget.h
@@ -1,287 +1,294 @@
1#ifndef PHONEEDITWIDGET_H 1#ifndef PHONEEDITWIDGET_H
2#define PHONEEDITWIDGET_H 2#define PHONEEDITWIDGET_H
3/* 3/*
4 This file is part of KAddressBook. 4 This file is part of KAddressBook.
5 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 5 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <kdialogbase.h> 26#include <kdialogbase.h>
27#include <kiconloader.h> 27#include <kiconloader.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qpopupmenu.h>
30 31
31#include <qptrlist.h> 32#include <qptrlist.h>
32#include <qscrollview.h> 33#include <qscrollview.h>
33 34
34#include "addresseeconfig.h" 35#include "addresseeconfig.h"
35#include "typecombo.h" 36#include "typecombo.h"
36 37
37class QButtonGroup; 38class QButtonGroup;
38class QCheckBox; 39class QCheckBox;
39class PhoneTypeNumberEdit; 40class PhoneTypeNumberEdit;
40 41
41#include <klineedit.h> 42#include <klineedit.h>
42#include <kcombobox.h> 43#include <kcombobox.h>
43#include <kabc/phonenumber.h> 44#include <kabc/phonenumber.h>
44 45
45typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; 46typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo;
46 47
47/** 48/**
48 Widget for editing phone numbers. 49 Widget for editing phone numbers.
49*/ 50*/
50class PhoneEditWidget : public QScrollView 51class PhoneEditWidget : public QWidget
51{ 52{
52 Q_OBJECT 53 Q_OBJECT
53 54
54 public: 55 public:
55 PhoneEditWidget( QWidget *parent, const char *name = 0 ); 56 PhoneEditWidget( QWidget *parent, const char *name = 0 );
56 ~PhoneEditWidget(); 57 ~PhoneEditWidget();
57 58
58 void setPhoneNumbers( const KABC::PhoneNumber::List &list ); 59 void setPhoneNumbers( const KABC::PhoneNumber::List &list );
59 KABC::PhoneNumber::List phoneNumbers(); 60 KABC::PhoneNumber::List phoneNumbers();
60 61
61 // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); 62 // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* );
62 //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); 63 //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int );
63 64
64 signals: 65 signals:
65 void modified(); 66 void modified();
66 void typeChange( int oldType, int newType ); 67 void typeChange( int oldType, int newType );
67 68
68 private slots: 69 private slots:
70 void bottomVisible();
71 void addNumberInt( int );
69 void deleteEdit( PhoneTypeNumberEdit* ew ); 72 void deleteEdit( PhoneTypeNumberEdit* ew );
70 void addNumber(); 73 void addNumber();
71 void pendingDelete(); 74 void pendingDelete();
72 protected: 75 protected:
73 76
74 private: 77 private:
78 QScrollView* sv;
79 QPopupMenu *mPopup;
80 int mPopupCount;
75 PhoneTypeNumberEdit* mPendingDelete; 81 PhoneTypeNumberEdit* mPendingDelete;
76 void setDefaults(); 82 void setDefaults();
77 PhoneTypeNumberEdit* appendEditCombo(); 83 PhoneTypeNumberEdit* appendEditCombo();
78 QWidget* mw; 84 QWidget* mw;
79 QVBoxLayout* mainLayout; 85 QVBoxLayout* mainLayout;
80 QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; 86 QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList;
81 87
82 KABC::PhoneNumber::List mPhoneList; 88 KABC::PhoneNumber::List mPhoneList;
83}; 89};
84 90
85 91
86 92
87 93
88 94
89#if 0 95#if 0
90class PhoneEditWidget : public QWidget 96class PhoneEditWidget : public QWidget
91{ 97{
92 Q___OBJECT 98 Q___OBJECT
93 99
94 public: 100 public:
95 PhoneEditWidget( QWidget *parent, const char *name = 0 ); 101 PhoneEditWidget( QWidget *parent, const char *name = 0 );
96 ~PhoneEditWidget(); 102 ~PhoneEditWidget();
97 103
98 void setPhoneNumbers( const KABC::PhoneNumber::List &list ); 104 void setPhoneNumbers( const KABC::PhoneNumber::List &list );
99 KABC::PhoneNumber::List phoneNumbers(); 105 KABC::PhoneNumber::List phoneNumbers();
100 106
101 void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); 107 void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* );
102 KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); 108 KABC::PhoneNumber currentPhoneNumber( KComboBox*, int );
103 109
104 sig_nals: 110 sig_nals:
105 void modified(); 111 void modified();
106 void typeChange( int oldType, int newType ); 112 void typeChange( int oldType, int newType );
107 113
108 private sl_ots: 114 private sl_ots:
109 void edit(); 115 void edit();
110 116
111 void updatePrefEdit(); 117 void updatePrefEdit();
112 void updateSecondEdit(); 118 void updateSecondEdit();
113 void updateThirdEdit(); 119 void updateThirdEdit();
114 void updateFourthEdit(); 120 void updateFourthEdit();
115 121
116 void slotPrefEditChanged(); 122 void slotPrefEditChanged();
117 void slotSecondEditChanged(); 123 void slotSecondEditChanged();
118 void slotThirdEditChanged(); 124 void slotThirdEditChanged();
119 void slotFourthEditChanged(); 125 void slotFourthEditChanged();
120 126
121 protected: 127 protected:
122 void updateLineEdits(); 128 void updateLineEdits();
123 void updateCombos(); 129 void updateCombos();
124 130
125 private: 131 private:
126 QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; 132 QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList;
127 void updateEdit( PhoneTypeCombo *combo ); 133 void updateEdit( PhoneTypeCombo *combo );
128 void updatePhoneNumber( PhoneTypeCombo *combo ); 134 void updatePhoneNumber( PhoneTypeCombo *combo );
129 void updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo ); 135 void updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo );
130 136
131 PhoneTypeCombo *mPrefCombo; 137 PhoneTypeCombo *mPrefCombo;
132 PhoneTypeCombo *mSecondCombo; 138 PhoneTypeCombo *mSecondCombo;
133 PhoneTypeCombo *mThirdCombo; 139 PhoneTypeCombo *mThirdCombo;
134 PhoneTypeCombo *mFourthCombo; 140 PhoneTypeCombo *mFourthCombo;
135 141
136 KLineEdit *mPrefEdit; 142 KLineEdit *mPrefEdit;
137 KLineEdit *mSecondEdit; 143 KLineEdit *mSecondEdit;
138 KLineEdit *mThirdEdit; 144 KLineEdit *mThirdEdit;
139 KLineEdit *mFourthEdit; 145 KLineEdit *mFourthEdit;
140 146
141 KABC::PhoneNumber::List mPhoneList; 147 KABC::PhoneNumber::List mPhoneList;
142}; 148};
143 149
144/** 150/**
145 Dialog for editing lists of phonenumbers. 151 Dialog for editing lists of phonenumbers.
146*/ 152*/
147class PhoneEditDialog : public KDialogBase 153class PhoneEditDialog : public KDialogBase
148{ 154{
149 Q___OBJECT 155 Q___OBJECT
150 156
151 public: 157 public:
152 PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name = 0 ); 158 PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name = 0 );
153 ~PhoneEditDialog(); 159 ~PhoneEditDialog();
154 160
155 const KABC::PhoneNumber::List &phoneNumbers(); 161 const KABC::PhoneNumber::List &phoneNumbers();
156 bool changed() const; 162 bool changed() const;
157 163
158 protected s__lots: 164 protected s__lots:
159 void slotAddPhoneNumber(); 165 void slotAddPhoneNumber();
160 void slotRemovePhoneNumber(); 166 void slotRemovePhoneNumber();
161 void slotEditPhoneNumber(); 167 void slotEditPhoneNumber();
162 void slotSelectionChanged(); 168 void slotSelectionChanged();
163 169
164 private: 170 private:
165 KABC::PhoneNumber::List mPhoneNumberList; 171 KABC::PhoneNumber::List mPhoneNumberList;
166 KABC::PhoneNumber::TypeList mTypeList; 172 KABC::PhoneNumber::TypeList mTypeList;
167 KComboBox *mTypeBox; 173 KComboBox *mTypeBox;
168 KListView *mListView; 174 KListView *mListView;
169 175
170 QPushButton *mRemoveButton; 176 QPushButton *mRemoveButton;
171 QPushButton *mEditButton; 177 QPushButton *mEditButton;
172 178
173 bool mChanged; 179 bool mChanged;
174}; 180};
175 181
176/** 182/**
177 Dialog for editing phone number types. 183 Dialog for editing phone number types.
178*/ 184*/
179class PhoneTypeDialog : public KDialogBase 185class PhoneTypeDialog : public KDialogBase
180{ 186{
181 Q___OBJECT 187 Q___OBJECT
182public: 188public:
183 PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 ); 189 PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 );
184 190
185 KABC::PhoneNumber phoneNumber(); 191 KABC::PhoneNumber phoneNumber();
186 192
187private: 193private:
188 KABC::PhoneNumber mPhoneNumber; 194 KABC::PhoneNumber mPhoneNumber;
189 KABC::PhoneNumber::TypeList mTypeList; 195 KABC::PhoneNumber::TypeList mTypeList;
190 196
191 QButtonGroup *mGroup; 197 QButtonGroup *mGroup;
192 QCheckBox *mPreferredBox; 198 QCheckBox *mPreferredBox;
193 KLineEdit *mNumber; 199 KLineEdit *mNumber;
194}; 200};
195#endif 201#endif
196 202
197class PhoneTypeNumberEdit : public QWidget 203class PhoneTypeNumberEdit : public QWidget
198{ 204{
199 Q_OBJECT 205 Q_OBJECT
200public: 206public:
201 PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent ) 207 PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent )
202 { 208 {
203 QHBoxLayout * lay = new QHBoxLayout( this ); 209 QHBoxLayout * lay = new QHBoxLayout( this );
204 lay->setSpacing( KDialogBase::spacingHintSmall() ); 210 lay->setSpacing( KDialogBase::spacingHintSmall() );
205 lay->setMargin( KDialogBase::marginHintSmall() ); 211 lay->setMargin( KDialogBase::marginHintSmall() );
206 mMinusButton = new QPushButton ( this ); 212 mMinusButton = new QPushButton ( this );
207 mMinusButton->setPixmap ( SmallIcon("minus")); 213 mMinusButton->setPixmap ( SmallIcon("minus"));
208 mCombo = new KComboBox( this ); 214 mCombo = new KComboBox( this );
209 mNumber = new KLineEdit( this ); 215 mNumber = new KLineEdit( this );
210 lay->addWidget( mMinusButton ); 216 lay->addWidget( mMinusButton );
211 lay->addWidget( mCombo ); 217 lay->addWidget( mCombo );
212 lay->addWidget( mNumber ); 218 lay->addWidget( mNumber );
213 connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) ); 219 connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) );
214 connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) ); 220 connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) );
215 connect( mNumber , SIGNAL ( textChanged ( const QString & ) ), 221 connect( mNumber , SIGNAL ( textChanged ( const QString & ) ),
216 this, SLOT ( textChanged ( const QString & ) ) ); 222 this, SLOT ( textChanged ( const QString & ) ) );
217 mCombo->insertStringList( PhoneNumber::supportedTypeListNames() ); 223 mCombo->insertStringList( PhoneNumber::supportedTypeListNames() );
218 } 224 }
219 ~PhoneTypeNumberEdit() { 225 ~PhoneTypeNumberEdit() {
220 // qDebug("~PhoneTypeNumberEdit() "); 226 // qDebug("~PhoneTypeNumberEdit() ");
221 } 227 }
222 void setPhoneNumber( const KABC::PhoneNumber &phoneNumber ) 228 void setPhoneNumber( const KABC::PhoneNumber &phoneNumber )
223 { 229 {
224 mPhoneNumber = phoneNumber; 230 mPhoneNumber = phoneNumber;
225 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); 231 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
226 mCombo->setCurrentItem( index ); 232 mCombo->setCurrentItem( index );
227 mNumber->setText( mPhoneNumber.number() ); 233 mNumber->setText( mPhoneNumber.number() );
228 show(); 234 show();
229 235 mNumber->setFocus();
230 } 236 }
231 KABC::PhoneNumber phoneNumber() 237 KABC::PhoneNumber phoneNumber()
232 { 238 {
233 mPhoneNumber.setNumber( mNumber->text() ); 239 mPhoneNumber.setNumber( mNumber->text() );
234 int index = mCombo->currentItem(); 240 int index = mCombo->currentItem();
235 mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); 241 mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] );
236 return mPhoneNumber; 242 return mPhoneNumber;
237 } 243 }
238 bool isValid() 244 bool isValid()
239 { 245 {
240 if ( mNumber->text().isEmpty() )return false; 246 if ( mNumber->text().isEmpty() )return false;
241 return true; 247 return true;
242 } 248 }
249 int currentType()
250 {
251 return mCombo->currentItem();
252 }
243 private slots: 253 private slots:
244 void typeExternalChanged( int oldType, int newType ) 254 void typeExternalChanged( int oldType, int newType )
245 { 255 {
246 if ( mPhoneNumber.type() == newType ) { 256 if ( mPhoneNumber.type() == newType ) {
247 mPhoneNumber.setType(oldType); 257 mPhoneNumber.setType(oldType);
248 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); 258 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
249 mCombo->setCurrentItem( index ); 259 mCombo->setCurrentItem( index );
250 } 260 }
251 } 261 }
252 void deleteNumber() 262 void deleteNumber()
253 { 263 {
254 emit deleteMe( this ); 264 emit deleteMe( this );
255 } 265 }
256 void comboTypeChange( int index ) 266 void comboTypeChange( int index )
257 { 267 {
258 int old = mPhoneNumber.type(); 268 int old = mPhoneNumber.type();
259 int newT = PhoneNumber::supportedTypeList()[index]; 269 int newT = PhoneNumber::supportedTypeList()[index];
260 if ( old != newT ) { 270 if ( old != newT ) {
261 emit modified(); 271 emit modified();
262 emit typeChange ( old, newT ); 272 if ( newT != PhoneNumber::Voice )
273 emit typeChange ( old, newT );
263 mPhoneNumber.setType(newT ); 274 mPhoneNumber.setType(newT );
264 } 275 }
265 276
266 } 277 }
267 int currentType()
268 {
269 return mCombo->currentItem();
270 }
271 void textChanged ( const QString & ) 278 void textChanged ( const QString & )
272 { 279 {
273 emit modified(); 280 emit modified();
274 } 281 }
275 signals: 282 signals:
276void typeChange( int oldType, int newType ); 283void typeChange( int oldType, int newType );
277 void modified(); 284 void modified();
278 void deleteMe( PhoneTypeNumberEdit* ); 285 void deleteMe( PhoneTypeNumberEdit* );
279 286
280private: 287private:
281 KABC::PhoneNumber mPhoneNumber; 288 KABC::PhoneNumber mPhoneNumber;
282 QPushButton* mMinusButton; 289 QPushButton* mMinusButton;
283 KComboBox *mCombo; 290 KComboBox *mCombo;
284 KLineEdit *mNumber; 291 KLineEdit *mNumber;
285}; 292};
286 293
287#endif 294#endif
diff --git a/version b/version
index 6c3e9c6..4f24d24 100644
--- a/version
+++ b/version
@@ -1 +1 @@
version = "2.2.5"; version = "2.2.6";