Skip to content

Commit

Permalink
Merge branch 'develop' into KDESKTOP-1453-macOS-A-file-can-be-dehydra…
Browse files Browse the repository at this point in the history
…ted-during-its-upload-fix
  • Loading branch information
herve-er authored Jan 3, 2025
2 parents d0c1d29 + 86741a1 commit b1eff05
Show file tree
Hide file tree
Showing 93 changed files with 2,609 additions and 1,363 deletions.
1 change: 1 addition & 0 deletions client.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,6 @@
<file>resources/icons/actions/light-down-arrow.svg</file>
<file>resources/pictures/en-endpoint-security.svg</file>
<file>resources/pictures/fr-endpoint-security.svg</file>
<file>resources/icons/actions/messages-bubble-square-typing.svg</file>
</qresource>
</RCC>
5 changes: 5 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
#cmakedefine APPLICATION_STORAGE_URL "@APPLICATION_STORAGE_URL@"
#cmakedefine APPLICATION_HELP_URL "@APPLICATION_HELP_URL@"
#cmakedefine APPLICATION_CONFLICT_HELP_URL "@APPLICATION_CONFLICT_HELP_URL@"
#cmakedefine FEEDBACK_EN_URL "@FEEDBACK_EN_URL@"
#cmakedefine FEEDBACK_FR_URL "@FEEDBACK_FR_URL@"
#cmakedefine FEEDBACK_DE_URL "@FEEDBACK_DE_URL@"
#cmakedefine FEEDBACK_ES_URL "@FEEDBACK_ES_URL@"
#cmakedefine FEEDBACK_IT_URL "@FEEDBACK_IT_URL@"
#cmakedefine APPLICATION_ICON_NAME "@APPLICATION_ICON_NAME@"
#cmakedefine APPLICATION_VIRTUALFILE_SUFFIX "@APPLICATION_VIRTUALFILE_SUFFIX@"
#define APPLICATION_DOTVIRTUALFILE_SUFFIX "." APPLICATION_VIRTUALFILE_SUFFIX
Expand Down
5 changes: 5 additions & 0 deletions infomaniak/kDrive.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ endif()

set( APPLICATION_HELP_URL "https://support.infomaniak.com/" CACHE STRING "URL for the help menu" )
set( APPLICATION_CONFLICT_HELP_URL "https://www.infomaniak.com/en/support/faq/2403/resolve-a-kdrive-sync-conflict" )
set( FEEDBACK_FR_URL "https://feedback.userreport.com/fe6ca4b6-5812-4f39-8ca6-5f2300aecda6" )
set( FEEDBACK_EN_URL "https://feedback.userreport.com/652ad8f0-84c8-4a21-9e31-7a8bd7134f46" )
set( FEEDBACK_DE_URL "https://feedback.userreport.com/074f5c5a-372b-40a6-b82f-9157fdb3d2d7" )
set( FEEDBACK_ES_URL "https://feedback.userreport.com/e1304b1e-ebd0-4ffe-9234-a1a91730e651" )
set( FEEDBACK_IT_URL "https://feedback.userreport.com/191a0beb-797d-4ec1-b1ff-31889a0012ee" )

if( APPLE )
set( APPLICATION_ICON_NAME "kdrive-mac" )
Expand Down
6 changes: 6 additions & 0 deletions resources/icons/actions/messages-bubble-square-typing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ set(client_SRCS
customtreewidgetitem.h customtreewidgetitem.cpp
customsystembar.h customsystembar.cpp
customwordwraplabel.h customwordwraplabel.cpp
taglabel.h taglabel.cpp
debuggingdialog.h debuggingdialog.cpp
disabledoverlay.h disabledoverlay.cpp
drivepreferenceswidget.h drivepreferenceswidget.cpp
Expand Down Expand Up @@ -116,6 +117,7 @@ set(client_SRCS
preferencesmenubarwidget.h preferencesmenubarwidget.cpp
preferenceswidget.h preferenceswidget.cpp
versionwidget.h versionwidget.cpp
betaprogramdialog.h betaprogramdialog.cpp
progressbarwidget.h progressbarwidget.cpp
proxyserverdialog.h proxyserverdialog.cpp
guirequests.h guirequests.cpp
Expand Down
233 changes: 233 additions & 0 deletions src/gui/betaprogramdialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
/*
* Infomaniak kDrive - Desktop
* Copyright (C) 2023-2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "betaprogramdialog.h"

#include "adddriveconfirmationwidget.h"
#include "customcombobox.h"
#include "guirequests.h"
#include "parameterscache.h"
#include "utility/utility.h"

#include <QCheckBox>
#include <QPushButton>

static constexpr int mainLayoutHMargin = 40;
static constexpr int mainLayoutSpacing = 24;
static constexpr int titleBoxVSpacing = 14;
static constexpr int subLayoutSpacing = 8;
static constexpr int iconSize = 16;
static constexpr auto iconColor = QColor(239, 139, 52);
static constexpr int indexNo = 0;
static constexpr int indexBeta = 1;
static constexpr int indexInternal = 2;

namespace KDC {

BetaProgramDialog::BetaProgramDialog(const bool isQuit, const bool isStaff, QWidget *parent /*= nullptr*/) :
CustomDialog(true, parent), _isQuit(isQuit && !isStaff), _isStaff(isStaff) {
setObjectName("BetaProgramDialog");

/*
* |-------------------------------------------------------|
* | layout |
* | |
* | |---------------------------------------------| |
* | | acknowledmentLayout | |
* | | | |
* | |---------------------------------------------| |
* | |
* | |---------------------------------------------| |
* | | buttonLayout | |
* | |---------------------------------------------| |
* |-------------------------------------------------------|
*/

auto *layout = new QVBoxLayout(this);
layout->setContentsMargins(mainLayoutHMargin, 0, mainLayoutHMargin, 0);
layout->setSpacing(mainLayoutSpacing);
mainLayout()->addLayout(layout);

// Title
auto *titleLabel = new QLabel(this);
titleLabel->setObjectName("titleLabel");
titleLabel->setText(_isQuit ? tr("Quit the beta program") : tr("Join the beta program"));
layout->addWidget(titleLabel);
layout->addSpacing(titleBoxVSpacing);

// Main text box
if (!_isQuit) {
auto *mainTextBox = new QLabel(this);
mainTextBox->setObjectName("largeNormalBoldTextLabel");
mainTextBox->setText(tr(
R"(Get early access to new versions of the application before they are released to the general public, and take )"
R"(part in improving the application by sending us your comments.)"));
mainTextBox->setWordWrap(true);
layout->addWidget(mainTextBox);
}

if (_isStaff) {
auto *staffLabel = new QLabel(this);
staffLabel->setObjectName("largeMediumBoldTextLabel");
staffLabel->setText(tr("Benefit from application beta updates"));
layout->addWidget(staffLabel);

_staffSelectionBox = new CustomComboBox(this);
_staffSelectionBox->insertItem(indexNo, tr("No"));
_staffSelectionBox->insertItem(indexBeta, tr("Public beta version"));
_staffSelectionBox->insertItem(indexInternal, tr("Internal beta version"));

switch (ParametersCache::instance()->parametersInfo().distributionChannel()) {
case DistributionChannel::Prod:
_initialIndex = indexNo;
break;
case DistributionChannel::Beta:
_initialIndex = indexBeta;
break;
case DistributionChannel::Internal:
_initialIndex = indexInternal;
break;
default:
break;
}
_staffSelectionBox->setCurrentIndex(_initialIndex);
layout->addWidget(_staffSelectionBox);

connect(_staffSelectionBox, &CustomComboBox::currentIndexChanged, this, &BetaProgramDialog::onChannelChange);
}

// Acknowledgment
_acknowledgmentFrame = new QFrame(this);
_acknowledgmentFrame->setStyleSheet("QFrame {border-radius: 8px; background-color: #F4F6FC;}");
_acknowledgmentFrame->setVisible(!_isStaff);
layout->addWidget(_acknowledgmentFrame);

auto *acknowledgmentLayout = new QGridLayout(this);
_acknowledgmentFrame->setLayout(acknowledgmentLayout);
acknowledgmentLayout->setSpacing(subLayoutSpacing);

auto *warningIcon = new QLabel(this);
warningIcon->setPixmap(GuiUtility::getIconWithColor(":/client/resources/icons/actions/warning.svg", iconColor)
.pixmap(QSize(iconSize, iconSize)));
warningIcon->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
acknowledgmentLayout->addWidget(warningIcon, 0, 0);

_acknowledgmentLabel = new QLabel(this);
_acknowledgmentLabel->setObjectName("largeNormalTextLabel");
if (_isQuit) {
setTooRecentMessage();
} else {
setInstabilityMessage();
}
_acknowledgmentLabel->setWordWrap(true);
_acknowledgmentLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
acknowledgmentLayout->addWidget(_acknowledgmentLabel, 0, 1);

_acknowledgmentCheckbox = new QCheckBox(tr("I understand"), this);
acknowledgmentLayout->addWidget(_acknowledgmentCheckbox, 1, 1);

if (_isQuit) {
auto *bottomTextBox = new QLabel(this);
bottomTextBox->setObjectName("largeNormalTextLabel");
bottomTextBox->setText(tr("Are you sure you want to leave the beta program?"));
bottomTextBox->setWordWrap(true);
layout->addWidget(bottomTextBox);
}

layout->addStretch();

// Buttons
auto *buttonLayout = new QHBoxLayout(this);
layout->addItem(buttonLayout);
buttonLayout->setSpacing(subLayoutSpacing);
_saveButton = new QPushButton(this);
_saveButton->setObjectName("defaultbutton");
_saveButton->setFlat(true);
_saveButton->setText(tr("Save"));
_saveButton->setEnabled(false);
buttonLayout->addWidget(_saveButton);
auto *cancelButton = new QPushButton(this);
cancelButton->setObjectName("nondefaultbutton");
cancelButton->setFlat(true);
cancelButton->setText(tr("Cancel"));
buttonLayout->addWidget(cancelButton);
buttonLayout->addStretch();

connect(_saveButton, &QPushButton::clicked, this, &BetaProgramDialog::onSave);
connect(cancelButton, &QPushButton::clicked, this, &BetaProgramDialog::reject);
connect(this, &BetaProgramDialog::exit, this, &BetaProgramDialog::reject);
connect(_acknowledgmentCheckbox, &QCheckBox::toggled, this, &BetaProgramDialog::onAcknowledgment);
}

void BetaProgramDialog::onAcknowledgment() {
_saveButton->setEnabled(_acknowledgmentCheckbox->isChecked());
}

DistributionChannel toDistributionChannel(const int index) {
switch (index) {
case indexNo:
return DistributionChannel::Prod;
case indexBeta:
return DistributionChannel::Beta;
case indexInternal:
return DistributionChannel::Internal;
default:
break;
}
return DistributionChannel::Unknown;
}

void BetaProgramDialog::onSave() {
if (_isStaff) {
_newChannel = toDistributionChannel(_staffSelectionBox->currentIndex());
} else {
if (_isQuit) {
_newChannel = DistributionChannel::Prod;
} else {
_newChannel = DistributionChannel::Beta;
}
}

accept();
}

void BetaProgramDialog::onChannelChange(const int index) {
_acknowledgmentCheckbox->setChecked(false);
if (_initialIndex == index) {
_acknowledgmentFrame->setVisible(false);
return;
}

_acknowledgmentFrame->setVisible(true);
if (index > _initialIndex)
setInstabilityMessage();
else
setTooRecentMessage();
}

void BetaProgramDialog::setTooRecentMessage() const {
_acknowledgmentLabel->setText(
tr("Your current version of the application may be too recent, your choice will be effective when the next update is "
"available."));
}

void BetaProgramDialog::setInstabilityMessage() const {
_acknowledgmentLabel->setText(tr("Beta versions may leave unexpectedly or cause instabilities."));
}

} // namespace KDC
62 changes: 62 additions & 0 deletions src/gui/betaprogramdialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Infomaniak kDrive - Desktop
* Copyright (C) 2023-2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "customcombobox.h"
#include "customdialog.h"

#include "utility/types.h"


class QLabel;
class QCheckBox;

namespace KDC {

class CustomComboBox;

class BetaProgramDialog final : public CustomDialog {
Q_OBJECT

public:
explicit BetaProgramDialog(bool isQuit, bool isStaff, QWidget *parent = nullptr);

[[nodiscard]] DistributionChannel selectedDistributionChannel() const { return _newChannel; }

private slots:
void onAcknowledgment();
void onSave();
void onChannelChange(int index);

private:
void setTooRecentMessage() const;
void setInstabilityMessage() const;

bool _isQuit{false};
bool _isStaff{false};
DistributionChannel _newChannel{DistributionChannel::Unknown};
QCheckBox *_acknowledgmentCheckbox{nullptr};
QFrame *_acknowledgmentFrame{nullptr};
QLabel *_acknowledgmentLabel{nullptr};
CustomComboBox *_staffSelectionBox{nullptr};
QPushButton *_saveButton{nullptr};
int _initialIndex{0};
};

} // namespace KDC
9 changes: 5 additions & 4 deletions src/gui/clientgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,9 @@ void ClientGui::setupSynthesisPopover() {
_workaroundManualVisibility = true;
#endif

qCInfo(lcClientGui) << "Tray menu workarounds:" << "noabouttoshow:" << _workaroundNoAboutToShowUpdate
<< "fakedoubleclick:" << _workaroundFakeDoubleClick << "showhide:" << _workaroundShowAndHideTray
<< "manualvisibility:" << _workaroundManualVisibility;
qCInfo(lcClientGui) << "Tray menu workarounds:"
<< "noabouttoshow:" << _workaroundNoAboutToShowUpdate << "fakedoubleclick:" << _workaroundFakeDoubleClick
<< "showhide:" << _workaroundShowAndHideTray << "manualvisibility:" << _workaroundManualVisibility;

connect(&_delayedTrayUpdateTimer, &QTimer::timeout, this, &ClientGui::onUpdateSystray);
_delayedTrayUpdateTimer.setInterval(2 * 1000);
Expand Down Expand Up @@ -758,7 +758,7 @@ void ClientGui::onNewDriveWizard() {

void ClientGui::onShowWindowsUpdateDialog(const VersionInfo &versionInfo) const {
static std::mutex mutex;
std::unique_lock lock(mutex, std::try_to_lock);
const std::unique_lock lock(mutex, std::try_to_lock);
if (!lock.owns_lock()) return;
if (UpdateDialog dialog(versionInfo); dialog.exec() == QDialog::Accepted) {
GuiRequests::startInstaller();
Expand Down Expand Up @@ -1016,6 +1016,7 @@ void ClientGui::onUserUpdated(const UserInfo &userInfo) {
if (userInfo.connected()) {
userInfoMapIt->second.setCredentialsAsked(false);
}
userInfoMapIt->second.setIsStaff(userInfo.isStaff());
emit userListRefreshed();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/customdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static const int resizeStripeWidth = 5;

Q_LOGGING_CATEGORY(lcCustomDialog, "gui.customdialog", QtInfoMsg)

CustomDialog::CustomDialog(bool popup, QWidget *parent) :
CustomDialog::CustomDialog(const bool popup, QWidget *parent) :
QDialog(parent), _backgroundColor(QColor()), _buttonIconColor(QColor()), _backgroundForcedColor(QColor()), _layout(nullptr) {
setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint);
setAttribute(Qt::WA_TranslucentBackground);
Expand Down
3 changes: 1 addition & 2 deletions src/gui/fixconflictingfilesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ void FixConflictingFilesDialog::onLinkActivated(const QString &link) {
}
} else {
if (!QDesktopServices::openUrl(QUrl(link))) {
CustomMessageBox msgBox(QMessageBox::Warning, tr("Unable to open link %1.").arg(link),
QMessageBox::Ok, this);
CustomMessageBox msgBox(QMessageBox::Warning, tr("Unable to open link %1.").arg(link), QMessageBox::Ok, this);
msgBox.exec();
}
}
Expand Down
Loading

0 comments on commit b1eff05

Please sign in to comment.