-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 | |||
@@ -251,7 +251,7 @@ void MainWindow::initEditor() { | |||
251 | m_curEdit = new Editor(); | 251 | m_curEdit = new Editor(); |
252 | } | 252 | } |
253 | void MainWindow::initShow() { | 253 | void MainWindow::initShow() { |
254 | m_curShow = new TextViewShow(this); | 254 | m_curShow = new TextViewShow(this, this); |
255 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); | 255 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); |
256 | } | 256 | } |
257 | MainWindow::~MainWindow() { | 257 | MainWindow::~MainWindow() { |
@@ -813,3 +813,6 @@ void MainWindow::add( const OPimRecord& rec) { | |||
813 | // but only call if we changed something -zecke | 813 | // but only call if we changed something -zecke |
814 | populateCategories(); | 814 | populateCategories(); |
815 | } | 815 | } |
816 | void MainWindow::slotReturnFromView() { | ||
817 | raiseCurrentView(); | ||
818 | } | ||
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 | |||
@@ -60,6 +60,7 @@ namespace Todo { | |||
60 | class MainWindow : public OPimMainWindow { | 60 | class MainWindow : public OPimMainWindow { |
61 | Q_OBJECT | 61 | Q_OBJECT |
62 | friend class TodoView; // avoid QObject here.... | 62 | friend class TodoView; // avoid QObject here.... |
63 | friend class TodoShow; // avoid QObject | ||
63 | public: | 64 | public: |
64 | MainWindow( QWidget *parent = 0, | 65 | MainWindow( QWidget *parent = 0, |
65 | const char* name = 0 ); | 66 | const char* name = 0 ); |
@@ -183,6 +184,7 @@ private slots: | |||
183 | void beamDone( Ir* ); | 184 | void beamDone( Ir* ); |
184 | void slotShowDetails(); | 185 | void slotShowDetails(); |
185 | void slotShowDue( bool ); | 186 | void slotShowDue( bool ); |
187 | void slotReturnFromView(); // for TodoShow... | ||
186 | /* reimplementation from opimmainwindow */ | 188 | /* reimplementation from opimmainwindow */ |
187 | protected slots: | 189 | protected slots: |
188 | void flush(); | 190 | void flush(); |
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 | |||
@@ -469,7 +469,7 @@ void TableView::slotPriority() { | |||
469 | * up and down. On odd or even we will currentRow()+-4 or +-9 | 469 | * up and down. On odd or even we will currentRow()+-4 or +-9 |
470 | * | 470 | * |
471 | */ | 471 | */ |
472 | void TableView::timerEvent( QTimerEvent* ev ) { | 472 | void TableView::timerEvent( QTimerEvent* ) { |
473 | // qWarning("sorted %d", sorted().count() ); | 473 | // qWarning("sorted %d", sorted().count() ); |
474 | if (sorted().count() == 0 ) | 474 | if (sorted().count() == 0 ) |
475 | return; | 475 | return; |
@@ -530,3 +530,14 @@ void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { | |||
530 | m_menuTimer->stop(); | 530 | m_menuTimer->stop(); |
531 | QTable::contentsMouseMoveEvent( e ); | 531 | QTable::contentsMouseMoveEvent( e ); |
532 | } | 532 | } |
533 | void TableView::keyPressEvent( QKeyEvent* event) { | ||
534 | switch( event->key() ) { | ||
535 | case Qt::Key_F33: | ||
536 | case Qt::Key_Enter: | ||
537 | case Qt::Key_Return: | ||
538 | showTodo( sorted().uidAt( currentRow() ) ); | ||
539 | break; | ||
540 | default: | ||
541 | QTable::keyPressEvent( event ); | ||
542 | } | ||
543 | } | ||
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 | |||
@@ -85,6 +85,7 @@ namespace Todo { | |||
85 | QPixmap m_pic_priority[ 5 ]; | 85 | QPixmap m_pic_priority[ 5 ]; |
86 | 86 | ||
87 | protected: | 87 | protected: |
88 | void keyPressEvent( QKeyEvent* ); | ||
88 | void contentsMouseReleaseEvent( QMouseEvent* ); | 89 | void contentsMouseReleaseEvent( QMouseEvent* ); |
89 | void contentsMouseMoveEvent( QMouseEvent* ); | 90 | void contentsMouseMoveEvent( QMouseEvent* ); |
90 | void timerEvent( QTimerEvent* e ); | 91 | void timerEvent( QTimerEvent* e ); |
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,9 +1,10 @@ | |||
1 | #include "mainwindow.h" | ||
1 | #include "textviewshow.h" | 2 | #include "textviewshow.h" |
2 | 3 | ||
3 | using namespace Todo; | 4 | using namespace Todo; |
4 | 5 | ||
5 | TextViewShow::TextViewShow( QWidget* parent) | 6 | TextViewShow::TextViewShow( QWidget* parent, MainWindow* win) |
6 | : QTextView( parent ), TodoShow() { | 7 | : QTextView( parent ), TodoShow(win) { |
7 | 8 | ||
8 | } | 9 | } |
9 | TextViewShow::~TextViewShow() { | 10 | TextViewShow::~TextViewShow() { |
@@ -17,3 +18,15 @@ void TextViewShow::slotShow( const OTodo& ev ) { | |||
17 | QWidget* TextViewShow::widget() { | 18 | QWidget* TextViewShow::widget() { |
18 | return this; | 19 | return this; |
19 | } | 20 | } |
21 | void TextViewShow::keyPressEvent( QKeyEvent* event ) { | ||
22 | switch( event->key() ) { | ||
23 | case Qt::Key_F33: | ||
24 | case Qt::Key_Enter: | ||
25 | case Qt::Key_Return: | ||
26 | escapeView(); | ||
27 | break; | ||
28 | default: | ||
29 | QTextView::keyPressEvent( event ); | ||
30 | break; | ||
31 | } | ||
32 | } | ||
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 | |||
@@ -6,12 +6,15 @@ namespace Todo { | |||
6 | 6 | ||
7 | class TextViewShow : public QTextView, public TodoShow { | 7 | class TextViewShow : public QTextView, public TodoShow { |
8 | public: | 8 | public: |
9 | TextViewShow( QWidget* parent ); | 9 | TextViewShow( QWidget* parent, MainWindow* ); |
10 | ~TextViewShow(); | 10 | ~TextViewShow(); |
11 | 11 | ||
12 | QString type()const; | 12 | QString type()const; |
13 | void slotShow( const OTodo& ev ); | 13 | void slotShow( const OTodo& ev ); |
14 | QWidget* widget(); | 14 | QWidget* widget(); |
15 | 15 | ||
16 | protected: | ||
17 | void keyPressEvent( QKeyEvent* ); | ||
18 | |||
16 | }; | 19 | }; |
17 | }; | 20 | }; |
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,9 +1,16 @@ | |||
1 | |||
2 | #include "mainwindow.h" | ||
1 | #include "todoshow.h" | 3 | #include "todoshow.h" |
2 | 4 | ||
3 | using namespace Todo; | 5 | using namespace Todo; |
4 | 6 | ||
5 | TodoShow::TodoShow() { | 7 | TodoShow::TodoShow(MainWindow* win) { |
8 | m_win = win; | ||
6 | } | 9 | } |
7 | TodoShow::~TodoShow() { | 10 | TodoShow::~TodoShow() { |
8 | } | 11 | } |
12 | void TodoShow::escapeView() { | ||
13 | if (m_win ) | ||
14 | m_win->slotReturnFromView(); | ||
15 | } | ||
9 | 16 | ||
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 | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <opie/otodo.h> | 34 | #include <opie/otodo.h> |
35 | 35 | ||
36 | namespace Todo { | 36 | namespace Todo { |
37 | class MainWindow; | ||
37 | /** | 38 | /** |
38 | * TodoShow is the baseclass of | 39 | * TodoShow is the baseclass of |
39 | * of all TodoShows. | 40 | * of all TodoShows. |
@@ -42,11 +43,15 @@ namespace Todo { | |||
42 | */ | 43 | */ |
43 | class TodoShow { | 44 | class TodoShow { |
44 | public: | 45 | public: |
45 | TodoShow(); | 46 | TodoShow( MainWindow* win); |
46 | virtual ~TodoShow(); | 47 | virtual ~TodoShow(); |
47 | virtual QString type()const = 0; | 48 | virtual QString type()const = 0; |
48 | virtual void slotShow( const OTodo& ev ) = 0; | 49 | virtual void slotShow( const OTodo& ev ) = 0; |
49 | virtual QWidget* widget() = 0; | 50 | virtual QWidget* widget() = 0; |
51 | protected: | ||
52 | void escapeView(); | ||
53 | private: | ||
54 | MainWindow *m_win; | ||
50 | }; | 55 | }; |
51 | }; | 56 | }; |
52 | 57 | ||