on xenial help sign in
fix expanding logic, update mock, silence runtime warnings
7e1fe43Lukáš Tinkl
qml/Notifications/Notification.qml+5−1
@@ -62,7 +62,7 @@ StyledItem {
62 if (ListView.view.currentIndex === index) {
62 if (ListView.view.currentIndex === index) {
63 result = true;
63 result = true;
64 } else {
64 } else {
65− if (ListView.view.count > 2) {
65+ if (ListView.view.count > 1) {
66 if (ListView.view.currentIndex === -1 && index == 1) {
66 if (ListView.view.currentIndex === -1 && index == 1) {
67 result = true;
67 result = true;
68 } else {
68 } else {
@@ -99,6 +99,10 @@ StyledItem {
99 }
99 }
100
100
101 function closeNotification() {
101 function closeNotification() {
102+ if (index === ListView.view.currentIndex) { // reset to get the 1st snap decision expanded
103+ ListView.view.currentIndex = -1;
104+ }
105+
102 if (notification.actions.count > 1) { // perform the "reject" action
106 if (notification.actions.count > 1) { // perform the "reject" action
103 notification.notification.invokeAction(notification.actions.data(1, ActionModel.RoleActionId));
107 notification.notification.invokeAction(notification.actions.data(1, ActionModel.RoleActionId));
104 }
108 }
qml/Notifications/Notifications.qml+1−1
@@ -52,7 +52,7 @@ ListView {
52 type: model.type
52 type: model.type
53 hints: model.hints
53 hints: model.hints
54 iconSource: model.icon
54 iconSource: model.icon
55− secondaryIconSource: model.secondaryIcon
55+ secondaryIconSource: model.secondaryIcon ? model.secondaryIcon : ""
56 summary: model.summary
56 summary: model.summary
57 body: model.body
57 body: model.body
58 value: model.value ? model.value : -1
58 value: model.value ? model.value : -1
tests/mocks/QtMultimedia/audio.cpp+3−3
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2013, 2015 Canonical, Ltd.
2+ * Copyright (C) 2013-2016 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
21Audio::Audio(QObject* parent):
21Audio::Audio(QObject* parent):
22 QObject(parent),
22 QObject(parent),
23 m_playbackState(StoppedState),
23 m_playbackState(StoppedState),
24− m_playlist(0)
24+ m_playlist(nullptr)
25{
25{
26 qsrand(time(nullptr));
26 qsrand(time(nullptr));
27 m_timer.setInterval(1000);
27 m_timer.setInterval(1000);
@@ -109,7 +109,7 @@ void Audio::timerEvent()
109
109
110Audio::AudioRole Audio::audioRole() const
110Audio::AudioRole Audio::audioRole() const
111{
111{
112− return Audio::multimedia;
112+ return Audio::MusicRole;
113}
113}
114
114
115void Audio::setAudioRole(Audio::AudioRole audioRole)
115void Audio::setAudioRole(Audio::AudioRole audioRole)
tests/mocks/QtMultimedia/audio.h+12−6
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2012, 2013, 2015 Canonical, Ltd.
2+ * Copyright (C) 2012-2016 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -44,13 +44,19 @@ public:
44 };
44 };
45
45
46 enum AudioRole {
46 enum AudioRole {
47− alarm,
47+ UnknownRole,
48− alert,
48+ MusicRole,
49− multimedia,
49+ VideoRole,
50− phone
50+ VoiceCommunicationRole,
51+ AlarmRole,
52+ NotificationRole,
53+ RingtoneRole,
54+ AccessibilityRole,
55+ SonificationRole,
56+ GameRole
51 };
57 };
52
58
53− explicit Audio(QObject *parent = 0);
59+ explicit Audio(QObject *parent = nullptr);
54
60
55 QUrl source() const;
61 QUrl source() const;
56 void setSource(const QUrl &source);
62 void setSource(const QUrl &source);