fix: Always show the tray menu entry for the restore action on macOS
This commit is contained in:
parent
ebad12a922
commit
af6dac9eee
1 changed files with 12 additions and 8 deletions
|
|
@ -240,7 +240,10 @@ void MainWindow::connectSlots()
|
||||||
|
|
||||||
connect(&m_WindowSaveTimer, &QTimer::timeout, this, &MainWindow::onWindowSaveTimerTimeout);
|
connect(&m_WindowSaveTimer, &QTimer::timeout, this, &MainWindow::onWindowSaveTimerTimeout);
|
||||||
|
|
||||||
|
// Mac os tray will only show a menu
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
connect(&m_TrayIcon, &TrayIcon::activated, this, &MainWindow::onTrayIconActivated);
|
connect(&m_TrayIcon, &TrayIcon::activated, this, &MainWindow::onTrayIconActivated);
|
||||||
|
#endif
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
&m_ServerConnection, &ServerConnection::configureClient, this, &MainWindow::onServerConnectionConfigureClient
|
&m_ServerConnection, &ServerConnection::configureClient, this, &MainWindow::onServerConnectionConfigureClient
|
||||||
|
|
@ -522,8 +525,14 @@ void MainWindow::moveEvent(QMoveEvent *event)
|
||||||
|
|
||||||
void MainWindow::open()
|
void MainWindow::open()
|
||||||
{
|
{
|
||||||
|
|
||||||
QList<QAction *> trayActions{ui->m_pActionStartCore, ui->m_pActionStopCore, nullptr, ui->m_pActionQuit};
|
QList<QAction *> trayActions{ui->m_pActionStartCore, ui->m_pActionStopCore, nullptr, ui->m_pActionQuit};
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
ui->m_pActionRestore->setText(tr("Open Deskflow"));
|
||||||
|
trayActions.insert(3, ui->m_pActionRestore);
|
||||||
|
trayActions.insert(4, nullptr);
|
||||||
|
#endif
|
||||||
m_TrayIcon.create(trayActions);
|
m_TrayIcon.create(trayActions);
|
||||||
|
|
||||||
if (m_AppConfig.autoHide()) {
|
if (m_AppConfig.autoHide()) {
|
||||||
|
|
@ -896,9 +905,9 @@ void MainWindow::setVisible(bool visible)
|
||||||
{
|
{
|
||||||
QMainWindow::setVisible(visible);
|
QMainWindow::setVisible(visible);
|
||||||
ui->m_pActionMinimize->setEnabled(visible);
|
ui->m_pActionMinimize->setEnabled(visible);
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
ui->m_pActionRestore->setEnabled(!visible);
|
ui->m_pActionRestore->setEnabled(!visible);
|
||||||
|
#else
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // lion
|
|
||||||
// dock hide only supported on lion :(
|
// dock hide only supported on lion :(
|
||||||
ProcessSerialNumber psn = {0, kCurrentProcess};
|
ProcessSerialNumber psn = {0, kCurrentProcess};
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
|
|
@ -1046,12 +1055,7 @@ void MainWindow::enableClient(bool enable)
|
||||||
|
|
||||||
void MainWindow::showAndActivate()
|
void MainWindow::showAndActivate()
|
||||||
{
|
{
|
||||||
if (!isMinimized() && !isHidden()) {
|
show();
|
||||||
qDebug("window already visible");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
showNormal();
|
|
||||||
raise();
|
raise();
|
||||||
activateWindow();
|
activateWindow();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue