-rw-r--r-- | core/pim/todo/TODO | 3 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 68 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 14 | ||||
-rw-r--r-- | core/pim/todo/opie-todo.control | 2 | ||||
-rw-r--r-- | core/pim/todo/todo.pro | 6 | ||||
-rw-r--r-- | core/pim/todo/todolabel.cc | 58 | ||||
-rw-r--r-- | core/pim/todo/todolabel.h | 51 | ||||
-rw-r--r-- | core/pim/todo/todotable.cpp | 10 | ||||
-rw-r--r-- | core/pim/todo/todotable.h | 2 |
9 files changed, 194 insertions, 20 deletions
diff --git a/core/pim/todo/TODO b/core/pim/todo/TODO index 7601dd2..b00450c 100644 --- a/core/pim/todo/TODO +++ b/core/pim/todo/TODO @@ -1,4 +1 @@ --fix the journal (wip ) --fix day wrapping update all DueDateItems -when checking the C. box update the deadline --TodoLabel : public TextView diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index fc17c5f..d3f4cb4 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp @@ -2,4 +2,4 @@ ** Copyright (C) 2000 Trolltech AS. All rights reserved. - Copyright (C) 2002 zecke - Copyright (C) 2002 Stefan Eilers +** Copyright (C) 2002 zecke +** Copyright (C) 2002 Stefan Eilers (se, eilers.stefan@epost.de) ** @@ -27,2 +27,3 @@ #include "todotable.h" +#include "todolabel.h" @@ -50,2 +51,3 @@ #include <qpopupmenu.h> +#include <qwidgetstack.h> @@ -73,3 +75,4 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : // t.start(); - + mView = 0l; + mStack = new QWidgetStack(this, "main stack"); setCaption( tr("Todo") ); @@ -103,3 +106,5 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : - setCentralWidget( table ); + mStack->addWidget(table, 1 ); + mStack->raiseWidget( 1 ); + setCentralWidget( mStack ); setToolBarsMovable( FALSE ); @@ -148,2 +153,9 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : editAction = a; + + a = new QAction( QString::null, tr("View Task"), 0, this, 0 ); + a->addTo( edit ); + a->addTo( contextMenu ); + connect( a, SIGNAL( activated() ), + this, SLOT(slotShowDetails() ) ); + edit->insertSeparator(); @@ -178,4 +190,6 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : duplicateAction = a; - edit->insertSeparator(); + + + if ( Ir::supported() ) { @@ -251,2 +265,4 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : + connect( table, SIGNAL(showDetails(const ToDoEvent &) ), + this, SLOT(slotShowDetails(const ToDoEvent & ) ) ); // qDebug("done: t=%d", t.elapsed() ); @@ -288,2 +304,3 @@ void TodoWindow::slotNew() populateCategories(); + mStack->raiseWidget(1 ); } @@ -320,2 +337,3 @@ void TodoWindow::slotDelete() } + mStack->raiseWidget(1); } @@ -331,3 +349,3 @@ void TodoWindow::slotDeleteAll() - if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("Should I delete all tasks?") ) ) + if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("Delete all tasks?") ) ) return; @@ -344,2 +362,3 @@ void TodoWindow::slotDeleteAll() } + mStack->raiseWidget(1 ); } @@ -371,3 +390,3 @@ void TodoWindow::slotEdit() populateCategories(); - + mStack->raiseWidget( 1 ); } @@ -381,3 +400,10 @@ void TodoWindow::slotDuplicate() ToDoEvent ev = table->currentEntry(); - ToDoEvent ev2 = ToDoEvent( ev ); + ToDoEvent ev2 = ToDoEvent( ev ); // what about the uid + int uid; + { // uid + Qtopia::UidGen *uidgen = new Qtopia::UidGen(); + uid = uidgen->generate(); + delete uidgen; + } + ev2.setUid( uid ); table->setPaintingEnabled( false ); @@ -385,2 +411,4 @@ void TodoWindow::slotDuplicate() table->setPaintingEnabled( true ); + + mStack->raiseWidget( 1 ); } @@ -435,2 +463,4 @@ void TodoWindow::setCategory( int c ) table->setPaintingEnabled( true ); + + mStack->raiseWidget( 1 ); } @@ -442,2 +472,3 @@ void TodoWindow::populateCategories() id = 1; + rememberId = 0; catMenu->insertItem( tr( "All Categories" ), id++ ); @@ -474,2 +505,7 @@ void TodoWindow::closeEvent( QCloseEvent *e ) { + if( mStack->visibleWidget() != table ){ + mStack->raiseWidget( 1 ); + e->ignore(); + return; + } if(syncing) { @@ -564,3 +600,2 @@ void TodoWindow::beamDone( Ir *ir ) -/* added 20.01.2k2 by se */ void TodoWindow::showDeadline( bool s ) @@ -571 +606,16 @@ void TodoWindow::showDeadline( bool s ) } +void TodoWindow::slotShowDetails() +{ + ToDoEvent event = table->currentEntry(); + slotShowDetails( event ); +} +void TodoWindow::slotShowDetails( const ToDoEvent &event ) +{ + if( mView == 0l ){ + mView = new TodoLabel(mStack); + mStack->addWidget( mView, 2 ); + } + mView->init( event ); + mView->sync(); + mStack->raiseWidget( 2); +} diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index b9172e1..f62ec6e 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h @@ -1,3 +1,4 @@ /********************************************************************** - Copyright (C) 2002 Holger 'zecke' Freyther <freyther@kde.org> +** Copyright (C) 2002 Holger 'zecke' Freyther <freyther@kde.org> +** Copyright (C) 2002 by Stefan Eilers (se, eilers.stefan@epost.de) ** Copyright (C) 2000 Trolltech AS. All rights reserved. @@ -31,2 +32,6 @@ class Ir; class OFontMenu; +class TodoLabel; +class ToDoDB; +class QWidgetStack; +class ToDoEvent; @@ -51,5 +56,7 @@ protected slots: - /* added 20.01.2k2 by se */ void showDeadline( bool ); + void slotShowDetails(const ToDoEvent &event ); + void slotShowDetails(); + void currentEntryChanged( int r, int c ); @@ -68,2 +75,3 @@ private: void populateCategories(); + //inline void switchToTable(); // move back to the normal view @@ -71,2 +79,3 @@ private: TodoTable *table; + TodoLabel *mView; QAction *editAction, @@ -79,2 +88,3 @@ private: QPopupMenu *contextMenu, *catMenu; + QWidgetStack *mStack; diff --git a/core/pim/todo/opie-todo.control b/core/pim/todo/opie-todo.control index cb9b110..71929af 100644 --- a/core/pim/todo/opie-todo.control +++ b/core/pim/todo/opie-todo.control @@ -3,3 +3,3 @@ Priority: optional Section: opie/applications -Maintainer: Warwick Allison <warwick@trolltech.com> +Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> Architecture: arm diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro index a46fb47..a365081 100644 --- a/core/pim/todo/todo.pro +++ b/core/pim/todo/todo.pro @@ -5,3 +5,4 @@ HEADERS = mainwindow.h \ todotable.h \ - todoentryimpl.h + todoentryimpl.h \ + todolabel.h SOURCES = main.cpp \ @@ -9,3 +10,4 @@ SOURCES = main.cpp \ todotable.cpp \ - todoentryimpl.cpp + todoentryimpl.cpp \ + todolabel.cc diff --git a/core/pim/todo/todolabel.cc b/core/pim/todo/todolabel.cc new file mode 100644 index 0000000..4ce3499 --- a/dev/null +++ b/core/pim/todo/todolabel.cc @@ -0,0 +1,58 @@ +/********************************************************************** +** Copyright (C) 2002 by Stefan Eilers (se, eilers.stefan@epost.de) +** Copyright (C) 2002 Holger 'zecke' Freyther <freyther@kde.org> +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of the Qtopia Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + + + +#include <qpe/stringutil.h> + +#include <qregexp.h> +#include <qstylesheet.h> + + +#include "todolabel.h" + +TodoLabel::TodoLabel( QWidget *parent, const char *name ) + : QTextView( parent, name ) +{ +} + +TodoLabel::~TodoLabel() +{ +} + +void TodoLabel::init( const ToDoEvent &item ) +{ + m_item = item; +} + +void TodoLabel::sync() +{ + QString text = m_item.richText(); + setText( text ); +} + +void TodoLabel::keyPressEvent( QKeyEvent *e ) +{ + if ( e->key() == Qt::Key_F33 ) { + emit okPressed(); + } +} diff --git a/core/pim/todo/todolabel.h b/core/pim/todo/todolabel.h new file mode 100644 index 0000000..b6d67af --- a/dev/null +++ b/core/pim/todo/todolabel.h @@ -0,0 +1,51 @@ +/********************************************************************** +** Copyright (C) 2002 by Stefan Eilers (se, eilers.stefan@epost.de) +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of the Qtopia Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#ifndef TODOLABEL_H +#define TODOLABEL_H + +#include <opie/todoevent.h> + +#include <qtextview.h> + +class TodoLabel : public QTextView +{ + Q_OBJECT + +public: + TodoLabel( QWidget *parent, const char *name = 0 ); + ~TodoLabel(); + +public slots: + void init( const ToDoEvent &item); + void sync(); + +signals: + void okPressed(); + +protected: + void keyPressEvent( QKeyEvent * ); + +private: + ToDoEvent m_item; + +}; + +#endif diff --git a/core/pim/todo/todotable.cpp b/core/pim/todo/todotable.cpp index d0bc61c..753c036 100644 --- a/core/pim/todo/todotable.cpp +++ b/core/pim/todo/todotable.cpp @@ -310,3 +310,9 @@ void TodoTable::slotClicked( int row, int col, int, const QPoint &pos ) // emit signalEdit(); - // fall through + // Show detailed view of the selected entry + { + menuTimer->stop(); + ToDoEvent *todo = todoList[static_cast<CheckItem*>(item(row, 0))]; + emit showDetails( *todo ); + } + break; case 3: @@ -347,3 +353,3 @@ ToDoEvent TodoTable::currentEntry() const { - printf ("in currentEntry\n"); + //qWarning ("in currentEntry\n"); diff --git a/core/pim/todo/todotable.h b/core/pim/todo/todotable.h index 458e07a..2f6e635 100644 --- a/core/pim/todo/todotable.h +++ b/core/pim/todo/todotable.h @@ -144,3 +144,3 @@ signals: void signalWrapAround(); - + void showDetails( const ToDoEvent & ); protected: |