Before saving file run test "unique id".

--HG--
branch : develop
This commit is contained in:
dismine 2013-10-21 13:18:12 +03:00
parent 27b239fc84
commit 933c7d8a75
2 changed files with 18 additions and 3 deletions

View File

@ -996,6 +996,21 @@ void MainWindow::MinimumScrollBar(){
}
bool MainWindow::SafeSaveing(const QString &fileName) const{
try{
doc->TestUniqueId();
}
catch(const VExceptionUniqueId &e){
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Error!"));
msgBox.setText(tr("Error don't unique id."));
msgBox.setInformativeText(e.ErrorMessage());
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setDetailedText(e.DetailedInformation());
msgBox.setIcon(QMessageBox::Critical);
msgBox.exec();
return false;
}
if(fileName.isEmpty()){
qWarning()<<tr("Got empty file name.");
return false;
@ -1038,7 +1053,7 @@ bool MainWindow::SafeSaveing(const QString &fileName) const{
}
void MainWindow::AutoSavePattern(){
if(!fileName.isEmpty()){
if(!fileName.isEmpty() && changeInFile == true){
bool result = SafeSaveing(fileName);
if(result){
ui->actionSave->setEnabled(false);

View File

@ -66,6 +66,7 @@ public:
void UpdateToolData(const qint64 &id, VContainer *data);
void IncrementReferens(qint64 id) const;
void DecrementReferens(qint64 id) const;
void TestUniqueId() const;
signals:
void ChangedActivDraw(const QString newName);
void ChangedNameDraw(const QString oldName, const QString newName);
@ -111,8 +112,7 @@ private:
qint64 GetParametrId(const QDomElement& domElement) const;
qint64 GetParametrLongLong(const QDomElement& domElement, const QString &name) const;
QString GetParametrString(const QDomElement& domElement, const QString &name) const;
qreal GetParametrDouble(const QDomElement& domElement, const QString &name) const;
void TestUniqueId() const;
qreal GetParametrDouble(const QDomElement& domElement, const QString &name) const;
void CollectId(QDomElement node, QVector<qint64> &vector)const;
};