diff options
author | Frerich Raabe <raabe@froglogic.com> | 2016-01-11 16:21:31 +0100 |
---|---|---|
committer | Katja Marttila <katja.marttila@theqtcompany.com> | 2016-01-18 04:46:11 +0000 |
commit | 8b344748b7059ade811c7b0f28c4458b0d01eb4d (patch) | |
tree | 48cb2a7f1c1384f3842a122c69c7ae1f107a514e /src/libs/installer/createshortcutoperation.cpp | |
parent | e53cb9d364f9809d24748039a0526d4ec57764d6 (diff) |
Added support for setting descriptions of Windows shortcuts
This patch extends the CreateShortcut operation on Windows such that it
recognizes a new optional 'description' argument - if specified, it's
used to set the description (AKA "comment") of the Windows shortcut.
Change-Id: Ib0ab48bd30e83d9cc89b1bad7d2b88e9109bdcea
Reviewed-by: Katja Marttila <katja.marttila@theqtcompany.com>
Diffstat (limited to 'src/libs/installer/createshortcutoperation.cpp')
-rw-r--r-- | src/libs/installer/createshortcutoperation.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libs/installer/createshortcutoperation.cpp b/src/libs/installer/createshortcutoperation.cpp index 9c48605ff..d8a418754 100644 --- a/src/libs/installer/createshortcutoperation.cpp +++ b/src/libs/installer/createshortcutoperation.cpp @@ -100,7 +100,7 @@ static QString takeArgument(const QString argument, QStringList *arguments) static bool createLink(const QString &fileName, const QString &linkName, QString workingDir, const QString &arguments = QString(), const QString &iconPath = QString(), - const QString &iconId = QString()) + const QString &iconId = QString(), const QString &description = QString()) { #ifdef Q_OS_WIN // CoInitialize cleanup object @@ -145,6 +145,8 @@ static bool createLink(const QString &fileName, const QString &linkName, QString psl->SetArguments((wchar_t*)arguments.utf16()); if (!iconPath.isNull()) psl->SetIconLocation((wchar_t*)(iconPath.utf16()), iconId.toInt()); + if (!description.isNull()) + psl->SetDescription((wchar_t*)(description.utf16())); iunkn = psl; } @@ -215,6 +217,7 @@ void CreateShortcutOperation::ensureOptionalArgumentsRead() m_iconId = takeArgument(QString::fromLatin1("iconId="), &args); m_iconPath = takeArgument(QString::fromLatin1("iconPath="), &args); m_workingDir = takeArgument(QString::fromLatin1("workingDirectory="), &args); + m_description = takeArgument(QString::fromLatin1("description="), &args); setArguments(args); } @@ -224,7 +227,8 @@ bool CreateShortcutOperation::performOperation() ensureOptionalArgumentsRead(); if (!checkArgumentCount(2, 3, tr("<target> <link location> [target arguments] " - "[\"workingDirectory=...\"] [\"iconPath=...\"] [\"iconId=...\"]"))) { + "[\"workingDirectory=...\"] [\"iconPath=...\"] [\"iconId=...\"] " + "[\"description=...\"]"))) { return false; } @@ -261,7 +265,8 @@ bool CreateShortcutOperation::performOperation() return false; } - const bool linked = createLink(linkTarget, linkLocation, m_workingDir, targetArguments, m_iconPath, m_iconId); + const bool linked = createLink(linkTarget, linkLocation, m_workingDir, targetArguments, m_iconPath, m_iconId, + m_description); if (!linked) { setError(UserDefinedError); setErrorString(tr("Cannot create link \"%1\": %2").arg(QDir::toNativeSeparators(linkLocation), |