Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mesonium
gajim
Commits
8d7e37b6
Commit
8d7e37b6
authored
3 years ago
by
Daniel Brötzmann
Browse files
Options
Downloads
Patches
Plain Diff
Preferences: Add Purge Chat History button
parent
b3686347
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gajim/common/storage/archive.py
+12
-0
12 additions, 0 deletions
gajim/common/storage/archive.py
gajim/data/gui/preferences.ui
+624
-160
624 additions, 160 deletions
gajim/data/gui/preferences.ui
gajim/gtk/preferences.py
+22
-0
22 additions, 0 deletions
gajim/gtk/preferences.py
with
658 additions
and
160 deletions
gajim/common/storage/archive.py
+
12
−
0
View file @
8d7e37b6
...
...
@@ -1375,6 +1375,18 @@ def forget_jid_data(self, account: str, jid: JID) -> None:
self
.
_delayed_commit
()
log
.
info
(
'
Forgot data for: %s
'
,
jid
)
def
remove_all_history
(
self
)
->
None
:
"""
Remove all messages for all accounts
"""
statements
=
[
'
DELETE FROM logs
'
,
'
DELETE FROM jids
'
,
'
DELETE FROM last_archive_message
'
]
self
.
_execute_multiple
(
statements
)
log
.
info
(
'
Removed all chat history
'
)
def
_cleanup_chat_history
(
self
)
->
None
:
"""
Remove messages from account where messages are older than max_age
...
...
This diff is collapsed.
Click to expand it.
gajim/data/gui/preferences.ui
+
624
−
160
View file @
8d7e37b6
This diff is collapsed.
Click to expand it.
gajim/gtk/preferences.py
+
22
−
0
View file @
8d7e37b6
...
...
@@ -41,6 +41,8 @@
from
.const
import
SettingKind
from
.const
import
SettingType
from
.controls.groupchat
import
GroupchatControl
from
.dialogs
import
DialogButton
from
.dialogs
import
ConfirmationDialog
from
.emoji_chooser
import
emoji_chooser
from
.settings
import
PopoverSetting
from
.settings
import
SettingsBox
...
...
@@ -920,6 +922,9 @@ def __init__(self, pref_window: Preferences) -> None:
reset_button
.
connect
(
'
clicked
'
,
self
.
_on_reset_hints
)
reset_button
.
set_sensitive
(
self
.
_check_hints_reset
)
purge_history_button
=
pref_window
.
get_ui
().
purge_history_button
purge_history_button
.
connect
(
'
clicked
'
,
self
.
_on_purge_history_clicked
)
@staticmethod
def
_get_proxies
()
->
dict
[
str
,
str
]:
return
{
proxy
:
proxy
for
proxy
in
app
.
settings
.
get_proxies
()}
...
...
@@ -943,6 +948,23 @@ def _on_reset_hints(self, button: Gtk.Button) -> None:
app
.
settings
.
set
(
hint
,
True
)
button
.
set_sensitive
(
False
)
@staticmethod
def
_on_purge_history_clicked
(
button
:
Gtk
.
Button
)
->
None
:
def
_purge
()
->
None
:
button
.
set_sensitive
(
False
)
app
.
storage
.
archive
.
remove_all_history
()
app
.
window
.
quit
()
ConfirmationDialog
(
_
(
'
Purge all Chat History
'
),
_
(
'
Purge all Chat History
'
),
_
(
'
Do you really want to remove all chat messages from Gajim?
\n
'
'
Warning: This can’t be undone!
\n
'
'
Gajim will quit afterwards.
'
),
[
DialogButton
.
make
(
'
Cancel
'
),
DialogButton
.
make
(
'
Remove
'
,
text
=
_
(
'
_Purge
'
),
callback
=
_purge
)]).
show
()
class
Advanced
(
PreferenceBox
):
def
__init__
(
self
,
pref_window
:
Preferences
)
->
None
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment