summaryrefslogtreecommitdiff
authordrw <drw>2002-12-22 17:03:27 (UTC)
committer drw <drw>2002-12-22 17:03:27 (UTC)
commitc8a5bdd7d4b7de88708e88df797bd494eb6f7e71 (patch) (unidiff)
tree7e3468f1dd9afab3a1ccad2978c628b2d737fc1d
parent5377a2c897ae67ec2cd0cf8e57da9037366efe67 (diff)
downloadopie-c8a5bdd7d4b7de88708e88df797bd494eb6f7e71.zip
opie-c8a5bdd7d4b7de88708e88df797bd494eb6f7e71.tar.gz
opie-c8a5bdd7d4b7de88708e88df797bd494eb6f7e71.tar.bz2
QWhatsThis for main task view and toolbars.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp20
-rw-r--r--core/pim/todo/quickeditimpl.cpp14
-rw-r--r--core/pim/todo/tableview.cpp21
3 files changed, 31 insertions, 24 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index 0ccf73e..d16d1ac 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -1,366 +1,368 @@
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  -_. . .   )=.  = General Public License along with 21  -_. . .   )=.  = 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#include <unistd.h> 29#include <unistd.h>
30#include <stdio.h>
31 30
32#include <qmenubar.h> 31#include <qmenubar.h>
33#include <qmessagebox.h> 32#include <qmessagebox.h>
34#include <qtoolbar.h> 33#include <qtoolbar.h>
35#include <qpopupmenu.h> 34#include <qpopupmenu.h>
36#include <qwidgetstack.h> 35#include <qwidgetstack.h>
37#include <qaction.h> 36#include <qaction.h>
38#include <qtimer.h> 37#include <qtimer.h>
39#include <qvbox.h> 38#include <qvbox.h>
40#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qwhatsthis.h>
41 41
42#include <qpe/applnk.h> 42#include <qpe/applnk.h>
43#include <qpe/config.h> 43#include <qpe/config.h>
44#include <qpe/ir.h> 44#include <qpe/ir.h>
45#include <qpe/resource.h> 45#include <qpe/resource.h>
46#include <qpe/qpemessagebox.h> 46#include <qpe/qpemessagebox.h>
47#include <qpe/qpetoolbar.h> 47#include <qpe/qpetoolbar.h>
48 48
49#include <opie/orecur.h> 49#include <opie/orecur.h>
50#include <opie/otodoaccessvcal.h> 50#include <opie/otodoaccessvcal.h>
51 51
52#include "quickeditimpl.h" 52#include "quickeditimpl.h"
53#include "todotemplatemanager.h" 53#include "todotemplatemanager.h"
54#include "templateeditor.h" 54#include "templateeditor.h"
55#include "tableview.h" 55#include "tableview.h"
56 56
57#include "textviewshow.h" 57#include "textviewshow.h"
58#include "todoeditor.h" 58#include "todoeditor.h"
59#include "mainwindow.h" 59#include "mainwindow.h"
60 60
61 61
62using namespace Todo; 62using namespace Todo;
63 63
64MainWindow::MainWindow( QWidget* parent, 64MainWindow::MainWindow( QWidget* parent,
65 const char* name ) 65 const char* name )
66 : OPimMainWindow("Todolist", parent, name) 66 : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp )
67{ 67{
68
69 m_syncing = false; 68 m_syncing = false;
70 m_counter = 0; 69 m_counter = 0;
71 m_tempManager = new TemplateManager(); 70 m_tempManager = new TemplateManager();
72 m_tempManager->load(); 71 m_tempManager->load();
73 72
74 initUI(); 73 initUI();
75 initConfig(); 74 initConfig();
76 initViews(); 75 initViews();
77 initActions(); 76 initActions();
78 initEditor(); 77 initEditor();
79 initShow(); 78 initShow();
80 initTemplate(); 79 initTemplate();
81 80
82 populateTemplates(); 81 populateTemplates();
83 raiseCurrentView(); 82 raiseCurrentView();
84 QTimer::singleShot(0, this, SLOT(populateCategories() ) ); 83 QTimer::singleShot(0, this, SLOT(populateCategories() ) );
85} 84}
86void MainWindow::initTemplate() { 85void MainWindow::initTemplate() {
87 m_curTempEd = new TemplateEditor( this, templateManager() ); 86 m_curTempEd = new TemplateEditor( this, templateManager() );
88} 87}
89void MainWindow::initActions() { 88void MainWindow::initActions() {
90 89
91 // Data menu 90 // Data menu
92 m_edit->insertItem(tr("New from template"), m_template, 91 m_edit->insertItem(tr("New from template"), m_template,
93 -1, 0 ); 92 -1, 0 );
94 93
95 QAction* a = new QAction( tr("New Task" ), Resource::loadPixmap( "new" ), 94 QAction* a = new QAction( tr("New Task" ), Resource::loadPixmap( "new" ),
96 QString::null, 0, this, 0 ); 95 QString::null, 0, this, 0 );
97 connect(a, SIGNAL( activated() ), 96 connect(a, SIGNAL( activated() ),
98 this, SLOT( slotNew() ) ); 97 this, SLOT( slotNew() ) );
98 a->setWhatsThis( tr( "Click here to create a new task." ) );
99 a->addTo(m_tool ); 99 a->addTo(m_tool );
100 a->addTo(m_edit ); 100 a->addTo(m_edit );
101 101
102 a = new QAction( tr("Edit Task"), Resource::loadIconSet( "edit" ), 102 a = new QAction( tr("Edit Task"), Resource::loadIconSet( "edit" ),
103 QString::null, 0, this, 0 ); 103 QString::null, 0, this, 0 );
104 connect(a, SIGNAL(activated() ), 104 connect(a, SIGNAL(activated() ),
105 this, SLOT( slotEdit() ) ); 105 this, SLOT( slotEdit() ) );
106 a->setWhatsThis( tr( "Click here to modify the current task." ) );
106 a->addTo( m_tool ); 107 a->addTo( m_tool );
107 a->addTo( m_edit ); 108 a->addTo( m_edit );
108 m_editAction = a; 109 m_editAction = a;
109 110
110 a = new QAction( QString::null, tr("View Task"), 0, this, 0 ); 111 a = new QAction( QString::null, tr("View Task"), 0, this, 0 );
111 connect(a, SIGNAL( activated() ), 112 connect(a, SIGNAL( activated() ),
112 this, SLOT( slotShowDetails() ) ); 113 this, SLOT( slotShowDetails() ) );
113 a->addTo( m_edit ); 114 a->addTo( m_edit );
114 115
115 m_edit->insertSeparator(); 116 m_edit->insertSeparator();
116 117
117 a = new QAction( tr("Delete..."), Resource::loadIconSet( "trash" ), 118 a = new QAction( tr("Delete..."), Resource::loadIconSet( "trash" ),
118 QString::null, 0, this, 0 ); 119 QString::null, 0, this, 0 );
119 connect(a, SIGNAL(activated() ), 120 connect(a, SIGNAL(activated() ),
120 this, SLOT(slotDelete() ) ); 121 this, SLOT(slotDelete() ) );
122 a->setWhatsThis( tr( "Click here to remove the current task." ) );
121 a->addTo( m_tool ); 123 a->addTo( m_tool );
122 a->addTo( m_edit ); 124 a->addTo( m_edit );
123 m_deleteAction = a; 125 m_deleteAction = a;
124 126
125 a = new QAction( QString::null, tr("Delete all..."), 0, this, 0 ); 127 a = new QAction( QString::null, tr("Delete all..."), 0, this, 0 );
126 connect(a, SIGNAL( activated() ), 128 connect(a, SIGNAL( activated() ),
127 this, SLOT( slotDeleteAll() ) ); 129 this, SLOT( slotDeleteAll() ) );
128 a->addTo(m_edit ); 130 a->addTo(m_edit );
129 m_deleteAllAction = a; 131 m_deleteAllAction = a;
130 132
131 a = new QAction( QString::null, tr("Delete completed"), 133 a = new QAction( QString::null, tr("Delete completed"),
132 0, this, 0 ); 134 0, this, 0 );
133 connect(a, SIGNAL( activated() ), 135 connect(a, SIGNAL( activated() ),
134 this, SLOT( slotDeleteCompleted() ) ); 136 this, SLOT( slotDeleteCompleted() ) );
135 a->addTo(m_edit ); 137 a->addTo(m_edit );
136 a->setEnabled( TRUE ); 138 a->setEnabled( TRUE );
137 m_deleteCompleteAction = a; 139 m_deleteCompleteAction = a;
138 140
139 m_edit->insertSeparator(); 141 m_edit->insertSeparator();
140 142
141 a = new QAction( QString::null, tr("Duplicate"), 0, this, 0 ); 143 a = new QAction( QString::null, tr("Duplicate"), 0, this, 0 );
142 connect(a, SIGNAL( activated() ), 144 connect(a, SIGNAL( activated() ),
143 this, SLOT( slotDuplicate() ) ); 145 this, SLOT( slotDuplicate() ) );
144 a->addTo(m_edit ); 146 a->addTo(m_edit );
145 m_duplicateAction = a; 147 m_duplicateAction = a;
146 148
147 m_edit->insertSeparator(); 149 m_edit->insertSeparator();
148 150
149 if ( Ir::supported() ) { 151 if ( Ir::supported() ) {
150 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), 152 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 );
151 QString::null, 0, this, 0 ); 153 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) );
152 connect( a, SIGNAL( activated() ), 154 a->setWhatsThis( tr( "Click here to send the current task to another device." ) );
153 this, SLOT( slotBeam() ) ); 155 a->addTo( m_edit );
154 a->addTo( m_edit ); 156 a->addTo( m_tool );
155 a->addTo( m_tool );
156 } 157 }
157 158
158 // Options menu 159 // Options menu
159 a = new QAction( tr("Find"), Resource::loadIconSet( "mag" ), 160 a = new QAction( tr("Find"), Resource::loadIconSet( "mag" ),
160 QString::null, 0, this, 0 ); 161 QString::null, 0, this, 0 );
161 connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); 162 connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) );
162 a->addTo( m_options ); 163 a->addTo( m_options );
163 m_findAction = a; 164 m_findAction = a;
164 165
165 m_options->insertSeparator(); 166 m_options->insertSeparator();
166 167
167 m_completedAction = new QAction( QString::null, tr("Show completed tasks"), 168 m_completedAction = new QAction( QString::null, tr("Show completed tasks"),
168 0, this, 0, TRUE ); 169 0, this, 0, TRUE );
169 m_completedAction->addTo( m_options ); 170 m_completedAction->addTo( m_options );
170 m_completedAction->setOn( showCompleted() ); 171 m_completedAction->setOn( showCompleted() );
171 connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); 172 connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) );
172 173
173 a = new QAction( QString::null, tr("Show only over-due tasks"), 174 a = new QAction( QString::null, tr("Show only over-due tasks"),
174 0, this, 0, TRUE ); 175 0, this, 0, TRUE );
175 a->addTo( m_options ); 176 a->addTo( m_options );
176 a->setOn( showOverDue() ); 177 a->setOn( showOverDue() );
177 connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); 178 connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) );
178 179
179 m_showDeadLineAction = new QAction( QString::null, tr("Show task deadlines"), 180 m_showDeadLineAction = new QAction( QString::null, tr("Show task deadlines"),
180 0, this, 0, TRUE ); 181 0, this, 0, TRUE );
181 m_showDeadLineAction->addTo( m_options ); 182 m_showDeadLineAction->addTo( m_options );
182 m_showDeadLineAction->setOn( showDeadline() ); 183 m_showDeadLineAction->setOn( showDeadline() );
183 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) ); 184 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) );
184 185
185 m_showQuickTaskAction = new QAction( QString::null, tr("Show quick task bar"), 186 m_showQuickTaskAction = new QAction( QString::null, tr("Show quick task bar"),
186 0, this, 0, TRUE ); 187 0, this, 0, TRUE );
187 m_showQuickTaskAction->addTo( m_options ); 188 m_showQuickTaskAction->addTo( m_options );
188 m_showQuickTaskAction->setOn( showQuickTask() ); 189 m_showQuickTaskAction->setOn( showQuickTask() );
189 connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); 190 connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) );
190 191
191 m_options->insertSeparator(); 192 m_options->insertSeparator();
192 193
193 m_bar->insertItem( tr("Data") ,m_edit ); 194 m_bar->insertItem( tr("Data") ,m_edit );
194 m_bar->insertItem( tr("Category"), m_catMenu ); 195 m_bar->insertItem( tr("Category"), m_catMenu );
195 m_bar->insertItem( tr("Options"), m_options ); 196 m_bar->insertItem( tr("Options"), m_options );
196 197
197 m_curQuick = new QuickEditImpl( this, m_quicktask ); 198 m_curQuick = new QuickEditImpl( this, m_quicktask );
198 addToolBar( (QPEToolBar *)m_curQuick->widget(), tr( "QuickEdit" ), QMainWindow::Top, TRUE ); 199 addToolBar( (QPEToolBar *)m_curQuick->widget(), tr( "QuickEdit" ), QMainWindow::Top, TRUE );
199 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); 200 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) );
200 201
201} 202}
202/* m_curCat from Config */ 203/* m_curCat from Config */
203void MainWindow::initConfig() { 204void MainWindow::initConfig() {
204 Config config( "todo" ); 205 Config config( "todo" );
205 config.setGroup( "View" ); 206 config.setGroup( "View" );
206 m_completed = config.readBoolEntry( "ShowComplete", TRUE ); 207 m_completed = config.readBoolEntry( "ShowComplete", TRUE );
207 m_curCat = config.readEntry( "Category", QString::null ); 208 m_curCat = config.readEntry( "Category", QString::null );
208 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); 209 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE);
209 m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); 210 m_overdue = config.readBoolEntry("ShowOverDue", FALSE );
210 m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); 211 m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE);
211} 212}
212void MainWindow::initUI() { 213void MainWindow::initUI() {
213 m_stack = new QWidgetStack(this, "main stack"); 214 m_stack = new QWidgetStack(this, "main stack");
214 setCentralWidget( m_stack ); 215 setCentralWidget( m_stack );
215 216
216 setToolBarsMovable( FALSE ); 217 setToolBarsMovable( FALSE );
217 218
218 m_tool = new QPEToolBar( this ); 219 m_tool = new QPEToolBar( this );
219 m_tool->setHorizontalStretchable( TRUE ); 220 m_tool->setHorizontalStretchable( TRUE );
220 221
221 m_bar = new QMenuBar( m_tool ); 222 m_bar = new QMenuBar( m_tool );
222 223
223 /** QPopupMenu */ 224 /** QPopupMenu */
224 m_edit = new QPopupMenu( this ); 225 m_edit = new QPopupMenu( this );
225 m_options = new QPopupMenu( this ); 226 m_options = new QPopupMenu( this );
226 m_catMenu = new QPopupMenu( this ); 227 m_catMenu = new QPopupMenu( this );
227 m_template = new QPopupMenu( this ); 228 m_template = new QPopupMenu( this );
228 229
229 m_catMenu->setCheckable( TRUE ); 230 m_catMenu->setCheckable( TRUE );
230 m_template->setCheckable( TRUE ); 231 m_template->setCheckable( TRUE );
231 232
232 connect(m_catMenu, SIGNAL(activated(int) ), 233 connect(m_catMenu, SIGNAL(activated(int) ),
233 this, SLOT(setCategory(int) ) ); 234 this, SLOT(setCategory(int) ) );
234 connect(m_template, SIGNAL(activated(int) ), 235 connect(m_template, SIGNAL(activated(int) ),
235 this, SLOT(slotNewFromTemplate(int) ) ); 236 this, SLOT(slotNewFromTemplate(int) ) );
236} 237}
237void MainWindow::initViews() { 238void MainWindow::initViews() {
238 TableView* tableView = new TableView( this, m_stack ); 239 TableView* tableView = new TableView( this, m_stack );
240 QWhatsThis::add( tableView, tr( "This is a listing of all current tasks.\n\nThe list displays the following information:\n1. Completed - A green checkmark indicates task is completed. Click here to complete a task.\n2. Priority - a graphical representation of task priority. Double-click here to modify.\n3. Description - description of task. Click here to select the task.\n4. Deadline - shows when task is due. This column can be shown or hidden by selecting Options->'Show task deadlines' from the menu above." ) );
239 m_stack->addWidget( tableView, m_counter++ ); 241 m_stack->addWidget( tableView, m_counter++ );
240 m_views.append( tableView ); 242 m_views.append( tableView );
241 m_curView = tableView; 243 m_curView = tableView;
242 connectBase( tableView ); 244 connectBase( tableView );
243 /* add QString type + QString configname to 245 /* add QString type + QString configname to
244 * the View menu 246 * the View menu
245 * and subdirs for multiple views 247 * and subdirs for multiple views
246 */ 248 */
247} 249}
248void MainWindow::initEditor() { 250void MainWindow::initEditor() {
249 m_curEdit = new Editor(); 251 m_curEdit = new Editor();
250} 252}
251void MainWindow::initShow() { 253void MainWindow::initShow() {
252 m_curShow = new TextViewShow(this); 254 m_curShow = new TextViewShow(this);
253 m_stack->addWidget( m_curShow->widget() , m_counter++ ); 255 m_stack->addWidget( m_curShow->widget() , m_counter++ );
254} 256}
255MainWindow::~MainWindow() { 257MainWindow::~MainWindow() {
256 delete templateManager(); 258 delete templateManager();
257} 259}
258void MainWindow::connectBase( ViewBase* ) { 260void MainWindow::connectBase( ViewBase* ) {
259 // once templates and signals mix we'll use it again 261 // once templates and signals mix we'll use it again
260} 262}
261QPopupMenu* MainWindow::contextMenu( int , bool recur ) { 263QPopupMenu* MainWindow::contextMenu( int , bool recur ) {
262 QPopupMenu* menu = new QPopupMenu(); 264 QPopupMenu* menu = new QPopupMenu();
263 265
264 m_editAction->addTo( menu ); 266 m_editAction->addTo( menu );
265 m_deleteAction->addTo( menu ); 267 m_deleteAction->addTo( menu );
266 m_duplicateAction->addTo( menu ); 268 m_duplicateAction->addTo( menu );
267 269
268 menu->insertSeparator(); 270 menu->insertSeparator();
269 271
270 /* 272 /*
271 * if this event recurs we allow 273 * if this event recurs we allow
272 * to detach it. 274 * to detach it.
273 * remove all 275 * remove all
274 */ 276 */
275 if ( recur ) { 277 if ( recur ) {
276 ; // FIXME 278 ; // FIXME
277 } 279 }
278 280
279 return menu; 281 return menu;
280} 282}
281QPopupMenu* MainWindow::options() { 283QPopupMenu* MainWindow::options() {
282 qWarning("Options"); 284 qWarning("Options");
283 return m_options; 285 return m_options;
284} 286}
285QPopupMenu* MainWindow::edit() { 287QPopupMenu* MainWindow::edit() {
286 return m_edit; 288 return m_edit;
287} 289}
288QToolBar* MainWindow::toolbar() { 290QToolBar* MainWindow::toolbar() {
289 return m_tool; 291 return m_tool;
290} 292}
291OTodoAccess::List MainWindow::list()const { 293OTodoAccess::List MainWindow::list()const {
292 return m_todoMgr.list(); 294 return m_todoMgr.list();
293} 295}
294OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { 296OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
295 int cat = 0; 297 int cat = 0;
296 if ( m_curCat != tr("All Categories") ) 298 if ( m_curCat != tr("All Categories") )
297 cat = currentCatId(); 299 cat = currentCatId();
298 300
299 int filter = 1; 301 int filter = 1;
300 302
301 if (!m_completed ) 303 if (!m_completed )
302 filter |= 4; 304 filter |= 4;
303 if (m_overdue) 305 if (m_overdue)
304 filter |= 2; 306 filter |= 2;
305 307
306 return m_todoMgr.sorted( asc, sortOrder, filter, cat ); 308 return m_todoMgr.sorted( asc, sortOrder, filter, cat );
307} 309}
308OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { 310OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
309 int cat = 0; 311 int cat = 0;
310 if ( m_curCat != tr("All Categories") ) 312 if ( m_curCat != tr("All Categories") )
311 cat = currentCatId(); 313 cat = currentCatId();
312 314
313 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); 315 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat );
314} 316}
315OTodo MainWindow::event( int uid ) { 317OTodo MainWindow::event( int uid ) {
316 return m_todoMgr.event( uid ); 318 return m_todoMgr.event( uid );
317} 319}
318bool MainWindow::isSyncing()const { 320bool MainWindow::isSyncing()const {
319 return m_syncing; 321 return m_syncing;
320} 322}
321TemplateManager* MainWindow::templateManager() { 323TemplateManager* MainWindow::templateManager() {
322 return m_tempManager; 324 return m_tempManager;
323} 325}
324Editor* MainWindow::currentEditor() { 326Editor* MainWindow::currentEditor() {
325 return m_curEdit; 327 return m_curEdit;
326} 328}
327TodoShow* MainWindow::currentShow() { 329TodoShow* MainWindow::currentShow() {
328 return m_curShow; 330 return m_curShow;
329} 331}
330void MainWindow::slotReload() { 332void MainWindow::slotReload() {
331 m_todoMgr.reload(); 333 m_todoMgr.reload();
332 currentView()->updateView( ); 334 currentView()->updateView( );
333 raiseCurrentView(); 335 raiseCurrentView();
334} 336}
335void MainWindow::closeEvent( QCloseEvent* e ) { 337void MainWindow::closeEvent( QCloseEvent* e ) {
336 if (m_stack->visibleWidget() == currentShow()->widget() ) { 338 if (m_stack->visibleWidget() == currentShow()->widget() ) {
337 raiseCurrentView(); 339 raiseCurrentView();
338 e->ignore(); 340 e->ignore();
339 return; 341 return;
340 } 342 }
341 /* 343 /*
342 * we should have flushed and now we're still saving 344 * we should have flushed and now we're still saving
343 * so there is no need to flush 345 * so there is no need to flush
344 */ 346 */
345 if (m_syncing ) { 347 if (m_syncing ) {
346 e->accept(); 348 e->accept();
347 return; 349 return;
348 } 350 }
349 bool quit = false; 351 bool quit = false;
350 if ( m_todoMgr.saveAll() ){ 352 if ( m_todoMgr.saveAll() ){
351 qWarning("saved"); 353 qWarning("saved");
352 quit = true; 354 quit = true;
353 }else { 355 }else {
354 if ( QMessageBox::critical( this, tr("Out of space"), 356 if ( QMessageBox::critical( this, tr("Out of space"),
355 tr("Todo was unable\n" 357 tr("Todo was unable\n"
356 "to save your changes.\n" 358 "to save your changes.\n"
357 "Free up some space\n" 359 "Free up some space\n"
358 "and try again.\n" 360 "and try again.\n"
359 "\nQuit Anyway?"), 361 "\nQuit Anyway?"),
360 QMessageBox::Yes|QMessageBox::Escape, 362 QMessageBox::Yes|QMessageBox::Escape,
361 QMessageBox::No|QMessageBox::Default) 363 QMessageBox::No|QMessageBox::Default)
362 != QMessageBox::No ) { 364 != QMessageBox::No ) {
363 e->accept(); 365 e->accept();
364 quit = true; 366 quit = true;
365 }else 367 }else
366 e->ignore(); 368 e->ignore();
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp
index cadec03..7664ee4 100644
--- a/core/pim/todo/quickeditimpl.cpp
+++ b/core/pim/todo/quickeditimpl.cpp
@@ -1,106 +1,110 @@
1#include <qaction.h> 1#include <qaction.h>
2#include <qlineedit.h> 2#include <qlineedit.h>
3#include <qwhatsthis.h>
3 4
4#include <qpe/resource.h> 5#include <qpe/resource.h>
5 6
6#include <opie/oclickablelabel.h> 7#include <opie/oclickablelabel.h>
7 8
8#include "mainwindow.h" 9#include "mainwindow.h"
9#include "quickeditimpl.h" 10#include "quickeditimpl.h"
10 11
11 12
12QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) 13QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible )
13 : QPEToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { 14 : QPEToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) {
14 setHorizontalStretchable( TRUE ); 15 setHorizontalStretchable( TRUE );
15 16
16 // Load priority icons 17 // Load priority icons
17 // TODO - probably should be done globally somewhere else, see also tableview.cpp/h 18 // TODO - probably should be done globally somewhere else, see also tableview.cpp/h
18 priority1 = Resource::loadPixmap( "todo/priority1" ); 19 priority1 = Resource::loadPixmap( "todo/priority1" );
19 priority3 = Resource::loadPixmap( "todo/priority3" ); 20 priority3 = Resource::loadPixmap( "todo/priority3" );
20 priority5 = Resource::loadPixmap( "todo/priority5" ); 21 priority5 = Resource::loadPixmap( "todo/priority5" );
21 22
22
23 // TODO - come up with icons and replace text priority values
24 m_lbl = new OClickableLabel( this ); 23 m_lbl = new OClickableLabel( this );
25 m_lbl->setMinimumWidth(15); 24 m_lbl->setMinimumWidth( 15 );
26 m_lbl->setPixmap( priority3 ); 25 m_lbl->setPixmap( priority3 );
27 connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); 26 connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) );
27 QWhatsThis::add( m_lbl, tr( "Click here to set the priority of new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
28 28
29 m_edit = new QLineEdit( this ); 29 m_edit = new QLineEdit( this );
30 setStretchableWidget( m_edit ); 30 setStretchableWidget( m_edit );
31 31 QWhatsThis::add( m_edit, tr( "Enter description of new task here.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
32
32 QAction *a = new QAction( tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); 33 QAction *a = new QAction( tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 );
33 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); 34 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) );
34 a->addTo( this ); 35 a->addTo( this );
36 a->setWhatsThis( tr( "Click here to enter additional information for new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
35 37
36 a = new QAction( tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); 38 a = new QAction( tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
37 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); 39 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) );
38 a->addTo( this ); 40 a->addTo( this );
41 a->setWhatsThis( tr( "Click here to add new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
39 42
40 a = new QAction( tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 43 a = new QAction( tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
41 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); 44 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) );
42 a->addTo( this ); 45 a->addTo( this );
46 a->setWhatsThis( tr( "Click here to reset new task information.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
43 47
44 m_visible = visible; 48 m_visible = visible;
45 if ( !m_visible ) { 49 if ( !m_visible ) {
46 hide(); 50 hide();
47 } 51 }
48 52
49 m_menu = 0l; 53 m_menu = 0l;
50 reinit(); 54 reinit();
51} 55}
52QuickEditImpl::~QuickEditImpl() { 56QuickEditImpl::~QuickEditImpl() {
53 57
54} 58}
55OTodo QuickEditImpl::todo()const { 59OTodo QuickEditImpl::todo()const {
56 return m_todo; 60 return m_todo;
57} 61}
58QWidget* QuickEditImpl::widget() { 62QWidget* QuickEditImpl::widget() {
59 return this; 63 return this;
60} 64}
61void QuickEditImpl::slotEnter() { 65void QuickEditImpl::slotEnter() {
62 OTodo todo; 66 OTodo todo;
63 67
64 68
65 if (!m_edit->text().isEmpty() ) { 69 if (!m_edit->text().isEmpty() ) {
66 todo.setUid(1 ); // new uid 70 todo.setUid(1 ); // new uid
67 todo.setPriority( m_state ); 71 todo.setPriority( m_state );
68 todo.setSummary( m_edit->text() ); 72 todo.setSummary( m_edit->text() );
69 if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 ) 73 if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 )
70 todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() ); 74 todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() );
71 75
72 m_todo = todo; 76 m_todo = todo;
73 commit(); 77 commit();
74 } 78 }
75 m_todo = todo; 79 m_todo = todo;
76 reinit(); 80 reinit();
77} 81}
78void QuickEditImpl::slotPrio() { 82void QuickEditImpl::slotPrio() {
79 m_state -= 2; 83 m_state -= 2;
80 if ( m_state < 1 ) 84 if ( m_state < 1 )
81 m_state = 5; 85 m_state = 5;
82 86
83 switch( m_state ) { 87 switch( m_state ) {
84 case 1: 88 case 1:
85 m_lbl->setPixmap( priority1 ); 89 m_lbl->setPixmap( priority1 );
86 break; 90 break;
87 case 5: 91 case 5:
88 m_lbl->setPixmap( priority5 ); 92 m_lbl->setPixmap( priority5 );
89 break; 93 break;
90 case 3: 94 case 3:
91 default: 95 default:
92 m_lbl->setPixmap( priority3 ); 96 m_lbl->setPixmap( priority3 );
93 break; 97 break;
94 } 98 }
95} 99}
96void QuickEditImpl::slotMore() { 100void QuickEditImpl::slotMore() {
97 // TODO - implement 101 // TODO - implement
98} 102}
99void QuickEditImpl::slotCancel() { 103void QuickEditImpl::slotCancel() {
100 reinit(); 104 reinit();
101} 105}
102void QuickEditImpl::reinit() { 106void QuickEditImpl::reinit() {
103 m_state = 3; 107 m_state = 3;
104 m_lbl->setPixmap( priority3 ); 108 m_lbl->setPixmap( priority3 );
105 m_edit->clear(); 109 m_edit->clear();
106} 110}
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index d229f52..cd6740a 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -1,239 +1,240 @@
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#include <qpe/resource.h>
39 39
40#include <opie/orecur.h> 40#include <opie/orecur.h>
41 41
42#include "mainwindow.h" 42#include "mainwindow.h"
43//#include "tableitems.h" 43//#include "tableitems.h"
44#include "tableview.h" 44#include "tableview.h"
45 45
46using namespace Todo; 46using namespace Todo;
47 47
48namespace { 48namespace {
49 static const int BoxSize = 14; 49 static const int BoxSize = 14;
50 static const int RowHeight = 20; 50 static const int RowHeight = 20;
51} 51}
52 52
53 53
54void TableView::initConfig() { 54void TableView::initConfig() {
55 Config config( "todo" ); 55 Config config( "todo" );
56 config.setGroup( "Options" ); 56 config.setGroup( "Options" );
57 m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 ); 57 m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 );
58} 58}
59 59
60TableView::TableView( MainWindow* window, QWidget* wid ) 60TableView::TableView( MainWindow* window, QWidget* wid )
61 : QTable( wid ), TodoView( window ) { 61 : QTable( wid ), TodoView( window ) {
62
63 // Load icons
64 // TODO - probably should be done globally somewhere else, see also quickeditimpl.cpp/h
65 m_pic_completed = Resource::loadPixmap( "todo/completed" );
66 QString namestr;
67 for ( unsigned int i = 1; i < 6; i++ ) {
68 namestr = "todo/priority";
69 namestr.append( QString::number( i ) );
70 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr );
71 }
72
62 setUpdatesEnabled( false ); 73 setUpdatesEnabled( false );
63 viewport()->setUpdatesEnabled( false ); 74 viewport()->setUpdatesEnabled( false );
64 m_enablePaint = false; 75 m_enablePaint = false;
65 setNumRows(0); 76 setNumRows(0);
66 setNumCols(4); 77 setNumCols(4);
67 78
68 horizontalHeader()->setLabel( 0, tr("C.") ); 79 horizontalHeader()->setLabel( 0, tr("C.") );
69 horizontalHeader()->setLabel( 1, tr("Priority") ); 80 horizontalHeader()->setLabel( 1, tr("Priority") );
70 horizontalHeader()->setLabel( 2, tr("Description" ) ); 81 horizontalHeader()->setLabel( 2, tr("Description" ) );
71 horizontalHeader()->setLabel( 3, tr("Deadline") ); 82 horizontalHeader()->setLabel( 3, tr("Deadline") );
72 83
73 setShowDeadline( todoWindow()->showDeadline() ); 84 setShowDeadline( todoWindow()->showDeadline() );
74 85
75 setSorting( TRUE ); 86 setSorting( TRUE );
76 setSelectionMode( NoSelection ); 87 setSelectionMode( NoSelection );
77 88
78 setLeftMargin( 0 ); 89 setLeftMargin( 0 );
79 verticalHeader()->hide(); 90 verticalHeader()->hide();
80 91
81 connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ), 92 connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ),
82 this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); 93 this, SLOT( slotClicked(int, int, int, const QPoint& ) ) );
83 connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), 94 connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ),
84 this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); 95 this, SLOT( slotPressed(int, int, int, const QPoint& ) ) );
85 connect((QTable*)this, SIGNAL(valueChanged(int, int) ), 96 connect((QTable*)this, SIGNAL(valueChanged(int, int) ),
86 this, SLOT( slotValueChanged(int, int) ) ); 97 this, SLOT( slotValueChanged(int, int) ) );
87 connect((QTable*)this, SIGNAL(currentChanged(int, int) ), 98 connect((QTable*)this, SIGNAL(currentChanged(int, int) ),
88 this, SLOT( slotCurrentChanged(int, int) ) ); 99 this, SLOT( slotCurrentChanged(int, int) ) );
89 100
90 m_menuTimer = new QTimer( this ); 101 m_menuTimer = new QTimer( this );
91 connect( m_menuTimer, SIGNAL(timeout()), 102 connect( m_menuTimer, SIGNAL(timeout()),
92 this, SLOT(slotShowMenu()) ); 103 this, SLOT(slotShowMenu()) );
93 104
94 m_enablePaint = true; 105 m_enablePaint = true;
95 setUpdatesEnabled( true ); 106 setUpdatesEnabled( true );
96 viewport()->setUpdatesEnabled( true ); 107 viewport()->setUpdatesEnabled( true );
97 viewport()->update(); 108 viewport()->update();
98 setSortOrder( 0 ); 109 setSortOrder( 0 );
99 setAscending( TRUE ); 110 setAscending( TRUE );
100 m_first = true; 111 m_first = true;
101 112
102 // Load icons
103 // TODO - probably should be done globally somewhere else, see also quickeditimpl.cpp/h
104 m_pic_completed = Resource::loadPixmap( "todo/completed" );
105 QString namestr;
106 for ( unsigned int i = 1; i < 6; i++ ) {
107 namestr = "todo/priority";
108 namestr.append( QString::number( i ) );
109 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr );
110 }
111
112 /* now let's init the config */ 113 /* now let's init the config */
113 initConfig(); 114 initConfig();
114} 115}
115/* a new day has started 116/* a new day has started
116 * update the day 117 * update the day
117 */ 118 */
118void TableView::newDay() { 119void TableView::newDay() {
119 clear(); 120 clear();
120 updateView(); 121 updateView();
121} 122}
122TableView::~TableView() { 123TableView::~TableView() {
123 124
124} 125}
125void TableView::slotShowMenu() { 126void TableView::slotShowMenu() {
126 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); 127 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() );
127 menu->exec(QCursor::pos() ); 128 menu->exec(QCursor::pos() );
128 delete menu; 129 delete menu;
129} 130}
130QString TableView::type() const { 131QString TableView::type() const {
131 return QString::fromLatin1( tr("Table View") ); 132 return QString::fromLatin1( tr("Table View") );
132} 133}
133int TableView::current() { 134int TableView::current() {
134 int uid = sorted().uidAt(currentRow() ); 135 int uid = sorted().uidAt(currentRow() );
135 136
136 return uid; 137 return uid;
137} 138}
138QString TableView::currentRepresentation() { 139QString TableView::currentRepresentation() {
139 OTodo to = sorted()[currentRow()]; 140 OTodo to = sorted()[currentRow()];
140 return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; 141 return to.summary().isEmpty() ? to.description().left(20) : to.summary() ;
141} 142}
142/* show overdue */ 143/* show overdue */
143void TableView::showOverDue( bool ) { 144void TableView::showOverDue( bool ) {
144 clear(); 145 clear();
145 updateView(); 146 updateView();
146} 147}
147 148
148void TableView::updateView( ) { 149void TableView::updateView( ) {
149 qWarning("update view"); 150 qWarning("update view");
150 m_row = false; 151 m_row = false;
151 static int id; 152 static int id;
152 id = startTimer(4000 ); 153 id = startTimer(4000 );
153 /* FIXME we want one page to be read! 154 /* FIXME we want one page to be read!
154 * 155 *
155 * Calculate that screensize 156 * Calculate that screensize
156 */ 157 */
157 todoWindow()->setReadAhead( 4 ); 158 todoWindow()->setReadAhead( 4 );
158 sort(); 159 sort();
159 OTodoAccess::List::Iterator it, end; 160 OTodoAccess::List::Iterator it, end;
160 it = sorted().begin(); 161 it = sorted().begin();
161 end = sorted().end(); 162 end = sorted().end();
162 163
163 qWarning("setTodos"); 164 qWarning("setTodos");
164 QTime time; 165 QTime time;
165 time.start(); 166 time.start();
166 m_enablePaint = false; 167 m_enablePaint = false;
167 setUpdatesEnabled( false ); 168 setUpdatesEnabled( false );
168 viewport()->setUpdatesEnabled( false ); 169 viewport()->setUpdatesEnabled( false );
169 170
170 setNumRows( it.count() ); 171 setNumRows( it.count() );
171 if ( it.count() == 0 ) 172 if ( it.count() == 0 )
172 killTimer(id); 173 killTimer(id);
173 174
174// int elc = time.elapsed(); 175// int elc = time.elapsed();
175 setUpdatesEnabled( true ); 176 setUpdatesEnabled( true );
176 viewport()->setUpdatesEnabled( true ); 177 viewport()->setUpdatesEnabled( true );
177 viewport()->update(); 178 viewport()->update();
178 179
179 m_enablePaint = true; 180 m_enablePaint = true;
180// int el = time.elapsed(); 181// int el = time.elapsed();
181} 182}
182void TableView::setTodo( int, const OTodo&) { 183void TableView::setTodo( int, const OTodo&) {
183 sort(); 184 sort();
184 185
185 /* repaint */ 186 /* repaint */
186 repaint(); 187 repaint();
187} 188}
188void TableView::addEvent( const OTodo&) { 189void TableView::addEvent( const OTodo&) {
189 190
190 /* fix problems of not showing the 'Haken' */ 191 /* fix problems of not showing the 'Haken' */
191 updateView(); 192 updateView();
192} 193}
193/* 194/*
194 * find the event 195 * find the event
195 * and then replace the complete row 196 * and then replace the complete row
196 */ 197 */
197void TableView::replaceEvent( const OTodo& ev) { 198void TableView::replaceEvent( const OTodo& ev) {
198 addEvent( ev ); 199 addEvent( ev );
199} 200}
200/* 201/*
201 * re aligning table can be slow too 202 * re aligning table can be slow too
202 * FIXME: look what performs better 203 * FIXME: look what performs better
203 * either this or the old align table 204 * either this or the old align table
204 */ 205 */
205void TableView::removeEvent( int ) { 206void TableView::removeEvent( int ) {
206 updateView(); 207 updateView();
207} 208}
208void TableView::setShowCompleted( bool b) { 209void TableView::setShowCompleted( bool b) {
209 qWarning("Show Completed %d" + b ); 210 qWarning("Show Completed %d" + b );
210 updateView(); 211 updateView();
211} 212}
212void TableView::setShowDeadline( bool b ) { 213void TableView::setShowDeadline( bool b ) {
213 qWarning( "Show DeadLine %d" + b ); 214 qWarning( "Show DeadLine %d" + b );
214 if ( b ) 215 if ( b )
215 showColumn( 3 ); 216 showColumn( 3 );
216 else 217 else
217 hideColumn( 3 ); 218 hideColumn( 3 );
218 219
219 // Try to intelligently size columns 220 // Try to intelligently size columns
220 // TODO - would use width() below, but doesn't have valid value at time of c'tor 221 // TODO - would use width() below, but doesn't have valid value at time of c'tor
221 int col2width = 238; 222 int col2width = 238;
222 int width = m_pic_completed.width(); 223 int width = m_pic_completed.width();
223 setColumnWidth( 0, width ); 224 setColumnWidth( 0, width );
224 col2width -= width; 225 col2width -= width;
225 width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; 226 width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8;
226 setColumnWidth( 1, width ); 227 setColumnWidth( 1, width );
227 col2width -= width; 228 col2width -= width;
228 if ( b ) { 229 if ( b ) {
229 width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; 230 width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8;
230 setColumnWidth( 3, width ); 231 setColumnWidth( 3, width );
231 col2width -= width; 232 col2width -= width;
232 } 233 }
233 setColumnWidth( 2, col2width ); 234 setColumnWidth( 2, col2width );
234} 235}
235void TableView::setShowCategory( const QString& str) { 236void TableView::setShowCategory( const QString& str) {
236 qWarning("setShowCategory"); 237 qWarning("setShowCategory");
237 if ( str != m_oleCat || m_first ) 238 if ( str != m_oleCat || m_first )
238 updateView(); 239 updateView();
239 240