diff --git a/src/main.cpp b/src/main.cpp index 7fbf61682..468641809 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -66,9 +66,12 @@ int main(int argc, char *argv[]) parser.addHelpOption(); parser.addVersionOption(); parser.addPositionalArgument("uri", QObject::tr("Tox URI to parse")); + parser.addOption(QCommandLineOption("P", QObject::tr("Starts new instance and loads specified profile."), "profile")); parser.process(a); Settings::getInstance(); // Build our Settings singleton as soon as QApplication is ready, not before + if(parser.isSet("P")) + Settings::getInstance().setCurrentProfile(parser.value("P")); sodium_init(); // For the auto-updater @@ -153,7 +156,7 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } } - else if(!ipc.isCurrentOwner()) + else if(!ipc.isCurrentOwner() && !parser.isSet("P")) { time_t event = ipc.postEvent("$activate"); ipc.waitUntilProcessed(event);