-rw-r--r-- | core/pim/todo/mainwindow.cpp | 4 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 4 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.cpp | 1 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.h | 2 | ||||
-rw-r--r-- | core/pim/todo/quickeditimpl.cpp | 3 | ||||
-rw-r--r-- | core/pim/todo/taskeditoralarms.cpp | 1 |
6 files changed, 10 insertions, 5 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index c2f422d..f0642c4 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -1,319 +1,321 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 <> | 3 | .=l. Copyright (c) 2002 <> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This program is free software; you can | 5 | _;:, .> :=|. This program is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This program is distributed in the hope that | 12 | .i_,=:_. -<s. This program is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = General Public License along with | 21 | -_. . . )=. = General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <unistd.h> | 29 | #include <unistd.h> |
30 | 30 | ||
31 | #include <opie2/opimrecurrence.h> | 31 | #include <opie2/opimrecurrence.h> |
32 | #include <opie2/opimnotifymanager.h> | 32 | #include <opie2/opimnotifymanager.h> |
33 | #include <opie2/otodoaccessvcal.h> | 33 | #include <opie2/otodoaccessvcal.h> |
34 | #include <opie2/oapplicationfactory.h> | 34 | #include <opie2/oapplicationfactory.h> |
35 | 35 | ||
36 | #include <qpe/applnk.h> | 36 | #include <qpe/applnk.h> |
37 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
38 | #include <qpe/ir.h> | 38 | #include <qpe/ir.h> |
39 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
40 | #include <qpe/qpemessagebox.h> | 40 | #include <qpe/qpemessagebox.h> |
41 | #include <qpe/alarmserver.h> | 41 | #include <qpe/alarmserver.h> |
42 | #include <qpe/qpeapplication.h> | 42 | #include <qpe/qpeapplication.h> |
43 | 43 | ||
44 | #include <qmenubar.h> | 44 | #include <qmenubar.h> |
45 | #include <qmessagebox.h> | 45 | #include <qmessagebox.h> |
46 | #include <qpushbutton.h> | 46 | #include <qpushbutton.h> |
47 | #include <qaction.h> | 47 | #include <qaction.h> |
48 | #include <qtimer.h> | 48 | #include <qtimer.h> |
49 | #include <qlayout.h> | 49 | #include <qlayout.h> |
50 | #include <qwhatsthis.h> | 50 | #include <qwhatsthis.h> |
51 | 51 | ||
52 | #include "quickeditimpl.h" | 52 | #include "quickeditimpl.h" |
53 | #include "todotemplatemanager.h" | 53 | #include "todotemplatemanager.h" |
54 | #include "templateeditor.h" | 54 | #include "templateeditor.h" |
55 | #include "tableview.h" | 55 | #include "tableview.h" |
56 | 56 | ||
57 | #include "textviewshow.h" | 57 | #include "textviewshow.h" |
58 | #include "todoeditor.h" | 58 | #include "todoeditor.h" |
59 | #include "mainwindow.h" | 59 | #include "mainwindow.h" |
60 | 60 | ||
61 | using namespace Opie::Core; | ||
61 | OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) | 62 | OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) |
62 | 63 | ||
64 | using namespace Opie; | ||
63 | using namespace Todo; | 65 | using namespace Todo; |
64 | 66 | ||
65 | MainWindow::MainWindow( QWidget* parent, | 67 | MainWindow::MainWindow( QWidget* parent, |
66 | const char* name, WFlags ) | 68 | const char* name, WFlags ) |
67 | : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) | 69 | : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) |
68 | { | 70 | { |
69 | if (!name) | 71 | if (!name) |
70 | setName("todo window"); | 72 | setName("todo window"); |
71 | 73 | ||
72 | m_syncing = false; | 74 | m_syncing = false; |
73 | m_showing = false; | 75 | m_showing = false; |
74 | m_counter = 0; | 76 | m_counter = 0; |
75 | m_tempManager = new TemplateManager(); | 77 | m_tempManager = new TemplateManager(); |
76 | m_tempManager->load(); | 78 | m_tempManager->load(); |
77 | 79 | ||
78 | initUI(); | 80 | initUI(); |
79 | initConfig(); | 81 | initConfig(); |
80 | initViews(); | 82 | initViews(); |
81 | initActions(); | 83 | initActions(); |
82 | initEditor(); | 84 | initEditor(); |
83 | initShow(); | 85 | initShow(); |
84 | initTemplate(); | 86 | initTemplate(); |
85 | 87 | ||
86 | populateTemplates(); | 88 | populateTemplates(); |
87 | raiseCurrentView(); | 89 | raiseCurrentView(); |
88 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); | 90 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); |
89 | } | 91 | } |
90 | void MainWindow::initTemplate() { | 92 | void MainWindow::initTemplate() { |
91 | m_curTempEd = new TemplateEditor( this, templateManager() ); | 93 | m_curTempEd = new TemplateEditor( this, templateManager() ); |
92 | } | 94 | } |
93 | void MainWindow::initActions() { | 95 | void MainWindow::initActions() { |
94 | 96 | ||
95 | // Data menu | 97 | // Data menu |
96 | m_edit->insertItem(QWidget::tr("New from template"), m_template, | 98 | m_edit->insertItem(QWidget::tr("New from template"), m_template, |
97 | -1, 0 ); | 99 | -1, 0 ); |
98 | 100 | ||
99 | QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), | 101 | QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), |
100 | QString::null, 0, this, 0 ); | 102 | QString::null, 0, this, 0 ); |
101 | connect(a, SIGNAL( activated() ), | 103 | connect(a, SIGNAL( activated() ), |
102 | this, SLOT( slotNew() ) ); | 104 | this, SLOT( slotNew() ) ); |
103 | a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); | 105 | a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); |
104 | a->addTo(m_tool ); | 106 | a->addTo(m_tool ); |
105 | a->addTo(m_edit ); | 107 | a->addTo(m_edit ); |
106 | 108 | ||
107 | a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), | 109 | a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), |
108 | QString::null, 0, this, 0 ); | 110 | QString::null, 0, this, 0 ); |
109 | connect(a, SIGNAL(activated() ), | 111 | connect(a, SIGNAL(activated() ), |
110 | this, SLOT( slotEdit() ) ); | 112 | this, SLOT( slotEdit() ) ); |
111 | a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); | 113 | a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); |
112 | a->addTo( m_tool ); | 114 | a->addTo( m_tool ); |
113 | a->addTo( m_edit ); | 115 | a->addTo( m_edit ); |
114 | m_editAction = a; | 116 | m_editAction = a; |
115 | 117 | ||
116 | a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); | 118 | a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); |
117 | connect(a, SIGNAL( activated() ), | 119 | connect(a, SIGNAL( activated() ), |
118 | this, SLOT( slotShowDetails() ) ); | 120 | this, SLOT( slotShowDetails() ) ); |
119 | a->addTo( m_edit ); | 121 | a->addTo( m_edit ); |
120 | 122 | ||
121 | m_edit->insertSeparator(); | 123 | m_edit->insertSeparator(); |
122 | 124 | ||
123 | a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ), | 125 | a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ), |
124 | QString::null, 0, this, 0 ); | 126 | QString::null, 0, this, 0 ); |
125 | connect(a, SIGNAL(activated() ), | 127 | connect(a, SIGNAL(activated() ), |
126 | this, SLOT(slotDelete() ) ); | 128 | this, SLOT(slotDelete() ) ); |
127 | a->setWhatsThis( QWidget::tr( "Click here to remove the current task." ) ); | 129 | a->setWhatsThis( QWidget::tr( "Click here to remove the current task." ) ); |
128 | a->addTo( m_tool ); | 130 | a->addTo( m_tool ); |
129 | a->addTo( m_edit ); | 131 | a->addTo( m_edit ); |
130 | m_deleteAction = a; | 132 | m_deleteAction = a; |
131 | 133 | ||
132 | a = new QAction( QString::null, QWidget::tr("Delete all..."), 0, this, 0 ); | 134 | a = new QAction( QString::null, QWidget::tr("Delete all..."), 0, this, 0 ); |
133 | connect(a, SIGNAL( activated() ), | 135 | connect(a, SIGNAL( activated() ), |
134 | this, SLOT( slotDeleteAll() ) ); | 136 | this, SLOT( slotDeleteAll() ) ); |
135 | a->addTo(m_edit ); | 137 | a->addTo(m_edit ); |
136 | m_deleteAllAction = a; | 138 | m_deleteAllAction = a; |
137 | 139 | ||
138 | a = new QAction( QString::null, QWidget::tr("Delete completed"), | 140 | a = new QAction( QString::null, QWidget::tr("Delete completed"), |
139 | 0, this, 0 ); | 141 | 0, this, 0 ); |
140 | connect(a, SIGNAL( activated() ), | 142 | connect(a, SIGNAL( activated() ), |
141 | this, SLOT( slotDeleteCompleted() ) ); | 143 | this, SLOT( slotDeleteCompleted() ) ); |
142 | a->addTo(m_edit ); | 144 | a->addTo(m_edit ); |
143 | a->setEnabled( TRUE ); | 145 | a->setEnabled( TRUE ); |
144 | m_deleteCompleteAction = a; | 146 | m_deleteCompleteAction = a; |
145 | 147 | ||
146 | m_edit->insertSeparator(); | 148 | m_edit->insertSeparator(); |
147 | 149 | ||
148 | a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 ); | 150 | a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 ); |
149 | connect(a, SIGNAL( activated() ), | 151 | connect(a, SIGNAL( activated() ), |
150 | this, SLOT( slotDuplicate() ) ); | 152 | this, SLOT( slotDuplicate() ) ); |
151 | a->addTo(m_edit ); | 153 | a->addTo(m_edit ); |
152 | m_duplicateAction = a; | 154 | m_duplicateAction = a; |
153 | 155 | ||
154 | m_edit->insertSeparator(); | 156 | m_edit->insertSeparator(); |
155 | 157 | ||
156 | if ( Ir::supported() ) { | 158 | if ( Ir::supported() ) { |
157 | a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); | 159 | a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); |
158 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 160 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
159 | a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) ); | 161 | a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) ); |
160 | a->addTo( m_edit ); | 162 | a->addTo( m_edit ); |
161 | a->addTo( m_tool ); | 163 | a->addTo( m_tool ); |
162 | } | 164 | } |
163 | 165 | ||
164 | #if 0 | 166 | #if 0 |
165 | // Options menu | 167 | // Options menu |
166 | a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ), | 168 | a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ), |
167 | QString::null, 0, this, 0 ); | 169 | QString::null, 0, this, 0 ); |
168 | connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | 170 | connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); |
169 | a->addTo( m_options ); | 171 | a->addTo( m_options ); |
170 | m_findAction = a; | 172 | m_findAction = a; |
171 | 173 | ||
172 | 174 | ||
173 | m_options->insertSeparator(); | 175 | m_options->insertSeparator(); |
174 | #endif | 176 | #endif |
175 | 177 | ||
176 | m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), | 178 | m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), |
177 | 0, this, 0, TRUE ); | 179 | 0, this, 0, TRUE ); |
178 | m_completedAction->addTo( m_options ); | 180 | m_completedAction->addTo( m_options ); |
179 | m_completedAction->setOn( showCompleted() ); | 181 | m_completedAction->setOn( showCompleted() ); |
180 | connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); | 182 | connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); |
181 | 183 | ||
182 | a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), | 184 | a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), |
183 | 0, this, 0, TRUE ); | 185 | 0, this, 0, TRUE ); |
184 | a->addTo( m_options ); | 186 | a->addTo( m_options ); |
185 | a->setOn( showOverDue() ); | 187 | a->setOn( showOverDue() ); |
186 | connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); | 188 | connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); |
187 | 189 | ||
188 | m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), | 190 | m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), |
189 | 0, this, 0, TRUE ); | 191 | 0, this, 0, TRUE ); |
190 | m_showDeadLineAction->addTo( m_options ); | 192 | m_showDeadLineAction->addTo( m_options ); |
191 | m_showDeadLineAction->setOn( showDeadline() ); | 193 | m_showDeadLineAction->setOn( showDeadline() ); |
192 | connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine(bool) ) ); | 194 | connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine(bool) ) ); |
193 | 195 | ||
194 | m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), | 196 | m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), |
195 | 0, this, 0, TRUE ); | 197 | 0, this, 0, TRUE ); |
196 | m_showQuickTaskAction->addTo( m_options ); | 198 | m_showQuickTaskAction->addTo( m_options ); |
197 | m_showQuickTaskAction->setOn( showQuickTask() ); | 199 | m_showQuickTaskAction->setOn( showQuickTask() ); |
198 | connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); | 200 | connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); |
199 | 201 | ||
200 | m_options->insertSeparator(); | 202 | m_options->insertSeparator(); |
201 | 203 | ||
202 | m_bar->insertItem( QWidget::tr("Data") ,m_edit ); | 204 | m_bar->insertItem( QWidget::tr("Data") ,m_edit ); |
203 | m_bar->insertItem( QWidget::tr("Category"), m_catMenu ); | 205 | m_bar->insertItem( QWidget::tr("Category"), m_catMenu ); |
204 | m_bar->insertItem( QWidget::tr("Options"), m_options ); | 206 | m_bar->insertItem( QWidget::tr("Options"), m_options ); |
205 | 207 | ||
206 | m_curQuick = new QuickEditImpl( this, m_quicktask ); | 208 | m_curQuick = new QuickEditImpl( this, m_quicktask ); |
207 | addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE ); | 209 | addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE ); |
208 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); | 210 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); |
209 | 211 | ||
210 | } | 212 | } |
211 | /* m_curCat from Config */ | 213 | /* m_curCat from Config */ |
212 | void MainWindow::initConfig() { | 214 | void MainWindow::initConfig() { |
213 | Config config( "todo" ); | 215 | Config config( "todo" ); |
214 | config.setGroup( "View" ); | 216 | config.setGroup( "View" ); |
215 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); | 217 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); |
216 | m_curCat = config.readEntry( "Category", QString::null ); | 218 | m_curCat = config.readEntry( "Category", QString::null ); |
217 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); | 219 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); |
218 | m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); | 220 | m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); |
219 | m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); | 221 | m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); |
220 | } | 222 | } |
221 | void MainWindow::initUI() { | 223 | void MainWindow::initUI() { |
222 | 224 | ||
223 | m_stack = new OWidgetStack(this, "main stack"); | 225 | m_stack = new Opie::Ui::OWidgetStack(this, "main stack"); |
224 | 226 | ||
225 | setCentralWidget( m_stack ); | 227 | setCentralWidget( m_stack ); |
226 | 228 | ||
227 | setToolBarsMovable( FALSE ); | 229 | setToolBarsMovable( FALSE ); |
228 | 230 | ||
229 | QToolBar *menubarholder = new QToolBar( this ); | 231 | QToolBar *menubarholder = new QToolBar( this ); |
230 | menubarholder->setHorizontalStretchable( TRUE ); | 232 | menubarholder->setHorizontalStretchable( TRUE ); |
231 | m_bar = new QMenuBar( menubarholder ); | 233 | m_bar = new QMenuBar( menubarholder ); |
232 | 234 | ||
233 | m_tool = new QToolBar( this ); | 235 | m_tool = new QToolBar( this ); |
234 | 236 | ||
235 | /** QPopupMenu */ | 237 | /** QPopupMenu */ |
236 | m_edit = new QPopupMenu( this ); | 238 | m_edit = new QPopupMenu( this ); |
237 | m_options = new QPopupMenu( this ); | 239 | m_options = new QPopupMenu( this ); |
238 | m_catMenu = new QPopupMenu( this ); | 240 | m_catMenu = new QPopupMenu( this ); |
239 | m_template = new QPopupMenu( this ); | 241 | m_template = new QPopupMenu( this ); |
240 | 242 | ||
241 | m_catMenu->setCheckable( TRUE ); | 243 | m_catMenu->setCheckable( TRUE ); |
242 | m_template->setCheckable( TRUE ); | 244 | m_template->setCheckable( TRUE ); |
243 | 245 | ||
244 | connect(m_catMenu, SIGNAL(activated(int) ), | 246 | connect(m_catMenu, SIGNAL(activated(int) ), |
245 | this, SLOT(setCategory(int) ) ); | 247 | this, SLOT(setCategory(int) ) ); |
246 | connect(m_template, SIGNAL(activated(int) ), | 248 | connect(m_template, SIGNAL(activated(int) ), |
247 | this, SLOT(slotNewFromTemplate(int) ) ); | 249 | this, SLOT(slotNewFromTemplate(int) ) ); |
248 | } | 250 | } |
249 | void MainWindow::initViews() { | 251 | void MainWindow::initViews() { |
250 | 252 | ||
251 | TableView* tableView = new TableView( this, m_stack ); | 253 | TableView* tableView = new TableView( this, m_stack ); |
252 | QWhatsThis::add( tableView, QWidget::tr( "This is a listing of all current tasks.\n\nThe list displays the following information:\n1. Completed - A green checkmark indicates task is completed. Click here to complete a task.\n2. Priority - a graphical representation of task priority. Double-click here to modify.\n3. Description - description of task. Click here to select the task.\n4. Deadline - shows when task is due. This column can be shown or hidden by selecting Options->'Show task deadlines' from the menu above." ) ); | 254 | QWhatsThis::add( tableView, QWidget::tr( "This is a listing of all current tasks.\n\nThe list displays the following information:\n1. Completed - A green checkmark indicates task is completed. Click here to complete a task.\n2. Priority - a graphical representation of task priority. Double-click here to modify.\n3. Description - description of task. Click here to select the task.\n4. Deadline - shows when task is due. This column can be shown or hidden by selecting Options->'Show task deadlines' from the menu above." ) ); |
253 | m_stack->addWidget( tableView, m_counter++ ); | 255 | m_stack->addWidget( tableView, m_counter++ ); |
254 | m_views.append( tableView ); | 256 | m_views.append( tableView ); |
255 | m_curView = tableView; | 257 | m_curView = tableView; |
256 | connectBase( tableView ); | 258 | connectBase( tableView ); |
257 | /* add QString type + QString configname to | 259 | /* add QString type + QString configname to |
258 | * the View menu | 260 | * the View menu |
259 | * and subdirs for multiple views | 261 | * and subdirs for multiple views |
260 | */ | 262 | */ |
261 | } | 263 | } |
262 | void MainWindow::initEditor() { | 264 | void MainWindow::initEditor() { |
263 | m_curEdit = new Editor(); | 265 | m_curEdit = new Editor(); |
264 | } | 266 | } |
265 | void MainWindow::initShow() { | 267 | void MainWindow::initShow() { |
266 | m_curShow = new TextViewShow(this, this); | 268 | m_curShow = new TextViewShow(this, this); |
267 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); | 269 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); |
268 | } | 270 | } |
269 | MainWindow::~MainWindow() { | 271 | MainWindow::~MainWindow() { |
270 | delete templateManager(); | 272 | delete templateManager(); |
271 | } | 273 | } |
272 | void MainWindow::connectBase( ViewBase* ) { | 274 | void MainWindow::connectBase( ViewBase* ) { |
273 | // once templates and signals mix we'll use it again | 275 | // once templates and signals mix we'll use it again |
274 | } | 276 | } |
275 | QPopupMenu* MainWindow::contextMenu( int , bool recur ) { | 277 | QPopupMenu* MainWindow::contextMenu( int , bool recur ) { |
276 | QPopupMenu* menu = new QPopupMenu(); | 278 | QPopupMenu* menu = new QPopupMenu(); |
277 | 279 | ||
278 | m_editAction->addTo( menu ); | 280 | m_editAction->addTo( menu ); |
279 | m_deleteAction->addTo( menu ); | 281 | m_deleteAction->addTo( menu ); |
280 | m_duplicateAction->addTo( menu ); | 282 | m_duplicateAction->addTo( menu ); |
281 | 283 | ||
282 | menu->insertSeparator(); | 284 | menu->insertSeparator(); |
283 | 285 | ||
284 | /* | 286 | /* |
285 | * if this event recurs we allow | 287 | * if this event recurs we allow |
286 | * to detach it. | 288 | * to detach it. |
287 | * remove all | 289 | * remove all |
288 | */ | 290 | */ |
289 | if ( recur ) { | 291 | if ( recur ) { |
290 | ; // FIXME | 292 | ; // FIXME |
291 | } | 293 | } |
292 | 294 | ||
293 | return menu; | 295 | return menu; |
294 | } | 296 | } |
295 | QPopupMenu* MainWindow::options() { | 297 | QPopupMenu* MainWindow::options() { |
296 | qWarning("Options"); | 298 | qWarning("Options"); |
297 | return m_options; | 299 | return m_options; |
298 | } | 300 | } |
299 | QPopupMenu* MainWindow::edit() { | 301 | QPopupMenu* MainWindow::edit() { |
300 | return m_edit; | 302 | return m_edit; |
301 | } | 303 | } |
302 | QToolBar* MainWindow::toolbar() { | 304 | QToolBar* MainWindow::toolbar() { |
303 | return m_tool; | 305 | return m_tool; |
304 | } | 306 | } |
305 | OPimTodoAccess::List MainWindow::list()const { | 307 | OPimTodoAccess::List MainWindow::list()const { |
306 | return m_todoMgr.list(); | 308 | return m_todoMgr.list(); |
307 | } | 309 | } |
308 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { | 310 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { |
309 | int cat = 0; | 311 | int cat = 0; |
310 | if ( m_curCat != QWidget::tr("All Categories") ) | 312 | if ( m_curCat != QWidget::tr("All Categories") ) |
311 | cat = currentCatId(); | 313 | cat = currentCatId(); |
312 | if ( m_curCat == QWidget::tr("Unfiled") ) | 314 | if ( m_curCat == QWidget::tr("Unfiled") ) |
313 | cat = -1; | 315 | cat = -1; |
314 | 316 | ||
315 | qWarning(" Category %d %s", cat, m_curCat.latin1() ); | 317 | qWarning(" Category %d %s", cat, m_curCat.latin1() ); |
316 | 318 | ||
317 | int filter = 1; | 319 | int filter = 1; |
318 | 320 | ||
319 | if (!m_completed ) | 321 | if (!m_completed ) |
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index b35a42b..f0d6a42 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -1,211 +1,211 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 3 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This program is free software; you can | 5 | _;:, .> :=|. This program is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This program is distributed in the hope that | 12 | .i_,=:_. -<s. This program is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef TODO_MAIN_WINDOW_H | 29 | #ifndef TODO_MAIN_WINDOW_H |
30 | #define TODO_MAIN_WINDOW_H | 30 | #define TODO_MAIN_WINDOW_H |
31 | 31 | ||
32 | #include <qlist.h> | 32 | #include <qlist.h> |
33 | 33 | ||
34 | #include <opie2/otodoaccess.h> | 34 | #include <opie2/otodoaccess.h> |
35 | #include <opie2/opimtodo.h> | 35 | #include <opie2/opimtodo.h> |
36 | #include <opie2/opimmainwindow.h> | 36 | #include <opie2/opimmainwindow.h> |
37 | #include <opie2/owidgetstack.h> | 37 | #include <opie2/owidgetstack.h> |
38 | 38 | ||
39 | #include "smalltodo.h" | 39 | #include "smalltodo.h" |
40 | #include "todoview.h" | 40 | #include "todoview.h" |
41 | #include "quickedit.h" | 41 | #include "quickedit.h" |
42 | #include "todomanager.h" | 42 | #include "todomanager.h" |
43 | 43 | ||
44 | class QPopupMenu; | 44 | class QPopupMenu; |
45 | class QMenuBar; | 45 | class QMenuBar; |
46 | class QToolBar; | 46 | class QToolBar; |
47 | class QAction; | 47 | class QAction; |
48 | class Ir; | 48 | class Ir; |
49 | class QVBox; | 49 | class QVBox; |
50 | class QLineEdit; | 50 | class QLineEdit; |
51 | 51 | ||
52 | namespace Todo { | 52 | namespace Todo { |
53 | typedef TodoView View; | 53 | typedef TodoView View; |
54 | class TemplateManager; | 54 | class TemplateManager; |
55 | class Editor; | 55 | class Editor; |
56 | class TodoShow; | 56 | class TodoShow; |
57 | class TemplateEditor; | 57 | class TemplateEditor; |
58 | struct QuickEditBase; | 58 | struct QuickEditBase; |
59 | 59 | ||
60 | class MainWindow : public Opie::OPimMainWindow { | 60 | class MainWindow : public Opie::OPimMainWindow { |
61 | Q_OBJECT | 61 | Q_OBJECT |
62 | friend class TodoView; // avoid QObject here.... | 62 | friend class TodoView; // avoid QObject here.... |
63 | friend class TodoShow; // avoid QObject | 63 | friend class TodoShow; // avoid QObject |
64 | public: | 64 | public: |
65 | /* OApplicationFactory application Name */ | 65 | /* Opie::Core::OApplicationFactory application Name */ |
66 | static QString appName() { return QString::fromLatin1("todolist"); } | 66 | static QString appName() { return QString::fromLatin1("todolist"); } |
67 | 67 | ||
68 | MainWindow( QWidget *parent = 0, | 68 | MainWindow( QWidget *parent = 0, |
69 | const char* name = 0, WFlags fl = 0 ); | 69 | const char* name = 0, WFlags fl = 0 ); |
70 | ~MainWindow(); | 70 | ~MainWindow(); |
71 | 71 | ||
72 | /** return a context menu for an OPimTodo */ | 72 | /** return a context menu for an OPimTodo */ |
73 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); | 73 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); |
74 | QPopupMenu* options(); | 74 | QPopupMenu* options(); |
75 | QPopupMenu* edit(); | 75 | QPopupMenu* edit(); |
76 | QToolBar* toolbar(); | 76 | QToolBar* toolbar(); |
77 | 77 | ||
78 | 78 | ||
79 | void updateList(); | 79 | void updateList(); |
80 | OPimTodoAccess::List list()const; | 80 | OPimTodoAccess::List list()const; |
81 | OPimTodoAccess::List sorted( bool asc, int sortOrder ); | 81 | OPimTodoAccess::List sorted( bool asc, int sortOrder ); |
82 | OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); | 82 | OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); |
83 | 83 | ||
84 | OPimTodo event(int uid ); | 84 | OPimTodo event(int uid ); |
85 | 85 | ||
86 | bool isSyncing()const; | 86 | bool isSyncing()const; |
87 | bool showCompleted()const; | 87 | bool showCompleted()const; |
88 | bool showDeadline()const; | 88 | bool showDeadline()const; |
89 | bool showOverDue()const; | 89 | bool showOverDue()const; |
90 | bool showQuickTask()const; | 90 | bool showQuickTask()const; |
91 | QString currentCategory()const; | 91 | QString currentCategory()const; |
92 | int currentCatId(); | 92 | int currentCatId(); |
93 | TemplateManager* templateManager(); | 93 | TemplateManager* templateManager(); |
94 | QuickEditBase* quickEditor(); | 94 | QuickEditBase* quickEditor(); |
95 | 95 | ||
96 | void updateTodo( const OPimTodo& ); | 96 | void updateTodo( const OPimTodo& ); |
97 | void populateTemplates(); | 97 | void populateTemplates(); |
98 | Editor* currentEditor(); | 98 | Editor* currentEditor(); |
99 | void setReadAhead(uint count ); | 99 | void setReadAhead(uint count ); |
100 | private slots: | 100 | private slots: |
101 | void slotQuickEntered(); | 101 | void slotQuickEntered(); |
102 | void populateCategories(); | 102 | void populateCategories(); |
103 | void slotReload(); | 103 | void slotReload(); |
104 | void slotFlush(); | 104 | void slotFlush(); |
105 | 105 | ||
106 | protected: | 106 | protected: |
107 | void closeEvent( QCloseEvent* e ); | 107 | void closeEvent( QCloseEvent* e ); |
108 | 108 | ||
109 | private: | 109 | private: |
110 | /* handle setting and removing alarms */ | 110 | /* handle setting and removing alarms */ |
111 | void handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo ); | 111 | void handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo ); |
112 | void receiveFile( const QString& filename ); | 112 | void receiveFile( const QString& filename ); |
113 | void connectBase( ViewBase* ); | 113 | void connectBase( ViewBase* ); |
114 | void initUI(); | 114 | void initUI(); |
115 | void initActions(); | 115 | void initActions(); |
116 | void initConfig(); | 116 | void initConfig(); |
117 | void initViews(); | 117 | void initViews(); |
118 | void initEditor(); | 118 | void initEditor(); |
119 | void initShow(); | 119 | void initShow(); |
120 | void initTemplate(); | 120 | void initTemplate(); |
121 | void raiseCurrentView(); | 121 | void raiseCurrentView(); |
122 | ViewBase* currentView(); | 122 | ViewBase* currentView(); |
123 | ViewBase* m_curView; | 123 | ViewBase* m_curView; |
124 | bool m_showing : 1; // used to see if we show a todo in the cases we shouldn't change the table | 124 | bool m_showing : 1; // used to see if we show a todo in the cases we shouldn't change the table |
125 | QuickEditBase* m_curQuick; | 125 | QuickEditBase* m_curQuick; |
126 | Editor* m_curEdit; | 126 | Editor* m_curEdit; |
127 | TodoShow* currentShow(); | 127 | TodoShow* currentShow(); |
128 | TodoShow* m_curShow; | 128 | TodoShow* m_curShow; |
129 | TemplateEditor* currentTemplateEditor(); | 129 | TemplateEditor* currentTemplateEditor(); |
130 | TemplateEditor* m_curTempEd; | 130 | TemplateEditor* m_curTempEd; |
131 | 131 | ||
132 | QMenuBar* m_bar; | 132 | QMenuBar* m_bar; |
133 | QToolBar* m_tool; | 133 | QToolBar* m_tool; |
134 | QAction* m_editAction, | 134 | QAction* m_editAction, |
135 | *m_deleteAction, | 135 | *m_deleteAction, |
136 | *m_findAction, | 136 | *m_findAction, |
137 | *m_completedAction, | 137 | *m_completedAction, |
138 | *m_showDeadLineAction, | 138 | *m_showDeadLineAction, |
139 | *m_deleteAllAction, | 139 | *m_deleteAllAction, |
140 | *m_deleteCompleteAction, | 140 | *m_deleteCompleteAction, |
141 | *m_duplicateAction, | 141 | *m_duplicateAction, |
142 | *m_showOverDueAction, | 142 | *m_showOverDueAction, |
143 | *m_showQuickTaskAction, | 143 | *m_showQuickTaskAction, |
144 | *m_effectiveAction; | 144 | *m_effectiveAction; |
145 | Opie::OWidgetStack *m_stack; | 145 | Opie::Ui::OWidgetStack *m_stack; |
146 | QPopupMenu* m_catMenu, | 146 | QPopupMenu* m_catMenu, |
147 | *m_edit, | 147 | *m_edit, |
148 | *m_options, | 148 | *m_options, |
149 | *m_template; | 149 | *m_template; |
150 | 150 | ||
151 | bool m_syncing:1; | 151 | bool m_syncing:1; |
152 | bool m_deadline:1; | 152 | bool m_deadline:1; |
153 | bool m_completed:1; | 153 | bool m_completed:1; |
154 | bool m_overdue:1; | 154 | bool m_overdue:1; |
155 | bool m_quicktask:1; | 155 | bool m_quicktask:1; |
156 | TodoManager m_todoMgr; | 156 | TodoManager m_todoMgr; |
157 | QString m_curCat; | 157 | QString m_curCat; |
158 | QList<ViewBase> m_views; | 158 | QList<ViewBase> m_views; |
159 | uint m_counter; | 159 | uint m_counter; |
160 | TemplateManager* m_tempManager; | 160 | TemplateManager* m_tempManager; |
161 | 161 | ||
162 | 162 | ||
163 | private slots: | 163 | private slots: |
164 | void slotShow(int); | 164 | void slotShow(int); |
165 | void slotEdit(int); | 165 | void slotEdit(int); |
166 | void slotUpdate3( QWidget* ); | 166 | void slotUpdate3( QWidget* ); |
167 | void slotComplete( int uid ); | 167 | void slotComplete( int uid ); |
168 | void slotComplete( const OPimTodo& ev ); | 168 | void slotComplete( const OPimTodo& ev ); |
169 | void slotNewFromTemplate(int id ); | 169 | void slotNewFromTemplate(int id ); |
170 | void slotNew(); | 170 | void slotNew(); |
171 | void slotDuplicate(); | 171 | void slotDuplicate(); |
172 | 172 | ||
173 | void slotDelete(); | 173 | void slotDelete(); |
174 | void slotDelete(int uid ); | 174 | void slotDelete(int uid ); |
175 | void slotDeleteAll(); | 175 | void slotDeleteAll(); |
176 | void slotDeleteCompleted(); | 176 | void slotDeleteCompleted(); |
177 | 177 | ||
178 | void slotEdit(); | 178 | void slotEdit(); |
179 | void slotFind(); | 179 | void slotFind(); |
180 | 180 | ||
181 | void setCategory( int ); | 181 | void setCategory( int ); |
182 | 182 | ||
183 | void slotShowDeadLine( bool ); | 183 | void slotShowDeadLine( bool ); |
184 | void slotShowCompleted( bool ); | 184 | void slotShowCompleted( bool ); |
185 | void slotShowQuickTask( bool ); | 185 | void slotShowQuickTask( bool ); |
186 | 186 | ||
187 | void setDocument( const QString& ); | 187 | void setDocument( const QString& ); |
188 | 188 | ||
189 | 189 | ||
190 | void slotBeam(); | 190 | void slotBeam(); |
191 | void beamDone( Ir* ); | 191 | void beamDone( Ir* ); |
192 | void slotShowDetails(); | 192 | void slotShowDetails(); |
193 | void slotShowNext(); | 193 | void slotShowNext(); |
194 | void slotShowPrev(); | 194 | void slotShowPrev(); |
195 | void slotShowDue( bool ); | 195 | void slotShowDue( bool ); |
196 | void slotReturnFromView(); // for TodoShow... | 196 | void slotReturnFromView(); // for TodoShow... |
197 | /* reimplementation from opimmainwindow */ | 197 | /* reimplementation from opimmainwindow */ |
198 | protected slots: | 198 | protected slots: |
199 | void flush(); | 199 | void flush(); |
200 | void reload(); | 200 | void reload(); |
201 | int create(); | 201 | int create(); |
202 | bool remove( int uid ); | 202 | bool remove( int uid ); |
203 | void beam(int uid); | 203 | void beam(int uid); |
204 | void show( int uid ); | 204 | void show( int uid ); |
205 | void edit( int uid ); | 205 | void edit( int uid ); |
206 | void add( const Opie::OPimRecord& ); | 206 | void add( const Opie::OPimRecord& ); |
207 | void doAlarm( const QDateTime& dt, int uid ); | 207 | void doAlarm( const QDateTime& dt, int uid ); |
208 | }; | 208 | }; |
209 | } | 209 | } |
210 | 210 | ||
211 | #endif | 211 | #endif |
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp index d1e50f7..f0128bc 100644 --- a/core/pim/todo/otaskeditor.cpp +++ b/core/pim/todo/otaskeditor.cpp | |||
@@ -1,90 +1,91 @@ | |||
1 | #include <qlayout.h> | 1 | #include <qlayout.h> |
2 | 2 | ||
3 | #include "taskeditoroverview.h" | 3 | #include "taskeditoroverview.h" |
4 | #include "taskeditorstatus.h" | 4 | #include "taskeditorstatus.h" |
5 | #include "taskeditoralarms.h" | 5 | #include "taskeditoralarms.h" |
6 | 6 | ||
7 | #include "otaskeditor.h" | 7 | #include "otaskeditor.h" |
8 | 8 | ||
9 | using namespace Opie::Ui; | ||
9 | OTaskEditor::OTaskEditor(int cur) | 10 | OTaskEditor::OTaskEditor(int cur) |
10 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { | 11 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { |
11 | init(); | 12 | init(); |
12 | init( cur ); | 13 | init( cur ); |
13 | } | 14 | } |
14 | OTaskEditor::OTaskEditor( const OPimTodo& to) | 15 | OTaskEditor::OTaskEditor( const OPimTodo& to) |
15 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { | 16 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { |
16 | init(); | 17 | init(); |
17 | init( to ); | 18 | init( to ); |
18 | } | 19 | } |
19 | OTaskEditor::~OTaskEditor() { | 20 | OTaskEditor::~OTaskEditor() { |
20 | 21 | ||
21 | } | 22 | } |
22 | void OTaskEditor::init( int cur ) { | 23 | void OTaskEditor::init( int cur ) { |
23 | OPimTodo to; | 24 | OPimTodo to; |
24 | to.setUid( 1 ); // generate a new uid | 25 | to.setUid( 1 ); // generate a new uid |
25 | if ( cur != 0 ) | 26 | if ( cur != 0 ) |
26 | to.setCategories( cur ); | 27 | to.setCategories( cur ); |
27 | load(to); | 28 | load(to); |
28 | } | 29 | } |
29 | void OTaskEditor::init( const OPimTodo& to ) { | 30 | void OTaskEditor::init( const OPimTodo& to ) { |
30 | load( to ); | 31 | load( to ); |
31 | } | 32 | } |
32 | OPimTodo OTaskEditor::todo()const{ | 33 | OPimTodo OTaskEditor::todo()const{ |
33 | qWarning("saving!"); | 34 | qWarning("saving!"); |
34 | OPimTodo to ( m_todo ); | 35 | OPimTodo to ( m_todo ); |
35 | m_overView->save( to ); | 36 | m_overView->save( to ); |
36 | m_stat->save( to ); | 37 | m_stat->save( to ); |
37 | to.setRecurrence( m_rec->recurrence() ); | 38 | to.setRecurrence( m_rec->recurrence() ); |
38 | m_alarm->save( to ); | 39 | m_alarm->save( to ); |
39 | 40 | ||
40 | return to; | 41 | return to; |
41 | } | 42 | } |
42 | void OTaskEditor::load(const OPimTodo& to) { | 43 | void OTaskEditor::load(const OPimTodo& to) { |
43 | m_overView->load( to ); | 44 | m_overView->load( to ); |
44 | m_stat->load( to ); | 45 | m_stat->load( to ); |
45 | m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); | 46 | m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); |
46 | m_alarm->load( to ); | 47 | m_alarm->load( to ); |
47 | 48 | ||
48 | m_todo = to; | 49 | m_todo = to; |
49 | } | 50 | } |
50 | void OTaskEditor::init() { | 51 | void OTaskEditor::init() { |
51 | setCaption(tr("Task Editor") ); | 52 | setCaption(tr("Task Editor") ); |
52 | 53 | ||
53 | QVBoxLayout* layo = new QVBoxLayout( this ); | 54 | QVBoxLayout* layo = new QVBoxLayout( this ); |
54 | m_tab = new OTabWidget( this ); | 55 | m_tab = new OTabWidget( this ); |
55 | layo->addWidget( m_tab ); | 56 | layo->addWidget( m_tab ); |
56 | 57 | ||
57 | /* | 58 | /* |
58 | * Add the Widgets | 59 | * Add the Widgets |
59 | */ | 60 | */ |
60 | m_overView = new TaskEditorOverView( m_tab ); | 61 | m_overView = new TaskEditorOverView( m_tab ); |
61 | m_tab->addTab( m_overView, "todo/info", tr("Information") ); | 62 | m_tab->addTab( m_overView, "todo/info", tr("Information") ); |
62 | 63 | ||
63 | m_stat = new TaskEditorStatus( m_tab ); | 64 | m_stat = new TaskEditorStatus( m_tab ); |
64 | m_tab->addTab( m_stat, "todo/TodoList", tr("Status") ); | 65 | m_tab->addTab( m_stat, "todo/TodoList", tr("Status") ); |
65 | 66 | ||
66 | m_alarm = new TaskEditorAlarms( m_tab ); | 67 | m_alarm = new TaskEditorAlarms( m_tab ); |
67 | m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") ); | 68 | m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") ); |
68 | 69 | ||
69 | // m_remind = new TaskEditorAlarms( m_tab ); | 70 | // m_remind = new TaskEditorAlarms( m_tab ); |
70 | // m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") ); | 71 | // m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") ); |
71 | 72 | ||
72 | // QLabel* lbl = new QLabel( m_tab ); | 73 | // QLabel* lbl = new QLabel( m_tab ); |
73 | // lbl->setText( tr("X-Ref") ); | 74 | // lbl->setText( tr("X-Ref") ); |
74 | // m_tab->addTab( lbl, "todo/xref", tr("X-Ref") ); | 75 | // m_tab->addTab( lbl, "todo/xref", tr("X-Ref") ); |
75 | 76 | ||
76 | m_rec = new OPimRecurrenceWidget( true, QDate::currentDate(), this ); | 77 | m_rec = new OPimRecurrenceWidget( true, QDate::currentDate(), this ); |
77 | m_tab->addTab( m_rec, "repeat", tr("Recurrence") ); | 78 | m_tab->addTab( m_rec, "repeat", tr("Recurrence") ); |
78 | 79 | ||
79 | 80 | ||
80 | /* signal and slots */ | 81 | /* signal and slots */ |
81 | connect(m_overView, SIGNAL(recurranceEnabled(bool) ), | 82 | connect(m_overView, SIGNAL(recurranceEnabled(bool) ), |
82 | m_rec, SLOT(setEnabled(bool) ) ); | 83 | m_rec, SLOT(setEnabled(bool) ) ); |
83 | 84 | ||
84 | /* connect due date changed to the recurrence tab */ | 85 | /* connect due date changed to the recurrence tab */ |
85 | connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ), | 86 | connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ), |
86 | m_rec, SLOT(setStartDate(const QDate&) ) ); | 87 | m_rec, SLOT(setStartDate(const QDate&) ) ); |
87 | 88 | ||
88 | 89 | ||
89 | m_tab->setCurrentTab( m_overView ); | 90 | m_tab->setCurrentTab( m_overView ); |
90 | } | 91 | } |
diff --git a/core/pim/todo/otaskeditor.h b/core/pim/todo/otaskeditor.h index 7068df8..4a00018 100644 --- a/core/pim/todo/otaskeditor.h +++ b/core/pim/todo/otaskeditor.h | |||
@@ -1,43 +1,43 @@ | |||
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 <opie2/opimtodo.h> | 6 | #include <opie2/opimtodo.h> |
7 | #include <opie2/otabwidget.h> | 7 | #include <opie2/otabwidget.h> |
8 | #include <opie2/opimrecurrencewidget.h> | 8 | #include <opie2/opimrecurrencewidget.h> |
9 | 9 | ||
10 | class TaskEditorOverView; | 10 | class TaskEditorOverView; |
11 | class TaskEditorStatus; | 11 | class TaskEditorStatus; |
12 | class TaskEditorAlarms; | 12 | class TaskEditorAlarms; |
13 | class QMultiLineEdit; | 13 | class QMultiLineEdit; |
14 | 14 | ||
15 | class OTaskEditor : public QDialog { | 15 | class OTaskEditor : public QDialog { |
16 | Q_OBJECT | 16 | Q_OBJECT |
17 | public: | 17 | public: |
18 | OTaskEditor(int cur); | 18 | OTaskEditor(int cur); |
19 | OTaskEditor( const OPimTodo& todo ); | 19 | OTaskEditor( const OPimTodo& todo ); |
20 | ~OTaskEditor(); | 20 | ~OTaskEditor(); |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * same as the c'tor but this gives us the | 23 | * same as the c'tor but this gives us the |
24 | * power to 'preload' the dialog | 24 | * power to 'preload' the dialog |
25 | */ | 25 | */ |
26 | void init( int cur ); | 26 | void init( int cur ); |
27 | void init( const OPimTodo& todo ); | 27 | void init( const OPimTodo& todo ); |
28 | 28 | ||
29 | OPimTodo todo()const; | 29 | OPimTodo todo()const; |
30 | private: | 30 | private: |
31 | void load( const OPimTodo& ); | 31 | void load( const OPimTodo& ); |
32 | void init(); | 32 | void init(); |
33 | 33 | ||
34 | OTabWidget *m_tab; | 34 | Opie::Ui::OTabWidget *m_tab; |
35 | TaskEditorOverView *m_overView; | 35 | TaskEditorOverView *m_overView; |
36 | TaskEditorStatus *m_stat; | 36 | TaskEditorStatus *m_stat; |
37 | TaskEditorAlarms *m_alarm; | 37 | TaskEditorAlarms *m_alarm; |
38 | TaskEditorAlarms *m_remind; | 38 | TaskEditorAlarms *m_remind; |
39 | OPimRecurrenceWidget *m_rec; | 39 | OPimRecurrenceWidget *m_rec; |
40 | OPimTodo m_todo; | 40 | OPimTodo m_todo; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | #endif | 43 | #endif |
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp index 94ae97e..90ad19e 100644 --- a/core/pim/todo/quickeditimpl.cpp +++ b/core/pim/todo/quickeditimpl.cpp | |||
@@ -1,116 +1,117 @@ | |||
1 | #include <qaction.h> | 1 | #include <qaction.h> |
2 | #include <qlineedit.h> | 2 | #include <qlineedit.h> |
3 | #include <qwhatsthis.h> | 3 | #include <qwhatsthis.h> |
4 | 4 | ||
5 | #include <qpe/resource.h> | 5 | #include <qpe/resource.h> |
6 | 6 | ||
7 | #include <opie2/oclickablelabel.h> | 7 | #include <opie2/oclickablelabel.h> |
8 | 8 | ||
9 | #include "mainwindow.h" | 9 | #include "mainwindow.h" |
10 | #include "quickeditimpl.h" | 10 | #include "quickeditimpl.h" |
11 | 11 | ||
12 | 12 | ||
13 | |||
13 | QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) | 14 | QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) |
14 | : QToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { | 15 | : QToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { |
15 | setHorizontalStretchable( TRUE ); | 16 | setHorizontalStretchable( TRUE ); |
16 | 17 | ||
17 | // Load priority icons | 18 | // Load priority icons |
18 | // TODO - probably should be done globally somewhere else, | 19 | // TODO - probably should be done globally somewhere else, |
19 | // see also tableview.cpp/h, taskeditoroverview.cpp/h | 20 | // see also tableview.cpp/h, taskeditoroverview.cpp/h |
20 | priority1 = Resource::loadPixmap( "todo/priority1" ); | 21 | priority1 = Resource::loadPixmap( "todo/priority1" ); |
21 | priority3 = Resource::loadPixmap( "todo/priority3" ); | 22 | priority3 = Resource::loadPixmap( "todo/priority3" ); |
22 | priority5 = Resource::loadPixmap( "todo/priority5" ); | 23 | priority5 = Resource::loadPixmap( "todo/priority5" ); |
23 | 24 | ||
24 | m_lbl = new Opie::OClickableLabel( this ); | 25 | m_lbl = new Opie::Ui::OClickableLabel( this ); |
25 | m_lbl->setMinimumWidth( 15 ); | 26 | m_lbl->setMinimumWidth( 15 ); |
26 | m_lbl->setPixmap( priority3 ); | 27 | m_lbl->setPixmap( priority3 ); |
27 | connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); | 28 | connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); |
28 | QWhatsThis::add( m_lbl, QWidget::tr( "Click here to set the priority of new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); | 29 | QWhatsThis::add( m_lbl, QWidget::tr( "Click here to set the priority of new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); |
29 | 30 | ||
30 | m_edit = new QLineEdit( this ); | 31 | m_edit = new QLineEdit( this ); |
31 | setStretchableWidget( m_edit ); | 32 | setStretchableWidget( m_edit ); |
32 | QWhatsThis::add( m_edit, QWidget::tr( "Enter description of new task here.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); | 33 | QWhatsThis::add( m_edit, QWidget::tr( "Enter description of new task here.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); |
33 | 34 | ||
34 | /* | 35 | /* |
35 | * it's not implemented and won't be implemented for 1.0 | 36 | * it's not implemented and won't be implemented for 1.0 |
36 | */ | 37 | */ |
37 | #if 0 | 38 | #if 0 |
38 | QAction *a = new QAction( QWidget::tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); | 39 | QAction *a = new QAction( QWidget::tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); |
39 | connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); | 40 | connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); |
40 | a->addTo( this ); | 41 | a->addTo( this ); |
41 | a->setWhatsThis( QWidget::tr( "Click here to enter additional information for new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); | 42 | a->setWhatsThis( QWidget::tr( "Click here to enter additional information for new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); |
42 | #endif | 43 | #endif |
43 | 44 | ||
44 | QAction *a = new QAction( QWidget::tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | 45 | QAction *a = new QAction( QWidget::tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); |
45 | connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); | 46 | connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); |
46 | a->addTo( this ); | 47 | a->addTo( this ); |
47 | a->setWhatsThis( QWidget::tr( "Click here to add new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); | 48 | a->setWhatsThis( QWidget::tr( "Click here to add new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); |
48 | 49 | ||
49 | a = new QAction( QWidget::tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 50 | a = new QAction( QWidget::tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
50 | connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); | 51 | connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); |
51 | a->addTo( this ); | 52 | a->addTo( this ); |
52 | a->setWhatsThis( QWidget::tr( "Click here to reset new task information.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); | 53 | a->setWhatsThis( QWidget::tr( "Click here to reset new task information.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); |
53 | 54 | ||
54 | m_visible = visible; | 55 | m_visible = visible; |
55 | if ( !m_visible ) { | 56 | if ( !m_visible ) { |
56 | hide(); | 57 | hide(); |
57 | } | 58 | } |
58 | 59 | ||
59 | m_menu = 0l; | 60 | m_menu = 0l; |
60 | reinit(); | 61 | reinit(); |
61 | } | 62 | } |
62 | QuickEditImpl::~QuickEditImpl() { | 63 | QuickEditImpl::~QuickEditImpl() { |
63 | 64 | ||
64 | } | 65 | } |
65 | OPimTodo QuickEditImpl::todo()const { | 66 | OPimTodo QuickEditImpl::todo()const { |
66 | return m_todo; | 67 | return m_todo; |
67 | } | 68 | } |
68 | QWidget* QuickEditImpl::widget() { | 69 | QWidget* QuickEditImpl::widget() { |
69 | return this; | 70 | return this; |
70 | } | 71 | } |
71 | void QuickEditImpl::slotEnter() { | 72 | void QuickEditImpl::slotEnter() { |
72 | OPimTodo todo; | 73 | OPimTodo todo; |
73 | 74 | ||
74 | 75 | ||
75 | if (!m_edit->text().isEmpty() ) { | 76 | if (!m_edit->text().isEmpty() ) { |
76 | todo.setUid(1 ); // new uid | 77 | todo.setUid(1 ); // new uid |
77 | todo.setPriority( m_state ); | 78 | todo.setPriority( m_state ); |
78 | todo.setSummary( m_edit->text() ); | 79 | todo.setSummary( m_edit->text() ); |
79 | if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 ) | 80 | if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 ) |
80 | todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() ); | 81 | todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() ); |
81 | 82 | ||
82 | m_todo = todo; | 83 | m_todo = todo; |
83 | commit(); | 84 | commit(); |
84 | } | 85 | } |
85 | m_todo = todo; | 86 | m_todo = todo; |
86 | reinit(); | 87 | reinit(); |
87 | } | 88 | } |
88 | void QuickEditImpl::slotPrio() { | 89 | void QuickEditImpl::slotPrio() { |
89 | m_state -= 2; | 90 | m_state -= 2; |
90 | if ( m_state < 1 ) | 91 | if ( m_state < 1 ) |
91 | m_state = 5; | 92 | m_state = 5; |
92 | 93 | ||
93 | switch( m_state ) { | 94 | switch( m_state ) { |
94 | case 1: | 95 | case 1: |
95 | m_lbl->setPixmap( priority1 ); | 96 | m_lbl->setPixmap( priority1 ); |
96 | break; | 97 | break; |
97 | case 5: | 98 | case 5: |
98 | m_lbl->setPixmap( priority5 ); | 99 | m_lbl->setPixmap( priority5 ); |
99 | break; | 100 | break; |
100 | case 3: | 101 | case 3: |
101 | default: | 102 | default: |
102 | m_lbl->setPixmap( priority3 ); | 103 | m_lbl->setPixmap( priority3 ); |
103 | break; | 104 | break; |
104 | } | 105 | } |
105 | } | 106 | } |
106 | void QuickEditImpl::slotMore() { | 107 | void QuickEditImpl::slotMore() { |
107 | // TODO - implement | 108 | // TODO - implement |
108 | } | 109 | } |
109 | void QuickEditImpl::slotCancel() { | 110 | void QuickEditImpl::slotCancel() { |
110 | reinit(); | 111 | reinit(); |
111 | } | 112 | } |
112 | void QuickEditImpl::reinit() { | 113 | void QuickEditImpl::reinit() { |
113 | m_state = 3; | 114 | m_state = 3; |
114 | m_lbl->setPixmap( priority3 ); | 115 | m_lbl->setPixmap( priority3 ); |
115 | m_edit->clear(); | 116 | m_edit->clear(); |
116 | } | 117 | } |
diff --git a/core/pim/todo/taskeditoralarms.cpp b/core/pim/todo/taskeditoralarms.cpp index a512fb0..62fc600 100644 --- a/core/pim/todo/taskeditoralarms.cpp +++ b/core/pim/todo/taskeditoralarms.cpp | |||
@@ -1,136 +1,137 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 <> | 3 | .=l. Copyright (c) 2002 <> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This program is free software; you can | 5 | _;:, .> :=|. This program is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This program is distributed in the hope that | 12 | .i_,=:_. -<s. This program is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = General Public License along with | 21 | -_. . . )=. = General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "taskeditoralarms.h" | 29 | #include "taskeditoralarms.h" |
30 | 30 | ||
31 | #include <opie2/opimnotifymanager.h> | 31 | #include <opie2/opimnotifymanager.h> |
32 | #include <opie2/otimepicker.h> | 32 | #include <opie2/otimepicker.h> |
33 | 33 | ||
34 | #include <qpe/datebookmonth.h> | 34 | #include <qpe/datebookmonth.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | 36 | ||
37 | #include <qlistview.h> | 37 | #include <qlistview.h> |
38 | #include <qlayout.h> | 38 | #include <qlayout.h> |
39 | 39 | ||
40 | 40 | ||
41 | using namespace Opie::Ui; | ||
41 | class AlarmItem : public QListViewItem { | 42 | class AlarmItem : public QListViewItem { |
42 | public: | 43 | public: |
43 | AlarmItem( QListView*, const OPimAlarm& ); | 44 | AlarmItem( QListView*, const OPimAlarm& ); |
44 | ~AlarmItem(); | 45 | ~AlarmItem(); |
45 | 46 | ||
46 | OPimAlarm alarm()const; | 47 | OPimAlarm alarm()const; |
47 | void setAlarm( const OPimAlarm& ); | 48 | void setAlarm( const OPimAlarm& ); |
48 | private: | 49 | private: |
49 | QDateTime m_dt; | 50 | QDateTime m_dt; |
50 | int m_type; | 51 | int m_type; |
51 | }; | 52 | }; |
52 | AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt) | 53 | AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt) |
53 | : QListViewItem(view) { | 54 | : QListViewItem(view) { |
54 | setAlarm( dt ); | 55 | setAlarm( dt ); |
55 | } | 56 | } |
56 | void AlarmItem::setAlarm( const OPimAlarm& dt ) { | 57 | void AlarmItem::setAlarm( const OPimAlarm& dt ) { |
57 | m_dt = dt.dateTime(); | 58 | m_dt = dt.dateTime(); |
58 | m_type = dt.sound(); | 59 | m_type = dt.sound(); |
59 | setText( 0, TimeString::dateString( m_dt.date() ) ); | 60 | setText( 0, TimeString::dateString( m_dt.date() ) ); |
60 | setText( 1, TimeString::timeString( m_dt.time() ) ); | 61 | setText( 1, TimeString::timeString( m_dt.time() ) ); |
61 | setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") ); | 62 | setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") ); |
62 | } | 63 | } |
63 | AlarmItem::~AlarmItem() { | 64 | AlarmItem::~AlarmItem() { |
64 | } | 65 | } |
65 | OPimAlarm AlarmItem::alarm()const{ | 66 | OPimAlarm AlarmItem::alarm()const{ |
66 | OPimAlarm al( m_type, m_dt ); | 67 | OPimAlarm al( m_type, m_dt ); |
67 | 68 | ||
68 | return al; | 69 | return al; |
69 | } | 70 | } |
70 | 71 | ||
71 | TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl ) | 72 | TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl ) |
72 | : QWidget( parent, name, fl ) | 73 | : QWidget( parent, name, fl ) |
73 | { | 74 | { |
74 | m_date = m_type = m_time = 0; | 75 | m_date = m_type = m_time = 0; |
75 | QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 ); | 76 | QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 ); |
76 | 77 | ||
77 | lstAlarms = new QListView( this ); | 78 | lstAlarms = new QListView( this ); |
78 | lstAlarms->addColumn( tr("Date") ); | 79 | lstAlarms->addColumn( tr("Date") ); |
79 | lstAlarms->addColumn( tr("Time") ); | 80 | lstAlarms->addColumn( tr("Time") ); |
80 | lstAlarms->addColumn( tr("Type") ); | 81 | lstAlarms->addColumn( tr("Type") ); |
81 | 82 | ||
82 | connect( lstAlarms, SIGNAL(clicked(QListViewItem*,const QPoint&,int) ), | 83 | connect( lstAlarms, SIGNAL(clicked(QListViewItem*,const QPoint&,int) ), |
83 | this, SLOT(inlineEdit(QListViewItem*,const QPoint&,int) ) ); | 84 | this, SLOT(inlineEdit(QListViewItem*,const QPoint&,int) ) ); |
84 | 85 | ||
85 | layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 ); | 86 | layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 ); |
86 | 87 | ||
87 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), this ); | 88 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), this ); |
88 | //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); | 89 | //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); |
89 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) ); | 90 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) ); |
90 | layout->addWidget( btn, 1, 0 ); | 91 | layout->addWidget( btn, 1, 0 ); |
91 | /* use when we've reminders too */ | 92 | /* use when we've reminders too */ |
92 | #if 0 | 93 | #if 0 |
93 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this ); | 94 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this ); |
94 | //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); | 95 | //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); |
95 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) ); | 96 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) ); |
96 | layout->addWidget( btn, 1, 1 ); | 97 | layout->addWidget( btn, 1, 1 ); |
97 | #endif | 98 | #endif |
98 | 99 | ||
99 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); | 100 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); |
100 | //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); | 101 | //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); |
101 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) ); | 102 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) ); |
102 | layout->addWidget( btn, 1, 2 ); | 103 | layout->addWidget( btn, 1, 2 ); |
103 | } | 104 | } |
104 | 105 | ||
105 | TaskEditorAlarms::~TaskEditorAlarms(){ | 106 | TaskEditorAlarms::~TaskEditorAlarms(){ |
106 | } | 107 | } |
107 | 108 | ||
108 | void TaskEditorAlarms::slotNew(){ | 109 | void TaskEditorAlarms::slotNew(){ |
109 | (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) ); | 110 | (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) ); |
110 | } | 111 | } |
111 | 112 | ||
112 | void TaskEditorAlarms::slotEdit(){ | 113 | void TaskEditorAlarms::slotEdit(){ |
113 | } | 114 | } |
114 | 115 | ||
115 | void TaskEditorAlarms::slotDelete(){ | 116 | void TaskEditorAlarms::slotDelete(){ |
116 | QListViewItem* item = lstAlarms->currentItem(); | 117 | QListViewItem* item = lstAlarms->currentItem(); |
117 | if (!item) return; | 118 | if (!item) return; |
118 | 119 | ||
119 | lstAlarms->takeItem( item ); delete item; | 120 | lstAlarms->takeItem( item ); delete item; |
120 | 121 | ||
121 | 122 | ||
122 | } | 123 | } |
123 | 124 | ||
124 | void TaskEditorAlarms::load( const OPimTodo& todo) { | 125 | void TaskEditorAlarms::load( const OPimTodo& todo) { |
125 | lstAlarms->clear(); | 126 | lstAlarms->clear(); |
126 | if (!todo.hasNotifiers() ) return; | 127 | if (!todo.hasNotifiers() ) return; |
127 | 128 | ||
128 | OPimNotifyManager::Alarms als = todo.notifiers().alarms(); | 129 | OPimNotifyManager::Alarms als = todo.notifiers().alarms(); |
129 | 130 | ||
130 | if (als.isEmpty() ) return; | 131 | if (als.isEmpty() ) return; |
131 | 132 | ||
132 | OPimNotifyManager::Alarms::Iterator it = als.begin(); | 133 | OPimNotifyManager::Alarms::Iterator it = als.begin(); |
133 | for ( ; it != als.end(); ++it ) | 134 | for ( ; it != als.end(); ++it ) |
134 | (void)new AlarmItem( lstAlarms, (*it) ); | 135 | (void)new AlarmItem( lstAlarms, (*it) ); |
135 | 136 | ||
136 | 137 | ||