Applied patch by Philippe Saint-Pierre:
* Extended the scope of the Revert feature to include changes to the time zone. * Moved the Revert button out of the tab view, so that it indicates the above visually. The window now handles the Revert feature. * Added Others/Greenwhich time zone which is equivalent to an "unset" time zone. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25415 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
1da9f5cea5
commit
310930fd9e
@ -15,9 +15,9 @@
|
|||||||
#include "DateTimeEdit.h"
|
#include "DateTimeEdit.h"
|
||||||
#include "TimeMessages.h"
|
#include "TimeMessages.h"
|
||||||
#include "DateTime.h"
|
#include "DateTime.h"
|
||||||
|
#include "TimeWindow.h"
|
||||||
|
|
||||||
|
|
||||||
#include <Button.h>
|
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
@ -69,10 +69,7 @@ DateTimeView::AttachedToWindow()
|
|||||||
if (!fInitialized) {
|
if (!fInitialized) {
|
||||||
fInitialized = true;
|
fInitialized = true;
|
||||||
|
|
||||||
fGmtTime->SetTarget(this);
|
|
||||||
fLocalTime->SetTarget(this);
|
|
||||||
fCalendarView->SetTarget(this);
|
fCalendarView->SetTarget(this);
|
||||||
fRevertButton->SetTarget(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,12 +128,10 @@ DateTimeView::MessageReceived(BMessage *message)
|
|||||||
case kRTCUpdate:
|
case kRTCUpdate:
|
||||||
fUseGmtTime = fGmtTime->Value() == B_CONTROL_ON;
|
fUseGmtTime = fGmtTime->Value() == B_CONTROL_ON;
|
||||||
_UpdateGmtSettings();
|
_UpdateGmtSettings();
|
||||||
CheckCanRevert();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgRevert:
|
case kMsgRevert:
|
||||||
_Revert();
|
_Revert();
|
||||||
fRevertButton->SetEnabled(false);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -146,7 +141,7 @@ DateTimeView::MessageReceived(BMessage *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
bool
|
||||||
DateTimeView::CheckCanRevert()
|
DateTimeView::CheckCanRevert()
|
||||||
{
|
{
|
||||||
// check GMT vs Local setting
|
// check GMT vs Local setting
|
||||||
@ -157,9 +152,7 @@ DateTimeView::CheckCanRevert()
|
|||||||
time_t changedNow;
|
time_t changedNow;
|
||||||
time(&changedNow);
|
time(&changedNow);
|
||||||
|
|
||||||
enable = enable || (changedNow != unchangedNow);
|
return enable || (changedNow != unchangedNow);
|
||||||
|
|
||||||
fRevertButton->SetEnabled(enable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -266,20 +259,6 @@ DateTimeView::_InitView()
|
|||||||
|
|
||||||
fOldUseGmtTime = fUseGmtTime;
|
fOldUseGmtTime = fUseGmtTime;
|
||||||
|
|
||||||
BRect rect = Bounds();
|
|
||||||
|
|
||||||
rect.left = 10;
|
|
||||||
rect.top = rect.bottom - 10;
|
|
||||||
|
|
||||||
fRevertButton = new BButton(rect, "revert", "Revert",
|
|
||||||
new BMessage(kMsgRevert), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW);
|
|
||||||
|
|
||||||
fRevertButton->ResizeToPreferred();
|
|
||||||
fRevertButton->SetEnabled(false);
|
|
||||||
float buttonHeight = fRevertButton->Bounds().Height();
|
|
||||||
fRevertButton->MoveBy(0, -buttonHeight);
|
|
||||||
AddChild(fRevertButton);
|
|
||||||
|
|
||||||
ResizeTo(fClock->Frame().right + 10.0, fGmtTime->Frame().bottom + 10.0);
|
ResizeTo(fClock->Frame().right + 10.0, fGmtTime->Frame().bottom + 10.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ class TTimeEdit;
|
|||||||
class BCalendarView;
|
class BCalendarView;
|
||||||
class BRadioButton;
|
class BRadioButton;
|
||||||
class TAnalogClock;
|
class TAnalogClock;
|
||||||
class BButton;
|
|
||||||
|
|
||||||
|
|
||||||
class DateTimeView : public BView {
|
class DateTimeView : public BView {
|
||||||
@ -32,7 +31,8 @@ class DateTimeView : public BView {
|
|||||||
virtual void Draw(BRect updaterect);
|
virtual void Draw(BRect updaterect);
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
|
||||||
void CheckCanRevert();
|
bool CheckCanRevert();
|
||||||
|
bool GetUseGmtTime();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _InitView();
|
void _InitView();
|
||||||
@ -51,9 +51,7 @@ class DateTimeView : public BView {
|
|||||||
BCalendarView *fCalendarView;
|
BCalendarView *fCalendarView;
|
||||||
TAnalogClock *fClock;
|
TAnalogClock *fClock;
|
||||||
|
|
||||||
BButton *fRevertButton;
|
bool fUseGmtTime;
|
||||||
|
|
||||||
bool fUseGmtTime;
|
|
||||||
bool fOldUseGmtTime;
|
bool fOldUseGmtTime;
|
||||||
bool fInitialized;
|
bool fInitialized;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ TimeApplication::AboutRequested()
|
|||||||
{
|
{
|
||||||
BAlert *alert = new BAlert("about",
|
BAlert *alert = new BAlert("about",
|
||||||
"Time & Date, writen by:\n\n\tAndrew Edward McCall\n\tMike Berg\n\t"
|
"Time & Date, writen by:\n\n\tAndrew Edward McCall\n\tMike Berg\n\t"
|
||||||
"Julun\n\nCopyright 2004-2007, Haiku.", "OK");
|
"Julun\n\tPhilippe Saint-Pierre\n\nCopyright 2004-2008, Haiku.", "OK");
|
||||||
alert->Go();
|
alert->Go();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <TabView.h>
|
#include <TabView.h>
|
||||||
|
#include <Button.h>
|
||||||
|
|
||||||
|
|
||||||
TTimeWindow::TTimeWindow(BRect rect)
|
TTimeWindow::TTimeWindow(BRect rect)
|
||||||
@ -37,19 +38,38 @@ TTimeWindow::~TTimeWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TTimeWindow::SetRevertStatus()
|
||||||
|
{
|
||||||
|
fRevertButton->SetEnabled(fDateTimeView->CheckCanRevert()
|
||||||
|
|| fTimeZoneView->CheckCanRevert());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TTimeWindow::MessageReceived(BMessage *message)
|
TTimeWindow::MessageReceived(BMessage *message)
|
||||||
{
|
{
|
||||||
switch(message->what) {
|
switch(message->what) {
|
||||||
case H_USER_CHANGE:
|
case H_USER_CHANGE:
|
||||||
fBaseView->ChangeTime(message);
|
fBaseView->ChangeTime(message);
|
||||||
fDateTimeView->CheckCanRevert();
|
SetRevertStatus();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_ABOUT_REQUESTED:
|
case B_ABOUT_REQUESTED:
|
||||||
be_app->PostMessage(B_ABOUT_REQUESTED);
|
be_app->PostMessage(B_ABOUT_REQUESTED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kMsgRevert:
|
||||||
|
fDateTimeView->MessageReceived(message);
|
||||||
|
fTimeZoneView->MessageReceived(message);
|
||||||
|
fRevertButton->SetEnabled(false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kRTCUpdate:
|
||||||
|
fDateTimeView->MessageReceived(message);
|
||||||
|
SetRevertStatus();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(message);
|
BWindow::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
@ -101,8 +121,24 @@ TTimeWindow::_InitWindow()
|
|||||||
|
|
||||||
fBaseView->AddChild(tabView);
|
fBaseView->AddChild(tabView);
|
||||||
tabView->ResizeBy(0.0, tabView->TabHeight());
|
tabView->ResizeBy(0.0, tabView->TabHeight());
|
||||||
|
|
||||||
|
BRect rect = Bounds();
|
||||||
|
|
||||||
|
rect.left = 10;
|
||||||
|
rect.top = rect.bottom - 10;
|
||||||
|
|
||||||
|
fRevertButton = new BButton(rect, "revert", "Revert",
|
||||||
|
new BMessage(kMsgRevert), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW);
|
||||||
|
|
||||||
|
fRevertButton->ResizeToPreferred();
|
||||||
|
fRevertButton->SetEnabled(false);
|
||||||
|
float buttonHeight = fRevertButton->Bounds().Height();
|
||||||
|
fRevertButton->MoveBy(0, -buttonHeight);
|
||||||
|
fBaseView->AddChild(fRevertButton);
|
||||||
|
fRevertButton->SetTarget(this);
|
||||||
|
|
||||||
fBaseView->ResizeTo(tabView->Bounds().Width() + 10.0,
|
fBaseView->ResizeTo(tabView->Bounds().Width() + 10.0,
|
||||||
tabView->Bounds().Height() + 10.0);
|
tabView->Bounds().Height() + buttonHeight + 30.0);
|
||||||
|
|
||||||
ResizeTo(fBaseView->Bounds().Width(), fBaseView->Bounds().Height());
|
ResizeTo(fBaseView->Bounds().Width(), fBaseView->Bounds().Height());
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ class TTimeWindow : public BWindow {
|
|||||||
|
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
void SetRevertStatus();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _InitWindow();
|
void _InitWindow();
|
||||||
@ -36,6 +37,7 @@ class TTimeWindow : public BWindow {
|
|||||||
TTimeBaseView *fBaseView;
|
TTimeBaseView *fBaseView;
|
||||||
DateTimeView *fDateTimeView;
|
DateTimeView *fDateTimeView;
|
||||||
TimeZoneView *fTimeZoneView;
|
TimeZoneView *fTimeZoneView;
|
||||||
|
BButton *fRevertButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TIME_WINDOW_H
|
#endif // TIME_WINDOW_H
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
|
* Copyright 2004-2008, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Mike Berg <mike@berg-net.us>
|
* Mike Berg <mike@berg-net.us>
|
||||||
* Julun <host.haiku@gmx.de>
|
* Julun <host.haiku@gmx.de>
|
||||||
|
* Philippe Saint-Pierre <stpere@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -21,6 +22,7 @@
|
|||||||
#include "ZoneView.h"
|
#include "ZoneView.h"
|
||||||
#include "TimeMessages.h"
|
#include "TimeMessages.h"
|
||||||
#include "TZDisplay.h"
|
#include "TZDisplay.h"
|
||||||
|
#include "TimeWindow.h"
|
||||||
|
|
||||||
|
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
@ -37,6 +39,7 @@
|
|||||||
#include <StorageDefs.h>
|
#include <StorageDefs.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
#include <Window.h>
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -67,6 +70,42 @@ TimeZoneView::TimeZoneView(BRect frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
TimeZoneView::CheckCanRevert()
|
||||||
|
{
|
||||||
|
return fCurrentZone != fOldZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeZoneView::_Revert()
|
||||||
|
{
|
||||||
|
BPath parent;
|
||||||
|
|
||||||
|
fCurrentZone = fOldZone;
|
||||||
|
int32 czone;
|
||||||
|
|
||||||
|
if (strcmp(fCurrentZone.Leaf(), "Greenwich") == 0) {
|
||||||
|
if (BMenuItem* item = fRegionPopUp->FindItem("Others"))
|
||||||
|
item->SetMarked(true);
|
||||||
|
czone = FillCityList("Others");
|
||||||
|
} else {
|
||||||
|
fCurrentZone.GetParent(&parent);
|
||||||
|
if (BMenuItem* item = fRegionPopUp->FindItem(parent.Leaf()))
|
||||||
|
item->SetMarked(true);
|
||||||
|
czone = FillCityList(parent.Path());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (czone > -1) {
|
||||||
|
fCityList->Select(czone);
|
||||||
|
fCityList->ScrollToSelection();
|
||||||
|
fCurrent->SetText(((TZoneItem *)fCityList->ItemAt(czone))->Text());
|
||||||
|
SetPreview();
|
||||||
|
}
|
||||||
|
SetTimeZone();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TimeZoneView::~TimeZoneView()
|
TimeZoneView::~TimeZoneView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -87,11 +126,19 @@ TimeZoneView::AttachedToWindow()
|
|||||||
|
|
||||||
// update displays
|
// update displays
|
||||||
BPath parent;
|
BPath parent;
|
||||||
fCurrentZone.GetParent(&parent);
|
if (strcmp(fCurrentZone.Leaf(), "Greenwich") != 0) {
|
||||||
int32 czone = FillCityList(parent.Path());
|
fCurrentZone.GetParent(&parent);
|
||||||
if (czone > -1) {
|
int32 czone = FillCityList(parent.Path());
|
||||||
fCityList->Select(czone);
|
if (czone > -1) {
|
||||||
fCurrent->SetText(((TZoneItem *)fCityList->ItemAt(czone))->Text());
|
fCityList->Select(czone);
|
||||||
|
fCurrent->SetText(((TZoneItem *)fCityList->ItemAt(czone))->Text());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int32 czone = FillCityList("Others");
|
||||||
|
if (czone > -1) {
|
||||||
|
fCityList->Select(czone);
|
||||||
|
fCurrent->SetText(((TZoneItem *)fCityList->ItemAt(czone))->Text());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fCityList->ScrollToSelection();
|
fCityList->ScrollToSelection();
|
||||||
@ -120,9 +167,19 @@ TimeZoneView::MessageReceived(BMessage *message)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case H_SET_TIME_ZONE:
|
case H_SET_TIME_ZONE:
|
||||||
|
{
|
||||||
SetTimeZone();
|
SetTimeZone();
|
||||||
|
BMessage msg(*message);
|
||||||
|
msg.what = kRTCUpdate;
|
||||||
|
Window()->PostMessage(&msg);
|
||||||
|
((TTimeWindow*)Window())->SetRevertStatus();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case kMsgRevert:
|
||||||
|
_Revert();
|
||||||
|
break;
|
||||||
|
|
||||||
case H_CITY_CHANGED:
|
case H_CITY_CHANGED:
|
||||||
SetPreview();
|
SetPreview();
|
||||||
break;
|
break;
|
||||||
@ -242,7 +299,7 @@ TimeZoneView::BuildRegionMenu()
|
|||||||
|
|
||||||
// skip Etc directory
|
// skip Etc directory
|
||||||
if (itemtext.Compare("Etc", 3) == 0)
|
if (itemtext.Compare("Etc", 3) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
markit = itemtext.Compare(region.Leaf()) == 0;
|
markit = itemtext.Compare(region.Leaf()) == 0;
|
||||||
|
|
||||||
@ -263,6 +320,12 @@ TimeZoneView::BuildRegionMenu()
|
|||||||
fRegionPopUp->AddItem(item);
|
fRegionPopUp->AddItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BMessage *msg = new BMessage(H_REGION_CHANGED);
|
||||||
|
msg->AddString("region", "Others");
|
||||||
|
|
||||||
|
item = new BMenuItem("Others", msg);
|
||||||
|
item->SetMarked(strcmp(fCurrentZone.Leaf(), "Greenwich") == 0);
|
||||||
|
fRegionPopUp->AddItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -277,44 +340,54 @@ TimeZoneView::FillCityList(const char *area)
|
|||||||
fCityList->MakeEmpty();
|
fCityList->MakeEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enter time zones directory. Find subdir with name that matches string
|
|
||||||
// stored in area. Enter subdirectory and count the items. For each item,
|
|
||||||
// add a StringItem to fCityList Time zones directory
|
|
||||||
|
|
||||||
BPath path;
|
|
||||||
if (find_directory(B_BEOS_ETC_DIRECTORY, &path) != B_OK)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
path.Append("timezones");
|
|
||||||
|
|
||||||
BPath Area(area);
|
|
||||||
BDirectory zoneDir(path.Path());
|
|
||||||
BDirectory cityDir;
|
|
||||||
BStringItem *city;
|
BStringItem *city;
|
||||||
BString city_name;
|
|
||||||
BEntry entry;
|
|
||||||
int32 index = -1;
|
int32 index = -1;
|
||||||
|
if (strcmp(area, "Others") != 0) {
|
||||||
//locate subdirectory:
|
|
||||||
if (zoneDir.Contains(Area.Leaf(), B_DIRECTORY_NODE)) {
|
|
||||||
cityDir.SetTo(&zoneDir, Area.Leaf());
|
|
||||||
|
|
||||||
// There is a subdir with a name that matches 'area'. That's the one!!
|
// Enter time zones directory. Find subdir with name that matches string
|
||||||
// Iterate over the items in the subdir, fill listview with TZoneItems
|
// stored in area. Enter subdirectory and count the items. For each item,
|
||||||
while(cityDir.GetNextEntry(&entry) == B_NO_ERROR) {
|
// add a StringItem to fCityList Time zones directory
|
||||||
if (!entry.IsDirectory()) {
|
|
||||||
BPath zone(&entry);
|
BPath path;
|
||||||
city_name = zone.Leaf();
|
if (find_directory(B_BEOS_ETC_DIRECTORY, &path) != B_OK)
|
||||||
city_name.ReplaceAll("_IN", ", Indiana");
|
return 0;
|
||||||
city_name.ReplaceAll("__Calif", ", Calif");
|
|
||||||
city_name.ReplaceAll("__", ", ");
|
path.Append("timezones");
|
||||||
city_name.ReplaceAll("_", " ");
|
|
||||||
city = new TZoneItem(city_name.String(), zone.Path());
|
BPath Area(area);
|
||||||
fCityList->AddItem(city);
|
BDirectory zoneDir(path.Path());
|
||||||
if (strcmp(fCurrentZone.Leaf(), zone.Leaf()) == 0)
|
BDirectory cityDir;
|
||||||
index = fCityList->IndexOf(city);
|
BString city_name;
|
||||||
|
BEntry entry;
|
||||||
|
|
||||||
|
|
||||||
|
//locate subdirectory:
|
||||||
|
if (zoneDir.Contains(Area.Leaf(), B_DIRECTORY_NODE)) {
|
||||||
|
cityDir.SetTo(&zoneDir, Area.Leaf());
|
||||||
|
|
||||||
|
// There is a subdir with a name that matches 'area'. That's the one!!
|
||||||
|
// Iterate over the items in the subdir, fill listview with TZoneItems
|
||||||
|
while(cityDir.GetNextEntry(&entry) == B_NO_ERROR) {
|
||||||
|
if (!entry.IsDirectory()) {
|
||||||
|
BPath zone(&entry);
|
||||||
|
city_name = zone.Leaf();
|
||||||
|
city_name.ReplaceAll("_IN", ", Indiana");
|
||||||
|
city_name.ReplaceAll("__Calif", ", Calif");
|
||||||
|
city_name.ReplaceAll("__", ", ");
|
||||||
|
city_name.ReplaceAll("_", " ");
|
||||||
|
city = new TZoneItem(city_name.String(), zone.Path());
|
||||||
|
fCityList->AddItem(city);
|
||||||
|
if (strcmp(fCurrentZone.Leaf(), zone.Leaf()) == 0)
|
||||||
|
index = fCityList->IndexOf(city);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
city = new TZoneItem("Greenwich", "/boot/beos/etc/timezones/Greenwich");
|
||||||
|
fCityList->AddItem(city);
|
||||||
|
if (strcmp(fCurrentZone.Leaf(), "Greenwich") == 0) {
|
||||||
|
index = fCityList->IndexOf(city);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
@ -363,13 +436,17 @@ TimeZoneView::ReadTimeZoneLink()
|
|||||||
tzLink.SetTo("/boot/beos/etc/timezones/Pacific/fiji");
|
tzLink.SetTo("/boot/beos/etc/timezones/Pacific/fiji");
|
||||||
// do something like set to a default GMT???
|
// do something like set to a default GMT???
|
||||||
}
|
}
|
||||||
|
else if (!tzLink.Exists()) { // link doesn't exists
|
||||||
|
tzLink.SetTo("/boot/beos/etc/timezones/Greenwich");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// set tzlink to a default
|
// directory doesn't exist
|
||||||
tzLink.SetTo("/boot/beos/etc/timezones/EST");
|
tzLink.SetTo("/boot/beos/etc/timezones/EST");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// we need something in the current zone
|
// we need something in the current zone
|
||||||
fCurrentZone.SetTo(&tzLink);
|
fCurrentZone.SetTo(&tzLink);
|
||||||
|
fOldZone.SetTo(&tzLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -449,7 +526,7 @@ TimeZoneView::SetTimeZone()
|
|||||||
|
|
||||||
// update environment
|
// update environment
|
||||||
SetTimeZone(target.Path());
|
SetTimeZone(target.Path());
|
||||||
|
|
||||||
// update display
|
// update display
|
||||||
time_t current = time(0);
|
time_t current = time(0);
|
||||||
struct tm *ltime = localtime(¤t);
|
struct tm *ltime = localtime(¤t);
|
||||||
|
@ -28,6 +28,7 @@ class TimeZoneView : public BView {
|
|||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
bool CheckCanRevert();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UpdateDateTime(BMessage *message);
|
void UpdateDateTime(BMessage *message);
|
||||||
@ -39,6 +40,7 @@ class TimeZoneView : public BView {
|
|||||||
void InitView();
|
void InitView();
|
||||||
void ReadTimeZoneLink();
|
void ReadTimeZoneLink();
|
||||||
void BuildRegionMenu();
|
void BuildRegionMenu();
|
||||||
|
void _Revert();
|
||||||
|
|
||||||
// returns index of current zone
|
// returns index of current zone
|
||||||
int32 FillCityList(const char *area);
|
int32 FillCityList(const char *area);
|
||||||
@ -53,6 +55,7 @@ class TimeZoneView : public BView {
|
|||||||
int32 fHour;
|
int32 fHour;
|
||||||
int32 fMinute;
|
int32 fMinute;
|
||||||
BPath fCurrentZone;
|
BPath fCurrentZone;
|
||||||
|
BPath fOldZone;
|
||||||
bool fInitialized;
|
bool fInitialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user