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