middle click in roster open chat window
middle clicl in gc window open a pm
This commit is contained in:
parent
697a49a9e9
commit
db90fc6430
|
@ -934,6 +934,27 @@ class GroupchatWindow(chat.Chat):
|
|||
room_jid = self.get_active_jid()
|
||||
self.mk_menu(room_jid, event, iter)
|
||||
return True
|
||||
if event.button == 2: # middle click
|
||||
try:
|
||||
path, column, x, y = widget.get_path_at_pos(int(event.x),
|
||||
int(event.y))
|
||||
except TypeError:
|
||||
widget.get_selection().unselect_all()
|
||||
return False
|
||||
widget.get_selection().select_path(path)
|
||||
model = widget.get_model()
|
||||
iter = model.get_iter(path)
|
||||
if len(path) == 2:
|
||||
room_jid = self.get_active_jid()
|
||||
nick = model.get_value(iter, 1)
|
||||
fjid = room_jid + '/' + nick
|
||||
if not self.plugin.windows[self.account]['chats'].has_key(fjid):
|
||||
show = model.get_value(iter, 3)
|
||||
u = User(fjid, nick, ['none'], show, '', 'none', None, '', 0,'')
|
||||
self.plugin.roster.new_chat(u, self.account)
|
||||
self.plugin.windows[self.account]['chats'][fjid].set_active_tab(fjid)
|
||||
self.plugin.windows[self.account]['chats'][fjid].window.present()
|
||||
return True
|
||||
if event.button == 1: # left click
|
||||
try:
|
||||
path, column, x, y = widget.get_path_at_pos(int(event.x),
|
||||
|
|
|
@ -1014,6 +1014,27 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
|||
elif type == 'account':
|
||||
self.mk_menu_account(event, iter)
|
||||
return True
|
||||
if event.button == 2: # Middle click
|
||||
try:
|
||||
path, column, x, y = self.tree.get_path_at_pos(int(event.x),
|
||||
int(event.y))
|
||||
except TypeError:
|
||||
self.tree.get_selection().unselect_all()
|
||||
return
|
||||
self.tree.get_selection().select_path(path)
|
||||
model = self.tree.get_model()
|
||||
iter = model.get_iter(path)
|
||||
type = model.get_value(iter, 2)
|
||||
if type == 'agent' or type == 'user':
|
||||
account = model.get_value(iter, 4)
|
||||
jid = model.get_value(iter, 3)
|
||||
if self.plugin.windows[account]['chats'].has_key(jid):
|
||||
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
||||
elif self.contacts[account].has_key(jid):
|
||||
self.new_chat(self.contacts[account][jid][0], account)
|
||||
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
||||
self.plugin.windows[account]['chats'][jid].window.present()
|
||||
return True
|
||||
if event.button == 1: # Left click
|
||||
try:
|
||||
path, column, x, y = self.tree.get_path_at_pos(int(event.x),
|
||||
|
|
Loading…
Reference in New Issue