aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/resourceeditor
diff options
context:
space:
mode:
authorDaniel Teske <daniel.teske@digia.com>2014-03-07 16:23:04 +0100
committerDaniel Teske <daniel.teske@digia.com>2014-03-10 10:45:11 +0100
commitca6efdcedc9c2d12e03db72d553297aeed249bc6 (patch)
tree54dffe9bad8b6ed7bef17673fcd1f9d4e4c2f391 /src/plugins/resourceeditor
parent5bb72be900037bba7937d0ebe571b854f369d9fa (diff)
ProjectExplorer::New File Use addNewInformation also for context menu
So that the resourcenode can steal from it's parent Change-Id: I97a21d94c0ddb0d217c48fd69dc808446763837b Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Diffstat (limited to 'src/plugins/resourceeditor')
-rw-r--r--src/plugins/resourceeditor/resourcenode.cpp30
-rw-r--r--src/plugins/resourceeditor/resourcenode.h4
2 files changed, 25 insertions, 9 deletions
diff --git a/src/plugins/resourceeditor/resourcenode.cpp b/src/plugins/resourceeditor/resourcenode.cpp
index a9b80b54038..0c9ece28be4 100644
--- a/src/plugins/resourceeditor/resourcenode.cpp
+++ b/src/plugins/resourceeditor/resourcenode.cpp
@@ -45,7 +45,7 @@
using namespace ResourceEditor;
using namespace ResourceEditor::Internal;
-static int priority(const QStringList &files)
+static bool priority(const QStringList &files)
{
if (files.isEmpty())
return -1;
@@ -54,8 +54,8 @@ static int priority(const QStringList &files)
if (type.startsWith(QLatin1String("image/"))
|| type == QLatin1String(QmlJSTools::Constants::QML_MIMETYPE)
|| type == QLatin1String(QmlJSTools::Constants::JS_MIMETYPE))
- return 120;
- return 80;
+ return true;
+ return false;
}
static bool addFilesToResource(const QString &resourceFile, const QStringList &filePaths, QStringList *notAdded,
@@ -244,12 +244,21 @@ bool ResourceTopLevelNode::removePrefix(const QString &prefix, const QString &la
return false;
}
-ProjectExplorer::FolderNode::AddNewInformation ResourceTopLevelNode::addNewInformation(const QStringList &files) const
+ProjectExplorer::FolderNode::AddNewInformation ResourceTopLevelNode::addNewInformation(const QStringList &files, Node *context) const
{
QString name = tr("%1 Prefix: %2")
.arg(QFileInfo(path()).fileName())
.arg(QLatin1String("/"));
- return AddNewInformation(name, priority(files) + 1);
+
+ int p = 80;
+ if (priority(files)) {
+ if (context == 0 || context == this)
+ p = 125;
+ else if (projectNode() == context)
+ p = 150; // steal from our project node
+ }
+
+ return AddNewInformation(name, p);
}
ResourceFolderNode::ResourceFolderNode(const QString &prefix, const QString &lang, ResourceTopLevelNode *parent)
@@ -357,12 +366,19 @@ bool ResourceFolderNode::renamePrefix(const QString &prefix, const QString &lang
return true;
}
-ProjectExplorer::FolderNode::AddNewInformation ResourceFolderNode::addNewInformation(const QStringList &files) const
+ProjectExplorer::FolderNode::AddNewInformation ResourceFolderNode::addNewInformation(const QStringList &files, Node *context) const
{
QString name = tr("%1 Prefix: %2")
.arg(QFileInfo(m_topLevelNode->path()).fileName())
.arg(displayName());
- return AddNewInformation(name, priority(files) + 1);
+
+ int p = 80;
+ if (priority(files)) {
+ if (context == 0 || context == this)
+ p = 120;
+ }
+
+ return AddNewInformation(name, p);
}
QString ResourceFolderNode::displayName() const
diff --git a/src/plugins/resourceeditor/resourcenode.h b/src/plugins/resourceeditor/resourcenode.h
index 74c01eb227b..9aa4166c938 100644
--- a/src/plugins/resourceeditor/resourcenode.h
+++ b/src/plugins/resourceeditor/resourcenode.h
@@ -59,7 +59,7 @@ public:
bool addPrefix(const QString &prefix, const QString &lang);
bool removePrefix(const QString &prefix, const QString &lang);
- AddNewInformation addNewInformation(const QStringList &files) const;
+ AddNewInformation addNewInformation(const QStringList &files, Node *context) const;
private:
Internal::ResourceFileWatcher *m_document;
@@ -84,7 +84,7 @@ public:
bool renamePrefix(const QString &prefix, const QString &lang);
- AddNewInformation addNewInformation(const QStringList &files) const;
+ AddNewInformation addNewInformation(const QStringList &files, Node *context) const;
QString prefix() const;
QString lang() const;