use new dataform widget in groupchat config window
This commit is contained in:
parent
8fc93418a2
commit
3534bb30cd
4 changed files with 37 additions and 14 deletions
|
@ -1232,11 +1232,12 @@ class Connection(ConnectionHandlers):
|
||||||
item.setAttr('affiliation', affiliation)
|
item.setAttr('affiliation', affiliation)
|
||||||
self.connection.send(iq)
|
self.connection.send(iq)
|
||||||
|
|
||||||
def send_gc_config(self, room_jid, config):
|
def send_gc_config(self, room_jid, form):
|
||||||
iq = common.xmpp.Iq(typ = 'set', to = room_jid, queryNS =\
|
iq = common.xmpp.Iq(typ = 'set', to = room_jid, queryNS =\
|
||||||
common.xmpp.NS_MUC_OWNER)
|
common.xmpp.NS_MUC_OWNER)
|
||||||
query = iq.getTag('query')
|
query = iq.getTag('query')
|
||||||
self.build_data_from_dict(query, config)
|
form.setAttr('type', 'submit')
|
||||||
|
query.addChild(node = form)
|
||||||
self.connection.send(iq)
|
self.connection.send(iq)
|
||||||
|
|
||||||
def gpg_passphrase(self, passphrase):
|
def gpg_passphrase(self, passphrase):
|
||||||
|
|
|
@ -1849,8 +1849,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
|
||||||
node = q
|
node = q
|
||||||
if not node:
|
if not node:
|
||||||
return
|
return
|
||||||
dic = self.parse_data_form(node)
|
self.dispatch('GC_CONFIG', (helpers.get_full_jid_from_iq(iq_obj), node))
|
||||||
self.dispatch('GC_CONFIG', (helpers.get_full_jid_from_iq(iq_obj), dic))
|
|
||||||
|
|
||||||
def _MucAdminCB(self, con, iq_obj):
|
def _MucAdminCB(self, con, iq_obj):
|
||||||
gajim.log.debug('MucAdminCB')
|
gajim.log.debug('MucAdminCB')
|
||||||
|
|
|
@ -28,6 +28,7 @@ import dialogs
|
||||||
import cell_renderer_image
|
import cell_renderer_image
|
||||||
import message_control
|
import message_control
|
||||||
import chat_control
|
import chat_control
|
||||||
|
import dataforms_widget
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import gtkspell
|
import gtkspell
|
||||||
|
@ -41,6 +42,7 @@ from common import connection
|
||||||
from common import passwords
|
from common import passwords
|
||||||
from common import zeroconf
|
from common import zeroconf
|
||||||
from common import dbus_support
|
from common import dbus_support
|
||||||
|
from common import dataforms
|
||||||
|
|
||||||
from common.exceptions import GajimGeneralException
|
from common.exceptions import GajimGeneralException
|
||||||
|
|
||||||
|
@ -2297,11 +2299,12 @@ class ServiceRegistrationWindow(DataFormWindow):
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
|
|
||||||
class GroupchatConfigWindow(DataFormWindow):
|
class GroupchatConfigWindow:
|
||||||
'''GroupchatConfigWindow class'''
|
'''GroupchatConfigWindow class'''
|
||||||
def __init__(self, account, room_jid, config = None):
|
def __init__(self, account, room_jid, form = None):
|
||||||
DataFormWindow.__init__(self, account, config)
|
self.account = account
|
||||||
self.room_jid = room_jid
|
self.room_jid = room_jid
|
||||||
|
self.form = form
|
||||||
self.remove_button = {}
|
self.remove_button = {}
|
||||||
self.affiliation_treeview = {}
|
self.affiliation_treeview = {}
|
||||||
self.list_init = {} # list at the beginning
|
self.list_init = {} # list at the beginning
|
||||||
|
@ -2310,6 +2313,22 @@ class GroupchatConfigWindow(DataFormWindow):
|
||||||
'owner': _('Owner List'),
|
'owner': _('Owner List'),
|
||||||
'admin':_('Administrator List')}
|
'admin':_('Administrator List')}
|
||||||
|
|
||||||
|
self.xml = gtkgui_helpers.get_glade('data_form_window.glade', 'data_form_window')
|
||||||
|
self.window = self.xml.get_widget('data_form_window')
|
||||||
|
self.window.set_transient_for(gajim.interface.roster.window)
|
||||||
|
|
||||||
|
if self.form:
|
||||||
|
config_vbox = self.xml.get_widget('config_vbox')
|
||||||
|
dataform = dataforms.ExtendForm(node = self.form)
|
||||||
|
self.data_form_widget = dataforms_widget.DataFormWidget(dataform)
|
||||||
|
# hide scrollbar of this data_form_widget, we already have in this
|
||||||
|
# widget
|
||||||
|
sw = self.data_form_widget.xml.get_widget('single_form_scrolledwindow')
|
||||||
|
sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER)
|
||||||
|
|
||||||
|
self.data_form_widget.show()
|
||||||
|
config_vbox.pack_start(self.data_form_widget)
|
||||||
|
|
||||||
# Draw the edit affiliation list things
|
# Draw the edit affiliation list things
|
||||||
add_on_vbox = self.xml.get_widget('add_on_vbox')
|
add_on_vbox = self.xml.get_widget('add_on_vbox')
|
||||||
|
|
||||||
|
@ -2369,7 +2388,11 @@ class GroupchatConfigWindow(DataFormWindow):
|
||||||
gajim.connections[self.account].get_affiliation_list(self.room_jid,
|
gajim.connections[self.account].get_affiliation_list(self.room_jid,
|
||||||
affiliation)
|
affiliation)
|
||||||
|
|
||||||
add_on_vbox.show_all()
|
self.xml.signal_autoconnect(self)
|
||||||
|
self.window.show_all()
|
||||||
|
|
||||||
|
def on_cancel_button_clicked(self, widget):
|
||||||
|
self.window.destroy()
|
||||||
|
|
||||||
def on_cell_edited(self, cell, path, new_text):
|
def on_cell_edited(self, cell, path, new_text):
|
||||||
model = self.affiliation_treeview['outcast'].get_model()
|
model = self.affiliation_treeview['outcast'].get_model()
|
||||||
|
@ -2448,9 +2471,9 @@ class GroupchatConfigWindow(DataFormWindow):
|
||||||
|
|
||||||
def on_ok_button_clicked(self, widget):
|
def on_ok_button_clicked(self, widget):
|
||||||
# We pressed OK button of the DataFormWindow
|
# We pressed OK button of the DataFormWindow
|
||||||
if self.config:
|
if self.form:
|
||||||
gajim.connections[self.account].send_gc_config(self.room_jid,
|
form = self.data_form_widget.data_form
|
||||||
self.config)
|
gajim.connections[self.account].send_gc_config(self.room_jid, form)
|
||||||
for affiliation in ('outcast', 'member', 'owner', 'admin'):
|
for affiliation in ('outcast', 'member', 'owner', 'admin'):
|
||||||
list = {}
|
list = {}
|
||||||
actual_jid_list = []
|
actual_jid_list = []
|
||||||
|
|
|
@ -1119,7 +1119,7 @@ class Interface:
|
||||||
gc_control.print_conversation(text)
|
gc_control.print_conversation(text)
|
||||||
|
|
||||||
def handle_event_gc_config(self, account, array):
|
def handle_event_gc_config(self, account, array):
|
||||||
#('GC_CONFIG', account, (jid, config)) config is a dict
|
#('GC_CONFIG', account, (jid, form)) config is a dict
|
||||||
room_jid = array[0].split('/')[0]
|
room_jid = array[0].split('/')[0]
|
||||||
if room_jid in gajim.automatic_rooms[account]:
|
if room_jid in gajim.automatic_rooms[account]:
|
||||||
# use default configuration
|
# use default configuration
|
||||||
|
|
Loading…
Add table
Reference in a new issue