Added support to delete conversations

This commit is contained in:
Manuel Cortez 2019-04-09 17:55:05 -05:00
parent 05c001067e
commit 6f245d9b7f
4 changed files with 27 additions and 4 deletions

View File

@ -6,7 +6,9 @@
* Improvements in the audio player module:
* When modifying volume of the playing audio, it will decrease or increase the volume by 2% instead of 5%.
* For users with multiple soundcards, there is a new tab in the preferences dialogue of Socializer, called sound. From there, you can define what soundcard will be used for input and output.
* it is possible to retrieve more items for conversation buffers. Due to API limitations, it is possible to load up to the last 600 messages for every conversation. Take into account that the process of loading more items takes some time. You will hear a message when the process is done.
* Improvements in conversation buffers:
* it is possible to retrieve more items for conversation buffers. Due to API limitations, it is possible to load up to the last 600 messages for every conversation. Take into account that the process of loading more items takes some time. You will hear a message when the process is done.
* It is possible to delete entire conversations from the tree of buffers, by using the menu key and selecting "delete conversation". The conversation will be removed from VK.
## Changes in version 0.19 (13.03.2019)

View File

@ -883,6 +883,7 @@ class Controller(object):
else:
option = menu.Append(wx.NewId(), _("Discard groups"))
widgetUtils.connect_event(menu, widgetUtils.MENU, self.unload_community_buffers, menuitem=option)
# Deal with video and audio albums' sections.
elif current_buffer.name == "audio_albums":
menu = wx.Menu()
if self.session.settings["load_at_startup"]["audio_albums"] == False and not hasattr(self.session, "audio_albums"):
@ -899,6 +900,9 @@ class Controller(object):
else:
option = menu.Append(wx.NewId(), _("Discard video albums"))
widgetUtils.connect_event(menu, widgetUtils.MENU, self.unload_video_album_buffers, menuitem=option)
elif current_buffer.name.endswith("_messages"):
menu = menus.conversationBufferMenu()
widgetUtils.connect_event(menu, widgetUtils.MENU, self.delete_conversation, menuitem=menu.delete)
if menu != None:
self.window.PopupMenu(menu, self.window.FindFocus().GetPosition())
@ -1000,4 +1004,13 @@ class Controller(object):
buff = self.window.search(buffer.name)
self.window.remove_buffer(buff)
self.buffers.remove(buffer)
del self.session.video_albums
del self.session.video_albums
def delete_conversation(self, *args, **kwargs):
current_buffer = self.get_current_buffer()
d = commonMessages.delete_conversation()
if d == widgetUtils.YES:
results = self.session.vk.client.messages.deleteConversation(peer_id=current_buffer.kwargs["peer_id"])
buff = self.window.search(current_buffer.name)
self.window.remove_buffer(buff)
self.buffers.remove(current_buffer)

View File

@ -63,4 +63,7 @@ def restart_program():
return wx.MessageDialog(None, _("In order to apply the changes you requested, you must restart the program. Do you want to restart Socializer now?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
def community_no_items():
return wx.MessageDialog(None, _("There are 0 items for this community."), _("Error"), wx.ICON_ERROR).ShowModal()
return wx.MessageDialog(None, _("There are 0 items for this community."), _("Error"), wx.ICON_ERROR).ShowModal()
def delete_conversation():
return wx.MessageDialog(None, _("do you really want to delete all messages of this conversation in VK?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()

View File

@ -124,4 +124,9 @@ class communityBufferMenu(wx.Menu):
self.load_audios = load.Append(wx.NewId(), _("Load audios"))
self.load_videos = load.Append(wx.NewId(), _("Load videos"))
self.load_documents = load.Append(wx.NewId(), _("Load documents"))
self.Append(wx.NewId(), _("Load"), load)
self.Append(wx.NewId(), _("Load"), load)
class conversationBufferMenu(wx.Menu):
def __init__(self):
super(conversationBufferMenu, self).__init__()
self.delete = self.Append(wx.NewId(), _("Delete conversation"))