summaryrefslogtreecommitdiffabout
path: root/libkcal/calendar.cpp
Unidiff
Diffstat (limited to 'libkcal/calendar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendar.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index f4350d9..5092d1a 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -32,48 +32,49 @@
32#include "calendar.h" 32#include "calendar.h"
33#include "syncdefines.h" 33#include "syncdefines.h"
34 34
35using namespace KCal; 35using namespace KCal;
36 36
37Calendar::Calendar() 37Calendar::Calendar()
38{ 38{
39 39
40 init(); 40 init();
41 setTimeZoneId( " 00:00 Europe/London(UTC)" ); 41 setTimeZoneId( " 00:00 Europe/London(UTC)" );
42} 42}
43 43
44Calendar::Calendar( const QString &timeZoneId ) 44Calendar::Calendar( const QString &timeZoneId )
45{ 45{
46 46
47 init(); 47 init();
48 setTimeZoneId(timeZoneId); 48 setTimeZoneId(timeZoneId);
49} 49}
50 50
51void Calendar::init() 51void Calendar::init()
52{ 52{
53 mObserver = 0; 53 mObserver = 0;
54 mNewObserver = false; 54 mNewObserver = false;
55 mUndoIncidence = 0; 55 mUndoIncidence = 0;
56 mDeleteIncidencesOnClose = true;
56 mModified = false; 57 mModified = false;
57 mDefaultCalendar = 1; 58 mDefaultCalendar = 1;
58 // Setup default filter, which does nothing 59 // Setup default filter, which does nothing
59 mDefaultFilter = new CalFilter; 60 mDefaultFilter = new CalFilter;
60 mFilter = mDefaultFilter; 61 mFilter = mDefaultFilter;
61 mFilter->setEnabled(false); 62 mFilter->setEnabled(false);
62 63
63 // initialize random numbers. This is a hack, and not 64 // initialize random numbers. This is a hack, and not
64 // even that good of one at that. 65 // even that good of one at that.
65// srandom(time(0)); 66// srandom(time(0));
66 67
67 // user information... 68 // user information...
68 setOwner(i18n("Unknown Name")); 69 setOwner(i18n("Unknown Name"));
69 setEmail(i18n("unknown@nowhere")); 70 setEmail(i18n("unknown@nowhere"));
70 71
71#if 0 72#if 0
72 tmpStr = KOPrefs::instance()->mTimeZone; 73 tmpStr = KOPrefs::instance()->mTimeZone;
73// kdDebug(5800) << "Calendar::Calendar(): TimeZone: " << tmpStr << endl; 74// kdDebug(5800) << "Calendar::Calendar(): TimeZone: " << tmpStr << endl;
74 int dstSetting = KOPrefs::instance()->mDaylightSavings; 75 int dstSetting = KOPrefs::instance()->mDaylightSavings;
75 extern long int timezone; 76 extern long int timezone;
76 struct tm *now; 77 struct tm *now;
77 time_t curtime; 78 time_t curtime;
78 curtime = time(0); 79 curtime = time(0);
79 now = localtime(&curtime); 80 now = localtime(&curtime);
@@ -91,48 +92,52 @@ void Calendar::init()
91 } else { 92 } else {
92 tzStr = tmpStr; 93 tzStr = tmpStr;
93 } 94 }
94 95
95 // if daylight savings has changed since last load time, we need 96 // if daylight savings has changed since last load time, we need
96 // to rewrite these settings to the config file. 97 // to rewrite these settings to the config file.
97 if ((now->tm_isdst && !dstSetting) || 98 if ((now->tm_isdst && !dstSetting) ||
98 (!now->tm_isdst && dstSetting)) { 99 (!now->tm_isdst && dstSetting)) {
99 KOPrefs::instance()->mTimeZone = tzStr; 100 KOPrefs::instance()->mTimeZone = tzStr;
100 KOPrefs::instance()->mDaylightSavings = now->tm_isdst; 101 KOPrefs::instance()->mDaylightSavings = now->tm_isdst;
101 } 102 }
102 103
103 setTimeZone(tzStr); 104 setTimeZone(tzStr);
104#endif 105#endif
105 106
106// KOPrefs::instance()->writeConfig(); 107// KOPrefs::instance()->writeConfig();
107} 108}
108 109
109Calendar::~Calendar() 110Calendar::~Calendar()
110{ 111{
111 delete mDefaultFilter; 112 delete mDefaultFilter;
112 if ( mUndoIncidence ) 113 if ( mUndoIncidence )
113 delete mUndoIncidence; 114 delete mUndoIncidence;
114} 115}
116void Calendar::setDontDeleteIncidencesOnClose ()
117{
118 mDeleteIncidencesOnClose = false;
119}
115void Calendar::setDefaultCalendar( int d ) 120void Calendar::setDefaultCalendar( int d )
116{ 121{
117 mDefaultCalendar = d; 122 mDefaultCalendar = d;
118} 123}
119int Calendar::defaultCalendar() 124int Calendar::defaultCalendar()
120{ 125{
121 return mDefaultCalendar; 126 return mDefaultCalendar;
122} 127}
123const QString &Calendar::getOwner() const 128const QString &Calendar::getOwner() const
124{ 129{
125 return mOwner; 130 return mOwner;
126} 131}
127 132
128bool Calendar::undoDeleteIncidence() 133bool Calendar::undoDeleteIncidence()
129{ 134{
130 if (!mUndoIncidence) 135 if (!mUndoIncidence)
131 return false; 136 return false;
132 addIncidence(mUndoIncidence); 137 addIncidence(mUndoIncidence);
133 mUndoIncidence = 0; 138 mUndoIncidence = 0;
134 return true; 139 return true;
135} 140}
136void Calendar::setOwner(const QString &os) 141void Calendar::setOwner(const QString &os)
137{ 142{
138 int i; 143 int i;