summaryrefslogtreecommitdiff
path: root/core/pim
authorsimon <simon>2002-04-30 14:27:27 (UTC)
committer simon <simon>2002-04-30 14:27:27 (UTC)
commit972fbb128294c821ff0f13ea59a83edb015d571e (patch) (unidiff)
tree29d5de901e2e6c679d4cc76286e3e6e77a49b297 /core/pim
parent5dae945f8ec25a811efb10eb71d606ce8da4429f (diff)
downloadopie-972fbb128294c821ff0f13ea59a83edb015d571e.zip
opie-972fbb128294c821ff0f13ea59a83edb015d571e.tar.gz
opie-972fbb128294c821ff0f13ea59a83edb015d571e.tar.bz2
- XMLTree is in the Opie namespace now
Diffstat (limited to 'core/pim') (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 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20/* Show Deadline was added by Stefan Eilers (se, eilers.stefan@epost.de) 20/* Show Deadline was added by Stefan Eilers (se, eilers.stefan@epost.de)
21 */ 21 */
22#include "todotable.h" 22#include "todotable.h"
23 23
24#include <opie/tododb.h> 24#include <opie/tododb.h>
25#include <opie/xmltree.h> 25#include <opie/xmltree.h>
26 26
27#include <qpe/categoryselect.h> 27#include <qpe/categoryselect.h>
28#include <qpe/xmlreader.h> 28#include <qpe/xmlreader.h>
29 29
30#include <qasciidict.h> 30#include <qasciidict.h>
31#include <qcombobox.h> 31#include <qcombobox.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qpainter.h> 33#include <qpainter.h>
34#include <qtextcodec.h> 34#include <qtextcodec.h>
35#include <qtimer.h> 35#include <qtimer.h>
36#include <qdatetime.h> 36#include <qdatetime.h>
37#include <qtextstream.h> 37#include <qtextstream.h>
38 38
39#include <qcursor.h> 39#include <qcursor.h>
40#include <qregexp.h> 40#include <qregexp.h>
41 41
42#include <errno.h> 42#include <errno.h>
43#include <stdlib.h> 43#include <stdlib.h>
44 44
45#include <stdio.h> 45#include <stdio.h>
46#include <iostream> 46#include <iostream>
47 47
48using namespace Opie;
49
48namespace { 50namespace {
49 51
50 static bool taskCompare( const ToDoEvent &task, const QRegExp &r, int category ); 52 static bool taskCompare( const ToDoEvent &task, const QRegExp &r, int category );
51 static QString journalFileName(); 53 static QString journalFileName();
52 static ToDoEvent xmlToEvent( XMLElement *ev ); 54 static ToDoEvent xmlToEvent( XMLElement *ev );
53} 55}
54CheckItem::CheckItem( QTable *t, const QString &key ) 56CheckItem::CheckItem( QTable *t, const QString &key )
55 : QTableItem( t, Never, "" ), checked( FALSE ), sortKey( key ) 57 : QTableItem( t, Never, "" ), checked( FALSE ), sortKey( key )
56{ 58{
57} 59}
58 60
59QString CheckItem::key() const 61QString CheckItem::key() const
60{ 62{
61 return sortKey; 63 return sortKey;
62} 64}
63 65
64void CheckItem::setChecked( bool b ) 66void CheckItem::setChecked( bool b )
65{ 67{
66 checked = b; 68 checked = b;
67 table()->updateCell( row(), col() ); 69 table()->updateCell( row(), col() );
68} 70}
69 71
70void CheckItem::toggle() 72void CheckItem::toggle()
71{ 73{
72 TodoTable *parent = static_cast<TodoTable*>(table()); 74 TodoTable *parent = static_cast<TodoTable*>(table());
73 ToDoEvent newTodo = parent->currentEntry(); 75 ToDoEvent newTodo = parent->currentEntry();
74 checked = !checked; 76 checked = !checked;
75 newTodo.setCompleted( checked ); 77 newTodo.setCompleted( checked );
76 table()->updateCell( row(), col() ); 78 table()->updateCell( row(), col() );
77 parent->replaceCurrentEntry( newTodo, true ); 79 parent->replaceCurrentEntry( newTodo, true );
78} 80}
79 81
80bool CheckItem::isChecked() const 82bool CheckItem::isChecked() const
81{ 83{
82 return checked; 84 return checked;
83} 85}
84 86
85static const int BoxSize = 10; 87static const int BoxSize = 10;
86 88
87void CheckItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr, 89void CheckItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr,
88 bool ) 90 bool )
89{ 91{
90 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); 92 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) );
91 93
92 int marg = ( cr.width() - BoxSize ) / 2; 94 int marg = ( cr.width() - BoxSize ) / 2;
93 int x = 0; 95 int x = 0;
94 int y = ( cr.height() - BoxSize ) / 2; 96 int y = ( cr.height() - BoxSize ) / 2;
95 p->setPen( QPen( cg.text() ) ); 97 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:
49 49
50private: 50private:
51 bool checked; 51 bool checked;
52 QString sortKey; 52 QString sortKey;
53}; 53};
54 54
55class ComboItem : public QTableItem 55class ComboItem : public QTableItem
56{ 56{
57public: 57public:
58 ComboItem( QTable *t, EditType et ); 58 ComboItem( QTable *t, EditType et );
59 QWidget *createEditor() const; 59 QWidget *createEditor() const;
60 void setContentFromEditor( QWidget *w ); 60 void setContentFromEditor( QWidget *w );
61 void setText( const QString &s ); 61 void setText( const QString &s );
62 int alignment() const { return Qt::AlignCenter; } 62 int alignment() const { return Qt::AlignCenter; }
63 63
64 QString text() const; 64 QString text() const;
65 65
66private: 66private:
67 QGuardedPtr<QComboBox> cb; 67 QGuardedPtr<QComboBox> cb;
68 68
69}; 69};
70 70
71class TodoTextItem : public QTableItem 71class TodoTextItem : public QTableItem
72{ 72{
73public: 73public:
74 TodoTextItem( QTable *t, const QString & str ) 74 TodoTextItem( QTable *t, const QString & str )
75 :QTableItem( t, QTableItem::Never, str ) {} 75 :QTableItem( t, QTableItem::Never, str ) {}
76 76
77 QString key () const { return Qtopia::buildSortKey( text() ); } 77 QString key () const { return Qtopia::buildSortKey( text() ); }
78}; 78};
79 79
80class DueTextItem : public QTableItem 80class DueTextItem : public QTableItem
81{ 81{
82 public: 82 public:
83 DueTextItem( QTable *t, ToDoEvent *ev ); 83 DueTextItem( QTable *t, ToDoEvent *ev );
84 QString key() const; 84 QString key() const;
85 void setToDoEvent( const ToDoEvent *ev ); 85 void setToDoEvent( const ToDoEvent *ev );
86 void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ); 86 void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected );
87 private: 87 private:
88 int m_off; 88 int m_off;
89 bool m_hasDate:1; 89 bool m_hasDate:1;
90 bool m_completed:1; 90 bool m_completed:1;
91 91
92}; 92};
93 93
94 94
95enum journal_action { ACTION_ADD=0, ACTION_REMOVE, ACTION_REPLACE }; 95enum journal_action { ACTION_ADD=0, ACTION_REMOVE, ACTION_REPLACE };
96 96
97namespace Opie
98{
97class XMLElement; 99class XMLElement;
100};
101
98class TodoTable : public QTable 102class TodoTable : public QTable
99{ 103{
100 Q_OBJECT 104 Q_OBJECT
101 105
102public: 106public:
103 TodoTable( QWidget *parent = 0, const char * name = 0 ); 107 TodoTable( QWidget *parent = 0, const char * name = 0 );
104 void addEntry( const ToDoEvent &todo ); 108 void addEntry( const ToDoEvent &todo );
105 void clearFindRow() { currFindRow = -2; } 109 void clearFindRow() { currFindRow = -2; }
106 110
107 ToDoEvent currentEntry() const; 111 ToDoEvent currentEntry() const;
108 void replaceCurrentEntry( const ToDoEvent &todo, bool fromTableItem = false ); 112 void replaceCurrentEntry( const ToDoEvent &todo, bool fromTableItem = false );
109 113
110 QStringList categories(); 114 QStringList categories();
111 115
112 void setShowCompleted( bool sc ) { showComp = sc; updateVisible(); } 116 void setShowCompleted( bool sc ) { showComp = sc; updateVisible(); }
113 bool showCompleted() const { return showComp; } 117 bool showCompleted() const { return showComp; }
114 118
115 void setShowDeadline (bool sd) {showDeadl = sd; updateVisible();} 119 void setShowDeadline (bool sd) {showDeadl = sd; updateVisible();}
116 bool showDeadline() const { return showDeadl;} 120 bool showDeadline() const { return showDeadl;}
117 121
118 void setShowCategory( const QString &c ) { showCat = c; updateVisible(); } 122 void setShowCategory( const QString &c ) { showCat = c; updateVisible(); }
119 const QString &showCategory() const { return showCat; } 123 const QString &showCategory() const { return showCat; }
120 int showCategoryId() const; 124 int showCategoryId() const;
121 125
122 bool save( const QString &fn ); 126 bool save( const QString &fn );
123 void load( const QString &fn ); 127 void load( const QString &fn );
124 void applyJournal( ); 128 void applyJournal( );
125 void clear(); 129 void clear();
126 void removeCurrentEntry(); 130 void removeCurrentEntry();
127 void removeAllEntries() { clear(); }; 131 void removeAllEntries() { clear(); };
128 //void removeAllEntriesInCategory(const QString &category ); 132 //void removeAllEntriesInCategory(const QString &category );
129 133
130 void setPaintingEnabled( bool e ); 134 void setPaintingEnabled( bool e );
131 135
132 virtual void sortColumn( int col, bool ascending, bool /*wholeRows*/ ); 136 virtual void sortColumn( int col, bool ascending, bool /*wholeRows*/ );
133 137
134// int rowHeight( int ) const; 138// int rowHeight( int ) const;
135// int rowPos( int row ) const; 139// int rowPos( int row ) const;
136// virtual int rowAt( int pos ) const; 140// virtual int rowAt( int pos ) const;
137 141
138signals: 142signals:
139 void signalEdit(); 143 void signalEdit();
140 void signalDoneChanged( bool b ); 144 void signalDoneChanged( bool b );
141 void signalPriorityChanged( int i ); 145 void signalPriorityChanged( int i );
142 void signalShowMenu( const QPoint & ); 146 void signalShowMenu( const QPoint & );
143 void signalNotFound(); 147 void signalNotFound();
144 void signalWrapAround(); 148 void signalWrapAround();
145 void showDetails( const ToDoEvent & ); 149 void showDetails( const ToDoEvent & );