diff --git a/mainwindow.cpp b/mainwindow.cpp index 2f0fb98b4..84ebd4500 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -198,8 +198,12 @@ void MainWindow::OptionDraw(){ } delete dlg; index = comboBoxDraws->findText(doc->GetNameActivDraw()); - doc->SetNameDraw(nameDraw); - comboBoxDraws->setItemText(index, nameDraw); + if(doc->SetNameDraw(nameDraw)){ + comboBoxDraws->setItemText(index, nameDraw); + } else { + QMessageBox::warning(this, tr("Error saving change!!!"), tr("Can't save new name of drawing")); + } + } template diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index cc8d87e01..f99b846f7 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -169,11 +169,20 @@ void VDomDocument::ChangeActivDraw(const QString& name, Document::Documents pars } } -void VDomDocument::SetNameDraw(const QString& name){ +bool VDomDocument::SetNameDraw(const QString& name){ Q_ASSERT_X(!name.isEmpty(), "SetNameDraw", "name draw is empty"); QString oldName = nameActivDraw; - nameActivDraw = name; - emit ChangedNameDraw(oldName, nameActivDraw); + QDomElement element; + if(GetActivDrawElement(element)){ + nameActivDraw = name; + element.setAttribute("name", nameActivDraw); + emit haveChange(); + emit ChangedNameDraw(oldName, nameActivDraw); + return true; + } else { + qWarning()<<"Can't find activ draw"<* getTools(); QVector *getHistory();