* implemented gmt/ local time switch, not working atm but will investigate
note: i think it should be enough to only call _kern_set_tzfilename(..) as the timezone offset and dst would have been set by clockconfig on boot or from the time prefs panel while switching the timezone. so the comment in _user_set_tzfilename should not be count and no update would be needed. it should only take the sIsGmt boolean take into account when getting the time. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22558 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6a0f39da22
commit
3ad1de3b5a
@ -3,6 +3,9 @@ SubDir HAIKU_TOP src preferences time ;
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
AddSubDirSupportedPlatforms libbe_test ;
|
||||
|
||||
UsePrivateHeaders kernel ;
|
||||
UseArchHeaders $(TARGET_ARCH) ;
|
||||
|
||||
Preference Time :
|
||||
AnalogClock.cpp
|
||||
BaseView.cpp
|
||||
|
@ -27,6 +27,17 @@
|
||||
#include <Window.h>
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
#include <syscalls.h>
|
||||
#else
|
||||
void _kset_tzfilename_(const char *name, size_t length, bool isGMT);
|
||||
#define _kern_set_tzfilename _kset_tzfilename_
|
||||
#endif
|
||||
|
||||
|
||||
TSettingsView::TSettingsView(BRect frame)
|
||||
: BView(frame,"Settings", B_FOLLOW_ALL,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP),
|
||||
@ -106,6 +117,10 @@ TSettingsView::MessageReceived(BMessage *message)
|
||||
Window()->PostMessage(&msg);
|
||||
} break;
|
||||
|
||||
case kRTCUpdate:
|
||||
_UpdateGmtSettings();
|
||||
break;
|
||||
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
break;
|
||||
@ -186,16 +201,18 @@ TSettingsView::_InitView()
|
||||
frameRight.top = text->Frame().bottom + 5.0;
|
||||
|
||||
fLocalTime = new BRadioButton(frameRight, "local", "Local time",
|
||||
new BMessage(H_RTC_CHANGE));
|
||||
new BMessage(kRTCUpdate));
|
||||
AddChild(fLocalTime);
|
||||
fLocalTime->ResizeToPreferred();
|
||||
fLocalTime->SetTarget(this);
|
||||
|
||||
frameRight.left = fLocalTime->Frame().right +10.0f;
|
||||
|
||||
fGmtTime = new BRadioButton(frameRight, "gmt", "GMT", new BMessage(H_RTC_CHANGE));
|
||||
fGmtTime = new BRadioButton(frameRight, "gmt", "GMT", new BMessage(kRTCUpdate));
|
||||
AddChild(fGmtTime);
|
||||
fGmtTime->ResizeToPreferred();
|
||||
|
||||
fGmtTime->SetTarget(this);
|
||||
|
||||
if (fIsLocalTime)
|
||||
fLocalTime->SetValue(B_CONTROL_ON);
|
||||
else
|
||||
@ -253,6 +270,29 @@ TSettingsView::_WriteRTCSettings()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TSettingsView::_UpdateGmtSettings()
|
||||
{
|
||||
_WriteRTCSettings();
|
||||
|
||||
BPath path;
|
||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
|
||||
return;
|
||||
|
||||
path.Append("timezone");
|
||||
BEntry entry(path.Path(), true);
|
||||
|
||||
if (!entry.Exists())
|
||||
return;
|
||||
|
||||
entry.GetPath(&path);
|
||||
|
||||
// take the existing timezone and set it's gmt use
|
||||
_kern_set_tzfilename(path.Path(), B_PATH_NAME_LENGTH
|
||||
, fGmtTime->Value() == B_CONTROL_ON);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TSettingsView::_UpdateDateTime(BMessage *message)
|
||||
{
|
||||
|
@ -35,6 +35,7 @@ class TSettingsView : public BView {
|
||||
void _InitView();
|
||||
void _ReadRTCSettings();
|
||||
void _WriteRTCSettings();
|
||||
void _UpdateGmtSettings();
|
||||
void _UpdateDateTime(BMessage *message);
|
||||
|
||||
private:
|
||||
|
@ -18,6 +18,9 @@
|
||||
#include <Message.h>
|
||||
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
TimeApplication::TimeApplication()
|
||||
: BApplication(HAIKU_APP_SIGNATURE),
|
||||
fWindow(NULL)
|
||||
@ -72,6 +75,7 @@ int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
TimeApplication app;
|
||||
setuid(0);
|
||||
app.Run();
|
||||
|
||||
return 0;
|
||||
|
@ -36,7 +36,7 @@ const uint32 H_TM_CHANGED = 'obTC';
|
||||
const uint32 H_USER_CHANGE = 'obUC';
|
||||
|
||||
// local/ gmt radiobuttons
|
||||
const uint32 H_RTC_CHANGE = 'obRC';
|
||||
const uint32 kRTCUpdate = '_rtc';
|
||||
|
||||
// sunday/ monday radio button
|
||||
const uint32 kWeekStart = '_kws';
|
||||
|
Loading…
x
Reference in New Issue
Block a user