GUI: Remember user-selected base path.

Remember the base path user selects when opening files from loaded
XML report.
This commit is contained in:
Kimmo Varis 2010-07-11 16:20:19 +03:00
parent b8793b1529
commit c9d63fa454
2 changed files with 13 additions and 4 deletions

View File

@ -33,7 +33,6 @@
ResultsTree::ResultsTree(QWidget * parent) : ResultsTree::ResultsTree(QWidget * parent) :
QTreeView(parent), QTreeView(parent),
mContextItem(0), mContextItem(0),
mCheckPath(""),
mVisibleErrors(false) mVisibleErrors(false)
{ {
for (int i = 0; i < SHOW_NONE; i++) for (int i = 0; i < SHOW_NONE; i++)
@ -482,12 +481,20 @@ void ResultsTree::StartApplication(QStandardItem *target, int application)
msgbox.exec(); msgbox.exec();
} }
else else
{
QDir checkdir(mCheckPath);
if (checkdir.isAbsolute() && checkdir.exists())
{
file = mCheckPath + "/" + file;
}
else
{ {
QString dir = AskFileDir(file); QString dir = AskFileDir(file);
dir += '/'; dir += '/';
file = dir + file; file = dir + file;
} }
} }
}
if (file.indexOf(" ") > -1) if (file.indexOf(" ") > -1)
{ {
@ -531,6 +538,7 @@ QString ResultsTree::AskFileDir(const QString &file)
QString dir = QFileDialog::getExistingDirectory(this, tr("Select Directory"), QString dir = QFileDialog::getExistingDirectory(this, tr("Select Directory"),
"", "",
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
mCheckPath = dir;
return dir; return dir;
} }

View File

@ -258,4 +258,5 @@ void ResultsView::ReadErrorsXml(const QString &filename)
ErrorItem item(line); ErrorItem item(line);
mUI.mTree->AddErrorItem(item); mUI.mTree->AddErrorItem(item);
} }
mUI.mTree->SetCheckDirectory("");
} }