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;
|
TaskDialog* remove = NULL;
|
||||||
if (ActiveDialog) {
|
if (ActiveDialog) {
|
||||||
|
// See 'accept' and 'reject'
|
||||||
|
if (ActiveDialog->property("taskview_accept_or_reject").isNull()) {
|
||||||
const std::vector<QWidget*> &cont = ActiveDialog->getDialogContent();
|
const std::vector<QWidget*> &cont = ActiveDialog->getDialogContent();
|
||||||
for(std::vector<QWidget*>::const_iterator it=cont.begin();it!=cont.end();++it){
|
for(std::vector<QWidget*>::const_iterator it=cont.begin();it!=cont.end();++it){
|
||||||
taskPanel->removeWidget(*it);
|
taskPanel->removeWidget(*it);
|
||||||
|
@ -581,6 +583,10 @@ void TaskView::removeDialog(void)
|
||||||
remove = ActiveDialog;
|
remove = ActiveDialog;
|
||||||
ActiveDialog = 0;
|
ActiveDialog = 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
ActiveDialog->setProperty("taskview_remove_dialog", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
taskPanel->removeStretch();
|
taskPanel->removeStretch();
|
||||||
|
|
||||||
|
@ -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