summaryrefslogtreecommitdiff
path: root/core
authorsimon <simon>2002-04-30 14:27:27 (UTC)
committer simon <simon>2002-04-30 14:27:27 (UTC)
commit972fbb128294c821ff0f13ea59a83edb015d571e (patch) (side-by-side diff)
tree29d5de901e2e6c679d4cc76286e3e6e77a49b297 /core
parent5dae945f8ec25a811efb10eb71d606ce8da4429f (diff)
downloadopie-972fbb128294c821ff0f13ea59a83edb015d571e.zip
opie-972fbb128294c821ff0f13ea59a83edb015d571e.tar.gz
opie-972fbb128294c821ff0f13ea59a83edb015d571e.tar.bz2
- XMLTree is in the Opie namespace now
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/todotable.cpp2
-rw-r--r--core/pim/todo/todotable.h4
2 files changed, 6 insertions, 0 deletions
diff --git a/core/pim/todo/todotable.cpp b/core/pim/todo/todotable.cpp
index 208a084..2389cdd 100644
--- a/core/pim/todo/todotable.cpp
+++ b/core/pim/todo/todotable.cpp
@@ -1,95 +1,97 @@
/**********************************************************************
** 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>
#include <iostream>
+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() ) );
diff --git a/core/pim/todo/todotable.h b/core/pim/todo/todotable.h
index 2f6e635..7672f21 100644
--- a/core/pim/todo/todotable.h
+++ b/core/pim/todo/todotable.h
@@ -49,97 +49,101 @@ public:
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 & );