Merge lp:~ralsina/ubuntu-system-settings/notification-plugin into lp:ubuntu-system-settings

Proposed by Roberto Alsina
Status: Merged
Approved by: Ɓukasz Zemczak
Approved revision: 818
Merged at revision: 860
Proposed branch: lp:~ralsina/ubuntu-system-settings/notification-plugin
Merge into: lp:ubuntu-system-settings
Diff against target: 633 lines (+572/-0)
11 files modified
plugins/CMakeLists.txt (+1/-0)
plugins/notifications/CMakeLists.txt (+18/-0)
plugins/notifications/PageComponent.qml (+85/-0)
plugins/notifications/notification_item.cpp (+48/-0)
plugins/notifications/notification_item.h (+62/-0)
plugins/notifications/notification_manager.cpp (+211/-0)
plugins/notifications/notification_manager.h (+59/-0)
plugins/notifications/notifications.settings (+15/-0)
plugins/notifications/plugin.cpp (+38/-0)
plugins/notifications/plugin.h (+33/-0)
plugins/notifications/qmldir (+2/-0)
To merge this branch: bzr merge lp:~ralsina/ubuntu-system-settings/notification-plugin
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Alberto Mardegan Approve
Sebastien Bacher (community) Needs Information
Diego Sarmentero (community) Approve
Review via email: mp+227344@code.launchpad.net

Commit message

Add a plugin for enabling/disabling push notification per-app.

Description of the change

Add a plugin for enabling/disabling push notification per-app.

Only the apps that have a push notification helper are listed, and the blacklist is stored according to https://code.launchpad.net/~chipaca/gsettings-ubuntu-touch-schemas/just-the-touch-settings/+merge/228317

To test this branch you need to have that one installed.

To post a comment you must log in.
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:795
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1084/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2712
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2162
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/276
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/276
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/276/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/276
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/2819
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3955
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3955/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10672
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1796
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2421
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2421/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1084/rebuild

review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, there are some issues though, review comments inline

You use the "com.ubuntu.touch.notifications" schemas, what is shipping it? Don't you need a depends to be added or versionned (new gsettings-ubuntu-touch-schemas?)

Can you also give some hints on how to test those changes?

review: Needs Fixing
796. By Roberto Alsina

alphabetical sorting of includes

797. By Roberto Alsina

removed unnecessary comment

798. By Roberto Alsina

set has_helper to the right value

799. By Roberto Alsina

describe what the plugin lists

800. By Roberto Alsina

better keywords

Revision history for this message
Roberto Alsina (ralsina) wrote :

> Thanks, there are some issues though, review comments inline

Answered those inline as well, except fr the QML which I am playing with.

> You use the "com.ubuntu.touch.notifications" schemas, what is shipping it?
> Don't you need a depends to be added or versionned (new gsettings-ubuntu-
> touch-schemas?)

Yes, there is a branch (see link above) that adds that schema in gsettings-ubuntu-touch-schemas. To test it you'd need to buld that, install it, then build this and try it.

To see it in action, you need to:

1) Install a few click apps that support push.

Since those are rare, you can change has_helper to true in line 134 of notification_manager.cpp and that will make this show all click apps.

2) Start system settings, open this page, play around with it, enable/disable a few

3) Start it again, see that it keeps the settings correctly.

>
> Can you also give some hints on how to test those changes?

Revision history for this message
Sebastien Bacher (seb128) wrote :

> Answered those inline as well, except fr the QML which I am playing with.

Did you click the "save" button on the right of your replies? I didn't get/can't see your reply

Revision history for this message
Roberto Alsina (ralsina) wrote :

I did... ok, for most, just check the latest commits, they should be
self-explanatory :-)

On Wed, Jul 30, 2014 at 11:44 AM, Sebastien Bacher <email address hidden>
wrote:

> > Answered those inline as well, except fr the QML which I am playing with.
>
> Did you click the "save" button on the right of your replies? I didn't
> get/can't see your reply
> --
>
> https://code.launchpad.net/~ralsina/ubuntu-system-settings/notification-plugin/+merge/227344
> You are the owner of
> lp:~ralsina/ubuntu-system-settings/notification-plugin.
>

Revision history for this message
Roberto Alsina (ralsina) wrote :

Bah, I can't see yours anymore, either. Beta feature indeed :-)

801. By Roberto Alsina

change logic so apps by default show notifications

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:800
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1086/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2731
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2173
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/278
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/278
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/278/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/278
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/2833
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3974
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3974/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10690
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1804
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2432
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2432/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1086/rebuild

review: Approve (continuous-integration)
802. By Roberto Alsina

changed text according to https://wiki.ubuntu.com/Notification

Revision history for this message
Roberto Alsina (ralsina) :
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for the fixes, looks good now, waiting for Chipaca to comment on the remaining issues still though

803. By Roberto Alsina

use a Base Item for subtitle

Revision history for this message
Roberto Alsina (ralsina) wrote :

> Thanks for the fixes, looks good now, waiting for Chipaca to comment on the
> remaining issues still though

Changed the QML to use a Base item (the text is very long, so it does need wrapping).

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:801
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1091/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2744
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2185
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/283
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/283
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/283/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/283
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/2843
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3987
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3987/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10701
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1812
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2444
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2444/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1091/rebuild

review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:803
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1094/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2751
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2192
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/286
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/286
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/286/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/286
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/2846
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3994
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3994/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10706
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1816
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2451
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2451/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1094/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Testing on an unity8 desktop session, system settings is listed but the item is not correctly vertically centered and miss an icon

review: Needs Fixing
Revision history for this message
Sebastien Bacher (seb128) wrote :

changes to the status are also not stored it seems (re-entering the panel reset to false)

Revision history for this message
Roberto Alsina (ralsina) wrote :

> Testing on an unity8 desktop session, system settings is listed but the item
> is not correctly vertically centered and miss an icon

I don't understand, missing icon where? In the system settings? I get an icon with a bell on it.

Revision history for this message
Roberto Alsina (ralsina) wrote :

> changes to the status are also not stored it seems (re-entering the panel
> reset to false)

It's working here (running system-settings on unity7, though)

Can you show me the out put of this command?

gsettings get com.ubuntu.touch.notifications popup-blacklist

Basically, it should be empty if all your click apps checkboxes are ticked, and list something like

[('com.ubuntu.developer.victorsemyonov.mymaps', 'mymaps')]

for each one you disable.

Revision history for this message
Roberto Alsina (ralsina) wrote :

> Thanks for the fixes, looks good now, waiting for Chipaca to comment on the
> remaining issues still though

I can change the schema name, and do a new branch to land the new name, if we can leave the hardcoded path for a later branch.

Revision history for this message
Sebastien Bacher (seb128) wrote :

only system settings is listed there, the key seems to not change everytime the switch is toggled for some reason (like it's not cleared when untoggling in my recent testing, tried under unity7 and unity8-desktop sessions). Note that settings is not a click

> I don't understand, missing icon where? In the system settings? I get an icon with a bell on it.

no, in the notifications panel itself, the listitem entry has no icon (it should according to the design)

Revision history for this message
Roberto Alsina (ralsina) wrote :

> only system settings is listed there, the key seems to not change everytime
> the switch is toggled for some reason (like it's not cleared when untoggling
> in my recent testing, tried under unity7 and unity8-desktop sessions). Note
> that settings is not a click
>
>
> > I don't understand, missing icon where? In the system settings? I get an
> icon with a bell on it.
>
> no, in the notifications panel itself, the listitem entry has no icon (it
> should according to the design)

Yes, system settings is the only deb-packaged app that should show here (only deb to support push), so that's good :-) I had not checked that until now because ... well, there weren't any to check with.

Maybe there's a bug in the saving code for debs. Thanks!

804. By Roberto Alsina

merged trunk

805. By Roberto Alsina

dpkg push notifications are also opt-out

806. By Roberto Alsina

make icon appear for .deb apps

807. By Roberto Alsina

set has_helper to correct value

Revision history for this message
Roberto Alsina (ralsina) wrote :

> only system settings is listed there, the key seems to not change everytime
> the switch is toggled for some reason (like it's not cleared when untoggling
> in my recent testing, tried under unity7 and unity8-desktop sessions). Note
> that settings is not a click
>
>
> > I don't understand, missing icon where? In the system settings? I get an
> icon with a bell on it.
>
> no, in the notifications panel itself, the listitem entry has no icon (it
> should according to the design)

Fixed, see attached image :-)

Revision history for this message
Roberto Alsina (ralsina) wrote :

Of course, I meant, see http://imgur.com/TK2VFVG

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:806
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1117/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2866
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2279
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/309
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/309
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/309/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/309
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/2937
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4109
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4109/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10808
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1884
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2543
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2543/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1117/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:807
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1119/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2875
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2284
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/311
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/311
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/311/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/311
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/2944
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4118
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4118/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10815
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1889
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2548
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2548/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1119/rebuild

review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, your screenshot shows some UI issue:
- the first row hasn't the right height (some top margin that shouldn't be there?)
- the divider shouldn't stop before the left/right borders

review: Needs Fixing
Revision history for this message
Sebastien Bacher (seb128) wrote :

can you also clean the debug output you added in r806?

review: Needs Fixing
Revision history for this message
Roberto Alsina (ralsina) wrote :

> can you also clean the debug output you added in r806?

Cleaned, also removed a bogus margin that caused the problems mentioned in the other comment.

808. By Roberto Alsina

merged trunk

809. By Roberto Alsina

removed debug code

810. By Roberto Alsina

remove bogus margin

Revision history for this message
Roberto Alsina (ralsina) wrote :

New screenshot: http://imgur.com/DNcfTVe

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, that looks better. But for some reason the items icons don't look correctly centered vertically ... is that an issue with the toolkit?

review: Needs Information
Revision history for this message
Sebastien Bacher (seb128) wrote :

oh, the schemas namespace should change to drop "touch", so this side is going to need an update as well

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:810
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1120/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2900
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2293
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/312
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/312
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/312/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/312
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/2965
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4143
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4143/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10844
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1896
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2558
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2558/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1120/rebuild

review: Approve (continuous-integration)
Revision history for this message
Roberto Alsina (ralsina) wrote :

> Thanks, that looks better. But for some reason the items icons don't look
> correctly centered vertically ... is that an issue with the toolkit?

I am not doing anything strange there, just setting the icon, so maybe?

Revision history for this message
Roberto Alsina (ralsina) wrote :

> oh, the schemas namespace should change to drop "touch", so this side is going
> to need an update as well

That needs coordination in 3 branches, we'll change it. Can you approve conditionally with that promise? :-)

811. By Roberto Alsina

renamed gsettings schema/key

Revision history for this message
Roberto Alsina (ralsina) wrote :

> oh, the schemas namespace should change to drop "touch", so this side is going
> to need an update as well

renamed here, and renaming accross the other branches too.

Revision history for this message
Roberto Alsina (ralsina) wrote :

> oh, the schemas namespace should change to drop "touch", so this side is going
> to need an update as well

renamed here, and renaming accross the other branches too.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:811
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1122/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2911
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2301
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/314
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/314
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/314/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/314
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/2975
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4154
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4154/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10858
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1903
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2566
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2566/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1122/rebuild

review: Needs Fixing (continuous-integration)
812. By Roberto Alsina

re-renamed to tvoss's suggested name

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:812
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1127/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2926
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2315
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/319
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/319
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/319/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/319
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/2987
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4169
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4169/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10872
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1915
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2580
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2580/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1127/rebuild

review: Approve (continuous-integration)
813. By Roberto Alsina

change suggested by chipaca

814. By Roberto Alsina

merged trunk

815. By Roberto Alsina

scopes packaged as clicks

816. By Roberto Alsina

further fix

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:814
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1131/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2959
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2347/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/323
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/323
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/323/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/323
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3017
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4202
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4202/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10907
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1942/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2613
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2613/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1131/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:816
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1132/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2960
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2348/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/324
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/324
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/324/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/324
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3018
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4203
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4203/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10909
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1943/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2614
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2614/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1132/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Alberto Mardegan (mardy) wrote :

Just three inline comments.

review: Needs Fixing
817. By Roberto Alsina

no tabs

818. By Roberto Alsina

added g_strdup

Revision history for this message
Roberto Alsina (ralsina) wrote :

> Just three inline comments.

Fixed in revnos 817 and 818

Revision history for this message
Alberto Mardegan (mardy) wrote :

I don't have time to test it, but code-wise it looks fine.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:818
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1134/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2979
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2360
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/326
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/326
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/326/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/326
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3032
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4222
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4222/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10930
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1954
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2626
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2626/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1134/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Ɓukasz Zemczak (sil2100) wrote :

Top-approved as it has been approved in a comment.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:818
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1137/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2995
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2374/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/329
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/329
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/329/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/329
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3047
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4238
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4238/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10953
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1967/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2640
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2640/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1137/rebuild

review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/CMakeLists.txt'
--- plugins/CMakeLists.txt 2014-03-17 22:12:26 +0000
+++ plugins/CMakeLists.txt 2014-08-04 14:04:23 +0000
@@ -10,6 +10,7 @@
10add_subdirectory(example)10add_subdirectory(example)
11add_subdirectory(flight-mode)11add_subdirectory(flight-mode)
12add_subdirectory(language)12add_subdirectory(language)
13add_subdirectory(notifications)
13add_subdirectory(orientation-lock)14add_subdirectory(orientation-lock)
14add_subdirectory(phone)15add_subdirectory(phone)
15add_subdirectory(reset)16add_subdirectory(reset)
1617
=== added directory 'plugins/notifications'
=== added file 'plugins/notifications/CMakeLists.txt'
--- plugins/notifications/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ plugins/notifications/CMakeLists.txt 2014-08-04 14:04:23 +0000
@@ -0,0 +1,18 @@
1set(QML_SOURCES PageComponent.qml)
2SET (CMAKE_AUTOMOC ON)
3
4add_library(UbuntuNotificationsPanel MODULE plugin.h notification_manager.h
5notification_item.h notification_item.cpp
6plugin.cpp notification_manager.cpp
7${QML_SOURCES})
8
9include_directories(${GIO_INCLUDE_DIRS})
10target_link_libraries(UbuntuNotificationsPanel ${GLIB_LDFLAGS} ${GIO_LDFLAGS})
11qt5_use_modules(UbuntuNotificationsPanel Qml Quick)
12
13set(PLUG_DIR ${PLUGIN_PRIVATE_MODULE_DIR}/Ubuntu/SystemSettings/Notifications)
14install(TARGETS UbuntuNotificationsPanel DESTINATION ${PLUG_DIR})
15install(FILES qmldir DESTINATION ${PLUG_DIR})
16install(FILES ${QML_SOURCES} DESTINATION ${PLUGIN_QML_DIR}/notifications)
17
18install(FILES notifications.settings DESTINATION ${PLUGIN_MANIFEST_DIR})
019
=== added file 'plugins/notifications/PageComponent.qml'
--- plugins/notifications/PageComponent.qml 1970-01-01 00:00:00 +0000
+++ plugins/notifications/PageComponent.qml 2014-08-04 14:04:23 +0000
@@ -0,0 +1,85 @@
1/*
2 * This file is part of system-settings
3 *
4 * Copyright (C) 2013-2014 Canonical Ltd.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 3, as published
8 * by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranties of
12 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
13 * PURPOSE. See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19import QtQuick 2.0
20import Ubuntu.Components 0.1
21import Ubuntu.Components.ListItems 0.1 as ListItem
22import Ubuntu.SystemSettings.Notifications 1.0
23import SystemSettings 1.0
24
25ItemPage {
26 id: root
27 objectName: "systemNotificationsPage"
28
29 title: i18n.tr("Notifications")
30
31 NotificationsManager {
32 id: notificationsManager
33 }
34
35 ListItem.Base {
36 id: subtitle
37 height: labelSubtitle.height + units.gu(2)
38 Label {
39 id: labelSubtitle
40 text: i18n.tr("Selected apps can alert you using notification bubbles, sounds, vibrations, and the Notification Center.")
41 wrapMode: Text.WordWrap
42 anchors {
43 top: parent.top
44 left: parent.left
45 right: parent.right
46 margins: units.gu(1)
47 }
48 fontSize: "large"
49 }
50 }
51
52 ListView {
53 id: notificationsList
54 objectName: "notificationsList"
55 anchors {
56 left: parent.left
57 right: parent.right
58 top: subtitle.bottom
59 bottom: parent.bottom
60 }
61 model: notificationsManager.model
62 clip: true
63 contentHeight: contentItem.childrenRect.height
64
65 delegate: ListItem.Standard {
66 text: modelData.title
67 Component.onCompleted: {
68 if (modelData.icon.search("/") == -1) {
69 iconName = modelData.icon
70 }
71 else {
72 iconSource = modelData.icon
73 }
74 }
75 iconFrame: false
76 control: Switch {
77 checked: modelData.status
78
79 onCheckedChanged: {
80 modelData.status = checked;
81 }
82 }
83 }
84 }
85}
086
=== added file 'plugins/notifications/notification_item.cpp'
--- plugins/notifications/notification_item.cpp 1970-01-01 00:00:00 +0000
+++ plugins/notifications/notification_item.cpp 2014-08-04 14:04:23 +0000
@@ -0,0 +1,48 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16*/
17
18#include "notification_item.h"
19
20namespace NotificationsPlugin {
21
22NotificationItem::NotificationItem(QObject *parent) :
23 QObject(parent)
24{
25}
26
27NotificationItem::~NotificationItem()
28{
29}
30
31void NotificationItem::setItemData(QString title, QString icon, bool status, QString key)
32{
33 m_title = title;
34 m_icon = icon;
35 m_status = status;
36 m_key = key;
37 Q_EMIT titleChanged();
38 Q_EMIT iconChanged();
39 Q_EMIT statusChanged();
40}
41
42void NotificationItem::setStatus(bool status) {
43 m_status = status;
44 Q_EMIT statusChanged();
45 Q_EMIT updateNotificationStatus(m_key, m_status);
46}
47
48}
049
=== added file 'plugins/notifications/notification_item.h'
--- plugins/notifications/notification_item.h 1970-01-01 00:00:00 +0000
+++ plugins/notifications/notification_item.h 2014-08-04 14:04:23 +0000
@@ -0,0 +1,62 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16*/
17
18#ifndef UPDATE_H
19#define UPDATE_H
20
21#include <QObject>
22#include <QString>
23#include <QStringList>
24#include <QtQml>
25
26namespace NotificationsPlugin {
27
28class NotificationItem : public QObject
29{
30 Q_OBJECT
31 Q_PROPERTY(QString title READ title NOTIFY titleChanged)
32 Q_PROPERTY(QString icon READ icon NOTIFY iconChanged)
33 Q_PROPERTY(bool status READ status WRITE setStatus NOTIFY statusChanged)
34 Q_PROPERTY(QString key MEMBER m_key)
35
36Q_SIGNALS:
37 void statusChanged();
38 void titleChanged();
39 void iconChanged();
40 void updateNotificationStatus(QString id, bool value);
41
42public:
43 explicit NotificationItem(QObject *parent = 0);
44 virtual ~NotificationItem();
45 void setItemData(QString title, QString icon, bool status, QString key);
46
47 bool status() { return m_status; }
48 QString title() { return m_title; }
49 QString icon() { return m_icon; }
50
51 void setStatus(bool status);
52
53private:
54 QString m_title;
55 QString m_icon;
56 QString m_key;
57 bool m_status;
58};
59
60}
61
62#endif // UPDATE_H
063
=== added file 'plugins/notifications/notification_manager.cpp'
--- plugins/notifications/notification_manager.cpp 1970-01-01 00:00:00 +0000
+++ plugins/notifications/notification_manager.cpp 2014-08-04 14:04:23 +0000
@@ -0,0 +1,211 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16*/
17
18#include <gio/gio.h>
19#include <gio/gdesktopappinfo.h>
20
21#include "notification_manager.h"
22#include "notification_item.h"
23#include <iostream>
24
25
26#define CLICK_COMMAND "click"
27#define BLACKLIST_CONFIG_SCHEMA_ID "com.ubuntu.notifications.hub"
28#define BLACKLIST_KEY "blacklist"
29
30
31namespace NotificationsPlugin {
32
33void app_data_from_desktop_id (const char* desktop_id, char **display_name, char **icon_fname) {
34 GAppInfo* app_info = (GAppInfo*)g_desktop_app_info_new(desktop_id);
35 if (app_info != NULL) {
36 *display_name = g_strdup(g_app_info_get_display_name(app_info));
37 GIcon* icon = g_app_info_get_icon (app_info);
38 if (icon != NULL) {
39 *icon_fname = g_icon_to_string (icon);
40 }
41 g_object_unref (app_info);
42 }
43 else {
44 *display_name = NULL;
45 *icon_fname = NULL;
46 }
47}
48
49// XXX: lots of code copied from the update plugin.
50// XXX: and lots of it is also reimplemented differently
51// XXX: in the about plugin!
52// XXX: And all of them should be replaced with libclick calls
53// XXX: instead of calling out to the click command
54
55NotificationsManager::NotificationsManager(QObject *parent):
56 QObject(parent),
57 m_pushSettings(g_settings_new(BLACKLIST_CONFIG_SCHEMA_ID))
58{
59 QObject::connect(&m_process, SIGNAL(finished(int)),
60 this, SLOT(loadModel()));
61
62 QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
63 QString command = environment.value("CLICK_COMMAND", QString(CLICK_COMMAND));
64 QStringList args("list");
65 args << "--manifest";
66 m_process.start(command, args);
67}
68
69NotificationsManager::~NotificationsManager()
70{
71 g_object_unref(m_pushSettings);
72}
73
74void NotificationsManager::loadModel()
75{
76 // Load the blacklist
77 GVariant *blacklist = g_settings_get_value(m_pushSettings, BLACKLIST_KEY);
78 GVariantIter *iter;
79 g_variant_get (blacklist, "a(ss)", &iter);
80 gchar *pkg;
81 gchar *app;
82 m_blacklist.clear();
83 while (g_variant_iter_loop (iter, "(ss)", &pkg, &app)) {
84 m_blacklist[QString(pkg)+"::::"+app] = true;
85 }
86 g_variant_iter_free (iter);
87 g_variant_unref (blacklist);
88
89 // Add legacy dpkg apps
90 QDir legacy_helpers_dir = QDir("/usr/lib/ubuntu-push-client/legacy-helpers/");
91 legacy_helpers_dir.setFilter(QDir::Files);
92 QStringList legacy_helpers = legacy_helpers_dir.entryList();
93 for (int i = 0; i < legacy_helpers.size(); ++i) {
94 QString appname = legacy_helpers.at(i);
95 QString appid = appname + ".desktop";
96 QString key = "::::"+appname;
97 char *display_name;
98 char *icon_fname;
99 app_data_from_desktop_id(appid.toUtf8().constData(), &display_name, &icon_fname);
100 bool blacklisted = m_blacklist.contains(key);
101 if (!display_name || !icon_fname) {
102 continue; // Broken .desktop file
103 }
104 NotificationItem *item = new NotificationItem();
105 item->setItemData(QString(display_name), QString(icon_fname), !blacklisted, key);
106 g_free(display_name);
107 g_free(icon_fname);
108 m_model.append(QVariant::fromValue(item));
109 connect(item, &NotificationItem::updateNotificationStatus,
110 this, &NotificationsManager::checkUpdates);
111 }
112
113 // Add Click Packages
114
115 QString output(m_process.readAllStandardOutput());
116 QJsonDocument document = QJsonDocument::fromJson(output.toUtf8());
117 QJsonArray array = document.array();
118
119
120 // Iterate over all the installed click packages,
121 // and, for those packages that have a push-helper hook,
122 // list all apps (hooks entries with a desktop field)
123
124 for (int i = 0; i < array.size(); i++) { // This iterates over packages
125 QJsonObject object = array.at(i).toObject();
126
127 QString pkgname = object.value("name").toString();
128 QString version = object.value("version").toString();
129
130 // This iterates over apps
131 QVariantMap hooks = object.value("hooks").toObject().toVariantMap();
132 QList<QString> keys = hooks.keys();
133
134 // We need one app that has a push-helper key
135 bool has_helper = false;
136 for (int j = 0; j < keys.size(); ++j) {
137 QVariantMap hook = hooks.value(keys.at(j)).toMap();
138 if (hook.contains("push-helper")) {
139 has_helper = true;
140 }
141 }
142 if (!has_helper) {
143 continue;
144 }
145
146 // It has a helper, so add items for all entries that have
147 // a "desktop" key.
148 for (int j = 0; j < keys.size(); ++j) {
149 QString appname = keys.at(j);
150 QVariantMap hook = hooks.value(appname).toMap();
151 if (hook.contains("desktop") || hook.contains("scope")) {
152 QString key = pkgname+"::::"+appname;
153 QString appid = pkgname+"_"+appname+"_"+version+".desktop"; // Full versioned APP_ID + ".desktop"
154 char *display_name;
155 char *icon_fname;
156 app_data_from_desktop_id(appid.toUtf8().constData(), &display_name, &icon_fname);
157 // fall back to the manifest's title & icon if missing from .desktop
158 if (!display_name) {
159 display_name = g_strdup(object.value("title").toString().toUtf8().data());
160 }
161 if (!icon_fname) {
162 icon_fname = g_strdup(object.value("icon").toString().toUtf8().data());
163 }
164 NotificationItem *item = new NotificationItem();
165 bool blacklisted = m_blacklist.contains(key);
166 item->setItemData(QString(display_name), QString(icon_fname), !blacklisted, key);
167 g_free(display_name);
168 g_free(icon_fname);
169 m_model.append(QVariant::fromValue(item));
170 connect(item, &NotificationItem::updateNotificationStatus,
171 this, &NotificationsManager::checkUpdates);
172 }
173 }
174 }
175 Q_EMIT modelChanged();
176}
177
178void NotificationsManager::checkUpdates(QString key, bool value)
179{
180 // Update the internal blacklist
181 if (!value) {
182 if (!m_blacklist.contains(key)) {
183 m_blacklist[key] = true;
184 }
185 } else {
186 if (m_blacklist.contains(key)) {
187 m_blacklist.remove(key);
188 }
189 }
190 // Save the config settings
191 GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(ss)"));
192 QList<QString> keys = m_blacklist.keys();
193 for (int j = 0; j < keys.size(); ++j) {
194 // Keys are in the form package::::app for click or appid::::appid for legacy apps
195 QStringList splitted = keys.at(j).split("::::");
196 if (splitted.count() != 2) {
197 // Should never ever ever ever ever happen
198 continue;
199 }
200 QString pkgname = splitted.at(0);
201 QString appname = splitted.at(1);
202 g_variant_builder_add(builder, "(ss)", pkgname.toUtf8().constData(), appname.toUtf8().constData());
203 }
204 GVariant *bl = g_variant_new("a(ss)", builder);
205 g_variant_builder_unref (builder);
206 g_settings_set_value(m_pushSettings, BLACKLIST_KEY, bl);
207 g_variant_unref (bl);
208}
209
210}
211
0212
=== added file 'plugins/notifications/notification_manager.h'
--- plugins/notifications/notification_manager.h 1970-01-01 00:00:00 +0000
+++ plugins/notifications/notification_manager.h 2014-08-04 14:04:23 +0000
@@ -0,0 +1,59 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16*/
17
18#ifndef NOTIFICATIONMANAGER_H
19#define NOTIFICATIONMANAGER_H
20
21#include <QObject>
22#include <QMap>
23#include <QtQml>
24#include <QList>
25#include <QVariant>
26#include <QVariantList>
27
28typedef struct _GSettings GSettings;
29
30namespace NotificationsPlugin {
31
32class NotificationsManager : public QObject
33{
34 Q_OBJECT
35 Q_PROPERTY(QVariantList model READ model NOTIFY modelChanged)
36
37Q_SIGNALS:
38 void modelChanged();
39
40public:
41 explicit NotificationsManager(QObject *parent = 0);
42 ~NotificationsManager();
43
44 QVariantList model() const { return m_model; }
45
46private Q_SLOTS:
47 void checkUpdates(QString id, bool value);
48 void loadModel();
49
50private:
51 QVariantList m_model;
52 QProcess m_process;
53 GSettings *m_pushSettings;
54 QMap <QString, bool> m_blacklist;
55};
56
57}
58
59#endif // NOTIFICATIONMANAGER_H
060
=== added file 'plugins/notifications/notifications.settings'
--- plugins/notifications/notifications.settings 1970-01-01 00:00:00 +0000
+++ plugins/notifications/notifications.settings 2014-08-04 14:04:23 +0000
@@ -0,0 +1,15 @@
1{
2 "icon": "preferences-desktop-notifications-symbolic",
3 "name": "Notifications",
4 "translations": "ubuntu-system-settings",
5 "category": "personal",
6 "priority": 5,
7 "keywords": [
8 "software",
9 "notifications",
10 "settings"
11 ],
12 "has-dynamic-keywords": false,
13 "has-dynamic-visibility": false,
14 "page-component": "PageComponent.qml"
15}
016
=== added file 'plugins/notifications/plugin.cpp'
--- plugins/notifications/plugin.cpp 1970-01-01 00:00:00 +0000
+++ plugins/notifications/plugin.cpp 2014-08-04 14:04:23 +0000
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2013-2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16*/
17
18#include <QtQml>
19#include <QtQml/QQmlContext>
20#include "plugin.h"
21#include "notification_manager.h"
22#include "notification_item.h"
23
24using namespace NotificationsPlugin;
25
26
27void BackendPlugin::registerTypes(const char *uri)
28{
29 Q_ASSERT(uri == QLatin1String("Ubuntu.SystemSettings.Notifications"));
30
31 qmlRegisterType<NotificationsManager>(uri, 1, 0, "NotificationsManager");
32 qmlRegisterType<NotificationItem>(uri, 1, 0, "NotificationItem");
33}
34
35void BackendPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
36{
37 QQmlExtensionPlugin::initializeEngine(engine, uri);
38}
039
=== added file 'plugins/notifications/plugin.h'
--- plugins/notifications/plugin.h 1970-01-01 00:00:00 +0000
+++ plugins/notifications/plugin.h 2014-08-04 14:04:23 +0000
@@ -0,0 +1,33 @@
1/*
2 * Copyright (C) 2013 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16*/
17
18#ifndef PLUGIN_H
19#define PLUGIN_H
20
21#include <QtQml/QQmlEngine>
22#include <QtQml/QQmlExtensionPlugin>
23
24class BackendPlugin : public QQmlExtensionPlugin
25{
26 Q_OBJECT
27 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
28
29public:
30 void registerTypes(const char *uri);
31 void initializeEngine(QQmlEngine *engine, const char *uri);
32};
33#endif // PLUGIN_H
034
=== added file 'plugins/notifications/qmldir'
--- plugins/notifications/qmldir 1970-01-01 00:00:00 +0000
+++ plugins/notifications/qmldir 2014-08-04 14:04:23 +0000
@@ -0,0 +1,2 @@
1module Ubuntu.SystemSettings.Notifications
2plugin UbuntuNotificationsPanel

Subscribers

People subscribed via source and target branches