Hi,
  I saw a recent commit:

> the contactlist should have focus per default rather then the search-lineedit 
> like at KDE3, right?!


  Can I suggest, instead, that the search lineedit does have focus,
but that the up,down and enter keys get passed through to the contact
list.  This allows you to quickly filter and select context with the
keyboard.

  I have added a similar ability to ktreewidgetsearchline and
klistwidgetsearchline.  It's also used in ksysguard, if you want to
see what it is like.

  Codewise, you just override the event method for the search line, or
install an event filter if you don't subclass.

  Here's the code used in kde/kdelibs/kdeui/itemviews/ktreewidgetsearchline.cpp


bool KTreeWidgetSearchLine::event(QEvent *event) {

        if (event->type() == QEvent::KeyPress) {
                QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
                if(keyEvent->matches(QKeySequence::MoveToNextLine) ||
keyEvent->matches(QKeySequence::SelectNextLine) ||
                   keyEvent->matches(QKeySequence::MoveToPreviousLine)
|| keyEvent->matches(QKeySequence::SelectPreviousLine) ||
                   keyEvent->matches(QKeySequence::MoveToNextPage) ||
keyEvent->matches(QKeySequence::SelectNextPage) ||
                   keyEvent->matches(QKeySequence::MoveToPreviousPage)
||  keyEvent->matches(QKeySequence::SelectPreviousPage) ||
                   keyEvent->key() == Qt::Key_Enter || keyEvent->key()
== Qt::Key_Return)
                {
                        QTreeWidget *first = d->treeWidgets.first();
                        if(first) {
                                QApplication::sendEvent(first, event);
                                return true;
                        }
                }
        }
        return KLineEdit::event(event);
}
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to