-rw-r--r-- | core/pim/todo/mainwindow.cpp | 5 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 2 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 13 | ||||
-rw-r--r-- | core/pim/todo/tableview.h | 1 | ||||
-rw-r--r-- | core/pim/todo/textviewshow.cpp | 17 | ||||
-rw-r--r-- | core/pim/todo/textviewshow.h | 5 | ||||
-rw-r--r-- | core/pim/todo/todoshow.cpp | 9 | ||||
-rw-r--r-- | core/pim/todo/todoshow.h | 7 |
8 files changed, 52 insertions, 7 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index c90166b..d328558 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp @@ -253,3 +253,3 @@ void MainWindow::initEditor() { void MainWindow::initShow() { - m_curShow = new TextViewShow(this); + m_curShow = new TextViewShow(this, this); m_stack->addWidget( m_curShow->widget() , m_counter++ ); @@ -815 +815,4 @@ void MainWindow::add( const OPimRecord& rec) { } +void MainWindow::slotReturnFromView() { + raiseCurrentView(); +} diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index d756d64..f880505 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h @@ -62,2 +62,3 @@ namespace Todo { friend class TodoView; // avoid QObject here.... + friend class TodoShow; // avoid QObject public: @@ -185,2 +186,3 @@ private slots: void slotShowDue( bool ); + void slotReturnFromView(); // for TodoShow... /* reimplementation from opimmainwindow */ diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 61d1edd..cec8b5e 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp @@ -471,3 +471,3 @@ void TableView::slotPriority() { */ -void TableView::timerEvent( QTimerEvent* ev ) { +void TableView::timerEvent( QTimerEvent* ) { // qWarning("sorted %d", sorted().count() ); @@ -532 +532,12 @@ void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { } +void TableView::keyPressEvent( QKeyEvent* event) { + switch( event->key() ) { + case Qt::Key_F33: + case Qt::Key_Enter: + case Qt::Key_Return: + showTodo( sorted().uidAt( currentRow() ) ); + break; + default: + QTable::keyPressEvent( event ); + } +} diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h index 2b6ea2b..689c496 100644 --- a/core/pim/todo/tableview.h +++ b/core/pim/todo/tableview.h @@ -87,2 +87,3 @@ namespace Todo { protected: + void keyPressEvent( QKeyEvent* ); void contentsMouseReleaseEvent( QMouseEvent* ); diff --git a/core/pim/todo/textviewshow.cpp b/core/pim/todo/textviewshow.cpp index 24c8c0e..fe8a9c8 100644 --- a/core/pim/todo/textviewshow.cpp +++ b/core/pim/todo/textviewshow.cpp @@ -1 +1,2 @@ +#include "mainwindow.h" #include "textviewshow.h" @@ -4,4 +5,4 @@ using namespace Todo; -TextViewShow::TextViewShow( QWidget* parent) - : QTextView( parent ), TodoShow() { +TextViewShow::TextViewShow( QWidget* parent, MainWindow* win) + : QTextView( parent ), TodoShow(win) { @@ -19 +20,13 @@ QWidget* TextViewShow::widget() { } +void TextViewShow::keyPressEvent( QKeyEvent* event ) { + switch( event->key() ) { + case Qt::Key_F33: + case Qt::Key_Enter: + case Qt::Key_Return: + escapeView(); + break; + default: + QTextView::keyPressEvent( event ); + break; + } +} diff --git a/core/pim/todo/textviewshow.h b/core/pim/todo/textviewshow.h index f58026b..498de81 100644 --- a/core/pim/todo/textviewshow.h +++ b/core/pim/todo/textviewshow.h @@ -8,3 +8,3 @@ namespace Todo { public: - TextViewShow( QWidget* parent ); + TextViewShow( QWidget* parent, MainWindow* ); ~TextViewShow(); @@ -15,2 +15,5 @@ namespace Todo { + protected: + void keyPressEvent( QKeyEvent* ); + }; diff --git a/core/pim/todo/todoshow.cpp b/core/pim/todo/todoshow.cpp index c84a08f..4dbc9aa 100644 --- a/core/pim/todo/todoshow.cpp +++ b/core/pim/todo/todoshow.cpp @@ -1 +1,3 @@ + +#include "mainwindow.h" #include "todoshow.h" @@ -4,3 +6,4 @@ using namespace Todo; -TodoShow::TodoShow() { +TodoShow::TodoShow(MainWindow* win) { + m_win = win; } @@ -8,2 +11,6 @@ TodoShow::~TodoShow() { } +void TodoShow::escapeView() { + if (m_win ) + m_win->slotReturnFromView(); +} diff --git a/core/pim/todo/todoshow.h b/core/pim/todo/todoshow.h index 198e9ae..7267b13 100644 --- a/core/pim/todo/todoshow.h +++ b/core/pim/todo/todoshow.h @@ -36,2 +36,3 @@ namespace Todo { + class MainWindow; /** @@ -44,3 +45,3 @@ namespace Todo { public: - TodoShow(); + TodoShow( MainWindow* win); virtual ~TodoShow(); @@ -49,2 +50,6 @@ namespace Todo { virtual QWidget* widget() = 0; + protected: + void escapeView(); + private: + MainWindow *m_win; }; |