summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/opimevent.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/core/opimevent.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimevent.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libopie2/opiepim/core/opimevent.cpp b/libopie2/opiepim/core/opimevent.cpp
index 9d46651..8752fce 100644
--- a/libopie2/opiepim/core/opimevent.cpp
+++ b/libopie2/opiepim/core/opimevent.cpp
@@ -12,48 +12,50 @@
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details. 20++= -. .` .: details.
21 : = ...= . :.=- 21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU 22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "opimevent.h" 30#include "opimevent.h"
31 31
32/* OPIE */ 32/* OPIE */
33#include <opie2/opimrecurrence.h> 33#include <opie2/opimrecurrence.h>
34#include <opie2/opimresolver.h> 34#include <opie2/opimresolver.h>
35#include <opie2/opimnotifymanager.h> 35#include <opie2/opimnotifymanager.h>
36#include <opie2/odebug.h>
37
36#include <qpe/categories.h> 38#include <qpe/categories.h>
37#include <qpe/stringutil.h> 39#include <qpe/stringutil.h>
38 40
39/* QT */ 41/* QT */
40 42
41namespace Opie 43namespace Opie
42{ 44{
43 45
44int OCalendarHelper::week( const QDate& date ) 46int OCalendarHelper::week( const QDate& date )
45{ 47{
46 // Calculates the week this date is in within that 48 // Calculates the week this date is in within that
47 // month. Equals the "row" is is in in the month view 49 // month. Equals the "row" is is in in the month view
48 int week = 1; 50 int week = 1;
49 QDate tmp( date.year(), date.month(), 1 ); 51 QDate tmp( date.year(), date.month(), 1 );
50 if ( date.dayOfWeek() < tmp.dayOfWeek() ) 52 if ( date.dayOfWeek() < tmp.dayOfWeek() )
51 ++week; 53 ++week;
52 54
53 week += ( date.day() - 1 ) / 7; 55 week += ( date.day() - 1 ) / 7;
54 56
55 return week; 57 return week;
56} 58}
57 59
58 60
59int OCalendarHelper::ocurrence( const QDate& date ) 61int OCalendarHelper::ocurrence( const QDate& date )
@@ -620,52 +622,52 @@ void OPimEvent::fromMap( const QMap<int, QString>& map )
620 if ( map[ OPimEvent::FType ] == "AllDay" ) 622 if ( map[ OPimEvent::FType ] == "AllDay" )
621 setAllDay( true ); 623 setAllDay( true );
622 else 624 else
623 setAllDay( false ); 625 setAllDay( false );
624 626
625 if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) ) 627 if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) )
626 { 628 {
627 setTimeZone( map[ OPimEvent::FTimeZone ] ); 629 setTimeZone( map[ OPimEvent::FTimeZone ] );
628 } 630 }
629 631
630 time_t start = ( time_t ) map[ OPimEvent::FStart ].toLong(); 632 time_t start = ( time_t ) map[ OPimEvent::FStart ].toLong();
631 time_t end = ( time_t ) map[ OPimEvent::FEnd ].toLong(); 633 time_t end = ( time_t ) map[ OPimEvent::FEnd ].toLong();
632 634
633 /* AllDay is always in UTC */ 635 /* AllDay is always in UTC */
634 if ( isAllDay() ) 636 if ( isAllDay() )
635 { 637 {
636 OPimTimeZone utc = OPimTimeZone::utc(); 638 OPimTimeZone utc = OPimTimeZone::utc();
637 setStartDateTime( utc.fromUTCDateTime( start ) ); 639 setStartDateTime( utc.fromUTCDateTime( start ) );
638 setEndDateTime ( utc.fromUTCDateTime( end ) ); 640 setEndDateTime ( utc.fromUTCDateTime( end ) );
639 setTimeZone( "UTC" ); // make sure it is really utc 641 setTimeZone( "UTC" ); // make sure it is really utc
640 } 642 }
641 else 643 else
642 { 644 {
643 /* to current date time */ 645 /* to current date time */
644 // qWarning(" Start is %d", start ); 646 // owarn << " Start is " << start << "" << oendl;
645 OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() ); 647 OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() );
646 QDateTime date = zone.toDateTime( start ); 648 QDateTime date = zone.toDateTime( start );
647 qWarning( " Start is %s", date.toString().latin1() ); 649 owarn << " Start is " << date.toString() << "" << oendl;
648 setStartDateTime( zone.toDateTime( date, OPimTimeZone::current() ) ); 650 setStartDateTime( zone.toDateTime( date, OPimTimeZone::current() ) );
649 651
650 date = zone.toDateTime( end ); 652 date = zone.toDateTime( end );
651 setEndDateTime ( zone.toDateTime( date, OPimTimeZone::current() ) ); 653 setEndDateTime ( zone.toDateTime( date, OPimTimeZone::current() ) );
652 } 654 }
653 655
654 int alarmTime = -1; 656 int alarmTime = -1;
655 if ( !map[ OPimEvent::FAlarm ].isEmpty() ) 657 if ( !map[ OPimEvent::FAlarm ].isEmpty() )
656 alarmTime = map[ OPimEvent::FAlarm ].toInt(); 658 alarmTime = map[ OPimEvent::FAlarm ].toInt();
657 659
658 int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); 660 int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent );
659 if ( ( alarmTime != -1 ) ) 661 if ( ( alarmTime != -1 ) )
660 { 662 {
661 QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 ); 663 QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 );
662 OPimAlarm al( sound , dt ); 664 OPimAlarm al( sound , dt );
663 notifiers().add( al ); 665 notifiers().add( al );
664 } 666 }
665 667
666 668
667 if ( !map[ OPimEvent::FNote ].isEmpty() ) 669 if ( !map[ OPimEvent::FNote ].isEmpty() )
668 setNote( map[ OPimEvent::FNote ] ); 670 setNote( map[ OPimEvent::FNote ] );
669 671
670 if ( !map[ OPimEvent::FRecParent ].isEmpty() ) 672 if ( !map[ OPimEvent::FRecParent ].isEmpty() )
671 setParent( map[ OPimEvent::FRecParent ].toInt() ); 673 setParent( map[ OPimEvent::FRecParent ].toInt() );