diff options
author | Camila Ayres <hello@camila.codes> | 2019-09-06 18:56:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-06 18:56:09 +0300 |
commit | acb9fc7c8eeb194fd1caefbcf6b4723baae98736 (patch) | |
tree | 1ca954d1c26c439a06ece25cc7bb1bd6ea74ff56 | |
parent | a70b7d5852ad1afa3449d16cc379043cb2baec23 (diff) | |
parent | 081f9741e432a7ca17cf0cf4d13eef92ab0e7448 (diff) |
Merge pull request #1408 from nextcloud/flow2-ui-qt5-compat
Qt5.5 compatiblity patch for login flow V2 + UI improvement
-rw-r--r-- | admin/linux/debian/debian.xenial/post-patches/qt5.5-compat.patch | 40 | ||||
-rw-r--r-- | src/gui/wizard/flow2authcredspage.cpp | 32 | ||||
-rw-r--r-- | src/gui/wizard/flow2authcredspage.h | 4 | ||||
-rw-r--r-- | src/gui/wizard/flow2authcredspage.ui | 15 | ||||
-rw-r--r-- | src/gui/wizard/flow2authwidget.cpp | 32 | ||||
-rw-r--r-- | src/gui/wizard/flow2authwidget.h | 4 | ||||
-rw-r--r-- | src/gui/wizard/flow2authwidget.ui | 15 | ||||
-rw-r--r-- | src/gui/wizard/owncloudoauthcredspage.cpp | 32 | ||||
-rw-r--r-- | src/gui/wizard/owncloudoauthcredspage.h | 4 | ||||
-rw-r--r-- | src/gui/wizard/owncloudoauthcredspage.ui | 13 |
10 files changed, 104 insertions, 87 deletions
diff --git a/admin/linux/debian/debian.xenial/post-patches/qt5.5-compat.patch b/admin/linux/debian/debian.xenial/post-patches/qt5.5-compat.patch index f6475205c..70c71d462 100644 --- a/admin/linux/debian/debian.xenial/post-patches/qt5.5-compat.patch +++ b/admin/linux/debian/debian.xenial/post-patches/qt5.5-compat.patch @@ -1,43 +1,3 @@ ---- nextcloud-client-2.4.0.orig/src/gui/wizard/owncloudoauthcredspage.cpp -+++ nextcloud-client-2.4.0/src/gui/wizard/owncloudoauthcredspage.cpp -@@ -53,10 +53,8 @@ OwncloudOAuthCredsPage::OwncloudOAuthCredsPage() - _ui.openLinkButton->setContextMenuPolicy(Qt::CustomContextMenu); - QObject::connect(_ui.openLinkButton, &QWidget::customContextMenuRequested, [this](const QPoint &pos) { - auto menu = new QMenu(_ui.openLinkButton); -- menu->addAction(tr("Copy link to clipboard"), this, [this] { -- if (_asyncAuth) -- QApplication::clipboard()->setText(_asyncAuth->authorisationLink().toString(QUrl::FullyEncoded)); -- }); -+ auto action = menu->addAction(tr("Copy link to clipboard")); -+ connect(action, &QAction::triggered, this, &OwncloudOAuthCredsPage::copyLinkToClipboard); - menu->setAttribute(Qt::WA_DeleteOnClose); - menu->popup(_ui.openLinkButton->mapToGlobal(pos)); - }); -@@ -131,4 +129,11 @@ bool OwncloudOAuthCredsPage::isComplete() const - return false; /* We can never go forward manually */ - } - -+void OwncloudOAuthCredsPage::copyLinkToClipboard() -+{ -+ if (_asyncAuth) -+ QApplication::clipboard()->setText(_asyncAuth->authorisationLink().toString(QUrl::FullyEncoded)); -+} -+ -+ - } // namespace OCC ---- nextcloud-client-2.4.0.orig/src/gui/wizard/owncloudoauthcredspage.h -+++ nextcloud-client-2.4.0/src/gui/wizard/owncloudoauthcredspage.h -@@ -57,6 +57,10 @@ public: - QString _refreshToken; - QScopedPointer<OAuth> _asyncAuth; - Ui_OwncloudOAuthCredsPage _ui; -+ -+protected slots: -+ void copyLinkToClipboard(); -+ - }; - - } // namespace OCC --- nextcloud-client-2.5.3.orig/src/3rdparty/kmessagewidget/kmessagewidget.cpp 2019-07-26 18:40:34.949349387 +0000 +++ nextcloud-client-2.5.3/src/3rdparty/kmessagewidget/kmessagewidget.cpp 2019-07-26 18:41:39.866478051 +0000 @@ -105,6 +105,9 @@ diff --git a/src/gui/wizard/flow2authcredspage.cpp b/src/gui/wizard/flow2authcredspage.cpp index a368d6043..165752663 100644 --- a/src/gui/wizard/flow2authcredspage.cpp +++ b/src/gui/wizard/flow2authcredspage.cpp @@ -46,21 +46,8 @@ Flow2AuthCredsPage::Flow2AuthCredsPage() setTitle(WizardCommon::titleTemplate().arg(tr("Connect to %1").arg(Theme::instance()->appNameGUI()))); setSubTitle(WizardCommon::subTitleTemplate().arg(tr("Login in your browser (Login Flow v2)"))); - connect(_ui.openLinkButton, &QCommandLinkButton::clicked, [this] { - _ui.errorLabel->hide(); - if (_asyncAuth) - _asyncAuth->openBrowser(); - }); - _ui.openLinkButton->setContextMenuPolicy(Qt::CustomContextMenu); - QObject::connect(_ui.openLinkButton, &QWidget::customContextMenuRequested, [this](const QPoint &pos) { - auto menu = new QMenu(_ui.openLinkButton); - menu->addAction(tr("Copy link to clipboard"), this, [this] { - if (_asyncAuth) - QApplication::clipboard()->setText(_asyncAuth->authorisationLink().toString(QUrl::FullyEncoded)); - }); - menu->setAttribute(Qt::WA_DeleteOnClose); - menu->popup(_ui.openLinkButton->mapToGlobal(pos)); - }); + connect(_ui.openLinkButton, &QCommandLinkButton::clicked, this, &Flow2AuthCredsPage::slotOpenBrowser); + connect(_ui.copyLinkButton, &QCommandLinkButton::clicked, this, &Flow2AuthCredsPage::slotCopyLinkToClipboard); } void Flow2AuthCredsPage::initializePage() @@ -146,4 +133,19 @@ bool Flow2AuthCredsPage::isComplete() const return false; /* We can never go forward manually */ } +void Flow2AuthCredsPage::slotOpenBrowser() +{ + if (_ui.errorLabel) + _ui.errorLabel->hide(); + + if (_asyncAuth) + _asyncAuth->openBrowser(); +} + +void Flow2AuthCredsPage::slotCopyLinkToClipboard() +{ + if (_asyncAuth) + QApplication::clipboard()->setText(_asyncAuth->authorisationLink().toString(QUrl::FullyEncoded)); +} + } // namespace OCC diff --git a/src/gui/wizard/flow2authcredspage.h b/src/gui/wizard/flow2authcredspage.h index bffcf68b3..f51d7d7f3 100644 --- a/src/gui/wizard/flow2authcredspage.h +++ b/src/gui/wizard/flow2authcredspage.h @@ -56,6 +56,10 @@ public: QString _appPassword; QScopedPointer<Flow2Auth> _asyncAuth; Ui_Flow2AuthCredsPage _ui; + +protected slots: + void slotOpenBrowser(); + void slotCopyLinkToClipboard(); }; } // namespace OCC diff --git a/src/gui/wizard/flow2authcredspage.ui b/src/gui/wizard/flow2authcredspage.ui index 04c1d7217..37d2b8f53 100644 --- a/src/gui/wizard/flow2authcredspage.ui +++ b/src/gui/wizard/flow2authcredspage.ui @@ -53,7 +53,20 @@ <item> <widget class="QCommandLinkButton" name="openLinkButton"> <property name="text"> - <string>Re-open Browser (or right-click to copy link)</string> + <string>Re-open Browser</string> + </property> + </widget> + </item> + <item> + <widget class="QCommandLinkButton" name="copyLinkButton"> + <property name="font"> + <font> + <weight>50</weight> + <bold>false</bold> + </font> + </property> + <property name="text"> + <string>Copy link</string> </property> </widget> </item> diff --git a/src/gui/wizard/flow2authwidget.cpp b/src/gui/wizard/flow2authwidget.cpp index 300b2e83d..c050a54d0 100644 --- a/src/gui/wizard/flow2authwidget.cpp +++ b/src/gui/wizard/flow2authwidget.cpp @@ -50,21 +50,8 @@ Flow2AuthWidget::Flow2AuthWidget(Account *account, QWidget *parent) WizardCommon::initErrorLabel(_ui.errorLabel); - connect(_ui.openLinkButton, &QCommandLinkButton::clicked, [this] { - _ui.errorLabel->hide(); - if (_asyncAuth) - _asyncAuth->openBrowser(); - }); - _ui.openLinkButton->setContextMenuPolicy(Qt::CustomContextMenu); - QObject::connect(_ui.openLinkButton, &QWidget::customContextMenuRequested, [this](const QPoint &pos) { - auto menu = new QMenu(_ui.openLinkButton); - menu->addAction(tr("Copy link to clipboard"), this, [this] { - if (_asyncAuth) - QApplication::clipboard()->setText(_asyncAuth->authorisationLink().toString(QUrl::FullyEncoded)); - }); - menu->setAttribute(Qt::WA_DeleteOnClose); - menu->popup(_ui.openLinkButton->mapToGlobal(pos)); - }); + connect(_ui.openLinkButton, &QCommandLinkButton::clicked, this, &Flow2AuthWidget::slotOpenBrowser); + connect(_ui.copyLinkButton, &QCommandLinkButton::clicked, this, &Flow2AuthWidget::slotCopyLinkToClipboard); _asyncAuth.reset(new Flow2Auth(_account, this)); connect(_asyncAuth.data(), &Flow2Auth::result, this, &Flow2AuthWidget::asyncAuthResult, Qt::QueuedConnection); @@ -110,4 +97,19 @@ Flow2AuthWidget::~Flow2AuthWidget() { _user.clear(); } +void Flow2AuthWidget::slotOpenBrowser() +{ + if (_ui.errorLabel) + _ui.errorLabel->hide(); + + if (_asyncAuth) + _asyncAuth->openBrowser(); +} + +void Flow2AuthWidget::slotCopyLinkToClipboard() +{ + if (_asyncAuth) + QApplication::clipboard()->setText(_asyncAuth->authorisationLink().toString(QUrl::FullyEncoded)); } + +} // namespace OCC diff --git a/src/gui/wizard/flow2authwidget.h b/src/gui/wizard/flow2authwidget.h index cf04d9193..7fe1844c1 100644 --- a/src/gui/wizard/flow2authwidget.h +++ b/src/gui/wizard/flow2authwidget.h @@ -45,6 +45,10 @@ private: QString _appPassword; QScopedPointer<Flow2Auth> _asyncAuth; Ui_Flow2AuthWidget _ui; + +protected slots: + void slotOpenBrowser(); + void slotCopyLinkToClipboard(); }; } diff --git a/src/gui/wizard/flow2authwidget.ui b/src/gui/wizard/flow2authwidget.ui index e73ae6a1d..7de44675f 100644 --- a/src/gui/wizard/flow2authwidget.ui +++ b/src/gui/wizard/flow2authwidget.ui @@ -65,7 +65,20 @@ <item> <widget class="QCommandLinkButton" name="openLinkButton"> <property name="text"> - <string>Re-open Browser (or right-click to copy link)</string> + <string>Re-open Browser</string> + </property> + </widget> + </item> + <item> + <widget class="QCommandLinkButton" name="copyLinkButton"> + <property name="font"> + <font> + <weight>50</weight> + <bold>false</bold> + </font> + </property> + <property name="text"> + <string>Copy link</string> </property> </widget> </item> diff --git a/src/gui/wizard/owncloudoauthcredspage.cpp b/src/gui/wizard/owncloudoauthcredspage.cpp index 174aa05c4..0d4c40ea7 100644 --- a/src/gui/wizard/owncloudoauthcredspage.cpp +++ b/src/gui/wizard/owncloudoauthcredspage.cpp @@ -45,21 +45,8 @@ OwncloudOAuthCredsPage::OwncloudOAuthCredsPage() setTitle(WizardCommon::titleTemplate().arg(tr("Connect to %1").arg(Theme::instance()->appNameGUI()))); setSubTitle(WizardCommon::subTitleTemplate().arg(tr("Login in your browser"))); - connect(_ui.openLinkButton, &QCommandLinkButton::clicked, [this] { - _ui.errorLabel->hide(); - if (_asyncAuth) - _asyncAuth->openBrowser(); - }); - _ui.openLinkButton->setContextMenuPolicy(Qt::CustomContextMenu); - QObject::connect(_ui.openLinkButton, &QWidget::customContextMenuRequested, [this](const QPoint &pos) { - auto menu = new QMenu(_ui.openLinkButton); - menu->addAction(tr("Copy link to clipboard"), this, [this] { - if (_asyncAuth) - QApplication::clipboard()->setText(_asyncAuth->authorisationLink().toString(QUrl::FullyEncoded)); - }); - menu->setAttribute(Qt::WA_DeleteOnClose); - menu->popup(_ui.openLinkButton->mapToGlobal(pos)); - }); + connect(_ui.openLinkButton, &QCommandLinkButton::clicked, this, &OwncloudOAuthCredsPage::slotOpenBrowser); + connect(_ui.copyLinkButton, &QCommandLinkButton::clicked, this, &OwncloudOAuthCredsPage::slotCopyLinkToClipboard); } void OwncloudOAuthCredsPage::initializePage() @@ -133,4 +120,19 @@ bool OwncloudOAuthCredsPage::isComplete() const return false; /* We can never go forward manually */ } +void OwncloudOAuthCredsPage::slotOpenBrowser() +{ + if (_ui.errorLabel) + _ui.errorLabel->hide(); + + if (_asyncAuth) + _asyncAuth->openBrowser(); +} + +void OwncloudOAuthCredsPage::slotCopyLinkToClipboard() +{ + if (_asyncAuth) + QApplication::clipboard()->setText(_asyncAuth->authorisationLink().toString(QUrl::FullyEncoded)); +} + } // namespace OCC diff --git a/src/gui/wizard/owncloudoauthcredspage.h b/src/gui/wizard/owncloudoauthcredspage.h index 32341eb1c..efbc9a69b 100644 --- a/src/gui/wizard/owncloudoauthcredspage.h +++ b/src/gui/wizard/owncloudoauthcredspage.h @@ -57,6 +57,10 @@ public: QString _refreshToken; QScopedPointer<OAuth> _asyncAuth; Ui_OwncloudOAuthCredsPage _ui; + +protected slots: + void slotOpenBrowser(); + void slotCopyLinkToClipboard(); }; } // namespace OCC diff --git a/src/gui/wizard/owncloudoauthcredspage.ui b/src/gui/wizard/owncloudoauthcredspage.ui index 2c3a79ed2..03682cae1 100644 --- a/src/gui/wizard/owncloudoauthcredspage.ui +++ b/src/gui/wizard/owncloudoauthcredspage.ui @@ -58,6 +58,19 @@ </widget> </item> <item> + <widget class="QCommandLinkButton" name="copyLinkButton"> + <property name="font"> + <font> + <weight>50</weight> + <bold>false</bold> + </font> + </property> + <property name="text"> + <string>Copy link</string> + </property> + </widget> + </item> + <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> |