Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Kleopatra
Commits
bbca0841
Commit
bbca0841
authored
Jan 14, 2021
by
Ingo Klöcker
Browse files
Use role constants and Columns enum values from namespace
parent
f7d80849
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/commands/importcertificatescommand.cpp
View file @
bbca0841
...
...
@@ -16,6 +16,7 @@
#include "certifycertificatecommand.h"
#include "kleopatra_debug.h"
#include <Libkleo/KeyList>
#include <Libkleo/KeyListSortFilterProxyModel>
#include <Libkleo/KeyCache>
#include <Libkleo/Predicates>
...
...
@@ -88,7 +89,7 @@ protected:
if
(
!
index
.
isValid
()
||
role
!=
Qt
::
ToolTipRole
)
{
return
AbstractKeyListSortFilterProxyModel
::
data
(
index
,
role
);
}
const
QString
fpr
=
index
.
data
(
FingerprintRole
).
toString
();
const
QString
fpr
=
index
.
data
(
KeyList
::
FingerprintRole
).
toString
();
// find information:
const
std
::
vector
<
Import
>::
const_iterator
it
=
qBinaryFind
(
m_importsByFingerprint
.
begin
(),
m_importsByFingerprint
.
end
(),
...
...
@@ -118,7 +119,7 @@ protected:
//
// 1. Check that this is an imported key:
//
const
QString
fpr
=
index
.
data
(
FingerprintRole
).
toString
();
const
QString
fpr
=
index
.
data
(
KeyList
::
FingerprintRole
).
toString
();
return
std
::
binary_search
(
m_importsByFingerprint
.
begin
(),
m_importsByFingerprint
.
end
(),
fpr
.
toLatin1
().
constData
(),
...
...
src/crypto/gui/certificatelineedit.cpp
View file @
bbca0841
...
...
@@ -20,6 +20,7 @@
#include <Libkleo/KeyCache>
#include <Libkleo/KeyFilter>
#include <Libkleo/KeyList>
#include <Libkleo/KeyListModel>
#include <Libkleo/KeyListSortFilterProxyModel>
#include <Libkleo/Formatting>
...
...
@@ -60,8 +61,7 @@ public:
switch
(
role
)
{
case
Qt
::
DecorationRole
:
{
const
auto
key
=
KeyListSortFilterProxyModel
::
data
(
index
,
Kleo
::
KeyListModelInterface
::
KeyRole
).
value
<
GpgME
::
Key
>
();
const
auto
key
=
KeyListSortFilterProxyModel
::
data
(
index
,
KeyList
::
KeyRole
).
value
<
GpgME
::
Key
>
();
Q_ASSERT
(
!
key
.
isNull
());
if
(
key
.
isNull
())
{
return
QVariant
();
...
...
@@ -92,12 +92,12 @@ CertificateLineEdit::CertificateLineEdit(AbstractKeyListModel *model,
mCompleterFilterModel
->
setSourceModel
(
model
);
auto
*
completer
=
new
QCompleter
(
this
);
completer
->
setModel
(
mCompleterFilterModel
);
completer
->
setCompletionColumn
(
KeyList
ModelInterface
::
Summary
);
completer
->
setCompletionColumn
(
KeyList
::
Summary
);
completer
->
setFilterMode
(
Qt
::
MatchContains
);
completer
->
setCaseSensitivity
(
Qt
::
CaseInsensitive
);
setCompleter
(
completer
);
mFilterModel
->
setSourceModel
(
model
);
mFilterModel
->
setFilterKeyColumn
(
KeyList
ModelInterface
::
Summary
);
mFilterModel
->
setFilterKeyColumn
(
KeyList
::
Summary
);
if
(
filter
)
{
mFilterModel
->
setKeyFilter
(
mFilter
);
}
...
...
@@ -172,7 +172,8 @@ void CertificateLineEdit::updateKey()
mLineAction
->
setToolTip
(
i18n
(
"Open selection dialog."
));
}
}
else
if
(
mFilterModel
->
rowCount
()
==
1
)
{
newKey
=
mFilterModel
->
data
(
mFilterModel
->
index
(
0
,
0
),
KeyListModelInterface
::
KeyRole
).
value
<
Key
>
();
const
auto
index
=
mFilterModel
->
index
(
0
,
0
);
newKey
=
mFilterModel
->
data
(
index
,
KeyList
::
KeyRole
).
value
<
Key
>
();
mLineAction
->
setToolTip
(
Formatting
::
validity
(
newKey
.
userID
(
0
))
+
QStringLiteral
(
"<br/>Click here for details."
));
/* FIXME: This needs to be solved by a multiple UID supporting model */
...
...
src/view/keytreeview.cpp
View file @
bbca0841
...
...
@@ -11,6 +11,7 @@
#include "keytreeview.h"
#include <Libkleo/KeyList>
#include <Libkleo/KeyListModel>
#include <Libkleo/KeyListSortFilterProxyModel>
#include <Libkleo/KeyRearrangeColumnsProxyModel>
...
...
@@ -273,22 +274,22 @@ void KeyTreeView::init()
KeyRearrangeColumnsProxyModel
*
rearangingModel
=
new
KeyRearrangeColumnsProxyModel
(
this
);
rearangingModel
->
setSourceModel
(
m_proxy
);
rearangingModel
->
setSourceColumns
(
QVector
<
int
>
()
<<
KeyList
ModelInterface
::
PrettyName
<<
KeyList
ModelInterface
::
PrettyEMail
<<
KeyList
ModelInterface
::
Validity
<<
KeyList
ModelInterface
::
ValidFrom
<<
KeyList
ModelInterface
::
ValidUntil
<<
KeyList
ModelInterface
::
TechnicalDetails
<<
KeyList
ModelInterface
::
KeyID
<<
KeyList
ModelInterface
::
Fingerprint
<<
KeyList
ModelInterface
::
OwnerTrust
<<
KeyList
ModelInterface
::
Origin
<<
KeyList
ModelInterface
::
LastUpdate
<<
KeyList
ModelInterface
::
Issuer
<<
KeyList
ModelInterface
::
SerialNumber
rearangingModel
->
setSourceColumns
(
QVector
<
int
>
()
<<
KeyList
::
PrettyName
<<
KeyList
::
PrettyEMail
<<
KeyList
::
Validity
<<
KeyList
::
ValidFrom
<<
KeyList
::
ValidUntil
<<
KeyList
::
TechnicalDetails
<<
KeyList
::
KeyID
<<
KeyList
::
Fingerprint
<<
KeyList
::
OwnerTrust
<<
KeyList
::
Origin
<<
KeyList
::
LastUpdate
<<
KeyList
::
Issuer
<<
KeyList
::
SerialNumber
#ifdef GPGME_HAS_REMARKS
// If a column is added before this TAGS_COLUMN define has to be updated accordingly
<<
KeyList
ModelInterface
::
Remarks
<<
KeyList
::
Remarks
#endif
);
m_view
->
setModel
(
rearangingModel
);
...
...
@@ -300,7 +301,7 @@ void KeyTreeView::init()
if
(
!
index
.
isValid
())
{
return
;
}
const
auto
&
key
=
index
.
data
(
K
leo
::
KeyListModelInterface
::
KeyRole
).
value
<
GpgME
::
Key
>
();
const
auto
&
key
=
index
.
data
(
K
eyList
::
KeyRole
).
value
<
GpgME
::
Key
>
();
const
auto
fpr
=
QString
::
fromLatin1
(
key
.
primaryFingerprint
());
if
(
m_expandedKeys
.
contains
(
fpr
))
{
...
...
@@ -314,7 +315,7 @@ void KeyTreeView::init()
if
(
!
index
.
isValid
())
{
return
;
}
const
auto
&
key
=
index
.
data
(
K
leo
::
KeyListModelInterface
::
KeyRole
).
value
<
GpgME
::
Key
>
();
const
auto
&
key
=
index
.
data
(
K
eyList
::
KeyRole
).
value
<
GpgME
::
Key
>
();
m_expandedKeys
.
removeAll
(
QString
::
fromLatin1
(
key
.
primaryFingerprint
()));
m_group
.
writeEntry
(
"Expanded"
,
m_expandedKeys
);
});
...
...
@@ -688,8 +689,8 @@ bool KeyTreeView::connectSearchBar(const QObject *bar)
void
KeyTreeView
::
resizeColumns
()
{
m_view
->
setColumnWidth
(
KeyList
ModelInterface
::
PrettyName
,
260
);
m_view
->
setColumnWidth
(
KeyList
ModelInterface
::
PrettyEMail
,
260
);
m_view
->
setColumnWidth
(
KeyList
::
PrettyName
,
260
);
m_view
->
setColumnWidth
(
KeyList
::
PrettyEMail
,
260
);
for
(
int
i
=
2
;
i
<
m_view
->
model
()
->
columnCount
();
++
i
)
{
m_view
->
resizeColumnToContents
(
i
);
...
...
Write
Preview
Supports
Markdown
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