1 | /* $Id: UIAddDiskEncryptionPasswordDialog.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIAddDiskEncryptionPasswordDialog class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_widgets_UIAddDiskEncryptionPasswordDialog_h
|
---|
29 | #define FEQT_INCLUDED_SRC_widgets_UIAddDiskEncryptionPasswordDialog_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QDialog>
|
---|
36 | #include <QMap>
|
---|
37 | #include <QMultiMap>
|
---|
38 |
|
---|
39 | /* GUI includes: */
|
---|
40 | #include "QIWithRetranslateUI.h"
|
---|
41 | #include "UILibraryDefs.h"
|
---|
42 |
|
---|
43 | /* Forward declarations: */
|
---|
44 | class QLabel;
|
---|
45 | class QIDialogButtonBox;
|
---|
46 | class UIEncryptionDataTable;
|
---|
47 |
|
---|
48 | /* Type definitions: */
|
---|
49 | typedef QMultiMap<QString, QUuid> EncryptedMediumMap;
|
---|
50 | typedef QMap<QString, QString> EncryptionPasswordMap;
|
---|
51 | typedef QMap<QString, bool> EncryptionPasswordStatusMap;
|
---|
52 |
|
---|
53 | /** QDialog subclass used to
|
---|
54 | * allow the user to enter disk encryption passwords for particular password IDs. */
|
---|
55 | class SHARED_LIBRARY_STUFF UIAddDiskEncryptionPasswordDialog : public QIWithRetranslateUI<QDialog>
|
---|
56 | {
|
---|
57 | Q_OBJECT;
|
---|
58 |
|
---|
59 | public:
|
---|
60 |
|
---|
61 | /** Constructs dialog passing @a pParent to the base-class.
|
---|
62 | * @param strMachineName Brings the name of the machine we show this dialog for.
|
---|
63 | * @param encryptedMedia Brings the lists of medium ids (values) encrypted with passwords with ids (keys). */
|
---|
64 | UIAddDiskEncryptionPasswordDialog(QWidget *pParent, const QString &strMachineName, const EncryptedMediumMap &encryptedMedia);
|
---|
65 |
|
---|
66 | /** Returns the shallow copy of the encryption password map
|
---|
67 | * acquired from the UIEncryptionDataTable instance. */
|
---|
68 | EncryptionPasswordMap encryptionPasswords() const;
|
---|
69 |
|
---|
70 | protected:
|
---|
71 |
|
---|
72 | /** Translation routine. */
|
---|
73 | virtual void retranslateUi() RT_OVERRIDE;
|
---|
74 |
|
---|
75 | private slots:
|
---|
76 |
|
---|
77 | /** Handles editor's Enter/Return key triggering. */
|
---|
78 | void sltEditorEnterKeyTriggered() { accept(); }
|
---|
79 |
|
---|
80 | /** Performs passwords validation.
|
---|
81 | * If all passwords are valid,
|
---|
82 | * this slot calls to base-class. */
|
---|
83 | void accept();
|
---|
84 |
|
---|
85 | private:
|
---|
86 |
|
---|
87 | /** Prepares all. */
|
---|
88 | void prepare();
|
---|
89 |
|
---|
90 | /** Returns whether passed @a strPassword is valid for medium with passed @a uMediumId. */
|
---|
91 | static bool isPasswordValid(const QUuid &uMediumId, const QString strPassword);
|
---|
92 |
|
---|
93 | /** Holds the name of the machine we show this dialog for. */
|
---|
94 | const QString m_strMachineName;
|
---|
95 |
|
---|
96 | /** Holds the encrypted medium map reference. */
|
---|
97 | const EncryptedMediumMap &m_encryptedMedia;
|
---|
98 |
|
---|
99 | /** Holds the description label instance. */
|
---|
100 | QLabel *m_pLabelDescription;
|
---|
101 | /** Holds the encryption-data table instance. */
|
---|
102 | UIEncryptionDataTable *m_pTableEncryptionData;
|
---|
103 | /** Holds the button-box instance. */
|
---|
104 | QIDialogButtonBox *m_pButtonBox;
|
---|
105 | };
|
---|
106 |
|
---|
107 | #endif /* !FEQT_INCLUDED_SRC_widgets_UIAddDiskEncryptionPasswordDialog_h */
|
---|