@@ -391,7 +391,7 @@ QStringList MainWindow::SelectFilesToCheck(QFileDialog::FileMode mode)
391391 if (mode == QFileDialog::ExistingFiles) {
392392 selected = QFileDialog::getOpenFileNames (this ,
393393 tr (" Select files to check" ),
394- mSettings -> value (SETTINGS_CHECK_PATH, " " ). toString ( ));
394+ GetPath (SETTINGS_LAST_CHECK_PATH ));
395395 if (selected.isEmpty ())
396396 mCurrentDirectory .clear ();
397397 else {
@@ -402,7 +402,7 @@ QStringList MainWindow::SelectFilesToCheck(QFileDialog::FileMode mode)
402402 } else if (mode == QFileDialog::DirectoryOnly) {
403403 QString dir = QFileDialog::getExistingDirectory (this ,
404404 tr (" Select directory to check" ),
405- mSettings -> value (SETTINGS_CHECK_PATH, " " ). toString ( ));
405+ GetPath (SETTINGS_LAST_CHECK_PATH ));
406406 if (!dir.isEmpty ()) {
407407 qDebug () << " Setting current directory to: " << dir;
408408 mCurrentDirectory = dir;
@@ -411,7 +411,9 @@ QStringList MainWindow::SelectFilesToCheck(QFileDialog::FileMode mode)
411411 FormatAndSetTitle (dir);
412412 }
413413 }
414-
414+
415+ SetPath (SETTINGS_LAST_CHECK_PATH, mCurrentDirectory );
416+
415417 return selected;
416418}
417419
@@ -670,7 +672,7 @@ void MainWindow::OpenResults()
670672 const QString filter (tr (" XML files (*.xml)" ));
671673 QString selectedFile = QFileDialog::getOpenFileName (this ,
672674 tr (" Open the report file" ),
673- QString ( ),
675+ GetPath (SETTINGS_LAST_RESULT_PATH ),
674676 filter,
675677 &selectedFilter);
676678
@@ -684,6 +686,7 @@ void MainWindow::LoadResults(const QString selectedFile)
684686 if (!selectedFile.isEmpty ()) {
685687 mUI .mResults ->Clear (true );
686688 mUI .mResults ->ReadErrorsXml (selectedFile);
689+ SetPath (SETTINGS_LAST_RESULT_PATH, selectedFile);
687690 }
688691}
689692
@@ -815,7 +818,7 @@ void MainWindow::Save()
815818 const QString filter (tr (" XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)" ));
816819 QString selectedFile = QFileDialog::getSaveFileName (this ,
817820 tr (" Save the report file" ),
818- QString ( ),
821+ GetPath (SETTINGS_LAST_RESULT_PATH ),
819822 filter,
820823 &selectedFilter);
821824
@@ -847,6 +850,7 @@ void MainWindow::Save()
847850 }
848851
849852 mUI .mResults ->Save (selectedFile, type);
853+ SetPath (SETTINGS_LAST_RESULT_PATH, selectedFile);
850854 }
851855}
852856
@@ -935,13 +939,13 @@ void MainWindow::OpenProjectFile()
935939 const QString filter = tr (" Project files (*.cppcheck);;All files(*.*)" );
936940 const QString filepath = QFileDialog::getOpenFileName (this ,
937941 tr (" Select Project File" ),
938- lastPath ,
942+ GetPath (SETTINGS_LAST_PROJECT_PATH) ,
939943 filter);
940944
941945 if (!filepath.isEmpty ()) {
942946 const QFileInfo fi (filepath);
943947 if (fi.exists () && fi.isFile () && fi.isReadable ()) {
944- mSettings -> setValue (SETTINGS_LAST_PROJECT_PATH, fi. path () );
948+ SetPath (SETTINGS_LAST_PROJECT_PATH, filepath );
945949 LoadProjectFile (filepath);
946950 }
947951 }
@@ -1018,12 +1022,14 @@ void MainWindow::NewProjectFile()
10181022 const QString filter = tr (" Project files (*.cppcheck);;All files(*.*)" );
10191023 QString filepath = QFileDialog::getSaveFileName (this ,
10201024 tr (" Select Project Filename" ),
1021- QString ( ),
1025+ GetPath (SETTINGS_LAST_PROJECT_PATH ),
10221026 filter);
10231027
10241028 if (filepath.isEmpty ())
10251029 return ;
10261030
1031+ SetPath (SETTINGS_LAST_PROJECT_PATH, filepath);
1032+
10271033 EnableProjectActions (true );
10281034 QFileInfo inf (filepath);
10291035 const QString filename = inf.fileName ();
0 commit comments