Philipp Hörist pushed to branch master at gajim / gajim


Commits:
63e5f254 by Philipp Hörist at 2022-10-10T20:22:12+02:00
change: Remove confirm_paste_image setting

Pasting a image in the chat should always be confirmed.

- - - - -


3 changed files:

- gajim/common/setting_values.py
- gajim/gtk/dialogs.py
- gajim/gtk/message_actions_box.py


Changes:

=====================================
gajim/common/setting_values.py
=====================================
@@ -46,7 +46,6 @@ class _ACCOUNT_DEFAULT:
     'check_for_update',
     'confirm_close_muc',
     'confirm_on_window_delete',
-    'confirm_paste_image',
     'dev_force_bookmark_2',
     'dev_use_message_label',
     'developer_modus',
@@ -184,7 +183,6 @@ class _ACCOUNT_DEFAULT:
     'confirm_block': '',
     'confirm_close_muc': True,
     'confirm_on_window_delete': True,
-    'confirm_paste_image': True,
     'dark_theme': 2,
     'date_timestamp_format': '%x',
     'dev_force_bookmark_2': False,
@@ -641,7 +639,6 @@ class WorkspaceSettings(TypedDict):
         'confirm_close_muc': _('Ask before closing a group chat tab/window.'),
         'confirm_on_window_delete': _(
             'Ask before quitting when Gajim’s window is closed'),
-        'confirm_paste_image': _('Ask before pasting an image.'),
         'date_timestamp_format': 
'https://docs.python.org/3/library/time.html#time.strftime',  # noqa: E501
         'dev_force_bookmark_2': _('Force Bookmark 2 usage'),
         'dev_use_message_label': '',


=====================================
gajim/gtk/dialogs.py
=====================================
@@ -335,7 +335,7 @@ def _on_response(self,
         super()._on_response(_dialog, response)
 
 
-class PastePreviewDialog(ConfirmationCheckDialog):
+class PastePreviewDialog(ConfirmationDialog):
     def __init__(self,
                  title: str,
                  text: str,
@@ -346,14 +346,13 @@ def __init__(self,
                  modal: bool = True,
                  transient_for: Optional[Gtk.Window] = None
                  ) -> None:
-        ConfirmationCheckDialog.__init__(self,
-                                         title,
-                                         text,
-                                         sec_text,
-                                         check_text,
-                                         buttons,
-                                         transient_for=transient_for,
-                                         modal=modal)
+        ConfirmationDialog.__init__(self,
+                                    title,
+                                    text,
+                                    sec_text,
+                                    buttons,
+                                    transient_for=transient_for,
+                                    modal=modal)
 
         preview = Gtk.Image()
         preview.set_halign(Gtk.Align.CENTER)


=====================================
gajim/gtk/message_actions_box.py
=====================================
@@ -579,10 +579,6 @@ def _on_paste_clipboard(self,
         if image is None:
             return
 
-        if not app.settings.get('confirm_paste_image'):
-            self._paste_event_confirmed(True, image)
-            return
-
         PastePreviewDialog(
             _('Paste Image'),
             _('You are trying to paste an image'),
@@ -591,17 +587,14 @@ def _on_paste_clipboard(self,
             _('_Do not ask me again'),
             image,
             [DialogButton.make('Cancel'),
-                DialogButton.make('Accept',
-                                  text=_('_Paste'),
-                                  callback=self._paste_event_confirmed,
-                                  args=[image])]).show()
+             DialogButton.make('Accept',
+                               text=_('_Paste'),
+                               callback=self._paste_event_confirmed,
+                               args=[image])]).show()
 
     def _paste_event_confirmed(self,
-                               is_checked: bool,
                                image: GdkPixbuf.Pixbuf
                                ) -> None:
-        if is_checked:
-            app.settings.set('confirm_paste_image', False)
 
         dir_ = tempfile.gettempdir()
         path = os.path.join(dir_, f'{uuid.uuid4()}.png')



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/63e5f254e006685dcc97372190442c3468d9f43e

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/63e5f254e006685dcc97372190442c3468d9f43e
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to