-rw-r--r-- | core/pim/todo/mainwindow.cpp | 10 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 5 | ||||
-rw-r--r-- | core/pim/todo/todo.pro | 28 |
3 files changed, 15 insertions, 28 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 6725951..ecb4e40 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -1,806 +1,810 @@ | |||
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 <qmenubar.h> | 31 | #include <qmenubar.h> |
32 | #include <qmessagebox.h> | 32 | #include <qmessagebox.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qwidgetstack.h> | 36 | #include <qwidgetstack.h> |
37 | #include <qaction.h> | 37 | #include <qaction.h> |
38 | #include <qtimer.h> | 38 | #include <qtimer.h> |
39 | #include <qvbox.h> | 39 | #include <qvbox.h> |
40 | #include <qlayout.h> | 40 | #include <qlayout.h> |
41 | #include <qlineedit.h> | 41 | #include <qlineedit.h> |
42 | #include <qwhatsthis.h> | 42 | #include <qwhatsthis.h> |
43 | 43 | ||
44 | #include <qpe/applnk.h> | 44 | #include <qpe/applnk.h> |
45 | #include <qpe/config.h> | 45 | #include <qpe/config.h> |
46 | #include <qpe/ir.h> | 46 | #include <qpe/ir.h> |
47 | #include <qpe/resource.h> | 47 | #include <qpe/resource.h> |
48 | #include <qpe/qpemessagebox.h> | 48 | #include <qpe/qpemessagebox.h> |
49 | #include <qpe/alarmserver.h> | 49 | #include <qpe/alarmserver.h> |
50 | #include <qpe/timestring.h> | 50 | #include <qpe/timestring.h> |
51 | #include <qpe/qpeapplication.h> | 51 | #include <qpe/qpeapplication.h> |
52 | 52 | ||
53 | #include <opie/orecur.h> | 53 | #include <opie/orecur.h> |
54 | #include <opie/opimnotifymanager.h> | 54 | #include <opie/opimnotifymanager.h> |
55 | #include <opie/otodoaccessvcal.h> | 55 | #include <opie/otodoaccessvcal.h> |
56 | 56 | ||
57 | #include <opie/oapplicationfactory.h> | ||
58 | |||
57 | #include "quickeditimpl.h" | 59 | #include "quickeditimpl.h" |
58 | #include "todotemplatemanager.h" | 60 | #include "todotemplatemanager.h" |
59 | #include "templateeditor.h" | 61 | #include "templateeditor.h" |
60 | #include "tableview.h" | 62 | #include "tableview.h" |
61 | 63 | ||
62 | #include "textviewshow.h" | 64 | #include "textviewshow.h" |
63 | #include "todoeditor.h" | 65 | #include "todoeditor.h" |
64 | #include "mainwindow.h" | 66 | #include "mainwindow.h" |
65 | 67 | ||
68 | OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) | ||
66 | 69 | ||
67 | using namespace Todo; | 70 | using namespace Todo; |
68 | 71 | ||
69 | MainWindow::MainWindow( QWidget* parent, | 72 | MainWindow::MainWindow( QWidget* parent, |
70 | const char* name ) | 73 | const char* name, WFlags ) |
71 | : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) | 74 | : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) |
72 | { | 75 | { |
73 | m_syncing = false; | 76 | m_syncing = false; |
74 | m_showing = false; | 77 | m_showing = false; |
75 | m_counter = 0; | 78 | m_counter = 0; |
76 | m_tempManager = new TemplateManager(); | 79 | m_tempManager = new TemplateManager(); |
77 | m_tempManager->load(); | 80 | m_tempManager->load(); |
78 | 81 | ||
79 | initUI(); | 82 | initUI(); |
80 | initConfig(); | 83 | initConfig(); |
81 | initViews(); | 84 | initViews(); |
82 | initActions(); | 85 | initActions(); |
83 | initEditor(); | 86 | initEditor(); |
84 | initShow(); | 87 | initShow(); |
85 | initTemplate(); | 88 | initTemplate(); |
86 | 89 | ||
87 | populateTemplates(); | 90 | populateTemplates(); |
88 | raiseCurrentView(); | 91 | raiseCurrentView(); |
89 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); | 92 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); |
90 | } | 93 | } |
91 | void MainWindow::initTemplate() { | 94 | void MainWindow::initTemplate() { |
92 | m_curTempEd = new TemplateEditor( this, templateManager() ); | 95 | m_curTempEd = new TemplateEditor( this, templateManager() ); |
93 | } | 96 | } |
94 | void MainWindow::initActions() { | 97 | void MainWindow::initActions() { |
95 | 98 | ||
96 | // Data menu | 99 | // Data menu |
97 | m_edit->insertItem(QWidget::tr("New from template"), m_template, | 100 | m_edit->insertItem(QWidget::tr("New from template"), m_template, |
98 | -1, 0 ); | 101 | -1, 0 ); |
99 | 102 | ||
100 | QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), | 103 | QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), |
101 | QString::null, 0, this, 0 ); | 104 | QString::null, 0, this, 0 ); |
102 | connect(a, SIGNAL( activated() ), | 105 | connect(a, SIGNAL( activated() ), |
103 | this, SLOT( slotNew() ) ); | 106 | this, SLOT( slotNew() ) ); |
104 | a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); | 107 | a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); |
105 | a->addTo(m_tool ); | 108 | a->addTo(m_tool ); |
106 | a->addTo(m_edit ); | 109 | a->addTo(m_edit ); |
107 | 110 | ||
108 | a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), | 111 | a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), |
109 | QString::null, 0, this, 0 ); | 112 | QString::null, 0, this, 0 ); |
110 | connect(a, SIGNAL(activated() ), | 113 | connect(a, SIGNAL(activated() ), |
111 | this, SLOT( slotEdit() ) ); | 114 | this, SLOT( slotEdit() ) ); |
112 | a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); | 115 | a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); |
113 | a->addTo( m_tool ); | 116 | a->addTo( m_tool ); |
114 | a->addTo( m_edit ); | 117 | a->addTo( m_edit ); |
115 | m_editAction = a; | 118 | m_editAction = a; |
116 | 119 | ||
117 | a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); | 120 | a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); |
118 | connect(a, SIGNAL( activated() ), | 121 | connect(a, SIGNAL( activated() ), |
119 | this, SLOT( slotShowDetails() ) ); | 122 | this, SLOT( slotShowDetails() ) ); |
120 | a->addTo( m_edit ); | 123 | a->addTo( m_edit ); |
121 | 124 | ||
122 | m_edit->insertSeparator(); | 125 | m_edit->insertSeparator(); |
123 | 126 | ||
124 | a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ), | 127 | a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ), |
125 | QString::null, 0, this, 0 ); | 128 | QString::null, 0, this, 0 ); |
126 | connect(a, SIGNAL(activated() ), | 129 | connect(a, SIGNAL(activated() ), |
127 | this, SLOT(slotDelete() ) ); | 130 | this, SLOT(slotDelete() ) ); |
128 | a->setWhatsThis( QWidget::tr( "Click here to remove the current task." ) ); | 131 | a->setWhatsThis( QWidget::tr( "Click here to remove the current task." ) ); |
129 | a->addTo( m_tool ); | 132 | a->addTo( m_tool ); |
130 | a->addTo( m_edit ); | 133 | a->addTo( m_edit ); |
131 | m_deleteAction = a; | 134 | m_deleteAction = a; |
132 | 135 | ||
133 | a = new QAction( QString::null, QWidget::tr("Delete all..."), 0, this, 0 ); | 136 | a = new QAction( QString::null, QWidget::tr("Delete all..."), 0, this, 0 ); |
134 | connect(a, SIGNAL( activated() ), | 137 | connect(a, SIGNAL( activated() ), |
135 | this, SLOT( slotDeleteAll() ) ); | 138 | this, SLOT( slotDeleteAll() ) ); |
136 | a->addTo(m_edit ); | 139 | a->addTo(m_edit ); |
137 | m_deleteAllAction = a; | 140 | m_deleteAllAction = a; |
138 | 141 | ||
139 | a = new QAction( QString::null, QWidget::tr("Delete completed"), | 142 | a = new QAction( QString::null, QWidget::tr("Delete completed"), |
140 | 0, this, 0 ); | 143 | 0, this, 0 ); |
141 | connect(a, SIGNAL( activated() ), | 144 | connect(a, SIGNAL( activated() ), |
142 | this, SLOT( slotDeleteCompleted() ) ); | 145 | this, SLOT( slotDeleteCompleted() ) ); |
143 | a->addTo(m_edit ); | 146 | a->addTo(m_edit ); |
144 | a->setEnabled( TRUE ); | 147 | a->setEnabled( TRUE ); |
145 | m_deleteCompleteAction = a; | 148 | m_deleteCompleteAction = a; |
146 | 149 | ||
147 | m_edit->insertSeparator(); | 150 | m_edit->insertSeparator(); |
148 | 151 | ||
149 | a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 ); | 152 | a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 ); |
150 | connect(a, SIGNAL( activated() ), | 153 | connect(a, SIGNAL( activated() ), |
151 | this, SLOT( slotDuplicate() ) ); | 154 | this, SLOT( slotDuplicate() ) ); |
152 | a->addTo(m_edit ); | 155 | a->addTo(m_edit ); |
153 | m_duplicateAction = a; | 156 | m_duplicateAction = a; |
154 | 157 | ||
155 | m_edit->insertSeparator(); | 158 | m_edit->insertSeparator(); |
156 | 159 | ||
157 | if ( Ir::supported() ) { | 160 | if ( Ir::supported() ) { |
158 | a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); | 161 | a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); |
159 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 162 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
160 | a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) ); | 163 | a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) ); |
161 | a->addTo( m_edit ); | 164 | a->addTo( m_edit ); |
162 | a->addTo( m_tool ); | 165 | a->addTo( m_tool ); |
163 | } | 166 | } |
164 | 167 | ||
165 | #if 0 | 168 | #if 0 |
166 | // Options menu | 169 | // Options menu |
167 | a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ), | 170 | a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ), |
168 | QString::null, 0, this, 0 ); | 171 | QString::null, 0, this, 0 ); |
169 | connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | 172 | connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); |
170 | a->addTo( m_options ); | 173 | a->addTo( m_options ); |
171 | m_findAction = a; | 174 | m_findAction = a; |
172 | 175 | ||
173 | 176 | ||
174 | m_options->insertSeparator(); | 177 | m_options->insertSeparator(); |
175 | #endif | 178 | #endif |
176 | 179 | ||
177 | m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), | 180 | m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), |
178 | 0, this, 0, TRUE ); | 181 | 0, this, 0, TRUE ); |
179 | m_completedAction->addTo( m_options ); | 182 | m_completedAction->addTo( m_options ); |
180 | m_completedAction->setOn( showCompleted() ); | 183 | m_completedAction->setOn( showCompleted() ); |
181 | connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); | 184 | connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); |
182 | 185 | ||
183 | a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), | 186 | a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), |
184 | 0, this, 0, TRUE ); | 187 | 0, this, 0, TRUE ); |
185 | a->addTo( m_options ); | 188 | a->addTo( m_options ); |
186 | a->setOn( showOverDue() ); | 189 | a->setOn( showOverDue() ); |
187 | connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); | 190 | connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); |
188 | 191 | ||
189 | m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), | 192 | m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), |
190 | 0, this, 0, TRUE ); | 193 | 0, this, 0, TRUE ); |
191 | m_showDeadLineAction->addTo( m_options ); | 194 | m_showDeadLineAction->addTo( m_options ); |
192 | m_showDeadLineAction->setOn( showDeadline() ); | 195 | m_showDeadLineAction->setOn( showDeadline() ); |
193 | connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) ); | 196 | connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) ); |
194 | 197 | ||
195 | m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), | 198 | m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), |
196 | 0, this, 0, TRUE ); | 199 | 0, this, 0, TRUE ); |
197 | m_showQuickTaskAction->addTo( m_options ); | 200 | m_showQuickTaskAction->addTo( m_options ); |
198 | m_showQuickTaskAction->setOn( showQuickTask() ); | 201 | m_showQuickTaskAction->setOn( showQuickTask() ); |
199 | connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); | 202 | connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); |
200 | 203 | ||
201 | m_options->insertSeparator(); | 204 | m_options->insertSeparator(); |
202 | 205 | ||
203 | m_bar->insertItem( QWidget::tr("Data") ,m_edit ); | 206 | m_bar->insertItem( QWidget::tr("Data") ,m_edit ); |
204 | m_bar->insertItem( QWidget::tr("Category"), m_catMenu ); | 207 | m_bar->insertItem( QWidget::tr("Category"), m_catMenu ); |
205 | m_bar->insertItem( QWidget::tr("Options"), m_options ); | 208 | m_bar->insertItem( QWidget::tr("Options"), m_options ); |
206 | 209 | ||
207 | m_curQuick = new QuickEditImpl( this, m_quicktask ); | 210 | m_curQuick = new QuickEditImpl( this, m_quicktask ); |
208 | addToolBar( (QPEToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE ); | 211 | addToolBar( (QPEToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE ); |
209 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); | 212 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); |
210 | 213 | ||
211 | } | 214 | } |
212 | /* m_curCat from Config */ | 215 | /* m_curCat from Config */ |
213 | void MainWindow::initConfig() { | 216 | void MainWindow::initConfig() { |
214 | Config config( "todo" ); | 217 | Config config( "todo" ); |
215 | config.setGroup( "View" ); | 218 | config.setGroup( "View" ); |
216 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); | 219 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); |
217 | m_curCat = config.readEntry( "Category", QString::null ); | 220 | m_curCat = config.readEntry( "Category", QString::null ); |
218 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); | 221 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); |
219 | m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); | 222 | m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); |
220 | m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); | 223 | m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); |
221 | } | 224 | } |
222 | void MainWindow::initUI() { | 225 | void MainWindow::initUI() { |
223 | 226 | ||
224 | m_stack = new QWidgetStack(this, "main stack"); | 227 | m_stack = new QWidgetStack(this, "main stack"); |
225 | 228 | ||
226 | setCentralWidget( m_stack ); | 229 | setCentralWidget( m_stack ); |
227 | 230 | ||
228 | setToolBarsMovable( FALSE ); | 231 | setToolBarsMovable( FALSE ); |
229 | 232 | ||
230 | QToolBar *menubarholder = new QToolBar( this ); | 233 | QToolBar *menubarholder = new QToolBar( this ); |
231 | menubarholder->setHorizontalStretchable( TRUE ); | 234 | menubarholder->setHorizontalStretchable( TRUE ); |
232 | m_bar = new QMenuBar( menubarholder ); | 235 | m_bar = new QMenuBar( menubarholder ); |
233 | 236 | ||
234 | m_tool = new QToolBar( this ); | 237 | m_tool = new QToolBar( this ); |
235 | 238 | ||
236 | /** QPopupMenu */ | 239 | /** QPopupMenu */ |
237 | m_edit = new QPopupMenu( this ); | 240 | m_edit = new QPopupMenu( this ); |
238 | m_options = new QPopupMenu( this ); | 241 | m_options = new QPopupMenu( this ); |
239 | m_catMenu = new QPopupMenu( this ); | 242 | m_catMenu = new QPopupMenu( this ); |
240 | m_template = new QPopupMenu( this ); | 243 | m_template = new QPopupMenu( this ); |
241 | 244 | ||
242 | m_catMenu->setCheckable( TRUE ); | 245 | m_catMenu->setCheckable( TRUE ); |
243 | m_template->setCheckable( TRUE ); | 246 | m_template->setCheckable( TRUE ); |
244 | 247 | ||
245 | connect(m_catMenu, SIGNAL(activated(int) ), | 248 | connect(m_catMenu, SIGNAL(activated(int) ), |
246 | this, SLOT(setCategory(int) ) ); | 249 | this, SLOT(setCategory(int) ) ); |
247 | connect(m_template, SIGNAL(activated(int) ), | 250 | connect(m_template, SIGNAL(activated(int) ), |
248 | this, SLOT(slotNewFromTemplate(int) ) ); | 251 | this, SLOT(slotNewFromTemplate(int) ) ); |
249 | } | 252 | } |
250 | void MainWindow::initViews() { | 253 | void MainWindow::initViews() { |
251 | 254 | ||
252 | TableView* tableView = new TableView( this, m_stack ); | 255 | TableView* tableView = new TableView( this, m_stack ); |
253 | 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." ) ); | 256 | QWhatsThis::add( tableView, QWidget::tr( "This is a listing of all current tasks.\n\nThe list displays the following information:\n1. Completed - A green checkmark indicates task is completed. Click here to complete a task.\n2. Priority - a graphical representation of task priority. Double-click here to modify.\n3. Description - description of task. Click here to select the task.\n4. Deadline - shows when task is due. This column can be shown or hidden by selecting Options->'Show task deadlines' from the menu above." ) ); |
254 | m_stack->addWidget( tableView, m_counter++ ); | 257 | m_stack->addWidget( tableView, m_counter++ ); |
255 | m_views.append( tableView ); | 258 | m_views.append( tableView ); |
256 | m_curView = tableView; | 259 | m_curView = tableView; |
257 | connectBase( tableView ); | 260 | connectBase( tableView ); |
258 | /* add QString type + QString configname to | 261 | /* add QString type + QString configname to |
259 | * the View menu | 262 | * the View menu |
260 | * and subdirs for multiple views | 263 | * and subdirs for multiple views |
261 | */ | 264 | */ |
262 | } | 265 | } |
263 | void MainWindow::initEditor() { | 266 | void MainWindow::initEditor() { |
264 | m_curEdit = new Editor(); | 267 | m_curEdit = new Editor(); |
265 | } | 268 | } |
266 | void MainWindow::initShow() { | 269 | void MainWindow::initShow() { |
267 | m_curShow = new TextViewShow(this, this); | 270 | m_curShow = new TextViewShow(this, this); |
268 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); | 271 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); |
269 | } | 272 | } |
270 | MainWindow::~MainWindow() { | 273 | MainWindow::~MainWindow() { |
271 | delete templateManager(); | 274 | delete templateManager(); |
272 | } | 275 | } |
273 | void MainWindow::connectBase( ViewBase* ) { | 276 | void MainWindow::connectBase( ViewBase* ) { |
274 | // once templates and signals mix we'll use it again | 277 | // once templates and signals mix we'll use it again |
275 | } | 278 | } |
276 | QPopupMenu* MainWindow::contextMenu( int , bool recur ) { | 279 | QPopupMenu* MainWindow::contextMenu( int , bool recur ) { |
277 | QPopupMenu* menu = new QPopupMenu(); | 280 | QPopupMenu* menu = new QPopupMenu(); |
278 | 281 | ||
279 | m_editAction->addTo( menu ); | 282 | m_editAction->addTo( menu ); |
280 | m_deleteAction->addTo( menu ); | 283 | m_deleteAction->addTo( menu ); |
281 | m_duplicateAction->addTo( menu ); | 284 | m_duplicateAction->addTo( menu ); |
282 | 285 | ||
283 | menu->insertSeparator(); | 286 | menu->insertSeparator(); |
284 | 287 | ||
285 | /* | 288 | /* |
286 | * if this event recurs we allow | 289 | * if this event recurs we allow |
287 | * to detach it. | 290 | * to detach it. |
288 | * remove all | 291 | * remove all |
289 | */ | 292 | */ |
290 | if ( recur ) { | 293 | if ( recur ) { |
291 | ; // FIXME | 294 | ; // FIXME |
292 | } | 295 | } |
293 | 296 | ||
294 | return menu; | 297 | return menu; |
295 | } | 298 | } |
296 | QPopupMenu* MainWindow::options() { | 299 | QPopupMenu* MainWindow::options() { |
297 | qWarning("Options"); | 300 | qWarning("Options"); |
298 | return m_options; | 301 | return m_options; |
299 | } | 302 | } |
300 | QPopupMenu* MainWindow::edit() { | 303 | QPopupMenu* MainWindow::edit() { |
301 | return m_edit; | 304 | return m_edit; |
302 | } | 305 | } |
303 | QToolBar* MainWindow::toolbar() { | 306 | QToolBar* MainWindow::toolbar() { |
304 | return m_tool; | 307 | return m_tool; |
305 | } | 308 | } |
306 | OTodoAccess::List MainWindow::list()const { | 309 | OTodoAccess::List MainWindow::list()const { |
307 | return m_todoMgr.list(); | 310 | return m_todoMgr.list(); |
308 | } | 311 | } |
309 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { | 312 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { |
310 | int cat = 0; | 313 | int cat = 0; |
311 | if ( m_curCat != QWidget::tr("All Categories") ) | 314 | if ( m_curCat != QWidget::tr("All Categories") ) |
312 | cat = currentCatId(); | 315 | cat = currentCatId(); |
313 | if ( m_curCat == QWidget::tr("Unfiled") ) | 316 | if ( m_curCat == QWidget::tr("Unfiled") ) |
314 | cat = -1; | 317 | cat = -1; |
315 | 318 | ||
316 | qWarning(" Category %d %s", cat, m_curCat.latin1() ); | 319 | qWarning(" Category %d %s", cat, m_curCat.latin1() ); |
317 | 320 | ||
318 | int filter = 1; | 321 | int filter = 1; |
319 | 322 | ||
320 | if (!m_completed ) | 323 | if (!m_completed ) |
321 | filter |= 4; | 324 | filter |= 4; |
322 | if (m_overdue) | 325 | if (m_overdue) |
323 | filter |= 2; | 326 | filter |= 2; |
324 | 327 | ||
325 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); | 328 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); |
326 | } | 329 | } |
327 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { | 330 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { |
328 | int cat = 0; | 331 | int cat = 0; |
329 | if ( m_curCat != QWidget::tr("All Categories") ) | 332 | if ( m_curCat != QWidget::tr("All Categories") ) |
330 | cat = currentCatId(); | 333 | cat = currentCatId(); |
331 | 334 | ||
332 | if ( m_curCat == QWidget::tr("Unfiled") ) | 335 | if ( m_curCat == QWidget::tr("Unfiled") ) |
333 | cat = -1; | 336 | cat = -1; |
334 | 337 | ||
335 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); | 338 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); |
336 | } | 339 | } |
337 | OTodo MainWindow::event( int uid ) { | 340 | OTodo MainWindow::event( int uid ) { |
338 | return m_todoMgr.event( uid ); | 341 | return m_todoMgr.event( uid ); |
339 | } | 342 | } |
340 | bool MainWindow::isSyncing()const { | 343 | bool MainWindow::isSyncing()const { |
341 | return m_syncing; | 344 | return m_syncing; |
342 | } | 345 | } |
343 | TemplateManager* MainWindow::templateManager() { | 346 | TemplateManager* MainWindow::templateManager() { |
344 | return m_tempManager; | 347 | return m_tempManager; |
345 | } | 348 | } |
346 | Editor* MainWindow::currentEditor() { | 349 | Editor* MainWindow::currentEditor() { |
347 | return m_curEdit; | 350 | return m_curEdit; |
348 | } | 351 | } |
349 | TodoShow* MainWindow::currentShow() { | 352 | TodoShow* MainWindow::currentShow() { |
350 | return m_curShow; | 353 | return m_curShow; |
351 | } | 354 | } |
352 | void MainWindow::slotReload() { | 355 | void MainWindow::slotReload() { |
356 | m_syncing = FALSE; | ||
353 | m_todoMgr.reload(); | 357 | m_todoMgr.reload(); |
354 | currentView()->updateView( ); | 358 | currentView()->updateView( ); |
355 | raiseCurrentView(); | 359 | raiseCurrentView(); |
356 | } | 360 | } |
357 | void MainWindow::closeEvent( QCloseEvent* e ) { | 361 | void MainWindow::closeEvent( QCloseEvent* e ) { |
358 | if (m_stack->visibleWidget() == currentShow()->widget() ) { | 362 | if (m_stack->visibleWidget() == currentShow()->widget() ) { |
359 | m_showing = false; | 363 | m_showing = false; |
360 | raiseCurrentView(); | 364 | raiseCurrentView(); |
361 | e->ignore(); | 365 | e->ignore(); |
362 | return; | 366 | return; |
363 | } | 367 | } |
364 | /* | 368 | /* |
365 | * we should have flushed and now we're still saving | 369 | * we should have flushed and now we're still saving |
366 | * so there is no need to flush | 370 | * so there is no need to flush |
367 | */ | 371 | */ |
368 | if (m_syncing ) { | 372 | if (m_syncing ) { |
369 | e->accept(); | 373 | e->accept(); |
370 | return; | 374 | return; |
371 | } | 375 | } |
372 | bool quit = false; | 376 | bool quit = false; |
373 | if ( m_todoMgr.saveAll() ){ | 377 | if ( m_todoMgr.saveAll() ){ |
374 | qWarning("saved"); | 378 | qWarning("saved"); |
375 | quit = true; | 379 | quit = true; |
376 | }else { | 380 | }else { |
377 | if ( QMessageBox::critical( this, QWidget::tr("Out of space"), | 381 | if ( QMessageBox::critical( this, QWidget::tr("Out of space"), |
378 | QWidget::tr("Todo was unable\n" | 382 | QWidget::tr("Todo was unable\n" |
379 | "to save your changes.\n" | 383 | "to save your changes.\n" |
380 | "Free up some space\n" | 384 | "Free up some space\n" |
381 | "and try again.\n" | 385 | "and try again.\n" |
382 | "\nQuit Anyway?"), | 386 | "\nQuit Anyway?"), |
383 | QMessageBox::Yes|QMessageBox::Escape, | 387 | QMessageBox::Yes|QMessageBox::Escape, |
384 | QMessageBox::No|QMessageBox::Default) | 388 | QMessageBox::No|QMessageBox::Default) |
385 | != QMessageBox::No ) { | 389 | != QMessageBox::No ) { |
386 | e->accept(); | 390 | e->accept(); |
387 | quit = true; | 391 | quit = true; |
388 | }else | 392 | }else |
389 | e->ignore(); | 393 | e->ignore(); |
390 | 394 | ||
391 | } | 395 | } |
392 | 396 | ||
393 | if (quit ) { | 397 | if (quit ) { |
394 | Config config( "todo" ); | 398 | Config config( "todo" ); |
395 | config.setGroup( "View" ); | 399 | config.setGroup( "View" ); |
396 | config.writeEntry( "ShowComplete", showCompleted() ); | 400 | config.writeEntry( "ShowComplete", showCompleted() ); |
397 | config.writeEntry( "Category", currentCategory() ); | 401 | config.writeEntry( "Category", currentCategory() ); |
398 | config.writeEntry( "ShowDeadLine", showDeadline()); | 402 | config.writeEntry( "ShowDeadLine", showDeadline()); |
399 | config.writeEntry( "ShowOverDue", showOverDue() ); | 403 | config.writeEntry( "ShowOverDue", showOverDue() ); |
400 | config.writeEntry( "ShowQuickTask", showQuickTask() ); | 404 | config.writeEntry( "ShowQuickTask", showQuickTask() ); |
401 | /* save templates */ | 405 | /* save templates */ |
402 | templateManager()->save(); | 406 | templateManager()->save(); |
403 | e->accept(); | 407 | e->accept(); |
404 | } | 408 | } |
405 | } | 409 | } |
406 | void MainWindow::populateTemplates() { | 410 | void MainWindow::populateTemplates() { |
407 | m_template->clear(); | 411 | m_template->clear(); |
408 | QStringList list = templateManager()->templates(); | 412 | QStringList list = templateManager()->templates(); |
409 | QStringList::Iterator it; | 413 | QStringList::Iterator it; |
410 | for ( it = list.begin(); it != list.end(); ++it ) { | 414 | for ( it = list.begin(); it != list.end(); ++it ) { |
411 | m_template->insertItem( (*it) ); | 415 | m_template->insertItem( (*it) ); |
412 | } | 416 | } |
413 | } | 417 | } |
414 | /* | 418 | /* |
415 | * slotNewFromTemplate | 419 | * slotNewFromTemplate |
416 | * We use the edit widget to do | 420 | * We use the edit widget to do |
417 | * the config but we setUid(1) | 421 | * the config but we setUid(1) |
418 | * to get a new uid | 422 | * to get a new uid |
419 | */ | 423 | */ |
420 | /* | 424 | /* |
421 | * first we get the name of the template | 425 | * first we get the name of the template |
422 | * then we will use the TemplateManager | 426 | * then we will use the TemplateManager |
423 | */ | 427 | */ |
424 | void MainWindow::slotNewFromTemplate( int id ) { | 428 | void MainWindow::slotNewFromTemplate( int id ) { |
425 | QString name = m_template->text( id ); | 429 | QString name = m_template->text( id ); |
426 | 430 | ||
427 | OTodo event = templateManager()->templateEvent( name ); | 431 | OTodo event = templateManager()->templateEvent( name ); |
428 | event = currentEditor()->edit(this, | 432 | event = currentEditor()->edit(this, |
429 | event ); | 433 | event ); |
430 | 434 | ||
431 | if ( currentEditor()->accepted() ) { | 435 | if ( currentEditor()->accepted() ) { |
432 | /* assign new todo */ | 436 | /* assign new todo */ |
433 | event.setUid( 1 ); | 437 | event.setUid( 1 ); |
434 | handleAlarms( OTodo(), event ); | 438 | handleAlarms( OTodo(), event ); |
435 | m_todoMgr.add( event ); | 439 | m_todoMgr.add( event ); |
436 | currentView()->addEvent( event ); | 440 | currentView()->addEvent( event ); |
437 | 441 | ||
438 | populateCategories(); | 442 | populateCategories(); |
439 | } | 443 | } |
440 | raiseCurrentView(); | 444 | raiseCurrentView(); |
441 | } | 445 | } |
442 | void MainWindow::slotNew() { | 446 | void MainWindow::slotNew() { |
443 | create(); | 447 | create(); |
444 | } | 448 | } |
445 | void MainWindow::slotDuplicate() { | 449 | void MainWindow::slotDuplicate() { |
446 | if(m_syncing) { | 450 | if(m_syncing) { |
447 | QMessageBox::warning(this, QWidget::tr("Todo"), | 451 | QMessageBox::warning(this, QWidget::tr("Todo"), |
448 | QWidget::tr("Data can not be edited, currently syncing")); | 452 | QWidget::tr("Data can not be edited, currently syncing")); |
449 | return; | 453 | return; |
450 | } | 454 | } |
451 | OTodo ev = m_todoMgr.event( currentView()->current() ); | 455 | OTodo ev = m_todoMgr.event( currentView()->current() ); |
452 | /* let's generate a new uid */ | 456 | /* let's generate a new uid */ |
453 | ev.setUid(1); | 457 | ev.setUid(1); |
454 | m_todoMgr.add( ev ); | 458 | m_todoMgr.add( ev ); |
455 | 459 | ||
456 | currentView()->addEvent( ev ); | 460 | currentView()->addEvent( ev ); |
457 | raiseCurrentView(); | 461 | raiseCurrentView(); |
458 | } | 462 | } |
459 | void MainWindow::slotDelete() { | 463 | void MainWindow::slotDelete() { |
460 | if (!currentView()->current() ) | 464 | if (!currentView()->current() ) |
461 | return; | 465 | return; |
462 | 466 | ||
463 | if(m_syncing) { | 467 | if(m_syncing) { |
464 | QMessageBox::warning(this, QWidget::tr("Todo"), | 468 | QMessageBox::warning(this, QWidget::tr("Todo"), |
465 | QWidget::tr("Data can not be edited, currently syncing")); | 469 | QWidget::tr("Data can not be edited, currently syncing")); |
466 | return; | 470 | return; |
467 | } | 471 | } |
468 | QString strName = currentView()->currentRepresentation(); | 472 | QString strName = currentView()->currentRepresentation(); |
469 | if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), strName ) ) | 473 | if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), strName ) ) |
470 | return; | 474 | return; |
471 | 475 | ||
472 | handleAlarms( m_todoMgr.event( currentView()->current() ), OTodo() ); | 476 | handleAlarms( m_todoMgr.event( currentView()->current() ), OTodo() ); |
473 | m_todoMgr.remove( currentView()->current() ); | 477 | m_todoMgr.remove( currentView()->current() ); |
474 | currentView()->removeEvent( currentView()->current() ); | 478 | currentView()->removeEvent( currentView()->current() ); |
475 | raiseCurrentView(); | 479 | raiseCurrentView(); |
476 | } | 480 | } |
477 | void MainWindow::slotDelete(int uid ) { | 481 | void MainWindow::slotDelete(int uid ) { |
478 | if( uid == 0 ) return; | 482 | if( uid == 0 ) return; |
479 | if(m_syncing) { | 483 | if(m_syncing) { |
480 | QMessageBox::warning(this, QWidget::tr("Todo"), | 484 | QMessageBox::warning(this, QWidget::tr("Todo"), |
481 | QWidget::tr("Data can not be edited, currently syncing")); | 485 | QWidget::tr("Data can not be edited, currently syncing")); |
482 | return; | 486 | return; |
483 | } | 487 | } |
484 | OTodo to = m_todoMgr.event(uid); | 488 | OTodo to = m_todoMgr.event(uid); |
485 | if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), to.toShortText() ) ) | 489 | if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), to.toShortText() ) ) |
486 | return; | 490 | return; |
487 | 491 | ||
488 | handleAlarms(to, OTodo() ); | 492 | handleAlarms(to, OTodo() ); |
489 | m_todoMgr.remove( to.uid() ); | 493 | m_todoMgr.remove( to.uid() ); |
490 | currentView()->removeEvent( to.uid() ); | 494 | currentView()->removeEvent( to.uid() ); |
491 | raiseCurrentView(); | 495 | raiseCurrentView(); |
492 | } | 496 | } |
493 | void MainWindow::slotDeleteAll() { | 497 | void MainWindow::slotDeleteAll() { |
494 | if(m_syncing) { | 498 | if(m_syncing) { |
495 | QMessageBox::warning(this, QWidget::tr("Todo"), | 499 | QMessageBox::warning(this, QWidget::tr("Todo"), |
496 | QWidget::tr("Data can not be edited, currently syncing")); | 500 | QWidget::tr("Data can not be edited, currently syncing")); |
497 | return; | 501 | return; |
498 | } | 502 | } |
499 | 503 | ||
500 | 504 | ||
501 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) ) | 505 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) ) |
502 | return; | 506 | return; |
503 | 507 | ||
504 | m_todoMgr.removeAll(); | 508 | m_todoMgr.removeAll(); |
505 | currentView()->clear(); | 509 | currentView()->clear(); |
506 | 510 | ||
507 | raiseCurrentView(); | 511 | raiseCurrentView(); |
508 | } | 512 | } |
509 | void MainWindow::slotDeleteCompleted() { | 513 | void MainWindow::slotDeleteCompleted() { |
510 | if(m_syncing) { | 514 | if(m_syncing) { |
511 | QMessageBox::warning(this, QWidget::tr("Todo"), | 515 | QMessageBox::warning(this, QWidget::tr("Todo"), |
512 | QWidget::tr("Data can not be edited, currently syncing")); | 516 | QWidget::tr("Data can not be edited, currently syncing")); |
513 | return; | 517 | return; |
514 | } | 518 | } |
515 | 519 | ||
516 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) ) | 520 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) ) |
517 | return; | 521 | return; |
518 | 522 | ||
519 | 523 | ||
520 | m_todoMgr.removeCompleted(); | 524 | m_todoMgr.removeCompleted(); |
521 | currentView()->updateView( ); | 525 | currentView()->updateView( ); |
522 | } | 526 | } |
523 | void MainWindow::slotFind() { | 527 | void MainWindow::slotFind() { |
524 | 528 | ||
525 | } | 529 | } |
526 | void MainWindow::slotEdit() { | 530 | void MainWindow::slotEdit() { |
527 | slotEdit( currentView()->current() ); | 531 | slotEdit( currentView()->current() ); |
528 | } | 532 | } |
529 | /* | 533 | /* |
530 | * set the category | 534 | * set the category |
531 | */ | 535 | */ |
532 | void MainWindow::setCategory( int c) { | 536 | void MainWindow::setCategory( int c) { |
533 | if ( c <= 0 ) return; | 537 | if ( c <= 0 ) return; |
534 | 538 | ||
535 | 539 | ||
536 | qWarning("Iterating over cats %d", c ); | 540 | qWarning("Iterating over cats %d", c ); |
537 | for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) | 541 | for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) |
538 | m_catMenu->setItemChecked(i, c == (int)i ); | 542 | m_catMenu->setItemChecked(i, c == (int)i ); |
539 | 543 | ||
540 | if (c == 1 ) { | 544 | if (c == 1 ) { |
541 | m_curCat = QString::null; | 545 | m_curCat = QString::null; |
542 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); | 546 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); |
543 | 547 | ||
544 | }else if ( c == (int)m_catMenu->count() - 1 ) { | 548 | }else if ( c == (int)m_catMenu->count() - 1 ) { |
545 | m_curCat = QWidget::tr("Unfiled"); | 549 | m_curCat = QWidget::tr("Unfiled"); |
546 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); | 550 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); |
547 | }else { | 551 | }else { |
548 | m_curCat = m_todoMgr.categories()[c-2]; | 552 | m_curCat = m_todoMgr.categories()[c-2]; |
549 | setCaption( QWidget::tr("Todo") + " - " + m_curCat ); | 553 | setCaption( QWidget::tr("Todo") + " - " + m_curCat ); |
550 | } | 554 | } |
551 | m_catMenu->setItemChecked( c, true ); | 555 | m_catMenu->setItemChecked( c, true ); |
552 | 556 | ||
553 | currentView()->setShowCategory( m_curCat ); | 557 | currentView()->setShowCategory( m_curCat ); |
554 | raiseCurrentView(); | 558 | raiseCurrentView(); |
555 | } | 559 | } |
556 | void MainWindow::slotShowDeadLine( bool dead) { | 560 | void MainWindow::slotShowDeadLine( bool dead) { |
557 | m_deadline = dead; | 561 | m_deadline = dead; |
558 | currentView()->setShowDeadline( dead ); | 562 | currentView()->setShowDeadline( dead ); |
559 | } | 563 | } |
560 | void MainWindow::slotShowCompleted( bool show) { | 564 | void MainWindow::slotShowCompleted( bool show) { |
561 | m_completed = show; | 565 | m_completed = show; |
562 | currentView()->setShowCompleted( m_completed ); | 566 | currentView()->setShowCompleted( m_completed ); |
563 | } | 567 | } |
564 | void MainWindow::slotShowQuickTask( bool show ) { | 568 | void MainWindow::slotShowQuickTask( bool show ) { |
565 | m_quicktask = show; | 569 | m_quicktask = show; |
566 | if ( m_quicktask ) | 570 | if ( m_quicktask ) |
567 | m_curQuick->widget()->show(); | 571 | m_curQuick->widget()->show(); |
568 | else | 572 | else |
569 | m_curQuick->widget()->hide(); | 573 | m_curQuick->widget()->hide(); |
570 | } | 574 | } |
571 | bool MainWindow::showOverDue()const { | 575 | bool MainWindow::showOverDue()const { |
572 | return m_overdue; | 576 | return m_overdue; |
573 | } | 577 | } |
574 | void MainWindow::setDocument( const QString& fi) { | 578 | void MainWindow::setDocument( const QString& fi) { |
575 | DocLnk doc(fi); | 579 | DocLnk doc(fi); |
576 | if (doc.isValid() ) | 580 | if (doc.isValid() ) |
577 | receiveFile(doc.file() ); | 581 | receiveFile(doc.file() ); |
578 | else | 582 | else |
579 | receiveFile(fi ); | 583 | receiveFile(fi ); |
580 | } | 584 | } |
581 | 585 | ||
582 | static const char *beamfile = "/tmp/opie-todo.vcs"; | 586 | static const char *beamfile = "/tmp/opie-todo.vcs"; |
583 | void MainWindow::slotBeam() { | 587 | void MainWindow::slotBeam() { |
584 | beam( currentView()->current() ); | 588 | beam( currentView()->current() ); |
585 | } | 589 | } |
586 | void MainWindow::beamDone( Ir* ir) { | 590 | void MainWindow::beamDone( Ir* ir) { |
587 | delete ir; | 591 | delete ir; |
588 | ::unlink( beamfile ); | 592 | ::unlink( beamfile ); |
589 | } | 593 | } |
590 | void MainWindow::receiveFile( const QString& filename ) { | 594 | void MainWindow::receiveFile( const QString& filename ) { |
591 | OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); | 595 | OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); |
592 | 596 | ||
593 | OTodoAccess acc( cal ); | 597 | OTodoAccess acc( cal ); |
594 | acc.load(); | 598 | acc.load(); |
595 | OTodoAccess::List list = acc.allRecords(); | 599 | OTodoAccess::List list = acc.allRecords(); |
596 | 600 | ||
597 | if (list.count()){ | 601 | if (list.count()){ |
598 | 602 | ||
599 | QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); | 603 | QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); |
600 | 604 | ||
601 | if ( QMessageBox::information(this, QWidget::tr("New Tasks"), | 605 | if ( QMessageBox::information(this, QWidget::tr("New Tasks"), |
602 | message, QMessageBox::Ok, | 606 | message, QMessageBox::Ok, |
603 | QMessageBox::Cancel ) == QMessageBox::Ok ) { | 607 | QMessageBox::Cancel ) == QMessageBox::Ok ) { |
604 | OTodoAccess::List::Iterator it; | 608 | OTodoAccess::List::Iterator it; |
605 | for ( it = list.begin(); it != list.end(); ++it ) | 609 | for ( it = list.begin(); it != list.end(); ++it ) |
606 | m_todoMgr.add( (*it) ); | 610 | m_todoMgr.add( (*it) ); |
607 | 611 | ||
608 | currentView()->updateView(); | 612 | currentView()->updateView(); |
609 | } | 613 | } |
610 | } | 614 | } |
611 | } | 615 | } |
612 | 616 | ||
613 | void MainWindow::slotFlush() { | 617 | void MainWindow::slotFlush() { |
614 | m_syncing = FALSE; | 618 | m_syncing = TRUE; |
615 | m_todoMgr.save(); | 619 | m_todoMgr.save(); |
616 | } | 620 | } |
617 | void MainWindow::slotShowDetails() { | 621 | void MainWindow::slotShowDetails() { |
618 | slotShow( currentView()->current() ); | 622 | slotShow( currentView()->current() ); |
619 | } | 623 | } |
620 | /* | 624 | /* |
621 | * populate the Categories | 625 | * populate the Categories |
622 | * Menu | 626 | * Menu |
623 | */ | 627 | */ |
624 | void MainWindow::populateCategories() { | 628 | void MainWindow::populateCategories() { |
625 | m_todoMgr.load(); | 629 | m_todoMgr.load(); |
626 | 630 | ||
627 | m_catMenu->clear(); | 631 | m_catMenu->clear(); |
628 | int id, rememberId; | 632 | int id, rememberId; |
629 | id = 1; | 633 | id = 1; |
630 | rememberId = 1; | 634 | rememberId = 1; |
631 | 635 | ||
632 | m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); | 636 | m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); |
633 | m_catMenu->insertSeparator(); | 637 | m_catMenu->insertSeparator(); |
634 | QStringList categories = m_todoMgr.categories(); | 638 | QStringList categories = m_todoMgr.categories(); |
635 | categories.append( QWidget::tr( "Unfiled" ) ); | 639 | categories.append( QWidget::tr( "Unfiled" ) ); |
636 | for ( QStringList::Iterator it = categories.begin(); | 640 | for ( QStringList::Iterator it = categories.begin(); |
637 | it != categories.end(); ++it ) { | 641 | it != categories.end(); ++it ) { |
638 | m_catMenu->insertItem( *it, id ); | 642 | m_catMenu->insertItem( *it, id ); |
639 | if ( *it == currentCategory() ) | 643 | if ( *it == currentCategory() ) |
640 | rememberId = id; | 644 | rememberId = id; |
641 | ++id; | 645 | ++id; |
642 | } | 646 | } |
643 | setCategory( rememberId ); | 647 | setCategory( rememberId ); |
644 | } | 648 | } |
645 | bool MainWindow::showCompleted()const { | 649 | bool MainWindow::showCompleted()const { |
646 | return m_completed; | 650 | return m_completed; |
647 | } | 651 | } |
648 | bool MainWindow::showDeadline()const { | 652 | bool MainWindow::showDeadline()const { |
649 | return m_deadline; | 653 | return m_deadline; |
650 | } | 654 | } |
651 | bool MainWindow::showQuickTask()const { | 655 | bool MainWindow::showQuickTask()const { |
652 | return m_quicktask; | 656 | return m_quicktask; |
653 | } | 657 | } |
654 | QString MainWindow::currentCategory()const { | 658 | QString MainWindow::currentCategory()const { |
655 | return m_curCat; | 659 | return m_curCat; |
656 | } | 660 | } |
657 | int MainWindow::currentCatId() { | 661 | int MainWindow::currentCatId() { |
658 | return m_todoMgr.catId( m_curCat ); | 662 | return m_todoMgr.catId( m_curCat ); |
659 | } | 663 | } |
660 | ViewBase* MainWindow::currentView() { | 664 | ViewBase* MainWindow::currentView() { |
661 | return m_curView; | 665 | return m_curView; |
662 | } | 666 | } |
663 | void MainWindow::raiseCurrentView() { | 667 | void MainWindow::raiseCurrentView() { |
664 | // due QPE/Application/todolist show(int) | 668 | // due QPE/Application/todolist show(int) |
665 | // we might not have the populateCategories slot called once | 669 | // we might not have the populateCategories slot called once |
666 | // we would show the otodo but then imediately switch to the currentView | 670 | // we would show the otodo but then imediately switch to the currentView |
667 | // if we're initially showing we shouldn't raise the table | 671 | // if we're initially showing we shouldn't raise the table |
668 | // in returnFromView we fix up m_showing | 672 | // in returnFromView we fix up m_showing |
669 | if (m_showing ) return; | 673 | if (m_showing ) return; |
670 | 674 | ||
671 | m_stack->raiseWidget( m_curView->widget() ); | 675 | m_stack->raiseWidget( m_curView->widget() ); |
672 | } | 676 | } |
673 | void MainWindow::slotShowDue(bool ov) { | 677 | void MainWindow::slotShowDue(bool ov) { |
674 | m_overdue = ov; | 678 | m_overdue = ov; |
675 | currentView()->showOverDue( ov ); | 679 | currentView()->showOverDue( ov ); |
676 | raiseCurrentView(); | 680 | raiseCurrentView(); |
677 | } | 681 | } |
678 | void MainWindow::slotShow( int uid ) { | 682 | void MainWindow::slotShow( int uid ) { |
679 | if ( uid == 0 ) return; | 683 | if ( uid == 0 ) return; |
680 | qWarning("slotShow"); | 684 | qWarning("slotShow"); |
681 | currentShow()->slotShow( event( uid ) ); | 685 | currentShow()->slotShow( event( uid ) ); |
682 | m_stack->raiseWidget( currentShow()->widget() ); | 686 | m_stack->raiseWidget( currentShow()->widget() ); |
683 | } | 687 | } |
684 | void MainWindow::slotShowNext() { | 688 | void MainWindow::slotShowNext() { |
685 | int l = currentView()->next(); | 689 | int l = currentView()->next(); |
686 | if (l!=0) | 690 | if (l!=0) |
687 | slotShow(l); | 691 | slotShow(l); |
688 | } | 692 | } |
689 | void MainWindow::slotShowPrev() { | 693 | void MainWindow::slotShowPrev() { |
690 | int l = currentView()->prev(); | 694 | int l = currentView()->prev(); |
691 | if (l!=0) | 695 | if (l!=0) |
692 | slotShow(l); | 696 | slotShow(l); |
693 | } | 697 | } |
694 | void MainWindow::slotEdit( int uid ) { | 698 | void MainWindow::slotEdit( int uid ) { |
695 | if (uid == 0 ) return; | 699 | if (uid == 0 ) return; |
696 | if(m_syncing) { | 700 | if(m_syncing) { |
697 | QMessageBox::warning(this, QWidget::tr("Todo"), | 701 | QMessageBox::warning(this, QWidget::tr("Todo"), |
698 | QWidget::tr("Data can't be edited, currently syncing")); | 702 | QWidget::tr("Data can't be edited, currently syncing")); |
699 | return; | 703 | return; |
700 | } | 704 | } |
701 | 705 | ||
702 | OTodo old_todo = m_todoMgr.event( uid ); | 706 | OTodo old_todo = m_todoMgr.event( uid ); |
703 | 707 | ||
704 | OTodo todo = currentEditor()->edit(this, old_todo ); | 708 | OTodo todo = currentEditor()->edit(this, old_todo ); |
705 | 709 | ||
706 | /* if completed */ | 710 | /* if completed */ |
707 | if ( currentEditor()->accepted() ) { | 711 | if ( currentEditor()->accepted() ) { |
708 | handleAlarms( old_todo, todo ); | 712 | handleAlarms( old_todo, todo ); |
709 | m_todoMgr.update( todo.uid(), todo ); | 713 | m_todoMgr.update( todo.uid(), todo ); |
710 | currentView()->replaceEvent( todo ); | 714 | currentView()->replaceEvent( todo ); |
711 | /* a Category might have changed */ | 715 | /* a Category might have changed */ |
712 | populateCategories(); | 716 | populateCategories(); |
713 | } | 717 | } |
714 | 718 | ||
715 | raiseCurrentView(); | 719 | raiseCurrentView(); |
716 | } | 720 | } |
717 | /* | 721 | /* |
718 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { | 722 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { |
719 | m_todoMgr.update( uid, ev ); | 723 | m_todoMgr.update( uid, ev ); |
720 | } | 724 | } |
721 | */ | 725 | */ |
722 | void MainWindow::updateTodo( const OTodo& ev) { | 726 | void MainWindow::updateTodo( const OTodo& ev) { |
723 | m_todoMgr.update( ev.uid() , ev ); | 727 | m_todoMgr.update( ev.uid() , ev ); |
724 | } | 728 | } |
725 | /* The view changed it's configuration | 729 | /* The view changed it's configuration |
726 | * update the view menu | 730 | * update the view menu |
727 | */ | 731 | */ |
728 | void MainWindow::slotUpdate3( QWidget* ) { | 732 | void MainWindow::slotUpdate3( QWidget* ) { |
729 | 733 | ||
730 | } | 734 | } |
731 | void MainWindow::updateList() { | 735 | void MainWindow::updateList() { |
732 | m_todoMgr.updateList(); | 736 | m_todoMgr.updateList(); |
733 | } | 737 | } |
734 | void MainWindow::setReadAhead( uint count ) { | 738 | void MainWindow::setReadAhead( uint count ) { |
735 | if (m_todoMgr.todoDB() ) | 739 | if (m_todoMgr.todoDB() ) |
736 | m_todoMgr.todoDB()->setReadAhead( count ); | 740 | m_todoMgr.todoDB()->setReadAhead( count ); |
737 | } | 741 | } |
738 | void MainWindow::slotQuickEntered() { | 742 | void MainWindow::slotQuickEntered() { |
739 | qWarning("entered"); | 743 | qWarning("entered"); |
740 | OTodo todo = quickEditor()->todo(); | 744 | OTodo todo = quickEditor()->todo(); |
741 | if (todo.isEmpty() ) | 745 | if (todo.isEmpty() ) |
742 | return; | 746 | return; |
743 | 747 | ||
744 | m_todoMgr.add( todo ); | 748 | m_todoMgr.add( todo ); |
745 | currentView()->addEvent( todo ); | 749 | currentView()->addEvent( todo ); |
746 | raiseCurrentView(); | 750 | raiseCurrentView(); |
747 | } | 751 | } |
748 | QuickEditBase* MainWindow::quickEditor() { | 752 | QuickEditBase* MainWindow::quickEditor() { |
749 | return m_curQuick; | 753 | return m_curQuick; |
750 | } | 754 | } |
751 | void MainWindow::slotComplete( int uid ) { | 755 | void MainWindow::slotComplete( int uid ) { |
752 | slotComplete( event(uid) ); | 756 | slotComplete( event(uid) ); |
753 | } | 757 | } |
754 | void MainWindow::slotComplete( const OTodo& todo ) { | 758 | void MainWindow::slotComplete( const OTodo& todo ) { |
755 | OTodo to = todo; | 759 | OTodo to = todo; |
756 | to.setCompleted( !to.isCompleted() ); | 760 | to.setCompleted( !to.isCompleted() ); |
757 | to.setCompletedDate( QDate::currentDate() ); | 761 | to.setCompletedDate( QDate::currentDate() ); |
758 | 762 | ||
759 | /* | 763 | /* |
760 | * if the item does recur | 764 | * if the item does recur |
761 | * we need to spin it off | 765 | * we need to spin it off |
762 | * and update the items duedate to the next | 766 | * and update the items duedate to the next |
763 | * possible recurrance of this item... | 767 | * possible recurrance of this item... |
764 | * the spinned off one will loose the | 768 | * the spinned off one will loose the |
765 | * recurrence. | 769 | * recurrence. |
766 | * We calculate the difference between the old due date and the | 770 | * We calculate the difference between the old due date and the |
767 | * new one and add this diff to start, completed and alarm dates | 771 | * new one and add this diff to start, completed and alarm dates |
768 | * -zecke | 772 | * -zecke |
769 | */ | 773 | */ |
770 | if ( to.hasRecurrence() && to.isCompleted() ) { | 774 | if ( to.hasRecurrence() && to.isCompleted() ) { |
771 | OTodo to2( to ); | 775 | OTodo to2( to ); |
772 | 776 | ||
773 | /* the spinned off one won't recur anymore */ | 777 | /* the spinned off one won't recur anymore */ |
774 | to.setRecurrence( ORecur() ); | 778 | to.setRecurrence( ORecur() ); |
775 | 779 | ||
776 | ORecur rec = to2.recurrence(); | 780 | ORecur rec = to2.recurrence(); |
777 | rec.setStart( to.dueDate() ); | 781 | rec.setStart( to.dueDate() ); |
778 | to2.setRecurrence( rec ); | 782 | to2.setRecurrence( rec ); |
779 | /* | 783 | /* |
780 | * if there is a next occurence | 784 | * if there is a next occurence |
781 | * from the duedate of the last recurrance | 785 | * from the duedate of the last recurrance |
782 | */ | 786 | */ |
783 | QDate date; | 787 | QDate date; |
784 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { | 788 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { |
785 | int dayDiff = to.dueDate().daysTo( date ); | 789 | int dayDiff = to.dueDate().daysTo( date ); |
786 | qWarning("day diff is %d", dayDiff ); | 790 | qWarning("day diff is %d", dayDiff ); |
787 | QDate inval; | 791 | QDate inval; |
788 | /* generate a new uid for the old record */ | 792 | /* generate a new uid for the old record */ |
789 | to.setUid( 1 ); | 793 | to.setUid( 1 ); |
790 | 794 | ||
791 | /* add the old one cause it has a new UID here cause it was spin off */ | 795 | /* add the old one cause it has a new UID here cause it was spin off */ |
792 | m_todoMgr.add( to ); | 796 | m_todoMgr.add( to ); |
793 | 797 | ||
794 | /* | 798 | /* |
795 | * update the due date | 799 | * update the due date |
796 | * start date | 800 | * start date |
797 | * and complete date | 801 | * and complete date |
798 | */ | 802 | */ |
799 | to2.setDueDate( date ); | 803 | to2.setDueDate( date ); |
800 | rec.setStart( date ); | 804 | rec.setStart( date ); |
801 | to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week | 805 | to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week |
802 | 806 | ||
803 | /* move start date */ | 807 | /* move start date */ |
804 | if (to2.hasStartDate() ) | 808 | if (to2.hasStartDate() ) |
805 | to2.setStartDate( to2.startDate().addDays( dayDiff ) ); | 809 | to2.setStartDate( to2.startDate().addDays( dayDiff ) ); |
806 | 810 | ||
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index b04a958..bd341c2 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -1,208 +1,211 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 3 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This program is free software; you can | 5 | _;:, .> :=|. This program is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This program is distributed in the hope that | 12 | .i_,=:_. -<s. This program is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef TODO_MAIN_WINDOW_H | 29 | #ifndef TODO_MAIN_WINDOW_H |
30 | #define TODO_MAIN_WINDOW_H | 30 | #define TODO_MAIN_WINDOW_H |
31 | 31 | ||
32 | #include <qlist.h> | 32 | #include <qlist.h> |
33 | 33 | ||
34 | #include <opie/otodoaccess.h> | 34 | #include <opie/otodoaccess.h> |
35 | #include <opie/otodo.h> | 35 | #include <opie/otodo.h> |
36 | #include <opie/opimmainwindow.h> | 36 | #include <opie/opimmainwindow.h> |
37 | 37 | ||
38 | #include "smalltodo.h" | 38 | #include "smalltodo.h" |
39 | #include "todoview.h" | 39 | #include "todoview.h" |
40 | #include "quickedit.h" | 40 | #include "quickedit.h" |
41 | #include "todomanager.h" | 41 | #include "todomanager.h" |
42 | 42 | ||
43 | class QPopupMenu; | 43 | class QPopupMenu; |
44 | class QMenuBar; | 44 | class QMenuBar; |
45 | class QToolBar; | 45 | class QToolBar; |
46 | class QAction; | 46 | class QAction; |
47 | class QWidgetStack; | 47 | class QWidgetStack; |
48 | class Ir; | 48 | class Ir; |
49 | class QVBox; | 49 | class QVBox; |
50 | class QLineEdit; | 50 | class QLineEdit; |
51 | 51 | ||
52 | namespace Todo { | 52 | namespace Todo { |
53 | typedef TodoView View; | 53 | typedef TodoView View; |
54 | class TemplateManager; | 54 | class TemplateManager; |
55 | class Editor; | 55 | class Editor; |
56 | class TodoShow; | 56 | class TodoShow; |
57 | class TemplateEditor; | 57 | class TemplateEditor; |
58 | struct QuickEditBase; | 58 | struct QuickEditBase; |
59 | 59 | ||
60 | class MainWindow : public OPimMainWindow { | 60 | class MainWindow : public OPimMainWindow { |
61 | Q_OBJECT | 61 | Q_OBJECT |
62 | friend class TodoView; // avoid QObject here.... | 62 | friend class TodoView; // avoid QObject here.... |
63 | friend class TodoShow; // avoid QObject | 63 | friend class TodoShow; // avoid QObject |
64 | public: | 64 | public: |
65 | /* OApplicationFactory application Name */ | ||
66 | static QString appName() { return QString::fromLatin1("todolist"); } | ||
67 | |||
65 | MainWindow( QWidget *parent = 0, | 68 | MainWindow( QWidget *parent = 0, |
66 | const char* name = 0 ); | 69 | const char* name = 0, WFlags fl = 0 ); |
67 | ~MainWindow(); | 70 | ~MainWindow(); |
68 | 71 | ||
69 | /** return a context menu for an OTodo */ | 72 | /** return a context menu for an OTodo */ |
70 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); | 73 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); |
71 | QPopupMenu* options(); | 74 | QPopupMenu* options(); |
72 | QPopupMenu* edit(); | 75 | QPopupMenu* edit(); |
73 | QToolBar* toolbar(); | 76 | QToolBar* toolbar(); |
74 | 77 | ||
75 | 78 | ||
76 | void updateList(); | 79 | void updateList(); |
77 | OTodoAccess::List list()const; | 80 | OTodoAccess::List list()const; |
78 | OTodoAccess::List sorted( bool asc, int sortOrder ); | 81 | OTodoAccess::List sorted( bool asc, int sortOrder ); |
79 | OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); | 82 | OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); |
80 | 83 | ||
81 | OTodo event(int uid ); | 84 | OTodo event(int uid ); |
82 | 85 | ||
83 | bool isSyncing()const; | 86 | bool isSyncing()const; |
84 | bool showCompleted()const; | 87 | bool showCompleted()const; |
85 | bool showDeadline()const; | 88 | bool showDeadline()const; |
86 | bool showOverDue()const; | 89 | bool showOverDue()const; |
87 | bool showQuickTask()const; | 90 | bool showQuickTask()const; |
88 | QString currentCategory()const; | 91 | QString currentCategory()const; |
89 | int currentCatId(); | 92 | int currentCatId(); |
90 | TemplateManager* templateManager(); | 93 | TemplateManager* templateManager(); |
91 | QuickEditBase* quickEditor(); | 94 | QuickEditBase* quickEditor(); |
92 | 95 | ||
93 | void updateTodo( const OTodo& ); | 96 | void updateTodo( const OTodo& ); |
94 | void populateTemplates(); | 97 | void populateTemplates(); |
95 | Editor* currentEditor(); | 98 | Editor* currentEditor(); |
96 | void setReadAhead(uint count ); | 99 | void setReadAhead(uint count ); |
97 | private slots: | 100 | private slots: |
98 | void slotQuickEntered(); | 101 | void slotQuickEntered(); |
99 | void populateCategories(); | 102 | void populateCategories(); |
100 | void slotReload(); | 103 | void slotReload(); |
101 | void slotFlush(); | 104 | void slotFlush(); |
102 | 105 | ||
103 | protected: | 106 | protected: |
104 | void closeEvent( QCloseEvent* e ); | 107 | void closeEvent( QCloseEvent* e ); |
105 | 108 | ||
106 | private: | 109 | private: |
107 | /* handle setting and removing alarms */ | 110 | /* handle setting and removing alarms */ |
108 | void handleAlarms( const OTodo& oldTodo, const OTodo& newTodo ); | 111 | void handleAlarms( const OTodo& oldTodo, const OTodo& newTodo ); |
109 | void receiveFile( const QString& filename ); | 112 | void receiveFile( const QString& filename ); |
110 | void connectBase( ViewBase* ); | 113 | void connectBase( ViewBase* ); |
111 | void initUI(); | 114 | void initUI(); |
112 | void initActions(); | 115 | void initActions(); |
113 | void initConfig(); | 116 | void initConfig(); |
114 | void initViews(); | 117 | void initViews(); |
115 | void initEditor(); | 118 | void initEditor(); |
116 | void initShow(); | 119 | void initShow(); |
117 | void initTemplate(); | 120 | void initTemplate(); |
118 | void raiseCurrentView(); | 121 | void raiseCurrentView(); |
119 | ViewBase* currentView(); | 122 | ViewBase* currentView(); |
120 | ViewBase* m_curView; | 123 | ViewBase* m_curView; |
121 | bool m_showing : 1; // used to see if we show a todo in the cases we shouldn't change the table | 124 | bool m_showing : 1; // used to see if we show a todo in the cases we shouldn't change the table |
122 | QuickEditBase* m_curQuick; | 125 | QuickEditBase* m_curQuick; |
123 | Editor* m_curEdit; | 126 | Editor* m_curEdit; |
124 | TodoShow* currentShow(); | 127 | TodoShow* currentShow(); |
125 | TodoShow* m_curShow; | 128 | TodoShow* m_curShow; |
126 | TemplateEditor* currentTemplateEditor(); | 129 | TemplateEditor* currentTemplateEditor(); |
127 | TemplateEditor* m_curTempEd; | 130 | TemplateEditor* m_curTempEd; |
128 | 131 | ||
129 | QMenuBar* m_bar; | 132 | QMenuBar* m_bar; |
130 | QToolBar* m_tool; | 133 | QToolBar* m_tool; |
131 | QAction* m_editAction, | 134 | QAction* m_editAction, |
132 | *m_deleteAction, | 135 | *m_deleteAction, |
133 | *m_findAction, | 136 | *m_findAction, |
134 | *m_completedAction, | 137 | *m_completedAction, |
135 | *m_showDeadLineAction, | 138 | *m_showDeadLineAction, |
136 | *m_deleteAllAction, | 139 | *m_deleteAllAction, |
137 | *m_deleteCompleteAction, | 140 | *m_deleteCompleteAction, |
138 | *m_duplicateAction, | 141 | *m_duplicateAction, |
139 | *m_showOverDueAction, | 142 | *m_showOverDueAction, |
140 | *m_showQuickTaskAction, | 143 | *m_showQuickTaskAction, |
141 | *m_effectiveAction; | 144 | *m_effectiveAction; |
142 | QWidgetStack *m_stack; | 145 | QWidgetStack *m_stack; |
143 | QPopupMenu* m_catMenu, | 146 | QPopupMenu* m_catMenu, |
144 | *m_edit, | 147 | *m_edit, |
145 | *m_options, | 148 | *m_options, |
146 | *m_template; | 149 | *m_template; |
147 | 150 | ||
148 | bool m_syncing:1; | 151 | bool m_syncing:1; |
149 | bool m_deadline:1; | 152 | bool m_deadline:1; |
150 | bool m_completed:1; | 153 | bool m_completed:1; |
151 | bool m_overdue:1; | 154 | bool m_overdue:1; |
152 | bool m_quicktask:1; | 155 | bool m_quicktask:1; |
153 | TodoManager m_todoMgr; | 156 | TodoManager m_todoMgr; |
154 | QString m_curCat; | 157 | QString m_curCat; |
155 | QList<ViewBase> m_views; | 158 | QList<ViewBase> m_views; |
156 | uint m_counter; | 159 | uint m_counter; |
157 | TemplateManager* m_tempManager; | 160 | TemplateManager* m_tempManager; |
158 | 161 | ||
159 | 162 | ||
160 | private slots: | 163 | private slots: |
161 | void slotShow(int); | 164 | void slotShow(int); |
162 | void slotEdit(int); | 165 | void slotEdit(int); |
163 | void slotUpdate3( QWidget* ); | 166 | void slotUpdate3( QWidget* ); |
164 | void slotComplete( int uid ); | 167 | void slotComplete( int uid ); |
165 | void slotComplete( const OTodo& ev ); | 168 | void slotComplete( const OTodo& ev ); |
166 | void slotNewFromTemplate(int id ); | 169 | void slotNewFromTemplate(int id ); |
167 | void slotNew(); | 170 | void slotNew(); |
168 | void slotDuplicate(); | 171 | void slotDuplicate(); |
169 | 172 | ||
170 | void slotDelete(); | 173 | void slotDelete(); |
171 | void slotDelete(int uid ); | 174 | void slotDelete(int uid ); |
172 | void slotDeleteAll(); | 175 | void slotDeleteAll(); |
173 | void slotDeleteCompleted(); | 176 | void slotDeleteCompleted(); |
174 | 177 | ||
175 | void slotEdit(); | 178 | void slotEdit(); |
176 | void slotFind(); | 179 | void slotFind(); |
177 | 180 | ||
178 | void setCategory( int ); | 181 | void setCategory( int ); |
179 | 182 | ||
180 | void slotShowDeadLine( bool ); | 183 | void slotShowDeadLine( bool ); |
181 | void slotShowCompleted( bool ); | 184 | void slotShowCompleted( bool ); |
182 | void slotShowQuickTask( bool ); | 185 | void slotShowQuickTask( bool ); |
183 | 186 | ||
184 | void setDocument( const QString& ); | 187 | void setDocument( const QString& ); |
185 | 188 | ||
186 | 189 | ||
187 | void slotBeam(); | 190 | void slotBeam(); |
188 | void beamDone( Ir* ); | 191 | void beamDone( Ir* ); |
189 | void slotShowDetails(); | 192 | void slotShowDetails(); |
190 | void slotShowNext(); | 193 | void slotShowNext(); |
191 | void slotShowPrev(); | 194 | void slotShowPrev(); |
192 | void slotShowDue( bool ); | 195 | void slotShowDue( bool ); |
193 | void slotReturnFromView(); // for TodoShow... | 196 | void slotReturnFromView(); // for TodoShow... |
194 | /* reimplementation from opimmainwindow */ | 197 | /* reimplementation from opimmainwindow */ |
195 | protected slots: | 198 | protected slots: |
196 | void flush(); | 199 | void flush(); |
197 | void reload(); | 200 | void reload(); |
198 | int create(); | 201 | int create(); |
199 | bool remove( int uid ); | 202 | bool remove( int uid ); |
200 | void beam(int uid); | 203 | void beam(int uid); |
201 | void show( int uid ); | 204 | void show( int uid ); |
202 | void edit( int uid ); | 205 | void edit( int uid ); |
203 | void add( const OPimRecord& ); | 206 | void add( const OPimRecord& ); |
204 | void doAlarm( const QDateTime& dt, int uid ); | 207 | void doAlarm( const QDateTime& dt, int uid ); |
205 | }; | 208 | }; |
206 | } | 209 | } |
207 | 210 | ||
208 | #endif | 211 | #endif |
diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro index 4a63770..51cfde7 100644 --- a/core/pim/todo/todo.pro +++ b/core/pim/todo/todo.pro | |||
@@ -1,69 +1,49 @@ | |||
1 | TEMPLATE= app | 1 | #TEMPLATE= app |
2 | CONFIG = qt warn_on release | 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 -lopie |
48 | 48 | ||
49 | TRANSLATIONS = ../../../i18n/de/todolist.ts \ | ||
50 | ../../../i18n/nl/todolist.ts \ | ||
51 | ../../../i18n/da/todolist.ts \ | ||
52 | ../../../i18n/xx/todolist.ts \ | ||
53 | ../../../i18n/en/todolist.ts \ | ||
54 | ../../../i18n/es/todolist.ts \ | ||
55 | ../../../i18n/fr/todolist.ts \ | ||
56 | ../../../i18n/hu/todolist.ts \ | ||
57 | ../../../i18n/ja/todolist.ts \ | ||
58 | ../../../i18n/ko/todolist.ts \ | ||
59 | ../../../i18n/no/todolist.ts \ | ||
60 | ../../../i18n/pl/todolist.ts \ | ||
61 | ../../../i18n/pt/todolist.ts \ | ||
62 | ../../../i18n/pt_BR/todolist.ts \ | ||
63 | ../../../i18n/sl/todolist.ts \ | ||
64 | ../../../i18n/zh_CN/todolist.ts \ | ||
65 | ../../../i18n/zh_TW/todolist.ts | ||
66 | |||
67 | |||
68 | |||
69 | include ( $(OPIEDIR)/include.pro ) | 49 | include ( $(OPIEDIR)/include.pro ) |