Changeset 50717 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Mar 6, 2014 4:32:05 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 92682
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r50716 r50717 74 74 { refresh(); } 75 75 76 /** Removes UIMedium wrapped by <i>this</i> item. */77 virtual bool remove() = 0;78 76 /** Copy UIMedium wrapped by <i>this</i> item. */ 79 77 virtual bool copy() = 0; 78 /** Modify UIMedium wrapped by <i>this</i> item. */ 79 virtual bool modify() = 0; 80 /** Remove UIMedium wrapped by <i>this</i> item. */ 81 virtual bool remove() = 0; 80 82 81 83 /** Refreshes item fully. */ … … 172 174 protected: 173 175 174 /** Removes UIMedium wrapped by <i>this</i> item. */175 bool remove()176 {177 /* Confirm medium removal: */178 if (!msgCenter().confirmMediumRemoval(medium(), treeWidget()))179 return false;180 181 /* Remember some of hard-disk attributes: */182 CMedium hardDisk = medium().medium();183 QString strMediumID = id();184 185 /* Propose to remove medium storage: */186 if (!maybeRemoveStorage())187 return false;188 189 /* Close hard-disk: */190 hardDisk.Close();191 if (!hardDisk.isOk())192 {193 msgCenter().cannotCloseMedium(medium(), hardDisk, treeWidget());194 return false;195 }196 197 /* Remove UIMedium finally: */198 vboxGlobal().deleteMedium(strMediumID);199 200 /* True by default: */201 return true;202 }203 204 176 /** Copy UIMedium wrapped by <i>this</i> item. */ 205 177 bool copy() … … 213 185 if (pWizard) 214 186 delete pWizard; 187 188 /* True by default: */ 189 return true; 190 } 191 192 /** Modify UIMedium wrapped by <i>this</i> item. */ 193 bool modify() 194 { 195 /* False by default: */ 196 bool fResult = false; 197 198 /* Show Modify VD dialog: */ 199 UISafePointerDialog pDialog = new UIMediumTypeChangeDialog(treeWidget(), id()); 200 if (pDialog->exec() == QDialog::Accepted) 201 { 202 /* Update medium-item: */ 203 refreshAll(); 204 /* Change to passed: */ 205 fResult = true; 206 } 207 208 /* Delete if still exists: */ 209 if (pDialog) 210 delete pDialog; 211 212 /* Return result: */ 213 return fResult; 214 } 215 216 /** Remove UIMedium wrapped by <i>this</i> item. */ 217 bool remove() 218 { 219 /* Confirm medium removal: */ 220 if (!msgCenter().confirmMediumRemoval(medium(), treeWidget())) 221 return false; 222 223 /* Remember some of hard-disk attributes: */ 224 CMedium hardDisk = medium().medium(); 225 QString strMediumID = id(); 226 227 /* Propose to remove medium storage: */ 228 if (!maybeRemoveStorage()) 229 return false; 230 231 /* Close hard-disk: */ 232 hardDisk.Close(); 233 if (!hardDisk.isOk()) 234 { 235 msgCenter().cannotCloseMedium(medium(), hardDisk, treeWidget()); 236 return false; 237 } 238 239 /* Remove UIMedium finally: */ 240 vboxGlobal().deleteMedium(strMediumID); 215 241 216 242 /* True by default: */ … … 281 307 protected: 282 308 283 /** Removes UIMedium wrapped by <i>this</i> item. */ 309 /** Copy UIMedium wrapped by <i>this</i> item. */ 310 bool copy() 311 { 312 AssertMsgFailedReturn(("That functionality in not supported!\n"), false); 313 } 314 315 /** Modify UIMedium wrapped by <i>this</i> item. */ 316 bool modify() 317 { 318 AssertMsgFailedReturn(("That functionality in not supported!\n"), false); 319 } 320 321 /** Remove UIMedium wrapped by <i>this</i> item. */ 284 322 bool remove() 285 323 { … … 305 343 /* True by default: */ 306 344 return true; 307 }308 309 /** Copy UIMedium wrapped by <i>this</i> item. */310 bool copy()311 {312 AssertMsgFailedReturn(("That functionality in not supported!\n"), false);313 345 } 314 346 }; … … 326 358 protected: 327 359 328 /** Removes UIMedium wrapped by <i>this</i> item. */ 360 /** Copy UIMedium wrapped by <i>this</i> item. */ 361 bool copy() 362 { 363 AssertMsgFailedReturn(("That functionality in not supported!\n"), false); 364 } 365 366 /** Modify UIMedium wrapped by <i>this</i> item. */ 367 bool modify() 368 { 369 AssertMsgFailedReturn(("That functionality in not supported!\n"), false); 370 } 371 372 /** Remove UIMedium wrapped by <i>this</i> item. */ 329 373 bool remove() 330 374 { … … 350 394 /* True by default: */ 351 395 return true; 352 }353 354 /** Copy UIMedium wrapped by <i>this</i> item. */355 bool copy()356 {357 AssertMsgFailedReturn(("That functionality in not supported!\n"), false);358 396 } 359 397 }; … … 606 644 AssertReturnVoid(!pMediumItem->id().isNull()); 607 645 608 /* Show Modify VD dialog: */ 609 UISafePointerDialog pDialog = new UIMediumTypeChangeDialog(this, pMediumItem->id()); 610 if (pDialog->exec() == QDialog::Accepted) 611 { 612 /* Update medium-item: */ 613 pMediumItem->refreshAll(); 614 /* Update HD information-panes: */ 646 /* Modify current medium-item: */ 647 bool fResult = pMediumItem->modify(); 648 649 /* Update HD information-panes: */ 650 if (fResult) 615 651 updateInformationPanesHD(); 616 }617 618 /* Delete if still exists: */619 if (pDialog)620 delete pDialog;621 652 } 622 653
Note:
See TracChangeset
for help on using the changeset viewer.