-rw-r--r-- | core/pim/todo/mainwindow.cpp | 2 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.cpp | 19 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.h | 7 | ||||
-rw-r--r-- | core/pim/todo/taskeditoroverviewimpl.cpp | 12 | ||||
-rw-r--r-- | core/pim/todo/todoeditor.cpp | 32 | ||||
-rw-r--r-- | core/pim/todo/todoeditor.h | 4 |
6 files changed, 59 insertions, 17 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 71e6750..9b2423b 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -146,65 +146,65 @@ void MainWindow::initActions() { | |||
146 | } | 146 | } |
147 | 147 | ||
148 | a = new QAction( tr("Find"), Resource::loadIconSet( "mag" ), | 148 | a = new QAction( tr("Find"), Resource::loadIconSet( "mag" ), |
149 | QString::null, 0, this, 0 ); | 149 | QString::null, 0, this, 0 ); |
150 | connect(a, SIGNAL( activated() ), | 150 | connect(a, SIGNAL( activated() ), |
151 | this, SLOT( slotFind() ) ); | 151 | this, SLOT( slotFind() ) ); |
152 | a->addTo( m_options ); | 152 | a->addTo( m_options ); |
153 | m_findAction = a; | 153 | m_findAction = a; |
154 | 154 | ||
155 | m_options->insertSeparator(); | 155 | m_options->insertSeparator(); |
156 | 156 | ||
157 | m_completedAction = new QAction( QString::null, tr("Completed tasks"), | 157 | m_completedAction = new QAction( QString::null, tr("Completed tasks"), |
158 | 0, this, 0, TRUE ); | 158 | 0, this, 0, TRUE ); |
159 | m_completedAction->addTo( m_options ); | 159 | m_completedAction->addTo( m_options ); |
160 | m_completedAction->setOn( showCompleted() ); | 160 | m_completedAction->setOn( showCompleted() ); |
161 | connect(m_completedAction, SIGNAL( toggled(bool) ), | 161 | connect(m_completedAction, SIGNAL( toggled(bool) ), |
162 | this, SLOT(slotShowCompleted(bool) ) ); | 162 | this, SLOT(slotShowCompleted(bool) ) ); |
163 | 163 | ||
164 | m_showDeadLineAction = new QAction( QString::null, tr("Show Deadline"), | 164 | m_showDeadLineAction = new QAction( QString::null, tr("Show Deadline"), |
165 | 0, this, 0, TRUE ); | 165 | 0, this, 0, TRUE ); |
166 | m_showDeadLineAction->addTo( m_options ); | 166 | m_showDeadLineAction->addTo( m_options ); |
167 | m_showDeadLineAction->setOn( showDeadline() ); | 167 | m_showDeadLineAction->setOn( showDeadline() ); |
168 | connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), | 168 | connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), |
169 | this, SLOT( slotShowDeadLine( bool ) ) ); | 169 | this, SLOT( slotShowDeadLine( bool ) ) ); |
170 | 170 | ||
171 | m_options->insertSeparator(); | 171 | m_options->insertSeparator(); |
172 | 172 | ||
173 | m_bar->insertItem( tr("Data") ,m_edit ); | 173 | m_bar->insertItem( tr("Data") ,m_edit ); |
174 | m_bar->insertItem( tr("Category"), m_catMenu ); | 174 | m_bar->insertItem( tr("Category"), m_catMenu ); |
175 | m_bar->insertItem( tr("Options"), m_options ); | 175 | m_bar->insertItem( tr("Options"), m_options ); |
176 | 176 | ||
177 | /* initialize the view menu */ | 177 | /* initialize the view menu */ |
178 | a = new QAction( QString::null, tr("Show over due"), | 178 | a = new QAction( QString::null, tr("Show only over due"), |
179 | 0, this, 0, TRUE ); | 179 | 0, this, 0, TRUE ); |
180 | a->addTo( m_view ); | 180 | a->addTo( m_view ); |
181 | a->setOn( showOverDue() ); | 181 | a->setOn( showOverDue() ); |
182 | connect(a, SIGNAL(toggled(bool)), | 182 | connect(a, SIGNAL(toggled(bool)), |
183 | this, SLOT(slotShowDue(bool) ) ); | 183 | this, SLOT(slotShowDue(bool) ) ); |
184 | m_view->insertSeparator(); | 184 | m_view->insertSeparator(); |
185 | 185 | ||
186 | m_bar->insertItem( tr("View"), m_view ); | 186 | m_bar->insertItem( tr("View"), m_view ); |
187 | 187 | ||
188 | /* templates */ | 188 | /* templates */ |
189 | m_edit->insertItem(tr("New from template"), m_template, | 189 | m_edit->insertItem(tr("New from template"), m_template, |
190 | -1, 0 ); | 190 | -1, 0 ); |
191 | 191 | ||
192 | } | 192 | } |
193 | /* m_curCat from Config */ | 193 | /* m_curCat from Config */ |
194 | void MainWindow::initConfig() { | 194 | void MainWindow::initConfig() { |
195 | Config config( "todo" ); | 195 | Config config( "todo" ); |
196 | config.setGroup( "View" ); | 196 | config.setGroup( "View" ); |
197 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); | 197 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); |
198 | m_curCat = config.readEntry( "Category", QString::null ); | 198 | m_curCat = config.readEntry( "Category", QString::null ); |
199 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); | 199 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); |
200 | m_overdue = config.readBoolEntry("ShowOverDue", TRUE ); | 200 | m_overdue = config.readBoolEntry("ShowOverDue", TRUE ); |
201 | } | 201 | } |
202 | void MainWindow::initUI() { | 202 | void MainWindow::initUI() { |
203 | m_mainBox = new QVBox(this, "main box "); | 203 | m_mainBox = new QVBox(this, "main box "); |
204 | m_curQuick = new QuickEditImpl(this, m_mainBox ); | 204 | m_curQuick = new QuickEditImpl(this, m_mainBox ); |
205 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); | 205 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); |
206 | m_quickEdit.append( m_curQuick ); | 206 | m_quickEdit.append( m_curQuick ); |
207 | 207 | ||
208 | 208 | ||
209 | 209 | ||
210 | m_stack = new QWidgetStack(m_mainBox, "main stack"); | 210 | m_stack = new QWidgetStack(m_mainBox, "main stack"); |
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp index e8e922f..1a68eb5 100644 --- a/core/pim/todo/otaskeditor.cpp +++ b/core/pim/todo/otaskeditor.cpp | |||
@@ -1,62 +1,69 @@ | |||
1 | #include <qdatetime.h> | 1 | #include <qdatetime.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qmultilineedit.h> | 4 | #include <qmultilineedit.h> |
5 | 5 | ||
6 | #include <opie/orecurrancewidget.h> | 6 | #include <opie/orecurrancewidget.h> |
7 | 7 | ||
8 | #include "taskeditoroverviewimpl.h" | 8 | #include "taskeditoroverviewimpl.h" |
9 | #include "taskeditoradvanced.h" | 9 | #include "taskeditoradvanced.h" |
10 | #include "taskeditoralarms.h" | 10 | #include "taskeditoralarms.h" |
11 | 11 | ||
12 | #include "otaskeditor.h" | 12 | #include "otaskeditor.h" |
13 | 13 | ||
14 | OTaskEditor::OTaskEditor(int cur) | 14 | OTaskEditor::OTaskEditor(int cur) |
15 | : QDialog(0, 0, TRUE ) { | 15 | : QDialog(0, 0, TRUE ) { |
16 | init(); | 16 | init(); |
17 | OTodo to; | 17 | init( cur ); |
18 | to.setCategories( cur ); | ||
19 | load(to); | ||
20 | m_uid = 1; // generate a new one | ||
21 | } | 18 | } |
22 | OTaskEditor::OTaskEditor( const OTodo& to) | 19 | OTaskEditor::OTaskEditor( const OTodo& to) |
23 | : QDialog(0, 0, TRUE ) { | 20 | : QDialog(0, 0, TRUE ) { |
24 | init(); | 21 | init(); |
25 | load( to ); | 22 | init( to ); |
26 | m_uid = to.uid(); | ||
27 | } | 23 | } |
28 | OTaskEditor::~OTaskEditor() { | 24 | OTaskEditor::~OTaskEditor() { |
29 | 25 | ||
30 | } | 26 | } |
27 | void OTaskEditor::init( int cur ) { | ||
28 | OTodo to; | ||
29 | if ( cur != 0 ) | ||
30 | to.setCategories( cur ); | ||
31 | load(to); | ||
32 | m_uid = 1; // generate a new one | ||
33 | } | ||
34 | void OTaskEditor::init( const OTodo& to ) { | ||
35 | load( to ); | ||
36 | m_uid = to.uid(); | ||
37 | } | ||
31 | OTodo OTaskEditor::todo()const{ | 38 | OTodo OTaskEditor::todo()const{ |
32 | qWarning("saving!"); | 39 | qWarning("saving!"); |
33 | OTodo to; | 40 | OTodo to; |
34 | to.setUid(m_uid ); | 41 | to.setUid(m_uid ); |
35 | m_overView->save( to ); | 42 | m_overView->save( to ); |
36 | to.setDescription( m_line->text() ); | 43 | to.setDescription( m_line->text() ); |
37 | 44 | ||
38 | return to; | 45 | return to; |
39 | } | 46 | } |
40 | void OTaskEditor::load(const OTodo& to) { | 47 | void OTaskEditor::load(const OTodo& to) { |
41 | m_overView->load( to ); | 48 | m_overView->load( to ); |
42 | m_line->setText( to.description() ); | 49 | m_line->setText( to.description() ); |
43 | } | 50 | } |
44 | void OTaskEditor::init() { | 51 | void OTaskEditor::init() { |
45 | QVBoxLayout* lay = new QVBoxLayout(this); | 52 | QVBoxLayout* lay = new QVBoxLayout(this); |
46 | setCaption("Task Editor"); | 53 | setCaption("Task Editor"); |
47 | m_tab = new OTabWidget(this); | 54 | m_tab = new OTabWidget(this); |
48 | 55 | ||
49 | /* | 56 | /* |
50 | * Add the Widgets | 57 | * Add the Widgets |
51 | */ | 58 | */ |
52 | m_overView = new TaskEditorOverViewImpl(m_tab ); | 59 | m_overView = new TaskEditorOverViewImpl(m_tab ); |
53 | m_tab->addTab( m_overView, QString::null, tr("Overview") ); | 60 | m_tab->addTab( m_overView, QString::null, tr("Overview") ); |
54 | 61 | ||
55 | m_adv = new TaskEditorAdvanced( m_tab ); | 62 | m_adv = new TaskEditorAdvanced( m_tab ); |
56 | m_line = new QMultiLineEdit(m_adv ); | 63 | m_line = new QMultiLineEdit(m_adv ); |
57 | QLabel* label = new QLabel(m_adv ); | 64 | QLabel* label = new QLabel(m_adv ); |
58 | label->setText( tr("Description") ); | 65 | label->setText( tr("Description") ); |
59 | ((QGridLayout*) m_adv->layout() )->addWidget( label,3, 0 ); | 66 | ((QGridLayout*) m_adv->layout() )->addWidget( label,3, 0 ); |
60 | ((QGridLayout*) m_adv->layout())->addWidget( m_line,4,0 ); | 67 | ((QGridLayout*) m_adv->layout())->addWidget( m_line,4,0 ); |
61 | m_tab->addTab( m_adv, QString::null, tr("Advanced") ); | 68 | m_tab->addTab( m_adv, QString::null, tr("Advanced") ); |
62 | 69 | ||
diff --git a/core/pim/todo/otaskeditor.h b/core/pim/todo/otaskeditor.h index 5842fdc..bcbd543 100644 --- a/core/pim/todo/otaskeditor.h +++ b/core/pim/todo/otaskeditor.h | |||
@@ -1,37 +1,44 @@ | |||
1 | #ifndef OPIE_TASK_EDITOR_H | 1 | #ifndef OPIE_TASK_EDITOR_H |
2 | #define OPIE_TASK_EDITOR_H | 2 | #define OPIE_TASK_EDITOR_H |
3 | 3 | ||
4 | #include <qdialog.h> | 4 | #include <qdialog.h> |
5 | 5 | ||
6 | #include <opie/otodo.h> | 6 | #include <opie/otodo.h> |
7 | #include <opie/otabwidget.h> | 7 | #include <opie/otabwidget.h> |
8 | 8 | ||
9 | class TaskEditorOverViewImpl; | 9 | class TaskEditorOverViewImpl; |
10 | class TaskEditorAdvanced; | 10 | class TaskEditorAdvanced; |
11 | class TaskEditorAlarms; | 11 | class TaskEditorAlarms; |
12 | class ORecurranceWidget; | 12 | class ORecurranceWidget; |
13 | class QMultiLineEdit; | 13 | class QMultiLineEdit; |
14 | class OTaskEditor : public QDialog { | 14 | class OTaskEditor : public QDialog { |
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | public: | 16 | public: |
17 | OTaskEditor(int cur); | 17 | OTaskEditor(int cur); |
18 | OTaskEditor( const OTodo& todo ); | 18 | OTaskEditor( const OTodo& todo ); |
19 | ~OTaskEditor(); | 19 | ~OTaskEditor(); |
20 | 20 | ||
21 | /* | ||
22 | * same as the c'tor but this gives us the | ||
23 | * power to 'preload' the dialog | ||
24 | */ | ||
25 | void init( int cur ); | ||
26 | void init( const OTodo& todo ); | ||
27 | |||
21 | OTodo todo()const; | 28 | OTodo todo()const; |
22 | private: | 29 | private: |
23 | void load( const OTodo& ); | 30 | void load( const OTodo& ); |
24 | void init(); | 31 | void init(); |
25 | 32 | ||
26 | OTabWidget *m_tab; | 33 | OTabWidget *m_tab; |
27 | TaskEditorOverViewImpl* m_overView; | 34 | TaskEditorOverViewImpl* m_overView; |
28 | TaskEditorAdvanced *m_adv; | 35 | TaskEditorAdvanced *m_adv; |
29 | TaskEditorAlarms *m_alarm; | 36 | TaskEditorAlarms *m_alarm; |
30 | TaskEditorAlarms* m_remind; | 37 | TaskEditorAlarms* m_remind; |
31 | ORecurranceWidget* m_rec; | 38 | ORecurranceWidget* m_rec; |
32 | QMultiLineEdit* m_line; | 39 | QMultiLineEdit* m_line; |
33 | int m_uid; | 40 | int m_uid; |
34 | 41 | ||
35 | }; | 42 | }; |
36 | 43 | ||
37 | #endif | 44 | #endif |
diff --git a/core/pim/todo/taskeditoroverviewimpl.cpp b/core/pim/todo/taskeditoroverviewimpl.cpp index b9b2ae6..c10ad40 100644 --- a/core/pim/todo/taskeditoroverviewimpl.cpp +++ b/core/pim/todo/taskeditoroverviewimpl.cpp | |||
@@ -1,103 +1,115 @@ | |||
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 | ||
16 | TaskEditorOverViewImpl::TaskEditorOverViewImpl( QWidget* parent, const char* name ) | 16 | TaskEditorOverViewImpl::TaskEditorOverViewImpl( QWidget* parent, const char* name ) |
17 | : TaskEditorOverView( parent, name ) { | 17 | : TaskEditorOverView( parent, name ) { |
18 | init(); | 18 | init(); |
19 | } | 19 | } |
20 | TaskEditorOverViewImpl::~TaskEditorOverViewImpl() { | 20 | TaskEditorOverViewImpl::~TaskEditorOverViewImpl() { |
21 | } | 21 | } |
22 | void TaskEditorOverViewImpl::load( const OTodo& todo) { | 22 | void TaskEditorOverViewImpl::load( const OTodo& todo) { |
23 | /* | ||
24 | * now that we're 'preloaded' we | ||
25 | * need to disable the buttons | ||
26 | * holding the dat | ||
27 | */ | ||
28 | btnDue-> setEnabled( FALSE ); | ||
29 | btnComp-> setEnabled( FALSE ); | ||
30 | btnStart->setEnabled( FALSE ); | ||
31 | |||
32 | |||
23 | QDate date = QDate::currentDate(); | 33 | QDate date = QDate::currentDate(); |
24 | QString str = TimeString::longDateString( date ); | 34 | QString str = TimeString::longDateString( date ); |
25 | 35 | ||
26 | emit recurranceEnabled( FALSE ); | 36 | emit recurranceEnabled( FALSE ); |
27 | ckbStart->setChecked( FALSE ); | 37 | ckbStart->setChecked( FALSE ); |
28 | btnStart->setText( str ); | 38 | btnStart->setText( str ); |
29 | 39 | ||
30 | ckbComp->setChecked( FALSE ); | 40 | ckbComp->setChecked( FALSE ); |
31 | btnComp->setText( str ); | 41 | btnComp->setText( str ); |
32 | 42 | ||
33 | cmbProgress->setCurrentItem( todo.progress()/20 ); | 43 | cmbProgress->setCurrentItem( todo.progress()/20 ); |
34 | cmbSum->insertItem( todo.summary(), 0 ); | 44 | cmbSum->insertItem( todo.summary(), 0 ); |
35 | cmbSum->setCurrentItem( 0 ); | 45 | cmbSum->setCurrentItem( 0 ); |
36 | 46 | ||
37 | ckbDue->setChecked( todo.hasDueDate() ); | 47 | ckbDue->setChecked( todo.hasDueDate() ); |
38 | btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); | 48 | btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); |
39 | 49 | ||
40 | cmbPrio->setCurrentItem( todo.priority() -1 ); | 50 | cmbPrio->setCurrentItem( todo.priority() -1 ); |
41 | ckbCompleted->setChecked( todo.isCompleted() ); | 51 | ckbCompleted->setChecked( todo.isCompleted() ); |
42 | 52 | ||
43 | comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); | 53 | comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); |
44 | 54 | ||
45 | } | 55 | } |
46 | void TaskEditorOverViewImpl::save( OTodo& to) { | 56 | void TaskEditorOverViewImpl::save( OTodo& to) { |
47 | qWarning("save it now"); | 57 | qWarning("save it now"); |
48 | if ( ckbDue->isChecked() ) { | 58 | if ( ckbDue->isChecked() ) { |
49 | to.setDueDate( m_due ); | 59 | to.setDueDate( m_due ); |
50 | to.setHasDueDate( true ); | 60 | to.setHasDueDate( true ); |
51 | }else | 61 | }else |
52 | to.setHasDueDate( false ); | 62 | to.setHasDueDate( false ); |
53 | if ( comboCategory->currentCategory() != -1 ) { | 63 | if ( comboCategory->currentCategory() != -1 ) { |
54 | QArray<int> arr = comboCategory->currentCategories(); | 64 | QArray<int> arr = comboCategory->currentCategories(); |
55 | to.setCategories( arr ); | 65 | to.setCategories( arr ); |
56 | } | 66 | } |
57 | to.setPriority( cmbPrio->currentItem() + 1 ); | 67 | to.setPriority( cmbPrio->currentItem() + 1 ); |
58 | to.setCompleted( ckbCompleted->isChecked() ); | 68 | to.setCompleted( ckbCompleted->isChecked() ); |
59 | to.setSummary( cmbSum->currentText() ); | 69 | to.setSummary( cmbSum->currentText() ); |
60 | to.setProgress( cmbProgress->currentItem() * 20 ); | 70 | to.setProgress( cmbProgress->currentItem() * 20 ); |
61 | } | 71 | } |
62 | /* | 72 | /* |
63 | * here we will init the basic view | 73 | * here we will init the basic view |
64 | * one Popup for each Date Button | 74 | * one Popup for each Date Button |
65 | * and some other signal and slots connection | 75 | * and some other signal and slots connection |
66 | */ | 76 | */ |
67 | void TaskEditorOverViewImpl::init() { | 77 | void TaskEditorOverViewImpl::init() { |
68 | QDate curDate = QDate::currentDate(); | 78 | QDate curDate = QDate::currentDate(); |
69 | m_start = m_comp = m_due = curDate; | 79 | m_start = m_comp = m_due = curDate; |
70 | QString str = TimeString::longDateString( curDate ); | 80 | QString str = TimeString::longDateString( curDate ); |
71 | 81 | ||
82 | |||
83 | |||
72 | /* Start Date Picker */ | 84 | /* Start Date Picker */ |
73 | m_startPop = new QPopupMenu(this); | 85 | m_startPop = new QPopupMenu(this); |
74 | m_startBook = new DateBookMonth(m_startPop, 0, TRUE ); | 86 | m_startBook = new DateBookMonth(m_startPop, 0, TRUE ); |
75 | m_startPop->insertItem( m_startBook ); | 87 | m_startPop->insertItem( m_startBook ); |
76 | connect( m_startBook, SIGNAL( dateClicked(int, int, int) ), | 88 | connect( m_startBook, SIGNAL( dateClicked(int, int, int) ), |
77 | this, SLOT(slotStartChanged(int, int, int) ) ); | 89 | this, SLOT(slotStartChanged(int, int, int) ) ); |
78 | 90 | ||
79 | 91 | ||
80 | /* Due Date Picker */ | 92 | /* Due Date Picker */ |
81 | m_duePop = new QPopupMenu(this); | 93 | m_duePop = new QPopupMenu(this); |
82 | m_dueBook = new DateBookMonth(m_duePop, 0, TRUE ); | 94 | m_dueBook = new DateBookMonth(m_duePop, 0, TRUE ); |
83 | m_duePop->insertItem( m_dueBook ); | 95 | m_duePop->insertItem( m_dueBook ); |
84 | connect( m_dueBook, SIGNAL( dateClicked(int, int, int) ), | 96 | connect( m_dueBook, SIGNAL( dateClicked(int, int, int) ), |
85 | this, SLOT(slotDueChanged(int, int, int) ) ); | 97 | this, SLOT(slotDueChanged(int, int, int) ) ); |
86 | 98 | ||
87 | m_compPop = new QPopupMenu(this); | 99 | m_compPop = new QPopupMenu(this); |
88 | m_compBook = new DateBookMonth(m_compPop, 0, TRUE ); | 100 | m_compBook = new DateBookMonth(m_compPop, 0, TRUE ); |
89 | m_compPop->insertItem(m_compBook ); | 101 | m_compPop->insertItem(m_compBook ); |
90 | connect( m_compBook, SIGNAL(dateClicked(int, int, int) ), | 102 | connect( m_compBook, SIGNAL(dateClicked(int, int, int) ), |
91 | this, SLOT(slotCompletedChanged(int, int, int) ) ); | 103 | this, SLOT(slotCompletedChanged(int, int, int) ) ); |
92 | 104 | ||
93 | 105 | ||
94 | /* | 106 | /* |
95 | * another part of the hack | 107 | * another part of the hack |
96 | * it's deprecated in Qt2 but | 108 | * it's deprecated in Qt2 but |
97 | * still available in my qt-copy of Qt3.1beta2 | 109 | * still available in my qt-copy of Qt3.1beta2 |
98 | */ | 110 | */ |
99 | btnDue->setIsMenuButton( TRUE ); | 111 | btnDue->setIsMenuButton( TRUE ); |
100 | btnStart->setIsMenuButton( TRUE ); | 112 | btnStart->setIsMenuButton( TRUE ); |
101 | btnComp->setIsMenuButton( TRUE ); | 113 | btnComp->setIsMenuButton( TRUE ); |
102 | 114 | ||
103 | /* now connect the hack */ | 115 | /* now connect the hack */ |
diff --git a/core/pim/todo/todoeditor.cpp b/core/pim/todo/todoeditor.cpp index e19ab8d..9b8c5cb 100644 --- a/core/pim/todo/todoeditor.cpp +++ b/core/pim/todo/todoeditor.cpp | |||
@@ -1,55 +1,67 @@ | |||
1 | 1 | ||
2 | #include "otaskeditor.h" | 2 | #include "otaskeditor.h" |
3 | #include "todoeditor.h" | 3 | #include "todoeditor.h" |
4 | 4 | ||
5 | using namespace Todo; | 5 | using namespace Todo; |
6 | 6 | ||
7 | Editor::Editor() { | 7 | Editor::Editor() { |
8 | m_accepted = false; | 8 | m_accepted = false; |
9 | m_self = 0l; | ||
9 | } | 10 | } |
10 | Editor::~Editor() { | 11 | Editor::~Editor() { |
12 | delete m_self; | ||
13 | m_self = 0; | ||
11 | } | 14 | } |
12 | OTodo Editor::newTodo( int cur, | 15 | OTodo Editor::newTodo( int cur, |
13 | QWidget* par) { | 16 | QWidget*) { |
14 | 17 | ||
15 | OTaskEditor e( cur); | 18 | OTaskEditor *e = self(); |
19 | e->setCaption( QObject::tr("Enter Task") ); | ||
20 | e->init( cur ); | ||
16 | 21 | ||
17 | 22 | ||
18 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 23 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
19 | e.showMaximized(); | 24 | e->showMaximized(); |
20 | #endif | 25 | #endif |
21 | 26 | ||
22 | int ret = e.exec(); | 27 | int ret = e->exec(); |
23 | if ( QDialog::Accepted == ret ) { | 28 | if ( QDialog::Accepted == ret ) { |
24 | m_accepted = true; | 29 | m_accepted = true; |
25 | }else | 30 | }else |
26 | m_accepted = false; | 31 | m_accepted = false; |
27 | 32 | ||
28 | OTodo ev = e.todo(); | 33 | OTodo ev = e->todo(); |
29 | qWarning("Todo uid"); | 34 | qWarning("Todo uid"); |
30 | qWarning("Todo %s %d %d", ev.summary().latin1(), ev.progress(), ev.isCompleted() ); | 35 | qWarning("Todo %s %d %d", ev.summary().latin1(), ev.progress(), ev.isCompleted() ); |
31 | ev.setUid(1); | 36 | ev.setUid(1); |
32 | 37 | ||
33 | return ev; | 38 | return ev; |
34 | } | 39 | } |
35 | OTodo Editor::edit( QWidget *wid, | 40 | OTodo Editor::edit( QWidget *wid, |
36 | const OTodo& todo ) { | 41 | const OTodo& todo ) { |
37 | OTaskEditor e( todo ); | 42 | OTaskEditor *e = self(); |
38 | e.setCaption( QObject::tr( "Edit Task" ) ); | 43 | e->init( todo ); |
44 | e->setCaption( QObject::tr( "Edit Task" ) ); | ||
39 | 45 | ||
40 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 46 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
41 | e.showMaximized(); | 47 | e->showMaximized(); |
42 | #endif | 48 | #endif |
43 | int ret = e.exec(); | 49 | int ret = e->exec(); |
44 | 50 | ||
45 | OTodo ev = e.todo(); | 51 | OTodo ev = e->todo(); |
46 | if ( ret == QDialog::Accepted ) | 52 | if ( ret == QDialog::Accepted ) |
47 | m_accepted = true; | 53 | m_accepted = true; |
48 | else | 54 | else |
49 | m_accepted = false; | 55 | m_accepted = false; |
50 | 56 | ||
51 | return ev; | 57 | return ev; |
52 | } | 58 | } |
53 | bool Editor::accepted()const { | 59 | bool Editor::accepted()const { |
54 | return m_accepted; | 60 | return m_accepted; |
55 | } | 61 | } |
62 | OTaskEditor* Editor::self() { | ||
63 | if (!m_self ) | ||
64 | m_self = new OTaskEditor(0); | ||
65 | |||
66 | return m_self; | ||
67 | } | ||
diff --git a/core/pim/todo/todoeditor.h b/core/pim/todo/todoeditor.h index bbfdcb5..fe30634 100644 --- a/core/pim/todo/todoeditor.h +++ b/core/pim/todo/todoeditor.h | |||
@@ -1,25 +1,29 @@ | |||
1 | #ifndef OPIE_TODO_EDITOR_H | 1 | #ifndef OPIE_TODO_EDITOR_H |
2 | #define OPIE_TODO_EDITOR_H | 2 | #define OPIE_TODO_EDITOR_H |
3 | 3 | ||
4 | #include <opie/otodo.h> | 4 | #include <opie/otodo.h> |
5 | 5 | ||
6 | 6 | ||
7 | class OTaskEditor; | ||
7 | namespace Todo { | 8 | namespace Todo { |
8 | class Editor { | 9 | class Editor { |
9 | public: | 10 | public: |
10 | Editor(); | 11 | Editor(); |
11 | ~Editor(); | 12 | ~Editor(); |
12 | 13 | ||
13 | OTodo newTodo( int currentCatId, | 14 | OTodo newTodo( int currentCatId, |
14 | QWidget* par ); | 15 | QWidget* par ); |
15 | OTodo edit( QWidget* par, | 16 | OTodo edit( QWidget* par, |
16 | const OTodo& ev = OTodo() ); | 17 | const OTodo& ev = OTodo() ); |
17 | 18 | ||
18 | 19 | ||
19 | bool accepted()const; | 20 | bool accepted()const; |
21 | protected: | ||
22 | OTaskEditor* self(); | ||
20 | private: | 23 | private: |
21 | bool m_accepted: 1; | 24 | bool m_accepted: 1; |
25 | OTaskEditor* m_self; | ||
22 | }; | 26 | }; |
23 | }; | 27 | }; |
24 | 28 | ||
25 | #endif | 29 | #endif |