-rw-r--r-- | korganizer/kotodoviewitem.cpp | 7 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 29 |
2 files changed, 21 insertions, 15 deletions
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 70f00c6..6559119 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -271,194 +271,197 @@ void KOTodoViewItem::stateChange(bool state) | |||
271 | setSortKey(5,skeyd); | 271 | setSortKey(5,skeyd); |
272 | setSortKey(6,skeyt); | 272 | setSortKey(6,skeyt); |
273 | } | 273 | } |
274 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); | 274 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); |
275 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 275 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
276 | 276 | ||
277 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 277 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
278 | if (mTodo->percentComplete()<100) { | 278 | if (mTodo->percentComplete()<100) { |
279 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 279 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
280 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 280 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
281 | } | 281 | } |
282 | else { | 282 | else { |
283 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 283 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
284 | else setSortKey(2,QString::number(99)); | 284 | else setSortKey(2,QString::number(99)); |
285 | } | 285 | } |
286 | if ( state ) { | 286 | if ( state ) { |
287 | QListViewItem * myChild = firstChild(); | 287 | QListViewItem * myChild = firstChild(); |
288 | KOTodoViewItem *item; | 288 | KOTodoViewItem *item; |
289 | while( myChild ) { | 289 | while( myChild ) { |
290 | //qDebug("stateCH "); | 290 | //qDebug("stateCH "); |
291 | item = static_cast<KOTodoViewItem*>(myChild); | 291 | item = static_cast<KOTodoViewItem*>(myChild); |
292 | item->stateChange(state); | 292 | item->stateChange(state); |
293 | myChild = myChild->nextSibling(); | 293 | myChild = myChild->nextSibling(); |
294 | } | 294 | } |
295 | } else { | 295 | } else { |
296 | QListViewItem * myChild = parent(); | 296 | QListViewItem * myChild = parent(); |
297 | if ( myChild ) | 297 | if ( myChild ) |
298 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); | 298 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); |
299 | } | 299 | } |
300 | mTodoView->modified(true); | 300 | mTodoView->modified(true); |
301 | setMyPixmap(); | 301 | setMyPixmap(); |
302 | mTodoView->setTodoModified( mTodo ); | 302 | mTodoView->setTodoModified( mTodo ); |
303 | } | 303 | } |
304 | 304 | ||
305 | bool KOTodoViewItem::isAlternate() | 305 | bool KOTodoViewItem::isAlternate() |
306 | { | 306 | { |
307 | 307 | ||
308 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | 308 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); |
309 | if (lv && lv->alternateBackground().isValid()) | 309 | if (lv && lv->alternateBackground().isValid()) |
310 | { | 310 | { |
311 | KOTodoViewItem *above = 0; | 311 | KOTodoViewItem *above = 0; |
312 | above = static_cast<KOTodoViewItem *>(itemAbove()); | 312 | above = static_cast<KOTodoViewItem *>(itemAbove()); |
313 | m_known = above ? above->m_known : true; | 313 | m_known = above ? above->m_known : true; |
314 | if (m_known) | 314 | if (m_known) |
315 | { | 315 | { |
316 | m_odd = above ? !above->m_odd : false; | 316 | m_odd = above ? !above->m_odd : false; |
317 | } | 317 | } |
318 | else | 318 | else |
319 | { | 319 | { |
320 | KOTodoViewItem *item; | 320 | KOTodoViewItem *item; |
321 | bool previous = true; | 321 | bool previous = true; |
322 | if (QListViewItem::parent()) | 322 | if (QListViewItem::parent()) |
323 | { | 323 | { |
324 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); | 324 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); |
325 | if (item) | 325 | if (item) |
326 | previous = item->m_odd; | 326 | previous = item->m_odd; |
327 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); | 327 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); |
328 | } | 328 | } |
329 | else | 329 | else |
330 | { | 330 | { |
331 | item = static_cast<KOTodoViewItem *>(lv->firstChild()); | 331 | item = static_cast<KOTodoViewItem *>(lv->firstChild()); |
332 | } | 332 | } |
333 | 333 | ||
334 | while(item) | 334 | while(item) |
335 | { | 335 | { |
336 | item->m_odd = previous = !previous; | 336 | item->m_odd = previous = !previous; |
337 | item->m_known = true; | 337 | item->m_known = true; |
338 | item = static_cast<KOTodoViewItem *>(item->nextSibling()); | 338 | item = static_cast<KOTodoViewItem *>(item->nextSibling()); |
339 | } | 339 | } |
340 | } | 340 | } |
341 | return m_odd; | 341 | return m_odd; |
342 | } | 342 | } |
343 | return false; | 343 | return false; |
344 | } | 344 | } |
345 | 345 | ||
346 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) | 346 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) |
347 | { | 347 | { |
348 | QColorGroup _cg = cg; | 348 | QColorGroup _cg = cg; |
349 | QColorGroup::ColorRole role; | 349 | QColorGroup::ColorRole role; |
350 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) | 350 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) |
351 | role = QColorGroup::Text; | 351 | role = QColorGroup::Text; |
352 | else | 352 | else |
353 | role = QColorGroup::Base; | 353 | role = QColorGroup::Base; |
354 | //#ifndef KORG_NOLVALTERNATION | 354 | //#ifndef KORG_NOLVALTERNATION |
355 | if (isAlternate()) | 355 | if (isAlternate()) |
356 | _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); | 356 | _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); |
357 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; | 357 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; |
358 | QColor colorToSet; | 358 | QColor colorToSet; |
359 | if ( setColor ) { | 359 | if ( setColor ) { |
360 | QStringList categories = mTodo->categories(); | 360 | QStringList categories = mTodo->categories(); |
361 | QString cat = categories.first(); | 361 | QString cat = categories.first(); |
362 | if ( !cat.isEmpty()) { | 362 | if ( !cat.isEmpty()) { |
363 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); | 363 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); |
364 | } else | 364 | } else |
365 | setColor = false; | 365 | setColor = false; |
366 | } | 366 | } |
367 | 367 | bool openMode = !isOpen(); | |
368 | int odue = mTodo->hasDueSubTodo( !isOpen()); | 368 | // maybe we are in flat-display-mode |
369 | if ( !firstChild() ) | ||
370 | openMode = false; | ||
371 | int odue = mTodo->hasDueSubTodo( openMode ); | ||
369 | if (odue == 2) { | 372 | if (odue == 2) { |
370 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; | 373 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; |
371 | setColor = true; | 374 | setColor = true; |
372 | } else if ( odue == 1 ) { | 375 | } else if ( odue == 1 ) { |
373 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; | 376 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; |
374 | setColor = true; | 377 | setColor = true; |
375 | } | 378 | } |
376 | 379 | ||
377 | 380 | ||
378 | if ( setColor ) { | 381 | if ( setColor ) { |
379 | _cg.setColor(role,colorToSet ); | 382 | _cg.setColor(role,colorToSet ); |
380 | if ( role == QColorGroup::Base) { | 383 | if ( role == QColorGroup::Base) { |
381 | int rgb = colorToSet.red(); | 384 | int rgb = colorToSet.red(); |
382 | rgb += colorToSet.blue()/2; | 385 | rgb += colorToSet.blue()/2; |
383 | rgb += colorToSet.green(); | 386 | rgb += colorToSet.green(); |
384 | if ( rgb < 200 ) | 387 | if ( rgb < 200 ) |
385 | _cg.setColor(QColorGroup::Text,Qt::white ); | 388 | _cg.setColor(QColorGroup::Text,Qt::white ); |
386 | } | 389 | } |
387 | } | 390 | } |
388 | //#endif | 391 | //#endif |
389 | if ( column > 0 ){ | 392 | if ( column > 0 ){ |
390 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { | 393 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { |
391 | p->save(); | 394 | p->save(); |
392 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); | 395 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); |
393 | 396 | ||
394 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background | 397 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background |
395 | // p->setPen(Qt::black ); //border | 398 | // p->setPen(Qt::black ); //border |
396 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling | 399 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling |
397 | QColor fc = KOPrefs::instance()->mHighlightColor; | 400 | QColor fc = KOPrefs::instance()->mHighlightColor; |
398 | if ( mTodo->percentComplete() == 100 ) | 401 | if ( mTodo->percentComplete() == 100 ) |
399 | fc = darkGreen; | 402 | fc = darkGreen; |
400 | p->drawRect( 2, 2, width-4, height()-4); | 403 | p->drawRect( 2, 2, width-4, height()-4); |
401 | p->fillRect( 3, 3, progress, height()-6, | 404 | p->fillRect( 3, 3, progress, height()-6, |
402 | fc ); | 405 | fc ); |
403 | p->restore(); | 406 | p->restore(); |
404 | } else { | 407 | } else { |
405 | QCheckListItem::paintCell(p, _cg, column, width, alignment); | 408 | QCheckListItem::paintCell(p, _cg, column, width, alignment); |
406 | } | 409 | } |
407 | return; | 410 | return; |
408 | } | 411 | } |
409 | 412 | ||
410 | int align = alignment; | 413 | int align = alignment; |
411 | 414 | ||
412 | if ( !p ) | 415 | if ( !p ) |
413 | return; | 416 | return; |
414 | 417 | ||
415 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); | 418 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); |
416 | 419 | ||
417 | QListView *lv = listView(); | 420 | QListView *lv = listView(); |
418 | if ( !lv ) | 421 | if ( !lv ) |
419 | return; | 422 | return; |
420 | int marg = 2;//lv->itemMargin(); | 423 | int marg = 2;//lv->itemMargin(); |
421 | int r = 0; | 424 | int r = 0; |
422 | QCheckListItem::Type myType = QCheckListItem::CheckBox; | 425 | QCheckListItem::Type myType = QCheckListItem::CheckBox; |
423 | int BoxSize = 20; | 426 | int BoxSize = 20; |
424 | int boxOffset = 2; | 427 | int boxOffset = 2; |
425 | int xOffset = 2; | 428 | int xOffset = 2; |
426 | if (qApp->desktop()->width() < 300 ) { | 429 | if (qApp->desktop()->width() < 300 ) { |
427 | BoxSize = 14; | 430 | BoxSize = 14; |
428 | boxOffset = -1; | 431 | boxOffset = -1; |
429 | xOffset = 1; | 432 | xOffset = 1; |
430 | // marg = 0; | 433 | // marg = 0; |
431 | } | 434 | } |
432 | if ( height() < BoxSize ) { | 435 | if ( height() < BoxSize ) { |
433 | boxOffset = boxOffset - ((BoxSize - height())/2) ; | 436 | boxOffset = boxOffset - ((BoxSize - height())/2) ; |
434 | // qDebug("boxOffset %d height %d", boxOffset, height() ); | 437 | // qDebug("boxOffset %d height %d", boxOffset, height() ); |
435 | BoxSize = height(); | 438 | BoxSize = height(); |
436 | 439 | ||
437 | } | 440 | } |
438 | //bool winStyle = lv->style() == WindowsStyle; | 441 | //bool winStyle = lv->style() == WindowsStyle; |
439 | 442 | ||
440 | int lineStart = 5; | 443 | int lineStart = 5; |
441 | if ( myType == Controller ) { | 444 | if ( myType == Controller ) { |
442 | if ( !pixmap( 0 ) ) | 445 | if ( !pixmap( 0 ) ) |
443 | r += BoxSize + 4; | 446 | r += BoxSize + 4; |
444 | } else { | 447 | } else { |
445 | ASSERT( lv ); //### | 448 | ASSERT( lv ); //### |
446 | //QFontMetrics fm( lv->font() ); | 449 | //QFontMetrics fm( lv->font() ); |
447 | //int d = fm.height(); | 450 | //int d = fm.height(); |
448 | int x = 0; | 451 | int x = 0; |
449 | int y = (height() - BoxSize) / 2; | 452 | int y = (height() - BoxSize) / 2; |
450 | //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); | 453 | //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); |
451 | if ( myType == CheckBox ) { | 454 | if ( myType == CheckBox ) { |
452 | if ( isEnabled() ) | 455 | if ( isEnabled() ) |
453 | p->setPen( QPen( _cg.text(), 1 ) ); | 456 | p->setPen( QPen( _cg.text(), 1 ) ); |
454 | else | 457 | else |
455 | p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); | 458 | p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); |
456 | p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); | 459 | p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); |
457 | lineStart = x+marg; | 460 | lineStart = x+marg; |
458 | ///////////////////// | 461 | ///////////////////// |
459 | x++; | 462 | x++; |
460 | y++; | 463 | y++; |
461 | if ( isOn() ) { | 464 | if ( isOn() ) { |
462 | QPointArray a( 7*2 ); | 465 | QPointArray a( 7*2 ); |
463 | int i, xx, yy; | 466 | int i, xx, yy; |
464 | xx = x+xOffset+marg+(boxOffset/2); | 467 | xx = x+xOffset+marg+(boxOffset/2); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 006a8dd..019f41f 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -426,238 +426,241 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | |||
426 | mCalendar->checkAlarmForIncidence( 0, true); | 426 | mCalendar->checkAlarmForIncidence( 0, true); |
427 | //showMaximized(); | 427 | //showMaximized(); |
428 | //raise(); | 428 | //raise(); |
429 | hide(); | 429 | hide(); |
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | if ( cmsg == "-newCountdown" ) { | 432 | if ( cmsg == "-newCountdown" ) { |
433 | qDebug("newCountdown "); | 433 | qDebug("newCountdown "); |
434 | 434 | ||
435 | } | 435 | } |
436 | QString msg ; | 436 | QString msg ; |
437 | QString allmsg = cmsg; | 437 | QString allmsg = cmsg; |
438 | while ( allmsg.length() > 0 ) { | 438 | while ( allmsg.length() > 0 ) { |
439 | int nextC = allmsg.find( "-", 1 ); | 439 | int nextC = allmsg.find( "-", 1 ); |
440 | if ( nextC == -1 ) { | 440 | if ( nextC == -1 ) { |
441 | msg = allmsg; | 441 | msg = allmsg; |
442 | allmsg = ""; | 442 | allmsg = ""; |
443 | } else{ | 443 | } else{ |
444 | msg = allmsg.left( nextC ); | 444 | msg = allmsg.left( nextC ); |
445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
446 | } | 446 | } |
447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
448 | if ( msg == "-newEvent" ) { | 448 | if ( msg == "-newEvent" ) { |
449 | mView->newEvent(); | 449 | mView->newEvent(); |
450 | } | 450 | } |
451 | if ( msg == "-newTodo" ) { | 451 | if ( msg == "-newTodo" ) { |
452 | mView->newTodo(); | 452 | mView->newTodo(); |
453 | 453 | ||
454 | } | 454 | } |
455 | if ( msg == "-showWN" ) { | 455 | if ( msg == "-showWN" ) { |
456 | mView->viewManager()->showWhatsNextView(); | 456 | mView->viewManager()->showWhatsNextView(); |
457 | } | 457 | } |
458 | if ( msg == "-showTodo" ) { | 458 | if ( msg == "-showTodo" ) { |
459 | mView->viewManager()->showTodoView(); | 459 | mView->viewManager()->showTodoView(); |
460 | } | 460 | } |
461 | if ( msg == "-showList" ) { | 461 | if ( msg == "-showList" ) { |
462 | mView->viewManager()->showListView(); | 462 | mView->viewManager()->showListView(); |
463 | } | 463 | } |
464 | else if ( msg == "-showDay" ) { | 464 | else if ( msg == "-showDay" ) { |
465 | mView->viewManager()->showDayView(); | 465 | mView->viewManager()->showDayView(); |
466 | } | 466 | } |
467 | else if ( msg == "-showWWeek" ) { | 467 | else if ( msg == "-showWWeek" ) { |
468 | mView->viewManager()->showWorkWeekView(); | 468 | mView->viewManager()->showWorkWeekView(); |
469 | } | 469 | } |
470 | else if ( msg == "-ringSync" ) { | 470 | else if ( msg == "-ringSync" ) { |
471 | mSyncManager->multiSync( false ); | 471 | mSyncManager->multiSync( false ); |
472 | } | 472 | } |
473 | else if ( msg == "-showWeek" ) { | 473 | else if ( msg == "-showWeek" ) { |
474 | mView->viewManager()->showWeekView(); | 474 | mView->viewManager()->showWeekView(); |
475 | } | 475 | } |
476 | else if ( msg == "-showTodo" ) { | 476 | else if ( msg == "-showTodo" ) { |
477 | mView->viewManager()->showTodoView(); | 477 | mView->viewManager()->showTodoView(); |
478 | } | 478 | } |
479 | else if ( msg == "-showJournal" ) { | 479 | else if ( msg == "-showJournal" ) { |
480 | mView->dateNavigator()->selectDates( 1 ); | 480 | mView->dateNavigator()->selectDates( 1 ); |
481 | mView->dateNavigator()->selectToday(); | 481 | mView->dateNavigator()->selectToday(); |
482 | mView->viewManager()->showJournalView(); | 482 | mView->viewManager()->showJournalView(); |
483 | } | 483 | } |
484 | else if ( msg == "-showKO" ) { | 484 | else if ( msg == "-showKO" ) { |
485 | mView->viewManager()->showNextXView(); | 485 | mView->viewManager()->showNextXView(); |
486 | } | 486 | } |
487 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 487 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
488 | mView->viewManager()->showWhatsNextView(); | 488 | mView->viewManager()->showWhatsNextView(); |
489 | } | 489 | } |
490 | else if ( msg == "-showNextXView" ) { | 490 | else if ( msg == "-showNextXView" ) { |
491 | mView->viewManager()->showNextXView(); | 491 | mView->viewManager()->showNextXView(); |
492 | } | 492 | } |
493 | 493 | ||
494 | 494 | ||
495 | } | 495 | } |
496 | 496 | ||
497 | showMaximized(); | 497 | showMaximized(); |
498 | raise(); | 498 | raise(); |
499 | } | 499 | } |
500 | 500 | ||
501 | QPixmap MainWindow::loadPixmap( QString name ) | 501 | QPixmap MainWindow::loadPixmap( QString name ) |
502 | { | 502 | { |
503 | return SmallIcon( name ); | 503 | return SmallIcon( name ); |
504 | 504 | ||
505 | } | 505 | } |
506 | void MainWindow::initActions() | 506 | void MainWindow::initActions() |
507 | { | 507 | { |
508 | //KOPrefs::instance()->mShowFullMenu | 508 | //KOPrefs::instance()->mShowFullMenu |
509 | iconToolBar->clear(); | 509 | iconToolBar->clear(); |
510 | KOPrefs *p = KOPrefs::instance(); | 510 | KOPrefs *p = KOPrefs::instance(); |
511 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 511 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
512 | 512 | ||
513 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 513 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
514 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 514 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
515 | QPopupMenu *importMenu = new QPopupMenu( this ); | 515 | QPopupMenu *importMenu = new QPopupMenu( this ); |
516 | selectFilterMenu = new QPopupMenu( this ); | 516 | selectFilterMenu = new QPopupMenu( this ); |
517 | selectFilterMenu->setCheckable( true ); | 517 | selectFilterMenu->setCheckable( true ); |
518 | syncMenu = new QPopupMenu( this ); | 518 | syncMenu = new QPopupMenu( this ); |
519 | configureAgendaMenu = new QPopupMenu( this ); | 519 | configureAgendaMenu = new QPopupMenu( this ); |
520 | configureToolBarMenu = new QPopupMenu( this ); | 520 | configureToolBarMenu = new QPopupMenu( this ); |
521 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 521 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
522 | |||
523 | QIconSet icon; | ||
524 | int pixWid = 22, pixHei = 22; | ||
525 | QString pathString = ""; | ||
526 | if ( !p->mToolBarMiniIcons ) { | ||
527 | if ( QApplication::desktop()->width() < 480 ) { | ||
528 | pathString += "icons16/"; | ||
529 | pixWid = 18; pixHei = 16; | ||
530 | } | ||
531 | } else { | ||
532 | pathString += "iconsmini/"; | ||
533 | pixWid = 18; pixHei = 16; | ||
534 | } | ||
522 | if ( KOPrefs::instance()->mShowFullMenu ) { | 535 | if ( KOPrefs::instance()->mShowFullMenu ) { |
523 | QMenuBar *menuBar1; | 536 | QMenuBar *menuBar1; |
524 | menuBar1 = menuBar(); | 537 | menuBar1 = menuBar(); |
525 | menuBar1->insertItem( i18n("File"), importMenu ); | 538 | menuBar1->insertItem( i18n("File"), importMenu ); |
526 | menuBar1->insertItem( i18n("View"), viewMenu ); | 539 | menuBar1->insertItem( i18n("View"), viewMenu ); |
527 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 540 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
528 | #ifdef DESKTOP_VERSION | 541 | #ifdef DESKTOP_VERSION |
529 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 542 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
530 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 543 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
531 | #else | 544 | #else |
532 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 545 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
533 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 546 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
534 | #endif | 547 | #endif |
535 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 548 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
536 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 549 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
537 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 550 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
538 | } else { | 551 | } else { |
539 | QPEMenuBar *menuBar1; | 552 | QPEMenuBar *menuBar1; |
540 | menuBar1 = new QPEMenuBar( iconToolBar ); | 553 | menuBar1 = new QPEMenuBar( iconToolBar ); |
541 | QPopupMenu *menuBar = new QPopupMenu( this ); | 554 | QPopupMenu *menuBar = new QPopupMenu( this ); |
542 | menuBar1->insertItem( i18n("ME"), menuBar); | 555 | icon = loadPixmap( pathString + "z_menu" ); |
556 | menuBar1->insertItem( icon.pixmap(), menuBar); | ||
557 | //menuBar1->insertItem( i18n("ME"), menuBar); | ||
543 | menuBar->insertItem( i18n("File"), importMenu ); | 558 | menuBar->insertItem( i18n("File"), importMenu ); |
544 | menuBar->insertItem( i18n("View"), viewMenu ); | 559 | menuBar->insertItem( i18n("View"), viewMenu ); |
545 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 560 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
546 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 561 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
547 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 562 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
548 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 563 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
549 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 564 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
550 | menuBar->insertItem( i18n("Help"), helpMenu ); | 565 | menuBar->insertItem( i18n("Help"), helpMenu ); |
551 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 566 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
552 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 567 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
553 | } | 568 | } |
554 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 569 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
555 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 570 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
556 | QIconSet icon; | ||
557 | int pixWid = 22, pixHei = 22; | ||
558 | QString pathString = ""; | ||
559 | if ( !p->mToolBarMiniIcons ) { | ||
560 | if ( QApplication::desktop()->width() < 480 ) { | ||
561 | pathString += "icons16/"; | ||
562 | pixWid = 18; pixHei = 16; | ||
563 | } | ||
564 | } else { | ||
565 | pathString += "iconsmini/"; | ||
566 | pixWid = 18; pixHei = 16; | ||
567 | } | ||
568 | mWeekBgColor = iconToolBar->backgroundColor(); | 571 | mWeekBgColor = iconToolBar->backgroundColor(); |
569 | mWeekPixmap.resize( pixWid , pixHei ); | 572 | mWeekPixmap.resize( pixWid , pixHei ); |
570 | mWeekPixmap.fill( mWeekBgColor ); | 573 | mWeekPixmap.fill( mWeekBgColor ); |
571 | icon = mWeekPixmap; | 574 | icon = mWeekPixmap; |
572 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 575 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
573 | if ( p-> mShowIconWeekNum ) | 576 | if ( p-> mShowIconWeekNum ) |
574 | mWeekAction->addTo( iconToolBar ); | 577 | mWeekAction->addTo( iconToolBar ); |
575 | mWeekFont = font(); | 578 | mWeekFont = font(); |
576 | 579 | ||
577 | int fontPoint = mWeekFont.pointSize(); | 580 | int fontPoint = mWeekFont.pointSize(); |
578 | QFontMetrics f( mWeekFont ); | 581 | QFontMetrics f( mWeekFont ); |
579 | int fontWid = f.width( "30" ); | 582 | int fontWid = f.width( "30" ); |
580 | while ( fontWid > pixWid ) { | 583 | while ( fontWid > pixWid ) { |
581 | --fontPoint; | 584 | --fontPoint; |
582 | mWeekFont.setPointSize( fontPoint ); | 585 | mWeekFont.setPointSize( fontPoint ); |
583 | QFontMetrics f( mWeekFont ); | 586 | QFontMetrics f( mWeekFont ); |
584 | fontWid = f.width( "30" ); | 587 | fontWid = f.width( "30" ); |
585 | qDebug("dec-- "); | 588 | qDebug("dec-- "); |
586 | } | 589 | } |
587 | 590 | ||
588 | connect( mWeekAction, SIGNAL( activated() ), | 591 | connect( mWeekAction, SIGNAL( activated() ), |
589 | this, SLOT( weekAction() ) ); | 592 | this, SLOT( weekAction() ) ); |
590 | 593 | ||
591 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 594 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
592 | 595 | ||
593 | //#endif | 596 | //#endif |
594 | // ****************** | 597 | // ****************** |
595 | QAction *action; | 598 | QAction *action; |
596 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 599 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
597 | configureToolBarMenu->setCheckable( true ); | 600 | configureToolBarMenu->setCheckable( true ); |
598 | 601 | ||
599 | 602 | ||
600 | configureAgendaMenu->setCheckable( true ); | 603 | configureAgendaMenu->setCheckable( true ); |
601 | int iii ; | 604 | int iii ; |
602 | for ( iii = 1;iii<= 10 ;++iii ){ | 605 | for ( iii = 1;iii<= 10 ;++iii ){ |
603 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 606 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
604 | } | 607 | } |
605 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 608 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
606 | 609 | ||
607 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 610 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
608 | this, SLOT( showConfigureAgenda( ) ) ); | 611 | this, SLOT( showConfigureAgenda( ) ) ); |
609 | 612 | ||
610 | icon = loadPixmap( pathString + "configure" ); | 613 | icon = loadPixmap( pathString + "configure" ); |
611 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 614 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
612 | action->addTo( actionMenu ); | 615 | action->addTo( actionMenu ); |
613 | connect( action, SIGNAL( activated() ), | 616 | connect( action, SIGNAL( activated() ), |
614 | mView, SLOT( edit_options() ) ); | 617 | mView, SLOT( edit_options() ) ); |
615 | actionMenu->insertSeparator(); | 618 | actionMenu->insertSeparator(); |
616 | 619 | ||
617 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 620 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
618 | action->addTo( actionMenu ); | 621 | action->addTo( actionMenu ); |
619 | connect( action, SIGNAL( activated() ), | 622 | connect( action, SIGNAL( activated() ), |
620 | mView, SLOT( undo_delete() ) ); | 623 | mView, SLOT( undo_delete() ) ); |
621 | actionMenu->insertSeparator(); | 624 | actionMenu->insertSeparator(); |
622 | 625 | ||
623 | icon = loadPixmap( pathString + "newevent" ); | 626 | icon = loadPixmap( pathString + "newevent" ); |
624 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 627 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
625 | configureToolBarMenu->insertSeparator(); | 628 | configureToolBarMenu->insertSeparator(); |
626 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 629 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
627 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 630 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
628 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 631 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
629 | ne_action->addTo( actionMenu ); | 632 | ne_action->addTo( actionMenu ); |
630 | connect( ne_action, SIGNAL( activated() ), | 633 | connect( ne_action, SIGNAL( activated() ), |
631 | mView, SLOT( newEvent() ) ); | 634 | mView, SLOT( newEvent() ) ); |
632 | icon = loadPixmap( pathString + "newtodo" ); | 635 | icon = loadPixmap( pathString + "newtodo" ); |
633 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 636 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
634 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 637 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
635 | nt_action->addTo( actionMenu ); | 638 | nt_action->addTo( actionMenu ); |
636 | connect( nt_action, SIGNAL( activated() ), | 639 | connect( nt_action, SIGNAL( activated() ), |
637 | mView, SLOT( newTodo() ) ); | 640 | mView, SLOT( newTodo() ) ); |
638 | 641 | ||
639 | icon = loadPixmap( pathString + "today" ); | 642 | icon = loadPixmap( pathString + "today" ); |
640 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 643 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
641 | today_action->addTo( viewMenu ); | 644 | today_action->addTo( viewMenu ); |
642 | connect( today_action, SIGNAL( activated() ), | 645 | connect( today_action, SIGNAL( activated() ), |
643 | mView, SLOT( goToday() ) ); | 646 | mView, SLOT( goToday() ) ); |
644 | viewMenu->insertSeparator(); | 647 | viewMenu->insertSeparator(); |
645 | 648 | ||
646 | icon = loadPixmap( pathString + "navi" ); | 649 | icon = loadPixmap( pathString + "navi" ); |
647 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 650 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
648 | action->addTo( viewMenu ); | 651 | action->addTo( viewMenu ); |
649 | connect( action, SIGNAL( activated() ), | 652 | connect( action, SIGNAL( activated() ), |
650 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 653 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
651 | mToggleNav = action ; | 654 | mToggleNav = action ; |
652 | icon = loadPixmap( pathString + "filter" ); | 655 | icon = loadPixmap( pathString + "filter" ); |
653 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 656 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
654 | action->addTo( viewMenu ); | 657 | action->addTo( viewMenu ); |
655 | connect( action, SIGNAL( activated() ), | 658 | connect( action, SIGNAL( activated() ), |
656 | mView, SLOT( toggleFilter() ) ); | 659 | mView, SLOT( toggleFilter() ) ); |
657 | mToggleFilter = action; | 660 | mToggleFilter = action; |
658 | icon = loadPixmap( pathString + "allday" ); | 661 | icon = loadPixmap( pathString + "allday" ); |
659 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 662 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
660 | action->addTo( viewMenu ); | 663 | action->addTo( viewMenu ); |
661 | connect( action, SIGNAL( activated() ), | 664 | connect( action, SIGNAL( activated() ), |
662 | mView, SLOT( toggleAllDaySize() ) ); | 665 | mView, SLOT( toggleAllDaySize() ) ); |
663 | mToggleAllday = action; | 666 | mToggleAllday = action; |