diff --git a/debian/changelog b/debian/changelog index 9ea11f0d..c9de11b5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ system-ui (1.2.14~1) unstable; urgency=low * [UNRELEASED] + * Fixes: NB#287151 - §qtn_noti_and_more§ is not retranslated when the language is changed on first boot -- Vesa Halttunen Tue, 25 Oct 2011 15:23:36 +0300 diff --git a/src/systemui/screenlock/screenlockwindow.cpp b/src/systemui/screenlock/screenlockwindow.cpp index f804191f..f7843e25 100644 --- a/src/systemui/screenlock/screenlockwindow.cpp +++ b/src/systemui/screenlock/screenlockwindow.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "x11wrapper.h" ScreenLockWindow::ScreenLockWindow(MApplicationExtensionArea *extensionArea, QWidget *parent) : @@ -44,6 +45,11 @@ ScreenLockWindow::ScreenLockWindow(MApplicationExtensionArea *extensionArea, QWi screenLockWindow->setStyleName("ScreenLockWindow"); screenLockWindow->setLayout(layout); screenLockWindow->appear(this); + + // The language may have changed before the window was created, + // retranslate the UI + QEvent event(QEvent::LanguageChange); + QApplication::sendEvent(this, &event); } ScreenLockWindow::~ScreenLockWindow() diff --git a/tests/ut_screenlockwindow/ut_screenlockwindow.cpp b/tests/ut_screenlockwindow/ut_screenlockwindow.cpp index 312ccb07..4b3aeb2f 100644 --- a/tests/ut_screenlockwindow/ut_screenlockwindow.cpp +++ b/tests/ut_screenlockwindow/ut_screenlockwindow.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "ut_screenlockwindow.h" #include "screenlockwindow.h" @@ -72,6 +73,14 @@ void MSceneWindow::appear(MWindow* window, MSceneWindow::DeletionPolicy policy) Q_UNUSED(policy); } +int languageChangeEventSendCount = 0; +bool MWindow::event(QEvent *event) +{ + if(event->type() == QEvent::LanguageChange) { + languageChangeEventSendCount++; + } + return false; +} void Ut_ScreenLockWindow::initTestCase() { @@ -100,6 +109,7 @@ void Ut_ScreenLockWindow::cleanup() mWindowOrientation.clear(); mWindowOrientationAngle = M::Angle180; gX11WrapperStub->stubReset(); + languageChangeEventSendCount = 0; } void Ut_ScreenLockWindow::testWhenWindowIsCreatedLockScreenAppears() @@ -107,6 +117,11 @@ void Ut_ScreenLockWindow::testWhenWindowIsCreatedLockScreenAppears() QCOMPARE(appearedWindow, lockScreenWindow); } +void Ut_ScreenLockWindow::testWhenWindowIsCreatedLanguageChangeEventIsSent() +{ + QCOMPARE(languageChangeEventSendCount, 1); +} + void Ut_ScreenLockWindow::testWhenWindowIsShownItIsExcludedFromTaskbar() { // The stub needs to be reset so that things done at construction time won't affect the test diff --git a/tests/ut_screenlockwindow/ut_screenlockwindow.h b/tests/ut_screenlockwindow/ut_screenlockwindow.h index f3b5a1e5..fdc0df64 100644 --- a/tests/ut_screenlockwindow/ut_screenlockwindow.h +++ b/tests/ut_screenlockwindow/ut_screenlockwindow.h @@ -35,6 +35,7 @@ private slots: void cleanupTestCase(); void testWhenWindowIsCreatedLockScreenAppears(); + void testWhenWindowIsCreatedLanguageChangeEventIsSent(); void testWhenWindowIsShownItIsExcludedFromTaskbar(); void testOrientationLocking_data(); void testOrientationLocking();