~ubuntu-branches/ubuntu/raring/plasma-mobile/raring-proposed

« back to all changes in this revision

Viewing changes to handset/applets/windowstrip/qml/WindowThumbnail.qml

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-07-17 12:04:43 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120717120443-q3ig9u2fnltx67yg
Tags: 2.0+git2012071701-0ubuntu1
* New upstream snapshot
* Remove build-dep on kde-runtime-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- coding: iso-8859-1 -*-
 
2
/*
 
3
 *   Author: Marco Martin <mart@kde.org>
 
4
 *   Date: Sun Nov 7 2010, 18:51:24
 
5
 *
 
6
 *   This program is free software; you can redistribute it and/or modify
 
7
 *   it under the terms of the GNU Library General Public License as
 
8
 *   published by the Free Software Foundation; either version 2 or
 
9
 *   (at your option) any later version.
 
10
 *
 
11
 *   This program is distributed in the hope that it will be useful,
 
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *   GNU Library General Public License for more details
 
15
 *
 
16
 *   You should have received a copy of the GNU Library General Public
 
17
 *   License along with this program; if not, write to the
 
18
 *   Free Software Foundation, Inc.,
 
19
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
20
 */
 
21
 
 
22
import QtQuick 1.0
 
23
import org.kde.plasma.core 0.1 as PlasmaCore
 
24
import org.kde.plasma.components 0.1 as PlasmaComponents
 
25
import org.kde.plasma.mobilecomponents 0.1 as MobileComponents
 
26
import org.kde.qtextracomponents 0.1
 
27
 
 
28
Item {
 
29
    id: windowDelegate
 
30
 
 
31
    //space for the close button
 
32
    width: height*1.6 + 48
 
33
    height: main.height
 
34
    onHeightChanged: {
 
35
        positionsTimer.restart()
 
36
    }
 
37
    property string winId: DataEngineSource
 
38
 
 
39
    Rectangle {
 
40
        opacity: 0
 
41
        anchors.fill: parent
 
42
    }
 
43
 
 
44
    QIconItem {
 
45
        anchors.centerIn: parent
 
46
        width: 64
 
47
        height: 64
 
48
        icon: model["icon"]
 
49
    }
 
50
 
 
51
    PlasmaComponents.Label {
 
52
        id: windowTitle
 
53
        anchors.bottom: parent.bottom
 
54
        anchors.horizontalCenter: parent.horizontalCenter;
 
55
        anchors.topMargin: 4
 
56
 
 
57
        text: model["visibleName"]
 
58
        elide: Text.ElideRight
 
59
        color: theme.textColor
 
60
        width: parent.width - 40
 
61
        horizontalAlignment: Text.AlignHCenter
 
62
    }
 
63
 
 
64
    MouseArea {
 
65
        anchors.fill: parent
 
66
        onClicked: {
 
67
            //print(winId)
 
68
            var service = tasksSource.serviceForSource(winId)
 
69
            var operation = service.operationDescription("activate")
 
70
 
 
71
            service.startOperationCall(operation)
 
72
        }
 
73
    }
 
74
 
 
75
    PlasmaCore.FrameSvgItem {
 
76
        imagePath: "widgets/button"
 
77
        prefix: "shadow"
 
78
        width: closeButton.width + margins.left + margins.right
 
79
        height: closeButton.height + margins.top + margins.bottom
 
80
        visible: model["actionClose"] && (model["className"] != shellName)
 
81
        anchors {
 
82
            top: parent.top
 
83
            right: parent.right
 
84
            topMargin: 32
 
85
        }
 
86
 
 
87
        PlasmaCore.FrameSvgItem {
 
88
            id: closeButton
 
89
            imagePath: "widgets/button"
 
90
            prefix: "normal"
 
91
            //a bit more left margin
 
92
            width: closeButtonSvg.width + margins.left + margins.right + 16
 
93
            height: closeButtonSvg.height + margins.top + margins.bottom
 
94
            x: parent.margins.left
 
95
            y: parent.margins.top
 
96
 
 
97
            MobileComponents.ActionButton {
 
98
                id: closeButtonSvg
 
99
                svg: iconsSvg
 
100
                iconSize: 22
 
101
                backgroundVisible: false
 
102
                elementId: "close"
 
103
 
 
104
                anchors {
 
105
                    verticalCenter: parent.verticalCenter
 
106
                    right: parent.right
 
107
                    rightMargin: parent.margins.right
 
108
                }
 
109
 
 
110
                onClicked: {
 
111
                    var service = tasksSource.serviceForSource(winId)
 
112
                    var operation = service.operationDescription("close")
 
113
 
 
114
                    service.startOperationCall(operation)
 
115
                }
 
116
            }
 
117
        }
 
118
    }
 
119
}