Merge lp:~mterry/unity8/session-lightdm into lp:unity8

Proposed by Michael Terry on 2016-07-14
Status: Superseded
Proposed branch: lp:~mterry/unity8/session-lightdm
Merge into: lp:unity8
Diff against target: 5395 lines (+779/-3072)
99 files modified
CMakeLists.txt (+1/-0)
cmake/modules/QmlTest.cmake (+3/-3)
debian/rules (+0/-4)
plugins/AccountsService/AccountsService.cpp (+27/-1)
plugins/AccountsService/AccountsService.h (+8/-0)
plugins/LightDM/CMakeLists.txt (+16/-9)
plugins/LightDM/FullLightDM/CMakeLists.txt (+0/-28)
plugins/LightDM/Greeter.cpp (+6/-0)
plugins/LightDM/Greeter.h (+4/-0)
plugins/LightDM/IntegratedLightDM/CMakeLists.txt (+0/-33)
plugins/LightDM/IntegratedLightDM/QLightDM/Greeter (+0/-17)
plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel (+0/-17)
plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel (+0/-17)
plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt (+0/-55)
plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp (+0/-184)
plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h (+0/-110)
plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp (+0/-304)
plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h (+0/-51)
plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp (+0/-88)
plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h (+0/-72)
plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp (+0/-36)
plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h (+0/-54)
plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp (+0/-110)
plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.h (+0/-67)
plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp (+0/-94)
plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h (+0/-72)
plugins/LightDM/IntegratedLightDM/qmldir (+0/-3)
plugins/LightDM/SessionsModel.cpp (+6/-2)
plugins/LightDM/SessionsModel.h (+6/-0)
plugins/LightDM/UsersModel.cpp (+7/-0)
plugins/LightDM/UsersModel.h (+4/-0)
plugins/LightDM/plugin.cpp (+2/-9)
plugins/LightDM/plugin.h (+1/-1)
plugins/LightDM/qmldir (+2/-3)
plugins/Unity/Session/dbusunitysessionservice.cpp (+3/-45)
plugins/Unity/Session/dbusunitysessionservice.h (+0/-3)
qml/Components/Dialogs.qml (+4/-4)
qml/Greeter/FullLightDMImpl.qml (+0/-28)
qml/Greeter/Greeter.qml (+33/-28)
qml/Greeter/IntegratedLightDMImpl.qml (+0/-28)
qml/Greeter/LightDMService.qml (+0/-52)
qml/Greeter/qmldir (+0/-1)
qml/Shell.qml (+9/-2)
tests/CMakeLists.txt (+1/-1)
tests/autopilot/unity8/fixture_setup.py (+1/-1)
tests/autopilot/unity8/shell/tests/__init__.py (+1/-1)
tests/mocks/AccountsService/AccountsService.cpp (+14/-0)
tests/mocks/AccountsService/AccountsService.h (+8/-0)
tests/mocks/CMakeLists.txt (+1/-1)
tests/mocks/LightDM/CMakeLists.txt (+0/-1)
tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt (+0/-51)
tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp (+0/-51)
tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h (+0/-42)
tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp (+0/-37)
tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h (+0/-34)
tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp (+0/-39)
tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h (+0/-37)
tests/mocks/LightDM/IntegratedLightDM/QLightDM/Greeter (+0/-17)
tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel (+0/-17)
tests/mocks/LightDM/IntegratedLightDM/QLightDM/UsersModel (+0/-17)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp (+0/-132)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h (+0/-54)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp (+0/-73)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h (+0/-59)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp (+0/-110)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h (+0/-64)
tests/mocks/LightDM/IntegratedLightDM/plugin.cpp (+0/-79)
tests/mocks/LightDM/IntegratedLightDM/plugin.h (+0/-32)
tests/mocks/LightDM/IntegratedLightDM/qmldir (+0/-2)
tests/mocks/liblightdm/CMakeLists.txt (+10/-12)
tests/mocks/liblightdm/MockController.cpp (+85/-0)
tests/mocks/liblightdm/MockController.h (+65/-0)
tests/mocks/liblightdm/MockGreeter.cpp (+88/-33)
tests/mocks/liblightdm/MockGreeter.h (+9/-15)
tests/mocks/liblightdm/MockSessionsModel.cpp (+64/-22)
tests/mocks/liblightdm/MockSessionsModel.h (+43/-44)
tests/mocks/liblightdm/MockUsersModel.cpp (+78/-23)
tests/mocks/liblightdm/MockUsersModel.h (+8/-11)
tests/mocks/libusermetrics/UserMetrics.cpp (+3/-5)
tests/plugins/AccountsService/AccountsServer.cpp (+11/-0)
tests/plugins/AccountsService/AccountsServer.h (+5/-0)
tests/plugins/AccountsService/client.cpp (+71/-21)
tests/plugins/AccountsService/interfaces.xml (+1/-0)
tests/plugins/LightDM/CMakeLists.txt (+20/-79)
tests/plugins/LightDM/IntegratedLightDM/integrated.cpp (+0/-88)
tests/plugins/LightDM/IntegratedLightDM/pam.cpp (+0/-54)
tests/plugins/LightDM/greeter.qml (+1/-6)
tests/plugins/LightDM/sessionsmodel.cpp (+14/-15)
tests/plugins/LightDM/usersmodel.cpp (+4/-14)
tests/plugins/Unity/Session/sessionbackendtest.cpp (+0/-1)
tests/qmltests/Greeter/TestView.qml (+1/-0)
tests/qmltests/Greeter/tst_Greeter.qml (+5/-8)
tests/qmltests/Greeter/tst_Infographics.qml (+1/-11)
tests/qmltests/Greeter/tst_NarrowView.qml (+8/-2)
tests/qmltests/Greeter/tst_WideView.qml (+1/-7)
tests/qmltests/Tutorial/tst_Tutorial.qml (+2/-3)
tests/qmltests/tst_OrientedShell.qml (+7/-1)
tests/qmltests/tst_Shell.qml (+4/-7)
tests/qmltests/tst_ShellWithPin.qml (+2/-3)
To merge this branch: bzr merge lp:~mterry/unity8/session-lightdm
Reviewer Review Type Date Requested Status
Unity Team 2016-07-14 Pending
Review via email: mp+300072@code.launchpad.net

This proposal has been superseded by a proposal from 2016-09-01.

Commit Message

Use liblightdm for session lockscreen too.
This lets us switch users directly from the lockscreen, rather than going to the system greeter.

Description of the Change

This is mostly simplification.

- I drop the distinction between FullLightDM and IntegratedLightDM. Now we always use the full lightdm experience. This lets us drop our custom PAM and custom user code in IntegratedLightDM. No more support for ~/.unity8-greeter-demo, but that's fine. We don't need it anymore with this branch.

- I drop the mock plugin entirely. (opting instead for a tiny "mock()" API call on the real plugin that returns an object that can be used to manipulate our mock liblightdm, if we're in testing mode)

- I simplify the mock liblightdm to avoid separate files for the Private classes. That can all go into the main files. The separation isn't worth wading through the files to find what you want.

- I add a "greeterMode" property to our AccountsService plugin. This toggles whether we try to write non-active user properties back to the system AccountsService daemon or not. When running in-session, we don't want to. We don't have permission to anyway, and it doesn't really matter for the properties we change (notably, the FailedLogins count -- we can just keep track of that locally. It's not urgent that we write that to disk in this case.)

This is easier to test on a yakkety desktop right now. The phone version of LightDM does not support this feature yet.

As part of landing, we will backport lightdm from yakkety.

======

 * Are there any related MPs required for this MP to build/function as expected? Please list.
 Yes. Two config changes to enable this new mode:
 - https://code.launchpad.net/~mterry/unity8-desktop-session/session-lightdm/+merge/300129
 - https://code.launchpad.net/~mterry/ubuntu-touch-session/session-lightdm/+merge/300224

 And a backported yakkety lightdm.

 * Did you perform an exploratory manual test run of your code change and any related functionality?
 Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
 I'm on the team.

 * If you changed the UI, has there been a design review?
 NA

To post a comment you must log in.
lp:~mterry/unity8/session-lightdm updated on 2017-01-26
2545. By CI Train Bot Account on 2016-07-21

Resync trunk.

2546. By Launchpad Translations on behalf of unity-team on 2016-07-22

Launchpad automatic translations update.

2547. By Launchpad Translations on behalf of unity-team on 2016-07-25

Launchpad automatic translations update.

2548. By Timo Jyrinki on 2016-07-26

* Rebuild against Qt 5.6.
* Add https://code.launchpad.net/~aacid/unity8/floor_includes/+merge/300850

2549. By CI Train Bot Account on 2016-07-28

Bump the version to secure UITK compatibility

2550. By Albert Astals Cid on 2016-07-28

Pass the correct number of arguments to mapToItem

One argument used to work in Qt 5.4 and 5.5 but it is not documented and seems to have broken on Qt 5.6 so just update to the correct signature (LP: #1606835)

Approved by: Michael Zanetti

2551. By CI Train Bot Account on 2016-07-28

Releasing 8.14+16.10.20160728-0ubuntu1

2552. By Launchpad Translations on behalf of unity-team on 2016-07-30

Launchpad automatic translations update.

2553. By Lukáš Tinkl on 2016-08-03

Implement frontend support for running keyboard indicator

Approved by: Michael Terry

2554. By Lukáš Tinkl on 2016-08-03

Provide window/surface close shortcuts across all the stages (LP: #1578392, #1606528)

Approved by: Michael Terry, Unity8 CI Bot

2555. By Lukáš Tinkl on 2016-08-03

Restart the location trust prompt service when exiting the wizard (LP: #1594430)

Approved by: Michael Terry

2556. By Daniel d'Andrada on 2016-08-03

Fix splashscreen orientation when app rotates own contents

+ Refactor states code in SpreadDelegate, removing redundancy

+ Fix mock MirSurfaceItem::orientationAngle implementation,
  mirroring what the real implementation in qtmir does. (LP: #1586050)

Approved by: Albert Astals Cid

2557. By Lukáš Tinkl on 2016-08-03

Implement clearing the search and closing the panel on pressing Escape key in the dash header

Approved by: Albert Astals Cid

2558. By Albert Astals Cid on 2016-08-03

Fix DisabledScreenNotice::test_rotation

Change expectFail into expectFailContinue
Otherwise the rest of the test doesn't get executed and we do want it to in this case

Approved by: Daniel d'Andrada

2559. By Albert Astals Cid on 2016-08-03

Unbox the artshapeLoader

There's no need for it to be inside an Item

Approved by: Albert Astals Cid

2560. By Albert Astals Cid on 2016-08-03

Make the delegate of DashNavigationList an async Loader

This list may be created while horizontally swiping through scopes
which means it may create all the visible delegates in a sync manner
while the swipe animation is happening and be jumpy

Previously the polish step of the list was taking around 230ms to in the amazon scope
now it's around 7ms without any noticeable delay in other places of the code

Approved by: Josh Arenson, Unity8 CI Bot

2561. By Albert Astals Cid on 2016-08-03

unity-scope-tool: Use parse instead of process

This way we can pass --desktop_file_hint on the phone

Approved by: Michael Terry

2562. By Andrea Cimitan on 2016-08-03

Unfocus the search text field in the dash page header when requested (LP: #1590820)

Approved by: Albert Astals Cid

2563. By Andrea Cimitan on 2016-08-03

Use binding for filter popover contentWidth (LP: #1595116)

Approved by: Albert Astals Cid

2564. By Andrea Cimitan on 2016-08-03

Add few sourceSize for Image we forgot (LP: #1595113)

Approved by: Albert Astals Cid

2565. By Andrea Cimitan on 2016-08-03

Replace Flickable with an Item inside DashPageHeader for headerContainer (LP: #1599235)

Approved by: Albert Astals Cid, Josh Arenson

2566. By Albert Astals Cid on 2016-08-03

VerticalJournal improvements regarding model insertions and item height changes

insertions in the middle need to trigger a reset
Item height changes need to trigger a relayout (LP: #1599754)

Approved by: Michał Sawicz

2567. By Daniel d'Andrada on 2016-08-03

tst_PreviewIconActions: Make test name match filename

and also test targets (make testFoo, etc)

Just like every other test.

So that you no longer see messages like that:
qmltestrunner.PreviewIconActionTest::test_checkButtonWithTemporary
As "make testPreviewIconActionTest" doesn't exist

Approved by: Albert Astals Cid

2568. By Daniel d'Andrada on 2016-08-03

Cursor: make its size grid unit based

So that it scales along with the rest of the UI (LP: #1604014)

Approved by: Albert Astals Cid, Unity8 CI Bot

2569. By Lukáš Tinkl on 2016-08-03

Fix log timestamps (LP: #1602196)

Approved by: Albert Astals Cid, Unity8 CI Bot

2570. By Michael Terry on 2016-08-03

Fix indicator profile bug that caused sound indicator to say Mute instead of Silent Mode. (LP: #1604205)

Approved by: Lukáš Tinkl

2571. By Michał Sawicz on 2016-08-03

Add arm64 support, drop unnecessary B-D on web plugin

Approved by: Michael Terry

2572. By Michael Terry on 2016-08-03

Fix lockscreen appearing right after unlocking a locked session on the desktop. (LP: #1604374)

Approved by: Josh Arenson

2573. By Albert Astals Cid on 2016-08-03

Add math.h includes for compilation in yakkety (LP: #1605502)

Approved by: Lukáš Tinkl, Timo Jyrinki

2574. By Lukáš Tinkl on 2016-08-03

Don't display the mode switch warning dialog on tablets (LP: #1600290)

Approved by: Michael Zanetti

2575. By Daniel d'Andrada on 2016-08-03

TouchEventSequenceWrapper: item might get deleted when touch sequence is committed (LP: #1607686)

Approved by: Albert Astals Cid

2576. By CI Train Bot Account on 2016-08-03

Releasing 8.14+16.10.20160803-0ubuntu1

2577. By Launchpad Translations on behalf of unity-team on 2016-08-09

Launchpad automatic translations update.

2578. By Albert Astals Cid on 2016-08-11

Take into account carousel selectedItemScaleFactor when setting card fixedArtShapeSize (LP: #1599238)

Approved by: Andrea Cimitan

2579. By Michael Zanetti on 2016-08-11

Clean up some build script legacy

Approved by: Albert Astals Cid

2580. By Michael Zanetti on 2016-08-11

Add a crossbuilder_post file to make crossbuilder restart unity8 after deploying

Approved by: Michał Sawicz

2581. By Albert Astals Cid on 2016-08-11

Remove unused LimitProxyModel

Probably cruft from when we used to have more than one preview in the previews view

Approved by: Josh Arenson, Unity8 CI Bot

2582. By Albert Astals Cid on 2016-08-11

Do not calculate implicitHeight for Cards in a CardGrid

We set their height with
     item.height = Qt.binding(function() { return cardTool.cardHeight; });
anyway so it's lost CPU time

The qmlprofiler said it took around 1.5% of the time of scrolling up/down a very long scope

Approved by: Andrea Cimitan

2583. By Larry Price on 2016-08-11

Allow libertine-scope to show empty search result hint unmodified.
Fixes bug #1606693. (LP: #1606693)

Approved by: Albert Astals Cid

2584. By Michael Zanetti on 2016-08-11

fixes for the automatic switching between usage modes

* evaluate usage mode when the screen size changes
* switch to staged mode even if a mouse is attached when the screen is too small (LP: #1590944)

Approved by: Albert Astals Cid

2585. By Lukáš Tinkl on 2016-08-11

Open the quicklist (context) menu also using the Menu key (LP: #1608265)

Approved by: Michael Zanetti

2586. By Lukáš Tinkl on 2016-08-11

Fix incorrect SIM PIN dialog position when entering a wrong PIN (LP: #1596076)

Approved by: Josh Arenson, Michael Zanetti

2587. By Albert Astals Cid on 2016-08-11

Small clazy fixes

Approved by: Lukáš Tinkl

2588. By Lukáš Tinkl on 2016-08-11

Apply the correct keymap also on prompt surfaces (LP: #1610124)

Approved by: Albert Astals Cid

2589. By Omer Akram on 2016-08-11

Add object names for setup wizard

Approved by: Albert Astals Cid

2590. By Lukáš Tinkl on 2016-08-11

Implement an optional system update feature during OOBE wizard (LP: #1580785)

Approved by: Michał Sawicz

2591. By Lukáš Tinkl on 2016-08-11

Implement a page for choosing HW keyboard layout in OOBE wizard

Approved by: Albert Astals Cid

2592. By Daniel d'Andrada on 2016-08-11

Remove stage property from Application

It's not used anymore

Approved by: Michał Sawicz

2593. By CI Train Bot Account on 2016-08-11

Releasing 8.14+16.10.20160811.1-0ubuntu1

2594. By CI Train Bot Account on 2016-08-16

Resync trunk.

2595. By Launchpad Translations on behalf of unity-team on 2016-08-17

Launchpad automatic translations update.

2596. By Launchpad Translations on behalf of unity-team on 2016-08-18

Launchpad automatic translations update.

2597. By Lukáš Tinkl on 2016-08-19

Reset topmostIsFullscreen to correctly rotate the shell when dismissing SIM PIN screen (LP: #1614070)

Approved by: Albert Astals Cid

2598. By CI Train Bot Account on 2016-08-19

Releasing 8.14+16.10.20160819-0ubuntu1

2599. By CI Train Bot Account on 2016-08-24

Resync trunk.

2600. By Launchpad Translations on behalf of unity-team on 2016-08-25

Launchpad automatic translations update.

2601. By Alfonso Sanchez-Beato on 2016-08-26

Make sure we emit sounds when taking a screenshot even after media-hub
has restarted (LP: #1544477) (LP: #1544477)

2602. By CI Train Bot Account on 2016-08-26

Releasing 8.14+16.10.20160826-0ubuntu1

2603. By CI Train Bot Account on 2016-08-31

Resync trunk.

2604. By Daniel d'Andrada on 2016-08-31

Added implementation for MirSurfaceInterface::persistentId

Approved by: Daniel d'Andrada

2605. By CI Train Bot Account on 2016-08-31

Releasing 8.14+16.10.20160831.3-0ubuntu1

2606. By CI Train Bot Account on 2016-09-02

Resync trunk.

2607. By Launchpad Translations on behalf of unity-team on 2016-09-03

Launchpad automatic translations update.

2608. By Launchpad Translations on behalf of unity-team on 2016-09-12

Launchpad automatic translations update.

2609. By Andrea Cimitan on 2016-09-22

override some Qt Components definitions so we can have sane default values for flick speeds

Approved by: Albert Astals Cid

2610. By Andrea Cimitan on 2016-09-22

Elide the label text inside recent searches panel (LP: #1611796)

Approved by: Albert Astals Cid

2611. By Andrea Cimitan on 2016-09-22

Add a PreviewSingleton module to store some data for previews (LP: #1595235)

Approved by: Albert Astals Cid

2612. By Andrea Cimitan on 2016-09-22

Use PreviewSingleton for PreviewRatingInput and PreviewCommentInput (LP: #1595235)

Approved by: Albert Astals Cid

2613. By Andrea Cimitan on 2016-09-22

rework GenericScopeView PullToRefresh test

Approved by: Albert Astals Cid

2614. By Andrea Cimitan on 2016-09-22

use mouseFlick instead touchFlick for manage_dash_move_current

Approved by: Albert Astals Cid

2615. By Andrea Cimitan on 2016-09-22

add a couple of waiting tricks for a flaky dash test

Approved by: Albert Astals Cid

2616. By Albert Astals Cid on 2016-09-22

LVWPH: update clipItem height when list height changes (LP: #1606935)

Approved by: Andrea Cimitan

2617. By Albert Astals Cid on 2016-09-22

Put the touchdown shape inside a loader

We only create the shape when needed, saving a bit of CPU time when we're just scrolling around the scopes

Doesn't seem to make the touchdown appear time on press noticeably slower

Approved by: Andrea Cimitan, Josh Arenson, Michael Terry, Unity8 CI Bot

2618. By Albert Astals Cid on 2016-09-22

No need for the touchdown in the card for the cardtool

We only use that card to get some size measurements so the touchdown code adds nothing

Approved by: Andrea Cimitan

2619. By Albert Astals Cid on 2016-09-22

Add bottom gradient to the Show Less floating button

Approved by: Andrea Cimitan

2620. By Albert Astals Cid on 2016-09-22

Remove artShapeSize from non cardtool cards

artShapeSize is only used in the cardtool card to read the value them we pass down in fixedArtShapeSize

According to qmlprofiler evaluating this useless binding accounts for ~0.5% when scrolling up and down a very long scope

Approved by: Andrea Cimitan

2621. By Albert Astals Cid on 2016-09-22

LVWPH: Fix case in which header was shown incorrectly

Making the list smaller did not move the header so it ended up being in view

Approved by: Josh Arenson

2622. By Albert Astals Cid on 2016-09-22

LVWPH: Fix items cut on top in the dash (or at least some instances of it)

This reverts a workaround for tests failing introduced in r2121

The commit log of that revision says "The other solutions involve implementing maxYExtent"
which we actually implemented in r2351 so the workaround would not seem needed anymore
and on top of it is causing brokenness so remove it

Approved by: Josh Arenson

2623. By Albert Astals Cid on 2016-09-22

Reduce calls to CardCreatorCache.getCardComponent while the component is being created

As it is right now on the phone we do calls with empty cardTool.artShapeStyle and cardTool.categoryLayout
that are useless so protect against it to save time. This is not reproducible on the desktop (there's a different Qt though 5.6 vs 5.4) (LP: #1615675)

Approved by: Andrea Cimitan

2624. By Albert Astals Cid on 2016-09-22

Dash::test_cardIconStyle change compare into tryCompareFunction

On very slow machines (CI or valgrind) the UCProportionalShape is not created immediately so give it some slack

Approved by: Andrea Cimitan

2625. By Albert Astals Cid on 2016-09-22

Make PreviewActionsTest::test_comboButton more stable

We also wait for the buttonGroup height to have settled otherwise the mouse clicks can end up in the wrong place

Approved by: Andrea Cimitan

2626. By Albert Astals Cid on 2016-09-22

Adapt onShiftedContentXChanged to work when the content changes very abruptly

This happens in CI quite a bit (and locally when run under xvfb)

Approved by: Michael Zanetti

2627. By Albert Astals Cid on 2016-09-22

Make tryGenericScopeView show the scope correctly

Approved by: Andrea Cimitan

2628. By Albert Astals Cid on 2016-09-22

Make sure the spinner does not get too close to the title text (LP: #1597392)

Approved by: Lukáš Tinkl

2629. By Albert Astals Cid on 2016-09-22

Show "Pull to refresh" in white when overlaid in low luminance colors (LP: #1596849)

Approved by: Michael Terry

2630. By Josh Arenson on 2016-09-22

Add a frontend to the sessions model and enable a session chooser in the greeter.

Approved by: Michael Terry

2631. By Michael Terry on 2016-09-22

Support launching apps inside a unity8 session from the greeter and support emergency dialing inside the greeter.

2632. By Michael Terry on 2016-09-22

Fix tryShell to actually show appropriate backgrounds for each mock user.

Approved by: Albert Astals Cid

2633. By Michael Terry on 2016-09-22

Add an indicator to the greeter when a user is logged in (only shown if we have more than one user)

Approved by: Albert Astals Cid

2634. By Michael Terry on 2016-09-22

Hide the greeter OSK if indicators are open and don't show the edge tutorial during an emergency call.

Approved by: Albert Astals Cid

2635. By Michael Terry on 2016-09-22

Switch from lockscreen PIN pad to a passcode entry box that uses the OSK.

Approved by: Albert Astals Cid

2636. By Michael Terry on 2016-09-22

Use the default system wallpaper instead of our custom one.

Additionally, crop the default wallpaper instead of rotating it, only darken the wallpaper if it's not the default one, and avoid reloading the wallpaper when the device is rotated.

2637. By Daniel d'Andrada on 2016-09-22

Set progress bar indeterminate when processing signal received. (LP: #1249349)

Approved by: Daniel d'Andrada

2638. By Daniel d'Andrada on 2016-09-22

Implement cursor confinement (LP: #1590099)

Approved by: Lukáš Tinkl

2639. By Lukáš Tinkl on 2016-09-22

Implement edge maximizing (aka window snapping) (LP: #1602628)

Approved by: Daniel d'Andrada

2640. By Albert Astals Cid on 2016-09-22

Make test_Shell non ultra slow again

By setting the timeout to 0 to findChild we know may return null (LP: #1597366)

Approved by: Lukáš Tinkl, Michael Zanetti

2641. By Albert Astals Cid on 2016-09-22

Improve findChild calls inside tryCompareFunction.

findChild has a timeout retry since a while ago. This means that if we have a findChild inside a tryCompareFunction the retries multiply and it takes around 30 minutes for the tryCompareFunction to fail if the findChild is failing, so what we do is set the timeout of findChild to 0.

In other cases we just had a tryCompareFunction that made sure the findChild after it would succeed, since now findChild has a retry mechanism we can just remove that tryCompareFunction altogether.

Approved by: Michał Sawicz, Unity8 CI Bot

2642. By Lukáš Tinkl on 2016-09-22

On the PC platform (as opposed to running on $devices), use the "mute" action instead of silent mode

Approved by: Albert Astals Cid, Unity8 CI Bot

2643. By Lukáš Tinkl on 2016-09-22

Respect Fitt's law wrt the window control buttons in panel (LP: #1611959)

Approved by: Albert Astals Cid

2644. By Lukáš Tinkl on 2016-09-22

Fix 2 failing color-related tests

Approved by: Michał Sawicz

2645. By Michael Terry on 2016-09-22

Update look of infographic a bit

Approved by: Albert Astals Cid

2646. By Michael Terry on 2016-09-22

Make infographic bubbles white even on the default wallpaper.

Approved by: Albert Astals Cid

2647. By Marco Trevisan (Treviño) on 2016-09-22

Indicators, mocks: add fake indicators menuitem to populate mocks with different menu types

Also allow to use fake indicators model in IndicatorsClient

Approved by: Albert Astals Cid, Lukáš Tinkl

2648. By Marco Trevisan (Treviño) on 2016-09-22

IndicatorsClient: use PageHeader and ListItemLayout's

Approved by: Albert Astals Cid

2649. By CI Train Bot Account on 2016-09-22

Releasing 8.14+16.10.20160922-0ubuntu1

2650. By CI Train Bot Account on 2016-09-26

Resync trunk.

2651. By Launchpad Translations on behalf of unity-team on 2016-09-27

Launchpad automatic translations update.

2652. By Launchpad Translations on behalf of unity-team on 2016-09-28

Launchpad automatic translations update.

2653. By Launchpad Translations on behalf of unity-team on 2016-09-29

Launchpad automatic translations update.

2654. By Launchpad Translations on behalf of unity-team on 2016-09-30

Launchpad automatic translations update.

2655. By Launchpad Translations on behalf of unity-team on 2016-10-03

Launchpad automatic translations update.

2656. By Michael Terry on 2016-10-04

* debian/control:
  - Drop unity-scope-mediascanner2 to a Suggests rather than a Recommends,
    to ease our transition to main. It's already seeded directly in
    Touch, so this will only affect the Desktop variant of unity8.

2657. By Launchpad Translations on behalf of unity-team on 2016-10-08

Launchpad automatic translations update.

2658. By Launchpad Translations on behalf of unity-team on 2016-10-18

Launchpad automatic translations update.

2659. By Launchpad Translations on behalf of unity-team on 2016-10-19

Launchpad automatic translations update.

2660. By Michael Terry on 2016-10-24

Grab launcher icon information from ubuntu-app-launch, not directly from desktop files.

Approved by: Michael Zanetti

2661. By Michael Terry on 2016-10-24

Adjust root paths if we're running inside a snap. (LP: #1629009)

Approved by: Lukáš Tinkl, Unity8 CI Bot

2662. By Michael Zanetti on 2016-10-24

Merge all Stages into one single codebase. Apply new spread visuals.

This deletes PhoneStage, TabletStage and DesktopStage, and merges all of the functionality into Stage. Also the spread visuals have been updated by design to work with all usage modes. (LP: #1489517, #1603914, #1635800)

Approved by: Lukáš Tinkl

2663. By Lukáš Tinkl on 2016-10-24

Restore the double tap decoration to maximize feature (LP: #1627281)

Approved by: Michael Zanetti

2664. By Andrea Azzarone on 2016-10-24

Remove UbuntuShapeForItem and replace its use with the more standard Ubuntu.Components.UbuntuShape.

Approved by: Albert Astals Cid, Lukáš Tinkl

2665. By Lukáš Tinkl on 2016-10-24

Hide the cursor for fullscreen apps after 3 seconds of inactivity

Approved by: Albert Astals Cid

2666. By Albert Astals Cid on 2016-10-24

Make PreviewProgress be thicker again

Last UITK landing reverted us to a very thin line, the code was a bit weird in which we both set implicitHeight and height in a bit of almost recursive fasion.

Make it simpler by just setting the height (LP: #1629382)

Approved by: Lukáš Tinkl, Unity8 CI Bot

2667. By Marco Trevisan (Treviño) on 2016-10-24

MenuItemFactory: use more features from SlotsLayout based settings components

Remove some legacy elements that were needed before

Approved by: Albert Astals Cid

2668. By Lukáš Tinkl on 2016-10-24

Implement moving windows by Alt + left mouse button

Approved by: Daniel d'Andrada

2669. By Albert Astals Cid on 2016-10-24

tst_PreviewZoomableImage: Wait for LazyImage transitions on init() (LP: #1630136)

Approved by: Lukáš Tinkl, Unity8 CI Bot

2670. By CI Train Bot Account on 2016-10-24

Releasing 8.14+17.04.20161024-0ubuntu1

2671. By Marco Trevisan (Treviño) on 2016-10-27

MenuItemFactory: activate item on calendar selection change

This informs the indicator-datetime to update the list of the upcoming events (LP: #1541125)

Approved by: Lukáš Tinkl

2672. By CI Train Bot Account on 2016-10-27

Releasing 8.14+17.04.20161027-0ubuntu1

2673. By CI Train Bot Account on 2016-11-07

Resync trunk.

2674. By Launchpad Translations on behalf of unity-team on 2016-11-08

Launchpad automatic translations update.

2675. By Andrea Cimitan on 2016-11-09

Remove background under header pagination dots, update dots assets, remove dash paper background, update bottom edge asset

Approved by: Albert Astals Cid, Unity8 CI Bot

2676. By Albert Astals Cid on 2016-11-09

Make more CardTool properties readonly

This removes "hacks" from GenericScopeView and moves them to either CardTool or CardGrid in a less "this is a hack" way

Approved by: Andrea Cimitan, Unity8 CI Bot

2677. By Andrea Cimitan on 2016-11-09

Few styling changes for cards

Approved by: Albert Astals Cid, Unity8 CI Bot

2678. By Albert Astals Cid on 2016-11-09

Make the > in Dash Section Header be after text

Instead than at the right of the view (LP: #1508905)

Approved by: Andrea Cimitan

2679. By Albert Astals Cid on 2016-11-09

Rework Dash Preview column margins

    If there's one column
     Preview widgets have 2GU on each side
      Unless it's one of the "full screen" widgets, i.e. video/image
     This hasn't changed in this patch

    If there's two columns
     the columns have 4GU on each side and between eachother
     This has changed according to design guidelines

Approved by: Andrea Cimitan, Unity8 CI Bot

2680. By Albert Astals Cid on 2016-11-09

Improve LVWPH <-> GenericScopeView interaction

Send up directly the delegate instead of the delegateIndex and then asking back for the delegate

Saves time and also if the delegateIndex is the same number but the delegate different the delegate won't be updated because QML doesn't know it's different (LP: #1508905, #1622423)

Approved by: Michael Zanetti, Paweł Stołowski, Unity8 CI Bot

2681. By Albert Astals Cid on 2016-11-09

Make the PreviewButtons be of the width of the button and not half the total width

half the total width is still the max width and the combos are still all the same width

Approved by: Andrea Cimitan, Unity8 CI Bot

2682. By Andrea Cimitan on 2016-11-09

various tweaks to fonts inside previews

Approved by: Albert Astals Cid

2683. By Albert Astals Cid on 2016-11-09

Fix first column of the preview table to be 25%

This way two consecutive tables have the second column start at the same X coordinate

Approved by: Andrea Cimitan

2684. By Andrea Cimitan on 2016-11-09

More visual tweaks

Approved by: Albert Astals Cid

2685. By Michael Terry on 2016-11-09

More path lookup fixes for running inside of a snap. (LP: #1629009)

Approved by: Michael Zanetti, Unity8 CI Bot

2686. By Michael Zanetti on 2016-11-09

Added blur and darkening to wallpaper while in spread

Approved by: Lukáš Tinkl

2687. By Michael Zanetti on 2016-11-09

Fixes in the spread after design review

- add a minimum width for the tile info to prevent it going to ...
- tiles should not be interactive any more when moving to spread
- add some resistance to the drag when an app is not closeable
- allow rotating when there is no app focused
- add a fade in animation to the icons in the spread
- fix spread looking out of place when there's only one item (LP: #1637502, #1638848)

Approved by: Lukáš Tinkl

2688. By Michael Zanetti on 2016-11-09

More fixes to the unified stages code (LP: #1637205, #1637249, #1637258)

Approved by: Lukáš Tinkl, Unity8 CI Bot

2689. By Michael Zanetti on 2016-11-09

Delay alt tab for tiny bit in order to avoid flickering on quick alt-tabs

Approved by: Lukáš Tinkl

2690. By Lukáš Tinkl on 2016-11-09

Stabilize test_doubleTapToMaximizeWindow()

Approved by: Michael Zanetti, Unity8 CI Bot

2691. By Brian Douglass on 2016-11-09

Add a new setting to enable/disable the launcher

Approved by: Michael Zanetti

2692. By Tomás Tormo on 2016-11-09

Reload Infographics userdata when the day changes (LP: #1378814)

Approved by: Albert Astals Cid

2693. By Lukáš Tinkl on 2016-11-09

Enable loading the main Qt catalog which in turn allows for using RTL languages

Approved by: Albert Astals Cid

2694. By Lukáš Tinkl on 2016-11-09

Fix the pixelated notification icon by setting sourceSize (LP: #1637712)

Approved by: Michael Zanetti, Unity8 CI Bot

2695. By CI Train Bot Account on 2016-11-09

Releasing 8.14+17.04.20161109-0ubuntu1

2696. By Launchpad Translations on behalf of unity-team on 2016-11-12

Launchpad automatic translations update.

2697. By Michael Zanetti on 2016-11-16

Stabilize OrientedShell tests

Approved by: Lukáš Tinkl, Unity8 CI Bot

2698. By CI Train Bot Account on 2016-11-16

* MenuItemFactory: bind calendar backend properties to calendarMenu item
  Adds support for showing the calendar at the requested date, marking days
  with events properly and toggling the visibility of the week number.
* Bump version as USC breaks with unity8 << 8.14

2699. By CI Train Bot Account on 2016-11-16

MenuItemFactory: use Menus.RadioMenu and Menus.ButtonMenu

2700. By Marco Trevisan (Treviño) on 2016-11-16

testLauncher: use tryCompare to check launcher contentY

Also init the launcher before each test

Approved by: Albert Astals Cid, Lukáš Tinkl, Unity8 CI Bot

2701. By Albert Astals Cid on 2016-11-16

[Hopefully] Fix infinite loop in some of the GSV tests

Potentially this could happen in real life too

Given rounding issues sometimes we ended up in a loop of showing the floatingSeeLess,
this makes the ScopeListView shorter which ends up in recalculation of whether floatingSeeLess
should be visible which then meant no and loop forever.

With this change i've run the test for 24 hours without it being stuck when previously it got stuck each 2 hours aprox (LP: #1599301)

Approved by: Michał Sawicz

2702. By CI Train Bot Account on 2016-11-16

Releasing 8.15+17.04.20161116.1-0ubuntu1

2703. By Launchpad Translations on behalf of unity-team on 2016-11-22

Launchpad automatic translations update.

2704. By Launchpad Translations on behalf of unity-team on 2016-11-23

Launchpad automatic translations update.

2705. By Andrea Cimitan on 2016-11-29

Fix white text (LP: #1644468)

Approved by: Albert Astals Cid, Unity8 CI Bot

2706. By Andrea Cimitan on 2016-11-29

Make MascotLoader in CardCreator flat

Approved by: Albert Astals Cid, Unity8 CI Bot

2707. By Andrea Cimitan on 2016-11-29

Make the remaining UbuntuShape flat

Approved by: Albert Astals Cid, Unity8 CI Bot

2708. By Andrea Cimitan on 2016-11-29

added dropshadow from panel indicators to dash page header extra panel, so there is right shadow when the extra panel is narrow

Approved by: Albert Astals Cid, Unity8 CI Bot

2709. By Andrea Cimitan on 2016-11-29

Look up for expandable template dash category flag

Approved by: Albert Astals Cid, Unity8 CI Bot

2710. By Albert Astals Cid on 2016-11-29

Fix PreviewProgress implicitHeight

We actually want this to be the height of the progressbar that we fix so use that and not the implicitHeight (LP: #1641943)

Approved by: Andrea Cimitan, Unity8 CI Bot

2711. By Andrea Azzarone on 2016-11-29

Set Mir.cursorName to "grabbing" on first mouse press on a window decoration. Don't wait for press+motion. (LP: #1618078)

Approved by: Lukáš Tinkl, Unity8 CI Bot

2712. By Andrea Azzarone on 2016-11-29

Do not show a divider between each quicklist entry but just between each section, similar to how unity7 does. (LP: #1637478)

Approved by: Albert Astals Cid, Unity8 CI Bot

2713. By Daniel d'Andrada on 2016-11-29

There's no need for WindowDecoration to access the appDelegate

It damages modularity.

Approved by: Michael Zanetti, Unity8 CI Bot

2714. By Brian Douglass on 2016-11-29

Added a setting to enable/disable the indicator dropdown menu.

Approved by: Michael Zanetti, Unity8 CI Bot

2715. By Michael Zanetti on 2016-11-29

disable spread interaction while locked (LP: #1641578)

Approved by: Lukáš Tinkl, Unity8 CI Bot

2716. By Olivier Tilloy on 2016-11-29

Remove dependency on transitional package. (LP: #1583079)

Approved by: Albert Astals Cid, Unity8 CI Bot

2717. By Lukáš Tinkl on 2016-11-29

Enable brightness (laptop backlight) handling on desktop/laptop PCs (LP: #1595947)

Approved by: Michael Zanetti, Unity8 CI Bot

2718. By Andrea Azzarone on 2016-11-29

Implement launcher tooltips.

Approved by: Michał Sawicz

2719. By Albert Astals Cid on 2016-11-29

Adapt to dummy notification being gone

and warning fix as bonus

Approved by: Lukáš Tinkl, Unity8 CI Bot

2720. By Albert Astals Cid on 2016-11-29

Fix autopilot test_lock_screen tests

Approved by: Andrea Cimitan, Unity8 CI Bot

2721. By Albert Astals Cid on 2016-11-29

Autopilot: Add more applications to the list for wider screens

Otherwise the test was failing because available_applications was too short

Approved by: Andrea Cimitan, Unity8 CI Bot

2722. By Albert Astals Cid on 2016-11-29

Fix autopilot DashHelperTestCase.test_search

Approved by: Andrea Cimitan, Unity8 CI Bot

2723. By Albert Astals Cid on 2016-11-29

Also install the Screens mock

This way we can run some more autopilot tests in X11

Approved by: Lukáš Tinkl, Unity8 CI Bot

2724. By Albert Astals Cid on 2016-11-29

Give default value to gu-px size

Fixes some of the autopilot greeter tests when run under X11

Approved by: Andrea Cimitan, Unity8 CI Bot

2725. By CI Train Bot Account on 2016-11-29

Releasing 8.15+17.04.20161129-0ubuntu1

2726. By Launchpad Translations on behalf of unity-team on 2016-12-01

Launchpad automatic translations update.

2727. By Lukáš Tinkl on 2016-12-07

Fix the Super key not invoking the dash scope home (LP: #1607427)

Approved by: Daniel d'Andrada, Unity8 CI Bot

2728. By Albert Astals Cid on 2016-12-07

Add the Wsuggest-override flag to gcc

While at it mark system includes as such so we don't get warnings we can not fix

Approved by: Michael Zanetti, Unity8 CI Bot

2729. By Albert Astals Cid on 2016-12-07

Add support for compiler sanitizers via ECM

2730. By Albert Astals Cid on 2016-12-07

Use timeStep as delay time

Passing iterations / speed didn't make much sense since that parameter is a delay in milliseconds and the default parameters would give a value of 5 / units.gu(10) that is smaller than 1 millisecond.

Qt 5.7 calculation for velocity was very unhappy if we moved things so fast in less than 1ms and ignored the movements, so this also makes tests pass on Qt 5.7 (LP: #1642919)

Approved by: Josh Arenson, Unity8 CI Bot

2731. By Michael Zanetti on 2016-12-07

Add the ApplicationDrawer

Approved by: Lukáš Tinkl, Unity8 CI Bot

2732. By Michael Zanetti on 2016-12-07

tune right edge push

make it less intrusive when accidentally hitting the edge with the mouse
tweak visuals for the mouse case (LP: #1646094)

Approved by: Unity8 CI Bot

2733. By Michael Zanetti on 2016-12-07

improve close button visiblity when hovering with the mouse

Approved by: Albert Astals Cid, Unity8 CI Bot

2734. By Albert Astals Cid on 2016-12-07

Bring back fix for 1517830

Now with autotest \o/ (LP: #1517830)

Approved by: Andrea Cimitan, Unity8 CI Bot

2735. By Daniel d'Andrada on 2016-12-07

Fix "make tryApplicationWindow"

No surface was showing up on the screen
Also remove outdated button (feature is no longer there)

Approved by: Albert Astals Cid, Unity8 CI Bot

2736. By Albert Astals Cid on 2016-12-07

Fix compile warnings in mocks

Approved by: Daniel d'Andrada, Unity8 CI Bot

2737. By Josh Arenson on 2016-12-07

Enable the greeter to remember which session the user last logged into

This also fixes a small issue with how the default session was handled. (LP: #1631365)

Approved by: Albert Astals Cid, Unity8 CI Bot

2738. By Daniel d'Andrada on 2016-12-07

Take save/restore functions out of WindowResizeArea

They've no relationship with resizing whatsoever.

Approved by: Lukáš Tinkl, Unity8 CI Bot

2739. By Michael Zanetti on 2016-12-07

Update virtual touchpad visuals and add a tutorial. (LP: #1585220)

Approved by: Lukáš Tinkl, Unity8 CI Bot

2740. By Albert Astals Cid on 2016-12-07

Do not hide panel when launching an application if the mouse is on the panel

Need Functions.itemUnderMouse because MouseArea.containsMouse returns true when tapping (i.e. no mouse used) on it.

Unfortunately the QML testlib do not set the proper value when issueing a mouseMove so i can't add a test that proofs it works, i'll try to propose something upstream and then add the test at a later MR (LP: #1591311)

Approved by: Lukáš Tinkl, Unity8 CI Bot

2741. By Pete Woods on 2016-12-07

MenuItemFactory: Add subtitle support to SwitchItem widget

Approved by: Marco Trevisan (Treviño), Michał Sawicz, Unity8 CI Bot

2742. By CI Train Bot Account on 2016-12-07

Releasing 8.15+17.04.20161207.1-0ubuntu1

2743. By Launchpad Translations on behalf of unity-team on 2016-12-15

Launchpad automatic translations update.

2744. By Daniel d'Andrada on 2016-12-15

Let the model deal with some window management decisions

eg: which window to focus, whether to change surface state

unity8 requests and reacts to changes in the model instead of applying them (LP: #1346633)

Approved by: Emanuele Antonio Faraone, Lukáš Tinkl

2745. By CI Train Bot Account on 2016-12-15

Releasing 8.15+17.04.20161215-0ubuntu1

2746. By CI Train Bot Account on 2016-12-22

Resync trunk.

2747. By Launchpad Translations on behalf of unity-team on 2016-12-23

Launchpad automatic translations update.

2748. By Launchpad Translations on behalf of unity-team on 2016-12-29

Launchpad automatic translations update.

2749. By Timo Jyrinki on 2017-01-10

No change rebuild

2750. By Michael Terry on 2017-01-10

Run the qmluitests.sh autopkg test against the installed package.

This is faster and more accurate than rebuilding unity8 and running tests from the build dir.

Approved by: Albert Astals Cid, Unity8 CI Bot

2751. By Nick Dedekind on 2017-01-10

Added registry for application menus

Approved by: Michael Zanetti, Unity8 CI Bot

2752. By Michał Sawicz on 2017-01-10

Application menus

2753. By Michael Zanetti on 2017-01-10

PreviewRatingInput: Use displayText instead of text to enable/disable the Send button (LP: #1595910)

Approved by: Andrea Cimitan, Christian Dywan, Unity8 CI Bot

2754. By Michael Zanetti on 2017-01-10

Add a D-Bus interface to control some debug facilities on the fly

Approved by: Gerry Boland, Unity8 CI Bot

2755. By Michael Zanetti on 2017-01-10

some launcher workarounds for the snapping

Approved by: Albert Astals Cid, Unity8 CI Bot

2756. By dobey on 2017-01-10

Remove the payments widget and dependency on libpay as no longer needed.

Approved by: Andrea Cimitan, Unity8 CI Bot

2757. By Lukáš Tinkl on 2017-01-10

Fix touch window controls being unreachable when the overlay is being displayed (LP: #1648167)

Approved by: Josh Arenson, Unity8 CI Bot

2758. By Albert Astals Cid on 2017-01-10

Give focus to one of the buttons of the dialog

This one you can use Tab/Alt+Tab to navigate through them.

Unfortunately there's still the problem that if there's some other elements that take focus (like indicators), focus will also travel through them, but this is an start.

Approved by: Daniel d'Andrada, Unity8 CI Bot

2759. By Albert Astals Cid on 2017-01-10

tst_WindowResizeArea: Use default values for mouseFlick speed and iterations (LP: #1651580)

Approved by: Daniel d'Andrada, Unity8 CI Bot

2760. By Albert Astals Cid on 2017-01-10

Require Qt 5.6 & misc fixes

Require Qt 5.6:
    We align with what we're really testing
    We can use Q_ENUM/Q_FLAG instead of Q_ENUMS/Q_FLAGS (Qt 5.5)

CursorImageInfo.cpp
    Join two QString::arg into one

SessionsModel.cpp
UsersModel.cpp
    Remove useless Q_D

dashconnection.cpp
ColorTheme.cpp
UserMetrics.cpp
horizontaljournaltest.cpp
listviewwithpageheadersectionexternalmodeltest.cpp
organicgridtest.cpp
verticaljournaltest.cpp
    QObjects should have the Q_OBJECT macro

indicatorsmodel.h
fakeindicatorsmodel.h
    There's no Roles enum, remove

appdrawerproxymodel.cpp
MirSurfaceItem.cpp
    Add & to the foreach variable

appdrawerproxymodel.cpp
    Make the string comparison faster

easingcurve.h
    Remove QEasingCurve::Type declaration, it's already in Qt

unitysortfilterproxymodelqml.h
fake_scopesoverview.h
    Make some parent functions accessible to remove clang warnings

PageList.cpp
unitymenumodel.cpp
qinputdeviceinfo_mock.cpp
    Better way to iterate the container

Greeter.cpp
    Cheaper env var checking

mediaplayer.cpp
mediaplayer.h
    Rename timerEvent, clang was not happy since QObject has another one

ApplicationInfo.h
    Mark as override

MockAppDrawerModel.cpp
launchermodeltest.cpp
screens.cpp
    Fix warning

fake_previewwidgetmodel.h
    Forward declare struct the same way it is defined later

fake_scopes.cpp
    Safer connect

horizontaljournaltest.cpp
verticaljournaltest.cpp
testutil.cpp
    Use at instead of [] in temporary

launchermodelastest.cpp
    Remove unused member
    Use toModelIndex() instead of value<QModelIndex>()

Approved by: Michael Zanetti, Unity8 CI Bot

2761. By Lukáš Tinkl on 2017-01-10

Fixup paths for window state storage in snappy environment

Approved by: Albert Astals Cid, Unity8 CI Bot

2762. By Josh Arenson on 2017-01-10

Allow the scopes list to automatically scroll when a scope is being dragged past the bounds of the screen. (LP: #1575319)

Approved by: Andrea Cimitan, Unity8 CI Bot

2763. By Daniel van Vugt on 2017-01-10

Deprecate usage of Mir's input resampling, instead opting for:
  Shell: Raw native input events
  Apps: Qt's built-in touch compression input resampling algorithm,
         and other toolkits are expected to provide their own.

This fixes LP: #1497105 nicely, allowing apps to receive the full-speed
input stream (if they ask their toolkit to give it to them).

As an added bonus this also eliminates the 0-16.9ms (average 8.4ms) of
input lag that apps under Unity8 would experience. We do still have the
problem of output lag making everything still look laggy but I am
working to eliminate that soon in Mir 0.26.0. (LP: #1497105, #1591328)

Approved by: Gerry Boland, Unity8 CI Bot

2764. By Lukáš Tinkl on 2017-01-10

Add Unity.Platform mock for our tests (LP: #1655336)

Approved by: Michał Sawicz

2765. By Michał Sawicz on 2017-01-10

Nuke leftover Platform in IndicatorsManager

Approved by: Nick Dedekind

2766. By CI Train Bot Account on 2017-01-10

Releasing 8.15+17.04.20170110.4-0ubuntu1

2767. By CI Train Bot Account on 2017-01-15

Resync trunk.

2768. By Launchpad Translations on behalf of unity-team on 2017-01-16

Launchpad automatic translations update.

2769. By Launchpad Translations on behalf of unity-team on 2017-01-18

Launchpad automatic translations update.

2770. By Launchpad Translations on behalf of unity-team on 2017-01-19

Launchpad automatic translations update.

2771. By Lukáš Tinkl on 2017-01-24

Fix keymap not being applied on the shell itself (LP: #1626435)

Approved by: Gerry Boland, Unity8 CI Bot

2772. By Albert Astals Cid on 2017-01-24

Limit tab-focus travelling on dialogs with a fence

Approved by: Lukáš Tinkl, Unity8 CI Bot

2773. By Lukáš Tinkl on 2017-01-24

Shell dialog improvements (kbd focus, mouse eater)

Approved by: Michael Zanetti, Unity8 CI Bot

2774. By Albert Astals Cid on 2017-01-24

Restore focus to where it was when our ShellDialogs get unloaded

UITK Dialogs want to have this feature but it seems to be broken, so i'm fixing it here first (since we use dialogs in a kind of special way)
I'll try to fix UITK next

Approved by: Andrea Cimitan, Unity8 CI Bot

2775. By Michael Terry on 2017-01-24

Simplify the lightdm mock to make future greeter improvements easier to test.

I simplified the mock liblightdm to avoid separate files for the Private classes. That can all go into the main files. The separation isn't worth wading through the files to find what you want.

And I dropped the mock LightDM plugin entirely. (opting instead for a tiny "mock()" API call on the real plugin that returns an object that can be used to manipulate our mock liblightdm, if we're in testing mode)

Approved by: Albert Astals Cid, Unity8 CI Bot

2776. By Josh Arenson on 2017-01-24

Add a test for the session chooser icon in the greeter's sessions list

Approved by: Albert Astals Cid, Unity8 CI Bot

2777. By Michael Terry on 2017-01-24

Add support for guest sessions in unity8-greeter.

Adds support for the "hasGuestAccount" and "selectGuest" LightDM hints and does so largely by having the users model report a "*guest" user, rather than adding special support in qml.

Approved by: Albert Astals Cid, Unity8 CI Bot

2778. By Michael Terry on 2017-01-24

Add support for LightDM hints for manual logins and hiding normal users.

Approved by: Albert Astals Cid, Unity8 CI Bot

2779. By Michael Terry on 2017-01-24

Use a model for PAM prompts, supporting more possible interactions.

- This lets us show more than one message and more than one prompt from PAM.

- We now also show error text when a user enters a wrong password. This matches unity7-greeter behavior.

- Similarly, when a fingerprint login is attempted, but we are demanding a real login (e.g. the user hasn't logged in before), we now show a message to explain that a bit.

- Simplify the Greeter/View interactions a bit. We no longer need to signal quite as much events, since the view reflects the prompts model directly.

- Fix keyboard focus highlight handling among prompts.

- Update and expand the tests.

Approved by: Albert Astals Cid

2780. By Albert Astals Cid on 2017-01-24

Update current session after changing the user

This matches unity7 greeter behaviour, i.e. if you change the session and then change the user, the session that shows up is the last session that new user logged in and not the new session you selected in the previous user

Approved by: Josh Arenson, Unity8 CI Bot

2781. By Albert Astals Cid on 2017-01-24

Add keyboard navigation for Indicators

Esc closes
Left/Right selects prev/next indicator

Approved by: Michael Zanetti, Unity8 CI Bot

2782. By Nick Dedekind on 2017-01-24

Added Alt+F10 shortcut to open app menus. (LP: #1656896)

Approved by: Albert Astals Cid, Unity8 CI Bot

2783. By Daniel d'Andrada on 2017-01-24

Simplify DecoratedWindow

Reduce the number of nested MouseAreas

Approved by: Nick Dedekind, Unity8 CI Bot

2784. By Nick Dedekind on 2017-01-24

Fixed menu layout width calculations. (LP: #1657050)

Approved by: Albert Astals Cid, Unity8 CI Bot

2785. By Michael Zanetti on 2017-01-24

hint the launcher to indicate a successful size change to the user (LP: #1646457)

Approved by: Lukáš Tinkl, Unity8 CI Bot

2786. By Lukáš Tinkl on 2017-01-24

Start searching directly as you type, w/o having to first focus/click the search field.

Approved by: Michael Zanetti, Unity8 CI Bot

2787. By Michael Zanetti on 2017-01-24

Improvements for the appdrawer

Allow cancelling of the reveal gesture
move the app store uri to a gsetting (LP: #1648173)

Approved by: Lukáš Tinkl, Unity8 CI Bot

2788. By Michael Zanetti on 2017-01-24

Adjust home key to still focus the dash instead of messing with the drawer

Approved by: Lukáš Tinkl

2789. By Albert Astals Cid on 2017-01-24

a window -> the current window

Approved by: Lukáš Tinkl

2790. By Lukáš Tinkl on 2017-01-24

Add a test for the real implementation of WindowStateStorage

Approved by: Albert Astals Cid, Unity8 CI Bot

2791. By Albert Astals Cid on 2017-01-24

There's no spreadDelegate_ anymore

Goes from ~9 to ~3 minutes

Approved by: Michael Zanetti, Unity8 CI Bot

2792. By Michael Terry on 2017-01-24

Fix grouping of autopkg output and allow optionally passing arguments to installed test scripts.

Approved by: Albert Astals Cid, Unity8 CI Bot

2793. By Lukáš Tinkl on 2017-01-24

Use a four finger gesture to open the drawer, much like in u7

Approved by: Michael Zanetti, Unity8 CI Bot

2794. By Michael Zanetti on 2017-01-24

allow 4 finger simulation with mousetouchadaptor

Approved by: Lukáš Tinkl, Unity8 CI Bot

2795. By Nick Dedekind on 2017-01-24

Skip Panel::test_drag_indicator_item_down_shows_menu

Approved by: Lukáš Tinkl, Michał Sawicz, Unity8 CI Bot

2796. By Daniel d'Andrada on 2017-01-24

Remove unnecessary warning message

It's being printed on every initialization for quite a while now and it's not prompting us
to perform any action. Thus this can't be really a warning if it's always there.

Approved by: Michael Zanetti, Unity8 CI Bot

2797. By CI Train Bot Account on 2017-01-24

Releasing 8.15+17.04.20170124-0ubuntu1

2798. By Launchpad Translations on behalf of unity-team on 2017-01-26

Launchpad automatic translations update.

2799. By Michael Terry on 2017-01-26

Drop IntegratedLightDM and always use system liblightdm instead

Unmerged revisions

2799. By Michael Terry on 2017-01-26

Drop IntegratedLightDM and always use system liblightdm instead

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-08-11 06:26:26 +0000
3+++ CMakeLists.txt 2016-08-25 20:40:06 +0000
4@@ -61,6 +61,7 @@
5 pkg_check_modules(GEONAMES REQUIRED geonames>=0.2)
6 pkg_check_modules(GIO REQUIRED gio-2.0>=2.32)
7 pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32)
8+pkg_check_modules(LIBLIGHTDM REQUIRED liblightdm-qt5-3)
9 pkg_check_modules(QMENUMODEL REQUIRED qmenumodel)
10 pkg_check_modules(GD3 REQUIRED gnome-desktop-3.0)
11
12
13=== modified file 'cmake/modules/QmlTest.cmake'
14--- cmake/modules/QmlTest.cmake 2016-03-04 15:07:31 +0000
15+++ cmake/modules/QmlTest.cmake 2016-08-25 20:40:06 +0000
16@@ -65,11 +65,11 @@
17 # This function wraps add_executable_test, see below for available arguments.
18
19 function(add_qml_unittest PATH COMPONENT_NAME)
20- import_executables(qmltestrunner)
21+ import_executables(dbus-run-session)
22
23- add_executable_test(${COMPONENT_NAME} qmltestrunner
24+ add_executable_test(${COMPONENT_NAME} dbus-run-session
25 ${ARGN}
26- ARGS -input ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml ${QMLTEST_ARGS}
27+ ARGS -- qmltestrunner -input ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml ${QMLTEST_ARGS}
28 )
29 endfunction()
30
31
32=== modified file 'debian/rules'
33--- debian/rules 2016-06-20 14:56:40 +0000
34+++ debian/rules 2016-08-25 20:40:06 +0000
35@@ -36,7 +36,3 @@
36 # use private lib directories
37 override_dh_makeshlibs:
38 dh_makeshlibs -Nunity8-private -Nunity8-fake-env
39-
40-# libMockLightDM-qml.so links against liblightdm-qt5-3.so which doesn't exist
41-override_dh_shlibdeps:
42- dh_shlibdeps -XlibMockLightDM-qml.so
43
44=== modified file 'plugins/AccountsService/AccountsService.cpp'
45--- plugins/AccountsService/AccountsService.cpp 2016-08-11 06:25:34 +0000
46+++ plugins/AccountsService/AccountsService.cpp 2016-08-25 20:40:06 +0000
47@@ -80,6 +80,7 @@
48 AccountsService::AccountsService(QObject* parent, const QString &user)
49 : QObject(parent)
50 , m_service(new AccountsServiceDBusAdaptor(this))
51+ , m_greeterMode(true)
52 {
53 m_unityInput = new QDBusInterface(QStringLiteral("com.canonical.Unity.Input"),
54 QStringLiteral("/com/canonical/Unity/Input"),
55@@ -155,6 +156,19 @@
56 refresh(!wasEmpty);
57 }
58
59+bool AccountsService::greeterMode() const
60+{
61+ return m_greeterMode;
62+}
63+
64+void AccountsService::setGreeterMode(bool greeterMode)
65+{
66+ if (m_greeterMode != greeterMode) {
67+ m_greeterMode = greeterMode;
68+ Q_EMIT greeterModeChanged();
69+ }
70+}
71+
72 bool AccountsService::demoEdges() const
73 {
74 auto value = getProperty(IFACE_UNITY, PROP_DEMO_EDGES);
75@@ -341,7 +355,19 @@
76 {
77 if (m_properties[interface][property].value != value) {
78 m_properties[interface][property].value = value;
79- m_service->setUserPropertyAsync(m_user, interface, property, value);
80+ if (m_greeterMode || m_user == g_get_user_name()) {
81+ // Only write any changes back to AccountsService if we are running
82+ // as a proper LightDM greeter (or are writing values for our own
83+ // user).
84+ // (A) Only the lightdm user has permission to set everyone's
85+ // properties.
86+ // (B) We don't want to have policykit throw up a password dialog
87+ // when we are running in the user session.
88+ // (C) We only write things to AS that are safe to ignore for other
89+ // users anyway (like failedLogins count, which does not NEED
90+ // to be persistent).
91+ m_service->setUserPropertyAsync(m_user, interface, property, value);
92+ }
93 emitChangedForProperty(interface, property);
94 }
95 }
96
97=== modified file 'plugins/AccountsService/AccountsService.h'
98--- plugins/AccountsService/AccountsService.h 2016-08-08 10:10:25 +0000
99+++ plugins/AccountsService/AccountsService.h 2016-08-25 20:40:06 +0000
100@@ -34,6 +34,10 @@
101 READ user
102 WRITE setUser
103 NOTIFY userChanged)
104+ Q_PROPERTY (bool greeterMode
105+ READ greeterMode
106+ WRITE setGreeterMode
107+ NOTIFY greeterModeChanged)
108 Q_PROPERTY (bool demoEdges
109 READ demoEdges
110 WRITE setDemoEdges
111@@ -92,6 +96,8 @@
112
113 QString user() const;
114 void setUser(const QString &user);
115+ bool greeterMode() const;
116+ void setGreeterMode(bool greeterMode);
117 bool demoEdges() const;
118 void setDemoEdges(bool demoEdges);
119 QStringList demoEdgesCompleted() const;
120@@ -119,6 +125,7 @@
121
122 Q_SIGNALS:
123 void userChanged();
124+ void greeterModeChanged();
125 void demoEdgesChanged();
126 void demoEdgesCompletedChanged();
127 void enableFingerprintIdentificationChanged();
128@@ -167,6 +174,7 @@
129 AccountsServiceDBusAdaptor *m_service;
130 QDBusInterface *m_unityInput;
131 QString m_user;
132+ bool m_greeterMode;
133 };
134
135 #endif
136
137=== modified file 'plugins/LightDM/CMakeLists.txt'
138--- plugins/LightDM/CMakeLists.txt 2016-03-02 02:54:30 +0000
139+++ plugins/LightDM/CMakeLists.txt 2016-08-25 20:40:06 +0000
140@@ -1,19 +1,20 @@
141 pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1)
142
143-find_package(Qt5Core REQUIRED)
144-find_package(Qt5Quick REQUIRED)
145-
146 include_directories(
147 ${CMAKE_CURRENT_SOURCE_DIR}
148 ${CMAKE_CURRENT_BINARY_DIR}
149 ${CMAKE_SOURCE_DIR}/plugins/Utils
150- ${CMAKE_BINARY_DIR}/tests/mocks/LightDM/IntegratedLightDM
151 ${libunity8-private_SOURCE_DIR}
152+ )
153+
154+include_directories(
155+ SYSTEM
156+ ${LIBLIGHTDM_INCLUDE_DIRS}
157 ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS}
158-)
159+ )
160
161-set(QMLPLUGIN_SRC
162- ../Utils/unitysortfilterproxymodelqml.cpp
163+add_library(LightDM-qml MODULE
164+ ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
165 DBusGreeter.cpp
166 DBusGreeterList.cpp
167 Greeter.cpp
168@@ -22,5 +23,11 @@
169 UsersModel.cpp
170 )
171
172-add_subdirectory(FullLightDM)
173-add_subdirectory(IntegratedLightDM)
174+target_link_libraries(LightDM-qml
175+ unity8-private
176+ ${LIBLIGHTDM_LDFLAGS}
177+ ${LIBUSERMETRICSOUTPUT_LDFLAGS}
178+ )
179+
180+qt5_use_modules(LightDM-qml DBus Gui Qml)
181+add_unity8_plugin(LightDM 0.1 LightDM TARGETS LightDM-qml)
182
183=== removed directory 'plugins/LightDM/FullLightDM'
184=== removed file 'plugins/LightDM/FullLightDM/CMakeLists.txt'
185--- plugins/LightDM/FullLightDM/CMakeLists.txt 2016-07-08 15:44:53 +0000
186+++ plugins/LightDM/FullLightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000
187@@ -1,28 +0,0 @@
188-pkg_check_modules(LIBLIGHTDM REQUIRED liblightdm-qt5-3)
189-
190-set(PLUGIN_CLASSNAME "FullLightDM")
191-
192-add_definitions(-DFULL_LIGHTDM)
193-
194-include_directories(
195- ../
196- ${LIBLIGHTDM_INCLUDE_DIRS}
197- ${CMAKE_CURRENT_BINARY_DIR}
198- )
199-
200-foreach(source_file ${QMLPLUGIN_SRC})
201- list(APPEND RELATIVE_QMLPLUGIN_SRC ../${source_file})
202-endforeach()
203-
204-add_library(FullLightDM-qml MODULE
205- ${RELATIVE_QMLPLUGIN_SRC}
206- )
207-
208-target_link_libraries(FullLightDM-qml
209- unity8-private
210- ${LIBLIGHTDM_LDFLAGS}
211- ${LIBUSERMETRICSOUTPUT_LDFLAGS}
212- )
213-
214-qt5_use_modules(FullLightDM-qml DBus Gui Qml)
215-add_unity8_plugin(FullLightDM 0.1 LightDM/FullLightDM TARGETS FullLightDM-qml)
216
217=== modified file 'plugins/LightDM/Greeter.cpp'
218--- plugins/LightDM/Greeter.cpp 2016-06-13 20:08:35 +0000
219+++ plugins/LightDM/Greeter.cpp 2016-08-25 20:40:06 +0000
220@@ -147,3 +147,9 @@
221 Q_EMIT isAuthenticatedChanged();
222 Q_EMIT authenticationComplete();
223 }
224+
225+QObject *Greeter::mock()
226+{
227+ Q_D(Greeter);
228+ return d->m_greeter->property("mock").value<QObject*>();
229+}
230
231=== modified file 'plugins/LightDM/Greeter.h'
232--- plugins/LightDM/Greeter.h 2016-06-13 20:08:35 +0000
233+++ plugins/LightDM/Greeter.h 2016-08-25 20:40:06 +0000
234@@ -40,6 +40,8 @@
235 Q_PROPERTY(bool promptless READ promptless NOTIFY promptlessChanged)
236 Q_PROPERTY(QString selectUser READ selectUser CONSTANT)
237
238+ Q_PROPERTY(QObject *mock READ mock CONSTANT) // for testing
239+
240 public:
241 explicit Greeter(QObject* parent=0);
242
243@@ -50,6 +52,8 @@
244 bool promptless() const;
245 QString selectUser() const;
246
247+ QObject *mock();
248+
249 public Q_SLOTS:
250 void authenticate(const QString &username=QString());
251 void respond(const QString &response);
252
253=== removed directory 'plugins/LightDM/IntegratedLightDM'
254=== removed file 'plugins/LightDM/IntegratedLightDM/CMakeLists.txt'
255--- plugins/LightDM/IntegratedLightDM/CMakeLists.txt 2016-07-08 15:44:53 +0000
256+++ plugins/LightDM/IntegratedLightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000
257@@ -1,33 +0,0 @@
258-set(PLUGIN_CLASSNAME "IntegratedLightDM")
259-
260-add_definitions(-DINTEGRATED_LIGHTDM)
261-
262-foreach(include_directory ${QMLPLUGIN_INCLUDES})
263- list(APPEND RELATIVE_QMLPLUGIN_INCLUDES ../${include_directory})
264-endforeach()
265-
266-include_directories(
267- . #QLightDM
268- ${QMLPLUGIN_INCLUDES}
269- ${libunity8-private_SOURCE_DIR}
270- ${CMAKE_CURRENT_BINARY_DIR}
271-)
272-
273-foreach(source_file ${QMLPLUGIN_SRC})
274- list(APPEND RELATIVE_QMLPLUGIN_SRC ../${source_file})
275-endforeach()
276-
277-add_library(IntegratedLightDM-qml MODULE
278- ${RELATIVE_QMLPLUGIN_SRC}
279- )
280-
281-target_link_libraries(IntegratedLightDM-qml
282- integratedLightDM
283- unity8-private
284- ${LIBUSERMETRICSOUTPUT_LDFLAGS}
285- )
286-
287-qt5_use_modules(IntegratedLightDM-qml DBus Gui Qml)
288-add_unity8_plugin(IntegratedLightDM 0.1 LightDM/IntegratedLightDM TARGETS IntegratedLightDM-qml)
289-
290-add_subdirectory(liblightdm)
291
292=== removed directory 'plugins/LightDM/IntegratedLightDM/QLightDM'
293=== removed file 'plugins/LightDM/IntegratedLightDM/QLightDM/Greeter'
294--- plugins/LightDM/IntegratedLightDM/QLightDM/Greeter 2016-06-13 21:21:57 +0000
295+++ plugins/LightDM/IntegratedLightDM/QLightDM/Greeter 1970-01-01 00:00:00 +0000
296@@ -1,17 +0,0 @@
297-/*
298- * Copyright (C) 2016 Canonical, Ltd.
299- *
300- * This program is free software; you can redistribute it and/or modify
301- * it under the terms of the GNU General Public License as published by
302- * the Free Software Foundation; version 3.
303- *
304- * This program is distributed in the hope that it will be useful,
305- * but WITHOUT ANY WARRANTY; without even the implied warranty of
306- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
307- * GNU General Public License for more details.
308- *
309- * You should have received a copy of the GNU General Public License
310- * along with this program. If not, see <http://www.gnu.org/licenses/>.
311- */
312-
313-#include "../liblightdm/Greeter.h"
314
315=== removed file 'plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel'
316--- plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel 2016-06-13 21:21:57 +0000
317+++ plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel 1970-01-01 00:00:00 +0000
318@@ -1,17 +0,0 @@
319-/*
320- * Copyright (C) 2016 Canonical, Ltd.
321- *
322- * This program is free software; you can redistribute it and/or modify
323- * it under the terms of the GNU General Public License as published by
324- * the Free Software Foundation; version 3.
325- *
326- * This program is distributed in the hope that it will be useful,
327- * but WITHOUT ANY WARRANTY; without even the implied warranty of
328- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
329- * GNU General Public License for more details.
330- *
331- * You should have received a copy of the GNU General Public License
332- * along with this program. If not, see <http://www.gnu.org/licenses/>.
333- */
334-
335-#include "../liblightdm/SessionsModel.h"
336
337=== removed file 'plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel'
338--- plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel 2016-06-13 21:21:57 +0000
339+++ plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel 1970-01-01 00:00:00 +0000
340@@ -1,17 +0,0 @@
341-/*
342- * Copyright (C) 2016 Canonical, Ltd.
343- *
344- * This program is free software; you can redistribute it and/or modify
345- * it under the terms of the GNU General Public License as published by
346- * the Free Software Foundation; version 3.
347- *
348- * This program is distributed in the hope that it will be useful,
349- * but WITHOUT ANY WARRANTY; without even the implied warranty of
350- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
351- * GNU General Public License for more details.
352- *
353- * You should have received a copy of the GNU General Public License
354- * along with this program. If not, see <http://www.gnu.org/licenses/>.
355- */
356-
357-#include "../liblightdm/UsersModel.h"
358
359=== removed directory 'plugins/LightDM/IntegratedLightDM/liblightdm'
360=== removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt'
361--- plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt 2016-03-17 16:51:38 +0000
362+++ plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt 1970-01-01 00:00:00 +0000
363@@ -1,55 +0,0 @@
364-pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1)
365-
366-set(LibLightDM_SOURCES
367- Greeter.cpp
368- SessionsModel.cpp
369- UsersModel.cpp
370- GreeterPrivate.cpp
371- SessionsModelPrivate.cpp
372- UsersModelPrivate.cpp
373- ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsServiceDBusAdaptor.cpp
374- ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
375- )
376-
377-add_library(integratedLightDM STATIC ${LibLightDM_SOURCES})
378-add_library(integratedLightDMSession STATIC ${LibLightDM_SOURCES})
379-add_library(MockLightDM-demo-shared SHARED ${LibLightDM_SOURCES})
380-
381-include_directories(
382- ${CMAKE_SOURCE_DIR}/plugins/AccountsService
383- ${CMAKE_CURRENT_BINARY_DIR}
384- ${GLIB_INCLUDE_DIRS}
385- ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS}
386-)
387-
388-target_link_libraries(integratedLightDM
389- ${GLIB_LIBRARIES}
390- ${LIBUSERMETRICSOUTPUT_LDFLAGS}
391- -lpam
392-)
393-target_link_libraries(integratedLightDMSession
394- ${GLIB_LIBRARIES}
395- ${LIBUSERMETRICSOUTPUT_LDFLAGS}
396- -lpam
397-)
398-target_link_libraries(MockLightDM-demo-shared
399- ${GLIB_LIBRARIES}
400- ${LIBUSERMETRICSOUTPUT_LDFLAGS}
401- -lpam
402-)
403-
404-qt5_use_modules(integratedLightDM Concurrent DBus Gui)
405-qt5_use_modules(integratedLightDMSession Concurrent DBus Gui)
406-qt5_use_modules(MockLightDM-demo-shared Concurrent DBus Gui)
407-
408-set_target_properties(integratedLightDM PROPERTIES
409- COMPILE_FLAGS "-DSM_BUSNAME=systemBus -fPIC")
410-set_target_properties(integratedLightDMSession PROPERTIES
411- COMPILE_FLAGS "-DSM_BUSNAME=sessionBus -fPIC")
412-set_target_properties(MockLightDM-demo-shared PROPERTIES
413- COMPILE_FLAGS "-DSM_BUSNAME=systemBus"
414- OUTPUT_NAME lightdm-qt5-3)
415-
416-install(TARGETS MockLightDM-demo-shared
417- DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/demo
418- )
419
420=== removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp'
421--- plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp 2016-03-02 02:37:37 +0000
422+++ plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp 1970-01-01 00:00:00 +0000
423@@ -1,184 +0,0 @@
424-/*
425- * Copyright (C) 2013 Canonical, Ltd.
426- *
427- * This program is free software; you can redistribute it and/or modify
428- * it under the terms of the GNU General Public License as published by
429- * the Free Software Foundation; version 3.
430- *
431- * This program is distributed in the hope that it will be useful,
432- * but WITHOUT ANY WARRANTY; without even the implied warranty of
433- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
434- * GNU General Public License for more details.
435- *
436- * You should have received a copy of the GNU General Public License
437- * along with this program. If not, see <http://www.gnu.org/licenses/>.
438- *
439- * Author: Michael Terry <michael.terry@canonical.com>
440- */
441-
442-
443-/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
444- * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
445- * COUNTERPART IN tests/mocks/Lightdm/liblightdm
446- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
447-
448-
449-#include "Greeter.h"
450-#include "GreeterPrivate.h"
451-#include <QtCore/QCoreApplication>
452-#include <QTimer>
453-
454-namespace QLightDM
455-{
456-
457-Greeter::Greeter(QObject *parent)
458- : QObject(parent),
459- d_ptr(new GreeterPrivate(this))
460-{
461-}
462-
463-Greeter::~Greeter()
464-{
465-}
466-
467-QString Greeter::authenticationUser() const
468-{
469- Q_D(const Greeter);
470- return d->authenticationUser;
471-}
472-
473-bool Greeter::hasGuestAccountHint() const
474-{
475- return true;
476-}
477-
478-QString Greeter::getHint(const QString &name) const
479-{
480- Q_UNUSED(name)
481- return QLatin1String("");
482-}
483-
484-QString Greeter::defaultSessionHint() const
485-{
486- return QStringLiteral("ubuntu");
487-}
488-
489-bool Greeter::hideUsersHint() const
490-{
491- return false;
492-}
493-
494-bool Greeter::showManualLoginHint() const
495-{
496- return true;
497-}
498-
499-bool Greeter::showRemoteLoginHint() const
500-{
501- return true;
502-}
503-
504-bool Greeter::lockHint () const
505-{
506- return false;
507-}
508-
509-QString Greeter::selectUserHint() const
510-{
511- return QLatin1String("");
512-}
513-
514-bool Greeter::selectGuestHint() const
515-{
516- return false;
517-}
518-
519-QString Greeter::autologinUserHint() const
520-{
521- return QLatin1String("");
522-}
523-
524-bool Greeter::autologinGuestHint() const
525-{
526- return false;
527-}
528-
529-int Greeter::autologinTimeoutHint() const
530-{
531- return 0;
532-}
533-
534-bool Greeter::inAuthentication() const
535-{
536- return false;
537-}
538-
539-QString Greeter::hostname() const
540-{
541- return QStringLiteral("hostname1");
542-}
543-
544-bool Greeter::isAuthenticated() const
545-{
546- Q_D(const Greeter);
547- return d->authenticated;
548-}
549-
550-bool Greeter::connectSync()
551-{
552- return true;
553-}
554-
555-void Greeter::authenticate(const QString &username)
556-{
557- Q_D(Greeter);
558-
559- d->authenticated = false;
560- d->authenticationUser = username;
561- d->handleAuthenticate();
562-}
563-
564-void Greeter::authenticateAsGuest()
565-{}
566-
567-void Greeter::authenticateAutologin()
568-{}
569-
570-void Greeter::authenticateRemote(const QString &session, const QString &username)
571-{
572- Q_UNUSED(session)
573- Q_UNUSED(username)
574-}
575-
576-void Greeter::cancelAuthentication()
577-{}
578-
579-void Greeter::setLanguage (const QString &language)
580-{
581- Q_UNUSED(language)
582-}
583-
584-bool Greeter::startSessionSync(const QString &session)
585-{
586- Q_UNUSED(session)
587- return true;
588-}
589-
590-void Greeter::respond(const QString &response)
591-{
592- Q_D(Greeter);
593-
594- d->handleRespond(response);
595-}
596-
597-void Greeter::sendAuthenticationComplete()
598-{
599- if (qEnvironmentVariableIsEmpty("UNITY_TESTING")) {
600- // simulate PAM's delay
601- QTimer::singleShot(1000, this, &Greeter::authenticationComplete);
602- } else {
603- Q_EMIT authenticationComplete();
604- }
605-}
606-
607-}
608
609=== removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h'
610--- plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h 2015-09-11 13:38:45 +0000
611+++ plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h 1970-01-01 00:00:00 +0000
612@@ -1,110 +0,0 @@
613-/*
614- * Copyright (C) 2013 Canonical, Ltd.
615- * Copyright (C) 2010-2011 David Edmundson.
616- * Copyright (C) 2010-2011 Robert Ancell
617- *
618- * This program is free software; you can redistribute it and/or modify
619- * it under the terms of the GNU General Public License as published by
620- * the Free Software Foundation; version 3.
621- *
622- * This program is distributed in the hope that it will be useful,
623- * but WITHOUT ANY WARRANTY; without even the implied warranty of
624- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
625- * GNU General Public License for more details.
626- *
627- * You should have received a copy of the GNU General Public License
628- * along with this program. If not, see <http://www.gnu.org/licenses/>.
629- *
630- * Author: David Edmundson <kde@davidedmundson.co.uk>
631- */
632-
633-#ifndef UNITY_MOCK_GREETER_H
634-#define UNITY_MOCK_GREETER_H
635-
636-#include <QtCore/QObject>
637-#include <QtCore/QVariant>
638-
639-/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
640- * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
641- * COUNTERPART IN tests/mocks/Lightdm/liblightdm
642- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
643-
644-namespace QLightDM
645-{
646- class GreeterPrivate;
647-
648-class Q_DECL_EXPORT Greeter : public QObject
649-{
650- Q_OBJECT
651-
652- Q_PROPERTY(bool authenticated READ isAuthenticated ) //NOTFIY authenticationComplete
653- Q_PROPERTY(QString authenticationUser READ authenticationUser )
654- Q_PROPERTY(QString defaultSession READ defaultSessionHint CONSTANT)
655- Q_PROPERTY(QString selectUser READ selectUserHint CONSTANT)
656- Q_PROPERTY(bool selectGuest READ selectGuestHint CONSTANT)
657-
658- Q_PROPERTY(QString hostname READ hostname CONSTANT)
659- Q_PROPERTY(bool hasGuestAccount READ hasGuestAccountHint CONSTANT)
660- Q_PROPERTY(bool locked READ lockHint CONSTANT)
661-
662- Q_ENUMS(PromptType MessageType)
663-
664-public:
665- enum PromptType {
666- PromptTypeQuestion,
667- PromptTypeSecret
668- };
669-
670- enum MessageType {
671- MessageTypeInfo,
672- MessageTypeError
673- };
674-
675- explicit Greeter(QObject* parent=0);
676- virtual ~Greeter();
677-
678- QString getHint(const QString &name) const;
679- QString defaultSessionHint() const;
680- bool hideUsersHint() const;
681- bool showManualLoginHint() const;
682- bool showRemoteLoginHint() const;
683- bool lockHint () const;
684- bool hasGuestAccountHint() const;
685- QString selectUserHint() const;
686- bool selectGuestHint() const;
687- QString autologinUserHint() const;
688- bool autologinGuestHint() const;
689- int autologinTimeoutHint() const;
690-
691- bool inAuthentication() const;
692- bool isAuthenticated() const;
693- QString authenticationUser() const;
694- QString hostname() const;
695-
696-public Q_SLOTS:
697- bool connectSync();
698- void authenticate(const QString &username=QString());
699- void authenticateAsGuest();
700- void authenticateAutologin();
701- void authenticateRemote(const QString &session=QString(), const QString &username=QString());
702- void respond(const QString &response);
703- void cancelAuthentication();
704- void setLanguage (const QString &language);
705- bool startSessionSync(const QString &session=QString());
706-
707-Q_SIGNALS:
708- void showMessage(QString text, QLightDM::Greeter::MessageType type);
709- void showPrompt(QString text, QLightDM::Greeter::PromptType type);
710- void authenticationComplete();
711- void autologinTimerExpired();
712-
713-protected:
714- void sendAuthenticationComplete();
715-
716-private:
717- GreeterPrivate *d_ptr;
718- Q_DECLARE_PRIVATE(Greeter)
719-};
720-}
721-
722-#endif // UNITY_MOCK_GREETER_H
723
724=== removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp'
725--- plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp 2015-11-02 17:22:30 +0000
726+++ plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp 1970-01-01 00:00:00 +0000
727@@ -1,304 +0,0 @@
728-/*
729- * Copyright (C) 2013 Canonical, Ltd.
730- *
731- * This program is free software; you can redistribute it and/or modify
732- * it under the terms of the GNU General Public License as published by
733- * the Free Software Foundation; version 3.
734- *
735- * This program is distributed in the hope that it will be useful,
736- * but WITHOUT ANY WARRANTY; without even the implied warranty of
737- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
738- * GNU General Public License for more details.
739- *
740- * You should have received a copy of the GNU General Public License
741- * along with this program. If not, see <http://www.gnu.org/licenses/>.
742- *
743- * Author: Michael Terry <michael.terry@canonical.com>
744- */
745-
746-#include "Greeter.h"
747-#include "GreeterPrivate.h"
748-#include <QFuture>
749-#include <QFutureInterface>
750-#include <QFutureWatcher>
751-#include <QQueue>
752-#include <QtConcurrent>
753-#include <QVector>
754-#include <security/pam_appl.h>
755-
756-namespace QLightDM
757-{
758-
759-class GreeterImpl : public QObject
760-{
761- Q_OBJECT
762-
763- struct AppData
764- {
765- GreeterImpl *impl;
766- pam_handle *handle;
767- };
768-
769- typedef QFutureInterface<QString> ResponseFuture;
770-
771-public:
772- explicit GreeterImpl(Greeter *parent, GreeterPrivate *greeterPrivate)
773- : QObject(parent),
774- greeter(parent),
775- greeterPrivate(greeterPrivate),
776- pamHandle(nullptr)
777- {
778- qRegisterMetaType<QLightDM::GreeterImpl::ResponseFuture>("QLightDM::GreeterImpl::ResponseFuture");
779-
780- connect(&futureWatcher, &QFutureWatcher<int>::finished, this, &GreeterImpl::finishPam);
781- connect(this, SIGNAL(showMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)),
782- this, SLOT(handleMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)));
783- // This next connect is how we pass ResponseFutures between threads
784- connect(this, SIGNAL(showPrompt(pam_handle *, QString, QLightDM::Greeter::PromptType, QLightDM::GreeterImpl::ResponseFuture)),
785- this, SLOT(handlePrompt(pam_handle *, QString, QLightDM::Greeter::PromptType, QLightDM::GreeterImpl::ResponseFuture)),
786- Qt::BlockingQueuedConnection);
787- }
788-
789- ~GreeterImpl()
790- {
791- cancelPam();
792- }
793-
794- void start(QString username)
795- {
796- // Clear out any existing PAM interactions first
797- cancelPam();
798- if (pamHandle != nullptr) {
799- // While we were cancelling pam above, we processed Qt events.
800- // Which may have allowed someone to call start() on us again.
801- // In which case, we'll bail on our current start() call.
802- // This isn't racy because it's all in the same thread.
803- return;
804- }
805-
806- AppData *appData = new AppData();
807- appData->impl = this;
808-
809- // Now actually start a new conversation with PAM
810- pam_conv conversation;
811- conversation.conv = converseWithPam;
812- conversation.appdata_ptr = static_cast<void*>(appData);
813-
814- if (pam_start("lightdm", username.toUtf8(), &conversation, &pamHandle) == PAM_SUCCESS) {
815- appData->handle = pamHandle;
816- futureWatcher.setFuture(QtConcurrent::mapped(QList<pam_handle*>() << pamHandle, authenticateWithPam));
817- } else {
818- delete appData;
819- greeterPrivate->authenticated = false;
820- Q_EMIT greeter->showMessage(QStringLiteral("Internal error: could not start PAM authentication"), QLightDM::Greeter::MessageTypeError);
821- Q_EMIT greeter->authenticationComplete();
822- }
823- }
824-
825- static int authenticateWithPam(pam_handle* const& pamHandle)
826- {
827- int pamStatus = pam_authenticate(pamHandle, 0);
828- if (pamStatus == PAM_SUCCESS) {
829- pamStatus = pam_acct_mgmt(pamHandle, 0);
830- }
831- if (pamStatus == PAM_NEW_AUTHTOK_REQD) {
832- pamStatus = pam_chauthtok(pamHandle, PAM_CHANGE_EXPIRED_AUTHTOK);
833- }
834- if (pamStatus == PAM_SUCCESS) {
835- pam_setcred(pamHandle, PAM_REINITIALIZE_CRED);
836- }
837- return pamStatus;
838- }
839-
840- static int converseWithPam(int num_msg, const pam_message** msg,
841- pam_response** resp, void* appdata_ptr)
842- {
843- if (num_msg <= 0)
844- return PAM_CONV_ERR;
845-
846- auto* tmp_response = static_cast<pam_response*>(calloc(num_msg, sizeof(pam_response)));
847- if (!tmp_response)
848- return PAM_CONV_ERR;
849-
850- AppData *appData = static_cast<AppData*>(appdata_ptr);
851- GreeterImpl *impl = appData->impl;
852- pam_handle *handle = appData->handle;
853-
854- int count;
855- QVector<ResponseFuture> responses;
856-
857- for (count = 0; count < num_msg; ++count)
858- {
859- switch (msg[count]->msg_style)
860- {
861- case PAM_PROMPT_ECHO_ON:
862- {
863- QString message(msg[count]->msg);
864- responses.append(ResponseFuture());
865- responses.last().reportStarted();
866- Q_EMIT impl->showPrompt(handle, message, Greeter::PromptTypeQuestion, responses.last());
867- break;
868- }
869- case PAM_PROMPT_ECHO_OFF:
870- {
871- QString message(msg[count]->msg);
872- responses.append(ResponseFuture());
873- responses.last().reportStarted();
874- Q_EMIT impl->showPrompt(handle, message, Greeter::PromptTypeSecret, responses.last());
875- break;
876- }
877- case PAM_TEXT_INFO:
878- {
879- QString message(msg[count]->msg);
880- Q_EMIT impl->showMessage(handle, message, Greeter::MessageTypeInfo);
881- break;
882- }
883- default:
884- {
885- QString message(msg[count]->msg);
886- Q_EMIT impl->showMessage(handle, message, Greeter::MessageTypeError);
887- break;
888- }
889- }
890- }
891-
892- int i = 0;
893- bool raise_error = false;
894-
895- for (auto &response : responses)
896- {
897- pam_response* resp_item = &tmp_response[i++];
898- resp_item->resp_retcode = 0;
899- resp_item->resp = strdup(response.future().result().toUtf8());
900-
901- if (!resp_item->resp)
902- {
903- raise_error = true;
904- break;
905- }
906- }
907-
908- delete appData;
909-
910- if (raise_error)
911- {
912- for (int i = 0; i < count; ++i)
913- free(tmp_response[i].resp);
914-
915- free(tmp_response);
916- return PAM_CONV_ERR;
917- }
918- else
919- {
920- *resp = tmp_response;
921- return PAM_SUCCESS;
922- }
923- }
924-
925-public Q_SLOTS:
926- bool respond(QString response)
927- {
928- if (!futures.isEmpty()) {
929- futures.dequeue().reportFinished(&response);
930- return true;
931- } else {
932- return false;
933- }
934- }
935-
936-Q_SIGNALS:
937- void showMessage(pam_handle *handle, QString text, QLightDM::Greeter::MessageType type);
938- void showPrompt(pam_handle *handle, QString text, QLightDM::Greeter::PromptType type, QLightDM::GreeterImpl::ResponseFuture response);
939-
940-private Q_SLOTS:
941- void finishPam()
942- {
943- if (pamHandle == nullptr) {
944- return;
945- }
946-
947- int pamStatus = futureWatcher.result();
948-
949- pam_end(pamHandle, pamStatus);
950- pamHandle = nullptr;
951-
952- greeterPrivate->authenticated = (pamStatus == PAM_SUCCESS);
953- Q_EMIT greeter->authenticationComplete();
954- }
955-
956- void handleMessage(pam_handle *handle, QString text, QLightDM::Greeter::MessageType type)
957- {
958- if (handle != pamHandle)
959- return;
960-
961- Q_EMIT greeter->showMessage(text, type);
962- }
963-
964- void handlePrompt(pam_handle *handle, QString text, QLightDM::Greeter::PromptType type, QLightDM::GreeterImpl::ResponseFuture future)
965- {
966- if (handle != pamHandle) {
967- future.reportResult(QString());
968- future.reportFinished();
969- return;
970- }
971-
972- futures.enqueue(future);
973- Q_EMIT greeter->showPrompt(text, type);
974- }
975-
976-private:
977- void cancelPam()
978- {
979- if (pamHandle != nullptr) {
980- QFuture<int> pamFuture = futureWatcher.future();
981- pam_handle *handle = pamHandle;
982- pamHandle = nullptr; // to disable normal finishPam() handling
983- pamFuture.cancel();
984-
985- // Note the empty loop, we just want to clear the futures queue.
986- // Any further prompts from the pam thread will be immediately
987- // responded to/dismissed in handlePrompt().
988- while (respond(QString()));
989-
990- // Now let signal/slot handling happen so the thread can finish
991- while (!pamFuture.isFinished()) {
992- QCoreApplication::processEvents();
993- }
994-
995- pam_end(handle, PAM_CONV_ERR);
996- }
997- }
998-
999- Greeter *greeter;
1000- GreeterPrivate *greeterPrivate;
1001- pam_handle* pamHandle;
1002- QFutureWatcher<int> futureWatcher;
1003- QQueue<ResponseFuture> futures;
1004-};
1005-
1006-GreeterPrivate::GreeterPrivate(Greeter* parent)
1007- : authenticated(false),
1008- authenticationUser(),
1009- m_impl(new GreeterImpl(parent, this)),
1010- q_ptr(parent)
1011-{
1012-}
1013-
1014-GreeterPrivate::~GreeterPrivate()
1015-{
1016- delete m_impl;
1017-}
1018-
1019-void GreeterPrivate::handleAuthenticate()
1020-{
1021- m_impl->start(authenticationUser);
1022-}
1023-
1024-void GreeterPrivate::handleRespond(const QString &response)
1025-{
1026- m_impl->respond(response);
1027-}
1028-
1029-}
1030-
1031-#include "GreeterPrivate.moc"
1032
1033=== removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h'
1034--- plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 2015-09-11 13:38:45 +0000
1035+++ plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 1970-01-01 00:00:00 +0000
1036@@ -1,51 +0,0 @@
1037-/*
1038- * Copyright (C) 2013 Canonical, Ltd.
1039- *
1040- * This program is free software; you can redistribute it and/or modify
1041- * it under the terms of the GNU General Public License as published by
1042- * the Free Software Foundation; version 3.
1043- *
1044- * This program is distributed in the hope that it will be useful,
1045- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1046- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1047- * GNU General Public License for more details.
1048- *
1049- * You should have received a copy of the GNU General Public License
1050- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1051- *
1052- * Author: Michael Terry <michael.terry@canonical.com>
1053- */
1054-
1055-#ifndef UNITY_MOCK_GREETER_PRIVATE_H
1056-#define UNITY_MOCK_GREETER_PRIVATE_H
1057-
1058-#include <QtCore/QObject>
1059-
1060-namespace QLightDM
1061-{
1062-class Greeter;
1063-class GreeterImpl;
1064-
1065-class GreeterPrivate
1066-{
1067-public:
1068- explicit GreeterPrivate(Greeter* parent=0);
1069- virtual ~GreeterPrivate();
1070-
1071- // These variables may not be used by all subclasses, that's no problem
1072- bool authenticated;
1073- QString authenticationUser;
1074-
1075- void handleAuthenticate();
1076- void handleRespond(const QString &response);
1077-
1078-protected:
1079- GreeterImpl *m_impl; // if the backend needs more private data
1080- Greeter * const q_ptr;
1081-
1082-private:
1083- Q_DECLARE_PUBLIC(Greeter)
1084-};
1085-}
1086-
1087-#endif // UNITY_MOCK_GREETER_PRIVATE_H
1088
1089=== removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp'
1090--- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp 2016-06-15 15:29:34 +0000
1091+++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp 1970-01-01 00:00:00 +0000
1092@@ -1,88 +0,0 @@
1093-/*
1094- * Copyright (C) 2015 Canonical, Ltd.
1095- *
1096- * This program is free software; you can redistribute it and/or modify
1097- * it under the terms of the GNU General Public License as published by
1098- * the Free Software Foundation; version 3.
1099- *
1100- * This program is distributed in the hope that it will be useful,
1101- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1102- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1103- * GNU General Public License for more details.
1104- *
1105- * You should have received a copy of the GNU General Public License
1106- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1107- *
1108- */
1109-
1110-
1111-/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1112- * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
1113- * COUNTERPART IN tests/mocks/LightDM/IntegratedLightDM/liblightdm
1114- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
1115-
1116-// LightDM currently is Qt4 compatible, and so doesn't define setRoleNames.
1117-// To use the same method of setting role name that it does, we
1118-// set our compatibility to Qt4 here too.
1119-#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0)
1120-
1121-#include "SessionsModel.h"
1122-#include "SessionsModelPrivate.h"
1123-#include <QtCore/QDir>
1124-#include <QtCore/QString>
1125-
1126-namespace QLightDM
1127-{
1128-
1129-SessionsModel::SessionsModel(QObject* parent) :
1130- QAbstractListModel(parent),
1131- d_ptr(new SessionsModelPrivate(this))
1132-{
1133- Q_D(SessionsModel);
1134- m_roleNames = QAbstractListModel::roleNames();
1135- m_roleNames[KeyRole] = "key";
1136- m_roleNames[TypeRole] = "type";
1137-}
1138-
1139-SessionsModel::~SessionsModel()
1140-{
1141- delete d_ptr;
1142-}
1143-
1144-QVariant SessionsModel::data(const QModelIndex& index, int role) const
1145-{
1146- Q_D(const SessionsModel);
1147-
1148- if(!index.isValid()) {
1149- return QVariant();
1150- }
1151-
1152- int row = index.row();
1153-
1154- switch (role) {
1155- case QLightDM::SessionsModel::KeyRole:
1156- return d->sessionItems[row].key;
1157- case Qt::DisplayRole:
1158- return d->sessionItems[row].name;
1159- default:
1160- return QVariant();
1161- }
1162-}
1163-
1164-QHash<int, QByteArray> SessionsModel::roleNames() const
1165-{
1166- return m_roleNames;
1167-}
1168-
1169-int SessionsModel::rowCount(const QModelIndex& parent) const
1170-{
1171- Q_D(const SessionsModel);
1172-
1173- if (parent.isValid()) {
1174- return 0;
1175- } else { // parent is root
1176- return d->sessionItems.size();
1177- }
1178-}
1179-
1180-} // namespace QLightDM
1181
1182=== removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h'
1183--- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h 2015-11-23 22:45:55 +0000
1184+++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h 1970-01-01 00:00:00 +0000
1185@@ -1,72 +0,0 @@
1186-/*
1187- * Copyright (C) 2015 Canonical, Ltd.
1188- *
1189- * This program is free software; you can redistribute it and/or modify
1190- * it under the terms of the GNU General Public License as published by
1191- * the Free Software Foundation; version 3.
1192- *
1193- * This program is distributed in the hope that it will be useful,
1194- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1195- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1196- * GNU General Public License for more details.
1197- *
1198- * You should have received a copy of the GNU General Public License
1199- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1200- *
1201- */
1202-
1203-#ifndef UNITY_INTEGRATED_SESSIONSMODEL_H
1204-#define UNITY_INTEGRATED_SESSIONSMODEL_H
1205-
1206-#include <QtCore/QAbstractListModel>
1207-#include <QtCore/QString>
1208-
1209-/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1210- * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
1211- * COUNTERPART IN tests/mocks/LightDM/IntegratedLightDM/liblightdm
1212- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
1213-
1214-// This is taken from liblightdm and modified to confirm to our syle conventions
1215-namespace QLightDM
1216-{
1217-class SessionsModelPrivate;
1218-
1219-class Q_DECL_EXPORT SessionsModel : public QAbstractListModel
1220- {
1221- Q_OBJECT
1222-
1223- Q_ENUMS(SessionModelRoles SessionType)
1224-
1225- public:
1226-
1227- enum SessionModelRoles {
1228- //name is exposed as Qt::DisplayRole
1229- //comment is exposed as Qt::TooltipRole
1230- KeyRole = Qt::UserRole,
1231- IdRole = KeyRole, /** Deprecated */
1232- TypeRole
1233- };
1234-
1235- enum SessionType {
1236- LocalSessions,
1237- RemoteSessions
1238- };
1239-
1240- explicit SessionsModel(QObject* parent=0); /** Deprecated. Loads local sessions*/
1241- explicit SessionsModel(SessionsModel::SessionType, QObject* parent=0);
1242- virtual ~SessionsModel();
1243-
1244- QHash<int, QByteArray> roleNames() const override;
1245- int rowCount(const QModelIndex& parent) const override;
1246- QVariant data(const QModelIndex& index, int role) const override;
1247-
1248- protected:
1249- SessionsModelPrivate* const d_ptr;
1250-
1251- private:
1252- QHash<int, QByteArray> m_roleNames;
1253- Q_DECLARE_PRIVATE(SessionsModel)
1254- };
1255-}
1256-
1257-#endif // UNITY_INTEGRATED_SESSIONSMODEL_H
1258
1259=== removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp'
1260--- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 2016-06-24 15:47:41 +0000
1261+++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 1970-01-01 00:00:00 +0000
1262@@ -1,36 +0,0 @@
1263-/*
1264- * Copyright (C) 2015 Canonical, Ltd.
1265- *
1266- * This program is free software; you can redistribute it and/or modify
1267- * it under the terms of the GNU General Public License as published by
1268- * the Free Software Foundation; version 3.
1269- *
1270- * This program is distributed in the hope that it will be useful,
1271- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1272- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1273- * GNU General Public License for more details.
1274- *
1275- * You should have received a copy of the GNU General Public License
1276- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1277- *
1278- */
1279-
1280-#include "SessionsModelPrivate.h"
1281-
1282-#include <QDir>
1283-#include <QSettings>
1284-#include <QStringList>
1285-
1286-namespace QLightDM
1287-{
1288-
1289-SessionsModelPrivate::SessionsModelPrivate(SessionsModel* parent)
1290- : q_ptr(parent)
1291-{
1292- // Since this model is never visible, as there is only 1 session,
1293- // just use the session name as the key
1294- QString sessionName = qgetenv("XDG_SESSION_DESKTOP");
1295- sessionItems.append({sessionName, "", sessionName, ""});
1296-}
1297-
1298-} // namespace QLightDM
1299
1300=== removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h'
1301--- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 2016-06-23 16:00:11 +0000
1302+++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 1970-01-01 00:00:00 +0000
1303@@ -1,54 +0,0 @@
1304-/*
1305- * Copyright (C) 2015 Canonical, Ltd.
1306- *
1307- * This program is free software; you can redistribute it and/or modify
1308- * it under the terms of the GNU General Public License as published by
1309- * the Free Software Foundation; version 3.
1310- *
1311- * This program is distributed in the hope that it will be useful,
1312- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1313- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1314- * GNU General Public License for more details.
1315- *
1316- * You should have received a copy of the GNU General Public License
1317- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1318- *
1319- */
1320-
1321-#ifndef UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H
1322-#define UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H
1323-
1324-#include <QtCore/QList>
1325-#include <QtCore/QString>
1326-
1327-namespace QLightDM
1328-{
1329-class SessionsModel;
1330-
1331-class SessionItem
1332-{
1333-public:
1334- QString key;
1335- QString type; // unused
1336- QString name;
1337- QString comment; // unused
1338-};
1339-
1340-class SessionsModelPrivate
1341-{
1342-public:
1343- explicit SessionsModelPrivate(SessionsModel* parent=0);
1344- virtual ~SessionsModelPrivate() = default;
1345-
1346- QList<SessionItem> sessionItems;
1347-
1348-protected:
1349- SessionsModel* const q_ptr;
1350-
1351-private:
1352- Q_DECLARE_PUBLIC(SessionsModel)
1353-};
1354-
1355-} // namespace QLightDM
1356-
1357-#endif // UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H
1358
1359=== removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp'
1360--- plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp 2016-08-08 14:15:49 +0000
1361+++ plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp 1970-01-01 00:00:00 +0000
1362@@ -1,110 +0,0 @@
1363-/*
1364- * Copyright (C) 2013-2016 Canonical, Ltd.
1365- *
1366- * This program is free software; you can redistribute it and/or modify
1367- * it under the terms of the GNU General Public License as published by
1368- * the Free Software Foundation; version 3.
1369- *
1370- * This program is distributed in the hope that it will be useful,
1371- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1372- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1373- * GNU General Public License for more details.
1374- *
1375- * You should have received a copy of the GNU General Public License
1376- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1377- *
1378- * Author: Michael Terry <michael.terry@canonical.com>
1379- */
1380-
1381-
1382-/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1383- * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
1384- * COUNTERPART IN tests/mocks/Lightdm/liblightdm
1385- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
1386-
1387-// LightDM currently is Qt4 compatible, and so doesn't define setRoleNames.
1388-// To use the same method of setting role name that it does, we
1389-// set our compatibility to Qt4 here too.
1390-#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0)
1391-
1392-#include "UsersModel.h"
1393-#include "UsersModelPrivate.h"
1394-#include <QtCore/QDir>
1395-#include <QtCore/QString>
1396-#include <QtGui/QIcon>
1397-
1398-namespace QLightDM
1399-{
1400-
1401-UsersModel::UsersModel(QObject *parent) :
1402- QAbstractListModel(parent),
1403- d_ptr(new UsersModelPrivate(this))
1404-{
1405- // Extend roleNames (we want to keep the "display" role)
1406- QHash<int, QByteArray> roles = roleNames();
1407- roles[NameRole] = "name";
1408- roles[RealNameRole] = "realName";
1409- roles[LoggedInRole] = "loggedIn";
1410- roles[BackgroundRole] = "background";
1411- roles[BackgroundPathRole] = "backgroundPath";
1412- roles[SessionRole] = "session";
1413- roles[HasMessagesRole] = "hasMessages";
1414- roles[ImagePathRole] = "imagePath";
1415- roles[UidRole] = "uid";
1416- setRoleNames(roles);
1417-
1418- connect(d_ptr, &UsersModelPrivate::dataChanged, this, [this](int i) {
1419- QModelIndex index = createIndex(i, 0);
1420- Q_EMIT dataChanged(index, index);
1421- });
1422-}
1423-
1424-int UsersModel::rowCount(const QModelIndex &parent) const
1425-{
1426- Q_D(const UsersModel);
1427-
1428- if (parent.isValid()) {
1429- return 0;
1430- } else { // parent is root
1431- return d->entries.size();
1432- }
1433-}
1434-
1435-QVariant UsersModel::data(const QModelIndex &index, int role) const
1436-{
1437- Q_D(const UsersModel);
1438-
1439- if (!index.isValid()) {
1440- return QVariant();
1441- }
1442-
1443- int row = index.row();
1444- switch (role) {
1445- case Qt::DisplayRole:
1446- return d->entries[row].real_name;
1447- case Qt::DecorationRole:
1448- return QIcon();
1449- case UsersModel::NameRole:
1450- return d->entries[row].username;
1451- case UsersModel::RealNameRole:
1452- return d->entries[row].real_name;
1453- case UsersModel::SessionRole:
1454- return d->entries[row].session;
1455- case UsersModel::LoggedInRole:
1456- return d->entries[row].is_active;
1457- case UsersModel::BackgroundRole:
1458- return QPixmap(d->entries[row].background);
1459- case UsersModel::BackgroundPathRole:
1460- return d->entries[row].background;
1461- case UsersModel::HasMessagesRole:
1462- return d->entries[row].has_messages;
1463- case UsersModel::ImagePathRole:
1464- return "";
1465- case UsersModel::UidRole:
1466- return d->entries[row].uid;
1467- default:
1468- return QVariant();
1469- }
1470-}
1471-
1472-}
1473
1474=== removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.h'
1475--- plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.h 2016-06-27 14:51:40 +0000
1476+++ plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.h 1970-01-01 00:00:00 +0000
1477@@ -1,67 +0,0 @@
1478-/*
1479- * Copyright (C) 2013 Canonical, Ltd.
1480- * Copyright (C) 2010-2011 David Edmundson.
1481- *
1482- * This program is free software; you can redistribute it and/or modify
1483- * it under the terms of the GNU General Public License as published by
1484- * the Free Software Foundation; version 3.
1485- *
1486- * This program is distributed in the hope that it will be useful,
1487- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1488- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1489- * GNU General Public License for more details.
1490- *
1491- * You should have received a copy of the GNU General Public License
1492- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1493- *
1494- * Author: David Edmundson <kde@davidedmundson.co.uk>
1495- */
1496-
1497-#ifndef UNITY_MOCK_USERSMODEL_H
1498-#define UNITY_MOCK_USERSMODEL_H
1499-
1500-#include <QtCore/QString>
1501-#include <QtCore/QSharedDataPointer>
1502-#include <QAbstractListModel>
1503-
1504-/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1505- * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
1506- * COUNTERPART IN tests/mocks/Lightdm/liblightdm
1507- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
1508-
1509-namespace QLightDM
1510-{
1511-class UsersModelPrivate;
1512-
1513-class Q_DECL_EXPORT UsersModel : public QAbstractListModel
1514-{
1515- Q_OBJECT
1516-
1517- Q_ENUMS(UserModelRoles)
1518-
1519-public:
1520- explicit UsersModel(QObject *parent = 0);
1521- virtual ~UsersModel() = default;
1522-
1523- enum UserModelRoles {NameRole = Qt::UserRole,
1524- RealNameRole,
1525- LoggedInRole,
1526- BackgroundRole,
1527- SessionRole,
1528- HasMessagesRole,
1529- ImagePathRole,
1530- BackgroundPathRole,
1531- UidRole
1532- };
1533-
1534- int rowCount(const QModelIndex &parent) const override;
1535- QVariant data(const QModelIndex &index, int role) const override;
1536-
1537-private:
1538- UsersModelPrivate * const d_ptr;
1539- Q_DECLARE_PRIVATE(UsersModel)
1540-};
1541-
1542-}
1543-
1544-#endif // UNITY_MOCK_USERSMODEL_H
1545
1546=== removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp'
1547--- plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 2016-06-28 20:34:34 +0000
1548+++ plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 1970-01-01 00:00:00 +0000
1549@@ -1,94 +0,0 @@
1550-/*
1551- * Copyright (C) 2013-2016 Canonical, Ltd.
1552- *
1553- * This program is free software; you can redistribute it and/or modify
1554- * it under the terms of the GNU General Public License as published by
1555- * the Free Software Foundation; version 3.
1556- *
1557- * This program is distributed in the hope that it will be useful,
1558- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1559- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1560- * GNU General Public License for more details.
1561- *
1562- * You should have received a copy of the GNU General Public License
1563- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1564- *
1565- * Author: Michael Terry <michael.terry@canonical.com>
1566- */
1567-
1568-#include "UsersModelPrivate.h"
1569-
1570-#include "AccountsServiceDBusAdaptor.h"
1571-#include "UsersModel.h"
1572-
1573-#include <glib.h>
1574-#include <QDebug>
1575-#include <QDir>
1576-#include <QSettings>
1577-#include <QStringList>
1578-#include <unistd.h>
1579-
1580-namespace QLightDM
1581-{
1582-
1583-UsersModelPrivate::UsersModelPrivate(UsersModel* parent)
1584- : QObject(parent),
1585- q_ptr(parent),
1586- m_service(new AccountsServiceDBusAdaptor(this))
1587-{
1588- QFileInfo demoFile(QDir::homePath() + "/.unity8-greeter-demo");
1589- QString currentUser = g_get_user_name();
1590- uid_t currentUid = getuid();
1591-
1592- if (demoFile.exists()) {
1593- QSettings settings(demoFile.filePath(), QSettings::NativeFormat);
1594- QStringList users = settings.value(QStringLiteral("users"), QStringList() << currentUser).toStringList();
1595-
1596- entries.reserve(users.count());
1597- Q_FOREACH(const QString &user, users)
1598- {
1599- QString name = settings.value(user + "/name", user).toString();
1600- entries.append({user, name, 0, 0, false, false, 0, 0, currentUid++});
1601- }
1602- } else {
1603- entries.append({currentUser, 0, 0, 0, false, false, 0, 0, currentUid});
1604-
1605- connect(m_service, &AccountsServiceDBusAdaptor::maybeChanged,
1606- this, [this](const QString &user) {
1607- if (user == entries[0].username) {
1608- updateName(true);
1609- }
1610- });
1611- updateName(false);
1612- }
1613-}
1614-
1615-void UsersModelPrivate::updateName(bool async)
1616-{
1617- auto pendingReply = m_service->getUserPropertyAsync(entries[0].username,
1618- QStringLiteral("org.freedesktop.Accounts.User"),
1619- QStringLiteral("RealName"));
1620- auto *watcher = new QDBusPendingCallWatcher(pendingReply, this);
1621-
1622- connect(watcher, &QDBusPendingCallWatcher::finished,
1623- this, [this](QDBusPendingCallWatcher* watcher) {
1624-
1625- QDBusPendingReply<QVariant> reply = *watcher;
1626- watcher->deleteLater();
1627- if (reply.isError()) {
1628- qWarning() << "Failed to get 'RealName' property - " << reply.error().message();
1629- return;
1630- }
1631-
1632- const QString realName = reply.value().toString();
1633- if (entries[0].real_name != realName) {
1634- entries[0].real_name = realName;
1635- Q_EMIT dataChanged(0);
1636- }
1637- });
1638- if (!async) {
1639- watcher->waitForFinished();
1640- }
1641-}
1642-
1643-}
1644
1645=== removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h'
1646--- plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h 2016-06-27 14:51:40 +0000
1647+++ plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h 1970-01-01 00:00:00 +0000
1648@@ -1,72 +0,0 @@
1649-/*
1650- * Copyright (C) 2013-2016 Canonical, Ltd.
1651- *
1652- * This program is free software; you can redistribute it and/or modify
1653- * it under the terms of the GNU General Public License as published by
1654- * the Free Software Foundation; version 3.
1655- *
1656- * This program is distributed in the hope that it will be useful,
1657- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1658- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1659- * GNU General Public License for more details.
1660- *
1661- * You should have received a copy of the GNU General Public License
1662- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1663- *
1664- * Author: Michael Terry <michael.terry@canonical.com>
1665- */
1666-
1667-#ifndef UNITY_MOCK_USERSMODEL_PRIVATE_H
1668-#define UNITY_MOCK_USERSMODEL_PRIVATE_H
1669-
1670-#include <QList>
1671-#include <QObject>
1672-#include <QString>
1673-
1674-class AccountsServiceDBusAdaptor;
1675-
1676-namespace QLightDM
1677-{
1678-class UsersModel;
1679-
1680-class Entry
1681-{
1682-public:
1683- QString username;
1684- QString real_name;
1685- QString background;
1686- QString layouts;
1687- bool is_active;
1688- bool has_messages;
1689- QString session;
1690- QString infographic;
1691- uid_t uid;
1692-};
1693-
1694-class UsersModelPrivate : public QObject
1695-{
1696- Q_OBJECT
1697-
1698-public:
1699- explicit UsersModelPrivate(UsersModel *parent = 0);
1700- virtual ~UsersModelPrivate() = default;
1701-
1702- QList<Entry> entries;
1703-
1704-Q_SIGNALS:
1705- void dataChanged(int);
1706-
1707-protected:
1708- UsersModel * const q_ptr;
1709-
1710-private:
1711- Q_DECLARE_PUBLIC(UsersModel)
1712-
1713- void updateName(bool async);
1714-
1715- AccountsServiceDBusAdaptor *m_service;
1716-};
1717-
1718-}
1719-
1720-#endif // UNITY_MOCK_USERSMODEL_PRIVATE_H
1721
1722=== removed file 'plugins/LightDM/IntegratedLightDM/qmldir'
1723--- plugins/LightDM/IntegratedLightDM/qmldir 2016-02-03 23:45:45 +0000
1724+++ plugins/LightDM/IntegratedLightDM/qmldir 1970-01-01 00:00:00 +0000
1725@@ -1,3 +0,0 @@
1726-module LightDM.IntegratedLightDM
1727-plugin IntegratedLightDM-qml
1728-typeinfo IntegratedLightDM.qmltypes
1729
1730=== modified file 'plugins/LightDM/SessionsModel.cpp'
1731--- plugins/LightDM/SessionsModel.cpp 2016-06-14 20:08:43 +0000
1732+++ plugins/LightDM/SessionsModel.cpp 2016-08-25 20:40:06 +0000
1733@@ -1,5 +1,5 @@
1734 /*
1735- * Copyright (C) 2015 Canonical, Ltd.
1736+ * Copyright (C) 2015-2016 Canonical, Ltd.
1737 *
1738 * This program is free software; you can redistribute it and/or modify
1739 * it under the terms of the GNU General Public License as published by
1740@@ -105,6 +105,11 @@
1741 }
1742 }
1743
1744+QObject *SessionsModel::mock()
1745+{
1746+ return m_model->property("mock").value<QObject*>();
1747+}
1748+
1749 SessionsModel::SessionsModel(QObject* parent)
1750 : UnitySortFilterProxyModelQML(parent)
1751 {
1752@@ -114,7 +119,6 @@
1753 m_roleNames[IconRole] = "icon_url";
1754
1755 setModel(m_model);
1756- setSourceModel(m_model);
1757 setSortCaseSensitivity(Qt::CaseInsensitive);
1758 setSortLocaleAware(true);
1759 setSortRole(Qt::DisplayRole);
1760
1761=== modified file 'plugins/LightDM/SessionsModel.h'
1762--- plugins/LightDM/SessionsModel.h 2015-11-23 22:57:45 +0000
1763+++ plugins/LightDM/SessionsModel.h 2016-08-25 20:40:06 +0000
1764@@ -32,6 +32,9 @@
1765
1766 Q_PROPERTY(QList<QUrl> iconSearchDirectories READ iconSearchDirectories
1767 WRITE setIconSearchDirectories NOTIFY iconSearchDirectoriesChanged)
1768+
1769+ Q_PROPERTY(QObject *mock READ mock CONSTANT) // for testing
1770+
1771 Q_SIGNALS:
1772 void iconSearchDirectoriesChanged();
1773
1774@@ -55,6 +58,9 @@
1775 Q_INVOKABLE QUrl iconUrl(const QString sessionName) const;
1776
1777 void setIconSearchDirectories(const QList<QUrl> searchDirectories);
1778+
1779+ QObject *mock();
1780+
1781 private:
1782 QLightDM::SessionsModel* m_model;
1783 QHash<int, QByteArray> m_roleNames;
1784
1785=== modified file 'plugins/LightDM/UsersModel.cpp'
1786--- plugins/LightDM/UsersModel.cpp 2015-10-26 20:15:08 +0000
1787+++ plugins/LightDM/UsersModel.cpp 2016-08-25 20:40:06 +0000
1788@@ -68,4 +68,11 @@
1789 sort(0);
1790 }
1791
1792+QObject *UsersModel::mock()
1793+{
1794+ // get through MangleModel down to QLightDM::UsersModel
1795+ MangleModel *mangleModel = static_cast<MangleModel*>(sourceModel());
1796+ return mangleModel->sourceModel()->property("mock").value<QObject*>();
1797+}
1798+
1799 #include "UsersModel.moc"
1800
1801=== modified file 'plugins/LightDM/UsersModel.h'
1802--- plugins/LightDM/UsersModel.h 2015-09-11 13:38:45 +0000
1803+++ plugins/LightDM/UsersModel.h 2016-08-25 20:40:06 +0000
1804@@ -30,8 +30,12 @@
1805 {
1806 Q_OBJECT
1807
1808+ Q_PROPERTY(QObject *mock READ mock CONSTANT) // for testing
1809+
1810 public:
1811 explicit UsersModel(QObject* parent=0);
1812+
1813+ QObject *mock();
1814 };
1815
1816 #endif
1817
1818=== modified file 'plugins/LightDM/plugin.cpp'
1819--- plugins/LightDM/plugin.cpp 2015-11-18 03:52:01 +0000
1820+++ plugins/LightDM/plugin.cpp 2016-08-25 20:40:06 +0000
1821@@ -63,20 +63,13 @@
1822 return UserMetricsOutput::UserMetrics::getInstance();
1823 }
1824
1825-void PLUGIN_CLASSNAME::registerTypes(const char *uri)
1826+void LightDM::registerTypes(const char *uri)
1827 {
1828 qmlRegisterType<QAbstractItemModel>();
1829 qmlRegisterType<UserMetricsOutput::ColorTheme>();
1830
1831-#if defined INTEGRATED_LIGHTDM
1832- Q_ASSERT(uri == QLatin1String("LightDM.IntegratedLightDM"));
1833- qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider);
1834-#elif defined FULL_LIGHTDM
1835- Q_ASSERT(uri == QLatin1String("LightDM.FullLightDM"));
1836+ Q_ASSERT(uri == QLatin1String("LightDM"));
1837 qmlRegisterSingletonType<QLightDM::Greeter>(uri, 0, 1, "Greeter", greeter_provider);
1838-#else
1839- #error No library defined in LightDM plugin
1840-#endif
1841
1842 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
1843 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
1844
1845=== modified file 'plugins/LightDM/plugin.h'
1846--- plugins/LightDM/plugin.h 2015-11-02 17:37:26 +0000
1847+++ plugins/LightDM/plugin.h 2016-08-25 20:40:06 +0000
1848@@ -21,7 +21,7 @@
1849 #include <QtQml/QQmlEngine>
1850 #include <QtQml/QQmlExtensionPlugin>
1851
1852-class PLUGIN_CLASSNAME : public QQmlExtensionPlugin
1853+class LightDM : public QQmlExtensionPlugin
1854 {
1855 Q_OBJECT
1856 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
1857
1858=== renamed file 'plugins/LightDM/FullLightDM/qmldir' => 'plugins/LightDM/qmldir'
1859--- plugins/LightDM/FullLightDM/qmldir 2016-02-03 23:45:45 +0000
1860+++ plugins/LightDM/qmldir 2016-08-25 20:40:06 +0000
1861@@ -1,3 +1,2 @@
1862-module LightDM.FullLightDM
1863-plugin FullLightDM-qml
1864-typeinfo FullLightDM.qmltypes
1865+module LightDM
1866+plugin LightDM-qml
1867
1868=== modified file 'plugins/Unity/Session/dbusunitysessionservice.cpp'
1869--- plugins/Unity/Session/dbusunitysessionservice.cpp 2016-06-22 13:38:16 +0000
1870+++ plugins/Unity/Session/dbusunitysessionservice.cpp 2016-08-25 20:40:06 +0000
1871@@ -337,58 +337,16 @@
1872 // user session.
1873 Q_EMIT LockRequested();
1874 Q_EMIT lockRequested();
1875+ Q_EMIT Locked();
1876 }
1877
1878 void DBusUnitySessionService::Lock()
1879 {
1880 // Normal lock (with animation, as compared to PromptLock above). Usually
1881 // used by indicator-session to lock the session in place.
1882- //
1883- // FIXME: We also -- as a bit of a hack around indicator-session not fully
1884- // supporting a phone profile -- switch to greeter here. The unity7 flow is
1885- // that the user chooses "Lock/Switch" from the indicator, and then can go
1886- // to greeter by selecting "Switch" again from the indicator, which is now
1887- // exposed by the desktop_lockscreen profile. But since in unity8, we try
1888- // to expose most things all the time, we don't use the separate lockscreen
1889- // profile. Instead, we just go directly to the greeter the first time
1890- // a user presses "Lock/Switch". This isn't what this DBus call is
1891- // supposed to do, but we can live with it for now.
1892- //
1893- // Here's a bug about indicator-session growing a converged Touch profile:
1894- // https://launchpad.net/bugs/1557716
1895- //
1896- // We only do this here in the animated-lock call because that's the only
1897- // time the indicator locks without also asking the display manager to
1898- // switch sessions on us. And since we are switching screens, we also
1899- // don't bother respecting the animate request, simply doing a PromptLock.
1900+ // Though here we don't really worry about the difference and just call
1901+ // PromptLock.
1902 PromptLock();
1903- switchToGreeter();
1904-}
1905-
1906-void DBusUnitySessionService::switchToGreeter()
1907-{
1908- // lock the session using the org.freedesktop.DisplayManager system DBUS service
1909- const QString sessionPath = QString::fromLocal8Bit(qgetenv("XDG_SESSION_PATH"));
1910- QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.DisplayManager"),
1911- sessionPath,
1912- QStringLiteral("org.freedesktop.DisplayManager.Session"),
1913- QStringLiteral("Lock"));
1914-
1915- QDBusPendingCall pendingCall = QDBusConnection::SM_BUSNAME().asyncCall(msg);
1916- QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this);
1917- connect(watcher, &QDBusPendingCallWatcher::finished,
1918- this, [this](QDBusPendingCallWatcher* watcher) {
1919-
1920- QDBusPendingReply<void> reply = *watcher;
1921- watcher->deleteLater();
1922- if (reply.isError()) {
1923- qWarning() << "Lock call failed" << reply.error().message();
1924- return;
1925- }
1926-
1927- // emit Locked when the call succeeds
1928- Q_EMIT Locked();
1929- });
1930 }
1931
1932 void DBusUnitySessionService::doUnlock()
1933
1934=== modified file 'plugins/Unity/Session/dbusunitysessionservice.h'
1935--- plugins/Unity/Session/dbusunitysessionservice.h 2016-06-22 13:38:16 +0000
1936+++ plugins/Unity/Session/dbusunitysessionservice.h 2016-08-25 20:40:06 +0000
1937@@ -262,9 +262,6 @@
1938
1939 private Q_SLOTS:
1940 void doUnlock();
1941-
1942-private:
1943- void switchToGreeter();
1944 };
1945
1946 class DBusGnomeSessionManagerWrapper : public UnityDBusObject
1947
1948=== modified file 'qml/Components/Dialogs.qml'
1949--- qml/Components/Dialogs.qml 2016-07-15 19:37:39 +0000
1950+++ qml/Components/Dialogs.qml 2016-08-25 20:40:06 +0000
1951@@ -19,10 +19,10 @@
1952 import Unity.Application 0.1
1953 import Unity.Session 0.1
1954 import GlobalShortcut 1.0
1955+import LightDM 0.1 as LightDM
1956 import Ubuntu.Components 1.3
1957 import Unity.Platform 1.0
1958 import Utils 0.1
1959-import "../Greeter"
1960
1961 Item {
1962 id: root
1963@@ -112,12 +112,12 @@
1964
1965 GlobalShortcut { // lock screen
1966 shortcut: Qt.Key_ScreenSaver
1967- onTriggered: LightDMService.greeter.showGreeter()
1968+ onTriggered: LightDM.Greeter.showGreeter()
1969 }
1970
1971 GlobalShortcut { // lock screen
1972 shortcut: Qt.ControlModifier|Qt.AltModifier|Qt.Key_L
1973- onTriggered: LightDMService.greeter.showGreeter()
1974+ onTriggered: LightDM.Greeter.showGreeter()
1975 }
1976
1977 QtObject {
1978@@ -151,7 +151,7 @@
1979 Button {
1980 text: i18n.ctr("Button: Lock the system", "Lock")
1981 onClicked: {
1982- LightDMService.greeter.showGreeter()
1983+ LightDM.Greeter.showGreeter()
1984 logoutDialog.hide();
1985 }
1986 }
1987
1988=== removed file 'qml/Greeter/FullLightDMImpl.qml'
1989--- qml/Greeter/FullLightDMImpl.qml 2015-11-09 15:30:25 +0000
1990+++ qml/Greeter/FullLightDMImpl.qml 1970-01-01 00:00:00 +0000
1991@@ -1,28 +0,0 @@
1992-/*
1993- * Copyright (C) 2015 Canonical, Ltd.
1994- *
1995- * This program is free software; you can redistribute it and/or modify
1996- * it under the terms of the GNU General Public License as published by
1997- * the Free Software Foundation; version 3.
1998- *
1999- * This program is distributed in the hope that it will be useful,
2000- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2001- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2002- * GNU General Public License for more details.
2003- *
2004- * You should have received a copy of the GNU General Public License
2005- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2006- */
2007-
2008-import QtQuick 2.4
2009-import LightDM.FullLightDM 0.1 as LightDM
2010-
2011-Item{
2012- id: implementation
2013-
2014- property var greeter: LightDM.Greeter
2015- property var infographic: LightDM.Infographic
2016- property var users: LightDM.Users
2017- property var userRoles: LightDM.UserRoles
2018-
2019-}
2020
2021=== modified file 'qml/Greeter/Greeter.qml'
2022--- qml/Greeter/Greeter.qml 2016-07-19 19:11:20 +0000
2023+++ qml/Greeter/Greeter.qml 2016-08-25 20:40:06 +0000
2024@@ -18,13 +18,13 @@
2025 import AccountsService 0.1
2026 import Biometryd 0.0
2027 import GSettings 1.0
2028+import LightDM 0.1 as LightDM
2029 import Powerd 0.1
2030 import Ubuntu.Components 1.3
2031 import Ubuntu.SystemImage 0.1
2032 import Unity.Launcher 0.1
2033 import Unity.Session 0.1
2034
2035-import "." 0.1
2036 import "../Components"
2037
2038 Showable {
2039@@ -50,7 +50,7 @@
2040 readonly property bool hasLockedApp: lockedApp !== ""
2041
2042 property bool forcedUnlock
2043- readonly property bool locked: LightDMService.greeter.active && !LightDMService.greeter.authenticated && !forcedUnlock
2044+ readonly property bool locked: LightDM.Greeter.active && !LightDM.Greeter.authenticated && !forcedUnlock
2045
2046 property bool tabletMode
2047 property url viewSource // only used for testing
2048@@ -135,8 +135,8 @@
2049 QtObject {
2050 id: d
2051
2052- readonly property bool multiUser: LightDMService.users.count > 1
2053- readonly property int selectUserIndex: d.getUserIndex(LightDMService.greeter.selectUser)
2054+ readonly property bool multiUser: LightDM.Users.count > 1
2055+ readonly property int selectUserIndex: d.getUserIndex(LightDM.Greeter.selectUser)
2056 property int currentIndex: Math.max(selectUserIndex, 0)
2057 property bool waiting
2058 property bool isLockscreen // true when we are locking an active session, rather than first user login
2059@@ -164,8 +164,8 @@
2060 return -1;
2061
2062 // Find index for requested user, if it exists
2063- for (var i = 0; i < LightDMService.users.count; i++) {
2064- if (username === LightDMService.users.data(i, LightDMService.userRoles.NameRole)) {
2065+ for (var i = 0; i < LightDM.Users.count; i++) {
2066+ if (username === LightDM.Users.data(i, LightDM.UserRoles.NameRole)) {
2067 return i;
2068 }
2069 }
2070@@ -174,17 +174,17 @@
2071 }
2072
2073 function selectUser(index, reset) {
2074- if (index < 0 || index >= LightDMService.users.count)
2075+ if (index < 0 || index >= LightDM.Users.count)
2076 return;
2077 d.waiting = true;
2078 if (reset) {
2079 loader.item.reset();
2080 }
2081 currentIndex = index;
2082- var user = LightDMService.users.data(index, LightDMService.userRoles.NameRole);
2083+ var user = LightDM.Users.data(index, LightDM.UserRoles.NameRole);
2084 AccountsService.user = user;
2085 LauncherModel.setUser(user);
2086- LightDMService.greeter.authenticate(user); // always resets auth state
2087+ LightDM.Greeter.authenticate(user); // always resets auth state
2088 }
2089
2090 function hideView() {
2091@@ -192,18 +192,22 @@
2092 loader.item.enabled = false; // drop OSK and prevent interaction
2093 loader.item.notifyAuthenticationSucceeded(false /* showFakePassword */);
2094 loader.item.hide();
2095+ sessionStarted();
2096 }
2097 }
2098
2099 function login() {
2100 d.waiting = true;
2101- if (LightDMService.greeter.startSessionSync()) {
2102- sessionStarted();
2103- hideView();
2104- } else if (loader.item) {
2105+ var success = LightDM.Greeter.startSessionSync();
2106+ d.waiting = false;
2107+
2108+ // If successful as a lockscreen, we don't need to hide ourselves.
2109+ // logind will tell us to unlock if our current user logged in.
2110+
2111+ if (!success) {
2112 loader.item.notifyAuthenticationFailed();
2113+ d.selectUser(d.currentIndex, false);
2114 }
2115- d.waiting = false;
2116 }
2117
2118 function startUnlock(toTheRight) {
2119@@ -216,6 +220,7 @@
2120
2121 function checkForcedUnlock(hideNow) {
2122 if (forcedUnlock && shown) {
2123+ d.waiting = false;
2124 hideView();
2125 if (hideNow) {
2126 root.hideNow(); // skip hide animation
2127@@ -339,7 +344,7 @@
2128 root.lockedApp = "";
2129 item.forceActiveFocus();
2130 d.selectUser(d.currentIndex, true);
2131- LightDMService.infographic.readyForDataChange();
2132+ LightDM.Infographic.readyForDataChange();
2133 }
2134
2135 Connections {
2136@@ -349,7 +354,7 @@
2137 }
2138 onResponded: {
2139 if (root.locked) {
2140- LightDMService.greeter.respond(response);
2141+ LightDM.Greeter.respond(response);
2142 } else {
2143 d.login();
2144 }
2145@@ -420,18 +425,18 @@
2146 Binding {
2147 target: loader.item
2148 property: "userModel"
2149- value: LightDMService.users
2150+ value: LightDM.Users
2151 }
2152
2153 Binding {
2154 target: loader.item
2155 property: "infographicModel"
2156- value: LightDMService.infographic
2157+ value: LightDM.Infographic
2158 }
2159 }
2160
2161 Connections {
2162- target: LightDMService.greeter
2163+ target: LightDM.Greeter
2164
2165 onShowGreeter: root.forceShow()
2166 onHideGreeter: root.forcedUnlock = true
2167@@ -462,12 +467,12 @@
2168 onAuthenticationComplete: {
2169 d.waiting = false;
2170
2171- if (LightDMService.greeter.authenticated) {
2172- if (!LightDMService.greeter.promptless) {
2173+ if (LightDM.Greeter.authenticated) {
2174+ if (!LightDM.Greeter.promptless) {
2175 d.login();
2176 }
2177 } else {
2178- if (!LightDMService.greeter.promptless) {
2179+ if (!LightDM.Greeter.promptless) {
2180 AccountsService.failedLogins++;
2181 }
2182
2183@@ -488,7 +493,7 @@
2184 }
2185
2186 loader.item.notifyAuthenticationFailed();
2187- if (!LightDMService.greeter.promptless) {
2188+ if (!LightDM.Greeter.promptless) {
2189 d.selectUser(d.currentIndex, false);
2190 }
2191 }
2192@@ -507,20 +512,20 @@
2193 }
2194
2195 Binding {
2196- target: LightDMService.greeter
2197+ target: LightDM.Greeter
2198 property: "active"
2199 value: root.active
2200 }
2201
2202 Binding {
2203- target: LightDMService.infographic
2204+ target: LightDM.Infographic
2205 property: "username"
2206- value: AccountsService.statsWelcomeScreen ? LightDMService.users.data(d.currentIndex, LightDMService.userRoles.NameRole) : ""
2207+ value: AccountsService.statsWelcomeScreen ? LightDM.Users.data(d.currentIndex, LightDM.UserRoles.NameRole) : ""
2208 }
2209
2210 Connections {
2211 target: i18n
2212- onLanguageChanged: LightDMService.infographic.readyForDataChange()
2213+ onLanguageChanged: LightDM.Infographic.readyForDataChange()
2214 }
2215
2216 Observer {
2217@@ -572,7 +577,7 @@
2218 failOperation("fingerprint reader is locked");
2219 return;
2220 }
2221- if (result !== LightDMService.users.data(d.currentIndex, LightDMService.userRoles.UidRole)) {
2222+ if (result !== LightDM.Users.data(d.currentIndex, LightDM.UserRoles.UidRole)) {
2223 AccountsService.failedFingerprintLogins++;
2224 failOperation("not the selected user");
2225 return;
2226
2227=== removed file 'qml/Greeter/IntegratedLightDMImpl.qml'
2228--- qml/Greeter/IntegratedLightDMImpl.qml 2015-11-07 00:12:17 +0000
2229+++ qml/Greeter/IntegratedLightDMImpl.qml 1970-01-01 00:00:00 +0000
2230@@ -1,28 +0,0 @@
2231-/*
2232- * Copyright (C) 2015 Canonical, Ltd.
2233- *
2234- * This program is free software; you can redistribute it and/or modify
2235- * it under the terms of the GNU General Public License as published by
2236- * the Free Software Foundation; version 3.
2237- *
2238- * This program is distributed in the hope that it will be useful,
2239- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2240- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2241- * GNU General Public License for more details.
2242- *
2243- * You should have received a copy of the GNU General Public License
2244- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2245- */
2246-
2247-import QtQuick 2.4
2248-import LightDM.IntegratedLightDM 0.1 as LightDM
2249-
2250-Item{
2251- id: implementation
2252-
2253- property var greeter: LightDM.Greeter
2254- property var infographic: LightDM.Infographic
2255- property var users: LightDM.Users
2256- property var userRoles: LightDM.UserRoles
2257-
2258-}
2259
2260=== removed file 'qml/Greeter/LightDMService.qml'
2261--- qml/Greeter/LightDMService.qml 2015-11-06 19:43:38 +0000
2262+++ qml/Greeter/LightDMService.qml 1970-01-01 00:00:00 +0000
2263@@ -1,52 +0,0 @@
2264-/*
2265- * Copyright (C) 2015 Canonical, Ltd.
2266- *
2267- * This program is free software; you can redistribute it and/or modify
2268- * it under the terms of the GNU General Public License as published by
2269- * the Free Software Foundation; version 3.
2270- *
2271- * This program is distributed in the hope that it will be useful,
2272- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2273- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2274- * GNU General Public License for more details.
2275- *
2276- * You should have received a copy of the GNU General Public License
2277- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2278- */
2279-
2280-/**
2281- * Lightweight wrapper that allows for loading integrated/real LightDM
2282- * plugin
2283- */
2284-
2285-pragma Singleton
2286-import QtQuick 2.4
2287-
2288-Loader {
2289- id: loader
2290-
2291- property var greeter: d.valid ? loader.item.greeter : null
2292- property var infographic: d.valid ? loader.item.infographic : null
2293- property var users: d.valid ? loader.item.users : null
2294- property var userRoles: d.valid ? loader.item.userRoles : null
2295-
2296- // This trickery handles cases where applicationArguments aren't provided
2297- // such as during testing
2298- property var fullLightDM: {
2299- if (typeof applicationArguments !== "undefined") {
2300- if (applicationArguments.mode === "greeter") {
2301- return true;
2302- }
2303- }
2304- return false;
2305- }
2306-
2307- source: fullLightDM ?
2308- "FullLightDMImpl.qml" : "IntegratedLightDMImpl.qml"
2309-
2310- QtObject {
2311- id: d
2312-
2313- property bool valid: loader.item !== null
2314- }
2315-}
2316
2317=== removed file 'qml/Greeter/qmldir'
2318--- qml/Greeter/qmldir 2015-10-20 00:59:12 +0000
2319+++ qml/Greeter/qmldir 1970-01-01 00:00:00 +0000
2320@@ -1,1 +0,0 @@
2321-singleton LightDMService 0.1 LightDMService.qml
2322
2323=== modified file 'qml/Shell.qml'
2324--- qml/Shell.qml 2016-08-19 09:16:28 +0000
2325+++ qml/Shell.qml 2016-08-25 20:40:06 +0000
2326@@ -26,6 +26,7 @@
2327 import Unity.Launcher 0.1
2328 import GlobalShortcut 1.0 // has to be before Utils, because of WindowInputFilter
2329 import GSettings 1.0
2330+import LightDM 0.1 as LightDM
2331 import Utils 0.1
2332 import Powerd 0.1
2333 import SessionBroadcast 0.1
2334@@ -171,6 +172,12 @@
2335 value: ApplicationManager
2336 }
2337
2338+ Binding {
2339+ target: AccountsService
2340+ property: "greeterMode"
2341+ value: shell.mode === "greeter"
2342+ }
2343+
2344 Component.onCompleted: {
2345 finishStartUpTimer.start();
2346 }
2347@@ -501,7 +508,7 @@
2348 function showHome() {
2349 greeter.notifyUserRequestedApp("unity8-dash");
2350
2351- var animate = !LightDMService.greeter.active && !stages.shown
2352+ var animate = !LightDM.Greeter.active && !stages.shown
2353 dash.setCurrentScope(0, animate, false)
2354 ApplicationManager.requestFocusApplication("unity8-dash")
2355 }
2356@@ -558,7 +565,7 @@
2357 readonly property bool focusedSurfaceIsFullscreen: MirFocusController.focusedSurface
2358 ? MirFocusController.focusedSurface.state === Mir.FullscreenState
2359 : false
2360- fullscreenMode: (focusedSurfaceIsFullscreen && !LightDMService.greeter.active && launcher.progress == 0)
2361+ fullscreenMode: (focusedSurfaceIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
2362 || greeter.hasLockedApp
2363 locked: greeter && greeter.active
2364 }
2365
2366=== modified file 'tests/CMakeLists.txt'
2367--- tests/CMakeLists.txt 2016-06-29 14:44:41 +0000
2368+++ tests/CMakeLists.txt 2016-08-25 20:40:06 +0000
2369@@ -46,8 +46,8 @@
2370 set(ld_paths)
2371 if(U8TEST_LIGHTDM)
2372 list(APPEND ld_paths
2373+ ${UNITY_MOCKPATH}/liblightdm
2374 ${UNITY_MOCKPATH}/libusermetrics
2375- ${UNITY_MOCKPATH}/LightDM/IntegratedLightDM/liblightdm
2376 )
2377 endif()
2378
2379
2380=== modified file 'tests/autopilot/unity8/fixture_setup.py'
2381--- tests/autopilot/unity8/fixture_setup.py 2015-10-26 20:15:08 +0000
2382+++ tests/autopilot/unity8/fixture_setup.py 2016-08-25 20:40:06 +0000
2383@@ -74,7 +74,7 @@
2384 def _get_lightdm_mock_path(self):
2385 lib_path = get_mocks_library_path()
2386 lightdm_mock_path = os.path.abspath(
2387- os.path.join(lib_path, "LightDM" ,"IntegratedLightDM", "liblightdm")
2388+ os.path.join(lib_path, "liblightdm")
2389 )
2390
2391 if not os.path.exists(lightdm_mock_path):
2392
2393=== modified file 'tests/autopilot/unity8/shell/tests/__init__.py'
2394--- tests/autopilot/unity8/shell/tests/__init__.py 2015-10-26 20:15:08 +0000
2395+++ tests/autopilot/unity8/shell/tests/__init__.py 2016-08-25 20:40:06 +0000
2396@@ -261,7 +261,7 @@
2397 def _get_lightdm_mock_path(self):
2398 lib_path = get_mocks_library_path()
2399 lightdm_mock_path = os.path.abspath(
2400- os.path.join(lib_path, "LightDM" ,"IntegratedLightDM", "liblightdm")
2401+ os.path.join(lib_path, "liblightdm")
2402 )
2403
2404 if not os.path.exists(lightdm_mock_path):
2405
2406=== modified file 'tests/mocks/AccountsService/AccountsService.cpp'
2407--- tests/mocks/AccountsService/AccountsService.cpp 2016-06-20 15:24:27 +0000
2408+++ tests/mocks/AccountsService/AccountsService.cpp 2016-08-25 20:40:06 +0000
2409@@ -24,6 +24,7 @@
2410 m_enableLauncherWhileLocked(true),
2411 m_enableIndicatorsWhileLocked(true),
2412 m_backgroundFile(qmlDirectory() + "/graphics/phone_background.jpg"),
2413+ m_greeterMode(true),
2414 m_statsWelcomeScreen(true),
2415 m_failedLogins(0),
2416 m_failedFingerprintLogins(0),
2417@@ -46,6 +47,19 @@
2418 Q_EMIT passwordDisplayHintChanged();
2419 }
2420
2421+bool AccountsService::greeterMode() const
2422+{
2423+ return m_greeterMode;
2424+}
2425+
2426+void AccountsService::setGreeterMode(bool greeterMode)
2427+{
2428+ if (m_greeterMode != greeterMode) {
2429+ m_greeterMode = greeterMode;
2430+ Q_EMIT greeterModeChanged();
2431+ }
2432+}
2433+
2434 bool AccountsService::demoEdges() const
2435 {
2436 return m_demoEdges;
2437
2438=== modified file 'tests/mocks/AccountsService/AccountsService.h'
2439--- tests/mocks/AccountsService/AccountsService.h 2016-06-30 22:42:32 +0000
2440+++ tests/mocks/AccountsService/AccountsService.h 2016-08-25 20:40:06 +0000
2441@@ -30,6 +30,10 @@
2442 READ user
2443 WRITE setUser
2444 NOTIFY userChanged)
2445+ Q_PROPERTY (bool greeterMode
2446+ READ greeterMode
2447+ WRITE setGreeterMode
2448+ NOTIFY greeterModeChanged)
2449 Q_PROPERTY (bool demoEdges
2450 READ demoEdges
2451 WRITE setDemoEdges
2452@@ -97,6 +101,8 @@
2453
2454 QString user() const;
2455 void setUser(const QString &user);
2456+ bool greeterMode() const;
2457+ void setGreeterMode(bool greeterMode);
2458 bool demoEdges() const;
2459 void setDemoEdges(bool demoEdges);
2460 QStringList demoEdgesCompleted() const;
2461@@ -131,6 +137,7 @@
2462
2463 Q_SIGNALS:
2464 void userChanged();
2465+ void greeterModeChanged();
2466 void demoEdgesChanged();
2467 void demoEdgesCompletedChanged();
2468 void enableFingerprintIdentificationChanged();
2469@@ -153,6 +160,7 @@
2470 bool m_enableIndicatorsWhileLocked;
2471 QString m_backgroundFile;
2472 QString m_user;
2473+ bool m_greeterMode;
2474 bool m_statsWelcomeScreen;
2475 uint m_failedLogins;
2476 uint m_failedFingerprintLogins;
2477
2478=== modified file 'tests/mocks/CMakeLists.txt'
2479--- tests/mocks/CMakeLists.txt 2016-06-27 14:51:40 +0000
2480+++ tests/mocks/CMakeLists.txt 2016-08-25 20:40:06 +0000
2481@@ -33,8 +33,8 @@
2482 add_subdirectory(Cursor)
2483 add_subdirectory(GSettings.1.0)
2484 add_subdirectory(indicator-service)
2485+add_subdirectory(liblightdm)
2486 add_subdirectory(libusermetrics)
2487-add_subdirectory(LightDM)
2488 add_subdirectory(Lights)
2489 add_subdirectory(MeeGo)
2490 add_subdirectory(Powerd)
2491
2492=== removed directory 'tests/mocks/LightDM'
2493=== removed file 'tests/mocks/LightDM/CMakeLists.txt'
2494--- tests/mocks/LightDM/CMakeLists.txt 2015-09-25 13:01:00 +0000
2495+++ tests/mocks/LightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000
2496@@ -1,1 +0,0 @@
2497-add_subdirectory(IntegratedLightDM)
2498
2499=== removed directory 'tests/mocks/LightDM/IntegratedLightDM'
2500=== removed file 'tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt'
2501--- tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt 2015-11-19 00:25:25 +0000
2502+++ tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000
2503@@ -1,51 +0,0 @@
2504-# This is a copy of the normal LightDM plugin, but instead of statically
2505-# linking in the lightdm bits, this one uses shared libraries so we can swap
2506-# out different sets of users for different tests. When we finally switch to
2507-# actually using the system liblightdm in the normal plugin, this version can
2508-# be deleted.
2509-
2510-add_subdirectory(liblightdm)
2511-
2512-include_directories(
2513- ${CMAKE_CURRENT_SOURCE_DIR}
2514- ${CMAKE_CURRENT_BINARY_DIR}
2515- ${CMAKE_SOURCE_DIR}/plugins/Utils
2516- ${CMAKE_SOURCE_DIR}/plugins/LightDM
2517- ${CMAKE_SOURCE_DIR}/tests/mocks/libusermetrics
2518- ${libunity8-private_SOURCE_DIR}
2519-)
2520-
2521-set(QMLPLUGIN_SRC
2522- ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeter.cpp
2523- ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeterList.cpp
2524- ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
2525- ${CMAKE_SOURCE_DIR}/plugins/LightDM/SessionsModel.cpp
2526- ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
2527- ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
2528- MockGreeter.cpp
2529- MockSessionsModel.cpp
2530- MockUsersModel.cpp
2531- plugin.cpp
2532- )
2533-
2534-add_library(MockLightDM-qml MODULE
2535- ${QMLPLUGIN_SRC}
2536- )
2537-
2538-# We want to link to liblightdm-qt5-3, but we don't want to depend on it being
2539-# installed on the system. So we make sure we link to our full fake version
2540-# At run time, we can point to whichever version we happen to be using via
2541-# LD_LIBRARY_PATH.
2542-target_link_libraries(MockLightDM-qml
2543- MockLightDM
2544- MockUserMetrics
2545- unity8-private
2546- )
2547-
2548-qt5_use_modules(MockLightDM-qml DBus Gui Qml)
2549-
2550-add_unity8_mock(LightDM.IntegratedLightDM 0.1 LightDM/IntegratedLightDM
2551- PREFIX mocks
2552- TARGETS MockLightDM-qml
2553- ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/liblightdm"
2554-)
2555
2556=== removed file 'tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp'
2557--- tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp 2016-06-09 21:45:09 +0000
2558+++ tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp 1970-01-01 00:00:00 +0000
2559@@ -1,51 +0,0 @@
2560-/*
2561- * Copyright (C) 2014 Canonical, Ltd.
2562- *
2563- * This program is free software; you can redistribute it and/or modify
2564- * it under the terms of the GNU General Public License as published by
2565- * the Free Software Foundation; version 3.
2566- *
2567- * This program is distributed in the hope that it will be useful,
2568- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2569- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2570- * GNU General Public License for more details.
2571- *
2572- * You should have received a copy of the GNU General Public License
2573- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2574- *
2575- */
2576-
2577-#include "MockGreeter.h"
2578-#include <GreeterPrivate.h>
2579-
2580-QString MockGreeter::mockMode() const
2581-{
2582- Q_D(const Greeter);
2583- return d->m_greeter->mockMode();
2584-}
2585-
2586-void MockGreeter::setMockMode(QString mockMode)
2587-{
2588- Q_D(Greeter);
2589-
2590- if (d->m_greeter->mockMode() != mockMode) {
2591- d->m_greeter->setMockMode(mockMode);
2592- Q_EMIT mockModeChanged(mockMode);
2593- }
2594-}
2595-
2596-QString MockGreeter::selectUserHint() const
2597-{
2598- Q_D(const Greeter);
2599- return d->m_greeter->selectUserHint();
2600-}
2601-
2602-void MockGreeter::setSelectUserHint(const QString &selectUserHint)
2603-{
2604- Q_D(Greeter);
2605-
2606- if (d->m_greeter->selectUserHint() != selectUserHint) {
2607- d->m_greeter->setSelectUserHint(selectUserHint);
2608- Q_EMIT selectUserHintChanged();
2609- }
2610-}
2611
2612=== removed file 'tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h'
2613--- tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h 2016-06-09 21:45:09 +0000
2614+++ tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h 1970-01-01 00:00:00 +0000
2615@@ -1,42 +0,0 @@
2616-/*
2617- * Copyright (C) 2014 Canonical, Ltd.
2618- *
2619- * This program is free software; you can redistribute it and/or modify
2620- * it under the terms of the GNU General Public License as published by
2621- * the Free Software Foundation; version 3.
2622- *
2623- * This program is distributed in the hope that it will be useful,
2624- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2625- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2626- * GNU General Public License for more details.
2627- *
2628- * You should have received a copy of the GNU General Public License
2629- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2630- *
2631- */
2632-
2633-// The real, production, Greeter
2634-#include <Greeter.h>
2635-
2636-#ifndef MOCK_UNITY_GREETER_H
2637-#define MOCK_UNITY_GREETER_H
2638-
2639-class MockGreeter : public Greeter {
2640- Q_OBJECT
2641-
2642- Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
2643- Q_PROPERTY(QString selectUser READ selectUserHint WRITE setSelectUserHint NOTIFY selectUserHintChanged)
2644-
2645-public:
2646- QString mockMode() const;
2647- void setMockMode(QString mockMode);
2648-
2649- QString selectUserHint() const;
2650- void setSelectUserHint(const QString &selectUserHint);
2651-
2652-Q_SIGNALS:
2653- void mockModeChanged(QString mode);
2654- void selectUserHintChanged();
2655-};
2656-
2657-#endif // MOCK_UNITY_GREETER_H
2658
2659=== removed file 'tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp'
2660--- tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp 2015-11-23 22:57:45 +0000
2661+++ tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp 1970-01-01 00:00:00 +0000
2662@@ -1,37 +0,0 @@
2663-/*
2664- * Copyright (C) 2015 Canonical, Ltd.
2665- *
2666- * This program is free software; you can redistribute it and/or modify
2667- * it under the terms of the GNU General Public License as published by
2668- * the Free Software Foundation; version 3.
2669- *
2670- * This program is distributed in the hope that it will be useful,
2671- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2672- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2673- * GNU General Public License for more details.
2674- *
2675- * You should have received a copy of the GNU General Public License
2676- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2677- *
2678- */
2679-
2680-#include "MockSessionsModel.h"
2681-#include <QLightDM/SessionsModel>
2682-
2683-QString MockSessionsModel::testScenario() const
2684-{
2685- QLightDM::SessionsModel* qSessionsModel =
2686- static_cast<QLightDM::SessionsModel*>(sourceModel());
2687-
2688- return qSessionsModel->testScenario();
2689-}
2690-
2691-void MockSessionsModel::setTestScenario(const QString testScenario)
2692-{
2693- QLightDM::SessionsModel* qSessionsModel =
2694- static_cast<QLightDM::SessionsModel*>(sourceModel());
2695-
2696- if (qSessionsModel->testScenario() != testScenario) {
2697- qSessionsModel->setTestScenario(testScenario);
2698- }
2699-}
2700
2701=== removed file 'tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h'
2702--- tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h 2015-11-19 00:25:25 +0000
2703+++ tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h 1970-01-01 00:00:00 +0000
2704@@ -1,34 +0,0 @@
2705-/*
2706- * Copyright (C) 2015 Canonical, Ltd.
2707- *
2708- * This program is free software; you can redistribute it and/or modify
2709- * it under the terms of the GNU General Public License as published by
2710- * the Free Software Foundation; version 3.
2711- *
2712- * This program is distributed in the hope that it will be useful,
2713- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2714- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2715- * GNU General Public License for more details.
2716- *
2717- * You should have received a copy of the GNU General Public License
2718- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2719- *
2720- */
2721-
2722-#ifndef MOCK_UNITY_SESSIONSMODEL_H
2723-#define MOCK_UNITY_SESSIONSMODEL_H
2724-
2725-#include <SessionsModel.h>
2726-
2727-class MockSessionsModel : public SessionsModel
2728-{
2729- Q_OBJECT
2730-
2731- Q_PROPERTY(QString testScenario READ testScenario WRITE setTestScenario)
2732-
2733-public:
2734- QString testScenario() const;
2735- void setTestScenario(QString testScenario);
2736-};
2737-
2738-#endif // MOCK_UNITY_SESSIONSMODEL_H
2739
2740=== removed file 'tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp'
2741--- tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp 2015-09-25 13:01:00 +0000
2742+++ tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp 1970-01-01 00:00:00 +0000
2743@@ -1,39 +0,0 @@
2744-/*
2745- * Copyright (C) 2014 Canonical, Ltd.
2746- *
2747- * This program is free software; you can redistribute it and/or modify
2748- * it under the terms of the GNU General Public License as published by
2749- * the Free Software Foundation; version 3.
2750- *
2751- * This program is distributed in the hope that it will be useful,
2752- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2753- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2754- * GNU General Public License for more details.
2755- *
2756- * You should have received a copy of the GNU General Public License
2757- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2758- *
2759- */
2760-
2761-#include "MockUsersModel.h"
2762-#include <QLightDM/UsersModel>
2763-#include <QSortFilterProxyModel>
2764-
2765-QString MockUsersModel::mockMode() const
2766-{
2767- QLightDM::UsersModel* qUsersModel =
2768- static_cast<QLightDM::UsersModel*>(static_cast<QSortFilterProxyModel*>(sourceModel())->sourceModel());
2769-
2770- return qUsersModel->mockMode();
2771-}
2772-
2773-void MockUsersModel::setMockMode(QString mockMode)
2774-{
2775- QLightDM::UsersModel* qUsersModel =
2776- static_cast<QLightDM::UsersModel*>(static_cast<QSortFilterProxyModel*>(sourceModel())->sourceModel());
2777-
2778- if (qUsersModel->mockMode() != mockMode) {
2779- qUsersModel->setMockMode(mockMode);
2780- Q_EMIT mockModeChanged(mockMode);
2781- }
2782-}
2783
2784=== removed file 'tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h'
2785--- tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h 2015-09-25 13:01:00 +0000
2786+++ tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h 1970-01-01 00:00:00 +0000
2787@@ -1,37 +0,0 @@
2788-/*
2789- * Copyright (C) 2014 Canonical, Ltd.
2790- *
2791- * This program is free software; you can redistribute it and/or modify
2792- * it under the terms of the GNU General Public License as published by
2793- * the Free Software Foundation; version 3.
2794- *
2795- * This program is distributed in the hope that it will be useful,
2796- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2797- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2798- * GNU General Public License for more details.
2799- *
2800- * You should have received a copy of the GNU General Public License
2801- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2802- *
2803- */
2804-
2805-#ifndef MOCK_UNITY_USERSMODEL_H
2806-#define MOCK_UNITY_USERSMODEL_H
2807-
2808-#include <UsersModel.h>
2809-
2810-class MockUsersModel : public UsersModel
2811-{
2812- Q_OBJECT
2813-
2814- Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
2815-
2816-public:
2817- QString mockMode() const;
2818- void setMockMode(QString mockMode);
2819-
2820-Q_SIGNALS:
2821- void mockModeChanged(QString mode);
2822-};
2823-
2824-#endif // MOCK_UNITY_USERSMODEL_H
2825
2826=== removed directory 'tests/mocks/LightDM/IntegratedLightDM/QLightDM'
2827=== removed file 'tests/mocks/LightDM/IntegratedLightDM/QLightDM/Greeter'
2828--- tests/mocks/LightDM/IntegratedLightDM/QLightDM/Greeter 2015-01-20 11:50:19 +0000
2829+++ tests/mocks/LightDM/IntegratedLightDM/QLightDM/Greeter 1970-01-01 00:00:00 +0000
2830@@ -1,17 +0,0 @@
2831-/*
2832- * Copyright (C) 2014 Canonical, Ltd.
2833- *
2834- * This program is free software; you can redistribute it and/or modify
2835- * it under the terms of the GNU General Public License as published by
2836- * the Free Software Foundation; version 3.
2837- *
2838- * This program is distributed in the hope that it will be useful,
2839- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2840- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2841- * GNU General Public License for more details.
2842- *
2843- * You should have received a copy of the GNU General Public License
2844- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2845- */
2846-
2847-#include "../liblightdm/Greeter.h"
2848
2849=== removed file 'tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel'
2850--- tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel 2015-11-18 03:52:01 +0000
2851+++ tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel 1970-01-01 00:00:00 +0000
2852@@ -1,17 +0,0 @@
2853-/*
2854- * Copyright (C) 2015 Canonical, Ltd.
2855- *
2856- * This program is free software; you can redistribute it and/or modify
2857- * it under the terms of the GNU General Public License as published by
2858- * the Free Software Foundation; version 3.
2859- *
2860- * This program is distributed in the hope that it will be useful,
2861- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2862- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2863- * GNU General Public License for more details.
2864- *
2865- * You should have received a copy of the GNU General Public License
2866- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2867- */
2868-
2869-#include "../liblightdm/SessionsModel.h"
2870
2871=== removed file 'tests/mocks/LightDM/IntegratedLightDM/QLightDM/UsersModel'
2872--- tests/mocks/LightDM/IntegratedLightDM/QLightDM/UsersModel 2015-01-20 11:50:19 +0000
2873+++ tests/mocks/LightDM/IntegratedLightDM/QLightDM/UsersModel 1970-01-01 00:00:00 +0000
2874@@ -1,17 +0,0 @@
2875-/*
2876- * Copyright (C) 2014 Canonical, Ltd.
2877- *
2878- * This program is free software; you can redistribute it and/or modify
2879- * it under the terms of the GNU General Public License as published by
2880- * the Free Software Foundation; version 3.
2881- *
2882- * This program is distributed in the hope that it will be useful,
2883- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2884- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2885- * GNU General Public License for more details.
2886- *
2887- * You should have received a copy of the GNU General Public License
2888- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2889- */
2890-
2891-#include "../liblightdm/UsersModel.h"
2892
2893=== removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp'
2894--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp 2016-06-09 21:45:09 +0000
2895+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp 1970-01-01 00:00:00 +0000
2896@@ -1,132 +0,0 @@
2897-/*
2898- * Copyright (C) 2014 Canonical, Ltd.
2899- *
2900- * This program is free software; you can redistribute it and/or modify
2901- * it under the terms of the GNU General Public License as published by
2902- * the Free Software Foundation; version 3.
2903- *
2904- * This program is distributed in the hope that it will be useful,
2905- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2906- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2907- * GNU General Public License for more details.
2908- *
2909- * You should have received a copy of the GNU General Public License
2910- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2911- */
2912-
2913-#include "Greeter.h"
2914-#include "GreeterPrivate.h"
2915-
2916-namespace QLightDM
2917-{
2918-
2919-GreeterPrivate::GreeterPrivate(Greeter* parent)
2920- : authenticated(false),
2921- authenticationUser(),
2922- twoFactorDone(false),
2923- mockMode("single"),
2924- q_ptr(parent)
2925-{
2926- char *envMockMode = getenv("LIBLIGHTDM_MOCK_MODE");
2927- if (envMockMode) {
2928- mockMode = envMockMode;
2929- }
2930-}
2931-
2932-void GreeterPrivate::handleAuthenticate()
2933-{
2934- Q_Q(Greeter);
2935-
2936- if (mockMode == "single") {
2937- authenticated = true;
2938- Q_EMIT q->authenticationComplete();
2939- } else if (mockMode == "single-passphrase" || mockMode == "single-pin") {
2940- Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret);
2941- } else if (mockMode == "full") {
2942- handleAuthenticate_full();
2943- }
2944-}
2945-
2946-void GreeterPrivate::handleAuthenticate_full()
2947-{
2948- Q_Q(Greeter);
2949-
2950- // Send out any messages we need to
2951- if (authenticationUser == "info-prompt")
2952- Q_EMIT q->showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo);
2953- else if (authenticationUser == "wide-info-prompt")
2954- Q_EMIT q->showMessage("Welcome to Unity Greeter, the greeteriest greeter that ever did appear in these fine lands", Greeter::MessageTypeInfo);
2955- else if (authenticationUser == "html-info-prompt")
2956- Q_EMIT q->showMessage("<b>&</b>", Greeter::MessageTypeInfo);
2957- else if (authenticationUser == "long-info-prompt")
2958- Q_EMIT q->showMessage("Welcome to Unity Greeter\n\nWe like to annoy you with super ridiculously long messages.\nLike this one\n\nThis is the last line of a multiple line message.", Greeter::MessageTypeInfo);
2959- else if (authenticationUser == "multi-info-prompt") {
2960- Q_EMIT q->showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo);
2961- Q_EMIT q->showMessage("This is an error", Greeter::MessageTypeError);
2962- Q_EMIT q->showMessage("You should have seen three messages", Greeter::MessageTypeInfo);
2963- }
2964-
2965- // OK, now actually do the prompt
2966- if (authenticationUser == "no-password") {
2967- authenticated = true;
2968- Q_EMIT q->authenticationComplete();
2969- } else if (authenticationUser == "has-pin"){
2970- Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret);
2971- } else if (authenticationUser == "auth-error") {
2972- authenticated = false;
2973- Q_EMIT q->authenticationComplete();
2974- } else if (authenticationUser == "different-prompt") {
2975- Q_EMIT q->showPrompt("Secret word: ", Greeter::PromptTypeSecret);
2976- } else {
2977- Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret);
2978- }
2979-}
2980-
2981-void GreeterPrivate::handleRespond(QString const &response)
2982-{
2983- Q_Q(Greeter);
2984-
2985- if (mockMode == "single") {
2986- // NOOP
2987- } else if (mockMode == "single-passphrase") {
2988- authenticated = (response == "password");
2989- q->sendAuthenticationComplete();
2990- } else if (mockMode == "single-pin") {
2991- authenticated = (response == "1234");
2992- q->sendAuthenticationComplete();
2993- } else if (mockMode == "full") {
2994- handleRespond_full(response);
2995- }
2996-}
2997-
2998-void GreeterPrivate::handleRespond_full(const QString &response)
2999-{
3000- Q_Q(Greeter);
3001-
3002- if (authenticationUser == "no-response")
3003- return;
3004- else if (authenticationUser == "two-factor") {
3005- if (!twoFactorDone) {
3006- if (response == "password") {
3007- twoFactorDone = true;
3008- Q_EMIT q->showPrompt("otp", Greeter::PromptTypeQuestion);
3009- } else {
3010- authenticated = false;
3011- q->sendAuthenticationComplete();
3012- }
3013- } else {
3014- authenticated = (response == "otp");
3015- q->sendAuthenticationComplete();
3016- }
3017- return;
3018- }
3019-
3020- if (authenticationUser == "has-pin") {
3021- authenticated = (response == "1234");
3022- } else {
3023- authenticated = (response == "password");
3024- }
3025- q->sendAuthenticationComplete();
3026-}
3027-
3028-}
3029
3030=== removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h'
3031--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 2016-06-09 21:45:09 +0000
3032+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 1970-01-01 00:00:00 +0000
3033@@ -1,54 +0,0 @@
3034-/*
3035- * Copyright (C) 2014 Canonical, Ltd.
3036- *
3037- * This program is free software; you can redistribute it and/or modify
3038- * it under the terms of the GNU General Public License as published by
3039- * the Free Software Foundation; version 3.
3040- *
3041- * This program is distributed in the hope that it will be useful,
3042- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3043- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3044- * GNU General Public License for more details.
3045- *
3046- * You should have received a copy of the GNU General Public License
3047- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3048- */
3049-
3050-#ifndef UNITY_MOCK_GREETER_PRIVATE_H
3051-#define UNITY_MOCK_GREETER_PRIVATE_H
3052-
3053-#include <QtCore/QObject>
3054-
3055-namespace QLightDM
3056-{
3057-class Greeter;
3058-class GreeterImpl;
3059-
3060-class GreeterPrivate
3061-{
3062-public:
3063- explicit GreeterPrivate(Greeter* parent=0);
3064- virtual ~GreeterPrivate() = default;
3065-
3066- // These variables may not be used by all subclasses, that's no problem
3067- bool authenticated;
3068- QString authenticationUser;
3069- bool twoFactorDone;
3070- QString selectUserHint;
3071-
3072- QString mockMode;
3073-
3074- void handleAuthenticate();
3075- void handleRespond(const QString &response);
3076-
3077-protected:
3078- Greeter * const q_ptr;
3079-
3080-private:
3081- void handleAuthenticate_full();
3082- void handleRespond_full(const QString &response);
3083- Q_DECLARE_PUBLIC(Greeter)
3084-};
3085-}
3086-
3087-#endif // UNITY_MOCK_GREETER_PRIVATE_H
3088
3089=== removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp'
3090--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 2016-06-15 15:29:34 +0000
3091+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 1970-01-01 00:00:00 +0000
3092@@ -1,73 +0,0 @@
3093-/*
3094- * Copyright (C) 2015 Canonical, Ltd.
3095- *
3096- * This program is free software; you can redistribute it and/or modify
3097- * it under the terms of the GNU General Public License as published by
3098- * the Free Software Foundation; version 3.
3099- *
3100- * This program is distributed in the hope that it will be useful,
3101- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3102- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3103- * GNU General Public License for more details.
3104- *
3105- * You should have received a copy of the GNU General Public License
3106- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3107- */
3108-
3109-#include "SessionsModel.h"
3110-#include "SessionsModelPrivate.h"
3111-
3112-namespace QLightDM
3113-{
3114-
3115-SessionsModelPrivate::SessionsModelPrivate(SessionsModel* parent)
3116- : testScenario("singleSession")
3117- , q_ptr(parent)
3118-{
3119- resetEntries();
3120-}
3121-
3122-void SessionsModelPrivate::resetEntries()
3123-{
3124- Q_Q(SessionsModel);
3125-
3126- q->beginResetModel();
3127- if (testScenario == "multipleSessions") {
3128- resetEntries_multipleSessions();
3129- } else if (testScenario == "noSessions") {
3130- resetEntries_noSessions();
3131- } else {
3132- resetEntries_singleSession();
3133- }
3134- q->endResetModel();
3135-}
3136-
3137-void SessionsModelPrivate::resetEntries_multipleSessions()
3138-{
3139- sessionItems =
3140- {
3141- {"ubuntu", "", "Ubuntu", ""},
3142- {"ubuntu-2d", "", "Ubuntu 2D", ""},
3143- {"gnome", "", "GNOME", ""},
3144- {"gnome-classic", "", "GNOME Classic", ""},
3145- {"gnome-flashback-compiz", "", "GNOME Flashback (Compiz)", ""},
3146- {"gnome-flashback-metacity", "", "GNOME Flashback (Metacity)", ""},
3147- {"gnome-wayland", "", "GNOME on Wayland", ""},
3148- {"plasma", "", "Plasma", ""},
3149- {"kde", "", "KDE" , ""},
3150- {"xterm", "", "Recovery Console", ""},
3151- {"", "", "Unknown?", ""}
3152- };
3153-}
3154-
3155-void SessionsModelPrivate::resetEntries_noSessions()
3156-{
3157- sessionItems = {};
3158-}
3159-
3160-void SessionsModelPrivate::resetEntries_singleSession()
3161-{
3162- sessionItems = {{"ubuntu", "", "Ubuntu", ""}};
3163-}
3164-
3165-} // namespace QLightDM
3166
3167=== removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h'
3168--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 2016-06-15 15:29:34 +0000
3169+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 1970-01-01 00:00:00 +0000
3170@@ -1,59 +0,0 @@
3171-/*
3172- * Copyright (C) 2015 Canonical, Ltd.
3173- *
3174- * This program is free software; you can redistribute it and/or modify
3175- * it under the terms of the GNU General Public License as published by
3176- * the Free Software Foundation; version 3.
3177- *
3178- * This program is distributed in the hope that it will be useful,
3179- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3180- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3181- * GNU General Public License for more details.
3182- *
3183- * You should have received a copy of the GNU General Public License
3184- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3185- *
3186- */
3187-
3188-#ifndef UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
3189-#define UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
3190-
3191-#include <QtCore/QList>
3192-#include <QtCore/QString>
3193-
3194-namespace QLightDM
3195-{
3196-class SessionsModel;
3197-
3198-class SessionItem
3199-{
3200-public:
3201- QString key;
3202- QString type; // unused
3203- QString name;
3204- QString comment; // unused
3205-};
3206-
3207-class SessionsModelPrivate
3208-{
3209-public:
3210- explicit SessionsModelPrivate(SessionsModel* parent=0);
3211- virtual ~SessionsModelPrivate() = default;
3212-
3213- QList<SessionItem> sessionItems;
3214- QString testScenario;
3215-
3216- void resetEntries();
3217-protected:
3218- SessionsModel* const q_ptr;
3219-
3220-private:
3221- void resetEntries_multipleSessions();
3222- void resetEntries_noSessions();
3223- void resetEntries_singleSession();
3224- Q_DECLARE_PUBLIC(SessionsModel)
3225-};
3226-
3227-} // namespace QLightDM
3228-
3229-#endif // UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
3230
3231=== removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp'
3232--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 2016-06-30 15:49:16 +0000
3233+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 1970-01-01 00:00:00 +0000
3234@@ -1,110 +0,0 @@
3235-/*
3236- * Copyright (C) 2014-2016 Canonical, Ltd.
3237- *
3238- * This program is free software; you can redistribute it and/or modify
3239- * it under the terms of the GNU General Public License as published by
3240- * the Free Software Foundation; version 3.
3241- *
3242- * This program is distributed in the hope that it will be useful,
3243- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3244- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3245- * GNU General Public License for more details.
3246- *
3247- * You should have received a copy of the GNU General Public License
3248- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3249- */
3250-
3251-#include "UsersModelPrivate.h"
3252-#include "UsersModel.h"
3253-
3254-namespace QLightDM
3255-{
3256-
3257-UsersModelPrivate::UsersModelPrivate(UsersModel* parent)
3258- : mockMode("single")
3259- , q_ptr(parent)
3260-{
3261- char *envMockMode = getenv("LIBLIGHTDM_MOCK_MODE");
3262- if (envMockMode) {
3263- mockMode = envMockMode;
3264- }
3265- resetEntries();
3266-}
3267-
3268-void UsersModelPrivate::resetEntries()
3269-{
3270- Q_Q(UsersModel);
3271-
3272- q->beginResetModel();
3273-
3274- if (mockMode == "single") {
3275- resetEntries_single();
3276- } else if (mockMode == "single-passphrase") {
3277- resetEntries_singlePassphrase();
3278- } else if (mockMode == "single-pin") {
3279- resetEntries_singlePin();
3280- } else if (mockMode == "full") {
3281- resetEntries_full();
3282- }
3283-
3284- // Assign uids in a loop, just to avoid having to muck with them when
3285- // adding or removing test users.
3286- for (int i = 0; i < entries.size(); i++) {
3287- entries[i].uid = i + 1;
3288- }
3289-
3290- q->endResetModel();
3291-}
3292-
3293-void UsersModelPrivate::resetEntries_single()
3294-{
3295- entries =
3296- {
3297- { "single", "Single User", 0, 0, false, false, "ubuntu", 0 },
3298- };
3299-}
3300-
3301-void UsersModelPrivate::resetEntries_singlePassphrase()
3302-{
3303- entries =
3304- {
3305- { "single", "Single User", 0, 0, false, false, "ubuntu", 0 },
3306- };
3307-}
3308-
3309-void UsersModelPrivate::resetEntries_singlePin()
3310-{
3311- entries =
3312- {
3313- { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
3314- };
3315-}
3316-
3317-void UsersModelPrivate::resetEntries_full()
3318-{
3319- entries =
3320- {
3321- { "has-password", "Has Password", 0, 0, false, false, "ubuntu", 0 },
3322- { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
3323- { "different-prompt", "Different Prompt", 0, 0, false, false, "ubuntu", 0 },
3324- { "no-password", "No Password", 0, 0, false, false, "ubuntu", 0 },
3325- { "auth-error", "Auth Error", 0, 0, false, false, "ubuntu", 0 },
3326- { "two-factor", "Two Factor", 0, 0, false, false, "ubuntu", 0 },
3327- { "info-prompt", "Info Prompt", 0, 0, false, false, "ubuntu", 0 },
3328- { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, "ubuntu", 0 },
3329- { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, "ubuntu", 0 },
3330- { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "ubuntu", 0 },
3331- { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "ubuntu", 0 },
3332- { "long-name", "Long name (far far too long to fit, seriously this would never fit on the screen, you will never see this part of the name)", 0, 0, false, false, "ubuntu", 0 },
3333- { "color-background", "Color Background", "#dd4814", 0, false, false, "ubuntu", 0 },
3334- // white and black are a bit redundant, but useful for manually testing if UI is still readable
3335- { "white-background", "White Background", "#ffffff", 0, false, false, "ubuntu", 0 },
3336- { "black-background", "Black Background", "#000000", 0, false, false, "ubuntu", 0 },
3337- { "no-background", "No Background", "", 0, false, false, "ubuntu", 0 },
3338- { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 },
3339- { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 },
3340- { "empty-name", "", 0, 0, false, false, "ubuntu", 0 },
3341- };
3342-}
3343-
3344-} // namespace QLightDM
3345
3346=== removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h'
3347--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h 2016-05-24 22:11:21 +0000
3348+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h 1970-01-01 00:00:00 +0000
3349@@ -1,64 +0,0 @@
3350-/*
3351- * Copyright (C) 2014-2016 Canonical, Ltd.
3352- *
3353- * This program is free software; you can redistribute it and/or modify
3354- * it under the terms of the GNU General Public License as published by
3355- * the Free Software Foundation; version 3.
3356- *
3357- * This program is distributed in the hope that it will be useful,
3358- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3359- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3360- * GNU General Public License for more details.
3361- *
3362- * You should have received a copy of the GNU General Public License
3363- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3364- */
3365-
3366-#ifndef UNITY_MOCK_USERSMODEL_PRIVATE_H
3367-#define UNITY_MOCK_USERSMODEL_PRIVATE_H
3368-
3369-#include <QtCore/QList>
3370-#include <QtCore/QString>
3371-
3372-namespace QLightDM
3373-{
3374-class UsersModel;
3375-
3376-class Entry
3377-{
3378-public:
3379- QString username;
3380- QString real_name;
3381- QString background;
3382- QString layouts;
3383- bool is_active;
3384- bool has_messages;
3385- QString session;
3386- QString infographic;
3387- uid_t uid;
3388-};
3389-
3390-class UsersModelPrivate
3391-{
3392-public:
3393- explicit UsersModelPrivate(UsersModel *parent = 0);
3394- virtual ~UsersModelPrivate() = default;
3395-
3396- QList<Entry> entries;
3397- QString mockMode;
3398-
3399- void resetEntries();
3400-protected:
3401- UsersModel * const q_ptr;
3402-
3403-private:
3404- void resetEntries_single();
3405- void resetEntries_singlePassphrase();
3406- void resetEntries_singlePin();
3407- void resetEntries_full();
3408- Q_DECLARE_PUBLIC(UsersModel)
3409-};
3410-
3411-}
3412-
3413-#endif // UNITY_MOCK_USERSMODEL_PRIVATE_H
3414
3415=== removed file 'tests/mocks/LightDM/IntegratedLightDM/plugin.cpp'
3416--- tests/mocks/LightDM/IntegratedLightDM/plugin.cpp 2015-11-18 03:52:01 +0000
3417+++ tests/mocks/LightDM/IntegratedLightDM/plugin.cpp 1970-01-01 00:00:00 +0000
3418@@ -1,79 +0,0 @@
3419-/*
3420- * Copyright (C) 2014, 2015 Canonical, Ltd.
3421- *
3422- * This program is free software; you can redistribute it and/or modify
3423- * it under the terms of the GNU General Public License as published by
3424- * the Free Software Foundation; version 3.
3425- *
3426- * This program is distributed in the hope that it will be useful,
3427- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3428- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3429- * GNU General Public License for more details.
3430- *
3431- * You should have received a copy of the GNU General Public License
3432- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3433- */
3434-
3435-#include "plugin.h"
3436-#include <DBusGreeter.h>
3437-#include <DBusGreeterList.h>
3438-#include "MockGreeter.h"
3439-#include "MockSessionsModel.h"
3440-#include "MockUsersModel.h"
3441-#include <QLightDM/SessionsModel>
3442-#include "ColorTheme.h"
3443-#include "UserMetrics.h"
3444-#include <QLightDM/UsersModel>
3445-
3446-#include <QAbstractItemModel>
3447-#include <QDBusConnection>
3448-#include <QtQml/qqml.h>
3449-
3450-static QObject *greeter_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
3451-{
3452- Q_UNUSED(engine)
3453- Q_UNUSED(scriptEngine)
3454-
3455- MockGreeter *greeter = new MockGreeter;
3456- new DBusGreeter(greeter, "/");
3457- new DBusGreeterList(greeter, "/list");
3458-
3459- return greeter;
3460-}
3461-
3462-static QObject *sessions_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
3463-{
3464- Q_UNUSED(engine)
3465- Q_UNUSED(scriptEngine)
3466- return new MockSessionsModel;
3467-}
3468-
3469-static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
3470-{
3471- Q_UNUSED(engine)
3472- Q_UNUSED(scriptEngine)
3473- return new MockUsersModel;
3474-}
3475-
3476-static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
3477-{
3478- Q_UNUSED(engine)
3479- Q_UNUSED(scriptEngine)
3480- return UserMetricsOutput::UserMetrics::getInstance();
3481-}
3482-
3483-void LightDMPlugin::registerTypes(const char *uri)
3484-{
3485- qmlRegisterType<QAbstractItemModel>();
3486- qmlRegisterType<UserMetricsOutput::ColorTheme>();
3487-
3488- Q_ASSERT(uri == QLatin1String("LightDM.IntegratedLightDM"));
3489- qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
3490- qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
3491- qmlRegisterSingletonType<MockGreeter>(uri, 0, 1, "Greeter", greeter_provider);
3492- qmlRegisterSingletonType<MockSessionsModel>(uri, 0, 1, "Sessions", sessions_provider);
3493- qmlRegisterUncreatableType<SessionsModel>(uri, 0, 1, "SessionRoles", "Type is not instantiable");
3494- qmlRegisterSingletonType<MockUsersModel>(uri, 0, 1, "Users", users_provider);
3495- qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", "Type is not instantiable");
3496- qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
3497-}
3498
3499=== removed file 'tests/mocks/LightDM/IntegratedLightDM/plugin.h'
3500--- tests/mocks/LightDM/IntegratedLightDM/plugin.h 2015-09-25 13:01:00 +0000
3501+++ tests/mocks/LightDM/IntegratedLightDM/plugin.h 1970-01-01 00:00:00 +0000
3502@@ -1,32 +0,0 @@
3503-/*
3504- * Copyright (C) 2014, 2015 Canonical, Ltd.
3505- *
3506- * This program is free software; you can redistribute it and/or modify
3507- * it under the terms of the GNU General Public License as published by
3508- * the Free Software Foundation; version 3.
3509- *
3510- * This program is distributed in the hope that it will be useful,
3511- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3512- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3513- * GNU General Public License for more details.
3514- *
3515- * You should have received a copy of the GNU General Public License
3516- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3517- */
3518-
3519-#ifndef MOCK_LIGHTDM_PLUGIN_H
3520-#define MOCK_LIGHTDM_PLUGIN_H
3521-
3522-#include <QtQml/QQmlEngine>
3523-#include <QtQml/QQmlExtensionPlugin>
3524-
3525-class LightDMPlugin : public QQmlExtensionPlugin
3526-{
3527- Q_OBJECT
3528- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
3529-
3530-public:
3531- void registerTypes(const char *uri) override;
3532-};
3533-
3534-#endif
3535
3536=== removed file 'tests/mocks/LightDM/IntegratedLightDM/qmldir'
3537--- tests/mocks/LightDM/IntegratedLightDM/qmldir 2015-09-25 13:01:00 +0000
3538+++ tests/mocks/LightDM/IntegratedLightDM/qmldir 1970-01-01 00:00:00 +0000
3539@@ -1,2 +0,0 @@
3540-module LightDM.IntegratedLightDM
3541-plugin MockLightDM-qml
3542
3543=== renamed directory 'tests/mocks/LightDM/IntegratedLightDM/liblightdm' => 'tests/mocks/liblightdm'
3544=== modified file 'tests/mocks/liblightdm/CMakeLists.txt'
3545--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt 2015-11-18 03:52:01 +0000
3546+++ tests/mocks/liblightdm/CMakeLists.txt 2016-08-25 20:40:06 +0000
3547@@ -1,20 +1,18 @@
3548-set(LibLightDM_SOURCES
3549- Greeter.cpp
3550- SessionsModel.cpp
3551- UsersModel.cpp
3552- GreeterPrivate.cpp
3553- SessionsModelPrivate.cpp
3554- UsersModelPrivate.cpp
3555- ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
3556+set(MockLightDM_SOURCES
3557+ MockController.cpp
3558+ MockGreeter.cpp
3559+ MockSessionsModel.cpp
3560+ MockUsersModel.cpp
3561 )
3562
3563-add_library(MockLightDM SHARED ${LibLightDM_SOURCES})
3564+add_library(MockLightDM SHARED ${MockLightDM_SOURCES})
3565
3566-qt5_use_modules(MockLightDM Gui)
3567+qt5_use_modules(MockLightDM DBus Gui)
3568
3569 set_target_properties(MockLightDM PROPERTIES
3570- OUTPUT_NAME lightdm-qt5-3)
3571+ OUTPUT_NAME lightdm-qt5-3
3572+ VERSION 0)
3573
3574 install(TARGETS MockLightDM
3575- DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/liblightdm
3576+ DESTINATION ${SHELL_INSTALL_QML}/mocks/liblightdm
3577 )
3578
3579=== added file 'tests/mocks/liblightdm/MockController.cpp'
3580--- tests/mocks/liblightdm/MockController.cpp 1970-01-01 00:00:00 +0000
3581+++ tests/mocks/liblightdm/MockController.cpp 2016-08-25 20:40:06 +0000
3582@@ -0,0 +1,85 @@
3583+/*
3584+ * Copyright (C) 2016 Canonical, Ltd.
3585+ *
3586+ * This program is free software; you can redistribute it and/or modify
3587+ * it under the terms of the GNU General Public License as published by
3588+ * the Free Software Foundation; version 3.
3589+ *
3590+ * This program is distributed in the hope that it will be useful,
3591+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3592+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3593+ * GNU General Public License for more details.
3594+ *
3595+ * You should have received a copy of the GNU General Public License
3596+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3597+ */
3598+
3599+#include "MockController.h"
3600+
3601+static QLightDM::MockController *m_instance = nullptr;
3602+
3603+namespace QLightDM
3604+{
3605+
3606+MockController::MockController(QObject *parent)
3607+ : QObject(parent)
3608+{
3609+ m_userMode = qgetenv("LIBLIGHTDM_MOCK_MODE");
3610+ if (m_userMode.isEmpty()) {
3611+ m_userMode = "full";
3612+ }
3613+ m_sessionMode = "full";
3614+}
3615+
3616+MockController::~MockController()
3617+{
3618+}
3619+
3620+MockController *MockController::instance()
3621+{
3622+ if (!m_instance) {
3623+ m_instance = new MockController;
3624+ }
3625+ return m_instance;
3626+}
3627+
3628+QString MockController::selectUserHint() const
3629+{
3630+ return m_selectUserHint;
3631+}
3632+
3633+void MockController::setSelectUserHint(const QString &selectUserHint)
3634+{
3635+ if (m_selectUserHint != selectUserHint) {
3636+ m_selectUserHint = selectUserHint;
3637+ Q_EMIT selectUserHintChanged();
3638+ }
3639+}
3640+
3641+QString MockController::userMode() const
3642+{
3643+ return m_userMode;
3644+}
3645+
3646+void MockController::setUserMode(const QString &userMode)
3647+{
3648+ if (m_userMode != userMode) {
3649+ m_userMode = userMode;
3650+ Q_EMIT userModeChanged();
3651+ }
3652+}
3653+
3654+QString MockController::sessionMode() const
3655+{
3656+ return m_sessionMode;
3657+}
3658+
3659+void MockController::setSessionMode(const QString &sessionMode)
3660+{
3661+ if (m_sessionMode != sessionMode) {
3662+ m_sessionMode = sessionMode;
3663+ Q_EMIT sessionModeChanged();
3664+ }
3665+}
3666+
3667+}
3668
3669=== added file 'tests/mocks/liblightdm/MockController.h'
3670--- tests/mocks/liblightdm/MockController.h 1970-01-01 00:00:00 +0000
3671+++ tests/mocks/liblightdm/MockController.h 2016-08-25 20:40:06 +0000
3672@@ -0,0 +1,65 @@
3673+/*
3674+ * Copyright (C) 2016 Canonical, Ltd.
3675+ *
3676+ * This program is free software; you can redistribute it and/or modify
3677+ * it under the terms of the GNU General Public License as published by
3678+ * the Free Software Foundation; version 3.
3679+ *
3680+ * This program is distributed in the hope that it will be useful,
3681+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3682+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3683+ * GNU General Public License for more details.
3684+ *
3685+ * You should have received a copy of the GNU General Public License
3686+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3687+ */
3688+
3689+#ifndef UNITY_MOCK_LIBLIGHTDM_CONTROLLER_H
3690+#define UNITY_MOCK_LIBLIGHTDM_CONTROLLER_H
3691+
3692+#include <QObject>
3693+#include <QString>
3694+
3695+
3696+namespace QLightDM
3697+{
3698+class Q_DECL_EXPORT MockController : public QObject
3699+{
3700+ Q_OBJECT
3701+
3702+ Q_PROPERTY(QString selectUserHint READ selectUserHint WRITE setSelectUserHint NOTIFY selectUserHintChanged)
3703+
3704+ // single, single-pin, single-passphrase, full
3705+ Q_PROPERTY(QString userMode READ userMode WRITE setUserMode NOTIFY userModeChanged)
3706+
3707+ // single, none, full
3708+ Q_PROPERTY(QString sessionMode READ sessionMode WRITE setSessionMode NOTIFY sessionModeChanged)
3709+
3710+public:
3711+ static MockController *instance();
3712+ virtual ~MockController();
3713+
3714+ QString selectUserHint() const;
3715+ void setSelectUserHint(const QString &selectUserHint);
3716+
3717+ QString userMode() const;
3718+ void setUserMode(const QString &userMode);
3719+
3720+ QString sessionMode() const;
3721+ void setSessionMode(const QString &sessionMode);
3722+
3723+Q_SIGNALS:
3724+ void selectUserHintChanged();
3725+ void userModeChanged();
3726+ void sessionModeChanged();
3727+
3728+private:
3729+ explicit MockController(QObject* parent=0);
3730+
3731+ QString m_selectUserHint;
3732+ QString m_userMode;
3733+ QString m_sessionMode;
3734+};
3735+}
3736+
3737+#endif
3738
3739=== renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp' => 'tests/mocks/liblightdm/MockGreeter.cpp'
3740--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp 2016-06-13 20:08:35 +0000
3741+++ tests/mocks/liblightdm/MockGreeter.cpp 2016-08-25 20:40:06 +0000
3742@@ -1,5 +1,5 @@
3743 /*
3744- * Copyright (C) 2014 Canonical, Ltd.
3745+ * Copyright (C) 2014-2016 Canonical, Ltd.
3746 *
3747 * This program is free software; you can redistribute it and/or modify
3748 * it under the terms of the GNU General Public License as published by
3749@@ -14,27 +14,38 @@
3750 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3751 */
3752
3753-#include "Greeter.h"
3754-#include "GreeterPrivate.h"
3755-#include <QtCore/QCoreApplication>
3756+#include "MockController.h"
3757+#include "MockGreeter.h"
3758+#include <QDBusInterface>
3759+#include <QDBusPendingCall>
3760 #include <QTimer>
3761
3762 namespace QLightDM
3763 {
3764
3765+class GreeterPrivate
3766+{
3767+public:
3768+ bool authenticated = false;
3769+ QString authenticationUser;
3770+ bool twoFactorDone = false;
3771+};
3772+
3773 Greeter::Greeter(QObject *parent)
3774- : QObject(parent),
3775- d_ptr(new GreeterPrivate(this))
3776+ : QObject(parent)
3777+ , d_ptr(new GreeterPrivate)
3778 {
3779 }
3780
3781 Greeter::~Greeter()
3782 {
3783+ delete d_ptr;
3784 }
3785
3786 QString Greeter::authenticationUser() const
3787 {
3788 Q_D(const Greeter);
3789+
3790 return d->authenticationUser;
3791 }
3792
3793@@ -76,14 +87,7 @@
3794
3795 QString Greeter::selectUserHint() const
3796 {
3797- Q_D(const Greeter);
3798- return d->selectUserHint;
3799-}
3800-
3801-void Greeter::setSelectUserHint(const QString &selectUserHint)
3802-{
3803- Q_D(Greeter);
3804- d->selectUserHint = selectUserHint;
3805+ return MockController::instance()->selectUserHint();
3806 }
3807
3808 bool Greeter::selectGuestHint() const
3809@@ -119,6 +123,7 @@
3810 bool Greeter::isAuthenticated() const
3811 {
3812 Q_D(const Greeter);
3813+
3814 return d->authenticated;
3815 }
3816
3817@@ -134,13 +139,42 @@
3818 d->authenticated = false;
3819 d->authenticationUser = username;
3820 d->twoFactorDone = false;
3821- QTimer::singleShot(0, this, &Greeter::delayedAuthentication);
3822+ QTimer::singleShot(0, this, &Greeter::handleAuthenticate);
3823 }
3824
3825-void Greeter::delayedAuthentication()
3826+void Greeter::handleAuthenticate()
3827 {
3828 Q_D(Greeter);
3829- d->handleAuthenticate();
3830+
3831+ // Send out any messages we need to
3832+ if (d->authenticationUser == "info-prompt")
3833+ Q_EMIT showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo);
3834+ else if (d->authenticationUser == "wide-info-prompt")
3835+ Q_EMIT showMessage("Welcome to Unity Greeter, the greeteriest greeter that ever did appear in these fine lands", Greeter::MessageTypeInfo);
3836+ else if (d->authenticationUser == "html-info-prompt")
3837+ Q_EMIT showMessage("<b>&</b>", Greeter::MessageTypeInfo);
3838+ else if (d->authenticationUser == "long-info-prompt")
3839+ Q_EMIT showMessage("Welcome to Unity Greeter\n\nWe like to annoy you with super ridiculously long messages.\nLike this one\n\nThis is the last line of a multiple line message.", Greeter::MessageTypeInfo);
3840+ else if (d->authenticationUser == "multi-info-prompt") {
3841+ Q_EMIT showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo);
3842+ Q_EMIT showMessage("This is an error", Greeter::MessageTypeError);
3843+ Q_EMIT showMessage("You should have seen three messages", Greeter::MessageTypeInfo);
3844+ }
3845+
3846+ // OK, now actually do the prompt
3847+ if (d->authenticationUser == "no-password") {
3848+ d->authenticated = true;
3849+ Q_EMIT authenticationComplete();
3850+ } else if (d->authenticationUser == "has-pin"){
3851+ Q_EMIT showPrompt("Password: ", Greeter::PromptTypeSecret);
3852+ } else if (d->authenticationUser == "auth-error") {
3853+ d->authenticated = false;
3854+ Q_EMIT authenticationComplete();
3855+ } else if (d->authenticationUser == "different-prompt") {
3856+ Q_EMIT showPrompt("Secret word: ", Greeter::PromptTypeSecret);
3857+ } else {
3858+ Q_EMIT showPrompt("Password: ", Greeter::PromptTypeSecret);
3859+ }
3860 }
3861
3862 void Greeter::authenticateAsGuest()
3863@@ -166,6 +200,16 @@
3864 bool Greeter::startSessionSync(const QString &session)
3865 {
3866 Q_UNUSED(session)
3867+
3868+ // Send a request to hide the greeter. This is normally done by logind,
3869+ // but when testing, we don't want the bother of mocking that out. Instead,
3870+ // just send the request directly ourselves.
3871+ QDBusInterface iface("com.canonical.UnityGreeter",
3872+ "/",
3873+ "com.canonical.UnityGreeter",
3874+ QDBusConnection::sessionBus());
3875+ iface.asyncCall("HideGreeter");
3876+
3877 return true;
3878 }
3879
3880@@ -173,7 +217,30 @@
3881 {
3882 Q_D(Greeter);
3883
3884- d->handleRespond(response);
3885+ if (d->authenticationUser == "no-response")
3886+ return;
3887+ else if (d->authenticationUser == "two-factor") {
3888+ if (!d->twoFactorDone) {
3889+ if (response == "password") {
3890+ d->twoFactorDone = true;
3891+ Q_EMIT showPrompt("otp", Greeter::PromptTypeQuestion);
3892+ } else {
3893+ d->authenticated = false;
3894+ sendAuthenticationComplete();
3895+ }
3896+ } else {
3897+ d->authenticated = (response == "otp");
3898+ sendAuthenticationComplete();
3899+ }
3900+ return;
3901+ }
3902+
3903+ if (d->authenticationUser == "has-pin") {
3904+ d->authenticated = (response == "1234");
3905+ } else {
3906+ d->authenticated = (response == "password");
3907+ }
3908+ sendAuthenticationComplete();
3909 }
3910
3911 void Greeter::sendAuthenticationComplete()
3912@@ -186,21 +253,9 @@
3913 }
3914 }
3915
3916-QString Greeter::mockMode() const
3917-{
3918- Q_D(const Greeter);
3919- return d->mockMode;
3920-}
3921-
3922-
3923-void Greeter::setMockMode(QString mockMode)
3924-{
3925- Q_D(Greeter);
3926-
3927- if (d->mockMode != mockMode) {
3928- d->mockMode = mockMode;
3929- Q_EMIT mockModeChanged(mockMode);
3930- }
3931+QObject *Greeter::mock()
3932+{
3933+ return MockController::instance();
3934 }
3935
3936 }
3937
3938=== renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h' => 'tests/mocks/liblightdm/MockGreeter.h'
3939--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h 2016-06-09 21:45:09 +0000
3940+++ tests/mocks/liblightdm/MockGreeter.h 2016-08-25 20:40:06 +0000
3941@@ -1,5 +1,5 @@
3942 /*
3943- * Copyright (C) 2013 Canonical, Ltd.
3944+ * Copyright (C) 2013-2016 Canonical, Ltd.
3945 * Copyright (C) 2010-2011 David Edmundson.
3946 * Copyright (C) 2010-2011 Robert Ancell
3947 *
3948@@ -21,13 +21,12 @@
3949 #ifndef UNITY_MOCK_GREETER_H
3950 #define UNITY_MOCK_GREETER_H
3951
3952-#include <QtCore/QObject>
3953-#include <QtCore/QVariant>
3954-
3955+#include <QObject>
3956+#include <QVariant>
3957
3958 namespace QLightDM
3959 {
3960- class GreeterPrivate;
3961+class GreeterPrivate;
3962
3963 class Q_DECL_EXPORT Greeter : public QObject
3964 {
3965@@ -45,8 +44,7 @@
3966
3967 Q_ENUMS(PromptType MessageType)
3968
3969- //Mock-only API for testing purposes
3970- Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
3971+ Q_PROPERTY(QObject *mock READ mock CONSTANT) // only in mock
3972
3973 public:
3974 enum PromptType {
3975@@ -70,7 +68,6 @@
3976 bool lockHint () const;
3977 bool hasGuestAccountHint() const;
3978 QString selectUserHint() const;
3979- void setSelectUserHint(const QString &selectUserHint); // only in mock
3980 bool selectGuestHint() const;
3981 QString autologinUserHint() const;
3982 bool autologinGuestHint() const;
3983@@ -81,8 +78,7 @@
3984 QString authenticationUser() const;
3985 QString hostname() const;
3986
3987- QString mockMode() const;
3988- void setMockMode(QString mockMode);
3989+ QObject *mock();
3990
3991 public Q_SLOTS:
3992 bool connectSync();
3993@@ -100,15 +96,13 @@
3994 void showPrompt(QString text, QLightDM::Greeter::PromptType type);
3995 void authenticationComplete();
3996 void autologinTimerExpired();
3997- void mockModeChanged(QString mode);
3998-
3999-protected:
4000- void sendAuthenticationComplete();
4001
4002 private Q_SLOTS:
4003- void delayedAuthentication();
4004+ void handleAuthenticate();
4005
4006 private:
4007+ void sendAuthenticationComplete();
4008+
4009 GreeterPrivate *d_ptr;
4010 Q_DECLARE_PRIVATE(Greeter)
4011 };
4012
4013=== renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp' => 'tests/mocks/liblightdm/MockSessionsModel.cpp'
4014--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp 2016-06-15 15:29:34 +0000
4015+++ tests/mocks/liblightdm/MockSessionsModel.cpp 2016-08-25 20:40:06 +0000
4016@@ -1,5 +1,5 @@
4017 /*
4018- * Copyright (C) 2015 Canonical, Ltd.
4019+ * Copyright (C) 2015-2016 Canonical, Ltd.
4020 *
4021 * This program is free software; you can redistribute it and/or modify
4022 * it under the terms of the GNU General Public License as published by
4023@@ -21,22 +21,41 @@
4024 // set our compatibility to Qt4 here too.
4025 #define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0)
4026
4027-#include "SessionsModel.h"
4028-#include "SessionsModelPrivate.h"
4029-#include <QtCore/QDir>
4030-#include <QtCore/QString>
4031+#include "MockController.h"
4032+#include "MockSessionsModel.h"
4033
4034 namespace QLightDM
4035 {
4036
4037-SessionsModel::SessionsModel(QObject* parent) :
4038- QAbstractListModel(parent),
4039- d_ptr(new SessionsModelPrivate(this))
4040+class SessionItem
4041+{
4042+public:
4043+ QString key;
4044+ QString type; // unused
4045+ QString name;
4046+ QString comment; // unused
4047+};
4048+
4049+class SessionsModelPrivate
4050+{
4051+public:
4052+ QHash<int, QByteArray> roleNames;
4053+ QList<SessionItem> sessionItems;
4054+};
4055+
4056+SessionsModel::SessionsModel(QObject* parent)
4057+ : QAbstractListModel(parent)
4058+ , d_ptr(new SessionsModelPrivate)
4059 {
4060 Q_D(SessionsModel);
4061- m_roleNames = QAbstractListModel::roleNames();
4062- m_roleNames[KeyRole] = "key";
4063- m_roleNames[TypeRole] = "type";
4064+
4065+ d->roleNames = QAbstractListModel::roleNames();
4066+ d->roleNames[KeyRole] = "key";
4067+ d->roleNames[TypeRole] = "type";
4068+
4069+ connect(MockController::instance(), SIGNAL(sessionModeChanged()),
4070+ this, SLOT(resetEntries()));
4071+ resetEntries();
4072 }
4073
4074 SessionsModel::~SessionsModel()
4075@@ -66,7 +85,9 @@
4076
4077 QHash<int, QByteArray> SessionsModel::roleNames() const
4078 {
4079- return m_roleNames;
4080+ Q_D(const SessionsModel);
4081+
4082+ return d->roleNames;
4083 }
4084
4085 int SessionsModel::rowCount(const QModelIndex& parent) const
4086@@ -80,20 +101,41 @@
4087 }
4088 }
4089
4090-QString SessionsModel::testScenario() const
4091-{
4092- Q_D(const SessionsModel);
4093- return d->testScenario;
4094-}
4095-
4096-void SessionsModel::setTestScenario(QString testScenario)
4097+void SessionsModel::resetEntries()
4098 {
4099 Q_D(SessionsModel);
4100
4101- if (d->testScenario != testScenario) {
4102- d->testScenario = testScenario;
4103- d->resetEntries();
4104+ beginResetModel();
4105+
4106+ QString sessionMode = MockController::instance()->sessionMode();
4107+
4108+ if (sessionMode == "full") {
4109+ d->sessionItems =
4110+ {
4111+ {"ubuntu", "", "Ubuntu", ""},
4112+ {"ubuntu-2d", "", "Ubuntu 2D", ""},
4113+ {"gnome", "", "GNOME", ""},
4114+ {"gnome-classic", "", "GNOME Classic", ""},
4115+ {"gnome-flashback-compiz", "", "GNOME Flashback (Compiz)", ""},
4116+ {"gnome-flashback-metacity", "", "GNOME Flashback (Metacity)", ""},
4117+ {"gnome-wayland", "", "GNOME on Wayland", ""},
4118+ {"plasma", "", "Plasma", ""},
4119+ {"kde", "", "KDE" , ""},
4120+ {"xterm", "", "Recovery Console", ""},
4121+ {"", "", "Unknown?", ""}
4122+ };
4123+ } else if (sessionMode == "single") {
4124+ d->sessionItems = {{"ubuntu", "", "Ubuntu", ""}};
4125+ } else {
4126+ d->sessionItems = {};
4127 }
4128+
4129+ endResetModel();
4130+}
4131+
4132+QObject *SessionsModel::mock()
4133+{
4134+ return MockController::instance();
4135 }
4136
4137 } // namespace QLightDM
4138
4139=== renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h' => 'tests/mocks/liblightdm/MockSessionsModel.h'
4140--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h 2015-11-23 22:57:45 +0000
4141+++ tests/mocks/liblightdm/MockSessionsModel.h 2016-08-25 20:40:06 +0000
4142@@ -1,5 +1,5 @@
4143 /*
4144- * Copyright (C) 2015 Canonical, Ltd.
4145+ * Copyright (C) 2015-2016 Canonical, Ltd.
4146 *
4147 * This program is free software; you can redistribute it and/or modify
4148 * it under the terms of the GNU General Public License as published by
4149@@ -18,55 +18,54 @@
4150 #ifndef UNITY_MOCK_SESSIONSMODEL_H
4151 #define UNITY_MOCK_SESSIONSMODEL_H
4152
4153-#include <QtCore/QAbstractListModel>
4154-#include <QtCore/QString>
4155+#include <QAbstractListModel>
4156+#include <QByteArray>
4157+#include <QHash>
4158+#include <QString>
4159
4160 namespace QLightDM
4161 {
4162 class SessionsModelPrivate;
4163
4164 class Q_DECL_EXPORT SessionsModel : public QAbstractListModel
4165- {
4166- Q_OBJECT
4167-
4168- Q_ENUMS(SessionModelRoles SessionType)
4169-
4170- // Mock-only API for testing purposes
4171- Q_PROPERTY(QString testScenario READ testScenario WRITE setTestScenario)
4172-
4173- public:
4174-
4175- enum SessionModelRoles {
4176- //name is exposed as Qt::DisplayRole
4177- //comment is exposed as Qt::TooltipRole
4178- KeyRole = Qt::UserRole,
4179- IdRole = KeyRole, /** Deprecated */
4180- TypeRole
4181- };
4182-
4183- enum SessionType {
4184- LocalSessions,
4185- RemoteSessions
4186- };
4187-
4188- explicit SessionsModel(QObject* parent=nullptr); /** Deprecated. Loads local sessions*/
4189- explicit SessionsModel(SessionsModel::SessionType, QObject* parent=nullptr);
4190- virtual ~SessionsModel();
4191-
4192- QHash<int, QByteArray> roleNames() const override;
4193- int rowCount(const QModelIndex& parent) const override;
4194- QVariant data(const QModelIndex& index, int role) const override;
4195-
4196- QString testScenario() const;
4197- void setTestScenario(QString testScenario);
4198-
4199- protected:
4200- SessionsModelPrivate* const d_ptr;
4201-
4202- private:
4203- QHash<int, QByteArray> m_roleNames;
4204- Q_DECLARE_PRIVATE(SessionsModel)
4205- };
4206+{
4207+ Q_OBJECT
4208+
4209+ Q_PROPERTY(QObject *mock READ mock CONSTANT) // only in mock
4210+
4211+ Q_ENUMS(SessionModelRoles SessionType)
4212+
4213+public:
4214+ enum SessionModelRoles {
4215+ //name is exposed as Qt::DisplayRole
4216+ //comment is exposed as Qt::TooltipRole
4217+ KeyRole = Qt::UserRole,
4218+ IdRole = KeyRole, /** Deprecated */
4219+ TypeRole
4220+ };
4221+
4222+ enum SessionType {
4223+ LocalSessions,
4224+ RemoteSessions
4225+ };
4226+
4227+ explicit SessionsModel(QObject* parent=nullptr); /** Deprecated. Loads local sessions*/
4228+ explicit SessionsModel(SessionsModel::SessionType, QObject* parent=nullptr);
4229+ virtual ~SessionsModel();
4230+
4231+ QHash<int, QByteArray> roleNames() const override;
4232+ int rowCount(const QModelIndex& parent) const override;
4233+ QVariant data(const QModelIndex& index, int role) const override;
4234+
4235+ QObject *mock();
4236+
4237+private Q_SLOTS:
4238+ void resetEntries();
4239+
4240+private:
4241+ SessionsModelPrivate *d_ptr;
4242+ Q_DECLARE_PRIVATE(SessionsModel)
4243+};
4244 }
4245
4246 #endif // UNITY_MOCK_SESSIONSMODEL_H
4247
4248=== renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp' => 'tests/mocks/liblightdm/MockUsersModel.cpp'
4249--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp 2016-05-24 22:11:21 +0000
4250+++ tests/mocks/liblightdm/MockUsersModel.cpp 2016-08-25 20:40:06 +0000
4251@@ -21,21 +21,36 @@
4252 // set our compatibility to Qt4 here too.
4253 #define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0)
4254
4255-#include "UsersModel.h"
4256-#include "UsersModelPrivate.h"
4257-#include <QtCore/QDir>
4258-#include <QtCore/QString>
4259-#include <QtGui/QIcon>
4260+#include "MockController.h"
4261+#include "MockUsersModel.h"
4262+#include <QIcon>
4263
4264 namespace QLightDM
4265 {
4266
4267-UsersModel::UsersModel(QObject *parent) :
4268- QAbstractListModel(parent),
4269- d_ptr(new UsersModelPrivate(this))
4270-{
4271- Q_D(UsersModel);
4272-
4273+class Entry
4274+{
4275+public:
4276+ QString username;
4277+ QString real_name;
4278+ QString background;
4279+ QString layouts;
4280+ bool is_active;
4281+ bool has_messages;
4282+ QString session;
4283+ uid_t uid;
4284+};
4285+
4286+class UsersModelPrivate
4287+{
4288+public:
4289+ QList<Entry> entries;
4290+};
4291+
4292+UsersModel::UsersModel(QObject *parent)
4293+ : QAbstractListModel(parent)
4294+ , d_ptr(new UsersModelPrivate)
4295+{
4296 // Extend roleNames (we want to keep the "display" role)
4297 QHash<int, QByteArray> roles = roleNames();
4298 roles[NameRole] = "name";
4299@@ -48,6 +63,10 @@
4300 roles[ImagePathRole] = "imagePath";
4301 roles[UidRole] = "uid";
4302 setRoleNames(roles);
4303+
4304+ connect(MockController::instance(), SIGNAL(userModeChanged()),
4305+ this, SLOT(resetEntries()));
4306+ resetEntries();
4307 }
4308
4309 UsersModel::~UsersModel()
4310@@ -103,21 +122,57 @@
4311 }
4312 }
4313
4314-QString UsersModel::mockMode() const
4315-{
4316- Q_D(const UsersModel);
4317- return d->mockMode;
4318-}
4319-
4320-void UsersModel::setMockMode(QString mockMode)
4321+void UsersModel::resetEntries()
4322 {
4323 Q_D(UsersModel);
4324
4325- if (d->mockMode != mockMode) {
4326- d->mockMode = mockMode;
4327- Q_EMIT mockModeChanged(mockMode);
4328- d->resetEntries();
4329- }
4330+ beginResetModel();
4331+
4332+ QString userMode = MockController::instance()->userMode();
4333+
4334+ if (userMode == "single") {
4335+ d->entries = {{"no-password", "No Password", 0, 0, false, false, "ubuntu", 0}};
4336+ } else if (userMode == "single-passphrase") {
4337+ d->entries = {{"has-password", "Has Password", 0, 0, false, false, "ubuntu", 0}};
4338+ } else if (userMode == "single-pin") {
4339+ d->entries = {{"has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0}};
4340+ } else if (userMode == "full") {
4341+ d->entries = {
4342+ { "has-password", "Has Password", 0, 0, false, false, "ubuntu", 0 },
4343+ { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
4344+ { "different-prompt", "Different Prompt", 0, 0, false, false, "ubuntu", 0 },
4345+ { "no-password", "No Password", 0, 0, false, false, "ubuntu", 0 },
4346+ { "auth-error", "Auth Error", 0, 0, false, false, "ubuntu", 0 },
4347+ { "two-factor", "Two Factor", 0, 0, false, false, "ubuntu", 0 },
4348+ { "info-prompt", "Info Prompt", 0, 0, false, false, "ubuntu", 0 },
4349+ { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, "ubuntu", 0 },
4350+ { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, "ubuntu", 0 },
4351+ { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "ubuntu", 0 },
4352+ { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "ubuntu", 0 },
4353+ { "long-name", "Long name (far far too long to fit, seriously this would never fit on the screen, you will never see this part of the name)", 0, 0, false, false, "ubuntu", 0 },
4354+ { "color-background", "Color Background", "#dd4814", 0, false, false, "ubuntu", 0 },
4355+ // white and black are a bit redundant, but useful for manually testing if UI is still readable
4356+ { "white-background", "White Background", "#ffffff", 0, false, false, "ubuntu", 0 },
4357+ { "black-background", "Black Background", "#000000", 0, false, false, "ubuntu", 0 },
4358+ { "no-background", "No Background", "", 0, false, false, "ubuntu", 0 },
4359+ { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 },
4360+ { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 },
4361+ { "empty-name", "", 0, 0, false, false, "ubuntu", 0 },
4362+ };
4363+ }
4364+
4365+ // Assign uids in a loop, just to avoid having to muck with them when
4366+ // adding or removing test users.
4367+ for (int i = 0; i < d->entries.size(); i++) {
4368+ d->entries[i].uid = i + 1;
4369+ }
4370+
4371+ endResetModel();
4372+}
4373+
4374+QObject *UsersModel::mock()
4375+{
4376+ return MockController::instance();
4377 }
4378
4379 }
4380
4381=== renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.h' => 'tests/mocks/liblightdm/MockUsersModel.h'
4382--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.h 2016-05-24 22:11:21 +0000
4383+++ tests/mocks/liblightdm/MockUsersModel.h 2016-08-25 20:40:06 +0000
4384@@ -1,5 +1,5 @@
4385 /*
4386- * Copyright (C) 2013-2014 Canonical, Ltd.
4387+ * Copyright (C) 2013-2016 Canonical, Ltd.
4388 * Copyright (C) 2010-2011 David Edmundson.
4389 *
4390 * This program is free software; you can redistribute it and/or modify
4391@@ -18,10 +18,9 @@
4392 #ifndef UNITY_MOCK_USERSMODEL_H
4393 #define UNITY_MOCK_USERSMODEL_H
4394
4395-#include <QtCore/QString>
4396-#include <QtCore/QSharedDataPointer>
4397 #include <QAbstractListModel>
4398-
4399+#include <QList>
4400+#include <QString>
4401
4402 namespace QLightDM
4403 {
4404@@ -33,11 +32,7 @@
4405
4406 Q_ENUMS(UserModelRoles)
4407
4408- //Mock-only API for testing purposes
4409- Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
4410-
4411-Q_SIGNALS:
4412- void mockModeChanged(QString mode);
4413+ Q_PROPERTY(QObject *mock READ mock CONSTANT) // only in mock
4414
4415 public:
4416 explicit UsersModel(QObject *parent = 0);
4417@@ -57,8 +52,10 @@
4418 int rowCount(const QModelIndex &parent) const override;
4419 QVariant data(const QModelIndex &index, int role) const override;
4420
4421- QString mockMode() const;
4422- void setMockMode(QString mockMode);
4423+ QObject *mock();
4424+
4425+private Q_SLOTS:
4426+ void resetEntries();
4427
4428 private:
4429 UsersModelPrivate * const d_ptr;
4430
4431=== modified file 'tests/mocks/libusermetrics/UserMetrics.cpp'
4432--- tests/mocks/libusermetrics/UserMetrics.cpp 2016-05-26 13:15:35 +0000
4433+++ tests/mocks/libusermetrics/UserMetrics.cpp 2016-08-25 20:40:06 +0000
4434@@ -288,7 +288,7 @@
4435 QSharedPointer<UserMetricsData> data(
4436 new UserMetricsData("<b>52km</b> travelled", first, firstMonth,
4437 ninth, secondMonth, this));
4438- m_fakeData.insert("single", data);
4439+ m_fakeData.insert("has-password", data);
4440 m_fakeData.insert("has-pin", data);
4441 }
4442
4443@@ -304,7 +304,7 @@
4444 QSharedPointer<UserMetricsData> data(
4445 new UserMetricsData("<b>33</b> messages today", second,
4446 firstMonth, eighth, secondMonth, this));
4447- m_fakeData.insert("single", data);
4448+ m_fakeData.insert("has-password", data);
4449 m_fakeData.insert("has-pin", data);
4450 }
4451
4452@@ -321,10 +321,8 @@
4453 QSharedPointer<UserMetricsData> data(
4454 new UserMetricsData("<b>19</b> minutes talk time", eighth,
4455 firstMonth, second, secondMonth, this));
4456- m_fakeData.insert("single", data);
4457+ m_fakeData.insert("has-password", data);
4458 m_fakeData.insert("has-pin", data);
4459- // Also use same data for some tablet users
4460- m_fakeData.insert("has-password", data);
4461 m_fakeData.insert("no-password", data);
4462 m_fakeData.insert("empty-name", data);
4463 }
4464
4465=== modified file 'tests/plugins/AccountsService/AccountsServer.cpp'
4466--- tests/plugins/AccountsService/AccountsServer.cpp 2015-10-26 14:05:14 +0000
4467+++ tests/plugins/AccountsService/AccountsServer.cpp 2016-08-25 20:40:06 +0000
4468@@ -40,6 +40,8 @@
4469 if (QDBusConnection::sessionBus().objectRegisteredAt(path) != nullptr)
4470 return true;
4471
4472+ m_users.insert(path);
4473+
4474 auto props = new PropertiesServer(this);
4475 new PropertiesAdaptor(props);
4476 new AccountsUserAdaptor(props);
4477@@ -52,6 +54,15 @@
4478 if (QDBusConnection::sessionBus().objectRegisteredAt(path) == nullptr)
4479 return false;
4480
4481+ m_users.remove(path);
4482 QDBusConnection::sessionBus().unregisterObject(path);
4483 return true;
4484 }
4485+
4486+void AccountsServer::RemoveAllUsers()
4487+{
4488+ Q_FOREACH(const QString &path, m_users) {
4489+ m_users.remove(path);
4490+ QDBusConnection::sessionBus().unregisterObject(path);
4491+ }
4492+}
4493
4494=== modified file 'tests/plugins/AccountsService/AccountsServer.h'
4495--- tests/plugins/AccountsService/AccountsServer.h 2015-10-26 14:05:14 +0000
4496+++ tests/plugins/AccountsService/AccountsServer.h 2016-08-25 20:40:06 +0000
4497@@ -23,6 +23,7 @@
4498 #include <QDBusContext>
4499 #include <QDBusObjectPath>
4500 #include <QObject>
4501+#include <QSet>
4502 #include <QString>
4503
4504 class AccountsServer: public QObject, protected QDBusContext
4505@@ -39,6 +40,10 @@
4506 // mock only.
4507 bool AddUser(const QString &user);
4508 bool RemoveUser(const QString &user);
4509+ void RemoveAllUsers();
4510+
4511+private:
4512+ QSet<QString> m_users;
4513 };
4514
4515 #endif
4516
4517=== modified file 'tests/plugins/AccountsService/client.cpp'
4518--- tests/plugins/AccountsService/client.cpp 2016-03-31 03:15:03 +0000
4519+++ tests/plugins/AccountsService/client.cpp 2016-08-25 20:40:06 +0000
4520@@ -26,6 +26,8 @@
4521 #include <QDBusReply>
4522 #include <QDBusMetaType>
4523
4524+#include <glib.h>
4525+
4526 template <class T>
4527 QVariant dbusVariant(const T& value) { return QVariant::fromValue(QDBusVariant(value)); }
4528
4529@@ -62,11 +64,7 @@
4530 private Q_SLOTS:
4531
4532 void init() {
4533- QDBusReply<bool> addReply = QDBusInterface("org.freedesktop.Accounts",
4534- "/org/freedesktop/Accounts",
4535- "org.freedesktop.Accounts").call("AddUser", QTest::currentTestFunction());
4536- QVERIFY(addReply.isValid());
4537- QCOMPARE(addReply.value(), true);
4538+ addUser(QTest::currentTestFunction());
4539
4540 m_userInterface = new QDBusInterface("org.freedesktop.Accounts",
4541 QString("/%1").arg(QTest::currentTestFunction()),
4542@@ -77,17 +75,46 @@
4543 }
4544
4545 void cleanup() {
4546- QDBusReply<bool> reply = QDBusInterface("org.freedesktop.Accounts",
4547+ QDBusReply<void> reply = QDBusInterface("org.freedesktop.Accounts",
4548 "/org/freedesktop/Accounts",
4549- "org.freedesktop.Accounts").call("RemoveUser", QTest::currentTestFunction());
4550+ "org.freedesktop.Accounts").call("RemoveAllUsers");
4551 QVERIFY(reply.isValid());
4552- QCOMPARE(reply.value(), true);
4553
4554 delete m_userInterface;
4555 m_spy.clear();
4556 m_mousePrimaryButtonSpy.clear();
4557 }
4558
4559+ void addUser(const QString &user)
4560+ {
4561+ QDBusReply<bool> addReply = QDBusInterface("org.freedesktop.Accounts",
4562+ "/org/freedesktop/Accounts",
4563+ "org.freedesktop.Accounts").call("AddUser", user);
4564+ QVERIFY(addReply.isValid());
4565+ QCOMPARE(addReply.value(), true);
4566+ }
4567+
4568+ QVariant getASProperty(const QString &interface, const QString &key, const QString &user = QString())
4569+ {
4570+ QString ifaceUser = user;
4571+ if (ifaceUser.isEmpty())
4572+ ifaceUser = QTest::currentTestFunction();
4573+
4574+ QDBusInterface iface("org.freedesktop.Accounts",
4575+ QString("/%1").arg(ifaceUser),
4576+ "org.freedesktop.DBus.Properties",
4577+ QDBusConnection::sessionBus());
4578+
4579+ auto message = iface.call("Get", interface, key);
4580+ if (message.type() == QDBusMessage::ReplyMessage) {
4581+ return message.arguments().first().value<QDBusVariant>().variant();
4582+ }
4583+ else {
4584+ qWarning() << "Could not get property" << key << ":" << message.errorMessage();
4585+ return QVariant();
4586+ }
4587+ }
4588+
4589 void testInvalids()
4590 {
4591 // Test various invalid calls
4592@@ -323,25 +350,16 @@
4593 QCOMPARE(message.type(), QDBusMessage::ErrorMessage);
4594 QCOMPARE(message.errorName(), QStringLiteral("org.freedesktop.DBus.Error.InvalidArgs"));
4595
4596- message = m_userInterface->call("Get",
4597- "org.freedesktop.Accounts.User",
4598- "RealName");
4599- QCOMPARE(message.type(), QDBusMessage::ReplyMessage);
4600- auto response = message.arguments().first().value<QDBusVariant>().variant().toString();
4601- QCOMPARE(response, QStringLiteral(""));
4602+ auto response = getASProperty("org.freedesktop.Accounts.User", "RealName");
4603+ QCOMPARE(response.toString(), QStringLiteral(""));
4604
4605 // Now try it via our AS wrapper and confirm it did get through, unlike above
4606 session.setRealName("Stallman");
4607
4608 QCOMPARE(session.realName(), QStringLiteral("Stallman"));
4609
4610- message = m_userInterface->call("Get",
4611- "org.freedesktop.Accounts.User",
4612- "RealName");
4613- QCOMPARE(message.type(), QDBusMessage::ReplyMessage);
4614- response = message.arguments().first().value<QDBusVariant>().variant().toString();
4615- QCOMPARE(response, QStringLiteral("Stallman"));
4616-
4617+ response = getASProperty("org.freedesktop.Accounts.User", "RealName");
4618+ QCOMPARE(response.toString(), QStringLiteral("Stallman"));
4619 }
4620
4621 void testAsynchronousChangeForKeymaps()
4622@@ -367,6 +385,38 @@
4623 QTRY_COMPARE(session.keymaps(), result);
4624 }
4625
4626+ void testGreeterMode()
4627+ {
4628+ addUser(g_get_user_name());
4629+ addUser("OtherUser"); // presumably will never conflict with running user
4630+ AccountsService session(this);
4631+ QVERIFY(session.greeterMode());
4632+
4633+ session.setGreeterMode(false);
4634+
4635+ // NOTE: we change real user data here, but it's a harmless change
4636+ session.setFailedLogins(1);
4637+ QCOMPARE(session.failedLogins(), 1u);
4638+ QCOMPARE(getASProperty("com.canonical.unity.AccountsService.Private",
4639+ "FailedLogins", session.user()), QVariant(1));
4640+
4641+ // This will fail because we aren't the active user
4642+ session.setUser("OtherUser");
4643+ session.setFailedLogins(2);
4644+ QCOMPARE(session.failedLogins(), 2u);
4645+ QCOMPARE(getASProperty("com.canonical.unity.AccountsService.Private",
4646+ "FailedLogins", "OtherUser"), QVariant(0));
4647+
4648+ session.setGreeterMode(true);
4649+
4650+ // But now a similar call will succeed because we're in greeter mode
4651+ session.setFailedLogins(3);
4652+ QCOMPARE(session.failedLogins(), 3u);
4653+ QCOMPARE(getASProperty("com.canonical.unity.AccountsService.Private",
4654+ "FailedLogins", "OtherUser"), QVariant(3));
4655+
4656+ }
4657+
4658 Q_SIGNALS:
4659 void propertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalid);
4660 void setMousePrimaryButtonCalled(int button);
4661
4662=== modified file 'tests/plugins/AccountsService/interfaces.xml'
4663--- tests/plugins/AccountsService/interfaces.xml 2016-03-31 03:15:03 +0000
4664+++ tests/plugins/AccountsService/interfaces.xml 2016-08-25 20:40:06 +0000
4665@@ -36,6 +36,7 @@
4666 <arg name="user" type="s" direction="in" />
4667 <arg name="success" type="b" direction="out" />
4668 </method>
4669+ <method name="RemoveAllUsers"/>
4670 </interface>
4671 <interface name="com.ubuntu.AccountsService.Input" />
4672 <interface name="com.ubuntu.touch.AccountsService.SecurityPrivacy" />
4673
4674=== removed file 'tests/plugins/LightDM/CMakeLists.txt'
4675--- tests/plugins/LightDM/CMakeLists.txt 2015-09-28 18:21:40 +0000
4676+++ tests/plugins/LightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000
4677@@ -1,1 +0,0 @@
4678-add_subdirectory(IntegratedLightDM)
4679
4680=== renamed file 'tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt' => 'tests/plugins/LightDM/CMakeLists.txt'
4681--- tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt 2016-05-02 21:46:11 +0000
4682+++ tests/plugins/LightDM/CMakeLists.txt 2016-08-25 20:40:06 +0000
4683@@ -1,68 +1,46 @@
4684 add_definitions(
4685 -DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
4686 )
4687+
4688 include_directories(
4689- ${GLIB_INCLUDE_DIRS}
4690 ${CMAKE_CURRENT_BINARY_DIR}
4691- )
4692-
4693+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
4694+ ${CMAKE_SOURCE_DIR}/plugins/Utils
4695+ )
4696+
4697+include_directories(
4698+ SYSTEM
4699+ ${GLIB_INCLUDE_DIRS}
4700+ ${LIBLIGHTDM_INCLUDE_DIRS}
4701+ )
4702+
4703+link_libraries(
4704+ LightDM-qml
4705+ ${LIBLIGHTDM_LDFLAGS}
4706+ )
4707+
4708+# DBusTest
4709 add_executable(GreeterDBusTestExec
4710 dbus.cpp
4711 ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
4712 )
4713-# This add_dependencies is needed since we're linking with with -L and -l below
4714-# make seems to work but ninja breaks without it
4715-add_dependencies(GreeterDBusTestExec MockLightDM)
4716 qt5_use_modules(GreeterDBusTestExec Core DBus Quick Test)
4717-target_link_libraries(GreeterDBusTestExec
4718- MockLightDM
4719- )
4720-target_include_directories(GreeterDBusTestExec PUBLIC
4721- ${CMAKE_SOURCE_DIR}/plugins/LightDM
4722- ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
4723- )
4724 add_unity8_uitest(GreeterDBus dbus-test-runner
4725 ARG_PREFIX "--parameter"
4726 ARGS --task $<TARGET_FILE:GreeterDBusTestExec>
4727- DEPENDS MockLightDM
4728- IMPORT_PATHS ${UNITY_MOCKPATH}
4729+ DEPENDS LightDM-qml;MockLightDM
4730 LIGHTDM
4731 )
4732
4733-add_executable(GreeterPamTestExec
4734- pam.cpp
4735- ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp
4736- )
4737-qt5_use_modules(GreeterPamTestExec Concurrent Core Test)
4738-target_link_libraries(GreeterPamTestExec
4739- integratedLightDM
4740- )
4741-
4742-target_include_directories(GreeterPamTestExec PUBLIC
4743- ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM
4744- ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
4745- )
4746-add_qmltest_target(testGreeterPam GreeterPamTestExec COMMAND $<TARGET_FILE:GreeterPamTestExec>)
4747-
4748 # SessionsModelTest
4749 add_executable(GreeterSessionsModelTestExec
4750 sessionsmodel.cpp
4751 ${CMAKE_SOURCE_DIR}/plugins/LightDM/SessionsModel.cpp
4752 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
4753 )
4754-add_dependencies(GreeterSessionsModelTestExec MockLightDM)
4755 qt5_use_modules(GreeterSessionsModelTestExec Core Test)
4756-target_link_libraries(GreeterSessionsModelTestExec
4757- MockLightDM
4758- )
4759-target_include_directories(GreeterSessionsModelTestExec PUBLIC
4760- ${CMAKE_SOURCE_DIR}/plugins/LightDM
4761- ${CMAKE_SOURCE_DIR}/plugins/Utils
4762- ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
4763- )
4764 add_unity8_uitest(GreeterSessions GreeterSessionsModelTestExec
4765- ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
4766- DEPENDS MockLightDM
4767+ DEPENDS LightDM-qml;MockLightDM
4768 LIGHTDM
4769 )
4770
4771@@ -72,45 +50,8 @@
4772 ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
4773 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
4774 )
4775-# This add_dependencies is needed since we're linking with with -L and -l below
4776-# make seems to work but ninja breaks without it
4777-add_dependencies(GreeterUsersModelTestExec MockLightDM)
4778 qt5_use_modules(GreeterUsersModelTestExec Core Test)
4779-target_link_libraries(GreeterUsersModelTestExec
4780- MockLightDM
4781- )
4782-target_include_directories(GreeterUsersModelTestExec PUBLIC
4783- ${CMAKE_SOURCE_DIR}/plugins/LightDM
4784- ${CMAKE_SOURCE_DIR}/plugins/Utils
4785- ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
4786- )
4787 add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec
4788- ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
4789- DEPENDS MockLightDM
4790+ DEPENDS LightDM-qml;MockLightDM
4791 LIGHTDM
4792 )
4793-
4794-add_executable(GreeterIntegratedTestExec
4795- integrated.cpp
4796- )
4797-qt5_use_modules(GreeterIntegratedTestExec Core DBus Quick Test)
4798-target_link_libraries(GreeterIntegratedTestExec
4799- ${GLIB_LIBRARIES}
4800- integratedLightDMSession
4801- )
4802-target_include_directories(GreeterIntegratedTestExec PUBLIC
4803- ${GLIB_INCLUDE_DIRS}
4804- ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
4805- )
4806-add_unity8_unittest(GreeterIntegrated dbus-test-runner
4807- ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/IntegratedLightDM/liblightdm/
4808- ARG_PREFIX "--parameter"
4809- ARGS
4810- --task $<TARGET_FILE:mock-server>
4811- --task-name server
4812- --ignore-return
4813- --task $<TARGET_FILE:GreeterIntegratedTestExec>
4814- --task-name client
4815- --wait-for org.freedesktop.Accounts
4816- DEPENDS integratedLightDMSession
4817- )
4818
4819=== removed directory 'tests/plugins/LightDM/IntegratedLightDM'
4820=== removed file 'tests/plugins/LightDM/IntegratedLightDM/integrated.cpp'
4821--- tests/plugins/LightDM/IntegratedLightDM/integrated.cpp 2016-05-02 18:43:06 +0000
4822+++ tests/plugins/LightDM/IntegratedLightDM/integrated.cpp 1970-01-01 00:00:00 +0000
4823@@ -1,88 +0,0 @@
4824-/*
4825- * Copyright (C) 2016 Canonical, Ltd.
4826- *
4827- * This program is free software; you can redistribute it and/or modify
4828- * it under the terms of the GNU General Public License as published by
4829- * the Free Software Foundation; version 3.
4830- *
4831- * This program is distributed in the hope that it will be useful,
4832- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4833- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4834- * GNU General Public License for more details.
4835- *
4836- * You should have received a copy of the GNU General Public License
4837- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4838- */
4839-
4840-#include "UsersModel.h"
4841-
4842-#include <glib.h>
4843-#include <QDBusInterface>
4844-#include <QDBusReply>
4845-#include <QtTest>
4846-
4847-class GreeterIntegratedTest : public QObject
4848-{
4849- Q_OBJECT
4850-
4851-private Q_SLOTS:
4852-
4853- void init()
4854- {
4855- m_accounts = new QDBusInterface(QStringLiteral("org.freedesktop.Accounts"),
4856- QStringLiteral("/org/freedesktop/Accounts"),
4857- QStringLiteral("org.freedesktop.Accounts"),
4858- QDBusConnection::sessionBus());
4859- QDBusReply<bool> addReply = m_accounts->call(QStringLiteral("AddUser"),
4860- g_get_user_name());
4861- QVERIFY(addReply.isValid());
4862- QCOMPARE(addReply.value(), true);
4863-
4864- m_user = new QDBusInterface(QStringLiteral("org.freedesktop.Accounts"),
4865- QStringLiteral("/%1").arg(g_get_user_name()),
4866- QStringLiteral("org.freedesktop.DBus.Properties"),
4867- QDBusConnection::sessionBus());
4868-
4869- m_model = new QLightDM::UsersModel();
4870- QVERIFY(m_model);
4871- }
4872-
4873- void cleanup()
4874- {
4875- QDBusReply<bool> addReply = m_accounts->call(QStringLiteral("RemoveUser"),
4876- g_get_user_name());
4877- QVERIFY(addReply.isValid());
4878- QCOMPARE(addReply.value(), true);
4879-
4880- delete m_model;
4881- delete m_accounts;
4882- delete m_user;
4883- }
4884-
4885- void testWatchRealName()
4886- {
4887- auto index = m_model->index(0, 0);
4888-
4889- QCOMPARE(m_model->data(index, QLightDM::UsersModel::RealNameRole).toString(),
4890- QStringLiteral(""));
4891-
4892- QDBusInterface accountsIface(m_user->service(),
4893- m_user->path(),
4894- "org.freedesktop.Accounts.User");
4895- QDBusReply<void> reply = accountsIface.call(QStringLiteral("SetRealName"),
4896- QStringLiteral("Test User"));
4897- QVERIFY(reply.isValid());
4898-
4899- QTRY_COMPARE(m_model->data(index, QLightDM::UsersModel::RealNameRole).toString(),
4900- QStringLiteral("Test User"));
4901- }
4902-
4903-private:
4904- QLightDM::UsersModel *m_model;
4905- QDBusInterface *m_accounts;
4906- QDBusInterface *m_user;
4907-};
4908-
4909-QTEST_MAIN(GreeterIntegratedTest)
4910-
4911-#include "integrated.moc"
4912
4913=== removed file 'tests/plugins/LightDM/IntegratedLightDM/pam.cpp'
4914--- tests/plugins/LightDM/IntegratedLightDM/pam.cpp 2016-05-02 18:43:06 +0000
4915+++ tests/plugins/LightDM/IntegratedLightDM/pam.cpp 1970-01-01 00:00:00 +0000
4916@@ -1,54 +0,0 @@
4917-/*
4918- * Copyright (C) 2015 Canonical, Ltd.
4919- *
4920- * This program is free software; you can redistribute it and/or modify
4921- * it under the terms of the GNU General Public License as published by
4922- * the Free Software Foundation; version 3.
4923- *
4924- * This program is distributed in the hope that it will be useful,
4925- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4926- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4927- * GNU General Public License for more details.
4928- *
4929- * You should have received a copy of the GNU General Public License
4930- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4931- */
4932-
4933-#include "GreeterPrivate.h"
4934-
4935-#include <QtTest>
4936-
4937-#include <glib.h>
4938-
4939-class GreeterPamTest : public QObject
4940-{
4941- Q_OBJECT
4942-
4943-private Q_SLOTS:
4944-
4945- void init()
4946- {
4947- m_greeterpriv = new QLightDM::GreeterPrivate();
4948- }
4949-
4950- void cleanup()
4951- {
4952- delete m_greeterpriv;
4953- QTRY_COMPARE(QThreadPool::globalInstance()->activeThreadCount(), 0);
4954- }
4955-
4956- void testRapidFireAuthentication()
4957- {
4958- m_greeterpriv->authenticationUser = QString::fromUtf8(g_get_user_name());
4959- for (int i = 0; i < 100; i++) {
4960- m_greeterpriv->handleAuthenticate();
4961- }
4962- }
4963-
4964-private:
4965- QLightDM::GreeterPrivate *m_greeterpriv;
4966-};
4967-
4968-QTEST_GUILESS_MAIN(GreeterPamTest)
4969-
4970-#include "pam.moc"
4971
4972=== renamed file 'tests/plugins/LightDM/IntegratedLightDM/dbus.cpp' => 'tests/plugins/LightDM/dbus.cpp'
4973=== renamed file 'tests/plugins/LightDM/IntegratedLightDM/greeter.qml' => 'tests/plugins/LightDM/greeter.qml'
4974--- tests/plugins/LightDM/IntegratedLightDM/greeter.qml 2015-11-07 00:12:17 +0000
4975+++ tests/plugins/LightDM/greeter.qml 2016-08-25 20:40:06 +0000
4976@@ -15,13 +15,8 @@
4977 */
4978
4979 import QtQuick 2.4
4980-import LightDM.IntegratedLightDM 0.1 as LightDM
4981+import LightDM 0.1 as LightDM
4982
4983 Item {
4984 property var greeter: LightDM.Greeter
4985- Binding {
4986- target: LightDM.Greeter
4987- property: "mockMode"
4988- value: "full"
4989- }
4990 }
4991
4992=== renamed file 'tests/plugins/LightDM/IntegratedLightDM/sessionsmodel.cpp' => 'tests/plugins/LightDM/sessionsmodel.cpp'
4993--- tests/plugins/LightDM/IntegratedLightDM/sessionsmodel.cpp 2016-06-15 15:29:34 +0000
4994+++ tests/plugins/LightDM/sessionsmodel.cpp 2016-08-25 20:40:06 +0000
4995@@ -16,10 +16,9 @@
4996
4997 #include "SessionsModel.h"
4998
4999-#include <QLightDM/SessionsModel>
5000-#include <QtCore/QModelIndex>
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches