summaryrefslogtreecommitdiff
path: root/core/pim/todo/mainwindow.cpp
authorzecke <zecke>2002-10-07 14:39:07 (UTC)
committer zecke <zecke>2002-10-07 14:39:07 (UTC)
commita7b03f9c31f515747663f07b6665744369e57ba8 (patch) (unidiff)
tree3799a9001d60eac5d8212596c6ce012082d42cf6 /core/pim/todo/mainwindow.cpp
parentadd436706a938a71a487db019dcd6ff236207bfc (diff)
downloadopie-a7b03f9c31f515747663f07b6665744369e57ba8.zip
opie-a7b03f9c31f515747663f07b6665744369e57ba8.tar.gz
opie-a7b03f9c31f515747663f07b6665744369e57ba8.tar.bz2
TodoView is a mess because I tried hard to make
it work with templates... I've to clean this up Then I made the way free to use sorted my next step is to make the paint hack work
Diffstat (limited to 'core/pim/todo/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index a8f4c9c..47c0160 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -216,26 +216,24 @@ void MainWindow::initUI() {
216 216
217 connect(m_catMenu, SIGNAL(activated(int) ), 217 connect(m_catMenu, SIGNAL(activated(int) ),
218 this, SLOT(setCategory(int) ) ); 218 this, SLOT(setCategory(int) ) );
219 connect(m_template, SIGNAL(activated(int) ), 219 connect(m_template, SIGNAL(activated(int) ),
220 this, SLOT(slotNewFromTemplate(int) ) ); 220 this, SLOT(slotNewFromTemplate(int) ) );
221} 221}
222void MainWindow::initViews() { 222void MainWindow::initViews() {
223 TableView* tableView = new TableView( this, this ); 223 TableView* tableView = new TableView( this, this );
224 m_stack->addWidget( tableView, m_counter++ ); 224 m_stack->addWidget( tableView, m_counter++ );
225 m_views.append( tableView ); 225 m_views.append( tableView );
226 m_curView = tableView; 226 m_curView = tableView;
227 connectBase( tableView ); 227 connectBase( tableView );
228// tableView->setTodos( begin(), end() ); we call populateCategories
229
230 /* add QString type + QString configname to 228 /* add QString type + QString configname to
231 * the View menu 229 * the View menu
232 * and subdirs for multiple views 230 * and subdirs for multiple views
233 */ 231 */
234} 232}
235void MainWindow::initEditor() { 233void MainWindow::initEditor() {
236 m_curEdit = new Editor(); 234 m_curEdit = new Editor();
237} 235}
238void MainWindow::initShow() { 236void MainWindow::initShow() {
239 m_curShow = new TextViewShow(this); 237 m_curShow = new TextViewShow(this);
240 m_stack->addWidget( m_curShow->widget() , m_counter++ ); 238 m_stack->addWidget( m_curShow->widget() , m_counter++ );
241} 239}
@@ -267,48 +265,66 @@ QPopupMenu* MainWindow::options() {
267 qWarning("Options"); 265 qWarning("Options");
268 return m_options; 266 return m_options;
269} 267}
270QPopupMenu* MainWindow::edit() { 268QPopupMenu* MainWindow::edit() {
271 return m_edit; 269 return m_edit;
272} 270}
273QPopupMenu* MainWindow::view() { 271QPopupMenu* MainWindow::view() {
274 return m_view; 272 return m_view;
275} 273}
276QToolBar* MainWindow::toolbar() { 274QToolBar* MainWindow::toolbar() {
277 return m_tool; 275 return m_tool;
278} 276}
279OTodoAccess::List::Iterator MainWindow::begin() { 277OTodoAccess::List MainWindow::list()const {
280 return m_todoMgr.begin(); 278 return m_todoMgr.list();
279}
280OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
281 int cat = 0;
282 if ( m_curCat == tr("All Categories") )
283 cat = currentCatId();
284
285 int filter = 1;
286
287 if (!m_completed )
288 filter |= 4;
289 if (m_overdue)
290 filter |= 2;
291
292 return m_todoMgr.sorted( asc, sortOrder, filter, cat );
281} 293}
282OTodoAccess::List::Iterator MainWindow::end() { 294OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
283 return m_todoMgr.end(); 295 int cat = 0;
296 if ( m_curCat == tr("All Categories") )
297 cat = currentCatId();
298
299 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat );
284} 300}
285OTodo MainWindow::event( int uid ) { 301OTodo MainWindow::event( int uid ) {
286 return m_todoMgr.event( uid ); 302 return m_todoMgr.event( uid );
287} 303}
288bool MainWindow::isSyncing()const { 304bool MainWindow::isSyncing()const {
289 return m_syncing; 305 return m_syncing;
290} 306}
291TemplateManager* MainWindow::templateManager() { 307TemplateManager* MainWindow::templateManager() {
292 return m_tempManager; 308 return m_tempManager;
293} 309}
294Editor* MainWindow::currentEditor() { 310Editor* MainWindow::currentEditor() {
295 return m_curEdit; 311 return m_curEdit;
296} 312}
297TodoShow* MainWindow::currentShow() { 313TodoShow* MainWindow::currentShow() {
298 return m_curShow; 314 return m_curShow;
299} 315}
300void MainWindow::slotReload() { 316void MainWindow::slotReload() {
301 m_todoMgr.reload(); 317 m_todoMgr.reload();
302 currentView()->setTodos( begin(), end() ); 318 currentView()->updateView( );
303 raiseCurrentView(); 319 raiseCurrentView();
304} 320}
305void MainWindow::closeEvent( QCloseEvent* e ) { 321void MainWindow::closeEvent( QCloseEvent* e ) {
306 if (m_stack->visibleWidget() == currentShow()->widget() ) { 322 if (m_stack->visibleWidget() == currentShow()->widget() ) {
307 raiseCurrentView(); 323 raiseCurrentView();
308 e->ignore(); 324 e->ignore();
309 return; 325 return;
310 } 326 }
311 /* 327 /*
312 * we should have flushed and now we're still saving 328 * we should have flushed and now we're still saving
313 * so there is no need to flush 329 * so there is no need to flush
314 */ 330 */
@@ -457,25 +473,25 @@ void MainWindow::slotDeleteAll() {
457} 473}
458void MainWindow::slotDeleteCompleted() { 474void MainWindow::slotDeleteCompleted() {
459 if(m_syncing) { 475 if(m_syncing) {
460 QMessageBox::warning(this, tr("Todo"), 476 QMessageBox::warning(this, tr("Todo"),
461 tr("Can not edit data, currently syncing")); 477 tr("Can not edit data, currently syncing"));
462 return; 478 return;
463 } 479 }
464 480
465 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all completed tasks?") ) ) 481 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all completed tasks?") ) )
466 return; 482 return;
467 483
468 m_todoMgr.remove( currentView()->completed() ); 484 m_todoMgr.remove( currentView()->completed() );
469 currentView()->setTodos( begin(), end() ); 485 currentView()->updateView( );
470} 486}
471void MainWindow::slotFind() { 487void MainWindow::slotFind() {
472 488
473} 489}
474void MainWindow::slotEdit() { 490void MainWindow::slotEdit() {
475 slotEdit( currentView()->current() ); 491 slotEdit( currentView()->current() );
476} 492}
477/* 493/*
478 * set the category 494 * set the category
479 */ 495 */
480void MainWindow::setCategory( int c) { 496void MainWindow::setCategory( int c) {
481 if ( c <= 0 ) return; 497 if ( c <= 0 ) return;