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
1=== modified file 'plugins/CMakeLists.txt'
2--- plugins/CMakeLists.txt 2014-03-17 22:12:26 +0000
3+++ plugins/CMakeLists.txt 2014-08-04 14:04:23 +0000
4@@ -10,6 +10,7 @@
5 add_subdirectory(example)
6 add_subdirectory(flight-mode)
7 add_subdirectory(language)
8+add_subdirectory(notifications)
9 add_subdirectory(orientation-lock)
10 add_subdirectory(phone)
11 add_subdirectory(reset)
12
13=== added directory 'plugins/notifications'
14=== added file 'plugins/notifications/CMakeLists.txt'
15--- plugins/notifications/CMakeLists.txt 1970-01-01 00:00:00 +0000
16+++ plugins/notifications/CMakeLists.txt 2014-08-04 14:04:23 +0000
17@@ -0,0 +1,18 @@
18+set(QML_SOURCES PageComponent.qml)
19+SET (CMAKE_AUTOMOC ON)
20+
21+add_library(UbuntuNotificationsPanel MODULE plugin.h notification_manager.h
22+notification_item.h notification_item.cpp
23+plugin.cpp notification_manager.cpp
24+${QML_SOURCES})
25+
26+include_directories(${GIO_INCLUDE_DIRS})
27+target_link_libraries(UbuntuNotificationsPanel ${GLIB_LDFLAGS} ${GIO_LDFLAGS})
28+qt5_use_modules(UbuntuNotificationsPanel Qml Quick)
29+
30+set(PLUG_DIR ${PLUGIN_PRIVATE_MODULE_DIR}/Ubuntu/SystemSettings/Notifications)
31+install(TARGETS UbuntuNotificationsPanel DESTINATION ${PLUG_DIR})
32+install(FILES qmldir DESTINATION ${PLUG_DIR})
33+install(FILES ${QML_SOURCES} DESTINATION ${PLUGIN_QML_DIR}/notifications)
34+
35+install(FILES notifications.settings DESTINATION ${PLUGIN_MANIFEST_DIR})
36
37=== added file 'plugins/notifications/PageComponent.qml'
38--- plugins/notifications/PageComponent.qml 1970-01-01 00:00:00 +0000
39+++ plugins/notifications/PageComponent.qml 2014-08-04 14:04:23 +0000
40@@ -0,0 +1,85 @@
41+/*
42+ * This file is part of system-settings
43+ *
44+ * Copyright (C) 2013-2014 Canonical Ltd.
45+ *
46+ * This program is free software: you can redistribute it and/or modify it
47+ * under the terms of the GNU General Public License version 3, as published
48+ * by the Free Software Foundation.
49+ *
50+ * This program is distributed in the hope that it will be useful, but
51+ * WITHOUT ANY WARRANTY; without even the implied warranties of
52+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
53+ * PURPOSE. See the GNU General Public License for more details.
54+ *
55+ * You should have received a copy of the GNU General Public License along
56+ * with this program. If not, see <http://www.gnu.org/licenses/>.
57+ */
58+
59+import QtQuick 2.0
60+import Ubuntu.Components 0.1
61+import Ubuntu.Components.ListItems 0.1 as ListItem
62+import Ubuntu.SystemSettings.Notifications 1.0
63+import SystemSettings 1.0
64+
65+ItemPage {
66+ id: root
67+ objectName: "systemNotificationsPage"
68+
69+ title: i18n.tr("Notifications")
70+
71+ NotificationsManager {
72+ id: notificationsManager
73+ }
74+
75+ ListItem.Base {
76+ id: subtitle
77+ height: labelSubtitle.height + units.gu(2)
78+ Label {
79+ id: labelSubtitle
80+ text: i18n.tr("Selected apps can alert you using notification bubbles, sounds, vibrations, and the Notification Center.")
81+ wrapMode: Text.WordWrap
82+ anchors {
83+ top: parent.top
84+ left: parent.left
85+ right: parent.right
86+ margins: units.gu(1)
87+ }
88+ fontSize: "large"
89+ }
90+ }
91+
92+ ListView {
93+ id: notificationsList
94+ objectName: "notificationsList"
95+ anchors {
96+ left: parent.left
97+ right: parent.right
98+ top: subtitle.bottom
99+ bottom: parent.bottom
100+ }
101+ model: notificationsManager.model
102+ clip: true
103+ contentHeight: contentItem.childrenRect.height
104+
105+ delegate: ListItem.Standard {
106+ text: modelData.title
107+ Component.onCompleted: {
108+ if (modelData.icon.search("/") == -1) {
109+ iconName = modelData.icon
110+ }
111+ else {
112+ iconSource = modelData.icon
113+ }
114+ }
115+ iconFrame: false
116+ control: Switch {
117+ checked: modelData.status
118+
119+ onCheckedChanged: {
120+ modelData.status = checked;
121+ }
122+ }
123+ }
124+ }
125+}
126
127=== added file 'plugins/notifications/notification_item.cpp'
128--- plugins/notifications/notification_item.cpp 1970-01-01 00:00:00 +0000
129+++ plugins/notifications/notification_item.cpp 2014-08-04 14:04:23 +0000
130@@ -0,0 +1,48 @@
131+/*
132+ * Copyright (C) 2014 Canonical Ltd
133+ *
134+ * This program is free software: you can redistribute it and/or modify
135+ * it under the terms of the GNU General Public License version 3 as
136+ * published by the Free Software Foundation.
137+ *
138+ * This program is distributed in the hope that it will be useful,
139+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
140+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
141+ * GNU General Public License for more details.
142+ *
143+ * You should have received a copy of the GNU General Public License
144+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
145+ *
146+*/
147+
148+#include "notification_item.h"
149+
150+namespace NotificationsPlugin {
151+
152+NotificationItem::NotificationItem(QObject *parent) :
153+ QObject(parent)
154+{
155+}
156+
157+NotificationItem::~NotificationItem()
158+{
159+}
160+
161+void NotificationItem::setItemData(QString title, QString icon, bool status, QString key)
162+{
163+ m_title = title;
164+ m_icon = icon;
165+ m_status = status;
166+ m_key = key;
167+ Q_EMIT titleChanged();
168+ Q_EMIT iconChanged();
169+ Q_EMIT statusChanged();
170+}
171+
172+void NotificationItem::setStatus(bool status) {
173+ m_status = status;
174+ Q_EMIT statusChanged();
175+ Q_EMIT updateNotificationStatus(m_key, m_status);
176+}
177+
178+}
179
180=== added file 'plugins/notifications/notification_item.h'
181--- plugins/notifications/notification_item.h 1970-01-01 00:00:00 +0000
182+++ plugins/notifications/notification_item.h 2014-08-04 14:04:23 +0000
183@@ -0,0 +1,62 @@
184+/*
185+ * Copyright (C) 2014 Canonical Ltd
186+ *
187+ * This program is free software: you can redistribute it and/or modify
188+ * it under the terms of the GNU General Public License version 3 as
189+ * published by the Free Software Foundation.
190+ *
191+ * This program is distributed in the hope that it will be useful,
192+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
193+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
194+ * GNU General Public License for more details.
195+ *
196+ * You should have received a copy of the GNU General Public License
197+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
198+ *
199+*/
200+
201+#ifndef UPDATE_H
202+#define UPDATE_H
203+
204+#include <QObject>
205+#include <QString>
206+#include <QStringList>
207+#include <QtQml>
208+
209+namespace NotificationsPlugin {
210+
211+class NotificationItem : public QObject
212+{
213+ Q_OBJECT
214+ Q_PROPERTY(QString title READ title NOTIFY titleChanged)
215+ Q_PROPERTY(QString icon READ icon NOTIFY iconChanged)
216+ Q_PROPERTY(bool status READ status WRITE setStatus NOTIFY statusChanged)
217+ Q_PROPERTY(QString key MEMBER m_key)
218+
219+Q_SIGNALS:
220+ void statusChanged();
221+ void titleChanged();
222+ void iconChanged();
223+ void updateNotificationStatus(QString id, bool value);
224+
225+public:
226+ explicit NotificationItem(QObject *parent = 0);
227+ virtual ~NotificationItem();
228+ void setItemData(QString title, QString icon, bool status, QString key);
229+
230+ bool status() { return m_status; }
231+ QString title() { return m_title; }
232+ QString icon() { return m_icon; }
233+
234+ void setStatus(bool status);
235+
236+private:
237+ QString m_title;
238+ QString m_icon;
239+ QString m_key;
240+ bool m_status;
241+};
242+
243+}
244+
245+#endif // UPDATE_H
246
247=== added file 'plugins/notifications/notification_manager.cpp'
248--- plugins/notifications/notification_manager.cpp 1970-01-01 00:00:00 +0000
249+++ plugins/notifications/notification_manager.cpp 2014-08-04 14:04:23 +0000
250@@ -0,0 +1,211 @@
251+/*
252+ * Copyright (C) 2014 Canonical Ltd
253+ *
254+ * This program is free software: you can redistribute it and/or modify
255+ * it under the terms of the GNU General Public License version 3 as
256+ * published by the Free Software Foundation.
257+ *
258+ * This program is distributed in the hope that it will be useful,
259+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
260+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
261+ * GNU General Public License for more details.
262+ *
263+ * You should have received a copy of the GNU General Public License
264+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
265+ *
266+*/
267+
268+#include <gio/gio.h>
269+#include <gio/gdesktopappinfo.h>
270+
271+#include "notification_manager.h"
272+#include "notification_item.h"
273+#include <iostream>
274+
275+
276+#define CLICK_COMMAND "click"
277+#define BLACKLIST_CONFIG_SCHEMA_ID "com.ubuntu.notifications.hub"
278+#define BLACKLIST_KEY "blacklist"
279+
280+
281+namespace NotificationsPlugin {
282+
283+void app_data_from_desktop_id (const char* desktop_id, char **display_name, char **icon_fname) {
284+ GAppInfo* app_info = (GAppInfo*)g_desktop_app_info_new(desktop_id);
285+ if (app_info != NULL) {
286+ *display_name = g_strdup(g_app_info_get_display_name(app_info));
287+ GIcon* icon = g_app_info_get_icon (app_info);
288+ if (icon != NULL) {
289+ *icon_fname = g_icon_to_string (icon);
290+ }
291+ g_object_unref (app_info);
292+ }
293+ else {
294+ *display_name = NULL;
295+ *icon_fname = NULL;
296+ }
297+}
298+
299+// XXX: lots of code copied from the update plugin.
300+// XXX: and lots of it is also reimplemented differently
301+// XXX: in the about plugin!
302+// XXX: And all of them should be replaced with libclick calls
303+// XXX: instead of calling out to the click command
304+
305+NotificationsManager::NotificationsManager(QObject *parent):
306+ QObject(parent),
307+ m_pushSettings(g_settings_new(BLACKLIST_CONFIG_SCHEMA_ID))
308+{
309+ QObject::connect(&m_process, SIGNAL(finished(int)),
310+ this, SLOT(loadModel()));
311+
312+ QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
313+ QString command = environment.value("CLICK_COMMAND", QString(CLICK_COMMAND));
314+ QStringList args("list");
315+ args << "--manifest";
316+ m_process.start(command, args);
317+}
318+
319+NotificationsManager::~NotificationsManager()
320+{
321+ g_object_unref(m_pushSettings);
322+}
323+
324+void NotificationsManager::loadModel()
325+{
326+ // Load the blacklist
327+ GVariant *blacklist = g_settings_get_value(m_pushSettings, BLACKLIST_KEY);
328+ GVariantIter *iter;
329+ g_variant_get (blacklist, "a(ss)", &iter);
330+ gchar *pkg;
331+ gchar *app;
332+ m_blacklist.clear();
333+ while (g_variant_iter_loop (iter, "(ss)", &pkg, &app)) {
334+ m_blacklist[QString(pkg)+"::::"+app] = true;
335+ }
336+ g_variant_iter_free (iter);
337+ g_variant_unref (blacklist);
338+
339+ // Add legacy dpkg apps
340+ QDir legacy_helpers_dir = QDir("/usr/lib/ubuntu-push-client/legacy-helpers/");
341+ legacy_helpers_dir.setFilter(QDir::Files);
342+ QStringList legacy_helpers = legacy_helpers_dir.entryList();
343+ for (int i = 0; i < legacy_helpers.size(); ++i) {
344+ QString appname = legacy_helpers.at(i);
345+ QString appid = appname + ".desktop";
346+ QString key = "::::"+appname;
347+ char *display_name;
348+ char *icon_fname;
349+ app_data_from_desktop_id(appid.toUtf8().constData(), &display_name, &icon_fname);
350+ bool blacklisted = m_blacklist.contains(key);
351+ if (!display_name || !icon_fname) {
352+ continue; // Broken .desktop file
353+ }
354+ NotificationItem *item = new NotificationItem();
355+ item->setItemData(QString(display_name), QString(icon_fname), !blacklisted, key);
356+ g_free(display_name);
357+ g_free(icon_fname);
358+ m_model.append(QVariant::fromValue(item));
359+ connect(item, &NotificationItem::updateNotificationStatus,
360+ this, &NotificationsManager::checkUpdates);
361+ }
362+
363+ // Add Click Packages
364+
365+ QString output(m_process.readAllStandardOutput());
366+ QJsonDocument document = QJsonDocument::fromJson(output.toUtf8());
367+ QJsonArray array = document.array();
368+
369+
370+ // Iterate over all the installed click packages,
371+ // and, for those packages that have a push-helper hook,
372+ // list all apps (hooks entries with a desktop field)
373+
374+ for (int i = 0; i < array.size(); i++) { // This iterates over packages
375+ QJsonObject object = array.at(i).toObject();
376+
377+ QString pkgname = object.value("name").toString();
378+ QString version = object.value("version").toString();
379+
380+ // This iterates over apps
381+ QVariantMap hooks = object.value("hooks").toObject().toVariantMap();
382+ QList<QString> keys = hooks.keys();
383+
384+ // We need one app that has a push-helper key
385+ bool has_helper = false;
386+ for (int j = 0; j < keys.size(); ++j) {
387+ QVariantMap hook = hooks.value(keys.at(j)).toMap();
388+ if (hook.contains("push-helper")) {
389+ has_helper = true;
390+ }
391+ }
392+ if (!has_helper) {
393+ continue;
394+ }
395+
396+ // It has a helper, so add items for all entries that have
397+ // a "desktop" key.
398+ for (int j = 0; j < keys.size(); ++j) {
399+ QString appname = keys.at(j);
400+ QVariantMap hook = hooks.value(appname).toMap();
401+ if (hook.contains("desktop") || hook.contains("scope")) {
402+ QString key = pkgname+"::::"+appname;
403+ QString appid = pkgname+"_"+appname+"_"+version+".desktop"; // Full versioned APP_ID + ".desktop"
404+ char *display_name;
405+ char *icon_fname;
406+ app_data_from_desktop_id(appid.toUtf8().constData(), &display_name, &icon_fname);
407+ // fall back to the manifest's title & icon if missing from .desktop
408+ if (!display_name) {
409+ display_name = g_strdup(object.value("title").toString().toUtf8().data());
410+ }
411+ if (!icon_fname) {
412+ icon_fname = g_strdup(object.value("icon").toString().toUtf8().data());
413+ }
414+ NotificationItem *item = new NotificationItem();
415+ bool blacklisted = m_blacklist.contains(key);
416+ item->setItemData(QString(display_name), QString(icon_fname), !blacklisted, key);
417+ g_free(display_name);
418+ g_free(icon_fname);
419+ m_model.append(QVariant::fromValue(item));
420+ connect(item, &NotificationItem::updateNotificationStatus,
421+ this, &NotificationsManager::checkUpdates);
422+ }
423+ }
424+ }
425+ Q_EMIT modelChanged();
426+}
427+
428+void NotificationsManager::checkUpdates(QString key, bool value)
429+{
430+ // Update the internal blacklist
431+ if (!value) {
432+ if (!m_blacklist.contains(key)) {
433+ m_blacklist[key] = true;
434+ }
435+ } else {
436+ if (m_blacklist.contains(key)) {
437+ m_blacklist.remove(key);
438+ }
439+ }
440+ // Save the config settings
441+ GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(ss)"));
442+ QList<QString> keys = m_blacklist.keys();
443+ for (int j = 0; j < keys.size(); ++j) {
444+ // Keys are in the form package::::app for click or appid::::appid for legacy apps
445+ QStringList splitted = keys.at(j).split("::::");
446+ if (splitted.count() != 2) {
447+ // Should never ever ever ever ever happen
448+ continue;
449+ }
450+ QString pkgname = splitted.at(0);
451+ QString appname = splitted.at(1);
452+ g_variant_builder_add(builder, "(ss)", pkgname.toUtf8().constData(), appname.toUtf8().constData());
453+ }
454+ GVariant *bl = g_variant_new("a(ss)", builder);
455+ g_variant_builder_unref (builder);
456+ g_settings_set_value(m_pushSettings, BLACKLIST_KEY, bl);
457+ g_variant_unref (bl);
458+}
459+
460+}
461+
462
463=== added file 'plugins/notifications/notification_manager.h'
464--- plugins/notifications/notification_manager.h 1970-01-01 00:00:00 +0000
465+++ plugins/notifications/notification_manager.h 2014-08-04 14:04:23 +0000
466@@ -0,0 +1,59 @@
467+/*
468+ * Copyright (C) 2014 Canonical Ltd
469+ *
470+ * This program is free software: you can redistribute it and/or modify
471+ * it under the terms of the GNU General Public License version 3 as
472+ * published by the Free Software Foundation.
473+ *
474+ * This program is distributed in the hope that it will be useful,
475+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
476+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
477+ * GNU General Public License for more details.
478+ *
479+ * You should have received a copy of the GNU General Public License
480+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
481+ *
482+*/
483+
484+#ifndef NOTIFICATIONMANAGER_H
485+#define NOTIFICATIONMANAGER_H
486+
487+#include <QObject>
488+#include <QMap>
489+#include <QtQml>
490+#include <QList>
491+#include <QVariant>
492+#include <QVariantList>
493+
494+typedef struct _GSettings GSettings;
495+
496+namespace NotificationsPlugin {
497+
498+class NotificationsManager : public QObject
499+{
500+ Q_OBJECT
501+ Q_PROPERTY(QVariantList model READ model NOTIFY modelChanged)
502+
503+Q_SIGNALS:
504+ void modelChanged();
505+
506+public:
507+ explicit NotificationsManager(QObject *parent = 0);
508+ ~NotificationsManager();
509+
510+ QVariantList model() const { return m_model; }
511+
512+private Q_SLOTS:
513+ void checkUpdates(QString id, bool value);
514+ void loadModel();
515+
516+private:
517+ QVariantList m_model;
518+ QProcess m_process;
519+ GSettings *m_pushSettings;
520+ QMap <QString, bool> m_blacklist;
521+};
522+
523+}
524+
525+#endif // NOTIFICATIONMANAGER_H
526
527=== added file 'plugins/notifications/notifications.settings'
528--- plugins/notifications/notifications.settings 1970-01-01 00:00:00 +0000
529+++ plugins/notifications/notifications.settings 2014-08-04 14:04:23 +0000
530@@ -0,0 +1,15 @@
531+{
532+ "icon": "preferences-desktop-notifications-symbolic",
533+ "name": "Notifications",
534+ "translations": "ubuntu-system-settings",
535+ "category": "personal",
536+ "priority": 5,
537+ "keywords": [
538+ "software",
539+ "notifications",
540+ "settings"
541+ ],
542+ "has-dynamic-keywords": false,
543+ "has-dynamic-visibility": false,
544+ "page-component": "PageComponent.qml"
545+}
546
547=== added file 'plugins/notifications/plugin.cpp'
548--- plugins/notifications/plugin.cpp 1970-01-01 00:00:00 +0000
549+++ plugins/notifications/plugin.cpp 2014-08-04 14:04:23 +0000
550@@ -0,0 +1,38 @@
551+/*
552+ * Copyright (C) 2013-2014 Canonical Ltd
553+ *
554+ * This program is free software: you can redistribute it and/or modify
555+ * it under the terms of the GNU General Public License version 3 as
556+ * published by the Free Software Foundation.
557+ *
558+ * This program is distributed in the hope that it will be useful,
559+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
560+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
561+ * GNU General Public License for more details.
562+ *
563+ * You should have received a copy of the GNU General Public License
564+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
565+ *
566+*/
567+
568+#include <QtQml>
569+#include <QtQml/QQmlContext>
570+#include "plugin.h"
571+#include "notification_manager.h"
572+#include "notification_item.h"
573+
574+using namespace NotificationsPlugin;
575+
576+
577+void BackendPlugin::registerTypes(const char *uri)
578+{
579+ Q_ASSERT(uri == QLatin1String("Ubuntu.SystemSettings.Notifications"));
580+
581+ qmlRegisterType<NotificationsManager>(uri, 1, 0, "NotificationsManager");
582+ qmlRegisterType<NotificationItem>(uri, 1, 0, "NotificationItem");
583+}
584+
585+void BackendPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
586+{
587+ QQmlExtensionPlugin::initializeEngine(engine, uri);
588+}
589
590=== added file 'plugins/notifications/plugin.h'
591--- plugins/notifications/plugin.h 1970-01-01 00:00:00 +0000
592+++ plugins/notifications/plugin.h 2014-08-04 14:04:23 +0000
593@@ -0,0 +1,33 @@
594+/*
595+ * Copyright (C) 2013 Canonical Ltd
596+ *
597+ * This program is free software: you can redistribute it and/or modify
598+ * it under the terms of the GNU General Public License version 3 as
599+ * published by the Free Software Foundation.
600+ *
601+ * This program is distributed in the hope that it will be useful,
602+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
603+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
604+ * GNU General Public License for more details.
605+ *
606+ * You should have received a copy of the GNU General Public License
607+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
608+ *
609+*/
610+
611+#ifndef PLUGIN_H
612+#define PLUGIN_H
613+
614+#include <QtQml/QQmlEngine>
615+#include <QtQml/QQmlExtensionPlugin>
616+
617+class BackendPlugin : public QQmlExtensionPlugin
618+{
619+ Q_OBJECT
620+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
621+
622+public:
623+ void registerTypes(const char *uri);
624+ void initializeEngine(QQmlEngine *engine, const char *uri);
625+};
626+#endif // PLUGIN_H
627
628=== added file 'plugins/notifications/qmldir'
629--- plugins/notifications/qmldir 1970-01-01 00:00:00 +0000
630+++ plugins/notifications/qmldir 2014-08-04 14:04:23 +0000
631@@ -0,0 +1,2 @@
632+module Ubuntu.SystemSettings.Notifications
633+plugin UbuntuNotificationsPanel

Subscribers

People subscribed via source and target branches