Enabled space to switch the read state in MessagesDialog and ForumsDialog.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4183 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2011-05-02 21:50:20 +00:00
parent 06bc6029f2
commit ac18995bdf
4 changed files with 46 additions and 2 deletions

View file

@ -19,7 +19,6 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QItemDelegate>
#include <QMessageBox>
#include <QPainter>
#include <QPaintEvent>
@ -371,6 +370,8 @@ MessagesDialog::MessagesDialog(QWidget *parent)
timer->setSingleShot(true);
connect(timer, SIGNAL(timeout()), this, SLOT(updateCurrentMessage()));
ui.messagestreeView->installEventFilter(this);
/* Hide platform specific features */
#ifdef Q_WS_WIN
@ -439,6 +440,24 @@ void MessagesDialog::processSettings(bool bLoad)
m_bProcessSettings = false;
}
bool MessagesDialog::eventFilter(QObject *obj, QEvent *event)
{
if (obj == ui.messagestreeView) {
if (event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
if (keyEvent && keyEvent->key() == Qt::Key_Space) {
// Space pressed
QModelIndex currentIndex = ui.messagestreeView->currentIndex();
QModelIndex index = ui.messagestreeView->model()->index(currentIndex.row(), COLUMN_UNREAD, currentIndex.parent());
clicked(index);
return true; // eat event
}
}
}
// pass the event on to the parent class
return MainPage::eventFilter(obj, event);
}
void MessagesDialog::fillTags()
{
MsgTagType Tags;