connection_id, _ok = index.model().data(
index.sibling(index.row(), 0)).toInt()
self.connection_id = connection_id
- self.model.setFilter(
- 'ipypbxweb_%s.connection_id = %i' %
- (self.basename, connection_id))
+
+ # Filter is customizable in order to allow ugly hacks :-)
+ self.model.setFilter(self.getFilter(connection_id))
+
+ # Select first row.
self.view_list.selectRow(0)
+
+ # Create a new object if none exist.
if not self.model.rowCount():
self.add()
+ def getFilter(self, connection_id):
+ return 'ipypbxweb_%s.connection_id = %i' % (
+ self.basename, connection_id)
+
def objectAdded(self, row, record):
"""
Set connection_id from currently selected connection.
'xml_dialplan', '<action application="echo" data=""/>')
super(ExtensionController, self).objectAdded(row, record)
+ def getFilter(self, connection_id):
+ # Workaround for Qt bug:
+ # http://bugreports.qt.nokia.com/browse/QTBUG-8217 . Apparently they
+ # don't hurry to fix it.
+ return '1 = 1) or (ipypbxweb_%s.connection_id = %i' % (
+ self.basename, connection_id)