summaryrefslogtreecommitdiff
path: root/core/pim/todo
Unidiff
Diffstat (limited to 'core/pim/todo') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp70
-rw-r--r--core/pim/todo/mainwindow.h6
-rw-r--r--core/pim/todo/quickeditimpl.cpp56
-rw-r--r--core/pim/todo/quickeditimpl.h9
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
@@ -28,4 +28,5 @@
28 28
29#include <unistd.h> 29#include <unistd.h>
30#include <stdio.h>
30 31
31#include <qmenubar.h> 32#include <qmenubar.h>
@@ -44,4 +45,5 @@
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>
@@ -86,4 +88,9 @@ void MainWindow::initTemplate() {
86} 88}
87void MainWindow::initActions() { 89void 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 );
@@ -149,8 +156,8 @@ void MainWindow::initActions() {
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;
@@ -158,17 +165,27 @@ void MainWindow::initActions() {
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();
@@ -178,15 +195,7 @@ void MainWindow::initActions() {
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}
@@ -198,13 +207,9 @@ void MainWindow::initConfig() {
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}
202void MainWindow::initUI() { 212void 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");
@@ -213,5 +218,5 @@ void MainWindow::initUI() {
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
@@ -372,5 +377,6 @@ void MainWindow::closeEvent( QCloseEvent* e ) {
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();
@@ -516,4 +522,11 @@ void MainWindow::slotShowCompleted( bool show) {
516 currentView()->setShowCompleted( m_completed ); 522 currentView()->setShowCompleted( m_completed );
517} 523}
524void 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}
518bool MainWindow::showOverDue()const { 531bool MainWindow::showOverDue()const {
519 return m_overdue; 532 return m_overdue;
@@ -592,4 +605,7 @@ bool MainWindow::showDeadline()const {
592 return m_deadline; 605 return m_deadline;
593} 606}
607bool MainWindow::showQuickTask()const {
608 return m_quicktask;
609}
594QString MainWindow::currentCategory()const { 610QString MainWindow::currentCategory()const {
595 return m_curCat; 611 return m_curCat;
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
@@ -48,4 +48,5 @@ class QWidgetStack;
48class Ir; 48class Ir;
49class QVBox; 49class QVBox;
50class QLineEdit;
50 51
51namespace Todo { 52namespace Todo {
@@ -83,4 +84,5 @@ namespace Todo {
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();
@@ -132,4 +134,5 @@ private slots:
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;
@@ -150,8 +153,8 @@ private slots:
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;
@@ -179,4 +182,5 @@ private slots:
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& );
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,4 +1,7 @@
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
@@ -7,30 +10,36 @@
7 10
8 11
9QuickEditImpl::QuickEditImpl( Todo::MainWindow* win, QWidget* arent ) 12QuickEditImpl::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}
36QuickEditImpl::~QuickEditImpl() { 45QuickEditImpl::~QuickEditImpl() {
@@ -43,7 +52,4 @@ QWidget* QuickEditImpl::widget() {
43 return this; 52 return this;
44} 53}
45QSize QuickEditImpl::sizeHint()const{
46 return m_edit->sizeHint();
47}
48void QuickEditImpl::slotEnter() { 54void QuickEditImpl::slotEnter() {
49 OTodo todo; 55 OTodo todo;
@@ -54,6 +60,6 @@ void QuickEditImpl::slotEnter() {
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;
@@ -82,4 +88,8 @@ void QuickEditImpl::slotPrio() {
82} 88}
83void QuickEditImpl::slotMore() { 89void QuickEditImpl::slotMore() {
90 // TODO - implement
91}
92void QuickEditImpl::slotCancel() {
93 reinit();
84} 94}
85void QuickEditImpl::reinit() { 95void QuickEditImpl::reinit() {
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
@@ -2,5 +2,5 @@
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"
@@ -9,16 +9,16 @@ class QLineEdit;
9class QLabel; 9class QLabel;
10 10
11class QuickEditImpl : public QHBox, public Todo::QuickEdit { 11class QuickEditImpl : public QPEToolBar, public Todo::QuickEdit {
12 Q_OBJECT 12 Q_OBJECT
13public: 13public:
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;
19private slots: 18private slots:
20 void slotEnter(); 19 void slotEnter();
21 void slotPrio(); 20 void slotPrio();
22 void slotMore(); 21 void slotMore();
22 void slotCancel();
23private: 23private:
24 void reinit(); 24 void reinit();
@@ -30,4 +30,5 @@ private:
30 QPopupMenu* m_menu; 30 QPopupMenu* m_menu;
31 OTodo m_todo; 31 OTodo m_todo;
32 bool m_visible;
32}; 33};
33 34