author | zautrix <zautrix> | 2004-10-29 10:53:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-29 10:53:31 (UTC) |
commit | 67146a3d92727f6fe3e92eacdb51da58bc7b0adf (patch) (side-by-side diff) | |
tree | 140ab8d70bab73ca75aae64c4d2fdfccd73b388a /kaddressbook/views/kaddressbookcardview.cpp | |
parent | d96b4fd7188145c49120dd159b0ac00c987f4972 (diff) | |
download | kdepimpi-67146a3d92727f6fe3e92eacdb51da58bc7b0adf.zip kdepimpi-67146a3d92727f6fe3e92eacdb51da58bc7b0adf.tar.gz kdepimpi-67146a3d92727f6fe3e92eacdb51da58bc7b0adf.tar.bz2 |
fixed single click in cardview
Diffstat (limited to 'kaddressbook/views/kaddressbookcardview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 7f33bb4..15f154e 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp @@ -149,202 +149,207 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, mShowEmptyFields = false; // Init the GUI QVBoxLayout *layout = new QVBoxLayout(viewWidget()); mCardView = new AddresseeCardView(viewWidget(), "mCardView"); mCardView->setSelectionMode(CardView::Extended); layout->addWidget(mCardView); // Connect up the signals connect(mCardView, SIGNAL(executed(CardViewItem *)), this, SLOT(addresseeExecuted(CardViewItem *))); connect(mCardView, SIGNAL(selectionChanged()), this, SLOT(addresseeSelected())); connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), this, SIGNAL(dropped(QDropEvent*))); connect(mCardView, SIGNAL(startAddresseeDrag()), this, SIGNAL(startDrag())); } KAddressBookCardView::~KAddressBookCardView() { } void KAddressBookCardView::setFocusAV() { if ( mCardView ) mCardView->setFocus(); } void KAddressBookCardView::scrollUP() { QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); QApplication::postEvent( mCardView, ev ); } void KAddressBookCardView::scrollDOWN() { QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); QApplication::postEvent( mCardView, ev ); } void KAddressBookCardView::readConfig(KConfig *config) { KAddressBookView::readConfig(config); // costum colors? if ( config->readBoolEntry( "EnableCustomColors", false ) ) { QPalette p( mCardView->palette() ); QColor c = p.color(QPalette::Normal, QColorGroup::Base ); p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); c = p.color(QPalette::Normal, QColorGroup::Text ); p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); c = p.color(QPalette::Normal, QColorGroup::Button ); p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); c = p.color(QPalette::Normal, QColorGroup::ButtonText ); p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); c = p.color(QPalette::Normal, QColorGroup::Highlight ); p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); mCardView->viewport()->setPalette( p ); } else { // needed if turned off during a session. mCardView->viewport()->setPalette( mCardView->palette() ); } //custom fonts? QFont f( font() ); if ( config->readBoolEntry( "EnableCustomFonts", false ) ) { mCardView->setFont( config->readFontEntry( "TextFont", &f) ); f.setBold( true ); mCardView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); } else { mCardView->setFont( f ); f.setBold( true ); mCardView->setHeaderFont( f ); } mCardView->setDrawCardBorder(config->readBoolEntry("DrawBorder", true)); mCardView->setDrawColSeparators(config->readBoolEntry("DrawSeparators", true)); mCardView->setDrawFieldLabels(config->readBoolEntry("DrawFieldLabels",false)); mShowEmptyFields = config->readBoolEntry("ShowEmptyFields", false); mCardView->setShowEmptyFields( mShowEmptyFields ); mCardView->setItemWidth( config->readNumEntry( "ItemWidth", 200 ) ); mCardView->setItemMargin( config->readNumEntry( "ItemMargin", 0 ) ); mCardView->setItemSpacing( config->readNumEntry( "ItemSpacing", 10 ) ); mCardView->setSeparatorWidth( config->readNumEntry( "SeparatorWidth", 2 ) ); +#if 0 + // LR KABPrefs::instance()->mHonorSingleClick is handled and fixed in cardviews contentsMouseDoubleClickEven disconnect(mCardView, SIGNAL(executed(CardViewItem *)), this, SLOT(addresseeExecuted(CardViewItem *))); if (KABPrefs::instance()->mHonorSingleClick) connect(mCardView, SIGNAL(executed(CardViewItem *)), this, SLOT(addresseeExecuted(CardViewItem *))); else connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), this, SLOT(addresseeExecuted(CardViewItem *))); +#endif + connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), + this, SLOT(addresseeExecuted(CardViewItem *))); } void KAddressBookCardView::writeConfig( KConfig *config ) { config->writeEntry( "ItemWidth", mCardView->itemWidth() ); KAddressBookView::writeConfig( config ); } void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) { mCardView->clear(); if ( s.isEmpty() || s == "*" ) { refresh(); return; } QString pattern = s.lower()+"*"; QRegExp re; re.setWildcard(true); // most people understand these better. re.setCaseSensitive(false); re.setPattern( pattern ); if (!re.isValid()) return; mCardView->viewport()->setUpdatesEnabled( false ); KABC::Addressee::List addresseeList = addressees(); KABC::Addressee::List::Iterator it; if ( field ) { for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { #if QT_VERSION >= 300 if (re.search(field->value( *it ).lower()) != -1) #else if (re.match(field->value( *it ).lower()) != -1) #endif new AddresseeCardViewItem(fields(), mShowEmptyFields, addressBook(), *it, mCardView); } } else { KABC::Field::List fieldList = fields(); KABC::Field::List::ConstIterator fieldIt; for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { #if QT_VERSION >= 300 if (re.search((*fieldIt)->value( *it ).lower()) != -1) #else if (re.match((*fieldIt)->value( *it ).lower()) != -1) #endif { new AddresseeCardViewItem(fields(), mShowEmptyFields, addressBook(), *it, mCardView); continue; } } } } mCardView->viewport()->setUpdatesEnabled( true ); mCardView->viewport()->update(); if ( mCardView->firstItem() ) { mCardView->setCurrentItem ( mCardView->firstItem() ); mCardView->setSelected ( mCardView->firstItem() , true ); } else emit selected(QString::null); } QStringList KAddressBookCardView::selectedUids() { QStringList uidList; CardViewItem *item; AddresseeCardViewItem *aItem; for (item = mCardView->firstItem(); item; item = item->nextItem()) { if (item->isSelected()) { #ifndef KAB_EMBEDDED aItem = dynamic_cast<AddresseeCardViewItem*>(item); #else //KAB_EMBEDDED aItem = (AddresseeCardViewItem*)(item); #endif //KAB_EMBEDDED if (aItem) uidList << aItem->addressee().uid(); } } return uidList; } void KAddressBookCardView::refresh(QString uid) { CardViewItem *item; AddresseeCardViewItem *aItem; if (uid.isNull()) { // Rebuild the view mCardView->viewport()->setUpdatesEnabled( false ); mCardView->clear(); |