Changeset 96967 in vbox
- Timestamp:
- Oct 3, 2022 1:17:31 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 153888
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r96430 r96967 858 858 } 859 859 860 bool UIMessageCenter::confirmCancelingPortForwardingDialog(QWidget *pParent /* = 0 */) const860 bool UIMessageCenter::confirmCancelingPortForwardingDialog(QWidget *pParent /* = 0 */) const 861 861 { 862 862 return questionBinary(pParent, MessageType_Question, 863 863 tr("<p>There are unsaved changes in the port forwarding configuration.</p>" 864 864 "<p>If you proceed your changes will be discarded.</p>"), 865 0 /* auto-confirm id */, 866 QString() /* ok button text */, 867 QString() /* cancel button text */, 868 false /* ok button by default? */); 869 } 870 871 bool UIMessageCenter::confirmRestoringDefaultKeys(QWidget *pParent /* = 0 */) const 872 { 873 return questionBinary(pParent, MessageType_Question, 874 tr("<p>Are you going to restore default secure boot keys.</p>" 875 "<p>If you proceed your current keys will be rewritten. " 876 "You may not be able to boot affected VM anymore.</p>"), 865 877 0 /* auto-confirm id */, 866 878 QString() /* ok button text */, -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r96407 r96967 317 317 bool warnAboutRulesConflict(QWidget *pParent = 0) const; 318 318 bool confirmCancelingPortForwardingDialog(QWidget *pParent = 0) const; 319 bool confirmRestoringDefaultKeys(QWidget *pParent = 0) const; 319 320 /** @} */ 320 321 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIMotherboardFeaturesEditor.cpp
r96877 r96967 30 30 #include <QGridLayout> 31 31 #include <QLabel> 32 #include <QPushButton> 32 33 33 34 /* GUI includes: */ 35 #include "UIIconPool.h" 36 #include "UIMessageCenter.h" 34 37 #include "UIMotherboardFeaturesEditor.h" 35 38 … … 46 49 , m_pCheckBoxEnableEfi(0) 47 50 , m_pCheckBoxEnableSecureBoot(0) 51 , m_pPushButtonResetSecureBoot(0) 48 52 { 49 53 prepare(); … … 124 128 ? m_pCheckBoxEnableSecureBoot->checkState() == Qt::Checked 125 129 : m_fEnableSecureBoot; 130 } 131 132 bool UIMotherboardFeaturesEditor::isResetSecureBoot() const 133 { 134 return m_pPushButtonResetSecureBoot 135 ? m_pPushButtonResetSecureBoot->property("clicked_once").toBool() 136 : false; 126 137 } 127 138 … … 166 177 m_pCheckBoxEnableSecureBoot->setToolTip(tr("When checked, the secure boot emulation will be enabled.")); 167 178 } 179 if (m_pPushButtonResetSecureBoot) 180 { 181 m_pPushButtonResetSecureBoot->setText(tr("&Reset Keys to Default")); 182 m_pPushButtonResetSecureBoot->setToolTip(tr("Resets secure boot keys to default.")); 183 } 168 184 } 169 185 … … 171 187 { 172 188 /* Acquire actual feature state: */ 173 const bool fOn = m_pCheckBoxEnableEfi ? m_pCheckBoxEnableEfi->isChecked() : false; 189 const bool fOn = m_pCheckBoxEnableEfi 190 ? m_pCheckBoxEnableEfi->isChecked() 191 : false; 174 192 175 193 /* Update corresponding controls: */ … … 179 197 /* Notify listeners: */ 180 198 emit sigChangedEfi(); 199 sltHandleEnableSecureBootToggling(); 200 } 201 202 void UIMotherboardFeaturesEditor::sltHandleEnableSecureBootToggling() 203 { 204 /* Acquire actual feature state: */ 205 const bool fOn = m_pCheckBoxEnableEfi 206 && m_pCheckBoxEnableSecureBoot 207 && m_pPushButtonResetSecureBoot 208 ? m_pCheckBoxEnableEfi->isChecked() 209 && m_pCheckBoxEnableSecureBoot->isChecked() 210 && !m_pPushButtonResetSecureBoot->property("clicked_once").toBool() 211 : false; 212 213 /* Update corresponding controls: */ 214 if (m_pPushButtonResetSecureBoot) 215 m_pPushButtonResetSecureBoot->setEnabled(fOn); 216 217 /* Notify listeners: */ 218 emit sigChangedSecureBoot(); 219 } 220 221 void UIMotherboardFeaturesEditor::sltResetSecureBoot() 222 { 223 if (!m_pPushButtonResetSecureBoot->property("clicked_once").toBool()) 224 { 225 if (msgCenter().confirmRestoringDefaultKeys()) 226 { 227 m_pPushButtonResetSecureBoot->setProperty("clicked_once", true); 228 sltHandleEnableSecureBootToggling(); 229 } 230 } 181 231 } 182 232 … … 226 276 { 227 277 connect(m_pCheckBoxEnableSecureBoot, &QCheckBox::stateChanged, 228 this, &UIMotherboardFeaturesEditor::s igChangedSecureBoot);278 this, &UIMotherboardFeaturesEditor::sltHandleEnableSecureBootToggling); 229 279 m_pLayout->addWidget(m_pCheckBoxEnableSecureBoot, 3, 1); 280 } 281 /* Prepare 'reset secure boot' tool-button: */ 282 m_pPushButtonResetSecureBoot = new QPushButton(this); 283 if (m_pPushButtonResetSecureBoot) 284 { 285 m_pPushButtonResetSecureBoot->setIcon(UIIconPool::iconSet(":/refresh_16px")); 286 connect(m_pPushButtonResetSecureBoot, &QPushButton::clicked, 287 this, &UIMotherboardFeaturesEditor::sltResetSecureBoot); 288 m_pLayout->addWidget(m_pPushButtonResetSecureBoot, 4, 1); 230 289 } 231 290 } … … 233 292 /* Fetch states: */ 234 293 sltHandleEnableEfiToggling(); 294 sltHandleEnableSecureBootToggling(); 235 295 236 296 /* Apply language settings: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIMotherboardFeaturesEditor.h
r96877 r96967 39 39 class QGridLayout; 40 40 class QLabel; 41 class QPushButton; 41 42 42 43 /** QWidget subclass used as motherboard features editor. */ … … 81 82 bool isEnabledSecureBoot() const; 82 83 84 /** Returns 'reset to default secure boot keys' feature value. */ 85 bool isResetSecureBoot() const; 86 83 87 /** Returns minimum layout hint. */ 84 88 int minimumLabelHorizontalHint() const; … … 95 99 /** Handles 'enable EFI' feature being toggled. */ 96 100 void sltHandleEnableEfiToggling(); 101 /** Handles 'enable secure boot' feature being toggled. */ 102 void sltHandleEnableSecureBootToggling(); 103 104 /** Marks corresponding push button activated. */ 105 void sltResetSecureBoot(); 97 106 98 107 private: … … 116 125 * @{ */ 117 126 /** Holds the main layout instance. */ 118 QGridLayout *m_pLayout;127 QGridLayout *m_pLayout; 119 128 /** Holds the label instance. */ 120 QLabel *m_pLabel;129 QLabel *m_pLabel; 121 130 /** Holds the 'enable IO APIC' check-box instance. */ 122 QCheckBox *m_pCheckBoxEnableIoApic;131 QCheckBox *m_pCheckBoxEnableIoApic; 123 132 /** Holds the 'enable UTC time' check-box instance. */ 124 QCheckBox *m_pCheckBoxEnableUtcTime;133 QCheckBox *m_pCheckBoxEnableUtcTime; 125 134 /** Holds the 'enable EFI' check-box instance. */ 126 QCheckBox *m_pCheckBoxEnableEfi; 127 /** Holds the 'enable secure boot' check-box instance. */ 128 QCheckBox *m_pCheckBoxEnableSecureBoot; 135 QCheckBox *m_pCheckBoxEnableEfi; 136 /** Holds the 'secure boot' check-box instance. */ 137 QCheckBox *m_pCheckBoxEnableSecureBoot; 138 /** Holds the 'secure boot' tool-button instance. */ 139 QPushButton *m_pPushButtonResetSecureBoot; 129 140 /** @} */ 130 141 }; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r96804 r96967 75 75 , m_fAvailableSecureBoot(false) 76 76 , m_fEnabledSecureBoot(false) 77 , m_fResetSecureBoot(false) 77 78 /* CPU data: */ 78 79 , m_cCPUCount(-1) … … 106 107 && (m_fAvailableSecureBoot == other.m_fAvailableSecureBoot) 107 108 && (m_fEnabledSecureBoot == other.m_fEnabledSecureBoot) 109 && (m_fResetSecureBoot == other.m_fResetSecureBoot) 108 110 /* CPU data: */ 109 111 && (m_cCPUCount == other.m_cCPUCount) … … 152 154 /** Holds whether the secure boot is enabled. */ 153 155 bool m_fEnabledSecureBoot; 156 /** Holds whether the secure boot is reseted. */ 157 bool m_fResetSecureBoot; 154 158 155 159 /** Holds the CPU count. */ … … 295 299 ? comStoreLvl2.GetSecureBootEnabled() 296 300 : false; 301 oldSystemData.m_fResetSecureBoot = false; 297 302 298 303 /* Gather old 'Processor' data: */ … … 409 414 newSystemData.m_fAvailableSecureBoot = m_pCache->base().m_fAvailableSecureBoot; 410 415 newSystemData.m_fEnabledSecureBoot = m_pEditorMotherboardFeatures->isEnabledSecureBoot(); 416 newSystemData.m_fResetSecureBoot = m_pEditorMotherboardFeatures->isResetSecureBoot(); 411 417 } 412 418 … … 998 1004 } 999 1005 /* Save whether secure boot is enabled: */ 1000 if (fSuccess && isMachineOffline() && newSystemData.m_fEnabledSecureBoot != oldSystemData.m_fEnabledSecureBoot) 1006 if ( fSuccess && isMachineOffline() 1007 && ( newSystemData.m_fEnabledSecureBoot != oldSystemData.m_fEnabledSecureBoot 1008 || newSystemData.m_fResetSecureBoot != oldSystemData.m_fResetSecureBoot)) 1001 1009 { 1002 1010 CNvramStore comStoreLvl1 = m_machine.GetNonVolatileStore(); … … 1007 1015 && newSystemData.m_fEnabledEFI) 1008 1016 { 1009 /* Secure boot was NOT available? */ 1010 if (!newSystemData.m_fAvailableSecureBoot) 1017 /* Secure boot was NOT available 1018 * or requested to be reseted: */ 1019 if ( !newSystemData.m_fAvailableSecureBoot 1020 || newSystemData.m_fResetSecureBoot) 1011 1021 { 1012 /* Init and enroll everything: */ 1013 comStoreLvl1.InitUefiVariableStore(0); 1022 /* Init if required: */ 1023 if (!newSystemData.m_fAvailableSecureBoot) 1024 comStoreLvl1.InitUefiVariableStore(0); 1025 /* Enroll everything: */ 1014 1026 comStoreLvl2 = comStoreLvl1.GetUefiVariableStore(); 1015 1027 comStoreLvl2.EnrollOraclePlatformKey();
Note:
See TracChangeset
for help on using the changeset viewer.