Changeset View
Changeset View
Standalone View
Standalone View
applets/devicenotifier/package/contents/ui/FullRepresentation.qml
Show All 16 Lines | |||||
17 | * | 17 | * | ||
18 | * You should have received a copy of the GNU Library General Public | 18 | * You should have received a copy of the GNU Library General Public | ||
19 | * License along with this program; if not, write to the | 19 | * License along with this program; if not, write to the | ||
20 | * Free Software Foundation, Inc., | 20 | * Free Software Foundation, Inc., | ||
21 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 21 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
22 | */ | 22 | */ | ||
23 | 23 | | |||
24 | import QtQuick 2.2 | 24 | import QtQuick 2.2 | ||
25 | import QtQuick.Window 2.2 | ||||
25 | import QtQuick.Layouts 1.1 | 26 | import QtQuick.Layouts 1.1 | ||
26 | 27 | | |||
27 | import org.kde.plasma.core 2.0 as PlasmaCore | 28 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
28 | import org.kde.plasma.components 2.0 as PlasmaComponents | 29 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
29 | import org.kde.plasma.extras 2.0 as PlasmaExtras | 30 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||
30 | 31 | | |||
31 | Item { | 32 | MouseArea { | ||
33 | id: fullRep | ||||
34 | property bool spontaneousOpen: false | ||||
35 | | ||||
36 | hoverEnabled: true | ||||
32 | Layout.minimumWidth: units.gridUnit * 12 | 37 | Layout.minimumWidth: units.gridUnit * 12 | ||
33 | Layout.minimumHeight: units.gridUnit * 12 | 38 | Layout.minimumHeight: units.gridUnit * 12 | ||
34 | 39 | | |||
35 | PlasmaExtras.Heading { | 40 | PlasmaExtras.Heading { | ||
36 | width: parent.width | 41 | width: parent.width | ||
37 | level: 3 | 42 | level: 3 | ||
38 | opacity: 0.6 | 43 | opacity: 0.6 | ||
39 | text: i18n("No Devices Available") | 44 | text: i18n("No Devices Available") | ||
40 | visible: notifierDialog.count === 0 && !devicenotifier.pendingDelegateRemoval | 45 | visible: notifierDialog.count === 0 && !devicenotifier.pendingDelegateRemoval | ||
41 | } | 46 | } | ||
42 | 47 | | |||
48 | PlasmaCore.DataSource { | ||||
49 | id: userActivitySource | ||||
50 | engine: "powermanagement" | ||||
51 | connectedSources: "UserActivity" | ||||
52 | property int polls: 0 | ||||
53 | //poll only on plasmoid expanded | ||||
54 | interval: !fullRep.containsMouse && !fullRep.Window.active && spontaneousOpen && plasmoid.expanded ? 3000 : 0 | ||||
55 | onIntervalChanged: polls = 0; | ||||
56 | onDataChanged: { | ||||
57 | //only do when polling | ||||
58 | if (interval == 0 || polls++ < 1) { | ||||
59 | return; | ||||
60 | } | ||||
61 | | ||||
62 | if (userActivitySource.data["UserActivity"]["IdleTime"] < interval) { | ||||
63 | plasmoid.expanded = false; | ||||
64 | spontaneousOpen = false; | ||||
65 | } | ||||
66 | } | ||||
67 | } | ||||
68 | | ||||
69 | | ||||
43 | // this item is reparented to a delegate that is showing a message to draw focus to it | 70 | // this item is reparented to a delegate that is showing a message to draw focus to it | ||
44 | PlasmaComponents.Highlight { | 71 | PlasmaComponents.Highlight { | ||
45 | id: messageHighlight | 72 | id: messageHighlight | ||
46 | visible: false | 73 | visible: false | ||
47 | 74 | | |||
48 | OpacityAnimator { | 75 | OpacityAnimator { | ||
49 | id: messageHighlightAnimator | 76 | id: messageHighlightAnimator | ||
50 | target: messageHighlight | 77 | target: messageHighlight | ||
▲ Show 20 Lines • Show All 133 Lines • Show Last 20 Lines |