postpone deletion of task dialog as long as inside its accept() or reject() method
This commit is contained in:
parent
6026608c20
commit
e0c69c8afe
|
@ -574,6 +574,8 @@ void TaskView::removeDialog(void)
|
|||
|
||||
TaskDialog* remove = NULL;
|
||||
if (ActiveDialog) {
|
||||
// See 'accept' and 'reject'
|
||||
if (ActiveDialog->property("taskview_accept_or_reject").isNull()) {
|
||||
const std::vector<QWidget*> &cont = ActiveDialog->getDialogContent();
|
||||
for(std::vector<QWidget*>::const_iterator it=cont.begin();it!=cont.end();++it){
|
||||
taskPanel->removeWidget(*it);
|
||||
|
@ -581,13 +583,17 @@ void TaskView::removeDialog(void)
|
|||
remove = ActiveDialog;
|
||||
ActiveDialog = 0;
|
||||
}
|
||||
else {
|
||||
ActiveDialog->setProperty("taskview_remove_dialog", true);
|
||||
}
|
||||
}
|
||||
|
||||
taskPanel->removeStretch();
|
||||
|
||||
// put the watcher back in control
|
||||
addTaskWatcher();
|
||||
|
||||
if(remove) {
|
||||
if (remove) {
|
||||
remove->emitDestructionSignal();
|
||||
delete remove;
|
||||
}
|
||||
|
@ -700,13 +706,23 @@ void TaskView::removeTaskWatcher(void)
|
|||
|
||||
void TaskView::accept()
|
||||
{
|
||||
if (ActiveDialog->accept())
|
||||
// Make sure that if 'accept' calls 'closeDialog' the deletion is postponed until
|
||||
// the dialog leaves the 'accept' method
|
||||
ActiveDialog->setProperty("taskview_accept_or_reject", true);
|
||||
bool success = ActiveDialog->accept();
|
||||
ActiveDialog->setProperty("taskview_accept_or_reject", QVariant());
|
||||
if (success || ActiveDialog->property("taskview_remove_dialog").isValid())
|
||||
removeDialog();
|
||||
}
|
||||
|
||||
void TaskView::reject()
|
||||
{
|
||||
if (ActiveDialog->reject())
|
||||
// Make sure that if 'reject' calls 'closeDialog' the deletion is postponed until
|
||||
// the dialog leaves the 'reject' method
|
||||
ActiveDialog->setProperty("taskview_accept_or_reject", true);
|
||||
bool success = ActiveDialog->reject();
|
||||
ActiveDialog->setProperty("taskview_accept_or_reject", QVariant());
|
||||
if (success || ActiveDialog->property("taskview_remove_dialog").isValid())
|
||||
removeDialog();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user