[haiku-commits] haiku: hrev51428 - src/preferences/time headers/os/locale src/kits/locale

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 16 Sep 2017 17:45:46 +0200 (CEST)

hrev51428 adds 2 changesets to branch 'master'
old head: 958b7451beff12bc99c14fc31db4641df8914084
new head: 9dc787581801463ab7b9603447216e8328626d42
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=9dc787581801+%5E958b7451beff

----------------------------------------------------------------------------

42745b94f8e9: BDateFormat: Properly map day values to ICU day-of-week.
  
  Signed-off-by: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>

9dc787581801: Time Preferences: Update CalendarView day name header on locale 
preferences change.
  
  Signed-off-by: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>

                       [ Akshay Agarwal <agarwal.akshay.akshay8@xxxxxxxxx> ]

----------------------------------------------------------------------------

5 files changed, 25 insertions(+), 1 deletion(-)
headers/os/locale/DateFormat.h        | 9 +++++++++
src/kits/locale/DateFormat.cpp        | 2 +-
src/preferences/time/DateTimeView.cpp | 5 +++++
src/preferences/time/Time.cpp         | 2 ++
src/preferences/time/TimeWindow.cpp   | 8 ++++++++

############################################################################

Commit:      42745b94f8e9d74d585f0b1cd600085ed9776ef8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=42745b94f8e9
Author:      Akshay Agarwal <agarwal.akshay.akshay8@xxxxxxxxx>
Date:        Mon Sep  4 07:24:28 2017 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Commit-Date: Sat Sep 16 15:42:54 2017 UTC

BDateFormat: Properly map day values to ICU day-of-week.

Signed-off-by: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>

----------------------------------------------------------------------------

diff --git a/headers/os/locale/DateFormat.h b/headers/os/locale/DateFormat.h
index 2f9aad0..cee04e5 100644
--- a/headers/os/locale/DateFormat.h
+++ b/headers/os/locale/DateFormat.h
@@ -84,10 +84,19 @@ public:
                                                                        BDate& 
output);
 
 private:
+                       int                                     
_ConvertDayNumberToICU(int day) const;
+
                        U_ICU_NAMESPACE::DateFormat*    _CreateDateFormatter(
                                                                        const 
BDateFormatStyle style) const;
 
 };
 
 
+inline int
+BDateFormat::_ConvertDayNumberToICU(int day) const
+{
+       return day == 7 ? 1 : day + 1;
+}
+
+
 #endif // _B_DATE_FORMAT_H_
diff --git a/src/kits/locale/DateFormat.cpp b/src/kits/locale/DateFormat.cpp
index 09fe428..b70d601 100644
--- a/src/kits/locale/DateFormat.cpp
+++ b/src/kits/locale/DateFormat.cpp
@@ -366,7 +366,7 @@ BDateFormat::GetDayName(int day, BString& outName,
        }
 
        BStringByteSink stringConverter(&outName);
-       names[day].toUTF8(stringConverter);
+       names[_ConvertDayNumberToICU(day)].toUTF8(stringConverter);
 
        delete simpleFormat;
        return B_OK;

############################################################################

Revision:    hrev51428
Commit:      9dc787581801463ab7b9603447216e8328626d42
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9dc787581801
Author:      Akshay Agarwal <agarwal.akshay.akshay8@xxxxxxxxx>
Date:        Fri Sep  1 15:21:02 2017 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Commit-Date: Sat Sep 16 15:45:24 2017 UTC

Time Preferences: Update CalendarView day name header on locale preferences 
change.

Signed-off-by: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>

----------------------------------------------------------------------------

diff --git a/src/preferences/time/DateTimeView.cpp 
b/src/preferences/time/DateTimeView.cpp
index abc7557..9f19b75 100644
--- a/src/preferences/time/DateTimeView.cpp
+++ b/src/preferences/time/DateTimeView.cpp
@@ -24,6 +24,7 @@
 #include <Entry.h>
 #include <File.h>
 #include <FindDirectory.h>
+#include <LocaleRoster.h>
 #include <Message.h>
 #include <Path.h>
 #include <StringView.h>
@@ -93,6 +94,10 @@ DateTimeView::MessageReceived(BMessage* message)
                        }
                        break;
 
+               case B_LOCALE_CHANGED:
+                       fCalendarView->UpdateDayNameHeader();
+                       break;
+
                case kDayChanged:
                {
                        BMessage msg(*message);
diff --git a/src/preferences/time/Time.cpp b/src/preferences/time/Time.cpp
index 21a65ea..ff32eee 100644
--- a/src/preferences/time/Time.cpp
+++ b/src/preferences/time/Time.cpp
@@ -18,6 +18,7 @@
 
 #include <Alert.h>
 #include <Catalog.h>
+#include <LocaleRoster.h>
 
 #include "NetworkTimeView.h"
 #include "TimeMessages.h"
@@ -71,6 +72,7 @@ TimeApplication::MessageReceived(BMessage* message)
        switch (message->what) {
                case kSelectClockTab:
                case kShowHideTime:
+               case B_LOCALE_CHANGED:
                        fWindow->PostMessage(message);
                        break;
 
diff --git a/src/preferences/time/TimeWindow.cpp 
b/src/preferences/time/TimeWindow.cpp
index c248628..da5c718 100644
--- a/src/preferences/time/TimeWindow.cpp
+++ b/src/preferences/time/TimeWindow.cpp
@@ -14,6 +14,7 @@
 #include <Button.h>
 #include <Catalog.h>
 #include <LayoutBuilder.h>
+#include <LocaleRoster.h>
 #include <Message.h>
 #include <Screen.h>
 #include <SeparatorView.h>
@@ -77,6 +78,13 @@ TTimeWindow::MessageReceived(BMessage* message)
                        be_app->PostMessage(B_ABOUT_REQUESTED);
                        break;
 
+               case B_LOCALE_CHANGED:
+               {
+                       BLocaleRoster::Default()->Refresh();
+                       fDateTimeView->MessageReceived(message);
+                       break;
+               }
+
                case kMsgRevert:
                        fDateTimeView->MessageReceived(message);
                        fTimeZoneView->MessageReceived(message);


Other related posts:

  • » [haiku-commits] haiku: hrev51428 - src/preferences/time headers/os/locale src/kits/locale - pulkomandy