Changeset 715
- Timestamp:
- 07/15/08 05:43:57 (5 months ago)
- Files:
-
- oss/jlib/jlib/core/contact.py (modified) (3 diffs)
- oss/jlib/jlib/gui/contact.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
oss/jlib/jlib/core/contact.py
r714 r715 113 113 self.send(Roster(from_jid=self.from_jid, to_jid=nodeid, 114 114 type=u'result', stanza_id=generate_unique()), 'result') 115 115 116 116 if contact.subscription == 'none': 117 117 r = Roster(from_jid=self.from_jid, to_jid=nodeid, 118 type=u'set', stanza_id=generate_unique())118 type=u'set', stanza_id=generate_unique()) 119 119 i = Item(nodeid) 120 120 i.subscription = u'remove' … … 192 192 return QtGui.QStandardItemModel.flags(self, index) 193 193 194 def mimeTypes(self): 195 types = QtGui.QStandardItemModel.mimeTypes(self) 196 types.append(QtCore.QString('text/uri-list')) 197 return types 198 194 199 def mimeData(self, indexes): 195 mimeData = Qt Core.QMimeData()200 mimeData = QtGui.QStandardItemModel.mimeData(self, indexes) 196 201 urls = [] 197 202 for index in indexes: 198 203 if index.isValid(): 199 204 contact = self.getContact(index) 200 urls.append(QtCore.QUrl( 'xmpp:%s' % str(contact.jid)))205 urls.append(QtCore.QUrl(QtCore.QString('xmpp:%s' % str(contact.jid)))) 201 206 202 207 mimeData.setUrls(urls) … … 238 243 def getGroup(self, index): 239 244 return self.itemFromIndex(index).group 245 246 def getGroupAt(self, row, column): 247 for group in self.group_items: 248 item = self.group_items[group] 249 if item.row() == row and item.column() == column: 250 return group 240 251 241 252 def getGroupIndex(self, group): oss/jlib/jlib/gui/contact.py
r714 r715 20 20 self.contacts.contextMenuEvent = self.contextMenuEvent 21 21 self.contacts.dragEnterEvent = self.dragEnterEvent 22 self.contacts.dropEvent = self.dropEvent 22 23 23 24 self.contact = jlibContact(parent=self) … … 42 43 43 44 QtCore.QObject.connect(self.contacts, QtCore.SIGNAL("clicked(QModelIndex)"), self.clicked) 44 45 45 46 def receivedRoster(self, roster): 46 47 model = self.contacts.model() … … 125 126 def dragEnterEvent(self, event): 126 127 data = event.mimeData() 127 if not data.hasFormat('text/uri-list'):128 event.ignore()129 return130 131 128 model = self.contacts.model() 132 129 index = self.contacts.indexAt(event.pos()) … … 137 134 if group in contact.groups: 138 135 contact.groups.remove(group) 139 140 136 event.accept() 141 137 142 138 def dropEvent(self, event): 143 139 model = self.contacts.model() 140 group = unicode(self.contacts.indexAt(event.pos()).data().toString()) 144 141 145 index = self.contacts.indexAt(event.pos()) 146 parentIndex = index.parent() 147 group = model.getGroup(parentIndex) 148 149 urls = event.data().urls() 150 for url in urls: 142 for url in event.mimeData().urls(): 151 143 xmppUrl = str(url.toString()) 152 144 jid = xmppUrl[5:] 153 145 contact = model.getContactByJID(jid) 154 contact.groups .append(group)155 156 print contact.groups146 contact.groups = [group] 147 self.contact.emit(QtCore.SIGNAL("changeGroup(PyQt_PyObject, PyQt_PyObject)"), 148 contact.jid, contact.groups) 157 149 158 159
