-rw-r--r-- | core/pim/todo/mainwindow.cpp | 70 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 6 | ||||
-rw-r--r-- | core/pim/todo/quickeditimpl.cpp | 56 | ||||
-rw-r--r-- | core/pim/todo/quickeditimpl.h | 9 |
4 files changed, 86 insertions, 55 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 0ab6230..f0aa455 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -14,48 +14,50 @@ | |||
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 | #include <stdio.h> | ||
30 | 31 | ||
31 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
32 | #include <qmessagebox.h> | 33 | #include <qmessagebox.h> |
33 | #include <qtoolbar.h> | 34 | #include <qtoolbar.h> |
34 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
35 | #include <qwidgetstack.h> | 36 | #include <qwidgetstack.h> |
36 | #include <qaction.h> | 37 | #include <qaction.h> |
37 | #include <qtimer.h> | 38 | #include <qtimer.h> |
38 | #include <qvbox.h> | 39 | #include <qvbox.h> |
39 | #include <qlineedit.h> | 40 | #include <qlineedit.h> |
40 | 41 | ||
41 | #include <qpe/applnk.h> | 42 | #include <qpe/applnk.h> |
42 | #include <qpe/config.h> | 43 | #include <qpe/config.h> |
43 | #include <qpe/ir.h> | 44 | #include <qpe/ir.h> |
44 | #include <qpe/resource.h> | 45 | #include <qpe/resource.h> |
45 | #include <qpe/qpemessagebox.h> | 46 | #include <qpe/qpemessagebox.h> |
47 | #include <qpe/qpetoolbar.h> | ||
46 | 48 | ||
47 | #include <opie/orecur.h> | 49 | #include <opie/orecur.h> |
48 | #include <opie/otodoaccessvcal.h> | 50 | #include <opie/otodoaccessvcal.h> |
49 | 51 | ||
50 | #include "quickeditimpl.h" | 52 | #include "quickeditimpl.h" |
51 | #include "todotemplatemanager.h" | 53 | #include "todotemplatemanager.h" |
52 | #include "templateeditor.h" | 54 | #include "templateeditor.h" |
53 | #include "tableview.h" | 55 | #include "tableview.h" |
54 | 56 | ||
55 | #include "textviewshow.h" | 57 | #include "textviewshow.h" |
56 | #include "todoeditor.h" | 58 | #include "todoeditor.h" |
57 | #include "mainwindow.h" | 59 | #include "mainwindow.h" |
58 | 60 | ||
59 | 61 | ||
60 | using namespace Todo; | 62 | using namespace Todo; |
61 | 63 | ||
@@ -72,32 +74,37 @@ MainWindow::MainWindow( QWidget* parent, | |||
72 | initUI(); | 74 | initUI(); |
73 | initConfig(); | 75 | initConfig(); |
74 | initViews(); | 76 | initViews(); |
75 | initActions(); | 77 | initActions(); |
76 | initEditor(); | 78 | initEditor(); |
77 | initShow(); | 79 | initShow(); |
78 | initTemplate(); | 80 | initTemplate(); |
79 | 81 | ||
80 | populateTemplates(); | 82 | populateTemplates(); |
81 | raiseCurrentView(); | 83 | raiseCurrentView(); |
82 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); | 84 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); |
83 | } | 85 | } |
84 | void MainWindow::initTemplate() { | 86 | void MainWindow::initTemplate() { |
85 | m_curTempEd = new TemplateEditor( this, templateManager() ); | 87 | m_curTempEd = new TemplateEditor( this, templateManager() ); |
86 | } | 88 | } |
87 | void MainWindow::initActions() { | 89 | void MainWindow::initActions() { |
90 | |||
91 | // Data menu | ||
92 | m_edit->insertItem(tr("New from template"), m_template, | ||
93 | -1, 0 ); | ||
94 | |||
88 | QAction* a = new QAction( tr("New Task" ), Resource::loadPixmap( "new" ), | 95 | QAction* a = new QAction( tr("New Task" ), Resource::loadPixmap( "new" ), |
89 | QString::null, 0, this, 0 ); | 96 | QString::null, 0, this, 0 ); |
90 | connect(a, SIGNAL( activated() ), | 97 | connect(a, SIGNAL( activated() ), |
91 | this, SLOT( slotNew() ) ); | 98 | this, SLOT( slotNew() ) ); |
92 | a->addTo(m_tool ); | 99 | a->addTo(m_tool ); |
93 | a->addTo(m_edit ); | 100 | a->addTo(m_edit ); |
94 | 101 | ||
95 | a = new QAction( tr("Edit Task"), Resource::loadIconSet( "edit" ), | 102 | a = new QAction( tr("Edit Task"), Resource::loadIconSet( "edit" ), |
96 | QString::null, 0, this, 0 ); | 103 | QString::null, 0, this, 0 ); |
97 | connect(a, SIGNAL(activated() ), | 104 | connect(a, SIGNAL(activated() ), |
98 | this, SLOT( slotEdit() ) ); | 105 | this, SLOT( slotEdit() ) ); |
99 | a->addTo( m_tool ); | 106 | a->addTo( m_tool ); |
100 | a->addTo( m_edit ); | 107 | a->addTo( m_edit ); |
101 | m_editAction = a; | 108 | m_editAction = a; |
102 | 109 | ||
103 | a = new QAction( QString::null, tr("View Task"), 0, this, 0 ); | 110 | a = new QAction( QString::null, tr("View Task"), 0, this, 0 ); |
@@ -135,97 +142,95 @@ void MainWindow::initActions() { | |||
135 | connect(a, SIGNAL( activated() ), | 142 | connect(a, SIGNAL( activated() ), |
136 | this, SLOT( slotDuplicate() ) ); | 143 | this, SLOT( slotDuplicate() ) ); |
137 | a->addTo(m_edit ); | 144 | a->addTo(m_edit ); |
138 | m_duplicateAction = a; | 145 | m_duplicateAction = a; |
139 | 146 | ||
140 | m_edit->insertSeparator(); | 147 | m_edit->insertSeparator(); |
141 | 148 | ||
142 | if ( Ir::supported() ) { | 149 | if ( Ir::supported() ) { |
143 | a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), | 150 | a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), |
144 | QString::null, 0, this, 0 ); | 151 | QString::null, 0, this, 0 ); |
145 | connect( a, SIGNAL( activated() ), | 152 | connect( a, SIGNAL( activated() ), |
146 | this, SLOT( slotBeam() ) ); | 153 | this, SLOT( slotBeam() ) ); |
147 | a->addTo( m_edit ); | 154 | a->addTo( m_edit ); |
148 | a->addTo( m_tool ); | 155 | a->addTo( m_tool ); |
149 | } | 156 | } |
150 | 157 | ||
158 | // Options menu | ||
151 | a = new QAction( tr("Find"), Resource::loadIconSet( "mag" ), | 159 | a = new QAction( tr("Find"), Resource::loadIconSet( "mag" ), |
152 | QString::null, 0, this, 0 ); | 160 | QString::null, 0, this, 0 ); |
153 | connect(a, SIGNAL( activated() ), | 161 | connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); |
154 | this, SLOT( slotFind() ) ); | ||
155 | a->addTo( m_options ); | 162 | a->addTo( m_options ); |
156 | m_findAction = a; | 163 | m_findAction = a; |
157 | 164 | ||
158 | m_options->insertSeparator(); | 165 | m_options->insertSeparator(); |
159 | 166 | ||
160 | m_completedAction = new QAction( QString::null, tr("Completed tasks"), | 167 | m_completedAction = new QAction( QString::null, tr("Show completed tasks"), |
161 | 0, this, 0, TRUE ); | 168 | 0, this, 0, TRUE ); |
162 | m_completedAction->addTo( m_options ); | 169 | m_completedAction->addTo( m_options ); |
163 | m_completedAction->setOn( showCompleted() ); | 170 | m_completedAction->setOn( showCompleted() ); |
164 | connect(m_completedAction, SIGNAL( toggled(bool) ), | 171 | connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); |
165 | this, SLOT(slotShowCompleted(bool) ) ); | ||
166 | 172 | ||
167 | m_showDeadLineAction = new QAction( QString::null, tr("Show Deadline"), | 173 | a = new QAction( QString::null, tr("Show only over-due tasks"), |
174 | 0, this, 0, TRUE ); | ||
175 | a->addTo( m_options ); | ||
176 | a->setOn( showOverDue() ); | ||
177 | connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); | ||
178 | |||
179 | m_showDeadLineAction = new QAction( QString::null, tr("Show task deadlines"), | ||
168 | 0, this, 0, TRUE ); | 180 | 0, this, 0, TRUE ); |
169 | m_showDeadLineAction->addTo( m_options ); | 181 | m_showDeadLineAction->addTo( m_options ); |
170 | m_showDeadLineAction->setOn( showDeadline() ); | 182 | m_showDeadLineAction->setOn( showDeadline() ); |
171 | connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), | 183 | connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) ); |
172 | this, SLOT( slotShowDeadLine( bool ) ) ); | 184 | |
185 | m_showQuickTaskAction = new QAction( QString::null, tr("Show quick task bar"), | ||
186 | 0, this, 0, TRUE ); | ||
187 | m_showQuickTaskAction->addTo( m_options ); | ||
188 | m_showQuickTaskAction->setOn( showQuickTask() ); | ||
189 | connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); | ||
173 | 190 | ||
174 | m_options->insertSeparator(); | 191 | m_options->insertSeparator(); |
175 | 192 | ||
176 | m_bar->insertItem( tr("Data") ,m_edit ); | 193 | m_bar->insertItem( tr("Data") ,m_edit ); |
177 | m_bar->insertItem( tr("Category"), m_catMenu ); | 194 | m_bar->insertItem( tr("Category"), m_catMenu ); |
178 | m_bar->insertItem( tr("Options"), m_options ); | 195 | m_bar->insertItem( tr("Options"), m_options ); |
179 | 196 | ||
180 | /* initialize the view menu */ | 197 | m_curQuick = new QuickEditImpl( this, m_quicktask ); |
181 | a = new QAction( QString::null, tr("Show only over due"), | 198 | addToolBar( (QPEToolBar *)m_curQuick->widget(), tr( "QuickEdit" ), QMainWindow::Top, TRUE ); |
182 | 0, this, 0, TRUE ); | 199 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); |
183 | a->addTo( m_options ); | ||
184 | a->setOn( showOverDue() ); | ||
185 | connect(a, SIGNAL(toggled(bool)), | ||
186 | this, SLOT(slotShowDue(bool) ) ); | ||
187 | |||
188 | /* templates */ | ||
189 | m_edit->insertItem(tr("New from template"), m_template, | ||
190 | -1, 0 ); | ||
191 | 200 | ||
192 | } | 201 | } |
193 | /* m_curCat from Config */ | 202 | /* m_curCat from Config */ |
194 | void MainWindow::initConfig() { | 203 | void MainWindow::initConfig() { |
195 | Config config( "todo" ); | 204 | Config config( "todo" ); |
196 | config.setGroup( "View" ); | 205 | config.setGroup( "View" ); |
197 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); | 206 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); |
198 | m_curCat = config.readEntry( "Category", QString::null ); | 207 | m_curCat = config.readEntry( "Category", QString::null ); |
199 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); | 208 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); |
200 | m_overdue = config.readBoolEntry("ShowOverDue", TRUE ); | 209 | m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); |
210 | m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); | ||
201 | } | 211 | } |
202 | void MainWindow::initUI() { | 212 | void MainWindow::initUI() { |
203 | m_mainBox = new QVBox(this, "main box "); | 213 | m_mainBox = new QVBox(this, "main box "); |
204 | m_curQuick = new QuickEditImpl(this, m_mainBox ); | ||
205 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); | ||
206 | m_quickEdit.append( m_curQuick ); | ||
207 | |||
208 | |||
209 | 214 | ||
210 | m_stack = new QWidgetStack(m_mainBox, "main stack"); | 215 | m_stack = new QWidgetStack(m_mainBox, "main stack"); |
211 | setCentralWidget( m_mainBox ); | 216 | setCentralWidget( m_mainBox ); |
212 | 217 | ||
213 | setToolBarsMovable( FALSE ); | 218 | setToolBarsMovable( FALSE ); |
214 | 219 | ||
215 | m_tool = new QToolBar( this ); | 220 | m_tool = new QPEToolBar( this ); |
216 | m_tool->setHorizontalStretchable( TRUE ); | 221 | m_tool->setHorizontalStretchable( TRUE ); |
217 | 222 | ||
218 | m_bar = new QMenuBar( m_tool ); | 223 | m_bar = new QMenuBar( m_tool ); |
219 | 224 | ||
220 | /** QPopupMenu */ | 225 | /** QPopupMenu */ |
221 | m_edit = new QPopupMenu( this ); | 226 | m_edit = new QPopupMenu( this ); |
222 | m_options = new QPopupMenu( this ); | 227 | m_options = new QPopupMenu( this ); |
223 | m_catMenu = new QPopupMenu( this ); | 228 | m_catMenu = new QPopupMenu( this ); |
224 | m_template = new QPopupMenu( this ); | 229 | m_template = new QPopupMenu( this ); |
225 | 230 | ||
226 | m_catMenu->setCheckable( TRUE ); | 231 | m_catMenu->setCheckable( TRUE ); |
227 | m_template->setCheckable( TRUE ); | 232 | m_template->setCheckable( TRUE ); |
228 | 233 | ||
229 | connect(m_catMenu, SIGNAL(activated(int) ), | 234 | connect(m_catMenu, SIGNAL(activated(int) ), |
230 | this, SLOT(setCategory(int) ) ); | 235 | this, SLOT(setCategory(int) ) ); |
231 | connect(m_template, SIGNAL(activated(int) ), | 236 | connect(m_template, SIGNAL(activated(int) ), |
@@ -358,33 +363,34 @@ void MainWindow::closeEvent( QCloseEvent* e ) { | |||
358 | QMessageBox::No|QMessageBox::Default) | 363 | QMessageBox::No|QMessageBox::Default) |
359 | != QMessageBox::No ) { | 364 | != QMessageBox::No ) { |
360 | e->accept(); | 365 | e->accept(); |
361 | quit = true; | 366 | quit = true; |
362 | }else | 367 | }else |
363 | e->ignore(); | 368 | e->ignore(); |
364 | 369 | ||
365 | } | 370 | } |
366 | 371 | ||
367 | if (quit ) { | 372 | if (quit ) { |
368 | Config config( "todo" ); | 373 | Config config( "todo" ); |
369 | config.setGroup( "View" ); | 374 | config.setGroup( "View" ); |
370 | config.writeEntry( "ShowComplete", showCompleted() ); | 375 | config.writeEntry( "ShowComplete", showCompleted() ); |
371 | config.writeEntry( "Category", currentCategory() ); | 376 | config.writeEntry( "Category", currentCategory() ); |
372 | config.writeEntry( "ShowDeadLine", showDeadline()); | 377 | config.writeEntry( "ShowDeadLine", showDeadline()); |
373 | config.writeEntry( "ShowOverDue", showOverDue() ); | 378 | config.writeEntry( "ShowOverDue", showOverDue() ); |
374 | /* svae templates */ | 379 | config.writeEntry( "ShowQuickTask", showQuickTask() ); |
380 | /* save templates */ | ||
375 | templateManager()->save(); | 381 | templateManager()->save(); |
376 | e->accept(); | 382 | e->accept(); |
377 | } | 383 | } |
378 | } | 384 | } |
379 | void MainWindow::populateTemplates() { | 385 | void MainWindow::populateTemplates() { |
380 | m_template->clear(); | 386 | m_template->clear(); |
381 | QStringList list = templateManager()->templates(); | 387 | QStringList list = templateManager()->templates(); |
382 | QStringList::Iterator it; | 388 | QStringList::Iterator it; |
383 | for ( it = list.begin(); it != list.end(); ++it ) { | 389 | for ( it = list.begin(); it != list.end(); ++it ) { |
384 | m_template->insertItem( (*it) ); | 390 | m_template->insertItem( (*it) ); |
385 | } | 391 | } |
386 | } | 392 | } |
387 | /* | 393 | /* |
388 | * slotNewFromTemplate | 394 | * slotNewFromTemplate |
389 | * We use the edit widget to do | 395 | * We use the edit widget to do |
390 | * the config but we setUid(-1) | 396 | * the config but we setUid(-1) |
@@ -502,32 +508,39 @@ void MainWindow::setCategory( int c) { | |||
502 | m_curCat = m_todoMgr.categories()[c-2]; | 508 | m_curCat = m_todoMgr.categories()[c-2]; |
503 | setCaption( tr("Todo") + " - " + m_curCat ); | 509 | setCaption( tr("Todo") + " - " + m_curCat ); |
504 | } | 510 | } |
505 | m_catMenu->setItemChecked( c, true ); | 511 | m_catMenu->setItemChecked( c, true ); |
506 | 512 | ||
507 | currentView()->setShowCategory( m_curCat ); | 513 | currentView()->setShowCategory( m_curCat ); |
508 | raiseCurrentView(); | 514 | raiseCurrentView(); |
509 | } | 515 | } |
510 | void MainWindow::slotShowDeadLine( bool dead) { | 516 | void MainWindow::slotShowDeadLine( bool dead) { |
511 | m_deadline = dead; | 517 | m_deadline = dead; |
512 | currentView()->setShowDeadline( dead ); | 518 | currentView()->setShowDeadline( dead ); |
513 | } | 519 | } |
514 | void MainWindow::slotShowCompleted( bool show) { | 520 | void MainWindow::slotShowCompleted( bool show) { |
515 | m_completed = show; | 521 | m_completed = show; |
516 | currentView()->setShowCompleted( m_completed ); | 522 | currentView()->setShowCompleted( m_completed ); |
517 | } | 523 | } |
524 | void MainWindow::slotShowQuickTask( bool show ) { | ||
525 | m_quicktask = show; | ||
526 | if ( m_quicktask ) | ||
527 | m_curQuick->widget()->show(); | ||
528 | else | ||
529 | m_curQuick->widget()->hide(); | ||
530 | } | ||
518 | bool MainWindow::showOverDue()const { | 531 | bool MainWindow::showOverDue()const { |
519 | return m_overdue; | 532 | return m_overdue; |
520 | } | 533 | } |
521 | void MainWindow::setDocument( const QString& fi) { | 534 | void MainWindow::setDocument( const QString& fi) { |
522 | DocLnk doc(fi); | 535 | DocLnk doc(fi); |
523 | if (doc.isValid() ) | 536 | if (doc.isValid() ) |
524 | receiveFile(doc.file() ); | 537 | receiveFile(doc.file() ); |
525 | else | 538 | else |
526 | receiveFile(fi ); | 539 | receiveFile(fi ); |
527 | } | 540 | } |
528 | 541 | ||
529 | static const char *beamfile = "/tmp/opie-todo.vcs"; | 542 | static const char *beamfile = "/tmp/opie-todo.vcs"; |
530 | void MainWindow::slotBeam() { | 543 | void MainWindow::slotBeam() { |
531 | beam( currentView()->current() ); | 544 | beam( currentView()->current() ); |
532 | } | 545 | } |
533 | void MainWindow::beamDone( Ir* ir) { | 546 | void MainWindow::beamDone( Ir* ir) { |
@@ -578,32 +591,35 @@ void MainWindow::populateCategories() { | |||
578 | categories.append( tr( "Unfiled" ) ); | 591 | categories.append( tr( "Unfiled" ) ); |
579 | for ( QStringList::Iterator it = categories.begin(); | 592 | for ( QStringList::Iterator it = categories.begin(); |
580 | it != categories.end(); ++it ) { | 593 | it != categories.end(); ++it ) { |
581 | m_catMenu->insertItem( *it, id ); | 594 | m_catMenu->insertItem( *it, id ); |
582 | if ( *it == currentCategory() ) | 595 | if ( *it == currentCategory() ) |
583 | rememberId = id; | 596 | rememberId = id; |
584 | ++id; | 597 | ++id; |
585 | } | 598 | } |
586 | setCategory( rememberId ); | 599 | setCategory( rememberId ); |
587 | } | 600 | } |
588 | bool MainWindow::showCompleted()const { | 601 | bool MainWindow::showCompleted()const { |
589 | return m_completed; | 602 | return m_completed; |
590 | } | 603 | } |
591 | bool MainWindow::showDeadline()const { | 604 | bool MainWindow::showDeadline()const { |
592 | return m_deadline; | 605 | return m_deadline; |
593 | } | 606 | } |
607 | bool MainWindow::showQuickTask()const { | ||
608 | return m_quicktask; | ||
609 | } | ||
594 | QString MainWindow::currentCategory()const { | 610 | QString MainWindow::currentCategory()const { |
595 | return m_curCat; | 611 | return m_curCat; |
596 | } | 612 | } |
597 | int MainWindow::currentCatId() { | 613 | int MainWindow::currentCatId() { |
598 | return m_todoMgr.catId( m_curCat ); | 614 | return m_todoMgr.catId( m_curCat ); |
599 | } | 615 | } |
600 | ViewBase* MainWindow::currentView() { | 616 | ViewBase* MainWindow::currentView() { |
601 | return m_curView; | 617 | return m_curView; |
602 | } | 618 | } |
603 | void MainWindow::raiseCurrentView() { | 619 | void MainWindow::raiseCurrentView() { |
604 | m_stack->raiseWidget( m_curView->widget() ); | 620 | m_stack->raiseWidget( m_curView->widget() ); |
605 | } | 621 | } |
606 | void MainWindow::slotShowDue(bool ov) { | 622 | void MainWindow::slotShowDue(bool ov) { |
607 | m_overdue = ov; | 623 | m_overdue = ov; |
608 | currentView()->showOverDue( ov ); | 624 | currentView()->showOverDue( ov ); |
609 | raiseCurrentView(); | 625 | raiseCurrentView(); |
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index 87a9133..86b9ac2 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -34,32 +34,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 | 51 | ||
51 | namespace Todo { | 52 | namespace Todo { |
52 | typedef TodoView View; | 53 | typedef TodoView View; |
53 | class TemplateManager; | 54 | class TemplateManager; |
54 | class Editor; | 55 | class Editor; |
55 | class TodoShow; | 56 | class TodoShow; |
56 | class TemplateEditor; | 57 | class TemplateEditor; |
57 | struct QuickEditBase; | 58 | struct QuickEditBase; |
58 | 59 | ||
59 | class MainWindow : public OPimMainWindow { | 60 | class MainWindow : public OPimMainWindow { |
60 | Q_OBJECT | 61 | Q_OBJECT |
61 | friend class TodoView; // avoid QObject here.... | 62 | friend class TodoView; // avoid QObject here.... |
62 | public: | 63 | public: |
63 | MainWindow( QWidget *parent = 0, | 64 | MainWindow( QWidget *parent = 0, |
64 | const char* name = 0 ); | 65 | const char* name = 0 ); |
65 | ~MainWindow(); | 66 | ~MainWindow(); |
@@ -69,32 +70,33 @@ namespace Todo { | |||
69 | QPopupMenu* options(); | 70 | QPopupMenu* options(); |
70 | QPopupMenu* edit(); | 71 | QPopupMenu* edit(); |
71 | QToolBar* toolbar(); | 72 | QToolBar* toolbar(); |
72 | 73 | ||
73 | 74 | ||
74 | void updateList(); | 75 | void updateList(); |
75 | OTodoAccess::List list()const; | 76 | OTodoAccess::List list()const; |
76 | OTodoAccess::List sorted( bool asc, int sortOrder ); | 77 | OTodoAccess::List sorted( bool asc, int sortOrder ); |
77 | OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); | 78 | OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); |
78 | 79 | ||
79 | OTodo event(int uid ); | 80 | OTodo event(int uid ); |
80 | 81 | ||
81 | bool isSyncing()const; | 82 | bool isSyncing()const; |
82 | bool showCompleted()const; | 83 | bool showCompleted()const; |
83 | bool showDeadline()const; | 84 | bool showDeadline()const; |
84 | bool showOverDue()const; | 85 | bool showOverDue()const; |
86 | bool showQuickTask()const; | ||
85 | QString currentCategory()const; | 87 | QString currentCategory()const; |
86 | int currentCatId(); | 88 | int currentCatId(); |
87 | TemplateManager* templateManager(); | 89 | TemplateManager* templateManager(); |
88 | QuickEditBase* quickEditor(); | 90 | QuickEditBase* quickEditor(); |
89 | 91 | ||
90 | void updateTodo( const OTodo& ); | 92 | void updateTodo( const OTodo& ); |
91 | void populateTemplates(); | 93 | void populateTemplates(); |
92 | Editor* currentEditor(); | 94 | Editor* currentEditor(); |
93 | void setReadAhead(uint count ); | 95 | void setReadAhead(uint count ); |
94 | private slots: | 96 | private slots: |
95 | void slotQuickEntered(); | 97 | void slotQuickEntered(); |
96 | void populateCategories(); | 98 | void populateCategories(); |
97 | void slotReload(); | 99 | void slotReload(); |
98 | void slotFlush(); | 100 | void slotFlush(); |
99 | 101 | ||
100 | protected: | 102 | protected: |
@@ -118,79 +120,81 @@ private slots: | |||
118 | TodoShow* currentShow(); | 120 | TodoShow* currentShow(); |
119 | TodoShow* m_curShow; | 121 | TodoShow* m_curShow; |
120 | TemplateEditor* currentTemplateEditor(); | 122 | TemplateEditor* currentTemplateEditor(); |
121 | TemplateEditor* m_curTempEd; | 123 | TemplateEditor* m_curTempEd; |
122 | 124 | ||
123 | QMenuBar* m_bar; | 125 | QMenuBar* m_bar; |
124 | QToolBar* m_tool; | 126 | QToolBar* m_tool; |
125 | QAction* m_editAction, | 127 | QAction* m_editAction, |
126 | *m_deleteAction, | 128 | *m_deleteAction, |
127 | *m_findAction, | 129 | *m_findAction, |
128 | *m_completedAction, | 130 | *m_completedAction, |
129 | *m_showDeadLineAction, | 131 | *m_showDeadLineAction, |
130 | *m_deleteAllAction, | 132 | *m_deleteAllAction, |
131 | *m_deleteCompleteAction, | 133 | *m_deleteCompleteAction, |
132 | *m_duplicateAction, | 134 | *m_duplicateAction, |
133 | *m_showOverDueAction, | 135 | *m_showOverDueAction, |
136 | *m_showQuickTaskAction, | ||
134 | *m_effectiveAction; | 137 | *m_effectiveAction; |
135 | QWidgetStack *m_stack; | 138 | QWidgetStack *m_stack; |
136 | QPopupMenu* m_catMenu, | 139 | QPopupMenu* m_catMenu, |
137 | *m_edit, | 140 | *m_edit, |
138 | *m_options, | 141 | *m_options, |
139 | *m_template; | 142 | *m_template; |
140 | /* box with two rows | 143 | /* box with two rows |
141 | * top will be the quick edit | 144 | * top will be the quick edit |
142 | * this will bite my ass once | 145 | * this will bite my ass once |
143 | * we want to have all parts | 146 | * we want to have all parts |
144 | * exchangeable | 147 | * exchangeable |
145 | */ | 148 | */ |
146 | QVBox* m_mainBox; | 149 | QVBox* m_mainBox; |
147 | 150 | ||
148 | bool m_syncing:1; | 151 | bool m_syncing:1; |
149 | bool m_deadline:1; | 152 | bool m_deadline:1; |
150 | bool m_completed:1; | 153 | bool m_completed:1; |
151 | bool m_overdue:1; | 154 | bool m_overdue:1; |
155 | bool m_quicktask:1; | ||
152 | TodoManager m_todoMgr; | 156 | TodoManager m_todoMgr; |
153 | QString m_curCat; | 157 | QString m_curCat; |
154 | QList<ViewBase> m_views; | 158 | QList<ViewBase> m_views; |
155 | QList<QuickEditBase> m_quickEdit; | ||
156 | uint m_counter; | 159 | uint m_counter; |
157 | TemplateManager* m_tempManager; | 160 | TemplateManager* m_tempManager; |
158 | 161 | ||
159 | 162 | ||
160 | private slots: | 163 | private slots: |
161 | void slotShow(int); | 164 | void slotShow(int); |
162 | void slotEdit(int); | 165 | void slotEdit(int); |
163 | void slotUpdate3( QWidget* ); | 166 | void slotUpdate3( QWidget* ); |
164 | void slotComplete( int uid ); | 167 | void slotComplete( int uid ); |
165 | void slotComplete( const OTodo& ev ); | 168 | void slotComplete( const OTodo& ev ); |
166 | void slotNewFromTemplate(int id ); | 169 | void slotNewFromTemplate(int id ); |
167 | void slotNew(); | 170 | void slotNew(); |
168 | void slotDuplicate(); | 171 | void slotDuplicate(); |
169 | 172 | ||
170 | void slotDelete(); | 173 | void slotDelete(); |
171 | void slotDeleteAll(); | 174 | void slotDeleteAll(); |
172 | void slotDeleteCompleted(); | 175 | void slotDeleteCompleted(); |
173 | 176 | ||
174 | void slotEdit(); | 177 | void slotEdit(); |
175 | void slotFind(); | 178 | void slotFind(); |
176 | 179 | ||
177 | void setCategory( int ); | 180 | void setCategory( int ); |
178 | 181 | ||
179 | void slotShowDeadLine( bool ); | 182 | void slotShowDeadLine( bool ); |
180 | void slotShowCompleted( bool ); | 183 | void slotShowCompleted( bool ); |
184 | void slotShowQuickTask( bool ); | ||
181 | 185 | ||
182 | void setDocument( const QString& ); | 186 | void setDocument( const QString& ); |
183 | 187 | ||
184 | 188 | ||
185 | void slotBeam(); | 189 | void slotBeam(); |
186 | void beamDone( Ir* ); | 190 | void beamDone( Ir* ); |
187 | void slotShowDetails(); | 191 | void slotShowDetails(); |
188 | void slotShowDue( bool ); | 192 | void slotShowDue( bool ); |
189 | /* reimplementation from opimmainwindow */ | 193 | /* reimplementation from opimmainwindow */ |
190 | protected slots: | 194 | protected slots: |
191 | void flush(); | 195 | void flush(); |
192 | void reload(); | 196 | void reload(); |
193 | int create(); | 197 | int create(); |
194 | bool remove( int uid ); | 198 | bool remove( int uid ); |
195 | void beam(int uid, int transport = IrDa ); | 199 | void beam(int uid, int transport = IrDa ); |
196 | void show( int uid ); | 200 | void show( int uid ); |
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp index 2dd5b61..9b54bdc 100644 --- a/core/pim/todo/quickeditimpl.cpp +++ b/core/pim/todo/quickeditimpl.cpp | |||
@@ -1,89 +1,99 @@ | |||
1 | #include <qaction.h> | ||
1 | #include <qlineedit.h> | 2 | #include <qlineedit.h> |
2 | 3 | ||
4 | #include <qpe/resource.h> | ||
5 | |||
3 | #include <opie/oclickablelabel.h> | 6 | #include <opie/oclickablelabel.h> |
4 | 7 | ||
5 | #include "mainwindow.h" | 8 | #include "mainwindow.h" |
6 | #include "quickeditimpl.h" | 9 | #include "quickeditimpl.h" |
7 | 10 | ||
8 | 11 | ||
9 | QuickEditImpl::QuickEditImpl( Todo::MainWindow* win, QWidget* arent ) | 12 | QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) |
10 | : QHBox(arent), Todo::QuickEdit(win) { | 13 | : QPEToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { |
11 | m_lbl = new OClickableLabel(this ); | 14 | setHorizontalStretchable( TRUE ); |
12 | m_lbl->setMinimumWidth(12); | ||
13 | m_lbl->setText("3"); | ||
14 | 15 | ||
15 | m_edit = new QLineEdit(this ); | 16 | // TODO - come up with icons and replace text priority values |
17 | m_lbl = new OClickableLabel( this ); | ||
18 | m_lbl->setMinimumWidth(15); | ||
19 | m_lbl->setText("3"); | ||
20 | connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); | ||
16 | 21 | ||
17 | m_enter = new OClickableLabel(this); | 22 | m_edit = new QLineEdit( this ); |
18 | m_enter->setText("Enter"); | 23 | setStretchableWidget( m_edit ); |
19 | 24 | ||
20 | m_more = new OClickableLabel(this); | 25 | QAction *a = new QAction( tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); |
21 | m_more->setText("More"); | 26 | connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); |
27 | a->addTo( this ); | ||
22 | 28 | ||
29 | a = new QAction( tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | ||
30 | connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); | ||
31 | a->addTo( this ); | ||
23 | 32 | ||
24 | // connect | 33 | a = new QAction( tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
25 | connect(m_lbl, SIGNAL(clicked() ), | 34 | connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); |
26 | this, SLOT(slotPrio()) ); | 35 | a->addTo( this ); |
27 | connect(m_enter, SIGNAL(clicked() ), | ||
28 | this, SLOT(slotEnter() ) ); | ||
29 | connect(m_more, SIGNAL(clicked() ), | ||
30 | this, SLOT(slotMore() ) ); | ||
31 | 36 | ||
37 | m_visible = visible; | ||
38 | if ( !m_visible ) { | ||
39 | hide(); | ||
40 | } | ||
41 | |||
32 | m_menu = 0l; | 42 | m_menu = 0l; |
33 | reinit(); | 43 | reinit(); |
34 | setMaximumHeight( m_edit->sizeHint().height() ); | ||
35 | } | 44 | } |
36 | QuickEditImpl::~QuickEditImpl() { | 45 | QuickEditImpl::~QuickEditImpl() { |
37 | 46 | ||
38 | } | 47 | } |
39 | OTodo QuickEditImpl::todo()const { | 48 | OTodo QuickEditImpl::todo()const { |
40 | return m_todo; | 49 | return m_todo; |
41 | } | 50 | } |
42 | QWidget* QuickEditImpl::widget() { | 51 | QWidget* QuickEditImpl::widget() { |
43 | return this; | 52 | return this; |
44 | } | 53 | } |
45 | QSize QuickEditImpl::sizeHint()const{ | ||
46 | return m_edit->sizeHint(); | ||
47 | } | ||
48 | void QuickEditImpl::slotEnter() { | 54 | void QuickEditImpl::slotEnter() { |
49 | OTodo todo; | 55 | OTodo todo; |
50 | 56 | ||
51 | 57 | ||
52 | if (!m_edit->text().isEmpty() ) { | 58 | if (!m_edit->text().isEmpty() ) { |
53 | todo.setUid(1 ); // new uid | 59 | todo.setUid(1 ); // new uid |
54 | todo.setPriority( m_lbl->text().toInt() ); | 60 | todo.setPriority( m_lbl->text().toInt() ); |
55 | todo.setSummary( m_edit->text() ); | 61 | todo.setSummary( m_edit->text() ); |
56 | if ( mainWindow()->currentCatId() != 0 ) | 62 | if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 ) |
57 | todo.setCategories( mainWindow()->currentCatId() ); | 63 | todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() ); |
58 | 64 | ||
59 | m_todo = todo; | 65 | m_todo = todo; |
60 | commit(); | 66 | commit(); |
61 | } | 67 | } |
62 | m_todo = todo; | 68 | m_todo = todo; |
63 | reinit(); | 69 | reinit(); |
64 | } | 70 | } |
65 | void QuickEditImpl::slotPrio() { | 71 | void QuickEditImpl::slotPrio() { |
66 | m_state++; | 72 | m_state++; |
67 | if (m_state > 2 ) | 73 | if (m_state > 2 ) |
68 | m_state = 0; | 74 | m_state = 0; |
69 | 75 | ||
70 | switch(m_state ) { | 76 | switch(m_state ) { |
71 | case 0: | 77 | case 0: |
72 | m_lbl->setText( "1" ); | 78 | m_lbl->setText( "1" ); |
73 | break; | 79 | break; |
74 | case 2: | 80 | case 2: |
75 | m_lbl->setText( "5" ); | 81 | m_lbl->setText( "5" ); |
76 | break; | 82 | break; |
77 | case 1: | 83 | case 1: |
78 | default: | 84 | default: |
79 | m_lbl->setText( "3"); | 85 | m_lbl->setText( "3"); |
80 | break; | 86 | break; |
81 | } | 87 | } |
82 | } | 88 | } |
83 | void QuickEditImpl::slotMore() { | 89 | void QuickEditImpl::slotMore() { |
90 | // TODO - implement | ||
91 | } | ||
92 | void QuickEditImpl::slotCancel() { | ||
93 | reinit(); | ||
84 | } | 94 | } |
85 | void QuickEditImpl::reinit() { | 95 | void QuickEditImpl::reinit() { |
86 | m_state = 1; | 96 | m_state = 1; |
87 | m_lbl->setText("3"); | 97 | m_lbl->setText("3"); |
88 | m_edit->clear(); | 98 | m_edit->clear(); |
89 | } | 99 | } |
diff --git a/core/pim/todo/quickeditimpl.h b/core/pim/todo/quickeditimpl.h index d0f6c69..c58275e 100644 --- a/core/pim/todo/quickeditimpl.h +++ b/core/pim/todo/quickeditimpl.h | |||
@@ -1,34 +1,35 @@ | |||
1 | #ifndef OPIE_QUICK_EDIT_IMPL_H | 1 | #ifndef OPIE_QUICK_EDIT_IMPL_H |
2 | #define OPIE_QUICK_EDIT_IMPL_H | 2 | #define OPIE_QUICK_EDIT_IMPL_H |
3 | 3 | ||
4 | #include <qhbox.h> | 4 | #include <qpe/qpetoolbar.h> |
5 | 5 | ||
6 | #include "quickedit.h" | 6 | #include "quickedit.h" |
7 | 7 | ||
8 | class QLineEdit; | 8 | class QLineEdit; |
9 | class QLabel; | 9 | class QLabel; |
10 | 10 | ||
11 | class QuickEditImpl : public QHBox, public Todo::QuickEdit { | 11 | class QuickEditImpl : public QPEToolBar, public Todo::QuickEdit { |
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | public: | 13 | public: |
14 | QuickEditImpl( Todo::MainWindow* win , QWidget* parent); | 14 | QuickEditImpl( QWidget* parent, bool visible); |
15 | ~QuickEditImpl(); | 15 | ~QuickEditImpl(); |
16 | OTodo todo()const; | 16 | OTodo todo()const; |
17 | QWidget* widget(); | 17 | QWidget* widget(); |
18 | QSize sizeHint()const; | ||
19 | private slots: | 18 | private slots: |
20 | void slotEnter(); | 19 | void slotEnter(); |
21 | void slotPrio(); | 20 | void slotPrio(); |
22 | void slotMore(); | 21 | void slotMore(); |
22 | void slotCancel(); | ||
23 | private: | 23 | private: |
24 | void reinit(); | 24 | void reinit(); |
25 | int m_state; | 25 | int m_state; |
26 | QLabel* m_lbl; | 26 | QLabel* m_lbl; |
27 | QLineEdit* m_edit; | 27 | QLineEdit* m_edit; |
28 | QLabel* m_enter; | 28 | QLabel* m_enter; |
29 | QLabel* m_more; | 29 | QLabel* m_more; |
30 | QPopupMenu* m_menu; | 30 | QPopupMenu* m_menu; |
31 | OTodo m_todo; | 31 | OTodo m_todo; |
32 | bool m_visible; | ||
32 | }; | 33 | }; |
33 | 34 | ||
34 | #endif | 35 | #endif |