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