author | zecke <zecke> | 2004-04-04 21:35:02 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-04 21:35:02 (UTC) |
commit | 4da953f1ef0349acc5b86ee15b9e3005dabc319f (patch) (unidiff) | |
tree | 89d73beecf627948657e43557a3e5d02739a8e13 | |
parent | f664b509b5e622ab74560fb74093175e50b2790c (diff) | |
download | opie-4da953f1ef0349acc5b86ee15b9e3005dabc319f.zip opie-4da953f1ef0349acc5b86ee15b9e3005dabc319f.tar.gz opie-4da953f1ef0349acc5b86ee15b9e3005dabc319f.tar.bz2 |
fix up owarn usage
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 42 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.cpp | 1 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 20 | ||||
-rw-r--r-- | core/pim/todo/templatedialog.cpp | 4 | ||||
-rw-r--r-- | core/pim/todo/todoeditor.cpp | 2 | ||||
-rw-r--r-- | core/pim/todo/todomanager.cpp | 4 | ||||
-rw-r--r-- | core/pim/todo/todotemplatemanager.cpp | 3 | ||||
-rw-r--r-- | core/pim/todo/todoview.cpp | 4 |
8 files changed, 36 insertions, 44 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index d552928..924fde1 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -1,129 +1,129 @@ | |||
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 | 30 | ||
31 | #include <opie2/odebug.h> | 31 | #include <opie2/odebug.h> |
32 | #include <opie2/opimrecurrence.h> | 32 | #include <opie2/opimrecurrence.h> |
33 | #include <opie2/opimnotifymanager.h> | 33 | #include <opie2/opimnotifymanager.h> |
34 | #include <opie2/otodoaccessvcal.h> | 34 | #include <opie2/otodoaccessvcal.h> |
35 | #include <opie2/oapplicationfactory.h> | 35 | #include <opie2/oapplicationfactory.h> |
36 | 36 | ||
37 | #include <qpe/applnk.h> | 37 | #include <qpe/applnk.h> |
38 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
39 | #include <qpe/ir.h> | 39 | #include <qpe/ir.h> |
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/qpemessagebox.h> | 41 | #include <qpe/qpemessagebox.h> |
42 | #include <qpe/alarmserver.h> | 42 | #include <qpe/alarmserver.h> |
43 | #include <qpe/qpeapplication.h> | 43 | #include <qpe/qpeapplication.h> |
44 | 44 | ||
45 | #include <qmenubar.h> | 45 | #include <qmenubar.h> |
46 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
47 | #include <qpushbutton.h> | 47 | #include <qpushbutton.h> |
48 | #include <qaction.h> | 48 | #include <qaction.h> |
49 | #include <qtimer.h> | 49 | #include <qtimer.h> |
50 | #include <qlayout.h> | 50 | #include <qlayout.h> |
51 | #include <qwhatsthis.h> | 51 | #include <qwhatsthis.h> |
52 | 52 | ||
53 | #include "quickeditimpl.h" | 53 | #include "quickeditimpl.h" |
54 | #include "todotemplatemanager.h" | 54 | #include "todotemplatemanager.h" |
55 | #include "templateeditor.h" | 55 | #include "templateeditor.h" |
56 | #include "tableview.h" | 56 | #include "tableview.h" |
57 | 57 | ||
58 | #include "textviewshow.h" | 58 | #include "textviewshow.h" |
59 | #include "todoeditor.h" | 59 | #include "todoeditor.h" |
60 | #include "mainwindow.h" | 60 | #include "mainwindow.h" |
61 | 61 | ||
62 | using namespace Opie::Core; | 62 | using Opie::Core::OApplicationFactory; |
63 | OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) | 63 | OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) |
64 | 64 | ||
65 | using namespace Opie; | 65 | using namespace Opie; |
66 | using namespace Todo; | 66 | using namespace Todo; |
67 | 67 | ||
68 | MainWindow::MainWindow( QWidget* parent, | 68 | MainWindow::MainWindow( QWidget* parent, |
69 | const char* name, WFlags ) | 69 | const char* name, WFlags ) |
70 | : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) | 70 | : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) |
71 | { | 71 | { |
72 | if (!name) | 72 | if (!name) |
73 | setName("todo window"); | 73 | setName("todo window"); |
74 | 74 | ||
75 | m_syncing = false; | 75 | m_syncing = false; |
76 | m_showing = false; | 76 | m_showing = false; |
77 | m_counter = 0; | 77 | m_counter = 0; |
78 | m_tempManager = new TemplateManager(); | 78 | m_tempManager = new TemplateManager(); |
79 | m_tempManager->load(); | 79 | m_tempManager->load(); |
80 | 80 | ||
81 | initUI(); | 81 | initUI(); |
82 | initConfig(); | 82 | initConfig(); |
83 | initViews(); | 83 | initViews(); |
84 | initActions(); | 84 | initActions(); |
85 | initEditor(); | 85 | initEditor(); |
86 | initShow(); | 86 | initShow(); |
87 | initTemplate(); | 87 | initTemplate(); |
88 | 88 | ||
89 | populateTemplates(); | 89 | populateTemplates(); |
90 | raiseCurrentView(); | 90 | raiseCurrentView(); |
91 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); | 91 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); |
92 | } | 92 | } |
93 | void MainWindow::initTemplate() { | 93 | void MainWindow::initTemplate() { |
94 | m_curTempEd = new TemplateEditor( this, templateManager() ); | 94 | m_curTempEd = new TemplateEditor( this, templateManager() ); |
95 | } | 95 | } |
96 | void MainWindow::initActions() { | 96 | void MainWindow::initActions() { |
97 | 97 | ||
98 | // Data menu | 98 | // Data menu |
99 | m_edit->insertItem(QWidget::tr("New from template"), m_template, | 99 | m_edit->insertItem(QWidget::tr("New from template"), m_template, |
100 | -1, 0 ); | 100 | -1, 0 ); |
101 | 101 | ||
102 | QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), | 102 | QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), |
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( slotNew() ) ); | 105 | this, SLOT( slotNew() ) ); |
106 | a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); | 106 | a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); |
107 | a->addTo(m_tool ); | 107 | a->addTo(m_tool ); |
108 | a->addTo(m_edit ); | 108 | a->addTo(m_edit ); |
109 | 109 | ||
110 | a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), | 110 | a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), |
111 | QString::null, 0, this, 0 ); | 111 | QString::null, 0, this, 0 ); |
112 | connect(a, SIGNAL(activated() ), | 112 | connect(a, SIGNAL(activated() ), |
113 | this, SLOT( slotEdit() ) ); | 113 | this, SLOT( slotEdit() ) ); |
114 | a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); | 114 | a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); |
115 | a->addTo( m_tool ); | 115 | a->addTo( m_tool ); |
116 | a->addTo( m_edit ); | 116 | a->addTo( m_edit ); |
117 | m_editAction = a; | 117 | m_editAction = a; |
118 | 118 | ||
119 | a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); | 119 | a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); |
120 | connect(a, SIGNAL( activated() ), | 120 | connect(a, SIGNAL( activated() ), |
121 | this, SLOT( slotShowDetails() ) ); | 121 | this, SLOT( slotShowDetails() ) ); |
122 | a->addTo( m_edit ); | 122 | a->addTo( m_edit ); |
123 | 123 | ||
124 | m_edit->insertSeparator(); | 124 | m_edit->insertSeparator(); |
125 | 125 | ||
126 | a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ), | 126 | a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ), |
127 | QString::null, 0, this, 0 ); | 127 | QString::null, 0, this, 0 ); |
128 | connect(a, SIGNAL(activated() ), | 128 | connect(a, SIGNAL(activated() ), |
129 | this, SLOT(slotDelete() ) ); | 129 | this, SLOT(slotDelete() ) ); |
@@ -235,207 +235,207 @@ void MainWindow::initUI() { | |||
235 | 235 | ||
236 | m_tool = new QToolBar( this ); | 236 | m_tool = new QToolBar( this ); |
237 | 237 | ||
238 | /** QPopupMenu */ | 238 | /** QPopupMenu */ |
239 | m_edit = new QPopupMenu( this ); | 239 | m_edit = new QPopupMenu( this ); |
240 | m_options = new QPopupMenu( this ); | 240 | m_options = new QPopupMenu( this ); |
241 | m_catMenu = new QPopupMenu( this ); | 241 | m_catMenu = new QPopupMenu( this ); |
242 | m_template = new QPopupMenu( this ); | 242 | m_template = new QPopupMenu( this ); |
243 | 243 | ||
244 | m_catMenu->setCheckable( TRUE ); | 244 | m_catMenu->setCheckable( TRUE ); |
245 | m_template->setCheckable( TRUE ); | 245 | m_template->setCheckable( TRUE ); |
246 | 246 | ||
247 | connect(m_catMenu, SIGNAL(activated(int) ), | 247 | connect(m_catMenu, SIGNAL(activated(int) ), |
248 | this, SLOT(setCategory(int) ) ); | 248 | this, SLOT(setCategory(int) ) ); |
249 | connect(m_template, SIGNAL(activated(int) ), | 249 | connect(m_template, SIGNAL(activated(int) ), |
250 | this, SLOT(slotNewFromTemplate(int) ) ); | 250 | this, SLOT(slotNewFromTemplate(int) ) ); |
251 | } | 251 | } |
252 | void MainWindow::initViews() { | 252 | void MainWindow::initViews() { |
253 | 253 | ||
254 | TableView* tableView = new TableView( this, m_stack ); | 254 | TableView* tableView = new TableView( this, m_stack ); |
255 | QWhatsThis::add( tableView, QWidget::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." ) ); | 255 | QWhatsThis::add( tableView, QWidget::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." ) ); |
256 | m_stack->addWidget( tableView, m_counter++ ); | 256 | m_stack->addWidget( tableView, m_counter++ ); |
257 | m_views.append( tableView ); | 257 | m_views.append( tableView ); |
258 | m_curView = tableView; | 258 | m_curView = tableView; |
259 | connectBase( tableView ); | 259 | connectBase( tableView ); |
260 | /* add QString type + QString configname to | 260 | /* add QString type + QString configname to |
261 | * the View menu | 261 | * the View menu |
262 | * and subdirs for multiple views | 262 | * and subdirs for multiple views |
263 | */ | 263 | */ |
264 | } | 264 | } |
265 | void MainWindow::initEditor() { | 265 | void MainWindow::initEditor() { |
266 | m_curEdit = new Editor(); | 266 | m_curEdit = new Editor(); |
267 | } | 267 | } |
268 | void MainWindow::initShow() { | 268 | void MainWindow::initShow() { |
269 | m_curShow = new TextViewShow(this, this); | 269 | m_curShow = new TextViewShow(this, this); |
270 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); | 270 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); |
271 | } | 271 | } |
272 | MainWindow::~MainWindow() { | 272 | MainWindow::~MainWindow() { |
273 | delete templateManager(); | 273 | delete templateManager(); |
274 | } | 274 | } |
275 | void MainWindow::connectBase( ViewBase* ) { | 275 | void MainWindow::connectBase( ViewBase* ) { |
276 | // once templates and signals mix we'll use it again | 276 | // once templates and signals mix we'll use it again |
277 | } | 277 | } |
278 | QPopupMenu* MainWindow::contextMenu( int , bool recur ) { | 278 | QPopupMenu* MainWindow::contextMenu( int , bool recur ) { |
279 | QPopupMenu* menu = new QPopupMenu(); | 279 | QPopupMenu* menu = new QPopupMenu(); |
280 | 280 | ||
281 | m_editAction->addTo( menu ); | 281 | m_editAction->addTo( menu ); |
282 | m_deleteAction->addTo( menu ); | 282 | m_deleteAction->addTo( menu ); |
283 | m_duplicateAction->addTo( menu ); | 283 | m_duplicateAction->addTo( menu ); |
284 | 284 | ||
285 | menu->insertSeparator(); | 285 | menu->insertSeparator(); |
286 | 286 | ||
287 | /* | 287 | /* |
288 | * if this event recurs we allow | 288 | * if this event recurs we allow |
289 | * to detach it. | 289 | * to detach it. |
290 | * remove all | 290 | * remove all |
291 | */ | 291 | */ |
292 | if ( recur ) { | 292 | if ( recur ) { |
293 | ; // FIXME | 293 | ; // FIXME |
294 | } | 294 | } |
295 | 295 | ||
296 | return menu; | 296 | return menu; |
297 | } | 297 | } |
298 | QPopupMenu* MainWindow::options() { | 298 | QPopupMenu* MainWindow::options() { |
299 | Opie::Core::owarn << "Options" << oendl; | 299 | owarn << "Options" << oendl; |
300 | return m_options; | 300 | return m_options; |
301 | } | 301 | } |
302 | QPopupMenu* MainWindow::edit() { | 302 | QPopupMenu* MainWindow::edit() { |
303 | return m_edit; | 303 | return m_edit; |
304 | } | 304 | } |
305 | QToolBar* MainWindow::toolbar() { | 305 | QToolBar* MainWindow::toolbar() { |
306 | return m_tool; | 306 | return m_tool; |
307 | } | 307 | } |
308 | OPimTodoAccess::List MainWindow::list()const { | 308 | OPimTodoAccess::List MainWindow::list()const { |
309 | return m_todoMgr.list(); | 309 | return m_todoMgr.list(); |
310 | } | 310 | } |
311 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { | 311 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { |
312 | int cat = 0; | 312 | int cat = 0; |
313 | if ( m_curCat != QWidget::tr("All Categories") ) | 313 | if ( m_curCat != QWidget::tr("All Categories") ) |
314 | cat = currentCatId(); | 314 | cat = currentCatId(); |
315 | if ( m_curCat == QWidget::tr("Unfiled") ) | 315 | if ( m_curCat == QWidget::tr("Unfiled") ) |
316 | cat = -1; | 316 | cat = -1; |
317 | 317 | ||
318 | Opie::Core::owarn << " Category " << cat << " " << m_curCat << oendl; | 318 | owarn << " Category " << cat << " " << m_curCat << oendl; |
319 | 319 | ||
320 | int filter = 1; | 320 | int filter = 1; |
321 | 321 | ||
322 | if (!m_completed ) | 322 | if (!m_completed ) |
323 | filter |= 4; | 323 | filter |= 4; |
324 | if (m_overdue) | 324 | if (m_overdue) |
325 | filter |= 2; | 325 | filter |= 2; |
326 | 326 | ||
327 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); | 327 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); |
328 | } | 328 | } |
329 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { | 329 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { |
330 | int cat = 0; | 330 | int cat = 0; |
331 | if ( m_curCat != QWidget::tr("All Categories") ) | 331 | if ( m_curCat != QWidget::tr("All Categories") ) |
332 | cat = currentCatId(); | 332 | cat = currentCatId(); |
333 | 333 | ||
334 | if ( m_curCat == QWidget::tr("Unfiled") ) | 334 | if ( m_curCat == QWidget::tr("Unfiled") ) |
335 | cat = -1; | 335 | cat = -1; |
336 | 336 | ||
337 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); | 337 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); |
338 | } | 338 | } |
339 | OPimTodo MainWindow::event( int uid ) { | 339 | OPimTodo MainWindow::event( int uid ) { |
340 | return m_todoMgr.event( uid ); | 340 | return m_todoMgr.event( uid ); |
341 | } | 341 | } |
342 | bool MainWindow::isSyncing()const { | 342 | bool MainWindow::isSyncing()const { |
343 | return m_syncing; | 343 | return m_syncing; |
344 | } | 344 | } |
345 | TemplateManager* MainWindow::templateManager() { | 345 | TemplateManager* MainWindow::templateManager() { |
346 | return m_tempManager; | 346 | return m_tempManager; |
347 | } | 347 | } |
348 | Editor* MainWindow::currentEditor() { | 348 | Editor* MainWindow::currentEditor() { |
349 | return m_curEdit; | 349 | return m_curEdit; |
350 | } | 350 | } |
351 | TodoShow* MainWindow::currentShow() { | 351 | TodoShow* MainWindow::currentShow() { |
352 | return m_curShow; | 352 | return m_curShow; |
353 | } | 353 | } |
354 | void MainWindow::slotReload() { | 354 | void MainWindow::slotReload() { |
355 | m_syncing = FALSE; | 355 | m_syncing = FALSE; |
356 | m_todoMgr.reload(); | 356 | m_todoMgr.reload(); |
357 | currentView()->updateView( ); | 357 | currentView()->updateView( ); |
358 | raiseCurrentView(); | 358 | raiseCurrentView(); |
359 | } | 359 | } |
360 | void MainWindow::closeEvent( QCloseEvent* e ) { | 360 | void MainWindow::closeEvent( QCloseEvent* e ) { |
361 | if (m_stack->visibleWidget() == currentShow()->widget() ) { | 361 | if (m_stack->visibleWidget() == currentShow()->widget() ) { |
362 | m_showing = false; | 362 | m_showing = false; |
363 | raiseCurrentView(); | 363 | raiseCurrentView(); |
364 | e->ignore(); | 364 | e->ignore(); |
365 | return; | 365 | return; |
366 | } | 366 | } |
367 | /* | 367 | /* |
368 | * we should have flushed and now we're still saving | 368 | * we should have flushed and now we're still saving |
369 | * so there is no need to flush | 369 | * so there is no need to flush |
370 | */ | 370 | */ |
371 | if (m_syncing ) { | 371 | if (m_syncing ) { |
372 | e->accept(); | 372 | e->accept(); |
373 | return; | 373 | return; |
374 | } | 374 | } |
375 | bool quit = false; | 375 | bool quit = false; |
376 | if ( m_todoMgr.saveAll() ){ | 376 | if ( m_todoMgr.saveAll() ){ |
377 | Opie::Core::owarn << "saved" << oendl; | 377 | owarn << "saved" << oendl; |
378 | quit = true; | 378 | quit = true; |
379 | }else { | 379 | }else { |
380 | if ( QMessageBox::critical( this, QWidget::tr("Out of space"), | 380 | if ( QMessageBox::critical( this, QWidget::tr("Out of space"), |
381 | QWidget::tr("Todo was unable\n" | 381 | QWidget::tr("Todo was unable\n" |
382 | "to save your changes.\n" | 382 | "to save your changes.\n" |
383 | "Free up some space\n" | 383 | "Free up some space\n" |
384 | "and try again.\n" | 384 | "and try again.\n" |
385 | "\nQuit Anyway?"), | 385 | "\nQuit Anyway?"), |
386 | QMessageBox::Yes|QMessageBox::Escape, | 386 | QMessageBox::Yes|QMessageBox::Escape, |
387 | QMessageBox::No|QMessageBox::Default) | 387 | QMessageBox::No|QMessageBox::Default) |
388 | != QMessageBox::No ) { | 388 | != QMessageBox::No ) { |
389 | e->accept(); | 389 | e->accept(); |
390 | quit = true; | 390 | quit = true; |
391 | }else | 391 | }else |
392 | e->ignore(); | 392 | e->ignore(); |
393 | 393 | ||
394 | } | 394 | } |
395 | 395 | ||
396 | if (quit ) { | 396 | if (quit ) { |
397 | Config config( "todo" ); | 397 | Config config( "todo" ); |
398 | config.setGroup( "View" ); | 398 | config.setGroup( "View" ); |
399 | config.writeEntry( "ShowComplete", showCompleted() ); | 399 | config.writeEntry( "ShowComplete", showCompleted() ); |
400 | config.writeEntry( "Category", currentCategory() ); | 400 | config.writeEntry( "Category", currentCategory() ); |
401 | config.writeEntry( "ShowDeadLine", showDeadline()); | 401 | config.writeEntry( "ShowDeadLine", showDeadline()); |
402 | config.writeEntry( "ShowOverDue", showOverDue() ); | 402 | config.writeEntry( "ShowOverDue", showOverDue() ); |
403 | config.writeEntry( "ShowQuickTask", showQuickTask() ); | 403 | config.writeEntry( "ShowQuickTask", showQuickTask() ); |
404 | /* save templates */ | 404 | /* save templates */ |
405 | templateManager()->save(); | 405 | templateManager()->save(); |
406 | e->accept(); | 406 | e->accept(); |
407 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows()) ); | 407 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows()) ); |
408 | } | 408 | } |
409 | } | 409 | } |
410 | void MainWindow::populateTemplates() { | 410 | void MainWindow::populateTemplates() { |
411 | m_template->clear(); | 411 | m_template->clear(); |
412 | QStringList list = templateManager()->templates(); | 412 | QStringList list = templateManager()->templates(); |
413 | QStringList::Iterator it; | 413 | QStringList::Iterator it; |
414 | for ( it = list.begin(); it != list.end(); ++it ) { | 414 | for ( it = list.begin(); it != list.end(); ++it ) { |
415 | m_template->insertItem( (*it) ); | 415 | m_template->insertItem( (*it) ); |
416 | } | 416 | } |
417 | } | 417 | } |
418 | /* | 418 | /* |
419 | * slotNewFromTemplate | 419 | * slotNewFromTemplate |
420 | * We use the edit widget to do | 420 | * We use the edit widget to do |
421 | * the config but we setUid(1) | 421 | * the config but we setUid(1) |
422 | * to get a new uid | 422 | * to get a new uid |
423 | */ | 423 | */ |
424 | /* | 424 | /* |
425 | * first we get the name of the template | 425 | * first we get the name of the template |
426 | * then we will use the TemplateManager | 426 | * then we will use the TemplateManager |
427 | */ | 427 | */ |
428 | void MainWindow::slotNewFromTemplate( int id ) { | 428 | void MainWindow::slotNewFromTemplate( int id ) { |
429 | QString name = m_template->text( id ); | 429 | QString name = m_template->text( id ); |
430 | 430 | ||
431 | OPimTodo event = templateManager()->templateEvent( name ); | 431 | OPimTodo event = templateManager()->templateEvent( name ); |
432 | event = currentEditor()->edit(this, | 432 | event = currentEditor()->edit(this, |
433 | event ); | 433 | event ); |
434 | 434 | ||
435 | if ( currentEditor()->accepted() ) { | 435 | if ( currentEditor()->accepted() ) { |
436 | /* assign new todo */ | 436 | /* assign new todo */ |
437 | event.setUid( 1 ); | 437 | event.setUid( 1 ); |
438 | handleAlarms( OPimTodo(), event ); | 438 | handleAlarms( OPimTodo(), event ); |
439 | m_todoMgr.add( event ); | 439 | m_todoMgr.add( event ); |
440 | currentView()->addEvent( event ); | 440 | currentView()->addEvent( event ); |
441 | 441 | ||
@@ -476,379 +476,381 @@ void MainWindow::slotDelete() { | |||
476 | handleAlarms( m_todoMgr.event( currentView()->current() ), OPimTodo() ); | 476 | handleAlarms( m_todoMgr.event( currentView()->current() ), OPimTodo() ); |
477 | m_todoMgr.remove( currentView()->current() ); | 477 | m_todoMgr.remove( currentView()->current() ); |
478 | currentView()->removeEvent( currentView()->current() ); | 478 | currentView()->removeEvent( currentView()->current() ); |
479 | raiseCurrentView(); | 479 | raiseCurrentView(); |
480 | } | 480 | } |
481 | void MainWindow::slotDelete(int uid ) { | 481 | void MainWindow::slotDelete(int uid ) { |
482 | if( uid == 0 ) return; | 482 | if( uid == 0 ) return; |
483 | if(m_syncing) { | 483 | if(m_syncing) { |
484 | QMessageBox::warning(this, QWidget::tr("Todo"), | 484 | QMessageBox::warning(this, QWidget::tr("Todo"), |
485 | QWidget::tr("Data can not be edited, currently syncing")); | 485 | QWidget::tr("Data can not be edited, currently syncing")); |
486 | return; | 486 | return; |
487 | } | 487 | } |
488 | OPimTodo to = m_todoMgr.event(uid); | 488 | OPimTodo to = m_todoMgr.event(uid); |
489 | if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), to.toShortText() ) ) | 489 | if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), to.toShortText() ) ) |
490 | return; | 490 | return; |
491 | 491 | ||
492 | handleAlarms(to, OPimTodo() ); | 492 | handleAlarms(to, OPimTodo() ); |
493 | m_todoMgr.remove( to.uid() ); | 493 | m_todoMgr.remove( to.uid() ); |
494 | currentView()->removeEvent( to.uid() ); | 494 | currentView()->removeEvent( to.uid() ); |
495 | raiseCurrentView(); | 495 | raiseCurrentView(); |
496 | } | 496 | } |
497 | void MainWindow::slotDeleteAll() { | 497 | void MainWindow::slotDeleteAll() { |
498 | if(m_syncing) { | 498 | if(m_syncing) { |
499 | QMessageBox::warning(this, QWidget::tr("Todo"), | 499 | QMessageBox::warning(this, QWidget::tr("Todo"), |
500 | QWidget::tr("Data can not be edited, currently syncing")); | 500 | QWidget::tr("Data can not be edited, currently syncing")); |
501 | return; | 501 | return; |
502 | } | 502 | } |
503 | 503 | ||
504 | 504 | ||
505 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) ) | 505 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) ) |
506 | return; | 506 | return; |
507 | 507 | ||
508 | m_todoMgr.removeAll(); | 508 | m_todoMgr.removeAll(); |
509 | currentView()->clear(); | 509 | currentView()->clear(); |
510 | 510 | ||
511 | raiseCurrentView(); | 511 | raiseCurrentView(); |
512 | } | 512 | } |
513 | void MainWindow::slotDeleteCompleted() { | 513 | void MainWindow::slotDeleteCompleted() { |
514 | if(m_syncing) { | 514 | if(m_syncing) { |
515 | QMessageBox::warning(this, QWidget::tr("Todo"), | 515 | QMessageBox::warning(this, QWidget::tr("Todo"), |
516 | QWidget::tr("Data can not be edited, currently syncing")); | 516 | QWidget::tr("Data can not be edited, currently syncing")); |
517 | return; | 517 | return; |
518 | } | 518 | } |
519 | 519 | ||
520 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) ) | 520 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) ) |
521 | return; | 521 | return; |
522 | 522 | ||
523 | 523 | ||
524 | m_todoMgr.removeCompleted(); | 524 | m_todoMgr.removeCompleted(); |
525 | currentView()->updateView( ); | 525 | currentView()->updateView( ); |
526 | } | 526 | } |
527 | void MainWindow::slotFind() { | 527 | void MainWindow::slotFind() { |
528 | 528 | ||
529 | } | 529 | } |
530 | void MainWindow::slotEdit() { | 530 | void MainWindow::slotEdit() { |
531 | slotEdit( currentView()->current() ); | 531 | slotEdit( currentView()->current() ); |
532 | } | 532 | } |
533 | /* | 533 | /* |
534 | * set the category | 534 | * set the category |
535 | */ | 535 | */ |
536 | void MainWindow::setCategory( int c) { | 536 | void MainWindow::setCategory( int c) { |
537 | if ( c <= 0 ) return; | 537 | if ( c <= 0 ) return; |
538 | 538 | ||
539 | 539 | ||
540 | Opie::Core::owarn << "Iterating over cats " << c << oendl; | 540 | owarn << "Iterating over cats " << c << oendl; |
541 | for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) | 541 | for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) |
542 | m_catMenu->setItemChecked(i, c == (int)i ); | 542 | m_catMenu->setItemChecked(i, c == (int)i ); |
543 | 543 | ||
544 | if (c == 1 ) { | 544 | if (c == 1 ) { |
545 | m_curCat = QString::null; | 545 | m_curCat = QString::null; |
546 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); | 546 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); |
547 | 547 | ||
548 | }else if ( c == (int)m_catMenu->count() - 1 ) { | 548 | }else if ( c == (int)m_catMenu->count() - 1 ) { |
549 | m_curCat = QWidget::tr("Unfiled"); | 549 | m_curCat = QWidget::tr("Unfiled"); |
550 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); | 550 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); |
551 | }else { | 551 | }else { |
552 | m_curCat = m_todoMgr.categories()[c-2]; | 552 | m_curCat = m_todoMgr.categories()[c-2]; |
553 | setCaption( QWidget::tr("Todo") + " - " + m_curCat ); | 553 | setCaption( QWidget::tr("Todo") + " - " + m_curCat ); |
554 | } | 554 | } |
555 | m_catMenu->setItemChecked( c, true ); | 555 | m_catMenu->setItemChecked( c, true ); |
556 | 556 | ||
557 | currentView()->setShowCategory( m_curCat ); | 557 | currentView()->setShowCategory( m_curCat ); |
558 | raiseCurrentView(); | 558 | raiseCurrentView(); |
559 | } | 559 | } |
560 | void MainWindow::slotShowDeadLine( bool dead) { | 560 | void MainWindow::slotShowDeadLine( bool dead) { |
561 | m_deadline = dead; | 561 | m_deadline = dead; |
562 | currentView()->setShowDeadline( dead ); | 562 | currentView()->setShowDeadline( dead ); |
563 | } | 563 | } |
564 | void MainWindow::slotShowCompleted( bool show) { | 564 | void MainWindow::slotShowCompleted( bool show) { |
565 | m_completed = show; | 565 | m_completed = show; |
566 | currentView()->setShowCompleted( m_completed ); | 566 | currentView()->setShowCompleted( m_completed ); |
567 | } | 567 | } |
568 | void MainWindow::slotShowQuickTask( bool show ) { | 568 | void MainWindow::slotShowQuickTask( bool show ) { |
569 | m_quicktask = show; | 569 | m_quicktask = show; |
570 | if ( m_quicktask ) | 570 | if ( m_quicktask ) |
571 | m_curQuick->widget()->show(); | 571 | m_curQuick->widget()->show(); |
572 | else | 572 | else |
573 | m_curQuick->widget()->hide(); | 573 | m_curQuick->widget()->hide(); |
574 | } | 574 | } |
575 | bool MainWindow::showOverDue()const { | 575 | bool MainWindow::showOverDue()const { |
576 | return m_overdue; | 576 | return m_overdue; |
577 | } | 577 | } |
578 | void MainWindow::setDocument( const QString& fi) { | 578 | void MainWindow::setDocument( const QString& fi) { |
579 | DocLnk doc(fi); | 579 | DocLnk doc(fi); |
580 | if (doc.isValid() ) | 580 | if (doc.isValid() ) |
581 | receiveFile(doc.file() ); | 581 | receiveFile(doc.file() ); |
582 | else | 582 | else |
583 | receiveFile(fi ); | 583 | receiveFile(fi ); |
584 | } | 584 | } |
585 | 585 | ||
586 | static const char *beamfile = "/tmp/opie-todo.vcs"; | 586 | static const char *beamfile = "/tmp/opie-todo.vcs"; |
587 | void MainWindow::slotBeam() { | 587 | void MainWindow::slotBeam() { |
588 | beam( currentView()->current() ); | 588 | beam( currentView()->current() ); |
589 | } | 589 | } |
590 | void MainWindow::beamDone( Ir* ir) { | 590 | void MainWindow::beamDone( Ir* ir) { |
591 | delete ir; | 591 | delete ir; |
592 | ::unlink( beamfile ); | 592 | ::unlink( beamfile ); |
593 | } | 593 | } |
594 | void MainWindow::receiveFile( const QString& filename ) { | 594 | void MainWindow::receiveFile( const QString& filename ) { |
595 | OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(filename ); | 595 | OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(filename ); |
596 | 596 | ||
597 | OPimTodoAccess acc( cal ); | 597 | OPimTodoAccess acc( cal ); |
598 | acc.load(); | 598 | acc.load(); |
599 | OPimTodoAccess::List list = acc.allRecords(); | 599 | OPimTodoAccess::List list = acc.allRecords(); |
600 | 600 | ||
601 | if (list.count()){ | 601 | if (list.count()){ |
602 | 602 | ||
603 | QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); | 603 | QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); |
604 | 604 | ||
605 | if ( QMessageBox::information(this, QWidget::tr("New Tasks"), | 605 | if ( QMessageBox::information(this, QWidget::tr("New Tasks"), |
606 | message, QMessageBox::Ok, | 606 | message, QMessageBox::Ok, |
607 | QMessageBox::Cancel ) == QMessageBox::Ok ) { | 607 | QMessageBox::Cancel ) == QMessageBox::Ok ) { |
608 | OPimTodoAccess::List::Iterator it; | 608 | OPimTodoAccess::List::Iterator it; |
609 | for ( it = list.begin(); it != list.end(); ++it ) | 609 | for ( it = list.begin(); it != list.end(); ++it ) |
610 | m_todoMgr.add( (*it) ); | 610 | m_todoMgr.add( (*it) ); |
611 | 611 | ||
612 | currentView()->updateView(); | 612 | currentView()->updateView(); |
613 | } | 613 | } |
614 | } | 614 | } |
615 | } | 615 | } |
616 | 616 | ||
617 | void MainWindow::slotFlush() { | 617 | void MainWindow::slotFlush() { |
618 | m_syncing = TRUE; | 618 | m_syncing = TRUE; |
619 | m_todoMgr.save(); | 619 | m_todoMgr.save(); |
620 | } | 620 | } |
621 | void MainWindow::slotShowDetails() { | 621 | void MainWindow::slotShowDetails() { |
622 | slotShow( currentView()->current() ); | 622 | slotShow( currentView()->current() ); |
623 | } | 623 | } |
624 | /* | 624 | /* |
625 | * populate the Categories | 625 | * populate the Categories |
626 | * Menu | 626 | * Menu |
627 | */ | 627 | */ |
628 | void MainWindow::populateCategories() { | 628 | void MainWindow::populateCategories() { |
629 | m_todoMgr.load(); | 629 | m_todoMgr.load(); |
630 | 630 | ||
631 | m_catMenu->clear(); | 631 | m_catMenu->clear(); |
632 | int id, rememberId; | 632 | int id, rememberId; |
633 | id = 1; | 633 | id = 1; |
634 | rememberId = 1; | 634 | rememberId = 1; |
635 | 635 | ||
636 | m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); | 636 | m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); |
637 | m_catMenu->insertSeparator(); | 637 | m_catMenu->insertSeparator(); |
638 | QStringList categories = m_todoMgr.categories(); | 638 | QStringList categories = m_todoMgr.categories(); |
639 | categories.append( QWidget::tr( "Unfiled" ) ); | 639 | categories.append( QWidget::tr( "Unfiled" ) ); |
640 | for ( QStringList::Iterator it = categories.begin(); | 640 | for ( QStringList::Iterator it = categories.begin(); |
641 | it != categories.end(); ++it ) { | 641 | it != categories.end(); ++it ) { |
642 | m_catMenu->insertItem( *it, id ); | 642 | m_catMenu->insertItem( *it, id ); |
643 | if ( *it == currentCategory() ) | 643 | if ( *it == currentCategory() ) |
644 | rememberId = id; | 644 | rememberId = id; |
645 | ++id; | 645 | ++id; |
646 | } | 646 | } |
647 | setCategory( rememberId ); | 647 | setCategory( rememberId ); |
648 | } | 648 | } |
649 | bool MainWindow::showCompleted()const { | 649 | bool MainWindow::showCompleted()const { |
650 | return m_completed; | 650 | return m_completed; |
651 | } | 651 | } |
652 | bool MainWindow::showDeadline()const { | 652 | bool MainWindow::showDeadline()const { |
653 | return m_deadline; | 653 | return m_deadline; |
654 | } | 654 | } |
655 | bool MainWindow::showQuickTask()const { | 655 | bool MainWindow::showQuickTask()const { |
656 | return m_quicktask; | 656 | return m_quicktask; |
657 | } | 657 | } |
658 | QString MainWindow::currentCategory()const { | 658 | QString MainWindow::currentCategory()const { |
659 | return m_curCat; | 659 | return m_curCat; |
660 | } | 660 | } |
661 | int MainWindow::currentCatId() { | 661 | int MainWindow::currentCatId() { |
662 | return m_todoMgr.catId( m_curCat ); | 662 | return m_todoMgr.catId( m_curCat ); |
663 | } | 663 | } |
664 | ViewBase* MainWindow::currentView() { | 664 | ViewBase* MainWindow::currentView() { |
665 | return m_curView; | 665 | return m_curView; |
666 | } | 666 | } |
667 | void MainWindow::raiseCurrentView() { | 667 | void MainWindow::raiseCurrentView() { |
668 | // due QPE/Application/todolist show(int) | 668 | // due QPE/Application/todolist show(int) |
669 | // we might not have the populateCategories slot called once | 669 | // we might not have the populateCategories slot called once |
670 | // we would show the otodo but then imediately switch to the currentView | 670 | // we would show the otodo but then imediately switch to the currentView |
671 | // if we're initially showing we shouldn't raise the table | 671 | // if we're initially showing we shouldn't raise the table |
672 | // in returnFromView we fix up m_showing | 672 | // in returnFromView we fix up m_showing |
673 | if (m_showing ) return; | 673 | if (m_showing ) return; |
674 | 674 | ||
675 | m_stack->raiseWidget( m_curView->widget() ); | 675 | m_stack->raiseWidget( m_curView->widget() ); |
676 | } | 676 | } |
677 | void MainWindow::slotShowDue(bool ov) { | 677 | void MainWindow::slotShowDue(bool ov) { |
678 | m_overdue = ov; | 678 | m_overdue = ov; |
679 | currentView()->showOverDue( ov ); | 679 | currentView()->showOverDue( ov ); |
680 | raiseCurrentView(); | 680 | raiseCurrentView(); |
681 | } | 681 | } |
682 | void MainWindow::slotShow( int uid ) { | 682 | void MainWindow::slotShow( int uid ) { |
683 | if ( uid == 0 ) return; | 683 | if ( uid == 0 ) return; |
684 | Opie::Core::owarn << "slotShow" << oendl; | 684 | |
685 | |||
686 | owarn << "slotShow" << oendl; | ||
685 | currentShow()->slotShow( event( uid ) ); | 687 | currentShow()->slotShow( event( uid ) ); |
686 | m_stack->raiseWidget( currentShow()->widget() ); | 688 | m_stack->raiseWidget( currentShow()->widget() ); |
687 | } | 689 | } |
688 | void MainWindow::slotShowNext() { | 690 | void MainWindow::slotShowNext() { |
689 | int l = currentView()->next(); | 691 | int l = currentView()->next(); |
690 | if (l!=0) | 692 | if (l!=0) |
691 | slotShow(l); | 693 | slotShow(l); |
692 | } | 694 | } |
693 | void MainWindow::slotShowPrev() { | 695 | void MainWindow::slotShowPrev() { |
694 | int l = currentView()->prev(); | 696 | int l = currentView()->prev(); |
695 | if (l!=0) | 697 | if (l!=0) |
696 | slotShow(l); | 698 | slotShow(l); |
697 | } | 699 | } |
698 | void MainWindow::slotEdit( int uid ) { | 700 | void MainWindow::slotEdit( int uid ) { |
699 | if (uid == 0 ) return; | 701 | if (uid == 0 ) return; |
700 | if(m_syncing) { | 702 | if(m_syncing) { |
701 | QMessageBox::warning(this, QWidget::tr("Todo"), | 703 | QMessageBox::warning(this, QWidget::tr("Todo"), |
702 | QWidget::tr("Data can't be edited, currently syncing")); | 704 | QWidget::tr("Data can't be edited, currently syncing")); |
703 | return; | 705 | return; |
704 | } | 706 | } |
705 | 707 | ||
706 | OPimTodo old_todo = m_todoMgr.event( uid ); | 708 | OPimTodo old_todo = m_todoMgr.event( uid ); |
707 | 709 | ||
708 | OPimTodo todo = currentEditor()->edit(this, old_todo ); | 710 | OPimTodo todo = currentEditor()->edit(this, old_todo ); |
709 | 711 | ||
710 | /* if completed */ | 712 | /* if completed */ |
711 | if ( currentEditor()->accepted() ) { | 713 | if ( currentEditor()->accepted() ) { |
712 | handleAlarms( old_todo, todo ); | 714 | handleAlarms( old_todo, todo ); |
713 | m_todoMgr.update( todo.uid(), todo ); | 715 | m_todoMgr.update( todo.uid(), todo ); |
714 | currentView()->replaceEvent( todo ); | 716 | currentView()->replaceEvent( todo ); |
715 | /* a Category might have changed */ | 717 | /* a Category might have changed */ |
716 | populateCategories(); | 718 | populateCategories(); |
717 | } | 719 | } |
718 | 720 | ||
719 | raiseCurrentView(); | 721 | raiseCurrentView(); |
720 | } | 722 | } |
721 | /* | 723 | /* |
722 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { | 724 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { |
723 | m_todoMgr.update( uid, ev ); | 725 | m_todoMgr.update( uid, ev ); |
724 | } | 726 | } |
725 | */ | 727 | */ |
726 | void MainWindow::updateTodo( const OPimTodo& ev) { | 728 | void MainWindow::updateTodo( const OPimTodo& ev) { |
727 | m_todoMgr.update( ev.uid() , ev ); | 729 | m_todoMgr.update( ev.uid() , ev ); |
728 | } | 730 | } |
729 | /* The view changed it's configuration | 731 | /* The view changed it's configuration |
730 | * update the view menu | 732 | * update the view menu |
731 | */ | 733 | */ |
732 | void MainWindow::slotUpdate3( QWidget* ) { | 734 | void MainWindow::slotUpdate3( QWidget* ) { |
733 | 735 | ||
734 | } | 736 | } |
735 | void MainWindow::updateList() { | 737 | void MainWindow::updateList() { |
736 | m_todoMgr.updateList(); | 738 | m_todoMgr.updateList(); |
737 | } | 739 | } |
738 | void MainWindow::setReadAhead( uint count ) { | 740 | void MainWindow::setReadAhead( uint count ) { |
739 | if (m_todoMgr.todoDB() ) | 741 | if (m_todoMgr.todoDB() ) |
740 | m_todoMgr.todoDB()->setReadAhead( count ); | 742 | m_todoMgr.todoDB()->setReadAhead( count ); |
741 | } | 743 | } |
742 | void MainWindow::slotQuickEntered() { | 744 | void MainWindow::slotQuickEntered() { |
743 | Opie::Core::owarn << "entered" << oendl; | 745 | owarn << "entered" << oendl; |
744 | OPimTodo todo = quickEditor()->todo(); | 746 | OPimTodo todo = quickEditor()->todo(); |
745 | if (todo.isEmpty() ) | 747 | if (todo.isEmpty() ) |
746 | return; | 748 | return; |
747 | 749 | ||
748 | m_todoMgr.add( todo ); | 750 | m_todoMgr.add( todo ); |
749 | currentView()->addEvent( todo ); | 751 | currentView()->addEvent( todo ); |
750 | raiseCurrentView(); | 752 | raiseCurrentView(); |
751 | } | 753 | } |
752 | QuickEditBase* MainWindow::quickEditor() { | 754 | QuickEditBase* MainWindow::quickEditor() { |
753 | return m_curQuick; | 755 | return m_curQuick; |
754 | } | 756 | } |
755 | void MainWindow::slotComplete( int uid ) { | 757 | void MainWindow::slotComplete( int uid ) { |
756 | slotComplete( event(uid) ); | 758 | slotComplete( event(uid) ); |
757 | } | 759 | } |
758 | void MainWindow::slotComplete( const OPimTodo& todo ) { | 760 | void MainWindow::slotComplete( const OPimTodo& todo ) { |
759 | OPimTodo to = todo; | 761 | OPimTodo to = todo; |
760 | to.setCompleted( !to.isCompleted() ); | 762 | to.setCompleted( !to.isCompleted() ); |
761 | to.setCompletedDate( QDate::currentDate() ); | 763 | to.setCompletedDate( QDate::currentDate() ); |
762 | 764 | ||
763 | /* | 765 | /* |
764 | * if the item does recur | 766 | * if the item does recur |
765 | * we need to spin it off | 767 | * we need to spin it off |
766 | * and update the items duedate to the next | 768 | * and update the items duedate to the next |
767 | * possible recurrance of this item... | 769 | * possible recurrance of this item... |
768 | * the spinned off one will loose the | 770 | * the spinned off one will loose the |
769 | * recurrence. | 771 | * recurrence. |
770 | * We calculate the difference between the old due date and the | 772 | * We calculate the difference between the old due date and the |
771 | * new one and add this diff to start, completed and alarm dates | 773 | * new one and add this diff to start, completed and alarm dates |
772 | * -zecke | 774 | * -zecke |
773 | */ | 775 | */ |
774 | if ( to.hasRecurrence() && to.isCompleted() ) { | 776 | if ( to.hasRecurrence() && to.isCompleted() ) { |
775 | OPimTodo to2( to ); | 777 | OPimTodo to2( to ); |
776 | 778 | ||
777 | /* the spinned off one won't recur anymore */ | 779 | /* the spinned off one won't recur anymore */ |
778 | to.setRecurrence( OPimRecurrence() ); | 780 | to.setRecurrence( OPimRecurrence() ); |
779 | 781 | ||
780 | OPimRecurrence rec = to2.recurrence(); | 782 | OPimRecurrence rec = to2.recurrence(); |
781 | rec.setStart( to.dueDate() ); | 783 | rec.setStart( to.dueDate() ); |
782 | to2.setRecurrence( rec ); | 784 | to2.setRecurrence( rec ); |
783 | /* | 785 | /* |
784 | * if there is a next occurence | 786 | * if there is a next occurence |
785 | * from the duedate of the last recurrance | 787 | * from the duedate of the last recurrance |
786 | */ | 788 | */ |
787 | QDate date; | 789 | QDate date; |
788 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { | 790 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { |
789 | int dayDiff = to.dueDate().daysTo( date ); | 791 | int dayDiff = to.dueDate().daysTo( date ); |
790 | Opie::Core::owarn << "day diff is " << dayDiff << oendl; | 792 | owarn << "day diff is " << dayDiff << oendl; |
791 | QDate inval; | 793 | QDate inval; |
792 | /* generate a new uid for the old record */ | 794 | /* generate a new uid for the old record */ |
793 | to.setUid( 1 ); | 795 | to.setUid( 1 ); |
794 | 796 | ||
795 | /* add the old one cause it has a new UID here cause it was spin off */ | 797 | /* add the old one cause it has a new UID here cause it was spin off */ |
796 | m_todoMgr.add( to ); | 798 | m_todoMgr.add( to ); |
797 | 799 | ||
798 | /* | 800 | /* |
799 | * update the due date | 801 | * update the due date |
800 | * start date | 802 | * start date |
801 | * and complete date | 803 | * and complete date |
802 | */ | 804 | */ |
803 | to2.setDueDate( date ); | 805 | to2.setDueDate( date ); |
804 | rec.setStart( date ); | 806 | rec.setStart( date ); |
805 | to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week | 807 | to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week |
806 | 808 | ||
807 | /* move start date */ | 809 | /* move start date */ |
808 | if (to2.hasStartDate() ) | 810 | if (to2.hasStartDate() ) |
809 | to2.setStartDate( to2.startDate().addDays( dayDiff ) ); | 811 | to2.setStartDate( to2.startDate().addDays( dayDiff ) ); |
810 | 812 | ||
811 | /* now the alarms */ | 813 | /* now the alarms */ |
812 | if (to2.hasNotifiers() ) { | 814 | if (to2.hasNotifiers() ) { |
813 | OPimNotifyManager::Alarms _als = to2.notifiers().alarms(); | 815 | OPimNotifyManager::Alarms _als = to2.notifiers().alarms(); |
814 | OPimNotifyManager::Alarms als; | 816 | OPimNotifyManager::Alarms als; |
815 | 817 | ||
816 | /* for every alarm move the day */ | 818 | /* for every alarm move the day */ |
817 | for ( OPimNotifyManager::Alarms::Iterator it = _als.begin(); it != _als.end(); ++it ) { | 819 | for ( OPimNotifyManager::Alarms::Iterator it = _als.begin(); it != _als.end(); ++it ) { |
818 | OPimAlarm al = (*it); | 820 | OPimAlarm al = (*it); |
819 | al.setDateTime( al.dateTime().addDays( dayDiff ) ); | 821 | al.setDateTime( al.dateTime().addDays( dayDiff ) ); |
820 | als.append( al ); | 822 | als.append( al ); |
821 | } | 823 | } |
822 | to2.notifiers().setAlarms( als ); | 824 | to2.notifiers().setAlarms( als ); |
823 | handleAlarms( OPimTodo(), todo ); | 825 | handleAlarms( OPimTodo(), todo ); |
824 | } | 826 | } |
825 | to2.setCompletedDate( inval ); | 827 | to2.setCompletedDate( inval ); |
826 | to2.setCompleted( false ); | 828 | to2.setCompleted( false ); |
827 | 829 | ||
828 | updateTodo( to2 ); | 830 | updateTodo( to2 ); |
829 | }else | 831 | }else |
830 | updateTodo( to ); | 832 | updateTodo( to ); |
831 | }else | 833 | }else |
832 | updateTodo( to ); | 834 | updateTodo( to ); |
833 | 835 | ||
834 | currentView()->updateView(); | 836 | currentView()->updateView(); |
835 | raiseCurrentView(); | 837 | raiseCurrentView(); |
836 | } | 838 | } |
837 | void MainWindow::flush() { | 839 | void MainWindow::flush() { |
838 | slotFlush(); | 840 | slotFlush(); |
839 | } | 841 | } |
840 | void MainWindow::reload() { | 842 | void MainWindow::reload() { |
841 | slotReload(); | 843 | slotReload(); |
842 | } | 844 | } |
843 | int MainWindow::create() { | 845 | int MainWindow::create() { |
844 | int uid = 0; | 846 | int uid = 0; |
845 | if(m_syncing) { | 847 | if(m_syncing) { |
846 | QMessageBox::warning(this, QWidget::tr("Todo"), | 848 | QMessageBox::warning(this, QWidget::tr("Todo"), |
847 | QWidget::tr("Data can not be edited, currently syncing")); | 849 | QWidget::tr("Data can not be edited, currently syncing")); |
848 | return uid; | 850 | return uid; |
849 | } | 851 | } |
850 | m_todoMgr.load(); | 852 | m_todoMgr.load(); |
851 | 853 | ||
852 | 854 | ||
853 | OPimTodo todo = currentEditor()->newTodo( currentCatId(), | 855 | OPimTodo todo = currentEditor()->newTodo( currentCatId(), |
854 | this ); | 856 | this ); |
@@ -889,137 +891,137 @@ void MainWindow::beam( int uid) { | |||
889 | OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(QString::fromLatin1(beamfile) ); | 891 | OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(QString::fromLatin1(beamfile) ); |
890 | OPimTodoAccess acc( cal ); | 892 | OPimTodoAccess acc( cal ); |
891 | acc.load(); | 893 | acc.load(); |
892 | acc.add( todo ); | 894 | acc.add( todo ); |
893 | acc.save(); | 895 | acc.save(); |
894 | Ir* ir = new Ir(this ); | 896 | Ir* ir = new Ir(this ); |
895 | connect(ir, SIGNAL(done(Ir*) ), | 897 | connect(ir, SIGNAL(done(Ir*) ), |
896 | this, SLOT(beamDone(Ir*) ) ); | 898 | this, SLOT(beamDone(Ir*) ) ); |
897 | ir->send(beamfile, todo.summary(), "text/x-vCalendar" ); | 899 | ir->send(beamfile, todo.summary(), "text/x-vCalendar" ); |
898 | } | 900 | } |
899 | void MainWindow::show( int uid ) { | 901 | void MainWindow::show( int uid ) { |
900 | m_todoMgr.load(); // might not be loaded yet | 902 | m_todoMgr.load(); // might not be loaded yet |
901 | m_showing = true; | 903 | m_showing = true; |
902 | slotShow( uid ); | 904 | slotShow( uid ); |
903 | raise(); | 905 | raise(); |
904 | QPEApplication::setKeepRunning(); | 906 | QPEApplication::setKeepRunning(); |
905 | } | 907 | } |
906 | void MainWindow::edit( int uid ) { | 908 | void MainWindow::edit( int uid ) { |
907 | m_todoMgr.load(); | 909 | m_todoMgr.load(); |
908 | slotEdit( uid ); | 910 | slotEdit( uid ); |
909 | } | 911 | } |
910 | void MainWindow::add( const OPimRecord& rec) { | 912 | void MainWindow::add( const OPimRecord& rec) { |
911 | if ( rec.rtti() != OPimTodo::rtti() ) return; | 913 | if ( rec.rtti() != OPimTodo::rtti() ) return; |
912 | m_todoMgr.load(); // might not be loaded | 914 | m_todoMgr.load(); // might not be loaded |
913 | 915 | ||
914 | const OPimTodo& todo = static_cast<const OPimTodo&>(rec); | 916 | const OPimTodo& todo = static_cast<const OPimTodo&>(rec); |
915 | 917 | ||
916 | m_todoMgr.add(todo ); | 918 | m_todoMgr.add(todo ); |
917 | currentView()->addEvent( todo ); | 919 | currentView()->addEvent( todo ); |
918 | 920 | ||
919 | 921 | ||
920 | // I'm afraid we must call this every time now, otherwise | 922 | // I'm afraid we must call this every time now, otherwise |
921 | // spend expensive time comparing all these strings... | 923 | // spend expensive time comparing all these strings... |
922 | // but only call if we changed something -zecke | 924 | // but only call if we changed something -zecke |
923 | populateCategories(); | 925 | populateCategories(); |
924 | } | 926 | } |
925 | void MainWindow::slotReturnFromView() { | 927 | void MainWindow::slotReturnFromView() { |
926 | m_showing = false; | 928 | m_showing = false; |
927 | raiseCurrentView(); | 929 | raiseCurrentView(); |
928 | } | 930 | } |
929 | 931 | ||
930 | namespace { | 932 | namespace { |
931 | OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls, | 933 | OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls, |
932 | const OPimNotifyManager::Alarms& newAls ) { | 934 | const OPimNotifyManager::Alarms& newAls ) { |
933 | OPimNotifyManager::Alarms nonMatching; | 935 | OPimNotifyManager::Alarms nonMatching; |
934 | OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin(); | 936 | OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin(); |
935 | OPimNotifyManager::Alarms::ConstIterator newIt; | 937 | OPimNotifyManager::Alarms::ConstIterator newIt; |
936 | for ( ; oldIt != oldAls.end(); ++oldIt ) { | 938 | for ( ; oldIt != oldAls.end(); ++oldIt ) { |
937 | bool found = false; | 939 | bool found = false; |
938 | QDateTime oldDt = (*oldIt).dateTime(); | 940 | QDateTime oldDt = (*oldIt).dateTime(); |
939 | for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) { | 941 | for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) { |
940 | if ( oldDt == (*newIt).dateTime() ) { | 942 | if ( oldDt == (*newIt).dateTime() ) { |
941 | found = true; | 943 | found = true; |
942 | break; | 944 | break; |
943 | } | 945 | } |
944 | } | 946 | } |
945 | if (!found) | 947 | if (!found) |
946 | nonMatching.append( (*oldIt) ); | 948 | nonMatching.append( (*oldIt) ); |
947 | } | 949 | } |
948 | return nonMatching; | 950 | return nonMatching; |
949 | } | 951 | } |
950 | void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { | 952 | void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { |
951 | OPimNotifyManager::Alarms::ConstIterator it; | 953 | OPimNotifyManager::Alarms::ConstIterator it; |
952 | for ( it = als.begin(); it != als.end(); ++it ) { | 954 | for ( it = als.begin(); it != als.end(); ++it ) { |
953 | Opie::Core::owarn << "Adding alarm for " << (*it).dateTime().toString() << oendl; | 955 | owarn << "Adding alarm for " << (*it).dateTime().toString() << oendl; |
954 | AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); | 956 | AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); |
955 | } | 957 | } |
956 | 958 | ||
957 | } | 959 | } |
958 | void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { | 960 | void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { |
959 | OPimNotifyManager::Alarms::ConstIterator it; | 961 | OPimNotifyManager::Alarms::ConstIterator it; |
960 | for ( it = als.begin(); it != als.end(); ++it ) { | 962 | for ( it = als.begin(); it != als.end(); ++it ) { |
961 | Opie::Core::owarn << "Removinf alarm for " << (*it).dateTime().toString() << oendl; | 963 | owarn << "Removinf alarm for " << (*it).dateTime().toString() << oendl; |
962 | AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); | 964 | AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); |
963 | } | 965 | } |
964 | } | 966 | } |
965 | } | 967 | } |
966 | 968 | ||
967 | void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) { | 969 | void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) { |
968 | /* | 970 | /* |
969 | * if oldTodo is not empty and has notifiers we need to find the deleted ones | 971 | * if oldTodo is not empty and has notifiers we need to find the deleted ones |
970 | */ | 972 | */ |
971 | if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) { | 973 | if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) { |
972 | OPimNotifyManager::Alarms removed; | 974 | OPimNotifyManager::Alarms removed; |
973 | OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms(); | 975 | OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms(); |
974 | if (!newTodo.hasNotifiers() ) | 976 | if (!newTodo.hasNotifiers() ) |
975 | removed = oldAls; | 977 | removed = oldAls; |
976 | else | 978 | else |
977 | removed = findNonMatching( oldAls, newTodo.notifiers().alarms() ); | 979 | removed = findNonMatching( oldAls, newTodo.notifiers().alarms() ); |
978 | 980 | ||
979 | removeAlarms( removed, oldTodo.uid() ); | 981 | removeAlarms( removed, oldTodo.uid() ); |
980 | } | 982 | } |
981 | if ( newTodo.hasNotifiers() ) { | 983 | if ( newTodo.hasNotifiers() ) { |
982 | OPimNotifyManager::Alarms added; | 984 | OPimNotifyManager::Alarms added; |
983 | if ( oldTodo.isEmpty() || !oldTodo.hasNotifiers() ) | 985 | if ( oldTodo.isEmpty() || !oldTodo.hasNotifiers() ) |
984 | added = newTodo.notifiers().alarms(); | 986 | added = newTodo.notifiers().alarms(); |
985 | else | 987 | else |
986 | added = findNonMatching( newTodo.notifiers().alarms(), oldTodo.notifiers().alarms() ); | 988 | added = findNonMatching( newTodo.notifiers().alarms(), oldTodo.notifiers().alarms() ); |
987 | 989 | ||
988 | addAlarms( added, newTodo.uid() ); | 990 | addAlarms( added, newTodo.uid() ); |
989 | } | 991 | } |
990 | } | 992 | } |
991 | /* we might have not loaded the db */ | 993 | /* we might have not loaded the db */ |
992 | void MainWindow::doAlarm( const QDateTime& dt, int uid ) { | 994 | void MainWindow::doAlarm( const QDateTime& dt, int uid ) { |
993 | m_todoMgr.load(); | 995 | m_todoMgr.load(); |
994 | 996 | ||
995 | OPimTodo todo = m_todoMgr.event( uid ); | 997 | OPimTodo todo = m_todoMgr.event( uid ); |
996 | if (!todo.hasNotifiers() ) return; | 998 | if (!todo.hasNotifiers() ) return; |
997 | 999 | ||
998 | /* | 1000 | /* |
999 | * let's find the right alarm and find out if silent | 1001 | * let's find the right alarm and find out if silent |
1000 | * then show a richtext widget | 1002 | * then show a richtext widget |
1001 | */ | 1003 | */ |
1002 | bool loud = false; | 1004 | bool loud = false; |
1003 | OPimNotifyManager::Alarms als = todo.notifiers().alarms(); | 1005 | OPimNotifyManager::Alarms als = todo.notifiers().alarms(); |
1004 | OPimNotifyManager::Alarms::Iterator it; | 1006 | OPimNotifyManager::Alarms::Iterator it; |
1005 | for ( it = als.begin(); it != als.end(); ++it ) { | 1007 | for ( it = als.begin(); it != als.end(); ++it ) { |
1006 | if ( (*it).dateTime() == dt ) { | 1008 | if ( (*it).dateTime() == dt ) { |
1007 | loud = ( (*it).sound() == OPimAlarm::Loud ); | 1009 | loud = ( (*it).sound() == OPimAlarm::Loud ); |
1008 | break; | 1010 | break; |
1009 | } | 1011 | } |
1010 | } | 1012 | } |
1011 | if (loud) | 1013 | if (loud) |
1012 | startAlarm(); | 1014 | startAlarm(); |
1013 | 1015 | ||
1014 | QDialog dlg(this, 0, TRUE ); | 1016 | QDialog dlg(this, 0, TRUE ); |
1015 | QVBoxLayout* lay = new QVBoxLayout( &dlg ); | 1017 | QVBoxLayout* lay = new QVBoxLayout( &dlg ); |
1016 | QTextView* view = new QTextView( &dlg ); | 1018 | QTextView* view = new QTextView( &dlg ); |
1017 | lay->addWidget( view ); | 1019 | lay->addWidget( view ); |
1018 | QPushButton* btnOk = new QPushButton( tr("Ok"), &dlg ); | 1020 | QPushButton* btnOk = new QPushButton( tr("Ok"), &dlg ); |
1019 | connect( btnOk, SIGNAL(clicked() ), &dlg, SLOT(accept() ) ); | 1021 | connect( btnOk, SIGNAL(clicked() ), &dlg, SLOT(accept() ) ); |
1020 | lay->addWidget( btnOk ); | 1022 | lay->addWidget( btnOk ); |
1021 | 1023 | ||
1022 | QString text = tr("<h1>Alarm at %1</h1><br>").arg( TimeString::dateString( dt ) ); | 1024 | QString text = tr("<h1>Alarm at %1</h1><br>").arg( TimeString::dateString( dt ) ); |
1023 | text += todo.toRichText(); | 1025 | text += todo.toRichText(); |
1024 | view->setText( text ); | 1026 | view->setText( text ); |
1025 | 1027 | ||
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp index 55a3dd5..bbc177d 100644 --- a/core/pim/todo/otaskeditor.cpp +++ b/core/pim/todo/otaskeditor.cpp | |||
@@ -1,95 +1,94 @@ | |||
1 | #include <qlayout.h> | 1 | #include <qlayout.h> |
2 | 2 | ||
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | 4 | ||
5 | #include "taskeditoroverview.h" | 5 | #include "taskeditoroverview.h" |
6 | #include "taskeditorstatus.h" | 6 | #include "taskeditorstatus.h" |
7 | #include "taskeditoralarms.h" | 7 | #include "taskeditoralarms.h" |
8 | 8 | ||
9 | #include "otaskeditor.h" | 9 | #include "otaskeditor.h" |
10 | 10 | ||
11 | using namespace Opie::Ui; | 11 | using namespace Opie::Ui; |
12 | using namespace Opie; | 12 | using namespace Opie; |
13 | 13 | ||
14 | OTaskEditor::OTaskEditor(int cur) | 14 | OTaskEditor::OTaskEditor(int cur) |
15 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { | 15 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { |
16 | init(); | 16 | init(); |
17 | init( cur ); | 17 | init( cur ); |
18 | } | 18 | } |
19 | OTaskEditor::OTaskEditor( const OPimTodo& to) | 19 | OTaskEditor::OTaskEditor( const OPimTodo& to) |
20 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { | 20 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { |
21 | init(); | 21 | init(); |
22 | init( to ); | 22 | init( to ); |
23 | } | 23 | } |
24 | OTaskEditor::~OTaskEditor() { | 24 | OTaskEditor::~OTaskEditor() { |
25 | 25 | ||
26 | } | 26 | } |
27 | void OTaskEditor::init( int cur ) { | 27 | void OTaskEditor::init( int cur ) { |
28 | OPimTodo to; | 28 | OPimTodo to; |
29 | to.setUid( 1 ); // generate a new uid | 29 | to.setUid( 1 ); // generate a new uid |
30 | if ( cur != 0 ) | 30 | if ( cur != 0 ) |
31 | to.setCategories( cur ); | 31 | to.setCategories( cur ); |
32 | load(to); | 32 | load(to); |
33 | } | 33 | } |
34 | void OTaskEditor::init( const OPimTodo& to ) { | 34 | void OTaskEditor::init( const OPimTodo& to ) { |
35 | load( to ); | 35 | load( to ); |
36 | } | 36 | } |
37 | OPimTodo OTaskEditor::todo()const{ | 37 | OPimTodo OTaskEditor::todo()const{ |
38 | Opie::Core::owarn << "saving!" << oendl; | ||
39 | OPimTodo to ( m_todo ); | 38 | OPimTodo to ( m_todo ); |
40 | m_overView->save( to ); | 39 | m_overView->save( to ); |
41 | m_stat->save( to ); | 40 | m_stat->save( to ); |
42 | to.setRecurrence( m_rec->recurrence() ); | 41 | to.setRecurrence( m_rec->recurrence() ); |
43 | m_alarm->save( to ); | 42 | m_alarm->save( to ); |
44 | 43 | ||
45 | return to; | 44 | return to; |
46 | } | 45 | } |
47 | void OTaskEditor::load(const OPimTodo& to) { | 46 | void OTaskEditor::load(const OPimTodo& to) { |
48 | m_overView->load( to ); | 47 | m_overView->load( to ); |
49 | m_stat->load( to ); | 48 | m_stat->load( to ); |
50 | m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); | 49 | m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); |
51 | m_alarm->load( to ); | 50 | m_alarm->load( to ); |
52 | 51 | ||
53 | m_todo = to; | 52 | m_todo = to; |
54 | } | 53 | } |
55 | void OTaskEditor::init() { | 54 | void OTaskEditor::init() { |
56 | setCaption(tr("Task Editor") ); | 55 | setCaption(tr("Task Editor") ); |
57 | 56 | ||
58 | QVBoxLayout* layo = new QVBoxLayout( this ); | 57 | QVBoxLayout* layo = new QVBoxLayout( this ); |
59 | m_tab = new OTabWidget( this ); | 58 | m_tab = new OTabWidget( this ); |
60 | layo->addWidget( m_tab ); | 59 | layo->addWidget( m_tab ); |
61 | 60 | ||
62 | /* | 61 | /* |
63 | * Add the Widgets | 62 | * Add the Widgets |
64 | */ | 63 | */ |
65 | m_overView = new TaskEditorOverView( m_tab ); | 64 | m_overView = new TaskEditorOverView( m_tab ); |
66 | m_tab->addTab( m_overView, "todo/info", tr("Information") ); | 65 | m_tab->addTab( m_overView, "todo/info", tr("Information") ); |
67 | 66 | ||
68 | m_stat = new TaskEditorStatus( m_tab ); | 67 | m_stat = new TaskEditorStatus( m_tab ); |
69 | m_tab->addTab( m_stat, "todo/TodoList", tr("Status") ); | 68 | m_tab->addTab( m_stat, "todo/TodoList", tr("Status") ); |
70 | 69 | ||
71 | m_alarm = new TaskEditorAlarms( m_tab ); | 70 | m_alarm = new TaskEditorAlarms( m_tab ); |
72 | m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") ); | 71 | m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") ); |
73 | 72 | ||
74 | // m_remind = new TaskEditorAlarms( m_tab ); | 73 | // m_remind = new TaskEditorAlarms( m_tab ); |
75 | // m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") ); | 74 | // m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") ); |
76 | 75 | ||
77 | // QLabel* lbl = new QLabel( m_tab ); | 76 | // QLabel* lbl = new QLabel( m_tab ); |
78 | // lbl->setText( tr("X-Ref") ); | 77 | // lbl->setText( tr("X-Ref") ); |
79 | // m_tab->addTab( lbl, "todo/xref", tr("X-Ref") ); | 78 | // m_tab->addTab( lbl, "todo/xref", tr("X-Ref") ); |
80 | 79 | ||
81 | m_rec = new OPimRecurrenceWidget( true, QDate::currentDate(), this ); | 80 | m_rec = new OPimRecurrenceWidget( true, QDate::currentDate(), this ); |
82 | m_tab->addTab( m_rec, "repeat", tr("Recurrence") ); | 81 | m_tab->addTab( m_rec, "repeat", tr("Recurrence") ); |
83 | 82 | ||
84 | 83 | ||
85 | /* signal and slots */ | 84 | /* signal and slots */ |
86 | connect(m_overView, SIGNAL(recurranceEnabled(bool) ), | 85 | connect(m_overView, SIGNAL(recurranceEnabled(bool) ), |
87 | m_rec, SLOT(setEnabled(bool) ) ); | 86 | m_rec, SLOT(setEnabled(bool) ) ); |
88 | 87 | ||
89 | /* connect due date changed to the recurrence tab */ | 88 | /* connect due date changed to the recurrence tab */ |
90 | connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ), | 89 | connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ), |
91 | m_rec, SLOT(setStartDate(const QDate&) ) ); | 90 | m_rec, SLOT(setStartDate(const QDate&) ) ); |
92 | 91 | ||
93 | 92 | ||
94 | m_tab->setCurrentTab( m_overView ); | 93 | m_tab->setCurrentTab( m_overView ); |
95 | } | 94 | } |
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 0b1c579..b7458d8 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -134,507 +134,507 @@ TableView::TableView( MainWindow* window, QWidget* wid ) | |||
134 | initConfig(); | 134 | initConfig(); |
135 | 135 | ||
136 | 136 | ||
137 | m_enablePaint = true; | 137 | m_enablePaint = true; |
138 | setUpdatesEnabled( true ); | 138 | setUpdatesEnabled( true ); |
139 | viewport()->setUpdatesEnabled( true ); | 139 | viewport()->setUpdatesEnabled( true ); |
140 | viewport()->update(); | 140 | viewport()->update(); |
141 | setSortOrder( 0 ); | 141 | setSortOrder( 0 ); |
142 | setAscending( TRUE ); | 142 | setAscending( TRUE ); |
143 | m_first = true; | 143 | m_first = true; |
144 | 144 | ||
145 | 145 | ||
146 | } | 146 | } |
147 | /* a new day has started | 147 | /* a new day has started |
148 | * update the day | 148 | * update the day |
149 | */ | 149 | */ |
150 | void TableView::newDay() { | 150 | void TableView::newDay() { |
151 | clear(); | 151 | clear(); |
152 | updateView(); | 152 | updateView(); |
153 | } | 153 | } |
154 | TableView::~TableView() { | 154 | TableView::~TableView() { |
155 | Config config( "todo" ); | 155 | Config config( "todo" ); |
156 | config.setGroup( "Options" ); | 156 | config.setGroup( "Options" ); |
157 | for (int i = 0; i < numCols(); i++ ) | 157 | for (int i = 0; i < numCols(); i++ ) |
158 | config.writeEntry("Width"+QString::number(i), columnWidth(i) ); | 158 | config.writeEntry("Width"+QString::number(i), columnWidth(i) ); |
159 | } | 159 | } |
160 | void TableView::slotShowMenu() { | 160 | void TableView::slotShowMenu() { |
161 | QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); | 161 | QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); |
162 | menu->exec(QCursor::pos() ); | 162 | menu->exec(QCursor::pos() ); |
163 | delete menu; | 163 | delete menu; |
164 | } | 164 | } |
165 | QString TableView::type() const { | 165 | QString TableView::type() const { |
166 | return QString::fromLatin1( tr("Table View") ); | 166 | return QString::fromLatin1( tr("Table View") ); |
167 | } | 167 | } |
168 | int TableView::current() { | 168 | int TableView::current() { |
169 | if (numRows() == 0 ) return 0; | 169 | if (numRows() == 0 ) return 0; |
170 | int uid = sorted().uidAt(currentRow() ); | 170 | int uid = sorted().uidAt(currentRow() ); |
171 | 171 | ||
172 | return uid; | 172 | return uid; |
173 | } | 173 | } |
174 | int TableView::next() { | 174 | int TableView::next() { |
175 | if ( numRows() == 0 ) return 0; | 175 | if ( numRows() == 0 ) return 0; |
176 | if ( currentRow() + 1 >= numRows() ) return 0; | 176 | if ( currentRow() + 1 >= numRows() ) return 0; |
177 | setCurrentCell( currentRow() +1, currentColumn() ); | 177 | setCurrentCell( currentRow() +1, currentColumn() ); |
178 | return sorted().uidAt( currentRow() ); | 178 | return sorted().uidAt( currentRow() ); |
179 | } | 179 | } |
180 | int TableView::prev() { | 180 | int TableView::prev() { |
181 | if ( numRows() == 0 ) return 0; | 181 | if ( numRows() == 0 ) return 0; |
182 | if ( currentRow() - 1 < 0 ) return 0; | 182 | if ( currentRow() - 1 < 0 ) return 0; |
183 | setCurrentCell( currentRow() -1, currentColumn() ); | 183 | setCurrentCell( currentRow() -1, currentColumn() ); |
184 | return sorted().uidAt( currentRow() ); | 184 | return sorted().uidAt( currentRow() ); |
185 | 185 | ||
186 | } | 186 | } |
187 | QString TableView::currentRepresentation() { | 187 | QString TableView::currentRepresentation() { |
188 | OPimTodo to = sorted()[currentRow()]; | 188 | OPimTodo to = sorted()[currentRow()]; |
189 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; | 189 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; |
190 | } | 190 | } |
191 | /* show overdue */ | 191 | /* show overdue */ |
192 | void TableView::showOverDue( bool ) { | 192 | void TableView::showOverDue( bool ) { |
193 | clear(); | 193 | clear(); |
194 | updateView(); | 194 | updateView(); |
195 | } | 195 | } |
196 | 196 | ||
197 | void TableView::updateView( ) { | 197 | void TableView::updateView( ) { |
198 | Opie::Core::owarn << "update view" << oendl; | 198 | owarn << "update view" << oendl; |
199 | m_row = false; | 199 | m_row = false; |
200 | static int id; | 200 | static int id; |
201 | id = startTimer(4000 ); | 201 | id = startTimer(4000 ); |
202 | /* FIXME we want one page to be read! | 202 | /* FIXME we want one page to be read! |
203 | * | 203 | * |
204 | * Calculate that screensize | 204 | * Calculate that screensize |
205 | */ | 205 | */ |
206 | todoWindow()->setReadAhead( 4 ); | 206 | todoWindow()->setReadAhead( 4 ); |
207 | sort(); | 207 | sort(); |
208 | OPimTodoAccess::List::Iterator it, end; | 208 | OPimTodoAccess::List::Iterator it, end; |
209 | it = sorted().begin(); | 209 | it = sorted().begin(); |
210 | end = sorted().end(); | 210 | end = sorted().end(); |
211 | 211 | ||
212 | Opie::Core::owarn << "setTodos" << oendl; | 212 | owarn << "setTodos" << oendl; |
213 | QTime time; | 213 | QTime time; |
214 | time.start(); | 214 | time.start(); |
215 | m_enablePaint = false; | 215 | m_enablePaint = false; |
216 | setUpdatesEnabled( false ); | 216 | setUpdatesEnabled( false ); |
217 | viewport()->setUpdatesEnabled( false ); | 217 | viewport()->setUpdatesEnabled( false ); |
218 | 218 | ||
219 | setNumRows( it.count() ); | 219 | setNumRows( it.count() ); |
220 | if ( it.count() == 0 ) | 220 | if ( it.count() == 0 ) |
221 | killTimer(id); | 221 | killTimer(id); |
222 | 222 | ||
223 | // int elc = time.elapsed(); | 223 | // int elc = time.elapsed(); |
224 | setUpdatesEnabled( true ); | 224 | setUpdatesEnabled( true ); |
225 | viewport()->setUpdatesEnabled( true ); | 225 | viewport()->setUpdatesEnabled( true ); |
226 | viewport()->update(); | 226 | viewport()->update(); |
227 | 227 | ||
228 | m_enablePaint = true; | 228 | m_enablePaint = true; |
229 | // int el = time.elapsed(); | 229 | // int el = time.elapsed(); |
230 | } | 230 | } |
231 | void TableView::setTodo( int, const OPimTodo&) { | 231 | void TableView::setTodo( int, const OPimTodo&) { |
232 | sort(); | 232 | sort(); |
233 | 233 | ||
234 | /* repaint */ | 234 | /* repaint */ |
235 | repaint(); | 235 | repaint(); |
236 | } | 236 | } |
237 | void TableView::addEvent( const OPimTodo&) { | 237 | void TableView::addEvent( const OPimTodo&) { |
238 | 238 | ||
239 | /* fix problems of not showing the 'Haken' */ | 239 | /* fix problems of not showing the 'Haken' */ |
240 | updateView(); | 240 | updateView(); |
241 | } | 241 | } |
242 | /* | 242 | /* |
243 | * find the event | 243 | * find the event |
244 | * and then replace the complete row | 244 | * and then replace the complete row |
245 | */ | 245 | */ |
246 | void TableView::replaceEvent( const OPimTodo& ev) { | 246 | void TableView::replaceEvent( const OPimTodo& ev) { |
247 | addEvent( ev ); | 247 | addEvent( ev ); |
248 | } | 248 | } |
249 | /* | 249 | /* |
250 | * re aligning table can be slow too | 250 | * re aligning table can be slow too |
251 | * FIXME: look what performs better | 251 | * FIXME: look what performs better |
252 | * either this or the old align table | 252 | * either this or the old align table |
253 | */ | 253 | */ |
254 | void TableView::removeEvent( int ) { | 254 | void TableView::removeEvent( int ) { |
255 | updateView(); | 255 | updateView(); |
256 | } | 256 | } |
257 | void TableView::setShowCompleted( bool b) { | 257 | void TableView::setShowCompleted( bool b) { |
258 | Opie::Core::owarn << "Show Completed " << b << oendl; | 258 | owarn << "Show Completed " << b << oendl; |
259 | updateView(); | 259 | updateView(); |
260 | } | 260 | } |
261 | void TableView::setShowDeadline( bool b ) { | 261 | void TableView::setShowDeadline( bool b ) { |
262 | Opie::Core::owarn << "Show Deadline " << b << oendl; | 262 | owarn << "Show Deadline " << b << oendl; |
263 | if ( b ) | 263 | if ( b ) |
264 | showColumn( 3 ); | 264 | showColumn( 3 ); |
265 | else | 265 | else |
266 | hideColumn( 3 ); | 266 | hideColumn( 3 ); |
267 | 267 | ||
268 | // Try to intelligently size columns | 268 | // Try to intelligently size columns |
269 | // TODO - would use width() below, but doesn't have valid value at time of c'tor | 269 | // TODO - would use width() below, but doesn't have valid value at time of c'tor |
270 | int col2width = 238; | 270 | int col2width = 238; |
271 | int width = m_pic_completed.width(); | 271 | int width = m_pic_completed.width(); |
272 | setColumnWidth( 0, width ); | 272 | setColumnWidth( 0, width ); |
273 | col2width -= width; | 273 | col2width -= width; |
274 | width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; | 274 | width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; |
275 | setColumnWidth( 1, width ); | 275 | setColumnWidth( 1, width ); |
276 | col2width -= width; | 276 | col2width -= width; |
277 | if ( b ) { | 277 | if ( b ) { |
278 | width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; | 278 | width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; |
279 | setColumnWidth( 3, width ); | 279 | setColumnWidth( 3, width ); |
280 | col2width -= width; | 280 | col2width -= width; |
281 | } | 281 | } |
282 | setColumnWidth( 2, col2width ); | 282 | setColumnWidth( 2, col2width ); |
283 | } | 283 | } |
284 | void TableView::setShowCategory( const QString& str) { | 284 | void TableView::setShowCategory( const QString& str) { |
285 | Opie::Core::owarn << "setShowCategory" << oendl; | 285 | owarn << "setShowCategory" << oendl; |
286 | if ( str != m_oleCat || m_first ) | 286 | if ( str != m_oleCat || m_first ) |
287 | updateView(); | 287 | updateView(); |
288 | 288 | ||
289 | m_oleCat = str; | 289 | m_oleCat = str; |
290 | m_first = false; | 290 | m_first = false; |
291 | 291 | ||
292 | } | 292 | } |
293 | void TableView::clear() { | 293 | void TableView::clear() { |
294 | setNumRows(0); | 294 | setNumRows(0); |
295 | } | 295 | } |
296 | void TableView::slotClicked(int row, int col, int, | 296 | void TableView::slotClicked(int row, int col, int, |
297 | const QPoint& point) { | 297 | const QPoint& point) { |
298 | if ( m_editorWidget.cellWidget() ) { | 298 | if ( m_editorWidget.cellWidget() ) { |
299 | //setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); | 299 | //setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); |
300 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), | 300 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), |
301 | true, true ); | 301 | true, true ); |
302 | m_editorWidget.releaseCellWidget(); | 302 | m_editorWidget.releaseCellWidget(); |
303 | } | 303 | } |
304 | 304 | ||
305 | if ( !cellGeometry(row, col ).contains(point ) ) | 305 | if ( !cellGeometry(row, col ).contains(point ) ) |
306 | return; | 306 | return; |
307 | 307 | ||
308 | int ui= sorted().uidAt( row ); | 308 | int ui= sorted().uidAt( row ); |
309 | 309 | ||
310 | 310 | ||
311 | switch( col ) { | 311 | switch( col ) { |
312 | case 0:{ | 312 | case 0:{ |
313 | int x = point.x() -columnPos( col ); | 313 | int x = point.x() -columnPos( col ); |
314 | int y = point.y() -rowPos( row ); | 314 | int y = point.y() -rowPos( row ); |
315 | int w = columnWidth( col ); | 315 | int w = columnWidth( col ); |
316 | int h = rowHeight( row ); | 316 | int h = rowHeight( row ); |
317 | if ( x >= ( w - BoxSize ) / 2 && | 317 | if ( x >= ( w - BoxSize ) / 2 && |
318 | x <= ( w - BoxSize ) / 2 + BoxSize && | 318 | x <= ( w - BoxSize ) / 2 + BoxSize && |
319 | y >= ( h - BoxSize ) / 2 && | 319 | y >= ( h - BoxSize ) / 2 && |
320 | y <= ( h - BoxSize ) / 2 + BoxSize ) { | 320 | y <= ( h - BoxSize ) / 2 + BoxSize ) { |
321 | TodoView::complete(sorted()[row] ); | 321 | TodoView::complete(sorted()[row] ); |
322 | } | 322 | } |
323 | } | 323 | } |
324 | break; | 324 | break; |
325 | 325 | ||
326 | // Priority emit a double click... | 326 | // Priority emit a double click... |
327 | case 1:{ | 327 | case 1:{ |
328 | QWidget* wid = beginEdit( row, col, FALSE ); | 328 | QWidget* wid = beginEdit( row, col, FALSE ); |
329 | m_editorWidget.setCellWidget( wid, row, col ); | 329 | m_editorWidget.setCellWidget( wid, row, col ); |
330 | } | 330 | } |
331 | break; | 331 | break; |
332 | 332 | ||
333 | case 2: { | 333 | case 2: { |
334 | m_menuTimer->stop(); | 334 | m_menuTimer->stop(); |
335 | showTodo( ui ); | 335 | showTodo( ui ); |
336 | break; | 336 | break; |
337 | } | 337 | } |
338 | case 3: { | 338 | case 3: { |
339 | m_menuTimer->stop(); | 339 | m_menuTimer->stop(); |
340 | TodoView::edit( ui ); | 340 | TodoView::edit( ui ); |
341 | break; | 341 | break; |
342 | } | 342 | } |
343 | } | 343 | } |
344 | 344 | ||
345 | 345 | ||
346 | } | 346 | } |
347 | void TableView::slotPressed(int row, int col, int, | 347 | void TableView::slotPressed(int row, int col, int, |
348 | const QPoint& point) { | 348 | const QPoint& point) { |
349 | 349 | ||
350 | Opie::Core::owarn << "pressed row " << row << " col " << col << " x:" << point.x() | 350 | owarn << "pressed row " << row << " col " << col << " x:" << point.x() |
351 | << "+y:" << point.y() << oendl; | 351 | << "+y:" << point.y() << oendl; |
352 | m_prevP = point; | 352 | m_prevP = point; |
353 | /* TextColumn column */ | 353 | /* TextColumn column */ |
354 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) | 354 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) |
355 | m_menuTimer->start( 750, TRUE ); | 355 | m_menuTimer->start( 750, TRUE ); |
356 | } | 356 | } |
357 | void TableView::slotValueChanged( int, int ) { | 357 | void TableView::slotValueChanged( int, int ) { |
358 | Opie::Core::owarn << "Value Changed" << oendl; | 358 | owarn << "Value Changed" << oendl; |
359 | } | 359 | } |
360 | void TableView::slotCurrentChanged(int, int ) { | 360 | void TableView::slotCurrentChanged(int, int ) { |
361 | m_menuTimer->stop(); | 361 | m_menuTimer->stop(); |
362 | } | 362 | } |
363 | QWidget* TableView::widget() { | 363 | QWidget* TableView::widget() { |
364 | return this; | 364 | return this; |
365 | } | 365 | } |
366 | /* | 366 | /* |
367 | * We need to overwrite sortColumn | 367 | * We need to overwrite sortColumn |
368 | * because we want to sort whole row | 368 | * because we want to sort whole row |
369 | * based | 369 | * based |
370 | * We event want to set the setOrder | 370 | * We event want to set the setOrder |
371 | * to a sort() and update() | 371 | * to a sort() and update() |
372 | */ | 372 | */ |
373 | void TableView::sortColumn( int col, bool asc, bool ) { | 373 | void TableView::sortColumn( int col, bool asc, bool ) { |
374 | Opie::Core::owarn << "bool " << asc << oendl; | 374 | owarn << "bool " << asc << oendl; |
375 | setSortOrder( col ); | 375 | setSortOrder( col ); |
376 | setAscending( asc ); | 376 | setAscending( asc ); |
377 | updateView(); | 377 | updateView(); |
378 | } | 378 | } |
379 | void TableView::viewportPaintEvent( QPaintEvent* e) { | 379 | void TableView::viewportPaintEvent( QPaintEvent* e) { |
380 | if (m_enablePaint ) | 380 | if (m_enablePaint ) |
381 | QTable::viewportPaintEvent( e ); | 381 | QTable::viewportPaintEvent( e ); |
382 | } | 382 | } |
383 | /* | 383 | /* |
384 | * This segment is copyrighted by TT | 384 | * This segment is copyrighted by TT |
385 | * it was taken from their todolist | 385 | * it was taken from their todolist |
386 | * application this code is GPL | 386 | * application this code is GPL |
387 | */ | 387 | */ |
388 | void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { | 388 | void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { |
389 | const QColorGroup &cg = colorGroup(); | 389 | const QColorGroup &cg = colorGroup(); |
390 | 390 | ||
391 | p->save(); | 391 | p->save(); |
392 | 392 | ||
393 | OPimTodo task = sorted()[row]; | 393 | OPimTodo task = sorted()[row]; |
394 | 394 | ||
395 | // TODO - give user option for grid or bars? | 395 | // TODO - give user option for grid or bars? |
396 | 396 | ||
397 | // Paint alternating background bars | 397 | // Paint alternating background bars |
398 | if ( (row % 2 ) == 0 ) { | 398 | if ( (row % 2 ) == 0 ) { |
399 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | 399 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); |
400 | p->setPen( QPen( cg.text() ) ); | 400 | p->setPen( QPen( cg.text() ) ); |
401 | } | 401 | } |
402 | else { | 402 | else { |
403 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); | 403 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); |
404 | p->setPen( QPen( cg.buttonText() ) ); | 404 | p->setPen( QPen( cg.buttonText() ) ); |
405 | } | 405 | } |
406 | 406 | ||
407 | // Paint grid | 407 | // Paint grid |
408 | //p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | 408 | //p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); |
409 | //QPen op = p->pen(); | 409 | //QPen op = p->pen(); |
410 | //p->setPen(cg.mid()); | 410 | //p->setPen(cg.mid()); |
411 | //p->drawLine( 0, cr.height() - 1, cr.width() - 1, cr.height() - 1 ); | 411 | //p->drawLine( 0, cr.height() - 1, cr.width() - 1, cr.height() - 1 ); |
412 | //p->drawLine( cr.width() - 1, 0, cr.width() - 1, cr.height() - 1 ); | 412 | //p->drawLine( cr.width() - 1, 0, cr.width() - 1, cr.height() - 1 ); |
413 | //p->setPen(op); | 413 | //p->setPen(op); |
414 | 414 | ||
415 | QFont f = p->font(); | 415 | QFont f = p->font(); |
416 | QFontMetrics fm(f); | 416 | QFontMetrics fm(f); |
417 | 417 | ||
418 | int marg = ( cr.width() - BoxSize ) / 2; | 418 | int marg = ( cr.width() - BoxSize ) / 2; |
419 | int x = 0; | 419 | int x = 0; |
420 | int y = ( cr.height() - BoxSize ) / 2; | 420 | int y = ( cr.height() - BoxSize ) / 2; |
421 | 421 | ||
422 | switch(col) { | 422 | switch(col) { |
423 | case 0: // completed field | 423 | case 0: // completed field |
424 | { | 424 | { |
425 | //p->setPen( QPen( cg.text() ) ); | 425 | //p->setPen( QPen( cg.text() ) ); |
426 | //p->drawRect( x + marg, y, BoxSize, BoxSize ); | 426 | //p->drawRect( x + marg, y, BoxSize, BoxSize ); |
427 | //p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 ); | 427 | //p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 ); |
428 | if ( task.isCompleted() ) { | 428 | if ( task.isCompleted() ) { |
429 | p->drawPixmap( x + marg, y, m_pic_completed ); | 429 | p->drawPixmap( x + marg, y, m_pic_completed ); |
430 | } | 430 | } |
431 | } | 431 | } |
432 | break; | 432 | break; |
433 | case 1: // priority field | 433 | case 1: // priority field |
434 | { | 434 | { |
435 | p->drawPixmap( x + marg, y, m_pic_priority[ task.priority() - 1 ] ); | 435 | p->drawPixmap( x + marg, y, m_pic_priority[ task.priority() - 1 ] ); |
436 | } | 436 | } |
437 | break; | 437 | break; |
438 | case 2: // description field | 438 | case 2: // description field |
439 | { | 439 | { |
440 | QString text = task.summary().isEmpty() ? | 440 | QString text = task.summary().isEmpty() ? |
441 | task.description().left(20) : | 441 | task.description().left(20) : |
442 | task.summary(); | 442 | task.summary(); |
443 | p->drawText(2,2 + fm.ascent(), text); | 443 | p->drawText(2,2 + fm.ascent(), text); |
444 | } | 444 | } |
445 | break; | 445 | break; |
446 | case 3: | 446 | case 3: |
447 | { | 447 | { |
448 | QString text; | 448 | QString text; |
449 | if (task.hasDueDate()) { | 449 | if (task.hasDueDate()) { |
450 | int off = QDate::currentDate().daysTo( task.dueDate() ); | 450 | int off = QDate::currentDate().daysTo( task.dueDate() ); |
451 | text = tr( "%1 day(s)").arg(QString::number(off)); | 451 | text = tr( "%1 day(s)").arg(QString::number(off)); |
452 | /* | 452 | /* |
453 | * set color if not completed | 453 | * set color if not completed |
454 | */ | 454 | */ |
455 | if (!task.isCompleted() ) { | 455 | if (!task.isCompleted() ) { |
456 | QColor color = Qt::black; | 456 | QColor color = Qt::black; |
457 | if ( off < 0 ) | 457 | if ( off < 0 ) |
458 | color = Qt::red; | 458 | color = Qt::red; |
459 | else if ( off == 0 ) | 459 | else if ( off == 0 ) |
460 | color = Qt::yellow; | 460 | color = Qt::yellow; |
461 | else if ( off > 0 ) | 461 | else if ( off > 0 ) |
462 | color = Qt::green; | 462 | color = Qt::green; |
463 | p->setPen(color ); | 463 | p->setPen(color ); |
464 | } | 464 | } |
465 | } else { | 465 | } else { |
466 | text = tr("None"); | 466 | text = tr("None"); |
467 | } | 467 | } |
468 | p->drawText(2,2 + fm.ascent(), text); | 468 | p->drawText(2,2 + fm.ascent(), text); |
469 | } | 469 | } |
470 | break; | 470 | break; |
471 | } | 471 | } |
472 | p->restore(); | 472 | p->restore(); |
473 | } | 473 | } |
474 | QWidget* TableView::createEditor(int row, int col, bool )const { | 474 | QWidget* TableView::createEditor(int row, int col, bool )const { |
475 | switch( col ) { | 475 | switch( col ) { |
476 | case 1: { | 476 | case 1: { |
477 | /* the priority stuff */ | 477 | /* the priority stuff */ |
478 | QComboBox* combo = new QComboBox( viewport() ); | 478 | QComboBox* combo = new QComboBox( viewport() ); |
479 | for ( int i = 0; i < 5; i++ ) { | 479 | for ( int i = 0; i < 5; i++ ) { |
480 | combo->insertItem( m_pic_priority[ i ] ); | 480 | combo->insertItem( m_pic_priority[ i ] ); |
481 | } | 481 | } |
482 | combo->setCurrentItem( sorted()[row].priority()-1 ); | 482 | combo->setCurrentItem( sorted()[row].priority()-1 ); |
483 | return combo; | 483 | return combo; |
484 | } | 484 | } |
485 | /* summary */ | 485 | /* summary */ |
486 | case 2:{ | 486 | case 2:{ |
487 | QLineEdit* edit = new QLineEdit( viewport() ); | 487 | QLineEdit* edit = new QLineEdit( viewport() ); |
488 | edit->setText( sorted()[row].summary() ); | 488 | edit->setText( sorted()[row].summary() ); |
489 | return edit; | 489 | return edit; |
490 | } | 490 | } |
491 | case 0: | 491 | case 0: |
492 | default: | 492 | default: |
493 | return 0l; | 493 | return 0l; |
494 | } | 494 | } |
495 | } | 495 | } |
496 | void TableView::setCellContentFromEditor(int row, int col ) { | 496 | void TableView::setCellContentFromEditor(int row, int col ) { |
497 | Opie::Core::owarn << "set cell content from editor" << oendl; | 497 | owarn << "set cell content from editor" << oendl; |
498 | if ( col == 1 ) { | 498 | if ( col == 1 ) { |
499 | QWidget* wid = cellWidget(row, 1 ); | 499 | QWidget* wid = cellWidget(row, 1 ); |
500 | if ( wid->inherits("QComboBox") ) { | 500 | if ( wid->inherits("QComboBox") ) { |
501 | int pri = ((QComboBox*)wid)->currentItem() + 1; | 501 | int pri = ((QComboBox*)wid)->currentItem() + 1; |
502 | OPimTodo todo = sorted()[row]; | 502 | OPimTodo todo = sorted()[row]; |
503 | if ( todo.priority() != pri ) { | 503 | if ( todo.priority() != pri ) { |
504 | todo.setPriority( pri ); | 504 | todo.setPriority( pri ); |
505 | TodoView::update( todo.uid(), todo ); | 505 | TodoView::update( todo.uid(), todo ); |
506 | updateView(); | 506 | updateView(); |
507 | } | 507 | } |
508 | } | 508 | } |
509 | }else if ( col == 2) { | 509 | }else if ( col == 2) { |
510 | QWidget* wid = cellWidget(row, 2); | 510 | QWidget* wid = cellWidget(row, 2); |
511 | if ( wid->inherits("QLineEdit") ) { | 511 | if ( wid->inherits("QLineEdit") ) { |
512 | QString text = ((QLineEdit*)wid)->text(); | 512 | QString text = ((QLineEdit*)wid)->text(); |
513 | OPimTodo todo = sorted()[row]; | 513 | OPimTodo todo = sorted()[row]; |
514 | if ( todo.summary() != text ) { | 514 | if ( todo.summary() != text ) { |
515 | todo.setSummary( text ); | 515 | todo.setSummary( text ); |
516 | TodoView::update( todo.uid(), todo ); | 516 | TodoView::update( todo.uid(), todo ); |
517 | updateView(); | 517 | updateView(); |
518 | } | 518 | } |
519 | } | 519 | } |
520 | } | 520 | } |
521 | } | 521 | } |
522 | void TableView::slotPriority() { | 522 | void TableView::slotPriority() { |
523 | setCellContentFromEditor( currentRow(), currentColumn() ); | 523 | setCellContentFromEditor( currentRow(), currentColumn() ); |
524 | } | 524 | } |
525 | /* | 525 | /* |
526 | * We'll use the TimerEvent to read ahead or to keep the cahce always | 526 | * We'll use the TimerEvent to read ahead or to keep the cahce always |
527 | * filled enough. | 527 | * filled enough. |
528 | * We will try to read ahead 4 items in both ways | 528 | * We will try to read ahead 4 items in both ways |
529 | * up and down. On odd or even we will currentRow()+-4 or +-9 | 529 | * up and down. On odd or even we will currentRow()+-4 or +-9 |
530 | * | 530 | * |
531 | */ | 531 | */ |
532 | void TableView::timerEvent( QTimerEvent* ) { | 532 | void TableView::timerEvent( QTimerEvent* ) { |
533 | // Opie::Core::owarn << "sorted " << sorted().count() << oendl; | 533 | // Opie::Core::owarn << "sorted " << sorted().count() << oendl; |
534 | if (sorted().count() == 0 ) | 534 | if (sorted().count() == 0 ) |
535 | return; | 535 | return; |
536 | 536 | ||
537 | int row = currentRow(); | 537 | int row = currentRow(); |
538 | if ( m_row ) { | 538 | if ( m_row ) { |
539 | int ro = row-4; | 539 | int ro = row-4; |
540 | if (ro < 0 ) ro = 0; | 540 | if (ro < 0 ) ro = 0; |
541 | sorted()[ro]; | 541 | sorted()[ro]; |
542 | 542 | ||
543 | ro = row+4; | 543 | ro = row+4; |
544 | sorted()[ro]; | 544 | sorted()[ro]; |
545 | } else { | 545 | } else { |
546 | int ro = row + 8; | 546 | int ro = row + 8; |
547 | sorted()[ro]; | 547 | sorted()[ro]; |
548 | 548 | ||
549 | ro = row-8; | 549 | ro = row-8; |
550 | if (ro < 0 ) ro = 0; | 550 | if (ro < 0 ) ro = 0; |
551 | sorted()[ro]; | 551 | sorted()[ro]; |
552 | } | 552 | } |
553 | 553 | ||
554 | m_row = !m_row; | 554 | m_row = !m_row; |
555 | } | 555 | } |
556 | 556 | ||
557 | // We want a strike through completed ;) | 557 | // We want a strike through completed ;) |
558 | // durchstreichen to complete | 558 | // durchstreichen to complete |
559 | /* | 559 | /* |
560 | * MouseTracking is off this mean we only receive | 560 | * MouseTracking is off this mean we only receive |
561 | * these events if the mouse button is pressed | 561 | * these events if the mouse button is pressed |
562 | * We've the previous point saved | 562 | * We've the previous point saved |
563 | * We check if the previous and current Point are | 563 | * We check if the previous and current Point are |
564 | * in the same row. | 564 | * in the same row. |
565 | * Then we check if they're some pixel horizontal away | 565 | * Then we check if they're some pixel horizontal away |
566 | * if the distance between the two points is greater than | 566 | * if the distance between the two points is greater than |
567 | * 8 we mark the underlying todo as completed and do a repaint | 567 | * 8 we mark the underlying todo as completed and do a repaint |
568 | * | 568 | * |
569 | * BUG: When clicking on the Due column and it's scrollable | 569 | * BUG: When clicking on the Due column and it's scrollable |
570 | * the todo is marked as completed... | 570 | * the todo is marked as completed... |
571 | * REASON: QTable is doing auto scrolling which leads to a move | 571 | * REASON: QTable is doing auto scrolling which leads to a move |
572 | * in the x coordinate and this way it's able to pass the | 572 | * in the x coordinate and this way it's able to pass the |
573 | * m_completeStrokeWidth criteria | 573 | * m_completeStrokeWidth criteria |
574 | * WORKAROUND: strike through needs to strike through the same | 574 | * WORKAROUND: strike through needs to strike through the same |
575 | * row and two columns! | 575 | * row and two columns! |
576 | */ | 576 | */ |
577 | void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { | 577 | void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { |
578 | int row = rowAt(m_prevP.y()); | 578 | int row = rowAt(m_prevP.y()); |
579 | int colOld = columnAt(m_prevP.x() ); | 579 | int colOld = columnAt(m_prevP.x() ); |
580 | int colNew = columnAt(e->x() ); | 580 | int colNew = columnAt(e->x() ); |
581 | Opie::Core::owarn << "colNew: " << colNew << " colOld: " << colOld << oendl; | 581 | owarn << "colNew: " << colNew << " colOld: " << colOld << oendl; |
582 | if ( row == rowAt( e->y() ) && row != -1 && | 582 | if ( row == rowAt( e->y() ) && row != -1 && |
583 | colOld != colNew ) { | 583 | colOld != colNew ) { |
584 | TodoView::complete( sorted()[row] ); | 584 | TodoView::complete( sorted()[row] ); |
585 | return; | 585 | return; |
586 | } | 586 | } |
587 | QTable::contentsMouseReleaseEvent( e ); | 587 | QTable::contentsMouseReleaseEvent( e ); |
588 | } | 588 | } |
589 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { | 589 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { |
590 | m_menuTimer->stop(); | 590 | m_menuTimer->stop(); |
591 | QTable::contentsMouseMoveEvent( e ); | 591 | QTable::contentsMouseMoveEvent( e ); |
592 | } | 592 | } |
593 | void TableView::keyPressEvent( QKeyEvent* event) { | 593 | void TableView::keyPressEvent( QKeyEvent* event) { |
594 | if ( m_editorWidget.cellWidget() ) { | 594 | if ( m_editorWidget.cellWidget() ) { |
595 | // setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); | 595 | // setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); |
596 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), | 596 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), |
597 | true, true ); | 597 | true, true ); |
598 | m_editorWidget.releaseCellWidget(); | 598 | m_editorWidget.releaseCellWidget(); |
599 | setFocus(); | 599 | setFocus(); |
600 | } | 600 | } |
601 | 601 | ||
602 | if ( sorted().count() < 1 ) { | 602 | if ( sorted().count() < 1 ) { |
603 | QTable::keyPressEvent( event ); | 603 | QTable::keyPressEvent( event ); |
604 | return; | 604 | return; |
605 | } | 605 | } |
606 | 606 | ||
607 | int row = currentRow(); | 607 | int row = currentRow(); |
608 | int col = currentColumn(); | 608 | int col = currentColumn(); |
609 | 609 | ||
610 | char key = ::toupper( event->ascii() ); | 610 | char key = ::toupper( event->ascii() ); |
611 | /* let QTable also handle the d letter */ | 611 | /* let QTable also handle the d letter */ |
612 | if ( key == 'D' ) { | 612 | if ( key == 'D' ) { |
613 | event->accept(); | 613 | event->accept(); |
614 | removeQuery( sorted().uidAt( row ) ); | 614 | removeQuery( sorted().uidAt( row ) ); |
615 | return; | 615 | return; |
616 | } | 616 | } |
617 | 617 | ||
618 | 618 | ||
619 | switch( event->key() ) { | 619 | switch( event->key() ) { |
620 | case Qt::Key_F33: | 620 | case Qt::Key_F33: |
621 | case Qt::Key_Enter: | 621 | case Qt::Key_Enter: |
622 | case Qt::Key_Return: | 622 | case Qt::Key_Return: |
623 | case Qt::Key_Space: | 623 | case Qt::Key_Space: |
624 | if ( col == 0 ) { | 624 | if ( col == 0 ) { |
625 | TodoView::complete(sorted()[row]); | 625 | TodoView::complete(sorted()[row]); |
626 | }else if ( col == 1 ) { | 626 | }else if ( col == 1 ) { |
627 | QWidget* wid = beginEdit(row, col, FALSE ); | 627 | QWidget* wid = beginEdit(row, col, FALSE ); |
628 | m_editorWidget.setCellWidget( wid, row, col ); | 628 | m_editorWidget.setCellWidget( wid, row, col ); |
629 | }else if ( col == 2 ) { | 629 | }else if ( col == 2 ) { |
630 | showTodo( sorted().uidAt( currentRow() ) ); | 630 | showTodo( sorted().uidAt( currentRow() ) ); |
631 | }else if ( col == 3 ) { | 631 | }else if ( col == 3 ) { |
632 | TodoView::edit( sorted().uidAt(row) ); | 632 | TodoView::edit( sorted().uidAt(row) ); |
633 | } | 633 | } |
634 | event->accept(); | 634 | event->accept(); |
635 | break; | 635 | break; |
636 | default: | 636 | default: |
637 | QTable::keyPressEvent( event ); | 637 | QTable::keyPressEvent( event ); |
638 | } | 638 | } |
639 | } | 639 | } |
640 | 640 | ||
diff --git a/core/pim/todo/templatedialog.cpp b/core/pim/todo/templatedialog.cpp index 32327a6..8d72297 100644 --- a/core/pim/todo/templatedialog.cpp +++ b/core/pim/todo/templatedialog.cpp | |||
@@ -1,64 +1,60 @@ | |||
1 | #include <opie2/odebug.h> | 1 | #include <opie2/odebug.h> |
2 | 2 | ||
3 | #include <qpushbutton.h> | 3 | #include <qpushbutton.h> |
4 | #include <qhbox.h> | 4 | #include <qhbox.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | #include <qlistview.h> | 6 | #include <qlistview.h> |
7 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
8 | 8 | ||
9 | #include "templatedialog.h" | 9 | #include "templatedialog.h" |
10 | 10 | ||
11 | 11 | ||
12 | using namespace Todo; | 12 | using namespace Todo; |
13 | 13 | ||
14 | /* TRANSLATOR Todo::TemplateDialog */ | 14 | /* TRANSLATOR Todo::TemplateDialog */ |
15 | 15 | ||
16 | TemplateDialog::TemplateDialog( QWidget* widget ) | 16 | TemplateDialog::TemplateDialog( QWidget* widget ) |
17 | : QDialog( widget, "TemplateDialog", TRUE ) | 17 | : QDialog( widget, "TemplateDialog", TRUE ) |
18 | { | 18 | { |
19 | setCaption( QWidget::tr("Template Editor") ); | 19 | setCaption( QWidget::tr("Template Editor") ); |
20 | m_main = new QVBoxLayout(this ); | 20 | m_main = new QVBoxLayout(this ); |
21 | 21 | ||
22 | m_list = new QListView( this ); | 22 | m_list = new QListView( this ); |
23 | m_main->addWidget( m_list, 100 ); | 23 | m_main->addWidget( m_list, 100 ); |
24 | 24 | ||
25 | m_lne = new QLineEdit( this ); | 25 | m_lne = new QLineEdit( this ); |
26 | m_main->addWidget( m_lne ); | 26 | m_main->addWidget( m_lne ); |
27 | 27 | ||
28 | m_btnBar = new QHBox( this ); | 28 | m_btnBar = new QHBox( this ); |
29 | m_add = new QPushButton( QWidget::tr("Add"), m_btnBar ); | 29 | m_add = new QPushButton( QWidget::tr("Add"), m_btnBar ); |
30 | m_edit = new QPushButton( QWidget::tr("Edit"), m_btnBar ); | 30 | m_edit = new QPushButton( QWidget::tr("Edit"), m_btnBar ); |
31 | m_rem = new QPushButton( QWidget::tr("Remove"), m_btnBar ); | 31 | m_rem = new QPushButton( QWidget::tr("Remove"), m_btnBar ); |
32 | m_main->addWidget( m_btnBar ); | 32 | m_main->addWidget( m_btnBar ); |
33 | 33 | ||
34 | connect(m_add, SIGNAL(clicked() ), | 34 | connect(m_add, SIGNAL(clicked() ), |
35 | this, SLOT(slotAdd() ) ); | 35 | this, SLOT(slotAdd() ) ); |
36 | connect(m_edit, SIGNAL(clicked() ), | 36 | connect(m_edit, SIGNAL(clicked() ), |
37 | this, SLOT(slotEdit() ) ); | 37 | this, SLOT(slotEdit() ) ); |
38 | connect(m_rem, SIGNAL(clicked() ), | 38 | connect(m_rem, SIGNAL(clicked() ), |
39 | this, SLOT(slotRemove() ) ); | 39 | this, SLOT(slotRemove() ) ); |
40 | connect(m_lne, SIGNAL(returnPressed() ), | 40 | connect(m_lne, SIGNAL(returnPressed() ), |
41 | this, SLOT(slotReturn() ) ); | 41 | this, SLOT(slotReturn() ) ); |
42 | 42 | ||
43 | } | 43 | } |
44 | TemplateDialog::~TemplateDialog() { | 44 | TemplateDialog::~TemplateDialog() { |
45 | // Qt does delete our widgets | 45 | // Qt does delete our widgets |
46 | } | 46 | } |
47 | QListView* TemplateDialog::listView() { | 47 | QListView* TemplateDialog::listView() { |
48 | return m_list; | 48 | return m_list; |
49 | } | 49 | } |
50 | QLineEdit* TemplateDialog::edit() { | 50 | QLineEdit* TemplateDialog::edit() { |
51 | return m_lne; | 51 | return m_lne; |
52 | } | 52 | } |
53 | void TemplateDialog::slotAdd() { | 53 | void TemplateDialog::slotAdd() { |
54 | Opie::Core::owarn << "Not Implemented here" << oendl; | ||
55 | } | 54 | } |
56 | void TemplateDialog::slotRemove() { | 55 | void TemplateDialog::slotRemove() { |
57 | Opie::Core::owarn << "Not Implemented here" << oendl; | ||
58 | } | 56 | } |
59 | void TemplateDialog::slotEdit() { | 57 | void TemplateDialog::slotEdit() { |
60 | Opie::Core::owarn << "Not Implemented here" << oendl; | ||
61 | } | 58 | } |
62 | void TemplateDialog::slotReturn() { | 59 | void TemplateDialog::slotReturn() { |
63 | Opie::Core::owarn << "Not Implemented here" << oendl; | ||
64 | } | 60 | } |
diff --git a/core/pim/todo/todoeditor.cpp b/core/pim/todo/todoeditor.cpp index 7857d52..a1c559d 100644 --- a/core/pim/todo/todoeditor.cpp +++ b/core/pim/todo/todoeditor.cpp | |||
@@ -1,64 +1,62 @@ | |||
1 | #include <opie2/odebug.h> | 1 | #include <opie2/odebug.h> |
2 | 2 | ||
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | 4 | ||
5 | #include "otaskeditor.h" | 5 | #include "otaskeditor.h" |
6 | #include "todoeditor.h" | 6 | #include "todoeditor.h" |
7 | 7 | ||
8 | using namespace Opie; | 8 | using namespace Opie; |
9 | using namespace Todo; | 9 | using namespace Todo; |
10 | 10 | ||
11 | Editor::Editor() { | 11 | Editor::Editor() { |
12 | m_accepted = false; | 12 | m_accepted = false; |
13 | m_self = 0l; | 13 | m_self = 0l; |
14 | } | 14 | } |
15 | Editor::~Editor() { | 15 | Editor::~Editor() { |
16 | delete m_self; | 16 | delete m_self; |
17 | m_self = 0; | 17 | m_self = 0; |
18 | } | 18 | } |
19 | OPimTodo Editor::newTodo( int cur, | 19 | OPimTodo Editor::newTodo( int cur, |
20 | QWidget*) { | 20 | QWidget*) { |
21 | 21 | ||
22 | OTaskEditor *e = self(); | 22 | OTaskEditor *e = self(); |
23 | e->setCaption( QObject::tr("Enter Task") ); | 23 | e->setCaption( QObject::tr("Enter Task") ); |
24 | e->init( cur ); | 24 | e->init( cur ); |
25 | 25 | ||
26 | int ret = QPEApplication::execDialog( e ); | 26 | int ret = QPEApplication::execDialog( e ); |
27 | 27 | ||
28 | if ( QDialog::Accepted == ret ) { | 28 | if ( QDialog::Accepted == ret ) { |
29 | m_accepted = true; | 29 | m_accepted = true; |
30 | }else | 30 | }else |
31 | m_accepted = false; | 31 | m_accepted = false; |
32 | 32 | ||
33 | OPimTodo ev = e->todo(); | 33 | OPimTodo ev = e->todo(); |
34 | Opie::Core::owarn << "Todo uid" << oendl; | ||
35 | Opie::Core::owarn << "Todo " << ev.summary() << " " << ev.progress() << " " << ev.isCompleted() << oendl; | ||
36 | ev.setUid(1); | 34 | ev.setUid(1); |
37 | 35 | ||
38 | return ev; | 36 | return ev; |
39 | } | 37 | } |
40 | OPimTodo Editor::edit( QWidget *, | 38 | OPimTodo Editor::edit( QWidget *, |
41 | const OPimTodo& todo ) { | 39 | const OPimTodo& todo ) { |
42 | OTaskEditor *e = self(); | 40 | OTaskEditor *e = self(); |
43 | e->init( todo ); | 41 | e->init( todo ); |
44 | e->setCaption( QObject::tr( "Edit Task" ) ); | 42 | e->setCaption( QObject::tr( "Edit Task" ) ); |
45 | 43 | ||
46 | int ret = QPEApplication::execDialog( e ); | 44 | int ret = QPEApplication::execDialog( e ); |
47 | 45 | ||
48 | OPimTodo ev = e->todo(); | 46 | OPimTodo ev = e->todo(); |
49 | if ( ret == QDialog::Accepted ) | 47 | if ( ret == QDialog::Accepted ) |
50 | m_accepted = true; | 48 | m_accepted = true; |
51 | else | 49 | else |
52 | m_accepted = false; | 50 | m_accepted = false; |
53 | 51 | ||
54 | return ev; | 52 | return ev; |
55 | } | 53 | } |
56 | bool Editor::accepted()const { | 54 | bool Editor::accepted()const { |
57 | return m_accepted; | 55 | return m_accepted; |
58 | } | 56 | } |
59 | OTaskEditor* Editor::self() { | 57 | OTaskEditor* Editor::self() { |
60 | if (!m_self ) | 58 | if (!m_self ) |
61 | m_self = new OTaskEditor(0); | 59 | m_self = new OTaskEditor(0); |
62 | 60 | ||
63 | return m_self; | 61 | return m_self; |
64 | } | 62 | } |
diff --git a/core/pim/todo/todomanager.cpp b/core/pim/todo/todomanager.cpp index 7826747..c4b8fbc 100644 --- a/core/pim/todo/todomanager.cpp +++ b/core/pim/todo/todomanager.cpp | |||
@@ -1,116 +1,116 @@ | |||
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 | #include <opie2/odebug.h> | 29 | #include <opie2/odebug.h> |
30 | 30 | ||
31 | #include <qpe/categoryselect.h> | 31 | #include <qpe/categoryselect.h> |
32 | 32 | ||
33 | #include "todomanager.h" | 33 | #include "todomanager.h" |
34 | 34 | ||
35 | using namespace Todo; | 35 | using namespace Todo; |
36 | 36 | ||
37 | TodoManager::TodoManager( QObject *obj ) | 37 | TodoManager::TodoManager( QObject *obj ) |
38 | : QObject( obj ) { | 38 | : QObject( obj ) { |
39 | m_db = 0l; | 39 | m_db = 0l; |
40 | QTime time; | 40 | QTime time; |
41 | time.start(); | 41 | time.start(); |
42 | int el = time.elapsed(); | 42 | int el = time.elapsed(); |
43 | Opie::Core::owarn << "QTimer for loading " << el/1000 << oendl; | 43 | owarn << "QTimer for loading " << el/1000 << oendl; |
44 | } | 44 | } |
45 | TodoManager::~TodoManager() { | 45 | TodoManager::~TodoManager() { |
46 | delete m_db; | 46 | delete m_db; |
47 | } | 47 | } |
48 | OPimTodo TodoManager::event(int uid ) { | 48 | OPimTodo TodoManager::event(int uid ) { |
49 | return m_db->find( uid ); | 49 | return m_db->find( uid ); |
50 | } | 50 | } |
51 | void TodoManager::updateList() { | 51 | void TodoManager::updateList() { |
52 | Opie::Core::owarn << "update lists" << oendl; | 52 | owarn << "update lists" << oendl; |
53 | m_list = m_db->allRecords(); | 53 | m_list = m_db->allRecords(); |
54 | } | 54 | } |
55 | OPimTodoAccess::List TodoManager::list() const{ | 55 | OPimTodoAccess::List TodoManager::list() const{ |
56 | return m_list; | 56 | return m_list; |
57 | } | 57 | } |
58 | OPimTodoAccess::List TodoManager::sorted( bool asc, int so, int f, int cat ) { | 58 | OPimTodoAccess::List TodoManager::sorted( bool asc, int so, int f, int cat ) { |
59 | return m_db->sorted( asc, so, f, cat ); | 59 | return m_db->sorted( asc, so, f, cat ); |
60 | } | 60 | } |
61 | OPimTodoAccess::List::Iterator TodoManager::overDue() { | 61 | OPimTodoAccess::List::Iterator TodoManager::overDue() { |
62 | int filter = 2 | 1; | 62 | int filter = 2 | 1; |
63 | m_list = m_db->sorted(m_asc, m_sortOrder, filter, m_ca ); | 63 | m_list = m_db->sorted(m_asc, m_sortOrder, filter, m_ca ); |
64 | m_it = m_list.begin(); | 64 | m_it = m_list.begin(); |
65 | return m_it; | 65 | return m_it; |
66 | } | 66 | } |
67 | OPimTodoAccess::List::Iterator TodoManager::fromTo( const QDate& start, | 67 | OPimTodoAccess::List::Iterator TodoManager::fromTo( const QDate& start, |
68 | const QDate& end ) { | 68 | const QDate& end ) { |
69 | m_list = m_db->effectiveToDos( start, end ); | 69 | m_list = m_db->effectiveToDos( start, end ); |
70 | m_it = m_list.begin(); | 70 | m_it = m_list.begin(); |
71 | return m_it; | 71 | return m_it; |
72 | } | 72 | } |
73 | OPimTodoAccess::List::Iterator TodoManager::query( const OPimTodo& ev, int query ) { | 73 | OPimTodoAccess::List::Iterator TodoManager::query( const OPimTodo& ev, int query ) { |
74 | m_list = m_db->queryByExample( ev, query ); | 74 | m_list = m_db->queryByExample( ev, query ); |
75 | m_it = m_list.begin(); | 75 | m_it = m_list.begin(); |
76 | return m_it; | 76 | return m_it; |
77 | } | 77 | } |
78 | OPimTodoAccess* TodoManager::todoDB() { | 78 | OPimTodoAccess* TodoManager::todoDB() { |
79 | return m_db; | 79 | return m_db; |
80 | } | 80 | } |
81 | void TodoManager::add( const OPimTodo& ev ) { | 81 | void TodoManager::add( const OPimTodo& ev ) { |
82 | m_db->add( ev ); | 82 | m_db->add( ev ); |
83 | } | 83 | } |
84 | void TodoManager::update( int, const SmallTodo& ) { | 84 | void TodoManager::update( int, const SmallTodo& ) { |
85 | 85 | ||
86 | } | 86 | } |
87 | void TodoManager::update( int, const OPimTodo& ev) { | 87 | void TodoManager::update( int, const OPimTodo& ev) { |
88 | m_db->replace( ev ); | 88 | m_db->replace( ev ); |
89 | } | 89 | } |
90 | bool TodoManager::remove( int uid ) { | 90 | bool TodoManager::remove( int uid ) { |
91 | return m_db->remove( uid ); | 91 | return m_db->remove( uid ); |
92 | } | 92 | } |
93 | void TodoManager::removeAll() { | 93 | void TodoManager::removeAll() { |
94 | m_db->clear(); | 94 | m_db->clear(); |
95 | } | 95 | } |
96 | void TodoManager::removeCompleted() { | 96 | void TodoManager::removeCompleted() { |
97 | m_db->removeAllCompleted(); | 97 | m_db->removeAllCompleted(); |
98 | } | 98 | } |
99 | void TodoManager::save() { | 99 | void TodoManager::save() { |
100 | m_db->save(); | 100 | m_db->save(); |
101 | } | 101 | } |
102 | bool TodoManager::saveAll() { | 102 | bool TodoManager::saveAll() { |
103 | return m_db->save(); | 103 | return m_db->save(); |
104 | } | 104 | } |
105 | void TodoManager::reload() { | 105 | void TodoManager::reload() { |
106 | m_db->reload(); | 106 | m_db->reload(); |
107 | } | 107 | } |
108 | QStringList TodoManager::categories() { | 108 | QStringList TodoManager::categories() { |
109 | m_cat.load(categoryFileName() ); | 109 | m_cat.load(categoryFileName() ); |
110 | return m_cat.labels( "Todo List"); | 110 | return m_cat.labels( "Todo List"); |
111 | } | 111 | } |
112 | /* | 112 | /* |
113 | * we rely on load beeing called from populateCategories | 113 | * we rely on load beeing called from populateCategories |
114 | */ | 114 | */ |
115 | int TodoManager::catId( const QString& cats ) { | 115 | int TodoManager::catId( const QString& cats ) { |
116 | return m_cat.id( "Todo List", cats ); | 116 | return m_cat.id( "Todo List", cats ); |
diff --git a/core/pim/todo/todotemplatemanager.cpp b/core/pim/todo/todotemplatemanager.cpp index 0b20d5a..7690d37 100644 --- a/core/pim/todo/todotemplatemanager.cpp +++ b/core/pim/todo/todotemplatemanager.cpp | |||
@@ -1,82 +1,79 @@ | |||
1 | #include <opie2/odebug.h> | 1 | #include <opie2/odebug.h> |
2 | #include <opie2/otodoaccess.h> | 2 | #include <opie2/otodoaccess.h> |
3 | #include <opie2/otodoaccessxml.h> | 3 | #include <opie2/otodoaccessxml.h> |
4 | 4 | ||
5 | #include <qpe/config.h> | 5 | #include <qpe/config.h> |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | 7 | ||
8 | #include "todotemplatemanager.h" | 8 | #include "todotemplatemanager.h" |
9 | 9 | ||
10 | 10 | ||
11 | using namespace Todo; | 11 | using namespace Todo; |
12 | 12 | ||
13 | TemplateManager::TemplateManager() { | 13 | TemplateManager::TemplateManager() { |
14 | m_path = Global::applicationFileName("todolist", "templates.xml"); | 14 | m_path = Global::applicationFileName("todolist", "templates.xml"); |
15 | } | 15 | } |
16 | TemplateManager::~TemplateManager() { | 16 | TemplateManager::~TemplateManager() { |
17 | save(); | 17 | save(); |
18 | } | 18 | } |
19 | void TemplateManager::load() { | 19 | void TemplateManager::load() { |
20 | Config conf("todolist_templates"); | 20 | Config conf("todolist_templates"); |
21 | OPimTodoAccessXML *xml = new OPimTodoAccessXML( QString::fromLatin1("template"), | 21 | OPimTodoAccessXML *xml = new OPimTodoAccessXML( QString::fromLatin1("template"), |
22 | m_path ); | 22 | m_path ); |
23 | OPimTodoAccess todoDB(xml ); | 23 | OPimTodoAccess todoDB(xml ); |
24 | todoDB.load(); | 24 | todoDB.load(); |
25 | 25 | ||
26 | OPimTodoAccess::List::Iterator it; | 26 | OPimTodoAccess::List::Iterator it; |
27 | OPimTodoAccess::List list = todoDB.allRecords(); | 27 | OPimTodoAccess::List list = todoDB.allRecords(); |
28 | for ( it = list.begin(); it != list.end(); ++it ) { | 28 | for ( it = list.begin(); it != list.end(); ++it ) { |
29 | OPimTodo ev = (*it); | 29 | OPimTodo ev = (*it); |
30 | conf.setGroup( QString::number( ev.uid() ) ); | 30 | conf.setGroup( QString::number( ev.uid() ) ); |
31 | QString str = conf.readEntry("Name", QString::null ); | 31 | QString str = conf.readEntry("Name", QString::null ); |
32 | if (str.isEmpty() ) | 32 | if (str.isEmpty() ) |
33 | continue; | 33 | continue; |
34 | 34 | ||
35 | m_templates.insert( str, ev ); | 35 | m_templates.insert( str, ev ); |
36 | } | 36 | } |
37 | } | 37 | } |
38 | void TemplateManager::save() { | 38 | void TemplateManager::save() { |
39 | Opie::Core::owarn << "Saving!!!!" << oendl; | ||
40 | Config conf("todolist_templates"); | 39 | Config conf("todolist_templates"); |
41 | 40 | ||
42 | OPimTodoAccessXML *res = new OPimTodoAccessXML( "template", | 41 | OPimTodoAccessXML *res = new OPimTodoAccessXML( "template", |
43 | m_path ); | 42 | m_path ); |
44 | OPimTodoAccess db(res); | 43 | OPimTodoAccess db(res); |
45 | db.load(); | 44 | db.load(); |
46 | db.clear(); | 45 | db.clear(); |
47 | 46 | ||
48 | 47 | ||
49 | QMap<QString, OPimTodo>::Iterator it; | 48 | QMap<QString, OPimTodo>::Iterator it; |
50 | for ( it = m_templates.begin(); it != m_templates.end(); ++it ) { | 49 | for ( it = m_templates.begin(); it != m_templates.end(); ++it ) { |
51 | OPimTodo ev = it.data(); | 50 | OPimTodo ev = it.data(); |
52 | conf.setGroup( QString::number( ev.uid() ) ); | 51 | conf.setGroup( QString::number( ev.uid() ) ); |
53 | Opie::Core::owarn << "Name " << it.key() << oendl; | ||
54 | conf.writeEntry("Name", it.key() ); | 52 | conf.writeEntry("Name", it.key() ); |
55 | db.add( ev ); | 53 | db.add( ev ); |
56 | } | 54 | } |
57 | db.save(); | 55 | db.save(); |
58 | } | 56 | } |
59 | void TemplateManager::addEvent( const QString& str, | 57 | void TemplateManager::addEvent( const QString& str, |
60 | const OPimTodo& ev) { | 58 | const OPimTodo& ev) { |
61 | Opie::Core::owarn << "AddEvent " << str << oendl; | ||
62 | OPimTodo todo = ev; | 59 | OPimTodo todo = ev; |
63 | if( ev.uid() == 0 ) | 60 | if( ev.uid() == 0 ) |
64 | todo.setUid(1); // generate a new uid | 61 | todo.setUid(1); // generate a new uid |
65 | 62 | ||
66 | m_templates.replace( str, todo ); | 63 | m_templates.replace( str, todo ); |
67 | } | 64 | } |
68 | void TemplateManager::removeEvent( const QString& str ) { | 65 | void TemplateManager::removeEvent( const QString& str ) { |
69 | m_templates.remove( str ); | 66 | m_templates.remove( str ); |
70 | } | 67 | } |
71 | QStringList TemplateManager::templates() const { | 68 | QStringList TemplateManager::templates() const { |
72 | QStringList list; | 69 | QStringList list; |
73 | QMap<QString, OPimTodo>::ConstIterator it; | 70 | QMap<QString, OPimTodo>::ConstIterator it; |
74 | for (it = m_templates.begin(); it != m_templates.end(); ++it ) { | 71 | for (it = m_templates.begin(); it != m_templates.end(); ++it ) { |
75 | list << it.key(); | 72 | list << it.key(); |
76 | } | 73 | } |
77 | 74 | ||
78 | return list; | 75 | return list; |
79 | } | 76 | } |
80 | OPimTodo TemplateManager::templateEvent( const QString& templateName ) { | 77 | OPimTodo TemplateManager::templateEvent( const QString& templateName ) { |
81 | return m_templates[templateName]; | 78 | return m_templates[templateName]; |
82 | } | 79 | } |
diff --git a/core/pim/todo/todoview.cpp b/core/pim/todo/todoview.cpp index 03e1060..3d2c982 100644 --- a/core/pim/todo/todoview.cpp +++ b/core/pim/todo/todoview.cpp | |||
@@ -1,71 +1,71 @@ | |||
1 | #include "mainwindow.h" | 1 | #include "mainwindow.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | 4 | ||
5 | #include "todoview.h" | 5 | #include "todoview.h" |
6 | 6 | ||
7 | using namespace Todo; | 7 | using namespace Todo; |
8 | 8 | ||
9 | 9 | ||
10 | 10 | ||
11 | 11 | ||
12 | TodoView::TodoView( MainWindow* win ) | 12 | TodoView::TodoView( MainWindow* win ) |
13 | : m_main( win ) | 13 | : m_main( win ) |
14 | { | 14 | { |
15 | m_asc = false; | 15 | m_asc = false; |
16 | m_sortOrder = -1; | 16 | m_sortOrder = -1; |
17 | } | 17 | } |
18 | TodoView::~TodoView() { | 18 | TodoView::~TodoView() { |
19 | }; | 19 | }; |
20 | MainWindow* TodoView::todoWindow() { | 20 | MainWindow* TodoView::todoWindow() { |
21 | return m_main; | 21 | return m_main; |
22 | } | 22 | } |
23 | 23 | ||
24 | OPimTodo TodoView::event(int uid ) { | 24 | OPimTodo TodoView::event(int uid ) { |
25 | return m_main->event( uid ); | 25 | return m_main->event( uid ); |
26 | } | 26 | } |
27 | OPimTodoAccess::List TodoView::list(){ | 27 | OPimTodoAccess::List TodoView::list(){ |
28 | todoWindow()->updateList(); | 28 | todoWindow()->updateList(); |
29 | return todoWindow()->list(); | 29 | return todoWindow()->list(); |
30 | } | 30 | } |
31 | OPimTodoAccess::List TodoView::sorted()const{ | 31 | OPimTodoAccess::List TodoView::sorted()const{ |
32 | return m_sort; | 32 | return m_sort; |
33 | } | 33 | } |
34 | void TodoView::sort() { | 34 | void TodoView::sort() { |
35 | m_sort = todoWindow()->sorted(m_asc,m_sortOrder ); | 35 | m_sort = todoWindow()->sorted(m_asc,m_sortOrder ); |
36 | Opie::Core::owarn << "m_sort.count() = " << m_sort.count() << oendl; | 36 | owarn << "m_sort.count() = " << m_sort.count() << oendl; |
37 | } | 37 | } |
38 | void TodoView::sort(int sort) { | 38 | void TodoView::sort(int sort) { |
39 | m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort ); | 39 | m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort ); |
40 | } | 40 | } |
41 | void TodoView::setSortOrder( int order ) { | 41 | void TodoView::setSortOrder( int order ) { |
42 | m_sortOrder = order; | 42 | m_sortOrder = order; |
43 | } | 43 | } |
44 | void TodoView::setAscending( bool b ) { | 44 | void TodoView::setAscending( bool b ) { |
45 | Opie::Core::owarn << "setAscending " << b << oendl; | 45 | owarn << "setAscending " << b << oendl; |
46 | m_asc = b; | 46 | m_asc = b; |
47 | } | 47 | } |
48 | void TodoView::update(int, const SmallTodo& ) { | 48 | void TodoView::update(int, const SmallTodo& ) { |
49 | //m_main->slotUpate1( uid, to ); | 49 | //m_main->slotUpate1( uid, to ); |
50 | } | 50 | } |
51 | void TodoView::update(int , const OPimTodo& ev ) { | 51 | void TodoView::update(int , const OPimTodo& ev ) { |
52 | m_main->updateTodo( ev ); | 52 | m_main->updateTodo( ev ); |
53 | } | 53 | } |
54 | void TodoView::showTodo( int uid ) { | 54 | void TodoView::showTodo( int uid ) { |
55 | m_main->slotShow( uid ); | 55 | m_main->slotShow( uid ); |
56 | } | 56 | } |
57 | void TodoView::edit( int uid ) { | 57 | void TodoView::edit( int uid ) { |
58 | m_main->slotEdit( uid ); | 58 | m_main->slotEdit( uid ); |
59 | } | 59 | } |
60 | void TodoView::remove( int uid ) { | 60 | void TodoView::remove( int uid ) { |
61 | m_main->m_todoMgr.remove( uid ); | 61 | m_main->m_todoMgr.remove( uid ); |
62 | } | 62 | } |
63 | void TodoView::complete( int uid ) { | 63 | void TodoView::complete( int uid ) { |
64 | m_main->slotComplete( uid ); | 64 | m_main->slotComplete( uid ); |
65 | } | 65 | } |
66 | void TodoView::complete( const OPimTodo& ev ) { | 66 | void TodoView::complete( const OPimTodo& ev ) { |
67 | m_main->slotComplete( ev ); | 67 | m_main->slotComplete( ev ); |
68 | } | 68 | } |
69 | void TodoView::removeQuery( int uid ) { | 69 | void TodoView::removeQuery( int uid ) { |
70 | m_main->slotDelete( uid ); | 70 | m_main->slotDelete( uid ); |
71 | } | 71 | } |