summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/datebookmonth.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/library/datebookmonth.cpp b/library/datebookmonth.cpp
index 013ab66..2616b7b 100644
--- a/library/datebookmonth.cpp
+++ b/library/datebookmonth.cpp
@@ -8,48 +8,51 @@
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "config.h" 20#include "config.h"
21#include "datebookmonth.h" 21#include "datebookmonth.h"
22#include "datebookdb.h" 22#include "datebookdb.h"
23#include "resource.h" 23#include "resource.h"
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25 25
26#include <qtoolbutton.h> 26#include <qtoolbutton.h>
27#include <qspinbox.h> 27#include <qspinbox.h>
28#include <qcombobox.h> 28#include <qcombobox.h>
29#include <qvaluestack.h> 29#include <qvaluestack.h>
30#include <qwhatsthis.h> 30#include <qwhatsthis.h>
31 31
32static const QColor s_colorNormalLight = QColor(255, 150, 150);
33static const QColor s_colorRepeatLight = QColor(150, 150, 255);
34static const QColor s_colorHolidayLight= QColor(150, 255, 150);
32 35
33DateBookMonthHeader::DateBookMonthHeader( QWidget *parent, const char *name ) 36DateBookMonthHeader::DateBookMonthHeader( QWidget *parent, const char *name )
34 : QHBox( parent, name ) 37 : QHBox( parent, name )
35{ 38{
36 setBackgroundMode( PaletteButton ); 39 setBackgroundMode( PaletteButton );
37 40
38 begin = new QToolButton( this ); 41 begin = new QToolButton( this );
39 begin->setFocusPolicy(NoFocus); 42 begin->setFocusPolicy(NoFocus);
40 begin->setPixmap( Resource::loadPixmap( "start" ) ); 43 begin->setPixmap( Resource::loadPixmap( "start" ) );
41 begin->setAutoRaise( TRUE ); 44 begin->setAutoRaise( TRUE );
42 begin->setFixedSize( begin->sizeHint() ); 45 begin->setFixedSize( begin->sizeHint() );
43 QWhatsThis::add( begin, tr("Show January in the selected year") ); 46 QWhatsThis::add( begin, tr("Show January in the selected year") );
44 47
45 back = new QToolButton( this ); 48 back = new QToolButton( this );
46 back->setFocusPolicy(NoFocus); 49 back->setFocusPolicy(NoFocus);
47 back->setPixmap( Resource::loadPixmap( "back" ) ); 50 back->setPixmap( Resource::loadPixmap( "back" ) );
48 back->setAutoRaise( TRUE ); 51 back->setAutoRaise( TRUE );
49 back->setFixedSize( back->sizeHint() ); 52 back->setFixedSize( back->sizeHint() );
50 QWhatsThis::add( back, tr("Show the previous month") ); 53 QWhatsThis::add( back, tr("Show the previous month") );
51 54
52 month = new QComboBox( FALSE, this ); 55 month = new QComboBox( FALSE, this );
53 for ( int i = 0; i < 12; ++i ) 56 for ( int i = 0; i < 12; ++i )
54 month->insertItem( Calendar::nameOfMonth( i + 1 ) ); 57 month->insertItem( Calendar::nameOfMonth( i + 1 ) );
55 58
@@ -589,62 +592,62 @@ void DayItemMonth::paint( QPainter *p, const QColorGroup &cg,
589 eLine = w - 1; 592 eLine = w - 1;
590 else { 593 else {
591 eLine = (t - 8) * (w - 8); 594 eLine = (t - 8) * (w - 8);
592 if (eLine) 595 if (eLine)
593 eLine /= 8; 596 eLine /= 8;
594 eLine += 4; 597 eLine += 4;
595 } 598 }
596 if (!ev.hasRepeat()) { 599 if (!ev.hasRepeat()) {
597 normalLine.push(sLine); 600 normalLine.push(sLine);
598 normalLine.push(eLine); 601 normalLine.push(eLine);
599 } else { 602 } else {
600 repeatLine.push(sLine); 603 repeatLine.push(sLine);
601 repeatLine.push(eLine); 604 repeatLine.push(eLine);
602 } 605 }
603 } 606 }
604 } 607 }
605 608
606 // draw the background 609 // draw the background
607 if (normalAllDay || repeatAllDay || travelAllDay || holidayAllDay) { 610 if (normalAllDay || repeatAllDay || travelAllDay || holidayAllDay) {
608 p->save(); 611 p->save();
609 612
610 if (normalAllDay) 613 if (normalAllDay)
611 if (repeatAllDay) { 614 if (repeatAllDay) {
612 p->fillRect( 0, 0, cr.width(), cr.height() / 2, 615 p->fillRect( 0, 0, cr.width(), cr.height() / 2,
613 colorNormalLight ); 616 s_colorNormalLight );
614 p->fillRect( 0, cr.height() / 2, cr.width(), cr.height() / 2, 617 p->fillRect( 0, cr.height() / 2, cr.width(), cr.height() / 2,
615 colorRepeatLight ); 618 colorRepeatLight );
616 } else { 619 } else {
617 if (!holidayAllDay) { 620 if (!holidayAllDay) {
618 p->fillRect( 0, 0, cr.width(), cr.height(), 621 p->fillRect( 0, 0, cr.width(), cr.height(),
619 colorNormalLight ); 622 s_colorNormalLight );
620 } else { 623 } else {
621 p->fillRect( 0, 0, cr.width(), cr.height(), 624 p->fillRect( 0, 0, cr.width(), cr.height(),
622 QColor(0,220,0) ); 625 s_colorHolidayLight );
623 } 626 }
624 } else if (repeatAllDay) { 627 } else if (repeatAllDay) {
625 p->fillRect( 0, 0, cr.width(), cr.height(), 628 p->fillRect( 0, 0, cr.width(), cr.height(),
626 colorRepeatLight ); 629 s_colorRepeatLight );
627 } 630 }
628 } else { 631 } else {
629 p->fillRect( 0, 0, cr.width(), 632 p->fillRect( 0, 0, cr.width(),
630 cr.height(), selected 633 cr.height(), selected
631 ? g.brush( QColorGroup::Highlight ) 634 ? g.brush( QColorGroup::Highlight )
632 : g.brush( QColorGroup::Base ) ); 635 : g.brush( QColorGroup::Base ) );
633 } 636 }
634 637
635 // The lines 638 // The lines
636 // now for the lines. 639 // now for the lines.
637 int h = 5; 640 int h = 5;
638 int y = cr.height() / 2 - h; 641 int y = cr.height() / 2 - h;
639 642
640 while(normalLine.count() >= 2) { 643 while(normalLine.count() >= 2) {
641 int x2 = normalLine.pop(); 644 int x2 = normalLine.pop();
642 int x1 = normalLine.pop(); 645 int x1 = normalLine.pop();
643 if (x2 < x1 + 2) 646 if (x2 < x1 + 2)
644 x2 = x1 + 2; 647 x2 = x1 + 2;
645 p->fillRect(x1, y, x2 - x1, h, colorNormal); 648 p->fillRect(x1, y, x2 - x1, h, colorNormal);
646 } 649 }
647 650
648 y += h; 651 y += h;
649 652
650 while(repeatLine.count() >= 2) { 653 while(repeatLine.count() >= 2) {