Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wizard: Move the 'Skip folder configuration' in a radio button #6470

Merged
merged 1 commit into from
Apr 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
129 changes: 121 additions & 8 deletions src/gui/wizard/owncloudadvancedsetuppage.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>912</width>
<height>633</height>
<height>635</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -240,7 +240,7 @@
<item>
<widget class="QRadioButton" name="rSyncEverything">
<property name="text">
<string>S&amp;ync everything from server</string>
<string>S&amp;ynchronize everything from server</string>
</property>
<property name="checked">
<bool>true</bool>
Expand Down Expand Up @@ -382,6 +382,42 @@
</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="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When this option is selected, the wizard will close without synchronizing anything. You can use the &amp;quot;Add Folder Sync Connection&amp;quot; button from the account settings to choose which pair of local and remote folder you wish to synchronize&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When this option is selected, the wizard will close without synchronizing anything. You can use the &amp;quot;Add Folder Sync Connection&amp;quot; button from the account settings to choose which pair of local and remote folder you wish to synchronize&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Manually create folder sync connections </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 +427,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 +492,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 +534,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 +550,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 +571,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