[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: [Kde-pim] [Bug 77988] konsolekalendar reports wrong time (hour too
From: Allen Winter <winterz () verizon ! net>
Date: 2004-03-22 20:57:21
Message-ID: 20040322205721.19645.qmail () ktown ! kde ! org
[Download RAW message or body]
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=77988
winterz verizon net changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From winterz verizon net 2004-03-22 21:57 -------
CVS commit by winterz:
Backport fix for handling timezones.
This fix has been in HEAD for several weeks but I finally got around
to the backport.
CCMAIL: 77988-done bugs kde org
M +56 -22 konsolekalendarvariables.cpp 1.20.4.2
M +48 -29 konsolekalendarvariables.h 1.21.4.2
M +33 -33 main.cpp 1.48.4.2
--- kdepim/konsolekalendar/konsolekalendarvariables.cpp #1.20.4.1:1.20.4.2
@ -32,5 +32,6 @
#include <iostream>
#include <stdio.h>
-
+#include <unistd.h>
+#include <time.h>
@ -43,4 +44,6 @ using namespace std;
KonsoleKalendarVariables::KonsoleKalendarVariables()
{
+ m_TimeZoneId = "";
+ m_bIsTimeZoneId = false;
m_bIsUID = false;
m_bIsStartDateTime = false;
@ -60,4 +63,35 @ KonsoleKalendarVariables::KonsoleKalenda
}
+// The following function is taken from korganizer's KOPrefs::setTimeZoneIdDefault()
+// Fine with me;) Tuukka
+void KonsoleKalendarVariables::setTimeZoneId()
+{
+ QString zone;
+
+ char zonefilebuf[100];
+ int len = readlink("/etc/localtime",zonefilebuf,100);
+ if (len > 0 && len < 100) {
+ zonefilebuf[len] = '\0';
+ zone = zonefilebuf;
+ zone = zone.mid(zone.find("zoneinfo/") + 9);
+ } else {
+ tzset();
+ zone = tzname[0];
+ }
+
+ m_bIsTimeZoneId = true;
+ m_TimeZoneId = zone;
+}
+
+QString KonsoleKalendarVariables::getTimeZoneId()
+{
+ return m_TimeZoneId;
+}
+
+bool KonsoleKalendarVariables::isTimeZoneId()
+{
+ return m_bIsTimeZoneId;
+}
+
KonsoleKalendarVariables::~KonsoleKalendarVariables()
{
--- kdepim/konsolekalendar/main.cpp #1.48.4.1:1.48.4.2
@ -382,5 +382,5 @ int main(int argc, char *argv[])
return(1);
}
- kdDebug() << "main | parse options | End date after converstion: (" << \
enddate.toString() << ")" << endl; + kdDebug() << "main | parse options | End date \
after conversion: (" << enddate.toString() << ")" << endl; }
@ -399,5 +399,5 @ int main(int argc, char *argv[])
variables.setDaysCount( option.toInt( &ok, 10 ) );
- if( !ok ){
+ if( !ok ) {
kdError() << i18n("Invalid Date Count Specified: ").local8Bit() << option \
<< endl; return(1);
@ -406,5 +406,5 @ int main(int argc, char *argv[])
enddate = startdate;
enddate = enddate.addDays( variables.getDaysCount() );
- kdDebug() << "main | parse options | End date after converstion: (" << \
enddate.toString() << ")" << endl; + kdDebug() << "main | parse options | End \
date after conversion: (" << enddate.toString() << ")" << endl;
}
@ -514,11 +514,11 @ int main(int argc, char *argv[])
* Should we use local calendar or resource?
*/
-
+ variables.setTimeZoneId();
if( args->isSet("file") ) {
- localCalendar = new CalendarLocal();
+ localCalendar = new CalendarLocal( variables.getTimeZoneId() );
localCalendar->load( variables.getCalendarFile() );
variables.setCalendar( localCalendar );
} else {
- calendarResource = new CalendarResources();
+ calendarResource = new CalendarResources( variables.getTimeZoneId() );
variables.setCalendarResources( calendarResource );
}
--- kdepim/konsolekalendar/konsolekalendarvariables.h #1.21.4.1:1.21.4.2
@ -88,4 +88,21 @ class KonsoleKalendarVariables
bool isEndDateTime();
+ /**
+ * Sets the timezone from the user or system environment
+ */
+ void setTimeZoneId();
+
+ /**
+ * Get timezone id string
+ * return timezone id string
+ */
+ QString getTimeZoneId();
+
+ /**
+ * Is there a timezone set?
+ * return true if there is false if there isn't
+ */
+ bool isTimeZoneId();
+
void setUID( QString uid );
@ -303,4 +320,6 @ class KonsoleKalendarVariables
void skipWhiteSpace( const QString &str, int &pos );
+ bool m_bIsTimeZoneId;
+ QString m_TimeZoneId;
QDateTime m_startDateTime;
QDateTime m_endDateTime;
_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic