Skip to content

Commit

Permalink
Wizard: Move the 'Skip folder configuration' in a radio button
Browse files Browse the repository at this point in the history
Issue #3664
  • Loading branch information
ogoffart committed Apr 19, 2018
1 parent a5271b5 commit 5a13ef3
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 30 deletions.
24 changes: 5 additions & 19 deletions src/gui/owncloudsetupwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ OwncloudSetupWizard::OwncloudSetupWizard(QObject *parent)
connect(_ocWizard, &OwncloudWizard::basicSetupFinished,
this, &OwncloudSetupWizard::slotAssistantFinished, Qt::QueuedConnection);
connect(_ocWizard, &QDialog::finished, this, &QObject::deleteLater);
connect(_ocWizard, &OwncloudWizard::skipFolderConfiguration, this, &OwncloudSetupWizard::slotSkipFolderConfiguration);
}

OwncloudSetupWizard::~OwncloudSetupWizard()
Expand Down Expand Up @@ -597,15 +596,12 @@ bool OwncloudSetupWizard::ensureStartFromScratch(const QString &localFolder)
// Method executed when the user end has finished the basic setup.
void OwncloudSetupWizard::slotAssistantFinished(int result)
{
FolderMan *folderMan = FolderMan::instance();

if (result == QDialog::Rejected) {
qCInfo(lcWizard) << "Rejected the new config, use the old!";

} else if (result == QDialog::Accepted) {
// This may or may not wipe all folder definitions, depending
// on whether a new account is activated or the existing one
// is changed.
// Wizard was cancelled
} else if (_ocWizard->manualFolderConfig()) {
applyAccountChanges();
} else {
FolderMan *folderMan = FolderMan::instance();
auto account = applyAccountChanges();

QString localFolder = FolderDefinition::prepareLocalPath(_ocWizard->localFolder());
Expand Down Expand Up @@ -639,16 +635,6 @@ void OwncloudSetupWizard::slotAssistantFinished(int result)
emit ownCloudWizardDone(result);
}

void OwncloudSetupWizard::slotSkipFolderConfiguration()
{
applyAccountChanges();

disconnect(_ocWizard, &OwncloudWizard::basicSetupFinished,
this, &OwncloudSetupWizard::slotAssistantFinished);
_ocWizard->close();
emit ownCloudWizardDone(QDialog::Accepted);
}

AccountState *OwncloudSetupWizard::applyAccountChanges()
{
AccountPtr newAccount = _ocWizard->account();
Expand Down
1 change: 0 additions & 1 deletion src/gui/owncloudsetupwizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ private slots:
void slotRemoteFolderExists(QNetworkReply *);
void slotCreateRemoteFolderFinished(QNetworkReply::NetworkError);
void slotAssistantFinished(int);
void slotSkipFolderConfiguration();

private:
explicit OwncloudSetupWizard(QObject *parent = 0);
Expand Down
6 changes: 6 additions & 0 deletions src/gui/wizard/owncloudadvancedsetuppage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ OwncloudAdvancedSetupPage::OwncloudAdvancedSetupPage()
connect(_ui.rSelectiveSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSelectiveSyncClicked);
connect(_ui.rPlaceholderSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotPlaceholderSyncClicked);
connect(_ui.bSelectiveSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSelectiveSyncClicked);
connect(_ui.rManualFolder, &QAbstractButton::clicked, this, [this] { setRadioChecked(_ui.rManualFolder); });

QIcon appIcon = theme->applicationIcon();
_ui.lServerIcon->setText(QString());
Expand Down Expand Up @@ -237,6 +238,11 @@ bool OwncloudAdvancedSetupPage::usePlaceholderSync() const
return _ui.rPlaceholderSync->isChecked();
}

bool OwncloudAdvancedSetupPage::manualFolderConfig() const
{
return _ui.rManualFolder->isChecked();
}

bool OwncloudAdvancedSetupPage::isConfirmBigFolderChecked() const
{
return _ui.rSyncEverything->isChecked() && _ui.confCheckBoxSize->isChecked();
Expand Down
1 change: 1 addition & 0 deletions src/gui/wizard/owncloudadvancedsetuppage.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class OwncloudAdvancedSetupPage : public QWizardPage
QString localFolder() const;
QStringList selectiveSyncBlacklist() const;
bool usePlaceholderSync() const;
bool manualFolderConfig() const;
bool isConfirmBigFolderChecked() const;
void setRemoteFolder(const QString &remoteFolder);
void setMultipleFoldersExist(bool exist);
Expand Down
119 changes: 113 additions & 6 deletions src/gui/wizard/owncloudadvancedsetuppage.ui
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,36 @@
</item>
<item>
<layout class="QHBoxLayout" name="lPlaceholderSync">
<item>
<widget class="QRadioButton" name="rManualFolder">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Manually create custom synchroni&amp;zation folders</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QRadioButton" name="rPlaceholderSync">
<property name="sizePolicy">
Expand All @@ -391,15 +421,15 @@
</sizepolicy>
</property>
<property name="text">
<string>Create placeholders instead of downloading files (experimental)</string>
<string>Create placeholders instead of downloading files (e&amp;xperimental)</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
Expand Down Expand Up @@ -456,6 +486,19 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>rSyncEverything</tabstop>
<tabstop>confCheckBoxSize</tabstop>
<tabstop>confSpinBox</tabstop>
<tabstop>confCheckBoxExternal</tabstop>
<tabstop>rSelectiveSync</tabstop>
<tabstop>bSelectiveSync</tabstop>
<tabstop>rManualFolder</tabstop>
<tabstop>rPlaceholderSync</tabstop>
<tabstop>pbSelectLocalFolder</tabstop>
<tabstop>radioButton</tabstop>
<tabstop>cbSyncFromScratch</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
Expand Down Expand Up @@ -485,8 +528,8 @@
<y>83</y>
</hint>
<hint type="destinationlabel">
<x>952</x>
<y>134</y>
<x>864</x>
<y>147</y>
</hint>
</hints>
</connection>
Expand All @@ -501,8 +544,8 @@
<y>76</y>
</hint>
<hint type="destinationlabel">
<x>1076</x>
<y>136</y>
<x>902</x>
<y>147</y>
</hint>
</hints>
</connection>
Expand All @@ -522,5 +565,69 @@
</hint>
</hints>
</connection>
<connection>
<sender>rManualFolder</sender>
<signal>toggled(bool)</signal>
<receiver>pbSelectLocalFolder</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>197</x>
<y>269</y>
</hint>
<hint type="destinationlabel">
<x>219</x>
<y>404</y>
</hint>
</hints>
</connection>
<connection>
<sender>rManualFolder</sender>
<signal>toggled(bool)</signal>
<receiver>resolutionWidget</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>260</x>
<y>266</y>
</hint>
<hint type="destinationlabel">
<x>443</x>
<y>437</y>
</hint>
</hints>
</connection>
<connection>
<sender>rManualFolder</sender>
<signal>toggled(bool)</signal>
<receiver>lLocal</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>163</x>
<y>267</y>
</hint>
<hint type="destinationlabel">
<x>88</x>
<y>438</y>
</hint>
</hints>
</connection>
<connection>
<sender>rManualFolder</sender>
<signal>toggled(bool)</signal>
<receiver>lLocalIcon</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>551</x>
<y>262</y>
</hint>
<hint type="destinationlabel">
<x>54</x>
<y>400</y>
</hint>
</hints>
</connection>
</connections>
</ui>
8 changes: 5 additions & 3 deletions src/gui/wizard/owncloudwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
#endif
connect(_advancedSetupPage, &OwncloudAdvancedSetupPage::createLocalAndRemoteFolders,
this, &OwncloudWizard::createLocalAndRemoteFolders);
connect(this, &QWizard::customButtonClicked, this, &OwncloudWizard::skipFolderConfiguration);


Theme *theme = Theme::instance();
Expand All @@ -92,7 +91,6 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
setOption(QWizard::NoCancelButton);
setTitleFormat(Qt::RichText);
setSubTitleFormat(Qt::RichText);
setButtonText(QWizard::CustomButton1, tr("Skip folders configuration"));
}

void OwncloudWizard::setAccount(AccountPtr account)
Expand Down Expand Up @@ -120,6 +118,11 @@ bool OwncloudWizard::usePlaceholderSync() const
return _advancedSetupPage->usePlaceholderSync();
}

bool OwncloudWizard::manualFolderConfig() const
{
return _advancedSetupPage->manualFolderConfig();
}

bool OwncloudWizard::isConfirmBigFolderChecked() const
{
return _advancedSetupPage->isConfirmBigFolderChecked();
Expand Down Expand Up @@ -207,7 +210,6 @@ void OwncloudWizard::slotCurrentPageChanged(int id)
done(Accepted);
}

setOption(QWizard::HaveCustomButton1, id == WizardCommon::Page_AdvancedSetup);
if (id == WizardCommon::Page_AdvancedSetup && _credentialsPage == _browserCredsPage) {
// For OAuth, disable the back button in the Page_AdvancedSetup because we don't want
// to re-open the browser.
Expand Down
2 changes: 1 addition & 1 deletion src/gui/wizard/owncloudwizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class OwncloudWizard : public QWizard
QString localFolder() const;
QStringList selectiveSyncBlacklist() const;
bool usePlaceholderSync() const;
bool manualFolderConfig() const;
bool isConfirmBigFolderChecked() const;

void enableFinishOnResultWidget(bool enable);
Expand Down Expand Up @@ -97,7 +98,6 @@ public slots:
void createLocalAndRemoteFolders(const QString &, const QString &);
// make sure to connect to this, rather than finished(int)!!
void basicSetupFinished(int);
void skipFolderConfiguration();
void needCertificate();

private:
Expand Down

0 comments on commit 5a13ef3

Please sign in to comment.