forked from qt-creator/qt-creator
Resourceeditor: Enabled renaming of files in qrc
Task-number: QTCREATORBUG-15786 Change-Id: I240c58951f2b1016bef694636f923322fc164009 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -427,6 +427,27 @@ bool ResourceFolderNode::removeFiles(const QStringList &filePaths, QStringList *
|
||||
return true;
|
||||
}
|
||||
|
||||
// QTCREATORBUG-15280
|
||||
bool ResourceFolderNode::canRenameFile(const QString &filePath, const QString &newFilePath)
|
||||
{
|
||||
Q_UNUSED(newFilePath)
|
||||
|
||||
bool fileEntryExists = false;
|
||||
ResourceFile file(m_topLevelNode->filePath().toString());
|
||||
|
||||
int index = (file.load() != Core::IDocument::OpenResult::Success) ? -1 :file.indexOfPrefix(m_prefix, m_lang);
|
||||
if (index != -1) {
|
||||
for (int j = 0; j < file.fileCount(index); ++j) {
|
||||
if (file.file(index, j) == filePath) {
|
||||
fileEntryExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fileEntryExists;
|
||||
}
|
||||
|
||||
bool ResourceFolderNode::renameFile(const QString &filePath, const QString &newFilePath)
|
||||
{
|
||||
ResourceFile file(m_topLevelNode->filePath().toString());
|
||||
|
@@ -100,6 +100,7 @@ public:
|
||||
|
||||
bool addFiles(const QStringList &filePaths, QStringList *notAdded) override;
|
||||
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved) override;
|
||||
bool canRenameFile(const QString &filePath, const QString &newFilePath) override;
|
||||
bool renameFile(const QString &filePath, const QString &newFilePath) override;
|
||||
|
||||
bool renamePrefix(const QString &prefix, const QString &lang);
|
||||
|
Reference in New Issue
Block a user