summaryrefslogtreecommitdiff
authorgroucho <groucho>2003-01-29 14:55:41 (UTC)
committer groucho <groucho>2003-01-29 14:55:41 (UTC)
commit7f31c266fbd10e41c206e68bdf59ab39bca32067 (patch) (unidiff)
treed4f171a53313713651e87edeb90a55d68be56ac4
parent59a67d792570e231d2de14cee78ff75fa79453ec (diff)
downloadopie-7f31c266fbd10e41c206e68bdf59ab39bca32067.zip
opie-7f31c266fbd10e41c206e68bdf59ab39bca32067.tar.gz
opie-7f31c266fbd10e41c206e68bdf59ab39bca32067.tar.bz2
Changed some code to make all strings translatable
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp100
-rw-r--r--core/pim/todo/tableview.cpp8
-rw-r--r--core/pim/todo/taskeditoroverview.cpp2
-rw-r--r--core/pim/todo/templateeditor.cpp2
4 files changed, 56 insertions, 56 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index d16d1ac..c90166b 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -1,815 +1,815 @@
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 <qwidgetstack.h> 35#include <qwidgetstack.h>
36#include <qaction.h> 36#include <qaction.h>
37#include <qtimer.h> 37#include <qtimer.h>
38#include <qvbox.h> 38#include <qvbox.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qwhatsthis.h> 40#include <qwhatsthis.h>
41 41
42#include <qpe/applnk.h> 42#include <qpe/applnk.h>
43#include <qpe/config.h> 43#include <qpe/config.h>
44#include <qpe/ir.h> 44#include <qpe/ir.h>
45#include <qpe/resource.h> 45#include <qpe/resource.h>
46#include <qpe/qpemessagebox.h> 46#include <qpe/qpemessagebox.h>
47#include <qpe/qpetoolbar.h> 47#include <qpe/qpetoolbar.h>
48 48
49#include <opie/orecur.h> 49#include <opie/orecur.h>
50#include <opie/otodoaccessvcal.h> 50#include <opie/otodoaccessvcal.h>
51 51
52#include "quickeditimpl.h" 52#include "quickeditimpl.h"
53#include "todotemplatemanager.h" 53#include "todotemplatemanager.h"
54#include "templateeditor.h" 54#include "templateeditor.h"
55#include "tableview.h" 55#include "tableview.h"
56 56
57#include "textviewshow.h" 57#include "textviewshow.h"
58#include "todoeditor.h" 58#include "todoeditor.h"
59#include "mainwindow.h" 59#include "mainwindow.h"
60 60
61 61
62using namespace Todo; 62using namespace Todo;
63 63
64MainWindow::MainWindow( QWidget* parent, 64MainWindow::MainWindow( QWidget* parent,
65 const char* name ) 65 const char* name )
66 : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) 66 : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp )
67{ 67{
68 m_syncing = false; 68 m_syncing = false;
69 m_counter = 0; 69 m_counter = 0;
70 m_tempManager = new TemplateManager(); 70 m_tempManager = new TemplateManager();
71 m_tempManager->load(); 71 m_tempManager->load();
72 72
73 initUI(); 73 initUI();
74 initConfig(); 74 initConfig();
75 initViews(); 75 initViews();
76 initActions(); 76 initActions();
77 initEditor(); 77 initEditor();
78 initShow(); 78 initShow();
79 initTemplate(); 79 initTemplate();
80 80
81 populateTemplates(); 81 populateTemplates();
82 raiseCurrentView(); 82 raiseCurrentView();
83 QTimer::singleShot(0, this, SLOT(populateCategories() ) ); 83 QTimer::singleShot(0, this, SLOT(populateCategories() ) );
84} 84}
85void MainWindow::initTemplate() { 85void MainWindow::initTemplate() {
86 m_curTempEd = new TemplateEditor( this, templateManager() ); 86 m_curTempEd = new TemplateEditor( this, templateManager() );
87} 87}
88void MainWindow::initActions() { 88void MainWindow::initActions() {
89 89
90 // Data menu 90 // Data menu
91 m_edit->insertItem(tr("New from template"), m_template, 91 m_edit->insertItem(QWidget::tr("New from template"), m_template,
92 -1, 0 ); 92 -1, 0 );
93 93
94 QAction* a = new QAction( tr("New Task" ), Resource::loadPixmap( "new" ), 94 QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ),
95 QString::null, 0, this, 0 ); 95 QString::null, 0, this, 0 );
96 connect(a, SIGNAL( activated() ), 96 connect(a, SIGNAL( activated() ),
97 this, SLOT( slotNew() ) ); 97 this, SLOT( slotNew() ) );
98 a->setWhatsThis( tr( "Click here to create a new task." ) ); 98 a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) );
99 a->addTo(m_tool ); 99 a->addTo(m_tool );
100 a->addTo(m_edit ); 100 a->addTo(m_edit );
101 101
102 a = new QAction( tr("Edit Task"), Resource::loadIconSet( "edit" ), 102 a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ),
103 QString::null, 0, this, 0 ); 103 QString::null, 0, this, 0 );
104 connect(a, SIGNAL(activated() ), 104 connect(a, SIGNAL(activated() ),
105 this, SLOT( slotEdit() ) ); 105 this, SLOT( slotEdit() ) );
106 a->setWhatsThis( tr( "Click here to modify the current task." ) ); 106 a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) );
107 a->addTo( m_tool ); 107 a->addTo( m_tool );
108 a->addTo( m_edit ); 108 a->addTo( m_edit );
109 m_editAction = a; 109 m_editAction = a;
110 110
111 a = new QAction( QString::null, tr("View Task"), 0, this, 0 ); 111 a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 );
112 connect(a, SIGNAL( activated() ), 112 connect(a, SIGNAL( activated() ),
113 this, SLOT( slotShowDetails() ) ); 113 this, SLOT( slotShowDetails() ) );
114 a->addTo( m_edit ); 114 a->addTo( m_edit );
115 115
116 m_edit->insertSeparator(); 116 m_edit->insertSeparator();
117 117
118 a = new QAction( tr("Delete..."), Resource::loadIconSet( "trash" ), 118 a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ),
119 QString::null, 0, this, 0 ); 119 QString::null, 0, this, 0 );
120 connect(a, SIGNAL(activated() ), 120 connect(a, SIGNAL(activated() ),
121 this, SLOT(slotDelete() ) ); 121 this, SLOT(slotDelete() ) );
122 a->setWhatsThis( tr( "Click here to remove the current task." ) ); 122 a->setWhatsThis( QWidget::tr( "Click here to remove the current task." ) );
123 a->addTo( m_tool ); 123 a->addTo( m_tool );
124 a->addTo( m_edit ); 124 a->addTo( m_edit );
125 m_deleteAction = a; 125 m_deleteAction = a;
126 126
127 a = new QAction( QString::null, tr("Delete all..."), 0, this, 0 ); 127 a = new QAction( QString::null, QWidget::tr("Delete all..."), 0, this, 0 );
128 connect(a, SIGNAL( activated() ), 128 connect(a, SIGNAL( activated() ),
129 this, SLOT( slotDeleteAll() ) ); 129 this, SLOT( slotDeleteAll() ) );
130 a->addTo(m_edit ); 130 a->addTo(m_edit );
131 m_deleteAllAction = a; 131 m_deleteAllAction = a;
132 132
133 a = new QAction( QString::null, tr("Delete completed"), 133 a = new QAction( QString::null, QWidget::tr("Delete completed"),
134 0, this, 0 ); 134 0, this, 0 );
135 connect(a, SIGNAL( activated() ), 135 connect(a, SIGNAL( activated() ),
136 this, SLOT( slotDeleteCompleted() ) ); 136 this, SLOT( slotDeleteCompleted() ) );
137 a->addTo(m_edit ); 137 a->addTo(m_edit );
138 a->setEnabled( TRUE ); 138 a->setEnabled( TRUE );
139 m_deleteCompleteAction = a; 139 m_deleteCompleteAction = a;
140 140
141 m_edit->insertSeparator(); 141 m_edit->insertSeparator();
142 142
143 a = new QAction( QString::null, tr("Duplicate"), 0, this, 0 ); 143 a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 );
144 connect(a, SIGNAL( activated() ), 144 connect(a, SIGNAL( activated() ),
145 this, SLOT( slotDuplicate() ) ); 145 this, SLOT( slotDuplicate() ) );
146 a->addTo(m_edit ); 146 a->addTo(m_edit );
147 m_duplicateAction = a; 147 m_duplicateAction = a;
148 148
149 m_edit->insertSeparator(); 149 m_edit->insertSeparator();
150 150
151 if ( Ir::supported() ) { 151 if ( Ir::supported() ) {
152 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); 152 a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 );
153 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); 153 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) );
154 a->setWhatsThis( tr( "Click here to send the current task to another device." ) ); 154 a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) );
155 a->addTo( m_edit ); 155 a->addTo( m_edit );
156 a->addTo( m_tool ); 156 a->addTo( m_tool );
157 } 157 }
158 158
159 // Options menu 159 // Options menu
160 a = new QAction( tr("Find"), Resource::loadIconSet( "mag" ), 160 a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ),
161 QString::null, 0, this, 0 ); 161 QString::null, 0, this, 0 );
162 connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); 162 connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) );
163 a->addTo( m_options ); 163 a->addTo( m_options );
164 m_findAction = a; 164 m_findAction = a;
165 165
166 m_options->insertSeparator(); 166 m_options->insertSeparator();
167 167
168 m_completedAction = new QAction( QString::null, tr("Show completed tasks"), 168 m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"),
169 0, this, 0, TRUE ); 169 0, this, 0, TRUE );
170 m_completedAction->addTo( m_options ); 170 m_completedAction->addTo( m_options );
171 m_completedAction->setOn( showCompleted() ); 171 m_completedAction->setOn( showCompleted() );
172 connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); 172 connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) );
173 173
174 a = new QAction( QString::null, tr("Show only over-due tasks"), 174 a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"),
175 0, this, 0, TRUE ); 175 0, this, 0, TRUE );
176 a->addTo( m_options ); 176 a->addTo( m_options );
177 a->setOn( showOverDue() ); 177 a->setOn( showOverDue() );
178 connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); 178 connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) );
179 179
180 m_showDeadLineAction = new QAction( QString::null, tr("Show task deadlines"), 180 m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"),
181 0, this, 0, TRUE ); 181 0, this, 0, TRUE );
182 m_showDeadLineAction->addTo( m_options ); 182 m_showDeadLineAction->addTo( m_options );
183 m_showDeadLineAction->setOn( showDeadline() ); 183 m_showDeadLineAction->setOn( showDeadline() );
184 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) ); 184 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) );
185 185
186 m_showQuickTaskAction = new QAction( QString::null, tr("Show quick task bar"), 186 m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"),
187 0, this, 0, TRUE ); 187 0, this, 0, TRUE );
188 m_showQuickTaskAction->addTo( m_options ); 188 m_showQuickTaskAction->addTo( m_options );
189 m_showQuickTaskAction->setOn( showQuickTask() ); 189 m_showQuickTaskAction->setOn( showQuickTask() );
190 connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); 190 connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) );
191 191
192 m_options->insertSeparator(); 192 m_options->insertSeparator();
193 193
194 m_bar->insertItem( tr("Data") ,m_edit ); 194 m_bar->insertItem( QWidget::tr("Data") ,m_edit );
195 m_bar->insertItem( tr("Category"), m_catMenu ); 195 m_bar->insertItem( QWidget::tr("Category"), m_catMenu );
196 m_bar->insertItem( tr("Options"), m_options ); 196 m_bar->insertItem( QWidget::tr("Options"), m_options );
197 197
198 m_curQuick = new QuickEditImpl( this, m_quicktask ); 198 m_curQuick = new QuickEditImpl( this, m_quicktask );
199 addToolBar( (QPEToolBar *)m_curQuick->widget(), tr( "QuickEdit" ), QMainWindow::Top, TRUE ); 199 addToolBar( (QPEToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE );
200 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); 200 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) );
201 201
202} 202}
203/* m_curCat from Config */ 203/* m_curCat from Config */
204void MainWindow::initConfig() { 204void MainWindow::initConfig() {
205 Config config( "todo" ); 205 Config config( "todo" );
206 config.setGroup( "View" ); 206 config.setGroup( "View" );
207 m_completed = config.readBoolEntry( "ShowComplete", TRUE ); 207 m_completed = config.readBoolEntry( "ShowComplete", TRUE );
208 m_curCat = config.readEntry( "Category", QString::null ); 208 m_curCat = config.readEntry( "Category", QString::null );
209 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); 209 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE);
210 m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); 210 m_overdue = config.readBoolEntry("ShowOverDue", FALSE );
211 m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); 211 m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE);
212} 212}
213void MainWindow::initUI() { 213void MainWindow::initUI() {
214 m_stack = new QWidgetStack(this, "main stack"); 214 m_stack = new QWidgetStack(this, "main stack");
215 setCentralWidget( m_stack ); 215 setCentralWidget( m_stack );
216 216
217 setToolBarsMovable( FALSE ); 217 setToolBarsMovable( FALSE );
218 218
219 m_tool = new QPEToolBar( this ); 219 m_tool = new QPEToolBar( this );
220 m_tool->setHorizontalStretchable( TRUE ); 220 m_tool->setHorizontalStretchable( TRUE );
221 221
222 m_bar = new QMenuBar( m_tool ); 222 m_bar = new QMenuBar( m_tool );
223 223
224 /** QPopupMenu */ 224 /** QPopupMenu */
225 m_edit = new QPopupMenu( this ); 225 m_edit = new QPopupMenu( this );
226 m_options = new QPopupMenu( this ); 226 m_options = new QPopupMenu( this );
227 m_catMenu = new QPopupMenu( this ); 227 m_catMenu = new QPopupMenu( this );
228 m_template = new QPopupMenu( this ); 228 m_template = new QPopupMenu( this );
229 229
230 m_catMenu->setCheckable( TRUE ); 230 m_catMenu->setCheckable( TRUE );
231 m_template->setCheckable( TRUE ); 231 m_template->setCheckable( TRUE );
232 232
233 connect(m_catMenu, SIGNAL(activated(int) ), 233 connect(m_catMenu, SIGNAL(activated(int) ),
234 this, SLOT(setCategory(int) ) ); 234 this, SLOT(setCategory(int) ) );
235 connect(m_template, SIGNAL(activated(int) ), 235 connect(m_template, SIGNAL(activated(int) ),
236 this, SLOT(slotNewFromTemplate(int) ) ); 236 this, SLOT(slotNewFromTemplate(int) ) );
237} 237}
238void MainWindow::initViews() { 238void MainWindow::initViews() {
239 TableView* tableView = new TableView( this, m_stack ); 239 TableView* tableView = new TableView( this, m_stack );
240 QWhatsThis::add( tableView, 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." ) ); 240 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." ) );
241 m_stack->addWidget( tableView, m_counter++ ); 241 m_stack->addWidget( tableView, m_counter++ );
242 m_views.append( tableView ); 242 m_views.append( tableView );
243 m_curView = tableView; 243 m_curView = tableView;
244 connectBase( tableView ); 244 connectBase( tableView );
245 /* add QString type + QString configname to 245 /* add QString type + QString configname to
246 * the View menu 246 * the View menu
247 * and subdirs for multiple views 247 * and subdirs for multiple views
248 */ 248 */
249} 249}
250void MainWindow::initEditor() { 250void MainWindow::initEditor() {
251 m_curEdit = new Editor(); 251 m_curEdit = new Editor();
252} 252}
253void MainWindow::initShow() { 253void MainWindow::initShow() {
254 m_curShow = new TextViewShow(this); 254 m_curShow = new TextViewShow(this);
255 m_stack->addWidget( m_curShow->widget() , m_counter++ ); 255 m_stack->addWidget( m_curShow->widget() , m_counter++ );
256} 256}
257MainWindow::~MainWindow() { 257MainWindow::~MainWindow() {
258 delete templateManager(); 258 delete templateManager();
259} 259}
260void MainWindow::connectBase( ViewBase* ) { 260void MainWindow::connectBase( ViewBase* ) {
261 // once templates and signals mix we'll use it again 261 // once templates and signals mix we'll use it again
262} 262}
263QPopupMenu* MainWindow::contextMenu( int , bool recur ) { 263QPopupMenu* MainWindow::contextMenu( int , bool recur ) {
264 QPopupMenu* menu = new QPopupMenu(); 264 QPopupMenu* menu = new QPopupMenu();
265 265
266 m_editAction->addTo( menu ); 266 m_editAction->addTo( menu );
267 m_deleteAction->addTo( menu ); 267 m_deleteAction->addTo( menu );
268 m_duplicateAction->addTo( menu ); 268 m_duplicateAction->addTo( menu );
269 269
270 menu->insertSeparator(); 270 menu->insertSeparator();
271 271
272 /* 272 /*
273 * if this event recurs we allow 273 * if this event recurs we allow
274 * to detach it. 274 * to detach it.
275 * remove all 275 * remove all
276 */ 276 */
277 if ( recur ) { 277 if ( recur ) {
278 ; // FIXME 278 ; // FIXME
279 } 279 }
280 280
281 return menu; 281 return menu;
282} 282}
283QPopupMenu* MainWindow::options() { 283QPopupMenu* MainWindow::options() {
284 qWarning("Options"); 284 qWarning("Options");
285 return m_options; 285 return m_options;
286} 286}
287QPopupMenu* MainWindow::edit() { 287QPopupMenu* MainWindow::edit() {
288 return m_edit; 288 return m_edit;
289} 289}
290QToolBar* MainWindow::toolbar() { 290QToolBar* MainWindow::toolbar() {
291 return m_tool; 291 return m_tool;
292} 292}
293OTodoAccess::List MainWindow::list()const { 293OTodoAccess::List MainWindow::list()const {
294 return m_todoMgr.list(); 294 return m_todoMgr.list();
295} 295}
296OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { 296OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
297 int cat = 0; 297 int cat = 0;
298 if ( m_curCat != tr("All Categories") ) 298 if ( m_curCat != QWidget::tr("All Categories") )
299 cat = currentCatId(); 299 cat = currentCatId();
300 300
301 int filter = 1; 301 int filter = 1;
302 302
303 if (!m_completed ) 303 if (!m_completed )
304 filter |= 4; 304 filter |= 4;
305 if (m_overdue) 305 if (m_overdue)
306 filter |= 2; 306 filter |= 2;
307 307
308 return m_todoMgr.sorted( asc, sortOrder, filter, cat ); 308 return m_todoMgr.sorted( asc, sortOrder, filter, cat );
309} 309}
310OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { 310OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
311 int cat = 0; 311 int cat = 0;
312 if ( m_curCat != tr("All Categories") ) 312 if ( m_curCat != QWidget::tr("All Categories") )
313 cat = currentCatId(); 313 cat = currentCatId();
314 314
315 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); 315 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat );
316} 316}
317OTodo MainWindow::event( int uid ) { 317OTodo MainWindow::event( int uid ) {
318 return m_todoMgr.event( uid ); 318 return m_todoMgr.event( uid );
319} 319}
320bool MainWindow::isSyncing()const { 320bool MainWindow::isSyncing()const {
321 return m_syncing; 321 return m_syncing;
322} 322}
323TemplateManager* MainWindow::templateManager() { 323TemplateManager* MainWindow::templateManager() {
324 return m_tempManager; 324 return m_tempManager;
325} 325}
326Editor* MainWindow::currentEditor() { 326Editor* MainWindow::currentEditor() {
327 return m_curEdit; 327 return m_curEdit;
328} 328}
329TodoShow* MainWindow::currentShow() { 329TodoShow* MainWindow::currentShow() {
330 return m_curShow; 330 return m_curShow;
331} 331}
332void MainWindow::slotReload() { 332void MainWindow::slotReload() {
333 m_todoMgr.reload(); 333 m_todoMgr.reload();
334 currentView()->updateView( ); 334 currentView()->updateView( );
335 raiseCurrentView(); 335 raiseCurrentView();
336} 336}
337void MainWindow::closeEvent( QCloseEvent* e ) { 337void MainWindow::closeEvent( QCloseEvent* e ) {
338 if (m_stack->visibleWidget() == currentShow()->widget() ) { 338 if (m_stack->visibleWidget() == currentShow()->widget() ) {
339 raiseCurrentView(); 339 raiseCurrentView();
340 e->ignore(); 340 e->ignore();
341 return; 341 return;
342 } 342 }
343 /* 343 /*
344 * we should have flushed and now we're still saving 344 * we should have flushed and now we're still saving
345 * so there is no need to flush 345 * so there is no need to flush
346 */ 346 */
347 if (m_syncing ) { 347 if (m_syncing ) {
348 e->accept(); 348 e->accept();
349 return; 349 return;
350 } 350 }
351 bool quit = false; 351 bool quit = false;
352 if ( m_todoMgr.saveAll() ){ 352 if ( m_todoMgr.saveAll() ){
353 qWarning("saved"); 353 qWarning("saved");
354 quit = true; 354 quit = true;
355 }else { 355 }else {
356 if ( QMessageBox::critical( this, tr("Out of space"), 356 if ( QMessageBox::critical( this, QWidget::tr("Out of space"),
357 tr("Todo was unable\n" 357 QWidget::tr("Todo was unable\n"
358 "to save your changes.\n" 358 "to save your changes.\n"
359 "Free up some space\n" 359 "Free up some space\n"
360 "and try again.\n" 360 "and try again.\n"
361 "\nQuit Anyway?"), 361 "\nQuit Anyway?"),
362 QMessageBox::Yes|QMessageBox::Escape, 362 QMessageBox::Yes|QMessageBox::Escape,
363 QMessageBox::No|QMessageBox::Default) 363 QMessageBox::No|QMessageBox::Default)
364 != QMessageBox::No ) { 364 != QMessageBox::No ) {
365 e->accept(); 365 e->accept();
366 quit = true; 366 quit = true;
367 }else 367 }else
368 e->ignore(); 368 e->ignore();
369 369
370 } 370 }
371 371
372 if (quit ) { 372 if (quit ) {
373 Config config( "todo" ); 373 Config config( "todo" );
374 config.setGroup( "View" ); 374 config.setGroup( "View" );
375 config.writeEntry( "ShowComplete", showCompleted() ); 375 config.writeEntry( "ShowComplete", showCompleted() );
376 config.writeEntry( "Category", currentCategory() ); 376 config.writeEntry( "Category", currentCategory() );
377 config.writeEntry( "ShowDeadLine", showDeadline()); 377 config.writeEntry( "ShowDeadLine", showDeadline());
378 config.writeEntry( "ShowOverDue", showOverDue() ); 378 config.writeEntry( "ShowOverDue", showOverDue() );
379 config.writeEntry( "ShowQuickTask", showQuickTask() ); 379 config.writeEntry( "ShowQuickTask", showQuickTask() );
380 /* save templates */ 380 /* save templates */
381 templateManager()->save(); 381 templateManager()->save();
382 e->accept(); 382 e->accept();
383 } 383 }
384} 384}
385void MainWindow::populateTemplates() { 385void MainWindow::populateTemplates() {
386 m_template->clear(); 386 m_template->clear();
387 QStringList list = templateManager()->templates(); 387 QStringList list = templateManager()->templates();
388 QStringList::Iterator it; 388 QStringList::Iterator it;
389 for ( it = list.begin(); it != list.end(); ++it ) { 389 for ( it = list.begin(); it != list.end(); ++it ) {
390 m_template->insertItem( (*it) ); 390 m_template->insertItem( (*it) );
391 } 391 }
392} 392}
393/* 393/*
394 * slotNewFromTemplate 394 * slotNewFromTemplate
395 * We use the edit widget to do 395 * We use the edit widget to do
396 * the config but we setUid(-1) 396 * the config but we setUid(-1)
397 * to get a new uid 397 * to get a new uid
398 */ 398 */
399/* 399/*
400 * first we get the name of the template 400 * first we get the name of the template
401 * then we will use the TemplateManager 401 * then we will use the TemplateManager
402 */ 402 */
403void MainWindow::slotNewFromTemplate( int id ) { 403void MainWindow::slotNewFromTemplate( int id ) {
404 QString name = m_template->text( id ); 404 QString name = m_template->text( id );
405 405
406 OTodo event = templateManager()->templateEvent( name ); 406 OTodo event = templateManager()->templateEvent( name );
407 event = currentEditor()->edit(this, 407 event = currentEditor()->edit(this,
408 event ); 408 event );
409 409
410 if ( currentEditor()->accepted() ) { 410 if ( currentEditor()->accepted() ) {
411 /* assign new todo */ 411 /* assign new todo */
412 event.setUid( -1 ); 412 event.setUid( -1 );
413 currentView()->addEvent( event ); 413 currentView()->addEvent( event );
414 m_todoMgr.add( event ); 414 m_todoMgr.add( event );
415 415
416 populateCategories(); 416 populateCategories();
417 } 417 }
418} 418}
419void MainWindow::slotNew() { 419void MainWindow::slotNew() {
420 create(); 420 create();
421} 421}
422void MainWindow::slotDuplicate() { 422void MainWindow::slotDuplicate() {
423 if(m_syncing) { 423 if(m_syncing) {
424 QMessageBox::warning(this, tr("Todo"), 424 QMessageBox::warning(this, QWidget::tr("Todo"),
425 tr("Can not edit data, currently syncing")); 425 QWidget::tr("Can not edit data, currently syncing"));
426 return; 426 return;
427 } 427 }
428 OTodo ev = m_todoMgr.event( currentView()->current() ); 428 OTodo ev = m_todoMgr.event( currentView()->current() );
429 /* let's generate a new uid */ 429 /* let's generate a new uid */
430 ev.setUid(-1); 430 ev.setUid(-1);
431 m_todoMgr.add( ev ); 431 m_todoMgr.add( ev );
432 432
433 currentView()->addEvent( ev ); 433 currentView()->addEvent( ev );
434 raiseCurrentView(); 434 raiseCurrentView();
435} 435}
436void MainWindow::slotDelete() { 436void MainWindow::slotDelete() {
437 if (!currentView()->current() ) 437 if (!currentView()->current() )
438 return; 438 return;
439 439
440 if(m_syncing) { 440 if(m_syncing) {
441 QMessageBox::warning(this, tr("Todo"), 441 QMessageBox::warning(this, QWidget::tr("Todo"),
442 tr("Can not edit data, currently syncing")); 442 QWidget::tr("Can not edit data, currently syncing"));
443 return; 443 return;
444 } 444 }
445 QString strName = currentView()->currentRepresentation(); 445 QString strName = currentView()->currentRepresentation();
446 if (!QPEMessageBox::confirmDelete(this, tr("Todo"), strName ) ) 446 if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), strName ) )
447 return; 447 return;
448 448
449 m_todoMgr.remove( currentView()->current() ); 449 m_todoMgr.remove( currentView()->current() );
450 currentView()->removeEvent( currentView()->current() ); 450 currentView()->removeEvent( currentView()->current() );
451 raiseCurrentView(); 451 raiseCurrentView();
452} 452}
453void MainWindow::slotDeleteAll() { 453void MainWindow::slotDeleteAll() {
454 if(m_syncing) { 454 if(m_syncing) {
455 QMessageBox::warning(this, tr("Todo"), 455 QMessageBox::warning(this, QWidget::tr("Todo"),
456 tr("Can not edit data, currently syncing")); 456 QWidget::tr("Can not edit data, currently syncing"));
457 return; 457 return;
458 } 458 }
459 459
460 460
461 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all tasks?") ) ) 461 if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) )
462 return; 462 return;
463 463
464 m_todoMgr.removeAll(); 464 m_todoMgr.removeAll();
465 currentView()->clear(); 465 currentView()->clear();
466 466
467 raiseCurrentView(); 467 raiseCurrentView();
468} 468}
469void MainWindow::slotDeleteCompleted() { 469void MainWindow::slotDeleteCompleted() {
470 if(m_syncing) { 470 if(m_syncing) {
471 QMessageBox::warning(this, tr("Todo"), 471 QMessageBox::warning(this, QWidget::tr("Todo"),
472 tr("Can not edit data, currently syncing")); 472 QWidget::tr("Can not edit data, currently syncing"));
473 return; 473 return;
474 } 474 }
475 475
476 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all completed tasks?") ) ) 476 if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) )
477 return; 477 return;
478 478
479 479
480 m_todoMgr.removeCompleted(); 480 m_todoMgr.removeCompleted();
481 currentView()->updateView( ); 481 currentView()->updateView( );
482} 482}
483void MainWindow::slotFind() { 483void MainWindow::slotFind() {
484 484
485} 485}
486void MainWindow::slotEdit() { 486void MainWindow::slotEdit() {
487 slotEdit( currentView()->current() ); 487 slotEdit( currentView()->current() );
488} 488}
489/* 489/*
490 * set the category 490 * set the category
491 */ 491 */
492void MainWindow::setCategory( int c) { 492void MainWindow::setCategory( int c) {
493 if ( c <= 0 ) return; 493 if ( c <= 0 ) return;
494 494
495 495
496 qWarning("Iterating over cats %d", c ); 496 qWarning("Iterating over cats %d", c );
497 for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) 497 for ( unsigned int i = 1; i < m_catMenu->count(); i++ )
498 m_catMenu->setItemChecked(i, c == (int)i ); 498 m_catMenu->setItemChecked(i, c == (int)i );
499 499
500 if (c == 1 ) { 500 if (c == 1 ) {
501 m_curCat = QString::null; 501 m_curCat = QString::null;
502 setCaption( tr("Todo") + " - " + tr("All Categories" ) ); 502 setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) );
503 503
504 }else if ( c == (int)m_catMenu->count() - 1 ) { 504 }else if ( c == (int)m_catMenu->count() - 1 ) {
505 m_curCat = tr("Unfiled"); 505 m_curCat = QWidget::tr("Unfiled");
506 setCaption( tr("Todo") + " - " + tr("Unfiled") ); 506 setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") );
507 }else { 507 }else {
508 m_curCat = m_todoMgr.categories()[c-2]; 508 m_curCat = m_todoMgr.categories()[c-2];
509 setCaption( tr("Todo") + " - " + m_curCat ); 509 setCaption( QWidget::tr("Todo") + " - " + m_curCat );
510 } 510 }
511 m_catMenu->setItemChecked( c, true ); 511 m_catMenu->setItemChecked( c, true );
512 512
513 currentView()->setShowCategory( m_curCat ); 513 currentView()->setShowCategory( m_curCat );
514 raiseCurrentView(); 514 raiseCurrentView();
515} 515}
516void MainWindow::slotShowDeadLine( bool dead) { 516void MainWindow::slotShowDeadLine( bool dead) {
517 m_deadline = dead; 517 m_deadline = dead;
518 currentView()->setShowDeadline( dead ); 518 currentView()->setShowDeadline( dead );
519} 519}
520void MainWindow::slotShowCompleted( bool show) { 520void MainWindow::slotShowCompleted( bool show) {
521 m_completed = show; 521 m_completed = show;
522 currentView()->setShowCompleted( m_completed ); 522 currentView()->setShowCompleted( m_completed );
523} 523}
524void MainWindow::slotShowQuickTask( bool show ) { 524void MainWindow::slotShowQuickTask( bool show ) {
525 m_quicktask = show; 525 m_quicktask = show;
526 if ( m_quicktask ) 526 if ( m_quicktask )
527 m_curQuick->widget()->show(); 527 m_curQuick->widget()->show();
528 else 528 else
529 m_curQuick->widget()->hide(); 529 m_curQuick->widget()->hide();
530} 530}
531bool MainWindow::showOverDue()const { 531bool MainWindow::showOverDue()const {
532 return m_overdue; 532 return m_overdue;
533} 533}
534void MainWindow::setDocument( const QString& fi) { 534void MainWindow::setDocument( const QString& fi) {
535 DocLnk doc(fi); 535 DocLnk doc(fi);
536 if (doc.isValid() ) 536 if (doc.isValid() )
537 receiveFile(doc.file() ); 537 receiveFile(doc.file() );
538 else 538 else
539 receiveFile(fi ); 539 receiveFile(fi );
540} 540}
541 541
542static const char *beamfile = "/tmp/opie-todo.vcs"; 542static const char *beamfile = "/tmp/opie-todo.vcs";
543void MainWindow::slotBeam() { 543void MainWindow::slotBeam() {
544 beam( currentView()->current() ); 544 beam( currentView()->current() );
545} 545}
546void MainWindow::beamDone( Ir* ir) { 546void MainWindow::beamDone( Ir* ir) {
547 delete ir; 547 delete ir;
548 ::unlink( beamfile ); 548 ::unlink( beamfile );
549} 549}
550void MainWindow::receiveFile( const QString& filename ) { 550void MainWindow::receiveFile( const QString& filename ) {
551 OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); 551 OTodoAccessVCal* cal = new OTodoAccessVCal(filename );
552 OTodoAccess acc( cal ); 552 OTodoAccess acc( cal );
553 acc.load(); 553 acc.load();
554 OTodoAccess::List list = acc.allRecords(); 554 OTodoAccess::List list = acc.allRecords();
555 555
556 QString message = tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); 556 QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() );
557 557
558 if ( QMessageBox::information(this, tr("New Tasks"), 558 if ( QMessageBox::information(this, QWidget::tr("New Tasks"),
559 message, QMessageBox::Ok, 559 message, QMessageBox::Ok,
560 QMessageBox::Cancel ) == QMessageBox::Ok ) { 560 QMessageBox::Cancel ) == QMessageBox::Ok ) {
561 OTodoAccess::List::Iterator it; 561 OTodoAccess::List::Iterator it;
562 for ( it = list.begin(); it != list.end(); ++it ) 562 for ( it = list.begin(); it != list.end(); ++it )
563 m_todoMgr.add( (*it) ); 563 m_todoMgr.add( (*it) );
564 564
565 currentView()->updateView(); 565 currentView()->updateView();
566 } 566 }
567} 567}
568 568
569void MainWindow::slotFlush() { 569void MainWindow::slotFlush() {
570 m_syncing = FALSE; 570 m_syncing = FALSE;
571 m_todoMgr.save(); 571 m_todoMgr.save();
572} 572}
573void MainWindow::slotShowDetails() { 573void MainWindow::slotShowDetails() {
574 slotShow( currentView()->current() ); 574 slotShow( currentView()->current() );
575} 575}
576/* 576/*
577 * populate the Categories 577 * populate the Categories
578 * Menu 578 * Menu
579 */ 579 */
580void MainWindow::populateCategories() { 580void MainWindow::populateCategories() {
581 m_todoMgr.load(); 581 m_todoMgr.load();
582 582
583 m_catMenu->clear(); 583 m_catMenu->clear();
584 int id, rememberId; 584 int id, rememberId;
585 id = 1; 585 id = 1;
586 rememberId = 1; 586 rememberId = 1;
587 587
588 m_catMenu->insertItem( tr( "All Categories" ), id++ ); 588 m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ );
589 m_catMenu->insertSeparator(); 589 m_catMenu->insertSeparator();
590 QStringList categories = m_todoMgr.categories(); 590 QStringList categories = m_todoMgr.categories();
591 categories.append( tr( "Unfiled" ) ); 591 categories.append( QWidget::tr( "Unfiled" ) );
592 for ( QStringList::Iterator it = categories.begin(); 592 for ( QStringList::Iterator it = categories.begin();
593 it != categories.end(); ++it ) { 593 it != categories.end(); ++it ) {
594 m_catMenu->insertItem( *it, id ); 594 m_catMenu->insertItem( *it, id );
595 if ( *it == currentCategory() ) 595 if ( *it == currentCategory() )
596 rememberId = id; 596 rememberId = id;
597 ++id; 597 ++id;
598 } 598 }
599 setCategory( rememberId ); 599 setCategory( rememberId );
600} 600}
601bool MainWindow::showCompleted()const { 601bool MainWindow::showCompleted()const {
602 return m_completed; 602 return m_completed;
603} 603}
604bool MainWindow::showDeadline()const { 604bool MainWindow::showDeadline()const {
605 return m_deadline; 605 return m_deadline;
606} 606}
607bool MainWindow::showQuickTask()const { 607bool MainWindow::showQuickTask()const {
608 return m_quicktask; 608 return m_quicktask;
609} 609}
610QString MainWindow::currentCategory()const { 610QString MainWindow::currentCategory()const {
611 return m_curCat; 611 return m_curCat;
612} 612}
613int MainWindow::currentCatId() { 613int MainWindow::currentCatId() {
614 return m_todoMgr.catId( m_curCat ); 614 return m_todoMgr.catId( m_curCat );
615} 615}
616ViewBase* MainWindow::currentView() { 616ViewBase* MainWindow::currentView() {
617 return m_curView; 617 return m_curView;
618} 618}
619void MainWindow::raiseCurrentView() { 619void MainWindow::raiseCurrentView() {
620 m_stack->raiseWidget( m_curView->widget() ); 620 m_stack->raiseWidget( m_curView->widget() );
621} 621}
622void MainWindow::slotShowDue(bool ov) { 622void MainWindow::slotShowDue(bool ov) {
623 m_overdue = ov; 623 m_overdue = ov;
624 currentView()->showOverDue( ov ); 624 currentView()->showOverDue( ov );
625 raiseCurrentView(); 625 raiseCurrentView();
626} 626}
627void MainWindow::slotShow( int uid ) { 627void MainWindow::slotShow( int uid ) {
628 qWarning("slotShow"); 628 qWarning("slotShow");
629 currentShow()->slotShow( event( uid ) ); 629 currentShow()->slotShow( event( uid ) );
630 m_stack->raiseWidget( currentShow()->widget() ); 630 m_stack->raiseWidget( currentShow()->widget() );
631} 631}
632void MainWindow::slotEdit( int uid ) { 632void MainWindow::slotEdit( int uid ) {
633 if(m_syncing) { 633 if(m_syncing) {
634 QMessageBox::warning(this, tr("Todo"), 634 QMessageBox::warning(this, QWidget::tr("Todo"),
635 tr("Can not edit data, currently syncing")); 635 QWidget::tr("Can not edit data, currently syncing"));
636 return; 636 return;
637 } 637 }
638 638
639 OTodo todo = m_todoMgr.event( uid ); 639 OTodo todo = m_todoMgr.event( uid );
640 640
641 todo = currentEditor()->edit(this, todo ); 641 todo = currentEditor()->edit(this, todo );
642 642
643 /* if completed */ 643 /* if completed */
644 if ( currentEditor()->accepted() ) { 644 if ( currentEditor()->accepted() ) {
645 qWarning("Replacing now" ); 645 qWarning("Replacing now" );
646 m_todoMgr.update( todo.uid(), todo ); 646 m_todoMgr.update( todo.uid(), todo );
647 currentView()->replaceEvent( todo ); 647 currentView()->replaceEvent( todo );
648 /* a Category might have changed */ 648 /* a Category might have changed */
649 populateCategories(); 649 populateCategories();
650 } 650 }
651 651
652 raiseCurrentView(); 652 raiseCurrentView();
653} 653}
654/* 654/*
655void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { 655void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) {
656 m_todoMgr.update( uid, ev ); 656 m_todoMgr.update( uid, ev );
657} 657}
658*/ 658*/
659void MainWindow::updateTodo( const OTodo& ev) { 659void MainWindow::updateTodo( const OTodo& ev) {
660 m_todoMgr.update( ev.uid() , ev ); 660 m_todoMgr.update( ev.uid() , ev );
661} 661}
662/* The view changed it's configuration 662/* The view changed it's configuration
663 * update the view menu 663 * update the view menu
664 */ 664 */
665void MainWindow::slotUpdate3( QWidget* ) { 665void MainWindow::slotUpdate3( QWidget* ) {
666 666
667} 667}
668void MainWindow::updateList() { 668void MainWindow::updateList() {
669 m_todoMgr.updateList(); 669 m_todoMgr.updateList();
670} 670}
671void MainWindow::setReadAhead( uint count ) { 671void MainWindow::setReadAhead( uint count ) {
672 if (m_todoMgr.todoDB() ) 672 if (m_todoMgr.todoDB() )
673 m_todoMgr.todoDB()->setReadAhead( count ); 673 m_todoMgr.todoDB()->setReadAhead( count );
674} 674}
675void MainWindow::slotQuickEntered() { 675void MainWindow::slotQuickEntered() {
676 qWarning("entered"); 676 qWarning("entered");
677 OTodo todo = quickEditor()->todo(); 677 OTodo todo = quickEditor()->todo();
678 if (todo.isEmpty() ) 678 if (todo.isEmpty() )
679 return; 679 return;
680 680
681 m_todoMgr.add( todo ); 681 m_todoMgr.add( todo );
682 currentView()->addEvent( todo ); 682 currentView()->addEvent( todo );
683 raiseCurrentView(); 683 raiseCurrentView();
684} 684}
685QuickEditBase* MainWindow::quickEditor() { 685QuickEditBase* MainWindow::quickEditor() {
686 return m_curQuick; 686 return m_curQuick;
687} 687}
688void MainWindow::slotComplete( int uid ) { 688void MainWindow::slotComplete( int uid ) {
689 slotComplete( event(uid) ); 689 slotComplete( event(uid) );
690} 690}
691void MainWindow::slotComplete( const OTodo& todo ) { 691void MainWindow::slotComplete( const OTodo& todo ) {
692 OTodo to = todo; 692 OTodo to = todo;
693 to.setCompleted( !to.isCompleted() ); 693 to.setCompleted( !to.isCompleted() );
694 to.setCompletedDate( QDate::currentDate() ); 694 to.setCompletedDate( QDate::currentDate() );
695 695
696 /* 696 /*
697 * if the item does recur 697 * if the item does recur
698 * we need to spin it off 698 * we need to spin it off
699 * and update the items duedate to the next 699 * and update the items duedate to the next
700 * possible recurrance of this item... 700 * possible recurrance of this item...
701 * the spinned off one will loose the 701 * the spinned off one will loose the
702 */ 702 */
703 if ( to.recurrence().doesRecur() && to.isCompleted() ) { 703 if ( to.recurrence().doesRecur() && to.isCompleted() ) {
704 OTodo to2( to ); 704 OTodo to2( to );
705 705
706 /* the spinned off one won't recur anymore */ 706 /* the spinned off one won't recur anymore */
707 to.setRecurrence( ORecur() ); 707 to.setRecurrence( ORecur() );
708 708
709 ORecur rec = to2.recurrence(); 709 ORecur rec = to2.recurrence();
710 rec.setStart( to.dueDate() ); 710 rec.setStart( to.dueDate() );
711 to2.setRecurrence( rec ); 711 to2.setRecurrence( rec );
712 /* 712 /*
713 * if there is a next occurence 713 * if there is a next occurence
714 * from the duedate of the last recurrance 714 * from the duedate of the last recurrance
715 */ 715 */
716 QDate date; 716 QDate date;
717 if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { 717 if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) {
718 QDate inval; 718 QDate inval;
719 /* generate a new uid for the old record */ 719 /* generate a new uid for the old record */
720 to.setUid( 1 ); 720 to.setUid( 1 );
721 721
722 /* add the old one cause it has a new UID here cause it was spin off */ 722 /* add the old one cause it has a new UID here cause it was spin off */
723 m_todoMgr.add( to ); 723 m_todoMgr.add( to );
724 724
725 /* 725 /*
726 * update the due date 726 * update the due date
727 * start date 727 * start date
728 * and complete date 728 * and complete date
729 */ 729 */
730 to2.setDueDate( date ); 730 to2.setDueDate( date );
731 to2.setStartDate( inval ); 731 to2.setStartDate( inval );
732 to2.setCompletedDate( inval ); 732 to2.setCompletedDate( inval );
733 to2.setCompleted( false ); 733 to2.setCompleted( false );
734 updateTodo( to2 ); 734 updateTodo( to2 );
735 }else 735 }else
736 updateTodo( to ); 736 updateTodo( to );
737 }else 737 }else
738 updateTodo( to ); 738 updateTodo( to );
739 739
740 currentView()->updateView(); 740 currentView()->updateView();
741 raiseCurrentView(); 741 raiseCurrentView();
742} 742}
743void MainWindow::flush() { 743void MainWindow::flush() {
744 slotFlush(); 744 slotFlush();
745} 745}
746void MainWindow::reload() { 746void MainWindow::reload() {
747 slotReload(); 747 slotReload();
748} 748}
749int MainWindow::create() { 749int MainWindow::create() {
750 int uid = 0; 750 int uid = 0;
751 if(m_syncing) { 751 if(m_syncing) {
752 QMessageBox::warning(this, tr("Todo"), 752 QMessageBox::warning(this, QWidget::tr("Todo"),
753 tr("Can not edit data, currently syncing")); 753 QWidget::tr("Can not edit data, currently syncing"));
754 return uid; 754 return uid;
755 } 755 }
756 756
757 757
758 OTodo todo = currentEditor()->newTodo( currentCatId(), 758 OTodo todo = currentEditor()->newTodo( currentCatId(),
759 this ); 759 this );
760 760
761 if ( currentEditor()->accepted() ) { 761 if ( currentEditor()->accepted() ) {
762 //todo.assignUid(); 762 //todo.assignUid();
763 uid = todo.uid(); 763 uid = todo.uid();
764 m_todoMgr.add( todo ); 764 m_todoMgr.add( todo );
765 currentView()->addEvent( todo ); 765 currentView()->addEvent( todo );
766 766
767 767
768 // I'm afraid we must call this every time now, otherwise 768 // I'm afraid we must call this every time now, otherwise
769 // spend expensive time comparing all these strings... 769 // spend expensive time comparing all these strings...
770 // but only call if we changed something -zecke 770 // but only call if we changed something -zecke
771 populateCategories(); 771 populateCategories();
772 } 772 }
773 raiseCurrentView( ); 773 raiseCurrentView( );
774 774
775 return uid; 775 return uid;
776} 776}
777/* delete it silently... */ 777/* delete it silently... */
778bool MainWindow::remove( int uid ) { 778bool MainWindow::remove( int uid ) {
779 if (m_syncing) return false; 779 if (m_syncing) return false;
780 780
781 return m_todoMgr.remove( uid ); 781 return m_todoMgr.remove( uid );
782} 782}
783void MainWindow::beam( int uid, int ) { 783void MainWindow::beam( int uid, int ) {
784 ::unlink( beamfile ); 784 ::unlink( beamfile );
785 OTodo todo = event( uid ); 785 OTodo todo = event( uid );
786 OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); 786 OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) );
787 OTodoAccess acc( cal ); 787 OTodoAccess acc( cal );
788 acc.load(); 788 acc.load();
789 acc.add( todo ); 789 acc.add( todo );
790 acc.save(); 790 acc.save();
791 Ir* ir = new Ir(this ); 791 Ir* ir = new Ir(this );
792 connect(ir, SIGNAL(done(Ir*) ), 792 connect(ir, SIGNAL(done(Ir*) ),
793 this, SLOT(beamDone(Ir*) ) ); 793 this, SLOT(beamDone(Ir*) ) );
794 ir->send( beamfile, todo.summary(), "text/x-vCalendar" ); 794 ir->send( beamfile, todo.summary(), "text/x-vCalendar" );
795} 795}
796void MainWindow::show( int uid ) { 796void MainWindow::show( int uid ) {
797 slotShow( uid ); 797 slotShow( uid );
798} 798}
799void MainWindow::edit( int uid ) { 799void MainWindow::edit( int uid ) {
800 slotEdit( uid ); 800 slotEdit( uid );
801} 801}
802void MainWindow::add( const OPimRecord& rec) { 802void MainWindow::add( const OPimRecord& rec) {
803 if ( rec.rtti() != OTodo::rtti() ) return; 803 if ( rec.rtti() != OTodo::rtti() ) return;
804 804
805 const OTodo& todo = static_cast<const OTodo&>(rec); 805 const OTodo& todo = static_cast<const OTodo&>(rec);
806 806
807 m_todoMgr.add(todo ); 807 m_todoMgr.add(todo );
808 currentView()->addEvent( todo ); 808 currentView()->addEvent( todo );
809 809
810 810
811 // I'm afraid we must call this every time now, otherwise 811 // I'm afraid we must call this every time now, otherwise
812 // spend expensive time comparing all these strings... 812 // spend expensive time comparing all these strings...
813 // but only call if we changed something -zecke 813 // but only call if we changed something -zecke
814 populateCategories(); 814 populateCategories();
815} 815}
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index 48b4dcc..61d1edd 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -1,275 +1,275 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 <zecke> 3             .=l. Copyright (c) 2002 <zecke>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This program is free software; you can 5 _;:,     .>    :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that 12    .i_,=:_.      -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28#include <stdlib.h> 28#include <stdlib.h>
29#include <cmath> 29#include <cmath>
30 30
31#include <qcombobox.h> 31#include <qcombobox.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qtimer.h> 33#include <qtimer.h>
34#include <qpoint.h> 34#include <qpoint.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36 36
37#include <qpe/config.h> 37#include <qpe/config.h>
38#include <qpe/resource.h> 38#include <qpe/resource.h>
39 39
40#include <opie/orecur.h> 40#include <opie/orecur.h>
41 41
42#include "mainwindow.h" 42#include "mainwindow.h"
43//#include "tableitems.h" 43//#include "tableitems.h"
44#include "tableview.h" 44#include "tableview.h"
45 45
46using namespace Todo; 46using namespace Todo;
47 47
48namespace { 48namespace {
49 static const int BoxSize = 14; 49 static const int BoxSize = 14;
50 static const int RowHeight = 20; 50 static const int RowHeight = 20;
51} 51}
52 52
53 53
54void TableView::initConfig() { 54void TableView::initConfig() {
55 Config config( "todo" ); 55 Config config( "todo" );
56 config.setGroup( "Options" ); 56 config.setGroup( "Options" );
57 m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 ); 57 m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 );
58} 58}
59 59
60TableView::TableView( MainWindow* window, QWidget* wid ) 60TableView::TableView( MainWindow* window, QWidget* wid )
61 : QTable( wid ), TodoView( window ) { 61 : QTable( wid ), TodoView( window ) {
62 62
63 // Load icons 63 // Load icons
64 // TODO - probably should be done globally somewhere else, 64 // TODO - probably should be done globally somewhere else,
65 // see also quickeditimpl.cpp/h, taskeditoroverview.cpp/h 65 // see also quickeditimpl.cpp/h, taskeditoroverview.cpp/h
66 m_pic_completed = Resource::loadPixmap( "todo/completed" ); 66 m_pic_completed = Resource::loadPixmap( "todo/completed" );
67 QString namestr; 67 QString namestr;
68 for ( unsigned int i = 1; i < 6; i++ ) { 68 for ( unsigned int i = 1; i < 6; i++ ) {
69 namestr = "todo/priority"; 69 namestr = "todo/priority";
70 namestr.append( QString::number( i ) ); 70 namestr.append( QString::number( i ) );
71 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); 71 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr );
72 } 72 }
73 73
74 setUpdatesEnabled( false ); 74 setUpdatesEnabled( false );
75 viewport()->setUpdatesEnabled( false ); 75 viewport()->setUpdatesEnabled( false );
76 m_enablePaint = false; 76 m_enablePaint = false;
77 setNumRows(0); 77 setNumRows(0);
78 setNumCols(4); 78 setNumCols(4);
79 79
80 horizontalHeader()->setLabel( 0, tr("C.") ); 80 horizontalHeader()->setLabel( 0, QWidget::tr("C.") );
81 horizontalHeader()->setLabel( 1, tr("Priority") ); 81 horizontalHeader()->setLabel( 1, QWidget::tr("Priority") );
82 horizontalHeader()->setLabel( 2, tr("Description" ) ); 82 horizontalHeader()->setLabel( 2, QWidget::tr("Description" ) );
83 horizontalHeader()->setLabel( 3, tr("Deadline") ); 83 horizontalHeader()->setLabel( 3, QWidget::tr("Deadline") );
84 84
85 setShowDeadline( todoWindow()->showDeadline() ); 85 setShowDeadline( todoWindow()->showDeadline() );
86 86
87 setSorting( TRUE ); 87 setSorting( TRUE );
88 setSelectionMode( NoSelection ); 88 setSelectionMode( NoSelection );
89 89
90 setLeftMargin( 0 ); 90 setLeftMargin( 0 );
91 verticalHeader()->hide(); 91 verticalHeader()->hide();
92 92
93 connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ), 93 connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ),
94 this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); 94 this, SLOT( slotClicked(int, int, int, const QPoint& ) ) );
95 connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), 95 connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ),
96 this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); 96 this, SLOT( slotPressed(int, int, int, const QPoint& ) ) );
97 connect((QTable*)this, SIGNAL(valueChanged(int, int) ), 97 connect((QTable*)this, SIGNAL(valueChanged(int, int) ),
98 this, SLOT( slotValueChanged(int, int) ) ); 98 this, SLOT( slotValueChanged(int, int) ) );
99 connect((QTable*)this, SIGNAL(currentChanged(int, int) ), 99 connect((QTable*)this, SIGNAL(currentChanged(int, int) ),
100 this, SLOT( slotCurrentChanged(int, int) ) ); 100 this, SLOT( slotCurrentChanged(int, int) ) );
101 101
102 m_menuTimer = new QTimer( this ); 102 m_menuTimer = new QTimer( this );
103 connect( m_menuTimer, SIGNAL(timeout()), 103 connect( m_menuTimer, SIGNAL(timeout()),
104 this, SLOT(slotShowMenu()) ); 104 this, SLOT(slotShowMenu()) );
105 105
106 m_enablePaint = true; 106 m_enablePaint = true;
107 setUpdatesEnabled( true ); 107 setUpdatesEnabled( true );
108 viewport()->setUpdatesEnabled( true ); 108 viewport()->setUpdatesEnabled( true );
109 viewport()->update(); 109 viewport()->update();
110 setSortOrder( 0 ); 110 setSortOrder( 0 );
111 setAscending( TRUE ); 111 setAscending( TRUE );
112 m_first = true; 112 m_first = true;
113 113
114 /* now let's init the config */ 114 /* now let's init the config */
115 initConfig(); 115 initConfig();
116} 116}
117/* a new day has started 117/* a new day has started
118 * update the day 118 * update the day
119 */ 119 */
120void TableView::newDay() { 120void TableView::newDay() {
121 clear(); 121 clear();
122 updateView(); 122 updateView();
123} 123}
124TableView::~TableView() { 124TableView::~TableView() {
125 125
126} 126}
127void TableView::slotShowMenu() { 127void TableView::slotShowMenu() {
128 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); 128 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() );
129 menu->exec(QCursor::pos() ); 129 menu->exec(QCursor::pos() );
130 delete menu; 130 delete menu;
131} 131}
132QString TableView::type() const { 132QString TableView::type() const {
133 return QString::fromLatin1( tr("Table View") ); 133 return QString::fromLatin1( tr("Table View") );
134} 134}
135int TableView::current() { 135int TableView::current() {
136 int uid = sorted().uidAt(currentRow() ); 136 int uid = sorted().uidAt(currentRow() );
137 137
138 return uid; 138 return uid;
139} 139}
140QString TableView::currentRepresentation() { 140QString TableView::currentRepresentation() {
141 OTodo to = sorted()[currentRow()]; 141 OTodo to = sorted()[currentRow()];
142 return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; 142 return to.summary().isEmpty() ? to.description().left(20) : to.summary() ;
143} 143}
144/* show overdue */ 144/* show overdue */
145void TableView::showOverDue( bool ) { 145void TableView::showOverDue( bool ) {
146 clear(); 146 clear();
147 updateView(); 147 updateView();
148} 148}
149 149
150void TableView::updateView( ) { 150void TableView::updateView( ) {
151 qWarning("update view"); 151 qWarning("update view");
152 m_row = false; 152 m_row = false;
153 static int id; 153 static int id;
154 id = startTimer(4000 ); 154 id = startTimer(4000 );
155 /* FIXME we want one page to be read! 155 /* FIXME we want one page to be read!
156 * 156 *
157 * Calculate that screensize 157 * Calculate that screensize
158 */ 158 */
159 todoWindow()->setReadAhead( 4 ); 159 todoWindow()->setReadAhead( 4 );
160 sort(); 160 sort();
161 OTodoAccess::List::Iterator it, end; 161 OTodoAccess::List::Iterator it, end;
162 it = sorted().begin(); 162 it = sorted().begin();
163 end = sorted().end(); 163 end = sorted().end();
164 164
165 qWarning("setTodos"); 165 qWarning("setTodos");
166 QTime time; 166 QTime time;
167 time.start(); 167 time.start();
168 m_enablePaint = false; 168 m_enablePaint = false;
169 setUpdatesEnabled( false ); 169 setUpdatesEnabled( false );
170 viewport()->setUpdatesEnabled( false ); 170 viewport()->setUpdatesEnabled( false );
171 171
172 setNumRows( it.count() ); 172 setNumRows( it.count() );
173 if ( it.count() == 0 ) 173 if ( it.count() == 0 )
174 killTimer(id); 174 killTimer(id);
175 175
176// int elc = time.elapsed(); 176// int elc = time.elapsed();
177 setUpdatesEnabled( true ); 177 setUpdatesEnabled( true );
178 viewport()->setUpdatesEnabled( true ); 178 viewport()->setUpdatesEnabled( true );
179 viewport()->update(); 179 viewport()->update();
180 180
181 m_enablePaint = true; 181 m_enablePaint = true;
182// int el = time.elapsed(); 182// int el = time.elapsed();
183} 183}
184void TableView::setTodo( int, const OTodo&) { 184void TableView::setTodo( int, const OTodo&) {
185 sort(); 185 sort();
186 186
187 /* repaint */ 187 /* repaint */
188 repaint(); 188 repaint();
189} 189}
190void TableView::addEvent( const OTodo&) { 190void TableView::addEvent( const OTodo&) {
191 191
192 /* fix problems of not showing the 'Haken' */ 192 /* fix problems of not showing the 'Haken' */
193 updateView(); 193 updateView();
194} 194}
195/* 195/*
196 * find the event 196 * find the event
197 * and then replace the complete row 197 * and then replace the complete row
198 */ 198 */
199void TableView::replaceEvent( const OTodo& ev) { 199void TableView::replaceEvent( const OTodo& ev) {
200 addEvent( ev ); 200 addEvent( ev );
201} 201}
202/* 202/*
203 * re aligning table can be slow too 203 * re aligning table can be slow too
204 * FIXME: look what performs better 204 * FIXME: look what performs better
205 * either this or the old align table 205 * either this or the old align table
206 */ 206 */
207void TableView::removeEvent( int ) { 207void TableView::removeEvent( int ) {
208 updateView(); 208 updateView();
209} 209}
210void TableView::setShowCompleted( bool b) { 210void TableView::setShowCompleted( bool b) {
211 qWarning("Show Completed %d" + b ); 211 qWarning("Show Completed %d" + b );
212 updateView(); 212 updateView();
213} 213}
214void TableView::setShowDeadline( bool b ) { 214void TableView::setShowDeadline( bool b ) {
215 qWarning( "Show DeadLine %d" + b ); 215 qWarning( "Show DeadLine %d" + b );
216 if ( b ) 216 if ( b )
217 showColumn( 3 ); 217 showColumn( 3 );
218 else 218 else
219 hideColumn( 3 ); 219 hideColumn( 3 );
220 220
221 // Try to intelligently size columns 221 // Try to intelligently size columns
222 // TODO - would use width() below, but doesn't have valid value at time of c'tor 222 // TODO - would use width() below, but doesn't have valid value at time of c'tor
223 int col2width = 238; 223 int col2width = 238;
224 int width = m_pic_completed.width(); 224 int width = m_pic_completed.width();
225 setColumnWidth( 0, width ); 225 setColumnWidth( 0, width );
226 col2width -= width; 226 col2width -= width;
227 width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; 227 width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8;
228 setColumnWidth( 1, width ); 228 setColumnWidth( 1, width );
229 col2width -= width; 229 col2width -= width;
230 if ( b ) { 230 if ( b ) {
231 width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; 231 width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8;
232 setColumnWidth( 3, width ); 232 setColumnWidth( 3, width );
233 col2width -= width; 233 col2width -= width;
234 } 234 }
235 setColumnWidth( 2, col2width ); 235 setColumnWidth( 2, col2width );
236} 236}
237void TableView::setShowCategory( const QString& str) { 237void TableView::setShowCategory( const QString& str) {
238 qWarning("setShowCategory"); 238 qWarning("setShowCategory");
239 if ( str != m_oleCat || m_first ) 239 if ( str != m_oleCat || m_first )
240 updateView(); 240 updateView();
241 241
242 m_oleCat = str; 242 m_oleCat = str;
243 m_first = false; 243 m_first = false;
244 244
245} 245}
246void TableView::clear() { 246void TableView::clear() {
247 setNumRows(0); 247 setNumRows(0);
248} 248}
249void TableView::slotClicked(int row, int col, int, 249void TableView::slotClicked(int row, int col, int,
250 const QPoint& point) { 250 const QPoint& point) {
251 if ( !cellGeometry(row, col ).contains(point ) ) 251 if ( !cellGeometry(row, col ).contains(point ) )
252 return; 252 return;
253 253
254 int ui= sorted().uidAt( row ); 254 int ui= sorted().uidAt( row );
255 255
256 256
257 switch( col ) { 257 switch( col ) {
258 case 0:{ 258 case 0:{
259 int x = point.x() -columnPos( col ); 259 int x = point.x() -columnPos( col );
260 int y = point.y() -rowPos( row ); 260 int y = point.y() -rowPos( row );
261 int w = columnWidth( col ); 261 int w = columnWidth( col );
262 int h = rowHeight( row ); 262 int h = rowHeight( row );
263 if ( x >= ( w - BoxSize ) / 2 && 263 if ( x >= ( w - BoxSize ) / 2 &&
264 x <= ( w - BoxSize ) / 2 + BoxSize && 264 x <= ( w - BoxSize ) / 2 + BoxSize &&
265 y >= ( h - BoxSize ) / 2 && 265 y >= ( h - BoxSize ) / 2 &&
266 y <= ( h - BoxSize ) / 2 + BoxSize ) { 266 y <= ( h - BoxSize ) / 2 + BoxSize ) {
267 TodoView::complete(sorted()[row] ); 267 TodoView::complete(sorted()[row] );
268 } 268 }
269 } 269 }
270 break; 270 break;
271 271
272 case 1: 272 case 1:
273 break; 273 break;
274 274
275 case 2: { 275 case 2: {
diff --git a/core/pim/todo/taskeditoroverview.cpp b/core/pim/todo/taskeditoroverview.cpp
index 5e2b026..92408ba 100644
--- a/core/pim/todo/taskeditoroverview.cpp
+++ b/core/pim/todo/taskeditoroverview.cpp
@@ -1,177 +1,177 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 <> 3             .=l. Copyright (c) 2002 <>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This program is free software; you can 5 _;:,     .>    :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that 12    .i_,=:_.      -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = General Public License along with 21  -_. . .   )=.  = General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "taskeditoroverview.h" 29#include "taskeditoroverview.h"
30 30
31#include <opie/orecur.h> 31#include <opie/orecur.h>
32 32
33#include <qpe/categoryselect.h> 33#include <qpe/categoryselect.h>
34#include <qpe/datebookmonth.h> 34#include <qpe/datebookmonth.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36#include <qpe/timestring.h> 36#include <qpe/timestring.h>
37 37
38#include <qcheckbox.h> 38#include <qcheckbox.h>
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qlabel.h> 40#include <qlabel.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qmultilineedit.h> 42#include <qmultilineedit.h>
43#include <qwhatsthis.h> 43#include <qwhatsthis.h>
44 44
45TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFlags fl ) 45TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFlags fl )
46 : QWidget( parent, name, fl ) 46 : QWidget( parent, name, fl )
47{ 47{
48 // Load icons 48 // Load icons
49 // TODO - probably should be done globally somewhere else, 49 // TODO - probably should be done globally somewhere else,
50 // see also quickeditimpl.cpp/h, tableview.cpp/h 50 // see also quickeditimpl.cpp/h, tableview.cpp/h
51 QString namestr; 51 QString namestr;
52 for ( unsigned int i = 1; i < 6; i++ ) { 52 for ( unsigned int i = 1; i < 6; i++ ) {
53 namestr = "todo/priority"; 53 namestr = "todo/priority";
54 namestr.append( QString::number( i ) ); 54 namestr.append( QString::number( i ) );
55 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); 55 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr );
56 } 56 }
57 57
58 QVBoxLayout *vb = new QVBoxLayout( this ); 58 QVBoxLayout *vb = new QVBoxLayout( this );
59 59
60 QScrollView *sv = new QScrollView( this ); 60 QScrollView *sv = new QScrollView( this );
61 vb->addWidget( sv ); 61 vb->addWidget( sv );
62 sv->setResizePolicy( QScrollView::AutoOneFit ); 62 sv->setResizePolicy( QScrollView::AutoOneFit );
63 sv->setFrameStyle( QFrame::NoFrame ); 63 sv->setFrameStyle( QFrame::NoFrame );
64 64
65 QWidget *container = new QWidget( sv->viewport() ); 65 QWidget *container = new QWidget( sv->viewport() );
66 sv->addChild( container ); 66 sv->addChild( container );
67 67
68 QGridLayout *layout = new QGridLayout( container, 7, 2, 4, 4 ); 68 QGridLayout *layout = new QGridLayout( container, 7, 2, 4, 4 );
69 69
70 // Description 70 // Description
71 QLabel *label = new QLabel( tr( "Description:" ), container ); 71 QLabel *label = new QLabel( tr( "Description:" ), container );
72 layout->addWidget( label, 0, 0 ); 72 layout->addWidget( label, 0, 0 );
73 QWhatsThis::add( label, tr( "Enter brief description of the task here." ) ); 73 QWhatsThis::add( label, tr( "Enter brief description of the task here." ) );
74 cmbDesc = new QComboBox( TRUE, container ); 74 cmbDesc = new QComboBox( TRUE, container );
75 cmbDesc->insertItem( tr( "Complete " ) ); 75 cmbDesc->insertItem( tr( "Complete " ) );
76 cmbDesc->insertItem( tr( "Work on " ) ); 76 cmbDesc->insertItem( tr( "Work on " ) );
77 cmbDesc->insertItem( tr( "Buy " ) ); 77 cmbDesc->insertItem( tr( "Buy " ) );
78 cmbDesc->insertItem( tr( "Organize " ) ); 78 cmbDesc->insertItem( tr( "Organize " ) );
79 cmbDesc->insertItem( tr( "Get " ) ); 79 cmbDesc->insertItem( tr( "Get " ) );
80 cmbDesc->insertItem( tr( "Update " ) ); 80 cmbDesc->insertItem( tr( "Update " ) );
81 cmbDesc->insertItem( tr( "Create " ) ); 81 cmbDesc->insertItem( tr( "Create " ) );
82 cmbDesc->insertItem( tr( "Plan " ) ); 82 cmbDesc->insertItem( tr( "Plan " ) );
83 cmbDesc->insertItem( tr( "Call " ) ); 83 cmbDesc->insertItem( tr( "Call " ) );
84 cmbDesc->insertItem( tr( "Mail " ) ); 84 cmbDesc->insertItem( tr( "Mail " ) );
85 cmbDesc->clearEdit(); 85 cmbDesc->clearEdit();
86 layout->addMultiCellWidget( cmbDesc, 1, 1, 0, 1 ); 86 layout->addMultiCellWidget( cmbDesc, 1, 1, 0, 1 );
87 QWhatsThis::add( cmbDesc, tr( "Enter brief description of the task here." ) ); 87 QWhatsThis::add( cmbDesc, tr( "Enter brief description of the task here." ) );
88 88
89 // Priority 89 // Priority
90 label = new QLabel( tr( "Priority:" ), container ); 90 label = new QLabel( QWidget::tr( "Priority:" ), container );
91 layout->addWidget( label, 2, 0 ); 91 layout->addWidget( label, 2, 0 );
92 QWhatsThis::add( label, tr( "Select priority of task here." ) ); 92 QWhatsThis::add( label, tr( "Select priority of task here." ) );
93 cmbPriority = new QComboBox( FALSE, container ); 93 cmbPriority = new QComboBox( FALSE, container );
94 cmbPriority->setMinimumHeight( 26 ); 94 cmbPriority->setMinimumHeight( 26 );
95 cmbPriority->insertItem( m_pic_priority[ 0 ], tr( "Very High" ) ); 95 cmbPriority->insertItem( m_pic_priority[ 0 ], tr( "Very High" ) );
96 cmbPriority->insertItem( m_pic_priority[ 1 ], tr( "High" ) ); 96 cmbPriority->insertItem( m_pic_priority[ 1 ], tr( "High" ) );
97 cmbPriority->insertItem( m_pic_priority[ 2 ], tr( "Normal" ) ); 97 cmbPriority->insertItem( m_pic_priority[ 2 ], tr( "Normal" ) );
98 cmbPriority->insertItem( m_pic_priority[ 3 ], tr( "Low" ) ); 98 cmbPriority->insertItem( m_pic_priority[ 3 ], tr( "Low" ) );
99 cmbPriority->insertItem( m_pic_priority[ 4 ], tr( "Very Low" ) ); 99 cmbPriority->insertItem( m_pic_priority[ 4 ], tr( "Very Low" ) );
100 cmbPriority->setCurrentItem( 2 ); 100 cmbPriority->setCurrentItem( 2 );
101 layout->addWidget( cmbPriority, 2, 1 ); 101 layout->addWidget( cmbPriority, 2, 1 );
102 QWhatsThis::add( cmbPriority, tr( "Select priority of task here." ) ); 102 QWhatsThis::add( cmbPriority, tr( "Select priority of task here." ) );
103 103
104 // Category 104 // Category
105 label = new QLabel( tr( "Category:" ), container ); 105 label = new QLabel( tr( "Category:" ), container );
106 layout->addWidget( label, 3, 0 ); 106 layout->addWidget( label, 3, 0 );
107 QWhatsThis::add( label, tr( "Select category to organize this task with." ) ); 107 QWhatsThis::add( label, tr( "Select category to organize this task with." ) );
108 cmbCategory = new CategorySelect( container ); 108 cmbCategory = new CategorySelect( container );
109 layout->addWidget( cmbCategory, 3, 1 ); 109 layout->addWidget( cmbCategory, 3, 1 );
110 QWhatsThis::add( cmbCategory, tr( "Select category to organize this task with." ) ); 110 QWhatsThis::add( cmbCategory, tr( "Select category to organize this task with." ) );
111 111
112 // Recurrence 112 // Recurrence
113 ckbRecurrence = new QCheckBox( tr( "Recurring task" ), container ); 113 ckbRecurrence = new QCheckBox( tr( "Recurring task" ), container );
114 layout->addMultiCellWidget( ckbRecurrence, 4, 4, 0, 1 ); 114 layout->addMultiCellWidget( ckbRecurrence, 4, 4, 0, 1 );
115 QWhatsThis::add( ckbRecurrence, tr( "Click here if task happens on a regular basis. If selected, frequency can be set on the Recurrence tab." ) ); 115 QWhatsThis::add( ckbRecurrence, tr( "Click here if task happens on a regular basis. If selected, frequency can be set on the Recurrence tab." ) );
116 connect( ckbRecurrence, SIGNAL(clicked() ), this, SLOT( slotRecClicked() ) ); 116 connect( ckbRecurrence, SIGNAL(clicked() ), this, SLOT( slotRecClicked() ) );
117 117
118 // Notes 118 // Notes
119 label = new QLabel( tr( "Notes:" ), container ); 119 label = new QLabel( tr( "Notes:" ), container );
120 layout->addWidget( label, 5, 0 ); 120 layout->addWidget( label, 5, 0 );
121 QWhatsThis::add( label, tr( "Enter any additional information about this task here." ) ); 121 QWhatsThis::add( label, tr( "Enter any additional information about this task here." ) );
122 mleNotes = new QMultiLineEdit( container ); 122 mleNotes = new QMultiLineEdit( container );
123 mleNotes->setWordWrap( QMultiLineEdit::WidgetWidth ); 123 mleNotes->setWordWrap( QMultiLineEdit::WidgetWidth );
124 layout->addMultiCellWidget( mleNotes, 6, 6, 0, 1 ); 124 layout->addMultiCellWidget( mleNotes, 6, 6, 0, 1 );
125 QWhatsThis::add( mleNotes, tr( "Enter any additional information about this task here." ) ); 125 QWhatsThis::add( mleNotes, tr( "Enter any additional information about this task here." ) );
126} 126}
127 127
128TaskEditorOverView::~TaskEditorOverView() 128TaskEditorOverView::~TaskEditorOverView()
129{ 129{
130} 130}
131 131
132void TaskEditorOverView::load( const OTodo& todo ) 132void TaskEditorOverView::load( const OTodo& todo )
133{ 133{
134 // Description 134 // Description
135 cmbDesc->insertItem( todo.summary(), 0 ); 135 cmbDesc->insertItem( todo.summary(), 0 );
136 cmbDesc->setCurrentItem( 0 ); 136 cmbDesc->setCurrentItem( 0 );
137 137
138 // Priority 138 // Priority
139 cmbPriority->setCurrentItem( todo.priority() - 1 ); 139 cmbPriority->setCurrentItem( todo.priority() - 1 );
140 140
141 // Category 141 // Category
142 cmbCategory->setCategories( todo.categories(), "Todo List", tr( "Todo List" ) ); 142 cmbCategory->setCategories( todo.categories(), "Todo List", tr( "Todo List" ) );
143 143
144 // Recurrence 144 // Recurrence
145 ckbRecurrence->setChecked( todo.recurrence().doesRecur() ); 145 ckbRecurrence->setChecked( todo.recurrence().doesRecur() );
146 emit recurranceEnabled( todo.recurrence().doesRecur() ); 146 emit recurranceEnabled( todo.recurrence().doesRecur() );
147 147
148 // Notes 148 // Notes
149 mleNotes->setText( todo.description() ); 149 mleNotes->setText( todo.description() );
150 150
151} 151}
152 152
153void TaskEditorOverView::save( OTodo &todo ) 153void TaskEditorOverView::save( OTodo &todo )
154{ 154{
155 // Description 155 // Description
156 todo.setSummary( cmbDesc->currentText() ); 156 todo.setSummary( cmbDesc->currentText() );
157 157
158 // Priority 158 // Priority
159 todo.setPriority( cmbPriority->currentItem() + 1 ); 159 todo.setPriority( cmbPriority->currentItem() + 1 );
160 160
161 // Category 161 // Category
162 if ( cmbCategory->currentCategory() != -1 ) 162 if ( cmbCategory->currentCategory() != -1 )
163 { 163 {
164 QArray<int> arr = cmbCategory->currentCategories(); 164 QArray<int> arr = cmbCategory->currentCategories();
165 todo.setCategories( arr ); 165 todo.setCategories( arr );
166 } 166 }
167 167
168 // Recurrence - don't need to save here... 168 // Recurrence - don't need to save here...
169 169
170 // Notes 170 // Notes
171 todo.setDescription( mleNotes->text() ); 171 todo.setDescription( mleNotes->text() );
172} 172}
173 173
174void TaskEditorOverView::slotRecClicked() 174void TaskEditorOverView::slotRecClicked()
175{ 175{
176 emit recurranceEnabled( ckbRecurrence->isChecked() ); 176 emit recurranceEnabled( ckbRecurrence->isChecked() );
177} 177}
diff --git a/core/pim/todo/templateeditor.cpp b/core/pim/todo/templateeditor.cpp
index 1b52d4f..3930428 100644
--- a/core/pim/todo/templateeditor.cpp
+++ b/core/pim/todo/templateeditor.cpp
@@ -1,39 +1,39 @@
1#include <qaction.h> 1#include <qaction.h>
2#include <qpopupmenu.h> 2#include <qpopupmenu.h>
3 3
4#include "mainwindow.h" 4#include "mainwindow.h"
5#include "todotemplatemanager.h" 5#include "todotemplatemanager.h"
6 6
7#include "templatedialogimpl.h" 7#include "templatedialogimpl.h"
8#include "templateeditor.h" 8#include "templateeditor.h"
9 9
10using namespace Todo; 10using namespace Todo;
11 11
12TemplateEditor::TemplateEditor( MainWindow* main, 12TemplateEditor::TemplateEditor( MainWindow* main,
13 TemplateManager* manager ) 13 TemplateManager* manager )
14 : QObject( main ), m_main( main ), m_man( manager ) 14 : QObject( main ), m_main( main ), m_man( manager )
15{ 15{
16 init(); 16 init();
17 17
18} 18}
19TemplateEditor::~TemplateEditor() { 19TemplateEditor::~TemplateEditor() {
20 20
21} 21}
22/* ok we add us to the Menubar */ 22/* ok we add us to the Menubar */
23void TemplateEditor::init() { 23void TemplateEditor::init() {
24 QAction* a = new QAction( QString::null, tr("Configure Templates"), 24 QAction* a = new QAction( QString::null, QWidget::tr("Configure Templates"),
25 0, this, 0, FALSE ); 25 0, this, 0, FALSE );
26 connect(a, SIGNAL(activated() ), 26 connect(a, SIGNAL(activated() ),
27 this, SLOT(setUp() ) ); 27 this, SLOT(setUp() ) );
28 28
29 a->addTo( m_main->options() ); 29 a->addTo( m_main->options() );
30} 30}
31void TemplateEditor::setUp() { 31void TemplateEditor::setUp() {
32 qWarning("set up"); 32 qWarning("set up");
33 TemplateDialogImpl dlg(m_main, m_man ); 33 TemplateDialogImpl dlg(m_main, m_man );
34 int ret= dlg.exec(); 34 int ret= dlg.exec();
35 if (QDialog::Accepted != ret ) { 35 if (QDialog::Accepted != ret ) {
36 m_man->load(); 36 m_man->load();
37 }else 37 }else
38 m_main->populateTemplates(); 38 m_main->populateTemplates();
39} 39}