summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index 7e7d2f7..48954ce 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -186,207 +186,207 @@ void MainWindow::initActions() {
186} 186}
187/* m_curCat from Config */ 187/* m_curCat from Config */
188void MainWindow::initConfig() { 188void MainWindow::initConfig() {
189 Config config( "todo" ); 189 Config config( "todo" );
190 config.setGroup( "View" ); 190 config.setGroup( "View" );
191 m_completed = config.readBoolEntry( "ShowComplete", TRUE ); 191 m_completed = config.readBoolEntry( "ShowComplete", TRUE );
192 m_curCat = config.readEntry( "Category", QString::null ); 192 m_curCat = config.readEntry( "Category", QString::null );
193 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); 193 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE);
194 m_overdue = config.readBoolEntry("ShowOverDue", TRUE ); 194 m_overdue = config.readBoolEntry("ShowOverDue", TRUE );
195} 195}
196void MainWindow::initUI() { 196void MainWindow::initUI() {
197 m_stack = new QWidgetStack(this, "main stack"); 197 m_stack = new QWidgetStack(this, "main stack");
198 setCentralWidget( m_stack ); 198 setCentralWidget( m_stack );
199 199
200 setToolBarsMovable( FALSE ); 200 setToolBarsMovable( FALSE );
201 201
202 m_tool = new QToolBar( this ); 202 m_tool = new QToolBar( this );
203 m_tool->setHorizontalStretchable( TRUE ); 203 m_tool->setHorizontalStretchable( TRUE );
204 204
205 m_bar = new QMenuBar( m_tool ); 205 m_bar = new QMenuBar( m_tool );
206 206
207 /** QPopupMenu */ 207 /** QPopupMenu */
208 m_edit = new QPopupMenu( this ); 208 m_edit = new QPopupMenu( this );
209 m_options = new QPopupMenu( this ); 209 m_options = new QPopupMenu( this );
210 m_view = new QPopupMenu( this ); 210 m_view = new QPopupMenu( this );
211 m_catMenu = new QPopupMenu( this ); 211 m_catMenu = new QPopupMenu( this );
212 m_template = new QPopupMenu( this ); 212 m_template = new QPopupMenu( this );
213 213
214 m_catMenu->setCheckable( TRUE ); 214 m_catMenu->setCheckable( TRUE );
215 m_template->setCheckable( TRUE ); 215 m_template->setCheckable( TRUE );
216 216
217 connect(m_catMenu, SIGNAL(activated(int) ), 217 connect(m_catMenu, SIGNAL(activated(int) ),
218 this, SLOT(setCategory(int) ) ); 218 this, SLOT(setCategory(int) ) );
219 connect(m_template, SIGNAL(activated(int) ), 219 connect(m_template, SIGNAL(activated(int) ),
220 this, SLOT(slotNewFromTemplate(int) ) ); 220 this, SLOT(slotNewFromTemplate(int) ) );
221} 221}
222void MainWindow::initViews() { 222void MainWindow::initViews() {
223 TableView* tableView = new TableView( this, this ); 223 TableView* tableView = new TableView( this, this );
224 m_stack->addWidget( tableView, m_counter++ ); 224 m_stack->addWidget( tableView, m_counter++ );
225 m_views.append( tableView ); 225 m_views.append( tableView );
226 m_curView = tableView; 226 m_curView = tableView;
227 connectBase( tableView ); 227 connectBase( tableView );
228 /* add QString type + QString configname to 228 /* add QString type + QString configname to
229 * the View menu 229 * the View menu
230 * and subdirs for multiple views 230 * and subdirs for multiple views
231 */ 231 */
232} 232}
233void MainWindow::initEditor() { 233void MainWindow::initEditor() {
234 m_curEdit = new Editor(); 234 m_curEdit = new Editor();
235} 235}
236void MainWindow::initShow() { 236void MainWindow::initShow() {
237 m_curShow = new TextViewShow(this); 237 m_curShow = new TextViewShow(this);
238 m_stack->addWidget( m_curShow->widget() , m_counter++ ); 238 m_stack->addWidget( m_curShow->widget() , m_counter++ );
239} 239}
240MainWindow::~MainWindow() { 240MainWindow::~MainWindow() {
241 delete templateManager(); 241 delete templateManager();
242} 242}
243void MainWindow::connectBase( ViewBase* base) { 243void MainWindow::connectBase( ViewBase* base) {
244 base->connectShow( this, SLOT(slotShow(int) ) ); 244 base->connectShow( this, SLOT(slotShow(int) ) );
245 base->connectEdit( this, SLOT(slotEdit(int) ) ); 245 base->connectEdit( this, SLOT(slotEdit(int) ) );
246 base->connectUpdateSmall( this, 246 base->connectUpdateSmall( this,
247 SLOT(slotUpate1(int, const Todo::SmallTodo&) )); 247 SLOT(slotUpate1(int, const Todo::SmallTodo&) ));
248 base->connectUpdateBig( this, 248 base->connectUpdateBig( this,
249 SLOT(slotUpate2(int, const OTodo& ) ) ); 249 SLOT(slotUpate2(int, const OTodo& ) ) );
250 base->connectUpdateView( this, SLOT(slotUpdate3( QWidget* ) ) ) ; 250 base->connectUpdateView( this, SLOT(slotUpdate3( QWidget* ) ) ) ;
251 base->connectRemove(&m_todoMgr, 251 base->connectRemove(&m_todoMgr,
252 SLOT(remove(int)) ); 252 SLOT(remove(int)) );
253} 253}
254QPopupMenu* MainWindow::contextMenu( int uid ) { 254QPopupMenu* MainWindow::contextMenu( int uid ) {
255 QPopupMenu* menu = new QPopupMenu(); 255 QPopupMenu* menu = new QPopupMenu();
256 256
257 m_editAction->addTo( menu ); 257 m_editAction->addTo( menu );
258 m_deleteAction->addTo( menu ); 258 m_deleteAction->addTo( menu );
259 m_duplicateAction->addTo( menu ); 259 m_duplicateAction->addTo( menu );
260 menu->insertSeparator(); 260 menu->insertSeparator();
261 261
262 return menu; 262 return menu;
263} 263}
264QPopupMenu* MainWindow::options() { 264QPopupMenu* MainWindow::options() {
265 qWarning("Options"); 265 qWarning("Options");
266 return m_options; 266 return m_options;
267} 267}
268QPopupMenu* MainWindow::edit() { 268QPopupMenu* MainWindow::edit() {
269 return m_edit; 269 return m_edit;
270} 270}
271QPopupMenu* MainWindow::view() { 271QPopupMenu* MainWindow::view() {
272 return m_view; 272 return m_view;
273} 273}
274QToolBar* MainWindow::toolbar() { 274QToolBar* MainWindow::toolbar() {
275 return m_tool; 275 return m_tool;
276} 276}
277OTodoAccess::List MainWindow::list()const { 277OTodoAccess::List MainWindow::list()const {
278 return m_todoMgr.list(); 278 return m_todoMgr.list();
279} 279}
280OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { 280OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
281 int cat = 0; 281 int cat = 0;
282 if ( m_curCat == tr("All Categories") ) 282 if ( m_curCat != tr("All Categories") )
283 cat = currentCatId(); 283 cat = currentCatId();
284 284
285 int filter = 1; 285 int filter = 1;
286 286
287 if (!m_completed ) 287 if (!m_completed )
288 filter |= 4; 288 filter |= 4;
289 if (m_overdue) 289 if (m_overdue)
290 filter |= 2; 290 filter |= 2;
291 291
292 return m_todoMgr.sorted( asc, sortOrder, filter, cat ); 292 return m_todoMgr.sorted( asc, sortOrder, filter, cat );
293} 293}
294OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { 294OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
295 int cat = 0; 295 int cat = 0;
296 if ( m_curCat == tr("All Categories") ) 296 if ( m_curCat != tr("All Categories") )
297 cat = currentCatId(); 297 cat = currentCatId();
298 298
299 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); 299 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat );
300} 300}
301OTodo MainWindow::event( int uid ) { 301OTodo MainWindow::event( int uid ) {
302 return m_todoMgr.event( uid ); 302 return m_todoMgr.event( uid );
303} 303}
304bool MainWindow::isSyncing()const { 304bool MainWindow::isSyncing()const {
305 return m_syncing; 305 return m_syncing;
306} 306}
307TemplateManager* MainWindow::templateManager() { 307TemplateManager* MainWindow::templateManager() {
308 return m_tempManager; 308 return m_tempManager;
309} 309}
310Editor* MainWindow::currentEditor() { 310Editor* MainWindow::currentEditor() {
311 return m_curEdit; 311 return m_curEdit;
312} 312}
313TodoShow* MainWindow::currentShow() { 313TodoShow* MainWindow::currentShow() {
314 return m_curShow; 314 return m_curShow;
315} 315}
316void MainWindow::slotReload() { 316void MainWindow::slotReload() {
317 m_todoMgr.reload(); 317 m_todoMgr.reload();
318 currentView()->updateView( ); 318 currentView()->updateView( );
319 raiseCurrentView(); 319 raiseCurrentView();
320} 320}
321void MainWindow::closeEvent( QCloseEvent* e ) { 321void MainWindow::closeEvent( QCloseEvent* e ) {
322 if (m_stack->visibleWidget() == currentShow()->widget() ) { 322 if (m_stack->visibleWidget() == currentShow()->widget() ) {
323 raiseCurrentView(); 323 raiseCurrentView();
324 e->ignore(); 324 e->ignore();
325 return; 325 return;
326 } 326 }
327 /* 327 /*
328 * we should have flushed and now we're still saving 328 * we should have flushed and now we're still saving
329 * so there is no need to flush 329 * so there is no need to flush
330 */ 330 */
331 if (m_syncing ) { 331 if (m_syncing ) {
332 e->accept(); 332 e->accept();
333 return; 333 return;
334 } 334 }
335 bool quit = false; 335 bool quit = false;
336 if ( m_todoMgr.saveAll() ){ 336 if ( m_todoMgr.saveAll() ){
337 qWarning("saved"); 337 qWarning("saved");
338 quit = true; 338 quit = true;
339 }else { 339 }else {
340 if ( QMessageBox::critical( this, tr("Out of space"), 340 if ( QMessageBox::critical( this, tr("Out of space"),
341 tr("Todo was unable\n" 341 tr("Todo was unable\n"
342 "to save your changes.\n" 342 "to save your changes.\n"
343 "Free up some space\n" 343 "Free up some space\n"
344 "and try again.\n" 344 "and try again.\n"
345 "\nQuit Anyway?"), 345 "\nQuit Anyway?"),
346 QMessageBox::Yes|QMessageBox::Escape, 346 QMessageBox::Yes|QMessageBox::Escape,
347 QMessageBox::No|QMessageBox::Default) 347 QMessageBox::No|QMessageBox::Default)
348 != QMessageBox::No ) { 348 != QMessageBox::No ) {
349 e->accept(); 349 e->accept();
350 quit = true; 350 quit = true;
351 }else 351 }else
352 e->ignore(); 352 e->ignore();
353 353
354 } 354 }
355 355
356 if (quit ) { 356 if (quit ) {
357 Config config( "todo" ); 357 Config config( "todo" );
358 config.setGroup( "View" ); 358 config.setGroup( "View" );
359 config.writeEntry( "ShowComplete", showCompleted() ); 359 config.writeEntry( "ShowComplete", showCompleted() );
360 config.writeEntry( "Category", currentCategory() ); 360 config.writeEntry( "Category", currentCategory() );
361 config.writeEntry( "ShowDeadLine", showDeadline()); 361 config.writeEntry( "ShowDeadLine", showDeadline());
362 config.writeEntry( "ShowOverDue", showOverDue() ); 362 config.writeEntry( "ShowOverDue", showOverDue() );
363 /* svae templates */ 363 /* svae templates */
364 templateManager()->save(); 364 templateManager()->save();
365 e->accept(); 365 e->accept();
366 } 366 }
367} 367}
368void MainWindow::populateTemplates() { 368void MainWindow::populateTemplates() {
369 m_template->clear(); 369 m_template->clear();
370 QStringList list = templateManager()->templates(); 370 QStringList list = templateManager()->templates();
371 QStringList::Iterator it; 371 QStringList::Iterator it;
372 for ( it = list.begin(); it != list.end(); ++it ) { 372 for ( it = list.begin(); it != list.end(); ++it ) {
373 m_template->insertItem( (*it) ); 373 m_template->insertItem( (*it) );
374 } 374 }
375} 375}
376/* 376/*
377 * slotNewFromTemplate 377 * slotNewFromTemplate
378 * We use the edit widget to do 378 * We use the edit widget to do
379 * the config but we setUid(-1) 379 * the config but we setUid(-1)
380 * to get a new uid 380 * to get a new uid
381 */ 381 */
382/* 382/*
383 * first we get the name of the template 383 * first we get the name of the template
384 * then we will use the TemplateManager 384 * then we will use the TemplateManager
385 */ 385 */
386void MainWindow::slotNewFromTemplate( int id ) { 386void MainWindow::slotNewFromTemplate( int id ) {
387 QString name = m_template->text( id ); 387 QString name = m_template->text( id );
388 388
389 OTodo event = templateManager()->templateEvent( name ); 389 OTodo event = templateManager()->templateEvent( name );
390 event = currentEditor()->edit(this, 390 event = currentEditor()->edit(this,
391 event ); 391 event );
392 392