Skip to content

Commit c1fb5e6

Browse files
ogoffartguruz
authored andcommittedApr 23, 2018
Wizard: Move the 'Skip folder configuration' in a radio button
Issue #3664
1 parent e0b554a commit c1fb5e6

7 files changed

+139
-32
lines changed
 

‎src/gui/owncloudsetupwizard.cpp

+5-19
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ OwncloudSetupWizard::OwncloudSetupWizard(QObject *parent)
5757
connect(_ocWizard, &OwncloudWizard::basicSetupFinished,
5858
this, &OwncloudSetupWizard::slotAssistantFinished, Qt::QueuedConnection);
5959
connect(_ocWizard, &QDialog::finished, this, &QObject::deleteLater);
60-
connect(_ocWizard, &OwncloudWizard::skipFolderConfiguration, this, &OwncloudSetupWizard::slotSkipFolderConfiguration);
6160
}
6261

6362
OwncloudSetupWizard::~OwncloudSetupWizard()
@@ -597,15 +596,12 @@ bool OwncloudSetupWizard::ensureStartFromScratch(const QString &localFolder)
597596
// Method executed when the user end has finished the basic setup.
598597
void OwncloudSetupWizard::slotAssistantFinished(int result)
599598
{
600-
FolderMan *folderMan = FolderMan::instance();
601-
602599
if (result == QDialog::Rejected) {
603-
qCInfo(lcWizard) << "Rejected the new config, use the old!";
604-
605-
} else if (result == QDialog::Accepted) {
606-
// This may or may not wipe all folder definitions, depending
607-
// on whether a new account is activated or the existing one
608-
// is changed.
600+
// Wizard was cancelled
601+
} else if (_ocWizard->manualFolderConfig()) {
602+
applyAccountChanges();
603+
} else {
604+
FolderMan *folderMan = FolderMan::instance();
609605
auto account = applyAccountChanges();
610606

611607
QString localFolder = FolderDefinition::prepareLocalPath(_ocWizard->localFolder());
@@ -639,16 +635,6 @@ void OwncloudSetupWizard::slotAssistantFinished(int result)
639635
emit ownCloudWizardDone(result);
640636
}
641637

642-
void OwncloudSetupWizard::slotSkipFolderConfiguration()
643-
{
644-
applyAccountChanges();
645-
646-
disconnect(_ocWizard, &OwncloudWizard::basicSetupFinished,
647-
this, &OwncloudSetupWizard::slotAssistantFinished);
648-
_ocWizard->close();
649-
emit ownCloudWizardDone(QDialog::Accepted);
650-
}
651-
652638
AccountState *OwncloudSetupWizard::applyAccountChanges()
653639
{
654640
AccountPtr newAccount = _ocWizard->account();

‎src/gui/owncloudsetupwizard.h

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ private slots:
6767
void slotRemoteFolderExists(QNetworkReply *);
6868
void slotCreateRemoteFolderFinished(QNetworkReply::NetworkError);
6969
void slotAssistantFinished(int);
70-
void slotSkipFolderConfiguration();
7170

7271
private:
7372
explicit OwncloudSetupWizard(QObject *parent = 0);

‎src/gui/wizard/owncloudadvancedsetuppage.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ OwncloudAdvancedSetupPage::OwncloudAdvancedSetupPage()
6262
connect(_ui.rSelectiveSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSelectiveSyncClicked);
6363
connect(_ui.rPlaceholderSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotPlaceholderSyncClicked);
6464
connect(_ui.bSelectiveSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSelectiveSyncClicked);
65+
connect(_ui.rManualFolder, &QAbstractButton::clicked, this, [this] { setRadioChecked(_ui.rManualFolder); });
6566

6667
QIcon appIcon = theme->applicationIcon();
6768
_ui.lServerIcon->setText(QString());
@@ -237,6 +238,11 @@ bool OwncloudAdvancedSetupPage::usePlaceholderSync() const
237238
return _ui.rPlaceholderSync->isChecked();
238239
}
239240

241+
bool OwncloudAdvancedSetupPage::manualFolderConfig() const
242+
{
243+
return _ui.rManualFolder->isChecked();
244+
}
245+
240246
bool OwncloudAdvancedSetupPage::isConfirmBigFolderChecked() const
241247
{
242248
return _ui.rSyncEverything->isChecked() && _ui.confCheckBoxSize->isChecked();

‎src/gui/wizard/owncloudadvancedsetuppage.h

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class OwncloudAdvancedSetupPage : public QWizardPage
4242
QString localFolder() const;
4343
QStringList selectiveSyncBlacklist() const;
4444
bool usePlaceholderSync() const;
45+
bool manualFolderConfig() const;
4546
bool isConfirmBigFolderChecked() const;
4647
void setRemoteFolder(const QString &remoteFolder);
4748
void setMultipleFoldersExist(bool exist);

‎src/gui/wizard/owncloudadvancedsetuppage.ui

+121-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>912</width>
10-
<height>633</height>
10+
<height>635</height>
1111
</rect>
1212
</property>
1313
<property name="sizePolicy">
@@ -240,7 +240,7 @@
240240
<item>
241241
<widget class="QRadioButton" name="rSyncEverything">
242242
<property name="text">
243-
<string>S&amp;ync everything from server</string>
243+
<string>S&amp;ynchronize everything from server</string>
244244
</property>
245245
<property name="checked">
246246
<bool>true</bool>
@@ -382,6 +382,42 @@
382382
</item>
383383
<item>
384384
<layout class="QHBoxLayout" name="lPlaceholderSync">
385+
<item>
386+
<widget class="QRadioButton" name="rManualFolder">
387+
<property name="sizePolicy">
388+
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
389+
<horstretch>0</horstretch>
390+
<verstretch>0</verstretch>
391+
</sizepolicy>
392+
</property>
393+
<property name="toolTip">
394+
<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>
395+
</property>
396+
<property name="whatsThis">
397+
<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>
398+
</property>
399+
<property name="text">
400+
<string>Manually create folder sync connections </string>
401+
</property>
402+
</widget>
403+
</item>
404+
<item>
405+
<spacer name="horizontalSpacer_5">
406+
<property name="orientation">
407+
<enum>Qt::Horizontal</enum>
408+
</property>
409+
<property name="sizeHint" stdset="0">
410+
<size>
411+
<width>40</width>
412+
<height>20</height>
413+
</size>
414+
</property>
415+
</spacer>
416+
</item>
417+
</layout>
418+
</item>
419+
<item>
420+
<layout class="QHBoxLayout" name="horizontalLayout_4">
385421
<item>
386422
<widget class="QRadioButton" name="rPlaceholderSync">
387423
<property name="sizePolicy">
@@ -391,15 +427,15 @@
391427
</sizepolicy>
392428
</property>
393429
<property name="text">
394-
<string>Create placeholders instead of downloading files (experimental)</string>
430+
<string>Create placeholders instead of downloading files (e&amp;xperimental)</string>
395431
</property>
396432
<property name="checkable">
397433
<bool>false</bool>
398434
</property>
399435
</widget>
400436
</item>
401437
<item>
402-
<spacer name="horizontalSpacer_5">
438+
<spacer name="horizontalSpacer_6">
403439
<property name="orientation">
404440
<enum>Qt::Horizontal</enum>
405441
</property>
@@ -456,6 +492,19 @@
456492
</item>
457493
</layout>
458494
</widget>
495+
<tabstops>
496+
<tabstop>rSyncEverything</tabstop>
497+
<tabstop>confCheckBoxSize</tabstop>
498+
<tabstop>confSpinBox</tabstop>
499+
<tabstop>confCheckBoxExternal</tabstop>
500+
<tabstop>rSelectiveSync</tabstop>
501+
<tabstop>bSelectiveSync</tabstop>
502+
<tabstop>rManualFolder</tabstop>
503+
<tabstop>rPlaceholderSync</tabstop>
504+
<tabstop>pbSelectLocalFolder</tabstop>
505+
<tabstop>radioButton</tabstop>
506+
<tabstop>cbSyncFromScratch</tabstop>
507+
</tabstops>
459508
<resources/>
460509
<connections>
461510
<connection>
@@ -485,8 +534,8 @@
485534
<y>83</y>
486535
</hint>
487536
<hint type="destinationlabel">
488-
<x>952</x>
489-
<y>134</y>
537+
<x>864</x>
538+
<y>147</y>
490539
</hint>
491540
</hints>
492541
</connection>
@@ -501,8 +550,8 @@
501550
<y>76</y>
502551
</hint>
503552
<hint type="destinationlabel">
504-
<x>1076</x>
505-
<y>136</y>
553+
<x>902</x>
554+
<y>147</y>
506555
</hint>
507556
</hints>
508557
</connection>
@@ -522,5 +571,69 @@
522571
</hint>
523572
</hints>
524573
</connection>
574+
<connection>
575+
<sender>rManualFolder</sender>
576+
<signal>toggled(bool)</signal>
577+
<receiver>pbSelectLocalFolder</receiver>
578+
<slot>setDisabled(bool)</slot>
579+
<hints>
580+
<hint type="sourcelabel">
581+
<x>197</x>
582+
<y>269</y>
583+
</hint>
584+
<hint type="destinationlabel">
585+
<x>219</x>
586+
<y>404</y>
587+
</hint>
588+
</hints>
589+
</connection>
590+
<connection>
591+
<sender>rManualFolder</sender>
592+
<signal>toggled(bool)</signal>
593+
<receiver>resolutionWidget</receiver>
594+
<slot>setDisabled(bool)</slot>
595+
<hints>
596+
<hint type="sourcelabel">
597+
<x>260</x>
598+
<y>266</y>
599+
</hint>
600+
<hint type="destinationlabel">
601+
<x>443</x>
602+
<y>437</y>
603+
</hint>
604+
</hints>
605+
</connection>
606+
<connection>
607+
<sender>rManualFolder</sender>
608+
<signal>toggled(bool)</signal>
609+
<receiver>lLocal</receiver>
610+
<slot>setDisabled(bool)</slot>
611+
<hints>
612+
<hint type="sourcelabel">
613+
<x>163</x>
614+
<y>267</y>
615+
</hint>
616+
<hint type="destinationlabel">
617+
<x>88</x>
618+
<y>438</y>
619+
</hint>
620+
</hints>
621+
</connection>
622+
<connection>
623+
<sender>rManualFolder</sender>
624+
<signal>toggled(bool)</signal>
625+
<receiver>lLocalIcon</receiver>
626+
<slot>setDisabled(bool)</slot>
627+
<hints>
628+
<hint type="sourcelabel">
629+
<x>551</x>
630+
<y>262</y>
631+
</hint>
632+
<hint type="destinationlabel">
633+
<x>54</x>
634+
<y>400</y>
635+
</hint>
636+
</hints>
637+
</connection>
525638
</connections>
526639
</ui>

‎src/gui/wizard/owncloudwizard.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
7979
#endif
8080
connect(_advancedSetupPage, &OwncloudAdvancedSetupPage::createLocalAndRemoteFolders,
8181
this, &OwncloudWizard::createLocalAndRemoteFolders);
82-
connect(this, &QWizard::customButtonClicked, this, &OwncloudWizard::skipFolderConfiguration);
8382

8483

8584
Theme *theme = Theme::instance();
@@ -92,7 +91,6 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
9291
setOption(QWizard::NoCancelButton);
9392
setTitleFormat(Qt::RichText);
9493
setSubTitleFormat(Qt::RichText);
95-
setButtonText(QWizard::CustomButton1, tr("Skip folders configuration"));
9694
}
9795

9896
void OwncloudWizard::setAccount(AccountPtr account)
@@ -120,6 +118,11 @@ bool OwncloudWizard::usePlaceholderSync() const
120118
return _advancedSetupPage->usePlaceholderSync();
121119
}
122120

121+
bool OwncloudWizard::manualFolderConfig() const
122+
{
123+
return _advancedSetupPage->manualFolderConfig();
124+
}
125+
123126
bool OwncloudWizard::isConfirmBigFolderChecked() const
124127
{
125128
return _advancedSetupPage->isConfirmBigFolderChecked();
@@ -207,7 +210,6 @@ void OwncloudWizard::slotCurrentPageChanged(int id)
207210
done(Accepted);
208211
}
209212

210-
setOption(QWizard::HaveCustomButton1, id == WizardCommon::Page_AdvancedSetup);
211213
if (id == WizardCommon::Page_AdvancedSetup && _credentialsPage == _browserCredsPage) {
212214
// For OAuth, disable the back button in the Page_AdvancedSetup because we don't want
213215
// to re-open the browser.

‎src/gui/wizard/owncloudwizard.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class OwncloudWizard : public QWizard
6464
QString localFolder() const;
6565
QStringList selectiveSyncBlacklist() const;
6666
bool usePlaceholderSync() const;
67+
bool manualFolderConfig() const;
6768
bool isConfirmBigFolderChecked() const;
6869

6970
void enableFinishOnResultWidget(bool enable);
@@ -97,7 +98,6 @@ public slots:
9798
void createLocalAndRemoteFolders(const QString &, const QString &);
9899
// make sure to connect to this, rather than finished(int)!!
99100
void basicSetupFinished(int);
100-
void skipFolderConfiguration();
101101
void needCertificate();
102102

103103
private:

0 commit comments

Comments
 (0)
Please sign in to comment.