on xenial help sign in
fix expanding logic, update mock, silence runtime warnings
commit7e1fe43e75460829f3cfbf1228f91017e4407f13 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateTue 3 May 2016, 15:17 (10 years ago) parentcce8634
4 files changed+21−11
qml/Notifications/Notification.qml+5−1 qml/Notifications/Notifications.qml+1−1 tests/mocks/QtMultimedia/audio.cpp+3−3 tests/mocks/QtMultimedia/audio.h+12−6
qml/Notifications/Notification.qml+5−1
@@ -62,7 +62,7 @@ StyledItem {
6262 if (ListView.view.currentIndex === index) {
6363 result = true;
6464 } else {
65− if (ListView.view.count > 2) {
65+ if (ListView.view.count > 1) {
6666 if (ListView.view.currentIndex === -1 && index == 1) {
6767 result = true;
6868 } else {
@@ -99,6 +99,10 @@ StyledItem {
9999 }
100100
101101 function closeNotification() {
102+ if (index === ListView.view.currentIndex) { // reset to get the 1st snap decision expanded
103+ ListView.view.currentIndex = -1;
104+ }
105+
102106 if (notification.actions.count > 1) { // perform the "reject" action
103107 notification.notification.invokeAction(notification.actions.data(1, ActionModel.RoleActionId));
104108 }
qml/Notifications/Notifications.qml+1−1
@@ -52,7 +52,7 @@ ListView {
5252 type: model.type
5353 hints: model.hints
5454 iconSource: model.icon
55− secondaryIconSource: model.secondaryIcon
55+ secondaryIconSource: model.secondaryIcon ? model.secondaryIcon : ""
5656 summary: model.summary
5757 body: model.body
5858 value: model.value ? model.value : -1
tests/mocks/QtMultimedia/audio.cpp+3−3
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013, 2015 Canonical, Ltd.
2+ * Copyright (C) 2013-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
2121Audio::Audio(QObject* parent):
2222 QObject(parent),
2323 m_playbackState(StoppedState),
24− m_playlist(0)
24+ m_playlist(nullptr)
2525{
2626 qsrand(time(nullptr));
2727 m_timer.setInterval(1000);
@@ -109,7 +109,7 @@ void Audio::timerEvent()
109109
110110Audio::AudioRole Audio::audioRole() const
111111{
112− return Audio::multimedia;
112+ return Audio::MusicRole;
113113}
114114
115115void Audio::setAudioRole(Audio::AudioRole audioRole)
tests/mocks/QtMultimedia/audio.h+12−6
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2012, 2013, 2015 Canonical, Ltd.
2+ * Copyright (C) 2012-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -44,13 +44,19 @@ public:
4444 };
4545
4646 enum AudioRole {
47− alarm,
48− alert,
49− multimedia,
50− phone
47+ UnknownRole,
48+ MusicRole,
49+ VideoRole,
50+ VoiceCommunicationRole,
51+ AlarmRole,
52+ NotificationRole,
53+ RingtoneRole,
54+ AccessibilityRole,
55+ SonificationRole,
56+ GameRole
5157 };
5258
53− explicit Audio(QObject *parent = 0);
59+ explicit Audio(QObject *parent = nullptr);
5460
5561 QUrl source() const;
5662 void setSource(const QUrl &source);