summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/taskeditoroverviewimpl.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/pim/todo/taskeditoroverviewimpl.cpp b/core/pim/todo/taskeditoroverviewimpl.cpp
index c10ad40..24b3386 100644
--- a/core/pim/todo/taskeditoroverviewimpl.cpp
+++ b/core/pim/todo/taskeditoroverviewimpl.cpp
@@ -1,181 +1,182 @@
1#include <qapplication.h> 1#include <qapplication.h>
2#include <qcheckbox.h> 2#include <qcheckbox.h>
3#include <qcombobox.h> 3#include <qcombobox.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5 5
6#include <qpe/datebookmonth.h> 6#include <qpe/datebookmonth.h>
7#include <qpe/categoryselect.h> 7#include <qpe/categoryselect.h>
8#include <qpe/timestring.h> 8#include <qpe/timestring.h>
9 9
10#include "taskeditoroverviewimpl.h" 10#include "taskeditoroverviewimpl.h"
11 11
12/* 12/*
13 * we need to hack 13 * we need to hack
14 */ 14 */
15 15
16TaskEditorOverViewImpl::TaskEditorOverViewImpl( QWidget* parent, const char* name ) 16TaskEditorOverViewImpl::TaskEditorOverViewImpl( QWidget* parent, const char* name )
17 : TaskEditorOverView( parent, name ) { 17 : TaskEditorOverView( parent, name ) {
18 init(); 18 init();
19} 19}
20TaskEditorOverViewImpl::~TaskEditorOverViewImpl() { 20TaskEditorOverViewImpl::~TaskEditorOverViewImpl() {
21} 21}
22void TaskEditorOverViewImpl::load( const OTodo& todo) { 22void TaskEditorOverViewImpl::load( const OTodo& todo) {
23 /* 23 /*
24 * now that we're 'preloaded' we 24 * now that we're 'preloaded' we
25 * need to disable the buttons 25 * need to disable the buttons
26 * holding the dat 26 * holding the dat
27 */ 27 */
28 btnDue-> setEnabled( FALSE ); 28 btnDue-> setEnabled( FALSE );
29 btnComp-> setEnabled( FALSE ); 29 btnComp-> setEnabled( FALSE );
30 btnStart->setEnabled( FALSE ); 30 btnStart->setEnabled( FALSE );
31 31
32 32
33 QDate date = QDate::currentDate(); 33 QDate date = QDate::currentDate();
34 QString str = TimeString::longDateString( date ); 34 QString str = TimeString::longDateString( date );
35 35
36 emit recurranceEnabled( FALSE ); 36 emit recurranceEnabled( FALSE );
37 ckbStart->setChecked( FALSE ); 37 ckbStart->setChecked( FALSE );
38 btnStart->setText( str ); 38 btnStart->setText( str );
39 39
40 ckbComp->setChecked( FALSE ); 40 ckbComp->setChecked( FALSE );
41 btnComp->setText( str ); 41 btnComp->setText( str );
42 42
43 cmbProgress->setCurrentItem( todo.progress()/20 ); 43 cmbProgress->setCurrentItem( todo.progress()/20 );
44 cmbSum->insertItem( todo.summary(), 0 ); 44 cmbSum->insertItem( todo.summary(), 0 );
45 cmbSum->setCurrentItem( 0 ); 45 cmbSum->setCurrentItem( 0 );
46 46
47 ckbDue->setChecked( todo.hasDueDate() ); 47 ckbDue->setChecked( todo.hasDueDate() );
48 btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); 48 btnDue->setText( TimeString::longDateString( todo.dueDate() ) );
49 btnDue->setEnabled( todo.hasDueDate() );
49 50
50 cmbPrio->setCurrentItem( todo.priority() -1 ); 51 cmbPrio->setCurrentItem( todo.priority() -1 );
51 ckbCompleted->setChecked( todo.isCompleted() ); 52 ckbCompleted->setChecked( todo.isCompleted() );
52 53
53 comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); 54 comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") );
54 55
55} 56}
56void TaskEditorOverViewImpl::save( OTodo& to) { 57void TaskEditorOverViewImpl::save( OTodo& to) {
57 qWarning("save it now"); 58 qWarning("save it now");
58 if ( ckbDue->isChecked() ) { 59 if ( ckbDue->isChecked() ) {
59 to.setDueDate( m_due ); 60 to.setDueDate( m_due );
60 to.setHasDueDate( true ); 61 to.setHasDueDate( true );
61 }else 62 }else
62 to.setHasDueDate( false ); 63 to.setHasDueDate( false );
63 if ( comboCategory->currentCategory() != -1 ) { 64 if ( comboCategory->currentCategory() != -1 ) {
64 QArray<int> arr = comboCategory->currentCategories(); 65 QArray<int> arr = comboCategory->currentCategories();
65 to.setCategories( arr ); 66 to.setCategories( arr );
66 } 67 }
67 to.setPriority( cmbPrio->currentItem() + 1 ); 68 to.setPriority( cmbPrio->currentItem() + 1 );
68 to.setCompleted( ckbCompleted->isChecked() ); 69 to.setCompleted( ckbCompleted->isChecked() );
69 to.setSummary( cmbSum->currentText() ); 70 to.setSummary( cmbSum->currentText() );
70 to.setProgress( cmbProgress->currentItem() * 20 ); 71 to.setProgress( cmbProgress->currentItem() * 20 );
71} 72}
72/* 73/*
73 * here we will init the basic view 74 * here we will init the basic view
74 * one Popup for each Date Button 75 * one Popup for each Date Button
75 * and some other signal and slots connection 76 * and some other signal and slots connection
76 */ 77 */
77void TaskEditorOverViewImpl::init() { 78void TaskEditorOverViewImpl::init() {
78 QDate curDate = QDate::currentDate(); 79 QDate curDate = QDate::currentDate();
79 m_start = m_comp = m_due = curDate; 80 m_start = m_comp = m_due = curDate;
80 QString str = TimeString::longDateString( curDate ); 81 QString str = TimeString::longDateString( curDate );
81 82
82 83
83 84
84 /* Start Date Picker */ 85 /* Start Date Picker */
85 m_startPop = new QPopupMenu(this); 86 m_startPop = new QPopupMenu(this);
86 m_startBook = new DateBookMonth(m_startPop, 0, TRUE ); 87 m_startBook = new DateBookMonth(m_startPop, 0, TRUE );
87 m_startPop->insertItem( m_startBook ); 88 m_startPop->insertItem( m_startBook );
88 connect( m_startBook, SIGNAL( dateClicked(int, int, int) ), 89 connect( m_startBook, SIGNAL( dateClicked(int, int, int) ),
89 this, SLOT(slotStartChanged(int, int, int) ) ); 90 this, SLOT(slotStartChanged(int, int, int) ) );
90 91
91 92
92 /* Due Date Picker */ 93 /* Due Date Picker */
93 m_duePop = new QPopupMenu(this); 94 m_duePop = new QPopupMenu(this);
94 m_dueBook = new DateBookMonth(m_duePop, 0, TRUE ); 95 m_dueBook = new DateBookMonth(m_duePop, 0, TRUE );
95 m_duePop->insertItem( m_dueBook ); 96 m_duePop->insertItem( m_dueBook );
96 connect( m_dueBook, SIGNAL( dateClicked(int, int, int) ), 97 connect( m_dueBook, SIGNAL( dateClicked(int, int, int) ),
97 this, SLOT(slotDueChanged(int, int, int) ) ); 98 this, SLOT(slotDueChanged(int, int, int) ) );
98 99
99 m_compPop = new QPopupMenu(this); 100 m_compPop = new QPopupMenu(this);
100 m_compBook = new DateBookMonth(m_compPop, 0, TRUE ); 101 m_compBook = new DateBookMonth(m_compPop, 0, TRUE );
101 m_compPop->insertItem(m_compBook ); 102 m_compPop->insertItem(m_compBook );
102 connect( m_compBook, SIGNAL(dateClicked(int, int, int) ), 103 connect( m_compBook, SIGNAL(dateClicked(int, int, int) ),
103 this, SLOT(slotCompletedChanged(int, int, int) ) ); 104 this, SLOT(slotCompletedChanged(int, int, int) ) );
104 105
105 106
106 /* 107 /*
107 * another part of the hack 108 * another part of the hack
108 * it's deprecated in Qt2 but 109 * it's deprecated in Qt2 but
109 * still available in my qt-copy of Qt3.1beta2 110 * still available in my qt-copy of Qt3.1beta2
110 */ 111 */
111 btnDue->setIsMenuButton( TRUE ); 112 btnDue->setIsMenuButton( TRUE );
112 btnStart->setIsMenuButton( TRUE ); 113 btnStart->setIsMenuButton( TRUE );
113 btnComp->setIsMenuButton( TRUE ); 114 btnComp->setIsMenuButton( TRUE );
114 115
115 /* now connect the hack */ 116 /* now connect the hack */
116 connect(btnDue, SIGNAL(clicked() ), 117 connect(btnDue, SIGNAL(clicked() ),
117 this, SLOT(hackySlotHack2() ) ); 118 this, SLOT(hackySlotHack2() ) );
118 connect(btnStart, SIGNAL(clicked() ), 119 connect(btnStart, SIGNAL(clicked() ),
119 this, SLOT(hackySlotHack1() ) ); 120 this, SLOT(hackySlotHack1() ) );
120 connect(btnComp, SIGNAL(clicked() ), 121 connect(btnComp, SIGNAL(clicked() ),
121 this, SLOT(hackySlotHack3() ) ); 122 this, SLOT(hackySlotHack3() ) );
122 123
123 /* recurrance */ 124 /* recurrance */
124 connect(CheckBox7, SIGNAL(clicked() ), 125 connect(CheckBox7, SIGNAL(clicked() ),
125 this, SLOT(slotRecClicked() ) ); 126 this, SLOT(slotRecClicked() ) );
126} 127}
127 128
128void TaskEditorOverViewImpl::slotStartChecked() { 129void TaskEditorOverViewImpl::slotStartChecked() {
129 qWarning("slotStartChecked"); 130 qWarning("slotStartChecked");
130 btnStart->setEnabled( ckbStart->isChecked() ); 131 btnStart->setEnabled( ckbStart->isChecked() );
131} 132}
132void TaskEditorOverViewImpl::slotStartChanged(int y, int m, int d) { 133void TaskEditorOverViewImpl::slotStartChanged(int y, int m, int d) {
133 m_start.setYMD( y, m, d ); 134 m_start.setYMD( y, m, d );
134 btnStart->setText( TimeString::longDateString( m_start ) ); 135 btnStart->setText( TimeString::longDateString( m_start ) );
135} 136}
136void TaskEditorOverViewImpl::slotDueChecked() { 137void TaskEditorOverViewImpl::slotDueChecked() {
137 btnDue->setEnabled( ckbDue->isChecked() ); 138 btnDue->setEnabled( ckbDue->isChecked() );
138 qWarning("slotDueChecked"); 139 qWarning("slotDueChecked");
139} 140}
140void TaskEditorOverViewImpl::slotDueChanged(int y, int m, int d ) { 141void TaskEditorOverViewImpl::slotDueChanged(int y, int m, int d ) {
141 m_due.setYMD(y, m, d ); 142 m_due.setYMD(y, m, d );
142 btnDue->setText( TimeString::longDateString( m_due ) ); 143 btnDue->setText( TimeString::longDateString( m_due ) );
143} 144}
144void TaskEditorOverViewImpl::slotCompletedChecked() { 145void TaskEditorOverViewImpl::slotCompletedChecked() {
145 btnComp->setEnabled( ckbComp->isChecked() ); 146 btnComp->setEnabled( ckbComp->isChecked() );
146 qWarning("slotCompletedChecked"); 147 qWarning("slotCompletedChecked");
147} 148}
148void TaskEditorOverViewImpl::slotCompletedChanged(int y, int m, int d) { 149void TaskEditorOverViewImpl::slotCompletedChanged(int y, int m, int d) {
149 m_comp.setYMD( y, m, d ); 150 m_comp.setYMD( y, m, d );
150 btnComp->setText( TimeString::longDateString( m_comp ) ); 151 btnComp->setText( TimeString::longDateString( m_comp ) );
151} 152}
152/* 153/*
153 * called by a button pressed event... 154 * called by a button pressed event...
154 * three slots to avoid ugly name() tests 155 * three slots to avoid ugly name() tests
155 * to sender() 156 * to sender()
156 */ 157 */
157void TaskEditorOverViewImpl::hackySlotHack1() { 158void TaskEditorOverViewImpl::hackySlotHack1() {
158 btnStart->setDown( FALSE ); 159 btnStart->setDown( FALSE );
159 popup( btnStart, m_startPop ); 160 popup( btnStart, m_startPop );
160} 161}
161void TaskEditorOverViewImpl::hackySlotHack2() { 162void TaskEditorOverViewImpl::hackySlotHack2() {
162 btnDue->setDown( FALSE ); 163 btnDue->setDown( FALSE );
163 popup( btnDue, m_duePop ); 164 popup( btnDue, m_duePop );
164} 165}
165void TaskEditorOverViewImpl::hackySlotHack3() { 166void TaskEditorOverViewImpl::hackySlotHack3() {
166 btnComp->setDown( FALSE ); 167 btnComp->setDown( FALSE );
167 popup( btnComp, m_compPop ); 168 popup( btnComp, m_compPop );
168} 169}
169void TaskEditorOverViewImpl::slotRecClicked() { 170void TaskEditorOverViewImpl::slotRecClicked() {
170 qWarning("enabled recurrance"); 171 qWarning("enabled recurrance");
171 emit recurranceEnabled( CheckBox7->isChecked() ); 172 emit recurranceEnabled( CheckBox7->isChecked() );
172} 173}
173/* 174/*
174 * GPL from TT QPushButton code 175 * GPL from TT QPushButton code
175 */ 176 */
176void TaskEditorOverViewImpl::popup( QPushButton* pu, QPopupMenu* pop) { 177void TaskEditorOverViewImpl::popup( QPushButton* pu, QPopupMenu* pop) {
177 if ( pu->mapToGlobal( QPoint(0, pu->rect().bottom() ) ).y() + pop->sizeHint().height() <= qApp->desktop()->height() ) 178 if ( pu->mapToGlobal( QPoint(0, pu->rect().bottom() ) ).y() + pop->sizeHint().height() <= qApp->desktop()->height() )
178 pop->exec( pu->mapToGlobal( pu->rect().bottomLeft() ) ); 179 pop->exec( pu->mapToGlobal( pu->rect().bottomLeft() ) );
179 else 180 else
180 pop->exec( pu->mapToGlobal( pu->rect().topLeft() - QPoint(0, pu->sizeHint().height() ) ) ); 181 pop->exec( pu->mapToGlobal( pu->rect().topLeft() - QPoint(0, pu->sizeHint().height() ) ) );
181} 182}