summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp5
-rw-r--r--core/pim/todo/mainwindow.h2
-rw-r--r--core/pim/todo/tableview.cpp13
-rw-r--r--core/pim/todo/tableview.h1
-rw-r--r--core/pim/todo/textviewshow.cpp17
-rw-r--r--core/pim/todo/textviewshow.h5
-rw-r--r--core/pim/todo/todoshow.cpp9
-rw-r--r--core/pim/todo/todoshow.h7
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() {
m_curEdit = new Editor();
}
void MainWindow::initShow() {
- m_curShow = new TextViewShow(this);
+ m_curShow = new TextViewShow(this, this);
m_stack->addWidget( m_curShow->widget() , m_counter++ );
}
MainWindow::~MainWindow() {
@@ -813,3 +813,6 @@ void MainWindow::add( const OPimRecord& rec) {
// but only call if we changed something -zecke
populateCategories();
}
+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
@@ -60,6 +60,7 @@ namespace Todo {
class MainWindow : public OPimMainWindow {
Q_OBJECT
friend class TodoView; // avoid QObject here....
+ friend class TodoShow; // avoid QObject
public:
MainWindow( QWidget *parent = 0,
const char* name = 0 );
@@ -183,6 +184,7 @@ private slots:
void beamDone( Ir* );
void slotShowDetails();
void slotShowDue( bool );
+ void slotReturnFromView(); // for TodoShow...
/* reimplementation from opimmainwindow */
protected slots:
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() {
* up and down. On odd or even we will currentRow()+-4 or +-9
*
*/
-void TableView::timerEvent( QTimerEvent* ev ) {
+void TableView::timerEvent( QTimerEvent* ) {
// qWarning("sorted %d", sorted().count() );
if (sorted().count() == 0 )
return;
@@ -530,3 +530,14 @@ void TableView::contentsMouseMoveEvent( QMouseEvent* e ) {
m_menuTimer->stop();
QTable::contentsMouseMoveEvent( 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
@@ -85,6 +85,7 @@ namespace Todo {
QPixmap m_pic_priority[ 5 ];
protected:
+ void keyPressEvent( QKeyEvent* );
void contentsMouseReleaseEvent( QMouseEvent* );
void contentsMouseMoveEvent( QMouseEvent* );
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 @@
+#include "mainwindow.h"
#include "textviewshow.h"
using namespace Todo;
-TextViewShow::TextViewShow( QWidget* parent)
- : QTextView( parent ), TodoShow() {
+TextViewShow::TextViewShow( QWidget* parent, MainWindow* win)
+ : QTextView( parent ), TodoShow(win) {
}
TextViewShow::~TextViewShow() {
@@ -17,3 +18,15 @@ void TextViewShow::slotShow( const OTodo& ev ) {
QWidget* TextViewShow::widget() {
return this;
}
+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
@@ -6,12 +6,15 @@ namespace Todo {
class TextViewShow : public QTextView, public TodoShow {
public:
- TextViewShow( QWidget* parent );
+ TextViewShow( QWidget* parent, MainWindow* );
~TextViewShow();
QString type()const;
void slotShow( const OTodo& ev );
QWidget* widget();
+ 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,9 +1,16 @@
+
+#include "mainwindow.h"
#include "todoshow.h"
using namespace Todo;
-TodoShow::TodoShow() {
+TodoShow::TodoShow(MainWindow* win) {
+ m_win = win;
}
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
@@ -34,6 +34,7 @@
#include <opie/otodo.h>
namespace Todo {
+ class MainWindow;
/**
* TodoShow is the baseclass of
* of all TodoShows.
@@ -42,11 +43,15 @@ namespace Todo {
*/
class TodoShow {
public:
- TodoShow();
+ TodoShow( MainWindow* win);
virtual ~TodoShow();
virtual QString type()const = 0;
virtual void slotShow( const OTodo& ev ) = 0;
virtual QWidget* widget() = 0;
+ protected:
+ void escapeView();
+ private:
+ MainWindow *m_win;
};
};