-rw-r--r-- | core/pim/todo/tableitems.h | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/core/pim/todo/tableitems.h b/core/pim/todo/tableitems.h new file mode 100644 index 0000000..33ae814 --- a/dev/null +++ b/core/pim/todo/tableitems.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 <> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This program is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This program is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #ifndef OPIE_TODO_TABLE_ITEMS_H | ||
30 | #define OPIE_TODO_TABLE_ITEMS_H | ||
31 | |||
32 | #include <qarray.h> | ||
33 | #include <qguardedptr.h> | ||
34 | #include <qcombobox.h> | ||
35 | #include <qtable.h> | ||
36 | |||
37 | #include <qpe/stringutil.h> | ||
38 | |||
39 | #include <opie/ocheckitem.h> | ||
40 | #include <opie/otodo.h> | ||
41 | |||
42 | |||
43 | namespace Todo { | ||
44 | |||
45 | /** | ||
46 | * We need to reimplement OCheckItem here | ||
47 | * we need to update on change | ||
48 | * You can check a checkItem | ||
49 | */ | ||
50 | class CheckItem : public OCheckItem { | ||
51 | public: | ||
52 | CheckItem( QTable* t, const QString& sortKey, | ||
53 | int uid, | ||
54 | const QArray<int>& ); | ||
55 | ~CheckItem(); | ||
56 | virtual void setChecked( bool b ); | ||
57 | virtual void toggle(); | ||
58 | int uid()const; | ||
59 | QArray<int> cats(); | ||
60 | private: | ||
61 | int m_uid; | ||
62 | QArray<int> m_cat; | ||
63 | }; | ||
64 | |||
65 | /** | ||
66 | * creates a QComboBox if neccessary | ||
67 | * to edit inline | ||
68 | */ | ||
69 | class ComboItem : public QTableItem { | ||
70 | public: | ||
71 | ComboItem( QTable* t, EditType et ); | ||
72 | ~ComboItem(); | ||
73 | QWidget* createEditor()const; | ||
74 | void setContentFromEditor( QWidget* w ); | ||
75 | void setText( const QString& s ); | ||
76 | int alignment() const; | ||
77 | |||
78 | QString text()const; | ||
79 | |||
80 | private: | ||
81 | QGuardedPtr<QComboBox> m_cb; | ||
82 | }; | ||
83 | |||
84 | /* implement inline */ | ||
85 | inline int ComboItem::alignment()const { | ||
86 | return Qt::AlignCenter; | ||
87 | } | ||
88 | |||
89 | /** | ||
90 | * TodoTextItem builds a better specialised | ||
91 | * sortkey | ||
92 | */ | ||
93 | class TodoTextItem : public QTableItem { | ||
94 | public: | ||
95 | TodoTextItem( QTable* t, const QString& str ); | ||
96 | ~TodoTextItem(); | ||
97 | QString key()const; | ||
98 | }; | ||
99 | |||
100 | |||
101 | inline QString TodoTextItem::key() const { | ||
102 | return Qtopia::buildSortKey( text() ); | ||
103 | } | ||
104 | |||
105 | class DueTextItem : public QTableItem { | ||
106 | public: | ||
107 | DueTextItem( QTable* t, const OTodo& ); | ||
108 | ~DueTextItem(); | ||
109 | |||
110 | QString key()const; | ||
111 | void setToDoEvent( const OTodo& ev ); | ||
112 | void setCompleted( bool comp ); | ||
113 | void paint( QPainter *p, const QColorGroup &cg, | ||
114 | const QRect& cr, bool selected ); | ||
115 | private: | ||
116 | int m_off; | ||
117 | bool m_hasDate:1; | ||
118 | bool m_completed:1; | ||
119 | }; | ||
120 | |||
121 | |||
122 | }; | ||
123 | |||
124 | #endif | ||