2
* Copyright 2015 Canonical Ltd.
4
* This file is part of messaging-app.
6
* messaging-app is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 3.
10
* messaging-app 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.
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/>.
20
import Ubuntu.Components 1.3
21
import messagingapp.private 0.1
25
signal stickerSelected(string path)
27
Component.onCompleted: {
28
StickersHistoryModel.databasePath = dataLocation + "/stickers/stickers.sqlite"
29
StickersHistoryModel.limit = 10
32
property bool expanded: false
33
readonly property int packCount: stickerPacksModel.count
35
// FIXME: try to get something similar to the keyboard height
36
// FIXME: animate the displaying
37
height: expanded ? units.gu(30) : 0
38
opacity: expanded ? 1 : 0
42
target: Qt.inputMethod
44
if (Qt.inputMethod.visible && oskEnabled) {
45
pickerRoot.expanded = false
51
UbuntuNumberAnimation { }
55
UbuntuNumberAnimation { }
60
model: stickerPacksModel
61
orientation: ListView.Horizontal
62
anchors.left: parent.left
63
anchors.right: parent.right
64
anchors.top: parent.top
67
header: HistoryButton {
71
onTriggered: stickersGrid.model.packName = ""
72
selected: stickersGrid.model.packName === ""
74
delegate: StickerPackDelegate {
75
anchors.top: parent.top
76
anchors.bottom: parent.bottom
80
onTriggered: stickersGrid.model.packName = fileName
81
selected: stickersGrid.model.packName === fileName
86
anchors.fill: stickersGrid
92
anchors.left: parent.left
93
anchors.right: parent.right
94
anchors.top: setsList.bottom
95
anchors.bottom: parent.bottom
97
cellWidth: units.gu(10)
98
cellHeight: units.gu(10)
99
visible: stickersGrid.model.packName.length > 0
102
delegate: StickerDelegate {
103
stickerSource: filePath
104
width: stickersGrid.cellWidth
105
height: stickersGrid.cellHeight
108
StickersHistoryModel.add("%1/%2".arg(stickersGrid.model.packName).arg(fileName))
109
pickerRoot.stickerSelected(stickerSource)
116
anchors.left: parent.left
117
anchors.right: parent.right
118
anchors.top: setsList.bottom
119
anchors.bottom: parent.bottom
121
cellWidth: units.gu(10)
122
cellHeight: units.gu(10)
123
visible: stickersGrid.model.packName.length === 0
125
model: StickersHistoryModel
127
delegate: StickerDelegate {
128
stickerSource: "%1/stickers/%2".arg(dataLocation).arg(sticker)
129
width: stickersGrid.cellWidth
130
height: stickersGrid.cellHeight
133
StickersHistoryModel.add(sticker)
134
pickerRoot.stickerSelected(stickerSource)