Diffstat (limited to 'kaddressbook/views/kaddressbookcardview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 4babf67..a7bf6c9 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -18,24 +18,25 @@ | |||
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 | #include <qdragobject.h> | 24 | #include <qdragobject.h> |
25 | #include <qevent.h> | 25 | #include <qevent.h> |
26 | #include <qiconview.h> | 26 | #include <qiconview.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | #include <qapplication.h> | ||
30 | 31 | ||
31 | #include <kabc/addressbook.h> | 32 | #include <kabc/addressbook.h> |
32 | #include <kabc/addressee.h> | 33 | #include <kabc/addressee.h> |
33 | #include <kconfig.h> | 34 | #include <kconfig.h> |
34 | #include <kdebug.h> | 35 | #include <kdebug.h> |
35 | #include <klocale.h> | 36 | #include <klocale.h> |
36 | 37 | ||
37 | #include "kabprefs.h" | 38 | #include "kabprefs.h" |
38 | #include "viewmanager.h" | 39 | #include "viewmanager.h" |
39 | 40 | ||
40 | #include "kaddressbookcardview.h" | 41 | #include "kaddressbookcardview.h" |
41 | 42 | ||
@@ -160,24 +161,35 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, | |||
160 | connect(mCardView, SIGNAL(selectionChanged()), | 161 | connect(mCardView, SIGNAL(selectionChanged()), |
161 | this, SLOT(addresseeSelected())); | 162 | this, SLOT(addresseeSelected())); |
162 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), | 163 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), |
163 | this, SIGNAL(dropped(QDropEvent*))); | 164 | this, SIGNAL(dropped(QDropEvent*))); |
164 | connect(mCardView, SIGNAL(startAddresseeDrag()), | 165 | connect(mCardView, SIGNAL(startAddresseeDrag()), |
165 | this, SIGNAL(startDrag())); | 166 | this, SIGNAL(startDrag())); |
166 | } | 167 | } |
167 | 168 | ||
168 | KAddressBookCardView::~KAddressBookCardView() | 169 | KAddressBookCardView::~KAddressBookCardView() |
169 | { | 170 | { |
170 | } | 171 | } |
171 | 172 | ||
173 | void KAddressBookCardView::scrollUP() | ||
174 | { | ||
175 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | ||
176 | QApplication::postEvent( mCardView, ev ); | ||
177 | |||
178 | } | ||
179 | void KAddressBookCardView::scrollDOWN() | ||
180 | { | ||
181 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | ||
182 | QApplication::postEvent( mCardView, ev ); | ||
183 | } | ||
172 | void KAddressBookCardView::readConfig(KConfig *config) | 184 | void KAddressBookCardView::readConfig(KConfig *config) |
173 | { | 185 | { |
174 | KAddressBookView::readConfig(config); | 186 | KAddressBookView::readConfig(config); |
175 | 187 | ||
176 | // costum colors? | 188 | // costum colors? |
177 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) | 189 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) |
178 | { | 190 | { |
179 | QPalette p( mCardView->palette() ); | 191 | QPalette p( mCardView->palette() ); |
180 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); | 192 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); |
181 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); | 193 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); |
182 | c = p.color(QPalette::Normal, QColorGroup::Text ); | 194 | c = p.color(QPalette::Normal, QColorGroup::Text ); |
183 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); | 195 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); |
@@ -281,25 +293,29 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) | |||
281 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 293 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
282 | #endif | 294 | #endif |
283 | { | 295 | { |
284 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | 296 | new AddresseeCardViewItem(fields(), mShowEmptyFields, |
285 | addressBook(), *it, mCardView); | 297 | addressBook(), *it, mCardView); |
286 | continue; | 298 | continue; |
287 | } | 299 | } |
288 | } | 300 | } |
289 | } | 301 | } |
290 | } | 302 | } |
291 | mCardView->viewport()->setUpdatesEnabled( true ); | 303 | mCardView->viewport()->setUpdatesEnabled( true ); |
292 | mCardView->viewport()->update(); | 304 | mCardView->viewport()->update(); |
293 | // by default nothing is selected | 305 | if ( mCardView->firstItem() ) { |
306 | mCardView->setCurrentItem ( mCardView->firstItem() ); | ||
307 | mCardView->setSelected ( mCardView->firstItem() , true ); | ||
308 | } | ||
309 | else | ||
294 | emit selected(QString::null); | 310 | emit selected(QString::null); |
295 | } | 311 | } |
296 | QStringList KAddressBookCardView::selectedUids() | 312 | QStringList KAddressBookCardView::selectedUids() |
297 | { | 313 | { |
298 | QStringList uidList; | 314 | QStringList uidList; |
299 | CardViewItem *item; | 315 | CardViewItem *item; |
300 | AddresseeCardViewItem *aItem; | 316 | AddresseeCardViewItem *aItem; |
301 | 317 | ||
302 | for (item = mCardView->firstItem(); item; item = item->nextItem()) | 318 | for (item = mCardView->firstItem(); item; item = item->nextItem()) |
303 | { | 319 | { |
304 | if (item->isSelected()) | 320 | if (item->isSelected()) |
305 | { | 321 | { |