Dekko
LomiriShapeGravatar.qml
1 /* Copyright (C) 2014-2016 Dan Chapman <dpniel@ubuntu.com>
2 
3  This file is part of Dekko email client for Ubuntu Devices/
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License as
7  published by the Free Software Foundation; either version 2 of
8  the License or (at your option) version 3
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 import QtQuick 2.4
19 import Lomiri.Components 1.3
20 import Dekko.Components 1.0
21 import Dekko.Mail.Settings 1.0
22 
23 PixelPerfectItem {
24  id: item
25  property string emailAddress
26  property alias source: inner_image.source
27  property alias status: inner_image.status
28  property alias sourceSize: inner_image.sourceSize
29  readonly property url circleMask: "circle.png"
30  property alias radius: shape.radius
31 
32  onEmailAddressChanged: {
33  inner_image.source = ""
34  }
35 
36  LomiriShape {
37  id: shape
38  anchors.fill: parent
39  aspect: LomiriShape.Flat
40  }
41 
42  Image {
43  id: inner_image
44  anchors.fill: parent
45  smooth: true
46  visible: false
47  asynchronous: true
48  ImageHelper on source {
49  id: helper
50  size: item.width
51  gravatarEmail: (size > 0 && PolicyManager.views.gravatarEnabled) ? emailAddress : ""
52  }
53  onSourceChanged: shape.source = inner_image;
54  }
55 }
Dekko
Definition: Dekko.qml:30