Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
gajim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yuki
gajim
Commits
245cecf1
Commit
245cecf1
authored
Apr 23, 2019
by
Daniel Brötzmann
Committed by
Philipp Hörist
Apr 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework PassphraseDialog
parent
a9499386
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
146 additions
and
109 deletions
+146
-109
gajim/data/gui/passphrase_dialog.ui
gajim/data/gui/passphrase_dialog.ui
+80
-42
gajim/dialogs.py
gajim/dialogs.py
+0
-62
gajim/gtk/accounts.py
gajim/gtk/accounts.py
+1
-1
gajim/gtk/dialogs.py
gajim/gtk/dialogs.py
+59
-0
gajim/gui_interface.py
gajim/gui_interface.py
+6
-4
No files found.
gajim/data/gui/passphrase_dialog.ui
View file @
245cecf1
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.
18.3
-->
<!-- Generated with glade 3.
22.1
-->
<interface>
<requires
lib=
"gtk+"
version=
"3.
12
"
/>
<requires
lib=
"gtk+"
version=
"3.
20
"
/>
<object
class=
"GtkDialog"
id=
"passphrase_dialog"
>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"border_width"
>
1
2
</property>
<property
name=
"border_width"
>
1
8
</property>
<property
name=
"title"
translatable=
"yes"
>
Passphrase
</property>
<property
name=
"resizable"
>
False
</property>
<property
name=
"type_hint"
>
dialog
</property>
<signal
name=
"destroy"
handler=
"on_passphrase_dialog_destroy"
swapped=
"no"
/>
<child>
<placeholder/>
</child>
<child
internal-child=
"vbox"
>
<object
class=
"GtkBox"
id=
"dialog-vbox4"
>
<object
class=
"GtkBox"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"spacing"
>
6
</property>
<child
internal-child=
"action_area"
>
<object
class=
"GtkButtonBox"
id=
"dialog-action_area3"
>
<object
class=
"GtkButtonBox"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"margin_top"
>
12
</property>
<property
name=
"layout_style"
>
end
</property>
<child>
<object
class=
"GtkButton"
id=
"cancel_button"
>
<property
name=
"label"
>
gtk-c
ancel
</property>
<property
name=
"label"
>
_C
ancel
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"can_default"
>
True
</property>
<property
name=
"receives_default"
>
False
</property>
<property
name=
"use_
stock
"
>
True
</property>
<property
name=
"use_
underline
"
>
True
</property>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
Fals
e
</property>
<property
name=
"fill"
>
Tru
e
</property>
<property
name=
"position"
>
0
</property>
</packing>
</child>
<child>
<object
class=
"GtkButton"
id=
"ok_button"
>
<property
name=
"label"
>
gtk-ok
</property>
<property
name=
"label"
>
_OK
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"can_default"
>
True
</property>
<property
name=
"has_default"
>
True
</property>
<property
name=
"receives_default"
>
False
</property>
<property
name=
"use_stock"
>
True
</property>
<property
name=
"use_underline"
>
True
</property>
<style>
<class
name=
"suggested-action"
/>
</style>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
Fals
e
</property>
<property
name=
"fill"
>
Tru
e
</property>
<property
name=
"position"
>
1
</property>
</packing>
</child>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
Fals
e
</property>
<property
name=
"fill"
>
Tru
e
</property>
<property
name=
"pack_type"
>
end
</property>
<property
name=
"position"
>
1
</property>
</packing>
</child>
<child>
<object
class=
"GtkBox"
id=
"vbox30"
>
<object
class=
"GtkBox"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"border_width"
>
6
</property>
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"spacing"
>
6
</property>
<property
name=
"spacing"
>
18
</property>
<child>
<object
class=
"Gtk
Label"
id=
"message_label
"
>
<object
class=
"Gtk
Image
"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"wrap"
>
True
</property>
<property
name=
"icon_name"
>
dialog-password-symbolic
</property>
<property
name=
"icon_size"
>
6
</property>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
<property
name=
"padding"
>
5
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
0
</property>
</packing>
</child>
<child>
<object
class=
"Gtk
Entry"
id=
"passphrase_entry
"
>
<object
class=
"Gtk
Box
"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"has_focus"
>
True
</property>
<property
name=
"visibility"
>
False
</property>
<property
name=
"activates_default"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"spacing"
>
6
</property>
<child>
<object
class=
"GtkLabel"
id=
"message_label"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"margin_bottom"
>
6
</property>
<property
name=
"wrap"
>
True
</property>
<property
name=
"max_width_chars"
>
40
</property>
<property
name=
"xalign"
>
0
</property>
<style>
<class
name=
"bold"
/>
</style>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
0
</property>
</packing>
</child>
<child>
<object
class=
"GtkEntry"
id=
"passphrase_entry"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"has_focus"
>
True
</property>
<property
name=
"visibility"
>
False
</property>
<property
name=
"activates_default"
>
True
</property>
<property
name=
"input_purpose"
>
password
</property>
<property
name=
"input_hints"
>
GTK_INPUT_HINT_NO_SPELLCHECK | GTK_INPUT_HINT_NONE
</property>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
1
</property>
</packing>
</child>
<child>
<object
class=
"GtkCheckButton"
id=
"save_passphrase_checkbutton"
>
<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=
"draw_indicator"
>
True
</property>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
2
</property>
</packing>
</child>
</object>
<packing>
<property
name=
"expand"
>
Fals
e
</property>
<property
name=
"fill"
>
Fals
e
</property>
<property
name=
"expand"
>
Tru
e
</property>
<property
name=
"fill"
>
Tru
e
</property>
<property
name=
"position"
>
1
</property>
</packing>
</child>
<child>
<object
class=
"GtkCheckButton"
id=
"save_passphrase_checkbutton"
>
<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=
"xalign"
>
0.5
</property>
<property
name=
"draw_indicator"
>
True
</property>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
<property
name=
"position"
>
2
</property>
</packing>
</child>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
...
...
gajim/dialogs.py
View file @
245cecf1
...
...
@@ -217,68 +217,6 @@ class EditGroupsDialog:
column
.
add_attribute
(
renderer
,
'active'
,
1
)
column
.
add_attribute
(
renderer
,
'inconsistent'
,
2
)
class
PassphraseDialog
:
"""
Class for Passphrase dialog
"""
def
__init__
(
self
,
titletext
,
labeltext
,
checkbuttontext
=
None
,
ok_handler
=
None
,
cancel_handler
=
None
,
transient_for
=
None
):
self
.
xml
=
get_builder
(
'passphrase_dialog.ui'
)
self
.
window
=
self
.
xml
.
get_object
(
'passphrase_dialog'
)
self
.
passphrase_entry
=
self
.
xml
.
get_object
(
'passphrase_entry'
)
self
.
passphrase
=
-
1
self
.
window
.
set_title
(
titletext
)
self
.
xml
.
get_object
(
'message_label'
).
set_text
(
labeltext
)
self
.
ok
=
False
self
.
cancel_handler
=
cancel_handler
self
.
ok_handler
=
ok_handler
okbutton
=
self
.
xml
.
get_object
(
'ok_button'
)
okbutton
.
connect
(
'clicked'
,
self
.
on_okbutton_clicked
)
cancelbutton
=
self
.
xml
.
get_object
(
'cancel_button'
)
cancelbutton
.
connect
(
'clicked'
,
self
.
on_cancelbutton_clicked
)
self
.
xml
.
connect_signals
(
self
)
if
transient_for
is
None
:
transient_for
=
app
.
app
.
get_active_window
()
self
.
window
.
set_transient_for
(
transient_for
)
self
.
window
.
show_all
()
self
.
check
=
bool
(
checkbuttontext
)
checkbutton
=
self
.
xml
.
get_object
(
'save_passphrase_checkbutton'
)
if
self
.
check
:
checkbutton
.
set_label
(
checkbuttontext
)
else
:
checkbutton
.
hide
()
def
on_okbutton_clicked
(
self
,
widget
):
if
not
self
.
ok_handler
:
return
passph
=
self
.
passphrase_entry
.
get_text
()
if
self
.
check
:
checked
=
self
.
xml
.
get_object
(
'save_passphrase_checkbutton'
).
\
get_active
()
else
:
checked
=
False
self
.
ok
=
True
self
.
window
.
destroy
()
if
isinstance
(
self
.
ok_handler
,
tuple
):
self
.
ok_handler
[
0
](
passph
,
checked
,
*
self
.
ok_handler
[
1
:])
else
:
self
.
ok_handler
(
passph
,
checked
)
def
on_cancelbutton_clicked
(
self
,
widget
):
self
.
window
.
destroy
()
def
on_passphrase_dialog_destroy
(
self
,
widget
):
if
self
.
cancel_handler
and
not
self
.
ok
:
self
.
cancel_handler
()
class
ChangeActivityDialog
:
PAGELIST
=
[
...
...
gajim/gtk/accounts.py
View file @
245cecf1
...
...
@@ -31,13 +31,13 @@ from gajim.common.connection import Connection
from
gajim.common.zeroconf.connection_zeroconf
import
ConnectionZeroconf
from
gajim
import
gui_menu_builder
from
gajim.dialogs
import
PassphraseDialog
from
gajim.gtk.settings
import
SettingsDialog
from
gajim.gtk.settings
import
SettingsBox
from
gajim.gtk.dialogs
import
ConfirmationDialog
from
gajim.gtk.dialogs
import
ConfirmationDialogDoubleRadio
from
gajim.gtk.dialogs
import
ErrorDialog
from
gajim.gtk.dialogs
import
PassphraseDialog
from
gajim.gtk.dialogs
import
YesNoDialog
from
gajim.gtk.dialogs
import
DialogButton
from
gajim.gtk.dialogs
import
NewConfirmationDialog
...
...
gajim/gtk/dialogs.py
View file @
245cecf1
...
...
@@ -1071,6 +1071,65 @@ class InvitationReceivedDialog(Gtk.ApplicationWindow):
self
.
destroy
()
class
PassphraseDialog
:
"""
Class for Passphrase dialog
"""
def
__init__
(
self
,
titletext
,
labeltext
,
checkbuttontext
=
None
,
ok_handler
=
None
,
cancel_handler
=
None
,
transient_for
=
None
):
self
.
_ui
=
get_builder
(
'passphrase_dialog.ui'
)
self
.
window
=
self
.
_ui
.
get_object
(
'passphrase_dialog'
)
self
.
passphrase
=
-
1
self
.
window
.
set_title
(
titletext
)
self
.
_ui
.
message_label
.
set_text
(
labeltext
)
self
.
ok
=
False
self
.
cancel_handler
=
cancel_handler
self
.
ok_handler
=
ok_handler
self
.
_ui
.
ok_button
.
connect
(
'clicked'
,
self
.
on_okbutton_clicked
)
self
.
_ui
.
cancel_button
.
connect
(
'clicked'
,
self
.
on_cancelbutton_clicked
)
self
.
_ui
.
connect_signals
(
self
)
if
transient_for
is
None
:
transient_for
=
app
.
app
.
get_active_window
()
self
.
window
.
set_transient_for
(
transient_for
)
self
.
window
.
show_all
()
self
.
check
=
bool
(
checkbuttontext
)
if
self
.
_ui
.
save_passphrase_checkbutton
:
self
.
_ui
.
save_passphrase_checkbutton
.
set_label
(
checkbuttontext
)
else
:
self
.
_ui
.
save_passphrase_checkbutton
.
hide
()
def
on_okbutton_clicked
(
self
,
widget
):
if
not
self
.
ok_handler
:
return
passph
=
self
.
_ui
.
passphrase_entry
.
get_text
()
if
self
.
check
:
checked
=
self
.
_ui
.
save_passphrase_checkbutton
.
get_active
()
else
:
checked
=
False
self
.
ok
=
True
self
.
window
.
destroy
()
if
isinstance
(
self
.
ok_handler
,
tuple
):
self
.
ok_handler
[
0
](
passph
,
checked
,
*
self
.
ok_handler
[
1
:])
else
:
self
.
ok_handler
(
passph
,
checked
)
def
on_cancelbutton_clicked
(
self
,
widget
):
self
.
window
.
destroy
()
def
on_passphrase_dialog_destroy
(
self
,
widget
):
if
self
.
cancel_handler
and
not
self
.
ok
:
self
.
cancel_handler
()
class
NewConfirmationDialog
(
Gtk
.
MessageDialog
):
def
__init__
(
self
,
title
,
text
,
sec_text
,
buttons
,
modal
=
True
,
transient_for
=
None
):
...
...
gajim/gui_interface.py
View file @
245cecf1
...
...
@@ -109,6 +109,7 @@ from gajim.gtk.dialogs import WarningDialog
from
gajim.gtk.dialogs
import
InformationDialog
from
gajim.gtk.dialogs
import
InputDialog
from
gajim.gtk.dialogs
import
YesNoDialog
from
gajim.gtk.dialogs
import
PassphraseDialog
from
gajim.gtk.dialogs
import
PlainConnectionDialog
from
gajim.gtk.dialogs
import
SSLErrorDialog
from
gajim.gtk.dialogs
import
ChangeNickDialog
...
...
@@ -574,9 +575,10 @@ class Interface:
obj
.
conn
.
on_client_cert_passphrase
(
''
,
obj
.
con
,
obj
.
port
,
obj
.
secure_tuple
)
dialogs
.
PassphraseDialog
(
_
(
'Certificate Passphrase Required'
),
_
(
'Enter the certificate passphrase for account %s'
)
%
\
obj
.
conn
.
name
,
ok_handler
=
on_ok
,
cancel_handler
=
on_cancel
)
PassphraseDialog
(
_
(
'Certificate Passphrase Required'
),
_
(
'Enter the certificate passphrase for account %s'
)
%
\
obj
.
conn
.
name
,
ok_handler
=
on_ok
,
cancel_handler
=
on_cancel
)
def
handle_event_password_required
(
self
,
obj
):
#('PASSWORD_REQUIRED', account, None)
...
...
@@ -595,7 +597,7 @@ class Interface:
obj
.
conn
.
disconnect
(
reconnect
=
False
,
immediately
=
True
)
del
self
.
pass_dialog
[
account
]
self
.
pass_dialog
[
account
]
=
dialogs
.
PassphraseDialog
(
self
.
pass_dialog
[
account
]
=
PassphraseDialog
(
_
(
'Password Required'
),
text
,
_
(
'Save password'
),
ok_handler
=
on_ok
,
cancel_handler
=
on_cancel
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment