diff options
author | Ville Nummela <ville.nummela@jolla.com> | 2019-06-18 14:39:38 +0300 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2019-06-25 11:53:58 +0000 |
commit | 63e418024225f104c7bc51110ac2b12dec4d23ba (patch) | |
tree | 216c7561f1dcc90ee0559340713dad6f6dcbced3 /src/plugins/resourceeditor/resourcenode.cpp | |
parent | 90ad2797eba573b275514ba487a787cf4036842b (diff) |
ProjectExplorer: Add special handling for removing files
... from a project which are pulled in via wildcards.
Such files cannot be removed from a project file, because they are
not listed verbatim. This kind of failure should not be reported to the
user if the file is also deleted, as the file list will have the correct
state after the next reparse.
Fixes: QTCREATORBUG-22586
Done-with: Christian Kandeler <christian.kandeler@qt.io>
Change-Id: I3dc66fe9a6594be7d0b86f46d830cd099ee49fd7
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/resourceeditor/resourcenode.cpp')
-rw-r--r-- | src/plugins/resourceeditor/resourcenode.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/plugins/resourceeditor/resourcenode.cpp b/src/plugins/resourceeditor/resourcenode.cpp index 0395c607b4..8444b07068 100644 --- a/src/plugins/resourceeditor/resourcenode.cpp +++ b/src/plugins/resourceeditor/resourcenode.cpp @@ -162,7 +162,8 @@ public: bool supportsAction(ProjectAction, const Node *node) const final; bool addFiles(const QStringList &filePaths, QStringList *notAdded) final; - bool removeFiles(const QStringList &filePaths, QStringList *notRemoved) final; + RemovedFilesFromProject removeFiles(const QStringList &filePaths, + QStringList *notRemoved) final; bool canRenameFile(const QString &filePath, const QString &newFilePath) override; bool renameFile(const QString &filePath, const QString &newFilePath) final; @@ -206,7 +207,8 @@ bool SimpleResourceFolderNode::addFiles(const QStringList &filePaths, QStringLis return addFilesToResource(m_topLevelNode->filePath(), filePaths, notAdded, m_prefix, m_lang); } -bool SimpleResourceFolderNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved) +RemovedFilesFromProject SimpleResourceFolderNode::removeFiles(const QStringList &filePaths, + QStringList *notRemoved) { return prefixNode()->removeFiles(filePaths, notRemoved); } @@ -373,7 +375,8 @@ bool ResourceTopLevelNode::addFiles(const QStringList &filePaths, QStringList *n return addFilesToResource(filePath(), filePaths, notAdded, QLatin1String("/"), QString()); } -bool ResourceTopLevelNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved) +RemovedFilesFromProject ResourceTopLevelNode::removeFiles(const QStringList &filePaths, + QStringList *notRemoved) { return parentFolderNode()->removeFiles(filePaths, notRemoved); } @@ -495,16 +498,17 @@ bool ResourceFolderNode::addFiles(const QStringList &filePaths, QStringList *not return addFilesToResource(m_topLevelNode->filePath(), filePaths, notAdded, m_prefix, m_lang); } -bool ResourceFolderNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved) +RemovedFilesFromProject ResourceFolderNode::removeFiles(const QStringList &filePaths, + QStringList *notRemoved) { if (notRemoved) *notRemoved = filePaths; ResourceFile file(m_topLevelNode->filePath().toString()); if (file.load() != IDocument::OpenResult::Success) - return false; + return RemovedFilesFromProject::Error; int index = file.indexOfPrefix(m_prefix, m_lang); if (index == -1) - return false; + return RemovedFilesFromProject::Error; for (int j = 0; j < file.fileCount(index); ++j) { QString fileName = file.file(index, j); if (!filePaths.contains(fileName)) @@ -517,7 +521,7 @@ bool ResourceFolderNode::removeFiles(const QStringList &filePaths, QStringList * FileChangeBlocker changeGuard(m_topLevelNode->filePath().toString()); file.save(); - return true; + return RemovedFilesFromProject::Ok; } // QTCREATORBUG-15280 |