Skip to content
Snippets Groups Projects
Commit 8f50831d authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

ability to hide / show status changes in history window. Fixes #7255

parent ee6cc335
No related branches found
No related tags found
No related merge requests found
......@@ -211,7 +211,21 @@
</packing>
</child>
<child>
<placeholder/>
<object class="GtkCheckButton" id="show_status_checkbutton">
<property name="label" translatable="yes">_Show status changes</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_show_status_checkbutton_toggled"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
......
......@@ -76,6 +76,7 @@ class HistoryWindow:
self.checkbutton = xml.get_object('log_history_checkbutton')
self.checkbutton.connect('toggled',
self.on_log_history_checkbutton_toggled)
self.show_status_checkbutton = xml.get_object('show_status_checkbutton')
self.query_entry = xml.get_object('query_entry')
self.query_combobox = xml.get_object('query_combobox')
self.jid_entry = self.query_combobox.child
......@@ -328,7 +329,7 @@ class HistoryWindow:
def on_calendar_day_selected(self, widget):
if not self.jid:
return
year, month, day = widget.get_date() # integers
year, month, day = self.calendar.get_date() # integers
month = gtkgui_helpers.make_gtk_month_python_month(month)
self._add_lines_for_date(year, month, day)
......@@ -381,6 +382,7 @@ class HistoryWindow:
"""
self.history_buffer.set_text('') # clear the buffer first
self.last_time_printout = 0
show_status = self.show_status_checkbutton.get_active()
lines = gajim.logger.get_conversation_for_date(self.jid, year, month,
day, self.account)
......@@ -389,6 +391,9 @@ class HistoryWindow:
for line in lines:
# line[0] is contact_name, line[1] is time of message
# line[2] is kind, line[3] is show, line[4] is message
if not show_status and line[2] in (constants.KIND_GCSTATUS,
constants.KIND_STATUS):
continue
self._add_new_line(line[0], line[1], line[2], line[3], line[4],
line[5])
......@@ -520,6 +525,8 @@ class HistoryWindow:
year, month, day = self.calendar.get_date() # integers
month = gtkgui_helpers.make_gtk_month_python_month(month)
show_status = self.show_status_checkbutton.get_active()
# contact_name, time, kind, show, message, subject
results = gajim.logger.get_search_results_for_query(jid, text,
account, year, month, day)
......@@ -527,6 +534,9 @@ class HistoryWindow:
# add "subject: | message: " in message column if kind is single
# also do we need show at all? (we do not search on subject)
for row in results:
if not show_status and row[2] in (constants.KIND_GCSTATUS,
constants.KIND_STATUS):
continue
contact_name = row[0]
if not contact_name:
kind = row[2]
......@@ -638,6 +648,10 @@ class HistoryWindow:
gajim.config.set_per('accounts', self.account, 'no_log_for',
' '.join(no_log_for))
def on_show_status_checkbutton_toggled(self, widget):
# reload logs
self.on_calendar_day_selected(None)
def open_history(self, jid, account):
"""
Load chat history of the specified jid
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment