forked from qt-creator/qt-creator
Annotation Editor question dialog
Change-Id: I4c278abf34bd6c33fe989a5aa80006f1d88f687b Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Aleksei German <aleksei.german@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -78,28 +78,15 @@ void AnnotationEditor::removeFullAnnotation()
|
|||||||
if (!node.isValid())
|
if (!node.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString dialogTitle = tr("Annotation");
|
if (QMessageBox::question(Core::ICore::dialogParent(),
|
||||||
if (!node.customId().isNull()) {
|
node.customId().isNull() ? tr("Annotation") : node.customId(),
|
||||||
dialogTitle = node.customId();
|
tr("Delete this annotation?"))
|
||||||
}
|
== QMessageBox::Yes) {
|
||||||
QPointer<QMessageBox> deleteDialog = new QMessageBox(Core::ICore::dialogParent());
|
|
||||||
deleteDialog->setWindowTitle(dialogTitle);
|
|
||||||
deleteDialog->setText(tr("Delete this annotation?"));
|
|
||||||
deleteDialog->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
|
||||||
deleteDialog->setDefaultButton(QMessageBox::Yes);
|
|
||||||
|
|
||||||
int result = deleteDialog->exec();
|
|
||||||
|
|
||||||
if (deleteDialog)
|
|
||||||
deleteDialog->deleteLater();
|
|
||||||
|
|
||||||
if (result == QMessageBox::Yes) {
|
|
||||||
node.removeCustomId();
|
node.removeCustomId();
|
||||||
node.removeAnnotation();
|
node.removeAnnotation();
|
||||||
|
emit customIdChanged();
|
||||||
|
emit annotationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit customIdChanged();
|
|
||||||
emit annotationChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnnotationEditor::acceptedClicked()
|
void AnnotationEditor::acceptedClicked()
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ AnnotationTabWidget::AnnotationTabWidget(QWidget *parent)
|
|||||||
int currentIndex = this->currentIndex();
|
int currentIndex = this->currentIndex();
|
||||||
QString currentTitle = tabText(currentIndex);
|
QString currentTitle = tabText(currentIndex);
|
||||||
if (QMessageBox::question(this,
|
if (QMessageBox::question(this,
|
||||||
tr("Global Annotation"),
|
currentTitle,
|
||||||
tr("Do you want to delete this annotation?"))
|
tr("Delete this comment?"))
|
||||||
== QMessageBox::Yes) {
|
== QMessageBox::Yes) {
|
||||||
removeTab(currentIndex);
|
removeTab(currentIndex);
|
||||||
if (count() == 0) //lets be sure that tabWidget is never empty
|
if (count() == 0) //lets be sure that tabWidget is never empty
|
||||||
|
|||||||
@@ -62,21 +62,13 @@ void GlobalAnnotationEditor::removeFullAnnotation()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QString dialogTitle = tr("Global Annotation");
|
QString dialogTitle = tr("Global Annotation");
|
||||||
QMessageBox *deleteDialog = new QMessageBox(Core::ICore::dialogParent());
|
if (QMessageBox::question(Core::ICore::dialogParent(),
|
||||||
deleteDialog->setWindowTitle(dialogTitle);
|
tr("Global Annotation"),
|
||||||
deleteDialog->setText(tr("Delete this annotation?"));
|
tr("Delete this annotation?"))
|
||||||
deleteDialog->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
== QMessageBox::Yes) {
|
||||||
deleteDialog->setDefaultButton(QMessageBox::Yes);
|
|
||||||
|
|
||||||
int result = deleteDialog->exec();
|
|
||||||
if (deleteDialog)
|
|
||||||
deleteDialog->deleteLater();
|
|
||||||
|
|
||||||
if (result == QMessageBox::Yes) {
|
|
||||||
node.removeGlobalAnnotation();
|
node.removeGlobalAnnotation();
|
||||||
|
emit annotationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit annotationChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalAnnotationEditor::acceptedClicked()
|
void GlobalAnnotationEditor::acceptedClicked()
|
||||||
|
|||||||
Reference in New Issue
Block a user