Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

reporegistry: experimental implementation for drop

Changeset 8b840103709d

Parent 6ece904a6d49

by Adrian Buehlmann

Changes to one file · Browse files at 8b840103709d Showing diff from parent 6ece904a6d49 Diff from another changeset...

 
181
182
183
 
184
185
186
187
188
189
190
191
192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
194
195
 
181
182
183
184
185
186
187
188
189
190
 
 
 
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
@@ -181,15 +181,50 @@
  return Qt.MoveAction     def removeRows(self, row, count, parent): + print "removeRows()"   self.beginRemoveRows(parent, row, row+count)   item = parent.internalPointer()   res = item.removeRows(row, count)   self.endRemoveRows()   return res   - def insertRows(self, row, count, parent): - print "insertRows(row=%s, count=%s): not yet implemented" % (row, count) - return False + def mimeTypes(self): + return QtCore.QStringList('application/thg-reporegistry') + + def mimeData(self, indexes): + print "mimeData()" + i = indexes[0] + item = i.internalPointer() + buf = 'repo=%s' % item.rootpath() + print buf + d = QtCore.QMimeData() + d.setData('application/thg-reporegistry', buf) + return d + + def dropMimeData(self, data, action, row, column, parent): + print "dropMimeData()" + print "action = %s" % action + print "formats:" + for s in data.formats(): + print s + d = str(data.data('application/thg-reporegistry')) + d = d.split('=') + print d + if d[0] != 'repo': + print "not a repo" + return False + path = d[1] + print "path = %s" % path + group = parent.internalPointer() + print "group = %s" % group + cc = group.childCount() + self.beginInsertRows(parent, cc, cc) + print "1: group.childCount() = %s" % group.childCount() + group.appendChild(RepoItem(path)) + print "2: group.childCount() = %s" % group.childCount() + self.endInsertRows() + return True +     # functions not defined in QAbstractItemModel