[win] using a semicolon separated string to create a jump list

This commit is contained in:
SimplestStudio
2025-05-31 12:20:18 +03:00
parent fcea900dec
commit 8452576809
4 changed files with 10 additions and 16 deletions

View File

@ -99,7 +99,7 @@ HRESULT _CreateShellLink(PCWSTR pszArguments, PCWSTR pszTitle, IShellLink **ppsl
return hr;
}
HRESULT _AddTasksToList(ICustomDestinationList *pcdl, QStringList list)
HRESULT _AddTasksToList(ICustomDestinationList *pcdl, const QStringList &list)
{
pcdl->AppendKnownCategory(KDC_RECENT);
IObjectCollection *poc;
@ -115,7 +115,7 @@ HRESULT _AddTasksToList(ICustomDestinationList *pcdl, QStringList list)
IShellLink * psl;
for (int i = 0; i < MAX_TASK_NUM && i < list.size(); i++) {
hr = _CreateShellLink(args[i], list[i].replace('_', ' ').toStdWString().c_str(), &psl, i);
hr = _CreateShellLink(args[i], list[i].toStdWString().c_str(), &psl, i);
if (SUCCEEDED(hr))
{
hr = poc->AddObject(psl);

View File

@ -35,7 +35,6 @@
#include <QStringList>
#define MIN_TASK_NUM 3
#define MAX_TASK_NUM 4
void CreateJumpList(const QStringList &list);

View File

@ -63,13 +63,11 @@ int main(int argc, char *argv[])
QStringList _cmdArgs(QCoreApplication::arguments().mid(1));
#ifndef __OS_WIN_XP
if (_cmdArgs.contains("--create-jump-list")) {
QStringList defaultTitles = {
"New document",
"New spreadsheet",
"New presentation",
"New PDF form"
};
CreateJumpList(_cmdArgs.size() > MIN_TASK_NUM ? _cmdArgs.mid(1) : defaultTitles);
if (_cmdArgs.size() > 1) {
QStringList list = _cmdArgs.at(1).split(';', Qt::SkipEmptyParts);
if (!list.isEmpty())
CreateJumpList(list);
}
return 0;
} else
if (_cmdArgs.contains("--remove-jump-list")) {

View File

@ -971,14 +971,11 @@ begin
DoPostInstall();
GetWindowsVersionEx(version);
if (version.Major > 6) or ((version.Major = 6) and (version.Minor >= 1)) then begin
translateArgs := ExpandConstant('@{app}\{#iconsExe},-1200;@{app}\{#iconsExe},-1201;@{app}\{#iconsExe},-1202');
#ifdef _ONLYOFFICE
translateArgs := ExpandConstant('@{app}\{#iconsExe},-1200+@{app}\{#iconsExe},-1201+@{app}\{#iconsExe},-1202+@{app}\{#iconsExe},-1103');
#else
translateArgs := ExpandConstant('@{app}\{#iconsExe},-1200+@{app}\{#iconsExe},-1201+@{app}\{#iconsExe},-1202');
translateArgs := translateArgs + ExpandConstant(';@{app}\{#iconsExe},-1103');
#endif
StringChangeEx(translateArgs, ' ', '_', True);
StringChangeEx(translateArgs, '+', ' ', True);
Exec(ExpandConstant('{app}\{#iconsExe}'), '--create-jump-list ' + translateArgs, '', SW_SHOWNORMAL, ewWaitUntilTerminated, ErrorCode);
Exec(ExpandConstant('{app}\{#iconsExe}'), '--create-jump-list "' + translateArgs + '"', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ErrorCode);
if CheckCommandlineParam('/noupdates') then begin
RegWriteDWordValue(HKEY_LOCAL_MACHINE, ExpandConstant('{#APP_REG_PATH}'), 'CheckForUpdates', 0);
end else