diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2017-12-11 09:53:28 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-11 09:53:28 -0600 |
| commit | 361e59e40d7e955eaaaa1cf4dd4f407a5ca7cdef (patch) | |
| tree | acf1d06bc6f90c4571ba4783380c7e7b33e27419 /src/main.cpp | |
| parent | bf02d13ed4353ef02d3e5ef0b91931fef59709e6 (diff) | |
| parent | ad702537bd6dc4eff40dd6b6d51536b2758dca6c (diff) | |
Merge pull request #140 from erasmux/shortcut_fixes
Shortcut fixes
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp index 40224170..dbf41afb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -121,11 +121,6 @@ bool bootstrap() }
-bool isNxmLink(const QString &link)
-{
- return link.startsWith("nxm://", Qt::CaseInsensitive);
-}
-
static LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *exceptionPtrs)
{
if ((exceptionPtrs->ExceptionRecord->ExceptionCode < 0x80000000) // non-critical
@@ -467,7 +462,16 @@ int runApplication(MOApplication &application, SingleInstance &instance, // if we have a command line parameter, it is either a nxm link or
// a binary to start
if (arguments.size() > 1) {
- if (isNxmLink(arguments.at(1))) {
+ if (OrganizerCore::isMoShortcut(arguments.at(1))) {
+ try {
+ organizer.runShortcut(OrganizerCore::moShortcutName(arguments.at(1)));
+ return 0;
+ } catch (const std::exception &e) {
+ reportError(
+ QObject::tr("failed to start shortcut: %1").arg(e.what()));
+ return 1;
+ }
+ } else if (OrganizerCore::isNxmLink(arguments.at(1))) {
qDebug("starting download from command line: %s",
qPrintable(arguments.at(1)));
organizer.externalMessage(arguments.at(1));
@@ -560,8 +564,10 @@ int main(int argc, char *argv[]) SingleInstance instance(forcePrimary);
if (!instance.primaryInstance()) {
- if ((arguments.size() == 2) && isNxmLink(arguments.at(1))) {
- qDebug("not primary instance, sending download message");
+ if ((arguments.size() == 2)
+ && (OrganizerCore::isMoShortcut(arguments.at(1)) || OrganizerCore::isNxmLink(arguments.at(1))))
+ {
+ qDebug("not primary instance, sending shortcut/download message");
instance.sendMessage(arguments.at(1));
return 0;
} else if (arguments.size() == 1) {
|
