- Timestamp:
- Mar 26, 2013 5:25:51 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r45183 r45184 219 219 } 220 220 221 QPointer<QIMessageBox> box = new QIMessageBox(title, strMessage, icon, button1, button2, 222 button3, pParent, pcszAutoConfirmId); 223 connect(this, SIGNAL(sigToCloseAllWarnings()), box, SLOT(deleteLater())); 224 221 /* Create message-box: */ 222 QPointer<QIMessageBox> pBox = new QIMessageBox(title, strMessage, icon, button1, button2, 223 button3, pParent, pcszAutoConfirmId); 224 225 /* Configure message-box: */ 226 connect(this, SIGNAL(sigToCloseAllWarnings()), pBox, SLOT(deleteLater())); 227 228 /* Prepare confirmation: */ 229 if (pcszAutoConfirmId) 230 { 231 pBox->setFlagText(tr("Do not show this message again", "msg box flag")); 232 pBox->setFlagChecked(false); 233 } 234 235 /* Configure button-text: */ 225 236 if (!strText1.isNull()) 226 box->setButtonText(0, strText1);237 pBox->setButtonText(0, strText1); 227 238 if (!strText2.isNull()) 228 box->setButtonText(1, strText2);239 pBox->setButtonText(1, strText2); 229 240 if (!strText3.isNull()) 230 box->setButtonText(2, strText3); 231 241 pBox->setButtonText(2, strText3); 242 243 /* Configure details: */ 232 244 if (!strDetails.isEmpty()) 233 box->setDetailsText(strDetails); 234 245 pBox->setDetailsText(strDetails); 246 247 /* Add to warnings: */ 248 m_warnings << pBox; 249 250 /* Show box: */ 251 int rc = pBox->exec(); 252 253 /* Make sure box still valid: */ 254 if (!pBox) 255 return rc; 256 257 /* Remove from warnings: */ 258 m_warnings.removeAll(pBox); 259 260 /* Cleanup confirmation: */ 235 261 if (pcszAutoConfirmId) 236 262 { 237 box->setFlagText(tr("Do not show this message again", "msg box flag")); 238 box->setFlagChecked(false); 239 } 240 241 m_warnings << box; 242 int rc = box->exec(); 243 if (box && m_warnings.contains(box)) 244 m_warnings.removeAll(box); 245 246 if (pcszAutoConfirmId) 247 { 248 if (box && box->isFlagChecked()) 263 if (pBox->isFlagChecked()) 249 264 { 250 265 msgs << pcszAutoConfirmId; … … 253 268 } 254 269 255 if (box) 256 delete box; 270 /* Delete message-box: */ 271 if (pBox) 272 delete pBox; 257 273 258 274 return rc; … … 328 344 329 345 /* Create message-box: */ 330 if (QPointer<QIMessageBox> pBox = new QIMessageBox(strTitle, strMessage, icon, 331 iButton1, iButton2, iButton3, pParent)) 332 { 333 /* Append the list of all warnings with current: */ 334 m_warnings << pBox; 335 336 /* Setup message-box connections: */ 337 connect(this, SIGNAL(sigToCloseAllWarnings()), pBox, SLOT(deleteLater())); 338 339 /* Assign other text values: */ 340 if (!strOptionText.isNull()) 341 { 342 pBox->setFlagText(strOptionText); 343 pBox->setFlagChecked(fDefaultOptionValue); 344 } 345 if (!strButtonName1.isNull()) 346 pBox->setButtonText(0, strButtonName1); 347 if (!strButtonName2.isNull()) 348 pBox->setButtonText(1, strButtonName2); 349 if (!strButtonName3.isNull()) 350 pBox->setButtonText(2, strButtonName3); 351 if (!strDetails.isEmpty()) 352 pBox->setDetailsText(strDetails); 353 354 /* Show the message box: */ 355 int iResultCode = pBox->exec(); 356 357 /* Its possible what message-box will be deleted during some event-processing procedure, 358 * in that case pBox will be null right after pBox->exec() returns from it's event-pool, 359 * so we have to check this too: */ 360 if (pBox) 361 { 362 /* Cleanup the list of all warnings from current: */ 363 if (m_warnings.contains(pBox)) 364 m_warnings.removeAll(pBox); 365 366 /* Check if option was chosen: */ 367 if (pBox->isFlagChecked()) 368 iResultCode |= QIMessageBox::OptionChosen; 369 370 /* Destroy message-box: */ 371 if (pBox) 372 delete pBox; 373 374 /* Return final result: */ 375 return iResultCode; 376 } 377 } 378 return 0; 346 QPointer<QIMessageBox> pBox = new QIMessageBox(strTitle, strMessage, icon, 347 iButton1, iButton2, iButton3, pParent); 348 349 /* Configure box: */ 350 connect(this, SIGNAL(sigToCloseAllWarnings()), pBox, SLOT(deleteLater())); 351 352 /* Load option: */ 353 if (!strOptionText.isNull()) 354 { 355 pBox->setFlagText(strOptionText); 356 pBox->setFlagChecked(fDefaultOptionValue); 357 } 358 359 /* Configure button-text: */ 360 if (!strButtonName1.isNull()) 361 pBox->setButtonText(0, strButtonName1); 362 if (!strButtonName2.isNull()) 363 pBox->setButtonText(1, strButtonName2); 364 if (!strButtonName3.isNull()) 365 pBox->setButtonText(2, strButtonName3); 366 if (!strDetails.isEmpty()) 367 pBox->setDetailsText(strDetails); 368 369 /* Add to warnings: */ 370 m_warnings << pBox; 371 372 /* Show box: */ 373 int rc = pBox->exec(); 374 375 /* Make sure box still valid: */ 376 if (!pBox) 377 return rc; 378 379 /* Remove from warnings: */ 380 m_warnings.removeAll(pBox); 381 382 /* Save option: */ 383 if (pBox->isFlagChecked()) 384 rc |= QIMessageBox::OptionChosen; 385 386 /* Delete message-box: */ 387 if (pBox) 388 delete pBox; 389 390 return rc; 379 391 } 380 392
Note:
See TracChangeset
for help on using the changeset viewer.