summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views/kaddressbookiconview.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/views/kaddressbookiconview.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'kaddressbook/views/kaddressbookiconview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/views/kaddressbookiconview.cpp60
1 files changed, 34 insertions, 26 deletions
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp
index d6ddec3..3a41a4b 100644
--- a/kaddressbook/views/kaddressbookiconview.cpp
+++ b/kaddressbook/views/kaddressbookiconview.cpp
@@ -1,157 +1,165 @@
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#ifndef KAB_EMBEDDED 24#ifndef KAB_EMBEDDED
25#include <qiconview.h> 25#include <q3iconview.h>
26#include <qstringlist.h> 26#include <qstringlist.h>
27 27
28#include <kabc/addressee.h> 28#include <kabc/addressee.h>
29#include <kconfig.h> 29#include <kconfig.h>
30#include <kdebug.h> 30#include <kdebug.h>
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kiconloader.h> 32#include <kiconloader.h>
33#include <klocale.h> 33#include <klocale.h>
34 34
35#else //KAB_EMBEDDED 35#else //KAB_EMBEDDED
36#endif //KAB_EMBEDDED 36#endif //KAB_EMBEDDED
37 37
38//Added by qt3to4:
39#include <QDropEvent>
40#include <Q3ValueList>
41#include <QPixmap>
42#include <QKeyEvent>
43#include <QEvent>
44#include <Q3VBoxLayout>
45
38#include <kabc/addressbook.h> 46#include <kabc/addressbook.h>
39#include "kabprefs.h" 47#include "kabprefs.h"
40#include "viewmanager.h" 48#include "viewmanager.h"
41#include "kaddressbookiconview.h" 49#include "kaddressbookiconview.h"
42#include <qlayout.h> 50#include <qlayout.h>
43#include <qregexp.h> 51#include <qregexp.h>
44#include <qapplication.h> 52#include <qapplication.h>
45#include <kglobal.h> 53#include <kglobal.h>
46/*US transfered to the headerfile 54/*US transfered to the headerfile
47class IconViewFactory : public ViewFactory 55class IconViewFactory : public ViewFactory
48{ 56{
49 public: 57 public:
50 KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) 58 KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name )
51 { 59 {
52 return new KAddressBookIconView( ab, parent, name ); 60 return new KAddressBookIconView( ab, parent, name );
53 } 61 }
54 62
55 QString type() const { return "Icon"; } 63 QString type() const { return "Icon"; }
56 64
57 QString description() const { return i18n( "Icons represent contacts. Very simple view." ); } 65 QString description() const { return i18n( "Icons represent contacts. Very simple view." ); }
58}; 66};
59 67
60*/ 68*/
61 69
62extern "C" { 70extern "C" {
63 void *init_libkaddrbk_iconview() 71 void *init_libkaddrbk_iconview()
64 { 72 {
65 return ( new IconViewFactory ); 73 return ( new IconViewFactory );
66 } 74 }
67} 75}
68 76
69//////////////////////////////// 77////////////////////////////////
70// AddresseeIconView (internal class) 78// AddresseeIconView (internal class)
71#ifndef KAB_EMBEDDED 79#ifndef KAB_EMBEDDED
72AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) 80AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name)
73 : KIconView(parent, name) 81 : KIconView(parent, name)
74#else //KAB_EMBEDDED 82#else //KAB_EMBEDDED
75AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) 83AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name)
76 : QIconView(parent, name) 84 : Q3IconView(parent, name)
77#endif //KAB_EMBEDDED 85#endif //KAB_EMBEDDED
78 86
79{ 87{
80 setSelectionMode( QIconView::Extended ); 88 setSelectionMode( Q3IconView::Extended );
81 setResizeMode( QIconView::Adjust ); 89 setResizeMode( Q3IconView::Adjust );
82 setWordWrapIconText( true ); 90 setWordWrapIconText( true );
83 setGridX( 100 ); 91 setGridX( 100 );
84 setItemsMovable(false); 92 setItemsMovable(false);
85 setSorting(true, true); 93 setSorting(true, true);
86 94
87 95
88//US ??? setMode( KIconView::Select ); 96//US ??? setMode( KIconView::Select );
89 97
90#ifndef KAB_EMBEDDED 98#ifndef KAB_EMBEDDED
91 99
92 connect(this, SIGNAL(dropped(QDropEvent*, const QValueList<QIconDragItem>&)), 100 connect(this, SIGNAL(dropped(QDropEvent*, const Q3ValueList<Q3IconDragItem>&)),
93 this, SLOT(itemDropped(QDropEvent*, const QValueList<QIconDragItem>&))); 101 this, SLOT(itemDropped(QDropEvent*, const Q3ValueList<Q3IconDragItem>&)));
94#endif //KAB_EMBEDDED 102#endif //KAB_EMBEDDED
95} 103}
96 104
97AddresseeIconView::~AddresseeIconView() 105AddresseeIconView::~AddresseeIconView()
98{ 106{
99} 107}
100 108
101 109
102void AddresseeIconView::itemDropped(QDropEvent *e, 110void AddresseeIconView::itemDropped(QDropEvent *e,
103 const QValueList<QIconDragItem> &) 111 const Q3ValueList<Q3IconDragItem> &)
104{ 112{
105 emit addresseeDropped(e); 113 emit addresseeDropped(e);
106} 114}
107 115
108QDragObject *AddresseeIconView::dragObject() 116Q3DragObject *AddresseeIconView::dragObject()
109{ 117{
110 emit startAddresseeDrag(); 118 emit startAddresseeDrag();
111 119
112 // We never want IconView to start the drag 120 // We never want IconView to start the drag
113 return 0; 121 return 0;
114} 122}
115//////////////////////////////// 123////////////////////////////////
116// AddresseeIconViewItem (internal class) 124// AddresseeIconViewItem (internal class)
117#ifndef KAB_EMBEDDED 125#ifndef KAB_EMBEDDED
118class AddresseeIconViewItem : public KIconViewItem 126class AddresseeIconViewItem : public KIconViewItem
119#else //KAB_EMBEDDED 127#else //KAB_EMBEDDED
120class AddresseeIconViewItem : public QIconViewItem 128class AddresseeIconViewItem : public Q3IconViewItem
121#endif //KAB_EMBEDDED 129#endif //KAB_EMBEDDED
122{ 130{
123 public: 131 public:
124#ifndef KAB_EMBEDDED 132#ifndef KAB_EMBEDDED
125 AddresseeIconViewItem(const KABC::Field::List &fields, 133 AddresseeIconViewItem(const KABC::Field::List &fields,
126 KABC::AddressBook *doc, const KABC::Addressee &a, 134 KABC::AddressBook *doc, const KABC::Addressee &a,
127 QIconView *parent) 135 Q3IconView *parent)
128 : KIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) 136 : KIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a)
129#else //KAB_EMBEDDED 137#else //KAB_EMBEDDED
130 AddresseeIconViewItem(const KABC::Field::List &fields, 138 AddresseeIconViewItem(const KABC::Field::List &fields,
131 KABC::AddressBook *doc, const KABC::Addressee &a, 139 KABC::AddressBook *doc, const KABC::Addressee &a,
132 QIconView *parent) 140 Q3IconView *parent)
133 : QIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) 141 : Q3IconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a)
134#endif //KAB_EMBEDDED 142#endif //KAB_EMBEDDED
135 { 143 {
136 if ( mFields.isEmpty() ) { 144 if ( mFields.isEmpty() ) {
137 mFields = KABC::Field::defaultFields(); 145 mFields = KABC::Field::defaultFields();
138 } 146 }
139 refresh(); 147 refresh();
140 } 148 }
141 149
142 const KABC::Addressee &addressee() const { return mAddressee; } 150 const KABC::Addressee &addressee() const { return mAddressee; }
143 151
144 void refresh() 152 void refresh()
145 { 153 {
146 // Update our addressee, since it may have changed elsewhere 154 // Update our addressee, since it may have changed elsewhere
147 mAddressee = mDocument->findByUid(mAddressee.uid()); 155 mAddressee = mDocument->findByUid(mAddressee.uid());
148 156
149 if (!mAddressee.isEmpty()) 157 if (!mAddressee.isEmpty())
150 setText( mAddressee.givenName() + " " + mAddressee.familyName() ); 158 setText( mAddressee.givenName() + " " + mAddressee.familyName() );
151 159
152 QPixmap icon; 160 QPixmap icon;
153 161
154 KABC::Picture pic = mAddressee.photo(); 162 KABC::Picture pic = mAddressee.photo();
155 if ( pic.data().isNull() ) 163 if ( pic.data().isNull() )
156 pic = mAddressee.logo(); 164 pic = mAddressee.logo();
157 165
@@ -179,110 +187,110 @@ class AddresseeIconViewItem : public QIconViewItem
179 qDebug("AddresseeIconViewItem::refresh - scale here dependend of the displaysize and the right factor"); 187 qDebug("AddresseeIconViewItem::refresh - scale here dependend of the displaysize and the right factor");
180 icon.convertFromImage(img.smoothScale(wid, hei)); 188 icon.convertFromImage(img.smoothScale(wid, hei));
181#endif //KAB_EMBEDDED 189#endif //KAB_EMBEDDED
182 190
183 } else { 191 } else {
184 icon = KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 ); 192 icon = KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 );
185 } 193 }
186 setPixmap( icon ); 194 setPixmap( icon );
187 } 195 }
188 196
189 private: 197 private:
190 KABC::Field::List mFields; 198 KABC::Field::List mFields;
191 KABC::AddressBook *mDocument; 199 KABC::AddressBook *mDocument;
192 KABC::Addressee mAddressee; 200 KABC::Addressee mAddressee;
193}; 201};
194 202
195/////////////////////////////// 203///////////////////////////////
196// KAddressBookView 204// KAddressBookView
197 205
198KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, 206KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab,
199 QWidget *parent, const char *name) 207 QWidget *parent, const char *name)
200 : KAddressBookView( ab, parent, name ) 208 : KAddressBookView( ab, parent, name )
201{ 209{
202 // Init the GUI 210 // Init the GUI
203 QVBoxLayout *layout = new QVBoxLayout(viewWidget()); 211 Q3VBoxLayout *layout = new Q3VBoxLayout(viewWidget());
204 212
205 mIconView = new AddresseeIconView(viewWidget(), "mIconView"); 213 mIconView = new AddresseeIconView(viewWidget(), "mIconView");
206 layout->addWidget(mIconView); 214 layout->addWidget(mIconView);
207 215
208 // Connect up the signals 216 // Connect up the signals
209 217
210//US method executed is part of KIconView 218//US method executed is part of KIconView
211//US connect(mIconView, SIGNAL(executed(QIconViewItem *)), 219//US connect(mIconView, SIGNAL(executed(QIconViewItem *)),
212//US this, SLOT(addresseeExecuted(QIconViewItem *))); 220//US this, SLOT(addresseeExecuted(QIconViewItem *)));
213 connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), 221 connect(mIconView, SIGNAL(selectionChanged(Q3IconViewItem *)),
214 this, SLOT(addresseeExecuted(QIconViewItem *))); 222 this, SLOT(addresseeExecuted(Q3IconViewItem *)));
215 223
216 connect(mIconView, SIGNAL(selectionChanged()), 224 connect(mIconView, SIGNAL(selectionChanged()),
217 this, SLOT(addresseeSelected())); 225 this, SLOT(addresseeSelected()));
218 connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), 226 connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)),
219 this, SIGNAL(dropped(QDropEvent*))); 227 this, SIGNAL(dropped(QDropEvent*)));
220 connect(mIconView, SIGNAL(startAddresseeDrag()), 228 connect(mIconView, SIGNAL(startAddresseeDrag()),
221 this, SIGNAL(startDrag())); 229 this, SIGNAL(startDrag()));
222} 230}
223 231
224KAddressBookIconView::~KAddressBookIconView() 232KAddressBookIconView::~KAddressBookIconView()
225{ 233{
226} 234}
227void KAddressBookIconView::setFocusAV() 235void KAddressBookIconView::setFocusAV()
228{ 236{
229 if ( mIconView ) 237 if ( mIconView )
230 mIconView->setFocus(); 238 mIconView->setFocus();
231} 239}
232 240
233 241
234void KAddressBookIconView::scrollUP() 242void KAddressBookIconView::scrollUP()
235{ 243{
236 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); 244 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
237 QApplication::postEvent( mIconView, ev ); 245 QApplication::postEvent( mIconView, ev );
238} 246}
239void KAddressBookIconView::scrollDOWN() 247void KAddressBookIconView::scrollDOWN()
240{ 248{
241 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); 249 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
242 QApplication::postEvent( mIconView, ev ); 250 QApplication::postEvent( mIconView, ev );
243} 251}
244void KAddressBookIconView::readConfig(KConfig *config) 252void KAddressBookIconView::readConfig(KConfig *config)
245{ 253{
246 KAddressBookView::readConfig(config); 254 KAddressBookView::readConfig(config);
247 255
248//US method executed is part of KIconView 256//US method executed is part of KIconView
249//US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), 257//US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)),
250//US this, SLOT(addresseeExecuted(QIconViewItem *))); 258//US this, SLOT(addresseeExecuted(QIconViewItem *)));
251 disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), 259 disconnect(mIconView, SIGNAL(selectionChanged(Q3IconViewItem *)),
252 this, SLOT(addresseeExecuted(QIconViewItem *))); 260 this, SLOT(addresseeExecuted(Q3IconViewItem *)));
253 261
254//US method executed is part of KIconView. Use selectionChanged instead 262//US method executed is part of KIconView. Use selectionChanged instead
255/*US 263/*US
256 if (KABPrefs::instance()->mHonorSingleClick) 264 if (KABPrefs::instance()->mHonorSingleClick)
257 connect(mIconView, SIGNAL(executed(QIconViewItem *)), 265 connect(mIconView, SIGNAL(executed(QIconViewItem *)),
258 this, SLOT(addresseeExecuted(QIconViewItem *))); 266 this, SLOT(addresseeExecuted(QIconViewItem *)));
259 else 267 else
260 connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), 268 connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)),
261 this, SLOT(addresseeExecuted(QIconViewItem *))); 269 this, SLOT(addresseeExecuted(QIconViewItem *)));
262*/ 270*/
263 connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), 271 connect(mIconView, SIGNAL(selectionChanged(Q3IconViewItem *)),
264 this, SLOT(addresseeExecuted(QIconViewItem *))); 272 this, SLOT(addresseeExecuted(Q3IconViewItem *)));
265 273
266} 274}
267void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) 275void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field )
268{ 276{
269 mIconView->clear(); 277 mIconView->clear();
270 mIconList.clear(); 278 mIconList.clear();
271 if ( s.isEmpty() || s == "*" ) { 279 if ( s.isEmpty() || s == "*" ) {
272 refresh(); 280 refresh();
273 return; 281 return;
274 } 282 }
275 QRegExp re = getRegExp( s ); 283 QRegExp re = getRegExp( s );
276 if (!re.isValid()) 284 if (!re.isValid())
277 return; 285 return;
278 KABC::Addressee::List addresseeList = addressees(); 286 KABC::Addressee::List addresseeList = addressees();
279 KABC::Addressee::List::Iterator it; 287 KABC::Addressee::List::Iterator it;
280 if ( field ) { 288 if ( field ) {
281 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 289 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
282 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 290 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
283 continue; 291 continue;
284#if QT_VERSION >= 0x030000 292#if QT_VERSION >= 0x030000
285 if (re.search(field->value( *it ).lower()) == 0) 293 if (re.search(field->value( *it ).lower()) == 0)
286#else 294#else
287 if (re.match(field->value( *it ).lower()) == 0) 295 if (re.match(field->value( *it ).lower()) == 0)
288#endif 296#endif
@@ -315,167 +323,167 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field )
315 match = true; 323 match = true;
316 break; 324 break;
317 } 325 }
318 } 326 }
319 if ( ! match ) { 327 if ( ! match ) {
320 if ( (*it).matchAddress( &re ) ) { 328 if ( (*it).matchAddress( &re ) ) {
321 mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); 329 mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
322 match = true; 330 match = true;
323 break; 331 break;
324 } 332 }
325 } 333 }
326 } 334 }
327 } 335 }
328 mIconView->arrangeItemsInGrid( true ); 336 mIconView->arrangeItemsInGrid( true );
329 if ( mIconView->firstItem() ) { 337 if ( mIconView->firstItem() ) {
330 mIconView->setCurrentItem ( mIconView->firstItem() ); 338 mIconView->setCurrentItem ( mIconView->firstItem() );
331 mIconView->setSelected ( mIconView->firstItem() , true ); 339 mIconView->setSelected ( mIconView->firstItem() , true );
332 } 340 }
333 else 341 else
334 emit selected(QString::null); 342 emit selected(QString::null);
335} 343}
336QStringList KAddressBookIconView::selectedUids() 344QStringList KAddressBookIconView::selectedUids()
337{ 345{
338 QStringList uidList; 346 QStringList uidList;
339 QIconViewItem *item; 347 Q3IconViewItem *item;
340 AddresseeIconViewItem *aItem; 348 AddresseeIconViewItem *aItem;
341 349
342 for (item = mIconView->firstItem(); item; item = item->nextItem()) 350 for (item = mIconView->firstItem(); item; item = item->nextItem())
343 { 351 {
344 if (item->isSelected()) 352 if (item->isSelected())
345 { 353 {
346#ifndef KAB_EMBEDDED 354#ifndef KAB_EMBEDDED
347 aItem = dynamic_cast<AddresseeIconViewItem*>(item); 355 aItem = dynamic_cast<AddresseeIconViewItem*>(item);
348#else //KAB_EMBEDDED 356#else //KAB_EMBEDDED
349 aItem = (AddresseeIconViewItem*)(item); 357 aItem = (AddresseeIconViewItem*)(item);
350#endif //KAB_EMBEDDED 358#endif //KAB_EMBEDDED
351 if (aItem) 359 if (aItem)
352 uidList << aItem->addressee().uid(); 360 uidList << aItem->addressee().uid();
353 } 361 }
354 } 362 }
355 363
356 return uidList; 364 return uidList;
357} 365}
358 366
359void KAddressBookIconView::refresh(QString uid) 367void KAddressBookIconView::refresh(QString uid)
360{ 368{
361 QIconViewItem *item; 369 Q3IconViewItem *item;
362 AddresseeIconViewItem *aItem; 370 AddresseeIconViewItem *aItem;
363 371
364 if ( uid.isNull() ) { 372 if ( uid.isNull() ) {
365 // Rebuild the view 373 // Rebuild the view
366 mIconView->clear(); 374 mIconView->clear();
367 mIconList.clear(); 375 mIconList.clear();
368 376
369 KABC::Addressee::List addresseeList = addressees(); 377 KABC::Addressee::List addresseeList = addressees();
370 KABC::Addressee::List::Iterator iter; 378 KABC::Addressee::List::Iterator iter;
371 for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) { 379 for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) {
372 if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") ) 380 if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") )
373 continue; 381 continue;
374 aItem = new AddresseeIconViewItem( fields(), addressBook(), *iter, mIconView ); 382 aItem = new AddresseeIconViewItem( fields(), addressBook(), *iter, mIconView );
375 } 383 }
376 384
377 mIconView->arrangeItemsInGrid( true ); 385 mIconView->arrangeItemsInGrid( true );
378 386
379 for ( item = mIconView->firstItem(); item; item = item->nextItem() ) 387 for ( item = mIconView->firstItem(); item; item = item->nextItem() )
380 { 388 {
381#ifndef KAB_EMBEDDED 389#ifndef KAB_EMBEDDED
382 AddresseeIconViewItem* aivi = dynamic_cast<AddresseeIconViewItem*>( item ); 390 AddresseeIconViewItem* aivi = dynamic_cast<AddresseeIconViewItem*>( item );
383#else //KAB_EMBEDDED 391#else //KAB_EMBEDDED
384 AddresseeIconViewItem* aivi = (AddresseeIconViewItem*)( item ); 392 AddresseeIconViewItem* aivi = (AddresseeIconViewItem*)( item );
385#endif //KAB_EMBEDDED 393#endif //KAB_EMBEDDED
386 mIconList.append( aivi ); 394 mIconList.append( aivi );
387 } 395 }
388 396
389 } else { 397 } else {
390 // Try to find the one to refresh 398 // Try to find the one to refresh
391 for ( item = mIconView->firstItem(); item; item = item->nextItem() ) { 399 for ( item = mIconView->firstItem(); item; item = item->nextItem() ) {
392#ifndef KAB_EMBEDDED 400#ifndef KAB_EMBEDDED
393 aItem = dynamic_cast<AddresseeIconViewItem*>(item); 401 aItem = dynamic_cast<AddresseeIconViewItem*>(item);
394#else //KAB_EMBEDDED 402#else //KAB_EMBEDDED
395 aItem = (AddresseeIconViewItem*)(item); 403 aItem = (AddresseeIconViewItem*)(item);
396#endif //KAB_EMBEDDED 404#endif //KAB_EMBEDDED
397 if ((aItem) && (aItem->addressee().uid() == uid)) { 405 if ((aItem) && (aItem->addressee().uid() == uid)) {
398 aItem->refresh(); 406 aItem->refresh();
399 mIconView->arrangeItemsInGrid( true ); 407 mIconView->arrangeItemsInGrid( true );
400 return; 408 return;
401 } 409 }
402 } 410 }
403 refresh( QString::null ); 411 refresh( QString::null );
404 } 412 }
405} 413}
406 414
407void KAddressBookIconView::setSelected(QString uid, bool selected) 415void KAddressBookIconView::setSelected(QString uid, bool selected)
408{ 416{
409 QIconViewItem *item; 417 Q3IconViewItem *item;
410 AddresseeIconViewItem *aItem; 418 AddresseeIconViewItem *aItem;
411 419
412 if (uid.isNull()) 420 if (uid.isNull())
413 { 421 {
414 mIconView->selectAll(selected); 422 mIconView->selectAll(selected);
415 } 423 }
416 else 424 else
417 { 425 {
418 bool found = false; 426 bool found = false;
419 for (item = mIconView->firstItem(); item && !found; 427 for (item = mIconView->firstItem(); item && !found;
420 item = item->nextItem()) 428 item = item->nextItem())
421 { 429 {
422#ifndef KAB_EMBEDDED 430#ifndef KAB_EMBEDDED
423 aItem = dynamic_cast<AddresseeIconViewItem*>(item); 431 aItem = dynamic_cast<AddresseeIconViewItem*>(item);
424#else //KAB_EMBEDDED 432#else //KAB_EMBEDDED
425 aItem = (AddresseeIconViewItem*)(item); 433 aItem = (AddresseeIconViewItem*)(item);
426#endif //KAB_EMBEDDED 434#endif //KAB_EMBEDDED
427 435
428 if ((aItem) && (aItem->addressee().uid() == uid)) 436 if ((aItem) && (aItem->addressee().uid() == uid))
429 { 437 {
430 mIconView->setSelected(aItem, selected); 438 mIconView->setSelected(aItem, selected);
431 mIconView->ensureItemVisible( aItem ); 439 mIconView->ensureItemVisible( aItem );
432 found = true; 440 found = true;
433 } 441 }
434 } 442 }
435 } 443 }
436} 444}
437 445
438void KAddressBookIconView::addresseeExecuted(QIconViewItem *item) 446void KAddressBookIconView::addresseeExecuted(Q3IconViewItem *item)
439{ 447{
440#ifndef KAB_EMBEDDED 448#ifndef KAB_EMBEDDED
441 AddresseeIconViewItem *aItem = dynamic_cast<AddresseeIconViewItem*>(item); 449 AddresseeIconViewItem *aItem = dynamic_cast<AddresseeIconViewItem*>(item);
442#else //KAB_EMBEDDED 450#else //KAB_EMBEDDED
443 AddresseeIconViewItem *aItem = (AddresseeIconViewItem*)(item); 451 AddresseeIconViewItem *aItem = (AddresseeIconViewItem*)(item);
444#endif //KAB_EMBEDDED 452#endif //KAB_EMBEDDED
445 453
446 if (aItem) { 454 if (aItem) {
447 emit executed(aItem->addressee().uid()); 455 emit executed(aItem->addressee().uid());
448 } 456 }
449} 457}
450 458
451void KAddressBookIconView::addresseeSelected() 459void KAddressBookIconView::addresseeSelected()
452{ 460{
453 QIconViewItem *item; 461 Q3IconViewItem *item;
454 AddresseeIconViewItem *aItem; 462 AddresseeIconViewItem *aItem;
455 463
456 bool found = false; 464 bool found = false;
457 for (item = mIconView->firstItem(); item && !found; 465 for (item = mIconView->firstItem(); item && !found;
458 item = item->nextItem()) 466 item = item->nextItem())
459 { 467 {
460 if (item->isSelected()) 468 if (item->isSelected())
461 { 469 {
462#ifndef KAB_EMBEDDED 470#ifndef KAB_EMBEDDED
463 aItem = dynamic_cast<AddresseeIconViewItem*>(item); 471 aItem = dynamic_cast<AddresseeIconViewItem*>(item);
464#else //KAB_EMBEDDED 472#else //KAB_EMBEDDED
465 aItem = (AddresseeIconViewItem*)(item); 473 aItem = (AddresseeIconViewItem*)(item);
466#endif //KAB_EMBEDDED 474#endif //KAB_EMBEDDED
467 if (aItem) 475 if (aItem)
468 { 476 {
469 emit selected(aItem->addressee().uid()); 477 emit selected(aItem->addressee().uid());
470 found = true; 478 found = true;
471 } 479 }
472 } 480 }
473 } 481 }
474 482
475 if (!found) 483 if (!found)
476 emit selected(QString::null); 484 emit selected(QString::null);
477} 485}
478 486
479#ifndef KAB_EMBEDDED 487#ifndef KAB_EMBEDDED_
480#include "kaddressbookiconview.moc" 488#include "moc_kaddressbookiconview.cpp"
481#endif //KAB_EMBEDDED 489#endif //KAB_EMBEDDED