postpone deletion of task dialog as long as inside its accept() or reject() method
This commit is contained in:
parent
6026608c20
commit
e0c69c8afe
|
@ -574,12 +574,18 @@ void TaskView::removeDialog(void)
|
||||||
|
|
||||||
TaskDialog* remove = NULL;
|
TaskDialog* remove = NULL;
|
||||||
if (ActiveDialog) {
|
if (ActiveDialog) {
|
||||||
const std::vector<QWidget*> &cont = ActiveDialog->getDialogContent();
|
// See 'accept' and 'reject'
|
||||||
for(std::vector<QWidget*>::const_iterator it=cont.begin();it!=cont.end();++it){
|
if (ActiveDialog->property("taskview_accept_or_reject").isNull()) {
|
||||||
taskPanel->removeWidget(*it);
|
const std::vector<QWidget*> &cont = ActiveDialog->getDialogContent();
|
||||||
|
for(std::vector<QWidget*>::const_iterator it=cont.begin();it!=cont.end();++it){
|
||||||
|
taskPanel->removeWidget(*it);
|
||||||
|
}
|
||||||
|
remove = ActiveDialog;
|
||||||
|
ActiveDialog = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ActiveDialog->setProperty("taskview_remove_dialog", true);
|
||||||
}
|
}
|
||||||
remove = ActiveDialog;
|
|
||||||
ActiveDialog = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
taskPanel->removeStretch();
|
taskPanel->removeStretch();
|
||||||
|
@ -587,7 +593,7 @@ void TaskView::removeDialog(void)
|
||||||
// put the watcher back in control
|
// put the watcher back in control
|
||||||
addTaskWatcher();
|
addTaskWatcher();
|
||||||
|
|
||||||
if(remove) {
|
if (remove) {
|
||||||
remove->emitDestructionSignal();
|
remove->emitDestructionSignal();
|
||||||
delete remove;
|
delete remove;
|
||||||
}
|
}
|
||||||
|
@ -700,13 +706,23 @@ void TaskView::removeTaskWatcher(void)
|
||||||
|
|
||||||
void TaskView::accept()
|
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();
|
removeDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskView::reject()
|
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();
|
removeDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user