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()
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
QString _appPassword;
QScopedPointer<Flow2Auth> _asyncAuth;
Ui_Flow2AuthCredsPage _ui;
+
+protected slots:
+ void slotOpenBrowser();
+ void slotCopyLinkToClipboard();
};
} // namespace OCC
<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>
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);
_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
QString _appPassword;
QScopedPointer<Flow2Auth> _asyncAuth;
Ui_Flow2AuthWidget _ui;
+
+protected slots:
+ void slotOpenBrowser();
+ void slotCopyLinkToClipboard();
};
}
<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>
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()
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
QString _refreshToken;
QScopedPointer<OAuth> _asyncAuth;
Ui_OwncloudOAuthCredsPage _ui;
+
+protected slots:
+ void slotOpenBrowser();
+ void slotCopyLinkToClipboard();
};
} // namespace OCC
</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>
<item>
<spacer name="verticalSpacer">
<property name="orientation">