mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-02-10 18:05:16 +08:00
[win] using a semicolon separated string to create a jump list
This commit is contained in:
@ -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);
|
||||
|
||||
@ -35,7 +35,6 @@
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
#define MIN_TASK_NUM 3
|
||||
#define MAX_TASK_NUM 4
|
||||
|
||||
void CreateJumpList(const QStringList &list);
|
||||
|
||||
@ -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")) {
|
||||
|
||||
Reference in New Issue
Block a user