Index: src/preferences/time/Time.cpp
===================================================================
--- src/preferences/time/Time.cpp	(révision 25314)
+++ src/preferences/time/Time.cpp	(copie de travail)
@@ -46,7 +46,7 @@
 {
 	BAlert *alert = new BAlert("about", 
 		"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();
 }
 
Index: src/preferences/time/ZoneView.cpp
===================================================================
--- src/preferences/time/ZoneView.cpp	(révision 25314)
+++ src/preferences/time/ZoneView.cpp	(copie de travail)
@@ -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.
  *
  * Authors:
  *		Mike Berg <mike@berg-net.us>
  *		Julun <host.haiku@gmx.de>
+ *		Philippe Saint-Pierre <stpere@gmail.com>
  */
 
 /*
@@ -21,6 +22,7 @@
 #include "ZoneView.h"
 #include "TimeMessages.h"
 #include "TZDisplay.h"
+#include "TimeWindow.h"
 
 
 #include <Button.h>
@@ -37,6 +39,7 @@
 #include <StorageDefs.h>
 #include <String.h>
 #include <View.h>
+#include <Window.h>
 
 
 #include <stdio.h>
@@ -67,6 +70,40 @@
 }
 
 
+bool
+TimeZoneView::CheckCanRevert()
+{
+	return fCurrentZone != fOldZone;
+}
+
+
+void
+TimeZoneView::_Revert()
+{
+	BPath parent;
+
+	fCurrentZone = fOldZone;
+	int32 czone;
+
+	if (strcmp(fCurrentZone.Leaf(), "Greenwich") == 0) {
+		fRegionPopUp->FindItem("Others")->SetMarked(true);
+		czone = FillCityList("Others");
+	} else {
+		fCurrentZone.GetParent(&parent);
+		fRegionPopUp->FindItem(parent.Leaf())->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()
 {
 }
@@ -87,11 +124,19 @@
 
 		// update displays	
 		BPath parent;
-		fCurrentZone.GetParent(&parent);
-		int32 czone = FillCityList(parent.Path());
-		if (czone > -1) {
-			fCityList->Select(czone);
-			fCurrent->SetText(((TZoneItem *)fCityList->ItemAt(czone))->Text());
+		if (strcmp(fCurrentZone.Leaf(), "Greenwich") != 0) {
+			fCurrentZone.GetParent(&parent);
+			int32 czone = FillCityList(parent.Path());
+			if (czone > -1) {
+				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();
@@ -120,9 +165,19 @@
 			break;
 		
 		case H_SET_TIME_ZONE:
+		{
 			SetTimeZone();
+			BMessage msg(*message);
+			msg.what = kRTCUpdate;
+			Window()->PostMessage(&msg);
+			((TTimeWindow*)Window())->SetRevertStatus();
 			break;
-		
+		}
+
+		case kMsgRevert:
+			_Revert();
+			break;
+
 		case H_CITY_CHANGED:
 			SetPreview();
 			break;	
@@ -242,7 +297,7 @@
 			
 			// skip Etc directory
 			if (itemtext.Compare("Etc", 3) == 0)
-			 	continue;
+				continue;
 			 
 			markit = itemtext.Compare(region.Leaf()) == 0;
 			
@@ -263,6 +318,12 @@
 			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 +338,54 @@
 		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 
+ 	BStringItem *city;
+	int32 index = -1; 
+	if (strcmp(area, "Others") != 0) {
 
-	BPath path;
-	if (find_directory(B_BEOS_ETC_DIRECTORY, &path) != B_OK)
-		return 0;
+		// 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 
 
-	path.Append("timezones");
+		BPath path;
+		if (find_directory(B_BEOS_ETC_DIRECTORY, &path) != B_OK)
+			return 0;
 
-	BPath Area(area);
- 	BDirectory zoneDir(path.Path()); 
- 	BDirectory cityDir;
- 	BStringItem *city;
- 	BString city_name;
- 	BEntry entry;
-	int32 index = -1; 
+		path.Append("timezones");
+
+		BPath Area(area);
+	 	BDirectory zoneDir(path.Path()); 
+	 	BDirectory cityDir;
+	 	BString city_name;
+	 	BEntry entry;
+
 	
-	//locate subdirectory:
-	if (zoneDir.Contains(Area.Leaf(), B_DIRECTORY_NODE)) {
-		cityDir.SetTo(&zoneDir, Area.Leaf());  
+		//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);
+			// 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;
 }
@@ -363,13 +434,17 @@
 			tzLink.SetTo("/boot/beos/etc/timezones/Pacific/fiji");
 			// do something like set to a default GMT???
 		}
+		else if (!tzLink.Exists()) { // link doesn't exists
+			tzLink.SetTo("/boot/beos/etc/timezones/Greenwich");
+		}
  	} else {
- 		// set tzlink to a default
+ 		// directory doesn't exist
  		tzLink.SetTo("/boot/beos/etc/timezones/EST");
  	}
 #endif
 	// we need something in the current zone
 	fCurrentZone.SetTo(&tzLink);
+	fOldZone.SetTo(&tzLink);
 }
 
 
@@ -449,7 +524,7 @@
 
 	// update environment
 	SetTimeZone(target.Path());
-
+	
 	// update display
 	time_t current = time(0);
 	struct tm *ltime = localtime(&current);
Index: src/preferences/time/ZoneView.h
===================================================================
--- src/preferences/time/ZoneView.h	(révision 25314)
+++ src/preferences/time/ZoneView.h	(copie de travail)
@@ -28,6 +28,7 @@
 		
 		virtual void 	AttachedToWindow();
 		virtual void 	MessageReceived(BMessage *message);
+		bool			CheckCanRevert();
 
 	private:
 		void 			UpdateDateTime(BMessage *message);
@@ -39,6 +40,7 @@
 		void 			InitView();
 		void 			ReadTimeZoneLink();
 		void 			BuildRegionMenu();
+		void			_Revert();
 
 		// returns index of current zone
 		int32 			FillCityList(const char *area);
@@ -53,6 +55,7 @@
 		int32 			fHour;
 		int32 			fMinute;
 		BPath 			fCurrentZone;
+		BPath				fOldZone;
 		bool 			fInitialized;
 };
 
Index: src/preferences/time/TimeWindow.cpp
===================================================================
--- src/preferences/time/TimeWindow.cpp	(révision 25314)
+++ src/preferences/time/TimeWindow.cpp	(copie de travail)
@@ -20,6 +20,7 @@
 #include <Message.h>
 #include <Screen.h>
 #include <TabView.h>
+#include <Button.h>
 
 
 TTimeWindow::TTimeWindow(BRect rect)
@@ -37,19 +38,38 @@
 }
 
 
+void
+TTimeWindow::SetRevertStatus()
+{
+	fRevertButton->SetEnabled(fDateTimeView->CheckCanRevert() 
+										|| fTimeZoneView->CheckCanRevert());
+}
+
+
 void 
 TTimeWindow::MessageReceived(BMessage *message)
 {
 	switch(message->what) {
 		case H_USER_CHANGE:
 			fBaseView->ChangeTime(message);
-			fDateTimeView->CheckCanRevert();
+			SetRevertStatus();
 			break;
 		
 		case B_ABOUT_REQUESTED:
 			be_app->PostMessage(B_ABOUT_REQUESTED);
 			break;
 
+		case kMsgRevert:
+			fDateTimeView->MessageReceived(message);
+			fTimeZoneView->MessageReceived(message);
+			fRevertButton->SetEnabled(false);
+			break;
+
+		case kRTCUpdate:
+			fDateTimeView->MessageReceived(message);
+			SetRevertStatus();
+			break;
+
 		default:
 			BWindow::MessageReceived(message);
 			break;
@@ -101,8 +121,24 @@
 
 	fBaseView->AddChild(tabView);
 	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, 
-		tabView->Bounds().Height() + 10.0);
+		tabView->Bounds().Height() + buttonHeight + 30.0);
 
 	ResizeTo(fBaseView->Bounds().Width(), fBaseView->Bounds().Height());
 }
Index: src/preferences/time/DateTimeView.cpp
===================================================================
--- src/preferences/time/DateTimeView.cpp	(révision 25314)
+++ src/preferences/time/DateTimeView.cpp	(copie de travail)
@@ -15,9 +15,9 @@
 #include "DateTimeEdit.h"
 #include "TimeMessages.h"
 #include "DateTime.h"
+#include "TimeWindow.h"
 
 
-#include <Button.h>
 #include <CheckBox.h>
 #include <Entry.h>
 #include <File.h>
@@ -69,10 +69,7 @@
 	if (!fInitialized) {
 		fInitialized = true;
 
-		fGmtTime->SetTarget(this);
-		fLocalTime->SetTarget(this);
 		fCalendarView->SetTarget(this);
-		fRevertButton->SetTarget(this);
 	}
 }
 
@@ -131,12 +128,10 @@
 		case kRTCUpdate:
 			fUseGmtTime = fGmtTime->Value() == B_CONTROL_ON;
 			_UpdateGmtSettings();
-			CheckCanRevert();
 			break;
 
 		case kMsgRevert:
 			_Revert();
-			fRevertButton->SetEnabled(false);
 			break;
 	
 		default:
@@ -146,7 +141,7 @@
 }
 
 
-void
+bool
 DateTimeView::CheckCanRevert()
 {
 	// check GMT vs Local setting
@@ -157,9 +152,7 @@
 	time_t changedNow;
 	time(&changedNow);
 
-	enable = enable || (changedNow != unchangedNow);
-
-	fRevertButton->SetEnabled(enable);
+	return enable || (changedNow != unchangedNow);
 }
 
 
@@ -266,20 +259,6 @@
 
 	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);
 }
 
Index: src/preferences/time/TimeWindow.h
===================================================================
--- src/preferences/time/TimeWindow.h	(révision 25314)
+++ src/preferences/time/TimeWindow.h	(copie de travail)
@@ -27,6 +27,7 @@
 
 		virtual bool	QuitRequested();
 		virtual void	MessageReceived(BMessage *message);
+		void				SetRevertStatus();
 
 	private:
 		void 			_InitWindow();
@@ -36,6 +37,7 @@
 		TTimeBaseView 	*fBaseView;
 		DateTimeView 	*fDateTimeView;
 		TimeZoneView 	*fTimeZoneView;
+		BButton			*fRevertButton;
 };
 
 #endif	// TIME_WINDOW_H
Index: src/preferences/time/DateTimeView.h
===================================================================
--- src/preferences/time/DateTimeView.h	(révision 25314)
+++ src/preferences/time/DateTimeView.h	(copie de travail)
@@ -20,7 +20,6 @@
 class BCalendarView;
 class BRadioButton;
 class TAnalogClock;
-class BButton;
 
 
 class DateTimeView : public BView {
@@ -32,7 +31,8 @@
 		virtual void 	Draw(BRect updaterect);
 		virtual void 	MessageReceived(BMessage *message);
 
-				void	CheckCanRevert();
+		bool			CheckCanRevert();
+		bool			GetUseGmtTime();
 
 	private:
 		void 			_InitView();
@@ -51,9 +51,7 @@
 		BCalendarView 	*fCalendarView;
 		TAnalogClock 	*fClock;
 
-		BButton			*fRevertButton;
-
-		bool 			fUseGmtTime;
+		bool			fUseGmtTime;
 		bool			fOldUseGmtTime;
 		bool			fInitialized;
 
