-rw-r--r-- | core/pim/todo/mainwindow.cpp | 425 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 77 | ||||
-rw-r--r-- | core/pim/todo/newtaskdlg.cpp | 78 | ||||
-rw-r--r-- | core/pim/todo/newtaskdlg.h | 56 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 88 | ||||
-rw-r--r-- | core/pim/todo/tableview.h | 52 | ||||
-rw-r--r-- | core/pim/todo/templateeditor.cpp | 38 | ||||
-rw-r--r-- | core/pim/todo/templateeditor.h | 31 | ||||
-rw-r--r-- | core/pim/todo/todo.pro | 8 | ||||
-rw-r--r-- | core/pim/todo/todomanager.cpp | 43 |
10 files changed, 375 insertions, 521 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 9424c23..75da27c 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -1,28 +1,28 @@ | |||
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 | ||
@@ -39,218 +39,123 @@ | |||
39 | #include <qpe/ir.h> | 39 | #include <qpe/ir.h> |
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/qpemessagebox.h> | 41 | #include <qpe/qpemessagebox.h> |
42 | #include <qpe/alarmserver.h> | 42 | #include <qpe/alarmserver.h> |
43 | #include <qpe/qpeapplication.h> | 43 | #include <qpe/qpeapplication.h> |
44 | 44 | ||
45 | #include <qaction.h> | ||
46 | #include <qlayout.h> | ||
45 | #include <qmenubar.h> | 47 | #include <qmenubar.h> |
46 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
47 | #include <qpushbutton.h> | 49 | #include <qpushbutton.h> |
48 | #include <qaction.h> | 50 | #include <qstringlist.h> |
49 | #include <qtimer.h> | 51 | #include <qtimer.h> |
50 | #include <qlayout.h> | ||
51 | #include <qwhatsthis.h> | 52 | #include <qwhatsthis.h> |
52 | 53 | ||
53 | #include "quickeditimpl.h" | 54 | #include "quickeditimpl.h" |
54 | #include "todotemplatemanager.h" | 55 | #include "todotemplatemanager.h" |
55 | #include "templateeditor.h" | 56 | #include "templatedialogimpl.h" |
56 | #include "tableview.h" | 57 | #include "tableview.h" |
57 | 58 | ||
58 | #include "textviewshow.h" | 59 | #include "textviewshow.h" |
59 | #include "todoeditor.h" | 60 | #include "todoeditor.h" |
61 | #include "newtaskdlg.h" | ||
60 | #include "mainwindow.h" | 62 | #include "mainwindow.h" |
61 | 63 | ||
62 | using Opie::Core::OApplicationFactory; | 64 | using Opie::Core::OApplicationFactory; |
63 | OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) | 65 | OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) |
64 | 66 | ||
65 | using namespace Opie; | 67 | using namespace Opie; |
66 | using namespace Todo; | 68 | using namespace Todo; |
67 | 69 | ||
68 | MainWindow::MainWindow( QWidget* parent, | 70 | MainWindow::MainWindow( QWidget* parent, |
69 | const char* name, WFlags ) | 71 | const char* name, WFlags ) |
70 | : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) | 72 | : Opie::OPimMainWindow( "Todolist", tr( "Todo List" ), "Todo List", tr( "Task" ), "todo", |
73 | parent, name, WType_TopLevel | WStyle_ContextHelp ) | ||
71 | { | 74 | { |
72 | if (!name) | 75 | if (!name) |
73 | setName("todo window"); | 76 | setName("todo window"); |
74 | 77 | ||
75 | m_syncing = false; | 78 | m_syncing = false; |
76 | m_showing = false; | 79 | m_showing = false; |
77 | m_counter = 0; | 80 | m_counter = 0; |
78 | m_tempManager = new TemplateManager(); | 81 | m_tempManager = new TemplateManager(); |
79 | m_tempManager->load(); | 82 | m_tempManager->load(); |
80 | 83 | ||
81 | initUI(); | ||
82 | initConfig(); | 84 | initConfig(); |
85 | initUI(); | ||
83 | initViews(); | 86 | initViews(); |
84 | initActions(); | 87 | initActions(); |
85 | initEditor(); | 88 | initEditor(); |
86 | initShow(); | 89 | initShow(); |
87 | initTemplate(); | ||
88 | 90 | ||
89 | populateTemplates(); | ||
90 | raiseCurrentView(); | 91 | raiseCurrentView(); |
91 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); | 92 | QTimer::singleShot( 0, this, SLOT(initStuff()) ); |
92 | } | 93 | } |
93 | void MainWindow::initTemplate() { | 94 | void MainWindow::initStuff() { |
94 | m_curTempEd = new TemplateEditor( this, templateManager() ); | 95 | m_todoMgr.load(); |
96 | setViewCategory( m_curCat ); | ||
97 | setCategory( m_curCat ); | ||
95 | } | 98 | } |
96 | void MainWindow::initActions() { | 99 | void MainWindow::initActions() { |
97 | 100 | // Insert Task menu items | |
98 | // Data menu | 101 | QActionGroup *items = new QActionGroup( this, QString::null, false ); |
99 | m_edit->insertItem(QWidget::tr("New from template"), m_template, | 102 | |
100 | -1, 0 ); | 103 | m_deleteCompleteAction = new QAction( QString::null, QWidget::tr( "Delete completed" ), |
101 | 104 | 0, items, 0 ); | |
102 | QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), | 105 | connect( m_deleteCompleteAction, SIGNAL(activated()), this, SLOT(slotDeleteCompleted()) ); |
103 | QString::null, 0, this, 0 ); | 106 | |
104 | connect(a, SIGNAL( activated() ), | 107 | insertItemMenuItems( items ); |
105 | this, SLOT( slotNew() ) ); | 108 | |
106 | a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); | 109 | // Insert View menu items |
107 | a->addTo(m_tool ); | 110 | items = new QActionGroup( this, QString::null, false ); |
108 | a->addTo(m_edit ); | 111 | |
109 | |||
110 | a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), | ||
111 | QString::null, 0, this, 0 ); | ||
112 | connect(a, SIGNAL(activated() ), | ||
113 | this, SLOT( slotEdit() ) ); | ||
114 | a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); | ||
115 | a->addTo( m_tool ); | ||
116 | a->addTo( m_edit ); | ||
117 | m_editAction = a; | ||
118 | |||
119 | a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); | ||
120 | connect(a, SIGNAL( activated() ), | ||
121 | this, SLOT( slotShowDetails() ) ); | ||
122 | a->addTo( m_edit ); | ||
123 | |||
124 | m_edit->insertSeparator(); | ||
125 | |||
126 | a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ), | ||
127 | QString::null, 0, this, 0 ); | ||
128 | connect(a, SIGNAL(activated() ), | ||
129 | this, SLOT(slotDelete() ) ); | ||
130 | a->setWhatsThis( QWidget::tr( "Click here to remove the current task." ) ); | ||
131 | a->addTo( m_tool ); | ||
132 | a->addTo( m_edit ); | ||
133 | m_deleteAction = a; | ||
134 | |||
135 | a = new QAction( QString::null, QWidget::tr("Delete all..."), 0, this, 0 ); | ||
136 | connect(a, SIGNAL( activated() ), | ||
137 | this, SLOT( slotDeleteAll() ) ); | ||
138 | a->addTo(m_edit ); | ||
139 | m_deleteAllAction = a; | ||
140 | |||
141 | a = new QAction( QString::null, QWidget::tr("Delete completed"), | ||
142 | 0, this, 0 ); | ||
143 | connect(a, SIGNAL( activated() ), | ||
144 | this, SLOT( slotDeleteCompleted() ) ); | ||
145 | a->addTo(m_edit ); | ||
146 | a->setEnabled( TRUE ); | ||
147 | m_deleteCompleteAction = a; | ||
148 | |||
149 | m_edit->insertSeparator(); | ||
150 | |||
151 | a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 ); | ||
152 | connect(a, SIGNAL( activated() ), | ||
153 | this, SLOT( slotDuplicate() ) ); | ||
154 | a->addTo(m_edit ); | ||
155 | m_duplicateAction = a; | ||
156 | |||
157 | m_edit->insertSeparator(); | ||
158 | |||
159 | if ( Ir::supported() ) { | ||
160 | a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); | ||
161 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | ||
162 | a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) ); | ||
163 | a->addTo( m_edit ); | ||
164 | a->addTo( m_tool ); | ||
165 | } | ||
166 | |||
167 | #if 0 | ||
168 | // Options menu | ||
169 | a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ), | ||
170 | QString::null, 0, this, 0 ); | ||
171 | connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | ||
172 | a->addTo( m_options ); | ||
173 | m_findAction = a; | ||
174 | |||
175 | |||
176 | m_options->insertSeparator(); | ||
177 | #endif | ||
178 | |||
179 | m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), | 112 | m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), |
180 | 0, this, 0, TRUE ); | 113 | 0, items, 0, true ); |
181 | m_completedAction->addTo( m_options ); | ||
182 | m_completedAction->setOn( showCompleted() ); | 114 | m_completedAction->setOn( showCompleted() ); |
183 | connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); | 115 | connect( m_completedAction, SIGNAL(toggled(bool)), this, SLOT(slotShowCompleted(bool)) ); |
184 | 116 | ||
185 | a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), | 117 | QAction *a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), |
186 | 0, this, 0, TRUE ); | 118 | 0, items, 0, true ); |
187 | a->addTo( m_options ); | ||
188 | a->setOn( showOverDue() ); | 119 | a->setOn( showOverDue() ); |
189 | connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); | 120 | connect( a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool)) ); |
190 | 121 | ||
191 | m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), | 122 | m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), |
192 | 0, this, 0, TRUE ); | 123 | 0, items, 0, true ); |
193 | m_showDeadLineAction->addTo( m_options ); | ||
194 | m_showDeadLineAction->setOn( showDeadline() ); | 124 | m_showDeadLineAction->setOn( showDeadline() ); |
195 | connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine(bool) ) ); | 125 | connect( m_showDeadLineAction, SIGNAL(toggled(bool)), this, SLOT(slotShowDeadLine(bool)) ); |
196 | 126 | ||
197 | m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), | 127 | m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), |
198 | 0, this, 0, TRUE ); | 128 | 0, items, 0, true ); |
199 | m_showQuickTaskAction->addTo( m_options ); | ||
200 | m_showQuickTaskAction->setOn( showQuickTask() ); | 129 | m_showQuickTaskAction->setOn( showQuickTask() ); |
201 | connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); | 130 | connect( m_showQuickTaskAction, SIGNAL(toggled(bool)), this, SLOT(slotShowQuickTask(bool)) ); |
202 | 131 | ||
203 | m_options->insertSeparator(); | 132 | insertViewMenuItems( items ); |
204 | |||
205 | m_bar->insertItem( QWidget::tr("Data") ,m_edit ); | ||
206 | m_bar->insertItem( QWidget::tr("Category"), m_catMenu ); | ||
207 | m_bar->insertItem( QWidget::tr("Options"), m_options ); | ||
208 | |||
209 | m_curQuick = new QuickEditImpl( this, m_quicktask ); | ||
210 | addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE ); | ||
211 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); | ||
212 | |||
213 | } | 133 | } |
214 | /* m_curCat from Config */ | 134 | /* m_curCat from Config */ |
215 | void MainWindow::initConfig() { | 135 | void MainWindow::initConfig() { |
216 | Config config( "todo" ); | 136 | Config config( "todo" ); |
217 | config.setGroup( "View" ); | 137 | config.setGroup( "View" ); |
218 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); | 138 | m_completed = config.readBoolEntry( "ShowComplete", true ); |
219 | m_curCat = config.readEntry( "Category", QString::null ); | 139 | m_curCat = config.readEntry( "Category", QString::null ); |
220 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); | 140 | m_deadline = config.readBoolEntry( "ShowDeadLine", true); |
221 | m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); | 141 | m_overdue = config.readBoolEntry("ShowOverDue", false ); |
222 | m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); | 142 | m_quicktask = config.readBoolEntry("ShowQuickTask", true); |
223 | } | 143 | } |
224 | void MainWindow::initUI() { | 144 | void MainWindow::initUI() { |
225 | 145 | // Create main widget stack | |
226 | m_stack = new Opie::Ui::OWidgetStack(this, "main stack"); | 146 | m_stack = new Opie::Ui::OWidgetStack(this, "main stack"); |
227 | |||
228 | setCentralWidget( m_stack ); | 147 | setCentralWidget( m_stack ); |
229 | 148 | connect( this, SIGNAL(categorySelected(const QString&)), | |
230 | setToolBarsMovable( FALSE ); | 149 | this, SLOT(setCategory(const QString&)) ); |
231 | 150 | ||
232 | QToolBar *menubarholder = new QToolBar( this ); | 151 | // Create quick task toolbar |
233 | menubarholder->setHorizontalStretchable( TRUE ); | 152 | m_curQuick = new QuickEditImpl( this, m_quicktask ); |
234 | m_bar = new QMenuBar( menubarholder ); | 153 | addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), |
235 | 154 | QMainWindow::Top, true ); | |
236 | m_tool = new QToolBar( this ); | 155 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered()) ); |
237 | |||
238 | /** QPopupMenu */ | ||
239 | m_edit = new QPopupMenu( this ); | ||
240 | m_options = new QPopupMenu( this ); | ||
241 | m_catMenu = new QPopupMenu( this ); | ||
242 | m_template = new QPopupMenu( this ); | ||
243 | |||
244 | m_catMenu->setCheckable( TRUE ); | ||
245 | m_template->setCheckable( TRUE ); | ||
246 | |||
247 | connect(m_catMenu, SIGNAL(activated(int) ), | ||
248 | this, SLOT(setCategory(int) ) ); | ||
249 | connect(m_template, SIGNAL(activated(int) ), | ||
250 | this, SLOT(slotNewFromTemplate(int) ) ); | ||
251 | } | 156 | } |
252 | void MainWindow::initViews() { | 157 | void MainWindow::initViews() { |
253 | 158 | ||
254 | TableView* tableView = new TableView( this, m_stack ); | 159 | TableView* tableView = new TableView( this, m_stack ); |
255 | 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." ) ); | 160 | 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 | m_stack->addWidget( tableView, m_counter++ ); | 161 | m_stack->addWidget( tableView, m_counter++ ); |
@@ -272,68 +177,42 @@ void MainWindow::initShow() { | |||
272 | MainWindow::~MainWindow() { | 177 | MainWindow::~MainWindow() { |
273 | delete templateManager(); | 178 | delete templateManager(); |
274 | } | 179 | } |
275 | void MainWindow::connectBase( ViewBase* ) { | 180 | void MainWindow::connectBase( ViewBase* ) { |
276 | // once templates and signals mix we'll use it again | 181 | // once templates and signals mix we'll use it again |
277 | } | 182 | } |
278 | QPopupMenu* MainWindow::contextMenu( int , bool recur ) { | 183 | QPopupMenu* MainWindow::contextMenu( int , bool /*recur*/ ) { |
279 | QPopupMenu* menu = new QPopupMenu(); | 184 | return itemContextMenu(); |
280 | |||
281 | m_editAction->addTo( menu ); | ||
282 | m_deleteAction->addTo( menu ); | ||
283 | m_duplicateAction->addTo( menu ); | ||
284 | |||
285 | menu->insertSeparator(); | ||
286 | |||
287 | /* | ||
288 | * if this event recurs we allow | ||
289 | * to detach it. | ||
290 | * remove all | ||
291 | */ | ||
292 | if ( recur ) { | ||
293 | ; // FIXME | ||
294 | } | ||
295 | |||
296 | return menu; | ||
297 | } | ||
298 | QPopupMenu* MainWindow::options() { | ||
299 | return m_options; | ||
300 | } | ||
301 | QPopupMenu* MainWindow::edit() { | ||
302 | return m_edit; | ||
303 | } | ||
304 | QToolBar* MainWindow::toolbar() { | ||
305 | return m_tool; | ||
306 | } | 185 | } |
307 | OPimTodoAccess::List MainWindow::list()const { | 186 | OPimTodoAccess::List MainWindow::list()const { |
308 | return m_todoMgr.list(); | 187 | return m_todoMgr.list(); |
309 | } | 188 | } |
310 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { | 189 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { |
311 | int cat = 0; | 190 | int cat = 0; |
312 | if ( m_curCat != QWidget::tr("All Categories") ) | 191 | if ( m_curCat != tr( "All" ) ) |
313 | cat = currentCatId(); | 192 | cat = currentCatId(); |
314 | if ( m_curCat == QWidget::tr("Unfiled") ) | 193 | if ( m_curCat == tr( "Unfiled" ) ) |
315 | cat = -1; | 194 | cat = -1; |
316 | 195 | ||
317 | int filter = OPimTodoAccess::FilterCategory; | 196 | int filter = OPimTodoAccess::FilterCategory; |
318 | 197 | ||
319 | if (!m_completed ) | 198 | if (!m_completed ) |
320 | filter |= OPimTodoAccess::DoNotShowCompleted; | 199 | filter |= OPimTodoAccess::DoNotShowCompleted; |
321 | if (m_overdue) | 200 | if (m_overdue) |
322 | filter |= OPimTodoAccess::OnlyOverDue; | 201 | filter |= OPimTodoAccess::OnlyOverDue; |
323 | 202 | ||
324 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); | 203 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); |
325 | } | 204 | } |
326 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { | 205 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { |
327 | int cat = 0; | 206 | int cat = 0; |
328 | if ( m_curCat != QWidget::tr("All Categories") ) | 207 | if ( m_curCat != tr( "All" ) ) |
329 | cat = currentCatId(); | 208 | cat = currentCatId(); |
330 | 209 | ||
331 | if ( m_curCat == QWidget::tr("Unfiled") ) | 210 | if ( m_curCat == tr( "Unfiled" ) ) |
332 | cat = -1; | 211 | cat = -1; |
333 | 212 | ||
334 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); | 213 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); |
335 | } | 214 | } |
336 | OPimTodo MainWindow::event( int uid ) { | 215 | OPimTodo MainWindow::event( int uid ) { |
337 | return m_todoMgr.event( uid ); | 216 | return m_todoMgr.event( uid ); |
338 | } | 217 | } |
339 | bool MainWindow::isSyncing()const { | 218 | bool MainWindow::isSyncing()const { |
@@ -346,13 +225,13 @@ Editor* MainWindow::currentEditor() { | |||
346 | return m_curEdit; | 225 | return m_curEdit; |
347 | } | 226 | } |
348 | TodoShow* MainWindow::currentShow() { | 227 | TodoShow* MainWindow::currentShow() { |
349 | return m_curShow; | 228 | return m_curShow; |
350 | } | 229 | } |
351 | void MainWindow::slotReload() { | 230 | void MainWindow::slotReload() { |
352 | m_syncing = FALSE; | 231 | m_syncing = false; |
353 | m_todoMgr.reload(); | 232 | m_todoMgr.reload(); |
354 | currentView()->updateView( ); | 233 | currentView()->updateView( ); |
355 | raiseCurrentView(); | 234 | raiseCurrentView(); |
356 | } | 235 | } |
357 | void MainWindow::closeEvent( QCloseEvent* e ) { | 236 | void MainWindow::closeEvent( QCloseEvent* e ) { |
358 | if (m_stack->visibleWidget() == currentShow()->widget() ) { | 237 | if (m_stack->visibleWidget() == currentShow()->widget() ) { |
@@ -400,52 +279,39 @@ void MainWindow::closeEvent( QCloseEvent* e ) { | |||
400 | /* save templates */ | 279 | /* save templates */ |
401 | templateManager()->save(); | 280 | templateManager()->save(); |
402 | e->accept(); | 281 | e->accept(); |
403 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows()) ); | 282 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows()) ); |
404 | } | 283 | } |
405 | } | 284 | } |
406 | void MainWindow::populateTemplates() { | 285 | void MainWindow::slotItemNew() { |
407 | m_template->clear(); | 286 | NewTaskDlg dlg( templateManager()->templates(), this ); |
408 | QStringList list = templateManager()->templates(); | 287 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) { |
409 | QStringList::Iterator it; | 288 | QString tempName = dlg.tempSelected(); |
410 | for ( it = list.begin(); it != list.end(); ++it ) { | 289 | if ( tempName.isNull() ) |
411 | m_template->insertItem( (*it) ); | 290 | // Create new, blank task |
412 | } | 291 | create(); |
413 | } | 292 | else { |
414 | /* | 293 | // Create new task from the template selected |
415 | * slotNewFromTemplate | 294 | OPimTodo event = templateManager()->templateEvent( tempName ); |
416 | * We use the edit widget to do | 295 | event = currentEditor()->edit( this, event ); |
417 | * the config but we setUid(1) | 296 | if ( currentEditor()->accepted() ) { |
418 | * to get a new uid | 297 | event.setUid( 1 ); |
419 | */ | 298 | handleAlarms( OPimTodo(), event ); |
420 | /* | 299 | m_todoMgr.add( event ); |
421 | * first we get the name of the template | 300 | currentView()->addEvent( event ); |
422 | * then we will use the TemplateManager | 301 | |
423 | */ | 302 | reloadCategories(); |
424 | void MainWindow::slotNewFromTemplate( int id ) { | 303 | } |
425 | QString name = m_template->text( id ); | 304 | raiseCurrentView(); |
426 | 305 | } | |
427 | OPimTodo event = templateManager()->templateEvent( name ); | ||
428 | event = currentEditor()->edit(this, | ||
429 | event ); | ||
430 | |||
431 | if ( currentEditor()->accepted() ) { | ||
432 | /* assign new todo */ | ||
433 | event.setUid( 1 ); | ||
434 | handleAlarms( OPimTodo(), event ); | ||
435 | m_todoMgr.add( event ); | ||
436 | currentView()->addEvent( event ); | ||
437 | |||
438 | populateCategories(); | ||
439 | } | 306 | } |
440 | raiseCurrentView(); | ||
441 | } | 307 | } |
442 | void MainWindow::slotNew() { | 308 | void MainWindow::slotItemEdit() { |
443 | create(); | 309 | slotEdit( currentView()->current() ); |
444 | } | 310 | } |
445 | void MainWindow::slotDuplicate() { | 311 | void MainWindow::slotItemDuplicate() { |
446 | if(m_syncing) { | 312 | if(m_syncing) { |
447 | QMessageBox::warning(this, QWidget::tr("Todo"), | 313 | QMessageBox::warning(this, QWidget::tr("Todo"), |
448 | QWidget::tr("Data can not be edited, currently syncing")); | 314 | QWidget::tr("Data can not be edited, currently syncing")); |
449 | return; | 315 | return; |
450 | } | 316 | } |
451 | OPimTodo ev = m_todoMgr.event( currentView()->current() ); | 317 | OPimTodo ev = m_todoMgr.event( currentView()->current() ); |
@@ -453,13 +319,13 @@ void MainWindow::slotDuplicate() { | |||
453 | ev.setUid(1); | 319 | ev.setUid(1); |
454 | m_todoMgr.add( ev ); | 320 | m_todoMgr.add( ev ); |
455 | 321 | ||
456 | currentView()->addEvent( ev ); | 322 | currentView()->addEvent( ev ); |
457 | raiseCurrentView(); | 323 | raiseCurrentView(); |
458 | } | 324 | } |
459 | void MainWindow::slotDelete() { | 325 | void MainWindow::slotItemDelete() { |
460 | if (!currentView()->current() ) | 326 | if (!currentView()->current() ) |
461 | return; | 327 | return; |
462 | 328 | ||
463 | if(m_syncing) { | 329 | if(m_syncing) { |
464 | QMessageBox::warning(this, QWidget::tr("Todo"), | 330 | QMessageBox::warning(this, QWidget::tr("Todo"), |
465 | QWidget::tr("Data can not be edited, currently syncing")); | 331 | QWidget::tr("Data can not be edited, currently syncing")); |
@@ -471,12 +337,24 @@ void MainWindow::slotDelete() { | |||
471 | 337 | ||
472 | handleAlarms( m_todoMgr.event( currentView()->current() ), OPimTodo() ); | 338 | handleAlarms( m_todoMgr.event( currentView()->current() ), OPimTodo() ); |
473 | m_todoMgr.remove( currentView()->current() ); | 339 | m_todoMgr.remove( currentView()->current() ); |
474 | currentView()->removeEvent( currentView()->current() ); | 340 | currentView()->removeEvent( currentView()->current() ); |
475 | raiseCurrentView(); | 341 | raiseCurrentView(); |
476 | } | 342 | } |
343 | |||
344 | static const char *beamfile = "/tmp/opie-todo.vcs"; | ||
345 | void MainWindow::slotItemBeam() { | ||
346 | beam( currentView()->current() ); | ||
347 | } | ||
348 | void MainWindow::slotItemFind() { | ||
349 | } | ||
350 | void MainWindow::slotConfigure() { | ||
351 | TemplateDialogImpl dlg( this, m_tempManager ); | ||
352 | if ( QPEApplication::execDialog( &dlg ) != QDialog::Accepted ) | ||
353 | m_tempManager->load(); | ||
354 | } | ||
477 | void MainWindow::slotDelete(int uid ) { | 355 | void MainWindow::slotDelete(int uid ) { |
478 | if( uid == 0 ) return; | 356 | if( uid == 0 ) return; |
479 | if(m_syncing) { | 357 | if(m_syncing) { |
480 | QMessageBox::warning(this, QWidget::tr("Todo"), | 358 | QMessageBox::warning(this, QWidget::tr("Todo"), |
481 | QWidget::tr("Data can not be edited, currently syncing")); | 359 | QWidget::tr("Data can not be edited, currently syncing")); |
482 | return; | 360 | return; |
@@ -517,41 +395,20 @@ void MainWindow::slotDeleteCompleted() { | |||
517 | return; | 395 | return; |
518 | 396 | ||
519 | 397 | ||
520 | m_todoMgr.removeCompleted(); | 398 | m_todoMgr.removeCompleted(); |
521 | currentView()->updateView( ); | 399 | currentView()->updateView( ); |
522 | } | 400 | } |
523 | void MainWindow::slotFind() { | ||
524 | |||
525 | } | ||
526 | void MainWindow::slotEdit() { | ||
527 | slotEdit( currentView()->current() ); | ||
528 | } | ||
529 | /* | 401 | /* |
530 | * set the category | 402 | * set the category |
531 | */ | 403 | */ |
532 | void MainWindow::setCategory( int c) { | 404 | void MainWindow::setCategory( const QString &category ) { |
533 | if ( c <= 0 ) return; | 405 | m_curCat = category; |
534 | 406 | if ( m_curCat == tr( "All" ) ) | |
535 | |||
536 | for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) | ||
537 | m_catMenu->setItemChecked(i, c == (int)i ); | ||
538 | |||
539 | if (c == 1 ) { | ||
540 | m_curCat = QString::null; | 407 | m_curCat = QString::null; |
541 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); | 408 | |
542 | |||
543 | }else if ( c == (int)m_catMenu->count() - 1 ) { | ||
544 | m_curCat = QWidget::tr("Unfiled"); | ||
545 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); | ||
546 | }else { | ||
547 | m_curCat = m_todoMgr.categories()[c-2]; | ||
548 | setCaption( QWidget::tr("Todo") + " - " + m_curCat ); | ||
549 | } | ||
550 | m_catMenu->setItemChecked( c, true ); | ||
551 | |||
552 | currentView()->setShowCategory( m_curCat ); | 409 | currentView()->setShowCategory( m_curCat ); |
553 | raiseCurrentView(); | 410 | raiseCurrentView(); |
554 | } | 411 | } |
555 | void MainWindow::slotShowDeadLine( bool dead) { | 412 | void MainWindow::slotShowDeadLine( bool dead) { |
556 | m_deadline = dead; | 413 | m_deadline = dead; |
557 | currentView()->setShowDeadline( dead ); | 414 | currentView()->setShowDeadline( dead ); |
@@ -574,17 +431,12 @@ void MainWindow::setDocument( const QString& fi) { | |||
574 | DocLnk doc(fi); | 431 | DocLnk doc(fi); |
575 | if (doc.isValid() ) | 432 | if (doc.isValid() ) |
576 | receiveFile(doc.file() ); | 433 | receiveFile(doc.file() ); |
577 | else | 434 | else |
578 | receiveFile(fi ); | 435 | receiveFile(fi ); |
579 | } | 436 | } |
580 | |||
581 | static const char *beamfile = "/tmp/opie-todo.vcs"; | ||
582 | void MainWindow::slotBeam() { | ||
583 | beam( currentView()->current() ); | ||
584 | } | ||
585 | void MainWindow::beamDone( Ir* ir) { | 437 | void MainWindow::beamDone( Ir* ir) { |
586 | delete ir; | 438 | delete ir; |
587 | ::unlink( beamfile ); | 439 | ::unlink( beamfile ); |
588 | } | 440 | } |
589 | void MainWindow::receiveFile( const QString& filename ) { | 441 | void MainWindow::receiveFile( const QString& filename ) { |
590 | OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(filename ); | 442 | OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(filename ); |
@@ -607,43 +459,18 @@ void MainWindow::receiveFile( const QString& filename ) { | |||
607 | currentView()->updateView(); | 459 | currentView()->updateView(); |
608 | } | 460 | } |
609 | } | 461 | } |
610 | } | 462 | } |
611 | 463 | ||
612 | void MainWindow::slotFlush() { | 464 | void MainWindow::slotFlush() { |
613 | m_syncing = TRUE; | 465 | m_syncing = true; |
614 | m_todoMgr.save(); | 466 | m_todoMgr.save(); |
615 | } | 467 | } |
616 | void MainWindow::slotShowDetails() { | 468 | void MainWindow::slotShowDetails() { |
617 | slotShow( currentView()->current() ); | 469 | slotShow( currentView()->current() ); |
618 | } | 470 | } |
619 | /* | ||
620 | * populate the Categories | ||
621 | * Menu | ||
622 | */ | ||
623 | void MainWindow::populateCategories() { | ||
624 | m_todoMgr.load(); | ||
625 | |||
626 | m_catMenu->clear(); | ||
627 | int id, rememberId; | ||
628 | id = 1; | ||
629 | rememberId = 1; | ||
630 | |||
631 | m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); | ||
632 | m_catMenu->insertSeparator(); | ||
633 | QStringList categories = m_todoMgr.categories(); | ||
634 | categories.append( QWidget::tr( "Unfiled" ) ); | ||
635 | for ( QStringList::Iterator it = categories.begin(); | ||
636 | it != categories.end(); ++it ) { | ||
637 | m_catMenu->insertItem( *it, id ); | ||
638 | if ( *it == currentCategory() ) | ||
639 | rememberId = id; | ||
640 | ++id; | ||
641 | } | ||
642 | setCategory( rememberId ); | ||
643 | } | ||
644 | bool MainWindow::showCompleted()const { | 471 | bool MainWindow::showCompleted()const { |
645 | return m_completed; | 472 | return m_completed; |
646 | } | 473 | } |
647 | bool MainWindow::showDeadline()const { | 474 | bool MainWindow::showDeadline()const { |
648 | return m_deadline; | 475 | return m_deadline; |
649 | } | 476 | } |
@@ -706,13 +533,13 @@ void MainWindow::slotEdit( int uid ) { | |||
706 | /* if completed */ | 533 | /* if completed */ |
707 | if ( currentEditor()->accepted() ) { | 534 | if ( currentEditor()->accepted() ) { |
708 | handleAlarms( old_todo, todo ); | 535 | handleAlarms( old_todo, todo ); |
709 | m_todoMgr.update( todo.uid(), todo ); | 536 | m_todoMgr.update( todo.uid(), todo ); |
710 | currentView()->replaceEvent( todo ); | 537 | currentView()->replaceEvent( todo ); |
711 | /* a Category might have changed */ | 538 | /* a Category might have changed */ |
712 | populateCategories(); | 539 | reloadCategories(); |
713 | } | 540 | } |
714 | 541 | ||
715 | raiseCurrentView(); | 542 | raiseCurrentView(); |
716 | } | 543 | } |
717 | /* | 544 | /* |
718 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { | 545 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { |
@@ -855,13 +682,13 @@ int MainWindow::create() { | |||
855 | currentView()->addEvent( todo ); | 682 | currentView()->addEvent( todo ); |
856 | 683 | ||
857 | 684 | ||
858 | // I'm afraid we must call this every time now, otherwise | 685 | // I'm afraid we must call this every time now, otherwise |
859 | // spend expensive time comparing all these strings... | 686 | // spend expensive time comparing all these strings... |
860 | // but only call if we changed something -zecke | 687 | // but only call if we changed something -zecke |
861 | populateCategories(); | 688 | reloadCategories(); |
862 | } | 689 | } |
863 | raiseCurrentView( ); | 690 | raiseCurrentView( ); |
864 | 691 | ||
865 | return uid; | 692 | return uid; |
866 | } | 693 | } |
867 | /* delete it silently... */ | 694 | /* delete it silently... */ |
@@ -912,13 +739,13 @@ void MainWindow::add( const OPimRecord& rec) { | |||
912 | currentView()->addEvent( todo ); | 739 | currentView()->addEvent( todo ); |
913 | 740 | ||
914 | 741 | ||
915 | // I'm afraid we must call this every time now, otherwise | 742 | // I'm afraid we must call this every time now, otherwise |
916 | // spend expensive time comparing all these strings... | 743 | // spend expensive time comparing all these strings... |
917 | // but only call if we changed something -zecke | 744 | // but only call if we changed something -zecke |
918 | populateCategories(); | 745 | reloadCategories(); |
919 | } | 746 | } |
920 | void MainWindow::slotReturnFromView() { | 747 | void MainWindow::slotReturnFromView() { |
921 | m_showing = false; | 748 | m_showing = false; |
922 | raiseCurrentView(); | 749 | raiseCurrentView(); |
923 | } | 750 | } |
924 | 751 | ||
@@ -1001,13 +828,13 @@ void MainWindow::doAlarm( const QDateTime& dt, int uid ) { | |||
1001 | break; | 828 | break; |
1002 | } | 829 | } |
1003 | } | 830 | } |
1004 | if (loud) | 831 | if (loud) |
1005 | startAlarm(); | 832 | startAlarm(); |
1006 | 833 | ||
1007 | QDialog dlg(this, 0, TRUE ); | 834 | QDialog dlg(this, 0, true ); |
1008 | QVBoxLayout* lay = new QVBoxLayout( &dlg ); | 835 | QVBoxLayout* lay = new QVBoxLayout( &dlg ); |
1009 | QTextView* view = new QTextView( &dlg ); | 836 | QTextView* view = new QTextView( &dlg ); |
1010 | lay->addWidget( view ); | 837 | lay->addWidget( view ); |
1011 | QPushButton* btnOk = new QPushButton( tr("Ok"), &dlg ); | 838 | QPushButton* btnOk = new QPushButton( tr("Ok"), &dlg ); |
1012 | connect( btnOk, SIGNAL(clicked() ), &dlg, SLOT(accept() ) ); | 839 | connect( btnOk, SIGNAL(clicked() ), &dlg, SLOT(accept() ) ); |
1013 | lay->addWidget( btnOk ); | 840 | lay->addWidget( btnOk ); |
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index f0d6a42..c0fe805 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -1,28 +1,28 @@ | |||
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 | ||
@@ -51,13 +51,12 @@ 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; | ||
58 | struct QuickEditBase; | 57 | struct QuickEditBase; |
59 | 58 | ||
60 | class MainWindow : public Opie::OPimMainWindow { | 59 | class MainWindow : public Opie::OPimMainWindow { |
61 | Q_OBJECT | 60 | Q_OBJECT |
62 | friend class TodoView; // avoid QObject here.... | 61 | friend class TodoView; // avoid QObject here.... |
63 | friend class TodoShow; // avoid QObject | 62 | friend class TodoShow; // avoid QObject |
@@ -68,16 +67,12 @@ namespace Todo { | |||
68 | MainWindow( QWidget *parent = 0, | 67 | MainWindow( QWidget *parent = 0, |
69 | const char* name = 0, WFlags fl = 0 ); | 68 | const char* name = 0, WFlags fl = 0 ); |
70 | ~MainWindow(); | 69 | ~MainWindow(); |
71 | 70 | ||
72 | /** return a context menu for an OPimTodo */ | 71 | /** return a context menu for an OPimTodo */ |
73 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); | 72 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); |
74 | QPopupMenu* options(); | ||
75 | QPopupMenu* edit(); | ||
76 | QToolBar* toolbar(); | ||
77 | |||
78 | 73 | ||
79 | void updateList(); | 74 | void updateList(); |
80 | OPimTodoAccess::List list()const; | 75 | OPimTodoAccess::List list()const; |
81 | OPimTodoAccess::List sorted( bool asc, int sortOrder ); | 76 | OPimTodoAccess::List sorted( bool asc, int sortOrder ); |
82 | OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); | 77 | OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); |
83 | 78 | ||
@@ -91,18 +86,16 @@ namespace Todo { | |||
91 | QString currentCategory()const; | 86 | QString currentCategory()const; |
92 | int currentCatId(); | 87 | int currentCatId(); |
93 | TemplateManager* templateManager(); | 88 | TemplateManager* templateManager(); |
94 | QuickEditBase* quickEditor(); | 89 | QuickEditBase* quickEditor(); |
95 | 90 | ||
96 | void updateTodo( const OPimTodo& ); | 91 | void updateTodo( const OPimTodo& ); |
97 | void populateTemplates(); | ||
98 | Editor* currentEditor(); | 92 | Editor* currentEditor(); |
99 | void setReadAhead(uint count ); | 93 | void setReadAhead(uint count ); |
100 | private slots: | 94 | private slots: |
101 | void slotQuickEntered(); | 95 | void slotQuickEntered(); |
102 | void populateCategories(); | ||
103 | void slotReload(); | 96 | void slotReload(); |
104 | void slotFlush(); | 97 | void slotFlush(); |
105 | 98 | ||
106 | protected: | 99 | protected: |
107 | void closeEvent( QCloseEvent* e ); | 100 | void closeEvent( QCloseEvent* e ); |
108 | 101 | ||
@@ -114,42 +107,33 @@ private slots: | |||
114 | void initUI(); | 107 | void initUI(); |
115 | void initActions(); | 108 | void initActions(); |
116 | void initConfig(); | 109 | void initConfig(); |
117 | void initViews(); | 110 | void initViews(); |
118 | void initEditor(); | 111 | void initEditor(); |
119 | void initShow(); | 112 | void initShow(); |
120 | void initTemplate(); | ||
121 | void raiseCurrentView(); | 113 | void raiseCurrentView(); |
122 | ViewBase* currentView(); | 114 | ViewBase* currentView(); |
123 | ViewBase* m_curView; | 115 | 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 | 116 | 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; | 117 | QuickEditBase* m_curQuick; |
126 | Editor* m_curEdit; | 118 | Editor* m_curEdit; |
127 | TodoShow* currentShow(); | 119 | TodoShow* currentShow(); |
128 | TodoShow* m_curShow; | 120 | TodoShow* m_curShow; |
129 | TemplateEditor* currentTemplateEditor(); | ||
130 | TemplateEditor* m_curTempEd; | ||
131 | 121 | ||
132 | QMenuBar* m_bar; | ||
133 | QToolBar* m_tool; | ||
134 | QAction* m_editAction, | 122 | QAction* m_editAction, |
135 | *m_deleteAction, | 123 | *m_deleteAction, |
136 | *m_findAction, | 124 | *m_findAction, |
137 | *m_completedAction, | 125 | *m_completedAction, |
138 | *m_showDeadLineAction, | 126 | *m_showDeadLineAction, |
139 | *m_deleteAllAction, | 127 | *m_deleteAllAction, |
140 | *m_deleteCompleteAction, | 128 | *m_deleteCompleteAction, |
141 | *m_duplicateAction, | 129 | *m_duplicateAction, |
142 | *m_showOverDueAction, | 130 | *m_showOverDueAction, |
143 | *m_showQuickTaskAction, | 131 | *m_showQuickTaskAction, |
144 | *m_effectiveAction; | 132 | *m_effectiveAction; |
145 | Opie::Ui::OWidgetStack *m_stack; | 133 | Opie::Ui::OWidgetStack *m_stack; |
146 | QPopupMenu* m_catMenu, | ||
147 | *m_edit, | ||
148 | *m_options, | ||
149 | *m_template; | ||
150 | 134 | ||
151 | bool m_syncing:1; | 135 | bool m_syncing:1; |
152 | bool m_deadline:1; | 136 | bool m_deadline:1; |
153 | bool m_completed:1; | 137 | bool m_completed:1; |
154 | bool m_overdue:1; | 138 | bool m_overdue:1; |
155 | bool m_quicktask:1; | 139 | bool m_quicktask:1; |
@@ -158,39 +142,42 @@ private slots: | |||
158 | QList<ViewBase> m_views; | 142 | QList<ViewBase> m_views; |
159 | uint m_counter; | 143 | uint m_counter; |
160 | TemplateManager* m_tempManager; | 144 | TemplateManager* m_tempManager; |
161 | 145 | ||
162 | 146 | ||
163 | private slots: | 147 | private slots: |
148 | void initStuff(); | ||
149 | |||
150 | void slotItemNew(); | ||
151 | void slotItemEdit(); | ||
152 | void slotItemDuplicate(); | ||
153 | void slotItemDelete(); | ||
154 | void slotItemBeam(); | ||
155 | void slotItemFind(); | ||
156 | void slotConfigure(); | ||
157 | |||
164 | void slotShow(int); | 158 | void slotShow(int); |
165 | void slotEdit(int); | 159 | void slotEdit(int); |
166 | void slotUpdate3( QWidget* ); | 160 | void slotUpdate3( QWidget* ); |
167 | void slotComplete( int uid ); | 161 | void slotComplete( int uid ); |
168 | void slotComplete( const OPimTodo& ev ); | 162 | void slotComplete( const OPimTodo& ev ); |
169 | void slotNewFromTemplate(int id ); | ||
170 | void slotNew(); | ||
171 | void slotDuplicate(); | ||
172 | 163 | ||
173 | void slotDelete(); | ||
174 | void slotDelete(int uid ); | 164 | void slotDelete(int uid ); |
175 | void slotDeleteAll(); | 165 | void slotDeleteAll(); |
176 | void slotDeleteCompleted(); | 166 | void slotDeleteCompleted(); |
177 | 167 | ||
178 | void slotEdit(); | ||
179 | void slotFind(); | ||
180 | 168 | ||
181 | void setCategory( int ); | 169 | void setCategory( const QString &category ); |
182 | 170 | ||
183 | void slotShowDeadLine( bool ); | 171 | void slotShowDeadLine( bool ); |
184 | void slotShowCompleted( bool ); | 172 | void slotShowCompleted( bool ); |
185 | void slotShowQuickTask( bool ); | 173 | void slotShowQuickTask( bool ); |
186 | 174 | ||
187 | void setDocument( const QString& ); | 175 | void setDocument( const QString& ); |
188 | 176 | ||
189 | 177 | ||
190 | void slotBeam(); | ||
191 | void beamDone( Ir* ); | 178 | void beamDone( Ir* ); |
192 | void slotShowDetails(); | 179 | void slotShowDetails(); |
193 | void slotShowNext(); | 180 | void slotShowNext(); |
194 | void slotShowPrev(); | 181 | void slotShowPrev(); |
195 | void slotShowDue( bool ); | 182 | void slotShowDue( bool ); |
196 | void slotReturnFromView(); // for TodoShow... | 183 | void slotReturnFromView(); // for TodoShow... |
diff --git a/core/pim/todo/newtaskdlg.cpp b/core/pim/todo/newtaskdlg.cpp new file mode 100644 index 0000000..0b5a29d --- a/dev/null +++ b/core/pim/todo/newtaskdlg.cpp | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2005 Dan Williams <drw@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This program is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This program is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #include "newtaskdlg.h" | ||
30 | |||
31 | #include <qbuttongroup.h> | ||
32 | #include <qcombobox.h> | ||
33 | #include <qlayout.h> | ||
34 | #include <qradiobutton.h> | ||
35 | |||
36 | NewTaskDlg::NewTaskDlg( const QStringList &templates, QWidget *parent ) | ||
37 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | ||
38 | { | ||
39 | setCaption( tr( "New Task" ) ); | ||
40 | |||
41 | QButtonGroup *bg = new QButtonGroup( this ); | ||
42 | bg->hide(); | ||
43 | |||
44 | QVBoxLayout *layout = new QVBoxLayout( this, 10, 3 ); | ||
45 | |||
46 | QRadioButton *btn = new QRadioButton( tr( "Blank task" ), this ); | ||
47 | btn->setChecked( true ); | ||
48 | bg->insert( btn ); | ||
49 | layout->addWidget( btn ); | ||
50 | |||
51 | layout->addStretch(); | ||
52 | |||
53 | m_useTemplate = new QRadioButton( tr( "Using template:" ), this ); | ||
54 | connect( m_useTemplate, SIGNAL(toggled(bool)), this, SLOT(slotUseTemplate(bool)) ); | ||
55 | bg->insert( m_useTemplate ); | ||
56 | layout->addWidget( m_useTemplate ); | ||
57 | |||
58 | m_templateList = new QComboBox( this ); | ||
59 | m_templateList->insertStringList( templates ); | ||
60 | m_templateList->setEnabled( false ); | ||
61 | layout->addWidget( m_templateList ); | ||
62 | |||
63 | layout->addStretch(); | ||
64 | } | ||
65 | |||
66 | QString NewTaskDlg::tempSelected() { | ||
67 | QString tempStr; | ||
68 | if ( m_useTemplate->isChecked() ) | ||
69 | tempStr = m_templateList->currentText(); | ||
70 | |||
71 | return tempStr; | ||
72 | } | ||
73 | |||
74 | void NewTaskDlg::slotUseTemplate( bool on ) { | ||
75 | m_templateList->setEnabled( on ); | ||
76 | if ( on ) | ||
77 | m_templateList->setFocus(); | ||
78 | } | ||
diff --git a/core/pim/todo/newtaskdlg.h b/core/pim/todo/newtaskdlg.h new file mode 100644 index 0000000..31398b3 --- a/dev/null +++ b/core/pim/todo/newtaskdlg.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 <> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This program is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This program is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #ifndef NEWTASKDLG_H | ||
30 | #define NEWTASKDLG_H | ||
31 | |||
32 | #include <qdialog.h> | ||
33 | |||
34 | #include <qstringlist.h> | ||
35 | |||
36 | class QComboBox; | ||
37 | class QRadioButton; | ||
38 | |||
39 | class NewTaskDlg : public QDialog | ||
40 | { | ||
41 | Q_OBJECT | ||
42 | |||
43 | public: | ||
44 | NewTaskDlg( const QStringList &templates, QWidget *parent = 0l ); | ||
45 | |||
46 | QString tempSelected(); | ||
47 | |||
48 | private: | ||
49 | QRadioButton *m_useTemplate; | ||
50 | QComboBox *m_templateList; | ||
51 | |||
52 | private slots: | ||
53 | void slotUseTemplate( bool on ); | ||
54 | }; | ||
55 | |||
56 | #endif | ||
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 221faca..c64ad46 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -1,28 +1,28 @@ | |||
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> |
@@ -30,17 +30,17 @@ | |||
30 | #include <cctype> | 30 | #include <cctype> |
31 | 31 | ||
32 | #include <opie2/odebug.h> | 32 | #include <opie2/odebug.h> |
33 | #include <opie2/opimrecurrence.h> | 33 | #include <opie2/opimrecurrence.h> |
34 | 34 | ||
35 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
36 | #include <qpe/qpeapplication.h> | ||
36 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
37 | 38 | ||
38 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
39 | #include <qlineedit.h> | 40 | #include <qlineedit.h> |
40 | #include <qtimer.h> | ||
41 | #include <qpopupmenu.h> | 41 | #include <qpopupmenu.h> |
42 | 42 | ||
43 | #include "mainwindow.h" | 43 | #include "mainwindow.h" |
44 | //#include "tableitems.h" | 44 | //#include "tableitems.h" |
45 | #include "tableview.h" | 45 | #include "tableview.h" |
46 | 46 | ||
@@ -114,25 +114,20 @@ TableView::TableView( MainWindow* window, QWidget* wid ) | |||
114 | setSorting( TRUE ); | 114 | setSorting( TRUE ); |
115 | setSelectionMode( NoSelection ); | 115 | setSelectionMode( NoSelection ); |
116 | 116 | ||
117 | setLeftMargin( 0 ); | 117 | setLeftMargin( 0 ); |
118 | verticalHeader()->hide(); | 118 | verticalHeader()->hide(); |
119 | 119 | ||
120 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | ||
120 | connect((QTable*)this, SIGNAL( clicked(int,int,int,const QPoint&) ), | 121 | connect((QTable*)this, SIGNAL( clicked(int,int,int,const QPoint&) ), |
121 | this, SLOT( slotClicked(int,int,int,const QPoint&) ) ); | 122 | this, SLOT( slotClicked(int,int,int,const QPoint&) ) ); |
122 | connect((QTable*)this, SIGNAL( pressed(int,int,int,const QPoint&) ), | ||
123 | this, SLOT( slotPressed(int,int,int,const QPoint&) ) ); | ||
124 | connect((QTable*)this, SIGNAL(valueChanged(int,int) ), | 123 | connect((QTable*)this, SIGNAL(valueChanged(int,int) ), |
125 | this, SLOT( slotValueChanged(int,int) ) ); | 124 | this, SLOT( slotValueChanged(int,int) ) ); |
126 | connect((QTable*)this, SIGNAL(currentChanged(int,int) ), | 125 | connect((QTable*)this, SIGNAL(currentChanged(int,int) ), |
127 | this, SLOT( slotCurrentChanged(int,int) ) ); | 126 | this, SLOT( slotCurrentChanged(int,int) ) ); |
128 | 127 | ||
129 | m_menuTimer = new QTimer( this ); | ||
130 | connect( m_menuTimer, SIGNAL(timeout()), | ||
131 | this, SLOT(slotShowMenu()) ); | ||
132 | |||
133 | /* now let's init the config */ | 128 | /* now let's init the config */ |
134 | initConfig(); | 129 | initConfig(); |
135 | 130 | ||
136 | 131 | ||
137 | m_enablePaint = true; | 132 | m_enablePaint = true; |
138 | setUpdatesEnabled( true ); | 133 | setUpdatesEnabled( true ); |
@@ -154,17 +149,12 @@ void TableView::newDay() { | |||
154 | TableView::~TableView() { | 149 | TableView::~TableView() { |
155 | Config config( "todo" ); | 150 | Config config( "todo" ); |
156 | config.setGroup( "Options" ); | 151 | config.setGroup( "Options" ); |
157 | for (int i = 0; i < numCols(); i++ ) | 152 | for (int i = 0; i < numCols(); i++ ) |
158 | config.writeEntry("Width"+QString::number(i), columnWidth(i) ); | 153 | config.writeEntry("Width"+QString::number(i), columnWidth(i) ); |
159 | } | 154 | } |
160 | void TableView::slotShowMenu() { | ||
161 | QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); | ||
162 | menu->exec(QCursor::pos() ); | ||
163 | delete menu; | ||
164 | } | ||
165 | QString TableView::type() const { | 155 | QString TableView::type() const { |
166 | return QString::fromLatin1( tr("Table View") ); | 156 | return QString::fromLatin1( tr("Table View") ); |
167 | } | 157 | } |
168 | int TableView::current() { | 158 | int TableView::current() { |
169 | if (numRows() == 0 ) return 0; | 159 | if (numRows() == 0 ) return 0; |
170 | int uid = sorted().uidAt(currentRow() ); | 160 | int uid = sorted().uidAt(currentRow() ); |
@@ -277,16 +267,15 @@ void TableView::setShowDeadline( bool b ) { | |||
277 | } | 267 | } |
278 | setColumnWidth( 2, col2width ); | 268 | setColumnWidth( 2, col2width ); |
279 | } | 269 | } |
280 | void TableView::setShowCategory( const QString& str) { | 270 | void TableView::setShowCategory( const QString& str) { |
281 | if ( str != m_oleCat || m_first ) | 271 | if ( str != m_oleCat || m_first ) |
282 | updateView(); | 272 | updateView(); |
283 | 273 | ||
284 | m_oleCat = str; | 274 | m_oleCat = str; |
285 | m_first = false; | 275 | m_first = false; |
286 | |||
287 | } | 276 | } |
288 | void TableView::clear() { | 277 | void TableView::clear() { |
289 | setNumRows(0); | 278 | setNumRows(0); |
290 | } | 279 | } |
291 | void TableView::slotClicked(int row, int col, int, | 280 | void TableView::slotClicked(int row, int col, int, |
292 | const QPoint& point) { | 281 | const QPoint& point) { |
@@ -323,38 +312,23 @@ void TableView::slotClicked(int row, int col, int, | |||
323 | QWidget* wid = beginEdit( row, col, FALSE ); | 312 | QWidget* wid = beginEdit( row, col, FALSE ); |
324 | m_editorWidget.setCellWidget( wid, row, col ); | 313 | m_editorWidget.setCellWidget( wid, row, col ); |
325 | } | 314 | } |
326 | break; | 315 | break; |
327 | 316 | ||
328 | case 2: { | 317 | case 2: { |
329 | m_menuTimer->stop(); | ||
330 | showTodo( ui ); | 318 | showTodo( ui ); |
331 | break; | 319 | break; |
332 | } | 320 | } |
333 | case 3: { | 321 | case 3: { |
334 | m_menuTimer->stop(); | ||
335 | TodoView::edit( ui ); | 322 | TodoView::edit( ui ); |
336 | break; | 323 | break; |
337 | } | 324 | } |
338 | } | 325 | } |
339 | 326 | ||
340 | 327 | ||
341 | } | 328 | } |
342 | void TableView::slotPressed(int row, int col, int, | ||
343 | const QPoint& point) { | ||
344 | |||
345 | m_prevP = point; | ||
346 | /* TextColumn column */ | ||
347 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) | ||
348 | m_menuTimer->start( 750, TRUE ); | ||
349 | } | ||
350 | void TableView::slotValueChanged( int, int ) { | ||
351 | } | ||
352 | void TableView::slotCurrentChanged(int, int ) { | ||
353 | m_menuTimer->stop(); | ||
354 | } | ||
355 | QWidget* TableView::widget() { | 329 | QWidget* TableView::widget() { |
356 | return this; | 330 | return this; |
357 | } | 331 | } |
358 | /* | 332 | /* |
359 | * We need to overwrite sortColumn | 333 | * We need to overwrite sortColumn |
360 | * because we want to sort whole row | 334 | * because we want to sort whole row |
@@ -576,26 +550,32 @@ void TableView::timerEvent( QTimerEvent* ) { | |||
576 | * REASON: QTable is doing auto scrolling which leads to a move | 550 | * REASON: QTable is doing auto scrolling which leads to a move |
577 | * in the x coordinate and this way it's able to pass the | 551 | * in the x coordinate and this way it's able to pass the |
578 | * m_completeStrokeWidth criteria | 552 | * m_completeStrokeWidth criteria |
579 | * WORKAROUND: strike through needs to strike through the same | 553 | * WORKAROUND: strike through needs to strike through the same |
580 | * row and two columns! | 554 | * row and two columns! |
581 | */ | 555 | */ |
582 | void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { | 556 | void TableView::contentsMouseReleaseEvent( QMouseEvent *e ) { |
583 | int row = rowAt(m_prevP.y()); | 557 | int row = rowAt(m_prevP.y()); |
584 | int colOld = columnAt(m_prevP.x() ); | 558 | int colOld = columnAt(m_prevP.x() ); |
585 | int colNew = columnAt(e->x() ); | 559 | int colNew = columnAt(e->x() ); |
586 | if ( row == rowAt( e->y() ) && row != -1 && | 560 | if ( row == rowAt( e->y() ) && row != -1 && |
587 | colOld != colNew ) { | 561 | colOld != colNew ) { |
588 | TodoView::complete( sorted()[row] ); | 562 | TodoView::complete( sorted()[row] ); |
589 | return; | 563 | return; |
590 | } | 564 | } |
591 | QTable::contentsMouseReleaseEvent( e ); | 565 | QTable::contentsMouseReleaseEvent( e ); |
592 | } | 566 | } |
593 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { | 567 | void TableView::contentsMousePressEvent( QMouseEvent *e ) { |
594 | m_menuTimer->stop(); | 568 | if ( e->button() == RightButton ) { |
595 | QTable::contentsMouseMoveEvent( e ); | 569 | QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); |
570 | menu->exec( QCursor::pos() ); | ||
571 | } | ||
572 | else { | ||
573 | m_prevP = e->pos(); | ||
574 | QTable::contentsMousePressEvent( e ); | ||
575 | } | ||
596 | } | 576 | } |
597 | void TableView::keyPressEvent( QKeyEvent* event) { | 577 | void TableView::keyPressEvent( QKeyEvent* event) { |
598 | if ( m_editorWidget.cellWidget() ) { | 578 | if ( m_editorWidget.cellWidget() ) { |
599 | // setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); | 579 | // setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); |
600 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), | 580 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), |
601 | true, true ); | 581 | true, true ); |
diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h index 7f78255..46c16e1 100644 --- a/core/pim/todo/tableview.h +++ b/core/pim/todo/tableview.h | |||
@@ -1,28 +1,28 @@ | |||
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 | ||
@@ -75,24 +75,23 @@ namespace Todo { | |||
75 | * OPimTodos 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; | ||
82 | bool m_enablePaint:1; | 81 | bool m_enablePaint:1; |
83 | QString m_oleCat; | 82 | QString m_oleCat; |
84 | bool m_first : 1; | 83 | bool m_first : 1; |
85 | 84 | ||
86 | QPixmap m_pic_completed; | 85 | QPixmap m_pic_completed; |
87 | QPixmap m_pic_priority[ 5 ]; | 86 | QPixmap m_pic_priority[ 5 ]; |
88 | 87 | ||
89 | protected: | 88 | protected: |
90 | void keyPressEvent( QKeyEvent* ); | 89 | void keyPressEvent( QKeyEvent* ); |
91 | void contentsMouseReleaseEvent( QMouseEvent* ); | 90 | void contentsMouseReleaseEvent( QMouseEvent *e ); |
92 | void contentsMouseMoveEvent( QMouseEvent* ); | 91 | void contentsMousePressEvent( QMouseEvent *e ); |
93 | void timerEvent( QTimerEvent* e ); | 92 | void timerEvent( QTimerEvent* e ); |
94 | QWidget* createEditor(int row, int col, bool initFromCell )const; | 93 | QWidget* createEditor(int row, int col, bool initFromCell )const; |
95 | void setCellContentFromEditor( int row, int col ); | 94 | void setCellContentFromEditor( int row, int col ); |
96 | /** | 95 | /** |
97 | * for inline editing on single click and to work around some | 96 | * for inline editing on single click and to work around some |
98 | * bug in qt2.3.5 | 97 | * bug in qt2.3.5 |
@@ -108,19 +107,14 @@ namespace Todo { | |||
108 | QWidget* m_wid; | 107 | QWidget* m_wid; |
109 | int m_row, m_col; | 108 | int m_row, m_col; |
110 | }; | 109 | }; |
111 | EditorWidget m_editorWidget; | 110 | EditorWidget m_editorWidget; |
112 | 111 | ||
113 | private slots: | 112 | private slots: |
114 | void slotShowMenu(); | ||
115 | void slotClicked(int, int, int, | 113 | void slotClicked(int, int, int, |
116 | const QPoint& ); | 114 | const QPoint& ); |
117 | void slotPressed(int, int, int, | ||
118 | const QPoint& ); | ||
119 | void slotValueChanged(int, int); | ||
120 | void slotCurrentChanged(int, int ); | ||
121 | void slotPriority(); | 115 | void slotPriority(); |
122 | private: | 116 | private: |
123 | void initConfig(); | 117 | void initConfig(); |
124 | int m_completeStrokeWidth; | 118 | int m_completeStrokeWidth; |
125 | bool m_row : 1; | 119 | bool m_row : 1; |
126 | QPoint m_prevP; | 120 | QPoint m_prevP; |
diff --git a/core/pim/todo/templateeditor.cpp b/core/pim/todo/templateeditor.cpp deleted file mode 100644 index ca02173..0000000 --- a/core/pim/todo/templateeditor.cpp +++ b/dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | #include <qaction.h> | ||
2 | #include <qpopupmenu.h> | ||
3 | |||
4 | #include "mainwindow.h" | ||
5 | #include "todotemplatemanager.h" | ||
6 | |||
7 | #include "templatedialogimpl.h" | ||
8 | #include "templateeditor.h" | ||
9 | |||
10 | using namespace Todo; | ||
11 | |||
12 | TemplateEditor::TemplateEditor( MainWindow* main, | ||
13 | TemplateManager* manager ) | ||
14 | : QObject( main ), m_main( main ), m_man( manager ) | ||
15 | { | ||
16 | init(); | ||
17 | |||
18 | } | ||
19 | TemplateEditor::~TemplateEditor() { | ||
20 | |||
21 | } | ||
22 | /* ok we add us to the Menubar */ | ||
23 | void TemplateEditor::init() { | ||
24 | QAction* a = new QAction( QString::null, QWidget::tr("Configure Templates"), | ||
25 | 0, this, 0, FALSE ); | ||
26 | connect(a, SIGNAL(activated() ), | ||
27 | this, SLOT(setUp() ) ); | ||
28 | |||
29 | a->addTo( m_main->options() ); | ||
30 | } | ||
31 | void TemplateEditor::setUp() { | ||
32 | TemplateDialogImpl dlg(m_main, m_man ); | ||
33 | int ret= dlg.exec(); | ||
34 | if (QDialog::Accepted != ret ) | ||
35 | m_man->load(); | ||
36 | else | ||
37 | m_main->populateTemplates(); | ||
38 | } | ||
diff --git a/core/pim/todo/templateeditor.h b/core/pim/todo/templateeditor.h deleted file mode 100644 index e551328..0000000 --- a/core/pim/todo/templateeditor.h +++ b/dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | #ifndef OPIE_TEMPLATE_EDITOR_H | ||
2 | #define OPIE_TEMPLATE_EDITOR_H | ||
3 | |||
4 | #include <qobject.h> | ||
5 | #include <qdialog.h> | ||
6 | #include <qstring.h> | ||
7 | |||
8 | namespace Todo { | ||
9 | |||
10 | class MainWindow; | ||
11 | class TemplateManager; | ||
12 | class TemplateEditor : public QObject{ | ||
13 | Q_OBJECT | ||
14 | public: | ||
15 | TemplateEditor( MainWindow* win, | ||
16 | TemplateManager* man); | ||
17 | ~TemplateEditor(); | ||
18 | |||
19 | signals: | ||
20 | void configChanged(); | ||
21 | private: | ||
22 | void init(); | ||
23 | MainWindow* m_main; | ||
24 | TemplateManager* m_man; | ||
25 | private slots: | ||
26 | void setUp(); | ||
27 | |||
28 | }; | ||
29 | }; | ||
30 | |||
31 | #endif | ||
diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro index 6c082cf..9b60818 100644 --- a/core/pim/todo/todo.pro +++ b/core/pim/todo/todo.pro | |||
@@ -8,41 +8,41 @@ HEADERS = smalltodo.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 \ | ||
15 | templatedialog.h \ | 14 | templatedialog.h \ |
16 | templatedialogimpl.h \ | 15 | templatedialogimpl.h \ |
17 | quickedit.h \ | 16 | quickedit.h \ |
18 | quickeditimpl.h \ | 17 | quickeditimpl.h \ |
19 | otaskeditor.h \ | 18 | otaskeditor.h \ |
20 | taskeditoroverview.h \ | 19 | taskeditoroverview.h \ |
21 | taskeditorstatus.h \ | 20 | taskeditorstatus.h \ |
22 | taskeditoralarms.h | 21 | taskeditoralarms.h \ |
22 | newtaskdlg.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 \ | ||
35 | templatedialog.cpp \ | 34 | templatedialog.cpp \ |
36 | templatedialogimpl.cpp \ | 35 | templatedialogimpl.cpp \ |
37 | quickeditimpl.cpp \ | 36 | quickeditimpl.cpp \ |
38 | quickedit.cpp \ | 37 | quickedit.cpp \ |
39 | otaskeditor.cpp \ | 38 | otaskeditor.cpp \ |
40 | taskeditoroverview.cpp \ | 39 | taskeditoroverview.cpp \ |
41 | taskeditorstatus.cpp \ | 40 | taskeditorstatus.cpp \ |
42 | taskeditoralarms.cpp | 41 | taskeditoralarms.cpp \ |
42 | newtaskdlg.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 -lopiecore2 -lopieui2 -lopiepim2 | 47 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiepim2 |
48 | 48 | ||
diff --git a/core/pim/todo/todomanager.cpp b/core/pim/todo/todomanager.cpp index 7136f9a..fcd5f0e 100644 --- a/core/pim/todo/todomanager.cpp +++ b/core/pim/todo/todomanager.cpp | |||
@@ -1,28 +1,28 @@ | |||
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 | ||
@@ -34,12 +34,13 @@ | |||
34 | 34 | ||
35 | using namespace Todo; | 35 | using namespace Todo; |
36 | 36 | ||
37 | TodoManager::TodoManager( QObject *obj ) | 37 | TodoManager::TodoManager( QObject *obj ) |
38 | : QObject( obj ) { | 38 | : QObject( obj ) { |
39 | m_db = 0l; | 39 | m_db = 0l; |
40 | m_cat.load( categoryFileName() ); | ||
40 | } | 41 | } |
41 | TodoManager::~TodoManager() { | 42 | TodoManager::~TodoManager() { |
42 | delete m_db; | 43 | delete m_db; |
43 | } | 44 | } |
44 | OPimTodo TodoManager::event(int uid ) { | 45 | OPimTodo TodoManager::event(int uid ) { |
45 | return m_db->find( uid ); | 46 | return m_db->find( uid ); |