summaryrefslogtreecommitdiff
path: root/core/pim/todo/taskeditoroverviewimpl.cpp
authorzecke <zecke>2002-10-21 13:45:10 (UTC)
committer zecke <zecke>2002-10-21 13:45:10 (UTC)
commit5e2e1e70e6cc7cadce96e42f83951b87e3f2209e (patch) (unidiff)
tree6350fbbaf5a4494817a133f46fea44baeb1e3098 /core/pim/todo/taskeditoroverviewimpl.cpp
parent2c61d682a74f9ce2a216cf59c33c3dcecf00a213 (diff)
downloadopie-5e2e1e70e6cc7cadce96e42f83951b87e3f2209e.zip
opie-5e2e1e70e6cc7cadce96e42f83951b87e3f2209e.tar.gz
opie-5e2e1e70e6cc7cadce96e42f83951b87e3f2209e.tar.bz2
Fix a bug where newly added items did not show up in the view
Now we add the Entry to the backend first and then update the view next step is to make place for the new EditorWidget It features Completed/Start Date State Began, Postponed... Maintainer Mode: needs to be done by... Maintainer: Choose a person who is responsible for ( once implemented I hope he master of our feeds is happy ) Recurrance Widget Alarms + Reminders Widget Parent to be added Most of it is not implemented cause first of all OTodo does not know anything about these attributes but this will change soon. I'll start to implement it very soon
Diffstat (limited to 'core/pim/todo/taskeditoroverviewimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/taskeditoroverviewimpl.cpp169
1 files changed, 169 insertions, 0 deletions
diff --git a/core/pim/todo/taskeditoroverviewimpl.cpp b/core/pim/todo/taskeditoroverviewimpl.cpp
new file mode 100644
index 0000000..b9b2ae6
--- a/dev/null
+++ b/core/pim/todo/taskeditoroverviewimpl.cpp
@@ -0,0 +1,169 @@
1#include <qapplication.h>
2#include <qcheckbox.h>
3#include <qcombobox.h>
4#include <qpopupmenu.h>
5
6#include <qpe/datebookmonth.h>
7#include <qpe/categoryselect.h>
8#include <qpe/timestring.h>
9
10#include "taskeditoroverviewimpl.h"
11
12/*
13 * we need to hack
14 */
15
16TaskEditorOverViewImpl::TaskEditorOverViewImpl( QWidget* parent, const char* name )
17 : TaskEditorOverView( parent, name ) {
18 init();
19}
20TaskEditorOverViewImpl::~TaskEditorOverViewImpl() {
21}
22void TaskEditorOverViewImpl::load( const OTodo& todo) {
23 QDate date = QDate::currentDate();
24 QString str = TimeString::longDateString( date );
25
26 emit recurranceEnabled( FALSE );
27 ckbStart->setChecked( FALSE );
28 btnStart->setText( str );
29
30 ckbComp->setChecked( FALSE );
31 btnComp->setText( str );
32
33 cmbProgress->setCurrentItem( todo.progress()/20 );
34 cmbSum->insertItem( todo.summary(), 0 );
35 cmbSum->setCurrentItem( 0 );
36
37 ckbDue->setChecked( todo.hasDueDate() );
38 btnDue->setText( TimeString::longDateString( todo.dueDate() ) );
39
40 cmbPrio->setCurrentItem( todo.priority() -1 );
41 ckbCompleted->setChecked( todo.isCompleted() );
42
43 comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") );
44
45}
46void TaskEditorOverViewImpl::save( OTodo& to) {
47 qWarning("save it now");
48 if ( ckbDue->isChecked() ) {
49 to.setDueDate( m_due );
50 to.setHasDueDate( true );
51 }else
52 to.setHasDueDate( false );
53 if ( comboCategory->currentCategory() != -1 ) {
54 QArray<int> arr = comboCategory->currentCategories();
55 to.setCategories( arr );
56 }
57 to.setPriority( cmbPrio->currentItem() + 1 );
58 to.setCompleted( ckbCompleted->isChecked() );
59 to.setSummary( cmbSum->currentText() );
60 to.setProgress( cmbProgress->currentItem() * 20 );
61}
62/*
63 * here we will init the basic view
64 * one Popup for each Date Button
65 * and some other signal and slots connection
66 */
67void TaskEditorOverViewImpl::init() {
68 QDate curDate = QDate::currentDate();
69 m_start = m_comp = m_due = curDate;
70 QString str = TimeString::longDateString( curDate );
71
72 /* Start Date Picker */
73 m_startPop = new QPopupMenu(this);
74 m_startBook = new DateBookMonth(m_startPop, 0, TRUE );
75 m_startPop->insertItem( m_startBook );
76 connect( m_startBook, SIGNAL( dateClicked(int, int, int) ),
77 this, SLOT(slotStartChanged(int, int, int) ) );
78
79
80 /* Due Date Picker */
81 m_duePop = new QPopupMenu(this);
82 m_dueBook = new DateBookMonth(m_duePop, 0, TRUE );
83 m_duePop->insertItem( m_dueBook );
84 connect( m_dueBook, SIGNAL( dateClicked(int, int, int) ),
85 this, SLOT(slotDueChanged(int, int, int) ) );
86
87 m_compPop = new QPopupMenu(this);
88 m_compBook = new DateBookMonth(m_compPop, 0, TRUE );
89 m_compPop->insertItem(m_compBook );
90 connect( m_compBook, SIGNAL(dateClicked(int, int, int) ),
91 this, SLOT(slotCompletedChanged(int, int, int) ) );
92
93
94 /*
95 * another part of the hack
96 * it's deprecated in Qt2 but
97 * still available in my qt-copy of Qt3.1beta2
98 */
99 btnDue->setIsMenuButton( TRUE );
100 btnStart->setIsMenuButton( TRUE );
101 btnComp->setIsMenuButton( TRUE );
102
103 /* now connect the hack */
104 connect(btnDue, SIGNAL(clicked() ),
105 this, SLOT(hackySlotHack2() ) );
106 connect(btnStart, SIGNAL(clicked() ),
107 this, SLOT(hackySlotHack1() ) );
108 connect(btnComp, SIGNAL(clicked() ),
109 this, SLOT(hackySlotHack3() ) );
110
111 /* recurrance */
112 connect(CheckBox7, SIGNAL(clicked() ),
113 this, SLOT(slotRecClicked() ) );
114}
115
116void TaskEditorOverViewImpl::slotStartChecked() {
117 qWarning("slotStartChecked");
118 btnStart->setEnabled( ckbStart->isChecked() );
119}
120void TaskEditorOverViewImpl::slotStartChanged(int y, int m, int d) {
121 m_start.setYMD( y, m, d );
122 btnStart->setText( TimeString::longDateString( m_start ) );
123}
124void TaskEditorOverViewImpl::slotDueChecked() {
125 btnDue->setEnabled( ckbDue->isChecked() );
126 qWarning("slotDueChecked");
127}
128void TaskEditorOverViewImpl::slotDueChanged(int y, int m, int d ) {
129 m_due.setYMD(y, m, d );
130 btnDue->setText( TimeString::longDateString( m_due ) );
131}
132void TaskEditorOverViewImpl::slotCompletedChecked() {
133 btnComp->setEnabled( ckbComp->isChecked() );
134 qWarning("slotCompletedChecked");
135}
136void TaskEditorOverViewImpl::slotCompletedChanged(int y, int m, int d) {
137 m_comp.setYMD( y, m, d );
138 btnComp->setText( TimeString::longDateString( m_comp ) );
139}
140/*
141 * called by a button pressed event...
142 * three slots to avoid ugly name() tests
143 * to sender()
144 */
145void TaskEditorOverViewImpl::hackySlotHack1() {
146 btnStart->setDown( FALSE );
147 popup( btnStart, m_startPop );
148}
149void TaskEditorOverViewImpl::hackySlotHack2() {
150 btnDue->setDown( FALSE );
151 popup( btnDue, m_duePop );
152}
153void TaskEditorOverViewImpl::hackySlotHack3() {
154 btnComp->setDown( FALSE );
155 popup( btnComp, m_compPop );
156}
157void TaskEditorOverViewImpl::slotRecClicked() {
158 qWarning("enabled recurrance");
159 emit recurranceEnabled( CheckBox7->isChecked() );
160}
161/*
162 * GPL from TT QPushButton code
163 */
164void TaskEditorOverViewImpl::popup( QPushButton* pu, QPopupMenu* pop) {
165 if ( pu->mapToGlobal( QPoint(0, pu->rect().bottom() ) ).y() + pop->sizeHint().height() <= qApp->desktop()->height() )
166 pop->exec( pu->mapToGlobal( pu->rect().bottomLeft() ) );
167 else
168 pop->exec( pu->mapToGlobal( pu->rect().topLeft() - QPoint(0, pu->sizeHint().height() ) ) );
169}