Ref T620, check for empty string as path, QDir("") exists

This commit is contained in:
Klaus Basan
2019-04-21 18:34:17 +02:00
parent a553dfc708
commit 5caea5ad9b
4 changed files with 25 additions and 1 deletions

View File

@@ -46,6 +46,7 @@
#include <QCompleter>
#include <QStringBuilder>
#include <QPointer>
#include <QMessageBox>
#include <Qt>
using namespace BlackMisc;
@@ -535,6 +536,19 @@ namespace BlackGui
m = CStatusMessage(this, CStatusMessage::SeverityDebug, u"Save canceled", true);
break;
}
QFileInfo fi(fileName);
QDir fpDir = fi.absoluteDir();
if (CDirectoryUtils::isInApplicationDirectory(fpDir.absolutePath()))
{
const int ret = QMessageBox::warning(this, "swift flight plan",
"You try to save inside the swift directory '" + fpDir.absolutePath() +
"'\n\nThis is not recommended!"
"\n\nDo you want to really do this?",
QMessageBox::Save | QMessageBox::Cancel);
if (ret != QMessageBox::Save) { return; }
}
CFlightPlan fp;
this->validateAndInitializeFlightPlan(fp); // get data