diff --git a/src/main.cpp b/src/main.cpp --- a/src/main.cpp +++ b/src/main.cpp @@ -53,6 +53,10 @@ void commitData(QSessionManager &sm); void setEventLoopReached(); void delayedInstanceCreation(const QStringList &args, const QString &workingDir); + +public Q_SLOTS: + int newInstance(const QByteArray &startupId, const QStringList &arguments, const QString &workingDirectory) override; + protected: bool mDelayedInstanceCreation; bool mEventLoopReached; @@ -69,6 +73,17 @@ mEventLoopReached = true; } +int KMailApplication::newInstance(const QByteArray &startupId, const QStringList &arguments, const QString &workingDirectory) +{ + if (!kmkernel->firstInstance() && !arguments.isEmpty()) { + // if we're going to create a new window (viewer or composer), + // don't bring the mainwindow onto the current desktop + return activate(arguments, workingDirectory); + } else { + return PimUniqueApplication::newInstance(startupId, arguments, workingDirectory); + } +} + int KMailApplication::activate(const QStringList &args, const QString &workingDir) { // If the event loop hasn't been reached yet, the kernel is probably not