Skip to content

Commit

Permalink
Fixes: NB#283977 - Battery low warnings produced during IHF call are …
Browse files Browse the repository at this point in the history
…displayed in a bunch after the call

Bug: NB#283977 - Battery low warnings produced during IHF call are displayed in a bunch after the call
RevBy: TrustMe
  • Loading branch information
Vesa Halttunen committed Oct 25, 2011
1 parent ab9d25b commit 71ed582
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 37 deletions.
1 change: 1 addition & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
system-ui (1.2.12~1) unstable; urgency=low

* [UNRELEASED]
* Fixes: NB#283977 - Battery low warnings produced during IHF call are displayed in a bunch after the call

-- Vesa Halttunen <[email protected]> Fri, 21 Oct 2011 11:36:10 +0300

Expand Down
26 changes: 9 additions & 17 deletions src/systemui/notifications/mcompositornotificationsink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ void MCompositorNotificationSink::addNotification(const Notification &notificati
updateNotification(notification);
} else {
#ifdef HAVE_QMSYSTEM
if (notification.type() == Notification::SystemEvent && window != NULL && displayState.get() == MeeGo::QmDisplayState::Off) {
// When a system banner comes in while the display is off, remove any other system banners from the queue
removeSystemBannersFromQueue();
if (window != NULL && displayState.get() == MeeGo::QmDisplayState::Off) {
// When a notification comes in while the display is off, remove any other banners from the queue
removeBannersFromQueue();
}
#endif

Expand Down Expand Up @@ -365,25 +365,17 @@ void MCompositorNotificationSink::setTouchScreenLockActive(bool active)
changeNotificationPreviewMode();
}

void MCompositorNotificationSink::removeSystemBannersFromQueue()
void MCompositorNotificationSink::removeBannersFromQueue()
{
// Remove references to all system banners
QList<MBanner *> doneBanners;
// Remove references to all banners
foreach (MBanner *banner, bannerQueue) {
if (banner->styleName() == "SystemBanner") {
bannerDone(banner);
doneBanners.append(banner);
}
}

// Remove system banners from the banner queue
foreach (MBanner *banner, doneBanners) {
bannerQueue.removeAll(banner);
bannerDone(banner);
delete banner;
}
bannerQueue.clear();

if (currentBanner != NULL && currentBanner->styleName() == "SystemBanner") {
// Disappear any system banner currently being displayed
if (currentBanner != NULL) {
// Disappear any banner currently being displayed
window->sceneManager()->disappearSceneWindowNow(currentBanner);
}
}
4 changes: 2 additions & 2 deletions src/systemui/notifications/mcompositornotificationsink.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ private slots:
//! Removes references to a banner
void bannerDone(MBanner *banner);

//! Removes system banners from the queue and disappears any system banner currently being displayed
void removeSystemBannersFromQueue();
//! Removes banners from the queue and disappears any banner currently being displayed
void removeBannersFromQueue();

//! The set of all notification IDs known by this sink. Needed to know also about those notifications which do not have banners anymore.
QSet<uint> notificationIds;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ void MWindow::setVisible(bool visible)
mWindowSetVisibleValue = visible;
mWindowSetVisibleWidget = this;

setAttribute(visible ? Qt::WA_WState_Visible : Qt::WA_WState_Hidden);
setAttribute(Qt::WA_WState_Visible, visible);
setAttribute(Qt::WA_WState_Hidden, !visible);
}

// MGConfItem stub
Expand Down Expand Up @@ -953,8 +954,8 @@ void Ut_MCompositorNotificationSink::updateNotificationDoesNotCreateWindowIfBann
bridge.setSceneWindowState(MSceneWindow::Disappeared);

// At this point the window has disappeared and updating the notification should not bring it back
TestNotificationParameters parameters1( "title1", "subtitle1", "buttonicon1", "content1 1 1 1");
notificationManager->addNotification(0, parameters1);
TestNotificationParameters parameters1("title1", "subtitle1", "buttonicon1", "content1 1 1 1");
notificationManager->updateNotification(0, 0, parameters1);
QCOMPARE(mWindowSetVisibleValue, false);
}

Expand Down Expand Up @@ -1014,7 +1015,7 @@ void Ut_MCompositorNotificationSink::testSystemNotificationIsRemovedWhenBannerHa
QCOMPARE(spy.last().at(0).toUInt(), id);
}

void Ut_MCompositorNotificationSink::testWhenDisplayIsOffAndSystemNotificationIsReceivedSystemNotificationsAreRemovedFromQueue()
void Ut_MCompositorNotificationSink::testWhenDisplayIsOffAndNotificationIsReceivedBannersAreRemovedFromQueue()
{
qQTimerEmitTimeoutImmediately = false;

Expand All @@ -1025,7 +1026,6 @@ void Ut_MCompositorNotificationSink::testWhenDisplayIsOffAndSystemNotificationIs
TestNotificationParameters parameters4("title4", "subtitle4", "buttonicon3", "content4 4 4 4");
parameters0.add(GenericNotificationParameterFactory::classKey(), "system");
parameters1.add(GenericNotificationParameterFactory::classKey(), "system");
parameters3.add(GenericNotificationParameterFactory::classKey(), "system");
parameters4.add(GenericNotificationParameterFactory::classKey(), "system");
notificationManager->addNotification(0, parameters0, 0);
notificationManager->addNotification(0, parameters1, 0);
Expand All @@ -1037,20 +1037,15 @@ void Ut_MCompositorNotificationSink::testWhenDisplayIsOffAndSystemNotificationIs
gQmDisplayStateOff = true;
notificationManager->addNotification(0, parameters4, 0);

// The system banner that was on screen should disappear
// The banner that was on screen should disappear and the queue should be emptied
QCOMPARE(mSceneManagerDisappearSceneWindowWindow, gMSceneWindowsAppeared.at(0));
QCOMPARE(gMSceneWindowsAppeared.count(), 1);

// Non-system notifications should not disappear from the queue but appear on the screen
QCOMPARE(static_cast<MBanner*>(gMSceneWindowsAppeared.at(1))->styleName(), QString("ShortEventBanner"));

// The queue should now contain only the latest system banner
MSceneWindowBridge bridge;
bridge.setObjectName("_m_testBridge");
bridge.setParent(static_cast<MBanner*>(gMSceneWindowsAppeared.at(1)));
bridge.setSceneWindowState(MSceneWindow::Disappeared);
QCOMPARE(gMSceneWindowsAppeared.count(), 3);
QCOMPARE(static_cast<MBanner*>(gMSceneWindowsAppeared.at(2))->styleName(), QString("SystemBanner"));
QCOMPARE(static_cast<MBanner*>(gMSceneWindowsAppeared.at(2))->title(), QString("subtitle4"));
// When the window is opened again the latest banner should appear
emitDisplayEntered();
QCOMPARE(gMSceneWindowsAppeared.count(), 2);
QCOMPARE(static_cast<MBanner*>(gMSceneWindowsAppeared.at(1))->styleName(), QString("SystemBanner"));
QCOMPARE(static_cast<MBanner*>(gMSceneWindowsAppeared.at(1))->title(), QString("subtitle4"));
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private slots:
void testCurrentBannerDoneDoesntRemoveOtherBanners();
void testSystemNotificationIsRemovedWhenPreviewsAreDisabled();
void testSystemNotificationIsRemovedWhenBannerHasBeenShown();
void testWhenDisplayIsOffAndSystemNotificationIsReceivedSystemNotificationsAreRemovedFromQueue();
void testWhenDisplayIsOffAndNotificationIsReceivedBannersAreRemovedFromQueue();

private:
void testWindowShapeRegion(M::OrientationAngle angle, MSceneWindow* window);
Expand Down

0 comments on commit 71ed582

Please sign in to comment.