Diffstat (limited to 'core/pim/datebook/datebookday.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index 26f0303..b8385aa 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -1,53 +1,65 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
20 | 30 | ||
21 | #include "datebookday.h" | 31 | #include "datebookday.h" |
22 | #include "datebooktypes.h" | 32 | #include "datebooktypes.h" |
23 | #include "datebookdayheaderimpl.h" | 33 | #include "datebookdayheaderimpl.h" |
24 | #include "datebookdayallday.h" | 34 | #include "datebookdayallday.h" |
25 | 35 | ||
26 | #include <opie2/oholidayplugin.h> | 36 | #include <opie2/oholidayplugin.h> |
27 | #include <qpe/resource.h> | 37 | #include <opie2/oresource.h> |
28 | #include <qpe/qpeapplication.h> | 38 | |
39 | #include <qpe/applnk.h> | ||
29 | #include <qpe/ir.h> | 40 | #include <qpe/ir.h> |
41 | #include <qpe/qpeapplication.h> | ||
30 | 42 | ||
31 | #include <qsimplerichtext.h> | 43 | #include <qsimplerichtext.h> |
32 | #include <qpopupmenu.h> | 44 | #include <qpopupmenu.h> |
33 | 45 | ||
34 | 46 | ||
35 | #include <qtimer.h> | 47 | #include <qtimer.h> |
36 | 48 | ||
37 | DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, const char *name ) | 49 | DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, const char *name ) |
38 | : QTable( 24, 1, parent, name ), ampm( whichClock ), currDate( QDate::currentDate() ) | 50 | : QTable( 24, 1, parent, name ), ampm( whichClock ), currDate( QDate::currentDate() ) |
39 | { | 51 | { |
40 | enableClipper(TRUE); | 52 | enableClipper(TRUE); |
41 | setTopMargin( 0 ); | 53 | setTopMargin( 0 ); |
42 | horizontalHeader()->hide(); | 54 | horizontalHeader()->hide(); |
43 | setLeftMargin(38); | 55 | setLeftMargin(38); |
44 | setColumnStretchable( 0, TRUE ); | 56 | setColumnStretchable( 0, TRUE ); |
45 | setHScrollBarMode( QScrollView::AlwaysOff ); | 57 | setHScrollBarMode( QScrollView::AlwaysOff ); |
46 | verticalHeader()->setPalette(white); | 58 | verticalHeader()->setPalette(white); |
47 | verticalHeader()->setResizeEnabled(FALSE); | 59 | verticalHeader()->setResizeEnabled(FALSE); |
48 | setSelectionMode( Single ); | 60 | setSelectionMode( Single ); |
49 | 61 | ||
50 | // get rid of being able to edit things... | 62 | // get rid of being able to edit things... |
51 | QTableItem *tmp; | 63 | QTableItem *tmp; |
52 | int row; | 64 | int row; |
53 | for ( row = 0; row < numRows(); row++ ) { | 65 | for ( row = 0; row < numRows(); row++ ) { |
@@ -736,57 +748,59 @@ void DateBookDayWidget::paintEvent( QPaintEvent *e ) | |||
736 | if (ev.end() < curTime) { | 748 | if (ev.end() < curTime) { |
737 | p.setBrush( QColor( 180, 180, 180 ) ); // grey, inactive | 749 | p.setBrush( QColor( 180, 180, 180 ) ); // grey, inactive |
738 | } else { | 750 | } else { |
739 | //change color in dependence of the time till the event starts | 751 | //change color in dependence of the time till the event starts |
740 | int duration = curTime.secsTo(ev.start()); | 752 | int duration = curTime.secsTo(ev.start()); |
741 | if (duration < 0) duration = 0; | 753 | if (duration < 0) duration = 0; |
742 | int colChange = duration*160/86400; //86400: secs per day, 160: max color shift | 754 | int colChange = duration*160/86400; //86400: secs per day, 160: max color shift |
743 | p.setBrush( QColor( 200-colChange, 200-colChange, 255 ) ); //blue | 755 | p.setBrush( QColor( 200-colChange, 200-colChange, 255 ) ); //blue |
744 | } | 756 | } |
745 | } else { | 757 | } else { |
746 | p.setBrush( QColor( 220, 220, 220 ) ); //light grey, inactive (not current date) | 758 | p.setBrush( QColor( 220, 220, 220 ) ); //light grey, inactive (not current date) |
747 | //perhaps make a distinction between future/past dates | 759 | //perhaps make a distinction between future/past dates |
748 | } | 760 | } |
749 | } | 761 | } |
750 | 762 | ||
751 | p.setPen( QColor(100, 100, 100) ); | 763 | p.setPen( QColor(100, 100, 100) ); |
752 | p.drawRect(rect()); | 764 | p.drawRect(rect()); |
753 | 765 | ||
754 | // p.drawRect(0,0, 5, height()); | 766 | // p.drawRect(0,0, 5, height()); |
755 | 767 | ||
756 | int y = 0; | 768 | int y = 0; |
757 | int d = 0; | 769 | int d = 0; |
758 | 770 | ||
759 | if ( ev.event().hasAlarm() ) { | 771 | if ( ev.event().hasAlarm() ) { |
760 | p.drawPixmap( width() - 16, 0, Resource::loadPixmap( "bell" ) ); | 772 | p.drawPixmap( width() - AppLnk::smallIconSize(), 0, |
761 | y = 20; | 773 | Opie::Core::OResource::loadPixmap( "bell", Opie::Core::OResource::SmallIcon ) ); |
774 | y = AppLnk::smallIconSize() + 2; | ||
762 | d = 20; | 775 | d = 20; |
763 | } | 776 | } |
764 | 777 | ||
765 | if ( ev.event().hasRepeat() ) { | 778 | if ( ev.event().hasRepeat() ) { |
766 | p.drawPixmap( width() - 16, y, Resource::loadPixmap( "repeat" ) ); | 779 | p.drawPixmap( width() - AppLnk::smallIconSize(), y, |
780 | Opie::Core::OResource::loadPixmap( "repeat", Opie::Core::OResource::SmallIcon ) ); | ||
767 | d = 20; | 781 | d = 20; |
768 | y += 20; | 782 | y += AppLnk::smallIconSize() + 2; |
769 | } | 783 | } |
770 | 784 | ||
771 | QSimpleRichText rt( text, font() ); | 785 | QSimpleRichText rt( text, font() ); |
772 | rt.setWidth( geom.width() - d - 6 ); | 786 | rt.setWidth( geom.width() - d - 6 ); |
773 | rt.draw( &p, 7, 0, e->region(), colorGroup() ); | 787 | rt.draw( &p, 7, 0, e->region(), colorGroup() ); |
774 | } | 788 | } |
775 | 789 | ||
776 | /* | 790 | /* |
777 | * we need to find the real start date for a uid | 791 | * we need to find the real start date for a uid |
778 | * we need to check from one day to another... | 792 | * we need to check from one day to another... |
779 | */ | 793 | */ |
780 | QDate DateBookDay::findRealStart( int uid, const QDate& isIncluded , DateBookDB* db) { | 794 | QDate DateBookDay::findRealStart( int uid, const QDate& isIncluded , DateBookDB* db) { |
781 | QDate dt( isIncluded ); | 795 | QDate dt( isIncluded ); |
782 | QDate fnd = dt; | 796 | QDate fnd = dt; |
783 | 797 | ||
784 | bool doAgain = true; | 798 | bool doAgain = true; |
785 | do{ | 799 | do{ |
786 | dt = dt.addDays( -1 ); | 800 | dt = dt.addDays( -1 ); |
787 | QValueList<EffectiveEvent> events = db->getEffectiveEvents( dt, dt ); | 801 | QValueList<EffectiveEvent> events = db->getEffectiveEvents( dt, dt ); |
788 | for (QValueList<EffectiveEvent>::Iterator it = events.begin(); it != events.end(); ++it ) { | 802 | for (QValueList<EffectiveEvent>::Iterator it = events.begin(); it != events.end(); ++it ) { |
789 | EffectiveEvent ev = (*it); | 803 | EffectiveEvent ev = (*it); |
790 | if ( uid == ev.event().uid() && ev.start() != QTime(0, 0, 0 ) ) | 804 | if ( uid == ev.event().uid() && ev.start() != QTime(0, 0, 0 ) ) |
791 | return ev.date(); | 805 | return ev.date(); |
792 | } | 806 | } |