diff options
Diffstat (limited to 'src/gui/mphoneform.cpp')
-rw-r--r-- | src/gui/mphoneform.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/gui/mphoneform.cpp b/src/gui/mphoneform.cpp index 6c447a8..9f90b29 100644 --- a/src/gui/mphoneform.cpp +++ b/src/gui/mphoneform.cpp @@ -200,6 +200,12 @@ void MphoneForm::init() connect(sysTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(sysTrayIconClicked(QSystemTrayIcon::ActivationReason))); + connect(menu, &QMenu::aboutToShow, this, &MphoneForm::updateTrayIconMenu); + + // Toggle window visibility + menu->addAction(toggleWindowAction); + + menu->addSeparator(); // Call menu menu->addAction(callInvite); @@ -1115,7 +1121,7 @@ void MphoneForm::updateMwi() toolTip.append(tr("Unknown")); } } else { - if ((*i)->get_mwi_sollicited()) { + if ((*i)->get_mwi_solicited()) { if (mwi.get_status() == t_mwi::MWI_FAILED) { toolTip.append(tr("Failure")); mwi_failure = true; @@ -1123,7 +1129,7 @@ void MphoneForm::updateMwi() toolTip.append(tr("Unknown")); } } else { - // Unsollicited MWI + // Unsolicited MWI if (mwi.get_status() == t_mwi::MWI_KNOWN) { bool new_msgs; QString status = getMWIStatus(mwi, new_msgs); @@ -3239,12 +3245,20 @@ void MphoneForm::whatsThis() void MphoneForm::sysTrayIconClicked(QSystemTrayIcon::ActivationReason reason) { if (reason == QSystemTrayIcon::Trigger || reason == QSystemTrayIcon::DoubleClick) - { - if (sys_config->get_gui_hide_on_close()) - setVisible(!isVisible()); - else - activateWindow(); - } + toggleWindow(); +} + +void MphoneForm::toggleWindow() +{ + setVisible(!isVisible()); +} + +void MphoneForm::updateTrayIconMenu() +{ + if (isVisible()) + toggleWindowAction->setText(tr("Hide window")); + else + toggleWindowAction->setText(tr("Show window")); } bool MphoneForm::event(QEvent * event) |