-
Notifications
You must be signed in to change notification settings - Fork 817
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a wizard page to check terms of service
should enable proper polling while the user check and signs the terms of service via teh web browser Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
- Loading branch information
Showing
8 changed files
with
154 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
Check notice on line 1 in src/gui/wizard/termsofservicewizardpage.cpp
|
||
* Copyright (C) by Matthieu Gallien <matthieu.gallien@nextcloud.com> | ||
* | ||
* 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 "termsofservicewizardpage.h" | ||
|
||
#include "account.h" | ||
#include "owncloudsetupwizard.h" | ||
#include "wizard/owncloudwizard.h" | ||
#include "wizard/owncloudwizardcommon.h" | ||
#include "connectionvalidator.h" | ||
|
||
#include <QVBoxLayout> | ||
#include <QDesktopServices> | ||
|
||
namespace OCC { | ||
|
||
OCC::TermsOfServiceWizardPage::TermsOfServiceWizardPage() | ||
: QWizardPage() | ||
{ | ||
_layout = new QVBoxLayout(this); | ||
} | ||
|
||
void OCC::TermsOfServiceWizardPage::initializePage() | ||
{ | ||
} | ||
|
||
void OCC::TermsOfServiceWizardPage::cleanupPage() | ||
{ | ||
} | ||
|
||
int OCC::TermsOfServiceWizardPage::nextId() const | ||
{ | ||
return WizardCommon::Page_AdvancedSetup; | ||
} | ||
|
||
bool OCC::TermsOfServiceWizardPage::isComplete() const | ||
{ | ||
return false; | ||
} | ||
|
||
void TermsOfServiceWizardPage::slotPollNow() | ||
{ | ||
_termsOfServiceChecker = new TermsOfServiceChecker{_ocWizard->account(), this}; | ||
|
||
connect(_termsOfServiceChecker, &TermsOfServiceChecker::done, this, &TermsOfServiceWizardPage::termsOfServiceChecked); | ||
_termsOfServiceChecker->start(); | ||
} | ||
|
||
void TermsOfServiceWizardPage::termsOfServiceChecked() | ||
{ | ||
if (_termsOfServiceChecker && _termsOfServiceChecker->needToSign()) { | ||
QDesktopServices::openUrl(_ocWizard->account()->url()); | ||
} else { | ||
_ocWizard->successfulStep(); | ||
delete _termsOfServiceChecker; | ||
_termsOfServiceChecker = nullptr; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (C) by Matthieu Gallien <matthieu.gallien@nextcloud.com> | ||
* | ||
* 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 TERMSOFSERVICEWIZARDPAGE_H | ||
#define TERMSOFSERVICEWIZARDPAGE_H | ||
|
||
#include <QWizardPage> | ||
|
||
class QVBoxLayout; | ||
|
||
namespace OCC { | ||
|
||
class OwncloudWizard; | ||
class TermsOfServiceChecker; | ||
|
||
class TermsOfServiceWizardPage : public QWizardPage | ||
{ | ||
Q_OBJECT | ||
public: | ||
TermsOfServiceWizardPage(); | ||
|
||
void initializePage() override; | ||
void cleanupPage() override; | ||
[[nodiscard]] int nextId() const override; | ||
[[nodiscard]] bool isComplete() const override; | ||
|
||
Q_SIGNALS: | ||
void connectToOCUrl(const QString &); | ||
void pollNow(); | ||
|
||
private Q_SLOTS: | ||
void slotPollNow(); | ||
void termsOfServiceChecked(); | ||
|
||
private: | ||
QVBoxLayout *_layout = nullptr; | ||
OwncloudWizard *_ocWizard = nullptr; | ||
TermsOfServiceChecker *_termsOfServiceChecker = nullptr; | ||
}; | ||
|
||
} // namespace OCC | ||
|
||
#endif // TERMSOFSERVICEWIZARDPAGE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters