author | drw <drw> | 2004-02-25 16:32:24 (UTC) |
---|---|---|
committer | drw <drw> | 2004-02-25 16:32:24 (UTC) |
commit | bea97f98bfb31994425908e7ce982b2450696706 (patch) (unidiff) | |
tree | 2f2bc2f55d4656b7c63a06cdce6bc35346d9388f | |
parent | f84a46fce6c1b7702ec1eaebd40e363b67253649 (diff) | |
download | opie-bea97f98bfb31994425908e7ce982b2450696706.zip opie-bea97f98bfb31994425908e7ce982b2450696706.tar.gz opie-bea97f98bfb31994425908e7ce982b2450696706.tar.bz2 |
Todo: libopie->libopie2
33 files changed, 237 insertions, 224 deletions
diff --git a/core/pim/todo/config.in b/core/pim/todo/config.in index 0b6af4c..45c4558 100644 --- a/core/pim/todo/config.in +++ b/core/pim/todo/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config TODO | 1 | config TODO |
2 | boolean "opie-todo (a Todo-list manager)" | 2 | boolean "opie-todo (a Todo-list manager)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM |
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index fc189bd..0613f2c 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -1,1044 +1,1042 @@ | |||
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> | ||
32 | #include <opie2/opimnotifymanager.h> | ||
33 | #include <opie2/otodoaccessvcal.h> | ||
34 | #include <opie2/oapplicationfactory.h> | ||
35 | |||
36 | #include <qpe/applnk.h> | ||
37 | #include <qpe/config.h> | ||
38 | #include <qpe/ir.h> | ||
39 | #include <qpe/resource.h> | ||
40 | #include <qpe/qpemessagebox.h> | ||
41 | #include <qpe/alarmserver.h> | ||
42 | #include <qpe/timestring.h> | ||
43 | #include <qpe/qpeapplication.h> | ||
44 | |||
31 | #include <qmenubar.h> | 45 | #include <qmenubar.h> |
32 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
33 | #include <qtoolbar.h> | 47 | #include <qtoolbar.h> |
34 | #include <qpopupmenu.h> | 48 | #include <qpopupmenu.h> |
35 | #include <qpushbutton.h> | 49 | #include <qpushbutton.h> |
36 | #include <qwidgetstack.h> | 50 | #include <qwidgetstack.h> |
37 | #include <qaction.h> | 51 | #include <qaction.h> |
38 | #include <qtimer.h> | 52 | #include <qtimer.h> |
39 | #include <qvbox.h> | 53 | #include <qvbox.h> |
40 | #include <qlayout.h> | 54 | #include <qlayout.h> |
41 | #include <qlineedit.h> | 55 | #include <qlineedit.h> |
42 | #include <qwhatsthis.h> | 56 | #include <qwhatsthis.h> |
43 | 57 | ||
44 | #include <qpe/applnk.h> | ||
45 | #include <qpe/config.h> | ||
46 | #include <qpe/ir.h> | ||
47 | #include <qpe/resource.h> | ||
48 | #include <qpe/qpemessagebox.h> | ||
49 | #include <qpe/alarmserver.h> | ||
50 | #include <qpe/timestring.h> | ||
51 | #include <qpe/qpeapplication.h> | ||
52 | |||
53 | #include <opie/orecur.h> | ||
54 | #include <opie/opimnotifymanager.h> | ||
55 | #include <opie/otodoaccessvcal.h> | ||
56 | #include <opie/owidgetstack.h> | ||
57 | |||
58 | #include <opie/oapplicationfactory.h> | ||
59 | |||
60 | #include "quickeditimpl.h" | 58 | #include "quickeditimpl.h" |
61 | #include "todotemplatemanager.h" | 59 | #include "todotemplatemanager.h" |
62 | #include "templateeditor.h" | 60 | #include "templateeditor.h" |
63 | #include "tableview.h" | 61 | #include "tableview.h" |
64 | 62 | ||
65 | #include "textviewshow.h" | 63 | #include "textviewshow.h" |
66 | #include "todoeditor.h" | 64 | #include "todoeditor.h" |
67 | #include "mainwindow.h" | 65 | #include "mainwindow.h" |
68 | 66 | ||
69 | OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) | 67 | OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) |
70 | 68 | ||
71 | using namespace Todo; | 69 | using namespace Todo; |
72 | 70 | ||
73 | MainWindow::MainWindow( QWidget* parent, | 71 | MainWindow::MainWindow( QWidget* parent, |
74 | const char* name, WFlags ) | 72 | const char* name, WFlags ) |
75 | : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) | 73 | : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) |
76 | { | 74 | { |
77 | if (!name) | 75 | if (!name) |
78 | setName("todo window"); | 76 | setName("todo window"); |
79 | 77 | ||
80 | m_syncing = false; | 78 | m_syncing = false; |
81 | m_showing = false; | 79 | m_showing = false; |
82 | m_counter = 0; | 80 | m_counter = 0; |
83 | m_tempManager = new TemplateManager(); | 81 | m_tempManager = new TemplateManager(); |
84 | m_tempManager->load(); | 82 | m_tempManager->load(); |
85 | 83 | ||
86 | initUI(); | 84 | initUI(); |
87 | initConfig(); | 85 | initConfig(); |
88 | initViews(); | 86 | initViews(); |
89 | initActions(); | 87 | initActions(); |
90 | initEditor(); | 88 | initEditor(); |
91 | initShow(); | 89 | initShow(); |
92 | initTemplate(); | 90 | initTemplate(); |
93 | 91 | ||
94 | populateTemplates(); | 92 | populateTemplates(); |
95 | raiseCurrentView(); | 93 | raiseCurrentView(); |
96 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); | 94 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); |
97 | } | 95 | } |
98 | void MainWindow::initTemplate() { | 96 | void MainWindow::initTemplate() { |
99 | m_curTempEd = new TemplateEditor( this, templateManager() ); | 97 | m_curTempEd = new TemplateEditor( this, templateManager() ); |
100 | } | 98 | } |
101 | void MainWindow::initActions() { | 99 | void MainWindow::initActions() { |
102 | 100 | ||
103 | // Data menu | 101 | // Data menu |
104 | m_edit->insertItem(QWidget::tr("New from template"), m_template, | 102 | m_edit->insertItem(QWidget::tr("New from template"), m_template, |
105 | -1, 0 ); | 103 | -1, 0 ); |
106 | 104 | ||
107 | QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), | 105 | QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), |
108 | QString::null, 0, this, 0 ); | 106 | QString::null, 0, this, 0 ); |
109 | connect(a, SIGNAL( activated() ), | 107 | connect(a, SIGNAL( activated() ), |
110 | this, SLOT( slotNew() ) ); | 108 | this, SLOT( slotNew() ) ); |
111 | a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); | 109 | a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); |
112 | a->addTo(m_tool ); | 110 | a->addTo(m_tool ); |
113 | a->addTo(m_edit ); | 111 | a->addTo(m_edit ); |
114 | 112 | ||
115 | a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), | 113 | a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), |
116 | QString::null, 0, this, 0 ); | 114 | QString::null, 0, this, 0 ); |
117 | connect(a, SIGNAL(activated() ), | 115 | connect(a, SIGNAL(activated() ), |
118 | this, SLOT( slotEdit() ) ); | 116 | this, SLOT( slotEdit() ) ); |
119 | a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); | 117 | a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); |
120 | a->addTo( m_tool ); | 118 | a->addTo( m_tool ); |
121 | a->addTo( m_edit ); | 119 | a->addTo( m_edit ); |
122 | m_editAction = a; | 120 | m_editAction = a; |
123 | 121 | ||
124 | a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); | 122 | a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); |
125 | connect(a, SIGNAL( activated() ), | 123 | connect(a, SIGNAL( activated() ), |
126 | this, SLOT( slotShowDetails() ) ); | 124 | this, SLOT( slotShowDetails() ) ); |
127 | a->addTo( m_edit ); | 125 | a->addTo( m_edit ); |
128 | 126 | ||
129 | m_edit->insertSeparator(); | 127 | m_edit->insertSeparator(); |
130 | 128 | ||
131 | a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ), | 129 | a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ), |
132 | QString::null, 0, this, 0 ); | 130 | QString::null, 0, this, 0 ); |
133 | connect(a, SIGNAL(activated() ), | 131 | connect(a, SIGNAL(activated() ), |
134 | this, SLOT(slotDelete() ) ); | 132 | this, SLOT(slotDelete() ) ); |
135 | a->setWhatsThis( QWidget::tr( "Click here to remove the current task." ) ); | 133 | a->setWhatsThis( QWidget::tr( "Click here to remove the current task." ) ); |
136 | a->addTo( m_tool ); | 134 | a->addTo( m_tool ); |
137 | a->addTo( m_edit ); | 135 | a->addTo( m_edit ); |
138 | m_deleteAction = a; | 136 | m_deleteAction = a; |
139 | 137 | ||
140 | a = new QAction( QString::null, QWidget::tr("Delete all..."), 0, this, 0 ); | 138 | a = new QAction( QString::null, QWidget::tr("Delete all..."), 0, this, 0 ); |
141 | connect(a, SIGNAL( activated() ), | 139 | connect(a, SIGNAL( activated() ), |
142 | this, SLOT( slotDeleteAll() ) ); | 140 | this, SLOT( slotDeleteAll() ) ); |
143 | a->addTo(m_edit ); | 141 | a->addTo(m_edit ); |
144 | m_deleteAllAction = a; | 142 | m_deleteAllAction = a; |
145 | 143 | ||
146 | a = new QAction( QString::null, QWidget::tr("Delete completed"), | 144 | a = new QAction( QString::null, QWidget::tr("Delete completed"), |
147 | 0, this, 0 ); | 145 | 0, this, 0 ); |
148 | connect(a, SIGNAL( activated() ), | 146 | connect(a, SIGNAL( activated() ), |
149 | this, SLOT( slotDeleteCompleted() ) ); | 147 | this, SLOT( slotDeleteCompleted() ) ); |
150 | a->addTo(m_edit ); | 148 | a->addTo(m_edit ); |
151 | a->setEnabled( TRUE ); | 149 | a->setEnabled( TRUE ); |
152 | m_deleteCompleteAction = a; | 150 | m_deleteCompleteAction = a; |
153 | 151 | ||
154 | m_edit->insertSeparator(); | 152 | m_edit->insertSeparator(); |
155 | 153 | ||
156 | a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 ); | 154 | a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 ); |
157 | connect(a, SIGNAL( activated() ), | 155 | connect(a, SIGNAL( activated() ), |
158 | this, SLOT( slotDuplicate() ) ); | 156 | this, SLOT( slotDuplicate() ) ); |
159 | a->addTo(m_edit ); | 157 | a->addTo(m_edit ); |
160 | m_duplicateAction = a; | 158 | m_duplicateAction = a; |
161 | 159 | ||
162 | m_edit->insertSeparator(); | 160 | m_edit->insertSeparator(); |
163 | 161 | ||
164 | if ( Ir::supported() ) { | 162 | if ( Ir::supported() ) { |
165 | a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); | 163 | a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); |
166 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 164 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
167 | a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) ); | 165 | a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) ); |
168 | a->addTo( m_edit ); | 166 | a->addTo( m_edit ); |
169 | a->addTo( m_tool ); | 167 | a->addTo( m_tool ); |
170 | } | 168 | } |
171 | 169 | ||
172 | #if 0 | 170 | #if 0 |
173 | // Options menu | 171 | // Options menu |
174 | a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ), | 172 | a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ), |
175 | QString::null, 0, this, 0 ); | 173 | QString::null, 0, this, 0 ); |
176 | connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | 174 | connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); |
177 | a->addTo( m_options ); | 175 | a->addTo( m_options ); |
178 | m_findAction = a; | 176 | m_findAction = a; |
179 | 177 | ||
180 | 178 | ||
181 | m_options->insertSeparator(); | 179 | m_options->insertSeparator(); |
182 | #endif | 180 | #endif |
183 | 181 | ||
184 | m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), | 182 | m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), |
185 | 0, this, 0, TRUE ); | 183 | 0, this, 0, TRUE ); |
186 | m_completedAction->addTo( m_options ); | 184 | m_completedAction->addTo( m_options ); |
187 | m_completedAction->setOn( showCompleted() ); | 185 | m_completedAction->setOn( showCompleted() ); |
188 | connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); | 186 | connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); |
189 | 187 | ||
190 | a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), | 188 | a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), |
191 | 0, this, 0, TRUE ); | 189 | 0, this, 0, TRUE ); |
192 | a->addTo( m_options ); | 190 | a->addTo( m_options ); |
193 | a->setOn( showOverDue() ); | 191 | a->setOn( showOverDue() ); |
194 | connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); | 192 | connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); |
195 | 193 | ||
196 | m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), | 194 | m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), |
197 | 0, this, 0, TRUE ); | 195 | 0, this, 0, TRUE ); |
198 | m_showDeadLineAction->addTo( m_options ); | 196 | m_showDeadLineAction->addTo( m_options ); |
199 | m_showDeadLineAction->setOn( showDeadline() ); | 197 | m_showDeadLineAction->setOn( showDeadline() ); |
200 | connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) ); | 198 | connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) ); |
201 | 199 | ||
202 | m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), | 200 | m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), |
203 | 0, this, 0, TRUE ); | 201 | 0, this, 0, TRUE ); |
204 | m_showQuickTaskAction->addTo( m_options ); | 202 | m_showQuickTaskAction->addTo( m_options ); |
205 | m_showQuickTaskAction->setOn( showQuickTask() ); | 203 | m_showQuickTaskAction->setOn( showQuickTask() ); |
206 | connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); | 204 | connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); |
207 | 205 | ||
208 | m_options->insertSeparator(); | 206 | m_options->insertSeparator(); |
209 | 207 | ||
210 | m_bar->insertItem( QWidget::tr("Data") ,m_edit ); | 208 | m_bar->insertItem( QWidget::tr("Data") ,m_edit ); |
211 | m_bar->insertItem( QWidget::tr("Category"), m_catMenu ); | 209 | m_bar->insertItem( QWidget::tr("Category"), m_catMenu ); |
212 | m_bar->insertItem( QWidget::tr("Options"), m_options ); | 210 | m_bar->insertItem( QWidget::tr("Options"), m_options ); |
213 | 211 | ||
214 | m_curQuick = new QuickEditImpl( this, m_quicktask ); | 212 | m_curQuick = new QuickEditImpl( this, m_quicktask ); |
215 | addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE ); | 213 | addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE ); |
216 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); | 214 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); |
217 | 215 | ||
218 | } | 216 | } |
219 | /* m_curCat from Config */ | 217 | /* m_curCat from Config */ |
220 | void MainWindow::initConfig() { | 218 | void MainWindow::initConfig() { |
221 | Config config( "todo" ); | 219 | Config config( "todo" ); |
222 | config.setGroup( "View" ); | 220 | config.setGroup( "View" ); |
223 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); | 221 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); |
224 | m_curCat = config.readEntry( "Category", QString::null ); | 222 | m_curCat = config.readEntry( "Category", QString::null ); |
225 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); | 223 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); |
226 | m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); | 224 | m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); |
227 | m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); | 225 | m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); |
228 | } | 226 | } |
229 | void MainWindow::initUI() { | 227 | void MainWindow::initUI() { |
230 | 228 | ||
231 | m_stack = new OWidgetStack(this, "main stack"); | 229 | m_stack = new OWidgetStack(this, "main stack"); |
232 | 230 | ||
233 | setCentralWidget( m_stack ); | 231 | setCentralWidget( m_stack ); |
234 | 232 | ||
235 | setToolBarsMovable( FALSE ); | 233 | setToolBarsMovable( FALSE ); |
236 | 234 | ||
237 | QToolBar *menubarholder = new QToolBar( this ); | 235 | QToolBar *menubarholder = new QToolBar( this ); |
238 | menubarholder->setHorizontalStretchable( TRUE ); | 236 | menubarholder->setHorizontalStretchable( TRUE ); |
239 | m_bar = new QMenuBar( menubarholder ); | 237 | m_bar = new QMenuBar( menubarholder ); |
240 | 238 | ||
241 | m_tool = new QToolBar( this ); | 239 | m_tool = new QToolBar( this ); |
242 | 240 | ||
243 | /** QPopupMenu */ | 241 | /** QPopupMenu */ |
244 | m_edit = new QPopupMenu( this ); | 242 | m_edit = new QPopupMenu( this ); |
245 | m_options = new QPopupMenu( this ); | 243 | m_options = new QPopupMenu( this ); |
246 | m_catMenu = new QPopupMenu( this ); | 244 | m_catMenu = new QPopupMenu( this ); |
247 | m_template = new QPopupMenu( this ); | 245 | m_template = new QPopupMenu( this ); |
248 | 246 | ||
249 | m_catMenu->setCheckable( TRUE ); | 247 | m_catMenu->setCheckable( TRUE ); |
250 | m_template->setCheckable( TRUE ); | 248 | m_template->setCheckable( TRUE ); |
251 | 249 | ||
252 | connect(m_catMenu, SIGNAL(activated(int) ), | 250 | connect(m_catMenu, SIGNAL(activated(int) ), |
253 | this, SLOT(setCategory(int) ) ); | 251 | this, SLOT(setCategory(int) ) ); |
254 | connect(m_template, SIGNAL(activated(int) ), | 252 | connect(m_template, SIGNAL(activated(int) ), |
255 | this, SLOT(slotNewFromTemplate(int) ) ); | 253 | this, SLOT(slotNewFromTemplate(int) ) ); |
256 | } | 254 | } |
257 | void MainWindow::initViews() { | 255 | void MainWindow::initViews() { |
258 | 256 | ||
259 | TableView* tableView = new TableView( this, m_stack ); | 257 | TableView* tableView = new TableView( this, m_stack ); |
260 | 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." ) ); | 258 | 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." ) ); |
261 | m_stack->addWidget( tableView, m_counter++ ); | 259 | m_stack->addWidget( tableView, m_counter++ ); |
262 | m_views.append( tableView ); | 260 | m_views.append( tableView ); |
263 | m_curView = tableView; | 261 | m_curView = tableView; |
264 | connectBase( tableView ); | 262 | connectBase( tableView ); |
265 | /* add QString type + QString configname to | 263 | /* add QString type + QString configname to |
266 | * the View menu | 264 | * the View menu |
267 | * and subdirs for multiple views | 265 | * and subdirs for multiple views |
268 | */ | 266 | */ |
269 | } | 267 | } |
270 | void MainWindow::initEditor() { | 268 | void MainWindow::initEditor() { |
271 | m_curEdit = new Editor(); | 269 | m_curEdit = new Editor(); |
272 | } | 270 | } |
273 | void MainWindow::initShow() { | 271 | void MainWindow::initShow() { |
274 | m_curShow = new TextViewShow(this, this); | 272 | m_curShow = new TextViewShow(this, this); |
275 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); | 273 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); |
276 | } | 274 | } |
277 | MainWindow::~MainWindow() { | 275 | MainWindow::~MainWindow() { |
278 | delete templateManager(); | 276 | delete templateManager(); |
279 | } | 277 | } |
280 | void MainWindow::connectBase( ViewBase* ) { | 278 | void MainWindow::connectBase( ViewBase* ) { |
281 | // once templates and signals mix we'll use it again | 279 | // once templates and signals mix we'll use it again |
282 | } | 280 | } |
283 | QPopupMenu* MainWindow::contextMenu( int , bool recur ) { | 281 | QPopupMenu* MainWindow::contextMenu( int , bool recur ) { |
284 | QPopupMenu* menu = new QPopupMenu(); | 282 | QPopupMenu* menu = new QPopupMenu(); |
285 | 283 | ||
286 | m_editAction->addTo( menu ); | 284 | m_editAction->addTo( menu ); |
287 | m_deleteAction->addTo( menu ); | 285 | m_deleteAction->addTo( menu ); |
288 | m_duplicateAction->addTo( menu ); | 286 | m_duplicateAction->addTo( menu ); |
289 | 287 | ||
290 | menu->insertSeparator(); | 288 | menu->insertSeparator(); |
291 | 289 | ||
292 | /* | 290 | /* |
293 | * if this event recurs we allow | 291 | * if this event recurs we allow |
294 | * to detach it. | 292 | * to detach it. |
295 | * remove all | 293 | * remove all |
296 | */ | 294 | */ |
297 | if ( recur ) { | 295 | if ( recur ) { |
298 | ; // FIXME | 296 | ; // FIXME |
299 | } | 297 | } |
300 | 298 | ||
301 | return menu; | 299 | return menu; |
302 | } | 300 | } |
303 | QPopupMenu* MainWindow::options() { | 301 | QPopupMenu* MainWindow::options() { |
304 | qWarning("Options"); | 302 | qWarning("Options"); |
305 | return m_options; | 303 | return m_options; |
306 | } | 304 | } |
307 | QPopupMenu* MainWindow::edit() { | 305 | QPopupMenu* MainWindow::edit() { |
308 | return m_edit; | 306 | return m_edit; |
309 | } | 307 | } |
310 | QToolBar* MainWindow::toolbar() { | 308 | QToolBar* MainWindow::toolbar() { |
311 | return m_tool; | 309 | return m_tool; |
312 | } | 310 | } |
313 | OTodoAccess::List MainWindow::list()const { | 311 | OPimTodoAccess::List MainWindow::list()const { |
314 | return m_todoMgr.list(); | 312 | return m_todoMgr.list(); |
315 | } | 313 | } |
316 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { | 314 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { |
317 | int cat = 0; | 315 | int cat = 0; |
318 | if ( m_curCat != QWidget::tr("All Categories") ) | 316 | if ( m_curCat != QWidget::tr("All Categories") ) |
319 | cat = currentCatId(); | 317 | cat = currentCatId(); |
320 | if ( m_curCat == QWidget::tr("Unfiled") ) | 318 | if ( m_curCat == QWidget::tr("Unfiled") ) |
321 | cat = -1; | 319 | cat = -1; |
322 | 320 | ||
323 | qWarning(" Category %d %s", cat, m_curCat.latin1() ); | 321 | qWarning(" Category %d %s", cat, m_curCat.latin1() ); |
324 | 322 | ||
325 | int filter = 1; | 323 | int filter = 1; |
326 | 324 | ||
327 | if (!m_completed ) | 325 | if (!m_completed ) |
328 | filter |= 4; | 326 | filter |= 4; |
329 | if (m_overdue) | 327 | if (m_overdue) |
330 | filter |= 2; | 328 | filter |= 2; |
331 | 329 | ||
332 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); | 330 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); |
333 | } | 331 | } |
334 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { | 332 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { |
335 | int cat = 0; | 333 | int cat = 0; |
336 | if ( m_curCat != QWidget::tr("All Categories") ) | 334 | if ( m_curCat != QWidget::tr("All Categories") ) |
337 | cat = currentCatId(); | 335 | cat = currentCatId(); |
338 | 336 | ||
339 | if ( m_curCat == QWidget::tr("Unfiled") ) | 337 | if ( m_curCat == QWidget::tr("Unfiled") ) |
340 | cat = -1; | 338 | cat = -1; |
341 | 339 | ||
342 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); | 340 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); |
343 | } | 341 | } |
344 | OTodo MainWindow::event( int uid ) { | 342 | OPimTodo MainWindow::event( int uid ) { |
345 | return m_todoMgr.event( uid ); | 343 | return m_todoMgr.event( uid ); |
346 | } | 344 | } |
347 | bool MainWindow::isSyncing()const { | 345 | bool MainWindow::isSyncing()const { |
348 | return m_syncing; | 346 | return m_syncing; |
349 | } | 347 | } |
350 | TemplateManager* MainWindow::templateManager() { | 348 | TemplateManager* MainWindow::templateManager() { |
351 | return m_tempManager; | 349 | return m_tempManager; |
352 | } | 350 | } |
353 | Editor* MainWindow::currentEditor() { | 351 | Editor* MainWindow::currentEditor() { |
354 | return m_curEdit; | 352 | return m_curEdit; |
355 | } | 353 | } |
356 | TodoShow* MainWindow::currentShow() { | 354 | TodoShow* MainWindow::currentShow() { |
357 | return m_curShow; | 355 | return m_curShow; |
358 | } | 356 | } |
359 | void MainWindow::slotReload() { | 357 | void MainWindow::slotReload() { |
360 | m_syncing = FALSE; | 358 | m_syncing = FALSE; |
361 | m_todoMgr.reload(); | 359 | m_todoMgr.reload(); |
362 | currentView()->updateView( ); | 360 | currentView()->updateView( ); |
363 | raiseCurrentView(); | 361 | raiseCurrentView(); |
364 | } | 362 | } |
365 | void MainWindow::closeEvent( QCloseEvent* e ) { | 363 | void MainWindow::closeEvent( QCloseEvent* e ) { |
366 | if (m_stack->visibleWidget() == currentShow()->widget() ) { | 364 | if (m_stack->visibleWidget() == currentShow()->widget() ) { |
367 | m_showing = false; | 365 | m_showing = false; |
368 | raiseCurrentView(); | 366 | raiseCurrentView(); |
369 | e->ignore(); | 367 | e->ignore(); |
370 | return; | 368 | return; |
371 | } | 369 | } |
372 | /* | 370 | /* |
373 | * we should have flushed and now we're still saving | 371 | * we should have flushed and now we're still saving |
374 | * so there is no need to flush | 372 | * so there is no need to flush |
375 | */ | 373 | */ |
376 | if (m_syncing ) { | 374 | if (m_syncing ) { |
377 | e->accept(); | 375 | e->accept(); |
378 | return; | 376 | return; |
379 | } | 377 | } |
380 | bool quit = false; | 378 | bool quit = false; |
381 | if ( m_todoMgr.saveAll() ){ | 379 | if ( m_todoMgr.saveAll() ){ |
382 | qWarning("saved"); | 380 | qWarning("saved"); |
383 | quit = true; | 381 | quit = true; |
384 | }else { | 382 | }else { |
385 | if ( QMessageBox::critical( this, QWidget::tr("Out of space"), | 383 | if ( QMessageBox::critical( this, QWidget::tr("Out of space"), |
386 | QWidget::tr("Todo was unable\n" | 384 | QWidget::tr("Todo was unable\n" |
387 | "to save your changes.\n" | 385 | "to save your changes.\n" |
388 | "Free up some space\n" | 386 | "Free up some space\n" |
389 | "and try again.\n" | 387 | "and try again.\n" |
390 | "\nQuit Anyway?"), | 388 | "\nQuit Anyway?"), |
391 | QMessageBox::Yes|QMessageBox::Escape, | 389 | QMessageBox::Yes|QMessageBox::Escape, |
392 | QMessageBox::No|QMessageBox::Default) | 390 | QMessageBox::No|QMessageBox::Default) |
393 | != QMessageBox::No ) { | 391 | != QMessageBox::No ) { |
394 | e->accept(); | 392 | e->accept(); |
395 | quit = true; | 393 | quit = true; |
396 | }else | 394 | }else |
397 | e->ignore(); | 395 | e->ignore(); |
398 | 396 | ||
399 | } | 397 | } |
400 | 398 | ||
401 | if (quit ) { | 399 | if (quit ) { |
402 | Config config( "todo" ); | 400 | Config config( "todo" ); |
403 | config.setGroup( "View" ); | 401 | config.setGroup( "View" ); |
404 | config.writeEntry( "ShowComplete", showCompleted() ); | 402 | config.writeEntry( "ShowComplete", showCompleted() ); |
405 | config.writeEntry( "Category", currentCategory() ); | 403 | config.writeEntry( "Category", currentCategory() ); |
406 | config.writeEntry( "ShowDeadLine", showDeadline()); | 404 | config.writeEntry( "ShowDeadLine", showDeadline()); |
407 | config.writeEntry( "ShowOverDue", showOverDue() ); | 405 | config.writeEntry( "ShowOverDue", showOverDue() ); |
408 | config.writeEntry( "ShowQuickTask", showQuickTask() ); | 406 | config.writeEntry( "ShowQuickTask", showQuickTask() ); |
409 | /* save templates */ | 407 | /* save templates */ |
410 | templateManager()->save(); | 408 | templateManager()->save(); |
411 | e->accept(); | 409 | e->accept(); |
412 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows()) ); | 410 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows()) ); |
413 | } | 411 | } |
414 | } | 412 | } |
415 | void MainWindow::populateTemplates() { | 413 | void MainWindow::populateTemplates() { |
416 | m_template->clear(); | 414 | m_template->clear(); |
417 | QStringList list = templateManager()->templates(); | 415 | QStringList list = templateManager()->templates(); |
418 | QStringList::Iterator it; | 416 | QStringList::Iterator it; |
419 | for ( it = list.begin(); it != list.end(); ++it ) { | 417 | for ( it = list.begin(); it != list.end(); ++it ) { |
420 | m_template->insertItem( (*it) ); | 418 | m_template->insertItem( (*it) ); |
421 | } | 419 | } |
422 | } | 420 | } |
423 | /* | 421 | /* |
424 | * slotNewFromTemplate | 422 | * slotNewFromTemplate |
425 | * We use the edit widget to do | 423 | * We use the edit widget to do |
426 | * the config but we setUid(1) | 424 | * the config but we setUid(1) |
427 | * to get a new uid | 425 | * to get a new uid |
428 | */ | 426 | */ |
429 | /* | 427 | /* |
430 | * first we get the name of the template | 428 | * first we get the name of the template |
431 | * then we will use the TemplateManager | 429 | * then we will use the TemplateManager |
432 | */ | 430 | */ |
433 | void MainWindow::slotNewFromTemplate( int id ) { | 431 | void MainWindow::slotNewFromTemplate( int id ) { |
434 | QString name = m_template->text( id ); | 432 | QString name = m_template->text( id ); |
435 | 433 | ||
436 | OTodo event = templateManager()->templateEvent( name ); | 434 | OPimTodo event = templateManager()->templateEvent( name ); |
437 | event = currentEditor()->edit(this, | 435 | event = currentEditor()->edit(this, |
438 | event ); | 436 | event ); |
439 | 437 | ||
440 | if ( currentEditor()->accepted() ) { | 438 | if ( currentEditor()->accepted() ) { |
441 | /* assign new todo */ | 439 | /* assign new todo */ |
442 | event.setUid( 1 ); | 440 | event.setUid( 1 ); |
443 | handleAlarms( OTodo(), event ); | 441 | handleAlarms( OPimTodo(), event ); |
444 | m_todoMgr.add( event ); | 442 | m_todoMgr.add( event ); |
445 | currentView()->addEvent( event ); | 443 | currentView()->addEvent( event ); |
446 | 444 | ||
447 | populateCategories(); | 445 | populateCategories(); |
448 | } | 446 | } |
449 | raiseCurrentView(); | 447 | raiseCurrentView(); |
450 | } | 448 | } |
451 | void MainWindow::slotNew() { | 449 | void MainWindow::slotNew() { |
452 | create(); | 450 | create(); |
453 | } | 451 | } |
454 | void MainWindow::slotDuplicate() { | 452 | void MainWindow::slotDuplicate() { |
455 | if(m_syncing) { | 453 | if(m_syncing) { |
456 | QMessageBox::warning(this, QWidget::tr("Todo"), | 454 | QMessageBox::warning(this, QWidget::tr("Todo"), |
457 | QWidget::tr("Data can not be edited, currently syncing")); | 455 | QWidget::tr("Data can not be edited, currently syncing")); |
458 | return; | 456 | return; |
459 | } | 457 | } |
460 | OTodo ev = m_todoMgr.event( currentView()->current() ); | 458 | OPimTodo ev = m_todoMgr.event( currentView()->current() ); |
461 | /* let's generate a new uid */ | 459 | /* let's generate a new uid */ |
462 | ev.setUid(1); | 460 | ev.setUid(1); |
463 | m_todoMgr.add( ev ); | 461 | m_todoMgr.add( ev ); |
464 | 462 | ||
465 | currentView()->addEvent( ev ); | 463 | currentView()->addEvent( ev ); |
466 | raiseCurrentView(); | 464 | raiseCurrentView(); |
467 | } | 465 | } |
468 | void MainWindow::slotDelete() { | 466 | void MainWindow::slotDelete() { |
469 | if (!currentView()->current() ) | 467 | if (!currentView()->current() ) |
470 | return; | 468 | return; |
471 | 469 | ||
472 | if(m_syncing) { | 470 | if(m_syncing) { |
473 | QMessageBox::warning(this, QWidget::tr("Todo"), | 471 | QMessageBox::warning(this, QWidget::tr("Todo"), |
474 | QWidget::tr("Data can not be edited, currently syncing")); | 472 | QWidget::tr("Data can not be edited, currently syncing")); |
475 | return; | 473 | return; |
476 | } | 474 | } |
477 | QString strName = currentView()->currentRepresentation(); | 475 | QString strName = currentView()->currentRepresentation(); |
478 | if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), strName ) ) | 476 | if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), strName ) ) |
479 | return; | 477 | return; |
480 | 478 | ||
481 | handleAlarms( m_todoMgr.event( currentView()->current() ), OTodo() ); | 479 | handleAlarms( m_todoMgr.event( currentView()->current() ), OPimTodo() ); |
482 | m_todoMgr.remove( currentView()->current() ); | 480 | m_todoMgr.remove( currentView()->current() ); |
483 | currentView()->removeEvent( currentView()->current() ); | 481 | currentView()->removeEvent( currentView()->current() ); |
484 | raiseCurrentView(); | 482 | raiseCurrentView(); |
485 | } | 483 | } |
486 | void MainWindow::slotDelete(int uid ) { | 484 | void MainWindow::slotDelete(int uid ) { |
487 | if( uid == 0 ) return; | 485 | if( uid == 0 ) return; |
488 | if(m_syncing) { | 486 | if(m_syncing) { |
489 | QMessageBox::warning(this, QWidget::tr("Todo"), | 487 | QMessageBox::warning(this, QWidget::tr("Todo"), |
490 | QWidget::tr("Data can not be edited, currently syncing")); | 488 | QWidget::tr("Data can not be edited, currently syncing")); |
491 | return; | 489 | return; |
492 | } | 490 | } |
493 | OTodo to = m_todoMgr.event(uid); | 491 | OPimTodo to = m_todoMgr.event(uid); |
494 | if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), to.toShortText() ) ) | 492 | if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), to.toShortText() ) ) |
495 | return; | 493 | return; |
496 | 494 | ||
497 | handleAlarms(to, OTodo() ); | 495 | handleAlarms(to, OPimTodo() ); |
498 | m_todoMgr.remove( to.uid() ); | 496 | m_todoMgr.remove( to.uid() ); |
499 | currentView()->removeEvent( to.uid() ); | 497 | currentView()->removeEvent( to.uid() ); |
500 | raiseCurrentView(); | 498 | raiseCurrentView(); |
501 | } | 499 | } |
502 | void MainWindow::slotDeleteAll() { | 500 | void MainWindow::slotDeleteAll() { |
503 | if(m_syncing) { | 501 | if(m_syncing) { |
504 | QMessageBox::warning(this, QWidget::tr("Todo"), | 502 | QMessageBox::warning(this, QWidget::tr("Todo"), |
505 | QWidget::tr("Data can not be edited, currently syncing")); | 503 | QWidget::tr("Data can not be edited, currently syncing")); |
506 | return; | 504 | return; |
507 | } | 505 | } |
508 | 506 | ||
509 | 507 | ||
510 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) ) | 508 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) ) |
511 | return; | 509 | return; |
512 | 510 | ||
513 | m_todoMgr.removeAll(); | 511 | m_todoMgr.removeAll(); |
514 | currentView()->clear(); | 512 | currentView()->clear(); |
515 | 513 | ||
516 | raiseCurrentView(); | 514 | raiseCurrentView(); |
517 | } | 515 | } |
518 | void MainWindow::slotDeleteCompleted() { | 516 | void MainWindow::slotDeleteCompleted() { |
519 | if(m_syncing) { | 517 | if(m_syncing) { |
520 | QMessageBox::warning(this, QWidget::tr("Todo"), | 518 | QMessageBox::warning(this, QWidget::tr("Todo"), |
521 | QWidget::tr("Data can not be edited, currently syncing")); | 519 | QWidget::tr("Data can not be edited, currently syncing")); |
522 | return; | 520 | return; |
523 | } | 521 | } |
524 | 522 | ||
525 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) ) | 523 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) ) |
526 | return; | 524 | return; |
527 | 525 | ||
528 | 526 | ||
529 | m_todoMgr.removeCompleted(); | 527 | m_todoMgr.removeCompleted(); |
530 | currentView()->updateView( ); | 528 | currentView()->updateView( ); |
531 | } | 529 | } |
532 | void MainWindow::slotFind() { | 530 | void MainWindow::slotFind() { |
533 | 531 | ||
534 | } | 532 | } |
535 | void MainWindow::slotEdit() { | 533 | void MainWindow::slotEdit() { |
536 | slotEdit( currentView()->current() ); | 534 | slotEdit( currentView()->current() ); |
537 | } | 535 | } |
538 | /* | 536 | /* |
539 | * set the category | 537 | * set the category |
540 | */ | 538 | */ |
541 | void MainWindow::setCategory( int c) { | 539 | void MainWindow::setCategory( int c) { |
542 | if ( c <= 0 ) return; | 540 | if ( c <= 0 ) return; |
543 | 541 | ||
544 | 542 | ||
545 | qWarning("Iterating over cats %d", c ); | 543 | qWarning("Iterating over cats %d", c ); |
546 | for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) | 544 | for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) |
547 | m_catMenu->setItemChecked(i, c == (int)i ); | 545 | m_catMenu->setItemChecked(i, c == (int)i ); |
548 | 546 | ||
549 | if (c == 1 ) { | 547 | if (c == 1 ) { |
550 | m_curCat = QString::null; | 548 | m_curCat = QString::null; |
551 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); | 549 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); |
552 | 550 | ||
553 | }else if ( c == (int)m_catMenu->count() - 1 ) { | 551 | }else if ( c == (int)m_catMenu->count() - 1 ) { |
554 | m_curCat = QWidget::tr("Unfiled"); | 552 | m_curCat = QWidget::tr("Unfiled"); |
555 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); | 553 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); |
556 | }else { | 554 | }else { |
557 | m_curCat = m_todoMgr.categories()[c-2]; | 555 | m_curCat = m_todoMgr.categories()[c-2]; |
558 | setCaption( QWidget::tr("Todo") + " - " + m_curCat ); | 556 | setCaption( QWidget::tr("Todo") + " - " + m_curCat ); |
559 | } | 557 | } |
560 | m_catMenu->setItemChecked( c, true ); | 558 | m_catMenu->setItemChecked( c, true ); |
561 | 559 | ||
562 | currentView()->setShowCategory( m_curCat ); | 560 | currentView()->setShowCategory( m_curCat ); |
563 | raiseCurrentView(); | 561 | raiseCurrentView(); |
564 | } | 562 | } |
565 | void MainWindow::slotShowDeadLine( bool dead) { | 563 | void MainWindow::slotShowDeadLine( bool dead) { |
566 | m_deadline = dead; | 564 | m_deadline = dead; |
567 | currentView()->setShowDeadline( dead ); | 565 | currentView()->setShowDeadline( dead ); |
568 | } | 566 | } |
569 | void MainWindow::slotShowCompleted( bool show) { | 567 | void MainWindow::slotShowCompleted( bool show) { |
570 | m_completed = show; | 568 | m_completed = show; |
571 | currentView()->setShowCompleted( m_completed ); | 569 | currentView()->setShowCompleted( m_completed ); |
572 | } | 570 | } |
573 | void MainWindow::slotShowQuickTask( bool show ) { | 571 | void MainWindow::slotShowQuickTask( bool show ) { |
574 | m_quicktask = show; | 572 | m_quicktask = show; |
575 | if ( m_quicktask ) | 573 | if ( m_quicktask ) |
576 | m_curQuick->widget()->show(); | 574 | m_curQuick->widget()->show(); |
577 | else | 575 | else |
578 | m_curQuick->widget()->hide(); | 576 | m_curQuick->widget()->hide(); |
579 | } | 577 | } |
580 | bool MainWindow::showOverDue()const { | 578 | bool MainWindow::showOverDue()const { |
581 | return m_overdue; | 579 | return m_overdue; |
582 | } | 580 | } |
583 | void MainWindow::setDocument( const QString& fi) { | 581 | void MainWindow::setDocument( const QString& fi) { |
584 | DocLnk doc(fi); | 582 | DocLnk doc(fi); |
585 | if (doc.isValid() ) | 583 | if (doc.isValid() ) |
586 | receiveFile(doc.file() ); | 584 | receiveFile(doc.file() ); |
587 | else | 585 | else |
588 | receiveFile(fi ); | 586 | receiveFile(fi ); |
589 | } | 587 | } |
590 | 588 | ||
591 | static const char *beamfile = "/tmp/opie-todo.vcs"; | 589 | static const char *beamfile = "/tmp/opie-todo.vcs"; |
592 | void MainWindow::slotBeam() { | 590 | void MainWindow::slotBeam() { |
593 | beam( currentView()->current() ); | 591 | beam( currentView()->current() ); |
594 | } | 592 | } |
595 | void MainWindow::beamDone( Ir* ir) { | 593 | void MainWindow::beamDone( Ir* ir) { |
596 | delete ir; | 594 | delete ir; |
597 | ::unlink( beamfile ); | 595 | ::unlink( beamfile ); |
598 | } | 596 | } |
599 | void MainWindow::receiveFile( const QString& filename ) { | 597 | void MainWindow::receiveFile( const QString& filename ) { |
600 | OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); | 598 | OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(filename ); |
601 | 599 | ||
602 | OTodoAccess acc( cal ); | 600 | OPimTodoAccess acc( cal ); |
603 | acc.load(); | 601 | acc.load(); |
604 | OTodoAccess::List list = acc.allRecords(); | 602 | OPimTodoAccess::List list = acc.allRecords(); |
605 | 603 | ||
606 | if (list.count()){ | 604 | if (list.count()){ |
607 | 605 | ||
608 | QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); | 606 | QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); |
609 | 607 | ||
610 | if ( QMessageBox::information(this, QWidget::tr("New Tasks"), | 608 | if ( QMessageBox::information(this, QWidget::tr("New Tasks"), |
611 | message, QMessageBox::Ok, | 609 | message, QMessageBox::Ok, |
612 | QMessageBox::Cancel ) == QMessageBox::Ok ) { | 610 | QMessageBox::Cancel ) == QMessageBox::Ok ) { |
613 | OTodoAccess::List::Iterator it; | 611 | OPimTodoAccess::List::Iterator it; |
614 | for ( it = list.begin(); it != list.end(); ++it ) | 612 | for ( it = list.begin(); it != list.end(); ++it ) |
615 | m_todoMgr.add( (*it) ); | 613 | m_todoMgr.add( (*it) ); |
616 | 614 | ||
617 | currentView()->updateView(); | 615 | currentView()->updateView(); |
618 | } | 616 | } |
619 | } | 617 | } |
620 | } | 618 | } |
621 | 619 | ||
622 | void MainWindow::slotFlush() { | 620 | void MainWindow::slotFlush() { |
623 | m_syncing = TRUE; | 621 | m_syncing = TRUE; |
624 | m_todoMgr.save(); | 622 | m_todoMgr.save(); |
625 | } | 623 | } |
626 | void MainWindow::slotShowDetails() { | 624 | void MainWindow::slotShowDetails() { |
627 | slotShow( currentView()->current() ); | 625 | slotShow( currentView()->current() ); |
628 | } | 626 | } |
629 | /* | 627 | /* |
630 | * populate the Categories | 628 | * populate the Categories |
631 | * Menu | 629 | * Menu |
632 | */ | 630 | */ |
633 | void MainWindow::populateCategories() { | 631 | void MainWindow::populateCategories() { |
634 | m_todoMgr.load(); | 632 | m_todoMgr.load(); |
635 | 633 | ||
636 | m_catMenu->clear(); | 634 | m_catMenu->clear(); |
637 | int id, rememberId; | 635 | int id, rememberId; |
638 | id = 1; | 636 | id = 1; |
639 | rememberId = 1; | 637 | rememberId = 1; |
640 | 638 | ||
641 | m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); | 639 | m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); |
642 | m_catMenu->insertSeparator(); | 640 | m_catMenu->insertSeparator(); |
643 | QStringList categories = m_todoMgr.categories(); | 641 | QStringList categories = m_todoMgr.categories(); |
644 | categories.append( QWidget::tr( "Unfiled" ) ); | 642 | categories.append( QWidget::tr( "Unfiled" ) ); |
645 | for ( QStringList::Iterator it = categories.begin(); | 643 | for ( QStringList::Iterator it = categories.begin(); |
646 | it != categories.end(); ++it ) { | 644 | it != categories.end(); ++it ) { |
647 | m_catMenu->insertItem( *it, id ); | 645 | m_catMenu->insertItem( *it, id ); |
648 | if ( *it == currentCategory() ) | 646 | if ( *it == currentCategory() ) |
649 | rememberId = id; | 647 | rememberId = id; |
650 | ++id; | 648 | ++id; |
651 | } | 649 | } |
652 | setCategory( rememberId ); | 650 | setCategory( rememberId ); |
653 | } | 651 | } |
654 | bool MainWindow::showCompleted()const { | 652 | bool MainWindow::showCompleted()const { |
655 | return m_completed; | 653 | return m_completed; |
656 | } | 654 | } |
657 | bool MainWindow::showDeadline()const { | 655 | bool MainWindow::showDeadline()const { |
658 | return m_deadline; | 656 | return m_deadline; |
659 | } | 657 | } |
660 | bool MainWindow::showQuickTask()const { | 658 | bool MainWindow::showQuickTask()const { |
661 | return m_quicktask; | 659 | return m_quicktask; |
662 | } | 660 | } |
663 | QString MainWindow::currentCategory()const { | 661 | QString MainWindow::currentCategory()const { |
664 | return m_curCat; | 662 | return m_curCat; |
665 | } | 663 | } |
666 | int MainWindow::currentCatId() { | 664 | int MainWindow::currentCatId() { |
667 | return m_todoMgr.catId( m_curCat ); | 665 | return m_todoMgr.catId( m_curCat ); |
668 | } | 666 | } |
669 | ViewBase* MainWindow::currentView() { | 667 | ViewBase* MainWindow::currentView() { |
670 | return m_curView; | 668 | return m_curView; |
671 | } | 669 | } |
672 | void MainWindow::raiseCurrentView() { | 670 | void MainWindow::raiseCurrentView() { |
673 | // due QPE/Application/todolist show(int) | 671 | // due QPE/Application/todolist show(int) |
674 | // we might not have the populateCategories slot called once | 672 | // we might not have the populateCategories slot called once |
675 | // we would show the otodo but then imediately switch to the currentView | 673 | // we would show the otodo but then imediately switch to the currentView |
676 | // if we're initially showing we shouldn't raise the table | 674 | // if we're initially showing we shouldn't raise the table |
677 | // in returnFromView we fix up m_showing | 675 | // in returnFromView we fix up m_showing |
678 | if (m_showing ) return; | 676 | if (m_showing ) return; |
679 | 677 | ||
680 | m_stack->raiseWidget( m_curView->widget() ); | 678 | m_stack->raiseWidget( m_curView->widget() ); |
681 | } | 679 | } |
682 | void MainWindow::slotShowDue(bool ov) { | 680 | void MainWindow::slotShowDue(bool ov) { |
683 | m_overdue = ov; | 681 | m_overdue = ov; |
684 | currentView()->showOverDue( ov ); | 682 | currentView()->showOverDue( ov ); |
685 | raiseCurrentView(); | 683 | raiseCurrentView(); |
686 | } | 684 | } |
687 | void MainWindow::slotShow( int uid ) { | 685 | void MainWindow::slotShow( int uid ) { |
688 | if ( uid == 0 ) return; | 686 | if ( uid == 0 ) return; |
689 | qWarning("slotShow"); | 687 | qWarning("slotShow"); |
690 | currentShow()->slotShow( event( uid ) ); | 688 | currentShow()->slotShow( event( uid ) ); |
691 | m_stack->raiseWidget( currentShow()->widget() ); | 689 | m_stack->raiseWidget( currentShow()->widget() ); |
692 | } | 690 | } |
693 | void MainWindow::slotShowNext() { | 691 | void MainWindow::slotShowNext() { |
694 | int l = currentView()->next(); | 692 | int l = currentView()->next(); |
695 | if (l!=0) | 693 | if (l!=0) |
696 | slotShow(l); | 694 | slotShow(l); |
697 | } | 695 | } |
698 | void MainWindow::slotShowPrev() { | 696 | void MainWindow::slotShowPrev() { |
699 | int l = currentView()->prev(); | 697 | int l = currentView()->prev(); |
700 | if (l!=0) | 698 | if (l!=0) |
701 | slotShow(l); | 699 | slotShow(l); |
702 | } | 700 | } |
703 | void MainWindow::slotEdit( int uid ) { | 701 | void MainWindow::slotEdit( int uid ) { |
704 | if (uid == 0 ) return; | 702 | if (uid == 0 ) return; |
705 | if(m_syncing) { | 703 | if(m_syncing) { |
706 | QMessageBox::warning(this, QWidget::tr("Todo"), | 704 | QMessageBox::warning(this, QWidget::tr("Todo"), |
707 | QWidget::tr("Data can't be edited, currently syncing")); | 705 | QWidget::tr("Data can't be edited, currently syncing")); |
708 | return; | 706 | return; |
709 | } | 707 | } |
710 | 708 | ||
711 | OTodo old_todo = m_todoMgr.event( uid ); | 709 | OPimTodo old_todo = m_todoMgr.event( uid ); |
712 | 710 | ||
713 | OTodo todo = currentEditor()->edit(this, old_todo ); | 711 | OPimTodo todo = currentEditor()->edit(this, old_todo ); |
714 | 712 | ||
715 | /* if completed */ | 713 | /* if completed */ |
716 | if ( currentEditor()->accepted() ) { | 714 | if ( currentEditor()->accepted() ) { |
717 | handleAlarms( old_todo, todo ); | 715 | handleAlarms( old_todo, todo ); |
718 | m_todoMgr.update( todo.uid(), todo ); | 716 | m_todoMgr.update( todo.uid(), todo ); |
719 | currentView()->replaceEvent( todo ); | 717 | currentView()->replaceEvent( todo ); |
720 | /* a Category might have changed */ | 718 | /* a Category might have changed */ |
721 | populateCategories(); | 719 | populateCategories(); |
722 | } | 720 | } |
723 | 721 | ||
724 | raiseCurrentView(); | 722 | raiseCurrentView(); |
725 | } | 723 | } |
726 | /* | 724 | /* |
727 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { | 725 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { |
728 | m_todoMgr.update( uid, ev ); | 726 | m_todoMgr.update( uid, ev ); |
729 | } | 727 | } |
730 | */ | 728 | */ |
731 | void MainWindow::updateTodo( const OTodo& ev) { | 729 | void MainWindow::updateTodo( const OPimTodo& ev) { |
732 | m_todoMgr.update( ev.uid() , ev ); | 730 | m_todoMgr.update( ev.uid() , ev ); |
733 | } | 731 | } |
734 | /* The view changed it's configuration | 732 | /* The view changed it's configuration |
735 | * update the view menu | 733 | * update the view menu |
736 | */ | 734 | */ |
737 | void MainWindow::slotUpdate3( QWidget* ) { | 735 | void MainWindow::slotUpdate3( QWidget* ) { |
738 | 736 | ||
739 | } | 737 | } |
740 | void MainWindow::updateList() { | 738 | void MainWindow::updateList() { |
741 | m_todoMgr.updateList(); | 739 | m_todoMgr.updateList(); |
742 | } | 740 | } |
743 | void MainWindow::setReadAhead( uint count ) { | 741 | void MainWindow::setReadAhead( uint count ) { |
744 | if (m_todoMgr.todoDB() ) | 742 | if (m_todoMgr.todoDB() ) |
745 | m_todoMgr.todoDB()->setReadAhead( count ); | 743 | m_todoMgr.todoDB()->setReadAhead( count ); |
746 | } | 744 | } |
747 | void MainWindow::slotQuickEntered() { | 745 | void MainWindow::slotQuickEntered() { |
748 | qWarning("entered"); | 746 | qWarning("entered"); |
749 | OTodo todo = quickEditor()->todo(); | 747 | OPimTodo todo = quickEditor()->todo(); |
750 | if (todo.isEmpty() ) | 748 | if (todo.isEmpty() ) |
751 | return; | 749 | return; |
752 | 750 | ||
753 | m_todoMgr.add( todo ); | 751 | m_todoMgr.add( todo ); |
754 | currentView()->addEvent( todo ); | 752 | currentView()->addEvent( todo ); |
755 | raiseCurrentView(); | 753 | raiseCurrentView(); |
756 | } | 754 | } |
757 | QuickEditBase* MainWindow::quickEditor() { | 755 | QuickEditBase* MainWindow::quickEditor() { |
758 | return m_curQuick; | 756 | return m_curQuick; |
759 | } | 757 | } |
760 | void MainWindow::slotComplete( int uid ) { | 758 | void MainWindow::slotComplete( int uid ) { |
761 | slotComplete( event(uid) ); | 759 | slotComplete( event(uid) ); |
762 | } | 760 | } |
763 | void MainWindow::slotComplete( const OTodo& todo ) { | 761 | void MainWindow::slotComplete( const OPimTodo& todo ) { |
764 | OTodo to = todo; | 762 | OPimTodo to = todo; |
765 | to.setCompleted( !to.isCompleted() ); | 763 | to.setCompleted( !to.isCompleted() ); |
766 | to.setCompletedDate( QDate::currentDate() ); | 764 | to.setCompletedDate( QDate::currentDate() ); |
767 | 765 | ||
768 | /* | 766 | /* |
769 | * if the item does recur | 767 | * if the item does recur |
770 | * we need to spin it off | 768 | * we need to spin it off |
771 | * and update the items duedate to the next | 769 | * and update the items duedate to the next |
772 | * possible recurrance of this item... | 770 | * possible recurrance of this item... |
773 | * the spinned off one will loose the | 771 | * the spinned off one will loose the |
774 | * recurrence. | 772 | * recurrence. |
775 | * We calculate the difference between the old due date and the | 773 | * We calculate the difference between the old due date and the |
776 | * new one and add this diff to start, completed and alarm dates | 774 | * new one and add this diff to start, completed and alarm dates |
777 | * -zecke | 775 | * -zecke |
778 | */ | 776 | */ |
779 | if ( to.hasRecurrence() && to.isCompleted() ) { | 777 | if ( to.hasRecurrence() && to.isCompleted() ) { |
780 | OTodo to2( to ); | 778 | OPimTodo to2( to ); |
781 | 779 | ||
782 | /* the spinned off one won't recur anymore */ | 780 | /* the spinned off one won't recur anymore */ |
783 | to.setRecurrence( ORecur() ); | 781 | to.setRecurrence( OPimRecurrence() ); |
784 | 782 | ||
785 | ORecur rec = to2.recurrence(); | 783 | OPimRecurrence rec = to2.recurrence(); |
786 | rec.setStart( to.dueDate() ); | 784 | rec.setStart( to.dueDate() ); |
787 | to2.setRecurrence( rec ); | 785 | to2.setRecurrence( rec ); |
788 | /* | 786 | /* |
789 | * if there is a next occurence | 787 | * if there is a next occurence |
790 | * from the duedate of the last recurrance | 788 | * from the duedate of the last recurrance |
791 | */ | 789 | */ |
792 | QDate date; | 790 | QDate date; |
793 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { | 791 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { |
794 | int dayDiff = to.dueDate().daysTo( date ); | 792 | int dayDiff = to.dueDate().daysTo( date ); |
795 | qWarning("day diff is %d", dayDiff ); | 793 | qWarning("day diff is %d", dayDiff ); |
796 | QDate inval; | 794 | QDate inval; |
797 | /* generate a new uid for the old record */ | 795 | /* generate a new uid for the old record */ |
798 | to.setUid( 1 ); | 796 | to.setUid( 1 ); |
799 | 797 | ||
800 | /* add the old one cause it has a new UID here cause it was spin off */ | 798 | /* add the old one cause it has a new UID here cause it was spin off */ |
801 | m_todoMgr.add( to ); | 799 | m_todoMgr.add( to ); |
802 | 800 | ||
803 | /* | 801 | /* |
804 | * update the due date | 802 | * update the due date |
805 | * start date | 803 | * start date |
806 | * and complete date | 804 | * and complete date |
807 | */ | 805 | */ |
808 | to2.setDueDate( date ); | 806 | to2.setDueDate( date ); |
809 | rec.setStart( date ); | 807 | rec.setStart( date ); |
810 | to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week | 808 | to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week |
811 | 809 | ||
812 | /* move start date */ | 810 | /* move start date */ |
813 | if (to2.hasStartDate() ) | 811 | if (to2.hasStartDate() ) |
814 | to2.setStartDate( to2.startDate().addDays( dayDiff ) ); | 812 | to2.setStartDate( to2.startDate().addDays( dayDiff ) ); |
815 | 813 | ||
816 | /* now the alarms */ | 814 | /* now the alarms */ |
817 | if (to2.hasNotifiers() ) { | 815 | if (to2.hasNotifiers() ) { |
818 | OPimNotifyManager::Alarms _als = to2.notifiers().alarms(); | 816 | OPimNotifyManager::Alarms _als = to2.notifiers().alarms(); |
819 | OPimNotifyManager::Alarms als; | 817 | OPimNotifyManager::Alarms als; |
820 | 818 | ||
821 | /* for every alarm move the day */ | 819 | /* for every alarm move the day */ |
822 | for ( OPimNotifyManager::Alarms::Iterator it = _als.begin(); it != _als.end(); ++it ) { | 820 | for ( OPimNotifyManager::Alarms::Iterator it = _als.begin(); it != _als.end(); ++it ) { |
823 | OPimAlarm al = (*it); | 821 | OPimAlarm al = (*it); |
824 | al.setDateTime( al.dateTime().addDays( dayDiff ) ); | 822 | al.setDateTime( al.dateTime().addDays( dayDiff ) ); |
825 | als.append( al ); | 823 | als.append( al ); |
826 | } | 824 | } |
827 | to2.notifiers().setAlarms( als ); | 825 | to2.notifiers().setAlarms( als ); |
828 | handleAlarms( OTodo(), todo ); | 826 | handleAlarms( OPimTodo(), todo ); |
829 | } | 827 | } |
830 | to2.setCompletedDate( inval ); | 828 | to2.setCompletedDate( inval ); |
831 | to2.setCompleted( false ); | 829 | to2.setCompleted( false ); |
832 | 830 | ||
833 | updateTodo( to2 ); | 831 | updateTodo( to2 ); |
834 | }else | 832 | }else |
835 | updateTodo( to ); | 833 | updateTodo( to ); |
836 | }else | 834 | }else |
837 | updateTodo( to ); | 835 | updateTodo( to ); |
838 | 836 | ||
839 | currentView()->updateView(); | 837 | currentView()->updateView(); |
840 | raiseCurrentView(); | 838 | raiseCurrentView(); |
841 | } | 839 | } |
842 | void MainWindow::flush() { | 840 | void MainWindow::flush() { |
843 | slotFlush(); | 841 | slotFlush(); |
844 | } | 842 | } |
845 | void MainWindow::reload() { | 843 | void MainWindow::reload() { |
846 | slotReload(); | 844 | slotReload(); |
847 | } | 845 | } |
848 | int MainWindow::create() { | 846 | int MainWindow::create() { |
849 | int uid = 0; | 847 | int uid = 0; |
850 | if(m_syncing) { | 848 | if(m_syncing) { |
851 | QMessageBox::warning(this, QWidget::tr("Todo"), | 849 | QMessageBox::warning(this, QWidget::tr("Todo"), |
852 | QWidget::tr("Data can not be edited, currently syncing")); | 850 | QWidget::tr("Data can not be edited, currently syncing")); |
853 | return uid; | 851 | return uid; |
854 | } | 852 | } |
855 | m_todoMgr.load(); | 853 | m_todoMgr.load(); |
856 | 854 | ||
857 | 855 | ||
858 | OTodo todo = currentEditor()->newTodo( currentCatId(), | 856 | OPimTodo todo = currentEditor()->newTodo( currentCatId(), |
859 | this ); | 857 | this ); |
860 | 858 | ||
861 | if ( currentEditor()->accepted() ) { | 859 | if ( currentEditor()->accepted() ) { |
862 | //todo.assignUid(); | 860 | //todo.assignUid(); |
863 | uid = todo.uid(); | 861 | uid = todo.uid(); |
864 | handleAlarms( OTodo(), todo ); | 862 | handleAlarms( OPimTodo(), todo ); |
865 | m_todoMgr.add( todo ); | 863 | m_todoMgr.add( todo ); |
866 | currentView()->addEvent( todo ); | 864 | currentView()->addEvent( todo ); |
867 | 865 | ||
868 | 866 | ||
869 | // I'm afraid we must call this every time now, otherwise | 867 | // I'm afraid we must call this every time now, otherwise |
870 | // spend expensive time comparing all these strings... | 868 | // spend expensive time comparing all these strings... |
871 | // but only call if we changed something -zecke | 869 | // but only call if we changed something -zecke |
872 | populateCategories(); | 870 | populateCategories(); |
873 | } | 871 | } |
874 | raiseCurrentView( ); | 872 | raiseCurrentView( ); |
875 | 873 | ||
876 | return uid; | 874 | return uid; |
877 | } | 875 | } |
878 | /* delete it silently... */ | 876 | /* delete it silently... */ |
879 | bool MainWindow::remove( int uid ) { | 877 | bool MainWindow::remove( int uid ) { |
880 | if (m_syncing) return false; | 878 | if (m_syncing) return false; |
881 | 879 | ||
882 | /* argh need to get the whole OEvent... to disable alarms -zecke */ | 880 | /* argh need to get the whole OEvent... to disable alarms -zecke */ |
883 | handleAlarms( OTodo(), m_todoMgr.event( uid ) ); | 881 | handleAlarms( OPimTodo(), m_todoMgr.event( uid ) ); |
884 | 882 | ||
885 | return m_todoMgr.remove( uid ); | 883 | return m_todoMgr.remove( uid ); |
886 | } | 884 | } |
887 | void MainWindow::beam( int uid) { | 885 | void MainWindow::beam( int uid) { |
888 | if( uid == 0 ) return; | 886 | if( uid == 0 ) return; |
889 | 887 | ||
890 | ::unlink( beamfile ); | 888 | ::unlink( beamfile ); |
891 | m_todoMgr.load(); | 889 | m_todoMgr.load(); |
892 | 890 | ||
893 | OTodo todo = event( uid ); | 891 | OPimTodo todo = event( uid ); |
894 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); | 892 | OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(QString::fromLatin1(beamfile) ); |
895 | OTodoAccess acc( cal ); | 893 | OPimTodoAccess acc( cal ); |
896 | acc.load(); | 894 | acc.load(); |
897 | acc.add( todo ); | 895 | acc.add( todo ); |
898 | acc.save(); | 896 | acc.save(); |
899 | Ir* ir = new Ir(this ); | 897 | Ir* ir = new Ir(this ); |
900 | connect(ir, SIGNAL(done(Ir*) ), | 898 | connect(ir, SIGNAL(done(Ir*) ), |
901 | this, SLOT(beamDone(Ir*) ) ); | 899 | this, SLOT(beamDone(Ir*) ) ); |
902 | ir->send(beamfile, todo.summary(), "text/x-vCalendar" ); | 900 | ir->send(beamfile, todo.summary(), "text/x-vCalendar" ); |
903 | } | 901 | } |
904 | void MainWindow::show( int uid ) { | 902 | void MainWindow::show( int uid ) { |
905 | m_todoMgr.load(); // might not be loaded yet | 903 | m_todoMgr.load(); // might not be loaded yet |
906 | m_showing = true; | 904 | m_showing = true; |
907 | slotShow( uid ); | 905 | slotShow( uid ); |
908 | raise(); | 906 | raise(); |
909 | QPEApplication::setKeepRunning(); | 907 | QPEApplication::setKeepRunning(); |
910 | } | 908 | } |
911 | void MainWindow::edit( int uid ) { | 909 | void MainWindow::edit( int uid ) { |
912 | m_todoMgr.load(); | 910 | m_todoMgr.load(); |
913 | slotEdit( uid ); | 911 | slotEdit( uid ); |
914 | } | 912 | } |
915 | void MainWindow::add( const OPimRecord& rec) { | 913 | void MainWindow::add( const OPimRecord& rec) { |
916 | if ( rec.rtti() != OTodo::rtti() ) return; | 914 | if ( rec.rtti() != OPimTodo::rtti() ) return; |
917 | m_todoMgr.load(); // might not be loaded | 915 | m_todoMgr.load(); // might not be loaded |
918 | 916 | ||
919 | const OTodo& todo = static_cast<const OTodo&>(rec); | 917 | const OPimTodo& todo = static_cast<const OPimTodo&>(rec); |
920 | 918 | ||
921 | m_todoMgr.add(todo ); | 919 | m_todoMgr.add(todo ); |
922 | currentView()->addEvent( todo ); | 920 | currentView()->addEvent( todo ); |
923 | 921 | ||
924 | 922 | ||
925 | // I'm afraid we must call this every time now, otherwise | 923 | // I'm afraid we must call this every time now, otherwise |
926 | // spend expensive time comparing all these strings... | 924 | // spend expensive time comparing all these strings... |
927 | // but only call if we changed something -zecke | 925 | // but only call if we changed something -zecke |
928 | populateCategories(); | 926 | populateCategories(); |
929 | } | 927 | } |
930 | void MainWindow::slotReturnFromView() { | 928 | void MainWindow::slotReturnFromView() { |
931 | m_showing = false; | 929 | m_showing = false; |
932 | raiseCurrentView(); | 930 | raiseCurrentView(); |
933 | } | 931 | } |
934 | 932 | ||
935 | namespace { | 933 | namespace { |
936 | OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls, | 934 | OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls, |
937 | const OPimNotifyManager::Alarms& newAls ) { | 935 | const OPimNotifyManager::Alarms& newAls ) { |
938 | OPimNotifyManager::Alarms nonMatching; | 936 | OPimNotifyManager::Alarms nonMatching; |
939 | OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin(); | 937 | OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin(); |
940 | OPimNotifyManager::Alarms::ConstIterator newIt; | 938 | OPimNotifyManager::Alarms::ConstIterator newIt; |
941 | for ( ; oldIt != oldAls.end(); ++oldIt ) { | 939 | for ( ; oldIt != oldAls.end(); ++oldIt ) { |
942 | bool found = false; | 940 | bool found = false; |
943 | QDateTime oldDt = (*oldIt).dateTime(); | 941 | QDateTime oldDt = (*oldIt).dateTime(); |
944 | for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) { | 942 | for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) { |
945 | if ( oldDt == (*newIt).dateTime() ) { | 943 | if ( oldDt == (*newIt).dateTime() ) { |
946 | found = true; | 944 | found = true; |
947 | break; | 945 | break; |
948 | } | 946 | } |
949 | } | 947 | } |
950 | if (!found) | 948 | if (!found) |
951 | nonMatching.append( (*oldIt) ); | 949 | nonMatching.append( (*oldIt) ); |
952 | } | 950 | } |
953 | return nonMatching; | 951 | return nonMatching; |
954 | } | 952 | } |
955 | void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { | 953 | void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { |
956 | OPimNotifyManager::Alarms::ConstIterator it; | 954 | OPimNotifyManager::Alarms::ConstIterator it; |
957 | for ( it = als.begin(); it != als.end(); ++it ) { | 955 | for ( it = als.begin(); it != als.end(); ++it ) { |
958 | qWarning("Adding alarm for %s", (*it).dateTime().toString().latin1() ); | 956 | qWarning("Adding alarm for %s", (*it).dateTime().toString().latin1() ); |
959 | AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); | 957 | AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); |
960 | } | 958 | } |
961 | 959 | ||
962 | } | 960 | } |
963 | void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { | 961 | void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { |
964 | OPimNotifyManager::Alarms::ConstIterator it; | 962 | OPimNotifyManager::Alarms::ConstIterator it; |
965 | for ( it = als.begin(); it != als.end(); ++it ) { | 963 | for ( it = als.begin(); it != als.end(); ++it ) { |
966 | qWarning("Removinf alarm for %s", (*it).dateTime().toString().latin1() ); | 964 | qWarning("Removinf alarm for %s", (*it).dateTime().toString().latin1() ); |
967 | AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); | 965 | AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); |
968 | } | 966 | } |
969 | } | 967 | } |
970 | } | 968 | } |
971 | 969 | ||
972 | void MainWindow::handleAlarms( const OTodo& oldTodo, const OTodo& newTodo) { | 970 | void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) { |
973 | /* | 971 | /* |
974 | * if oldTodo is not empty and has notifiers we need to find the deleted ones | 972 | * if oldTodo is not empty and has notifiers we need to find the deleted ones |
975 | */ | 973 | */ |
976 | if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) { | 974 | if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) { |
977 | OPimNotifyManager::Alarms removed; | 975 | OPimNotifyManager::Alarms removed; |
978 | OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms(); | 976 | OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms(); |
979 | if (!newTodo.hasNotifiers() ) | 977 | if (!newTodo.hasNotifiers() ) |
980 | removed = oldAls; | 978 | removed = oldAls; |
981 | else | 979 | else |
982 | removed = findNonMatching( oldAls, newTodo.notifiers().alarms() ); | 980 | removed = findNonMatching( oldAls, newTodo.notifiers().alarms() ); |
983 | 981 | ||
984 | removeAlarms( removed, oldTodo.uid() ); | 982 | removeAlarms( removed, oldTodo.uid() ); |
985 | } | 983 | } |
986 | if ( newTodo.hasNotifiers() ) { | 984 | if ( newTodo.hasNotifiers() ) { |
987 | OPimNotifyManager::Alarms added; | 985 | OPimNotifyManager::Alarms added; |
988 | if ( oldTodo.isEmpty() || !oldTodo.hasNotifiers() ) | 986 | if ( oldTodo.isEmpty() || !oldTodo.hasNotifiers() ) |
989 | added = newTodo.notifiers().alarms(); | 987 | added = newTodo.notifiers().alarms(); |
990 | else | 988 | else |
991 | added = findNonMatching( newTodo.notifiers().alarms(), oldTodo.notifiers().alarms() ); | 989 | added = findNonMatching( newTodo.notifiers().alarms(), oldTodo.notifiers().alarms() ); |
992 | 990 | ||
993 | addAlarms( added, newTodo.uid() ); | 991 | addAlarms( added, newTodo.uid() ); |
994 | } | 992 | } |
995 | } | 993 | } |
996 | /* we might have not loaded the db */ | 994 | /* we might have not loaded the db */ |
997 | void MainWindow::doAlarm( const QDateTime& dt, int uid ) { | 995 | void MainWindow::doAlarm( const QDateTime& dt, int uid ) { |
998 | m_todoMgr.load(); | 996 | m_todoMgr.load(); |
999 | 997 | ||
1000 | OTodo todo = m_todoMgr.event( uid ); | 998 | OPimTodo todo = m_todoMgr.event( uid ); |
1001 | if (!todo.hasNotifiers() ) return; | 999 | if (!todo.hasNotifiers() ) return; |
1002 | 1000 | ||
1003 | /* | 1001 | /* |
1004 | * let's find the right alarm and find out if silent | 1002 | * let's find the right alarm and find out if silent |
1005 | * then show a richtext widget | 1003 | * then show a richtext widget |
1006 | */ | 1004 | */ |
1007 | bool loud = false; | 1005 | bool loud = false; |
1008 | OPimNotifyManager::Alarms als = todo.notifiers().alarms(); | 1006 | OPimNotifyManager::Alarms als = todo.notifiers().alarms(); |
1009 | OPimNotifyManager::Alarms::Iterator it; | 1007 | OPimNotifyManager::Alarms::Iterator it; |
1010 | for ( it = als.begin(); it != als.end(); ++it ) { | 1008 | for ( it = als.begin(); it != als.end(); ++it ) { |
1011 | if ( (*it).dateTime() == dt ) { | 1009 | if ( (*it).dateTime() == dt ) { |
1012 | loud = ( (*it).sound() == OPimAlarm::Loud ); | 1010 | loud = ( (*it).sound() == OPimAlarm::Loud ); |
1013 | break; | 1011 | break; |
1014 | } | 1012 | } |
1015 | } | 1013 | } |
1016 | if (loud) | 1014 | if (loud) |
1017 | startAlarm(); | 1015 | startAlarm(); |
1018 | 1016 | ||
1019 | QDialog dlg(this, 0, TRUE ); | 1017 | QDialog dlg(this, 0, TRUE ); |
1020 | QVBoxLayout* lay = new QVBoxLayout( &dlg ); | 1018 | QVBoxLayout* lay = new QVBoxLayout( &dlg ); |
1021 | QTextView* view = new QTextView( &dlg ); | 1019 | QTextView* view = new QTextView( &dlg ); |
1022 | lay->addWidget( view ); | 1020 | lay->addWidget( view ); |
1023 | QPushButton* btnOk = new QPushButton( tr("Ok"), &dlg ); | 1021 | QPushButton* btnOk = new QPushButton( tr("Ok"), &dlg ); |
1024 | connect( btnOk, SIGNAL(clicked() ), &dlg, SLOT(accept() ) ); | 1022 | connect( btnOk, SIGNAL(clicked() ), &dlg, SLOT(accept() ) ); |
1025 | lay->addWidget( btnOk ); | 1023 | lay->addWidget( btnOk ); |
1026 | 1024 | ||
1027 | QString text = tr("<h1>Alarm at %1</h1><br>").arg( TimeString::dateString( dt ) ); | 1025 | QString text = tr("<h1>Alarm at %1</h1><br>").arg( TimeString::dateString( dt ) ); |
1028 | text += todo.toRichText(); | 1026 | text += todo.toRichText(); |
1029 | view->setText( text ); | 1027 | view->setText( text ); |
1030 | 1028 | ||
1031 | bool needToStay = QPEApplication::execDialog( &dlg ); | 1029 | bool needToStay = QPEApplication::execDialog( &dlg ); |
1032 | 1030 | ||
1033 | if (loud) | 1031 | if (loud) |
1034 | killAlarm(); | 1032 | killAlarm(); |
1035 | 1033 | ||
1036 | if (needToStay) { | 1034 | if (needToStay) { |
1037 | // showMaximized(); | 1035 | // showMaximized(); |
1038 | // raise(); | 1036 | // raise(); |
1039 | QPEApplication::setKeepRunning(); | 1037 | QPEApplication::setKeepRunning(); |
1040 | // setActiveWindow(); | 1038 | // setActiveWindow(); |
1041 | } | 1039 | } |
1042 | 1040 | ||
1043 | } | 1041 | } |
1044 | 1042 | ||
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index fd0e1bd..6a7296b 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -1,211 +1,213 @@ | |||
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 <opie/otodoaccess.h> | 34 | #include <opie2/otodoaccess.h> |
35 | #include <opie/otodo.h> | 35 | #include <opie2/opimtodo.h> |
36 | #include <opie/opimmainwindow.h> | 36 | #include <opie2/opimmainwindow.h> |
37 | #include <opie2/owidgetstack.h> | ||
37 | 38 | ||
38 | #include "smalltodo.h" | 39 | #include "smalltodo.h" |
39 | #include "todoview.h" | 40 | #include "todoview.h" |
40 | #include "quickedit.h" | 41 | #include "quickedit.h" |
41 | #include "todomanager.h" | 42 | #include "todomanager.h" |
42 | 43 | ||
43 | class QPopupMenu; | 44 | class QPopupMenu; |
44 | class QMenuBar; | 45 | class QMenuBar; |
45 | class QToolBar; | 46 | class QToolBar; |
46 | class QAction; | 47 | class QAction; |
47 | class OWidgetStack; | ||
48 | class Ir; | 48 | class Ir; |
49 | class QVBox; | 49 | class QVBox; |
50 | class QLineEdit; | 50 | class QLineEdit; |
51 | 51 | ||
52 | using namespace Opie; | ||
53 | |||
52 | namespace Todo { | 54 | namespace Todo { |
53 | typedef TodoView View; | 55 | typedef TodoView View; |
54 | class TemplateManager; | 56 | class TemplateManager; |
55 | class Editor; | 57 | class Editor; |
56 | class TodoShow; | 58 | class TodoShow; |
57 | class TemplateEditor; | 59 | class TemplateEditor; |
58 | struct QuickEditBase; | 60 | struct QuickEditBase; |
59 | 61 | ||
60 | class MainWindow : public OPimMainWindow { | 62 | class MainWindow : public OPimMainWindow { |
61 | Q_OBJECT | 63 | Q_OBJECT |
62 | friend class TodoView; // avoid QObject here.... | 64 | friend class TodoView; // avoid QObject here.... |
63 | friend class TodoShow; // avoid QObject | 65 | friend class TodoShow; // avoid QObject |
64 | public: | 66 | public: |
65 | /* OApplicationFactory application Name */ | 67 | /* OApplicationFactory application Name */ |
66 | static QString appName() { return QString::fromLatin1("todolist"); } | 68 | static QString appName() { return QString::fromLatin1("todolist"); } |
67 | 69 | ||
68 | MainWindow( QWidget *parent = 0, | 70 | MainWindow( QWidget *parent = 0, |
69 | const char* name = 0, WFlags fl = 0 ); | 71 | const char* name = 0, WFlags fl = 0 ); |
70 | ~MainWindow(); | 72 | ~MainWindow(); |
71 | 73 | ||
72 | /** return a context menu for an OTodo */ | 74 | /** return a context menu for an OPimTodo */ |
73 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); | 75 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); |
74 | QPopupMenu* options(); | 76 | QPopupMenu* options(); |
75 | QPopupMenu* edit(); | 77 | QPopupMenu* edit(); |
76 | QToolBar* toolbar(); | 78 | QToolBar* toolbar(); |
77 | 79 | ||
78 | 80 | ||
79 | void updateList(); | 81 | void updateList(); |
80 | OTodoAccess::List list()const; | 82 | OPimTodoAccess::List list()const; |
81 | OTodoAccess::List sorted( bool asc, int sortOrder ); | 83 | OPimTodoAccess::List sorted( bool asc, int sortOrder ); |
82 | OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); | 84 | OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); |
83 | 85 | ||
84 | OTodo event(int uid ); | 86 | OPimTodo event(int uid ); |
85 | 87 | ||
86 | bool isSyncing()const; | 88 | bool isSyncing()const; |
87 | bool showCompleted()const; | 89 | bool showCompleted()const; |
88 | bool showDeadline()const; | 90 | bool showDeadline()const; |
89 | bool showOverDue()const; | 91 | bool showOverDue()const; |
90 | bool showQuickTask()const; | 92 | bool showQuickTask()const; |
91 | QString currentCategory()const; | 93 | QString currentCategory()const; |
92 | int currentCatId(); | 94 | int currentCatId(); |
93 | TemplateManager* templateManager(); | 95 | TemplateManager* templateManager(); |
94 | QuickEditBase* quickEditor(); | 96 | QuickEditBase* quickEditor(); |
95 | 97 | ||
96 | void updateTodo( const OTodo& ); | 98 | void updateTodo( const OPimTodo& ); |
97 | void populateTemplates(); | 99 | void populateTemplates(); |
98 | Editor* currentEditor(); | 100 | Editor* currentEditor(); |
99 | void setReadAhead(uint count ); | 101 | void setReadAhead(uint count ); |
100 | private slots: | 102 | private slots: |
101 | void slotQuickEntered(); | 103 | void slotQuickEntered(); |
102 | void populateCategories(); | 104 | void populateCategories(); |
103 | void slotReload(); | 105 | void slotReload(); |
104 | void slotFlush(); | 106 | void slotFlush(); |
105 | 107 | ||
106 | protected: | 108 | protected: |
107 | void closeEvent( QCloseEvent* e ); | 109 | void closeEvent( QCloseEvent* e ); |
108 | 110 | ||
109 | private: | 111 | private: |
110 | /* handle setting and removing alarms */ | 112 | /* handle setting and removing alarms */ |
111 | void handleAlarms( const OTodo& oldTodo, const OTodo& newTodo ); | 113 | void handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo ); |
112 | void receiveFile( const QString& filename ); | 114 | void receiveFile( const QString& filename ); |
113 | void connectBase( ViewBase* ); | 115 | void connectBase( ViewBase* ); |
114 | void initUI(); | 116 | void initUI(); |
115 | void initActions(); | 117 | void initActions(); |
116 | void initConfig(); | 118 | void initConfig(); |
117 | void initViews(); | 119 | void initViews(); |
118 | void initEditor(); | 120 | void initEditor(); |
119 | void initShow(); | 121 | void initShow(); |
120 | void initTemplate(); | 122 | void initTemplate(); |
121 | void raiseCurrentView(); | 123 | void raiseCurrentView(); |
122 | ViewBase* currentView(); | 124 | ViewBase* currentView(); |
123 | ViewBase* m_curView; | 125 | 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 | 126 | 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; | 127 | QuickEditBase* m_curQuick; |
126 | Editor* m_curEdit; | 128 | Editor* m_curEdit; |
127 | TodoShow* currentShow(); | 129 | TodoShow* currentShow(); |
128 | TodoShow* m_curShow; | 130 | TodoShow* m_curShow; |
129 | TemplateEditor* currentTemplateEditor(); | 131 | TemplateEditor* currentTemplateEditor(); |
130 | TemplateEditor* m_curTempEd; | 132 | TemplateEditor* m_curTempEd; |
131 | 133 | ||
132 | QMenuBar* m_bar; | 134 | QMenuBar* m_bar; |
133 | QToolBar* m_tool; | 135 | QToolBar* m_tool; |
134 | QAction* m_editAction, | 136 | QAction* m_editAction, |
135 | *m_deleteAction, | 137 | *m_deleteAction, |
136 | *m_findAction, | 138 | *m_findAction, |
137 | *m_completedAction, | 139 | *m_completedAction, |
138 | *m_showDeadLineAction, | 140 | *m_showDeadLineAction, |
139 | *m_deleteAllAction, | 141 | *m_deleteAllAction, |
140 | *m_deleteCompleteAction, | 142 | *m_deleteCompleteAction, |
141 | *m_duplicateAction, | 143 | *m_duplicateAction, |
142 | *m_showOverDueAction, | 144 | *m_showOverDueAction, |
143 | *m_showQuickTaskAction, | 145 | *m_showQuickTaskAction, |
144 | *m_effectiveAction; | 146 | *m_effectiveAction; |
145 | OWidgetStack *m_stack; | 147 | OWidgetStack *m_stack; |
146 | QPopupMenu* m_catMenu, | 148 | QPopupMenu* m_catMenu, |
147 | *m_edit, | 149 | *m_edit, |
148 | *m_options, | 150 | *m_options, |
149 | *m_template; | 151 | *m_template; |
150 | 152 | ||
151 | bool m_syncing:1; | 153 | bool m_syncing:1; |
152 | bool m_deadline:1; | 154 | bool m_deadline:1; |
153 | bool m_completed:1; | 155 | bool m_completed:1; |
154 | bool m_overdue:1; | 156 | bool m_overdue:1; |
155 | bool m_quicktask:1; | 157 | bool m_quicktask:1; |
156 | TodoManager m_todoMgr; | 158 | TodoManager m_todoMgr; |
157 | QString m_curCat; | 159 | QString m_curCat; |
158 | QList<ViewBase> m_views; | 160 | QList<ViewBase> m_views; |
159 | uint m_counter; | 161 | uint m_counter; |
160 | TemplateManager* m_tempManager; | 162 | TemplateManager* m_tempManager; |
161 | 163 | ||
162 | 164 | ||
163 | private slots: | 165 | private slots: |
164 | void slotShow(int); | 166 | void slotShow(int); |
165 | void slotEdit(int); | 167 | void slotEdit(int); |
166 | void slotUpdate3( QWidget* ); | 168 | void slotUpdate3( QWidget* ); |
167 | void slotComplete( int uid ); | 169 | void slotComplete( int uid ); |
168 | void slotComplete( const OTodo& ev ); | 170 | void slotComplete( const OPimTodo& ev ); |
169 | void slotNewFromTemplate(int id ); | 171 | void slotNewFromTemplate(int id ); |
170 | void slotNew(); | 172 | void slotNew(); |
171 | void slotDuplicate(); | 173 | void slotDuplicate(); |
172 | 174 | ||
173 | void slotDelete(); | 175 | void slotDelete(); |
174 | void slotDelete(int uid ); | 176 | void slotDelete(int uid ); |
175 | void slotDeleteAll(); | 177 | void slotDeleteAll(); |
176 | void slotDeleteCompleted(); | 178 | void slotDeleteCompleted(); |
177 | 179 | ||
178 | void slotEdit(); | 180 | void slotEdit(); |
179 | void slotFind(); | 181 | void slotFind(); |
180 | 182 | ||
181 | void setCategory( int ); | 183 | void setCategory( int ); |
182 | 184 | ||
183 | void slotShowDeadLine( bool ); | 185 | void slotShowDeadLine( bool ); |
184 | void slotShowCompleted( bool ); | 186 | void slotShowCompleted( bool ); |
185 | void slotShowQuickTask( bool ); | 187 | void slotShowQuickTask( bool ); |
186 | 188 | ||
187 | void setDocument( const QString& ); | 189 | void setDocument( const QString& ); |
188 | 190 | ||
189 | 191 | ||
190 | void slotBeam(); | 192 | void slotBeam(); |
191 | void beamDone( Ir* ); | 193 | void beamDone( Ir* ); |
192 | void slotShowDetails(); | 194 | void slotShowDetails(); |
193 | void slotShowNext(); | 195 | void slotShowNext(); |
194 | void slotShowPrev(); | 196 | void slotShowPrev(); |
195 | void slotShowDue( bool ); | 197 | void slotShowDue( bool ); |
196 | void slotReturnFromView(); // for TodoShow... | 198 | void slotReturnFromView(); // for TodoShow... |
197 | /* reimplementation from opimmainwindow */ | 199 | /* reimplementation from opimmainwindow */ |
198 | protected slots: | 200 | protected slots: |
199 | void flush(); | 201 | void flush(); |
200 | void reload(); | 202 | void reload(); |
201 | int create(); | 203 | int create(); |
202 | bool remove( int uid ); | 204 | bool remove( int uid ); |
203 | void beam(int uid); | 205 | void beam(int uid); |
204 | void show( int uid ); | 206 | void show( int uid ); |
205 | void edit( int uid ); | 207 | void edit( int uid ); |
206 | void add( const OPimRecord& ); | 208 | void add( const OPimRecord& ); |
207 | void doAlarm( const QDateTime& dt, int uid ); | 209 | void doAlarm( const QDateTime& dt, int uid ); |
208 | }; | 210 | }; |
209 | } | 211 | } |
210 | 212 | ||
211 | #endif | 213 | #endif |
diff --git a/core/pim/todo/opie-todo.control b/core/pim/todo/opie-todo.control index 8ad50b2..3a65c04 100644 --- a/core/pim/todo/opie-todo.control +++ b/core/pim/todo/opie-todo.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-todo | 1 | Package: opie-todo |
2 | Files: plugins/application/libtodolist.so* bin/todolist apps/1Pim/todo.desktop | 2 | Files: plugins/application/libtodolist.so* bin/todolist apps/1Pim/todo.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/pim | 4 | Section: opie/pim |
5 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> | 5 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, libopie1, opie-pics | 7 | Depends: task-opie-minimal, libopiecore2, libopieui2, libopiepim2, opie-pics |
8 | Description: Todo list manager | 8 | Description: Todo list manager |
9 | A Todo list manager for the Opie environment. | 9 | A Todo list manager for the Opie environment. |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp index 1ed20b4..ab1ce94 100644 --- a/core/pim/todo/otaskeditor.cpp +++ b/core/pim/todo/otaskeditor.cpp | |||
@@ -1,92 +1,90 @@ | |||
1 | #include <qlayout.h> | 1 | #include <qlayout.h> |
2 | 2 | ||
3 | #include <opie/orecurrancewidget.h> | ||
4 | |||
5 | #include "taskeditoroverview.h" | 3 | #include "taskeditoroverview.h" |
6 | #include "taskeditorstatus.h" | 4 | #include "taskeditorstatus.h" |
7 | #include "taskeditoralarms.h" | 5 | #include "taskeditoralarms.h" |
8 | 6 | ||
9 | #include "otaskeditor.h" | 7 | #include "otaskeditor.h" |
10 | 8 | ||
11 | OTaskEditor::OTaskEditor(int cur) | 9 | OTaskEditor::OTaskEditor(int cur) |
12 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { | 10 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { |
13 | init(); | 11 | init(); |
14 | init( cur ); | 12 | init( cur ); |
15 | } | 13 | } |
16 | OTaskEditor::OTaskEditor( const OTodo& to) | 14 | OTaskEditor::OTaskEditor( const OPimTodo& to) |
17 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { | 15 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { |
18 | init(); | 16 | init(); |
19 | init( to ); | 17 | init( to ); |
20 | } | 18 | } |
21 | OTaskEditor::~OTaskEditor() { | 19 | OTaskEditor::~OTaskEditor() { |
22 | 20 | ||
23 | } | 21 | } |
24 | void OTaskEditor::init( int cur ) { | 22 | void OTaskEditor::init( int cur ) { |
25 | OTodo to; | 23 | OPimTodo to; |
26 | to.setUid( 1 ); // generate a new uid | 24 | to.setUid( 1 ); // generate a new uid |
27 | if ( cur != 0 ) | 25 | if ( cur != 0 ) |
28 | to.setCategories( cur ); | 26 | to.setCategories( cur ); |
29 | load(to); | 27 | load(to); |
30 | } | 28 | } |
31 | void OTaskEditor::init( const OTodo& to ) { | 29 | void OTaskEditor::init( const OPimTodo& to ) { |
32 | load( to ); | 30 | load( to ); |
33 | } | 31 | } |
34 | OTodo OTaskEditor::todo()const{ | 32 | OPimTodo OTaskEditor::todo()const{ |
35 | qWarning("saving!"); | 33 | qWarning("saving!"); |
36 | OTodo to ( m_todo ); | 34 | OPimTodo to ( m_todo ); |
37 | m_overView->save( to ); | 35 | m_overView->save( to ); |
38 | m_stat->save( to ); | 36 | m_stat->save( to ); |
39 | to.setRecurrence( m_rec->recurrence() ); | 37 | to.setRecurrence( m_rec->recurrence() ); |
40 | m_alarm->save( to ); | 38 | m_alarm->save( to ); |
41 | 39 | ||
42 | return to; | 40 | return to; |
43 | } | 41 | } |
44 | void OTaskEditor::load(const OTodo& to) { | 42 | void OTaskEditor::load(const OPimTodo& to) { |
45 | m_overView->load( to ); | 43 | m_overView->load( to ); |
46 | m_stat->load( to ); | 44 | m_stat->load( to ); |
47 | m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); | 45 | m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); |
48 | m_alarm->load( to ); | 46 | m_alarm->load( to ); |
49 | 47 | ||
50 | m_todo = to; | 48 | m_todo = to; |
51 | } | 49 | } |
52 | void OTaskEditor::init() { | 50 | void OTaskEditor::init() { |
53 | setCaption(tr("Task Editor") ); | 51 | setCaption(tr("Task Editor") ); |
54 | 52 | ||
55 | QVBoxLayout* layo = new QVBoxLayout( this ); | 53 | QVBoxLayout* layo = new QVBoxLayout( this ); |
56 | m_tab = new OTabWidget( this ); | 54 | m_tab = new OTabWidget( this ); |
57 | layo->addWidget( m_tab ); | 55 | layo->addWidget( m_tab ); |
58 | 56 | ||
59 | /* | 57 | /* |
60 | * Add the Widgets | 58 | * Add the Widgets |
61 | */ | 59 | */ |
62 | m_overView = new TaskEditorOverView( m_tab ); | 60 | m_overView = new TaskEditorOverView( m_tab ); |
63 | m_tab->addTab( m_overView, "todo/info", tr("Information") ); | 61 | m_tab->addTab( m_overView, "todo/info", tr("Information") ); |
64 | 62 | ||
65 | m_stat = new TaskEditorStatus( m_tab ); | 63 | m_stat = new TaskEditorStatus( m_tab ); |
66 | m_tab->addTab( m_stat, "todo/TodoList", tr("Status") ); | 64 | m_tab->addTab( m_stat, "todo/TodoList", tr("Status") ); |
67 | 65 | ||
68 | m_alarm = new TaskEditorAlarms( m_tab ); | 66 | m_alarm = new TaskEditorAlarms( m_tab ); |
69 | m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") ); | 67 | m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") ); |
70 | 68 | ||
71 | // m_remind = new TaskEditorAlarms( m_tab ); | 69 | // m_remind = new TaskEditorAlarms( m_tab ); |
72 | // m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") ); | 70 | // m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") ); |
73 | 71 | ||
74 | // QLabel* lbl = new QLabel( m_tab ); | 72 | // QLabel* lbl = new QLabel( m_tab ); |
75 | // lbl->setText( tr("X-Ref") ); | 73 | // lbl->setText( tr("X-Ref") ); |
76 | // m_tab->addTab( lbl, "todo/xref", tr("X-Ref") ); | 74 | // m_tab->addTab( lbl, "todo/xref", tr("X-Ref") ); |
77 | 75 | ||
78 | m_rec = new ORecurranceWidget( true, QDate::currentDate(), this ); | 76 | m_rec = new OPimRecurrenceWidget( true, QDate::currentDate(), this ); |
79 | m_tab->addTab( m_rec, "repeat", tr("Recurrence") ); | 77 | m_tab->addTab( m_rec, "repeat", tr("Recurrence") ); |
80 | 78 | ||
81 | 79 | ||
82 | /* signal and slots */ | 80 | /* signal and slots */ |
83 | connect(m_overView, SIGNAL(recurranceEnabled(bool) ), | 81 | connect(m_overView, SIGNAL(recurranceEnabled(bool) ), |
84 | m_rec, SLOT(setEnabled(bool) ) ); | 82 | m_rec, SLOT(setEnabled(bool) ) ); |
85 | 83 | ||
86 | /* connect due date changed to the recurrence tab */ | 84 | /* connect due date changed to the recurrence tab */ |
87 | connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ), | 85 | connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ), |
88 | m_rec, SLOT(setStartDate(const QDate& ) ) ); | 86 | m_rec, SLOT(setStartDate(const QDate& ) ) ); |
89 | 87 | ||
90 | 88 | ||
91 | m_tab->setCurrentTab( m_overView ); | 89 | m_tab->setCurrentTab( m_overView ); |
92 | } | 90 | } |
diff --git a/core/pim/todo/otaskeditor.h b/core/pim/todo/otaskeditor.h index 2daae52..7068df8 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 <opie/otodo.h> | 6 | #include <opie2/opimtodo.h> |
7 | #include <opie/otabwidget.h> | 7 | #include <opie2/otabwidget.h> |
8 | #include <opie2/opimrecurrencewidget.h> | ||
8 | 9 | ||
9 | class TaskEditorOverView; | 10 | class TaskEditorOverView; |
10 | class TaskEditorStatus; | 11 | class TaskEditorStatus; |
11 | class TaskEditorAlarms; | 12 | class TaskEditorAlarms; |
12 | class ORecurranceWidget; | ||
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 OTodo& 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 OTodo& todo ); | 27 | void init( const OPimTodo& todo ); |
28 | 28 | ||
29 | OTodo todo()const; | 29 | OPimTodo todo()const; |
30 | private: | 30 | private: |
31 | void load( const OTodo& ); | 31 | void load( const OPimTodo& ); |
32 | void init(); | 32 | void init(); |
33 | 33 | ||
34 | OTabWidget *m_tab; | 34 | 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 | ORecurranceWidget *m_rec; | 39 | OPimRecurrenceWidget *m_rec; |
40 | OTodo m_todo; | 40 | OPimTodo m_todo; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | #endif | 43 | #endif |
diff --git a/core/pim/todo/quickedit.h b/core/pim/todo/quickedit.h index 5fe74fe..0c0c204 100644 --- a/core/pim/todo/quickedit.h +++ b/core/pim/todo/quickedit.h | |||
@@ -1,45 +1,47 @@ | |||
1 | #ifndef OPIE_QUICK_EDIT_H | 1 | #ifndef OPIE_QUICK_EDIT_H |
2 | #define OPIE_QUICK_EDIT_H | 2 | #define OPIE_QUICK_EDIT_H |
3 | 3 | ||
4 | #include <qsignal.h> | 4 | #include <qsignal.h> |
5 | #include <qwidget.h> | 5 | #include <qwidget.h> |
6 | 6 | ||
7 | #include <opie/otodo.h> | 7 | #include <opie2/opimtodo.h> |
8 | |||
9 | using Opie::OPimTodo; | ||
8 | 10 | ||
9 | namespace Todo{ | 11 | namespace Todo{ |
10 | class MainWindow; | 12 | class MainWindow; |
11 | struct QuickEditBase { | 13 | struct QuickEditBase { |
12 | virtual OTodo todo()const = 0l; | 14 | virtual OPimTodo todo()const = 0l; |
13 | virtual QSignal* signal() = 0l; | 15 | virtual QSignal* signal() = 0l; |
14 | virtual QWidget* widget() = 0l; | 16 | virtual QWidget* widget() = 0l; |
15 | }; | 17 | }; |
16 | /* | 18 | /* |
17 | * this is my second try | 19 | * this is my second try |
18 | * of signal and slots with namespaces | 20 | * of signal and slots with namespaces |
19 | * and templates | 21 | * and templates |
20 | * I use a different approach now | 22 | * I use a different approach now |
21 | * I give a QSignal away | 23 | * I give a QSignal away |
22 | * and have a protected method called emit | 24 | * and have a protected method called emit |
23 | */ | 25 | */ |
24 | /** | 26 | /** |
25 | * Quick edit is meant to quickly enter | 27 | * Quick edit is meant to quickly enter |
26 | * OTodos in a fast way | 28 | * OPimTodos in a fast way |
27 | */ | 29 | */ |
28 | class QuickEdit : public QuickEditBase{ | 30 | class QuickEdit : public QuickEditBase{ |
29 | public: | 31 | public: |
30 | QuickEdit(MainWindow* main ); | 32 | QuickEdit(MainWindow* main ); |
31 | virtual ~QuickEdit(); | 33 | virtual ~QuickEdit(); |
32 | //OTodo todo()const; | 34 | //OPimTodo todo()const; |
33 | QSignal* signal(); | 35 | QSignal* signal(); |
34 | //QWidget* widget(); | 36 | //QWidget* widget(); |
35 | protected: | 37 | protected: |
36 | MainWindow* mainWindow(); | 38 | MainWindow* mainWindow(); |
37 | void commit(); | 39 | void commit(); |
38 | private: | 40 | private: |
39 | MainWindow* m_main; | 41 | MainWindow* m_main; |
40 | QSignal* m_sig; | 42 | QSignal* m_sig; |
41 | }; | 43 | }; |
42 | }; | 44 | }; |
43 | 45 | ||
44 | 46 | ||
45 | #endif | 47 | #endif |
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp index 1863ef4..cd0684f 100644 --- a/core/pim/todo/quickeditimpl.cpp +++ b/core/pim/todo/quickeditimpl.cpp | |||
@@ -1,116 +1,116 @@ | |||
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 <opie/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 | QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) | 13 | QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) |
14 | : QToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { | 14 | : QToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { |
15 | setHorizontalStretchable( TRUE ); | 15 | setHorizontalStretchable( TRUE ); |
16 | 16 | ||
17 | // Load priority icons | 17 | // Load priority icons |
18 | // TODO - probably should be done globally somewhere else, | 18 | // TODO - probably should be done globally somewhere else, |
19 | // see also tableview.cpp/h, taskeditoroverview.cpp/h | 19 | // see also tableview.cpp/h, taskeditoroverview.cpp/h |
20 | priority1 = Resource::loadPixmap( "todo/priority1" ); | 20 | priority1 = Resource::loadPixmap( "todo/priority1" ); |
21 | priority3 = Resource::loadPixmap( "todo/priority3" ); | 21 | priority3 = Resource::loadPixmap( "todo/priority3" ); |
22 | priority5 = Resource::loadPixmap( "todo/priority5" ); | 22 | priority5 = Resource::loadPixmap( "todo/priority5" ); |
23 | 23 | ||
24 | m_lbl = new OClickableLabel( this ); | 24 | m_lbl = new OClickableLabel( this ); |
25 | m_lbl->setMinimumWidth( 15 ); | 25 | m_lbl->setMinimumWidth( 15 ); |
26 | m_lbl->setPixmap( priority3 ); | 26 | m_lbl->setPixmap( priority3 ); |
27 | connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); | 27 | 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." ) ); | 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 | 29 | ||
30 | m_edit = new QLineEdit( this ); | 30 | m_edit = new QLineEdit( this ); |
31 | setStretchableWidget( m_edit ); | 31 | 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." ) ); | 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 | 33 | ||
34 | /* | 34 | /* |
35 | * it's not implemented and won't be implemented for 1.0 | 35 | * it's not implemented and won't be implemented for 1.0 |
36 | */ | 36 | */ |
37 | #if 0 | 37 | #if 0 |
38 | QAction *a = new QAction( QWidget::tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); | 38 | QAction *a = new QAction( QWidget::tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); |
39 | connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); | 39 | connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); |
40 | a->addTo( this ); | 40 | 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." ) ); | 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 | #endif | 42 | #endif |
43 | 43 | ||
44 | QAction *a = new QAction( QWidget::tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | 44 | QAction *a = new QAction( QWidget::tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); |
45 | connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); | 45 | connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); |
46 | a->addTo( this ); | 46 | 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." ) ); | 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 | 48 | ||
49 | a = new QAction( QWidget::tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 49 | a = new QAction( QWidget::tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
50 | connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); | 50 | connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); |
51 | a->addTo( this ); | 51 | 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." ) ); | 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 | 53 | ||
54 | m_visible = visible; | 54 | m_visible = visible; |
55 | if ( !m_visible ) { | 55 | if ( !m_visible ) { |
56 | hide(); | 56 | hide(); |
57 | } | 57 | } |
58 | 58 | ||
59 | m_menu = 0l; | 59 | m_menu = 0l; |
60 | reinit(); | 60 | reinit(); |
61 | } | 61 | } |
62 | QuickEditImpl::~QuickEditImpl() { | 62 | QuickEditImpl::~QuickEditImpl() { |
63 | 63 | ||
64 | } | 64 | } |
65 | OTodo QuickEditImpl::todo()const { | 65 | OPimTodo QuickEditImpl::todo()const { |
66 | return m_todo; | 66 | return m_todo; |
67 | } | 67 | } |
68 | QWidget* QuickEditImpl::widget() { | 68 | QWidget* QuickEditImpl::widget() { |
69 | return this; | 69 | return this; |
70 | } | 70 | } |
71 | void QuickEditImpl::slotEnter() { | 71 | void QuickEditImpl::slotEnter() { |
72 | OTodo todo; | 72 | OPimTodo todo; |
73 | 73 | ||
74 | 74 | ||
75 | if (!m_edit->text().isEmpty() ) { | 75 | if (!m_edit->text().isEmpty() ) { |
76 | todo.setUid(1 ); // new uid | 76 | todo.setUid(1 ); // new uid |
77 | todo.setPriority( m_state ); | 77 | todo.setPriority( m_state ); |
78 | todo.setSummary( m_edit->text() ); | 78 | todo.setSummary( m_edit->text() ); |
79 | if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 ) | 79 | if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 ) |
80 | todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() ); | 80 | todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() ); |
81 | 81 | ||
82 | m_todo = todo; | 82 | m_todo = todo; |
83 | commit(); | 83 | commit(); |
84 | } | 84 | } |
85 | m_todo = todo; | 85 | m_todo = todo; |
86 | reinit(); | 86 | reinit(); |
87 | } | 87 | } |
88 | void QuickEditImpl::slotPrio() { | 88 | void QuickEditImpl::slotPrio() { |
89 | m_state -= 2; | 89 | m_state -= 2; |
90 | if ( m_state < 1 ) | 90 | if ( m_state < 1 ) |
91 | m_state = 5; | 91 | m_state = 5; |
92 | 92 | ||
93 | switch( m_state ) { | 93 | switch( m_state ) { |
94 | case 1: | 94 | case 1: |
95 | m_lbl->setPixmap( priority1 ); | 95 | m_lbl->setPixmap( priority1 ); |
96 | break; | 96 | break; |
97 | case 5: | 97 | case 5: |
98 | m_lbl->setPixmap( priority5 ); | 98 | m_lbl->setPixmap( priority5 ); |
99 | break; | 99 | break; |
100 | case 3: | 100 | case 3: |
101 | default: | 101 | default: |
102 | m_lbl->setPixmap( priority3 ); | 102 | m_lbl->setPixmap( priority3 ); |
103 | break; | 103 | break; |
104 | } | 104 | } |
105 | } | 105 | } |
106 | void QuickEditImpl::slotMore() { | 106 | void QuickEditImpl::slotMore() { |
107 | // TODO - implement | 107 | // TODO - implement |
108 | } | 108 | } |
109 | void QuickEditImpl::slotCancel() { | 109 | void QuickEditImpl::slotCancel() { |
110 | reinit(); | 110 | reinit(); |
111 | } | 111 | } |
112 | void QuickEditImpl::reinit() { | 112 | void QuickEditImpl::reinit() { |
113 | m_state = 3; | 113 | m_state = 3; |
114 | m_lbl->setPixmap( priority3 ); | 114 | m_lbl->setPixmap( priority3 ); |
115 | m_edit->clear(); | 115 | m_edit->clear(); |
116 | } | 116 | } |
diff --git a/core/pim/todo/quickeditimpl.h b/core/pim/todo/quickeditimpl.h index 89b94f8..d465dba 100644 --- a/core/pim/todo/quickeditimpl.h +++ b/core/pim/todo/quickeditimpl.h | |||
@@ -1,41 +1,41 @@ | |||
1 | #ifndef OPIE_QUICK_EDIT_IMPL_H | 1 | #ifndef OPIE_QUICK_EDIT_IMPL_H |
2 | #define OPIE_QUICK_EDIT_IMPL_H | 2 | #define OPIE_QUICK_EDIT_IMPL_H |
3 | 3 | ||
4 | #include <qpixmap.h> | 4 | #include <qpixmap.h> |
5 | 5 | ||
6 | #include <qtoolbar.h> | 6 | #include <qtoolbar.h> |
7 | 7 | ||
8 | #include "quickedit.h" | 8 | #include "quickedit.h" |
9 | 9 | ||
10 | class QLineEdit; | 10 | class QLineEdit; |
11 | class QLabel; | 11 | class QLabel; |
12 | 12 | ||
13 | class QuickEditImpl : public QToolBar, public Todo::QuickEdit { | 13 | class QuickEditImpl : public QToolBar, public Todo::QuickEdit { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | public: | 15 | public: |
16 | QuickEditImpl( QWidget* parent, bool visible); | 16 | QuickEditImpl( QWidget* parent, bool visible); |
17 | ~QuickEditImpl(); | 17 | ~QuickEditImpl(); |
18 | OTodo todo()const; | 18 | OPimTodo todo()const; |
19 | QWidget* widget(); | 19 | QWidget* widget(); |
20 | private slots: | 20 | private slots: |
21 | void slotEnter(); | 21 | void slotEnter(); |
22 | void slotPrio(); | 22 | void slotPrio(); |
23 | void slotMore(); | 23 | void slotMore(); |
24 | void slotCancel(); | 24 | void slotCancel(); |
25 | private: | 25 | private: |
26 | void reinit(); | 26 | void reinit(); |
27 | int m_state; | 27 | int m_state; |
28 | QLabel* m_lbl; | 28 | QLabel* m_lbl; |
29 | QLineEdit* m_edit; | 29 | QLineEdit* m_edit; |
30 | QLabel* m_enter; | 30 | QLabel* m_enter; |
31 | QLabel* m_more; | 31 | QLabel* m_more; |
32 | QPopupMenu* m_menu; | 32 | QPopupMenu* m_menu; |
33 | OTodo m_todo; | 33 | OPimTodo m_todo; |
34 | bool m_visible; | 34 | bool m_visible; |
35 | 35 | ||
36 | QPixmap priority1; | 36 | QPixmap priority1; |
37 | QPixmap priority3; | 37 | QPixmap priority3; |
38 | QPixmap priority5; | 38 | QPixmap priority5; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | #endif | 41 | #endif |
diff --git a/core/pim/todo/smalltodo.h b/core/pim/todo/smalltodo.h index 952ed04..963218e 100644 --- a/core/pim/todo/smalltodo.h +++ b/core/pim/todo/smalltodo.h | |||
@@ -1,70 +1,70 @@ | |||
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 <zecke@handhelds.org> | 3 | .=l. Copyright (c) 2002 <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_SMALL_TODO_H | 29 | #ifndef TODO_SMALL_TODO_H |
30 | #define TODO_SMALL_TODO_H | 30 | #define TODO_SMALL_TODO_H |
31 | 31 | ||
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <qstring.h> | 33 | #include <qstring.h> |
34 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
35 | 35 | ||
36 | 36 | ||
37 | namespace Todo { | 37 | namespace Todo { |
38 | /** | 38 | /** |
39 | * SmallTodo holds everything necessary | 39 | * SmallTodo holds everything necessary |
40 | * to represent a OTodo without holding | 40 | * to represent a OPimTodo without holding |
41 | * everything from a OTodo | 41 | * everything from a OPimTodo |
42 | */ | 42 | */ |
43 | class SmallTodo { | 43 | class SmallTodo { |
44 | public: | 44 | public: |
45 | SmallTodo(int uid = 0, | 45 | SmallTodo(int uid = 0, |
46 | bool comp = false, | 46 | bool comp = false, |
47 | const QDate& date = QDate::currentDate(), | 47 | const QDate& date = QDate::currentDate(), |
48 | const QString& = QString::null, | 48 | const QString& = QString::null, |
49 | const QStringList& = QStringList() ); | 49 | const QStringList& = QStringList() ); |
50 | SmallTodo( const SmallTodo& ); | 50 | SmallTodo( const SmallTodo& ); |
51 | ~SmallTodo(); | 51 | ~SmallTodo(); |
52 | 52 | ||
53 | bool operator==( const SmallTodo& ); | 53 | bool operator==( const SmallTodo& ); |
54 | bool operator==( const SmallTodo& ) const; | 54 | bool operator==( const SmallTodo& ) const; |
55 | 55 | ||
56 | SmallTodo &operator=( const SmallTodo& ); | 56 | SmallTodo &operator=( const SmallTodo& ); |
57 | QString name()const; | 57 | QString name()const; |
58 | QStringList categories()const; | 58 | QStringList categories()const; |
59 | int uid()const; | 59 | int uid()const; |
60 | bool isCompleted()const; | 60 | bool isCompleted()const; |
61 | QDate date()const; | 61 | QDate date()const; |
62 | 62 | ||
63 | private: | 63 | private: |
64 | struct SmallTodoPrivate; | 64 | struct SmallTodoPrivate; |
65 | SmallTodoPrivate* d; | 65 | SmallTodoPrivate* d; |
66 | void deref(); | 66 | void deref(); |
67 | }; | 67 | }; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | #endif | 70 | #endif |
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index d980a24..5bbf880 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -1,638 +1,638 @@ | |||
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 <zecke> | 3 | .=l. Copyright (c) 2002 <zecke> |
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 | #include <stdlib.h> | 28 | #include <stdlib.h> |
29 | #include <cmath> | 29 | #include <cmath> |
30 | #include <cctype> | 30 | #include <cctype> |
31 | 31 | ||
32 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
33 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
34 | #include <qtimer.h> | 34 | #include <qtimer.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | 36 | ||
37 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
38 | #include <qpe/resource.h> | 38 | #include <qpe/resource.h> |
39 | 39 | ||
40 | #include <opie/orecur.h> | 40 | #include <opie2/opimrecurrence.h> |
41 | 41 | ||
42 | #include "mainwindow.h" | 42 | #include "mainwindow.h" |
43 | //#include "tableitems.h" | 43 | //#include "tableitems.h" |
44 | #include "tableview.h" | 44 | #include "tableview.h" |
45 | 45 | ||
46 | using namespace Todo; | 46 | using namespace Todo; |
47 | 47 | ||
48 | namespace { | 48 | namespace { |
49 | static const int BoxSize = 14; | 49 | static const int BoxSize = 14; |
50 | static const int RowHeight = 20; | 50 | static const int RowHeight = 20; |
51 | } | 51 | } |
52 | 52 | ||
53 | TableView::EditorWidget::EditorWidget() : m_wid(0l), m_row(-1), m_col(-1) { | 53 | TableView::EditorWidget::EditorWidget() : m_wid(0l), m_row(-1), m_col(-1) { |
54 | } | 54 | } |
55 | void TableView::EditorWidget::setCellWidget(QWidget* wid, int row, int col ) { | 55 | void TableView::EditorWidget::setCellWidget(QWidget* wid, int row, int col ) { |
56 | m_wid = wid; | 56 | m_wid = wid; |
57 | m_row = row; | 57 | m_row = row; |
58 | m_col = col; | 58 | m_col = col; |
59 | } | 59 | } |
60 | void TableView::EditorWidget::releaseCellWidget() { | 60 | void TableView::EditorWidget::releaseCellWidget() { |
61 | m_wid = 0; | 61 | m_wid = 0; |
62 | m_row = m_col = -1; | 62 | m_row = m_col = -1; |
63 | } | 63 | } |
64 | QWidget* TableView::EditorWidget::cellWidget()const { | 64 | QWidget* TableView::EditorWidget::cellWidget()const { |
65 | return m_wid; | 65 | return m_wid; |
66 | } | 66 | } |
67 | int TableView::EditorWidget::cellRow()const { | 67 | int TableView::EditorWidget::cellRow()const { |
68 | return m_row; | 68 | return m_row; |
69 | } | 69 | } |
70 | int TableView::EditorWidget::cellCol()const { | 70 | int TableView::EditorWidget::cellCol()const { |
71 | return m_col; | 71 | return m_col; |
72 | } | 72 | } |
73 | 73 | ||
74 | 74 | ||
75 | void TableView::initConfig() { | 75 | void TableView::initConfig() { |
76 | Config config( "todo" ); | 76 | Config config( "todo" ); |
77 | config.setGroup( "Options" ); | 77 | config.setGroup( "Options" ); |
78 | m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 ); | 78 | m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 ); |
79 | for (int i = 0; i < numCols(); i++ ) { | 79 | for (int i = 0; i < numCols(); i++ ) { |
80 | int width = config.readNumEntry("Width"+QString::number(i), -1 ); | 80 | int width = config.readNumEntry("Width"+QString::number(i), -1 ); |
81 | setColumnWidth(i, width == -1 ? columnWidth(i) : width ); | 81 | setColumnWidth(i, width == -1 ? columnWidth(i) : width ); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | TableView::TableView( MainWindow* window, QWidget* wid ) | 85 | TableView::TableView( MainWindow* window, QWidget* wid ) |
86 | : QTable( wid ), TodoView( window ) { | 86 | : QTable( wid ), TodoView( window ) { |
87 | 87 | ||
88 | setName("TableView"); | 88 | setName("TableView"); |
89 | // Load icons | 89 | // Load icons |
90 | // TODO - probably should be done globally somewhere else, | 90 | // TODO - probably should be done globally somewhere else, |
91 | // see also quickeditimpl.cpp/h, taskeditoroverview.cpp/h | 91 | // see also quickeditimpl.cpp/h, taskeditoroverview.cpp/h |
92 | m_pic_completed = Resource::loadPixmap( "todo/completed" ); | 92 | m_pic_completed = Resource::loadPixmap( "todo/completed" ); |
93 | QString namestr; | 93 | QString namestr; |
94 | for ( unsigned int i = 1; i < 6; i++ ) { | 94 | for ( unsigned int i = 1; i < 6; i++ ) { |
95 | namestr = "todo/priority"; | 95 | namestr = "todo/priority"; |
96 | namestr.append( QString::number( i ) ); | 96 | namestr.append( QString::number( i ) ); |
97 | m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); | 97 | m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); |
98 | } | 98 | } |
99 | 99 | ||
100 | setUpdatesEnabled( false ); | 100 | setUpdatesEnabled( false ); |
101 | viewport()->setUpdatesEnabled( false ); | 101 | viewport()->setUpdatesEnabled( false ); |
102 | m_enablePaint = false; | 102 | m_enablePaint = false; |
103 | setNumRows(0); | 103 | setNumRows(0); |
104 | setNumCols(4); | 104 | setNumCols(4); |
105 | 105 | ||
106 | horizontalHeader()->setLabel( 0, QWidget::tr("C.") ); | 106 | horizontalHeader()->setLabel( 0, QWidget::tr("C.") ); |
107 | horizontalHeader()->setLabel( 1, QWidget::tr("Priority") ); | 107 | horizontalHeader()->setLabel( 1, QWidget::tr("Priority") ); |
108 | horizontalHeader()->setLabel( 2, QWidget::tr("Summary" ) ); | 108 | horizontalHeader()->setLabel( 2, QWidget::tr("Summary" ) ); |
109 | horizontalHeader()->setLabel( 3, QWidget::tr("Deadline") ); | 109 | horizontalHeader()->setLabel( 3, QWidget::tr("Deadline") ); |
110 | 110 | ||
111 | setShowDeadline( todoWindow()->showDeadline() ); | 111 | setShowDeadline( todoWindow()->showDeadline() ); |
112 | 112 | ||
113 | setSorting( TRUE ); | 113 | setSorting( TRUE ); |
114 | setSelectionMode( NoSelection ); | 114 | setSelectionMode( NoSelection ); |
115 | 115 | ||
116 | setLeftMargin( 0 ); | 116 | setLeftMargin( 0 ); |
117 | verticalHeader()->hide(); | 117 | verticalHeader()->hide(); |
118 | 118 | ||
119 | connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ), | 119 | connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ), |
120 | this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); | 120 | this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); |
121 | connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), | 121 | connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), |
122 | this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); | 122 | this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); |
123 | connect((QTable*)this, SIGNAL(valueChanged(int, int) ), | 123 | connect((QTable*)this, SIGNAL(valueChanged(int, int) ), |
124 | this, SLOT( slotValueChanged(int, int) ) ); | 124 | this, SLOT( slotValueChanged(int, int) ) ); |
125 | connect((QTable*)this, SIGNAL(currentChanged(int, int) ), | 125 | connect((QTable*)this, SIGNAL(currentChanged(int, int) ), |
126 | this, SLOT( slotCurrentChanged(int, int) ) ); | 126 | this, SLOT( slotCurrentChanged(int, int) ) ); |
127 | 127 | ||
128 | m_menuTimer = new QTimer( this ); | 128 | m_menuTimer = new QTimer( this ); |
129 | connect( m_menuTimer, SIGNAL(timeout()), | 129 | connect( m_menuTimer, SIGNAL(timeout()), |
130 | this, SLOT(slotShowMenu()) ); | 130 | this, SLOT(slotShowMenu()) ); |
131 | 131 | ||
132 | /* now let's init the config */ | 132 | /* now let's init the config */ |
133 | initConfig(); | 133 | initConfig(); |
134 | 134 | ||
135 | 135 | ||
136 | m_enablePaint = true; | 136 | m_enablePaint = true; |
137 | setUpdatesEnabled( true ); | 137 | setUpdatesEnabled( true ); |
138 | viewport()->setUpdatesEnabled( true ); | 138 | viewport()->setUpdatesEnabled( true ); |
139 | viewport()->update(); | 139 | viewport()->update(); |
140 | setSortOrder( 0 ); | 140 | setSortOrder( 0 ); |
141 | setAscending( TRUE ); | 141 | setAscending( TRUE ); |
142 | m_first = true; | 142 | m_first = true; |
143 | 143 | ||
144 | 144 | ||
145 | } | 145 | } |
146 | /* a new day has started | 146 | /* a new day has started |
147 | * update the day | 147 | * update the day |
148 | */ | 148 | */ |
149 | void TableView::newDay() { | 149 | void TableView::newDay() { |
150 | clear(); | 150 | clear(); |
151 | updateView(); | 151 | updateView(); |
152 | } | 152 | } |
153 | TableView::~TableView() { | 153 | TableView::~TableView() { |
154 | Config config( "todo" ); | 154 | Config config( "todo" ); |
155 | config.setGroup( "Options" ); | 155 | config.setGroup( "Options" ); |
156 | for (int i = 0; i < numCols(); i++ ) | 156 | for (int i = 0; i < numCols(); i++ ) |
157 | config.writeEntry("Width"+QString::number(i), columnWidth(i) ); | 157 | config.writeEntry("Width"+QString::number(i), columnWidth(i) ); |
158 | } | 158 | } |
159 | void TableView::slotShowMenu() { | 159 | void TableView::slotShowMenu() { |
160 | QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); | 160 | QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); |
161 | menu->exec(QCursor::pos() ); | 161 | menu->exec(QCursor::pos() ); |
162 | delete menu; | 162 | delete menu; |
163 | } | 163 | } |
164 | QString TableView::type() const { | 164 | QString TableView::type() const { |
165 | return QString::fromLatin1( tr("Table View") ); | 165 | return QString::fromLatin1( tr("Table View") ); |
166 | } | 166 | } |
167 | int TableView::current() { | 167 | int TableView::current() { |
168 | if (numRows() == 0 ) return 0; | 168 | if (numRows() == 0 ) return 0; |
169 | int uid = sorted().uidAt(currentRow() ); | 169 | int uid = sorted().uidAt(currentRow() ); |
170 | 170 | ||
171 | return uid; | 171 | return uid; |
172 | } | 172 | } |
173 | int TableView::next() { | 173 | int TableView::next() { |
174 | if ( numRows() == 0 ) return 0; | 174 | if ( numRows() == 0 ) return 0; |
175 | if ( currentRow() + 1 >= numRows() ) return 0; | 175 | if ( currentRow() + 1 >= numRows() ) return 0; |
176 | setCurrentCell( currentRow() +1, currentColumn() ); | 176 | setCurrentCell( currentRow() +1, currentColumn() ); |
177 | return sorted().uidAt( currentRow() ); | 177 | return sorted().uidAt( currentRow() ); |
178 | } | 178 | } |
179 | int TableView::prev() { | 179 | int TableView::prev() { |
180 | if ( numRows() == 0 ) return 0; | 180 | if ( numRows() == 0 ) return 0; |
181 | if ( currentRow() - 1 < 0 ) return 0; | 181 | if ( currentRow() - 1 < 0 ) return 0; |
182 | setCurrentCell( currentRow() -1, currentColumn() ); | 182 | setCurrentCell( currentRow() -1, currentColumn() ); |
183 | return sorted().uidAt( currentRow() ); | 183 | return sorted().uidAt( currentRow() ); |
184 | 184 | ||
185 | } | 185 | } |
186 | QString TableView::currentRepresentation() { | 186 | QString TableView::currentRepresentation() { |
187 | OTodo to = sorted()[currentRow()]; | 187 | OPimTodo to = sorted()[currentRow()]; |
188 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; | 188 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; |
189 | } | 189 | } |
190 | /* show overdue */ | 190 | /* show overdue */ |
191 | void TableView::showOverDue( bool ) { | 191 | void TableView::showOverDue( bool ) { |
192 | clear(); | 192 | clear(); |
193 | updateView(); | 193 | updateView(); |
194 | } | 194 | } |
195 | 195 | ||
196 | void TableView::updateView( ) { | 196 | void TableView::updateView( ) { |
197 | qWarning("update view"); | 197 | qWarning("update view"); |
198 | m_row = false; | 198 | m_row = false; |
199 | static int id; | 199 | static int id; |
200 | id = startTimer(4000 ); | 200 | id = startTimer(4000 ); |
201 | /* FIXME we want one page to be read! | 201 | /* FIXME we want one page to be read! |
202 | * | 202 | * |
203 | * Calculate that screensize | 203 | * Calculate that screensize |
204 | */ | 204 | */ |
205 | todoWindow()->setReadAhead( 4 ); | 205 | todoWindow()->setReadAhead( 4 ); |
206 | sort(); | 206 | sort(); |
207 | OTodoAccess::List::Iterator it, end; | 207 | OPimTodoAccess::List::Iterator it, end; |
208 | it = sorted().begin(); | 208 | it = sorted().begin(); |
209 | end = sorted().end(); | 209 | end = sorted().end(); |
210 | 210 | ||
211 | qWarning("setTodos"); | 211 | qWarning("setTodos"); |
212 | QTime time; | 212 | QTime time; |
213 | time.start(); | 213 | time.start(); |
214 | m_enablePaint = false; | 214 | m_enablePaint = false; |
215 | setUpdatesEnabled( false ); | 215 | setUpdatesEnabled( false ); |
216 | viewport()->setUpdatesEnabled( false ); | 216 | viewport()->setUpdatesEnabled( false ); |
217 | 217 | ||
218 | setNumRows( it.count() ); | 218 | setNumRows( it.count() ); |
219 | if ( it.count() == 0 ) | 219 | if ( it.count() == 0 ) |
220 | killTimer(id); | 220 | killTimer(id); |
221 | 221 | ||
222 | // int elc = time.elapsed(); | 222 | // int elc = time.elapsed(); |
223 | setUpdatesEnabled( true ); | 223 | setUpdatesEnabled( true ); |
224 | viewport()->setUpdatesEnabled( true ); | 224 | viewport()->setUpdatesEnabled( true ); |
225 | viewport()->update(); | 225 | viewport()->update(); |
226 | 226 | ||
227 | m_enablePaint = true; | 227 | m_enablePaint = true; |
228 | // int el = time.elapsed(); | 228 | // int el = time.elapsed(); |
229 | } | 229 | } |
230 | void TableView::setTodo( int, const OTodo&) { | 230 | void TableView::setTodo( int, const OPimTodo&) { |
231 | sort(); | 231 | sort(); |
232 | 232 | ||
233 | /* repaint */ | 233 | /* repaint */ |
234 | repaint(); | 234 | repaint(); |
235 | } | 235 | } |
236 | void TableView::addEvent( const OTodo&) { | 236 | void TableView::addEvent( const OPimTodo&) { |
237 | 237 | ||
238 | /* fix problems of not showing the 'Haken' */ | 238 | /* fix problems of not showing the 'Haken' */ |
239 | updateView(); | 239 | updateView(); |
240 | } | 240 | } |
241 | /* | 241 | /* |
242 | * find the event | 242 | * find the event |
243 | * and then replace the complete row | 243 | * and then replace the complete row |
244 | */ | 244 | */ |
245 | void TableView::replaceEvent( const OTodo& ev) { | 245 | void TableView::replaceEvent( const OPimTodo& ev) { |
246 | addEvent( ev ); | 246 | addEvent( ev ); |
247 | } | 247 | } |
248 | /* | 248 | /* |
249 | * re aligning table can be slow too | 249 | * re aligning table can be slow too |
250 | * FIXME: look what performs better | 250 | * FIXME: look what performs better |
251 | * either this or the old align table | 251 | * either this or the old align table |
252 | */ | 252 | */ |
253 | void TableView::removeEvent( int ) { | 253 | void TableView::removeEvent( int ) { |
254 | updateView(); | 254 | updateView(); |
255 | } | 255 | } |
256 | void TableView::setShowCompleted( bool b) { | 256 | void TableView::setShowCompleted( bool b) { |
257 | qWarning("Show Completed %d" , b ); | 257 | qWarning("Show Completed %d" , b ); |
258 | updateView(); | 258 | updateView(); |
259 | } | 259 | } |
260 | void TableView::setShowDeadline( bool b ) { | 260 | void TableView::setShowDeadline( bool b ) { |
261 | qWarning( "Show DeadLine %d" , b ); | 261 | qWarning( "Show DeadLine %d" , b ); |
262 | if ( b ) | 262 | if ( b ) |
263 | showColumn( 3 ); | 263 | showColumn( 3 ); |
264 | else | 264 | else |
265 | hideColumn( 3 ); | 265 | hideColumn( 3 ); |
266 | 266 | ||
267 | // Try to intelligently size columns | 267 | // Try to intelligently size columns |
268 | // TODO - would use width() below, but doesn't have valid value at time of c'tor | 268 | // TODO - would use width() below, but doesn't have valid value at time of c'tor |
269 | int col2width = 238; | 269 | int col2width = 238; |
270 | int width = m_pic_completed.width(); | 270 | int width = m_pic_completed.width(); |
271 | setColumnWidth( 0, width ); | 271 | setColumnWidth( 0, width ); |
272 | col2width -= width; | 272 | col2width -= width; |
273 | width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; | 273 | width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; |
274 | setColumnWidth( 1, width ); | 274 | setColumnWidth( 1, width ); |
275 | col2width -= width; | 275 | col2width -= width; |
276 | if ( b ) { | 276 | if ( b ) { |
277 | width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; | 277 | width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; |
278 | setColumnWidth( 3, width ); | 278 | setColumnWidth( 3, width ); |
279 | col2width -= width; | 279 | col2width -= width; |
280 | } | 280 | } |
281 | setColumnWidth( 2, col2width ); | 281 | setColumnWidth( 2, col2width ); |
282 | } | 282 | } |
283 | void TableView::setShowCategory( const QString& str) { | 283 | void TableView::setShowCategory( const QString& str) { |
284 | qWarning("setShowCategory"); | 284 | qWarning("setShowCategory"); |
285 | if ( str != m_oleCat || m_first ) | 285 | if ( str != m_oleCat || m_first ) |
286 | updateView(); | 286 | updateView(); |
287 | 287 | ||
288 | m_oleCat = str; | 288 | m_oleCat = str; |
289 | m_first = false; | 289 | m_first = false; |
290 | 290 | ||
291 | } | 291 | } |
292 | void TableView::clear() { | 292 | void TableView::clear() { |
293 | setNumRows(0); | 293 | setNumRows(0); |
294 | } | 294 | } |
295 | void TableView::slotClicked(int row, int col, int, | 295 | void TableView::slotClicked(int row, int col, int, |
296 | const QPoint& point) { | 296 | const QPoint& point) { |
297 | if ( m_editorWidget.cellWidget() ) { | 297 | if ( m_editorWidget.cellWidget() ) { |
298 | //setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); | 298 | //setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); |
299 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), | 299 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), |
300 | true, true ); | 300 | true, true ); |
301 | m_editorWidget.releaseCellWidget(); | 301 | m_editorWidget.releaseCellWidget(); |
302 | } | 302 | } |
303 | 303 | ||
304 | if ( !cellGeometry(row, col ).contains(point ) ) | 304 | if ( !cellGeometry(row, col ).contains(point ) ) |
305 | return; | 305 | return; |
306 | 306 | ||
307 | int ui= sorted().uidAt( row ); | 307 | int ui= sorted().uidAt( row ); |
308 | 308 | ||
309 | 309 | ||
310 | switch( col ) { | 310 | switch( col ) { |
311 | case 0:{ | 311 | case 0:{ |
312 | int x = point.x() -columnPos( col ); | 312 | int x = point.x() -columnPos( col ); |
313 | int y = point.y() -rowPos( row ); | 313 | int y = point.y() -rowPos( row ); |
314 | int w = columnWidth( col ); | 314 | int w = columnWidth( col ); |
315 | int h = rowHeight( row ); | 315 | int h = rowHeight( row ); |
316 | if ( x >= ( w - BoxSize ) / 2 && | 316 | if ( x >= ( w - BoxSize ) / 2 && |
317 | x <= ( w - BoxSize ) / 2 + BoxSize && | 317 | x <= ( w - BoxSize ) / 2 + BoxSize && |
318 | y >= ( h - BoxSize ) / 2 && | 318 | y >= ( h - BoxSize ) / 2 && |
319 | y <= ( h - BoxSize ) / 2 + BoxSize ) { | 319 | y <= ( h - BoxSize ) / 2 + BoxSize ) { |
320 | TodoView::complete(sorted()[row] ); | 320 | TodoView::complete(sorted()[row] ); |
321 | } | 321 | } |
322 | } | 322 | } |
323 | break; | 323 | break; |
324 | 324 | ||
325 | // Priority emit a double click... | 325 | // Priority emit a double click... |
326 | case 1:{ | 326 | case 1:{ |
327 | QWidget* wid = beginEdit( row, col, FALSE ); | 327 | QWidget* wid = beginEdit( row, col, FALSE ); |
328 | m_editorWidget.setCellWidget( wid, row, col ); | 328 | m_editorWidget.setCellWidget( wid, row, col ); |
329 | } | 329 | } |
330 | break; | 330 | break; |
331 | 331 | ||
332 | case 2: { | 332 | case 2: { |
333 | m_menuTimer->stop(); | 333 | m_menuTimer->stop(); |
334 | showTodo( ui ); | 334 | showTodo( ui ); |
335 | break; | 335 | break; |
336 | } | 336 | } |
337 | case 3: { | 337 | case 3: { |
338 | m_menuTimer->stop(); | 338 | m_menuTimer->stop(); |
339 | TodoView::edit( ui ); | 339 | TodoView::edit( ui ); |
340 | break; | 340 | break; |
341 | } | 341 | } |
342 | } | 342 | } |
343 | 343 | ||
344 | 344 | ||
345 | } | 345 | } |
346 | void TableView::slotPressed(int row, int col, int, | 346 | void TableView::slotPressed(int row, int col, int, |
347 | const QPoint& point) { | 347 | const QPoint& point) { |
348 | 348 | ||
349 | qWarning("pressed row %d col %d x:%d+y:%d", row,col,point.x(),point.y() ); | 349 | qWarning("pressed row %d col %d x:%d+y:%d", row,col,point.x(),point.y() ); |
350 | m_prevP = point; | 350 | m_prevP = point; |
351 | /* TextColumn column */ | 351 | /* TextColumn column */ |
352 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) | 352 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) |
353 | m_menuTimer->start( 750, TRUE ); | 353 | m_menuTimer->start( 750, TRUE ); |
354 | } | 354 | } |
355 | void TableView::slotValueChanged( int, int ) { | 355 | void TableView::slotValueChanged( int, int ) { |
356 | qWarning("Value Changed"); | 356 | qWarning("Value Changed"); |
357 | } | 357 | } |
358 | void TableView::slotCurrentChanged(int, int ) { | 358 | void TableView::slotCurrentChanged(int, int ) { |
359 | m_menuTimer->stop(); | 359 | m_menuTimer->stop(); |
360 | } | 360 | } |
361 | QWidget* TableView::widget() { | 361 | QWidget* TableView::widget() { |
362 | return this; | 362 | return this; |
363 | } | 363 | } |
364 | /* | 364 | /* |
365 | * We need to overwrite sortColumn | 365 | * We need to overwrite sortColumn |
366 | * because we want to sort whole row | 366 | * because we want to sort whole row |
367 | * based | 367 | * based |
368 | * We event want to set the setOrder | 368 | * We event want to set the setOrder |
369 | * to a sort() and update() | 369 | * to a sort() and update() |
370 | */ | 370 | */ |
371 | void TableView::sortColumn( int col, bool asc, bool ) { | 371 | void TableView::sortColumn( int col, bool asc, bool ) { |
372 | qWarning("bool %d", asc ); | 372 | qWarning("bool %d", asc ); |
373 | setSortOrder( col ); | 373 | setSortOrder( col ); |
374 | setAscending( asc ); | 374 | setAscending( asc ); |
375 | updateView(); | 375 | updateView(); |
376 | } | 376 | } |
377 | void TableView::viewportPaintEvent( QPaintEvent* e) { | 377 | void TableView::viewportPaintEvent( QPaintEvent* e) { |
378 | if (m_enablePaint ) | 378 | if (m_enablePaint ) |
379 | QTable::viewportPaintEvent( e ); | 379 | QTable::viewportPaintEvent( e ); |
380 | } | 380 | } |
381 | /* | 381 | /* |
382 | * This segment is copyrighted by TT | 382 | * This segment is copyrighted by TT |
383 | * it was taken from their todolist | 383 | * it was taken from their todolist |
384 | * application this code is GPL | 384 | * application this code is GPL |
385 | */ | 385 | */ |
386 | void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { | 386 | void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { |
387 | const QColorGroup &cg = colorGroup(); | 387 | const QColorGroup &cg = colorGroup(); |
388 | 388 | ||
389 | p->save(); | 389 | p->save(); |
390 | 390 | ||
391 | OTodo task = sorted()[row]; | 391 | OPimTodo task = sorted()[row]; |
392 | 392 | ||
393 | // TODO - give user option for grid or bars? | 393 | // TODO - give user option for grid or bars? |
394 | 394 | ||
395 | // Paint alternating background bars | 395 | // Paint alternating background bars |
396 | if ( (row % 2 ) == 0 ) { | 396 | if ( (row % 2 ) == 0 ) { |
397 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | 397 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); |
398 | p->setPen( QPen( cg.text() ) ); | 398 | p->setPen( QPen( cg.text() ) ); |
399 | } | 399 | } |
400 | else { | 400 | else { |
401 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); | 401 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); |
402 | p->setPen( QPen( cg.buttonText() ) ); | 402 | p->setPen( QPen( cg.buttonText() ) ); |
403 | } | 403 | } |
404 | 404 | ||
405 | // Paint grid | 405 | // Paint grid |
406 | //p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | 406 | //p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); |
407 | //QPen op = p->pen(); | 407 | //QPen op = p->pen(); |
408 | //p->setPen(cg.mid()); | 408 | //p->setPen(cg.mid()); |
409 | //p->drawLine( 0, cr.height() - 1, cr.width() - 1, cr.height() - 1 ); | 409 | //p->drawLine( 0, cr.height() - 1, cr.width() - 1, cr.height() - 1 ); |
410 | //p->drawLine( cr.width() - 1, 0, cr.width() - 1, cr.height() - 1 ); | 410 | //p->drawLine( cr.width() - 1, 0, cr.width() - 1, cr.height() - 1 ); |
411 | //p->setPen(op); | 411 | //p->setPen(op); |
412 | 412 | ||
413 | QFont f = p->font(); | 413 | QFont f = p->font(); |
414 | QFontMetrics fm(f); | 414 | QFontMetrics fm(f); |
415 | 415 | ||
416 | int marg = ( cr.width() - BoxSize ) / 2; | 416 | int marg = ( cr.width() - BoxSize ) / 2; |
417 | int x = 0; | 417 | int x = 0; |
418 | int y = ( cr.height() - BoxSize ) / 2; | 418 | int y = ( cr.height() - BoxSize ) / 2; |
419 | 419 | ||
420 | switch(col) { | 420 | switch(col) { |
421 | case 0: // completed field | 421 | case 0: // completed field |
422 | { | 422 | { |
423 | //p->setPen( QPen( cg.text() ) ); | 423 | //p->setPen( QPen( cg.text() ) ); |
424 | //p->drawRect( x + marg, y, BoxSize, BoxSize ); | 424 | //p->drawRect( x + marg, y, BoxSize, BoxSize ); |
425 | //p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 ); | 425 | //p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 ); |
426 | if ( task.isCompleted() ) { | 426 | if ( task.isCompleted() ) { |
427 | p->drawPixmap( x + marg, y, m_pic_completed ); | 427 | p->drawPixmap( x + marg, y, m_pic_completed ); |
428 | } | 428 | } |
429 | } | 429 | } |
430 | break; | 430 | break; |
431 | case 1: // priority field | 431 | case 1: // priority field |
432 | { | 432 | { |
433 | p->drawPixmap( x + marg, y, m_pic_priority[ task.priority() - 1 ] ); | 433 | p->drawPixmap( x + marg, y, m_pic_priority[ task.priority() - 1 ] ); |
434 | } | 434 | } |
435 | break; | 435 | break; |
436 | case 2: // description field | 436 | case 2: // description field |
437 | { | 437 | { |
438 | QString text = task.summary().isEmpty() ? | 438 | QString text = task.summary().isEmpty() ? |
439 | task.description().left(20) : | 439 | task.description().left(20) : |
440 | task.summary(); | 440 | task.summary(); |
441 | p->drawText(2,2 + fm.ascent(), text); | 441 | p->drawText(2,2 + fm.ascent(), text); |
442 | } | 442 | } |
443 | break; | 443 | break; |
444 | case 3: | 444 | case 3: |
445 | { | 445 | { |
446 | QString text; | 446 | QString text; |
447 | if (task.hasDueDate()) { | 447 | if (task.hasDueDate()) { |
448 | int off = QDate::currentDate().daysTo( task.dueDate() ); | 448 | int off = QDate::currentDate().daysTo( task.dueDate() ); |
449 | text = tr( "%1 day(s)").arg(QString::number(off)); | 449 | text = tr( "%1 day(s)").arg(QString::number(off)); |
450 | /* | 450 | /* |
451 | * set color if not completed | 451 | * set color if not completed |
452 | */ | 452 | */ |
453 | if (!task.isCompleted() ) { | 453 | if (!task.isCompleted() ) { |
454 | QColor color = Qt::black; | 454 | QColor color = Qt::black; |
455 | if ( off < 0 ) | 455 | if ( off < 0 ) |
456 | color = Qt::red; | 456 | color = Qt::red; |
457 | else if ( off == 0 ) | 457 | else if ( off == 0 ) |
458 | color = Qt::yellow; | 458 | color = Qt::yellow; |
459 | else if ( off > 0 ) | 459 | else if ( off > 0 ) |
460 | color = Qt::green; | 460 | color = Qt::green; |
461 | p->setPen(color ); | 461 | p->setPen(color ); |
462 | } | 462 | } |
463 | } else { | 463 | } else { |
464 | text = tr("None"); | 464 | text = tr("None"); |
465 | } | 465 | } |
466 | p->drawText(2,2 + fm.ascent(), text); | 466 | p->drawText(2,2 + fm.ascent(), text); |
467 | } | 467 | } |
468 | break; | 468 | break; |
469 | } | 469 | } |
470 | p->restore(); | 470 | p->restore(); |
471 | } | 471 | } |
472 | QWidget* TableView::createEditor(int row, int col, bool )const { | 472 | QWidget* TableView::createEditor(int row, int col, bool )const { |
473 | switch( col ) { | 473 | switch( col ) { |
474 | case 1: { | 474 | case 1: { |
475 | /* the priority stuff */ | 475 | /* the priority stuff */ |
476 | QComboBox* combo = new QComboBox( viewport() ); | 476 | QComboBox* combo = new QComboBox( viewport() ); |
477 | for ( int i = 0; i < 5; i++ ) { | 477 | for ( int i = 0; i < 5; i++ ) { |
478 | combo->insertItem( m_pic_priority[ i ] ); | 478 | combo->insertItem( m_pic_priority[ i ] ); |
479 | } | 479 | } |
480 | combo->setCurrentItem( sorted()[row].priority()-1 ); | 480 | combo->setCurrentItem( sorted()[row].priority()-1 ); |
481 | return combo; | 481 | return combo; |
482 | } | 482 | } |
483 | /* summary */ | 483 | /* summary */ |
484 | case 2:{ | 484 | case 2:{ |
485 | QLineEdit* edit = new QLineEdit( viewport() ); | 485 | QLineEdit* edit = new QLineEdit( viewport() ); |
486 | edit->setText( sorted()[row].summary() ); | 486 | edit->setText( sorted()[row].summary() ); |
487 | return edit; | 487 | return edit; |
488 | } | 488 | } |
489 | case 0: | 489 | case 0: |
490 | default: | 490 | default: |
491 | return 0l; | 491 | return 0l; |
492 | } | 492 | } |
493 | } | 493 | } |
494 | void TableView::setCellContentFromEditor(int row, int col ) { | 494 | void TableView::setCellContentFromEditor(int row, int col ) { |
495 | qWarning("set cell content from editor"); | 495 | qWarning("set cell content from editor"); |
496 | if ( col == 1 ) { | 496 | if ( col == 1 ) { |
497 | QWidget* wid = cellWidget(row, 1 ); | 497 | QWidget* wid = cellWidget(row, 1 ); |
498 | if ( wid->inherits("QComboBox") ) { | 498 | if ( wid->inherits("QComboBox") ) { |
499 | int pri = ((QComboBox*)wid)->currentItem() + 1; | 499 | int pri = ((QComboBox*)wid)->currentItem() + 1; |
500 | OTodo todo = sorted()[row]; | 500 | OPimTodo todo = sorted()[row]; |
501 | if ( todo.priority() != pri ) { | 501 | if ( todo.priority() != pri ) { |
502 | todo.setPriority( pri ); | 502 | todo.setPriority( pri ); |
503 | TodoView::update( todo.uid(), todo ); | 503 | TodoView::update( todo.uid(), todo ); |
504 | updateView(); | 504 | updateView(); |
505 | } | 505 | } |
506 | } | 506 | } |
507 | }else if ( col == 2) { | 507 | }else if ( col == 2) { |
508 | QWidget* wid = cellWidget(row, 2); | 508 | QWidget* wid = cellWidget(row, 2); |
509 | if ( wid->inherits("QLineEdit") ) { | 509 | if ( wid->inherits("QLineEdit") ) { |
510 | QString text = ((QLineEdit*)wid)->text(); | 510 | QString text = ((QLineEdit*)wid)->text(); |
511 | OTodo todo = sorted()[row]; | 511 | OPimTodo todo = sorted()[row]; |
512 | if ( todo.summary() != text ) { | 512 | if ( todo.summary() != text ) { |
513 | todo.setSummary( text ); | 513 | todo.setSummary( text ); |
514 | TodoView::update( todo.uid(), todo ); | 514 | TodoView::update( todo.uid(), todo ); |
515 | updateView(); | 515 | updateView(); |
516 | } | 516 | } |
517 | } | 517 | } |
518 | } | 518 | } |
519 | } | 519 | } |
520 | void TableView::slotPriority() { | 520 | void TableView::slotPriority() { |
521 | setCellContentFromEditor( currentRow(), currentColumn() ); | 521 | setCellContentFromEditor( currentRow(), currentColumn() ); |
522 | } | 522 | } |
523 | /* | 523 | /* |
524 | * We'll use the TimerEvent to read ahead or to keep the cahce always | 524 | * We'll use the TimerEvent to read ahead or to keep the cahce always |
525 | * filled enough. | 525 | * filled enough. |
526 | * We will try to read ahead 4 items in both ways | 526 | * We will try to read ahead 4 items in both ways |
527 | * up and down. On odd or even we will currentRow()+-4 or +-9 | 527 | * up and down. On odd or even we will currentRow()+-4 or +-9 |
528 | * | 528 | * |
529 | */ | 529 | */ |
530 | void TableView::timerEvent( QTimerEvent* ) { | 530 | void TableView::timerEvent( QTimerEvent* ) { |
531 | // qWarning("sorted %d", sorted().count() ); | 531 | // qWarning("sorted %d", sorted().count() ); |
532 | if (sorted().count() == 0 ) | 532 | if (sorted().count() == 0 ) |
533 | return; | 533 | return; |
534 | 534 | ||
535 | int row = currentRow(); | 535 | int row = currentRow(); |
536 | if ( m_row ) { | 536 | if ( m_row ) { |
537 | int ro = row-4; | 537 | int ro = row-4; |
538 | if (ro < 0 ) ro = 0; | 538 | if (ro < 0 ) ro = 0; |
539 | sorted()[ro]; | 539 | sorted()[ro]; |
540 | 540 | ||
541 | ro = row+4; | 541 | ro = row+4; |
542 | sorted()[ro]; | 542 | sorted()[ro]; |
543 | } else { | 543 | } else { |
544 | int ro = row + 8; | 544 | int ro = row + 8; |
545 | sorted()[ro]; | 545 | sorted()[ro]; |
546 | 546 | ||
547 | ro = row-8; | 547 | ro = row-8; |
548 | if (ro < 0 ) ro = 0; | 548 | if (ro < 0 ) ro = 0; |
549 | sorted()[ro]; | 549 | sorted()[ro]; |
550 | } | 550 | } |
551 | 551 | ||
552 | m_row = !m_row; | 552 | m_row = !m_row; |
553 | } | 553 | } |
554 | 554 | ||
555 | // We want a strike through completed ;) | 555 | // We want a strike through completed ;) |
556 | // durchstreichen to complete | 556 | // durchstreichen to complete |
557 | /* | 557 | /* |
558 | * MouseTracking is off this mean we only receive | 558 | * MouseTracking is off this mean we only receive |
559 | * these events if the mouse button is pressed | 559 | * these events if the mouse button is pressed |
560 | * We've the previous point saved | 560 | * We've the previous point saved |
561 | * We check if the previous and current Point are | 561 | * We check if the previous and current Point are |
562 | * in the same row. | 562 | * in the same row. |
563 | * Then we check if they're some pixel horizontal away | 563 | * Then we check if they're some pixel horizontal away |
564 | * if the distance between the two points is greater than | 564 | * if the distance between the two points is greater than |
565 | * 8 we mark the underlying todo as completed and do a repaint | 565 | * 8 we mark the underlying todo as completed and do a repaint |
566 | * | 566 | * |
567 | * BUG: When clicking on the Due column and it's scrollable | 567 | * BUG: When clicking on the Due column and it's scrollable |
568 | * the todo is marked as completed... | 568 | * the todo is marked as completed... |
569 | * REASON: QTable is doing auto scrolling which leads to a move | 569 | * REASON: QTable is doing auto scrolling which leads to a move |
570 | * in the x coordinate and this way it's able to pass the | 570 | * in the x coordinate and this way it's able to pass the |
571 | * m_completeStrokeWidth criteria | 571 | * m_completeStrokeWidth criteria |
572 | * WORKAROUND: strike through needs to strike through the same | 572 | * WORKAROUND: strike through needs to strike through the same |
573 | * row and two columns! | 573 | * row and two columns! |
574 | */ | 574 | */ |
575 | void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { | 575 | void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { |
576 | int row = rowAt(m_prevP.y()); | 576 | int row = rowAt(m_prevP.y()); |
577 | int colOld = columnAt(m_prevP.x() ); | 577 | int colOld = columnAt(m_prevP.x() ); |
578 | int colNew = columnAt(e->x() ); | 578 | int colNew = columnAt(e->x() ); |
579 | qWarning("colNew: %d colOld: %d", colNew, colOld ); | 579 | qWarning("colNew: %d colOld: %d", colNew, colOld ); |
580 | if ( row == rowAt( e->y() ) && row != -1 && | 580 | if ( row == rowAt( e->y() ) && row != -1 && |
581 | colOld != colNew ) { | 581 | colOld != colNew ) { |
582 | TodoView::complete( sorted()[row] ); | 582 | TodoView::complete( sorted()[row] ); |
583 | return; | 583 | return; |
584 | } | 584 | } |
585 | QTable::contentsMouseReleaseEvent( e ); | 585 | QTable::contentsMouseReleaseEvent( e ); |
586 | } | 586 | } |
587 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { | 587 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { |
588 | m_menuTimer->stop(); | 588 | m_menuTimer->stop(); |
589 | QTable::contentsMouseMoveEvent( e ); | 589 | QTable::contentsMouseMoveEvent( e ); |
590 | } | 590 | } |
591 | void TableView::keyPressEvent( QKeyEvent* event) { | 591 | void TableView::keyPressEvent( QKeyEvent* event) { |
592 | if ( m_editorWidget.cellWidget() ) { | 592 | if ( m_editorWidget.cellWidget() ) { |
593 | // setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); | 593 | // setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); |
594 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), | 594 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), |
595 | true, true ); | 595 | true, true ); |
596 | m_editorWidget.releaseCellWidget(); | 596 | m_editorWidget.releaseCellWidget(); |
597 | setFocus(); | 597 | setFocus(); |
598 | } | 598 | } |
599 | 599 | ||
600 | if ( sorted().count() < 1 ) { | 600 | if ( sorted().count() < 1 ) { |
601 | QTable::keyPressEvent( event ); | 601 | QTable::keyPressEvent( event ); |
602 | return; | 602 | return; |
603 | } | 603 | } |
604 | 604 | ||
605 | int row = currentRow(); | 605 | int row = currentRow(); |
606 | int col = currentColumn(); | 606 | int col = currentColumn(); |
607 | 607 | ||
608 | char key = ::toupper( event->ascii() ); | 608 | char key = ::toupper( event->ascii() ); |
609 | /* let QTable also handle the d letter */ | 609 | /* let QTable also handle the d letter */ |
610 | if ( key == 'D' ) { | 610 | if ( key == 'D' ) { |
611 | event->accept(); | 611 | event->accept(); |
612 | removeQuery( sorted().uidAt( row ) ); | 612 | removeQuery( sorted().uidAt( row ) ); |
613 | return; | 613 | return; |
614 | } | 614 | } |
615 | 615 | ||
616 | 616 | ||
617 | switch( event->key() ) { | 617 | switch( event->key() ) { |
618 | case Qt::Key_F33: | 618 | case Qt::Key_F33: |
619 | case Qt::Key_Enter: | 619 | case Qt::Key_Enter: |
620 | case Qt::Key_Return: | 620 | case Qt::Key_Return: |
621 | case Qt::Key_Space: | 621 | case Qt::Key_Space: |
622 | if ( col == 0 ) { | 622 | if ( col == 0 ) { |
623 | TodoView::complete(sorted()[row]); | 623 | TodoView::complete(sorted()[row]); |
624 | }else if ( col == 1 ) { | 624 | }else if ( col == 1 ) { |
625 | QWidget* wid = beginEdit(row, col, FALSE ); | 625 | QWidget* wid = beginEdit(row, col, FALSE ); |
626 | m_editorWidget.setCellWidget( wid, row, col ); | 626 | m_editorWidget.setCellWidget( wid, row, col ); |
627 | }else if ( col == 2 ) { | 627 | }else if ( col == 2 ) { |
628 | showTodo( sorted().uidAt( currentRow() ) ); | 628 | showTodo( sorted().uidAt( currentRow() ) ); |
629 | }else if ( col == 3 ) { | 629 | }else if ( col == 3 ) { |
630 | TodoView::edit( sorted().uidAt(row) ); | 630 | TodoView::edit( sorted().uidAt(row) ); |
631 | } | 631 | } |
632 | event->accept(); | 632 | event->accept(); |
633 | break; | 633 | break; |
634 | default: | 634 | default: |
635 | QTable::keyPressEvent( event ); | 635 | QTable::keyPressEvent( event ); |
636 | } | 636 | } |
637 | } | 637 | } |
638 | 638 | ||
diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h index 528ddc9..7f78255 100644 --- a/core/pim/todo/tableview.h +++ b/core/pim/todo/tableview.h | |||
@@ -1,130 +1,130 @@ | |||
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 | -_. . . )=. = 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 OPIE_TABLE_VIEW_H | 29 | #ifndef OPIE_TABLE_VIEW_H |
30 | #define OPIE_TABLE_VIEW_H | 30 | #define OPIE_TABLE_VIEW_H |
31 | 31 | ||
32 | #include <qtable.h> | 32 | #include <qtable.h> |
33 | #include <qmap.h> | 33 | #include <qmap.h> |
34 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
35 | 35 | ||
36 | #include "todoview.h" | 36 | #include "todoview.h" |
37 | 37 | ||
38 | class QTimer; | 38 | class QTimer; |
39 | 39 | ||
40 | namespace Todo { | 40 | namespace Todo { |
41 | class CheckItem; | 41 | class CheckItem; |
42 | class DueTextItem; | 42 | class DueTextItem; |
43 | class TableView : public QTable, public TodoView { | 43 | class TableView : public QTable, public TodoView { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | public: | 45 | public: |
46 | TableView( MainWindow*, QWidget* parent ); | 46 | TableView( MainWindow*, QWidget* parent ); |
47 | ~TableView(); | 47 | ~TableView(); |
48 | 48 | ||
49 | 49 | ||
50 | QString type()const; | 50 | QString type()const; |
51 | int current(); | 51 | int current(); |
52 | QString currentRepresentation(); | 52 | QString currentRepresentation(); |
53 | int next(); | 53 | int next(); |
54 | int prev(); | 54 | int prev(); |
55 | 55 | ||
56 | void clear(); | 56 | void clear(); |
57 | void showOverDue( bool ); | 57 | void showOverDue( bool ); |
58 | void updateView(); | 58 | void updateView(); |
59 | void setTodo( int uid, const OTodo& ); | 59 | void setTodo( int uid, const OPimTodo& ); |
60 | void addEvent( const OTodo& event ); | 60 | void addEvent( const OPimTodo& event ); |
61 | void replaceEvent( const OTodo& ); | 61 | void replaceEvent( const OPimTodo& ); |
62 | void removeEvent( int uid ); | 62 | void removeEvent( int uid ); |
63 | void setShowCompleted( bool ); | 63 | void setShowCompleted( bool ); |
64 | void setShowDeadline( bool ); | 64 | void setShowDeadline( bool ); |
65 | 65 | ||
66 | void setShowCategory(const QString& =QString::null ); | 66 | void setShowCategory(const QString& =QString::null ); |
67 | void newDay(); | 67 | void newDay(); |
68 | QWidget* widget(); | 68 | QWidget* widget(); |
69 | void sortColumn(int, bool, bool ); | 69 | void sortColumn(int, bool, bool ); |
70 | 70 | ||
71 | /* | 71 | /* |
72 | * we do our drawing ourselves | 72 | * we do our drawing ourselves |
73 | * because we don't want to have | 73 | * because we don't want to have |
74 | * 40.000 QTableItems for 10.000 | 74 | * 40.000 QTableItems for 10.000 |
75 | * OTodos where we only show 10 at a time! | 75 | * OPimTodos where we only show 10 at a time! |
76 | */ | 76 | */ |
77 | void paintCell(QPainter* p, int row, int col, const QRect&, bool ); | 77 | void paintCell(QPainter* p, int row, int col, const QRect&, bool ); |
78 | private: | 78 | private: |
79 | /* reimplented for internal reasons */ | 79 | /* reimplented for internal reasons */ |
80 | void viewportPaintEvent( QPaintEvent* ); | 80 | void viewportPaintEvent( QPaintEvent* ); |
81 | QTimer *m_menuTimer; | 81 | QTimer *m_menuTimer; |
82 | bool m_enablePaint:1; | 82 | bool m_enablePaint:1; |
83 | QString m_oleCat; | 83 | QString m_oleCat; |
84 | bool m_first : 1; | 84 | bool m_first : 1; |
85 | 85 | ||
86 | QPixmap m_pic_completed; | 86 | QPixmap m_pic_completed; |
87 | QPixmap m_pic_priority[ 5 ]; | 87 | QPixmap m_pic_priority[ 5 ]; |
88 | 88 | ||
89 | protected: | 89 | protected: |
90 | void keyPressEvent( QKeyEvent* ); | 90 | void keyPressEvent( QKeyEvent* ); |
91 | void contentsMouseReleaseEvent( QMouseEvent* ); | 91 | void contentsMouseReleaseEvent( QMouseEvent* ); |
92 | void contentsMouseMoveEvent( QMouseEvent* ); | 92 | void contentsMouseMoveEvent( QMouseEvent* ); |
93 | void timerEvent( QTimerEvent* e ); | 93 | void timerEvent( QTimerEvent* e ); |
94 | QWidget* createEditor(int row, int col, bool initFromCell )const; | 94 | QWidget* createEditor(int row, int col, bool initFromCell )const; |
95 | void setCellContentFromEditor( int row, int col ); | 95 | void setCellContentFromEditor( int row, int col ); |
96 | /** | 96 | /** |
97 | * for inline editing on single click and to work around some | 97 | * for inline editing on single click and to work around some |
98 | * bug in qt2.3.5 | 98 | * bug in qt2.3.5 |
99 | */ | 99 | */ |
100 | struct EditorWidget { | 100 | struct EditorWidget { |
101 | EditorWidget(); | 101 | EditorWidget(); |
102 | void setCellWidget(QWidget*, int row, int col ); | 102 | void setCellWidget(QWidget*, int row, int col ); |
103 | void releaseCellWidget(); | 103 | void releaseCellWidget(); |
104 | QWidget* cellWidget()const; | 104 | QWidget* cellWidget()const; |
105 | int cellRow()const; | 105 | int cellRow()const; |
106 | int cellCol()const; | 106 | int cellCol()const; |
107 | private: | 107 | private: |
108 | QWidget* m_wid; | 108 | QWidget* m_wid; |
109 | int m_row, m_col; | 109 | int m_row, m_col; |
110 | }; | 110 | }; |
111 | EditorWidget m_editorWidget; | 111 | EditorWidget m_editorWidget; |
112 | 112 | ||
113 | private slots: | 113 | private slots: |
114 | void slotShowMenu(); | 114 | void slotShowMenu(); |
115 | void slotClicked(int, int, int, | 115 | void slotClicked(int, int, int, |
116 | const QPoint& ); | 116 | const QPoint& ); |
117 | void slotPressed(int, int, int, | 117 | void slotPressed(int, int, int, |
118 | const QPoint& ); | 118 | const QPoint& ); |
119 | void slotValueChanged(int, int); | 119 | void slotValueChanged(int, int); |
120 | void slotCurrentChanged(int, int ); | 120 | void slotCurrentChanged(int, int ); |
121 | void slotPriority(); | 121 | void slotPriority(); |
122 | private: | 122 | private: |
123 | void initConfig(); | 123 | void initConfig(); |
124 | int m_completeStrokeWidth; | 124 | int m_completeStrokeWidth; |
125 | bool m_row : 1; | 125 | bool m_row : 1; |
126 | QPoint m_prevP; | 126 | QPoint m_prevP; |
127 | }; | 127 | }; |
128 | }; | 128 | }; |
129 | 129 | ||
130 | #endif | 130 | #endif |
diff --git a/core/pim/todo/taskeditoralarms.cpp b/core/pim/todo/taskeditoralarms.cpp index bcc40fe..930c94e 100644 --- a/core/pim/todo/taskeditoralarms.cpp +++ b/core/pim/todo/taskeditoralarms.cpp | |||
@@ -1,233 +1,232 @@ | |||
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 <opie/otodo.h> | 31 | #include <opie2/opimnotifymanager.h> |
32 | #include <opie/opimnotifymanager.h> | 32 | #include <opie2/otimepicker.h> |
33 | #include <opie/otimepicker.h> | ||
34 | 33 | ||
35 | #include <qpe/datebookmonth.h> | 34 | #include <qpe/datebookmonth.h> |
36 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
37 | 36 | ||
38 | #include <qlistview.h> | 37 | #include <qlistview.h> |
39 | #include <qlayout.h> | 38 | #include <qlayout.h> |
40 | 39 | ||
41 | 40 | ||
42 | class AlarmItem : public QListViewItem { | 41 | class AlarmItem : public QListViewItem { |
43 | public: | 42 | public: |
44 | AlarmItem( QListView*, const OPimAlarm& ); | 43 | AlarmItem( QListView*, const OPimAlarm& ); |
45 | ~AlarmItem(); | 44 | ~AlarmItem(); |
46 | 45 | ||
47 | OPimAlarm alarm()const; | 46 | OPimAlarm alarm()const; |
48 | void setAlarm( const OPimAlarm& ); | 47 | void setAlarm( const OPimAlarm& ); |
49 | private: | 48 | private: |
50 | QDateTime m_dt; | 49 | QDateTime m_dt; |
51 | int m_type; | 50 | int m_type; |
52 | }; | 51 | }; |
53 | AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt) | 52 | AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt) |
54 | : QListViewItem(view) { | 53 | : QListViewItem(view) { |
55 | setAlarm( dt ); | 54 | setAlarm( dt ); |
56 | } | 55 | } |
57 | void AlarmItem::setAlarm( const OPimAlarm& dt ) { | 56 | void AlarmItem::setAlarm( const OPimAlarm& dt ) { |
58 | m_dt = dt.dateTime(); | 57 | m_dt = dt.dateTime(); |
59 | m_type = dt.sound(); | 58 | m_type = dt.sound(); |
60 | setText( 0, TimeString::dateString( m_dt.date() ) ); | 59 | setText( 0, TimeString::dateString( m_dt.date() ) ); |
61 | setText( 1, TimeString::timeString( m_dt.time() ) ); | 60 | setText( 1, TimeString::timeString( m_dt.time() ) ); |
62 | setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") ); | 61 | setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") ); |
63 | } | 62 | } |
64 | AlarmItem::~AlarmItem() { | 63 | AlarmItem::~AlarmItem() { |
65 | } | 64 | } |
66 | OPimAlarm AlarmItem::alarm()const{ | 65 | OPimAlarm AlarmItem::alarm()const{ |
67 | OPimAlarm al( m_type, m_dt ); | 66 | OPimAlarm al( m_type, m_dt ); |
68 | 67 | ||
69 | return al; | 68 | return al; |
70 | } | 69 | } |
71 | 70 | ||
72 | TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl ) | 71 | TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl ) |
73 | : QWidget( parent, name, fl ) | 72 | : QWidget( parent, name, fl ) |
74 | { | 73 | { |
75 | m_date = m_type = m_time = 0; | 74 | m_date = m_type = m_time = 0; |
76 | QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 ); | 75 | QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 ); |
77 | 76 | ||
78 | lstAlarms = new QListView( this ); | 77 | lstAlarms = new QListView( this ); |
79 | lstAlarms->addColumn( tr("Date") ); | 78 | lstAlarms->addColumn( tr("Date") ); |
80 | lstAlarms->addColumn( tr("Time") ); | 79 | lstAlarms->addColumn( tr("Time") ); |
81 | lstAlarms->addColumn( tr("Type") ); | 80 | lstAlarms->addColumn( tr("Type") ); |
82 | 81 | ||
83 | connect( lstAlarms, SIGNAL(clicked ( QListViewItem *, const QPoint &, int ) ), | 82 | connect( lstAlarms, SIGNAL(clicked ( QListViewItem *, const QPoint &, int ) ), |
84 | this, SLOT(inlineEdit(QListViewItem*, const QPoint&, int ) ) ); | 83 | this, SLOT(inlineEdit(QListViewItem*, const QPoint&, int ) ) ); |
85 | 84 | ||
86 | layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 ); | 85 | layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 ); |
87 | 86 | ||
88 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), this ); | 87 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), this ); |
89 | //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); | 88 | //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); |
90 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) ); | 89 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) ); |
91 | layout->addWidget( btn, 1, 0 ); | 90 | layout->addWidget( btn, 1, 0 ); |
92 | /* use when we've reminders too */ | 91 | /* use when we've reminders too */ |
93 | #if 0 | 92 | #if 0 |
94 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this ); | 93 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this ); |
95 | //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); | 94 | //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); |
96 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) ); | 95 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) ); |
97 | layout->addWidget( btn, 1, 1 ); | 96 | layout->addWidget( btn, 1, 1 ); |
98 | #endif | 97 | #endif |
99 | 98 | ||
100 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); | 99 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); |
101 | //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); | 100 | //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); |
102 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) ); | 101 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) ); |
103 | layout->addWidget( btn, 1, 2 ); | 102 | layout->addWidget( btn, 1, 2 ); |
104 | } | 103 | } |
105 | 104 | ||
106 | TaskEditorAlarms::~TaskEditorAlarms(){ | 105 | TaskEditorAlarms::~TaskEditorAlarms(){ |
107 | } | 106 | } |
108 | 107 | ||
109 | void TaskEditorAlarms::slotNew(){ | 108 | void TaskEditorAlarms::slotNew(){ |
110 | (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) ); | 109 | (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) ); |
111 | } | 110 | } |
112 | 111 | ||
113 | void TaskEditorAlarms::slotEdit(){ | 112 | void TaskEditorAlarms::slotEdit(){ |
114 | } | 113 | } |
115 | 114 | ||
116 | void TaskEditorAlarms::slotDelete(){ | 115 | void TaskEditorAlarms::slotDelete(){ |
117 | QListViewItem* item = lstAlarms->currentItem(); | 116 | QListViewItem* item = lstAlarms->currentItem(); |
118 | if (!item) return; | 117 | if (!item) return; |
119 | 118 | ||
120 | lstAlarms->takeItem( item ); delete item; | 119 | lstAlarms->takeItem( item ); delete item; |
121 | 120 | ||
122 | 121 | ||
123 | } | 122 | } |
124 | 123 | ||
125 | void TaskEditorAlarms::load( const OTodo& todo) { | 124 | void TaskEditorAlarms::load( const OPimTodo& todo) { |
126 | lstAlarms->clear(); | 125 | lstAlarms->clear(); |
127 | if (!todo.hasNotifiers() ) return; | 126 | if (!todo.hasNotifiers() ) return; |
128 | 127 | ||
129 | OPimNotifyManager::Alarms als = todo.notifiers().alarms(); | 128 | OPimNotifyManager::Alarms als = todo.notifiers().alarms(); |
130 | 129 | ||
131 | if (als.isEmpty() ) return; | 130 | if (als.isEmpty() ) return; |
132 | 131 | ||
133 | OPimNotifyManager::Alarms::Iterator it = als.begin(); | 132 | OPimNotifyManager::Alarms::Iterator it = als.begin(); |
134 | for ( ; it != als.end(); ++it ) | 133 | for ( ; it != als.end(); ++it ) |
135 | (void)new AlarmItem( lstAlarms, (*it) ); | 134 | (void)new AlarmItem( lstAlarms, (*it) ); |
136 | 135 | ||
137 | 136 | ||
138 | } | 137 | } |
139 | void TaskEditorAlarms::save( OTodo& todo ) { | 138 | void TaskEditorAlarms::save( OPimTodo& todo ) { |
140 | if (lstAlarms->childCount() <= 0 ) return; | 139 | if (lstAlarms->childCount() <= 0 ) return; |
141 | 140 | ||
142 | OPimNotifyManager::Alarms alarms; | 141 | OPimNotifyManager::Alarms alarms; |
143 | 142 | ||
144 | for ( QListViewItem* item = lstAlarms->firstChild(); item; item = item->nextSibling() ) { | 143 | for ( QListViewItem* item = lstAlarms->firstChild(); item; item = item->nextSibling() ) { |
145 | AlarmItem *alItem = static_cast<AlarmItem*>(item); | 144 | AlarmItem *alItem = static_cast<AlarmItem*>(item); |
146 | alarms.append( alItem->alarm() ); | 145 | alarms.append( alItem->alarm() ); |
147 | } | 146 | } |
148 | 147 | ||
149 | OPimNotifyManager& manager = todo.notifiers(); | 148 | OPimNotifyManager& manager = todo.notifiers(); |
150 | manager.setAlarms( alarms ); | 149 | manager.setAlarms( alarms ); |
151 | } | 150 | } |
152 | void TaskEditorAlarms::inlineEdit( QListViewItem* alarm, const QPoint& p, int col ) { | 151 | void TaskEditorAlarms::inlineEdit( QListViewItem* alarm, const QPoint& p, int col ) { |
153 | if (!alarm) return; | 152 | if (!alarm) return; |
154 | 153 | ||
155 | AlarmItem* item = static_cast<AlarmItem*>(alarm); | 154 | AlarmItem* item = static_cast<AlarmItem*>(alarm); |
156 | switch( col ) { | 155 | switch( col ) { |
157 | // date | 156 | // date |
158 | case 0: | 157 | case 0: |
159 | return inlineSetDate( item, p ); | 158 | return inlineSetDate( item, p ); |
160 | // time | 159 | // time |
161 | case 1: | 160 | case 1: |
162 | return inlineSetTime( item ); | 161 | return inlineSetTime( item ); |
163 | // type | 162 | // type |
164 | case 2: | 163 | case 2: |
165 | return inlineSetType( item, p ); | 164 | return inlineSetType( item, p ); |
166 | } | 165 | } |
167 | } | 166 | } |
168 | void TaskEditorAlarms::inlineSetDate( AlarmItem* item, const QPoint& p ) { | 167 | void TaskEditorAlarms::inlineSetDate( AlarmItem* item, const QPoint& p ) { |
169 | QPopupMenu* pop = popup( 0 ); | 168 | QPopupMenu* pop = popup( 0 ); |
170 | m_dbMonth->setDate( item->alarm().dateTime().date() ); | 169 | m_dbMonth->setDate( item->alarm().dateTime().date() ); |
171 | pop->exec(p); | 170 | pop->exec(p); |
172 | 171 | ||
173 | OPimAlarm al = item->alarm(); | 172 | OPimAlarm al = item->alarm(); |
174 | QDateTime dt = al.dateTime(); | 173 | QDateTime dt = al.dateTime(); |
175 | dt.setDate( m_dbMonth->selectedDate() ); | 174 | dt.setDate( m_dbMonth->selectedDate() ); |
176 | al.setDateTime( dt ); | 175 | al.setDateTime( dt ); |
177 | item->setAlarm( al ); | 176 | item->setAlarm( al ); |
178 | } | 177 | } |
179 | void TaskEditorAlarms::inlineSetType( AlarmItem* item, const QPoint& p ) { | 178 | void TaskEditorAlarms::inlineSetType( AlarmItem* item, const QPoint& p ) { |
180 | int type; | 179 | int type; |
181 | QPopupMenu* pop = popup( 2 ); | 180 | QPopupMenu* pop = popup( 2 ); |
182 | switch( pop->exec(p) ) { | 181 | switch( pop->exec(p) ) { |
183 | case 10: | 182 | case 10: |
184 | type = 1; | 183 | type = 1; |
185 | break; | 184 | break; |
186 | case 20: | 185 | case 20: |
187 | default: | 186 | default: |
188 | type = 0; | 187 | type = 0; |
189 | } | 188 | } |
190 | OPimAlarm al = item->alarm(); | 189 | OPimAlarm al = item->alarm(); |
191 | al.setSound( type ); | 190 | al.setSound( type ); |
192 | item->setAlarm( al ); | 191 | item->setAlarm( al ); |
193 | } | 192 | } |
194 | void TaskEditorAlarms::inlineSetTime( AlarmItem* item ) { | 193 | void TaskEditorAlarms::inlineSetTime( AlarmItem* item ) { |
195 | OPimAlarm al = item->alarm(); | 194 | OPimAlarm al = item->alarm(); |
196 | QDateTime dt = al.dateTime(); | 195 | QDateTime dt = al.dateTime(); |
197 | 196 | ||
198 | OTimePickerDialog dialog; | 197 | OTimePickerDialog dialog; |
199 | dialog.setTime( dt.time() ); | 198 | dialog.setTime( dt.time() ); |
200 | if ( dialog.exec() == QDialog::Accepted ) { | 199 | if ( dialog.exec() == QDialog::Accepted ) { |
201 | dt.setTime( dialog.time() ); | 200 | dt.setTime( dialog.time() ); |
202 | al.setDateTime( dt ); | 201 | al.setDateTime( dt ); |
203 | item->setAlarm( al ); | 202 | item->setAlarm( al ); |
204 | } | 203 | } |
205 | } | 204 | } |
206 | QPopupMenu* TaskEditorAlarms::popup( int column ) { | 205 | QPopupMenu* TaskEditorAlarms::popup( int column ) { |
207 | QPopupMenu* pop = 0; | 206 | QPopupMenu* pop = 0; |
208 | switch( column ) { | 207 | switch( column ) { |
209 | case 0:{ | 208 | case 0:{ |
210 | if (!m_date) { | 209 | if (!m_date) { |
211 | m_date = new QPopupMenu(this); | 210 | m_date = new QPopupMenu(this); |
212 | m_dbMonth = new DateBookMonth(m_date, 0, TRUE); | 211 | m_dbMonth = new DateBookMonth(m_date, 0, TRUE); |
213 | m_date->insertItem(m_dbMonth); | 212 | m_date->insertItem(m_dbMonth); |
214 | } | 213 | } |
215 | pop = m_date; | 214 | pop = m_date; |
216 | } | 215 | } |
217 | break; | 216 | break; |
218 | case 1: | 217 | case 1: |
219 | break; | 218 | break; |
220 | case 2:{ | 219 | case 2:{ |
221 | if (!m_type) { | 220 | if (!m_type) { |
222 | m_type = new QPopupMenu(this); | 221 | m_type = new QPopupMenu(this); |
223 | m_type->insertItem( QObject::tr("loud"), 10 ); | 222 | m_type->insertItem( QObject::tr("loud"), 10 ); |
224 | m_type->insertItem( QObject::tr("silent"), 20 ); | 223 | m_type->insertItem( QObject::tr("silent"), 20 ); |
225 | } | 224 | } |
226 | pop = m_type; | 225 | pop = m_type; |
227 | } | 226 | } |
228 | break; | 227 | break; |
229 | default: | 228 | default: |
230 | break; | 229 | break; |
231 | } | 230 | } |
232 | return pop; | 231 | return pop; |
233 | } | 232 | } |
diff --git a/core/pim/todo/taskeditoralarms.h b/core/pim/todo/taskeditoralarms.h index 0aa52cc..2379b0c 100644 --- a/core/pim/todo/taskeditoralarms.h +++ b/core/pim/todo/taskeditoralarms.h | |||
@@ -1,72 +1,75 @@ | |||
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,2003 <> | 3 | .=l. Copyright (c) 2002,2003 <> |
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 | #ifndef TASKEDITORALARMS_H | 29 | #ifndef TASKEDITORALARMS_H |
30 | #define TASKEDITORALARMS_H | 30 | #define TASKEDITORALARMS_H |
31 | 31 | ||
32 | #include <opie2/opimtodo.h> | ||
33 | |||
32 | #include <qwidget.h> | 34 | #include <qwidget.h> |
33 | 35 | ||
34 | class QListView; | 36 | class QListView; |
35 | class QListViewItem; | 37 | class QListViewItem; |
36 | class OTodo; | 38 | |
39 | using namespace Opie; | ||
37 | 40 | ||
38 | class AlarmItem; | 41 | class AlarmItem; |
39 | class DateBookMonth; | 42 | class DateBookMonth; |
40 | class TaskEditorAlarms : public QWidget | 43 | class TaskEditorAlarms : public QWidget |
41 | { | 44 | { |
42 | Q_OBJECT | 45 | Q_OBJECT |
43 | 46 | ||
44 | public: | 47 | public: |
45 | enum Type { | 48 | enum Type { |
46 | Alarm = 0, | 49 | Alarm = 0, |
47 | Reminders | 50 | Reminders |
48 | }; | 51 | }; |
49 | TaskEditorAlarms( QWidget* parent = 0, int type = Alarm, const char* name = 0, WFlags fl = 0 ); | 52 | TaskEditorAlarms( QWidget* parent = 0, int type = Alarm, const char* name = 0, WFlags fl = 0 ); |
50 | ~TaskEditorAlarms(); | 53 | ~TaskEditorAlarms(); |
51 | void load( const OTodo& ); | 54 | void load( const OPimTodo& ); |
52 | void save( OTodo& ); | 55 | void save( OPimTodo& ); |
53 | private: | 56 | private: |
54 | QPopupMenu* popup( int column ); | 57 | QPopupMenu* popup( int column ); |
55 | void inlineSetDate( AlarmItem*, const QPoint& p ); | 58 | void inlineSetDate( AlarmItem*, const QPoint& p ); |
56 | void inlineSetTime( AlarmItem*); | 59 | void inlineSetTime( AlarmItem*); |
57 | void inlineSetType( AlarmItem*, const QPoint& p ); | 60 | void inlineSetType( AlarmItem*, const QPoint& p ); |
58 | 61 | ||
59 | QListView* lstAlarms; | 62 | QListView* lstAlarms; |
60 | QPopupMenu* m_date; | 63 | QPopupMenu* m_date; |
61 | QPopupMenu* m_time; | 64 | QPopupMenu* m_time; |
62 | QPopupMenu* m_type; | 65 | QPopupMenu* m_type; |
63 | DateBookMonth* m_dbMonth; | 66 | DateBookMonth* m_dbMonth; |
64 | 67 | ||
65 | protected slots: | 68 | protected slots: |
66 | void slotNew(); | 69 | void slotNew(); |
67 | void slotEdit(); | 70 | void slotEdit(); |
68 | void slotDelete(); | 71 | void slotDelete(); |
69 | void inlineEdit( QListViewItem*, const QPoint& p, int ); | 72 | void inlineEdit( QListViewItem*, const QPoint& p, int ); |
70 | }; | 73 | }; |
71 | 74 | ||
72 | #endif // TASKEDITORALARMS_H | 75 | #endif // TASKEDITORALARMS_H |
diff --git a/core/pim/todo/taskeditoroverview.cpp b/core/pim/todo/taskeditoroverview.cpp index 415dcf2..294acb9 100644 --- a/core/pim/todo/taskeditoroverview.cpp +++ b/core/pim/todo/taskeditoroverview.cpp | |||
@@ -1,175 +1,175 @@ | |||
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 "taskeditoroverview.h" | 29 | #include "taskeditoroverview.h" |
30 | 30 | ||
31 | #include <opie/orecur.h> | 31 | //#include <opie2/opimrecurrence.h> |
32 | 32 | ||
33 | #include <qpe/categoryselect.h> | 33 | #include <qpe/categoryselect.h> |
34 | #include <qpe/datebookmonth.h> | 34 | #include <qpe/datebookmonth.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | 36 | ||
37 | #include <qcheckbox.h> | 37 | #include <qcheckbox.h> |
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qlayout.h> | 39 | #include <qlayout.h> |
40 | #include <qmultilineedit.h> | 40 | #include <qmultilineedit.h> |
41 | #include <qwhatsthis.h> | 41 | #include <qwhatsthis.h> |
42 | 42 | ||
43 | TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFlags fl ) | 43 | TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFlags fl ) |
44 | : QWidget( parent, name, fl ) | 44 | : QWidget( parent, name, fl ) |
45 | { | 45 | { |
46 | // Load icons | 46 | // Load icons |
47 | // TODO - probably should be done globally somewhere else, | 47 | // TODO - probably should be done globally somewhere else, |
48 | // see also quickeditimpl.cpp/h, tableview.cpp/h | 48 | // see also quickeditimpl.cpp/h, tableview.cpp/h |
49 | QString namestr; | 49 | QString namestr; |
50 | for ( unsigned int i = 1; i < 6; i++ ) { | 50 | for ( unsigned int i = 1; i < 6; i++ ) { |
51 | namestr = "todo/priority"; | 51 | namestr = "todo/priority"; |
52 | namestr.append( QString::number( i ) ); | 52 | namestr.append( QString::number( i ) ); |
53 | m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); | 53 | m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); |
54 | } | 54 | } |
55 | 55 | ||
56 | QVBoxLayout *vb = new QVBoxLayout( this ); | 56 | QVBoxLayout *vb = new QVBoxLayout( this ); |
57 | 57 | ||
58 | QScrollView *sv = new QScrollView( this ); | 58 | QScrollView *sv = new QScrollView( this ); |
59 | vb->addWidget( sv ); | 59 | vb->addWidget( sv ); |
60 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 60 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
61 | sv->setFrameStyle( QFrame::NoFrame ); | 61 | sv->setFrameStyle( QFrame::NoFrame ); |
62 | 62 | ||
63 | QWidget *container = new QWidget( sv->viewport() ); | 63 | QWidget *container = new QWidget( sv->viewport() ); |
64 | sv->addChild( container ); | 64 | sv->addChild( container ); |
65 | 65 | ||
66 | QGridLayout *layout = new QGridLayout( container, 7, 2, 4, 4 ); | 66 | QGridLayout *layout = new QGridLayout( container, 7, 2, 4, 4 ); |
67 | 67 | ||
68 | // Description | 68 | // Description |
69 | QLabel *label = new QLabel( tr( "Summary:" ), container ); | 69 | QLabel *label = new QLabel( tr( "Summary:" ), container ); |
70 | layout->addWidget( label, 0, 0 ); | 70 | layout->addWidget( label, 0, 0 ); |
71 | QWhatsThis::add( label, tr( "Enter brief description of the task here." ) ); | 71 | QWhatsThis::add( label, tr( "Enter brief description of the task here." ) ); |
72 | cmbDesc = new QComboBox( TRUE, container ); | 72 | cmbDesc = new QComboBox( TRUE, container ); |
73 | cmbDesc->insertItem( tr( "Complete " ) ); | 73 | cmbDesc->insertItem( tr( "Complete " ) ); |
74 | cmbDesc->insertItem( tr( "Work on " ) ); | 74 | cmbDesc->insertItem( tr( "Work on " ) ); |
75 | cmbDesc->insertItem( tr( "Buy " ) ); | 75 | cmbDesc->insertItem( tr( "Buy " ) ); |
76 | cmbDesc->insertItem( tr( "Organize " ) ); | 76 | cmbDesc->insertItem( tr( "Organize " ) ); |
77 | cmbDesc->insertItem( tr( "Get " ) ); | 77 | cmbDesc->insertItem( tr( "Get " ) ); |
78 | cmbDesc->insertItem( tr( "Update " ) ); | 78 | cmbDesc->insertItem( tr( "Update " ) ); |
79 | cmbDesc->insertItem( tr( "Create " ) ); | 79 | cmbDesc->insertItem( tr( "Create " ) ); |
80 | cmbDesc->insertItem( tr( "Plan " ) ); | 80 | cmbDesc->insertItem( tr( "Plan " ) ); |
81 | cmbDesc->insertItem( tr( "Call " ) ); | 81 | cmbDesc->insertItem( tr( "Call " ) ); |
82 | cmbDesc->insertItem( tr( "Mail " ) ); | 82 | cmbDesc->insertItem( tr( "Mail " ) ); |
83 | cmbDesc->clearEdit(); | 83 | cmbDesc->clearEdit(); |
84 | layout->addMultiCellWidget( cmbDesc, 1, 1, 0, 1 ); | 84 | layout->addMultiCellWidget( cmbDesc, 1, 1, 0, 1 ); |
85 | QWhatsThis::add( cmbDesc, tr( "Enter brief description of the task here." ) ); | 85 | QWhatsThis::add( cmbDesc, tr( "Enter brief description of the task here." ) ); |
86 | 86 | ||
87 | // Priority | 87 | // Priority |
88 | label = new QLabel( QWidget::tr( "Priority:" ), container ); | 88 | label = new QLabel( QWidget::tr( "Priority:" ), container ); |
89 | layout->addWidget( label, 2, 0 ); | 89 | layout->addWidget( label, 2, 0 ); |
90 | QWhatsThis::add( label, tr( "Select priority of task here." ) ); | 90 | QWhatsThis::add( label, tr( "Select priority of task here." ) ); |
91 | cmbPriority = new QComboBox( FALSE, container ); | 91 | cmbPriority = new QComboBox( FALSE, container ); |
92 | cmbPriority->setMinimumHeight( 26 ); | 92 | cmbPriority->setMinimumHeight( 26 ); |
93 | cmbPriority->insertItem( m_pic_priority[ 0 ], tr( "Very High" ) ); | 93 | cmbPriority->insertItem( m_pic_priority[ 0 ], tr( "Very High" ) ); |
94 | cmbPriority->insertItem( m_pic_priority[ 1 ], tr( "High" ) ); | 94 | cmbPriority->insertItem( m_pic_priority[ 1 ], tr( "High" ) ); |
95 | cmbPriority->insertItem( m_pic_priority[ 2 ], tr( "Normal" ) ); | 95 | cmbPriority->insertItem( m_pic_priority[ 2 ], tr( "Normal" ) ); |
96 | cmbPriority->insertItem( m_pic_priority[ 3 ], tr( "Low" ) ); | 96 | cmbPriority->insertItem( m_pic_priority[ 3 ], tr( "Low" ) ); |
97 | cmbPriority->insertItem( m_pic_priority[ 4 ], tr( "Very Low" ) ); | 97 | cmbPriority->insertItem( m_pic_priority[ 4 ], tr( "Very Low" ) ); |
98 | cmbPriority->setCurrentItem( 2 ); | 98 | cmbPriority->setCurrentItem( 2 ); |
99 | layout->addWidget( cmbPriority, 2, 1 ); | 99 | layout->addWidget( cmbPriority, 2, 1 ); |
100 | QWhatsThis::add( cmbPriority, tr( "Select priority of task here." ) ); | 100 | QWhatsThis::add( cmbPriority, tr( "Select priority of task here." ) ); |
101 | 101 | ||
102 | // Category | 102 | // Category |
103 | label = new QLabel( tr( "Category:" ), container ); | 103 | label = new QLabel( tr( "Category:" ), container ); |
104 | layout->addWidget( label, 3, 0 ); | 104 | layout->addWidget( label, 3, 0 ); |
105 | QWhatsThis::add( label, tr( "Select category to organize this task with." ) ); | 105 | QWhatsThis::add( label, tr( "Select category to organize this task with." ) ); |
106 | cmbCategory = new CategorySelect( container ); | 106 | cmbCategory = new CategorySelect( container ); |
107 | layout->addWidget( cmbCategory, 3, 1 ); | 107 | layout->addWidget( cmbCategory, 3, 1 ); |
108 | QWhatsThis::add( cmbCategory, tr( "Select category to organize this task with." ) ); | 108 | QWhatsThis::add( cmbCategory, tr( "Select category to organize this task with." ) ); |
109 | 109 | ||
110 | // Recurrence | 110 | // Recurrence |
111 | ckbRecurrence = new QCheckBox( tr( "Recurring task" ), container ); | 111 | ckbRecurrence = new QCheckBox( tr( "Recurring task" ), container ); |
112 | layout->addMultiCellWidget( ckbRecurrence, 4, 4, 0, 1 ); | 112 | layout->addMultiCellWidget( ckbRecurrence, 4, 4, 0, 1 ); |
113 | QWhatsThis::add( ckbRecurrence, tr( "Click here if task happens on a regular basis. If selected, frequency can be set on the Recurrence tab." ) ); | 113 | QWhatsThis::add( ckbRecurrence, tr( "Click here if task happens on a regular basis. If selected, frequency can be set on the Recurrence tab." ) ); |
114 | connect( ckbRecurrence, SIGNAL(clicked() ), this, SLOT( slotRecClicked() ) ); | 114 | connect( ckbRecurrence, SIGNAL(clicked() ), this, SLOT( slotRecClicked() ) ); |
115 | 115 | ||
116 | // Notes | 116 | // Notes |
117 | label = new QLabel( tr( "Description:" ), container ); | 117 | label = new QLabel( tr( "Description:" ), container ); |
118 | layout->addWidget( label, 5, 0 ); | 118 | layout->addWidget( label, 5, 0 ); |
119 | QWhatsThis::add( label, tr( "Enter any additional information about this task here." ) ); | 119 | QWhatsThis::add( label, tr( "Enter any additional information about this task here." ) ); |
120 | mleNotes = new QMultiLineEdit( container ); | 120 | mleNotes = new QMultiLineEdit( container ); |
121 | mleNotes->setWordWrap( QMultiLineEdit::WidgetWidth ); | 121 | mleNotes->setWordWrap( QMultiLineEdit::WidgetWidth ); |
122 | layout->addMultiCellWidget( mleNotes, 6, 6, 0, 1 ); | 122 | layout->addMultiCellWidget( mleNotes, 6, 6, 0, 1 ); |
123 | QWhatsThis::add( mleNotes, tr( "Enter any additional information about this task here." ) ); | 123 | QWhatsThis::add( mleNotes, tr( "Enter any additional information about this task here." ) ); |
124 | } | 124 | } |
125 | 125 | ||
126 | TaskEditorOverView::~TaskEditorOverView() | 126 | TaskEditorOverView::~TaskEditorOverView() |
127 | { | 127 | { |
128 | } | 128 | } |
129 | 129 | ||
130 | void TaskEditorOverView::load( const OTodo& todo ) | 130 | void TaskEditorOverView::load( const OPimTodo& todo ) |
131 | { | 131 | { |
132 | // Description | 132 | // Description |
133 | cmbDesc->insertItem( todo.summary(), 0 ); | 133 | cmbDesc->insertItem( todo.summary(), 0 ); |
134 | cmbDesc->setCurrentItem( 0 ); | 134 | cmbDesc->setCurrentItem( 0 ); |
135 | 135 | ||
136 | // Priority | 136 | // Priority |
137 | cmbPriority->setCurrentItem( todo.priority() - 1 ); | 137 | cmbPriority->setCurrentItem( todo.priority() - 1 ); |
138 | 138 | ||
139 | // Category | 139 | // Category |
140 | cmbCategory->setCategories( todo.categories(), "Todo List", tr( "Todo List" ) ); | 140 | cmbCategory->setCategories( todo.categories(), "Todo List", tr( "Todo List" ) ); |
141 | 141 | ||
142 | // Recurrence | 142 | // Recurrence |
143 | ckbRecurrence->setChecked( todo.hasRecurrence() ); | 143 | ckbRecurrence->setChecked( todo.hasRecurrence() ); |
144 | emit recurranceEnabled( todo.hasRecurrence() ); | 144 | emit recurranceEnabled( todo.hasRecurrence() ); |
145 | 145 | ||
146 | // Notes | 146 | // Notes |
147 | mleNotes->setText( todo.description() ); | 147 | mleNotes->setText( todo.description() ); |
148 | 148 | ||
149 | } | 149 | } |
150 | 150 | ||
151 | void TaskEditorOverView::save( OTodo &todo ) | 151 | void TaskEditorOverView::save( OPimTodo &todo ) |
152 | { | 152 | { |
153 | // Description | 153 | // Description |
154 | todo.setSummary( cmbDesc->currentText() ); | 154 | todo.setSummary( cmbDesc->currentText() ); |
155 | 155 | ||
156 | // Priority | 156 | // Priority |
157 | todo.setPriority( cmbPriority->currentItem() + 1 ); | 157 | todo.setPriority( cmbPriority->currentItem() + 1 ); |
158 | 158 | ||
159 | // Category | 159 | // Category |
160 | if ( cmbCategory->currentCategory() != -1 ) | 160 | if ( cmbCategory->currentCategory() != -1 ) |
161 | { | 161 | { |
162 | QArray<int> arr = cmbCategory->currentCategories(); | 162 | QArray<int> arr = cmbCategory->currentCategories(); |
163 | todo.setCategories( arr ); | 163 | todo.setCategories( arr ); |
164 | } | 164 | } |
165 | 165 | ||
166 | // Recurrence - don't need to save here... | 166 | // Recurrence - don't need to save here... |
167 | 167 | ||
168 | // Notes | 168 | // Notes |
169 | todo.setDescription( mleNotes->text() ); | 169 | todo.setDescription( mleNotes->text() ); |
170 | } | 170 | } |
171 | 171 | ||
172 | void TaskEditorOverView::slotRecClicked() | 172 | void TaskEditorOverView::slotRecClicked() |
173 | { | 173 | { |
174 | emit recurranceEnabled( ckbRecurrence->isChecked() ); | 174 | emit recurranceEnabled( ckbRecurrence->isChecked() ); |
175 | } | 175 | } |
diff --git a/core/pim/todo/taskeditoroverview.h b/core/pim/todo/taskeditoroverview.h index d5f5125..89679f1 100644 --- a/core/pim/todo/taskeditoroverview.h +++ b/core/pim/todo/taskeditoroverview.h | |||
@@ -1,69 +1,71 @@ | |||
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 | #ifndef TASKEDITOROVERVIEW_H | 29 | #ifndef TASKEDITOROVERVIEW_H |
30 | #define TASKEDITOROVERVIEW_H | 30 | #define TASKEDITOROVERVIEW_H |
31 | 31 | ||
32 | #include <opie/otodo.h> | 32 | #include <opie2/opimtodo.h> |
33 | 33 | ||
34 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
35 | #include <qwidget.h> | 35 | #include <qwidget.h> |
36 | 36 | ||
37 | class CategorySelect; | 37 | class CategorySelect; |
38 | class QCheckBox; | 38 | class QCheckBox; |
39 | class QComboBox; | 39 | class QComboBox; |
40 | class QMultiLineEdit; | 40 | class QMultiLineEdit; |
41 | 41 | ||
42 | using namespace Opie; | ||
43 | |||
42 | class TaskEditorOverView : public QWidget | 44 | class TaskEditorOverView : public QWidget |
43 | { | 45 | { |
44 | Q_OBJECT | 46 | Q_OBJECT |
45 | 47 | ||
46 | public: | 48 | public: |
47 | TaskEditorOverView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 49 | TaskEditorOverView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
48 | ~TaskEditorOverView(); | 50 | ~TaskEditorOverView(); |
49 | 51 | ||
50 | QComboBox *cmbDesc; | 52 | QComboBox *cmbDesc; |
51 | QComboBox *cmbPriority; | 53 | QComboBox *cmbPriority; |
52 | CategorySelect *cmbCategory; | 54 | CategorySelect *cmbCategory; |
53 | QCheckBox *ckbRecurrence; | 55 | QCheckBox *ckbRecurrence; |
54 | QMultiLineEdit *mleNotes; | 56 | QMultiLineEdit *mleNotes; |
55 | 57 | ||
56 | void load( const OTodo & ); | 58 | void load( const OPimTodo & ); |
57 | void save( OTodo & ); | 59 | void save( OPimTodo & ); |
58 | 60 | ||
59 | signals: | 61 | signals: |
60 | void recurranceEnabled( bool ); | 62 | void recurranceEnabled( bool ); |
61 | 63 | ||
62 | protected: | 64 | protected: |
63 | QPixmap m_pic_priority[ 5 ]; | 65 | QPixmap m_pic_priority[ 5 ]; |
64 | 66 | ||
65 | protected slots: | 67 | protected slots: |
66 | void slotRecClicked(); | 68 | void slotRecClicked(); |
67 | }; | 69 | }; |
68 | 70 | ||
69 | #endif // TASKEDITOROVERVIEW_H | 71 | #endif // TASKEDITOROVERVIEW_H |
diff --git a/core/pim/todo/taskeditorstatus.cpp b/core/pim/todo/taskeditorstatus.cpp index 98e3cea..367dd58 100644 --- a/core/pim/todo/taskeditorstatus.cpp +++ b/core/pim/todo/taskeditorstatus.cpp | |||
@@ -1,303 +1,302 @@ | |||
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 "taskeditorstatus.h" | 29 | #include "taskeditorstatus.h" |
30 | 30 | ||
31 | #include <opie/otodo.h> | 31 | #include <opie2/opimmaintainer.h> |
32 | #include <opie/opimmaintainer.h> | 32 | #include <opie2/opimstate.h> |
33 | #include <opie/opimstate.h> | ||
34 | 33 | ||
35 | #include <qpe/datebookmonth.h> | 34 | #include <qpe/datebookmonth.h> |
36 | 35 | ||
37 | #include <qcheckbox.h> | 36 | #include <qcheckbox.h> |
38 | #include <qcombobox.h> | 37 | #include <qcombobox.h> |
39 | #include <qlabel.h> | 38 | #include <qlabel.h> |
40 | #include <qlayout.h> | 39 | #include <qlayout.h> |
41 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
42 | 41 | ||
43 | // FIXME add the hack slots instead of setPopup!!!! | 42 | // FIXME add the hack slots instead of setPopup!!!! |
44 | // drw you shouldn't have removed them | 43 | // drw you shouldn't have removed them |
45 | 44 | ||
46 | TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags fl ) | 45 | TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags fl ) |
47 | : QWidget( parent, name, fl ) | 46 | : QWidget( parent, name, fl ) |
48 | { | 47 | { |
49 | QDate curDate = QDate::currentDate(); | 48 | QDate curDate = QDate::currentDate(); |
50 | m_start = m_comp = m_due = curDate; | 49 | m_start = m_comp = m_due = curDate; |
51 | QString curDateStr = TimeString::longDateString( curDate ); | 50 | QString curDateStr = TimeString::longDateString( curDate ); |
52 | 51 | ||
53 | QVBoxLayout *vb = new QVBoxLayout( this ); | 52 | QVBoxLayout *vb = new QVBoxLayout( this ); |
54 | 53 | ||
55 | QScrollView *sv = new QScrollView( this ); | 54 | QScrollView *sv = new QScrollView( this ); |
56 | vb->addWidget( sv ); | 55 | vb->addWidget( sv ); |
57 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 56 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
58 | sv->setFrameStyle( QFrame::NoFrame ); | 57 | sv->setFrameStyle( QFrame::NoFrame ); |
59 | 58 | ||
60 | QWidget *container = new QWidget( sv->viewport() ); | 59 | QWidget *container = new QWidget( sv->viewport() ); |
61 | sv->addChild( container ); | 60 | sv->addChild( container ); |
62 | 61 | ||
63 | QGridLayout *layout = new QGridLayout( container, 7, 3, 4, 4 ); | 62 | QGridLayout *layout = new QGridLayout( container, 7, 3, 4, 4 ); |
64 | 63 | ||
65 | // Status | 64 | // Status |
66 | QLabel *label = new QLabel( tr( "Status:" ), container ); | 65 | QLabel *label = new QLabel( tr( "Status:" ), container ); |
67 | layout->addWidget( label, 0, 0 ); | 66 | layout->addWidget( label, 0, 0 ); |
68 | QWhatsThis::add( label, tr( "Click here to set the current status of this task." ) ); | 67 | QWhatsThis::add( label, tr( "Click here to set the current status of this task." ) ); |
69 | cmbStatus = new QComboBox( FALSE, container ); | 68 | cmbStatus = new QComboBox( FALSE, container ); |
70 | cmbStatus->insertItem( tr( "Started" ) ); | 69 | cmbStatus->insertItem( tr( "Started" ) ); |
71 | cmbStatus->insertItem( tr( "Postponed" ) ); | 70 | cmbStatus->insertItem( tr( "Postponed" ) ); |
72 | cmbStatus->insertItem( tr( "Finished" ) ); | 71 | cmbStatus->insertItem( tr( "Finished" ) ); |
73 | cmbStatus->insertItem( tr( "Not started" ) ); | 72 | cmbStatus->insertItem( tr( "Not started" ) ); |
74 | layout->addMultiCellWidget( cmbStatus, 0, 0, 1, 2 ); | 73 | layout->addMultiCellWidget( cmbStatus, 0, 0, 1, 2 ); |
75 | QWhatsThis::add( cmbStatus, tr( "Click here to set the current status of this task." ) ); | 74 | QWhatsThis::add( cmbStatus, tr( "Click here to set the current status of this task." ) ); |
76 | 75 | ||
77 | // Progress | 76 | // Progress |
78 | label = new QLabel( tr( "Progress:" ), container ); | 77 | label = new QLabel( tr( "Progress:" ), container ); |
79 | layout->addWidget( label, 1, 0 ); | 78 | layout->addWidget( label, 1, 0 ); |
80 | QWhatsThis::add( label, tr( "Select progress made on this task here." ) ); | 79 | QWhatsThis::add( label, tr( "Select progress made on this task here." ) ); |
81 | cmbProgress = new QComboBox( FALSE, container ); | 80 | cmbProgress = new QComboBox( FALSE, container ); |
82 | cmbProgress->insertItem( tr( "0 %" ) ); | 81 | cmbProgress->insertItem( tr( "0 %" ) ); |
83 | cmbProgress->insertItem( tr( "20 %" ) ); | 82 | cmbProgress->insertItem( tr( "20 %" ) ); |
84 | cmbProgress->insertItem( tr( "40 %" ) ); | 83 | cmbProgress->insertItem( tr( "40 %" ) ); |
85 | cmbProgress->insertItem( tr( "60 %" ) ); | 84 | cmbProgress->insertItem( tr( "60 %" ) ); |
86 | cmbProgress->insertItem( tr( "80 %" ) ); | 85 | cmbProgress->insertItem( tr( "80 %" ) ); |
87 | cmbProgress->insertItem( tr( "100 %" ) ); | 86 | cmbProgress->insertItem( tr( "100 %" ) ); |
88 | layout->addMultiCellWidget( cmbProgress, 1, 1, 1, 2 ); | 87 | layout->addMultiCellWidget( cmbProgress, 1, 1, 1, 2 ); |
89 | QWhatsThis::add( cmbProgress, tr( "Select progress made on this task here." ) ); | 88 | QWhatsThis::add( cmbProgress, tr( "Select progress made on this task here." ) ); |
90 | 89 | ||
91 | // Start date | 90 | // Start date |
92 | ckbStart = new QCheckBox( tr( "Start Date:" ), container ); | 91 | ckbStart = new QCheckBox( tr( "Start Date:" ), container ); |
93 | layout->addWidget( ckbStart, 2, 0 ); | 92 | layout->addWidget( ckbStart, 2, 0 ); |
94 | QWhatsThis::add( ckbStart, tr( "Click here to set the date this task was started." ) ); | 93 | QWhatsThis::add( ckbStart, tr( "Click here to set the date this task was started." ) ); |
95 | connect( ckbStart, SIGNAL( clicked() ), this, SLOT( slotStartChecked() ) ); | 94 | connect( ckbStart, SIGNAL( clicked() ), this, SLOT( slotStartChecked() ) ); |
96 | btnStart = new QPushButton( curDateStr, container ); | 95 | btnStart = new QPushButton( curDateStr, container ); |
97 | btnStart->setEnabled( FALSE ); | 96 | btnStart->setEnabled( FALSE ); |
98 | layout->addMultiCellWidget( btnStart, 2, 2, 1, 2 ); | 97 | layout->addMultiCellWidget( btnStart, 2, 2, 1, 2 ); |
99 | QWhatsThis::add( btnStart, tr( "Click here to set the date this task was started." ) ); | 98 | QWhatsThis::add( btnStart, tr( "Click here to set the date this task was started." ) ); |
100 | QPopupMenu *popup = new QPopupMenu( this ); | 99 | QPopupMenu *popup = new QPopupMenu( this ); |
101 | m_startBook = new DateBookMonth( popup, 0, TRUE ); | 100 | m_startBook = new DateBookMonth( popup, 0, TRUE ); |
102 | popup->insertItem( m_startBook ); | 101 | popup->insertItem( m_startBook ); |
103 | btnStart->setPopup( popup ); | 102 | btnStart->setPopup( popup ); |
104 | connect( m_startBook, SIGNAL( dateClicked( int, int, int ) ), | 103 | connect( m_startBook, SIGNAL( dateClicked( int, int, int ) ), |
105 | this, SLOT( slotStartChanged( int, int, int ) ) ); | 104 | this, SLOT( slotStartChanged( int, int, int ) ) ); |
106 | 105 | ||
107 | // Due date | 106 | // Due date |
108 | ckbDue = new QCheckBox( tr( "Due Date:" ), container ); | 107 | ckbDue = new QCheckBox( tr( "Due Date:" ), container ); |
109 | layout->addWidget( ckbDue, 3, 0 ); | 108 | layout->addWidget( ckbDue, 3, 0 ); |
110 | QWhatsThis::add( ckbDue, tr( "Click here to set the date this task needs to be completed by." ) ); | 109 | QWhatsThis::add( ckbDue, tr( "Click here to set the date this task needs to be completed by." ) ); |
111 | connect( ckbDue, SIGNAL( clicked() ), this, SLOT( slotDueChecked() ) ); | 110 | connect( ckbDue, SIGNAL( clicked() ), this, SLOT( slotDueChecked() ) ); |
112 | btnDue = new QPushButton( curDateStr, container ); | 111 | btnDue = new QPushButton( curDateStr, container ); |
113 | btnDue->setEnabled( FALSE ); | 112 | btnDue->setEnabled( FALSE ); |
114 | layout->addMultiCellWidget( btnDue, 3, 3, 1, 2 ); | 113 | layout->addMultiCellWidget( btnDue, 3, 3, 1, 2 ); |
115 | QWhatsThis::add( btnDue, tr( "Click here to set the date this task needs to be completed by." ) ); | 114 | QWhatsThis::add( btnDue, tr( "Click here to set the date this task needs to be completed by." ) ); |
116 | popup = new QPopupMenu( this ); | 115 | popup = new QPopupMenu( this ); |
117 | m_dueBook = new DateBookMonth( popup, 0, TRUE ); | 116 | m_dueBook = new DateBookMonth( popup, 0, TRUE ); |
118 | popup->insertItem( m_dueBook ); | 117 | popup->insertItem( m_dueBook ); |
119 | btnDue->setPopup( popup ); | 118 | btnDue->setPopup( popup ); |
120 | connect( m_dueBook, SIGNAL( dateClicked( int, int, int ) ), | 119 | connect( m_dueBook, SIGNAL( dateClicked( int, int, int ) ), |
121 | this, SLOT( slotDueChanged( int, int, int ) ) ); | 120 | this, SLOT( slotDueChanged( int, int, int ) ) ); |
122 | 121 | ||
123 | // Completed | 122 | // Completed |
124 | ckbComp = new QCheckBox( tr( "Completed:" ), container ); | 123 | ckbComp = new QCheckBox( tr( "Completed:" ), container ); |
125 | layout->addWidget( ckbComp, 4, 0 ); | 124 | layout->addWidget( ckbComp, 4, 0 ); |
126 | QWhatsThis::add( ckbComp, tr( "Click here to mark this task as completed." ) ); | 125 | QWhatsThis::add( ckbComp, tr( "Click here to mark this task as completed." ) ); |
127 | connect( ckbComp, SIGNAL( clicked() ), this, SLOT( slotCompChecked() ) ); | 126 | connect( ckbComp, SIGNAL( clicked() ), this, SLOT( slotCompChecked() ) ); |
128 | btnComp = new QPushButton( curDateStr, container ); | 127 | btnComp = new QPushButton( curDateStr, container ); |
129 | btnComp->setEnabled( FALSE ); | 128 | btnComp->setEnabled( FALSE ); |
130 | layout->addMultiCellWidget( btnComp, 4, 4, 1, 2 ); | 129 | layout->addMultiCellWidget( btnComp, 4, 4, 1, 2 ); |
131 | QWhatsThis::add( btnComp, tr( "Click here to set the date this task was completed." ) ); | 130 | QWhatsThis::add( btnComp, tr( "Click here to set the date this task was completed." ) ); |
132 | popup = new QPopupMenu( this ); | 131 | popup = new QPopupMenu( this ); |
133 | m_compBook = new DateBookMonth( popup, 0, TRUE ); | 132 | m_compBook = new DateBookMonth( popup, 0, TRUE ); |
134 | popup->insertItem( m_compBook ); | 133 | popup->insertItem( m_compBook ); |
135 | btnComp->setPopup( popup ); | 134 | btnComp->setPopup( popup ); |
136 | connect( m_compBook, SIGNAL( dateClicked( int, int, int ) ), | 135 | connect( m_compBook, SIGNAL( dateClicked( int, int, int ) ), |
137 | this, SLOT( slotCompChanged( int, int, int ) ) ); | 136 | this, SLOT( slotCompChanged( int, int, int ) ) ); |
138 | 137 | ||
139 | QSpacerItem *spacer = new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); | 138 | QSpacerItem *spacer = new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); |
140 | layout->addItem( spacer, 5, 0 ); | 139 | layout->addItem( spacer, 5, 0 ); |
141 | 140 | ||
142 | // Maintainer mode | 141 | // Maintainer mode |
143 | #if 0 | 142 | #if 0 |
144 | label = new QLabel( tr( "Maintainer Mode:" ), container ); | 143 | label = new QLabel( tr( "Maintainer Mode:" ), container ); |
145 | layout->addWidget( label, 6, 0 ); | 144 | layout->addWidget( label, 6, 0 ); |
146 | QWhatsThis::add( label, tr( "Click here to set the maintainer's role." ) ); | 145 | QWhatsThis::add( label, tr( "Click here to set the maintainer's role." ) ); |
147 | cmbMaintMode = new QComboBox( FALSE, container ); | 146 | cmbMaintMode = new QComboBox( FALSE, container ); |
148 | cmbMaintMode->insertItem( tr( "Nothing" ) ); | 147 | cmbMaintMode->insertItem( tr( "Nothing" ) ); |
149 | cmbMaintMode->insertItem( tr( "Responsible" ) ); | 148 | cmbMaintMode->insertItem( tr( "Responsible" ) ); |
150 | cmbMaintMode->insertItem( tr( "Done By" ) ); | 149 | cmbMaintMode->insertItem( tr( "Done By" ) ); |
151 | cmbMaintMode->insertItem( tr( "Coordinating" ) ); | 150 | cmbMaintMode->insertItem( tr( "Coordinating" ) ); |
152 | // layout->addMultiCellWidget( cmbMaintMode, 6, 6, 1, 2 ); | 151 | // layout->addMultiCellWidget( cmbMaintMode, 6, 6, 1, 2 ); |
153 | QWhatsThis::add( cmbMaintMode, tr( "Click here to set the maintainer's role." ) ); | 152 | QWhatsThis::add( cmbMaintMode, tr( "Click here to set the maintainer's role." ) ); |
154 | 153 | ||
155 | // Maintainer | 154 | // Maintainer |
156 | label = new QLabel( tr( "Maintainer:" ), container ); | 155 | label = new QLabel( tr( "Maintainer:" ), container ); |
157 | layout->addWidget( label, 7, 0 ); | 156 | layout->addWidget( label, 7, 0 ); |
158 | QWhatsThis::add( label, tr( "This is the name of the current task maintainer." ) ); | 157 | QWhatsThis::add( label, tr( "This is the name of the current task maintainer." ) ); |
159 | txtMaintainer = new QLabel( tr( "test" ), container ); | 158 | txtMaintainer = new QLabel( tr( "test" ), container ); |
160 | txtMaintainer->setTextFormat( QLabel::RichText ); | 159 | txtMaintainer->setTextFormat( QLabel::RichText ); |
161 | layout->addWidget( txtMaintainer, 7, 1 ); | 160 | layout->addWidget( txtMaintainer, 7, 1 ); |
162 | QWhatsThis::add( txtMaintainer, tr( "This is the name of the current task maintainer." ) ); | 161 | QWhatsThis::add( txtMaintainer, tr( "This is the name of the current task maintainer." ) ); |
163 | tbtMaintainer = new QToolButton( container ); | 162 | tbtMaintainer = new QToolButton( container ); |
164 | tbtMaintainer->setPixmap( Resource::loadPixmap( "todo/more" ) ); | 163 | tbtMaintainer->setPixmap( Resource::loadPixmap( "todo/more" ) ); |
165 | // layout->addWidget( tbtMaintainer, 7, 2 ); | 164 | // layout->addWidget( tbtMaintainer, 7, 2 ); |
166 | QWhatsThis::add( tbtMaintainer, tr( "Click here to select the task maintainer." ) ); | 165 | QWhatsThis::add( tbtMaintainer, tr( "Click here to select the task maintainer." ) ); |
167 | #endif | 166 | #endif |
168 | } | 167 | } |
169 | 168 | ||
170 | TaskEditorStatus::~TaskEditorStatus() | 169 | TaskEditorStatus::~TaskEditorStatus() |
171 | { | 170 | { |
172 | } | 171 | } |
173 | 172 | ||
174 | void TaskEditorStatus::load( const OTodo &todo ) | 173 | void TaskEditorStatus::load( const OPimTodo &todo ) |
175 | { | 174 | { |
176 | QDate date = QDate::currentDate(); | 175 | QDate date = QDate::currentDate(); |
177 | QString str = TimeString::longDateString( date ); | 176 | QString str = TimeString::longDateString( date ); |
178 | 177 | ||
179 | // Status | 178 | // Status |
180 | int state = todo.hasState()? todo.state().state() : OPimState::NotStarted; | 179 | int state = todo.hasState()? todo.state().state() : OPimState::NotStarted; |
181 | if ( state == OPimState::Undefined ) | 180 | if ( state == OPimState::Undefined ) |
182 | state = OPimState::NotStarted; | 181 | state = OPimState::NotStarted; |
183 | cmbStatus->setCurrentItem( state ); | 182 | cmbStatus->setCurrentItem( state ); |
184 | 183 | ||
185 | // Progress | 184 | // Progress |
186 | cmbProgress->setCurrentItem( todo.progress() / 20 ); | 185 | cmbProgress->setCurrentItem( todo.progress() / 20 ); |
187 | 186 | ||
188 | // Start date | 187 | // Start date |
189 | ckbStart->setChecked( todo.hasStartDate() ); | 188 | ckbStart->setChecked( todo.hasStartDate() ); |
190 | btnStart->setEnabled( todo.hasStartDate() ); | 189 | btnStart->setEnabled( todo.hasStartDate() ); |
191 | if ( todo.hasStartDate() ) | 190 | if ( todo.hasStartDate() ) |
192 | { | 191 | { |
193 | m_start = todo.startDate(); | 192 | m_start = todo.startDate(); |
194 | btnStart->setText( TimeString::longDateString( m_start ) ); | 193 | btnStart->setText( TimeString::longDateString( m_start ) ); |
195 | } | 194 | } |
196 | else | 195 | else |
197 | btnStart->setText( str ); | 196 | btnStart->setText( str ); |
198 | 197 | ||
199 | // Due date | 198 | // Due date |
200 | ckbDue->setChecked( todo.hasDueDate() ); | 199 | ckbDue->setChecked( todo.hasDueDate() ); |
201 | btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); | 200 | btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); |
202 | btnDue->setEnabled( todo.hasDueDate() ); | 201 | btnDue->setEnabled( todo.hasDueDate() ); |
203 | m_due = todo.dueDate(); | 202 | m_due = todo.dueDate(); |
204 | 203 | ||
205 | // Completed | 204 | // Completed |
206 | ckbComp->setChecked( todo.isCompleted() ); | 205 | ckbComp->setChecked( todo.isCompleted() ); |
207 | btnComp->setEnabled( todo.hasCompletedDate() ); | 206 | btnComp->setEnabled( todo.hasCompletedDate() ); |
208 | if ( todo.hasCompletedDate() ) | 207 | if ( todo.hasCompletedDate() ) |
209 | { | 208 | { |
210 | m_comp = todo.completedDate(); | 209 | m_comp = todo.completedDate(); |
211 | btnComp->setText( TimeString::longDateString( m_comp ) ); | 210 | btnComp->setText( TimeString::longDateString( m_comp ) ); |
212 | } | 211 | } |
213 | else | 212 | else |
214 | btnComp->setText( str ); | 213 | btnComp->setText( str ); |
215 | 214 | ||
216 | // Maintainer Mode | 215 | // Maintainer Mode |
217 | #if 0 | 216 | #if 0 |
218 | state = todo.hasMaintainer() ? todo.maintainer().mode() : OPimMaintainer::Nothing; | 217 | state = todo.hasMaintainer() ? todo.maintainer().mode() : OPimMaintainer::Nothing; |
219 | if ( state == OPimMaintainer::Undefined ) | 218 | if ( state == OPimMaintainer::Undefined ) |
220 | state = OPimMaintainer::Nothing; | 219 | state = OPimMaintainer::Nothing; |
221 | cmbMaintMode->setCurrentItem( state ); | 220 | cmbMaintMode->setCurrentItem( state ); |
222 | #endif | 221 | #endif |
223 | // Maintainer - not implemented yet | 222 | // Maintainer - not implemented yet |
224 | } | 223 | } |
225 | 224 | ||
226 | void TaskEditorStatus::save( OTodo &todo ) | 225 | void TaskEditorStatus::save( OPimTodo &todo ) |
227 | { | 226 | { |
228 | QDate inval; | 227 | QDate inval; |
229 | 228 | ||
230 | // Status | 229 | // Status |
231 | todo.setState( OPimState( cmbStatus->currentItem() ) ); | 230 | todo.setState( OPimState( cmbStatus->currentItem() ) ); |
232 | 231 | ||
233 | // Progress | 232 | // Progress |
234 | todo.setProgress( cmbProgress->currentItem() * 20 ); | 233 | todo.setProgress( cmbProgress->currentItem() * 20 ); |
235 | 234 | ||
236 | // Start date | 235 | // Start date |
237 | if ( ckbStart->isChecked() ) | 236 | if ( ckbStart->isChecked() ) |
238 | { | 237 | { |
239 | todo.setStartDate( m_start ); | 238 | todo.setStartDate( m_start ); |
240 | } | 239 | } |
241 | else | 240 | else |
242 | todo.setStartDate( inval ); | 241 | todo.setStartDate( inval ); |
243 | 242 | ||
244 | // Due date | 243 | // Due date |
245 | if ( ckbDue->isChecked() ) | 244 | if ( ckbDue->isChecked() ) |
246 | { | 245 | { |
247 | todo.setDueDate( m_due ); | 246 | todo.setDueDate( m_due ); |
248 | todo.setHasDueDate( true ); | 247 | todo.setHasDueDate( true ); |
249 | } | 248 | } |
250 | else | 249 | else |
251 | todo.setHasDueDate( false ); | 250 | todo.setHasDueDate( false ); |
252 | 251 | ||
253 | // Completed | 252 | // Completed |
254 | todo.setCompleted( ckbComp->isChecked() ); | 253 | todo.setCompleted( ckbComp->isChecked() ); |
255 | if ( ckbComp->isChecked() ) | 254 | if ( ckbComp->isChecked() ) |
256 | { | 255 | { |
257 | todo.setCompletedDate( m_comp ); | 256 | todo.setCompletedDate( m_comp ); |
258 | } | 257 | } |
259 | else | 258 | else |
260 | todo.setCompletedDate( inval ); | 259 | todo.setCompletedDate( inval ); |
261 | 260 | ||
262 | #if 0 | 261 | #if 0 |
263 | // Maintainer mode - not implemented yet | 262 | // Maintainer mode - not implemented yet |
264 | 263 | ||
265 | // Maintainer | 264 | // Maintainer |
266 | /* TODO - resolve name to uid.....*/ | 265 | /* TODO - resolve name to uid.....*/ |
267 | todo.setMaintainer( OPimMaintainer( cmbMaintMode->currentItem(), -10 ) ); | 266 | todo.setMaintainer( OPimMaintainer( cmbMaintMode->currentItem(), -10 ) ); |
268 | #endif | 267 | #endif |
269 | } | 268 | } |
270 | 269 | ||
271 | void TaskEditorStatus::slotStartChecked() | 270 | void TaskEditorStatus::slotStartChecked() |
272 | { | 271 | { |
273 | btnStart->setEnabled( ckbStart->isChecked() ); | 272 | btnStart->setEnabled( ckbStart->isChecked() ); |
274 | } | 273 | } |
275 | 274 | ||
276 | void TaskEditorStatus::slotCompChecked() | 275 | void TaskEditorStatus::slotCompChecked() |
277 | { | 276 | { |
278 | btnComp->setEnabled( ckbComp->isChecked() ); | 277 | btnComp->setEnabled( ckbComp->isChecked() ); |
279 | } | 278 | } |
280 | 279 | ||
281 | void TaskEditorStatus::slotDueChecked() | 280 | void TaskEditorStatus::slotDueChecked() |
282 | { | 281 | { |
283 | btnDue->setEnabled( ckbDue->isChecked() ); | 282 | btnDue->setEnabled( ckbDue->isChecked() ); |
284 | } | 283 | } |
285 | 284 | ||
286 | void TaskEditorStatus::slotStartChanged(int y, int m, int d) | 285 | void TaskEditorStatus::slotStartChanged(int y, int m, int d) |
287 | { | 286 | { |
288 | m_start.setYMD( y, m, d ); | 287 | m_start.setYMD( y, m, d ); |
289 | btnStart->setText( TimeString::longDateString( m_start ) ); | 288 | btnStart->setText( TimeString::longDateString( m_start ) ); |
290 | } | 289 | } |
291 | 290 | ||
292 | void TaskEditorStatus::slotCompChanged(int y, int m, int d) | 291 | void TaskEditorStatus::slotCompChanged(int y, int m, int d) |
293 | { | 292 | { |
294 | m_comp.setYMD( y, m, d ); | 293 | m_comp.setYMD( y, m, d ); |
295 | btnComp->setText( TimeString::longDateString( m_comp ) ); | 294 | btnComp->setText( TimeString::longDateString( m_comp ) ); |
296 | } | 295 | } |
297 | 296 | ||
298 | void TaskEditorStatus::slotDueChanged(int y, int m, int d) | 297 | void TaskEditorStatus::slotDueChanged(int y, int m, int d) |
299 | { | 298 | { |
300 | m_due.setYMD( y, m, d ); | 299 | m_due.setYMD( y, m, d ); |
301 | btnDue->setText( TimeString::longDateString( m_due ) ); | 300 | btnDue->setText( TimeString::longDateString( m_due ) ); |
302 | emit dueDateChanged( m_due ); | 301 | emit dueDateChanged( m_due ); |
303 | } | 302 | } |
diff --git a/core/pim/todo/taskeditorstatus.h b/core/pim/todo/taskeditorstatus.h index 3544200..97129f0 100644 --- a/core/pim/todo/taskeditorstatus.h +++ b/core/pim/todo/taskeditorstatus.h | |||
@@ -1,100 +1,103 @@ | |||
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 | #ifndef TASKEDITORSTATUS_H | 29 | #ifndef TASKEDITORSTATUS_H |
30 | #define TASKEDITORSTATUS_H | 30 | #define TASKEDITORSTATUS_H |
31 | 31 | ||
32 | #include <opie2/opimtodo.h> | ||
33 | |||
32 | #include <qdatetime.h> | 34 | #include <qdatetime.h> |
33 | #include <qwidget.h> | 35 | #include <qwidget.h> |
34 | 36 | ||
35 | class DateBookMonth; | 37 | class DateBookMonth; |
36 | class OTodo; | ||
37 | class QCheckBox; | 38 | class QCheckBox; |
38 | class QComboBox; | 39 | class QComboBox; |
39 | class QLabel; | 40 | class QLabel; |
40 | class QPushButton; | 41 | class QPushButton; |
41 | class QToolButton; | 42 | class QToolButton; |
42 | 43 | ||
44 | using namespace Opie; | ||
45 | |||
43 | /** | 46 | /** |
44 | * This is the implementation of the Opie Task Editor Advanced tab | 47 | * This is the implementation of the Opie Task Editor Advanced tab |
45 | * it features the State! | 48 | * it features the State! |
46 | * MaintainerMode | 49 | * MaintainerMode |
47 | * Description | 50 | * Description |
48 | */ | 51 | */ |
49 | class TaskEditorStatus : public QWidget | 52 | class TaskEditorStatus : public QWidget |
50 | { | 53 | { |
51 | Q_OBJECT | 54 | Q_OBJECT |
52 | 55 | ||
53 | public: | 56 | public: |
54 | TaskEditorStatus( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 57 | TaskEditorStatus( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
55 | ~TaskEditorStatus(); | 58 | ~TaskEditorStatus(); |
56 | 59 | ||
57 | QComboBox *cmbStatus; | 60 | QComboBox *cmbStatus; |
58 | QLabel *txtMaintainer; | 61 | QLabel *txtMaintainer; |
59 | QToolButton *tbtMaintainer; | 62 | QToolButton *tbtMaintainer; |
60 | QComboBox *cmbMaintMode; | 63 | QComboBox *cmbMaintMode; |
61 | QCheckBox *ckbDue; | 64 | QCheckBox *ckbDue; |
62 | QPushButton *btnDue; | 65 | QPushButton *btnDue; |
63 | QCheckBox *ckbStart; | 66 | QCheckBox *ckbStart; |
64 | QPushButton *btnStart; | 67 | QPushButton *btnStart; |
65 | QCheckBox *ckbComp; | 68 | QCheckBox *ckbComp; |
66 | QPushButton *btnComp; | 69 | QPushButton *btnComp; |
67 | QComboBox *cmbProgress; | 70 | QComboBox *cmbProgress; |
68 | 71 | ||
69 | /* | 72 | /* |
70 | * I could have a struct which returns a QWidget* | 73 | * I could have a struct which returns a QWidget* |
71 | * load and save to a OTodo | 74 | * load and save to a OPimTodo |
72 | * and use multiple inheretence with all other widgets | 75 | * and use multiple inheretence with all other widgets |
73 | * and then simply iterate over the list of structs | 76 | * and then simply iterate over the list of structs |
74 | * this way I could easily have plugins for the whole editor.... | 77 | * this way I could easily have plugins for the whole editor.... |
75 | * but I do not do it -zecke | 78 | * but I do not do it -zecke |
76 | */ | 79 | */ |
77 | void load( const OTodo & ); | 80 | void load( const OPimTodo & ); |
78 | void save( OTodo & ); | 81 | void save( OPimTodo & ); |
79 | 82 | ||
80 | private: | 83 | private: |
81 | QDate m_start; | 84 | QDate m_start; |
82 | QDate m_comp; | 85 | QDate m_comp; |
83 | QDate m_due; | 86 | QDate m_due; |
84 | DateBookMonth *m_startBook; | 87 | DateBookMonth *m_startBook; |
85 | DateBookMonth *m_compBook; | 88 | DateBookMonth *m_compBook; |
86 | DateBookMonth *m_dueBook; | 89 | DateBookMonth *m_dueBook; |
87 | 90 | ||
88 | private slots: | 91 | private slots: |
89 | void slotStartChecked(); | 92 | void slotStartChecked(); |
90 | void slotCompChecked(); | 93 | void slotCompChecked(); |
91 | void slotDueChecked(); | 94 | void slotDueChecked(); |
92 | void slotStartChanged( int, int, int ); | 95 | void slotStartChanged( int, int, int ); |
93 | void slotCompChanged( int, int, int ); | 96 | void slotCompChanged( int, int, int ); |
94 | void slotDueChanged( int, int, int ); | 97 | void slotDueChanged( int, int, int ); |
95 | 98 | ||
96 | signals: | 99 | signals: |
97 | void dueDateChanged( const QDate& date ); | 100 | void dueDateChanged( const QDate& date ); |
98 | }; | 101 | }; |
99 | 102 | ||
100 | #endif // TASKEDITORSTATUS_H | 103 | #endif // TASKEDITORSTATUS_H |
diff --git a/core/pim/todo/templatedialogimpl.cpp b/core/pim/todo/templatedialogimpl.cpp index 63d8107..c9ad3d0 100644 --- a/core/pim/todo/templatedialogimpl.cpp +++ b/core/pim/todo/templatedialogimpl.cpp | |||
@@ -1,127 +1,127 @@ | |||
1 | #include <qlineedit.h> | 1 | #include <qlineedit.h> |
2 | 2 | ||
3 | #include "mainwindow.h" | 3 | #include "mainwindow.h" |
4 | #include "todoeditor.h" | 4 | #include "todoeditor.h" |
5 | #include "todotemplatemanager.h" | 5 | #include "todotemplatemanager.h" |
6 | #include "templatedialogimpl.h" | 6 | #include "templatedialogimpl.h" |
7 | 7 | ||
8 | 8 | ||
9 | using namespace Todo; | 9 | using namespace Todo; |
10 | 10 | ||
11 | /* TRANSLATOR Todo::TemplateDialogImpl */ | 11 | /* TRANSLATOR Todo::TemplateDialogImpl */ |
12 | 12 | ||
13 | namespace { | 13 | namespace { |
14 | class TemplateListItem : public QListViewItem { | 14 | class TemplateListItem : public QListViewItem { |
15 | public: | 15 | public: |
16 | TemplateListItem( QListView*, | 16 | TemplateListItem( QListView*, |
17 | const QString& name, | 17 | const QString& name, |
18 | const OTodo& ); | 18 | const OPimTodo& ); |
19 | ~TemplateListItem(); | 19 | ~TemplateListItem(); |
20 | 20 | ||
21 | OTodo event()const; | 21 | OPimTodo event()const; |
22 | QString text()const; | 22 | QString text()const; |
23 | void setText(const QString& str ); | 23 | void setText(const QString& str ); |
24 | void setEvent( const OTodo& ); | 24 | void setEvent( const OPimTodo& ); |
25 | private: | 25 | private: |
26 | QString m_name; | 26 | QString m_name; |
27 | OTodo m_ev; | 27 | OPimTodo m_ev; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | /* implementation */ | 30 | /* implementation */ |
31 | TemplateListItem::TemplateListItem( QListView* view, | 31 | TemplateListItem::TemplateListItem( QListView* view, |
32 | const QString& text, | 32 | const QString& text, |
33 | const OTodo& ev ) | 33 | const OPimTodo& ev ) |
34 | : QListViewItem( view ), m_name( text ), m_ev( ev ) | 34 | : QListViewItem( view ), m_name( text ), m_ev( ev ) |
35 | { | 35 | { |
36 | QListViewItem::setText(0, m_name ); | 36 | QListViewItem::setText(0, m_name ); |
37 | } | 37 | } |
38 | TemplateListItem::~TemplateListItem() {} | 38 | TemplateListItem::~TemplateListItem() {} |
39 | OTodo TemplateListItem::event() const { | 39 | OPimTodo TemplateListItem::event() const { |
40 | return m_ev; | 40 | return m_ev; |
41 | } | 41 | } |
42 | QString TemplateListItem::text()const { | 42 | QString TemplateListItem::text()const { |
43 | return m_name; | 43 | return m_name; |
44 | } | 44 | } |
45 | void TemplateListItem::setText( const QString& str ) { | 45 | void TemplateListItem::setText( const QString& str ) { |
46 | QListViewItem::setText(0, str ); | 46 | QListViewItem::setText(0, str ); |
47 | m_name = str; | 47 | m_name = str; |
48 | } | 48 | } |
49 | void TemplateListItem::setEvent( const OTodo& ev) { | 49 | void TemplateListItem::setEvent( const OPimTodo& ev) { |
50 | m_ev = ev; | 50 | m_ev = ev; |
51 | } | 51 | } |
52 | } | 52 | } |
53 | 53 | ||
54 | TemplateDialogImpl::TemplateDialogImpl( MainWindow* win, | 54 | TemplateDialogImpl::TemplateDialogImpl( MainWindow* win, |
55 | TemplateManager* man ) | 55 | TemplateManager* man ) |
56 | : TemplateDialog( win ), m_win( win), m_man( man ) | 56 | : TemplateDialog( win ), m_win( win), m_man( man ) |
57 | { | 57 | { |
58 | /* fill the listview */ | 58 | /* fill the listview */ |
59 | /* not the fastest way.... */ | 59 | /* not the fastest way.... */ |
60 | QStringList list = man->templates(); | 60 | QStringList list = man->templates(); |
61 | for (QStringList::Iterator it = list.begin(); | 61 | for (QStringList::Iterator it = list.begin(); |
62 | it != list.end(); ++it ) { | 62 | it != list.end(); ++it ) { |
63 | new TemplateListItem( listView(), (*it), man->templateEvent( (*it) ) ); | 63 | new TemplateListItem( listView(), (*it), man->templateEvent( (*it) ) ); |
64 | } | 64 | } |
65 | listView()->addColumn( QWidget::tr("Name") ); | 65 | listView()->addColumn( QWidget::tr("Name") ); |
66 | 66 | ||
67 | connect( listView(), SIGNAL(clicked(QListViewItem*) ), | 67 | connect( listView(), SIGNAL(clicked(QListViewItem*) ), |
68 | this, SLOT(slotClicked(QListViewItem*) ) ); | 68 | this, SLOT(slotClicked(QListViewItem*) ) ); |
69 | } | 69 | } |
70 | TemplateDialogImpl::~TemplateDialogImpl() { | 70 | TemplateDialogImpl::~TemplateDialogImpl() { |
71 | 71 | ||
72 | } | 72 | } |
73 | void TemplateDialogImpl::slotAdd() { | 73 | void TemplateDialogImpl::slotAdd() { |
74 | QString str = QWidget::tr("New Template %1").arg( listView()->childCount() ); | 74 | QString str = QWidget::tr("New Template %1").arg( listView()->childCount() ); |
75 | OTodo ev; | 75 | OPimTodo ev; |
76 | m_man->addEvent(str, ev); | 76 | m_man->addEvent(str, ev); |
77 | new TemplateListItem( listView(), str, ev ); | 77 | new TemplateListItem( listView(), str, ev ); |
78 | } | 78 | } |
79 | void TemplateDialogImpl::slotRemove() { | 79 | void TemplateDialogImpl::slotRemove() { |
80 | if (!listView()->currentItem() ) | 80 | if (!listView()->currentItem() ) |
81 | return; | 81 | return; |
82 | 82 | ||
83 | TemplateListItem* item = static_cast<TemplateListItem*>( listView()->currentItem() ); | 83 | TemplateListItem* item = static_cast<TemplateListItem*>( listView()->currentItem() ); |
84 | listView()->takeItem( item ); | 84 | listView()->takeItem( item ); |
85 | 85 | ||
86 | m_man->removeEvent( item->text() ); | 86 | m_man->removeEvent( item->text() ); |
87 | 87 | ||
88 | delete item; | 88 | delete item; |
89 | } | 89 | } |
90 | void TemplateDialogImpl::slotEdit() { | 90 | void TemplateDialogImpl::slotEdit() { |
91 | if ( !listView()->currentItem() ) | 91 | if ( !listView()->currentItem() ) |
92 | return; | 92 | return; |
93 | 93 | ||
94 | TemplateListItem* item = static_cast<TemplateListItem*>( listView()->currentItem() ); | 94 | TemplateListItem* item = static_cast<TemplateListItem*>( listView()->currentItem() ); |
95 | OTodo ev = m_win->currentEditor()->edit( m_win, item->event() ); | 95 | OPimTodo ev = m_win->currentEditor()->edit( m_win, item->event() ); |
96 | if ( m_win->currentEditor()->accepted() ) { | 96 | if ( m_win->currentEditor()->accepted() ) { |
97 | item->setEvent( ev ); | 97 | item->setEvent( ev ); |
98 | m_man->removeEvent( item->text() ); | 98 | m_man->removeEvent( item->text() ); |
99 | m_man->addEvent( item->text(), ev ); | 99 | m_man->addEvent( item->text(), ev ); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | /* | 102 | /* |
103 | * we need to update | 103 | * we need to update |
104 | * the text | 104 | * the text |
105 | */ | 105 | */ |
106 | 106 | ||
107 | void TemplateDialogImpl::slotReturn() { | 107 | void TemplateDialogImpl::slotReturn() { |
108 | if ( !listView()->currentItem() ) | 108 | if ( !listView()->currentItem() ) |
109 | return; | 109 | return; |
110 | 110 | ||
111 | TemplateListItem* tbl = static_cast<TemplateListItem*>( listView()->currentItem() ); | 111 | TemplateListItem* tbl = static_cast<TemplateListItem*>( listView()->currentItem() ); |
112 | 112 | ||
113 | if (tbl->text() != edit()->text() ) { | 113 | if (tbl->text() != edit()->text() ) { |
114 | m_man->removeEvent( tbl->text() ); | 114 | m_man->removeEvent( tbl->text() ); |
115 | tbl->setText( edit()->text() ); | 115 | tbl->setText( edit()->text() ); |
116 | m_man->addEvent( tbl->text(), tbl->event() ); | 116 | m_man->addEvent( tbl->text(), tbl->event() ); |
117 | } | 117 | } |
118 | } | 118 | } |
119 | /* update the lineedit when changing */ | 119 | /* update the lineedit when changing */ |
120 | void TemplateDialogImpl::slotClicked( QListViewItem* item) { | 120 | void TemplateDialogImpl::slotClicked( QListViewItem* item) { |
121 | if (!item) | 121 | if (!item) |
122 | return; | 122 | return; |
123 | 123 | ||
124 | TemplateListItem* tbl = static_cast<TemplateListItem*>(item); | 124 | TemplateListItem* tbl = static_cast<TemplateListItem*>(item); |
125 | edit()->setText( tbl->text() ); | 125 | edit()->setText( tbl->text() ); |
126 | } | 126 | } |
127 | 127 | ||
diff --git a/core/pim/todo/templatedialogimpl.h b/core/pim/todo/templatedialogimpl.h index f366c9e..cc78521 100644 --- a/core/pim/todo/templatedialogimpl.h +++ b/core/pim/todo/templatedialogimpl.h | |||
@@ -1,33 +1,33 @@ | |||
1 | #ifndef OPIE_TEMPLATE_DIALOG_IMPL_H | 1 | #ifndef OPIE_TEMPLATE_DIALOG_IMPL_H |
2 | #define OPIE_TEMPLATE_DIALOG_IMPL_H | 2 | #define OPIE_TEMPLATE_DIALOG_IMPL_H |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | 5 | ||
6 | #include <opie/otodo.h> | 6 | #include <opie2/opimtodo.h> |
7 | 7 | ||
8 | #include "templatedialog.h" | 8 | #include "templatedialog.h" |
9 | 9 | ||
10 | 10 | ||
11 | namespace Todo { | 11 | namespace Todo { |
12 | 12 | ||
13 | class MainWindow; | 13 | class MainWindow; |
14 | class TemplateManager; | 14 | class TemplateManager; |
15 | class TemplateDialogImpl : public Todo::TemplateDialog { | 15 | class TemplateDialogImpl : public Todo::TemplateDialog { |
16 | Q_OBJECT | 16 | Q_OBJECT |
17 | public: | 17 | public: |
18 | TemplateDialogImpl( MainWindow* win, TemplateManager* ); | 18 | TemplateDialogImpl( MainWindow* win, TemplateManager* ); |
19 | ~TemplateDialogImpl(); | 19 | ~TemplateDialogImpl(); |
20 | 20 | ||
21 | private: | 21 | private: |
22 | MainWindow* m_win; | 22 | MainWindow* m_win; |
23 | TemplateManager* m_man; | 23 | TemplateManager* m_man; |
24 | private slots: | 24 | private slots: |
25 | void slotAdd(); | 25 | void slotAdd(); |
26 | void slotRemove(); | 26 | void slotRemove(); |
27 | void slotEdit(); | 27 | void slotEdit(); |
28 | void slotReturn(); | 28 | void slotReturn(); |
29 | void slotClicked(QListViewItem*); | 29 | void slotClicked(QListViewItem*); |
30 | }; | 30 | }; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | #endif | 33 | #endif |
diff --git a/core/pim/todo/textviewshow.cpp b/core/pim/todo/textviewshow.cpp index 35ea74b..01e5810 100644 --- a/core/pim/todo/textviewshow.cpp +++ b/core/pim/todo/textviewshow.cpp | |||
@@ -1,48 +1,48 @@ | |||
1 | #include "textviewshow.h" | 1 | #include "textviewshow.h" |
2 | 2 | ||
3 | using namespace Todo; | 3 | using namespace Todo; |
4 | 4 | ||
5 | TextViewShow::TextViewShow( QWidget* parent, MainWindow* win) | 5 | TextViewShow::TextViewShow( QWidget* parent, MainWindow* win) |
6 | : QTextView( parent ), TodoShow(win) { | 6 | : QTextView( parent ), TodoShow(win) { |
7 | 7 | ||
8 | } | 8 | } |
9 | TextViewShow::~TextViewShow() { | 9 | TextViewShow::~TextViewShow() { |
10 | } | 10 | } |
11 | QString TextViewShow::type()const { | 11 | QString TextViewShow::type()const { |
12 | return QString::fromLatin1("TextViewShow"); | 12 | return QString::fromLatin1("TextViewShow"); |
13 | } | 13 | } |
14 | void TextViewShow::slotShow( const OTodo& ev ) { | 14 | void TextViewShow::slotShow( const OPimTodo& ev ) { |
15 | setText( ev.toRichText() ); | 15 | setText( ev.toRichText() ); |
16 | } | 16 | } |
17 | QWidget* TextViewShow::widget() { | 17 | QWidget* TextViewShow::widget() { |
18 | return this; | 18 | return this; |
19 | } | 19 | } |
20 | void TextViewShow::keyPressEvent( QKeyEvent* event ) { | 20 | void TextViewShow::keyPressEvent( QKeyEvent* event ) { |
21 | switch( event->key() ) { | 21 | switch( event->key() ) { |
22 | case Qt::Key_Up: | 22 | case Qt::Key_Up: |
23 | if ( ( visibleHeight() < contentsHeight() ) && | 23 | if ( ( visibleHeight() < contentsHeight() ) && |
24 | ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) ) | 24 | ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) ) |
25 | scrollBy( 0, -(visibleHeight()-20) ); | 25 | scrollBy( 0, -(visibleHeight()-20) ); |
26 | else | 26 | else |
27 | showPrev(); | 27 | showPrev(); |
28 | break; | 28 | break; |
29 | case Qt::Key_Down: | 29 | case Qt::Key_Down: |
30 | if ( ( visibleHeight() < contentsHeight() ) && | 30 | if ( ( visibleHeight() < contentsHeight() ) && |
31 | ( verticalScrollBar()->value() < verticalScrollBar()->maxValue() ) ) | 31 | ( verticalScrollBar()->value() < verticalScrollBar()->maxValue() ) ) |
32 | scrollBy( 0, visibleHeight()-20 ); | 32 | scrollBy( 0, visibleHeight()-20 ); |
33 | else | 33 | else |
34 | showNext(); | 34 | showNext(); |
35 | break; | 35 | break; |
36 | case Qt::Key_Left: | 36 | case Qt::Key_Left: |
37 | case Qt::Key_Right: | 37 | case Qt::Key_Right: |
38 | case Qt::Key_F33: | 38 | case Qt::Key_F33: |
39 | case Qt::Key_Enter: | 39 | case Qt::Key_Enter: |
40 | case Qt::Key_Return: | 40 | case Qt::Key_Return: |
41 | case Qt::Key_Space: | 41 | case Qt::Key_Space: |
42 | escapeView(); | 42 | escapeView(); |
43 | break; | 43 | break; |
44 | default: | 44 | default: |
45 | QTextView::keyPressEvent( event ); | 45 | QTextView::keyPressEvent( event ); |
46 | break; | 46 | break; |
47 | } | 47 | } |
48 | } | 48 | } |
diff --git a/core/pim/todo/textviewshow.h b/core/pim/todo/textviewshow.h index 498de81..cc31522 100644 --- a/core/pim/todo/textviewshow.h +++ b/core/pim/todo/textviewshow.h | |||
@@ -1,20 +1,20 @@ | |||
1 | #include <qtextview.h> | 1 | #include <qtextview.h> |
2 | 2 | ||
3 | #include "todoshow.h" | 3 | #include "todoshow.h" |
4 | 4 | ||
5 | namespace Todo { | 5 | namespace Todo { |
6 | 6 | ||
7 | class TextViewShow : public QTextView, public TodoShow { | 7 | class TextViewShow : public QTextView, public TodoShow { |
8 | public: | 8 | public: |
9 | TextViewShow( QWidget* parent, MainWindow* ); | 9 | TextViewShow( QWidget* parent, MainWindow* ); |
10 | ~TextViewShow(); | 10 | ~TextViewShow(); |
11 | 11 | ||
12 | QString type()const; | 12 | QString type()const; |
13 | void slotShow( const OTodo& ev ); | 13 | void slotShow( const OPimTodo& ev ); |
14 | QWidget* widget(); | 14 | QWidget* widget(); |
15 | 15 | ||
16 | protected: | 16 | protected: |
17 | void keyPressEvent( QKeyEvent* ); | 17 | void keyPressEvent( QKeyEvent* ); |
18 | 18 | ||
19 | }; | 19 | }; |
20 | }; | 20 | }; |
diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro index 51cfde7..9267082 100644 --- a/core/pim/todo/todo.pro +++ b/core/pim/todo/todo.pro | |||
@@ -1,49 +1,49 @@ | |||
1 | #TEMPLATE= app | 1 | #TEMPLATE= app |
2 | CONFIG = qt warn_on release quick-app | 2 | CONFIG = qt warn_on release quick-app |
3 | #DESTDIR = $(OPIEDIR)/bin | 3 | #DESTDIR = $(OPIEDIR)/bin |
4 | 4 | ||
5 | HEADERS= smalltodo.h \ | 5 | HEADERS= smalltodo.h \ |
6 | todomanager.h \ | 6 | todomanager.h \ |
7 | mainwindow.h \ | 7 | mainwindow.h \ |
8 | todoview.h \ | 8 | todoview.h \ |
9 | tableview.h \ | 9 | tableview.h \ |
10 | todotemplatemanager.h \ | 10 | todotemplatemanager.h \ |
11 | todoeditor.h \ | 11 | todoeditor.h \ |
12 | todoshow.h \ | 12 | todoshow.h \ |
13 | textviewshow.h \ | 13 | textviewshow.h \ |
14 | templateeditor.h \ | 14 | templateeditor.h \ |
15 | templatedialog.h \ | 15 | templatedialog.h \ |
16 | templatedialogimpl.h \ | 16 | templatedialogimpl.h \ |
17 | quickedit.h \ | 17 | quickedit.h \ |
18 | quickeditimpl.h \ | 18 | quickeditimpl.h \ |
19 | otaskeditor.h \ | 19 | otaskeditor.h \ |
20 | taskeditoroverview.h \ | 20 | taskeditoroverview.h \ |
21 | taskeditorstatus.h \ | 21 | taskeditorstatus.h \ |
22 | taskeditoralarms.h | 22 | taskeditoralarms.h |
23 | 23 | ||
24 | SOURCES= smalltodo.cpp \ | 24 | SOURCES= smalltodo.cpp \ |
25 | todomanager.cpp \ | 25 | todomanager.cpp \ |
26 | mainwindow.cpp \ | 26 | mainwindow.cpp \ |
27 | # main.cpp \ | 27 | # main.cpp \ |
28 | tableview.cpp \ | 28 | tableview.cpp \ |
29 | todoview.cpp \ | 29 | todoview.cpp \ |
30 | todotemplatemanager.cpp \ | 30 | todotemplatemanager.cpp \ |
31 | todoeditor.cpp \ | 31 | todoeditor.cpp \ |
32 | todoshow.cpp \ | 32 | todoshow.cpp \ |
33 | textviewshow.cpp \ | 33 | textviewshow.cpp \ |
34 | templateeditor.cpp \ | 34 | templateeditor.cpp \ |
35 | templatedialog.cpp \ | 35 | templatedialog.cpp \ |
36 | templatedialogimpl.cpp \ | 36 | templatedialogimpl.cpp \ |
37 | quickeditimpl.cpp \ | 37 | quickeditimpl.cpp \ |
38 | quickedit.cpp \ | 38 | quickedit.cpp \ |
39 | otaskeditor.cpp \ | 39 | otaskeditor.cpp \ |
40 | taskeditoroverview.cpp \ | 40 | taskeditoroverview.cpp \ |
41 | taskeditorstatus.cpp \ | 41 | taskeditorstatus.cpp \ |
42 | taskeditoralarms.cpp | 42 | taskeditoralarms.cpp |
43 | 43 | ||
44 | TARGET = todolist | 44 | TARGET = todolist |
45 | INCLUDEPATH += $(OPIEDIR)/include | 45 | INCLUDEPATH += $(OPIEDIR)/include |
46 | DEPENDPATH+= $(OPIEDIR)/include | 46 | DEPENDPATH+= $(OPIEDIR)/include |
47 | LIBS += -lqpe -lopie | 47 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiepim2 |
48 | 48 | ||
49 | include ( $(OPIEDIR)/include.pro ) | 49 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/pim/todo/todoedit.h b/core/pim/todo/todoedit.h index 02800ca..4e89e93 100644 --- a/core/pim/todo/todoedit.h +++ b/core/pim/todo/todoedit.h | |||
@@ -1,17 +1,17 @@ | |||
1 | #ifndef OPIE_TODO_EDIT_H | 1 | #ifndef OPIE_TODO_EDIT_H |
2 | #define OPIE_TODO_EDIT_H | 2 | #define OPIE_TODO_EDIT_H |
3 | 3 | ||
4 | #include <opie/otodo.h> | 4 | #include <opie2/opimtodo.h> |
5 | 5 | ||
6 | namespace Todo { | 6 | namespace Todo { |
7 | class Edit { | 7 | class Edit { |
8 | public: | 8 | public: |
9 | Edit(); | 9 | Edit(); |
10 | virtual ~Edit(); | 10 | virtual ~Edit(); |
11 | 11 | ||
12 | ToDoEvent newEvent( const OTodo& ) = 0; | 12 | ToDoEvent newEvent( const OPimTodo& ) = 0; |
13 | ToDoEvent editEvent( const OTodo& ) = 0; | 13 | ToDoEvent editEvent( const OPimTodo& ) = 0; |
14 | }; | 14 | }; |
15 | }; | 15 | }; |
16 | 16 | ||
17 | #endif | 17 | #endif |
diff --git a/core/pim/todo/todoeditor.cpp b/core/pim/todo/todoeditor.cpp index 78aedd6..879d809 100644 --- a/core/pim/todo/todoeditor.cpp +++ b/core/pim/todo/todoeditor.cpp | |||
@@ -1,62 +1,62 @@ | |||
1 | 1 | ||
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | 3 | ||
4 | #include "otaskeditor.h" | 4 | #include "otaskeditor.h" |
5 | #include "todoeditor.h" | 5 | #include "todoeditor.h" |
6 | 6 | ||
7 | using namespace Todo; | 7 | using namespace Todo; |
8 | 8 | ||
9 | Editor::Editor() { | 9 | Editor::Editor() { |
10 | m_accepted = false; | 10 | m_accepted = false; |
11 | m_self = 0l; | 11 | m_self = 0l; |
12 | } | 12 | } |
13 | Editor::~Editor() { | 13 | Editor::~Editor() { |
14 | delete m_self; | 14 | delete m_self; |
15 | m_self = 0; | 15 | m_self = 0; |
16 | } | 16 | } |
17 | OTodo Editor::newTodo( int cur, | 17 | OPimTodo Editor::newTodo( int cur, |
18 | QWidget*) { | 18 | QWidget*) { |
19 | 19 | ||
20 | OTaskEditor *e = self(); | 20 | OTaskEditor *e = self(); |
21 | e->setCaption( QObject::tr("Enter Task") ); | 21 | e->setCaption( QObject::tr("Enter Task") ); |
22 | e->init( cur ); | 22 | e->init( cur ); |
23 | 23 | ||
24 | int ret = QPEApplication::execDialog( e ); | 24 | int ret = QPEApplication::execDialog( e ); |
25 | 25 | ||
26 | if ( QDialog::Accepted == ret ) { | 26 | if ( QDialog::Accepted == ret ) { |
27 | m_accepted = true; | 27 | m_accepted = true; |
28 | }else | 28 | }else |
29 | m_accepted = false; | 29 | m_accepted = false; |
30 | 30 | ||
31 | OTodo ev = e->todo(); | 31 | OPimTodo ev = e->todo(); |
32 | qWarning("Todo uid"); | 32 | qWarning("Todo uid"); |
33 | qWarning("Todo %s %d %d", ev.summary().latin1(), ev.progress(), ev.isCompleted() ); | 33 | qWarning("Todo %s %d %d", ev.summary().latin1(), ev.progress(), ev.isCompleted() ); |
34 | ev.setUid(1); | 34 | ev.setUid(1); |
35 | 35 | ||
36 | return ev; | 36 | return ev; |
37 | } | 37 | } |
38 | OTodo Editor::edit( QWidget *, | 38 | OPimTodo Editor::edit( QWidget *, |
39 | const OTodo& todo ) { | 39 | const OPimTodo& todo ) { |
40 | OTaskEditor *e = self(); | 40 | OTaskEditor *e = self(); |
41 | e->init( todo ); | 41 | e->init( todo ); |
42 | e->setCaption( QObject::tr( "Edit Task" ) ); | 42 | e->setCaption( QObject::tr( "Edit Task" ) ); |
43 | 43 | ||
44 | int ret = QPEApplication::execDialog( e ); | 44 | int ret = QPEApplication::execDialog( e ); |
45 | 45 | ||
46 | OTodo ev = e->todo(); | 46 | OPimTodo ev = e->todo(); |
47 | if ( ret == QDialog::Accepted ) | 47 | if ( ret == QDialog::Accepted ) |
48 | m_accepted = true; | 48 | m_accepted = true; |
49 | else | 49 | else |
50 | m_accepted = false; | 50 | m_accepted = false; |
51 | 51 | ||
52 | return ev; | 52 | return ev; |
53 | } | 53 | } |
54 | bool Editor::accepted()const { | 54 | bool Editor::accepted()const { |
55 | return m_accepted; | 55 | return m_accepted; |
56 | } | 56 | } |
57 | OTaskEditor* Editor::self() { | 57 | OTaskEditor* Editor::self() { |
58 | if (!m_self ) | 58 | if (!m_self ) |
59 | m_self = new OTaskEditor(0); | 59 | m_self = new OTaskEditor(0); |
60 | 60 | ||
61 | return m_self; | 61 | return m_self; |
62 | } | 62 | } |
diff --git a/core/pim/todo/todoeditor.h b/core/pim/todo/todoeditor.h index fe30634..bcfd205 100644 --- a/core/pim/todo/todoeditor.h +++ b/core/pim/todo/todoeditor.h | |||
@@ -1,29 +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 <opie2/opimtodo.h> |
5 | 5 | ||
6 | 6 | ||
7 | class OTaskEditor; | 7 | class OTaskEditor; |
8 | namespace Todo { | 8 | namespace Todo { |
9 | class Editor { | 9 | class Editor { |
10 | public: | 10 | public: |
11 | Editor(); | 11 | Editor(); |
12 | ~Editor(); | 12 | ~Editor(); |
13 | 13 | ||
14 | OTodo newTodo( int currentCatId, | 14 | OPimTodo newTodo( int currentCatId, |
15 | QWidget* par ); | 15 | QWidget* par ); |
16 | OTodo edit( QWidget* par, | 16 | OPimTodo edit( QWidget* par, |
17 | const OTodo& ev = OTodo() ); | 17 | const OPimTodo& ev = OPimTodo() ); |
18 | 18 | ||
19 | 19 | ||
20 | bool accepted()const; | 20 | bool accepted()const; |
21 | protected: | 21 | protected: |
22 | OTaskEditor* self(); | 22 | OTaskEditor* self(); |
23 | private: | 23 | private: |
24 | bool m_accepted: 1; | 24 | bool m_accepted: 1; |
25 | OTaskEditor* m_self; | 25 | OTaskEditor* m_self; |
26 | }; | 26 | }; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | #endif | 29 | #endif |
diff --git a/core/pim/todo/todomanager.cpp b/core/pim/todo/todomanager.cpp index 501cca7..21e1d0c 100644 --- a/core/pim/todo/todomanager.cpp +++ b/core/pim/todo/todomanager.cpp | |||
@@ -1,127 +1,127 @@ | |||
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 | -_. . . )=. = 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 | #include <qpe/categoryselect.h> | 28 | #include <qpe/categoryselect.h> |
29 | 29 | ||
30 | #include "todomanager.h" | 30 | #include "todomanager.h" |
31 | 31 | ||
32 | using namespace Todo; | 32 | using namespace Todo; |
33 | 33 | ||
34 | TodoManager::TodoManager( QObject *obj ) | 34 | TodoManager::TodoManager( QObject *obj ) |
35 | : QObject( obj ) { | 35 | : QObject( obj ) { |
36 | m_db = 0l; | 36 | m_db = 0l; |
37 | QTime time; | 37 | QTime time; |
38 | time.start(); | 38 | time.start(); |
39 | int el = time.elapsed(); | 39 | int el = time.elapsed(); |
40 | qWarning("QTimer for loading %d", el/1000 ); | 40 | qWarning("QTimer for loading %d", el/1000 ); |
41 | } | 41 | } |
42 | TodoManager::~TodoManager() { | 42 | TodoManager::~TodoManager() { |
43 | delete m_db; | 43 | delete m_db; |
44 | } | 44 | } |
45 | OTodo TodoManager::event(int uid ) { | 45 | OPimTodo TodoManager::event(int uid ) { |
46 | return m_db->find( uid ); | 46 | return m_db->find( uid ); |
47 | } | 47 | } |
48 | void TodoManager::updateList() { | 48 | void TodoManager::updateList() { |
49 | qWarning("update list"); | 49 | qWarning("update list"); |
50 | m_list = m_db->allRecords(); | 50 | m_list = m_db->allRecords(); |
51 | } | 51 | } |
52 | OTodoAccess::List TodoManager::list() const{ | 52 | OPimTodoAccess::List TodoManager::list() const{ |
53 | return m_list; | 53 | return m_list; |
54 | } | 54 | } |
55 | OTodoAccess::List TodoManager::sorted( bool asc, int so, int f, int cat ) { | 55 | OPimTodoAccess::List TodoManager::sorted( bool asc, int so, int f, int cat ) { |
56 | return m_db->sorted( asc, so, f, cat ); | 56 | return m_db->sorted( asc, so, f, cat ); |
57 | } | 57 | } |
58 | OTodoAccess::List::Iterator TodoManager::overDue() { | 58 | OPimTodoAccess::List::Iterator TodoManager::overDue() { |
59 | int filter = 2 | 1; | 59 | int filter = 2 | 1; |
60 | m_list = m_db->sorted(m_asc, m_sortOrder, filter, m_ca ); | 60 | m_list = m_db->sorted(m_asc, m_sortOrder, filter, m_ca ); |
61 | m_it = m_list.begin(); | 61 | m_it = m_list.begin(); |
62 | return m_it; | 62 | return m_it; |
63 | } | 63 | } |
64 | OTodoAccess::List::Iterator TodoManager::fromTo( const QDate& start, | 64 | OPimTodoAccess::List::Iterator TodoManager::fromTo( const QDate& start, |
65 | const QDate& end ) { | 65 | const QDate& end ) { |
66 | m_list = m_db->effectiveToDos( start, end ); | 66 | m_list = m_db->effectiveToDos( start, end ); |
67 | m_it = m_list.begin(); | 67 | m_it = m_list.begin(); |
68 | return m_it; | 68 | return m_it; |
69 | } | 69 | } |
70 | OTodoAccess::List::Iterator TodoManager::query( const OTodo& ev, int query ) { | 70 | OPimTodoAccess::List::Iterator TodoManager::query( const OPimTodo& ev, int query ) { |
71 | m_list = m_db->queryByExample( ev, query ); | 71 | m_list = m_db->queryByExample( ev, query ); |
72 | m_it = m_list.begin(); | 72 | m_it = m_list.begin(); |
73 | return m_it; | 73 | return m_it; |
74 | } | 74 | } |
75 | OTodoAccess* TodoManager::todoDB() { | 75 | OPimTodoAccess* TodoManager::todoDB() { |
76 | return m_db; | 76 | return m_db; |
77 | } | 77 | } |
78 | void TodoManager::add( const OTodo& ev ) { | 78 | void TodoManager::add( const OPimTodo& ev ) { |
79 | m_db->add( ev ); | 79 | m_db->add( ev ); |
80 | } | 80 | } |
81 | void TodoManager::update( int, const SmallTodo& ) { | 81 | void TodoManager::update( int, const SmallTodo& ) { |
82 | 82 | ||
83 | } | 83 | } |
84 | void TodoManager::update( int, const OTodo& ev) { | 84 | void TodoManager::update( int, const OPimTodo& ev) { |
85 | m_db->replace( ev ); | 85 | m_db->replace( ev ); |
86 | } | 86 | } |
87 | bool TodoManager::remove( int uid ) { | 87 | bool TodoManager::remove( int uid ) { |
88 | return m_db->remove( uid ); | 88 | return m_db->remove( uid ); |
89 | } | 89 | } |
90 | void TodoManager::removeAll() { | 90 | void TodoManager::removeAll() { |
91 | m_db->clear(); | 91 | m_db->clear(); |
92 | } | 92 | } |
93 | void TodoManager::removeCompleted() { | 93 | void TodoManager::removeCompleted() { |
94 | m_db->removeAllCompleted(); | 94 | m_db->removeAllCompleted(); |
95 | } | 95 | } |
96 | void TodoManager::save() { | 96 | void TodoManager::save() { |
97 | m_db->save(); | 97 | m_db->save(); |
98 | } | 98 | } |
99 | bool TodoManager::saveAll() { | 99 | bool TodoManager::saveAll() { |
100 | return m_db->save(); | 100 | return m_db->save(); |
101 | } | 101 | } |
102 | void TodoManager::reload() { | 102 | void TodoManager::reload() { |
103 | m_db->reload(); | 103 | m_db->reload(); |
104 | } | 104 | } |
105 | QStringList TodoManager::categories() { | 105 | QStringList TodoManager::categories() { |
106 | m_cat.load(categoryFileName() ); | 106 | m_cat.load(categoryFileName() ); |
107 | return m_cat.labels( "Todo List"); | 107 | return m_cat.labels( "Todo List"); |
108 | } | 108 | } |
109 | /* | 109 | /* |
110 | * we rely on load beeing called from populateCategories | 110 | * we rely on load beeing called from populateCategories |
111 | */ | 111 | */ |
112 | int TodoManager::catId( const QString& cats ) { | 112 | int TodoManager::catId( const QString& cats ) { |
113 | return m_cat.id( "Todo List", cats ); | 113 | return m_cat.id( "Todo List", cats ); |
114 | } | 114 | } |
115 | void TodoManager::remove( const QArray<int>& ids) { | 115 | void TodoManager::remove( const QArray<int>& ids) { |
116 | for (uint i=0; i < ids.size(); i++ ) | 116 | for (uint i=0; i < ids.size(); i++ ) |
117 | remove( ids[i] ); | 117 | remove( ids[i] ); |
118 | } | 118 | } |
119 | bool TodoManager::isLoaded()const { | 119 | bool TodoManager::isLoaded()const { |
120 | return (m_db == 0 ); | 120 | return (m_db == 0 ); |
121 | } | 121 | } |
122 | void TodoManager::load() { | 122 | void TodoManager::load() { |
123 | if (!m_db) { | 123 | if (!m_db) { |
124 | m_db = new OTodoAccess(); | 124 | m_db = new OPimTodoAccess(); |
125 | m_db->load(); | 125 | m_db->load(); |
126 | } | 126 | } |
127 | } | 127 | } |
diff --git a/core/pim/todo/todomanager.h b/core/pim/todo/todomanager.h index 8544277..865b47b 100644 --- a/core/pim/todo/todomanager.h +++ b/core/pim/todo/todomanager.h | |||
@@ -1,111 +1,113 @@ | |||
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 | -_. . . )=. = 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 OPIE_TODO_MANAGER_H | 29 | #ifndef OPIE_TODO_MANAGER_H |
30 | #define OPIE_TODO_MANAGER_H | 30 | #define OPIE_TODO_MANAGER_H |
31 | 31 | ||
32 | #include <qarray.h> | 32 | #include <opie2/opimtodo.h> |
33 | #include <qobject.h> | 33 | #include <opie2/otodoaccess.h> |
34 | #include <qstring.h> | ||
35 | 34 | ||
36 | #include <qpe/categories.h> | 35 | #include <qpe/categories.h> |
37 | 36 | ||
38 | #include <opie/otodo.h> | 37 | #include <qarray.h> |
39 | #include <opie/otodoaccess.h> | 38 | #include <qobject.h> |
39 | #include <qstring.h> | ||
40 | 40 | ||
41 | #include "smalltodo.h" | 41 | #include "smalltodo.h" |
42 | 42 | ||
43 | using Opie::OPimTodo; | ||
44 | using Opie::OPimTodoAccess; | ||
43 | 45 | ||
44 | namespace Todo { | 46 | namespace Todo { |
45 | class TodoManager : public QObject{ | 47 | class TodoManager : public QObject{ |
46 | Q_OBJECT | 48 | Q_OBJECT |
47 | public: | 49 | public: |
48 | bool isLoaded()const; | 50 | bool isLoaded()const; |
49 | void load(); | 51 | void load(); |
50 | TodoManager(QObject* obj = 0); | 52 | TodoManager(QObject* obj = 0); |
51 | ~TodoManager(); | 53 | ~TodoManager(); |
52 | 54 | ||
53 | QStringList categories()/*const*/; | 55 | QStringList categories()/*const*/; |
54 | int catId(const QString&); | 56 | int catId(const QString&); |
55 | OTodo event(int uid ); | 57 | OPimTodo event(int uid ); |
56 | 58 | ||
57 | void updateList(); | 59 | void updateList(); |
58 | /** returns the iterator sorted if set sorted*/ | 60 | /** returns the iterator sorted if set sorted*/ |
59 | OTodoAccess::List list()const; | 61 | OPimTodoAccess::List list()const; |
60 | OTodoAccess::List sorted( bool asc, int so, int f, int cat ); | 62 | OPimTodoAccess::List sorted( bool asc, int so, int f, int cat ); |
61 | 63 | ||
62 | OTodoAccess::List::Iterator overDue(); | 64 | OPimTodoAccess::List::Iterator overDue(); |
63 | OTodoAccess::List::Iterator fromTo( const QDate& start, | 65 | OPimTodoAccess::List::Iterator fromTo( const QDate& start, |
64 | const QDate& end ); | 66 | const QDate& end ); |
65 | OTodoAccess::List::Iterator query( const OTodo& ev, int query ); | 67 | OPimTodoAccess::List::Iterator query( const OPimTodo& ev, int query ); |
66 | 68 | ||
67 | void setCategory( bool sort, int category = -1); | 69 | void setCategory( bool sort, int category = -1); |
68 | void setShowOverDue( bool show ); | 70 | void setShowOverDue( bool show ); |
69 | void setSortOrder( int sortOrder ); | 71 | void setSortOrder( int sortOrder ); |
70 | void setSortASC( bool ); | 72 | void setSortASC( bool ); |
71 | void sort(); | 73 | void sort(); |
72 | 74 | ||
73 | OTodoAccess* todoDB(); | 75 | OPimTodoAccess* todoDB(); |
74 | bool saveAll(); | 76 | bool saveAll(); |
75 | 77 | ||
76 | 78 | ||
77 | signals: | 79 | signals: |
78 | void update(); | 80 | void update(); |
79 | void updateCategories(); | 81 | void updateCategories(); |
80 | 82 | ||
81 | public slots: | 83 | public slots: |
82 | void add( const OTodo& ); | 84 | void add( const OPimTodo& ); |
83 | void update( int uid, const SmallTodo& ); | 85 | void update( int uid, const SmallTodo& ); |
84 | void update( int uid, const OTodo& ); | 86 | void update( int uid, const OPimTodo& ); |
85 | bool remove( int uid ); | 87 | bool remove( int uid ); |
86 | void remove( const QArray<int>& ); | 88 | void remove( const QArray<int>& ); |
87 | 89 | ||
88 | /** | 90 | /** |
89 | * remove all completed | 91 | * remove all completed |
90 | */ | 92 | */ |
91 | void removeCompleted(); | 93 | void removeCompleted(); |
92 | void removeAll(); | 94 | void removeAll(); |
93 | void reload(); | 95 | void reload(); |
94 | void save(); | 96 | void save(); |
95 | 97 | ||
96 | private: | 98 | private: |
97 | OTodoAccess* m_db; | 99 | OPimTodoAccess* m_db; |
98 | OTodoAccess::List m_list; | 100 | OPimTodoAccess::List m_list; |
99 | OTodoAccess::List::Iterator m_it; | 101 | OPimTodoAccess::List::Iterator m_it; |
100 | OTodoAccess::List m_sorted; | 102 | OPimTodoAccess::List m_sorted; |
101 | Categories m_cat; | 103 | Categories m_cat; |
102 | int m_ca; | 104 | int m_ca; |
103 | /* sort cat */ | 105 | /* sort cat */ |
104 | bool m_shCat; | 106 | bool m_shCat; |
105 | int m_sortOrder; | 107 | int m_sortOrder; |
106 | bool m_asc; | 108 | bool m_asc; |
107 | 109 | ||
108 | }; | 110 | }; |
109 | }; | 111 | }; |
110 | 112 | ||
111 | #endif | 113 | #endif |
diff --git a/core/pim/todo/todoshow.h b/core/pim/todo/todoshow.h index 2babe93..1eeadf8 100644 --- a/core/pim/todo/todoshow.h +++ b/core/pim/todo/todoshow.h | |||
@@ -1,60 +1,62 @@ | |||
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 | -_. . . )=. = 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 | #ifndef TODO_TODO_SHOW_H | 28 | #ifndef TODO_TODO_SHOW_H |
29 | #define TODO_TODO_SHOW_H | 29 | #define TODO_TODO_SHOW_H |
30 | 30 | ||
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qwidget.h> | 32 | #include <qwidget.h> |
33 | 33 | ||
34 | #include <opie/otodo.h> | 34 | #include <opie2/opimtodo.h> |
35 | |||
36 | using Opie::OPimTodo; | ||
35 | 37 | ||
36 | namespace Todo { | 38 | namespace Todo { |
37 | class MainWindow; | 39 | class MainWindow; |
38 | /** | 40 | /** |
39 | * TodoShow is the baseclass of | 41 | * TodoShow is the baseclass of |
40 | * of all TodoShows. | 42 | * of all TodoShows. |
41 | * The first implementation is a QTextView | 43 | * The first implementation is a QTextView |
42 | * implementation showing the Todo as richtext | 44 | * implementation showing the Todo as richtext |
43 | */ | 45 | */ |
44 | class TodoShow { | 46 | class TodoShow { |
45 | public: | 47 | public: |
46 | TodoShow( MainWindow* win); | 48 | TodoShow( MainWindow* win); |
47 | virtual ~TodoShow(); | 49 | virtual ~TodoShow(); |
48 | virtual QString type()const = 0; | 50 | virtual QString type()const = 0; |
49 | virtual void slotShow( const OTodo& ev ) = 0; | 51 | virtual void slotShow( const OPimTodo& ev ) = 0; |
50 | virtual QWidget* widget() = 0; | 52 | virtual QWidget* widget() = 0; |
51 | protected: | 53 | protected: |
52 | void escapeView(); | 54 | void escapeView(); |
53 | void showNext(); | 55 | void showNext(); |
54 | void showPrev(); | 56 | void showPrev(); |
55 | private: | 57 | private: |
56 | MainWindow *m_win; | 58 | MainWindow *m_win; |
57 | }; | 59 | }; |
58 | }; | 60 | }; |
59 | 61 | ||
60 | #endif | 62 | #endif |
diff --git a/core/pim/todo/todotemplatemanager.cpp b/core/pim/todo/todotemplatemanager.cpp index 5b83f76..eeac51b 100644 --- a/core/pim/todo/todotemplatemanager.cpp +++ b/core/pim/todo/todotemplatemanager.cpp | |||
@@ -1,81 +1,81 @@ | |||
1 | #include <opie2/otodoaccess.h> | ||
2 | #include <opie2/otodoaccessxml.h> | ||
3 | |||
1 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
2 | #include <qpe/global.h> | 5 | #include <qpe/global.h> |
3 | 6 | ||
4 | #include <opie/otodoaccess.h> | ||
5 | #include <opie/otodoaccessxml.h> | ||
6 | |||
7 | #include "todotemplatemanager.h" | 7 | #include "todotemplatemanager.h" |
8 | 8 | ||
9 | 9 | ||
10 | using namespace Todo; | 10 | using namespace Todo; |
11 | 11 | ||
12 | TemplateManager::TemplateManager() { | 12 | TemplateManager::TemplateManager() { |
13 | m_path = Global::applicationFileName("todolist", "templates.xml"); | 13 | m_path = Global::applicationFileName("todolist", "templates.xml"); |
14 | } | 14 | } |
15 | TemplateManager::~TemplateManager() { | 15 | TemplateManager::~TemplateManager() { |
16 | save(); | 16 | save(); |
17 | } | 17 | } |
18 | void TemplateManager::load() { | 18 | void TemplateManager::load() { |
19 | Config conf("todolist_templates"); | 19 | Config conf("todolist_templates"); |
20 | OTodoAccessXML *xml = new OTodoAccessXML( QString::fromLatin1("template"), | 20 | OPimTodoAccessXML *xml = new OPimTodoAccessXML( QString::fromLatin1("template"), |
21 | m_path ); | 21 | m_path ); |
22 | OTodoAccess todoDB(xml ); | 22 | OPimTodoAccess todoDB(xml ); |
23 | todoDB.load(); | 23 | todoDB.load(); |
24 | 24 | ||
25 | OTodoAccess::List::Iterator it; | 25 | OPimTodoAccess::List::Iterator it; |
26 | OTodoAccess::List list = todoDB.allRecords(); | 26 | OPimTodoAccess::List list = todoDB.allRecords(); |
27 | for ( it = list.begin(); it != list.end(); ++it ) { | 27 | for ( it = list.begin(); it != list.end(); ++it ) { |
28 | OTodo ev = (*it); | 28 | OPimTodo ev = (*it); |
29 | conf.setGroup( QString::number( ev.uid() ) ); | 29 | conf.setGroup( QString::number( ev.uid() ) ); |
30 | QString str = conf.readEntry("Name", QString::null ); | 30 | QString str = conf.readEntry("Name", QString::null ); |
31 | if (str.isEmpty() ) | 31 | if (str.isEmpty() ) |
32 | continue; | 32 | continue; |
33 | 33 | ||
34 | m_templates.insert( str, ev ); | 34 | m_templates.insert( str, ev ); |
35 | } | 35 | } |
36 | } | 36 | } |
37 | void TemplateManager::save() { | 37 | void TemplateManager::save() { |
38 | qWarning("Saving!!!!"); | 38 | qWarning("Saving!!!!"); |
39 | Config conf("todolist_templates"); | 39 | Config conf("todolist_templates"); |
40 | 40 | ||
41 | OTodoAccessXML *res = new OTodoAccessXML( "template", | 41 | OPimTodoAccessXML *res = new OPimTodoAccessXML( "template", |
42 | m_path ); | 42 | m_path ); |
43 | OTodoAccess db(res); | 43 | OPimTodoAccess db(res); |
44 | db.load(); | 44 | db.load(); |
45 | db.clear(); | 45 | db.clear(); |
46 | 46 | ||
47 | 47 | ||
48 | QMap<QString, OTodo>::Iterator it; | 48 | QMap<QString, OPimTodo>::Iterator it; |
49 | for ( it = m_templates.begin(); it != m_templates.end(); ++it ) { | 49 | for ( it = m_templates.begin(); it != m_templates.end(); ++it ) { |
50 | OTodo ev = it.data(); | 50 | OPimTodo ev = it.data(); |
51 | conf.setGroup( QString::number( ev.uid() ) ); | 51 | conf.setGroup( QString::number( ev.uid() ) ); |
52 | qWarning("Name" + it.key() ); | 52 | qWarning("Name" + it.key() ); |
53 | conf.writeEntry("Name", it.key() ); | 53 | conf.writeEntry("Name", it.key() ); |
54 | db.add( ev ); | 54 | db.add( ev ); |
55 | } | 55 | } |
56 | db.save(); | 56 | db.save(); |
57 | } | 57 | } |
58 | void TemplateManager::addEvent( const QString& str, | 58 | void TemplateManager::addEvent( const QString& str, |
59 | const OTodo& ev) { | 59 | const OPimTodo& ev) { |
60 | qWarning("AddEvent"+ str ); | 60 | qWarning("AddEvent"+ str ); |
61 | OTodo todo = ev; | 61 | OPimTodo todo = ev; |
62 | if( ev.uid() == 0 ) | 62 | if( ev.uid() == 0 ) |
63 | todo.setUid(1); // generate a new uid | 63 | todo.setUid(1); // generate a new uid |
64 | 64 | ||
65 | m_templates.replace( str, todo ); | 65 | m_templates.replace( str, todo ); |
66 | } | 66 | } |
67 | void TemplateManager::removeEvent( const QString& str ) { | 67 | void TemplateManager::removeEvent( const QString& str ) { |
68 | m_templates.remove( str ); | 68 | m_templates.remove( str ); |
69 | } | 69 | } |
70 | QStringList TemplateManager::templates() const { | 70 | QStringList TemplateManager::templates() const { |
71 | QStringList list; | 71 | QStringList list; |
72 | QMap<QString, OTodo>::ConstIterator it; | 72 | QMap<QString, OPimTodo>::ConstIterator it; |
73 | for (it = m_templates.begin(); it != m_templates.end(); ++it ) { | 73 | for (it = m_templates.begin(); it != m_templates.end(); ++it ) { |
74 | list << it.key(); | 74 | list << it.key(); |
75 | } | 75 | } |
76 | 76 | ||
77 | return list; | 77 | return list; |
78 | } | 78 | } |
79 | OTodo TemplateManager::templateEvent( const QString& templateName ) { | 79 | OPimTodo TemplateManager::templateEvent( const QString& templateName ) { |
80 | return m_templates[templateName]; | 80 | return m_templates[templateName]; |
81 | } | 81 | } |
diff --git a/core/pim/todo/todotemplatemanager.h b/core/pim/todo/todotemplatemanager.h index 387ced1..ee8aaaf 100644 --- a/core/pim/todo/todotemplatemanager.h +++ b/core/pim/todo/todotemplatemanager.h | |||
@@ -1,32 +1,33 @@ | |||
1 | #ifndef OPIE_TODO_TEMPLATE_H | 1 | #ifndef OPIE_TODO_TEMPLATE_H |
2 | #define OPIE_TODO_TEMPLATE_H | 2 | #define OPIE_TODO_TEMPLATE_H |
3 | 3 | ||
4 | #include <opie2/opimtodo.h> | ||
5 | |||
4 | #include <qstring.h> | 6 | #include <qstring.h> |
5 | #include <qmap.h> | 7 | #include <qmap.h> |
6 | 8 | ||
7 | #include <opie/otodo.h> | 9 | using namespace Opie; |
8 | |||
9 | 10 | ||
10 | namespace Todo { | 11 | namespace Todo { |
11 | class TemplateManager { | 12 | class TemplateManager { |
12 | public: | 13 | public: |
13 | TemplateManager(); | 14 | TemplateManager(); |
14 | ~TemplateManager(); | 15 | ~TemplateManager(); |
15 | void load(); | 16 | void load(); |
16 | void save(); | 17 | void save(); |
17 | QStringList templates()const; | 18 | QStringList templates()const; |
18 | OTodo templateEvent( const QString& templateName ); | 19 | OPimTodo templateEvent( const QString& templateName ); |
19 | 20 | ||
20 | /* also replaces one */ | 21 | /* also replaces one */ |
21 | void addEvent( const QString&, const OTodo& ); | 22 | void addEvent( const QString&, const OPimTodo& ); |
22 | void removeEvent( const QString& ); | 23 | void removeEvent( const QString& ); |
23 | private: | 24 | private: |
24 | QString m_path; | 25 | QString m_path; |
25 | QMap<QString, OTodo> m_templates; | 26 | QMap<QString, OPimTodo> m_templates; |
26 | 27 | ||
27 | 28 | ||
28 | 29 | ||
29 | }; | 30 | }; |
30 | }; | 31 | }; |
31 | 32 | ||
32 | #endif | 33 | #endif |
diff --git a/core/pim/todo/todoview.cpp b/core/pim/todo/todoview.cpp index 31047cf..d99cf77 100644 --- a/core/pim/todo/todoview.cpp +++ b/core/pim/todo/todoview.cpp | |||
@@ -1,69 +1,69 @@ | |||
1 | #include "mainwindow.h" | 1 | #include "mainwindow.h" |
2 | 2 | ||
3 | #include "todoview.h" | 3 | #include "todoview.h" |
4 | 4 | ||
5 | using namespace Todo; | 5 | using namespace Todo; |
6 | 6 | ||
7 | 7 | ||
8 | 8 | ||
9 | 9 | ||
10 | TodoView::TodoView( MainWindow* win ) | 10 | TodoView::TodoView( MainWindow* win ) |
11 | : m_main( win ) | 11 | : m_main( win ) |
12 | { | 12 | { |
13 | m_asc = false; | 13 | m_asc = false; |
14 | m_sortOrder = -1; | 14 | m_sortOrder = -1; |
15 | } | 15 | } |
16 | TodoView::~TodoView() { | 16 | TodoView::~TodoView() { |
17 | }; | 17 | }; |
18 | MainWindow* TodoView::todoWindow() { | 18 | MainWindow* TodoView::todoWindow() { |
19 | return m_main; | 19 | return m_main; |
20 | } | 20 | } |
21 | 21 | ||
22 | OTodo TodoView::event(int uid ) { | 22 | OPimTodo TodoView::event(int uid ) { |
23 | return m_main->event( uid ); | 23 | return m_main->event( uid ); |
24 | } | 24 | } |
25 | OTodoAccess::List TodoView::list(){ | 25 | OPimTodoAccess::List TodoView::list(){ |
26 | todoWindow()->updateList(); | 26 | todoWindow()->updateList(); |
27 | return todoWindow()->list(); | 27 | return todoWindow()->list(); |
28 | } | 28 | } |
29 | OTodoAccess::List TodoView::sorted()const{ | 29 | OPimTodoAccess::List TodoView::sorted()const{ |
30 | return m_sort; | 30 | return m_sort; |
31 | } | 31 | } |
32 | void TodoView::sort() { | 32 | void TodoView::sort() { |
33 | m_sort = todoWindow()->sorted(m_asc,m_sortOrder ); | 33 | m_sort = todoWindow()->sorted(m_asc,m_sortOrder ); |
34 | qWarning("m_sort.count() = %d", m_sort.count() ); | 34 | qWarning("m_sort.count() = %d", m_sort.count() ); |
35 | } | 35 | } |
36 | void TodoView::sort(int sort) { | 36 | void TodoView::sort(int sort) { |
37 | m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort ); | 37 | m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort ); |
38 | } | 38 | } |
39 | void TodoView::setSortOrder( int order ) { | 39 | void TodoView::setSortOrder( int order ) { |
40 | m_sortOrder = order; | 40 | m_sortOrder = order; |
41 | } | 41 | } |
42 | void TodoView::setAscending( bool b ) { | 42 | void TodoView::setAscending( bool b ) { |
43 | qWarning("setAscending %d", b ); | 43 | qWarning("setAscending %d", b ); |
44 | m_asc = b; | 44 | m_asc = b; |
45 | } | 45 | } |
46 | void TodoView::update(int, const SmallTodo& ) { | 46 | void TodoView::update(int, const SmallTodo& ) { |
47 | //m_main->slotUpate1( uid, to ); | 47 | //m_main->slotUpate1( uid, to ); |
48 | } | 48 | } |
49 | void TodoView::update(int , const OTodo& ev ) { | 49 | void TodoView::update(int , const OPimTodo& ev ) { |
50 | m_main->updateTodo( ev ); | 50 | m_main->updateTodo( ev ); |
51 | } | 51 | } |
52 | void TodoView::showTodo( int uid ) { | 52 | void TodoView::showTodo( int uid ) { |
53 | m_main->slotShow( uid ); | 53 | m_main->slotShow( uid ); |
54 | } | 54 | } |
55 | void TodoView::edit( int uid ) { | 55 | void TodoView::edit( int uid ) { |
56 | m_main->slotEdit( uid ); | 56 | m_main->slotEdit( uid ); |
57 | } | 57 | } |
58 | void TodoView::remove( int uid ) { | 58 | void TodoView::remove( int uid ) { |
59 | m_main->m_todoMgr.remove( uid ); | 59 | m_main->m_todoMgr.remove( uid ); |
60 | } | 60 | } |
61 | void TodoView::complete( int uid ) { | 61 | void TodoView::complete( int uid ) { |
62 | m_main->slotComplete( uid ); | 62 | m_main->slotComplete( uid ); |
63 | } | 63 | } |
64 | void TodoView::complete( const OTodo& ev ) { | 64 | void TodoView::complete( const OPimTodo& ev ) { |
65 | m_main->slotComplete( ev ); | 65 | m_main->slotComplete( ev ); |
66 | } | 66 | } |
67 | void TodoView::removeQuery( int uid ) { | 67 | void TodoView::removeQuery( int uid ) { |
68 | m_main->slotDelete( uid ); | 68 | m_main->slotDelete( uid ); |
69 | } | 69 | } |
diff --git a/core/pim/todo/todoview.h b/core/pim/todo/todoview.h index e5ed66f..a5ea9f5 100644 --- a/core/pim/todo/todoview.h +++ b/core/pim/todo/todoview.h | |||
@@ -1,136 +1,138 @@ | |||
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 | -_. . . )=. = 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_VIEW_H | 29 | #ifndef TODO_VIEW_H |
30 | #define TODO_VIEW_H | 30 | #define TODO_VIEW_H |
31 | 31 | ||
32 | #include <qarray.h> | 32 | #include <qarray.h> |
33 | #include <qstring.h> | 33 | #include <qstring.h> |
34 | #include <qvaluelist.h> | 34 | #include <qvaluelist.h> |
35 | #include <qwidget.h> | 35 | #include <qwidget.h> |
36 | 36 | ||
37 | #include <opie/otodoaccess.h> | 37 | #include <opie2/otodoaccess.h> |
38 | 38 | ||
39 | #include "smalltodo.h" | 39 | #include "smalltodo.h" |
40 | 40 | ||
41 | using Opie::OPimTodo; | ||
42 | using Opie::OPimTodoAccess; | ||
41 | 43 | ||
42 | namespace Todo { | 44 | namespace Todo { |
43 | class MainWindow; | 45 | class MainWindow; |
44 | 46 | ||
45 | /** | 47 | /** |
46 | * due to inheretince problems we need this base class | 48 | * due to inheretince problems we need this base class |
47 | */ | 49 | */ |
48 | struct ViewBase { | 50 | struct ViewBase { |
49 | public: | 51 | public: |
50 | virtual QWidget* widget() = 0; | 52 | virtual QWidget* widget() = 0; |
51 | virtual QString type()const = 0; | 53 | virtual QString type()const = 0; |
52 | virtual int current() = 0; | 54 | virtual int current() = 0; |
53 | virtual QString currentRepresentation() = 0; | 55 | virtual QString currentRepresentation() = 0; |
54 | virtual void showOverDue( bool ) = 0; | 56 | virtual void showOverDue( bool ) = 0; |
55 | 57 | ||
56 | /** | 58 | /** |
57 | * the next record in the view or 0 if none is there | 59 | * the next record in the view or 0 if none is there |
58 | */ | 60 | */ |
59 | virtual int next() = 0; | 61 | virtual int next() = 0; |
60 | 62 | ||
61 | /** | 63 | /** |
62 | * the previous record or 0 if none is there.. | 64 | * the previous record or 0 if none is there.. |
63 | */ | 65 | */ |
64 | virtual int prev() = 0; | 66 | virtual int prev() = 0; |
65 | 67 | ||
66 | /* | 68 | /* |
67 | * update the view | 69 | * update the view |
68 | */ | 70 | */ |
69 | virtual void updateView() = 0; | 71 | virtual void updateView() = 0; |
70 | 72 | ||
71 | virtual void addEvent( const OTodo& ) = 0; | 73 | virtual void addEvent( const OPimTodo& ) = 0; |
72 | virtual void replaceEvent( const OTodo& ) = 0; | 74 | virtual void replaceEvent( const OPimTodo& ) = 0; |
73 | virtual void removeEvent( int uid ) = 0; | 75 | virtual void removeEvent( int uid ) = 0; |
74 | virtual void setShowCompleted( bool ) = 0; | 76 | virtual void setShowCompleted( bool ) = 0; |
75 | virtual void setShowDeadline( bool ) = 0; | 77 | virtual void setShowDeadline( bool ) = 0; |
76 | virtual void setShowCategory( const QString& = QString::null ) = 0; | 78 | virtual void setShowCategory( const QString& = QString::null ) = 0; |
77 | virtual void clear() = 0; | 79 | virtual void clear() = 0; |
78 | virtual void newDay() = 0; | 80 | virtual void newDay() = 0; |
79 | }; | 81 | }; |
80 | 82 | ||
81 | /** | 83 | /** |
82 | * A base class for all TodoView which are showing | 84 | * A base class for all TodoView which are showing |
83 | * a list of todos. | 85 | * a list of todos. |
84 | * Either in a QTable, QListView or any other QWidget | 86 | * Either in a QTable, QListView or any other QWidget |
85 | * derived class | 87 | * derived class |
86 | * Through the MainWindow( dispatcher ) one can access | 88 | * Through the MainWindow( dispatcher ) one can access |
87 | * the relevant informations | 89 | * the relevant informations |
88 | * | 90 | * |
89 | * It's not possible to have signal and slots from within | 91 | * It's not possible to have signal and slots from within |
90 | * templates this way you've to register for a signal | 92 | * templates this way you've to register for a signal |
91 | */ | 93 | */ |
92 | class TodoView : public ViewBase{ | 94 | class TodoView : public ViewBase{ |
93 | 95 | ||
94 | public: | 96 | public: |
95 | /** | 97 | /** |
96 | * c'tor | 98 | * c'tor |
97 | */ | 99 | */ |
98 | TodoView( MainWindow* win ); | 100 | TodoView( MainWindow* win ); |
99 | 101 | ||
100 | /** | 102 | /** |
101 | *d'tor | 103 | *d'tor |
102 | */ | 104 | */ |
103 | virtual ~TodoView(); | 105 | virtual ~TodoView(); |
104 | 106 | ||
105 | protected: | 107 | protected: |
106 | MainWindow* todoWindow(); | 108 | MainWindow* todoWindow(); |
107 | OTodo event(int uid ); | 109 | OPimTodo event(int uid ); |
108 | OTodoAccess::List list(); | 110 | OPimTodoAccess::List list(); |
109 | OTodoAccess::List sorted()const; | 111 | OPimTodoAccess::List sorted()const; |
110 | void sort(); | 112 | void sort(); |
111 | void sort(int sort ); | 113 | void sort(int sort ); |
112 | void setSortOrder( int order ); | 114 | void setSortOrder( int order ); |
113 | void setAscending( bool ); | 115 | void setAscending( bool ); |
114 | 116 | ||
115 | /* | 117 | /* |
116 | * These things needs to be implemented | 118 | * These things needs to be implemented |
117 | * in a implementation | 119 | * in a implementation |
118 | */ | 120 | */ |
119 | void showTodo( int uid ); | 121 | void showTodo( int uid ); |
120 | void edit( int uid ); | 122 | void edit( int uid ); |
121 | void update(int uid, const SmallTodo& to ); | 123 | void update(int uid, const SmallTodo& to ); |
122 | void update(int uid, const OTodo& ev); | 124 | void update(int uid, const OPimTodo& ev); |
123 | void remove( int uid ); | 125 | void remove( int uid ); |
124 | /* will ask the user if the item should be deleted */ | 126 | /* will ask the user if the item should be deleted */ |
125 | void removeQuery(int uid ); | 127 | void removeQuery(int uid ); |
126 | void complete( int uid ); | 128 | void complete( int uid ); |
127 | void complete( const OTodo& ev ); | 129 | void complete( const OPimTodo& ev ); |
128 | private: | 130 | private: |
129 | MainWindow *m_main; | 131 | MainWindow *m_main; |
130 | OTodoAccess::List m_sort; | 132 | OPimTodoAccess::List m_sort; |
131 | bool m_asc : 1; | 133 | bool m_asc : 1; |
132 | int m_sortOrder; | 134 | int m_sortOrder; |
133 | }; | 135 | }; |
134 | }; | 136 | }; |
135 | 137 | ||
136 | #endif | 138 | #endif |