summaryrefslogtreecommitdiff
authorzecke <zecke>2003-02-11 18:42:42 (UTC)
committer zecke <zecke>2003-02-11 18:42:42 (UTC)
commit986afbabdd7c291f2fcbecd865e8c7075623bbf8 (patch) (side-by-side diff)
tree7b00ad1e26a47666c05b7040d2218d134f698007
parentcb85b004afe2750733cef1663961539f6a3968e6 (diff)
downloadopie-986afbabdd7c291f2fcbecd865e8c7075623bbf8.zip
opie-986afbabdd7c291f2fcbecd865e8c7075623bbf8.tar.gz
opie-986afbabdd7c291f2fcbecd865e8c7075623bbf8.tar.bz2
Add switching the views with the ActionKey..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp9
-rw-r--r--core/pim/todo/mainwindow.h2
-rw-r--r--core/pim/todo/tableview.cpp21
-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, 58 insertions, 13 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
@@ -87,9 +87,9 @@ void MainWindow::initTemplate() {
}
void MainWindow::initActions() {
-
+
// Data menu
m_edit->insertItem(QWidget::tr("New from template"), m_template,
-1, 0 );
-
+
QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ),
QString::null, 0, this, 0 );
@@ -252,5 +252,5 @@ 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++ );
}
@@ -814,2 +814,5 @@ void MainWindow::add( const OPimRecord& rec) {
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
@@ -61,4 +61,5 @@ namespace Todo {
Q_OBJECT
friend class TodoView; // avoid QObject here....
+ friend class TodoShow; // avoid QObject
public:
MainWindow( QWidget *parent = 0,
@@ -184,4 +185,5 @@ private slots:
void slotShowDetails();
void slotShowDue( bool );
+ void slotReturnFromView(); // for TodoShow...
/* reimplementation from opimmainwindow */
protected slots:
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
@@ -60,5 +60,5 @@ void TableView::initConfig() {
TableView::TableView( MainWindow* window, QWidget* wid )
: QTable( wid ), TodoView( window ) {
-
+
// Load icons
// TODO - probably should be done globally somewhere else,
@@ -84,8 +84,8 @@ TableView::TableView( MainWindow* window, QWidget* wid )
setShowDeadline( todoWindow()->showDeadline() );
-
+
setSorting( TRUE );
setSelectionMode( NoSelection );
-
+
setLeftMargin( 0 );
verticalHeader()->hide();
@@ -369,5 +369,5 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool
if ( task.isCompleted() ) {
p->drawPixmap( x + marg, y, m_pic_completed );
- }
+ }
}
break;
@@ -470,5 +470,5 @@ void TableView::slotPriority() {
*
*/
-void TableView::timerEvent( QTimerEvent* ev ) {
+void TableView::timerEvent( QTimerEvent* ) {
// qWarning("sorted %d", sorted().count() );
if (sorted().count() == 0 )
@@ -531,2 +531,13 @@ void TableView::contentsMouseMoveEvent( QMouseEvent* e ) {
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
@@ -86,4 +86,5 @@ namespace Todo {
protected:
+ void keyPressEvent( QKeyEvent* );
void contentsMouseReleaseEvent( QMouseEvent* );
void contentsMouseMoveEvent( 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,8 +1,9 @@
+#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) {
}
@@ -18,2 +19,14 @@ 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
@@ -7,5 +7,5 @@ namespace Todo {
class TextViewShow : public QTextView, public TodoShow {
public:
- TextViewShow( QWidget* parent );
+ TextViewShow( QWidget* parent, MainWindow* );
~TextViewShow();
@@ -14,4 +14,7 @@ namespace Todo {
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
@@ -35,4 +35,5 @@
namespace Todo {
+ class MainWindow;
/**
* TodoShow is the baseclass of
@@ -43,9 +44,13 @@ 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;
};
};