Changeset 86242 in vbox
- Timestamp:
- Sep 23, 2020 2:55:37 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/cloud/profilemanager/UICloudProfileManager.cpp
r86233 r86242 24 24 #include "QIDialogButtonBox.h" 25 25 #include "QIInputDialog.h" 26 #include "QIMessageBox.h" 26 27 #include "QITreeWidget.h" 27 28 #include "UICommon.h" … … 184 185 << tr("Source") 185 186 << tr("List VMs")); 187 } 188 189 bool UICloudProfileManagerWidget::makeSureChangesResolved() 190 { 191 /* Check if currently selected item is of profile type: */ 192 QITreeWidgetItem *pItem = QITreeWidgetItem::toItem(m_pTreeWidget->currentItem()); 193 UIItemCloudProfile *pProfileItem = qobject_cast<UIItemCloudProfile*>(pItem); 194 if (!pProfileItem) 195 return true; 196 197 /* Get item data: */ 198 UIDataCloudProfile oldData = *pProfileItem; 199 UIDataCloudProfile newData = m_pDetailsWidget->data(); 200 201 /* Check if data has changed: */ 202 if (newData == oldData) 203 return true; 204 205 /* Ask whether user wants to Accept/Reset changes or still not sure: */ 206 const int iResult = msgCenter().confirmCloudProfileManagerClosing(window()); 207 switch (iResult) 208 { 209 case AlertButton_Choice1: 210 { 211 sltApplyCloudProfileDetailsChanges(); 212 return true; 213 } 214 case AlertButton_Choice2: 215 { 216 sltResetCloudProfileDetailsChanges(); 217 return true; 218 } 219 default: 220 break; 221 } 222 223 /* False by default: */ 224 return false; 186 225 } 187 226 … … 1072 1111 } 1073 1112 1113 void UICloudProfileManager::closeEvent(QCloseEvent *pEvent) 1114 { 1115 /* Make sure all changes resolved: */ 1116 if (widget()->makeSureChangesResolved()) 1117 { 1118 /* Call to base class: */ 1119 QIWithRetranslateUI<QIManagerDialog>::closeEvent(pEvent); 1120 } 1121 else 1122 { 1123 /* Just ignore the event otherwise: */ 1124 pEvent->ignore(); 1125 } 1126 } 1127 1074 1128 1075 1129 #include "UICloudProfileManager.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/cloud/profilemanager/UICloudProfileManager.h
r86233 r86242 72 72 QIToolBar *toolbar() const { return m_pToolBar; } 73 73 #endif 74 75 /** Check for changes committed. 76 * @returns Whether changes were resolved (accepted or discarded) or still a problem otherwise. */ 77 bool makeSureChangesResolved(); 74 78 75 79 protected: … … 274 278 /** @} */ 275 279 280 /** @name Event-handling stuff. 281 * @{ */ 282 /** Handles close @a pEvent. */ 283 virtual void closeEvent(QCloseEvent *pEvent) /* override */; 284 /** @} */ 285 276 286 /** @name Action related variables. 277 287 * @{ */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r85389 r86242 2022 2022 } 2023 2023 2024 int UIMessageCenter::confirmCloudProfileManagerClosing(QWidget *pParent /* = 0 */) const 2025 { 2026 return question(pParent, MessageType_Question, 2027 tr("<p>Do you want to close the Cloud Profile Manager?</p>" 2028 "<p>There seems to be an unsaved changes. " 2029 "You can choose to <b>Accept</b> or <b>Reject</b> them automatically " 2030 "or cancel to keep the dialog opened.</p>"), 2031 0 /* auto-confirm id */, 2032 AlertButton_Choice1, 2033 AlertButton_Choice2, 2034 AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape, 2035 tr("Accept", "cloud profile manager changes"), 2036 tr("Reject", "cloud profile manager changes")); 2037 } 2038 2024 2039 bool UIMessageCenter::confirmCloudConsoleApplicationRemoval(const QString &strName, QWidget *pParent /* = 0 */) const 2025 2040 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r85389 r86242 416 416 void cannotAssignFormValue(const CRangedIntegerFormValue &comValue, QWidget *pParent = 0) const; 417 417 void cannotAssignFormValue(const CProgress &comProgress, QWidget *pParent = 0) const; 418 int confirmCloudProfileManagerClosing(QWidget *pParent = 0) const; 418 419 419 420 /* API: Cloud Console Manager warnings: */
Note:
See TracChangeset
for help on using the changeset viewer.