mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
06bc6029f2
commit
ac18995bdf
@ -23,7 +23,7 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QItemDelegate>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
#include "ForumsDialog.h"
|
#include "ForumsDialog.h"
|
||||||
#include "forums/CreateForum.h"
|
#include "forums/CreateForum.h"
|
||||||
@ -208,6 +208,8 @@ ForumsDialog::ForumsDialog(QWidget *parent)
|
|||||||
|
|
||||||
insertThreads();
|
insertThreads();
|
||||||
|
|
||||||
|
ui.threadTreeWidget->installEventFilter(this);
|
||||||
|
|
||||||
/* Hide platform specific features */
|
/* Hide platform specific features */
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
|
||||||
@ -399,6 +401,23 @@ void ForumsDialog::threadListCustomPopupMenu( QPoint point )
|
|||||||
contextMnu.exec(QCursor::pos());
|
contextMnu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ForumsDialog::eventFilter(QObject *obj, QEvent *event)
|
||||||
|
{
|
||||||
|
if (obj == ui.threadTreeWidget) {
|
||||||
|
if (event->type() == QEvent::KeyPress) {
|
||||||
|
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
|
||||||
|
if (keyEvent && keyEvent->key() == Qt::Key_Space) {
|
||||||
|
// Space pressed
|
||||||
|
QTreeWidgetItem *item = ui.threadTreeWidget->currentItem ();
|
||||||
|
clickedThread (item, COLUMN_THREAD_READ);
|
||||||
|
return true; // eat event
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// pass the event on to the parent class
|
||||||
|
return RsAutoUpdatePage::eventFilter(obj, event);
|
||||||
|
}
|
||||||
|
|
||||||
void ForumsDialog::restoreForumKeys(void)
|
void ForumsDialog::restoreForumKeys(void)
|
||||||
{
|
{
|
||||||
rsForums->forumRestoreKeys(mCurrForumId);
|
rsForums->forumRestoreKeys(mCurrForumId);
|
||||||
|
@ -41,6 +41,9 @@ public:
|
|||||||
/* overloaded from RsAuthUpdatePage */
|
/* overloaded from RsAuthUpdatePage */
|
||||||
virtual void updateDisplay();
|
virtual void updateDisplay();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool eventFilter(QObject *obj, QEvent *ev);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/** Create the context popup menu and it's submenus */
|
/** Create the context popup menu and it's submenus */
|
||||||
void forumListCustomPopupMenu( QPoint point );
|
void forumListCustomPopupMenu( QPoint point );
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#include <QItemDelegate>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
@ -371,6 +370,8 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
|||||||
timer->setSingleShot(true);
|
timer->setSingleShot(true);
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(updateCurrentMessage()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(updateCurrentMessage()));
|
||||||
|
|
||||||
|
ui.messagestreeView->installEventFilter(this);
|
||||||
|
|
||||||
/* Hide platform specific features */
|
/* Hide platform specific features */
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
|
||||||
@ -439,6 +440,24 @@ void MessagesDialog::processSettings(bool bLoad)
|
|||||||
m_bProcessSettings = false;
|
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()
|
void MessagesDialog::fillTags()
|
||||||
{
|
{
|
||||||
MsgTagType Tags;
|
MsgTagType Tags;
|
||||||
|
@ -48,6 +48,9 @@ public:
|
|||||||
// replaced by shortcut
|
// replaced by shortcut
|
||||||
// virtual void keyPressEvent(QKeyEvent *) ;
|
// virtual void keyPressEvent(QKeyEvent *) ;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool eventFilter(QObject *obj, QEvent *ev);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void insertMessages();
|
void insertMessages();
|
||||||
void messagesTagsChanged();
|
void messagesTagsChanged();
|
||||||
|
Loading…
Reference in New Issue
Block a user