summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views
authorzautrix <zautrix>2004-09-03 09:23:23 (UTC)
committer zautrix <zautrix>2004-09-03 09:23:23 (UTC)
commitd171ed3b09665db0f511310d6c84a23d75135f50 (patch) (unidiff)
tree557b3fd423a022559971ceafa61def5adbb7e828 /kaddressbook/views
parentf6b72fd55671131cd81a3357940c9337ea5d7494 (diff)
downloadkdepimpi-d171ed3b09665db0f511310d6c84a23d75135f50.zip
kdepimpi-d171ed3b09665db0f511310d6c84a23d75135f50.tar.gz
kdepimpi-d171ed3b09665db0f511310d6c84a23d75135f50.tar.bz2
Much better search possibility in kapi
Diffstat (limited to 'kaddressbook/views') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp
index 66a3f0b..0847b64 100644
--- a/kaddressbook/views/kaddressbooktableview.cpp
+++ b/kaddressbook/views/kaddressbooktableview.cpp
@@ -1,382 +1,382 @@
1// $Id$ 1// $Id$
2 2
3#include <qvbox.h> 3#include <qvbox.h>
4#include <qlistbox.h> 4#include <qlistbox.h>
5#include <qwidget.h> 5#include <qwidget.h>
6#include <qfile.h> 6#include <qfile.h>
7#include <qimage.h> 7#include <qimage.h>
8#include <qcombobox.h> 8#include <qcombobox.h>
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qdragobject.h> 10#include <qdragobject.h>
11#include <qevent.h> 11#include <qevent.h>
12#include <qurl.h> 12#include <qurl.h>
13#include <qpixmap.h> 13#include <qpixmap.h>
14 14
15#include <kabc/addressbook.h> 15#include <kabc/addressbook.h>
16#include <kapplication.h> 16#include <kapplication.h>
17#include <kconfig.h> 17#include <kconfig.h>
18#include <kcolorbutton.h> 18#include <kcolorbutton.h>
19#include <kdebug.h> 19#include <kdebug.h>
20#include <kglobal.h> 20#include <kglobal.h>
21#include <kiconloader.h> 21#include <kiconloader.h>
22#include <klineedit.h> 22#include <klineedit.h>
23#include <klocale.h> 23#include <klocale.h>
24#include <kmessagebox.h> 24#include <kmessagebox.h>
25#include <kurl.h> 25#include <kurl.h>
26#include <kurlrequester.h> 26#include <kurlrequester.h>
27 27
28//US#include "configuretableviewdialog.h" 28//US#include "configuretableviewdialog.h"
29#include "contactlistview.h" 29#include "contactlistview.h"
30#include "kabprefs.h" 30#include "kabprefs.h"
31#include "undocmds.h" 31#include "undocmds.h"
32#include "viewmanager.h" 32#include "viewmanager.h"
33 33
34#include <qlayout.h> 34#include <qlayout.h>
35 35
36 36
37#include "kaddressbooktableview.h" 37#include "kaddressbooktableview.h"
38 38
39 39
40KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, 40KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab,
41 QWidget *parent, const char *name ) 41 QWidget *parent, const char *name )
42 : KAddressBookView( ab, parent, name ) 42 : KAddressBookView( ab, parent, name )
43{ 43{
44 mainLayout = new QVBoxLayout( viewWidget(), 2 ); 44 mainLayout = new QVBoxLayout( viewWidget(), 2 );
45 45
46 // The list view will be created when the config is read. 46 // The list view will be created when the config is read.
47 mListView = 0; 47 mListView = 0;
48} 48}
49 49
50KAddressBookTableView::~KAddressBookTableView() 50KAddressBookTableView::~KAddressBookTableView()
51{ 51{
52} 52}
53 53
54void KAddressBookTableView::reconstructListView() 54void KAddressBookTableView::reconstructListView()
55{ 55{
56 if (mListView) 56 if (mListView)
57 { 57 {
58 disconnect(mListView, SIGNAL(selectionChanged()), 58 disconnect(mListView, SIGNAL(selectionChanged()),
59 this, SLOT(addresseeSelected())); 59 this, SLOT(addresseeSelected()));
60 disconnect(mListView, SIGNAL(executed(QListViewItem*)), 60 disconnect(mListView, SIGNAL(executed(QListViewItem*)),
61 this, SLOT(addresseeExecuted(QListViewItem*))); 61 this, SLOT(addresseeExecuted(QListViewItem*)));
62 disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), 62 disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)),
63 this, SLOT(addresseeExecuted(QListViewItem*))); 63 this, SLOT(addresseeExecuted(QListViewItem*)));
64 disconnect(mListView, SIGNAL(startAddresseeDrag()), this, 64 disconnect(mListView, SIGNAL(startAddresseeDrag()), this,
65 SIGNAL(startDrag())); 65 SIGNAL(startDrag()));
66 disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), 66 disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)),
67 this, SLOT(addresseeExecuted(QListViewItem*))); 67 this, SLOT(addresseeExecuted(QListViewItem*)));
68 68
69 disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, 69 disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this,
70 SIGNAL(dropped(QDropEvent*))); 70 SIGNAL(dropped(QDropEvent*)));
71 delete mListView; 71 delete mListView;
72 } 72 }
73 73
74 mListView = new ContactListView( this, addressBook(), viewWidget() ); 74 mListView = new ContactListView( this, addressBook(), viewWidget() );
75 75
76 // Add the columns 76 // Add the columns
77 KABC::Field::List fieldList = fields(); 77 KABC::Field::List fieldList = fields();
78 KABC::Field::List::ConstIterator it; 78 KABC::Field::List::ConstIterator it;
79 79
80 int c = 0; 80 int c = 0;
81 for( it = fieldList.begin(); it != fieldList.end(); ++it ) { 81 for( it = fieldList.begin(); it != fieldList.end(); ++it ) {
82 mListView->addColumn( (*it)->label() ); 82 mListView->addColumn( (*it)->label() );
83 mListView->setColumnWidthMode(c++, QListView::Manual); 83 mListView->setColumnWidthMode(c++, QListView::Manual);
84//US 84//US
85 // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); 85 // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1());
86 } 86 }
87 87
88 connect(mListView, SIGNAL(selectionChanged()), 88 connect(mListView, SIGNAL(selectionChanged()),
89 this, SLOT(addresseeSelected())); 89 this, SLOT(addresseeSelected()));
90 connect(mListView, SIGNAL(startAddresseeDrag()), this, 90 connect(mListView, SIGNAL(startAddresseeDrag()), this,
91 SIGNAL(startDrag())); 91 SIGNAL(startDrag()));
92 connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, 92 connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this,
93 SIGNAL(dropped(QDropEvent*))); 93 SIGNAL(dropped(QDropEvent*)));
94 94
95 if (KABPrefs::instance()->mHonorSingleClick) 95 if (KABPrefs::instance()->mHonorSingleClick)
96 connect(mListView, SIGNAL(executed(QListViewItem*)), 96 connect(mListView, SIGNAL(executed(QListViewItem*)),
97 this, SLOT(addresseeExecuted(QListViewItem*))); 97 this, SLOT(addresseeExecuted(QListViewItem*)));
98 else 98 else
99 connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), 99 connect(mListView, SIGNAL(doubleClicked(QListViewItem*)),
100 this, SLOT(addresseeExecuted(QListViewItem*))); 100 this, SLOT(addresseeExecuted(QListViewItem*)));
101 connect(mListView, SIGNAL(returnPressed(QListViewItem*)), 101 connect(mListView, SIGNAL(returnPressed(QListViewItem*)),
102 this, SLOT(addresseeExecuted(QListViewItem*))); 102 this, SLOT(addresseeExecuted(QListViewItem*)));
103 connect(mListView, SIGNAL(signalDelete()), 103 connect(mListView, SIGNAL(signalDelete()),
104 this, SLOT(addresseeDeleted())); 104 this, SLOT(addresseeDeleted()));
105 105
106//US performceimprovement. Refresh is done from the outside 106//US performceimprovement. Refresh is done from the outside
107//US refresh(); 107//US refresh();
108 108
109 mListView->setSorting( 0, true ); 109 mListView->setSorting( 0, true );
110 mainLayout->addWidget( mListView ); 110 mainLayout->addWidget( mListView );
111 mainLayout->activate(); 111 mainLayout->activate();
112 mListView->show(); 112 mListView->show();
113} 113}
114 114
115void KAddressBookTableView::writeConfig(KConfig *config) 115void KAddressBookTableView::writeConfig(KConfig *config)
116{ 116{
117 KAddressBookView::writeConfig(config); 117 KAddressBookView::writeConfig(config);
118 118
119 mListView->saveLayout(config, config->group()); 119 mListView->saveLayout(config, config->group());
120} 120}
121 121
122void KAddressBookTableView::readConfig(KConfig *config) 122void KAddressBookTableView::readConfig(KConfig *config)
123{ 123{
124 KAddressBookView::readConfig( config ); 124 KAddressBookView::readConfig( config );
125 // The config could have changed the fields, so we need to reconstruct
126 // the listview.
127 reconstructListView();
125 128
126 // costum colors? 129 // costum colors?
127 if ( config->readBoolEntry( "EnableCustomColors", false ) ) 130 if ( config->readBoolEntry( "EnableCustomColors", false ) )
128 { 131 {
129 QPalette p( mListView->palette() ); 132 QPalette p( mListView->palette() );
130 QColor c = p.color(QPalette::Normal, QColorGroup::Base ); 133 QColor c = p.color(QPalette::Normal, QColorGroup::Base );
131 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); 134 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) );
132 c = p.color(QPalette::Normal, QColorGroup::Text ); 135 c = p.color(QPalette::Normal, QColorGroup::Text );
133 p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); 136 p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) );
134 c = p.color(QPalette::Normal, QColorGroup::Button ); 137 c = p.color(QPalette::Normal, QColorGroup::Button );
135 p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); 138 p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) );
136 c = p.color(QPalette::Normal, QColorGroup::ButtonText ); 139 c = p.color(QPalette::Normal, QColorGroup::ButtonText );
137 p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); 140 p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) );
138 c = p.color(QPalette::Normal, QColorGroup::Highlight ); 141 c = p.color(QPalette::Normal, QColorGroup::Highlight );
139 p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); 142 p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) );
140 c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); 143 c = p.color(QPalette::Normal, QColorGroup::HighlightedText );
141 p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); 144 p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) );
142 c = p.color(QPalette::Normal, QColorGroup::Base ); 145 c = p.color(QPalette::Normal, QColorGroup::Base );
143 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "AlternatingBackgroundColor", &c ) ); 146 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "AlternatingBackgroundColor", &c ) );
144 mListView->viewport()->setPalette( p ); 147 mListView->viewport()->setPalette( p );
145 } 148 }
146 else 149 else
147 { 150 {
148 // needed if turned off during a session. 151 // needed if turned off during a session.
149 mListView->viewport()->setPalette( mListView->palette() ); 152 mListView->viewport()->setPalette( mListView->palette() );
150 } 153 }
151 154
152 //custom fonts? 155 //custom fonts?
153 QFont f( font() ); 156 QFont f( font() );
154 if ( config->readBoolEntry( "EnableCustomFonts", false ) ) 157 if ( config->readBoolEntry( "EnableCustomFonts", false ) )
155 { 158 {
156 // mListView->setFont( config->readFontEntry( "TextFont", &f) ); 159 // mListView->setFont( config->readFontEntry( "TextFont", &f) );
157 f.setBold( true ); 160 f.setBold( true );
158 // mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); 161 // mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) );
159 } 162 }
160 else 163 else
161 { 164 {
162 // mListView->setFont( f ); 165 // mListView->setFont( f );
163 f.setBold( true ); 166 f.setBold( true );
164 // mListView->setHeaderFont( f ); 167 // mListView->setHeaderFont( f );
165 } 168 }
166 169
167 170
168 171
169 172
170 // The config could have changed the fields, so we need to reconstruct
171 // the listview.
172 reconstructListView();
173 173
174 // Set the list view options 174 // Set the list view options
175 mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", 175 mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground",
176 true)); 176 true));
177 mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); 177 mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false));
178 mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); 178 mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true));
179 179
180 if (config->readBoolEntry("Background", false)) 180 if (config->readBoolEntry("Background", false))
181 mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); 181 mListView->setBackgroundPixmap(config->readEntry("BackgroundName"));
182 182
183 // Restore the layout of the listview 183 // Restore the layout of the listview
184 mListView->restoreLayout(config, config->group()); 184 mListView->restoreLayout(config, config->group());
185} 185}
186 186
187void KAddressBookTableView::refresh(QString uid) 187void KAddressBookTableView::refresh(QString uid)
188{ 188{
189 // For now just repopulate. In reality this method should 189 // For now just repopulate. In reality this method should
190 // check the value of uid, and if valid iterate through 190 // check the value of uid, and if valid iterate through
191 // the listview to find the entry, then tell it to refresh. 191 // the listview to find the entry, then tell it to refresh.
192 192
193 if (uid.isNull()) { 193 if (uid.isNull()) {
194 // Clear the list view 194 // Clear the list view
195 QString currentUID, nextUID; 195 QString currentUID, nextUID;
196#ifndef KAB_EMBEDDED 196#ifndef KAB_EMBEDDED
197 ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); 197 ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() );
198#else //KAB_EMBEDDED 198#else //KAB_EMBEDDED
199 ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); 199 ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() );
200#endif //KAB_EMBEDDED 200#endif //KAB_EMBEDDED
201 201
202 if ( currentItem ) { 202 if ( currentItem ) {
203#ifndef KAB_EMBEDDED 203#ifndef KAB_EMBEDDED
204 ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); 204 ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() );
205#else //KAB_EMBEDDED 205#else //KAB_EMBEDDED
206 ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); 206 ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() );
207#endif //KAB_EMBEDDED 207#endif //KAB_EMBEDDED
208 if ( nextItem ) 208 if ( nextItem )
209 nextUID = nextItem->addressee().uid(); 209 nextUID = nextItem->addressee().uid();
210 currentUID = currentItem->addressee().uid(); 210 currentUID = currentItem->addressee().uid();
211 } 211 }
212 212
213 mListView->clear(); 213 mListView->clear();
214 214
215 currentItem = 0; 215 currentItem = 0;
216 KABC::Addressee::List addresseeList = addressees(); 216 KABC::Addressee::List addresseeList = addressees();
217 KABC::Addressee::List::Iterator it; 217 KABC::Addressee::List::Iterator it;
218 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 218 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
219 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); 219 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
220 if ( (*it).uid() == currentUID ) 220 if ( (*it).uid() == currentUID )
221 currentItem = item; 221 currentItem = item;
222 else if ( (*it).uid() == nextUID && !currentItem ) 222 else if ( (*it).uid() == nextUID && !currentItem )
223 currentItem = item; 223 currentItem = item;
224 } 224 }
225 225
226 // Sometimes the background pixmap gets messed up when we add lots 226 // Sometimes the background pixmap gets messed up when we add lots
227 // of items. 227 // of items.
228 mListView->repaint(); 228 mListView->repaint();
229 229
230 if ( currentItem ) { 230 if ( currentItem ) {
231 mListView->setCurrentItem( currentItem ); 231 mListView->setCurrentItem( currentItem );
232 mListView->ensureItemVisible( currentItem ); 232 mListView->ensureItemVisible( currentItem );
233 } 233 }
234 } else { 234 } else {
235 // Only need to update on entry. Iterate through and try to find it 235 // Only need to update on entry. Iterate through and try to find it
236 ContactListViewItem *ceItem; 236 ContactListViewItem *ceItem;
237 QListViewItemIterator it( mListView ); 237 QListViewItemIterator it( mListView );
238 while ( it.current() ) { 238 while ( it.current() ) {
239#ifndef KAB_EMBEDDED 239#ifndef KAB_EMBEDDED
240 ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); 240 ceItem = dynamic_cast<ContactListViewItem*>( it.current() );
241#else //KAB_EMBEDDED 241#else //KAB_EMBEDDED
242 ceItem = (ContactListViewItem*)( it.current() ); 242 ceItem = (ContactListViewItem*)( it.current() );
243#endif //KAB_EMBEDDED 243#endif //KAB_EMBEDDED
244 244
245 if ( ceItem && ceItem->addressee().uid() == uid ) { 245 if ( ceItem && ceItem->addressee().uid() == uid ) {
246 ceItem->refresh(); 246 ceItem->refresh();
247 return; 247 return;
248 } 248 }
249 ++it; 249 ++it;
250 } 250 }
251 251
252 refresh( QString::null ); 252 refresh( QString::null );
253 } 253 }
254} 254}
255 255
256QStringList KAddressBookTableView::selectedUids() 256QStringList KAddressBookTableView::selectedUids()
257{ 257{
258 QStringList uidList; 258 QStringList uidList;
259 QListViewItem *item; 259 QListViewItem *item;
260 ContactListViewItem *ceItem; 260 ContactListViewItem *ceItem;
261 261
262 for(item = mListView->firstChild(); item; item = item->itemBelow()) 262 for(item = mListView->firstChild(); item; item = item->itemBelow())
263 { 263 {
264 if (mListView->isSelected( item )) 264 if (mListView->isSelected( item ))
265 { 265 {
266#ifndef KAB_EMBEDDED 266#ifndef KAB_EMBEDDED
267 ceItem = dynamic_cast<ContactListViewItem*>(item); 267 ceItem = dynamic_cast<ContactListViewItem*>(item);
268#else //KAB_EMBEDDED 268#else //KAB_EMBEDDED
269 ceItem = (ContactListViewItem*)(item); 269 ceItem = (ContactListViewItem*)(item);
270#endif //KAB_EMBEDDED 270#endif //KAB_EMBEDDED
271 271
272 if (ceItem != 0L) 272 if (ceItem != 0L)
273 uidList << ceItem->addressee().uid(); 273 uidList << ceItem->addressee().uid();
274 } 274 }
275 } 275 }
276 if ( uidList.count() == 0 ) 276 if ( uidList.count() == 0 )
277 if ( mListView->currentItem() ) { 277 if ( mListView->currentItem() ) {
278 ceItem = (ContactListViewItem*)(mListView->currentItem()) ; 278 ceItem = (ContactListViewItem*)(mListView->currentItem()) ;
279 uidList << ceItem->addressee().uid(); 279 uidList << ceItem->addressee().uid();
280 } 280 }
281 281
282 return uidList; 282 return uidList;
283} 283}
284 284
285void KAddressBookTableView::setSelected(QString uid, bool selected) 285void KAddressBookTableView::setSelected(QString uid, bool selected)
286{ 286{
287 QListViewItem *item; 287 QListViewItem *item;
288 ContactListViewItem *ceItem; 288 ContactListViewItem *ceItem;
289 289
290 if (uid.isNull()) 290 if (uid.isNull())
291 { 291 {
292 mListView->selectAll(selected); 292 mListView->selectAll(selected);
293 } 293 }
294 else 294 else
295 { 295 {
296 for(item = mListView->firstChild(); item; item = item->itemBelow()) 296 for(item = mListView->firstChild(); item; item = item->itemBelow())
297 { 297 {
298#ifndef KAB_EMBEDDED 298#ifndef KAB_EMBEDDED
299 ceItem = dynamic_cast<ContactListViewItem*>(item); 299 ceItem = dynamic_cast<ContactListViewItem*>(item);
300#else //KAB_EMBEDDED 300#else //KAB_EMBEDDED
301 ceItem = (ContactListViewItem*)(item); 301 ceItem = (ContactListViewItem*)(item);
302#endif //KAB_EMBEDDED 302#endif //KAB_EMBEDDED
303 303
304 304
305 if ((ceItem != 0L) && (ceItem->addressee().uid() == uid)) 305 if ((ceItem != 0L) && (ceItem->addressee().uid() == uid))
306 { 306 {
307 mListView->setSelected(item, selected); 307 mListView->setSelected(item, selected);
308 308
309 if (selected) 309 if (selected)
310 mListView->ensureItemVisible(item); 310 mListView->ensureItemVisible(item);
311 } 311 }
312 } 312 }
313 } 313 }
314} 314}
315 315
316void KAddressBookTableView::addresseeSelected() 316void KAddressBookTableView::addresseeSelected()
317{ 317{
318 // We need to try to find the first selected item. This might not be the 318 // We need to try to find the first selected item. This might not be the
319 // last selected item, but when QListView is in multiselection mode, 319 // last selected item, but when QListView is in multiselection mode,
320 // there is no way to figure out which one was 320 // there is no way to figure out which one was
321 // selected last. 321 // selected last.
322 QListViewItem *item; 322 QListViewItem *item;
323 bool found =false; 323 bool found =false;
324 for (item = mListView->firstChild(); item && !found; 324 for (item = mListView->firstChild(); item && !found;
325 item = item->nextSibling()) 325 item = item->nextSibling())
326 { 326 {
327 if (item->isSelected()) 327 if (item->isSelected())
328 { 328 {
329 found = true; 329 found = true;
330#ifndef KAB_EMBEDDED 330#ifndef KAB_EMBEDDED
331 ContactListViewItem *ceItem 331 ContactListViewItem *ceItem
332 = dynamic_cast<ContactListViewItem*>(item); 332 = dynamic_cast<ContactListViewItem*>(item);
333#else //KAB_EMBEDDED 333#else //KAB_EMBEDDED
334 ContactListViewItem *ceItem 334 ContactListViewItem *ceItem
335 = (ContactListViewItem*)(item); 335 = (ContactListViewItem*)(item);
336#endif //KAB_EMBEDDED 336#endif //KAB_EMBEDDED
337 337
338 if ( ceItem ) emit selected(ceItem->addressee().uid()); 338 if ( ceItem ) emit selected(ceItem->addressee().uid());
339 } 339 }
340 } 340 }
341 341
342 if (!found) 342 if (!found)
343 emit selected(QString::null); 343 emit selected(QString::null);
344} 344}
345 345
346void KAddressBookTableView::addresseeExecuted(QListViewItem *item) 346void KAddressBookTableView::addresseeExecuted(QListViewItem *item)
347{ 347{
348 if (item) 348 if (item)
349 { 349 {
350#ifndef KAB_EMBEDDED 350#ifndef KAB_EMBEDDED
351 ContactListViewItem *ceItem 351 ContactListViewItem *ceItem
352 = dynamic_cast<ContactListViewItem*>(item); 352 = dynamic_cast<ContactListViewItem*>(item);
353#else //KAB_EMBEDDED 353#else //KAB_EMBEDDED
354 ContactListViewItem *ceItem 354 ContactListViewItem *ceItem
355 = (ContactListViewItem*)(item); 355 = (ContactListViewItem*)(item);
356#endif //KAB_EMBEDDED 356#endif //KAB_EMBEDDED
357 357
358 if (ceItem) 358 if (ceItem)
359 { 359 {
360 emit executed(ceItem->addressee().uid()); 360 emit executed(ceItem->addressee().uid());
361 } 361 }
362 } 362 }
363 else 363 else
364 { 364 {
365 emit executed(QString::null); 365 emit executed(QString::null);
366 } 366 }
367} 367}
368 368
369void KAddressBookTableView::addresseeDeleted() 369void KAddressBookTableView::addresseeDeleted()
370{ 370{
371 371
372 emit deleteRequest(); 372 emit deleteRequest();
373 373
374} 374}
375 375
376 376
377 377
378 378
379 379
380#ifndef KAB_EMBEDDED 380#ifndef KAB_EMBEDDED
381#include "kaddressbooktableview.moc" 381#include "kaddressbooktableview.moc"
382#endif //KAB_EMBEDDED 382#endif //KAB_EMBEDDED