author | zautrix <zautrix> | 2004-10-10 23:26:49 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-10 23:26:49 (UTC) |
commit | ea40295e233db219dc2431960e18fb4398ddb75c (patch) (unidiff) | |
tree | 1d654ae51d7f65f4375787105951a8f4f9fc359e /kaddressbook/views/kaddressbookiconview.cpp | |
parent | 640874bb21ea348edb33a54690ad225e0efdd1e4 (diff) | |
download | kdepimpi-ea40295e233db219dc2431960e18fb4398ddb75c.zip kdepimpi-ea40295e233db219dc2431960e18fb4398ddb75c.tar.gz kdepimpi-ea40295e233db219dc2431960e18fb4398ddb75c.tar.bz2 |
added better searching in kapi
Diffstat (limited to 'kaddressbook/views/kaddressbookiconview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index fdc0db9..f4c68b8 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp | |||
@@ -32,24 +32,25 @@ | |||
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 | #include <kabc/addressbook.h> | 38 | #include <kabc/addressbook.h> |
39 | #include "kabprefs.h" | 39 | #include "kabprefs.h" |
40 | #include "viewmanager.h" | 40 | #include "viewmanager.h" |
41 | #include "kaddressbookiconview.h" | 41 | #include "kaddressbookiconview.h" |
42 | #include <qlayout.h> | 42 | #include <qlayout.h> |
43 | #include <qregexp.h> | 43 | #include <qregexp.h> |
44 | #include <qapplication.h> | ||
44 | #include <kglobal.h> | 45 | #include <kglobal.h> |
45 | /*US transfered to the headerfile | 46 | /*US transfered to the headerfile |
46 | class IconViewFactory : public ViewFactory | 47 | class IconViewFactory : public ViewFactory |
47 | { | 48 | { |
48 | public: | 49 | public: |
49 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) | 50 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) |
50 | { | 51 | { |
51 | return new KAddressBookIconView( ab, parent, name ); | 52 | return new KAddressBookIconView( ab, parent, name ); |
52 | } | 53 | } |
53 | 54 | ||
54 | QString type() const { return "Icon"; } | 55 | QString type() const { return "Icon"; } |
55 | 56 | ||
@@ -202,24 +203,34 @@ KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, | |||
202 | connect(mIconView, SIGNAL(selectionChanged()), | 203 | connect(mIconView, SIGNAL(selectionChanged()), |
203 | this, SLOT(addresseeSelected())); | 204 | this, SLOT(addresseeSelected())); |
204 | connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), | 205 | connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), |
205 | this, SIGNAL(dropped(QDropEvent*))); | 206 | this, SIGNAL(dropped(QDropEvent*))); |
206 | connect(mIconView, SIGNAL(startAddresseeDrag()), | 207 | connect(mIconView, SIGNAL(startAddresseeDrag()), |
207 | this, SIGNAL(startDrag())); | 208 | this, SIGNAL(startDrag())); |
208 | } | 209 | } |
209 | 210 | ||
210 | KAddressBookIconView::~KAddressBookIconView() | 211 | KAddressBookIconView::~KAddressBookIconView() |
211 | { | 212 | { |
212 | } | 213 | } |
213 | 214 | ||
215 | void KAddressBookIconView::scrollUP() | ||
216 | { | ||
217 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | ||
218 | QApplication::postEvent( mIconView, ev ); | ||
219 | } | ||
220 | void KAddressBookIconView::scrollDOWN() | ||
221 | { | ||
222 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | ||
223 | QApplication::postEvent( mIconView, ev ); | ||
224 | } | ||
214 | void KAddressBookIconView::readConfig(KConfig *config) | 225 | void KAddressBookIconView::readConfig(KConfig *config) |
215 | { | 226 | { |
216 | KAddressBookView::readConfig(config); | 227 | KAddressBookView::readConfig(config); |
217 | 228 | ||
218 | //US method executed is part of KIconView | 229 | //US method executed is part of KIconView |
219 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), | 230 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), |
220 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); | 231 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); |
221 | disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 232 | disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
222 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 233 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
223 | 234 | ||
224 | //US method executed is part of KIconView. Use selectionChanged instead | 235 | //US method executed is part of KIconView. Use selectionChanged instead |
225 | /*US | 236 | /*US |
@@ -271,24 +282,30 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) | |||
271 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 282 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
272 | #else | 283 | #else |
273 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 284 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
274 | #endif | 285 | #endif |
275 | { | 286 | { |
276 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | 287 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); |
277 | continue; | 288 | continue; |
278 | } | 289 | } |
279 | } | 290 | } |
280 | } | 291 | } |
281 | } | 292 | } |
282 | mIconView->arrangeItemsInGrid( true ); | 293 | mIconView->arrangeItemsInGrid( true ); |
294 | if ( mIconView->firstItem() ) { | ||
295 | mIconView->setCurrentItem ( mIconView->firstItem() ); | ||
296 | mIconView->setSelected ( mIconView->firstItem() , true ); | ||
297 | } | ||
298 | else | ||
299 | emit selected(QString::null); | ||
283 | } | 300 | } |
284 | QStringList KAddressBookIconView::selectedUids() | 301 | QStringList KAddressBookIconView::selectedUids() |
285 | { | 302 | { |
286 | QStringList uidList; | 303 | QStringList uidList; |
287 | QIconViewItem *item; | 304 | QIconViewItem *item; |
288 | AddresseeIconViewItem *aItem; | 305 | AddresseeIconViewItem *aItem; |
289 | 306 | ||
290 | for (item = mIconView->firstItem(); item; item = item->nextItem()) | 307 | for (item = mIconView->firstItem(); item; item = item->nextItem()) |
291 | { | 308 | { |
292 | if (item->isSelected()) | 309 | if (item->isSelected()) |
293 | { | 310 | { |
294 | #ifndef KAB_EMBEDDED | 311 | #ifndef KAB_EMBEDDED |