Fix displaying QR-code in wizard when built-in launcher is used
In this case the connection from the setup detection is not the correct one. The connection used to apply the settings should generally be used for querying the QR-code.
This commit is contained in:
parent
9da5392c35
commit
e9eeb76578
|
@ -388,7 +388,7 @@ void SyncthingApplet::concludeWizard(const QString &errorMessage)
|
|||
}
|
||||
m_applyingSettingsForWizard = false;
|
||||
if (m_wizard) {
|
||||
m_wizard->handleConfigurationApplied(errorMessage);
|
||||
m_wizard->handleConfigurationApplied(errorMessage, &m_connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ void TrayWidget::applySettingsChangesFromWizard()
|
|||
// consider the settings applied instantly if there's no tray widget instance
|
||||
if (s_instances.empty()) {
|
||||
if (s_wizard) {
|
||||
s_wizard->handleConfigurationApplied();
|
||||
s_wizard->handleConfigurationApplied(QString(), &m_connection);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -926,7 +926,7 @@ void TrayWidget::concludeWizard(const QString &errorMessage)
|
|||
}
|
||||
m_applyingSettingsForWizard = false;
|
||||
if (s_wizard) {
|
||||
s_wizard->handleConfigurationApplied(errorMessage);
|
||||
s_wizard->handleConfigurationApplied(errorMessage, &m_connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -394,12 +394,15 @@ QString Wizard::hintAboutSyncthingLog() const
|
|||
return res;
|
||||
}
|
||||
|
||||
void Wizard::handleConfigurationApplied(const QString &configError)
|
||||
void Wizard::handleConfigurationApplied(const QString &configError, Data::SyncthingConnection *connection)
|
||||
{
|
||||
m_configApplied = true;
|
||||
if (m_configError.isEmpty()) {
|
||||
m_configError = configError;
|
||||
}
|
||||
if ((m_appliedConnection = connection)) {
|
||||
connect(connection, &Data::SyncthingConnection::destroyed, this, [this] { m_appliedConnection = nullptr; });
|
||||
}
|
||||
emit configApplied();
|
||||
}
|
||||
|
||||
|
@ -1005,7 +1008,9 @@ void QtGui::FinalWizardPage::showResults()
|
|||
"Syncthing</a> to pair remote devices and add folders for sharing. If you need further help, read the "
|
||||
"<a href=\"openDocs\">documentation to get started</a>.</p>"
|
||||
"<p>To initiate the pairing from another device, the device ID of this Syncthing device is displayed below.</p>"));
|
||||
m_layout->addWidget(m_ownDeviceIdWidget = ownDeviceIdWidget(wizard->setupDetection().connection, 256));
|
||||
if (wizard->appliedConnection()) {
|
||||
m_layout->addWidget(m_ownDeviceIdWidget = ownDeviceIdWidget(*(wizard->appliedConnection()), 256));
|
||||
}
|
||||
} else {
|
||||
setSubTitle(tr("Not all changes could be applied"));
|
||||
m_label->setText(
|
||||
|
|
|
@ -14,6 +14,10 @@ QT_FORWARD_DECLARE_CLASS(QLabel)
|
|||
QT_FORWARD_DECLARE_CLASS(QProgressBar)
|
||||
QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
|
||||
|
||||
namespace Data {
|
||||
class SyncthingConnection;
|
||||
}
|
||||
|
||||
namespace QtGui {
|
||||
|
||||
class SetupDetection;
|
||||
|
@ -54,10 +58,11 @@ public:
|
|||
bool autoStart() const;
|
||||
bool isConfigApplied() const;
|
||||
const QString &configError() const;
|
||||
Data::SyncthingConnection *appliedConnection();
|
||||
|
||||
public Q_SLOTS:
|
||||
bool changeSettings();
|
||||
void handleConfigurationApplied(const QString &configError = QString());
|
||||
void handleConfigurationApplied(const QString &configError = QString(), Data::SyncthingConnection *connection = nullptr);
|
||||
|
||||
Q_SIGNALS:
|
||||
void settingsDialogRequested();
|
||||
|
@ -82,6 +87,7 @@ private:
|
|||
bool m_autoStart = false;
|
||||
bool m_configApplied = false;
|
||||
QString m_configError;
|
||||
Data::SyncthingConnection *m_appliedConnection = nullptr;
|
||||
int m_elapsedPollTime;
|
||||
};
|
||||
|
||||
|
@ -115,6 +121,11 @@ inline const QString &Wizard::configError() const
|
|||
return m_configError;
|
||||
}
|
||||
|
||||
inline Data::SyncthingConnection *Wizard::appliedConnection()
|
||||
{
|
||||
return m_appliedConnection;
|
||||
}
|
||||
|
||||
class SYNCTHINGWIDGETS_EXPORT WelcomeWizardPage final : public QWizardPage {
|
||||
Q_OBJECT
|
||||
|
||||
|
|
Loading…
Reference in New Issue