Commit 1d130b3e authored by Anatoly Mihalchenko's avatar Anatoly Mihalchenko

SANKORE-896

Impossible to write an ê and an ë using the keyboard
parent 42d1fcb6
...@@ -107,12 +107,12 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec ...@@ -107,12 +107,12 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec
, mFrame(0) , mFrame(0)
, mFrameWidth(UBSettings::settings()->objectFrameWidth) , mFrameWidth(UBSettings::settings()->objectFrameWidth)
, mAntiScaleRatio(1.0) , mAntiScaleRatio(1.0)
, mToolBarItem(NULL)
, mCanRotate(canRotate) , mCanRotate(canRotate)
, mCanDuplicate(true) , mCanDuplicate(true)
, mRespectRatio(respectRatio) , mRespectRatio(respectRatio)
, mMimeData(NULL) , mMimeData(NULL)
, mFlippable(false) , mFlippable(false)
, mToolBarItem(NULL)
, mToolBarUsed(useToolBar) , mToolBarUsed(useToolBar)
{ {
// NOOP // NOOP
...@@ -1075,11 +1075,11 @@ void MediaTimer::display(const QString &s) ...@@ -1075,11 +1075,11 @@ void MediaTimer::display(const QString &s)
void MediaTimer::setNumDigits(int numDigits) void MediaTimer::setNumDigits(int numDigits)
{ {
if (numDigits > 99) { if (numDigits > 99) {
qWarning("QLCDNumber::setNumDigits: (%s) Max 99 digits allowed"); qWarning("QLCDNumber::setNumDigits: Max 99 digits allowed");
numDigits = 99; numDigits = 99;
} }
if (numDigits < 0) { if (numDigits < 0) {
qWarning("QLCDNumber::setNumDigits: (%s) Min 0 digits allowed"); qWarning("QLCDNumber::setNumDigits: Min 0 digits allowed");
numDigits = 0; numDigits = 0;
} }
if (digitStr.isNull()) { // from constructor if (digitStr.isNull()) { // from constructor
......
...@@ -243,6 +243,8 @@ void UBKeyboardPalette::adjustSizeAndPosition(bool pUp) ...@@ -243,6 +243,8 @@ void UBKeyboardPalette::adjustSizeAndPosition(bool pUp)
void UBKeyboardPalette::paintEvent( QPaintEvent* event) void UBKeyboardPalette::paintEvent( QPaintEvent* event)
{ {
checkLayout();
UBActionPalette::paintEvent(event); UBActionPalette::paintEvent(event);
QRect r = this->geometry(); QRect r = this->geometry();
......
...@@ -127,6 +127,7 @@ protected: ...@@ -127,6 +127,7 @@ protected:
void init(); void init();
private: private:
QRect originalRect; QRect originalRect;
...@@ -134,6 +135,11 @@ private: ...@@ -134,6 +135,11 @@ private:
UBKeyButton** buttons; UBKeyButton** buttons;
UBKeyboardButton** ctrlButtons; UBKeyboardButton** ctrlButtons;
/*
For MacOS: synchronization with system locale.
*/
void checkLayout();
void createCtrlButtons(); void createCtrlButtons();
void setInput(const UBKeyboardLocale* locale); void setInput(const UBKeyboardLocale* locale);
...@@ -145,10 +151,6 @@ private: ...@@ -145,10 +151,6 @@ private:
void* storage; void* storage;
// Linux-related parameters // Linux-related parameters
int min_keycodes, max_keycodes, byte_per_code; int min_keycodes, max_keycodes, byte_per_code;
// Save locale before activation to restore it after (MAC)
QString activeLocale;
}; };
class UBKeyboardButton : public QWidget class UBKeyboardButton : public QWidget
......
...@@ -164,6 +164,9 @@ void UBKeyboardPalette::createCtrlButtons() ...@@ -164,6 +164,9 @@ void UBKeyboardPalette::createCtrlButtons()
} }
void UBKeyboardPalette::checkLayout()
{}
void UBKeyboardPalette::onActivated(bool activated) void UBKeyboardPalette::onActivated(bool activated)
{ {
if (activated) if (activated)
......
...@@ -74,32 +74,35 @@ void SetMacLocaleByIdentifier(const QString& id) ...@@ -74,32 +74,35 @@ void SetMacLocaleByIdentifier(const QString& id)
} }
} }
void UBKeyboardPalette::onActivated(bool activated)
void UBKeyboardPalette::checkLayout()
{ {
if (activated) TISInputSourceRef selectedLocale = TISCopyCurrentKeyboardInputSource();
{
TISInputSourceRef selectedLocale = TISCopyCurrentKeyboardInputSource();
CFStringRef sr = (CFStringRef) TISGetInputSourceProperty(selectedLocale,
kTISPropertyInputSourceID);
if (sr!=NULL)
{
char tmp[1024];
CFStringGetCString(sr, tmp, 1024, 0);
activeLocale = tmp;
}
else
activeLocale = "";
onLocaleChanged(locales[nCurrentLocale]); CFStringRef sr = (CFStringRef) TISGetInputSourceProperty(selectedLocale,
} kTISPropertyInputSourceID);
else
{ if (sr!=NULL)
if (activeLocale != "") {
SetMacLocaleByIdentifier(activeLocale); char clId[1024];
} CFStringGetCString(sr, clId, 1024, 0);
for(int i=0; i<nLocalesCount;i++)
{
if (locales[i]->id == clId)
{
if (nCurrentLocale!=i)
{
setLocale(i);
}
break;
}
}
}
}
void UBKeyboardPalette::onActivated(bool)
{
} }
void UBKeyboardPalette::onLocaleChanged(UBKeyboardLocale* locale) void UBKeyboardPalette::onLocaleChanged(UBKeyboardLocale* locale)
......
...@@ -64,9 +64,12 @@ void UBKeyboardPalette::createCtrlButtons() ...@@ -64,9 +64,12 @@ void UBKeyboardPalette::createCtrlButtons()
ctrlButtons[ctrlID++] = new UBLocaleButton(this); // Language Switch ctrlButtons[ctrlID++] = new UBLocaleButton(this); // Language Switch
} }
void UBKeyboardPalette::checkLayout()
{}
void UBKeyboardPalette::onActivated(bool) void UBKeyboardPalette::onActivated(bool)
{ {}
}
void UBKeyboardPalette::onLocaleChanged(UBKeyboardLocale* ) void UBKeyboardPalette::onLocaleChanged(UBKeyboardLocale* )
{} {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment