summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp10
-rw-r--r--core/pim/todo/mainwindow.h1
-rw-r--r--core/pim/todo/tableview.cpp4
-rw-r--r--core/pim/todo/todoeditor.cpp2
4 files changed, 5 insertions, 12 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index b2b3b8f..0ab6230 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -1,351 +1,351 @@
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 <qmenubar.h> 31#include <qmenubar.h>
32#include <qmessagebox.h> 32#include <qmessagebox.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qwidgetstack.h> 35#include <qwidgetstack.h>
36#include <qaction.h> 36#include <qaction.h>
37#include <qtimer.h> 37#include <qtimer.h>
38#include <qvbox.h> 38#include <qvbox.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40 40
41#include <qpe/applnk.h> 41#include <qpe/applnk.h>
42#include <qpe/config.h> 42#include <qpe/config.h>
43#include <qpe/ir.h> 43#include <qpe/ir.h>
44#include <qpe/resource.h> 44#include <qpe/resource.h>
45#include <qpe/qpemessagebox.h> 45#include <qpe/qpemessagebox.h>
46 46
47#include <opie/orecur.h> 47#include <opie/orecur.h>
48#include <opie/otodoaccessvcal.h> 48#include <opie/otodoaccessvcal.h>
49 49
50#include "quickeditimpl.h" 50#include "quickeditimpl.h"
51#include "todotemplatemanager.h" 51#include "todotemplatemanager.h"
52#include "templateeditor.h" 52#include "templateeditor.h"
53#include "tableview.h" 53#include "tableview.h"
54 54
55#include "textviewshow.h" 55#include "textviewshow.h"
56#include "todoeditor.h" 56#include "todoeditor.h"
57#include "mainwindow.h" 57#include "mainwindow.h"
58 58
59 59
60using namespace Todo; 60using namespace Todo;
61 61
62MainWindow::MainWindow( QWidget* parent, 62MainWindow::MainWindow( QWidget* parent,
63 const char* name ) 63 const char* name )
64 : OPimMainWindow("Todolist") 64 : OPimMainWindow("Todolist", parent, name)
65{ 65{
66 66
67 m_syncing = false; 67 m_syncing = false;
68 m_counter = 0; 68 m_counter = 0;
69 m_tempManager = new TemplateManager(); 69 m_tempManager = new TemplateManager();
70 m_tempManager->load(); 70 m_tempManager->load();
71 71
72 initUI(); 72 initUI();
73 initConfig(); 73 initConfig();
74 initViews(); 74 initViews();
75 initActions(); 75 initActions();
76 initEditor(); 76 initEditor();
77 initShow(); 77 initShow();
78 initTemplate(); 78 initTemplate();
79 79
80 populateTemplates(); 80 populateTemplates();
81 raiseCurrentView(); 81 raiseCurrentView();
82 QTimer::singleShot(0, this, SLOT(populateCategories() ) ); 82 QTimer::singleShot(0, this, SLOT(populateCategories() ) );
83} 83}
84void MainWindow::initTemplate() { 84void MainWindow::initTemplate() {
85 m_curTempEd = new TemplateEditor( this, templateManager() ); 85 m_curTempEd = new TemplateEditor( this, templateManager() );
86} 86}
87void MainWindow::initActions() { 87void MainWindow::initActions() {
88 QAction* a = new QAction( tr("New Task" ), Resource::loadPixmap( "new" ), 88 QAction* a = new QAction( tr("New Task" ), Resource::loadPixmap( "new" ),
89 QString::null, 0, this, 0 ); 89 QString::null, 0, this, 0 );
90 connect(a, SIGNAL( activated() ), 90 connect(a, SIGNAL( activated() ),
91 this, SLOT( slotNew() ) ); 91 this, SLOT( slotNew() ) );
92 a->addTo(m_tool ); 92 a->addTo(m_tool );
93 a->addTo(m_edit ); 93 a->addTo(m_edit );
94 94
95 a = new QAction( tr("Edit Task"), Resource::loadIconSet( "edit" ), 95 a = new QAction( tr("Edit Task"), Resource::loadIconSet( "edit" ),
96 QString::null, 0, this, 0 ); 96 QString::null, 0, this, 0 );
97 connect(a, SIGNAL(activated() ), 97 connect(a, SIGNAL(activated() ),
98 this, SLOT( slotEdit() ) ); 98 this, SLOT( slotEdit() ) );
99 a->addTo( m_tool ); 99 a->addTo( m_tool );
100 a->addTo( m_edit ); 100 a->addTo( m_edit );
101 m_editAction = a; 101 m_editAction = a;
102 102
103 a = new QAction( QString::null, tr("View Task"), 0, this, 0 ); 103 a = new QAction( QString::null, tr("View Task"), 0, this, 0 );
104 connect(a, SIGNAL( activated() ), 104 connect(a, SIGNAL( activated() ),
105 this, SLOT( slotShowDetails() ) ); 105 this, SLOT( slotShowDetails() ) );
106 a->addTo( m_edit ); 106 a->addTo( m_edit );
107 107
108 m_edit->insertSeparator(); 108 m_edit->insertSeparator();
109 109
110 a = new QAction( tr("Delete..."), Resource::loadIconSet( "trash" ), 110 a = new QAction( tr("Delete..."), Resource::loadIconSet( "trash" ),
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(slotDelete() ) ); 113 this, SLOT(slotDelete() ) );
114 a->addTo( m_tool ); 114 a->addTo( m_tool );
115 a->addTo( m_edit ); 115 a->addTo( m_edit );
116 m_deleteAction = a; 116 m_deleteAction = a;
117 117
118 a = new QAction( QString::null, tr("Delete all..."), 0, this, 0 ); 118 a = new QAction( QString::null, tr("Delete all..."), 0, this, 0 );
119 connect(a, SIGNAL( activated() ), 119 connect(a, SIGNAL( activated() ),
120 this, SLOT( slotDeleteAll() ) ); 120 this, SLOT( slotDeleteAll() ) );
121 a->addTo(m_edit ); 121 a->addTo(m_edit );
122 m_deleteAllAction = a; 122 m_deleteAllAction = a;
123 123
124 a = new QAction( QString::null, tr("Delete completed"), 124 a = new QAction( QString::null, tr("Delete completed"),
125 0, this, 0 ); 125 0, this, 0 );
126 connect(a, SIGNAL( activated() ), 126 connect(a, SIGNAL( activated() ),
127 this, SLOT( slotDeleteCompleted() ) ); 127 this, SLOT( slotDeleteCompleted() ) );
128 a->addTo(m_edit ); 128 a->addTo(m_edit );
129 a->setEnabled( TRUE ); 129 a->setEnabled( TRUE );
130 m_deleteCompleteAction = a; 130 m_deleteCompleteAction = a;
131 131
132 m_edit->insertSeparator(); 132 m_edit->insertSeparator();
133 133
134 a = new QAction( QString::null, tr("Duplicate"), 0, this, 0 ); 134 a = new QAction( QString::null, tr("Duplicate"), 0, this, 0 );
135 connect(a, SIGNAL( activated() ), 135 connect(a, SIGNAL( activated() ),
136 this, SLOT( slotDuplicate() ) ); 136 this, SLOT( slotDuplicate() ) );
137 a->addTo(m_edit ); 137 a->addTo(m_edit );
138 m_duplicateAction = a; 138 m_duplicateAction = a;
139 139
140 m_edit->insertSeparator(); 140 m_edit->insertSeparator();
141 141
142 if ( Ir::supported() ) { 142 if ( Ir::supported() ) {
143 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), 143 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ),
144 QString::null, 0, this, 0 ); 144 QString::null, 0, this, 0 );
145 connect( a, SIGNAL( activated() ), 145 connect( a, SIGNAL( activated() ),
146 this, SLOT( slotBeam() ) ); 146 this, SLOT( slotBeam() ) );
147 a->addTo( m_edit ); 147 a->addTo( m_edit );
148 a->addTo( m_tool ); 148 a->addTo( m_tool );
149 } 149 }
150 150
151 a = new QAction( tr("Find"), Resource::loadIconSet( "mag" ), 151 a = new QAction( tr("Find"), Resource::loadIconSet( "mag" ),
152 QString::null, 0, this, 0 ); 152 QString::null, 0, this, 0 );
153 connect(a, SIGNAL( activated() ), 153 connect(a, SIGNAL( activated() ),
154 this, SLOT( slotFind() ) ); 154 this, SLOT( slotFind() ) );
155 a->addTo( m_options ); 155 a->addTo( m_options );
156 m_findAction = a; 156 m_findAction = a;
157 157
158 m_options->insertSeparator(); 158 m_options->insertSeparator();
159 159
160 m_completedAction = new QAction( QString::null, tr("Completed tasks"), 160 m_completedAction = new QAction( QString::null, tr("Completed tasks"),
161 0, this, 0, TRUE ); 161 0, this, 0, TRUE );
162 m_completedAction->addTo( m_options ); 162 m_completedAction->addTo( m_options );
163 m_completedAction->setOn( showCompleted() ); 163 m_completedAction->setOn( showCompleted() );
164 connect(m_completedAction, SIGNAL( toggled(bool) ), 164 connect(m_completedAction, SIGNAL( toggled(bool) ),
165 this, SLOT(slotShowCompleted(bool) ) ); 165 this, SLOT(slotShowCompleted(bool) ) );
166 166
167 m_showDeadLineAction = new QAction( QString::null, tr("Show Deadline"), 167 m_showDeadLineAction = new QAction( QString::null, tr("Show Deadline"),
168 0, this, 0, TRUE ); 168 0, this, 0, TRUE );
169 m_showDeadLineAction->addTo( m_options ); 169 m_showDeadLineAction->addTo( m_options );
170 m_showDeadLineAction->setOn( showDeadline() ); 170 m_showDeadLineAction->setOn( showDeadline() );
171 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), 171 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ),
172 this, SLOT( slotShowDeadLine( bool ) ) ); 172 this, SLOT( slotShowDeadLine( bool ) ) );
173 173
174 m_options->insertSeparator(); 174 m_options->insertSeparator();
175 175
176 m_bar->insertItem( tr("Data") ,m_edit ); 176 m_bar->insertItem( tr("Data") ,m_edit );
177 m_bar->insertItem( tr("Category"), m_catMenu ); 177 m_bar->insertItem( tr("Category"), m_catMenu );
178 m_bar->insertItem( tr("Options"), m_options ); 178 m_bar->insertItem( tr("Options"), m_options );
179 179
180 /* initialize the view menu */ 180 /* initialize the view menu */
181 a = new QAction( QString::null, tr("Show only over due"), 181 a = new QAction( QString::null, tr("Show only over due"),
182 0, this, 0, TRUE ); 182 0, this, 0, TRUE );
183 a->addTo( m_options ); 183 a->addTo( m_options );
184 a->setOn( showOverDue() ); 184 a->setOn( showOverDue() );
185 connect(a, SIGNAL(toggled(bool)), 185 connect(a, SIGNAL(toggled(bool)),
186 this, SLOT(slotShowDue(bool) ) ); 186 this, SLOT(slotShowDue(bool) ) );
187 187
188 /* templates */ 188 /* templates */
189 m_edit->insertItem(tr("New from template"), m_template, 189 m_edit->insertItem(tr("New from template"), m_template,
190 -1, 0 ); 190 -1, 0 );
191 191
192} 192}
193/* m_curCat from Config */ 193/* m_curCat from Config */
194void MainWindow::initConfig() { 194void MainWindow::initConfig() {
195 Config config( "todo" ); 195 Config config( "todo" );
196 config.setGroup( "View" ); 196 config.setGroup( "View" );
197 m_completed = config.readBoolEntry( "ShowComplete", TRUE ); 197 m_completed = config.readBoolEntry( "ShowComplete", TRUE );
198 m_curCat = config.readEntry( "Category", QString::null ); 198 m_curCat = config.readEntry( "Category", QString::null );
199 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); 199 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE);
200 m_overdue = config.readBoolEntry("ShowOverDue", TRUE ); 200 m_overdue = config.readBoolEntry("ShowOverDue", TRUE );
201} 201}
202void MainWindow::initUI() { 202void MainWindow::initUI() {
203 m_mainBox = new QVBox(this, "main box "); 203 m_mainBox = new QVBox(this, "main box ");
204 m_curQuick = new QuickEditImpl(this, m_mainBox ); 204 m_curQuick = new QuickEditImpl(this, m_mainBox );
205 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); 205 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) );
206 m_quickEdit.append( m_curQuick ); 206 m_quickEdit.append( m_curQuick );
207 207
208 208
209 209
210 m_stack = new QWidgetStack(m_mainBox, "main stack"); 210 m_stack = new QWidgetStack(m_mainBox, "main stack");
211 setCentralWidget( m_mainBox ); 211 setCentralWidget( m_mainBox );
212 212
213 setToolBarsMovable( FALSE ); 213 setToolBarsMovable( FALSE );
214 214
215 m_tool = new QToolBar( this ); 215 m_tool = new QToolBar( this );
216 m_tool->setHorizontalStretchable( TRUE ); 216 m_tool->setHorizontalStretchable( TRUE );
217 217
218 m_bar = new QMenuBar( m_tool ); 218 m_bar = new QMenuBar( m_tool );
219 219
220 /** QPopupMenu */ 220 /** QPopupMenu */
221 m_edit = new QPopupMenu( this ); 221 m_edit = new QPopupMenu( this );
222 m_options = new QPopupMenu( this ); 222 m_options = new QPopupMenu( this );
223 m_catMenu = new QPopupMenu( this ); 223 m_catMenu = new QPopupMenu( this );
224 m_template = new QPopupMenu( this ); 224 m_template = new QPopupMenu( this );
225 225
226 m_catMenu->setCheckable( TRUE ); 226 m_catMenu->setCheckable( TRUE );
227 m_template->setCheckable( TRUE ); 227 m_template->setCheckable( TRUE );
228 228
229 connect(m_catMenu, SIGNAL(activated(int) ), 229 connect(m_catMenu, SIGNAL(activated(int) ),
230 this, SLOT(setCategory(int) ) ); 230 this, SLOT(setCategory(int) ) );
231 connect(m_template, SIGNAL(activated(int) ), 231 connect(m_template, SIGNAL(activated(int) ),
232 this, SLOT(slotNewFromTemplate(int) ) ); 232 this, SLOT(slotNewFromTemplate(int) ) );
233} 233}
234void MainWindow::initViews() { 234void MainWindow::initViews() {
235 TableView* tableView = new TableView( this, m_stack ); 235 TableView* tableView = new TableView( this, m_stack );
236 m_stack->addWidget( tableView, m_counter++ ); 236 m_stack->addWidget( tableView, m_counter++ );
237 m_views.append( tableView ); 237 m_views.append( tableView );
238 m_curView = tableView; 238 m_curView = tableView;
239 connectBase( tableView ); 239 connectBase( tableView );
240 /* add QString type + QString configname to 240 /* add QString type + QString configname to
241 * the View menu 241 * the View menu
242 * and subdirs for multiple views 242 * and subdirs for multiple views
243 */ 243 */
244} 244}
245void MainWindow::initEditor() { 245void MainWindow::initEditor() {
246 m_curEdit = new Editor(); 246 m_curEdit = new Editor();
247} 247}
248void MainWindow::initShow() { 248void MainWindow::initShow() {
249 m_curShow = new TextViewShow(this); 249 m_curShow = new TextViewShow(this);
250 m_stack->addWidget( m_curShow->widget() , m_counter++ ); 250 m_stack->addWidget( m_curShow->widget() , m_counter++ );
251} 251}
252MainWindow::~MainWindow() { 252MainWindow::~MainWindow() {
253 delete templateManager(); 253 delete templateManager();
254} 254}
255void MainWindow::connectBase( ViewBase* base) { 255void MainWindow::connectBase( ViewBase* ) {
256 // once templates and signals mix we'll use it again 256 // once templates and signals mix we'll use it again
257} 257}
258QPopupMenu* MainWindow::contextMenu( int , bool recur ) { 258QPopupMenu* MainWindow::contextMenu( int , bool recur ) {
259 QPopupMenu* menu = new QPopupMenu(); 259 QPopupMenu* menu = new QPopupMenu();
260 260
261 m_editAction->addTo( menu ); 261 m_editAction->addTo( menu );
262 m_deleteAction->addTo( menu ); 262 m_deleteAction->addTo( menu );
263 m_duplicateAction->addTo( menu ); 263 m_duplicateAction->addTo( menu );
264 264
265 menu->insertSeparator(); 265 menu->insertSeparator();
266 266
267 /* 267 /*
268 * if this event recurs we allow 268 * if this event recurs we allow
269 * to detach it. 269 * to detach it.
270 * remove all 270 * remove all
271 */ 271 */
272 if ( recur ) { 272 if ( recur ) {
273 ; // FIXME 273 ; // FIXME
274 } 274 }
275 275
276 return menu; 276 return menu;
277} 277}
278QPopupMenu* MainWindow::options() { 278QPopupMenu* MainWindow::options() {
279 qWarning("Options"); 279 qWarning("Options");
280 return m_options; 280 return m_options;
281} 281}
282QPopupMenu* MainWindow::edit() { 282QPopupMenu* MainWindow::edit() {
283 return m_edit; 283 return m_edit;
284} 284}
285QToolBar* MainWindow::toolbar() { 285QToolBar* MainWindow::toolbar() {
286 return m_tool; 286 return m_tool;
287} 287}
288OTodoAccess::List MainWindow::list()const { 288OTodoAccess::List MainWindow::list()const {
289 return m_todoMgr.list(); 289 return m_todoMgr.list();
290} 290}
291OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { 291OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
292 int cat = 0; 292 int cat = 0;
293 if ( m_curCat != tr("All Categories") ) 293 if ( m_curCat != tr("All Categories") )
294 cat = currentCatId(); 294 cat = currentCatId();
295 295
296 int filter = 1; 296 int filter = 1;
297 297
298 if (!m_completed ) 298 if (!m_completed )
299 filter |= 4; 299 filter |= 4;
300 if (m_overdue) 300 if (m_overdue)
301 filter |= 2; 301 filter |= 2;
302 302
303 return m_todoMgr.sorted( asc, sortOrder, filter, cat ); 303 return m_todoMgr.sorted( asc, sortOrder, filter, cat );
304} 304}
305OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { 305OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
306 int cat = 0; 306 int cat = 0;
307 if ( m_curCat != tr("All Categories") ) 307 if ( m_curCat != tr("All Categories") )
308 cat = currentCatId(); 308 cat = currentCatId();
309 309
310 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); 310 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat );
311} 311}
312OTodo MainWindow::event( int uid ) { 312OTodo MainWindow::event( int uid ) {
313 return m_todoMgr.event( uid ); 313 return m_todoMgr.event( uid );
314} 314}
315bool MainWindow::isSyncing()const { 315bool MainWindow::isSyncing()const {
316 return m_syncing; 316 return m_syncing;
317} 317}
318TemplateManager* MainWindow::templateManager() { 318TemplateManager* MainWindow::templateManager() {
319 return m_tempManager; 319 return m_tempManager;
320} 320}
321Editor* MainWindow::currentEditor() { 321Editor* MainWindow::currentEditor() {
322 return m_curEdit; 322 return m_curEdit;
323} 323}
324TodoShow* MainWindow::currentShow() { 324TodoShow* MainWindow::currentShow() {
325 return m_curShow; 325 return m_curShow;
326} 326}
327void MainWindow::slotReload() { 327void MainWindow::slotReload() {
328 m_todoMgr.reload(); 328 m_todoMgr.reload();
329 currentView()->updateView( ); 329 currentView()->updateView( );
330 raiseCurrentView(); 330 raiseCurrentView();
331} 331}
332void MainWindow::closeEvent( QCloseEvent* e ) { 332void MainWindow::closeEvent( QCloseEvent* e ) {
333 if (m_stack->visibleWidget() == currentShow()->widget() ) { 333 if (m_stack->visibleWidget() == currentShow()->widget() ) {
334 raiseCurrentView(); 334 raiseCurrentView();
335 e->ignore(); 335 e->ignore();
336 return; 336 return;
337 } 337 }
338 /* 338 /*
339 * we should have flushed and now we're still saving 339 * we should have flushed and now we're still saving
340 * so there is no need to flush 340 * so there is no need to flush
341 */ 341 */
342 if (m_syncing ) { 342 if (m_syncing ) {
343 e->accept(); 343 e->accept();
344 return; 344 return;
345 } 345 }
346 bool quit = false; 346 bool quit = false;
347 if ( m_todoMgr.saveAll() ){ 347 if ( m_todoMgr.saveAll() ){
348 qWarning("saved"); 348 qWarning("saved");
349 quit = true; 349 quit = true;
350 }else { 350 }else {
351 if ( QMessageBox::critical( this, tr("Out of space"), 351 if ( QMessageBox::critical( this, tr("Out of space"),
@@ -704,102 +704,96 @@ void MainWindow::slotComplete( const OTodo& todo ) {
704 to.setUid( 1 ); 704 to.setUid( 1 );
705 705
706 /* add the old one cause it has a new UID here cause it was spin off */ 706 /* add the old one cause it has a new UID here cause it was spin off */
707 m_todoMgr.add( to ); 707 m_todoMgr.add( to );
708 708
709 /* 709 /*
710 * update the due date 710 * update the due date
711 * start date 711 * start date
712 * and complete date 712 * and complete date
713 */ 713 */
714 to2.setDueDate( date ); 714 to2.setDueDate( date );
715 to2.setStartDate( inval ); 715 to2.setStartDate( inval );
716 to2.setCompletedDate( inval ); 716 to2.setCompletedDate( inval );
717 to2.setCompleted( false ); 717 to2.setCompleted( false );
718 updateTodo( to2 ); 718 updateTodo( to2 );
719 }else 719 }else
720 updateTodo( to ); 720 updateTodo( to );
721 }else 721 }else
722 updateTodo( to ); 722 updateTodo( to );
723 723
724 currentView()->updateView(); 724 currentView()->updateView();
725 raiseCurrentView(); 725 raiseCurrentView();
726} 726}
727void MainWindow::flush() { 727void MainWindow::flush() {
728 slotFlush(); 728 slotFlush();
729} 729}
730void MainWindow::reload() { 730void MainWindow::reload() {
731 slotReload(); 731 slotReload();
732} 732}
733int MainWindow::create() { 733int MainWindow::create() {
734 int uid = 0; 734 int uid = 0;
735 if(m_syncing) { 735 if(m_syncing) {
736 QMessageBox::warning(this, tr("Todo"), 736 QMessageBox::warning(this, tr("Todo"),
737 tr("Can not edit data, currently syncing")); 737 tr("Can not edit data, currently syncing"));
738 return uid; 738 return uid;
739 } 739 }
740 740
741 741
742 OTodo todo = currentEditor()->newTodo( currentCatId(), 742 OTodo todo = currentEditor()->newTodo( currentCatId(),
743 this ); 743 this );
744 744
745 if ( currentEditor()->accepted() ) { 745 if ( currentEditor()->accepted() ) {
746 //todo.assignUid(); 746 //todo.assignUid();
747 uid = todo.uid(); 747 uid = todo.uid();
748 m_todoMgr.add( todo ); 748 m_todoMgr.add( todo );
749 currentView()->addEvent( todo ); 749 currentView()->addEvent( todo );
750 750
751 751
752 // I'm afraid we must call this every time now, otherwise 752 // I'm afraid we must call this every time now, otherwise
753 // spend expensive time comparing all these strings... 753 // spend expensive time comparing all these strings...
754 // but only call if we changed something -zecke 754 // but only call if we changed something -zecke
755 populateCategories(); 755 populateCategories();
756 } 756 }
757 raiseCurrentView( ); 757 raiseCurrentView( );
758 758
759 return uid; 759 return uid;
760} 760}
761/* delete it silently... */ 761/* delete it silently... */
762bool MainWindow::remove( int uid ) { 762bool MainWindow::remove( int uid ) {
763 if (m_syncing) return false; 763 if (m_syncing) return false;
764 764
765 return m_todoMgr.remove( uid ); 765 return m_todoMgr.remove( uid );
766} 766}
767void MainWindow::beam( int uid, int ) { 767void MainWindow::beam( int uid, int ) {
768 ::unlink( beamfile ); 768 ::unlink( beamfile );
769 OTodo todo = event( uid ); 769 OTodo todo = event( uid );
770 OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); 770 OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) );
771 OTodoAccess acc( cal ); 771 OTodoAccess acc( cal );
772 acc.load(); 772 acc.load();
773 acc.add( todo ); 773 acc.add( todo );
774 acc.save(); 774 acc.save();
775 Ir* ir = new Ir(this ); 775 Ir* ir = new Ir(this );
776 connect(ir, SIGNAL(done(Ir*) ), 776 connect(ir, SIGNAL(done(Ir*) ),
777 this, SLOT(beamDone(Ir*) ) ); 777 this, SLOT(beamDone(Ir*) ) );
778 ir->send( beamfile, todo.summary(), "text/x-vCalendar" ); 778 ir->send( beamfile, todo.summary(), "text/x-vCalendar" );
779} 779}
780void MainWindow::show( int uid ) { 780void MainWindow::show( int uid ) {
781 slotShow( uid ); 781 slotShow( uid );
782} 782}
783void MainWindow::edit( int uid ) { 783void MainWindow::edit( int uid ) {
784 slotEdit( uid ); 784 slotEdit( uid );
785} 785}
786void MainWindow::add( const OPimRecord& rec) { 786void MainWindow::add( const OPimRecord& rec) {
787 if ( rec.rtti() != OTodo::rtti() ) return; 787 if ( rec.rtti() != OTodo::rtti() ) return;
788 788
789 const OTodo& todo = static_cast<const OTodo&>(rec); 789 const OTodo& todo = static_cast<const OTodo&>(rec);
790 790
791 m_todoMgr.add(todo ); 791 m_todoMgr.add(todo );
792 currentView()->addEvent( todo ); 792 currentView()->addEvent( todo );
793 793
794 794
795 // I'm afraid we must call this every time now, otherwise 795 // I'm afraid we must call this every time now, otherwise
796 // spend expensive time comparing all these strings... 796 // spend expensive time comparing all these strings...
797 // but only call if we changed something -zecke 797 // but only call if we changed something -zecke
798 populateCategories(); 798 populateCategories();
799} 799}
800/* todo does not have the QDataStream<< and >> operators implemented :(
801 * FIXME
802 */
803OPimRecord* MainWindow::record( int rtti, const QByteArray& ) {
804 return 0l;
805}
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h
index 14cfa82..87a9133 100644
--- a/core/pim/todo/mainwindow.h
+++ b/core/pim/todo/mainwindow.h
@@ -103,101 +103,100 @@ private slots:
103 private: 103 private:
104 void receiveFile( const QString& filename ); 104 void receiveFile( const QString& filename );
105 void connectBase( ViewBase* ); 105 void connectBase( ViewBase* );
106 void initUI(); 106 void initUI();
107 void initActions(); 107 void initActions();
108 void initConfig(); 108 void initConfig();
109 void initViews(); 109 void initViews();
110 void initEditor(); 110 void initEditor();
111 void initShow(); 111 void initShow();
112 void initTemplate(); 112 void initTemplate();
113 void raiseCurrentView(); 113 void raiseCurrentView();
114 ViewBase* currentView(); 114 ViewBase* currentView();
115 ViewBase* m_curView; 115 ViewBase* m_curView;
116 QuickEditBase* m_curQuick; 116 QuickEditBase* m_curQuick;
117 Editor* m_curEdit; 117 Editor* m_curEdit;
118 TodoShow* currentShow(); 118 TodoShow* currentShow();
119 TodoShow* m_curShow; 119 TodoShow* m_curShow;
120 TemplateEditor* currentTemplateEditor(); 120 TemplateEditor* currentTemplateEditor();
121 TemplateEditor* m_curTempEd; 121 TemplateEditor* m_curTempEd;
122 122
123 QMenuBar* m_bar; 123 QMenuBar* m_bar;
124 QToolBar* m_tool; 124 QToolBar* m_tool;
125 QAction* m_editAction, 125 QAction* m_editAction,
126 *m_deleteAction, 126 *m_deleteAction,
127 *m_findAction, 127 *m_findAction,
128 *m_completedAction, 128 *m_completedAction,
129 *m_showDeadLineAction, 129 *m_showDeadLineAction,
130 *m_deleteAllAction, 130 *m_deleteAllAction,
131 *m_deleteCompleteAction, 131 *m_deleteCompleteAction,
132 *m_duplicateAction, 132 *m_duplicateAction,
133 *m_showOverDueAction, 133 *m_showOverDueAction,
134 *m_effectiveAction; 134 *m_effectiveAction;
135 QWidgetStack *m_stack; 135 QWidgetStack *m_stack;
136 QPopupMenu* m_catMenu, 136 QPopupMenu* m_catMenu,
137 *m_edit, 137 *m_edit,
138 *m_options, 138 *m_options,
139 *m_template; 139 *m_template;
140 /* box with two rows 140 /* box with two rows
141 * top will be the quick edit 141 * top will be the quick edit
142 * this will bite my ass once 142 * this will bite my ass once
143 * we want to have all parts 143 * we want to have all parts
144 * exchangeable 144 * exchangeable
145 */ 145 */
146 QVBox* m_mainBox; 146 QVBox* m_mainBox;
147 147
148 bool m_syncing:1; 148 bool m_syncing:1;
149 bool m_deadline:1; 149 bool m_deadline:1;
150 bool m_completed:1; 150 bool m_completed:1;
151 bool m_overdue:1; 151 bool m_overdue:1;
152 TodoManager m_todoMgr; 152 TodoManager m_todoMgr;
153 QString m_curCat; 153 QString m_curCat;
154 QList<ViewBase> m_views; 154 QList<ViewBase> m_views;
155 QList<QuickEditBase> m_quickEdit; 155 QList<QuickEditBase> m_quickEdit;
156 uint m_counter; 156 uint m_counter;
157 TemplateManager* m_tempManager; 157 TemplateManager* m_tempManager;
158 158
159 159
160 private slots: 160 private slots:
161 void slotShow(int); 161 void slotShow(int);
162 void slotEdit(int); 162 void slotEdit(int);
163 void slotUpdate3( QWidget* ); 163 void slotUpdate3( QWidget* );
164 void slotComplete( int uid ); 164 void slotComplete( int uid );
165 void slotComplete( const OTodo& ev ); 165 void slotComplete( const OTodo& ev );
166 void slotNewFromTemplate(int id ); 166 void slotNewFromTemplate(int id );
167 void slotNew(); 167 void slotNew();
168 void slotDuplicate(); 168 void slotDuplicate();
169 169
170 void slotDelete(); 170 void slotDelete();
171 void slotDeleteAll(); 171 void slotDeleteAll();
172 void slotDeleteCompleted(); 172 void slotDeleteCompleted();
173 173
174 void slotEdit(); 174 void slotEdit();
175 void slotFind(); 175 void slotFind();
176 176
177 void setCategory( int ); 177 void setCategory( int );
178 178
179 void slotShowDeadLine( bool ); 179 void slotShowDeadLine( bool );
180 void slotShowCompleted( bool ); 180 void slotShowCompleted( bool );
181 181
182 void setDocument( const QString& ); 182 void setDocument( const QString& );
183 183
184 184
185 void slotBeam(); 185 void slotBeam();
186 void beamDone( Ir* ); 186 void beamDone( Ir* );
187 void slotShowDetails(); 187 void slotShowDetails();
188 void slotShowDue( bool ); 188 void slotShowDue( bool );
189 /* reimplementation from opimmainwindow */ 189 /* reimplementation from opimmainwindow */
190 protected slots: 190 protected slots:
191 void flush(); 191 void flush();
192 void reload(); 192 void reload();
193 int create(); 193 int create();
194 bool remove( int uid ); 194 bool remove( int uid );
195 void beam(int uid, int transport = IrDa ); 195 void beam(int uid, int transport = IrDa );
196 void show( int uid ); 196 void show( int uid );
197 void edit( int uid ); 197 void edit( int uid );
198 void add( const OPimRecord& ); 198 void add( const OPimRecord& );
199 OPimRecord* record( int rtti, const QByteArray& );
200 }; 199 };
201}; 200};
202 201
203#endif 202#endif
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index 0f683c9..2434150 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -77,199 +77,199 @@ TableView::TableView( MainWindow* window, QWidget* wid )
77 horizontalHeader()->setLabel(0, tr("C.") ); 77 horizontalHeader()->setLabel(0, tr("C.") );
78 horizontalHeader()->setLabel(1, tr("Prior.") ); 78 horizontalHeader()->setLabel(1, tr("Prior.") );
79 horizontalHeader()->setLabel(2, tr("Description" ) ); 79 horizontalHeader()->setLabel(2, tr("Description" ) );
80 80
81// setColumnStretchable(3, FALSE ); 81// setColumnStretchable(3, FALSE );
82 82
83 horizontalHeader()->setLabel(3, tr("Deadline") ); 83 horizontalHeader()->setLabel(3, tr("Deadline") );
84 84
85 if ( todoWindow()->showDeadline() ) 85 if ( todoWindow()->showDeadline() )
86 showColumn( 3); 86 showColumn( 3);
87 else 87 else
88 hideColumn(3 ); 88 hideColumn(3 );
89 89
90 connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ), 90 connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ),
91 this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); 91 this, SLOT( slotClicked(int, int, int, const QPoint& ) ) );
92 connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), 92 connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ),
93 this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); 93 this, SLOT( slotPressed(int, int, int, const QPoint& ) ) );
94 connect((QTable*)this, SIGNAL(valueChanged(int, int) ), 94 connect((QTable*)this, SIGNAL(valueChanged(int, int) ),
95 this, SLOT( slotValueChanged(int, int) ) ); 95 this, SLOT( slotValueChanged(int, int) ) );
96 connect((QTable*)this, SIGNAL(currentChanged(int, int) ), 96 connect((QTable*)this, SIGNAL(currentChanged(int, int) ),
97 this, SLOT( slotCurrentChanged(int, int) ) ); 97 this, SLOT( slotCurrentChanged(int, int) ) );
98 98
99 m_menuTimer = new QTimer( this ); 99 m_menuTimer = new QTimer( this );
100 connect( m_menuTimer, SIGNAL(timeout()), 100 connect( m_menuTimer, SIGNAL(timeout()),
101 this, SLOT(slotShowMenu()) ); 101 this, SLOT(slotShowMenu()) );
102 102
103 m_enablePaint = true; 103 m_enablePaint = true;
104 setUpdatesEnabled( true ); 104 setUpdatesEnabled( true );
105 viewport()->setUpdatesEnabled( true ); 105 viewport()->setUpdatesEnabled( true );
106 viewport()->update(); 106 viewport()->update();
107 setSortOrder( 0 ); 107 setSortOrder( 0 );
108 setAscending( TRUE ); 108 setAscending( TRUE );
109 m_first = true; 109 m_first = true;
110 110
111 /* now let's init the config */ 111 /* now let's init the config */
112 initConfig(); 112 initConfig();
113} 113}
114/* a new day has started 114/* a new day has started
115 * update the day 115 * update the day
116 */ 116 */
117void TableView::newDay() { 117void TableView::newDay() {
118 clear(); 118 clear();
119 updateView(); 119 updateView();
120} 120}
121TableView::~TableView() { 121TableView::~TableView() {
122 122
123} 123}
124void TableView::slotShowMenu() { 124void TableView::slotShowMenu() {
125 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); 125 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() );
126 menu->exec(QCursor::pos() ); 126 menu->exec(QCursor::pos() );
127 delete menu; 127 delete menu;
128} 128}
129QString TableView::type() const { 129QString TableView::type() const {
130 return QString::fromLatin1( tr("Table View") ); 130 return QString::fromLatin1( tr("Table View") );
131} 131}
132int TableView::current() { 132int TableView::current() {
133 int uid = sorted().uidAt(currentRow() ); 133 int uid = sorted().uidAt(currentRow() );
134 134
135 return uid; 135 return uid;
136} 136}
137QString TableView::currentRepresentation() { 137QString TableView::currentRepresentation() {
138 OTodo to = sorted()[currentRow()]; 138 OTodo to = sorted()[currentRow()];
139 return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; 139 return to.summary().isEmpty() ? to.description().left(20) : to.summary() ;
140} 140}
141/* show overdue */ 141/* show overdue */
142void TableView::showOverDue( bool ) { 142void TableView::showOverDue( bool ) {
143 clear(); 143 clear();
144 updateView(); 144 updateView();
145} 145}
146 146
147void TableView::updateView( ) { 147void TableView::updateView( ) {
148 qWarning("update view"); 148 qWarning("update view");
149 m_row = false; 149 m_row = false;
150 static int id; 150 static int id;
151 id = startTimer(4000 ); 151 id = startTimer(4000 );
152 /* FIXME we want one page to be read! 152 /* FIXME we want one page to be read!
153 * 153 *
154 * Calculate that screensize 154 * Calculate that screensize
155 */ 155 */
156 todoWindow()->setReadAhead( 4 ); 156 todoWindow()->setReadAhead( 4 );
157 sort(); 157 sort();
158 OTodoAccess::List::Iterator it, end; 158 OTodoAccess::List::Iterator it, end;
159 it = sorted().begin(); 159 it = sorted().begin();
160 end = sorted().end(); 160 end = sorted().end();
161 161
162 qWarning("setTodos"); 162 qWarning("setTodos");
163 QTime time; 163 QTime time;
164 time.start(); 164 time.start();
165 m_enablePaint = false; 165 m_enablePaint = false;
166 setUpdatesEnabled( false ); 166 setUpdatesEnabled( false );
167 viewport()->setUpdatesEnabled( false ); 167 viewport()->setUpdatesEnabled( false );
168 168
169 setNumRows( it.count() ); 169 setNumRows( it.count() );
170 if ( it.count() == 0 ) 170 if ( it.count() == 0 )
171 killTimer(id); 171 killTimer(id);
172 172
173 int elc = time.elapsed(); 173// int elc = time.elapsed();
174 setUpdatesEnabled( true ); 174 setUpdatesEnabled( true );
175 viewport()->setUpdatesEnabled( true ); 175 viewport()->setUpdatesEnabled( true );
176 viewport()->update(); 176 viewport()->update();
177 177
178 m_enablePaint = true; 178 m_enablePaint = true;
179 int el = time.elapsed(); 179// int el = time.elapsed();
180} 180}
181void TableView::setTodo( int, const OTodo&) { 181void TableView::setTodo( int, const OTodo&) {
182 sort(); 182 sort();
183 183
184 /* repaint */ 184 /* repaint */
185 repaint(); 185 repaint();
186} 186}
187void TableView::addEvent( const OTodo&) { 187void TableView::addEvent( const OTodo&) {
188 188
189 /* fix problems of not showing the 'Haken' */ 189 /* fix problems of not showing the 'Haken' */
190 updateView(); 190 updateView();
191} 191}
192/* 192/*
193 * find the event 193 * find the event
194 * and then replace the complete row 194 * and then replace the complete row
195 */ 195 */
196void TableView::replaceEvent( const OTodo& ev) { 196void TableView::replaceEvent( const OTodo& ev) {
197 addEvent( ev ); 197 addEvent( ev );
198} 198}
199/* 199/*
200 * re aligning table can be slow too 200 * re aligning table can be slow too
201 * FIXME: look what performs better 201 * FIXME: look what performs better
202 * either this or the old align table 202 * either this or the old align table
203 */ 203 */
204void TableView::removeEvent( int ) { 204void TableView::removeEvent( int ) {
205 updateView(); 205 updateView();
206} 206}
207void TableView::setShowCompleted( bool b) { 207void TableView::setShowCompleted( bool b) {
208 qWarning("Show Completed %d" + b ); 208 qWarning("Show Completed %d" + b );
209 updateView(); 209 updateView();
210} 210}
211void TableView::setShowDeadline( bool b) { 211void TableView::setShowDeadline( bool b) {
212 qWarning("Show DeadLine %d" + b ); 212 qWarning("Show DeadLine %d" + b );
213 if (b) 213 if (b)
214 showColumn(3 ); 214 showColumn(3 );
215 else 215 else
216 hideColumn(3 ); 216 hideColumn(3 );
217} 217}
218void TableView::setShowCategory( const QString& str) { 218void TableView::setShowCategory( const QString& str) {
219 qWarning("setShowCategory"); 219 qWarning("setShowCategory");
220 if ( str != m_oleCat || m_first ) 220 if ( str != m_oleCat || m_first )
221 updateView(); 221 updateView();
222 222
223 m_oleCat = str; 223 m_oleCat = str;
224 m_first = false; 224 m_first = false;
225 225
226} 226}
227void TableView::clear() { 227void TableView::clear() {
228 setNumRows(0); 228 setNumRows(0);
229} 229}
230void TableView::slotClicked(int row, int col, int, 230void TableView::slotClicked(int row, int col, int,
231 const QPoint& point) { 231 const QPoint& point) {
232 if ( !cellGeometry(row, col ).contains(point ) ) 232 if ( !cellGeometry(row, col ).contains(point ) )
233 return; 233 return;
234 234
235 int ui= sorted().uidAt( row ); 235 int ui= sorted().uidAt( row );
236 236
237 237
238 switch( col ) { 238 switch( col ) {
239 case 0:{ 239 case 0:{
240 int x = point.x() -columnPos( col ); 240 int x = point.x() -columnPos( col );
241 int y = point.y() -rowPos( row ); 241 int y = point.y() -rowPos( row );
242 int w = columnWidth( col ); 242 int w = columnWidth( col );
243 int h = rowHeight( row ); 243 int h = rowHeight( row );
244 if ( x >= ( w - BoxSize ) / 2 && 244 if ( x >= ( w - BoxSize ) / 2 &&
245 x <= ( w - BoxSize ) / 2 + BoxSize && 245 x <= ( w - BoxSize ) / 2 + BoxSize &&
246 y >= ( h - BoxSize ) / 2 && 246 y >= ( h - BoxSize ) / 2 &&
247 y <= ( h - BoxSize ) / 2 + BoxSize ) { 247 y <= ( h - BoxSize ) / 2 + BoxSize ) {
248 TodoView::complete(sorted()[row] ); 248 TodoView::complete(sorted()[row] );
249 } 249 }
250 } 250 }
251 break; 251 break;
252 252
253 case 1: 253 case 1:
254 break; 254 break;
255 255
256 case 2: { 256 case 2: {
257 m_menuTimer->stop(); 257 m_menuTimer->stop();
258 showTodo( ui ); 258 showTodo( ui );
259 break; 259 break;
260 } 260 }
261 case 3: { 261 case 3: {
262 m_menuTimer->stop(); 262 m_menuTimer->stop();
263 TodoView::edit( ui ); 263 TodoView::edit( ui );
264 break; 264 break;
265 } 265 }
266 } 266 }
267 267
268 268
269} 269}
270void TableView::slotPressed(int row, int col, int, 270void TableView::slotPressed(int row, int col, int,
271 const QPoint& point) { 271 const QPoint& point) {
272 272
273 qWarning("pressed row %d col %d x:%d+y:%d", row,col,point.x(),point.y() ); 273 qWarning("pressed row %d col %d x:%d+y:%d", row,col,point.x(),point.y() );
274 m_prevP = point; 274 m_prevP = point;
275 /* TextColumn column */ 275 /* TextColumn column */
diff --git a/core/pim/todo/todoeditor.cpp b/core/pim/todo/todoeditor.cpp
index 9b8c5cb..5aa7097 100644
--- a/core/pim/todo/todoeditor.cpp
+++ b/core/pim/todo/todoeditor.cpp
@@ -1,67 +1,67 @@
1 1
2#include "otaskeditor.h" 2#include "otaskeditor.h"
3#include "todoeditor.h" 3#include "todoeditor.h"
4 4
5using namespace Todo; 5using namespace Todo;
6 6
7Editor::Editor() { 7Editor::Editor() {
8 m_accepted = false; 8 m_accepted = false;
9 m_self = 0l; 9 m_self = 0l;
10} 10}
11Editor::~Editor() { 11Editor::~Editor() {
12 delete m_self; 12 delete m_self;
13 m_self = 0; 13 m_self = 0;
14} 14}
15OTodo Editor::newTodo( int cur, 15OTodo Editor::newTodo( int cur,
16 QWidget*) { 16 QWidget*) {
17 17
18 OTaskEditor *e = self(); 18 OTaskEditor *e = self();
19 e->setCaption( QObject::tr("Enter Task") ); 19 e->setCaption( QObject::tr("Enter Task") );
20 e->init( cur ); 20 e->init( cur );
21 21
22 22
23#if defined(Q_WS_QWS) || defined(_WS_QWS_) 23#if defined(Q_WS_QWS) || defined(_WS_QWS_)
24 e->showMaximized(); 24 e->showMaximized();
25#endif 25#endif
26 26
27 int ret = e->exec(); 27 int ret = e->exec();
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 OTodo ev = e->todo(); 33 OTodo ev = e->todo();
34 qWarning("Todo uid"); 34 qWarning("Todo uid");
35 qWarning("Todo %s %d %d", ev.summary().latin1(), ev.progress(), ev.isCompleted() ); 35 qWarning("Todo %s %d %d", ev.summary().latin1(), ev.progress(), ev.isCompleted() );
36 ev.setUid(1); 36 ev.setUid(1);
37 37
38 return ev; 38 return ev;
39} 39}
40OTodo Editor::edit( QWidget *wid, 40OTodo Editor::edit( QWidget *,
41 const OTodo& todo ) { 41 const OTodo& todo ) {
42 OTaskEditor *e = self(); 42 OTaskEditor *e = self();
43 e->init( todo ); 43 e->init( todo );
44 e->setCaption( QObject::tr( "Edit Task" ) ); 44 e->setCaption( QObject::tr( "Edit Task" ) );
45 45
46#if defined(Q_WS_QWS) || defined(_WS_QWS_) 46#if defined(Q_WS_QWS) || defined(_WS_QWS_)
47 e->showMaximized(); 47 e->showMaximized();
48#endif 48#endif
49 int ret = e->exec(); 49 int ret = e->exec();
50 50
51 OTodo ev = e->todo(); 51 OTodo ev = e->todo();
52 if ( ret == QDialog::Accepted ) 52 if ( ret == QDialog::Accepted )
53 m_accepted = true; 53 m_accepted = true;
54 else 54 else
55 m_accepted = false; 55 m_accepted = false;
56 56
57 return ev; 57 return ev;
58} 58}
59bool Editor::accepted()const { 59bool Editor::accepted()const {
60 return m_accepted; 60 return m_accepted;
61} 61}
62OTaskEditor* Editor::self() { 62OTaskEditor* Editor::self() {
63 if (!m_self ) 63 if (!m_self )
64 m_self = new OTaskEditor(0); 64 m_self = new OTaskEditor(0);
65 65
66 return m_self; 66 return m_self;
67} 67}