Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Nheko Reborn
nheko
Commits
e6723884
Commit
e6723884
authored
4 years ago
by
kirillpt
Browse files
Options
Downloads
Patches
Plain Diff
fix encryption toggles
parent
5a3905b3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/dialogs/CreateRoom.cpp
+0
-1
0 additions, 1 deletion
src/dialogs/CreateRoom.cpp
src/dialogs/RoomSettings.cpp
+33
-31
33 additions, 31 deletions
src/dialogs/RoomSettings.cpp
with
33 additions
and
32 deletions
src/dialogs/CreateRoom.cpp
+
0
−
1
View file @
e6723884
...
...
@@ -81,7 +81,6 @@ CreateRoom::CreateRoom(QWidget *parent)
directToggle_
->
setActiveColor
(
QColor
(
"#38A3D8"
));
directToggle_
->
setInactiveColor
(
QColor
(
"gray"
));
directToggle_
->
setState
(
false
);
directToggle_
->
setChecked
(
false
);
auto
directLayout
=
new
QHBoxLayout
;
directLayout
->
setContentsMargins
(
0
,
10
,
0
,
10
);
...
...
This diff is collapsed.
Click to expand it.
src/dialogs/RoomSettings.cpp
+
33
−
31
View file @
e6723884
#include
"dialogs/RoomSettings.h"
#include
<QApplication>
#include
<QComboBox>
#include
<QEvent>
...
...
@@ -15,8 +16,6 @@
#include
<QStandardPaths>
#include
<QStyleOption>
#include
<QVBoxLayout>
#include
"dialogs/RoomSettings.h"
#include
<mtx/responses/common.hpp>
#include
<mtx/responses/media.hpp>
...
...
@@ -405,8 +404,31 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent)
auto
encryptionLabel
=
new
QLabel
(
tr
(
"Encryption"
),
this
);
encryptionToggle_
=
new
Toggle
(
this
);
connect
(
encryptionToggle_
,
&
Toggle
::
toggled
,
this
,
[
this
](
bool
isOn
)
{
if
(
!
isOn
)
auto
encryptionOptionLayout
=
new
QHBoxLayout
;
encryptionOptionLayout
->
setMargin
(
0
);
encryptionOptionLayout
->
addWidget
(
encryptionLabel
,
Qt
::
AlignBottom
|
Qt
::
AlignLeft
);
encryptionOptionLayout
->
addWidget
(
encryptionToggle_
,
0
,
Qt
::
AlignBottom
|
Qt
::
AlignRight
);
auto
keyRequestsLabel
=
new
QLabel
(
tr
(
"Respond to key requests"
),
this
);
keyRequestsLabel
->
setToolTipDuration
(
6000
);
keyRequestsLabel
->
setToolTip
(
tr
(
"Whether or not the client should respond automatically with the session keys
\n
"
" upon request. Use with caution, this is a temporary measure to test the
\n
"
" E2E implementation until device verification is completed."
));
keyRequestsToggle_
=
new
Toggle
(
this
);
connect
(
keyRequestsToggle_
,
&
Toggle
::
toggled
,
this
,
[
this
](
bool
isOn
)
{
utils
::
setKeyRequestsPreference
(
room_id_
,
isOn
);
});
auto
keyRequestsLayout
=
new
QHBoxLayout
;
keyRequestsLayout
->
setMargin
(
0
);
keyRequestsLayout
->
setSpacing
(
0
);
keyRequestsLayout
->
addWidget
(
keyRequestsLabel
,
Qt
::
AlignBottom
|
Qt
::
AlignLeft
);
keyRequestsLayout
->
addWidget
(
keyRequestsToggle_
,
0
,
Qt
::
AlignBottom
|
Qt
::
AlignRight
);
connect
(
encryptionToggle_
,
&
Toggle
::
toggled
,
this
,
[
this
,
keyRequestsLabel
](
bool
isOn
)
{
if
(
!
isOn
||
usesEncryption_
)
return
;
QMessageBox
msgBox
;
...
...
@@ -422,44 +444,22 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent)
switch
(
ret
)
{
case
QMessageBox
::
Ok
:
{
encryptionToggle_
->
setState
(
true
);
encryptionToggle_
->
setEnabled
(
tru
e
);
encryptionToggle_
->
setEnabled
(
fals
e
);
enableEncryption
();
keyRequestsToggle_
->
show
();
keyRequestsLabel
->
show
();
break
;
}
default
:
{
encryptionToggle_
->
setState
(
false
);
encryptionToggle_
->
setEnabled
(
false
);
break
;
}
}
});
auto
encryptionOptionLayout
=
new
QHBoxLayout
;
encryptionOptionLayout
->
setMargin
(
0
);
encryptionOptionLayout
->
addWidget
(
encryptionLabel
,
Qt
::
AlignBottom
|
Qt
::
AlignLeft
);
encryptionOptionLayout
->
addWidget
(
encryptionToggle_
,
0
,
Qt
::
AlignBottom
|
Qt
::
AlignRight
);
auto
keyRequestsLabel
=
new
QLabel
(
tr
(
"Respond to key requests"
),
this
);
keyRequestsLabel
->
setToolTipDuration
(
6000
);
keyRequestsLabel
->
setToolTip
(
tr
(
"Whether or not the client should respond automatically with the session keys
\n
"
" upon request. Use with caution, this is a temporary measure to test the
\n
"
" E2E implementation until device verification is completed."
));
keyRequestsToggle_
=
new
Toggle
(
this
);
connect
(
keyRequestsToggle_
,
&
Toggle
::
toggled
,
this
,
[
this
](
bool
isOn
)
{
utils
::
setKeyRequestsPreference
(
room_id_
,
isOn
);
});
auto
keyRequestsLayout
=
new
QHBoxLayout
;
keyRequestsLayout
->
setMargin
(
0
);
keyRequestsLayout
->
setSpacing
(
0
);
keyRequestsLayout
->
addWidget
(
keyRequestsLabel
,
Qt
::
AlignBottom
|
Qt
::
AlignLeft
);
keyRequestsLayout
->
addWidget
(
keyRequestsToggle_
,
0
,
Qt
::
AlignBottom
|
Qt
::
AlignRight
);
// Disable encryption button.
if
(
usesEncryption_
)
{
encryptionToggle_
->
setState
(
true
);
encryptionToggle_
->
setEnabled
(
tru
e
);
encryptionToggle_
->
setEnabled
(
fals
e
);
keyRequestsToggle_
->
setState
(
utils
::
respondsToKeyRequests
(
room_id_
));
}
else
{
...
...
@@ -544,7 +544,9 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent)
connect
(
this
,
&
RoomSettings
::
enableEncryptionError
,
this
,
[
this
](
const
QString
&
msg
)
{
encryptionToggle_
->
setState
(
false
);
encryptionToggle_
->
setEnabled
(
false
);
keyRequestsToggle_
->
setState
(
false
);
keyRequestsToggle_
->
setEnabled
(
false
);
keyRequestsToggle_
->
hide
();
emit
ChatPage
::
instance
()
->
showNotification
(
msg
);
});
...
...
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