* Introduce a new method in BCountry to get the first day of week (monday or sunday)
* Localize date in deskbar properly, and use the new API to show the calendar. The "show european date" checkbox is now gone. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37344 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -49,6 +49,8 @@ class BCountry {
|
|||||||
const char* DateSeparator() const;
|
const char* DateSeparator() const;
|
||||||
const char* TimeSeparator() const;
|
const char* TimeSeparator() const;
|
||||||
|
|
||||||
|
int StartOfWeek();
|
||||||
|
|
||||||
// numbers
|
// numbers
|
||||||
|
|
||||||
virtual void FormatNumber(char* string, size_t maxSize, double value);
|
virtual void FormatNumber(char* string, size_t maxSize, double value);
|
||||||
|
|||||||
@@ -192,7 +192,6 @@ TBarApp::SaveSettings()
|
|||||||
fSettingsFile->Write(&fSettings.recentDocsCount, sizeof(int32));
|
fSettingsFile->Write(&fSettings.recentDocsCount, sizeof(int32));
|
||||||
fSettingsFile->Write(&fSettings.timeShowSeconds, sizeof(bool));
|
fSettingsFile->Write(&fSettings.timeShowSeconds, sizeof(bool));
|
||||||
fSettingsFile->Write(&fSettings.recentFoldersCount, sizeof(int32));
|
fSettingsFile->Write(&fSettings.recentFoldersCount, sizeof(int32));
|
||||||
fSettingsFile->Write(&fSettings.timeShowEuro, sizeof(bool));
|
|
||||||
fSettingsFile->Write(&fSettings.alwaysOnTop, sizeof(bool));
|
fSettingsFile->Write(&fSettings.alwaysOnTop, sizeof(bool));
|
||||||
fSettingsFile->Write(&fSettings.timeFullDate, sizeof(bool));
|
fSettingsFile->Write(&fSettings.timeFullDate, sizeof(bool));
|
||||||
fSettingsFile->Write(&fSettings.trackerAlwaysFirst, sizeof(bool));
|
fSettingsFile->Write(&fSettings.trackerAlwaysFirst, sizeof(bool));
|
||||||
@@ -223,7 +222,6 @@ TBarApp::InitSettings()
|
|||||||
settings.recentDocsCount = 10;
|
settings.recentDocsCount = 10;
|
||||||
settings.timeShowSeconds = false;
|
settings.timeShowSeconds = false;
|
||||||
settings.recentFoldersCount = 10;
|
settings.recentFoldersCount = 10;
|
||||||
settings.timeShowEuro = false;
|
|
||||||
settings.alwaysOnTop = false;
|
settings.alwaysOnTop = false;
|
||||||
settings.timeFullDate = false;
|
settings.timeFullDate = false;
|
||||||
settings.trackerAlwaysFirst = false;
|
settings.trackerAlwaysFirst = false;
|
||||||
@@ -278,7 +276,6 @@ TBarApp::InitSettings()
|
|||||||
fSettingsFile->Read(&settings.recentFoldersCount,
|
fSettingsFile->Read(&settings.recentFoldersCount,
|
||||||
sizeof(int32));
|
sizeof(int32));
|
||||||
if (size >= kValidSettingsSize6) {
|
if (size >= kValidSettingsSize6) {
|
||||||
fSettingsFile->Read(&settings.timeShowEuro, sizeof(bool));
|
|
||||||
fSettingsFile->Read(&settings.alwaysOnTop, sizeof(bool));
|
fSettingsFile->Read(&settings.alwaysOnTop, sizeof(bool));
|
||||||
}
|
}
|
||||||
if (size >= kValidSettingsSize7)
|
if (size >= kValidSettingsSize7)
|
||||||
|
|||||||
@@ -105,8 +105,7 @@ struct desk_settings {
|
|||||||
int32 recentDocsCount;
|
int32 recentDocsCount;
|
||||||
bool timeShowSeconds; // version 4
|
bool timeShowSeconds; // version 4
|
||||||
int32 recentFoldersCount; // version 5
|
int32 recentFoldersCount; // version 5
|
||||||
bool timeShowEuro; // version 6
|
bool alwaysOnTop; // version 6
|
||||||
bool alwaysOnTop;
|
|
||||||
bool timeFullDate; // version 7
|
bool timeFullDate; // version 7
|
||||||
bool trackerAlwaysFirst; // version 8
|
bool trackerAlwaysFirst; // version 8
|
||||||
bool sortRunningApps;
|
bool sortRunningApps;
|
||||||
@@ -127,7 +126,7 @@ const uint32 kValidSettingsSize2 = sizeof(BPoint) + kValidSettingsSize1;
|
|||||||
const uint32 kValidSettingsSize3 = 2 * sizeof(int32) + kValidSettingsSize2;
|
const uint32 kValidSettingsSize3 = 2 * sizeof(int32) + kValidSettingsSize2;
|
||||||
const uint32 kValidSettingsSize4 = sizeof(bool) + kValidSettingsSize3;
|
const uint32 kValidSettingsSize4 = sizeof(bool) + kValidSettingsSize3;
|
||||||
const uint32 kValidSettingsSize5 = sizeof(int32) + kValidSettingsSize4;
|
const uint32 kValidSettingsSize5 = sizeof(int32) + kValidSettingsSize4;
|
||||||
const uint32 kValidSettingsSize6 = 2 * sizeof(bool) + kValidSettingsSize5;
|
const uint32 kValidSettingsSize6 = sizeof(bool) + kValidSettingsSize5;
|
||||||
const uint32 kValidSettingsSize7 = sizeof(bool) + kValidSettingsSize6;
|
const uint32 kValidSettingsSize7 = sizeof(bool) + kValidSettingsSize6;
|
||||||
const uint32 kValidSettingsSize8 = 2 * sizeof(bool) + kValidSettingsSize7;
|
const uint32 kValidSettingsSize8 = 2 * sizeof(bool) + kValidSettingsSize7;
|
||||||
const uint32 kValidSettingsSize9 = 2 * sizeof(bool) + kValidSettingsSize8;
|
const uint32 kValidSettingsSize9 = 2 * sizeof(bool) + kValidSettingsSize8;
|
||||||
|
|||||||
@@ -371,7 +371,6 @@ TBeMenu::ResetTargets()
|
|||||||
case kConfigShow:
|
case kConfigShow:
|
||||||
case kAlwaysTop:
|
case kAlwaysTop:
|
||||||
case kShowSeconds:
|
case kShowSeconds:
|
||||||
case kEuroDate:
|
|
||||||
case kRebootSystem:
|
case kRebootSystem:
|
||||||
case kSuspendSystem:
|
case kSuspendSystem:
|
||||||
case kShutdownSystem:
|
case kShutdownSystem:
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
#include <GroupLayout.h>
|
#include <GroupLayout.h>
|
||||||
#include <GroupLayoutBuilder.h>
|
#include <GroupLayoutBuilder.h>
|
||||||
#include <GroupView.h>
|
#include <GroupView.h>
|
||||||
|
#include <Locale.h>
|
||||||
|
#include <LocaleRoster.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <SpaceLayoutItem.h>
|
#include <SpaceLayoutItem.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
@@ -77,7 +79,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
CalendarMenuWindow::CalendarMenuWindow(BPoint where, bool euroDate)
|
CalendarMenuWindow::CalendarMenuWindow(BPoint where)
|
||||||
:
|
:
|
||||||
BWindow(BRect(0.0, 0.0, 100.0, 130.0), "", B_BORDERED_WINDOW,
|
BWindow(BRect(0.0, 0.0, 100.0, 130.0), "", B_BORDERED_WINDOW,
|
||||||
B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS | B_CLOSE_ON_ESCAPE
|
B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS | B_CLOSE_ON_ESCAPE
|
||||||
@@ -87,6 +89,10 @@ CalendarMenuWindow::CalendarMenuWindow(BPoint where, bool euroDate)
|
|||||||
fCalendarView(NULL),
|
fCalendarView(NULL),
|
||||||
fSuppressFirstClose(true)
|
fSuppressFirstClose(true)
|
||||||
{
|
{
|
||||||
|
BCountry* here;
|
||||||
|
be_locale_roster->GetDefaultCountry(&here);
|
||||||
|
BPrivate::week_start startOfWeek = /*here->StartOfWeek()*/ B_WEEK_START_MONDAY;
|
||||||
|
|
||||||
RemoveShortcut('H', B_COMMAND_KEY | B_CONTROL_KEY);
|
RemoveShortcut('H', B_COMMAND_KEY | B_CONTROL_KEY);
|
||||||
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
||||||
|
|
||||||
@@ -97,7 +103,7 @@ CalendarMenuWindow::CalendarMenuWindow(BPoint where, bool euroDate)
|
|||||||
fMonthLabel->SetFontSize(10.0);
|
fMonthLabel->SetFontSize(10.0);
|
||||||
|
|
||||||
fCalendarView = new BCalendarView(Bounds(), "calendar",
|
fCalendarView = new BCalendarView(Bounds(), "calendar",
|
||||||
euroDate ? B_WEEK_START_MONDAY : B_WEEK_START_SUNDAY, B_FOLLOW_ALL);
|
startOfWeek, B_FOLLOW_ALL);
|
||||||
fCalendarView->SetInvocationMessage(new BMessage(kInvokationMessage));
|
fCalendarView->SetInvocationMessage(new BMessage(kInvokationMessage));
|
||||||
fCalendarView->SetFontSize(10.0);
|
fCalendarView->SetFontSize(10.0);
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ using BPrivate::BCalendarView;
|
|||||||
|
|
||||||
class CalendarMenuWindow : public BWindow {
|
class CalendarMenuWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
CalendarMenuWindow(BPoint where, bool euroDate);
|
CalendarMenuWindow(BPoint where);
|
||||||
virtual ~CalendarMenuWindow();
|
virtual ~CalendarMenuWindow();
|
||||||
|
|
||||||
virtual void Show();
|
virtual void Show();
|
||||||
|
|||||||
@@ -60,8 +60,6 @@ PreferencesWindow::PreferencesWindow(BRect frame)
|
|||||||
|
|
||||||
fClockSeconds = new BCheckBox(B_TRANSLATE("Show seconds"),
|
fClockSeconds = new BCheckBox(B_TRANSLATE("Show seconds"),
|
||||||
new BMessage(kShowSeconds));
|
new BMessage(kShowSeconds));
|
||||||
fClockEuropeanDate = new BCheckBox(B_TRANSLATE("European date"),
|
|
||||||
new BMessage(kEuroDate));
|
|
||||||
fClockFullDate = new BCheckBox(B_TRANSLATE("Full date"),
|
fClockFullDate = new BCheckBox(B_TRANSLATE("Full date"),
|
||||||
new BMessage(kFullDate));
|
new BMessage(kFullDate));
|
||||||
|
|
||||||
@@ -123,12 +121,10 @@ PreferencesWindow::PreferencesWindow(BRect frame)
|
|||||||
TReplicantTray* replicantTray = barApp->BarView()->fReplicantTray;
|
TReplicantTray* replicantTray = barApp->BarView()->fReplicantTray;
|
||||||
|
|
||||||
fClockSeconds->SetValue(replicantTray->ShowingSeconds());
|
fClockSeconds->SetValue(replicantTray->ShowingSeconds());
|
||||||
fClockEuropeanDate->SetValue(replicantTray->ShowingEuroDate());
|
|
||||||
fClockFullDate->SetValue(replicantTray->ShowingFullDate());
|
fClockFullDate->SetValue(replicantTray->ShowingFullDate());
|
||||||
|
|
||||||
bool showingClock = barApp->BarView()->ShowingClock();
|
bool showingClock = barApp->BarView()->ShowingClock();
|
||||||
fClockSeconds->SetEnabled(showingClock);
|
fClockSeconds->SetEnabled(showingClock);
|
||||||
fClockEuropeanDate->SetEnabled(showingClock);
|
|
||||||
fClockFullDate->SetEnabled(replicantTray->CanShowFullDate());
|
fClockFullDate->SetEnabled(replicantTray->CanShowFullDate());
|
||||||
|
|
||||||
fWindowAlwaysOnTop->SetValue(appSettings->alwaysOnTop);
|
fWindowAlwaysOnTop->SetValue(appSettings->alwaysOnTop);
|
||||||
@@ -142,7 +138,6 @@ PreferencesWindow::PreferencesWindow(BRect frame)
|
|||||||
fAppsExpandNew->SetTarget(be_app);
|
fAppsExpandNew->SetTarget(be_app);
|
||||||
|
|
||||||
fClockSeconds->SetTarget(replicantTray);
|
fClockSeconds->SetTarget(replicantTray);
|
||||||
fClockEuropeanDate->SetTarget(replicantTray);
|
|
||||||
fClockFullDate->SetTarget(replicantTray);
|
fClockFullDate->SetTarget(replicantTray);
|
||||||
|
|
||||||
fWindowAlwaysOnTop->SetTarget(be_app);
|
fWindowAlwaysOnTop->SetTarget(be_app);
|
||||||
@@ -199,7 +194,6 @@ PreferencesWindow::PreferencesWindow(BRect frame)
|
|||||||
view = BLayoutBuilder::Group<>()
|
view = BLayoutBuilder::Group<>()
|
||||||
.AddGroup(B_VERTICAL, 1)
|
.AddGroup(B_VERTICAL, 1)
|
||||||
.Add(fClockSeconds)
|
.Add(fClockSeconds)
|
||||||
.Add(fClockEuropeanDate)
|
|
||||||
.Add(fClockFullDate)
|
.Add(fClockFullDate)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
.SetInsets(10, 10, 10, 10)
|
.SetInsets(10, 10, 10, 10)
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ private:
|
|||||||
BCheckBox* fAppsExpandNew;
|
BCheckBox* fAppsExpandNew;
|
||||||
|
|
||||||
BCheckBox* fClockSeconds;
|
BCheckBox* fClockSeconds;
|
||||||
BCheckBox* fClockEuropeanDate;
|
|
||||||
BCheckBox* fClockFullDate;
|
BCheckBox* fClockFullDate;
|
||||||
|
|
||||||
BCheckBox* fWindowAlwaysOnTop;
|
BCheckBox* fWindowAlwaysOnTop;
|
||||||
|
|||||||
@@ -199,7 +199,6 @@ TReplicantTray::RememberClockSettings()
|
|||||||
desk_settings* settings = ((TBarApp*)be_app)->Settings();
|
desk_settings* settings = ((TBarApp*)be_app)->Settings();
|
||||||
|
|
||||||
settings->timeShowSeconds = fClock->ShowingSeconds();
|
settings->timeShowSeconds = fClock->ShowingSeconds();
|
||||||
settings->timeShowEuro = fClock->ShowingEuroDate();
|
|
||||||
settings->timeFullDate = fClock->ShowingFullDate();
|
settings->timeFullDate = fClock->ShowingFullDate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -214,15 +213,6 @@ TReplicantTray::ShowingSeconds()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
TReplicantTray::ShowingEuroDate()
|
|
||||||
{
|
|
||||||
if (fClock)
|
|
||||||
return fClock->ShowingEuroDate();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TReplicantTray::ShowingFullDate()
|
TReplicantTray::ShowingFullDate()
|
||||||
{
|
{
|
||||||
@@ -252,7 +242,7 @@ TReplicantTray::DealWithClock(bool showClock)
|
|||||||
|
|
||||||
fClock = new TTimeView(fMinimumTrayWidth, kMaxReplicantHeight - 1.0,
|
fClock = new TTimeView(fMinimumTrayWidth, kMaxReplicantHeight - 1.0,
|
||||||
settings->timeShowSeconds, settings->timeFullDate,
|
settings->timeShowSeconds, settings->timeFullDate,
|
||||||
settings->timeShowEuro, false);
|
false);
|
||||||
AddChild(fClock);
|
AddChild(fClock);
|
||||||
|
|
||||||
fClock->MoveTo(Bounds().right - fClock->Bounds().Width() - 1, 2);
|
fClock->MoveTo(Bounds().right - fClock->Bounds().Width() - 1, 2);
|
||||||
@@ -375,7 +365,6 @@ TReplicantTray::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kShowSeconds:
|
case kShowSeconds:
|
||||||
case kEuroDate:
|
|
||||||
case kFullDate:
|
case kFullDate:
|
||||||
if (fClock != NULL)
|
if (fClock != NULL)
|
||||||
Window()->PostMessage(message, fClock);
|
Window()->PostMessage(message, fClock);
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ public:
|
|||||||
|
|
||||||
bool ShowingSeconds(void);
|
bool ShowingSeconds(void);
|
||||||
bool ShowingMiltime(void);
|
bool ShowingMiltime(void);
|
||||||
bool ShowingEuroDate(void);
|
|
||||||
bool ShowingFullDate(void);
|
bool ShowingFullDate(void);
|
||||||
bool CanShowFullDate(void);
|
bool CanShowFullDate(void);
|
||||||
|
|
||||||
|
|||||||
@@ -52,11 +52,6 @@ All rights reserved.
|
|||||||
#include "CalendarMenuWindow.h"
|
#include "CalendarMenuWindow.h"
|
||||||
|
|
||||||
|
|
||||||
const char* kShortDateFormat = "%m/%d/%y";
|
|
||||||
const char* kShortEuroDateFormat = "%d/%m/%y";
|
|
||||||
const char* kLongDateFormat = "%a, %B %d, %Y";
|
|
||||||
const char* kLongEuroDateFormat = "%a, %d %B, %Y";
|
|
||||||
|
|
||||||
static const char* const kMinString = "99:99 AM";
|
static const char* const kMinString = "99:99 AM";
|
||||||
static const float kHMargin = 2.0;
|
static const float kHMargin = 2.0;
|
||||||
|
|
||||||
@@ -74,7 +69,7 @@ enum {
|
|||||||
#define B_TRANSLATE_CONTEXT "TimeView"
|
#define B_TRANSLATE_CONTEXT "TimeView"
|
||||||
|
|
||||||
TTimeView::TTimeView(float maxWidth, float height, bool showSeconds,
|
TTimeView::TTimeView(float maxWidth, float height, bool showSeconds,
|
||||||
bool fullDate, bool euroDate, bool)
|
bool fullDate, bool)
|
||||||
:
|
:
|
||||||
BView(BRect(-100,-100,-90,-90), "_deskbar_tv_",
|
BView(BRect(-100,-100,-90,-90), "_deskbar_tv_",
|
||||||
B_FOLLOW_RIGHT | B_FOLLOW_TOP,
|
B_FOLLOW_RIGHT | B_FOLLOW_TOP,
|
||||||
@@ -84,7 +79,6 @@ TTimeView::TTimeView(float maxWidth, float height, bool showSeconds,
|
|||||||
fShowSeconds(showSeconds),
|
fShowSeconds(showSeconds),
|
||||||
fFullDate(fullDate),
|
fFullDate(fullDate),
|
||||||
fCanShowFullDate(false),
|
fCanShowFullDate(false),
|
||||||
fEuroDate(euroDate),
|
|
||||||
fMaxWidth(maxWidth),
|
fMaxWidth(maxWidth),
|
||||||
fHeight(height),
|
fHeight(height),
|
||||||
fOrientation(true),
|
fOrientation(true),
|
||||||
@@ -108,7 +102,6 @@ TTimeView::TTimeView(BMessage* data)
|
|||||||
fTime = fLastTime = time(NULL);
|
fTime = fLastTime = time(NULL);
|
||||||
data->FindBool("seconds", &fShowSeconds);
|
data->FindBool("seconds", &fShowSeconds);
|
||||||
data->FindBool("fulldate", &fFullDate);
|
data->FindBool("fulldate", &fFullDate);
|
||||||
data->FindBool("eurodate", &fEuroDate);
|
|
||||||
data->FindBool("interval", &fInterval);
|
data->FindBool("interval", &fInterval);
|
||||||
fShowingDate = false;
|
fShowingDate = false;
|
||||||
|
|
||||||
@@ -140,7 +133,6 @@ TTimeView::Archive(BMessage* data, bool deep) const
|
|||||||
BView::Archive(data, deep);
|
BView::Archive(data, deep);
|
||||||
data->AddBool("seconds", fShowSeconds);
|
data->AddBool("seconds", fShowSeconds);
|
||||||
data->AddBool("fulldate", fFullDate);
|
data->AddBool("fulldate", fFullDate);
|
||||||
data->AddBool("eurodate", fEuroDate);
|
|
||||||
data->AddBool("interval", fInterval);
|
data->AddBool("interval", fInterval);
|
||||||
data->AddInt32("deskbar:private_align", B_ALIGN_RIGHT);
|
data->AddInt32("deskbar:private_align", B_ALIGN_RIGHT);
|
||||||
|
|
||||||
@@ -223,10 +215,6 @@ TTimeView::MessageReceived(BMessage* message)
|
|||||||
ShowSeconds(!ShowingSeconds());
|
ShowSeconds(!ShowingSeconds());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEuroDate:
|
|
||||||
ShowEuroDate(!ShowingEuroDate());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kChangeClock:
|
case kChangeClock:
|
||||||
// launch the time prefs app
|
// launch the time prefs app
|
||||||
be_roster->Launch("application/x-vnd.Haiku-Time");
|
be_roster->Launch("application/x-vnd.Haiku-Time");
|
||||||
@@ -279,7 +267,7 @@ TTimeView::ShowCalendar(BPoint where)
|
|||||||
if (where.y >= BScreen().Frame().bottom)
|
if (where.y >= BScreen().Frame().bottom)
|
||||||
where.y -= (Bounds().Height() + 4.0);
|
where.y -= (Bounds().Height() + 4.0);
|
||||||
|
|
||||||
CalendarMenuWindow* window = new CalendarMenuWindow(where, fEuroDate);
|
CalendarMenuWindow* window = new CalendarMenuWindow(where);
|
||||||
fCalendarWindow = BMessenger(window);
|
fCalendarWindow = BMessenger(window);
|
||||||
|
|
||||||
window->Show();
|
window->Show();
|
||||||
@@ -329,14 +317,8 @@ void
|
|||||||
TTimeView::GetCurrentDate()
|
TTimeView::GetCurrentDate()
|
||||||
{
|
{
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
tm time = *localtime(&fTime);
|
|
||||||
|
|
||||||
if (fFullDate && CanShowFullDate())
|
fHere->FormatDate(tmp, 64, fTime, fFullDate && CanShowFullDate());
|
||||||
strftime(tmp, 64, fEuroDate ? kLongEuroDateFormat : kLongDateFormat,
|
|
||||||
&time);
|
|
||||||
else
|
|
||||||
strftime(tmp, 64, fEuroDate ? kShortEuroDateFormat : kShortDateFormat,
|
|
||||||
&time);
|
|
||||||
|
|
||||||
// remove leading 0 from date when month is less than 10 (MM/DD/YY)
|
// remove leading 0 from date when month is less than 10 (MM/DD/YY)
|
||||||
// or remove leading 0 from date when day is less than 10 (DD/MM/YY)
|
// or remove leading 0 from date when day is less than 10 (DD/MM/YY)
|
||||||
@@ -466,14 +448,6 @@ TTimeView::ShowFullDate(bool on)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
TTimeView::ShowEuroDate(bool on)
|
|
||||||
{
|
|
||||||
fEuroDate = on;
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TTimeView::AllowFullDate(bool allow)
|
TTimeView::AllowFullDate(bool allow)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ All rights reserved.
|
|||||||
|
|
||||||
const uint32 kShowSeconds = 'ShSc';
|
const uint32 kShowSeconds = 'ShSc';
|
||||||
const uint32 kFullDate = 'FDat';
|
const uint32 kFullDate = 'FDat';
|
||||||
const uint32 kEuroDate = 'EDat';
|
|
||||||
|
|
||||||
class BCountry;
|
class BCountry;
|
||||||
class BMessageRunner;
|
class BMessageRunner;
|
||||||
@@ -55,8 +54,7 @@ class _EXPORT TTimeView;
|
|||||||
class TTimeView : public BView {
|
class TTimeView : public BView {
|
||||||
public:
|
public:
|
||||||
TTimeView(float maxWidth, float height, bool showSeconds = false,
|
TTimeView(float maxWidth, float height, bool showSeconds = false,
|
||||||
bool fullDate = false, bool euroDate = false,
|
bool fullDate = false, bool showInterval = false);
|
||||||
bool showInterval = false);
|
|
||||||
TTimeView(BMessage* data);
|
TTimeView(BMessage* data);
|
||||||
~TTimeView();
|
~TTimeView();
|
||||||
|
|
||||||
@@ -83,8 +81,6 @@ class TTimeView : public BView {
|
|||||||
void ShowFullDate(bool);
|
void ShowFullDate(bool);
|
||||||
bool CanShowFullDate() const { return fCanShowFullDate; }
|
bool CanShowFullDate() const { return fCanShowFullDate; }
|
||||||
void AllowFullDate(bool);
|
void AllowFullDate(bool);
|
||||||
bool ShowingEuroDate() {return fEuroDate; }
|
|
||||||
void ShowEuroDate(bool);
|
|
||||||
void ShowCalendar(BPoint where);
|
void ShowCalendar(BPoint where);
|
||||||
void StartLongClickNotifier(BPoint where);
|
void StartLongClickNotifier(BPoint where);
|
||||||
void StopLongClickNotifier();
|
void StopLongClickNotifier();
|
||||||
@@ -122,7 +118,6 @@ class TTimeView : public BView {
|
|||||||
bool fShowingDate;
|
bool fShowingDate;
|
||||||
bool fFullDate;
|
bool fFullDate;
|
||||||
bool fCanShowFullDate;
|
bool fCanShowFullDate;
|
||||||
bool fEuroDate;
|
|
||||||
|
|
||||||
float fMaxWidth;
|
float fMaxWidth;
|
||||||
float fHeight;
|
float fHeight;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <CalendarView.h>
|
||||||
#include <IconUtils.h>
|
#include <IconUtils.h>
|
||||||
#include <Resources.h>
|
#include <Resources.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
@@ -24,6 +25,10 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
|
||||||
|
using BPrivate::B_WEEK_START_MONDAY;
|
||||||
|
using BPrivate::B_WEEK_START_SUNDAY;
|
||||||
|
|
||||||
|
|
||||||
const char* gStrings[] = {
|
const char* gStrings[] = {
|
||||||
// date/time format
|
// date/time format
|
||||||
"",
|
"",
|
||||||
@@ -231,6 +236,23 @@ BCountry::TimeFormat(BString& format, bool longFormat) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
BCountry::StartOfWeek()
|
||||||
|
{
|
||||||
|
UErrorCode err = U_ZERO_ERROR;
|
||||||
|
Calendar* c = Calendar::createInstance(*fICULocale, err);
|
||||||
|
|
||||||
|
if (err == U_ZERO_ERROR && c->getFirstDayOfWeek(err) == UCAL_SUNDAY) {
|
||||||
|
delete c;
|
||||||
|
return B_WEEK_START_SUNDAY;
|
||||||
|
} else {
|
||||||
|
delete c;
|
||||||
|
// Might be another day, but BeAPI will not handle it
|
||||||
|
return B_WEEK_START_MONDAY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO find how to get it from ICU (setting it is ok, we use the pattern-string
|
// TODO find how to get it from ICU (setting it is ok, we use the pattern-string
|
||||||
// for that)
|
// for that)
|
||||||
// Or remove this function ?
|
// Or remove this function ?
|
||||||
|
|||||||
Reference in New Issue
Block a user