Refactoring: early return
This commit is contained in:
parent
80290a15e0
commit
90a3759479
|
@ -1650,28 +1650,27 @@ void MainWindow::enableProjectOpenActions(bool enable)
|
||||||
void MainWindow::openRecentProject()
|
void MainWindow::openRecentProject()
|
||||||
{
|
{
|
||||||
QAction *action = qobject_cast<QAction *>(sender());
|
QAction *action = qobject_cast<QAction *>(sender());
|
||||||
if (action) {
|
if (!action)
|
||||||
const QString project = action->data().toString();
|
return;
|
||||||
QFileInfo inf(project);
|
const QString project = action->data().toString();
|
||||||
if (inf.exists()) {
|
QFileInfo inf(project);
|
||||||
loadProjectFile(project);
|
if (inf.exists()) {
|
||||||
} else {
|
loadProjectFile(project);
|
||||||
const QString text(tr("The project file\n\n%1\n\n could not be found!\n\n"
|
} else {
|
||||||
"Do you want to remove the file from the recently "
|
const QString text(tr("The project file\n\n%1\n\n could not be found!\n\n"
|
||||||
"used projects -list?").arg(project));
|
"Do you want to remove the file from the recently "
|
||||||
|
"used projects -list?").arg(project));
|
||||||
|
|
||||||
QMessageBox msg(QMessageBox::Warning,
|
QMessageBox msg(QMessageBox::Warning,
|
||||||
tr("Cppcheck"),
|
tr("Cppcheck"),
|
||||||
text,
|
text,
|
||||||
QMessageBox::Yes | QMessageBox::No,
|
QMessageBox::Yes | QMessageBox::No,
|
||||||
this);
|
this);
|
||||||
|
|
||||||
msg.setDefaultButton(QMessageBox::No);
|
|
||||||
int rv = msg.exec();
|
|
||||||
if (rv == QMessageBox::Yes) {
|
|
||||||
removeProjectMRU(project);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
msg.setDefaultButton(QMessageBox::No);
|
||||||
|
int rv = msg.exec();
|
||||||
|
if (rv == QMessageBox::Yes) {
|
||||||
|
removeProjectMRU(project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue