Diffstat (limited to 'core/pim/todo/todoentryimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/todoentryimpl.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/pim/todo/todoentryimpl.cpp b/core/pim/todo/todoentryimpl.cpp index f8e2f4d..dd01130 100644 --- a/core/pim/todo/todoentryimpl.cpp +++ b/core/pim/todo/todoentryimpl.cpp | |||
@@ -1,158 +1,165 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** Copyright (C) 2002 zecke | 3 | ** Copyright (C) 2002 zecke |
4 | ** | 4 | ** |
5 | ** This file is part of Qtopia Environment. | 5 | ** This file is part of Qtopia Environment. |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | #include "todoentryimpl.h" | 22 | #include "todoentryimpl.h" |
23 | 23 | ||
24 | #include <opie/oclickablelabel.h> | ||
24 | #include <opie/todoevent.h> | 25 | #include <opie/todoevent.h> |
25 | #include <opie/tododb.h> | 26 | #include <opie/tododb.h> |
26 | 27 | ||
27 | #include <qpe/categoryselect.h> | 28 | #include <qpe/categoryselect.h> |
28 | #include <qpe/datebookmonth.h> | 29 | #include <qpe/datebookmonth.h> |
29 | #include <qpe/global.h> | 30 | #include <qpe/global.h> |
31 | #include <qpe/resource.h> | ||
30 | #include <qpe/imageedit.h> | 32 | #include <qpe/imageedit.h> |
31 | #include <qpe/timestring.h> | 33 | #include <qpe/timestring.h> |
32 | #include <qpe/palmtoprecord.h> | 34 | #include <qpe/palmtoprecord.h> |
33 | 35 | ||
34 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
35 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
36 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
37 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
38 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
39 | #include <qlineedit.h> | 41 | #include <qlineedit.h> |
40 | #include <qmultilineedit.h> | 42 | #include <qmultilineedit.h> |
41 | #include <qlabel.h> | 43 | #include <qlabel.h> |
42 | #include <qtimer.h> | 44 | #include <qtimer.h> |
43 | #include <qapplication.h> | 45 | #include <qapplication.h> |
44 | 46 | ||
45 | 47 | ||
46 | NewTaskDialog::NewTaskDialog( const ToDoEvent& task, QWidget *parent, | 48 | NewTaskDialog::NewTaskDialog( const ToDoEvent& task, QWidget *parent, |
47 | const char *name, bool modal, WFlags fl ) | 49 | const char *name, bool modal, WFlags fl ) |
48 | : NewTaskDialogBase( parent, name, modal, fl ), | 50 | : NewTaskDialogBase( parent, name, modal, fl ), |
49 | todo( task ) | 51 | todo( task ) |
50 | { | 52 | { |
51 | todo.setCategories( task.allCategories() ); | 53 | todo.setCategories( task.allCategories() ); |
52 | if ( todo.hasDate() ) | 54 | if ( todo.hasDate() ) |
53 | date = todo.date(); | 55 | date = todo.date(); |
54 | else | 56 | else |
55 | date = QDate::currentDate(); | 57 | date = QDate::currentDate(); |
56 | 58 | ||
57 | init(); | 59 | init(); |
58 | comboPriority->setCurrentItem( task.priority() - 1 ); | 60 | comboPriority->setCurrentItem( task.priority() - 1 ); |
59 | 61 | ||
60 | checkCompleted->setChecked( task.isCompleted() ); | 62 | checkCompleted->setChecked( task.isCompleted() ); |
61 | checkDate->setChecked( task.hasDate() ); | 63 | checkDate->setChecked( task.hasDate() ); |
62 | buttonDate->setText( TimeString::longDateString( date ) ); | 64 | buttonDate->setText( TimeString::longDateString( date ) ); |
63 | 65 | ||
64 | txtTodo->setText( task.description() ); | 66 | txtTodo->setText( task.description() ); |
65 | lneSum->setText( task.summary() ); | 67 | lneSum->setText( task.summary() ); |
66 | cmbProg->setCurrentItem( task.progress()/20 ); | 68 | cmbProg->setCurrentItem( task.progress()/20 ); |
67 | } | 69 | } |
68 | 70 | ||
69 | /* | 71 | /* |
70 | * Constructs a NewTaskDialog which is a child of 'parent', with the | 72 | * Constructs a NewTaskDialog which is a child of 'parent', with the |
71 | * name 'name' and widget flags set to 'f' | 73 | * name 'name' and widget flags set to 'f' |
72 | * | 74 | * |
73 | * The dialog will by default be modeless, unless you set 'modal' to | 75 | * The dialog will by default be modeless, unless you set 'modal' to |
74 | * TRUE to construct a modal dialog. | 76 | * TRUE to construct a modal dialog. |
75 | */ | 77 | */ |
76 | NewTaskDialog::NewTaskDialog( int id, QWidget* parent, const char* name, bool modal, | 78 | NewTaskDialog::NewTaskDialog( int id, QWidget* parent, const char* name, bool modal, |
77 | WFlags fl ) | 79 | WFlags fl ) |
78 | : NewTaskDialogBase( parent, name, modal, fl ), | 80 | : NewTaskDialogBase( parent, name, modal, fl ), |
79 | date( QDate::currentDate() ) | 81 | date( QDate::currentDate() ) |
80 | { | 82 | { |
81 | if ( id != -1 ) { | 83 | if ( id != -1 ) { |
82 | QArray<int> ids( 1 ); | 84 | QArray<int> ids( 1 ); |
83 | ids[0] = id; | 85 | ids[0] = id; |
84 | todo.setCategory( Qtopia::Record::idsToString( ids ) ); | 86 | todo.setCategory( Qtopia::Record::idsToString( ids ) ); |
85 | } | 87 | } |
86 | init(); | 88 | init(); |
87 | } | 89 | } |
88 | 90 | ||
89 | void NewTaskDialog::init() | 91 | void NewTaskDialog::init() |
90 | { | 92 | { |
91 | QPopupMenu *m1 = new QPopupMenu( this ); | 93 | QPopupMenu *m1 = new QPopupMenu( this ); |
92 | picker = new DateBookMonth( m1, 0, TRUE ); | 94 | picker = new DateBookMonth( m1, 0, TRUE ); |
93 | m1->insertItem( picker ); | 95 | m1->insertItem( picker ); |
94 | buttonDate->setPopup( m1 ); | 96 | buttonDate->setPopup( m1 ); |
95 | comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); | 97 | comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); |
96 | 98 | ||
97 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), | 99 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), |
98 | this, SLOT( dateChanged( int, int, int ) ) ); | 100 | this, SLOT( dateChanged( int, int, int ) ) ); |
99 | 101 | ||
100 | buttonDate->setText( TimeString::longDateString( date ) ); | 102 | buttonDate->setText( TimeString::longDateString( date ) ); |
101 | picker->setDate( date.year(), date.month(), date.day() ); | 103 | picker->setDate( date.year(), date.month(), date.day() ); |
104 | lblDown->setPixmap(Resource::loadPixmap("down") ); | ||
102 | } | 105 | } |
103 | 106 | ||
104 | /* | 107 | /* |
105 | * Destroys the object and frees any allocated resources | 108 | * Destroys the object and frees any allocated resources |
106 | */ | 109 | */ |
107 | NewTaskDialog::~NewTaskDialog() | 110 | NewTaskDialog::~NewTaskDialog() |
108 | { | 111 | { |
109 | // no need to delete child widgets, Qt does it all for us | 112 | // no need to delete child widgets, Qt does it all for us |
110 | } | 113 | } |
111 | void NewTaskDialog::dateChanged( int y, int m, int d ) | 114 | void NewTaskDialog::dateChanged( int y, int m, int d ) |
112 | { | 115 | { |
113 | date = QDate( y, m, d ); | 116 | date = QDate( y, m, d ); |
114 | buttonDate->setText( TimeString::longDateString( date ) ); | 117 | buttonDate->setText( TimeString::longDateString( date ) ); |
115 | } | 118 | } |
116 | 119 | ||
117 | /*! | 120 | /*! |
118 | */ | 121 | */ |
119 | 122 | ||
120 | ToDoEvent NewTaskDialog::todoEntry() | 123 | ToDoEvent NewTaskDialog::todoEntry() |
121 | { | 124 | { |
122 | if( checkDate->isChecked() ){ | 125 | if( checkDate->isChecked() ){ |
123 | todo.setDate( date ); | 126 | todo.setDate( date ); |
124 | todo.setHasDate( true ); | 127 | todo.setHasDate( true ); |
125 | }else{ | 128 | }else{ |
126 | todo.setHasDate( false ); | 129 | todo.setHasDate( false ); |
127 | } | 130 | } |
128 | if ( comboCategory->currentCategory() != -1 ) { | 131 | if ( comboCategory->currentCategory() != -1 ) { |
129 | QArray<int> arr = comboCategory->currentCategories(); | 132 | QArray<int> arr = comboCategory->currentCategories(); |
130 | QStringList list; | 133 | QStringList list; |
131 | list = QStringList::split(";", Qtopia::Record::idsToString( arr )) ; | 134 | list = QStringList::split(";", Qtopia::Record::idsToString( arr )) ; |
132 | todo.setCategories( list ); | 135 | todo.setCategories( list ); |
133 | } | 136 | } |
134 | todo.setPriority( comboPriority->currentItem() + 1 ); | 137 | todo.setPriority( comboPriority->currentItem() + 1 ); |
135 | todo.setCompleted( checkCompleted->isChecked() ); | 138 | todo.setCompleted( checkCompleted->isChecked() ); |
136 | 139 | ||
137 | todo.setDescription( txtTodo->text() ); | 140 | todo.setDescription( txtTodo->text() ); |
138 | todo.setSummary( lneSum->text() ); | 141 | todo.setSummary( lneSum->text() ); |
139 | QString text = cmbProg->currentText(); | 142 | QString text = cmbProg->currentText(); |
140 | todo.setProgress( text.remove( text.length()-1, 1 ).toUShort() ); | 143 | todo.setProgress( text.remove( text.length()-1, 1 ).toUShort() ); |
141 | return todo; | 144 | return todo; |
142 | } | 145 | } |
143 | 146 | void NewTaskDialog::slotCopy() | |
147 | { | ||
148 | txtTodo->clear(); | ||
149 | txtTodo->setText( lneSum->text() ); | ||
150 | } | ||
144 | 151 | ||
145 | /*! | 152 | /*! |
146 | 153 | ||
147 | */ | 154 | */ |
148 | 155 | ||
149 | void NewTaskDialog::accept() | 156 | void NewTaskDialog::accept() |
150 | { | 157 | { |
151 | QString strText = txtTodo->text(); | 158 | QString strText = txtTodo->text(); |
152 | if ( strText.isEmpty() ) { | 159 | if ( strText.isEmpty() ) { |
153 | // hmm... just decline it then, the user obviously didn't care about it | 160 | // hmm... just decline it then, the user obviously didn't care about it |
154 | QDialog::reject(); | 161 | QDialog::reject(); |
155 | return; | 162 | return; |
156 | } | 163 | } |
157 | QDialog::accept(); | 164 | QDialog::accept(); |
158 | } | 165 | } |