~ubuntu-branches/ubuntu/saucy/share-like-connect/saucy

« back to all changes in this revision

Viewing changes to applet/contents/ui/Icon.qml

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-09-17 11:30:06 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130917113006-5ohj8qt9kuf3izma
Tags: 1:0.4-0ubuntu1
* New upstream release LP: #1227602
* Use epoch to reset version number in line with upstream
* Add build-dep on nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import org.kde.qtextracomponents 0.1
22
22
import org.kde.plasma.core 0.1 as PlasmaCore
23
23
import org.kde.qtextracomponents 0.1
24
 
 
 
24
import "plasmapackage:/code/uiproperties.js" as UiProperties
25
25
 
26
26
Item {
27
27
    id: iconItem
28
 
    width: Math.min(main.width, main.height*1.4)
29
 
    height: Math.min(main.width*1.4, main.height)
 
28
 
 
29
    width: appletRoot.vertical ? appletRoot.width : Math.min(appletRoot.height * UiProperties.iconProportions, theme.hugeIconSize)
 
30
 
 
31
    height: appletRoot.vertical ? Math.min(appletRoot.width * UiProperties.iconProportions, theme.hugeIconSize) : appletRoot.height
 
32
 
 
33
 
30
34
    property QtObject model
31
35
    property string service
32
36
    property alias source: iconLoader.source
33
 
    IconLoader {
 
37
    PlasmaCore.IconItem {
34
38
        id: iconLoader
35
39
        signal menuTriggered
36
 
        width: height
 
40
        width: Math.min(parent.width, parent.height)
 
41
        height: width
 
42
        anchors.centerIn: parent
37
43
 
38
 
        enabled: model.count>0?true:false
39
 
        opacity: enabled ? 1 : 0.3
40
 
        Behavior on opacity {
41
 
            NumberAnimation {
42
 
                duration: 250
43
 
                easing: Ease.InOut
44
 
            }
45
 
        }
46
 
        anchors {
47
 
            top: parent.top
48
 
            bottom: parent.bottom
49
 
        }
 
44
        enabled: model.count > 0 ? true : false
50
45
    }
51
46
    MouseEventListener {
52
47
        enabled: iconLoader.enabled
55
50
            if (dialog.visible) {
56
51
                dialog.visible = false
57
52
            } else {
58
 
                if (iconItem.service == "Share") {
59
 
                    dialog.mainItem.shareVisible = true
60
 
                    dialog.mainItem.likeVisible = false
61
 
                    dialog.mainItem.connectVisible = false
62
 
                } else if (iconItem.service == "Like") {
63
 
                    dialog.mainItem.shareVisible = false
64
 
                    dialog.mainItem.likeVisible = true
65
 
                    dialog.mainItem.connectVisible = false
66
 
                //Connect
67
 
                } else {
68
 
                    dialog.mainItem.shareVisible = false
69
 
                    dialog.mainItem.likeVisible = false
70
 
                    dialog.mainItem.connectVisible = true
71
 
                }
 
53
                dialog.mainItem.sourceName = iconItem.service
72
54
                dialog.open(iconItem)
73
55
            }
74
56
        }
75
57
 
76
58
        onPositionChanged: {
77
 
            dialog.mainItem.highlightItem(mouse.screenX, mouse.screenY)
 
59
            dialog.mainItem.highlightItemAtGlobalPos(mouse.screenX, mouse.screenY)
78
60
        }
79
61
 
80
62
        onReleased: {
81
 
            dialog.mainItem.runItem(mouse.screenX, mouse.screenY)
 
63
            dialog.mainItem.runItemAtGlobalPos(mouse.screenX, mouse.screenY)
82
64
        }
83
65
    }
84
66
}