author | ulf69 <ulf69> | 2004-08-20 22:13:00 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-20 22:13:00 (UTC) |
commit | bc33238f8038a03e04f25ea608c53e784616fee6 (patch) (unidiff) | |
tree | 6b0ce40b7f05a62b26df5eca19f9fdf4cc2cffba /kaddressbook/views | |
parent | 0b6f4c58076a92ad81085db87358fab8666276d9 (diff) | |
download | kdepimpi-bc33238f8038a03e04f25ea608c53e784616fee6.zip kdepimpi-bc33238f8038a03e04f25ea608c53e784616fee6.tar.gz kdepimpi-bc33238f8038a03e04f25ea608c53e784616fee6.tar.bz2 |
performanceenhancements by removing unnecessary refreshs
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index ee2fcf8..8d2203e 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -81,7 +81,7 @@ void KAddressBookTableView::reconstructListView() | |||
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 | ||
@@ -103,7 +103,8 @@ void KAddressBookTableView::reconstructListView() | |||
103 | connect(mListView, SIGNAL(signalDelete()), | 103 | connect(mListView, SIGNAL(signalDelete()), |
104 | this, SLOT(addresseeDeleted())); | 104 | this, SLOT(addresseeDeleted())); |
105 | 105 | ||
106 | refresh(); | 106 | //US performceimprovement. Refresh is done from the outside |
107 | //US refresh(); | ||
107 | 108 | ||
108 | mListView->setSorting( 0, true ); | 109 | mListView->setSorting( 0, true ); |
109 | mainLayout->addWidget( mListView ); | 110 | mainLayout->addWidget( mListView ); |
@@ -148,18 +149,18 @@ void KAddressBookTableView::refresh(QString uid) | |||
148 | if (uid.isNull()) { | 149 | if (uid.isNull()) { |
149 | // Clear the list view | 150 | // Clear the list view |
150 | QString currentUID, nextUID; | 151 | QString currentUID, nextUID; |
151 | #ifndef KAB_EMBEDDED | 152 | #ifndef KAB_EMBEDDED |
152 | ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); | 153 | ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); |
153 | #else //KAB_EMBEDDED | 154 | #else //KAB_EMBEDDED |
154 | ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); | 155 | ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); |
155 | #endif //KAB_EMBEDDED | 156 | #endif //KAB_EMBEDDED |
156 | 157 | ||
157 | if ( currentItem ) { | 158 | if ( currentItem ) { |
158 | #ifndef KAB_EMBEDDED | 159 | #ifndef KAB_EMBEDDED |
159 | ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); | 160 | ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); |
160 | #else //KAB_EMBEDDED | 161 | #else //KAB_EMBEDDED |
161 | ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); | 162 | ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); |
162 | #endif //KAB_EMBEDDED | 163 | #endif //KAB_EMBEDDED |
163 | if ( nextItem ) | 164 | if ( nextItem ) |
164 | nextUID = nextItem->addressee().uid(); | 165 | nextUID = nextItem->addressee().uid(); |
165 | currentUID = currentItem->addressee().uid(); | 166 | currentUID = currentItem->addressee().uid(); |
@@ -191,12 +192,12 @@ void KAddressBookTableView::refresh(QString uid) | |||
191 | ContactListViewItem *ceItem; | 192 | ContactListViewItem *ceItem; |
192 | QListViewItemIterator it( mListView ); | 193 | QListViewItemIterator it( mListView ); |
193 | while ( it.current() ) { | 194 | while ( it.current() ) { |
194 | #ifndef KAB_EMBEDDED | 195 | #ifndef KAB_EMBEDDED |
195 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); | 196 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); |
196 | #else //KAB_EMBEDDED | 197 | #else //KAB_EMBEDDED |
197 | ceItem = (ContactListViewItem*)( it.current() ); | 198 | ceItem = (ContactListViewItem*)( it.current() ); |
198 | #endif //KAB_EMBEDDED | 199 | #endif //KAB_EMBEDDED |
199 | 200 | ||
200 | if ( ceItem && ceItem->addressee().uid() == uid ) { | 201 | if ( ceItem && ceItem->addressee().uid() == uid ) { |
201 | ceItem->refresh(); | 202 | ceItem->refresh(); |
202 | return; | 203 | return; |
@@ -218,12 +219,12 @@ QStringList KAddressBookTableView::selectedUids() | |||
218 | { | 219 | { |
219 | if (mListView->isSelected( item )) | 220 | if (mListView->isSelected( item )) |
220 | { | 221 | { |
221 | #ifndef KAB_EMBEDDED | 222 | #ifndef KAB_EMBEDDED |
222 | ceItem = dynamic_cast<ContactListViewItem*>(item); | 223 | ceItem = dynamic_cast<ContactListViewItem*>(item); |
223 | #else //KAB_EMBEDDED | 224 | #else //KAB_EMBEDDED |
224 | ceItem = (ContactListViewItem*)(item); | 225 | ceItem = (ContactListViewItem*)(item); |
225 | #endif //KAB_EMBEDDED | 226 | #endif //KAB_EMBEDDED |
226 | 227 | ||
227 | if (ceItem != 0L) | 228 | if (ceItem != 0L) |
228 | uidList << ceItem->addressee().uid(); | 229 | uidList << ceItem->addressee().uid(); |
229 | } | 230 | } |
@@ -233,7 +234,7 @@ QStringList KAddressBookTableView::selectedUids() | |||
233 | ceItem = (ContactListViewItem*)(mListView->currentItem()) ; | 234 | ceItem = (ContactListViewItem*)(mListView->currentItem()) ; |
234 | uidList << ceItem->addressee().uid(); | 235 | uidList << ceItem->addressee().uid(); |
235 | } | 236 | } |
236 | 237 | ||
237 | return uidList; | 238 | return uidList; |
238 | } | 239 | } |
239 | 240 | ||
@@ -250,13 +251,13 @@ void KAddressBookTableView::setSelected(QString uid, bool selected) | |||
250 | { | 251 | { |
251 | for(item = mListView->firstChild(); item; item = item->itemBelow()) | 252 | for(item = mListView->firstChild(); item; item = item->itemBelow()) |
252 | { | 253 | { |
253 | #ifndef KAB_EMBEDDED | 254 | #ifndef KAB_EMBEDDED |
254 | ceItem = dynamic_cast<ContactListViewItem*>(item); | 255 | ceItem = dynamic_cast<ContactListViewItem*>(item); |
255 | #else //KAB_EMBEDDED | 256 | #else //KAB_EMBEDDED |
256 | ceItem = (ContactListViewItem*)(item); | 257 | ceItem = (ContactListViewItem*)(item); |
257 | #endif //KAB_EMBEDDED | 258 | #endif //KAB_EMBEDDED |
258 | 259 | ||
259 | 260 | ||
260 | if ((ceItem != 0L) && (ceItem->addressee().uid() == uid)) | 261 | if ((ceItem != 0L) && (ceItem->addressee().uid() == uid)) |
261 | { | 262 | { |
262 | mListView->setSelected(item, selected); | 263 | mListView->setSelected(item, selected); |
@@ -282,14 +283,14 @@ void KAddressBookTableView::addresseeSelected() | |||
282 | if (item->isSelected()) | 283 | if (item->isSelected()) |
283 | { | 284 | { |
284 | found = true; | 285 | found = true; |
285 | #ifndef KAB_EMBEDDED | 286 | #ifndef KAB_EMBEDDED |
286 | ContactListViewItem *ceItem | 287 | ContactListViewItem *ceItem |
287 | = dynamic_cast<ContactListViewItem*>(item); | 288 | = dynamic_cast<ContactListViewItem*>(item); |
288 | #else //KAB_EMBEDDED | 289 | #else //KAB_EMBEDDED |
289 | ContactListViewItem *ceItem | 290 | ContactListViewItem *ceItem |
290 | = (ContactListViewItem*)(item); | 291 | = (ContactListViewItem*)(item); |
291 | #endif //KAB_EMBEDDED | 292 | #endif //KAB_EMBEDDED |
292 | 293 | ||
293 | if ( ceItem ) emit selected(ceItem->addressee().uid()); | 294 | if ( ceItem ) emit selected(ceItem->addressee().uid()); |
294 | } | 295 | } |
295 | } | 296 | } |
@@ -302,13 +303,13 @@ void KAddressBookTableView::addresseeExecuted(QListViewItem *item) | |||
302 | { | 303 | { |
303 | if (item) | 304 | if (item) |
304 | { | 305 | { |
305 | #ifndef KAB_EMBEDDED | 306 | #ifndef KAB_EMBEDDED |
306 | ContactListViewItem *ceItem | 307 | ContactListViewItem *ceItem |
307 | = dynamic_cast<ContactListViewItem*>(item); | 308 | = dynamic_cast<ContactListViewItem*>(item); |
308 | #else //KAB_EMBEDDED | 309 | #else //KAB_EMBEDDED |
309 | ContactListViewItem *ceItem | 310 | ContactListViewItem *ceItem |
310 | = (ContactListViewItem*)(item); | 311 | = (ContactListViewItem*)(item); |
311 | #endif //KAB_EMBEDDED | 312 | #endif //KAB_EMBEDDED |
312 | 313 | ||
313 | if (ceItem) | 314 | if (ceItem) |
314 | { | 315 | { |
@@ -323,9 +324,9 @@ void KAddressBookTableView::addresseeExecuted(QListViewItem *item) | |||
323 | 324 | ||
324 | void KAddressBookTableView::addresseeDeleted() | 325 | void KAddressBookTableView::addresseeDeleted() |
325 | { | 326 | { |
326 | 327 | ||
327 | emit deleteRequest(); | 328 | emit deleteRequest(); |
328 | 329 | ||
329 | } | 330 | } |
330 | 331 | ||
331 | 332 | ||