From 565aed03a24e315847421272d582b7fd3b7ff04d Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 25 Nov 2016 14:45:59 +0100 Subject: [PATCH] Wizards: Use filename, not baseName for license headers Task-number: QTCREATORBUG-17343 Change-Id: I23ae4b510bb2dc81bd34253e8129ba148ae92021 Reviewed-by: Tim Jenssen Reviewed-by: Eike Ziller --- .../qtcreator/templates/wizards/files/cppheader/wizard.json | 2 +- .../qtcreator/templates/wizards/files/cppsource/wizard.json | 2 +- src/plugins/coreplugin/corejsextensions.cpp | 6 ++++++ src/plugins/coreplugin/corejsextensions.h | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/templates/wizards/files/cppheader/wizard.json b/share/qtcreator/templates/wizards/files/cppheader/wizard.json index db6809b0b9d..6ea6fe5b09a 100644 --- a/share/qtcreator/templates/wizards/files/cppheader/wizard.json +++ b/share/qtcreator/templates/wizards/files/cppheader/wizard.json @@ -32,7 +32,7 @@ "source": "file.h", "target": "%{FileName}", "openInEditor": true, - "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.completeBaseName('%{FileName}')}" } + "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.fileName('%{FileName}')}" } } } ] diff --git a/share/qtcreator/templates/wizards/files/cppsource/wizard.json b/share/qtcreator/templates/wizards/files/cppsource/wizard.json index bad4ad1f27c..504de97238e 100644 --- a/share/qtcreator/templates/wizards/files/cppsource/wizard.json +++ b/share/qtcreator/templates/wizards/files/cppsource/wizard.json @@ -32,7 +32,7 @@ "source": "file.cpp", "target": "%{FileName}", "openInEditor": true, - "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.completeBaseName('%{FileName}')}" } + "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.fileName('%{FileName}')}" } } } ] diff --git a/src/plugins/coreplugin/corejsextensions.cpp b/src/plugins/coreplugin/corejsextensions.cpp index 81e193f263b..806a5054e18 100644 --- a/src/plugins/coreplugin/corejsextensions.cpp +++ b/src/plugins/coreplugin/corejsextensions.cpp @@ -52,6 +52,12 @@ QString UtilsJsExtension::baseName(const QString &in) const return fi.baseName(); } +QString UtilsJsExtension::fileName(const QString &in) const +{ + QFileInfo fi(in); + return fi.fileName(); +} + QString UtilsJsExtension::completeBaseName(const QString &in) const { QFileInfo fi(in); diff --git a/src/plugins/coreplugin/corejsextensions.h b/src/plugins/coreplugin/corejsextensions.h index 861e10bd016..78e1bc99daa 100644 --- a/src/plugins/coreplugin/corejsextensions.h +++ b/src/plugins/coreplugin/corejsextensions.h @@ -46,6 +46,7 @@ public: Q_INVOKABLE QString fromNativeSeparators(const QString &in) const; Q_INVOKABLE QString baseName(const QString &in) const; + Q_INVOKABLE QString fileName(const QString &in) const; Q_INVOKABLE QString completeBaseName(const QString &in) const; Q_INVOKABLE QString suffix(const QString &in) const; Q_INVOKABLE QString completeSuffix(const QString &in) const;