summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-07 11:29:28 (UTC)
committer zecke <zecke>2002-10-07 11:29:28 (UTC)
commit772e75ae7934325172073a09f176fbbd9b64b4e0 (patch) (side-by-side diff)
treebaa162c1d464baeb2f6e9844ae7afedc59f4ea9c
parentd9b425252bc2d3b0d9cb848f823d8eb254f38a26 (diff)
downloadopie-772e75ae7934325172073a09f176fbbd9b64b4e0.zip
opie-772e75ae7934325172073a09f176fbbd9b64b4e0.tar.gz
opie-772e75ae7934325172073a09f176fbbd9b64b4e0.tar.bz2
make place for the new todo
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/Changes10
-rw-r--r--core/pim/todo/TODO1
-rw-r--r--core/pim/todo/main.cpp36
-rw-r--r--core/pim/todo/mainwindow.cpp634
-rw-r--r--core/pim/todo/mainwindow.h97
-rw-r--r--core/pim/todo/opie-todo.control9
-rw-r--r--core/pim/todo/todo.pro33
-rw-r--r--core/pim/todo/todoentry.ui484
-rw-r--r--core/pim/todo/todoentryimpl.cpp170
-rw-r--r--core/pim/todo/todoentryimpl.h61
-rw-r--r--core/pim/todo/todolabel.cc58
-rw-r--r--core/pim/todo/todolabel.h51
-rw-r--r--core/pim/todo/todotable.cpp949
-rw-r--r--core/pim/todo/todotable.h245
14 files changed, 0 insertions, 2838 deletions
diff --git a/core/pim/todo/Changes b/core/pim/todo/Changes
deleted file mode 100644
index 543d7dc..0000000
--- a/core/pim/todo/Changes
+++ b/dev/null
@@ -1,10 +0,0 @@
-Hi,
-We try to keep a report of what was changed from the day we forked
-
--(re)enable sorting
--needed to update the journal
--ported to the ToDoDB
--Overview Label
--deadline
-
-- magic suprise \ No newline at end of file
diff --git a/core/pim/todo/TODO b/core/pim/todo/TODO
deleted file mode 100644
index b00450c..0000000
--- a/core/pim/todo/TODO
+++ b/dev/null
@@ -1 +0,0 @@
--when checking the C. box update the deadline
diff --git a/core/pim/todo/main.cpp b/core/pim/todo/main.cpp
deleted file mode 100644
index 4e1c8a1..0000000
--- a/core/pim/todo/main.cpp
+++ b/dev/null
@@ -1,36 +0,0 @@
-/**********************************************************************
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
-**
-** This file is part of 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 "mainwindow.h"
-
-#include <qpe/qpeapplication.h>
-
-int main( int argc, char **argv )
-{
- QPEApplication a( argc, argv );
-
- TodoWindow mw;
- QObject::connect( &a, SIGNAL( flush() ), &mw, SLOT( flush() ) );
- QObject::connect( &a, SIGNAL( reload() ), &mw, SLOT( reload() ) );
-
- a.showMainWidget(&mw);
-
- return a.exec();
-}
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
deleted file mode 100644
index 974951e..0000000
--- a/core/pim/todo/mainwindow.cpp
+++ b/dev/null
@@ -1,634 +0,0 @@
-/**********************************************************************
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
-** Copyright (C) 2002 zecke
-** Copyright (C) 2002 Stefan Eilers (se, eilers.stefan@epost.de)
-**
-** This file is part of 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.
-**
-**********************************************************************/
-
-#define QTOPIA_INTERNAL_FD
-
-#include "mainwindow.h"
-#include "todoentryimpl.h"
-#include "todotable.h"
-#include "todolabel.h"
-
-#include <opie/tododb.h>
-#include <opie/todovcalresource.h>
-#include <opie/ofontmenu.h>
-
-#include <qpe/qpeapplication.h>
-#include <qpe/config.h>
-#include <qpe/finddialog.h>
-#include <qpe/global.h>
-#include <qpe/ir.h>
-#include <qpe/qpemenubar.h>
-#include <qpe/qpemessagebox.h>
-#include <qpe/resource.h>
-//#include <qpe/task.h>
-#include <qpe/qpetoolbar.h>
-
-#include <qaction.h>
-#include <qarray.h>
-#include <qdatastream.h>
-#include <qdatetime.h>
-#include <qfile.h>
-#include <qmessagebox.h>
-#include <qpopupmenu.h>
-#include <qwidgetstack.h>
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <stdlib.h>
-
-static QString todolistXMLFilename()
-{
- return Global::applicationFileName("todolist","todolist.xml");
-}
-
-static QString categoriesXMLFilename()
-{
- return Global::applicationFileName("todolist","categories.xml");
-}
-
-TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f ) :
- QMainWindow( parent, name, f ), syncing(FALSE)
-{
-// QTime t;
-// t.start();
- mView = 0l;
- mStack = new QWidgetStack(this, "main stack");
- setCentralWidget( mStack );
- setCaption( tr("Todo") );
- QString str;
- table = new TodoTable( this );
- table->setColumnWidth( 2, 10 );
- table->setPaintingEnabled( FALSE );
- table->setUpdatesEnabled( FALSE );
- table->viewport()->setUpdatesEnabled( FALSE );
-
- {
- str = todolistXMLFilename();
- if ( str.isNull() )
- QMessageBox::critical( this,
- tr("Out of Space"),
- tr("Unable to create startup files\n"
- "Free up some space\n"
- "before you enter any data") );
- else
- table->load( str );
- }
-
- // repeat for categories...
- str = categoriesXMLFilename();
- if ( str.isNull() )
- QMessageBox::critical( this,
- tr( "Out of Space" ),
- tr( "Unable to create startup files\n"
- "Free up some space\n"
- "before you enter any data") );
-
- mStack->addWidget(table, 1 );
- mStack->raiseWidget( 1 );
- setCentralWidget( mStack );
- setToolBarsMovable( FALSE );
-
-// qDebug("after load: t=%d", t.elapsed() );
-
- Config config( "todo" );
- config.setGroup( "View" );
- bool complete = config.readBoolEntry( "ShowComplete", true );
- table->setShowCompleted( complete );
-
- bool showdeadline = config.readBoolEntry("ShowDeadLine", true);
- table->setShowDeadline (showdeadline);
-
- QString category = config.readEntry( "Category", QString::null );
- table->setShowCategory( category );
-
- QPEToolBar *bar = new QPEToolBar( this );
- bar->setHorizontalStretchable( TRUE );
-
- QPEMenuBar *mb = new QPEMenuBar( bar );
-
- catMenu = new QPopupMenu( this );
- QPopupMenu *edit = new QPopupMenu( this );
- QPopupMenu *options = new QPopupMenu(this );
-
- contextMenu = new QPopupMenu( this );
-
- bar = new QPEToolBar( this );
-
- QAction *a = new QAction( tr( "New Task" ), Resource::loadPixmap( "new" ),
- QString::null, 0, this, 0 );
- connect( a, SIGNAL( activated() ),
- this, SLOT( slotNew() ) );
- a->addTo( bar );
- a->addTo( edit );
-
- a = new QAction( tr( "Edit Task" ), Resource::loadIconSet( "edit" ),
- QString::null, 0, this, 0 );
- connect( a, SIGNAL( activated() ),
- this, SLOT( slotEdit() ) );
- a->addTo( bar );
- a->addTo( edit );
- a->addTo( contextMenu );
- a->setEnabled( FALSE );
- 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() ) );
- viewAction = a;
-
- edit->insertSeparator();
-
- a = new QAction( tr( "Delete..." ), Resource::loadIconSet( "trash" ),
- QString::null, 0, this, 0 );
- connect( a, SIGNAL( activated() ),
- this, SLOT( slotDelete() ) );
- a->addTo( bar );
- a->addTo( edit );
- a->addTo( contextMenu );
- a->setEnabled( FALSE );
- deleteAction = a;
-
- // delete All in category is missing....
- // set All Done
- // set All Done in category
-
- a = new QAction( QString::null, tr( "Delete all..."), 0, this, 0 );
- connect(a, SIGNAL( activated() ),
- this, SLOT( slotDeleteAll() ) );
- a->addTo(edit );
- a->setEnabled( FALSE );
- deleteAllAction = a;
-
- edit->insertSeparator();
- a = new QAction( QString::null, tr("Duplicate" ), 0, this, 0 );
- connect(a, SIGNAL( activated() ),
- this, SLOT( slotDuplicate() ) );
- a->addTo(edit );
- a->setEnabled( FALSE );
- duplicateAction = a;
- edit->insertSeparator();
-
-
-
- if ( Ir::supported() ) {
- a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ),
- QString::null, 0, this, 0 );
- connect( a, SIGNAL( activated() ),
- this, SLOT( slotBeam() ) );
- a->addTo( edit );
- a->addTo( bar );
- }
-
- a = new QAction( tr( "Find" ), Resource::loadIconSet( "mag" ),
- QString::null, 0, this, 0 );
- connect( a, SIGNAL( activated() ),
- this, SLOT( slotFind() ) );
-// a->addTo( bar );
- a->addTo( options );
- options->insertSeparator();
-
- if ( table->numRows() )
- a->setEnabled( TRUE );
- else
- a->setEnabled( FALSE );
-
- //a->setEnabled( FALSE );
- findAction = a;
-// qDebug("mainwindow #2: t=%d", t.elapsed() );
-
- completedAction = new QAction( QString::null, tr("Completed tasks"), 0, this, 0, TRUE );
-
- showdeadlineAction = new QAction( QString::null, tr( "Show Deadline" ), 0, this, 0, TRUE );
-
- catMenu->setCheckable( true );
- populateCategories();
-
-
- completedAction->addTo( options );
- completedAction->setOn( table->showCompleted() );
- showdeadlineAction->addTo( options );
- showdeadlineAction->setOn( table->showDeadline() );
- options->insertSeparator( );
- QList<QWidget> list;
- list.append(table );
- OFontMenu *menu = new OFontMenu(this, "menu",list );
- menu->forceSize( table->horizontalHeader(), 10 );
- //catMenu->insertItem(tr("Fonts"), menu );
- list.clear();
- options->insertItem( tr("Fonts"), menu );
-
-
- mb->insertItem( tr( "Data" ), edit );
- mb->insertItem( tr( "Category" ), catMenu );
- mb->insertItem( tr( "Options"), options );
- resize( 200, 300 );
- if ( table->numRows() > 0 )
- currentEntryChanged( 0, 0 );
- connect( table, SIGNAL( signalEdit() ),
- this, SLOT( slotEdit() ) );
- connect( table, SIGNAL(signalShowMenu(const QPoint &)),
- this, SLOT( slotShowPopup(const QPoint &)) );
-
-// qDebug("mainwindow #3: t=%d", t.elapsed() );
- table->updateVisible();
- table->setUpdatesEnabled( TRUE );
- table->setPaintingEnabled( TRUE );
- table->viewport()->setUpdatesEnabled( TRUE );
-
- // Initialize the table
- table->updateVisible();
-
- connect( completedAction, SIGNAL( toggled(bool) ), this, SLOT( showCompleted(bool) ) );
- connect( showdeadlineAction, SIGNAL( toggled(bool) ), this, SLOT( showDeadline(bool) ) );
- connect( catMenu, SIGNAL(activated(int)), this, SLOT(setCategory(int)) );
- connect( table, SIGNAL( currentChanged( int, int ) ),
- this, SLOT( currentEntryChanged( int, int ) ) );
-
- connect( table, SIGNAL(showDetails(const ToDoEvent &) ),
- this, SLOT(slotShowDetails(const ToDoEvent & ) ) );
-// qDebug("done: t=%d", t.elapsed() );
-}
-
-void TodoWindow::slotNew()
-{
- if(syncing) {
- QMessageBox::warning(this, tr("Todo"),
- tr("Can not edit data, currently syncing"));
- return;
- }
-
- int id;
- id = -1;
- QArray<int> ids;
- ids = table->currentEntry().categories();
- if ( ids.count() )
- id = ids[0];
- NewTaskDialog e( id, this, 0, TRUE );
-
- ToDoEvent todo;
-
-#if defined(Q_WS_QWS) || defined(_WS_QWS_)
- e.showMaximized();
-#endif
- int ret = e.exec();
-// qWarning("finished" );
- if ( ret == QDialog::Accepted ) {
- table->setPaintingEnabled( false );
- todo = e.todoEntry();
- //todo.assignUid();
- table->addEntry( todo );
- table->setPaintingEnabled( true );
- findAction->setEnabled( TRUE );
- }
- // I'm afraid we must call this every time now, otherwise
- // spend expensive time comparing all these strings...
- populateCategories();
- mStack->raiseWidget(1 );
-}
-
-TodoWindow::~TodoWindow()
-{
-}
-
-void TodoWindow::slotDelete()
-{
- if(syncing) {
- QMessageBox::warning(this, tr("Todo"),
- tr("Can not edit data, currently syncing"));
- return;
- }
-
- if ( table->currentRow() == -1 )
- return;
-
- QString strName = table->text( table->currentRow(), 2 ).left( 30 );
-
- if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), strName ) )
- return;
-
-
-
- table->setPaintingEnabled( false );
- table->removeCurrentEntry();
- table->setPaintingEnabled( true );
-
- if ( table->numRows() == 0 ) {
- currentEntryChanged( -1, 0 );
- findAction->setEnabled( FALSE );
- }
- mStack->raiseWidget(1);
-}
-void TodoWindow::slotDeleteAll()
-{
- if(syncing) {
- QMessageBox::warning(this, tr("Todo"),
- tr("Can not edit data, currently syncing"));
- return;
- }
-
- //QString strName = table->text( table->currentRow(), 2 ).left( 30 );
-
- if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all tasks") ) )
- return;
-
-
-
- table->setPaintingEnabled( false );
- table->removeAllEntries();
- table->setPaintingEnabled( true );
-
- if ( table->numRows() == 0 ) {
- currentEntryChanged( -1, 0 );
- findAction->setEnabled( FALSE );
- }
- mStack->raiseWidget(1 );
-}
-
-void TodoWindow::slotEdit()
-{
- if(syncing) {
- QMessageBox::warning(this, tr("Todo"),
- tr("Can not edit data, currently syncing"));
- return;
- }
-
- ToDoEvent todo = table->currentEntry();
- qWarning("slotEdit" );
- NewTaskDialog e( todo, this, 0, TRUE );
- e.setCaption( tr( "Edit Task" ) );
-
-#if defined(Q_WS_QWS) || defined(_WS_QWS_)
- e.showMaximized();
-#endif
- int ret = e.exec();
-
- if ( ret == QDialog::Accepted ) {
- qWarning("Replacing now" );
- table->setPaintingEnabled( false );
- todo = e.todoEntry();
- table->replaceCurrentEntry( todo );
- table->setPaintingEnabled( true );
- }
- populateCategories();
- mStack->raiseWidget( 1 );
-}
-void TodoWindow::slotDuplicate()
-{
- if(syncing) {
- QMessageBox::warning(this, tr("Todo"),
- tr("Can not edit data, currently syncing"));
- return;
- }
- ToDoEvent ev = table->currentEntry();
- 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 );
- table->addEntry( ev2 );
- table->setPaintingEnabled( true );
-
- mStack->raiseWidget( 1 );
-}
-void TodoWindow::slotShowPopup( const QPoint &p )
-{
- contextMenu->popup( p );
-}
-
-void TodoWindow::showCompleted( bool s )
-{
- if ( !table->isUpdatesEnabled() )
- return;
- table->setPaintingEnabled( false );
- table->setShowCompleted( s );
- table->setPaintingEnabled( true );
- mStack->raiseWidget( 1 );
-}
-
-void TodoWindow::currentEntryChanged( int r, int )
-{
- if ( r != -1 && table->rowHeight( r ) > 0 ) {
- editAction->setEnabled( TRUE );
- viewAction->setEnabled( TRUE );
- deleteAction->setEnabled( TRUE );
- duplicateAction->setEnabled( TRUE );
- deleteAllAction->setEnabled( TRUE );
- } else {
- editAction->setEnabled( FALSE );
- viewAction->setEnabled( FALSE );
- deleteAction->setEnabled( FALSE );
- duplicateAction->setEnabled( FALSE );
- deleteAllAction->setEnabled( FALSE );
- }
-}
-
-void TodoWindow::setCategory( int c )
-{
- if ( c <= 0 ) return;
- if ( !table->isUpdatesEnabled() )
- return;
- table->setPaintingEnabled( false );
- for ( unsigned int i = 1; i < catMenu->count(); i++ )
- catMenu->setItemChecked( i, c == (int)i );
- if ( c == 1 ) {
- table->setShowCategory( QString::null );
- setCaption( tr("Todo") + " - " + tr( "All Categories" ) );
- } else if ( c == (int)catMenu->count() - 1 ) {
- table->setShowCategory( tr( "Unfiled" ) );
- setCaption( tr("Todo") + " - " + tr( "Unfiled" ) );
- } else {
- QString cat = table->categories()[c - 2];
- table->setShowCategory( cat );
- setCaption( tr("Todo") + " - " + cat );
- }
- table->setPaintingEnabled( true );
-
- mStack->raiseWidget( 1 );
-}
-
-void TodoWindow::populateCategories()
-{
- catMenu->clear();
- int id, rememberId;
- id = 1;
- rememberId = 0;
- catMenu->insertItem( tr( "All Categories" ), id++ );
- catMenu->insertSeparator();
- QStringList categories = table->categories();
- categories.append( tr( "Unfiled" ) );
- for ( QStringList::Iterator it = categories.begin();
- it != categories.end(); ++it ) {
- catMenu->insertItem( *it, id );
- if ( *it == table->showCategory() )
- rememberId = id;
- ++id;
- }
- if ( table->showCategory().isEmpty() )
- setCategory( 1 );
- else
- setCategory( rememberId );
-}
-
-void TodoWindow::reload()
-{
- table->clear();
- table->load( todolistXMLFilename() );
- syncing = FALSE;
-}
-
-void TodoWindow::flush()
-{
- syncing = TRUE;
- table->save( todolistXMLFilename() );
-}
-
-void TodoWindow::closeEvent( QCloseEvent *e )
-{
- if( mStack->visibleWidget() != table ){
- mStack->raiseWidget( 1 );
- e->ignore();
- return;
- }
- if(syncing) {
- /* no need to save if in the middle of syncing */
- e->accept();
- return;
- }
-
- if ( table->save( todolistXMLFilename() ) ) {
- e->accept();
- // repeat for categories...
- // if writing configs fail, it will emit an
- // error, but I feel that it is "ok" for us to exit
- // espically since we aren't told if the write succeeded...
- Config config( "todo" );
- config.setGroup( "View" );
- config.writeEntry( "ShowComplete", table->showCompleted() );
- config.writeEntry( "Category", table->showCategory() );
- /* added 20.01.2k2 by se */
- config.writeEntry( "ShowDeadLine", table->showDeadline());
- } else {
- if ( QMessageBox::critical( this, tr("Out of space"),
- tr("Todo was unable\n"
- "to save your changes.\n"
- "Free up some space\n"
- "and try again.\n"
- "\nQuit Anyway?"),
- QMessageBox::Yes|QMessageBox::Escape,
- QMessageBox::No|QMessageBox::Default)
- != QMessageBox::No )
- e->accept();
- else
- e->ignore();
- }
-}
-
-void TodoWindow::slotFind()
-{
- // put everything back to view all for searching...
- mStack->raiseWidget( 1 );
- if ( !catMenu->isItemChecked( 0 ) )
- setCategory( 0 );
-
- FindDialog dlg( "Todo List", this );
- QObject::connect( &dlg,
- SIGNAL(signalFindClicked(const QString &,
- bool, bool, int)),
- table,
- SLOT(slotDoFind(const QString&, bool, bool, int)) );
- QObject::connect( table, SIGNAL(signalNotFound()), &dlg,
- SLOT(slotNotFound()) );
- QObject::connect( table, SIGNAL(signalWrapAround()), &dlg,
- SLOT(slotWrapAround()) );
- dlg.exec();
- if ( table->numSelections() )
- table->clearSelection();
- table->clearFindRow();
-}
-
-
-void TodoWindow::setDocument( const QString &filename )
-{
- if ( filename.find(".vcs") != int(filename.length()) - 4 ) return;
-
- ToDoDB todoDB(filename, new ToDoVCalResource() );
- QValueList<ToDoEvent> tl = todoDB.rawToDos();
- for( QValueList<ToDoEvent>::Iterator it = tl.begin(); it != tl.end(); ++it ) {
- table->addEntry( *it );
- }
-}
-
-static const char * beamfile = "/tmp/obex/todo.vcs";
-
-void TodoWindow::slotBeam()
-{
- unlink( beamfile ); // delete if exists
- ToDoEvent c = table->currentEntry();
- mkdir("/tmp/obex/", 0755);
- ToDoDB todoDB( beamfile, new ToDoVCalResource() );
- todoDB.addEvent( c );
- todoDB.save();
- Ir *ir = new Ir( this );
- connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
- QString description = c.summary();
- ir->send( beamfile, description, "text/x-vCalendar" );
-}
-
-void TodoWindow::beamDone( Ir *ir )
-{
- delete ir;
- unlink( beamfile );
-}
-
-void TodoWindow::showDeadline( bool s )
-{
- if ( !table->isUpdatesEnabled() )
- return;
- table->setPaintingEnabled( false );
- table->setShowDeadline( s );
- table->setPaintingEnabled( true );
- mStack->raiseWidget( 1 );
-}
-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
deleted file mode 100644
index 7e8445c..0000000
--- a/core/pim/todo/mainwindow.h
+++ b/dev/null
@@ -1,97 +0,0 @@
-/**********************************************************************
-** 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.
-**
-** This file is part of Qtopia and Opi 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 MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <qmainwindow.h>
-
-class TodoTable;
-class QAction;
-class QPopupMenu;
-class Ir;
-class OFontMenu;
-class TodoLabel;
-class ToDoDB;
-class QWidgetStack;
-class ToDoEvent;
-
-class TodoWindow : public QMainWindow
-{
- Q_OBJECT
-
-public:
- TodoWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
- ~TodoWindow();
-
-public slots:
- void flush();
- void reload();
-
-protected slots:
- void slotNew();
- void slotDelete();
- void slotEdit();
- void slotShowPopup( const QPoint & );
- void showCompleted( bool );
-
- void showDeadline( bool );
-
- void slotShowDetails(const ToDoEvent &event );
- void slotShowDetails();
-
- void currentEntryChanged( int r, int c );
- void setCategory( int );
- void slotFind();
- void setDocument( const QString & );
- void slotBeam();
- void beamDone( Ir * );
- void slotDeleteAll();
- void slotDuplicate();
-
-protected:
- void closeEvent( QCloseEvent *e );
-
-private:
- void populateCategories();
- //inline void switchToTable(); // move back to the normal view
-
-private:
- TodoTable *table;
- TodoLabel *mView;
- QAction *editAction,
- *viewAction,
- *deleteAction,
- *findAction,
- *completedAction,
- *showdeadlineAction,
- *deleteAllAction,
- *duplicateAction;
- QPopupMenu *contextMenu, *catMenu;
- QWidgetStack *mStack;
-
- bool syncing;
-};
-
-#endif
-
-
diff --git a/core/pim/todo/opie-todo.control b/core/pim/todo/opie-todo.control
deleted file mode 100644
index 31fa166..0000000
--- a/core/pim/todo/opie-todo.control
+++ b/dev/null
@@ -1,9 +0,0 @@
-Files: bin/todolist apps/1Pim/todo.desktop
-Priority: optional
-Section: opie/applications
-Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org>
-Architecture: arm
-Version: $QPE_VERSION-$SUB_VERSION
-Depends: opie-base ($QPE_VERSION)
-Description: TODO-list manager
- A Todo-list manager for the Opie environment.
diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro
deleted file mode 100644
index 210a70c..0000000
--- a/core/pim/todo/todo.pro
+++ b/dev/null
@@ -1,33 +0,0 @@
-TEMPLATE = app
-CONFIG = qt warn_on release
-DESTDIR = $(OPIEDIR)/bin
-HEADERS = mainwindow.h \
- todotable.h \
- todoentryimpl.h \
- todolabel.h
-SOURCES = main.cpp \
- mainwindow.cpp \
- todotable.cpp \
- todoentryimpl.cpp \
- todolabel.cc
-INTERFACES = todoentry.ui
-TARGET = todolist
-INCLUDEPATH += $(OPIEDIR)/include
-DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lopie
-
-TRANSLATIONS = ../../../i18n/de/todolist.ts \
- ../../../i18n/en/todolist.ts \
- ../../../i18n/es/todolist.ts \
- ../../../i18n/fr/todolist.ts \
- ../../../i18n/hu/todolist.ts \
- ../../../i18n/ja/todolist.ts \
- ../../../i18n/ko/todolist.ts \
- ../../../i18n/no/todolist.ts \
- ../../../i18n/pl/todolist.ts \
- ../../../i18n/pt/todolist.ts \
- ../../../i18n/pt_BR/todolist.ts \
- ../../../i18n/sl/todolist.ts \
- ../../../i18n/zh_CN/todolist.ts \
- ../../../i18n/it/todolist.ts \
- ../../../i18n/zh_TW/todolist.ts
diff --git a/core/pim/todo/todoentry.ui b/core/pim/todo/todoentry.ui
deleted file mode 100644
index bcd1d7c..0000000
--- a/core/pim/todo/todoentry.ui
+++ b/dev/null
@@ -1,484 +0,0 @@
-<!DOCTYPE UI><UI>
-<class>NewTaskDialogBase</class>
-<comment>*********************************************************************
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
-**
-** This file is part of 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.
-**
-*********************************************************************</comment>
-<widget>
- <class>QDialog</class>
- <property stdset="1">
- <name>name</name>
- <cstring>NewTaskDialogBase</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>0</x>
- <y>0</y>
- <width>342</width>
- <height>445</height>
- </rect>
- </property>
- <property stdset="1">
- <name>caption</name>
- <string>New Task</string>
- </property>
- <property>
- <name>layoutMargin</name>
- </property>
- <property>
- <name>layoutSpacing</name>
- </property>
- <vbox>
- <property stdset="1">
- <name>margin</name>
- <number>4</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>4</number>
- </property>
- <widget>
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout18</cstring>
- </property>
- <property>
- <name>layoutSpacing</name>
- </property>
- <grid>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>4</number>
- </property>
- <widget row="4" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel1</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>1</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Summary:</string>
- </property>
- </widget>
- <widget row="3" column="1" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>buttonDate</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>false</bool>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>1 Jan 2001</string>
- </property>
- </widget>
- <widget row="2" column="1" >
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout15</cstring>
- </property>
- <property>
- <name>layoutSpacing</name>
- </property>
- <hbox>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>4</number>
- </property>
- <widget>
- <class>QComboBox</class>
- <item>
- <property>
- <name>text</name>
- <string>0%</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>20%</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>40%</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>60%</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>80%</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>100%</string>
- </property>
- </item>
- <property stdset="1">
- <name>name</name>
- <cstring>cmbProg</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>maximumSize</name>
- <size>
- <width>32767</width>
- <height>32767</height>
- </size>
- </property>
- </widget>
- <widget>
- <class>QCheckBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>checkCompleted</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>&amp;Completed</string>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget row="4" column="1" >
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout17</cstring>
- </property>
- <property>
- <name>layoutSpacing</name>
- </property>
- <hbox>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>4</number>
- </property>
- <widget>
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>lneSum</cstring>
- </property>
- </widget>
- <widget>
- <class>OClickableLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>lblDown</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>minimumSize</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property stdset="1">
- <name>maximumSize</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget row="0" column="1" >
- <class>QComboBox</class>
- <item>
- <property>
- <name>text</name>
- <string>1 - Very High</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>2 - High</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>3 - Normal</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>4 - Low</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>5 - Very Low</string>
- </property>
- </item>
- <property stdset="1">
- <name>name</name>
- <cstring>comboPriority</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>currentItem</name>
- <number>2</number>
- </property>
- </widget>
- <widget row="0" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel2</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>1</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Priority:</string>
- </property>
- </widget>
- <widget row="2" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>txtProg</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>1</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>frameShape</name>
- <enum>MShape</enum>
- </property>
- <property stdset="1">
- <name>frameShadow</name>
- <enum>MShadow</enum>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Progress:</string>
- </property>
- </widget>
- <widget row="3" column="0" >
- <class>QCheckBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>checkDate</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>D&amp;ue</string>
- </property>
- </widget>
- <widget row="1" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel3</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>1</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>frameShape</name>
- <enum>NoFrame</enum>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Category:</string>
- </property>
- </widget>
- <widget row="1" column="1" >
- <class>CategorySelect</class>
- <property stdset="1">
- <name>name</name>
- <cstring>comboCategory</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>minimumSize</name>
- <size>
- <width>60</width>
- <height>20</height>
- </size>
- </property>
- </widget>
- </grid>
- </widget>
- <widget>
- <class>QMultiLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>txtTodo</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>7</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>wordWrap</name>
- <enum>WidgetWidth</enum>
- </property>
- </widget>
- </vbox>
-</widget>
-<customwidgets>
- <customwidget>
- <class>CategorySelect</class>
- <header location="global">qpe/categoryselect.h</header>
- <sizehint>
- <width>-1</width>
- <height>-1</height>
- </sizehint>
- <container>0</container>
- <sizepolicy>
- <hordata>7</hordata>
- <verdata>1</verdata>
- </sizepolicy>
- <pixmap>image0</pixmap>
- </customwidget>
- <customwidget>
- <class>OClickableLabel</class>
- <header location="global">opie/oclickablelabel.h</header>
- <sizehint>
- <width>-1</width>
- <height>-1</height>
- </sizehint>
- <container>0</container>
- <sizepolicy>
- <hordata>5</hordata>
- <verdata>5</verdata>
- </sizepolicy>
- <pixmap>image0</pixmap>
- <signal>clicked()</signal>
- <signal>toggled(bool)</signal>
- <slot access="public">slotOn(bool)</slot>
- </customwidget>
-</customwidgets>
-<images>
- <image>
- <name>image0</name>
- <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
- </image>
-</images>
-<connections>
- <connection>
- <sender>checkDate</sender>
- <signal>toggled(bool)</signal>
- <receiver>buttonDate</receiver>
- <slot>setEnabled(bool)</slot>
- </connection>
- <connection>
- <sender>lblDown</sender>
- <signal>clicked()</signal>
- <receiver>NewTaskDialogBase</receiver>
- <slot>slotCopy()</slot>
- </connection>
- <slot access="protected">dateChanged( const QString &amp; )</slot>
- <slot access="protected">dateChanged( int, int, int )</slot>
- <slot access="protected">slotCopy()</slot>
-</connections>
-<tabstops>
- <tabstop>comboPriority</tabstop>
- <tabstop>checkCompleted</tabstop>
- <tabstop>checkDate</tabstop>
- <tabstop>buttonDate</tabstop>
- <tabstop>cmbProg</tabstop>
- <tabstop>comboCategory</tabstop>
- <tabstop>lneSum</tabstop>
- <tabstop>txtTodo</tabstop>
-</tabstops>
-</UI>
diff --git a/core/pim/todo/todoentryimpl.cpp b/core/pim/todo/todoentryimpl.cpp
deleted file mode 100644
index af47665..0000000
--- a/core/pim/todo/todoentryimpl.cpp
+++ b/dev/null
@@ -1,170 +0,0 @@
-/**********************************************************************
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
-** Copyright (C) 2002 zecke
-**
-** This file is part of 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 "todoentryimpl.h"
-
-#include <opie/oclickablelabel.h>
-#include <opie/todoevent.h>
-#include <opie/tododb.h>
-
-#include <qpe/categoryselect.h>
-#include <qpe/datebookmonth.h>
-#include <qpe/global.h>
-#include <qpe/resource.h>
-#include <qpe/imageedit.h>
-#include <qpe/timestring.h>
-#include <qpe/palmtoprecord.h>
-
-#include <qlayout.h>
-#include <qmessagebox.h>
-#include <qpopupmenu.h>
-#include <qtoolbutton.h>
-#include <qcombobox.h>
-#include <qcheckbox.h>
-#include <qlineedit.h>
-#include <qmultilineedit.h>
-#include <qlabel.h>
-#include <qtimer.h>
-#include <qapplication.h>
-
-
-NewTaskDialog::NewTaskDialog( const ToDoEvent& task, QWidget *parent,
- const char *name, bool modal, WFlags fl )
- : NewTaskDialogBase( parent, name, modal, fl ),
- todo( task )
-{
- todo.setCategories( task.allCategories() );
- if ( todo.hasDate() )
- date = todo.date();
- else
- date = QDate::currentDate();
-
- init();
- comboPriority->setCurrentItem( task.priority() - 1 );
-
- checkCompleted->setChecked( task.isCompleted() );
- checkDate->setChecked( task.hasDate() );
- buttonDate->setText( TimeString::longDateString( date ) );
-
- txtTodo->setText( task.description() );
- lneSum->setText( task.summary() );
- cmbProg->setCurrentItem( task.progress()/20 );
-}
-
-/*
- * Constructs a NewTaskDialog which is a child of 'parent', with the
- * name 'name' and widget flags set to 'f'
- *
- * The dialog will by default be modeless, unless you set 'modal' to
- * TRUE to construct a modal dialog.
- */
-NewTaskDialog::NewTaskDialog( int id, QWidget* parent, const char* name, bool modal,
- WFlags fl )
- : NewTaskDialogBase( parent, name, modal, fl ),
- date( QDate::currentDate() )
-{
- if ( id != -1 ) {
- QArray<int> ids( 1 );
- ids[0] = id;
- todo.setCategory( Qtopia::Record::idsToString( ids ) );
- }
- init();
-}
-
-void NewTaskDialog::init()
-{
- if( layout() != 0 ){
- layout()->setMargin( 2 );
- }
- QPopupMenu *m1 = new QPopupMenu( this );
- picker = new DateBookMonth( m1, 0, TRUE );
- m1->insertItem( picker );
- buttonDate->setPopup( m1 );
- comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") );
-
- connect( picker, SIGNAL( dateClicked( int, int, int ) ),
- this, SLOT( dateChanged( int, int, int ) ) );
-
- buttonDate->setText( TimeString::longDateString( date ) );
- picker->setDate( date.year(), date.month(), date.day() );
- lblDown->setPixmap(Resource::loadPixmap("down") );
-}
-
-/*
- * Destroys the object and frees any allocated resources
- */
-NewTaskDialog::~NewTaskDialog()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-void NewTaskDialog::dateChanged( int y, int m, int d )
-{
- date = QDate( y, m, d );
- buttonDate->setText( TimeString::longDateString( date ) );
-}
-
-/*!
-*/
-
-ToDoEvent NewTaskDialog::todoEntry()
-{
- if( checkDate->isChecked() ){
- todo.setDate( date );
- todo.setHasDate( true );
- }else{
- todo.setHasDate( false );
- }
- if ( comboCategory->currentCategory() != -1 ) {
- QArray<int> arr = comboCategory->currentCategories();
- QStringList list;
- list = QStringList::split(";", Qtopia::Record::idsToString( arr )) ;
- todo.setCategories( list );
- }
- todo.setPriority( comboPriority->currentItem() + 1 );
- todo.setCompleted( checkCompleted->isChecked() );
-
- todo.setDescription( txtTodo->text() );
- todo.setSummary( lneSum->text() );
- QString text = cmbProg->currentText();
- todo.setProgress( text.remove( text.length()-1, 1 ).toUShort() );
- return todo;
-}
-void NewTaskDialog::slotCopy()
-{
- txtTodo->clear();
- txtTodo->setText( lneSum->text() );
-}
-
-/*!
-
-*/
-
-void NewTaskDialog::accept()
-{
- QString strText = txtTodo->text();
- QString strSumm = lneSum->text();
- if ( strSumm.isEmpty() && strText.isEmpty() ) {
- // hmm... just decline it then, the user obviously didn't care about it
- QDialog::reject();
- return;
- }
- QDialog::accept();
-}
diff --git a/core/pim/todo/todoentryimpl.h b/core/pim/todo/todoentryimpl.h
deleted file mode 100644
index 49d1274..0000000
--- a/core/pim/todo/todoentryimpl.h
+++ b/dev/null
@@ -1,61 +0,0 @@
-/**********************************************************************
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
-**
-** This file is part of 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 NEWTASKDIALOG_H
-#define NEWTASKDIALOG_H
-
-#include "todoentry.h"
-
-#include <opie/todoevent.h>
-
-#include <qdatetime.h>
-#include <qpalette.h>
-
-class QLabel;
-class QTimer;
-class DateBookMonth;
-
-class NewTaskDialog : public NewTaskDialogBase
-{
- Q_OBJECT
-
-public:
- NewTaskDialog( const ToDoEvent &task, QWidget *parent = 0, const char* name = 0,
- bool modal = FALSE, WFlags fl = 0 );
- NewTaskDialog( int id, QWidget* parent = 0, const char* name = 0,
- bool modal = FALSE, WFlags fl = 0 );
- ~NewTaskDialog();
-
- ToDoEvent todoEntry();
-
-protected slots:
- void dateChanged( int y, int m, int d );
- void slotCopy();
-protected:
- virtual void accept();
-
-private:
- void init();
- ToDoEvent todo;
- QDate date;
- DateBookMonth *picker;
-};
-
-#endif // NEWTASKDIALOG_H
diff --git a/core/pim/todo/todolabel.cc b/core/pim/todo/todolabel.cc
deleted file mode 100644
index 4ce3499..0000000
--- a/core/pim/todo/todolabel.cc
+++ b/dev/null
@@ -1,58 +0,0 @@
-/**********************************************************************
-** 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
deleted file mode 100644
index b6d67af..0000000
--- a/core/pim/todo/todolabel.h
+++ b/dev/null
@@ -1,51 +0,0 @@
-/**********************************************************************
-** 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
deleted file mode 100644
index 15f733b..0000000
--- a/core/pim/todo/todotable.cpp
+++ b/dev/null
@@ -1,949 +0,0 @@
-/**********************************************************************
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
-**
-** This file is part of 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.
-**
-**********************************************************************/
-/* Show Deadline was added by Stefan Eilers (se, eilers.stefan@epost.de)
- */
-#include "todotable.h"
-
-#include <opie/tododb.h>
-#include <opie/xmltree.h>
-
-#include <qpe/categoryselect.h>
-#include <qpe/xmlreader.h>
-
-#include <qasciidict.h>
-#include <qcombobox.h>
-#include <qfile.h>
-#include <qpainter.h>
-#include <qtextcodec.h>
-#include <qtimer.h>
-#include <qdatetime.h>
-#include <qtextstream.h>
-
-#include <qcursor.h>
-#include <qregexp.h>
-
-#include <errno.h>
-#include <stdlib.h>
-
-#include <stdio.h>
-
-using namespace Opie;
-
-namespace {
-
- static bool taskCompare( const ToDoEvent &task, const QRegExp &r, int category );
- static QString journalFileName();
- static ToDoEvent xmlToEvent( XMLElement *ev );
-}
-CheckItem::CheckItem( QTable *t, const QString &key )
- : QTableItem( t, Never, "" ), checked( FALSE ), sortKey( key )
-{
-}
-
-QString CheckItem::key() const
-{
- return sortKey;
-}
-
-void CheckItem::setChecked( bool b )
-{
- checked = b;
- table()->updateCell( row(), col() );
-}
-
-void CheckItem::toggle()
-{
- TodoTable *parent = static_cast<TodoTable*>(table());
- ToDoEvent newTodo = parent->currentEntry();
- checked = !checked;
- newTodo.setCompleted( checked );
- table()->updateCell( row(), col() );
- parent->replaceCurrentEntry( newTodo, true );
-}
-
-bool CheckItem::isChecked() const
-{
- return checked;
-}
-
-static const int BoxSize = 10;
-
-void CheckItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr,
- bool )
-{
- p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) );
-
- int marg = ( cr.width() - BoxSize ) / 2;
- int x = 0;
- int y = ( cr.height() - BoxSize ) / 2;
- p->setPen( QPen( cg.text() ) );
- p->drawRect( x + marg, y, BoxSize, BoxSize );
- p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 );
- p->setPen( darkGreen );
- x += 1;
- y += 1;
- if ( checked ) {
- QPointArray a( 7*2 );
- int i, xx, yy;
- xx = x+1+marg;
- yy = y+2;
- for ( i=0; i<3; i++ ) {
- a.setPoint( 2*i, xx, yy );
- a.setPoint( 2*i+1, xx, yy+2 );
- xx++; yy++;
- }
- yy -= 2;
- for ( i=3; i<7; i++ ) {
- a.setPoint( 2*i, xx, yy );
- a.setPoint( 2*i+1, xx, yy+2 );
- xx++; yy--;
- }
- p->drawLineSegments( a );
- }
-}
-
-
-ComboItem::ComboItem( QTable *t, EditType et )
- : QTableItem( t, et, "3" ), cb( 0 )
-{
- setReplaceable( FALSE );
-}
-
-QWidget *ComboItem::createEditor() const
-{
- QString txt = text();
- ( (ComboItem*)this )->cb = new QComboBox( table()->viewport() );
- cb->insertItem( "1" );
- cb->insertItem( "2" );
- cb->insertItem( "3" );
- cb->insertItem( "4" );
- cb->insertItem( "5" );
- cb->setCurrentItem( txt.toInt() - 1 );
- return cb;
-}
-
-void ComboItem::setContentFromEditor( QWidget *w )
-{
- TodoTable *parent = static_cast<TodoTable*>(table());
- ToDoEvent newTodo = parent->currentEntry();
-
- if ( w->inherits( "QComboBox" ) )
- setText( ( (QComboBox*)w )->currentText() );
- else
- QTableItem::setContentFromEditor( w );
- newTodo.setPriority( text().toInt() );
- parent->replaceCurrentEntry( newTodo, true );
-}
-
-void ComboItem::setText( const QString &s )
-{
- if ( cb )
- cb->setCurrentItem( s.toInt() - 1 );
- QTableItem::setText( s );
-}
-
-QString ComboItem::text() const
-{
- if ( cb )
- return cb->currentText();
- return QTableItem::text();
-}
-DueTextItem::DueTextItem( QTable *t, ToDoEvent *ev )
- : QTableItem(t, Never, QString::null )
-{
- setToDoEvent( ev );
-}
-QString DueTextItem::key() const
-{
- QString key;
- if( m_hasDate ){
- if(m_off == 0 ){
- key.append("b");
- }else if( m_off > 0 ){
- key.append("c");
- }else if( m_off < 0 ){
- key.append("a");
- }
- key.append(QString::number(m_off ) );
- }else{
- key.append("d");
- }
- return key;
-}
-void DueTextItem::setToDoEvent( const ToDoEvent *ev )
-{
- m_hasDate = ev->hasDate();
- m_completed = ev->isCompleted();
- if( ev->hasDate() ){
- QDate today = QDate::currentDate();
- m_off = today.daysTo(ev->date() );
- //qWarning("DueText m_off=%d", m_off );
- setText( QString::number(m_off) + " day(s) " );
- }else{
- setText("n.d." );
- m_off = 0;
- }
- //qWarning("m_off=%d", m_off );
-}
-void DueTextItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected )
-{
- //qWarning ("paint m_off=%d", m_off );
- QColorGroup cg2(cg);
- QColor text = cg.text();
- if( m_hasDate && !m_completed ){
- if( m_off < 0 ){
- cg2.setColor(QColorGroup::Text, QColor(red ) );
- }else if( m_off == 0 ){
- cg2.setColor(QColorGroup::Text, QColor(yellow) ); // orange isn't predefined
- }else if( m_off > 0){
- cg2.setColor(QColorGroup::Text, QColor(green ) );
- }
- }
- QTableItem::paint(p, cg2, cr, selected );
- cg2.setColor(QColorGroup::Text, text );
-}
-TodoTable::TodoTable( QWidget *parent, const char *name )
-// #ifdef QT_QTABLE_NOHEADER_CONSTRUCTOR
-// : QTable( 0, 3, parent, name, TRUE ),
-// #else
- : QTable( 0, 4, parent, name ),
-// #endif
- showComp( true ),
- enablePainting( true ),
- mCat( 0 ),
- currFindRow( -2 ),
- showDeadl( true)
-{
- setNumRows(0);
- mCat.load( categoryFileName() );
- setSorting( TRUE );
- setSelectionMode( NoSelection );
- setColumnStretchable( 2, TRUE );
- setColumnWidth( 0, 20 );
- setColumnWidth( 1, 35 );
-
- setLeftMargin( 0 );
- verticalHeader()->hide();
- horizontalHeader()->setLabel( 0, tr( "C." ) );
- horizontalHeader()->setLabel( 1, tr( "Prior." ) );
- horizontalHeader()->setLabel( 2, tr( "Description" ) );
-
- setColumnStretchable( 3, FALSE );
- setColumnWidth( 3, 20 );
- horizontalHeader()->setLabel( 3, tr( "Deadline" ) );
-
- if (showDeadl){
- showColumn (3);
- }else{
- hideColumn (3);
- }
-
- connect( this, SIGNAL( clicked( int, int, int, const QPoint & ) ),
- this, SLOT( slotClicked( int, int, int, const QPoint & ) ) );
- connect( this, SIGNAL( pressed( int, int, int, const QPoint & ) ),
- this, SLOT( slotPressed( int, int, int, const QPoint & ) ) );
- connect( this, SIGNAL( valueChanged( int, int ) ),
- this, SLOT( slotCheckPriority( int, int ) ) );
- connect( this, SIGNAL( currentChanged( int, int ) ),
- this, SLOT( slotCurrentChanged( int, int ) ) );
-
- menuTimer = new QTimer( this );
- connect( menuTimer, SIGNAL(timeout()), this, SLOT(slotShowMenu()) );
-
- mDayTimer = new QTimer( this );
- connect( mDayTimer, SIGNAL(timeout()), this, SLOT(slotCheckDay() ) );
- mDay = QDate::currentDate();
-}
-
-void TodoTable::addEntry( const ToDoEvent &todo )
-{
- int row = numRows();
- setNumRows( row + 1 );
- updateJournal( todo, ACTION_ADD );
- insertIntoTable( new ToDoEvent(todo), row );
- setCurrentCell(row, currentColumn());
- updateVisible();
-}
-
-void TodoTable::slotClicked( int row, int col, int, const QPoint &pos )
-{
- if ( !cellGeometry( row, col ).contains(pos) )
- return;
- // let's switch on the column number...
- switch ( col )
- {
- case 0: {
- CheckItem *i = static_cast<CheckItem*>(item( row, col ));
- if ( i ) {
- int x = pos.x() - columnPos( col );
- int y = pos.y() - rowPos( row );
- int w = columnWidth( col );
- int h = rowHeight( row );
- if ( i && x >= ( w - BoxSize ) / 2 && x <= ( w - BoxSize ) / 2 + BoxSize &&
- y >= ( h - BoxSize ) / 2 && y <= ( h - BoxSize ) / 2 + BoxSize ) {
- i->toggle();
- }
- emit signalDoneChanged( i->isChecked() );
- }
- }
- break;
- case 1:
- break;
- case 2:
- // Show detailed view of the selected entry
- {
- menuTimer->stop();
- ToDoEvent *todo = todoList[static_cast<CheckItem*>(item(row, 0))];
- emit showDetails( *todo );
- }
- break;
- case 3:
- // may as well edit it...
- menuTimer->stop();
- emit signalEdit();
- break;
- }
-}
-
-void TodoTable::slotPressed( int row, int col, int, const QPoint &pos )
-{
- if ( col == 2 && cellGeometry( row, col ).contains(pos) )
- menuTimer->start( 750, TRUE );
-}
-
-void TodoTable::slotShowMenu()
-{
- emit signalShowMenu( QCursor::pos() );
-}
-
-void TodoTable::slotCurrentChanged( int, int )
-{
- menuTimer->stop();
-}
-
-void TodoTable::internalAddEntries( QList<ToDoEvent> &list )
-{
- setNumRows( list.count() );
- int row = 0;
- ToDoEvent *it;
- for ( it = list.first(); it; it = list.next() )
- insertIntoTable( it, row++ );
-}
-
-
-ToDoEvent TodoTable::currentEntry() const
-{
- //qWarning ("in currentEntry\n");
-
- QTableItem *i = item( currentRow(), 0 );
- if ( !i || rowHeight( currentRow() ) <= 0 )
- return ToDoEvent();
- ToDoEvent *todo = todoList[(CheckItem*)i];
- todo->setCompleted( ( (CheckItem*)item( currentRow(), 0 ) )->isChecked() );
- todo->setPriority( ( (ComboItem*)item( currentRow(), 1 ) )->text().toInt() );
- return *todo;
-}
-
-void TodoTable::replaceCurrentEntry( const ToDoEvent &todo, bool fromTableItem )
-{
- int row = currentRow();
- updateJournal( todo, ACTION_REPLACE);
-
- if ( !fromTableItem ) {
- journalFreeReplaceEntry( todo, row );
- updateVisible();
- }
-}
-
-void TodoTable::removeCurrentEntry()
-{
- ToDoEvent *oldTodo;
- int row = currentRow();
- CheckItem *chk;
-
- chk = static_cast<CheckItem*>(item(row, 0 ));
- if ( !chk )
- return;
- oldTodo = todoList[chk];
- todoList.remove( chk );
- oldTodo->setCompleted( chk->isChecked() );
- oldTodo->setPriority( static_cast<ComboItem*>(item(row, 1))->text().toInt() );
- realignTable( row );
- updateVisible();
- updateJournal( *oldTodo, ACTION_REMOVE);
- delete oldTodo;
-}
-
-
-bool TodoTable::save( const QString &fn )
-{
- QString strNewFile = fn + ".new";
- QFile::remove( strNewFile ); // just to be sure
- ToDoDB todoDB( strNewFile );
- for ( QMap<CheckItem*, ToDoEvent *>::Iterator it = todoList.begin();
- it != todoList.end(); ++it ) {
- if ( !item( it.key()->row(), 0 ) )
- continue;
- ToDoEvent *todo = *it;
- // sync item with table
- todo->setCompleted( ((CheckItem*)item(it.key()->row(), 0))->isChecked() );
- todo->setPriority( ((ComboItem*)item( it.key()->row(), 1))->text().toInt() );
- todoDB.addEvent( *todo );
- }
- if(!todoDB.save() ){
- QFile::remove( strNewFile );
- return false;
- };
- // now do the rename
- if ( ::rename( strNewFile, fn ) < 0 )
- qWarning( "problem renaming file %s to %s errno %d",
- strNewFile.latin1(), fn.latin1(), errno );
-
- // remove the journal
- QFile::remove( journalFileName() );
- return true;
-}
-
-void TodoTable::load( const QString &fn )
-{
- if ( QFile::exists(journalFileName()) ) {
- applyJournal();
- QFile::remove(journalFileName() );
- }
- loadFile( fn );
-// QTable::sortColumn(2,TRUE,TRUE);
-// QTable::sortColumn(1,TRUE,TRUE);
- QTable::sortColumn(0,TRUE,TRUE);
- setCurrentCell( 0, 2 );
- setSorting(true );
- mDayTimer->start( 60 * 1000 ); // gone in 60 seconds?
-}
-void TodoTable::updateVisible()
-{
- if ( !isUpdatesEnabled() )
- return;
-
- if (showDeadl){
- showColumn (3);
- adjustColumn(3);
- }else{
- hideColumn (3);
- adjustColumn(2);
- }
-
- int visible = 0;
- int id = mCat.id( "Todo List", showCat );
- for ( int row = 0; row < numRows(); row++ ) {
- CheckItem *ci = (CheckItem *)item( row, 0 );
- ToDoEvent *t = todoList[ci];
- if (!t)
- continue;
-
- QArray<int> vlCats = t->categories();
- bool hide = false;
- if ( !showComp && ci->isChecked() )
- hide = true;
- if ( !showCat.isEmpty() ) {
- if ( showCat == tr( "Unfiled" ) ) {
- if ( vlCats.count() > 0 )
- hide = true;
- } else {
- // do some comparing, we have to reverse our idea here... which idea? - zecke
- if ( !hide ) {
- hide = true;
- for ( uint it = 0; it < vlCats.count(); ++it ) {
- if ( vlCats[it] == id ) {
- hide = false;
- break;
- }
- }
- }
- }
- }
- if ( hide ) {
- if ( currentRow() == row )
- setCurrentCell( -1, 0 );
- if ( rowHeight( row ) > 0 )
- hideRow( row );
- } else {
- if ( rowHeight( row ) == 0 ) {
- showRow( row );
- adjustRow( row );
- }
- visible++;
- }
- }
- if ( !visible )
- setCurrentCell( -1, 0 );
-}
-
-void TodoTable::viewportPaintEvent( QPaintEvent *pe )
-{
- if ( enablePainting )
- QTable::viewportPaintEvent( pe );
-}
-
-void TodoTable::setPaintingEnabled( bool e )
-{
- if ( e != enablePainting ) {
- if ( !enablePainting ) {
- enablePainting = true;
- rowHeightChanged( 0 );
- viewport()->update();
- } else {
- enablePainting = false;
- }
- }
-}
-
-void TodoTable::clear()
-{
- for ( QMap<CheckItem*, ToDoEvent *>::Iterator it = todoList.begin();
- it != todoList.end(); ++it ) {
- ToDoEvent *todo = it.data();
- updateJournal( *todo, ACTION_REMOVE );
- delete todo;
- }
- todoList.clear();
- for ( int r = 0; r < numRows(); ++r ) {
- for ( int c = 0; c < numCols(); ++c ) {
- if ( cellWidget( r, c ) )
- clearCellWidget( r, c );
- clearCell( r, c );
- }
- }
- setNumRows( 0 );
-}
-
-void TodoTable::sortColumn( int col, bool ascending, bool /*wholeRows*/ )
-{
- // The default for wholeRows is false, however
- // for this todo table we want to exchange complete
- // rows when sorting. Also, we always want ascending, since
- // the values have a logical order.
- QTable::sortColumn( col, ascending, TRUE );
- updateVisible();
-}
-
-void TodoTable::slotCheckPriority(int row, int col )
-{
- // kludgey work around to make forward along the updated priority...
- if ( col == 1 ) {
- // let everyone know!!
- ComboItem* i = static_cast<ComboItem*>( item( row, col ) );
- emit signalPriorityChanged( i->text().toInt() );
- }
-}
-
-
-void TodoTable::updateJournal( const ToDoEvent &todo, journal_action action )
-{
- QFile f( journalFileName() );
- if ( !f.open(IO_WriteOnly|IO_Append) )
- return;
- QString buf;
- QCString str;
- buf = "<Task";
- // todo.save( buf );
- buf += " Action=\"" + QString::number( int(action) ) + "\"";
- buf += " Uid=\"" + QString::number( todo.uid() ) + "\""; // better write the id
- buf += " Completed=\""+ QString::number((int)todo.isCompleted() ) + "\"";
- buf += " HasDate=\""+ QString::number((int)todo.hasDate() ) +"\"";
- buf += " Priority=\"" + QString::number( todo.priority() ) + "\"";
- QArray<int> arrat = todo.categories();
- QString attr;
- for(uint i=0; i < arrat.count(); i++ ){
- attr.append(QString::number(arrat[i])+";" );
- }
- if(!attr.isEmpty() ) // remove the last ;
- attr.remove(attr.length()-1, 1 );
- buf += " Categories=\"" + attr + "\"";
- buf += " Description=\"" + todo.description() + "\"";
- buf += " Summary=\"" + todo.summary() + "\"";
- if(todo.hasDate() ) {
- buf += " DateYear=\""+QString::number( todo.date().year() ) + "\"";
- buf += " DateMonth=\"" + QString::number( todo.date().month() ) + "\"";
- buf += " DateDay=\"" + QString::number( todo.date().day() ) + "\"";
- }
- buf += "/>\n";
- str = buf.utf8();
- f.writeBlock( str.data(), str.length() );
- f.close();
-}
-
-void TodoTable::rowHeightChanged( int row )
-{
- if ( enablePainting )
- QTable::rowHeightChanged( row );
-}
-
-void TodoTable::loadFile( const QString &/*we use the standard*/ )
-{
-
- QList<ToDoEvent> list;
- ToDoDB todoDB;
- QValueList<ToDoEvent> vaList = todoDB.rawToDos();
- for(QValueList<ToDoEvent>::ConstIterator it = vaList.begin(); it != vaList.end(); ++it ){
- ToDoEvent *event = new ToDoEvent( (*it) );
- list.append( event );
- }
- vaList.clear();
- // qDebug("parsing done=%d", t.elapsed() );
- if ( list.count() > 0 ) {
- internalAddEntries( list );
- list.clear();
- }
-// qDebug("loading done: t=%d", t.elapsed() );
-}
-
-void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row )
-{
- QString strTodo = todo.summary();
- if( strTodo.isEmpty() ){
- strTodo = todo.description().left(40).simplifyWhiteSpace();
- //todo.setSummary(strTodo );
- }
- if ( row == -1 ) {
- QMapIterator<CheckItem*, ToDoEvent *> it;
- for ( it = todoList.begin(); it != todoList.end(); ++it ) {
- if ( *(*it) == todo ) {
- row = it.key()->row();
- it.key()->setChecked( todo.isCompleted() );
- static_cast<ComboItem*>(item(row, 1))->setText( QString::number(todo.priority()) );
- item( row, 2 )->setText( strTodo );
-
- if (showDeadl){
- static_cast<DueTextItem*>(item(row,3))->setToDoEvent(&todo );
- }
-
- *(*it) = todo;
- }
- }
- } else {
- ToDoEvent *t = todoList[static_cast<CheckItem*>(item(row, 0))];
- todoList.remove( static_cast<CheckItem*>(item(row, 0)) );
- delete t;
- static_cast<CheckItem*>(item(row, 0))->setChecked( todo.isCompleted() );
- static_cast<ComboItem*>(item(row, 1))->setText( QString::number(todo.priority()) );
- item( row, 2 )->setText( strTodo );
-
- if (showDeadl){
- static_cast<DueTextItem*>(item(row,3))->setToDoEvent(&todo );
- }
- todoList.insert( static_cast<CheckItem*>(item(row,0)), new ToDoEvent(todo) );
- }
-}
-
-void TodoTable::journalFreeRemoveEntry( int row )
-{
- CheckItem *chk;
- chk = static_cast<CheckItem*>(item(row, 0 ));
- if ( !chk )
- return;
- todoList.remove( chk );
-
- realignTable( row );
-}
-
-void TodoTable::keyPressEvent( QKeyEvent *e )
-{
- if ( e->key() == Key_Space || e->key() == Key_Return ) {
- switch ( currentColumn() ) {
- case 0: {
- CheckItem *i = static_cast<CheckItem*>(item(currentRow(),
- currentColumn()));
- if ( i )
- i->toggle();
- break;
- }
- case 1:
- break;
- case 2:{
- ToDoEvent *todo = todoList[static_cast<CheckItem*>(item(currentRow(), 0))];
- emit showDetails(*todo);
- break;
- }
- case 3:
- // Future: Let us change the dueDate directly...
- emit signalEdit();
- default:
- break;
- }
- } else
- QTable::keyPressEvent( e );
-}
-
-
-QStringList TodoTable::categories()
-{
- // This is called seldom, so calling a load in here
- // should be fine.
- mCat.load( categoryFileName() );
- QStringList categoryList = mCat.labels( "Todo List" );
- return categoryList;
-}
-
-void TodoTable::slotDoFind( const QString &findString, bool caseSensitive,
- bool backwards, int category )
-{
- // we have to iterate through the table, this gives the illusion that
- // sorting is actually being used.
- if ( currFindRow < -1 )
- currFindRow = currentRow() - 1;
- clearSelection( TRUE );
- int rows,
- row;
- CheckItem *chk;
- QRegExp r( findString );
-
- r.setCaseSensitive( caseSensitive );
- rows = numRows();
- static bool wrapAround = true;
-
- if ( !backwards ) {
- for ( row = currFindRow + 1; row < rows; row++ ) {
- chk = static_cast<CheckItem*>( item(row, 0) );
- if ( taskCompare(*(todoList[chk]), r, category) )
- break;
- }
- } else {
- for ( row = currFindRow - 1; row > -1; row-- ) {
- chk = static_cast<CheckItem*>( item(row, 0) );
- if ( taskCompare(*(todoList[chk]), r, category) )
- break;
- }
- }
- if ( row >= rows || row < 0 ) {
- if ( row < 0 )
- currFindRow = rows;
- else
- currFindRow = -1;
- if ( wrapAround )
- emit signalWrapAround();
- else
- emit signalNotFound();
- wrapAround = !wrapAround;
- } else {
- currFindRow = row;
- QTableSelection foundSelection;
- foundSelection.init( currFindRow, 0 );
- foundSelection.expandTo( currFindRow, numCols() - 1 );
- addSelection( foundSelection );
- setCurrentCell( currFindRow, numCols() - 1 );
- // we should always be able to wrap around and find this again,
- // so don't give confusing not found message...
- wrapAround = true;
- }
-}
-
-int TodoTable::showCategoryId() const
-{
- int id;
- id = -1;
- // if allcategories are selected, you get unfiled...
- if ( showCat != tr( "Unfiled" ) && showCat != tr( "All" ) )
- id = mCat.id( "Todo List", showCat );
- return id;
-}
-void TodoTable::applyJournal()
-{
- // we need to hack
- QFile file( journalFileName() );
- if( file.open(IO_ReadOnly ) ) {
- QByteArray ar = file.readAll();
- file.close();
- QFile file2( journalFileName() + "_new" );
- if( file2.open(IO_WriteOnly ) ){
- QTextStream str(&file2 );
- str << QString::fromLatin1("<Tasks>") << endl;
- str << ar.data();
- str << QString::fromLatin1("</Tasks>") << endl;
- file2.close();
- }
- XMLElement *root = XMLElement::load(journalFileName()+ "_new");
- XMLElement *el = root->firstChild();
- el = el->firstChild();
- ToDoDB tododb; // allready loaded ;)
- bool ok;
- int action;
- QString dummy;
- while( el ){
- dummy = el->attribute("Action" );
- action = dummy.toInt(&ok );
- ToDoEvent ev = xmlToEvent( el );
- if(ok ){
- switch( action){
- case ACTION_ADD:
- tododb.addEvent(ev );
- break;
- case ACTION_REMOVE:
- tododb.removeEvent( ev );
- break;
- case ACTION_REPLACE:
- tododb.replaceEvent( ev );
- break;
- }
- }
- el = el->nextChild();
- }
- QFile::remove(journalFileName()+ "_new" );
- tododb.save();
- }
-}
-void TodoTable::slotCheckDay()
-{
- QDate date = QDate::currentDate();
- if( mDay.daysTo(date )!= 0 ){
- setPaintingEnabled( FALSE );
- for(int i=0; i < numRows(); i++ ){
- ToDoEvent *t = todoList[static_cast<CheckItem*>(item(i, 0))];
- static_cast<DueTextItem*>(item(i, 3) )->setToDoEvent( t );
-
- }
- setPaintingEnabled( TRUE );
- mDay = date;
- }
- mDayTimer->start( 60 * 1000 ); // 60 seconds
-}
-// check Action and decide
-/*
-void TodoTable::doApply(XMLElement *el )
-{
- QString dummy;
- bool ok;
- int action;
- dummy = el->attribute("Action" );
- action = dummy.toInt(&ok );
- ToDoEvent ev = xmlToEvent( el );
- if( ok ){
- switch( action ){
- case ACTION_ADD:
- addEntry( ev );
- break;
- case ACTION_REMOVE:{ // find an entry with the same uid and remove it then
- break;
- }
- case ACTION_REPLACE:
- break;
- }
- }
-}
-*/
-namespace {
-static bool taskCompare( const ToDoEvent &task, const QRegExp &r, int category )
-{
- bool returnMe;
- QArray<int> cats;
- cats = task.categories();
-
- returnMe = false;
- if ( (category == -1 && cats.count() == 0) || category == -2 )
- returnMe = task.match( r );
- else {
- int i;
- for ( i = 0; i < int(cats.count()); i++ ) {
- if ( cats[i] == category ) {
- returnMe = task.match( r );
- break;
- }
- }
- }
- return returnMe;
-}
-
-static QString journalFileName()
-{
- QString str;
- str = getenv( "HOME" );
- str += "/.opie_todojournal";
- return str;
-}
-static ToDoEvent xmlToEvent( XMLElement *element )
-{
- QString dummy;
- ToDoEvent event;
- bool ok;
- int dumInt;
- // completed
- dummy = element->attribute("Completed" );
- dumInt = dummy.toInt(&ok );
- if(ok ) event.setCompleted( dumInt == 0 ? false : true );
- // hasDate
- dummy = element->attribute("HasDate" );
- dumInt = dummy.toInt(&ok );
- if(ok ) event.setHasDate( dumInt == 0 ? false: true );
- // set the date
- bool hasDa = dumInt;
- if ( hasDa ) { //parse the date
- int year, day, month = 0;
- year = day = month;
- // year
- dummy = element->attribute("DateYear" );
- dumInt = dummy.toInt(&ok );
- if( ok ) year = dumInt;
- // month
- dummy = element->attribute("DateMonth" );
- dumInt = dummy.toInt(&ok );
- if(ok ) month = dumInt;
- dummy = element->attribute("DateDay" );
- dumInt = dummy.toInt(&ok );
- if(ok ) day = dumInt;
- // set the date
- QDate date( year, month, day );
- event.setDate( date);
- }
- dummy = element->attribute("Priority" );
- dumInt = dummy.toInt(&ok );
- if(!ok ) dumInt = ToDoEvent::NORMAL;
- event.setPriority( dumInt );
- //description
- dummy = element->attribute("Description" );
- event.setDescription( dummy );
- // summary
- dummy = element->attribute("Summary" );
- event.setSummary( dummy );
- // category
- dummy = element->attribute("Categories" );
- QStringList ids = QStringList::split(";", dummy );
- event.setCategories( ids );
-
- //uid
- dummy = element->attribute("Uid" );
- dumInt = dummy.toInt(&ok );
- if(ok ) event.setUid( dumInt );
- return event;
-}
-
-}
-// int TodoTable::rowHeight( int ) const
-// {
-// return 18;
-// }
-
-// int TodoTable::rowPos( int row ) const
-// {
-// return 18*row;
-// }
-
-// int TodoTable::rowAt( int pos ) const
-// {
-// return QMIN( pos/18, numRows()-1 );
-// }
-
diff --git a/core/pim/todo/todotable.h b/core/pim/todo/todotable.h
deleted file mode 100644
index 387dddb..0000000
--- a/core/pim/todo/todotable.h
+++ b/dev/null
@@ -1,245 +0,0 @@
-/**********************************************************************
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
-**
-** This file is part of 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 TODOTABLE_H
-#define TODOTABLE_H
-
-#include <qpe/categories.h>
-#include <qpe/stringutil.h>
-//#include <qpe/task.h>
-#include <opie/todoevent.h>
-
-#include <qtable.h>
-#include <qmap.h>
-#include <qguardedptr.h>
-
-class Node;
-class QComboBox;
-class QTimer;
-
-class CheckItem : public QTableItem
-{
-public:
- CheckItem( QTable *t, const QString &sortkey );
-
- void setChecked( bool b );
- void toggle();
- bool isChecked() const;
- void setKey( const QString &key ) { sortKey = key; }
- QString key() const;
-
- void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected );
-
-private:
- bool checked;
- QString sortKey;
-};
-
-class ComboItem : public QTableItem
-{
-public:
- ComboItem( QTable *t, EditType et );
- QWidget *createEditor() const;
- void setContentFromEditor( QWidget *w );
- void setText( const QString &s );
- int alignment() const { return Qt::AlignCenter; }
-
- QString text() const;
-
-private:
- QGuardedPtr<QComboBox> cb;
-
-};
-
-class TodoTextItem : public QTableItem
-{
-public:
- TodoTextItem( QTable *t, const QString & str )
- :QTableItem( t, QTableItem::Never, str ) {}
-
- QString key () const { return Qtopia::buildSortKey( text() ); }
-};
-
-class DueTextItem : public QTableItem
-{
- public:
- DueTextItem( QTable *t, ToDoEvent *ev );
- QString key() const;
- void setToDoEvent( const ToDoEvent *ev );
- void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected );
- private:
- int m_off;
- bool m_hasDate:1;
- bool m_completed:1;
-
-};
-
-
-enum journal_action { ACTION_ADD=0, ACTION_REMOVE, ACTION_REPLACE };
-
-namespace Opie
-{
-class XMLElement;
-};
-
-class TodoTable : public QTable
-{
- Q_OBJECT
-
-public:
- TodoTable( QWidget *parent = 0, const char * name = 0 );
- void addEntry( const ToDoEvent &todo );
- void clearFindRow() { currFindRow = -2; }
-
- ToDoEvent currentEntry() const;
- void replaceCurrentEntry( const ToDoEvent &todo, bool fromTableItem = false );
-
- QStringList categories();
-
- void setShowCompleted( bool sc ) { showComp = sc; updateVisible(); }
- bool showCompleted() const { return showComp; }
-
- void setShowDeadline (bool sd) {showDeadl = sd; updateVisible();}
- bool showDeadline() const { return showDeadl;}
-
- void setShowCategory( const QString &c ) { showCat = c; updateVisible(); }
- const QString &showCategory() const { return showCat; }
- int showCategoryId() const;
-
- bool save( const QString &fn );
- void load( const QString &fn );
- void applyJournal( );
- void clear();
- void removeCurrentEntry();
- void removeAllEntries() { clear(); };
- //void removeAllEntriesInCategory(const QString &category );
-
- void setPaintingEnabled( bool e );
-
- virtual void sortColumn( int col, bool ascending, bool /*wholeRows*/ );
-
-// int rowHeight( int ) const;
-// int rowPos( int row ) const;
-// virtual int rowAt( int pos ) const;
-
-signals:
- void signalEdit();
- void signalDoneChanged( bool b );
- void signalPriorityChanged( int i );
- void signalShowMenu( const QPoint & );
- void signalNotFound();
- void signalWrapAround();
- void showDetails( const ToDoEvent & );
-protected:
- void keyPressEvent( QKeyEvent *e );
-
-private:
- void updateVisible();
- void viewportPaintEvent( QPaintEvent * );
- void internalAddEntries( QList<ToDoEvent> &list);
- inline void insertIntoTable( ToDoEvent *todo, int row );
- void updateJournal( const ToDoEvent &todo, journal_action action);
- void mergeJournal();
- void journalFreeReplaceEntry( const ToDoEvent &todo, int row );
- void journalFreeRemoveEntry( int row );
- inline void realignTable( int row );
- void loadFile( const QString &strFile);
-
-private slots:
- void slotClicked( int row, int col, int button, const QPoint &pos );
- void slotPressed( int row, int col, int button, const QPoint &pos );
- void slotCheckPriority(int row, int col );
- void slotCurrentChanged(int row, int col );
- void slotDoFind( const QString &findString, bool caseSensetive,
- bool backwards, int category );
- void slotShowMenu();
- void rowHeightChanged( int row );
- void slotCheckDay(); // check the day
-
-private:
- friend class TodoWindow;
-
- QMap<CheckItem*, ToDoEvent *> todoList;
- QStringList categoryList;
- bool showComp;
- QString showCat;
- QTimer *menuTimer;
- QDate mDay;
- QTimer *mDayTimer; // see if the day changed
- bool enablePainting;
- Categories mCat;
- int currFindRow;
- bool showDeadl:1;
-};
-
-
-inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row )
-{
- QString sortKey = (char) ((todo->isCompleted() ? 'a' : 'A')
- + todo->priority() )
- + Qtopia::buildSortKey( todo->description() );
- CheckItem *chk = new CheckItem( this, sortKey );
- chk->setChecked( todo->isCompleted() );
- ComboItem *cmb = new ComboItem( this, QTableItem::WhenCurrent );
- cmb->setText( QString::number( todo->priority() ) );
- QString sum = todo->summary();
- QTableItem *ti = new TodoTextItem( this, sum.isEmpty() ? todo->description().left(40).simplifyWhiteSpace() : sum );
- ti->setReplaceable( false );
-
- DueTextItem *due = new DueTextItem(this, todo );
- setItem( row, 3, due);
-
- setItem( row, 0, chk );
- setItem( row, 1, cmb );
- setItem( row, 2, ti );
-
-
- todoList.insert( chk, todo );
-}
-
-inline void TodoTable::realignTable( int row )
-{
- QTableItem *ti1,
- *ti2,
- *ti3,
- *ti4;
- int totalRows = numRows();
- for ( int curr = row; curr < totalRows - 1; curr++ ) {
- // this is bad, we must take the item out and then
- // set it. In the end, it behaves no worse (time wise)
- // then the old way of saving the entries to file, clearing
- // the table re-reading in the file and resetting the table
- ti1 = item( curr + 1, 0 );
- ti2 = item( curr + 1, 1 );
- ti3 = item( curr + 1, 2 );
- ti4 = item( curr + 1, 3 );
- takeItem( ti1 );
- takeItem( ti2 );
- takeItem( ti3 );
- takeItem( ti4 );
- setItem( curr, 0, ti1 );
- setItem( curr, 1, ti2 );
- setItem( curr, 2, ti3 );
- setItem( curr, 3, ti4 );
- }
- setNumRows( totalRows - 1 );
-}
-
-#endif