124
114
collapseAllItem()
127
function scrollView(itemy) {
128
// console.log("itemy: ", itemy - content.contentY)
129
if ((itemy - content.contentY) < units.gu(16)) {
130
if (!content.atYBeginning)
131
content.contentY -= 3
133
else if ((itemy - content.contentY) > ( content.height - units.gu(16))) {
135
content.contentY += 3
139
117
displaced: Transition {
140
118
NumberAnimation { properties: "x,y"; easing.type: Easing.OutQuad }
143
model: VisualDataModel {
148
delegate: MouseArea {
151
property int visualIndex: VisualDataModel.itemsIndex
152
property alias isExpanded: topicItem.isExpanded
153
property alias isEditing: topicItem.isEditing
154
property bool isSelected: visualIndex == topicList.feedSelectedIndex
156
anchors{ left: parent.left; right: parent.right }
157
height: topicItem.height
159
function cancelEdit() {
160
topicItem.cancelEdit()
163
function confirmEdit() {
164
topicItem.confirmEdit()
167
function feedDrop(feedId, topicId) {
168
console.log("dropped item feed id", feedId)
169
console.log("dropped item topic id", topicId)
170
DB.deleteFeedTag(feedId, topicId)
171
DB.addFeedTag(feedId, model.id)
172
delegateRoot.isExpanded = true
125
delegate: MouseArea {
128
// property int visualIndex: VisualDataModel.itemsIndex
129
property alias isExpanded: topicItem.isExpanded
130
// property alias isEditing: topicItem.isEditing
132
anchors { left: parent.left; right: parent.right }
133
height: topicItem.height
135
function cancelEdit() {
136
topicItem.cancelEdit()
139
function confirmEdit() {
140
topicItem.confirmEdit()
145
topicName: model.name
148
// isSelected: VisualDataModel.itemsIndex == topicList.feedSelectedIndex
151
if (topicList.currentItem)
152
topicList.currentItem.cancelEdit()
153
topicManagement.state = "editMode"
154
topicList.currentIndex = index
158
if (topicList.currentItem)
159
topicList.currentItem.cancelEdit()
160
topicManagement.state = "default"
161
topicList.currentIndex = -1
174
165
feedEdit(model.id)
179
topicName: model.name
182
// isExpanded: delegateRoot.isExpanded
185
if (topicList.currentItem)
186
topicList.currentItem.cancelEdit()
187
topicManagement.editIndex = index
188
topicManagement.state = "editMode"
189
// editConfirm.visible = true
190
topicList.currentIndex = index
194
if (topicList.currentItem)
195
topicList.currentItem.cancelEdit()
196
topicManagement.state = "default"
197
// editConfirm.visible = false
198
topicList.currentIndex = -1
215
when: delegateRoot.isSelected
225
DropArea is useless here, because Drag.active will lead crash in device
226
so I use another more complicated way to act like DropArea
230
anchors { fill: parent}
233
console.log("enter", drag.source)
234
topicItem.selected = true
238
// console.log("exit", drag.source)
239
topicItem.selected = false
243
// console.log("drop", drag.source)
244
topicItem.selected = false
245
drag.source.opacity = 0
246
console.log("dropped item feed id", drag.source.feedId)
247
console.log("dropped item topic id", drag.source.topicId)
248
DB.deleteFeedTag(drag.source.feedId, drag.source.topicId)
249
DB.addFeedTag(drag.source.feedId, model.id)
250
delegateRoot.isExpanded = true
256
// target: Qt.inputMethod
258
// onVisibleChanged: {
259
// if (pageStack && (pageStack.currentPage == topicManagement) && Qt.inputMethod.visible) {
260
// topicList.delegateRootY = topicList.currentItem.y
261
// timerKeyboard.stop()
262
// timerKeyboard.start()
178
// when: delegateRoot.isSelected
273
delegateRoot.isExpanded = false
282
if (model.id == newTopicId || model.id == previousTopicId){
283
topicItem.reloadFeed()
284
topicItem.isExpanded = true
285
feedEdit(previousTopicId)
291
if (model.id == topicId){
292
topicItem.reloadFeed()
293
topicItem.isExpanded = true
192
delegateRoot.isExpanded = false
201
if (model.id == newTopicId || model.id == previousTopicId){
202
topicItem.reloadFeed()
203
topicItem.isExpanded = true
204
feedEdit(previousTopicId)
210
if (model.id == topicId){
211
topicItem.reloadFeed()
212
topicItem.isExpanded = true