summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/kaddressbookcardview.cpp4
-rw-r--r--kaddressbook/views/kaddressbookiconview.cpp4
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp4
3 files changed, 6 insertions, 6 deletions
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp
index 6fcd73f..9d8c5ce 100644
--- a/kaddressbook/views/kaddressbookcardview.cpp
+++ b/kaddressbook/views/kaddressbookcardview.cpp
@@ -285,81 +285,81 @@ void KAddressBookCardView::readConfig(KConfig *config)
285#endif 285#endif
286 286
287 connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), 287 connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)),
288 this, SLOT(addresseeExecuted(CardViewItem *))); 288 this, SLOT(addresseeExecuted(CardViewItem *)));
289} 289}
290 290
291void KAddressBookCardView::writeConfig( KConfig *config ) 291void KAddressBookCardView::writeConfig( KConfig *config )
292{ 292{
293 config->writeEntry( "ItemWidth", mCardView->itemWidth() ); 293 config->writeEntry( "ItemWidth", mCardView->itemWidth() );
294 KAddressBookView::writeConfig( config ); 294 KAddressBookView::writeConfig( config );
295} 295}
296void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) 296void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field )
297{ 297{
298 mCardView->clear(); 298 mCardView->clear();
299 if ( s.isEmpty() || s == "*" ) { 299 if ( s.isEmpty() || s == "*" ) {
300 refresh(); 300 refresh();
301 return; 301 return;
302 } 302 }
303 QString pattern = s.lower()+"*"; 303 QString pattern = s.lower()+"*";
304 QRegExp re; 304 QRegExp re;
305 re.setWildcard(true); // most people understand these better. 305 re.setWildcard(true); // most people understand these better.
306 re.setCaseSensitive(false); 306 re.setCaseSensitive(false);
307 re.setPattern( pattern ); 307 re.setPattern( pattern );
308 if (!re.isValid()) 308 if (!re.isValid())
309 return; 309 return;
310 mCardView->viewport()->setUpdatesEnabled( false ); 310 mCardView->viewport()->setUpdatesEnabled( false );
311 KABC::Addressee::List addresseeList = addressees(); 311 KABC::Addressee::List addresseeList = addressees();
312 KABC::Addressee::List::Iterator it; 312 KABC::Addressee::List::Iterator it;
313 if ( field ) { 313 if ( field ) {
314 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 314 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
315 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 315 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
316 continue; 316 continue;
317#if QT_VERSION >= 300 317#if QT_VERSION >= 0x030000
318 if (re.search(field->value( *it ).lower()) != -1) 318 if (re.search(field->value( *it ).lower()) != -1)
319#else 319#else
320 if (re.match(field->value( *it ).lower()) != -1) 320 if (re.match(field->value( *it ).lower()) != -1)
321#endif 321#endif
322 new AddresseeCardViewItem(fields(), mShowEmptyFields, 322 new AddresseeCardViewItem(fields(), mShowEmptyFields,
323 addressBook(), *it, mCardView); 323 addressBook(), *it, mCardView);
324 324
325 } 325 }
326 } else { 326 } else {
327 KABC::Field::List fieldList = allFields(); 327 KABC::Field::List fieldList = allFields();
328 KABC::Field::List::ConstIterator fieldIt; 328 KABC::Field::List::ConstIterator fieldIt;
329 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 329 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
330 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 330 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
331 continue; 331 continue;
332 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 332 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
333#if QT_VERSION >= 300 333#if QT_VERSION >= 0x030000
334 if (re.search((*fieldIt)->value( *it ).lower()) != -1) 334 if (re.search((*fieldIt)->value( *it ).lower()) != -1)
335#else 335#else
336 if (re.match((*fieldIt)->value( *it ).lower()) != -1) 336 if (re.match((*fieldIt)->value( *it ).lower()) != -1)
337#endif 337#endif
338 { 338 {
339 new AddresseeCardViewItem(fields(), mShowEmptyFields, 339 new AddresseeCardViewItem(fields(), mShowEmptyFields,
340 addressBook(), *it, mCardView); 340 addressBook(), *it, mCardView);
341 break; 341 break;
342 } 342 }
343 } 343 }
344 } 344 }
345 } 345 }
346 mCardView->viewport()->setUpdatesEnabled( true ); 346 mCardView->viewport()->setUpdatesEnabled( true );
347 mCardView->viewport()->update(); 347 mCardView->viewport()->update();
348 if ( mCardView->firstItem() ) { 348 if ( mCardView->firstItem() ) {
349 mCardView->setCurrentItem ( mCardView->firstItem() ); 349 mCardView->setCurrentItem ( mCardView->firstItem() );
350 mCardView->setSelected ( mCardView->firstItem() , true ); 350 mCardView->setSelected ( mCardView->firstItem() , true );
351 } 351 }
352 else 352 else
353 emit selected(QString::null); 353 emit selected(QString::null);
354} 354}
355QStringList KAddressBookCardView::selectedUids() 355QStringList KAddressBookCardView::selectedUids()
356{ 356{
357 QStringList uidList; 357 QStringList uidList;
358 CardViewItem *item; 358 CardViewItem *item;
359 AddresseeCardViewItem *aItem; 359 AddresseeCardViewItem *aItem;
360 360
361 for (item = mCardView->firstItem(); item; item = item->nextItem()) 361 for (item = mCardView->firstItem(); item; item = item->nextItem())
362 { 362 {
363 if (item->isSelected()) 363 if (item->isSelected())
364 { 364 {
365#ifndef KAB_EMBEDDED 365#ifndef KAB_EMBEDDED
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp
index ef0a23a..fb53215 100644
--- a/kaddressbook/views/kaddressbookiconview.cpp
+++ b/kaddressbook/views/kaddressbookiconview.cpp
@@ -243,81 +243,81 @@ void KAddressBookIconView::readConfig(KConfig *config)
243 if (KABPrefs::instance()->mHonorSingleClick) 243 if (KABPrefs::instance()->mHonorSingleClick)
244 connect(mIconView, SIGNAL(executed(QIconViewItem *)), 244 connect(mIconView, SIGNAL(executed(QIconViewItem *)),
245 this, SLOT(addresseeExecuted(QIconViewItem *))); 245 this, SLOT(addresseeExecuted(QIconViewItem *)));
246 else 246 else
247 connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), 247 connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)),
248 this, SLOT(addresseeExecuted(QIconViewItem *))); 248 this, SLOT(addresseeExecuted(QIconViewItem *)));
249*/ 249*/
250 connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), 250 connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)),
251 this, SLOT(addresseeExecuted(QIconViewItem *))); 251 this, SLOT(addresseeExecuted(QIconViewItem *)));
252 252
253} 253}
254void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) 254void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field )
255{ 255{
256 mIconView->clear(); 256 mIconView->clear();
257 mIconList.clear(); 257 mIconList.clear();
258 if ( s.isEmpty() || s == "*" ) { 258 if ( s.isEmpty() || s == "*" ) {
259 refresh(); 259 refresh();
260 return; 260 return;
261 } 261 }
262 QString pattern = s.lower()+"*"; 262 QString pattern = s.lower()+"*";
263 QRegExp re; 263 QRegExp re;
264 re.setWildcard(true); // most people understand these better. 264 re.setWildcard(true); // most people understand these better.
265 re.setCaseSensitive(false); 265 re.setCaseSensitive(false);
266 re.setPattern( pattern ); 266 re.setPattern( pattern );
267 if (!re.isValid()) 267 if (!re.isValid())
268 return; 268 return;
269 KABC::Addressee::List addresseeList = addressees(); 269 KABC::Addressee::List addresseeList = addressees();
270 KABC::Addressee::List::Iterator it; 270 KABC::Addressee::List::Iterator it;
271 if ( field ) { 271 if ( field ) {
272 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 272 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
273 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 273 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
274 continue; 274 continue;
275#if QT_VERSION >= 300 275#if QT_VERSION >= 0x030000
276 if (re.search(field->value( *it ).lower()) != -1) 276 if (re.search(field->value( *it ).lower()) != -1)
277#else 277#else
278 if (re.match(field->value( *it ).lower()) != -1) 278 if (re.match(field->value( *it ).lower()) != -1)
279#endif 279#endif
280 mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); 280 mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
281 281
282 282
283 } 283 }
284 } else { 284 } else {
285 KABC::Field::List fieldList = allFields(); 285 KABC::Field::List fieldList = allFields();
286 KABC::Field::List::ConstIterator fieldIt; 286 KABC::Field::List::ConstIterator fieldIt;
287 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 287 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
288 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 288 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
289 continue; 289 continue;
290 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 290 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
291#if QT_VERSION >= 300 291#if QT_VERSION >= 0x030000
292 if (re.search((*fieldIt)->value( *it ).lower()) != -1) 292 if (re.search((*fieldIt)->value( *it ).lower()) != -1)
293#else 293#else
294 if (re.match((*fieldIt)->value( *it ).lower()) != -1) 294 if (re.match((*fieldIt)->value( *it ).lower()) != -1)
295#endif 295#endif
296 { 296 {
297 mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); 297 mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
298 break; 298 break;
299 } 299 }
300 } 300 }
301 } 301 }
302 } 302 }
303 mIconView->arrangeItemsInGrid( true ); 303 mIconView->arrangeItemsInGrid( true );
304 if ( mIconView->firstItem() ) { 304 if ( mIconView->firstItem() ) {
305 mIconView->setCurrentItem ( mIconView->firstItem() ); 305 mIconView->setCurrentItem ( mIconView->firstItem() );
306 mIconView->setSelected ( mIconView->firstItem() , true ); 306 mIconView->setSelected ( mIconView->firstItem() , true );
307 } 307 }
308 else 308 else
309 emit selected(QString::null); 309 emit selected(QString::null);
310} 310}
311QStringList KAddressBookIconView::selectedUids() 311QStringList KAddressBookIconView::selectedUids()
312{ 312{
313 QStringList uidList; 313 QStringList uidList;
314 QIconViewItem *item; 314 QIconViewItem *item;
315 AddresseeIconViewItem *aItem; 315 AddresseeIconViewItem *aItem;
316 316
317 for (item = mIconView->firstItem(); item; item = item->nextItem()) 317 for (item = mIconView->firstItem(); item; item = item->nextItem())
318 { 318 {
319 if (item->isSelected()) 319 if (item->isSelected())
320 { 320 {
321#ifndef KAB_EMBEDDED 321#ifndef KAB_EMBEDDED
322 aItem = dynamic_cast<AddresseeIconViewItem*>(item); 322 aItem = dynamic_cast<AddresseeIconViewItem*>(item);
323#else //KAB_EMBEDDED 323#else //KAB_EMBEDDED
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp
index 7022dcb..69802a4 100644
--- a/kaddressbook/views/kaddressbooktableview.cpp
+++ b/kaddressbook/views/kaddressbooktableview.cpp
@@ -127,80 +127,80 @@ void KAddressBookTableView::reconstructListView()
127 connect(mListView, SIGNAL(signalDelete()), 127 connect(mListView, SIGNAL(signalDelete()),
128 this, SLOT(addresseeDeleted())); 128 this, SLOT(addresseeDeleted()));
129 129
130//US performceimprovement. Refresh is done from the outside 130//US performceimprovement. Refresh is done from the outside
131//US refresh(); 131//US refresh();
132 132
133 mListView->setSorting( 0, true ); 133 mListView->setSorting( 0, true );
134 mainLayout->addWidget( mListView ); 134 mainLayout->addWidget( mListView );
135 mainLayout->activate(); 135 mainLayout->activate();
136 mListView->show(); 136 mListView->show();
137} 137}
138 138
139void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) 139void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field )
140{ 140{
141 mListView->clear(); 141 mListView->clear();
142 if ( s.isEmpty() || s == "*" ) { 142 if ( s.isEmpty() || s == "*" ) {
143 refresh(); 143 refresh();
144 return; 144 return;
145 } 145 }
146 QString pattern = s.lower()+"*"; 146 QString pattern = s.lower()+"*";
147 QRegExp re; 147 QRegExp re;
148 re.setWildcard(true); // most people understand these better. 148 re.setWildcard(true); // most people understand these better.
149 re.setCaseSensitive(false); 149 re.setCaseSensitive(false);
150 re.setPattern( pattern ); 150 re.setPattern( pattern );
151 if (!re.isValid()) 151 if (!re.isValid())
152 return; 152 return;
153 KABC::Addressee::List addresseeList = addressees(); 153 KABC::Addressee::List addresseeList = addressees();
154 KABC::Addressee::List::Iterator it; 154 KABC::Addressee::List::Iterator it;
155 if ( field ) { 155 if ( field ) {
156 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 156 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
157 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 157 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
158 continue; 158 continue;
159#if QT_VERSION >= 300 159#if QT_VERSION >= 0x030000
160 if (re.search(field->value( *it ).lower()) == 0) 160 if (re.search(field->value( *it ).lower()) == 0)
161#else 161#else
162 if (re.match(field->value( *it ).lower()) != -1) 162 if (re.match(field->value( *it ).lower()) != -1)
163#endif 163#endif
164 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); 164 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
165 165
166 } 166 }
167 } else { 167 } else {
168 KABC::Field::List fieldList = allFields(); 168 KABC::Field::List fieldList = allFields();
169 KABC::Field::List::ConstIterator fieldIt; 169 KABC::Field::List::ConstIterator fieldIt;
170 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 170 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
171 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 171 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
172 continue; 172 continue;
173 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 173 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
174#if QT_VERSION >= 300 174#if QT_VERSION >= 0x030000
175 if (re.search((*fieldIt)->value( *it ).lower()) != -1) 175 if (re.search((*fieldIt)->value( *it ).lower()) != -1)
176#else 176#else
177 if (re.match((*fieldIt)->value( *it ).lower()) != -1) 177 if (re.match((*fieldIt)->value( *it ).lower()) != -1)
178#endif 178#endif
179 { 179 {
180 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); 180 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
181 break; 181 break;
182 } 182 }
183 } 183 }
184 } 184 }
185 } 185 }
186 // Sometimes the background pixmap gets messed up when we add lots 186 // Sometimes the background pixmap gets messed up when we add lots
187 // of items. 187 // of items.
188 mListView->repaint(); 188 mListView->repaint();
189 if ( mListView->firstChild() ) { 189 if ( mListView->firstChild() ) {
190 mListView->setCurrentItem ( mListView->firstChild() ); 190 mListView->setCurrentItem ( mListView->firstChild() );
191 mListView->setSelected ( mListView->firstChild(), true ); 191 mListView->setSelected ( mListView->firstChild(), true );
192 } 192 }
193 else 193 else
194 emit selected(QString::null); 194 emit selected(QString::null);
195 195
196} 196}
197void KAddressBookTableView::writeConfig(KConfig *config) 197void KAddressBookTableView::writeConfig(KConfig *config)
198{ 198{
199 KAddressBookView::writeConfig(config); 199 KAddressBookView::writeConfig(config);
200 200
201 mListView->saveLayout(config, config->group()); 201 mListView->saveLayout(config, config->group());
202} 202}
203 203
204void KAddressBookTableView::readConfig(KConfig *config) 204void KAddressBookTableView::readConfig(KConfig *config)
205{ 205{
206 KAddressBookView::readConfig( config ); 206 KAddressBookView::readConfig( config );