Bring app window back to front once msg URL is opened externally.

This commit is contained in:
Martin Rotter 2020-11-27 07:31:41 +01:00
parent de6aab846e
commit 902570a0e0
3 changed files with 14 additions and 2 deletions

View File

@ -459,12 +459,12 @@ void FormMain::switchVisibility(bool force_hide) {
void FormMain::display() {
// Make sure window is not minimized.
setWindowState(windowState() & ~Qt::WindowMinimized);
setWindowState(windowState() & ~Qt::WindowMinimized& ~Qt::WindowActive);
// Display the window and make sure it is raised on top.
show();
activateWindow();
raise();
activateWindow();
// Raise alert event. Check the documentation for more info on this.
Application::alert(this);

View File

@ -392,6 +392,10 @@ void MessagesView::openSelectedSourceMessagesExternally() {
if (!selectionModel()->selectedRows().isEmpty()) {
QTimer::singleShot(0, this, SLOT(markSelectedMessagesRead()));
}
QTimer::singleShot(1000, this, []() {
qApp->mainForm()->display();
});
}
void MessagesView::openSelectedMessagesInternally() {

View File

@ -8,6 +8,10 @@
#include "miscellaneous/application.h"
#include "services/abstract/label.h"
#ifdef Q_OS_WIN
#include <QtPlatformHeaders/QWindowsWindowFunctions>
#endif
#if defined (Q_OS_MACOS)
extern void disableWindowTabbing();
@ -69,6 +73,10 @@ int main(int argc, char* argv[]) {
qApp->reactOnForeignNotifications();
#ifdef Q_OS_WIN
QWindowsWindowFunctions::setWindowActivationBehavior(QWindowsWindowFunctions::AlwaysActivateWindow);
#endif
FormMain main_window;
qApp->loadDynamicShortcuts();