Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
896e4345
Commit
896e4345
authored
10 years ago
by
Emmanuel Lepage Vallee
Browse files
Options
Downloads
Patches
Plain Diff
ciphers: Add 'useDefault' option
Refs #71337
parent
8bc888e4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ciphermodel.cpp
+19
-1
19 additions, 1 deletion
src/ciphermodel.cpp
src/ciphermodel.h
+8
-0
8 additions, 0 deletions
src/ciphermodel.h
with
27 additions
and
1 deletion
src/ciphermodel.cpp
+
19
−
1
View file @
896e4345
...
@@ -39,6 +39,7 @@ public:
...
@@ -39,6 +39,7 @@ public:
static
QVector
<
QByteArray
>
m_slSupportedCiphers
;
static
QVector
<
QByteArray
>
m_slSupportedCiphers
;
static
QHash
<
QString
,
int
>
m_shMapping
;
static
QHash
<
QString
,
int
>
m_shMapping
;
static
bool
m_sIsLoaded
;
static
bool
m_sIsLoaded
;
bool
m_UseDefault
;
static
void
loadCiphers
();
static
void
loadCiphers
();
};
};
...
@@ -47,7 +48,7 @@ bool CipherModelPrivate::m_sIsLoaded = false;
...
@@ -47,7 +48,7 @@ bool CipherModelPrivate::m_sIsLoaded = false;
QVector
<
QByteArray
>
CipherModelPrivate
::
m_slSupportedCiphers
;
QVector
<
QByteArray
>
CipherModelPrivate
::
m_slSupportedCiphers
;
QHash
<
QString
,
int
>
CipherModelPrivate
::
m_shMapping
;
QHash
<
QString
,
int
>
CipherModelPrivate
::
m_shMapping
;
CipherModelPrivate
::
CipherModelPrivate
(
Account
*
parent
)
:
m_pAccount
(
parent
)
CipherModelPrivate
::
CipherModelPrivate
(
Account
*
parent
)
:
m_pAccount
(
parent
)
,
m_UseDefault
(
true
)
{
{
if
(
!
CipherModelPrivate
::
m_sIsLoaded
)
{
if
(
!
CipherModelPrivate
::
m_sIsLoaded
)
{
const
QStringList
cs
=
DBus
::
ConfigurationManager
::
instance
().
getSupportedCiphers
(
DRing
::
Account
::
ProtocolNames
::
IP2IP
);
const
QStringList
cs
=
DBus
::
ConfigurationManager
::
instance
().
getSupportedCiphers
(
DRing
::
Account
::
ProtocolNames
::
IP2IP
);
...
@@ -60,6 +61,7 @@ CipherModelPrivate::CipherModelPrivate(Account* parent) : m_pAccount(parent)
...
@@ -60,6 +61,7 @@ CipherModelPrivate::CipherModelPrivate(Account* parent) : m_pAccount(parent)
foreach
(
const
QString
&
cipher
,
parent
->
d_ptr
->
accountDetail
(
DRing
::
Account
::
ConfProperties
::
TLS
::
CIPHERS
).
split
(
' '
))
{
foreach
(
const
QString
&
cipher
,
parent
->
d_ptr
->
accountDetail
(
DRing
::
Account
::
ConfProperties
::
TLS
::
CIPHERS
).
split
(
' '
))
{
m_lChecked
[
m_shMapping
[
cipher
]]
=
true
;
m_lChecked
[
m_shMapping
[
cipher
]]
=
true
;
m_UseDefault
=
false
;
}
}
}
}
...
@@ -133,3 +135,19 @@ bool CipherModel::setData( const QModelIndex& index, const QVariant &value, int
...
@@ -133,3 +135,19 @@ bool CipherModel::setData( const QModelIndex& index, const QVariant &value, int
}
}
return
false
;
return
false
;
}
}
bool
CipherModel
::
useDefault
()
const
{
return
d_ptr
->
m_UseDefault
;
}
void
CipherModel
::
setUseDefault
(
bool
value
)
{
d_ptr
->
m_UseDefault
=
value
;
if
(
value
)
{
for
(
int
i
=
0
;
i
<
d_ptr
->
m_slSupportedCiphers
.
size
();
i
++
)
{
d_ptr
->
m_lChecked
[
i
]
=
false
;
}
emit
dataChanged
(
index
(
0
,
0
),
index
(
d_ptr
->
m_slSupportedCiphers
.
size
()
-
1
,
0
));
}
}
This diff is collapsed.
Click to expand it.
src/ciphermodel.h
+
8
−
0
View file @
896e4345
...
@@ -42,6 +42,8 @@ class LIB_EXPORT CipherModel : public QAbstractListModel {
...
@@ -42,6 +42,8 @@ class LIB_EXPORT CipherModel : public QAbstractListModel {
public:
public:
Q_PROPERTY
(
bool
useDefault
READ
useDefault
WRITE
setUseDefault
)
//Model functions
//Model functions
virtual
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
override
;
virtual
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
override
;
virtual
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
()
)
const
override
;
virtual
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
()
)
const
override
;
...
@@ -49,6 +51,12 @@ public:
...
@@ -49,6 +51,12 @@ public:
virtual
bool
setData
(
const
QModelIndex
&
index
,
const
QVariant
&
value
,
int
role
)
override
;
virtual
bool
setData
(
const
QModelIndex
&
index
,
const
QVariant
&
value
,
int
role
)
override
;
virtual
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
virtual
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
//Getter
bool
useDefault
()
const
;
//Setter
void
setUseDefault
(
bool
value
);
private:
private:
//Private constructor, can only be called by 'Account'
//Private constructor, can only be called by 'Account'
...
...
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