summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp6
-rw-r--r--core/pim/todo/mainwindow.h7
-rw-r--r--core/pim/todo/quickeditimpl.cpp2
-rw-r--r--core/pim/todo/tableview.cpp133
-rw-r--r--core/pim/todo/tableview.h4
5 files changed, 75 insertions, 77 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index f0aa455..0ccf73e 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -165,100 +165,98 @@ void MainWindow::initActions() {
165 m_options->insertSeparator(); 165 m_options->insertSeparator();
166 166
167 m_completedAction = new QAction( QString::null, tr("Show completed tasks"), 167 m_completedAction = new QAction( QString::null, tr("Show completed tasks"),
168 0, this, 0, TRUE ); 168 0, this, 0, TRUE );
169 m_completedAction->addTo( m_options ); 169 m_completedAction->addTo( m_options );
170 m_completedAction->setOn( showCompleted() ); 170 m_completedAction->setOn( showCompleted() );
171 connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); 171 connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) );
172 172
173 a = new QAction( QString::null, tr("Show only over-due tasks"), 173 a = new QAction( QString::null, tr("Show only over-due tasks"),
174 0, this, 0, TRUE ); 174 0, this, 0, TRUE );
175 a->addTo( m_options ); 175 a->addTo( m_options );
176 a->setOn( showOverDue() ); 176 a->setOn( showOverDue() );
177 connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); 177 connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) );
178 178
179 m_showDeadLineAction = new QAction( QString::null, tr("Show task deadlines"), 179 m_showDeadLineAction = new QAction( QString::null, tr("Show task deadlines"),
180 0, this, 0, TRUE ); 180 0, this, 0, TRUE );
181 m_showDeadLineAction->addTo( m_options ); 181 m_showDeadLineAction->addTo( m_options );
182 m_showDeadLineAction->setOn( showDeadline() ); 182 m_showDeadLineAction->setOn( showDeadline() );
183 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) ); 183 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) );
184 184
185 m_showQuickTaskAction = new QAction( QString::null, tr("Show quick task bar"), 185 m_showQuickTaskAction = new QAction( QString::null, tr("Show quick task bar"),
186 0, this, 0, TRUE ); 186 0, this, 0, TRUE );
187 m_showQuickTaskAction->addTo( m_options ); 187 m_showQuickTaskAction->addTo( m_options );
188 m_showQuickTaskAction->setOn( showQuickTask() ); 188 m_showQuickTaskAction->setOn( showQuickTask() );
189 connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); 189 connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) );
190 190
191 m_options->insertSeparator(); 191 m_options->insertSeparator();
192 192
193 m_bar->insertItem( tr("Data") ,m_edit ); 193 m_bar->insertItem( tr("Data") ,m_edit );
194 m_bar->insertItem( tr("Category"), m_catMenu ); 194 m_bar->insertItem( tr("Category"), m_catMenu );
195 m_bar->insertItem( tr("Options"), m_options ); 195 m_bar->insertItem( tr("Options"), m_options );
196 196
197 m_curQuick = new QuickEditImpl( this, m_quicktask ); 197 m_curQuick = new QuickEditImpl( this, m_quicktask );
198 addToolBar( (QPEToolBar *)m_curQuick->widget(), tr( "QuickEdit" ), QMainWindow::Top, TRUE ); 198 addToolBar( (QPEToolBar *)m_curQuick->widget(), tr( "QuickEdit" ), QMainWindow::Top, TRUE );
199 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); 199 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) );
200 200
201} 201}
202/* m_curCat from Config */ 202/* m_curCat from Config */
203void MainWindow::initConfig() { 203void MainWindow::initConfig() {
204 Config config( "todo" ); 204 Config config( "todo" );
205 config.setGroup( "View" ); 205 config.setGroup( "View" );
206 m_completed = config.readBoolEntry( "ShowComplete", TRUE ); 206 m_completed = config.readBoolEntry( "ShowComplete", TRUE );
207 m_curCat = config.readEntry( "Category", QString::null ); 207 m_curCat = config.readEntry( "Category", QString::null );
208 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); 208 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE);
209 m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); 209 m_overdue = config.readBoolEntry("ShowOverDue", FALSE );
210 m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); 210 m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE);
211} 211}
212void MainWindow::initUI() { 212void MainWindow::initUI() {
213 m_mainBox = new QVBox(this, "main box "); 213 m_stack = new QWidgetStack(this, "main stack");
214 214 setCentralWidget( m_stack );
215 m_stack = new QWidgetStack(m_mainBox, "main stack");
216 setCentralWidget( m_mainBox );
217 215
218 setToolBarsMovable( FALSE ); 216 setToolBarsMovable( FALSE );
219 217
220 m_tool = new QPEToolBar( this ); 218 m_tool = new QPEToolBar( this );
221 m_tool->setHorizontalStretchable( TRUE ); 219 m_tool->setHorizontalStretchable( TRUE );
222 220
223 m_bar = new QMenuBar( m_tool ); 221 m_bar = new QMenuBar( m_tool );
224 222
225 /** QPopupMenu */ 223 /** QPopupMenu */
226 m_edit = new QPopupMenu( this ); 224 m_edit = new QPopupMenu( this );
227 m_options = new QPopupMenu( this ); 225 m_options = new QPopupMenu( this );
228 m_catMenu = new QPopupMenu( this ); 226 m_catMenu = new QPopupMenu( this );
229 m_template = new QPopupMenu( this ); 227 m_template = new QPopupMenu( this );
230 228
231 m_catMenu->setCheckable( TRUE ); 229 m_catMenu->setCheckable( TRUE );
232 m_template->setCheckable( TRUE ); 230 m_template->setCheckable( TRUE );
233 231
234 connect(m_catMenu, SIGNAL(activated(int) ), 232 connect(m_catMenu, SIGNAL(activated(int) ),
235 this, SLOT(setCategory(int) ) ); 233 this, SLOT(setCategory(int) ) );
236 connect(m_template, SIGNAL(activated(int) ), 234 connect(m_template, SIGNAL(activated(int) ),
237 this, SLOT(slotNewFromTemplate(int) ) ); 235 this, SLOT(slotNewFromTemplate(int) ) );
238} 236}
239void MainWindow::initViews() { 237void MainWindow::initViews() {
240 TableView* tableView = new TableView( this, m_stack ); 238 TableView* tableView = new TableView( this, m_stack );
241 m_stack->addWidget( tableView, m_counter++ ); 239 m_stack->addWidget( tableView, m_counter++ );
242 m_views.append( tableView ); 240 m_views.append( tableView );
243 m_curView = tableView; 241 m_curView = tableView;
244 connectBase( tableView ); 242 connectBase( tableView );
245 /* add QString type + QString configname to 243 /* add QString type + QString configname to
246 * the View menu 244 * the View menu
247 * and subdirs for multiple views 245 * and subdirs for multiple views
248 */ 246 */
249} 247}
250void MainWindow::initEditor() { 248void MainWindow::initEditor() {
251 m_curEdit = new Editor(); 249 m_curEdit = new Editor();
252} 250}
253void MainWindow::initShow() { 251void MainWindow::initShow() {
254 m_curShow = new TextViewShow(this); 252 m_curShow = new TextViewShow(this);
255 m_stack->addWidget( m_curShow->widget() , m_counter++ ); 253 m_stack->addWidget( m_curShow->widget() , m_counter++ );
256} 254}
257MainWindow::~MainWindow() { 255MainWindow::~MainWindow() {
258 delete templateManager(); 256 delete templateManager();
259} 257}
260void MainWindow::connectBase( ViewBase* ) { 258void MainWindow::connectBase( ViewBase* ) {
261 // once templates and signals mix we'll use it again 259 // once templates and signals mix we'll use it again
262} 260}
263QPopupMenu* MainWindow::contextMenu( int , bool recur ) { 261QPopupMenu* MainWindow::contextMenu( int , bool recur ) {
264 QPopupMenu* menu = new QPopupMenu(); 262 QPopupMenu* menu = new QPopupMenu();
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h
index 86b9ac2..d756d64 100644
--- a/core/pim/todo/mainwindow.h
+++ b/core/pim/todo/mainwindow.h
@@ -95,103 +95,96 @@ namespace Todo {
95 void setReadAhead(uint count ); 95 void setReadAhead(uint count );
96private slots: 96private slots:
97 void slotQuickEntered(); 97 void slotQuickEntered();
98 void populateCategories(); 98 void populateCategories();
99 void slotReload(); 99 void slotReload();
100 void slotFlush(); 100 void slotFlush();
101 101
102 protected: 102 protected:
103 void closeEvent( QCloseEvent* e ); 103 void closeEvent( QCloseEvent* e );
104 104
105 private: 105 private:
106 void receiveFile( const QString& filename ); 106 void receiveFile( const QString& filename );
107 void connectBase( ViewBase* ); 107 void connectBase( ViewBase* );
108 void initUI(); 108 void initUI();
109 void initActions(); 109 void initActions();
110 void initConfig(); 110 void initConfig();
111 void initViews(); 111 void initViews();
112 void initEditor(); 112 void initEditor();
113 void initShow(); 113 void initShow();
114 void initTemplate(); 114 void initTemplate();
115 void raiseCurrentView(); 115 void raiseCurrentView();
116 ViewBase* currentView(); 116 ViewBase* currentView();
117 ViewBase* m_curView; 117 ViewBase* m_curView;
118 QuickEditBase* m_curQuick; 118 QuickEditBase* m_curQuick;
119 Editor* m_curEdit; 119 Editor* m_curEdit;
120 TodoShow* currentShow(); 120 TodoShow* currentShow();
121 TodoShow* m_curShow; 121 TodoShow* m_curShow;
122 TemplateEditor* currentTemplateEditor(); 122 TemplateEditor* currentTemplateEditor();
123 TemplateEditor* m_curTempEd; 123 TemplateEditor* m_curTempEd;
124 124
125 QMenuBar* m_bar; 125 QMenuBar* m_bar;
126 QToolBar* m_tool; 126 QToolBar* m_tool;
127 QAction* m_editAction, 127 QAction* m_editAction,
128 *m_deleteAction, 128 *m_deleteAction,
129 *m_findAction, 129 *m_findAction,
130 *m_completedAction, 130 *m_completedAction,
131 *m_showDeadLineAction, 131 *m_showDeadLineAction,
132 *m_deleteAllAction, 132 *m_deleteAllAction,
133 *m_deleteCompleteAction, 133 *m_deleteCompleteAction,
134 *m_duplicateAction, 134 *m_duplicateAction,
135 *m_showOverDueAction, 135 *m_showOverDueAction,
136 *m_showQuickTaskAction, 136 *m_showQuickTaskAction,
137 *m_effectiveAction; 137 *m_effectiveAction;
138 QWidgetStack *m_stack; 138 QWidgetStack *m_stack;
139 QPopupMenu* m_catMenu, 139 QPopupMenu* m_catMenu,
140 *m_edit, 140 *m_edit,
141 *m_options, 141 *m_options,
142 *m_template; 142 *m_template;
143 /* box with two rows
144 * top will be the quick edit
145 * this will bite my ass once
146 * we want to have all parts
147 * exchangeable
148 */
149 QVBox* m_mainBox;
150 143
151 bool m_syncing:1; 144 bool m_syncing:1;
152 bool m_deadline:1; 145 bool m_deadline:1;
153 bool m_completed:1; 146 bool m_completed:1;
154 bool m_overdue:1; 147 bool m_overdue:1;
155 bool m_quicktask:1; 148 bool m_quicktask:1;
156 TodoManager m_todoMgr; 149 TodoManager m_todoMgr;
157 QString m_curCat; 150 QString m_curCat;
158 QList<ViewBase> m_views; 151 QList<ViewBase> m_views;
159 uint m_counter; 152 uint m_counter;
160 TemplateManager* m_tempManager; 153 TemplateManager* m_tempManager;
161 154
162 155
163 private slots: 156 private slots:
164 void slotShow(int); 157 void slotShow(int);
165 void slotEdit(int); 158 void slotEdit(int);
166 void slotUpdate3( QWidget* ); 159 void slotUpdate3( QWidget* );
167 void slotComplete( int uid ); 160 void slotComplete( int uid );
168 void slotComplete( const OTodo& ev ); 161 void slotComplete( const OTodo& ev );
169 void slotNewFromTemplate(int id ); 162 void slotNewFromTemplate(int id );
170 void slotNew(); 163 void slotNew();
171 void slotDuplicate(); 164 void slotDuplicate();
172 165
173 void slotDelete(); 166 void slotDelete();
174 void slotDeleteAll(); 167 void slotDeleteAll();
175 void slotDeleteCompleted(); 168 void slotDeleteCompleted();
176 169
177 void slotEdit(); 170 void slotEdit();
178 void slotFind(); 171 void slotFind();
179 172
180 void setCategory( int ); 173 void setCategory( int );
181 174
182 void slotShowDeadLine( bool ); 175 void slotShowDeadLine( bool );
183 void slotShowCompleted( bool ); 176 void slotShowCompleted( bool );
184 void slotShowQuickTask( bool ); 177 void slotShowQuickTask( bool );
185 178
186 void setDocument( const QString& ); 179 void setDocument( const QString& );
187 180
188 181
189 void slotBeam(); 182 void slotBeam();
190 void beamDone( Ir* ); 183 void beamDone( Ir* );
191 void slotShowDetails(); 184 void slotShowDetails();
192 void slotShowDue( bool ); 185 void slotShowDue( bool );
193 /* reimplementation from opimmainwindow */ 186 /* reimplementation from opimmainwindow */
194 protected slots: 187 protected slots:
195 void flush(); 188 void flush();
196 void reload(); 189 void reload();
197 int create(); 190 int create();
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp
index 8d0a9fd..cadec03 100644
--- a/core/pim/todo/quickeditimpl.cpp
+++ b/core/pim/todo/quickeditimpl.cpp
@@ -1,65 +1,65 @@
1#include <qaction.h> 1#include <qaction.h>
2#include <qlineedit.h> 2#include <qlineedit.h>
3 3
4#include <qpe/resource.h> 4#include <qpe/resource.h>
5 5
6#include <opie/oclickablelabel.h> 6#include <opie/oclickablelabel.h>
7 7
8#include "mainwindow.h" 8#include "mainwindow.h"
9#include "quickeditimpl.h" 9#include "quickeditimpl.h"
10 10
11 11
12QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) 12QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible )
13 : QPEToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { 13 : QPEToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) {
14 setHorizontalStretchable( TRUE ); 14 setHorizontalStretchable( TRUE );
15 15
16 // Load priority icons 16 // Load priority icons
17 // TODO - probably should be done globally somewhere else 17 // TODO - probably should be done globally somewhere else, see also tableview.cpp/h
18 priority1 = Resource::loadPixmap( "todo/priority1" ); 18 priority1 = Resource::loadPixmap( "todo/priority1" );
19 priority3 = Resource::loadPixmap( "todo/priority3" ); 19 priority3 = Resource::loadPixmap( "todo/priority3" );
20 priority5 = Resource::loadPixmap( "todo/priority5" ); 20 priority5 = Resource::loadPixmap( "todo/priority5" );
21 21
22 22
23 // TODO - come up with icons and replace text priority values 23 // TODO - come up with icons and replace text priority values
24 m_lbl = new OClickableLabel( this ); 24 m_lbl = new OClickableLabel( this );
25 m_lbl->setMinimumWidth(15); 25 m_lbl->setMinimumWidth(15);
26 m_lbl->setPixmap( priority3 ); 26 m_lbl->setPixmap( priority3 );
27 connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); 27 connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) );
28 28
29 m_edit = new QLineEdit( this ); 29 m_edit = new QLineEdit( this );
30 setStretchableWidget( m_edit ); 30 setStretchableWidget( m_edit );
31 31
32 QAction *a = new QAction( tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); 32 QAction *a = new QAction( tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 );
33 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); 33 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) );
34 a->addTo( this ); 34 a->addTo( this );
35 35
36 a = new QAction( tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); 36 a = new QAction( tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
37 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); 37 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) );
38 a->addTo( this ); 38 a->addTo( this );
39 39
40 a = new QAction( tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 40 a = new QAction( tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
41 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); 41 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) );
42 a->addTo( this ); 42 a->addTo( this );
43 43
44 m_visible = visible; 44 m_visible = visible;
45 if ( !m_visible ) { 45 if ( !m_visible ) {
46 hide(); 46 hide();
47 } 47 }
48 48
49 m_menu = 0l; 49 m_menu = 0l;
50 reinit(); 50 reinit();
51} 51}
52QuickEditImpl::~QuickEditImpl() { 52QuickEditImpl::~QuickEditImpl() {
53 53
54} 54}
55OTodo QuickEditImpl::todo()const { 55OTodo QuickEditImpl::todo()const {
56 return m_todo; 56 return m_todo;
57} 57}
58QWidget* QuickEditImpl::widget() { 58QWidget* QuickEditImpl::widget() {
59 return this; 59 return this;
60} 60}
61void QuickEditImpl::slotEnter() { 61void QuickEditImpl::slotEnter() {
62 OTodo todo; 62 OTodo todo;
63 63
64 64
65 if (!m_edit->text().isEmpty() ) { 65 if (!m_edit->text().isEmpty() ) {
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index a8cc271..faf4611 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -1,159 +1,175 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 <zecke> 3             .=l. Copyright (c) 2002 <zecke>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This program is free software; you can 5 _;:,     .>    :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that 12    .i_,=:_.      -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28#include <stdlib.h> 28#include <stdlib.h>
29#include <cmath> 29#include <cmath>
30 30
31#include <qcombobox.h> 31#include <qcombobox.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qtimer.h> 33#include <qtimer.h>
34#include <qpoint.h> 34#include <qpoint.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36 36
37#include <qpe/config.h> 37#include <qpe/config.h>
38#include <qpe/resource.h>
38 39
39#include <opie/orecur.h> 40#include <opie/orecur.h>
40 41
41#include "mainwindow.h" 42#include "mainwindow.h"
42//#include "tableitems.h" 43//#include "tableitems.h"
43#include "tableview.h" 44#include "tableview.h"
44 45
45using namespace Todo; 46using namespace Todo;
46 47
47namespace { 48namespace {
48 static const int BoxSize = 14; 49 static const int BoxSize = 14;
49 static const int RowHeight = 20; 50 static const int RowHeight = 20;
50} 51}
51 52
52 53
53void TableView::initConfig() { 54void TableView::initConfig() {
54 Config config( "todo" ); 55 Config config( "todo" );
55 config.setGroup( "Options" ); 56 config.setGroup( "Options" );
56 m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 ); 57 m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 );
57} 58}
58 59
59TableView::TableView( MainWindow* window, QWidget* wid ) 60TableView::TableView( MainWindow* window, QWidget* wid )
60 : QTable( wid ), TodoView( window ) { 61 : QTable( wid ), TodoView( window ) {
61 setUpdatesEnabled( false ); 62 setUpdatesEnabled( false );
62 viewport()->setUpdatesEnabled( false ); 63 viewport()->setUpdatesEnabled( false );
63 m_enablePaint = false; 64 m_enablePaint = false;
64 setNumRows(0); 65 setNumRows(0);
65 setNumCols(4); 66 setNumCols(4);
66 67
68 horizontalHeader()->setLabel( 0, tr("C.") );
69 horizontalHeader()->setLabel( 1, tr("Prior.") );
70 horizontalHeader()->setLabel( 2, tr("Description" ) );
71 horizontalHeader()->setLabel( 3, tr("Deadline") );
72
67 setSorting( TRUE ); 73 setSorting( TRUE );
68 setSelectionMode( NoSelection ); 74 setSelectionMode( NoSelection );
69// setColumnStretchable( 2, TRUE ); 75
70 setColumnStretchable( 3, FALSE );
71 setColumnWidth(0, 20 );
72 setColumnWidth(1, 35 );
73 setColumnWidth(3, 18 );
74
75 setLeftMargin( 0 ); 76 setLeftMargin( 0 );
76 verticalHeader()->hide(); 77 verticalHeader()->hide();
77 78
78 horizontalHeader()->setLabel(0, tr("C.") );
79 horizontalHeader()->setLabel(1, tr("Prior.") );
80 horizontalHeader()->setLabel(2, tr("Description" ) );
81
82// setColumnStretchable(3, FALSE );
83
84 horizontalHeader()->setLabel(3, tr("Deadline") );
85
86 if ( todoWindow()->showDeadline() ) 79 if ( todoWindow()->showDeadline() )
87 showColumn( 3); 80 showColumn( 3 );
88 else 81 else
89 hideColumn(3 ); 82 hideColumn( 3 );
90 83
91 connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ), 84 connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ),
92 this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); 85 this, SLOT( slotClicked(int, int, int, const QPoint& ) ) );
93 connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), 86 connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ),
94 this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); 87 this, SLOT( slotPressed(int, int, int, const QPoint& ) ) );
95 connect((QTable*)this, SIGNAL(valueChanged(int, int) ), 88 connect((QTable*)this, SIGNAL(valueChanged(int, int) ),
96 this, SLOT( slotValueChanged(int, int) ) ); 89 this, SLOT( slotValueChanged(int, int) ) );
97 connect((QTable*)this, SIGNAL(currentChanged(int, int) ), 90 connect((QTable*)this, SIGNAL(currentChanged(int, int) ),
98 this, SLOT( slotCurrentChanged(int, int) ) ); 91 this, SLOT( slotCurrentChanged(int, int) ) );
99 92
100 m_menuTimer = new QTimer( this ); 93 m_menuTimer = new QTimer( this );
101 connect( m_menuTimer, SIGNAL(timeout()), 94 connect( m_menuTimer, SIGNAL(timeout()),
102 this, SLOT(slotShowMenu()) ); 95 this, SLOT(slotShowMenu()) );
103 96
104 m_enablePaint = true; 97 m_enablePaint = true;
105 setUpdatesEnabled( true ); 98 setUpdatesEnabled( true );
106 viewport()->setUpdatesEnabled( true ); 99 viewport()->setUpdatesEnabled( true );
107 viewport()->update(); 100 viewport()->update();
108 setSortOrder( 0 ); 101 setSortOrder( 0 );
109 setAscending( TRUE ); 102 setAscending( TRUE );
110 m_first = true; 103 m_first = true;
111 104
105 // Load icons
106 // TODO - probably should be done globally somewhere else, see also quickeditimpl.cpp/h
107 m_pic_completed = Resource::loadPixmap( "todo/completed" );
108 QString namestr;
109 for ( unsigned int i = 1; i < 6; i++ ) {
110 namestr = "todo/priority";
111 namestr.append( QString::number( i ) );
112 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr );
113 }
114
115 // Try to intelligently size columns
116 int col2width = 240;
117 int width = m_pic_completed.width();
118 setColumnWidth( 0, width );
119 col2width -= width;
120 width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width()+8;
121 setColumnWidth( 1, width );
122 col2width -= width;
123 width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width()+8;
124 setColumnWidth( 3, width );
125 col2width -= width;
126 setColumnWidth( 2, col2width - 2 );
127
112 /* now let's init the config */ 128 /* now let's init the config */
113 initConfig(); 129 initConfig();
114} 130}
115/* a new day has started 131/* a new day has started
116 * update the day 132 * update the day
117 */ 133 */
118void TableView::newDay() { 134void TableView::newDay() {
119 clear(); 135 clear();
120 updateView(); 136 updateView();
121} 137}
122TableView::~TableView() { 138TableView::~TableView() {
123 139
124} 140}
125void TableView::slotShowMenu() { 141void TableView::slotShowMenu() {
126 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); 142 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() );
127 menu->exec(QCursor::pos() ); 143 menu->exec(QCursor::pos() );
128 delete menu; 144 delete menu;
129} 145}
130QString TableView::type() const { 146QString TableView::type() const {
131 return QString::fromLatin1( tr("Table View") ); 147 return QString::fromLatin1( tr("Table View") );
132} 148}
133int TableView::current() { 149int TableView::current() {
134 int uid = sorted().uidAt(currentRow() ); 150 int uid = sorted().uidAt(currentRow() );
135 151
136 return uid; 152 return uid;
137} 153}
138QString TableView::currentRepresentation() { 154QString TableView::currentRepresentation() {
139 OTodo to = sorted()[currentRow()]; 155 OTodo to = sorted()[currentRow()];
140 return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; 156 return to.summary().isEmpty() ? to.description().left(20) : to.summary() ;
141} 157}
142/* show overdue */ 158/* show overdue */
143void TableView::showOverDue( bool ) { 159void TableView::showOverDue( bool ) {
144 clear(); 160 clear();
145 updateView(); 161 updateView();
146} 162}
147 163
148void TableView::updateView( ) { 164void TableView::updateView( ) {
149 qWarning("update view"); 165 qWarning("update view");
150 m_row = false; 166 m_row = false;
151 static int id; 167 static int id;
152 id = startTimer(4000 ); 168 id = startTimer(4000 );
153 /* FIXME we want one page to be read! 169 /* FIXME we want one page to be read!
154 * 170 *
155 * Calculate that screensize 171 * Calculate that screensize
156 */ 172 */
157 todoWindow()->setReadAhead( 4 ); 173 todoWindow()->setReadAhead( 4 );
158 sort(); 174 sort();
159 OTodoAccess::List::Iterator it, end; 175 OTodoAccess::List::Iterator it, end;
@@ -270,194 +286,181 @@ void TableView::slotClicked(int row, int col, int,
270} 286}
271void TableView::slotPressed(int row, int col, int, 287void TableView::slotPressed(int row, int col, int,
272 const QPoint& point) { 288 const QPoint& point) {
273 289
274 qWarning("pressed row %d col %d x:%d+y:%d", row,col,point.x(),point.y() ); 290 qWarning("pressed row %d col %d x:%d+y:%d", row,col,point.x(),point.y() );
275 m_prevP = point; 291 m_prevP = point;
276 /* TextColumn column */ 292 /* TextColumn column */
277 if ( col == 2 && cellGeometry( row, col ).contains( point ) ) 293 if ( col == 2 && cellGeometry( row, col ).contains( point ) )
278 m_menuTimer->start( 750, TRUE ); 294 m_menuTimer->start( 750, TRUE );
279} 295}
280void TableView::slotValueChanged( int, int ) { 296void TableView::slotValueChanged( int, int ) {
281 qWarning("Value Changed"); 297 qWarning("Value Changed");
282} 298}
283void TableView::slotCurrentChanged(int, int ) { 299void TableView::slotCurrentChanged(int, int ) {
284 m_menuTimer->stop(); 300 m_menuTimer->stop();
285} 301}
286QWidget* TableView::widget() { 302QWidget* TableView::widget() {
287 return this; 303 return this;
288} 304}
289/* 305/*
290 * We need to overwrite sortColumn 306 * We need to overwrite sortColumn
291 * because we want to sort whole row 307 * because we want to sort whole row
292 * based 308 * based
293 * We event want to set the setOrder 309 * We event want to set the setOrder
294 * to a sort() and update() 310 * to a sort() and update()
295 */ 311 */
296void TableView::sortColumn( int col, bool asc, bool ) { 312void TableView::sortColumn( int col, bool asc, bool ) {
297 qWarning("bool %d", asc ); 313 qWarning("bool %d", asc );
298 setSortOrder( col ); 314 setSortOrder( col );
299 setAscending( asc ); 315 setAscending( asc );
300 updateView(); 316 updateView();
301} 317}
302void TableView::viewportPaintEvent( QPaintEvent* e) { 318void TableView::viewportPaintEvent( QPaintEvent* e) {
303 if (m_enablePaint ) 319 if (m_enablePaint )
304 QTable::viewportPaintEvent( e ); 320 QTable::viewportPaintEvent( e );
305} 321}
306/* 322/*
307 * This segment is copyrighted by TT 323 * This segment is copyrighted by TT
308 * it was taken from their todolist 324 * it was taken from their todolist
309 * application this code is GPL 325 * application this code is GPL
310 */ 326 */
311void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { 327void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) {
312 const QColorGroup &cg = colorGroup(); 328 const QColorGroup &cg = colorGroup();
313 329
314 p->save(); 330 p->save();
315 331
316 OTodo task = sorted()[row]; 332 OTodo task = sorted()[row];
317 333
318 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); 334 // TODO - give user option for grid or bars?
335
336 // Paint alternating background bars
337 if ( (row % 2 ) == 0 ) {
338 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) );
339 }
340 else {
341 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) );
342 }
319 343
320 QPen op = p->pen(); 344 // Paint grid
321 p->setPen(cg.mid()); 345 //p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) );
322 p->drawLine( 0, cr.height() - 1, cr.width() - 1, cr.height() - 1 ); 346 //QPen op = p->pen();
323 p->drawLine( cr.width() - 1, 0, cr.width() - 1, cr.height() - 1 ); 347 //p->setPen(cg.mid());
324 p->setPen(op); 348 //p->drawLine( 0, cr.height() - 1, cr.width() - 1, cr.height() - 1 );
349 //p->drawLine( cr.width() - 1, 0, cr.width() - 1, cr.height() - 1 );
350 //p->setPen(op);
325 351
326 QFont f = p->font(); 352 QFont f = p->font();
327 QFontMetrics fm(f); 353 QFontMetrics fm(f);
328 354
355 int marg = ( cr.width() - BoxSize ) / 2;
356 int x = 0;
357 int y = ( cr.height() - BoxSize ) / 2;
358
329 switch(col) { 359 switch(col) {
330 case 0: 360 case 0: // completed field
331 {
332 // completed field
333 int marg = ( cr.width() - BoxSize ) / 2;
334 int x = 0;
335 int y = ( cr.height() - BoxSize ) / 2;
336 p->setPen( QPen( cg.text() ) );
337 p->drawRect( x + marg, y, BoxSize, BoxSize );
338 p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 );
339 p->setPen( darkGreen );
340 x += 1;
341 y += 1;
342 if ( task.isCompleted() ) {
343 QPointArray a( 9*2 );
344 int i, xx, yy;
345 xx = x+2+marg;
346 yy = y+4;
347 for ( i=0; i<4; i++ ) {
348 a.setPoint( 2*i, xx, yy );
349 a.setPoint( 2*i+1, xx, yy+2 );
350 xx++; yy++;
351 }
352 yy -= 2;
353 for ( i=4; i<9; i++ ) {
354 a.setPoint( 2*i, xx, yy );
355 a.setPoint( 2*i+1, xx, yy+2 );
356 xx++; yy--;
357 }
358 p->drawLineSegments( a );
359 }
360 }
361 break;
362 case 1:
363 // priority field
364 { 361 {
365 QString text = QString::number(task.priority()); 362 //p->setPen( QPen( cg.text() ) );
366 p->drawText(2,2 + fm.ascent(), text); 363 //p->drawRect( x + marg, y, BoxSize, BoxSize );
364 //p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 );
365 if ( task.isCompleted() ) {
366 p->drawPixmap( x + marg, y, m_pic_completed );
367 }
367 } 368 }
368 break; 369 break;
369 case 2: 370 case 1: // priority field
370 // description field 371 {
372 p->drawPixmap( x + marg, y, m_pic_priority[ task.priority() - 1 ] );
373 }
374 break;
375 case 2: // description field
371 { 376 {
372 QString text = task.summary().isEmpty() ? 377 QString text = task.summary().isEmpty() ?
373 task.description().left(20) : 378 task.description().left(20) :
374 task.summary(); 379 task.summary();
375 p->drawText(2,2 + fm.ascent(), text); 380 p->drawText(2,2 + fm.ascent(), text);
376 } 381 }
377 break; 382 break;
378 case 3: 383 case 3:
379 { 384 {
380 QString text; 385 QString text;
381 if (task.hasDueDate()) { 386 if (task.hasDueDate()) {
382 int off = QDate::currentDate().daysTo( task.dueDate() ); 387 int off = QDate::currentDate().daysTo( task.dueDate() );
383 text = tr( "%1 day(s)").arg(QString::number(off)); 388 text = tr( "%1 day(s)").arg(QString::number(off));
384 /* 389 /*
385 * set color if not completed 390 * set color if not completed
386 */ 391 */
387 if (!task.isCompleted() ) { 392 if (!task.isCompleted() ) {
388 QColor color = Qt::black; 393 QColor color = Qt::black;
389 if ( off < 0 ) 394 if ( off < 0 )
390 color = Qt::red; 395 color = Qt::red;
391 else if ( off == 0 ) 396 else if ( off == 0 )
392 color = Qt::yellow; 397 color = Qt::yellow;
393 else if ( off > 0 ) 398 else if ( off > 0 )
394 color = Qt::green; 399 color = Qt::green;
395 p->setPen(color ); 400 p->setPen(color );
396 } 401 }
397 } else { 402 } else {
398 text = tr("None"); 403 text = tr("None");
399 } 404 }
400 p->drawText(2,2 + fm.ascent(), text); 405 p->drawText(2,2 + fm.ascent(), text);
401 } 406 }
402 break; 407 break;
403 } 408 }
404 p->restore(); 409 p->restore();
405} 410}
406QWidget* TableView::createEditor(int row, int col, bool )const { 411QWidget* TableView::createEditor(int row, int col, bool )const {
407 switch( col ) { 412 switch( col ) {
408 case 1: { 413 case 1: {
409 /* the priority stuff */ 414 /* the priority stuff */
410 QComboBox* combo = new QComboBox( viewport() ); 415 QComboBox* combo = new QComboBox( viewport() );
411 combo->insertItem( "1" ); 416 for ( int i = 0; i < 5; i++ ) {
412 combo->insertItem( "2" ); 417 combo->insertItem( m_pic_priority[ i ] );
413 combo->insertItem( "3" ); 418 }
414 combo->insertItem( "4" );
415 combo->insertItem( "5" );
416 combo->setCurrentItem( sorted()[row].priority()-1 ); 419 combo->setCurrentItem( sorted()[row].priority()-1 );
417 return combo; 420 return combo;
418 } 421 }
419 /* summary */ 422 /* summary */
420 case 2:{ 423 case 2:{
421 QLineEdit* edit = new QLineEdit( viewport() ); 424 QLineEdit* edit = new QLineEdit( viewport() );
422 edit->setText( sorted()[row].summary() ); 425 edit->setText( sorted()[row].summary() );
423 return edit; 426 return edit;
424 } 427 }
425 case 0: 428 case 0:
426 default: 429 default:
427 return 0l; 430 return 0l;
428 } 431 }
429} 432}
430void TableView::setCellContentFromEditor(int row, int col ) { 433void TableView::setCellContentFromEditor(int row, int col ) {
431 if ( col == 1 ) { 434 if ( col == 1 ) {
432 QWidget* wid = cellWidget(row, 1 ); 435 QWidget* wid = cellWidget(row, 1 );
433 if ( wid->inherits("QComboBox") ) { 436 if ( wid->inherits("QComboBox") ) {
434 int pri = ((QComboBox*)wid)->currentItem() + 1; 437 int pri = ((QComboBox*)wid)->currentItem() + 1;
435 OTodo todo = sorted()[row]; 438 OTodo todo = sorted()[row];
436 if ( todo.priority() != pri ) { 439 if ( todo.priority() != pri ) {
437 todo.setPriority( pri ); 440 todo.setPriority( pri );
438 TodoView::update( todo.uid(), todo ); 441 TodoView::update( todo.uid(), todo );
439 updateView(); 442 updateView();
440 } 443 }
441 } 444 }
442 }else if ( col == 2) { 445 }else if ( col == 2) {
443 QWidget* wid = cellWidget(row, 2); 446 QWidget* wid = cellWidget(row, 2);
444 if ( wid->inherits("QLineEdit") ) { 447 if ( wid->inherits("QLineEdit") ) {
445 QString text = ((QLineEdit*)wid)->text(); 448 QString text = ((QLineEdit*)wid)->text();
446 OTodo todo = sorted()[row]; 449 OTodo todo = sorted()[row];
447 if ( todo.summary() != text ) { 450 if ( todo.summary() != text ) {
448 todo.setSummary( text ); 451 todo.setSummary( text );
449 TodoView::update( todo.uid(), todo ); 452 TodoView::update( todo.uid(), todo );
450 updateView(); 453 updateView();
451 } 454 }
452 } 455 }
453 } 456 }
454} 457}
455void TableView::slotPriority() { 458void TableView::slotPriority() {
456 setCellContentFromEditor( currentRow(), currentColumn() ); 459 setCellContentFromEditor( currentRow(), currentColumn() );
457} 460}
458/* 461/*
459 * We'll use the TimerEvent to read ahead or to keep the cahce always 462 * We'll use the TimerEvent to read ahead or to keep the cahce always
460 * filled enough. 463 * filled enough.
461 * We will try to read ahead 4 items in both ways 464 * We will try to read ahead 4 items in both ways
462 * up and down. On odd or even we will currentRow()+-4 or +-9 465 * up and down. On odd or even we will currentRow()+-4 or +-9
463 * 466 *
diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h
index a27c698..2b6ea2b 100644
--- a/core/pim/todo/tableview.h
+++ b/core/pim/todo/tableview.h
@@ -1,107 +1,111 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 <> 3             .=l. Copyright (c) 2002 <>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This program is free software; you can 5 _;:,     .>    :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that 12    .i_,=:_.      -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef OPIE_TABLE_VIEW_H 29#ifndef OPIE_TABLE_VIEW_H
30#define OPIE_TABLE_VIEW_H 30#define OPIE_TABLE_VIEW_H
31 31
32#include <qtable.h> 32#include <qtable.h>
33#include <qmap.h> 33#include <qmap.h>
34#include <qpixmap.h>
34 35
35#include "todoview.h" 36#include "todoview.h"
36 37
37class QTimer; 38class QTimer;
38 39
39namespace Todo { 40namespace Todo {
40 class CheckItem; 41 class CheckItem;
41 class DueTextItem; 42 class DueTextItem;
42 class TableView : public QTable, public TodoView { 43 class TableView : public QTable, public TodoView {
43 Q_OBJECT 44 Q_OBJECT
44 public: 45 public:
45 TableView( MainWindow*, QWidget* parent ); 46 TableView( MainWindow*, QWidget* parent );
46 ~TableView(); 47 ~TableView();
47 48
48 49
49 QString type()const; 50 QString type()const;
50 int current(); 51 int current();
51 QString currentRepresentation(); 52 QString currentRepresentation();
52 53
53 void clear(); 54 void clear();
54 void showOverDue( bool ); 55 void showOverDue( bool );
55 void updateView(); 56 void updateView();
56 void setTodo( int uid, const OTodo& ); 57 void setTodo( int uid, const OTodo& );
57 void addEvent( const OTodo& event ); 58 void addEvent( const OTodo& event );
58 void replaceEvent( const OTodo& ); 59 void replaceEvent( const OTodo& );
59 void removeEvent( int uid ); 60 void removeEvent( int uid );
60 void setShowCompleted( bool ); 61 void setShowCompleted( bool );
61 void setShowDeadline( bool ); 62 void setShowDeadline( bool );
62 63
63 void setShowCategory(const QString& =QString::null ); 64 void setShowCategory(const QString& =QString::null );
64 void newDay(); 65 void newDay();
65 QWidget* widget(); 66 QWidget* widget();
66 void sortColumn(int, bool, bool ); 67 void sortColumn(int, bool, bool );
67 68
68 /* 69 /*
69 * we do our drawing ourselves 70 * we do our drawing ourselves
70 * because we don't want to have 71 * because we don't want to have
71 * 40.000 QTableItems for 10.000 72 * 40.000 QTableItems for 10.000
72 * OTodos where we only show 10 at a time! 73 * OTodos where we only show 10 at a time!
73 */ 74 */
74 void paintCell(QPainter* p, int row, int col, const QRect&, bool ); 75 void paintCell(QPainter* p, int row, int col, const QRect&, bool );
75 private: 76 private:
76 /* reimplented for internal reasons */ 77 /* reimplented for internal reasons */
77 void viewportPaintEvent( QPaintEvent* ); 78 void viewportPaintEvent( QPaintEvent* );
78 QTimer *m_menuTimer; 79 QTimer *m_menuTimer;
79 bool m_enablePaint:1; 80 bool m_enablePaint:1;
80 QString m_oleCat; 81 QString m_oleCat;
81 bool m_first : 1; 82 bool m_first : 1;
82 83
84 QPixmap m_pic_completed;
85 QPixmap m_pic_priority[ 5 ];
86
83 protected: 87 protected:
84 void contentsMouseReleaseEvent( QMouseEvent* ); 88 void contentsMouseReleaseEvent( QMouseEvent* );
85 void contentsMouseMoveEvent( QMouseEvent* ); 89 void contentsMouseMoveEvent( QMouseEvent* );
86 void timerEvent( QTimerEvent* e ); 90 void timerEvent( QTimerEvent* e );
87 QWidget* createEditor(int row, int col, bool initFromCell )const; 91 QWidget* createEditor(int row, int col, bool initFromCell )const;
88 void setCellContentFromEditor( int row, int col ); 92 void setCellContentFromEditor( int row, int col );
89 93
90private slots: 94private slots:
91 void slotShowMenu(); 95 void slotShowMenu();
92 void slotClicked(int, int, int, 96 void slotClicked(int, int, int,
93 const QPoint& ); 97 const QPoint& );
94 void slotPressed(int, int, int, 98 void slotPressed(int, int, int,
95 const QPoint& ); 99 const QPoint& );
96 void slotValueChanged(int, int); 100 void slotValueChanged(int, int);
97 void slotCurrentChanged(int, int ); 101 void slotCurrentChanged(int, int );
98 void slotPriority(); 102 void slotPriority();
99 private: 103 private:
100 void initConfig(); 104 void initConfig();
101 int m_completeStrokeWidth; 105 int m_completeStrokeWidth;
102 bool m_row : 1; 106 bool m_row : 1;
103 QPoint m_prevP; 107 QPoint m_prevP;
104 }; 108 };
105}; 109};
106 110
107#endif 111#endif