Commit fa94ec2c authored by Daniel Teske's avatar Daniel Teske
Browse files

ProjectExplorer: Simplify code for showing rename errors



Lambdas!

Change-Id: I89d381aaca07eb678d818c2be138197e25b855b1
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 83951574
......@@ -371,7 +371,6 @@ public:
bool m_shuttingDown;
QStringList m_arguments;
QList<ProjectPanelFactory *> m_panelFactories;
QString m_renameFileError;
#ifdef WITH_JOURNALD
JournaldWatcher *m_journalWatcher;
#endif
......@@ -3271,12 +3270,16 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &newFilePath)
FolderNode *folderNode = node->parentFolderNode();
QString projectFileName = folderNode->projectNode()->path().fileName();
if (!folderNode->renameFile(orgFilePath, newFilePath)) {
dd->m_renameFileError = tr("The file %1 was renamed to %2, but the project file %3 could not be automatically changed.")
QString renameFileError = tr("The file %1 was renamed to %2, but the project file %3 could not be automatically changed.")
.arg(orgFilePath)
.arg(newFilePath)
.arg(projectFileName);
QTimer::singleShot(0, m_instance, SLOT(showRenameFileError()));
QTimer::singleShot(0, [renameFileError]() {
QMessageBox::warning(ICore::mainWindow(),
tr("Project Editing Failed"),
renameFileError);
});
}
}
}
......@@ -3286,11 +3289,6 @@ void ProjectExplorerPluginPrivate::handleSetStartupProject()
setStartupProject(ProjectTree::currentProject());
}
void ProjectExplorerPlugin::showRenameFileError()
{
QMessageBox::warning(ICore::mainWindow(), tr("Project Editing Failed"), dd->m_renameFileError);
}
void ProjectExplorerPluginPrivate::updateSessionMenu()
{
m_sessionMenu->clear();
......
......@@ -181,7 +181,6 @@ public slots:
private slots:
void restoreSession2();
void showRenameFileError();
#ifdef WITH_TESTS
void testAnsiFilterOutputParser_data();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment