ResourceNodes: Add copy to clipboard actions.

One for :/prefix/file paths and one as a url qrc:///prefix/file

Task-number: QTCREATORBUG-11776

Change-Id: I98cc2fccf98a6bf07487352e9b10ae29e8347a45
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Daniel Teske
2014-03-31 14:26:03 +02:00
parent a5c77222d8
commit 589945b7d3
5 changed files with 74 additions and 5 deletions

View File

@@ -150,14 +150,19 @@ void ResourceTopLevelNode::update()
int filecount = file.fileCount(i);
for (int j = 0; j < filecount; ++j) {
const QString &fileName = file.file(i, j);
QString alias = file.alias(i, j);
if (alias.isEmpty()) {
alias = QFileInfo(path()).absoluteDir().relativeFilePath(fileName);
}
if (fileNames.contains(fileName)) {
// The file name is duplicated, skip it
// Note: this is wrong, but the qrceditor doesn't allow it either
// only aliases need to be unique
} else {
const QString qrcPath = QDir::cleanPath(prefix + QLatin1Char('/') + alias);
fileNames.insert(fileName);
filesToAdd[qMakePair(prefix, lang)]
<< new ResourceFileNode(fileName, this);
<< new ResourceFileNode(fileName, qrcPath, this);
}
}
@@ -478,9 +483,10 @@ bool ResourceFileWatcher::reload(QString *errorString, ReloadFlag flag, ChangeTy
return true;
}
ResourceFileNode::ResourceFileNode(const QString &filePath, ResourceTopLevelNode *topLevel)
ResourceFileNode::ResourceFileNode(const QString &filePath, const QString &qrcPath, ResourceTopLevelNode *topLevel)
: ProjectExplorer::FileNode(filePath, ProjectExplorer::UnknownFileType, false),
m_topLevel(topLevel)
m_topLevel(topLevel),
m_qrcPath(qrcPath)
{
QString baseDir = QFileInfo(topLevel->path()).absolutePath();
@@ -491,3 +497,8 @@ QString ResourceFileNode::displayName() const
{
return m_displayName;
}
QString ResourceFileNode::qrcPath() const
{
return m_qrcPath;
}