blob: 0d76c07fe6f2db5da787a6b18663c4fa1eca9598 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
/*
* Copyright (C) 2020 KeePassXC Team <team@keepassxc.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 or (at your option)
* version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KEEPASSXC_REPORTSWIDGETHIBP_H
#define KEEPASSXC_REPORTSWIDGETHIBP_H
#include "config-keepassx.h"
#include "gui/entry/EntryModel.h"
#include <QMap>
#include <QPair>
#include <QPointer>
#include <QWidget>
#ifdef WITH_XC_NETWORKING
#include "core/HibpDownloader.h"
#endif
class Database;
class Entry;
class Group;
class QSortFilterProxyModel;
class QStandardItemModel;
namespace Ui
{
class ReportsWidgetHibp;
}
class ReportsWidgetHibp : public QWidget
{
Q_OBJECT
public:
explicit ReportsWidgetHibp(QWidget* parent = nullptr);
~ReportsWidgetHibp();
void loadSettings(QSharedPointer<Database> db);
void saveSettings();
void refreshAfterEdit();
signals:
void entryActivated(Entry*);
public slots:
void emitEntryActivated(const QModelIndex&);
void addHibpResult(const QString&, int);
void fetchFailed(const QString& error);
void makeHibpTable();
void customMenuRequested(QPoint);
void editFromContextmenu();
void toggleKnownBad(bool);
private:
void startValidation();
static QString countToText(int count);
QScopedPointer<Ui::ReportsWidgetHibp> m_ui;
QScopedPointer<QStandardItemModel> m_referencesModel;
QScopedPointer<QSortFilterProxyModel> m_modelProxy;
QSharedPointer<Database> m_db;
QMap<QString, int> m_pwndPasswords; // Passwords we found to have been pwned (value is pwn count)
QString m_error; // Error message if download failed, else empty
QList<const Entry*> m_rowToEntry; // List index is table row
QPointer<const Entry> m_editedEntry; // The entry we're currently editing
QString m_editedPassword; // The old password of the entry we're editing
bool m_editedKnownBad; // The old "known bad" flag of the entry we're editing
Entry* m_contextmenuEntry = nullptr; // The entry that was right-clicked
#ifdef WITH_XC_NETWORKING
HibpDownloader m_downloader; // This performs the actual HIBP online query
#endif
};
#endif // KEEPASSXC_REPORTSWIDGETHIBP_H
|