author | zecke <zecke> | 2002-10-13 19:09:09 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-13 19:09:09 (UTC) |
commit | 0762b201f248b9eaf3a08601b04484bec9a6d9a1 (patch) (unidiff) | |
tree | 5f386485a6b3b3e5c6edeeefdd26ef98ff924a34 | |
parent | 34c1199becdb2f9b0447553e66c85d8f6770558f (diff) | |
download | opie-0762b201f248b9eaf3a08601b04484bec9a6d9a1.zip opie-0762b201f248b9eaf3a08601b04484bec9a6d9a1.tar.gz opie-0762b201f248b9eaf3a08601b04484bec9a6d9a1.tar.bz2 |
Implement beaming and adding of todos. Use the vCal resource for that
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 52 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 1 | ||||
-rw-r--r-- | core/pim/todo/todo.pro | 2 |
3 files changed, 48 insertions, 7 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index c9c43d4..2994915 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -13,45 +13,49 @@ | |||
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> | ||
30 | |||
29 | #include <qmenubar.h> | 31 | #include <qmenubar.h> |
30 | #include <qmessagebox.h> | 32 | #include <qmessagebox.h> |
31 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
32 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
33 | #include <qwidgetstack.h> | 35 | #include <qwidgetstack.h> |
34 | #include <qaction.h> | 36 | #include <qaction.h> |
35 | #include <qtimer.h> | 37 | #include <qtimer.h> |
36 | 38 | ||
39 | #include <qpe/applnk.h> | ||
37 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
38 | #include <qpe/ir.h> | 41 | #include <qpe/ir.h> |
39 | #include <qpe/resource.h> | 42 | #include <qpe/resource.h> |
40 | #include <qpe/qpemessagebox.h> | 43 | #include <qpe/qpemessagebox.h> |
41 | 44 | ||
45 | #include <opie/otodoaccessvcal.h> | ||
42 | 46 | ||
43 | #include "todotemplatemanager.h" | 47 | #include "todotemplatemanager.h" |
44 | #include "templateeditor.h" | 48 | #include "templateeditor.h" |
45 | #include "todoentryimpl.h" | 49 | #include "todoentryimpl.h" |
46 | #include "tableview.h" | 50 | #include "tableview.h" |
47 | 51 | ||
48 | #include "textviewshow.h" | 52 | #include "textviewshow.h" |
49 | #include "todoeditor.h" | 53 | #include "todoeditor.h" |
50 | #include "mainwindow.h" | 54 | #include "mainwindow.h" |
51 | 55 | ||
52 | 56 | ||
53 | using namespace Todo; | 57 | using namespace Todo; |
54 | 58 | ||
55 | MainWindow::MainWindow( QWidget* parent, | 59 | MainWindow::MainWindow( QWidget* parent, |
56 | const char* name ) { | 60 | const char* name ) { |
57 | 61 | ||
@@ -515,40 +519,76 @@ void MainWindow::setCategory( int c) { | |||
515 | m_catMenu->setItemChecked( c, true ); | 519 | m_catMenu->setItemChecked( c, true ); |
516 | 520 | ||
517 | currentView()->setShowCategory( m_curCat ); | 521 | currentView()->setShowCategory( m_curCat ); |
518 | raiseCurrentView(); | 522 | raiseCurrentView(); |
519 | } | 523 | } |
520 | void MainWindow::slotShowDeadLine( bool dead) { | 524 | void MainWindow::slotShowDeadLine( bool dead) { |
521 | m_deadline = dead; | 525 | m_deadline = dead; |
522 | currentView()->setShowDeadline( dead ); | 526 | currentView()->setShowDeadline( dead ); |
523 | } | 527 | } |
524 | void MainWindow::slotShowCompleted( bool show) { | 528 | void MainWindow::slotShowCompleted( bool show) { |
525 | m_completed = show; | 529 | m_completed = show; |
526 | currentView()->setShowCompleted( m_completed ); | 530 | currentView()->setShowCompleted( m_completed ); |
527 | } | 531 | } |
528 | bool MainWindow::showOverDue()const { | 532 | bool MainWindow::showOverDue()const { |
529 | return m_overdue; | 533 | return m_overdue; |
530 | } | 534 | } |
531 | void MainWindow::setDocument( const QString& ) { | 535 | void MainWindow::setDocument( const QString& fi) { |
532 | 536 | DocLnk doc(fi); | |
537 | if (doc.isValid() ) | ||
538 | receiveFile(doc.file() ); | ||
539 | else | ||
540 | receiveFile(fi ); | ||
533 | } | 541 | } |
534 | void MainWindow::slotBeam() { | ||
535 | |||
536 | } | ||
537 | void MainWindow::beamDone( Ir* ) { | ||
538 | 542 | ||
543 | static const char *beamfile = "/tmp/opie-todo.vcs"; | ||
544 | void MainWindow::slotBeam() { | ||
545 | ::unlink( beamfile ); | ||
546 | OTodo todo = event( currentView()->current() ); | ||
547 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); | ||
548 | OTodoAccess acc( cal ); | ||
549 | acc.load(); | ||
550 | acc.add( todo ); | ||
551 | acc.save(); | ||
552 | Ir* ir = new Ir(this ); | ||
553 | connect(ir, SIGNAL(done(Ir*) ), | ||
554 | this, SLOT(beamDone(Ir*) ) ); | ||
555 | ir->send( beamfile, todo.summary(), "text/x-vCalendar" ); | ||
556 | |||
557 | } | ||
558 | void MainWindow::beamDone( Ir* ir) { | ||
559 | delete ir; | ||
560 | ::unlink( beamfile ); | ||
561 | } | ||
562 | void MainWindow::receiveFile( const QString& filename ) { | ||
563 | OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); | ||
564 | OTodoAccess acc( cal ); | ||
565 | acc.load(); | ||
566 | OTodoAccess::List list = acc.allRecords(); | ||
567 | |||
568 | QString message = tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); | ||
569 | |||
570 | if ( QMessageBox::information(this, tr("New Tasks"), | ||
571 | message, QMessageBox::Ok, | ||
572 | QMessageBox::Cancel ) == QMessageBox::Ok ) { | ||
573 | OTodoAccess::List::Iterator it; | ||
574 | for ( it = list.begin(); it != list.end(); ++it ) | ||
575 | m_todoMgr.add( (*it) ); | ||
576 | |||
577 | currentView()->updateView(); | ||
578 | } | ||
539 | } | 579 | } |
540 | 580 | ||
541 | void MainWindow::slotFlush() { | 581 | void MainWindow::slotFlush() { |
542 | m_syncing = FALSE; | 582 | m_syncing = FALSE; |
543 | m_todoMgr.save(); | 583 | m_todoMgr.save(); |
544 | } | 584 | } |
545 | void MainWindow::slotShowDetails() { | 585 | void MainWindow::slotShowDetails() { |
546 | slotShow( currentView()->current() ); | 586 | slotShow( currentView()->current() ); |
547 | } | 587 | } |
548 | /* | 588 | /* |
549 | * populate the Categories | 589 | * populate the Categories |
550 | * Menu | 590 | * Menu |
551 | */ | 591 | */ |
552 | void MainWindow::populateCategories() { | 592 | void MainWindow::populateCategories() { |
553 | m_todoMgr.load(); | 593 | m_todoMgr.load(); |
554 | 594 | ||
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index 598c3af..8d0c29f 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -83,32 +83,33 @@ namespace Todo { | |||
83 | QString currentCategory()const; | 83 | QString currentCategory()const; |
84 | int currentCatId(); | 84 | int currentCatId(); |
85 | TemplateManager* templateManager(); | 85 | TemplateManager* templateManager(); |
86 | 86 | ||
87 | void updateTodo( const OTodo& ); | 87 | void updateTodo( const OTodo& ); |
88 | void populateTemplates(); | 88 | void populateTemplates(); |
89 | Editor* currentEditor(); | 89 | Editor* currentEditor(); |
90 | private slots: | 90 | private slots: |
91 | void populateCategories(); | 91 | void populateCategories(); |
92 | void slotReload(); | 92 | void slotReload(); |
93 | void slotFlush(); | 93 | void slotFlush(); |
94 | 94 | ||
95 | protected: | 95 | protected: |
96 | void closeEvent( QCloseEvent* e ); | 96 | void closeEvent( QCloseEvent* e ); |
97 | 97 | ||
98 | private: | 98 | private: |
99 | void receiveFile( const QString& filename ); | ||
99 | void connectBase( ViewBase* ); | 100 | void connectBase( ViewBase* ); |
100 | void initUI(); | 101 | void initUI(); |
101 | void initActions(); | 102 | void initActions(); |
102 | void initConfig(); | 103 | void initConfig(); |
103 | void initViews(); | 104 | void initViews(); |
104 | void initEditor(); | 105 | void initEditor(); |
105 | void initShow(); | 106 | void initShow(); |
106 | void initTemplate(); | 107 | void initTemplate(); |
107 | void raiseCurrentView(); | 108 | void raiseCurrentView(); |
108 | ViewBase* currentView(); | 109 | ViewBase* currentView(); |
109 | ViewBase* m_curView; | 110 | ViewBase* m_curView; |
110 | Editor* m_curEdit; | 111 | Editor* m_curEdit; |
111 | TodoShow* currentShow(); | 112 | TodoShow* currentShow(); |
112 | TodoShow* m_curShow; | 113 | TodoShow* m_curShow; |
113 | TemplateEditor* currentTemplateEditor(); | 114 | TemplateEditor* currentTemplateEditor(); |
114 | TemplateEditor* m_curTempEd; | 115 | TemplateEditor* m_curTempEd; |
diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro index 3ff78f5..f26acee 100644 --- a/core/pim/todo/todo.pro +++ b/core/pim/todo/todo.pro | |||
@@ -1,18 +1,18 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on debug | 2 | CONFIG = qt warn_on release |
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 | todoentryimpl.h \ | 9 | todoentryimpl.h \ |
10 | tableview.h \ | 10 | tableview.h \ |
11 | tableitems.h \ | 11 | tableitems.h \ |
12 | todotemplatemanager.h \ | 12 | todotemplatemanager.h \ |
13 | todoeditor.h \ | 13 | todoeditor.h \ |
14 | todoshow.h \ | 14 | todoshow.h \ |
15 | textviewshow.h \ | 15 | textviewshow.h \ |
16 | templateeditor.h \ | 16 | templateeditor.h \ |
17 | templatedialog.h \ | 17 | templatedialog.h \ |
18 | templatedialogimpl.h | 18 | templatedialogimpl.h |