author | zecke <zecke> | 2003-08-27 13:12:10 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-08-27 13:12:10 (UTC) |
commit | e2cbbacc147897a7db1dfe7335397ce980b295cc (patch) (unidiff) | |
tree | 6afbc52fdf2ca5912d20a47eed08141668824782 | |
parent | 2635bf400cb58c11f48477150d6fc4337de12fb0 (diff) | |
download | opie-e2cbbacc147897a7db1dfe7335397ce980b295cc.zip opie-e2cbbacc147897a7db1dfe7335397ce980b295cc.tar.gz opie-e2cbbacc147897a7db1dfe7335397ce980b295cc.tar.bz2 |
-Convert to quick launch as an example
-Fix a bug. If flush() is called m_syncing = true and on reload m_syncing = false
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 10 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 5 | ||||
-rw-r--r-- | core/pim/todo/todo.pro | 28 |
3 files changed, 15 insertions, 28 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 6725951..ecb4e40 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -9,110 +9,113 @@ | |||
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 <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qwidgetstack.h> | 36 | #include <qwidgetstack.h> |
37 | #include <qaction.h> | 37 | #include <qaction.h> |
38 | #include <qtimer.h> | 38 | #include <qtimer.h> |
39 | #include <qvbox.h> | 39 | #include <qvbox.h> |
40 | #include <qlayout.h> | 40 | #include <qlayout.h> |
41 | #include <qlineedit.h> | 41 | #include <qlineedit.h> |
42 | #include <qwhatsthis.h> | 42 | #include <qwhatsthis.h> |
43 | 43 | ||
44 | #include <qpe/applnk.h> | 44 | #include <qpe/applnk.h> |
45 | #include <qpe/config.h> | 45 | #include <qpe/config.h> |
46 | #include <qpe/ir.h> | 46 | #include <qpe/ir.h> |
47 | #include <qpe/resource.h> | 47 | #include <qpe/resource.h> |
48 | #include <qpe/qpemessagebox.h> | 48 | #include <qpe/qpemessagebox.h> |
49 | #include <qpe/alarmserver.h> | 49 | #include <qpe/alarmserver.h> |
50 | #include <qpe/timestring.h> | 50 | #include <qpe/timestring.h> |
51 | #include <qpe/qpeapplication.h> | 51 | #include <qpe/qpeapplication.h> |
52 | 52 | ||
53 | #include <opie/orecur.h> | 53 | #include <opie/orecur.h> |
54 | #include <opie/opimnotifymanager.h> | 54 | #include <opie/opimnotifymanager.h> |
55 | #include <opie/otodoaccessvcal.h> | 55 | #include <opie/otodoaccessvcal.h> |
56 | 56 | ||
57 | #include <opie/oapplicationfactory.h> | ||
58 | |||
57 | #include "quickeditimpl.h" | 59 | #include "quickeditimpl.h" |
58 | #include "todotemplatemanager.h" | 60 | #include "todotemplatemanager.h" |
59 | #include "templateeditor.h" | 61 | #include "templateeditor.h" |
60 | #include "tableview.h" | 62 | #include "tableview.h" |
61 | 63 | ||
62 | #include "textviewshow.h" | 64 | #include "textviewshow.h" |
63 | #include "todoeditor.h" | 65 | #include "todoeditor.h" |
64 | #include "mainwindow.h" | 66 | #include "mainwindow.h" |
65 | 67 | ||
68 | OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) | ||
66 | 69 | ||
67 | using namespace Todo; | 70 | using namespace Todo; |
68 | 71 | ||
69 | MainWindow::MainWindow( QWidget* parent, | 72 | MainWindow::MainWindow( QWidget* parent, |
70 | const char* name ) | 73 | const char* name, WFlags ) |
71 | : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) | 74 | : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) |
72 | { | 75 | { |
73 | m_syncing = false; | 76 | m_syncing = false; |
74 | m_showing = false; | 77 | m_showing = false; |
75 | m_counter = 0; | 78 | m_counter = 0; |
76 | m_tempManager = new TemplateManager(); | 79 | m_tempManager = new TemplateManager(); |
77 | m_tempManager->load(); | 80 | m_tempManager->load(); |
78 | 81 | ||
79 | initUI(); | 82 | initUI(); |
80 | initConfig(); | 83 | initConfig(); |
81 | initViews(); | 84 | initViews(); |
82 | initActions(); | 85 | initActions(); |
83 | initEditor(); | 86 | initEditor(); |
84 | initShow(); | 87 | initShow(); |
85 | initTemplate(); | 88 | initTemplate(); |
86 | 89 | ||
87 | populateTemplates(); | 90 | populateTemplates(); |
88 | raiseCurrentView(); | 91 | raiseCurrentView(); |
89 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); | 92 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); |
90 | } | 93 | } |
91 | void MainWindow::initTemplate() { | 94 | void MainWindow::initTemplate() { |
92 | m_curTempEd = new TemplateEditor( this, templateManager() ); | 95 | m_curTempEd = new TemplateEditor( this, templateManager() ); |
93 | } | 96 | } |
94 | void MainWindow::initActions() { | 97 | void MainWindow::initActions() { |
95 | 98 | ||
96 | // Data menu | 99 | // Data menu |
97 | m_edit->insertItem(QWidget::tr("New from template"), m_template, | 100 | m_edit->insertItem(QWidget::tr("New from template"), m_template, |
98 | -1, 0 ); | 101 | -1, 0 ); |
99 | 102 | ||
100 | QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), | 103 | QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), |
101 | QString::null, 0, this, 0 ); | 104 | QString::null, 0, this, 0 ); |
102 | connect(a, SIGNAL( activated() ), | 105 | connect(a, SIGNAL( activated() ), |
103 | this, SLOT( slotNew() ) ); | 106 | this, SLOT( slotNew() ) ); |
104 | a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); | 107 | a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); |
105 | a->addTo(m_tool ); | 108 | a->addTo(m_tool ); |
106 | a->addTo(m_edit ); | 109 | a->addTo(m_edit ); |
107 | 110 | ||
108 | a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), | 111 | a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), |
109 | QString::null, 0, this, 0 ); | 112 | QString::null, 0, this, 0 ); |
110 | connect(a, SIGNAL(activated() ), | 113 | connect(a, SIGNAL(activated() ), |
111 | this, SLOT( slotEdit() ) ); | 114 | this, SLOT( slotEdit() ) ); |
112 | a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); | 115 | a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); |
113 | a->addTo( m_tool ); | 116 | a->addTo( m_tool ); |
114 | a->addTo( m_edit ); | 117 | a->addTo( m_edit ); |
115 | m_editAction = a; | 118 | m_editAction = a; |
116 | 119 | ||
117 | a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); | 120 | a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); |
118 | connect(a, SIGNAL( activated() ), | 121 | connect(a, SIGNAL( activated() ), |
@@ -305,96 +308,97 @@ QToolBar* MainWindow::toolbar() { | |||
305 | } | 308 | } |
306 | OTodoAccess::List MainWindow::list()const { | 309 | OTodoAccess::List MainWindow::list()const { |
307 | return m_todoMgr.list(); | 310 | return m_todoMgr.list(); |
308 | } | 311 | } |
309 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { | 312 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { |
310 | int cat = 0; | 313 | int cat = 0; |
311 | if ( m_curCat != QWidget::tr("All Categories") ) | 314 | if ( m_curCat != QWidget::tr("All Categories") ) |
312 | cat = currentCatId(); | 315 | cat = currentCatId(); |
313 | if ( m_curCat == QWidget::tr("Unfiled") ) | 316 | if ( m_curCat == QWidget::tr("Unfiled") ) |
314 | cat = -1; | 317 | cat = -1; |
315 | 318 | ||
316 | qWarning(" Category %d %s", cat, m_curCat.latin1() ); | 319 | qWarning(" Category %d %s", cat, m_curCat.latin1() ); |
317 | 320 | ||
318 | int filter = 1; | 321 | int filter = 1; |
319 | 322 | ||
320 | if (!m_completed ) | 323 | if (!m_completed ) |
321 | filter |= 4; | 324 | filter |= 4; |
322 | if (m_overdue) | 325 | if (m_overdue) |
323 | filter |= 2; | 326 | filter |= 2; |
324 | 327 | ||
325 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); | 328 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); |
326 | } | 329 | } |
327 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { | 330 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { |
328 | int cat = 0; | 331 | int cat = 0; |
329 | if ( m_curCat != QWidget::tr("All Categories") ) | 332 | if ( m_curCat != QWidget::tr("All Categories") ) |
330 | cat = currentCatId(); | 333 | cat = currentCatId(); |
331 | 334 | ||
332 | if ( m_curCat == QWidget::tr("Unfiled") ) | 335 | if ( m_curCat == QWidget::tr("Unfiled") ) |
333 | cat = -1; | 336 | cat = -1; |
334 | 337 | ||
335 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); | 338 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); |
336 | } | 339 | } |
337 | OTodo MainWindow::event( int uid ) { | 340 | OTodo MainWindow::event( int uid ) { |
338 | return m_todoMgr.event( uid ); | 341 | return m_todoMgr.event( uid ); |
339 | } | 342 | } |
340 | bool MainWindow::isSyncing()const { | 343 | bool MainWindow::isSyncing()const { |
341 | return m_syncing; | 344 | return m_syncing; |
342 | } | 345 | } |
343 | TemplateManager* MainWindow::templateManager() { | 346 | TemplateManager* MainWindow::templateManager() { |
344 | return m_tempManager; | 347 | return m_tempManager; |
345 | } | 348 | } |
346 | Editor* MainWindow::currentEditor() { | 349 | Editor* MainWindow::currentEditor() { |
347 | return m_curEdit; | 350 | return m_curEdit; |
348 | } | 351 | } |
349 | TodoShow* MainWindow::currentShow() { | 352 | TodoShow* MainWindow::currentShow() { |
350 | return m_curShow; | 353 | return m_curShow; |
351 | } | 354 | } |
352 | void MainWindow::slotReload() { | 355 | void MainWindow::slotReload() { |
356 | m_syncing = FALSE; | ||
353 | m_todoMgr.reload(); | 357 | m_todoMgr.reload(); |
354 | currentView()->updateView( ); | 358 | currentView()->updateView( ); |
355 | raiseCurrentView(); | 359 | raiseCurrentView(); |
356 | } | 360 | } |
357 | void MainWindow::closeEvent( QCloseEvent* e ) { | 361 | void MainWindow::closeEvent( QCloseEvent* e ) { |
358 | if (m_stack->visibleWidget() == currentShow()->widget() ) { | 362 | if (m_stack->visibleWidget() == currentShow()->widget() ) { |
359 | m_showing = false; | 363 | m_showing = false; |
360 | raiseCurrentView(); | 364 | raiseCurrentView(); |
361 | e->ignore(); | 365 | e->ignore(); |
362 | return; | 366 | return; |
363 | } | 367 | } |
364 | /* | 368 | /* |
365 | * we should have flushed and now we're still saving | 369 | * we should have flushed and now we're still saving |
366 | * so there is no need to flush | 370 | * so there is no need to flush |
367 | */ | 371 | */ |
368 | if (m_syncing ) { | 372 | if (m_syncing ) { |
369 | e->accept(); | 373 | e->accept(); |
370 | return; | 374 | return; |
371 | } | 375 | } |
372 | bool quit = false; | 376 | bool quit = false; |
373 | if ( m_todoMgr.saveAll() ){ | 377 | if ( m_todoMgr.saveAll() ){ |
374 | qWarning("saved"); | 378 | qWarning("saved"); |
375 | quit = true; | 379 | quit = true; |
376 | }else { | 380 | }else { |
377 | if ( QMessageBox::critical( this, QWidget::tr("Out of space"), | 381 | if ( QMessageBox::critical( this, QWidget::tr("Out of space"), |
378 | QWidget::tr("Todo was unable\n" | 382 | QWidget::tr("Todo was unable\n" |
379 | "to save your changes.\n" | 383 | "to save your changes.\n" |
380 | "Free up some space\n" | 384 | "Free up some space\n" |
381 | "and try again.\n" | 385 | "and try again.\n" |
382 | "\nQuit Anyway?"), | 386 | "\nQuit Anyway?"), |
383 | QMessageBox::Yes|QMessageBox::Escape, | 387 | QMessageBox::Yes|QMessageBox::Escape, |
384 | QMessageBox::No|QMessageBox::Default) | 388 | QMessageBox::No|QMessageBox::Default) |
385 | != QMessageBox::No ) { | 389 | != QMessageBox::No ) { |
386 | e->accept(); | 390 | e->accept(); |
387 | quit = true; | 391 | quit = true; |
388 | }else | 392 | }else |
389 | e->ignore(); | 393 | e->ignore(); |
390 | 394 | ||
391 | } | 395 | } |
392 | 396 | ||
393 | if (quit ) { | 397 | if (quit ) { |
394 | Config config( "todo" ); | 398 | Config config( "todo" ); |
395 | config.setGroup( "View" ); | 399 | config.setGroup( "View" ); |
396 | config.writeEntry( "ShowComplete", showCompleted() ); | 400 | config.writeEntry( "ShowComplete", showCompleted() ); |
397 | config.writeEntry( "Category", currentCategory() ); | 401 | config.writeEntry( "Category", currentCategory() ); |
398 | config.writeEntry( "ShowDeadLine", showDeadline()); | 402 | config.writeEntry( "ShowDeadLine", showDeadline()); |
399 | config.writeEntry( "ShowOverDue", showOverDue() ); | 403 | config.writeEntry( "ShowOverDue", showOverDue() ); |
400 | config.writeEntry( "ShowQuickTask", showQuickTask() ); | 404 | config.writeEntry( "ShowQuickTask", showQuickTask() ); |
@@ -559,104 +563,104 @@ void MainWindow::slotShowDeadLine( bool dead) { | |||
559 | } | 563 | } |
560 | void MainWindow::slotShowCompleted( bool show) { | 564 | void MainWindow::slotShowCompleted( bool show) { |
561 | m_completed = show; | 565 | m_completed = show; |
562 | currentView()->setShowCompleted( m_completed ); | 566 | currentView()->setShowCompleted( m_completed ); |
563 | } | 567 | } |
564 | void MainWindow::slotShowQuickTask( bool show ) { | 568 | void MainWindow::slotShowQuickTask( bool show ) { |
565 | m_quicktask = show; | 569 | m_quicktask = show; |
566 | if ( m_quicktask ) | 570 | if ( m_quicktask ) |
567 | m_curQuick->widget()->show(); | 571 | m_curQuick->widget()->show(); |
568 | else | 572 | else |
569 | m_curQuick->widget()->hide(); | 573 | m_curQuick->widget()->hide(); |
570 | } | 574 | } |
571 | bool MainWindow::showOverDue()const { | 575 | bool MainWindow::showOverDue()const { |
572 | return m_overdue; | 576 | return m_overdue; |
573 | } | 577 | } |
574 | void MainWindow::setDocument( const QString& fi) { | 578 | void MainWindow::setDocument( const QString& fi) { |
575 | DocLnk doc(fi); | 579 | DocLnk doc(fi); |
576 | if (doc.isValid() ) | 580 | if (doc.isValid() ) |
577 | receiveFile(doc.file() ); | 581 | receiveFile(doc.file() ); |
578 | else | 582 | else |
579 | receiveFile(fi ); | 583 | receiveFile(fi ); |
580 | } | 584 | } |
581 | 585 | ||
582 | static const char *beamfile = "/tmp/opie-todo.vcs"; | 586 | static const char *beamfile = "/tmp/opie-todo.vcs"; |
583 | void MainWindow::slotBeam() { | 587 | void MainWindow::slotBeam() { |
584 | beam( currentView()->current() ); | 588 | beam( currentView()->current() ); |
585 | } | 589 | } |
586 | void MainWindow::beamDone( Ir* ir) { | 590 | void MainWindow::beamDone( Ir* ir) { |
587 | delete ir; | 591 | delete ir; |
588 | ::unlink( beamfile ); | 592 | ::unlink( beamfile ); |
589 | } | 593 | } |
590 | void MainWindow::receiveFile( const QString& filename ) { | 594 | void MainWindow::receiveFile( const QString& filename ) { |
591 | OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); | 595 | OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); |
592 | 596 | ||
593 | OTodoAccess acc( cal ); | 597 | OTodoAccess acc( cal ); |
594 | acc.load(); | 598 | acc.load(); |
595 | OTodoAccess::List list = acc.allRecords(); | 599 | OTodoAccess::List list = acc.allRecords(); |
596 | 600 | ||
597 | if (list.count()){ | 601 | if (list.count()){ |
598 | 602 | ||
599 | 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() ); |
600 | 604 | ||
601 | if ( QMessageBox::information(this, QWidget::tr("New Tasks"), | 605 | if ( QMessageBox::information(this, QWidget::tr("New Tasks"), |
602 | message, QMessageBox::Ok, | 606 | message, QMessageBox::Ok, |
603 | QMessageBox::Cancel ) == QMessageBox::Ok ) { | 607 | QMessageBox::Cancel ) == QMessageBox::Ok ) { |
604 | OTodoAccess::List::Iterator it; | 608 | OTodoAccess::List::Iterator it; |
605 | for ( it = list.begin(); it != list.end(); ++it ) | 609 | for ( it = list.begin(); it != list.end(); ++it ) |
606 | m_todoMgr.add( (*it) ); | 610 | m_todoMgr.add( (*it) ); |
607 | 611 | ||
608 | currentView()->updateView(); | 612 | currentView()->updateView(); |
609 | } | 613 | } |
610 | } | 614 | } |
611 | } | 615 | } |
612 | 616 | ||
613 | void MainWindow::slotFlush() { | 617 | void MainWindow::slotFlush() { |
614 | m_syncing = FALSE; | 618 | m_syncing = TRUE; |
615 | m_todoMgr.save(); | 619 | m_todoMgr.save(); |
616 | } | 620 | } |
617 | void MainWindow::slotShowDetails() { | 621 | void MainWindow::slotShowDetails() { |
618 | slotShow( currentView()->current() ); | 622 | slotShow( currentView()->current() ); |
619 | } | 623 | } |
620 | /* | 624 | /* |
621 | * populate the Categories | 625 | * populate the Categories |
622 | * Menu | 626 | * Menu |
623 | */ | 627 | */ |
624 | void MainWindow::populateCategories() { | 628 | void MainWindow::populateCategories() { |
625 | m_todoMgr.load(); | 629 | m_todoMgr.load(); |
626 | 630 | ||
627 | m_catMenu->clear(); | 631 | m_catMenu->clear(); |
628 | int id, rememberId; | 632 | int id, rememberId; |
629 | id = 1; | 633 | id = 1; |
630 | rememberId = 1; | 634 | rememberId = 1; |
631 | 635 | ||
632 | m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); | 636 | m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); |
633 | m_catMenu->insertSeparator(); | 637 | m_catMenu->insertSeparator(); |
634 | QStringList categories = m_todoMgr.categories(); | 638 | QStringList categories = m_todoMgr.categories(); |
635 | categories.append( QWidget::tr( "Unfiled" ) ); | 639 | categories.append( QWidget::tr( "Unfiled" ) ); |
636 | for ( QStringList::Iterator it = categories.begin(); | 640 | for ( QStringList::Iterator it = categories.begin(); |
637 | it != categories.end(); ++it ) { | 641 | it != categories.end(); ++it ) { |
638 | m_catMenu->insertItem( *it, id ); | 642 | m_catMenu->insertItem( *it, id ); |
639 | if ( *it == currentCategory() ) | 643 | if ( *it == currentCategory() ) |
640 | rememberId = id; | 644 | rememberId = id; |
641 | ++id; | 645 | ++id; |
642 | } | 646 | } |
643 | setCategory( rememberId ); | 647 | setCategory( rememberId ); |
644 | } | 648 | } |
645 | bool MainWindow::showCompleted()const { | 649 | bool MainWindow::showCompleted()const { |
646 | return m_completed; | 650 | return m_completed; |
647 | } | 651 | } |
648 | bool MainWindow::showDeadline()const { | 652 | bool MainWindow::showDeadline()const { |
649 | return m_deadline; | 653 | return m_deadline; |
650 | } | 654 | } |
651 | bool MainWindow::showQuickTask()const { | 655 | bool MainWindow::showQuickTask()const { |
652 | return m_quicktask; | 656 | return m_quicktask; |
653 | } | 657 | } |
654 | QString MainWindow::currentCategory()const { | 658 | QString MainWindow::currentCategory()const { |
655 | return m_curCat; | 659 | return m_curCat; |
656 | } | 660 | } |
657 | int MainWindow::currentCatId() { | 661 | int MainWindow::currentCatId() { |
658 | return m_todoMgr.catId( m_curCat ); | 662 | return m_todoMgr.catId( m_curCat ); |
659 | } | 663 | } |
660 | ViewBase* MainWindow::currentView() { | 664 | ViewBase* MainWindow::currentView() { |
661 | return m_curView; | 665 | return m_curView; |
662 | } | 666 | } |
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index b04a958..bd341c2 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -17,98 +17,101 @@ | |||
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef TODO_MAIN_WINDOW_H | 29 | #ifndef TODO_MAIN_WINDOW_H |
30 | #define TODO_MAIN_WINDOW_H | 30 | #define TODO_MAIN_WINDOW_H |
31 | 31 | ||
32 | #include <qlist.h> | 32 | #include <qlist.h> |
33 | 33 | ||
34 | #include <opie/otodoaccess.h> | 34 | #include <opie/otodoaccess.h> |
35 | #include <opie/otodo.h> | 35 | #include <opie/otodo.h> |
36 | #include <opie/opimmainwindow.h> | 36 | #include <opie/opimmainwindow.h> |
37 | 37 | ||
38 | #include "smalltodo.h" | 38 | #include "smalltodo.h" |
39 | #include "todoview.h" | 39 | #include "todoview.h" |
40 | #include "quickedit.h" | 40 | #include "quickedit.h" |
41 | #include "todomanager.h" | 41 | #include "todomanager.h" |
42 | 42 | ||
43 | class QPopupMenu; | 43 | class QPopupMenu; |
44 | class QMenuBar; | 44 | class QMenuBar; |
45 | class QToolBar; | 45 | class QToolBar; |
46 | class QAction; | 46 | class QAction; |
47 | class QWidgetStack; | 47 | class QWidgetStack; |
48 | class Ir; | 48 | class Ir; |
49 | class QVBox; | 49 | class QVBox; |
50 | class QLineEdit; | 50 | class QLineEdit; |
51 | 51 | ||
52 | namespace Todo { | 52 | namespace Todo { |
53 | typedef TodoView View; | 53 | typedef TodoView View; |
54 | class TemplateManager; | 54 | class TemplateManager; |
55 | class Editor; | 55 | class Editor; |
56 | class TodoShow; | 56 | class TodoShow; |
57 | class TemplateEditor; | 57 | class TemplateEditor; |
58 | struct QuickEditBase; | 58 | struct QuickEditBase; |
59 | 59 | ||
60 | class MainWindow : public OPimMainWindow { | 60 | class MainWindow : public OPimMainWindow { |
61 | Q_OBJECT | 61 | Q_OBJECT |
62 | friend class TodoView; // avoid QObject here.... | 62 | friend class TodoView; // avoid QObject here.... |
63 | friend class TodoShow; // avoid QObject | 63 | friend class TodoShow; // avoid QObject |
64 | public: | 64 | public: |
65 | /* OApplicationFactory application Name */ | ||
66 | static QString appName() { return QString::fromLatin1("todolist"); } | ||
67 | |||
65 | MainWindow( QWidget *parent = 0, | 68 | MainWindow( QWidget *parent = 0, |
66 | const char* name = 0 ); | 69 | const char* name = 0, WFlags fl = 0 ); |
67 | ~MainWindow(); | 70 | ~MainWindow(); |
68 | 71 | ||
69 | /** return a context menu for an OTodo */ | 72 | /** return a context menu for an OTodo */ |
70 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); | 73 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); |
71 | QPopupMenu* options(); | 74 | QPopupMenu* options(); |
72 | QPopupMenu* edit(); | 75 | QPopupMenu* edit(); |
73 | QToolBar* toolbar(); | 76 | QToolBar* toolbar(); |
74 | 77 | ||
75 | 78 | ||
76 | void updateList(); | 79 | void updateList(); |
77 | OTodoAccess::List list()const; | 80 | OTodoAccess::List list()const; |
78 | OTodoAccess::List sorted( bool asc, int sortOrder ); | 81 | OTodoAccess::List sorted( bool asc, int sortOrder ); |
79 | OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); | 82 | OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); |
80 | 83 | ||
81 | OTodo event(int uid ); | 84 | OTodo event(int uid ); |
82 | 85 | ||
83 | bool isSyncing()const; | 86 | bool isSyncing()const; |
84 | bool showCompleted()const; | 87 | bool showCompleted()const; |
85 | bool showDeadline()const; | 88 | bool showDeadline()const; |
86 | bool showOverDue()const; | 89 | bool showOverDue()const; |
87 | bool showQuickTask()const; | 90 | bool showQuickTask()const; |
88 | QString currentCategory()const; | 91 | QString currentCategory()const; |
89 | int currentCatId(); | 92 | int currentCatId(); |
90 | TemplateManager* templateManager(); | 93 | TemplateManager* templateManager(); |
91 | QuickEditBase* quickEditor(); | 94 | QuickEditBase* quickEditor(); |
92 | 95 | ||
93 | void updateTodo( const OTodo& ); | 96 | void updateTodo( const OTodo& ); |
94 | void populateTemplates(); | 97 | void populateTemplates(); |
95 | Editor* currentEditor(); | 98 | Editor* currentEditor(); |
96 | void setReadAhead(uint count ); | 99 | void setReadAhead(uint count ); |
97 | private slots: | 100 | private slots: |
98 | void slotQuickEntered(); | 101 | void slotQuickEntered(); |
99 | void populateCategories(); | 102 | void populateCategories(); |
100 | void slotReload(); | 103 | void slotReload(); |
101 | void slotFlush(); | 104 | void slotFlush(); |
102 | 105 | ||
103 | protected: | 106 | protected: |
104 | void closeEvent( QCloseEvent* e ); | 107 | void closeEvent( QCloseEvent* e ); |
105 | 108 | ||
106 | private: | 109 | private: |
107 | /* handle setting and removing alarms */ | 110 | /* handle setting and removing alarms */ |
108 | void handleAlarms( const OTodo& oldTodo, const OTodo& newTodo ); | 111 | void handleAlarms( const OTodo& oldTodo, const OTodo& newTodo ); |
109 | void receiveFile( const QString& filename ); | 112 | void receiveFile( const QString& filename ); |
110 | void connectBase( ViewBase* ); | 113 | void connectBase( ViewBase* ); |
111 | void initUI(); | 114 | void initUI(); |
112 | void initActions(); | 115 | void initActions(); |
113 | void initConfig(); | 116 | void initConfig(); |
114 | void initViews(); | 117 | void initViews(); |
diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro index 4a63770..51cfde7 100644 --- a/core/pim/todo/todo.pro +++ b/core/pim/todo/todo.pro | |||
@@ -1,69 +1,49 @@ | |||
1 | TEMPLATE= app | 1 | #TEMPLATE= app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release quick-app |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | #DESTDIR = $(OPIEDIR)/bin |
4 | 4 | ||
5 | HEADERS= smalltodo.h \ | 5 | HEADERS= smalltodo.h \ |
6 | todomanager.h \ | 6 | todomanager.h \ |
7 | mainwindow.h \ | 7 | mainwindow.h \ |
8 | todoview.h \ | 8 | todoview.h \ |
9 | tableview.h \ | 9 | tableview.h \ |
10 | todotemplatemanager.h \ | 10 | todotemplatemanager.h \ |
11 | todoeditor.h \ | 11 | todoeditor.h \ |
12 | todoshow.h \ | 12 | todoshow.h \ |
13 | textviewshow.h \ | 13 | textviewshow.h \ |
14 | templateeditor.h \ | 14 | templateeditor.h \ |
15 | templatedialog.h \ | 15 | templatedialog.h \ |
16 | templatedialogimpl.h \ | 16 | templatedialogimpl.h \ |
17 | quickedit.h \ | 17 | quickedit.h \ |
18 | quickeditimpl.h \ | 18 | quickeditimpl.h \ |
19 | otaskeditor.h \ | 19 | otaskeditor.h \ |
20 | taskeditoroverview.h \ | 20 | taskeditoroverview.h \ |
21 | taskeditorstatus.h \ | 21 | taskeditorstatus.h \ |
22 | taskeditoralarms.h | 22 | taskeditoralarms.h |
23 | 23 | ||
24 | SOURCES= smalltodo.cpp \ | 24 | SOURCES= smalltodo.cpp \ |
25 | todomanager.cpp \ | 25 | todomanager.cpp \ |
26 | mainwindow.cpp \ | 26 | mainwindow.cpp \ |
27 | main.cpp \ | 27 | # main.cpp \ |
28 | tableview.cpp \ | 28 | tableview.cpp \ |
29 | todoview.cpp \ | 29 | todoview.cpp \ |
30 | todotemplatemanager.cpp \ | 30 | todotemplatemanager.cpp \ |
31 | todoeditor.cpp \ | 31 | todoeditor.cpp \ |
32 | todoshow.cpp \ | 32 | todoshow.cpp \ |
33 | textviewshow.cpp \ | 33 | textviewshow.cpp \ |
34 | templateeditor.cpp \ | 34 | templateeditor.cpp \ |
35 | templatedialog.cpp \ | 35 | templatedialog.cpp \ |
36 | templatedialogimpl.cpp \ | 36 | templatedialogimpl.cpp \ |
37 | quickeditimpl.cpp \ | 37 | quickeditimpl.cpp \ |
38 | quickedit.cpp \ | 38 | quickedit.cpp \ |
39 | otaskeditor.cpp \ | 39 | otaskeditor.cpp \ |
40 | taskeditoroverview.cpp \ | 40 | taskeditoroverview.cpp \ |
41 | taskeditorstatus.cpp \ | 41 | taskeditorstatus.cpp \ |
42 | taskeditoralarms.cpp | 42 | taskeditoralarms.cpp |
43 | 43 | ||
44 | TARGET = todolist | 44 | TARGET = todolist |
45 | INCLUDEPATH += $(OPIEDIR)/include | 45 | INCLUDEPATH += $(OPIEDIR)/include |
46 | DEPENDPATH+= $(OPIEDIR)/include | 46 | DEPENDPATH+= $(OPIEDIR)/include |
47 | LIBS += -lqpe -lopie | 47 | LIBS += -lqpe -lopie |
48 | 48 | ||
49 | TRANSLATIONS = ../../../i18n/de/todolist.ts \ | ||
50 | ../../../i18n/nl/todolist.ts \ | ||
51 | ../../../i18n/da/todolist.ts \ | ||
52 | ../../../i18n/xx/todolist.ts \ | ||
53 | ../../../i18n/en/todolist.ts \ | ||
54 | ../../../i18n/es/todolist.ts \ | ||
55 | ../../../i18n/fr/todolist.ts \ | ||
56 | ../../../i18n/hu/todolist.ts \ | ||
57 | ../../../i18n/ja/todolist.ts \ | ||
58 | ../../../i18n/ko/todolist.ts \ | ||
59 | ../../../i18n/no/todolist.ts \ | ||
60 | ../../../i18n/pl/todolist.ts \ | ||
61 | ../../../i18n/pt/todolist.ts \ | ||
62 | ../../../i18n/pt_BR/todolist.ts \ | ||
63 | ../../../i18n/sl/todolist.ts \ | ||
64 | ../../../i18n/zh_CN/todolist.ts \ | ||
65 | ../../../i18n/zh_TW/todolist.ts | ||
66 | |||
67 | |||
68 | |||
69 | include ( $(OPIEDIR)/include.pro ) | 49 | include ( $(OPIEDIR)/include.pro ) |