Skip to content

Commit

Permalink
Patched stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugen Fischer authored and Eugen Fischer committed Jan 6, 2024
1 parent 344fc08 commit 5991c50
Show file tree
Hide file tree
Showing 13 changed files with 242 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ set(client_SRCS
filedetails/shareemodel.cpp
filedetails/sortedsharemodel.h
filedetails/sortedsharemodel.cpp
nmcgui/nmcflow2authwidget.h
nmcgui/nmcflow2authwidget.cpp
nmcgui/nmcowncloudadvancedsetuppage.h
nmcgui/nmcowncloudadvancedsetuppage.cpp
tray/svgimageprovider.h
tray/svgimageprovider.cpp
tray/syncstatussummary.h
Expand Down
81 changes: 81 additions & 0 deletions src/gui/nmcgui/nmcflow2authwidget.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Copyright (C) by Eugen Fischer
*
* 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 2 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.
*/

#include "nmcflow2authwidget.h"

#include "QPushButton"
#include "QDesktopServices"
#include "QtGui/qpainter.h"
#include "theme.h"
#include "QString"
#include <MacTypes.h>

namespace OCC {


NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent)
: Flow2AuthWidget(parent)
{
_ui.copyLinkLabel->setVisible(false);
_ui.openLinkLabel->setVisible(false);

//Create and connect the push buttons to base slots
auto copyLinkButton = new QPushButton(tr("Copy Link"));
connect(copyLinkButton, &QPushButton::clicked, this, [this](){
slotCopyLinkToClipboard();
});
auto reopenBrowserButton = new QPushButton(tr("Reopen Browser"));
connect(reopenBrowserButton, &QPushButton::clicked, this, [this](){
slotOpenBrowser();
});

//Create a layout where we put our new buttons.
auto hLayout = new QHBoxLayout(this);
auto spacerLeft = new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed);
auto spacerRight = new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed);
hLayout->addSpacerItem(spacerLeft);
hLayout->addWidget(copyLinkButton);
hLayout->addWidget(reopenBrowserButton);
hLayout->addSpacerItem(spacerRight);

hLayout->setSpacing(10); //its not defined in jira ticket https://jira.telekom.de/browse/NMC-2380

//According to Jira ticket https://jira.telekom.de/browse/NMC-2380
QSize buttonSize(176,32);
copyLinkButton->setFixedSize(buttonSize);
reopenBrowserButton->setFixedSize(buttonSize);

//Now add the layout to base layout
_ui.verticalLayout_3->addLayout(hLayout);

//Make sure the first button wont get focus. It will be assigned to second button (reopenBrowserButton)
copyLinkButton->setFocusPolicy(Qt::NoFocus);

//Apply custom Pushbutton ui modifications, colors are set globaly in style.qml or theme?
const QString styleSheet("QPushButton{font-size: 14px;font-family: Segoe; border: %1px solid; border-color: black; border-radius: 10px; background-color: %2; color: %3}");
copyLinkButton->setStyleSheet(styleSheet.arg("1","white","black"));
reopenBrowserButton->setStyleSheet(styleSheet.arg("0","#E20074","white"));
}

void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event)
{
QPainter painter;
painter.begin(this);
painter.fillRect(rect(), Qt::white);
painter.end();
Flow2AuthWidget::paintEvent(event);
}


} // namespace OCC
35 changes: 35 additions & 0 deletions src/gui/nmcgui/nmcflow2authwidget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) by Michael Schuster <[email protected]>
*
* 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 2 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.
*/

#ifndef NMCFLOW2AUTHWIDGET_H
#define NMCFLOW2AUTHWIDGET_H

#include "wizard/flow2authwidget.h"

namespace OCC {

class NMCFlow2AuthWidget : public Flow2AuthWidget
{
Q_OBJECT
public:
NMCFlow2AuthWidget(QWidget *parent = nullptr);
~NMCFlow2AuthWidget() = default;

protected:
void paintEvent(QPaintEvent *event) override;
};

} // namespace OCC

#endif // NMCFLOW2AUTHWIDGET_H
42 changes: 42 additions & 0 deletions src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (C) by Eugen Fischer
*
* 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 2 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.
*/

#include "nmcgui/nmcowncloudadvancedsetuppage.h"
#include "QtGui/qpainter.h"

namespace OCC {

NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard)
: OwncloudAdvancedSetupPage(wizard)

{
_ui.confCheckBoxSize->setVisible(false);
_ui.confSpinBox->setVisible(false);
_ui.confTraillingSizeLabel->setVisible(false);
_ui.confCheckBoxSize->setFixedSize(0,0);
_ui.confSpinBox->setFixedSize(0,0);
_ui.confTraillingSizeLabel->setFixedSize(0,0);
_ui.wSyncStrategy->removeItem(_ui.horizontalLayout_6);

_ui.confCheckBoxExternal->setVisible(false);
_ui.confCheckBoxExternal->setFixedSize(0,0);
_ui.wSyncStrategy->removeItem(_ui.horizontalLayout_8);

_ui.verticalLayout->removeWidget(_ui.errorLabel);
_ui.wSyncStrategy->insertWidget(0, _ui.errorLabel);

_ui.lServerIcon->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
}

} // namespace OCC
39 changes: 39 additions & 0 deletions src/gui/nmcgui/nmcowncloudadvancedsetuppage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (C) by Eugen Fischer
*
* 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 2 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.
*/

#ifndef MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H
#define MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H

#include "wizard/owncloudadvancedsetuppage.h"


namespace OCC {

/**
* @brief The NMCOwncloudAdvancedSetupPage class
* @ingroup gui
*/

class NMCOwncloudAdvancedSetupPage : public OwncloudAdvancedSetupPage
{
Q_OBJECT

public:
NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard);
~NMCOwncloudAdvancedSetupPage() = default;
};

} // namespace OCC

#endif
4 changes: 3 additions & 1 deletion src/gui/wizard/flow2authcredspage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <QVBoxLayout>

#include "flow2authcredspage.h"
#include "QtGui/qpainter.h"
#include "nmcgui/nmcflow2authwidget.h"
#include "theme.h"
#include "account.h"
#include "cookiejar.h"
Expand All @@ -33,7 +35,7 @@ Flow2AuthCredsPage::Flow2AuthCredsPage()
{
_layout = new QVBoxLayout(this);

_flow2AuthWidget = new Flow2AuthWidget();
_flow2AuthWidget = new NMCFlow2AuthWidget();
_layout->addWidget(_flow2AuthWidget);

connect(_flow2AuthWidget, &Flow2AuthWidget::authResult, this, &Flow2AuthCredsPage::slotFlow2AuthResult);
Expand Down
4 changes: 3 additions & 1 deletion src/gui/wizard/flow2authwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ public Q_SLOTS:
void authResult(Flow2Auth::Result, const QString &errorString, const QString &user, const QString &appPassword);
void pollNow();

protected:
Ui_Flow2AuthWidget _ui{};

private:
Account *_account = nullptr;
QScopedPointer<Flow2Auth> _asyncAuth;
Ui_Flow2AuthWidget _ui{};

protected slots:
void slotOpenBrowser();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/wizard/owncloudadvancedsetuppage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ void OwncloudAdvancedSetupPage::customizeStyle()
void OwncloudAdvancedSetupPage::styleLocalFolderLabel()
{
const auto backgroundColor = palette().window().color();
const auto folderIconFileName = Theme::instance()->isBranded() ? Theme::hidpiFileName("folder.png", backgroundColor)
const auto folderIconFileName = Theme::instance()->isBranded() ? Theme::hidpiFileName("computer-icon.png", backgroundColor)
: Theme::hidpiFileName(":/client/theme/colored/folder.png");
_ui.lLocal->setPixmap(folderIconFileName);
}
Expand Down
6 changes: 5 additions & 1 deletion src/gui/wizard/owncloudadvancedsetuppage.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class OwncloudAdvancedSetupPage : public QWizardPage
void setMultipleFoldersExist(bool exist);
void directoriesCreated();

Ui_OwncloudAdvancedSetupPage ui() const;

signals:
void createLocalAndRemoteFolders(const QString &, const QString &);

Expand All @@ -64,6 +66,9 @@ private slots:
void slotVirtualFileSyncClicked();
void slotQuotaRetrieved(const QVariantMap &result);

protected:
Ui_OwncloudAdvancedSetupPage _ui{};

private:
void setRadioChecked(QRadioButton *radio);

Expand All @@ -87,7 +92,6 @@ private slots:
// TODO: remove when UX decision is made
void refreshVirtualFilesAvailibility(const QString &path);

Ui_OwncloudAdvancedSetupPage _ui{};
bool _checking = false;
bool _created = false;
bool _localFolderValid = false;
Expand Down
19 changes: 15 additions & 4 deletions src/gui/wizard/owncloudwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "account.h"
#include "config.h"
#include "configfile.h"
#include "nmcgui/nmcowncloudadvancedsetuppage.h"
#include "theme.h"
#include "owncloudgui.h"

Expand Down Expand Up @@ -49,7 +50,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
, _setupPage(new OwncloudSetupPage(this))
, _httpCredsPage(new OwncloudHttpCredsPage(this))
, _flow2CredsPage(new Flow2AuthCredsPage)
, _advancedSetupPage(new OwncloudAdvancedSetupPage(this))
, _advancedSetupPage(new NMCOwncloudAdvancedSetupPage(this))
#ifdef WITH_WEBENGINE
, _webViewPage(new WebViewPage(this))
#else // WITH_WEBENGINE
Expand All @@ -58,6 +59,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
{
setObjectName("owncloudWizard");


setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setPage(WizardCommon::Page_Welcome, _welcomePage);
setPage(WizardCommon::Page_ServerSetup, _setupPage);
Expand Down Expand Up @@ -87,7 +89,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)

Theme *theme = Theme::instance();
setWindowTitle(tr("Add %1 account").arg(theme->appNameGUI()));
setWizardStyle(QWizard::ModernStyle);
setWizardStyle(QWizard::ClassicStyle);
setOption(QWizard::NoBackButtonOnStartPage);
setOption(QWizard::NoCancelButton);
setButtonText(QWizard::CustomButton1, tr("Skip folders configuration"));
Expand Down Expand Up @@ -306,9 +308,9 @@ void OwncloudWizard::slotCurrentPageChanged(int id)
id == WizardCommon::Page_WebView ||
#endif // WITH_WEBENGINE
id == WizardCommon::Page_Flow2AuthCreds) {
setButtonLayout({ QWizard::BackButton, QWizard::Stretch });
setButtonLayout({ QWizard::Stretch });
} else if (id == WizardCommon::Page_AdvancedSetup) {
setButtonLayout({ QWizard::CustomButton2, QWizard::Stretch, QWizard::CustomButton1, QWizard::FinishButton });
setButtonLayout({ QWizard::Stretch, QWizard::FinishButton });
setNextButtonAsDefault();
} else {
setButtonLayout({ QWizard::BackButton, QWizard::Stretch, QWizard::NextButton });
Expand Down Expand Up @@ -385,6 +387,15 @@ void OwncloudWizard::changeEvent(QEvent *e)
QWizard::changeEvent(e);
}

void OwncloudWizard::paintEvent(QPaintEvent *event)
{
QPainter painter;
painter.begin(this);
painter.fillRect(rect(), Qt::white);
painter.end();
QWizard::paintEvent(event);
}

void OwncloudWizard::customizeStyle()
{
// HINT: Customize wizard's own style here, if necessary in the future (Dark-/Light-Mode switching)
Expand Down
1 change: 1 addition & 0 deletions src/gui/wizard/owncloudwizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public slots:

protected:
void changeEvent(QEvent *) override;
void paintEvent(QPaintEvent *event) override;

private:
void customizeStyle();
Expand Down
10 changes: 10 additions & 0 deletions theme/black/computer-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion theme/sync-arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5991c50

Please sign in to comment.