Merge pull request #4379 from nextcloud/bugfix/updateChannelLocalized

ensure we only store update channel not localized in settings
This commit is contained in:
Matthieu Gallien 2022-03-27 19:33:53 +02:00 committed by GitHub
commit 5500be725f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 10 deletions

View file

@ -32,9 +32,9 @@ cd qtkeychain
git checkout v0.10.0
mkdir build
cd build
cmake -G Ninja -D CMAKE_INSTALL_PREFIX=/app/usr ..
cmake -G Ninja -D CMAKE_INSTALL_PREFIX=/usr ..
cmake --build . --target all
cmake --build . --target install
cmake --install . --prefix /app/usr
# Build client
@ -42,14 +42,16 @@ mkdir build-client
cd build-client
cmake \
-G Ninja \
-D CMAKE_INSTALL_PREFIX=/app/usr \
-D CMAKE_INSTALL_PREFIX=/usr \
-D BUILD_TESTING=OFF \
-D BUILD_UPDATER=$BUILD_UPDATER \
-D MIRALL_VERSION_BUILD=$BUILDNR \
-D MIRALL_VERSION_SUFFIX="$VERSION_SUFFIX" \
${DESKTOP_CLIENT_ROOT}
cmake --build . --target all
cmake --build . --target install
cmake --install . --prefix /app/usr
mkdir -p /app/usr/etc/Nextcloud
mv /etc/Nextcloud/sync-exclude.lst /app/usr/etc/Nextcloud/sync-exclude.lst
# Move stuff around
cd /app
@ -96,7 +98,7 @@ chmod a+x linuxdeployqt*.AppImage
./linuxdeployqt-continuous-x86_64.AppImage --appimage-extract
rm ./linuxdeployqt-continuous-x86_64.AppImage
unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/app/usr/lib/
export LD_LIBRARY_PATH=/usr/lib/
./squashfs-root/AppRun ${DESKTOP_FILE} -bundle-non-qt-libs -qmldir=${DESKTOP_CLIENT_ROOT}/src/gui
# Set origin

View file

@ -304,10 +304,43 @@ void GeneralSettings::slotUpdateInfo()
this, &GeneralSettings::slotUpdateChannelChanged, Qt::UniqueConnection);
}
void GeneralSettings::slotUpdateChannelChanged(const QString &channel)
void GeneralSettings::slotUpdateChannelChanged(const QString &translatedChannel)
{
if (channel == ConfigFile().updateChannel())
const auto updateChannelToLocalized = [](const QString &channel) {
auto decodedTranslatedChannel = QString{};
if (channel == QStringLiteral("stable")) {
decodedTranslatedChannel = tr("stable");
} else if (channel == QStringLiteral("beta")) {
decodedTranslatedChannel = tr("beta");
}
return decodedTranslatedChannel;
};
const auto updateChannelFromLocalized = [](const int index) {
auto channel = QString{};
switch (index)
{
case 0:
channel = QStringLiteral("stable");
break;
case 1:
channel = QStringLiteral("beta");
break;
default:
channel = QString{};
}
return channel;
};
const auto channel = updateChannelFromLocalized(_ui->updateChannel->currentIndex());
if (translatedChannel == ConfigFile().updateChannel()) {
return;
}
auto msgBox = new QMessageBox(
QMessageBox::Warning,
@ -327,7 +360,7 @@ void GeneralSettings::slotUpdateChannelChanged(const QString &channel)
this);
auto acceptButton = msgBox->addButton(tr("Change update channel"), QMessageBox::AcceptRole);
msgBox->addButton(tr("Cancel"), QMessageBox::RejectRole);
connect(msgBox, &QMessageBox::finished, msgBox, [this, channel, msgBox, acceptButton] {
connect(msgBox, &QMessageBox::finished, msgBox, [this, channel, msgBox, acceptButton, updateChannelToLocalized] {
msgBox->deleteLater();
if (msgBox->clickedButton() == acceptButton) {
ConfigFile().setUpdateChannel(channel);
@ -342,7 +375,7 @@ void GeneralSettings::slotUpdateChannelChanged(const QString &channel)
}
#endif
} else {
_ui->updateChannel->setCurrentText(ConfigFile().updateChannel());
_ui->updateChannel->setCurrentText(updateChannelToLocalized(ConfigFile().updateChannel()));
}
});
msgBox->open();

View file

@ -55,7 +55,7 @@ private slots:
void slotShowLegalNotice();
#if defined(BUILD_UPDATER)
void slotUpdateInfo();
void slotUpdateChannelChanged(const QString &channel);
void slotUpdateChannelChanged(const QString &translatedChannel);
void slotUpdateCheckNow();
void slotToggleAutoUpdateCheck();
#endif