Hide connections menu when only one connection is configured

* Make UI look cleaner for the common case of only one configuration
* Save some width to help with
  https://github.com/Martchus/syncthingtray/issues/65 a little bit
This commit is contained in:
Martchus 2020-04-28 00:10:04 +02:00
parent a2695311d4
commit 65b3261320
2 changed files with 2 additions and 0 deletions

View File

@ -394,6 +394,7 @@ ColumnLayout {
paddingEnabled: true
enforceMenuArrow: true
onClicked: connectionConfigsMenu.toggle(x, y + height)
visible: plasmoid.nativeInterface.connectionConfigNames.length > 1
Shortcut {
sequence: "Ctrl+Shift+C"
onActivated: connectionsButton.clicked()

View File

@ -433,6 +433,7 @@ void TrayWidget::applySettings(const QString &connectionConfig)
m_connectionsMenu->actions().at(0)->setChecked(true);
}
m_ui->connectionsPushButton->setText(m_selectedConnection->label);
m_ui->connectionsPushButton->setHidden(secondaryConnectionSettings.empty());
const bool reconnectRequired = m_connection.applySettings(*m_selectedConnection);
// apply notification settings