diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index a53728d66f7..73bc69aa098 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -179,7 +179,7 @@ void AccountSettings::slotAddFolder() FolderMan *folderMan = FolderMan::instance(); folderMan->setSyncEnabled(false); // do not start more syncs. - FolderWizard *folderWizard = new FolderWizard(this); + FolderWizard *folderWizard = new FolderWizard(AccountManager::instance()->account(), this); connect(folderWizard, SIGNAL(accepted()), SLOT(slotFolderWizardAccepted())); connect(folderWizard, SIGNAL(rejected()), SLOT(slotFolderWizardRejected())); diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index f98fe25a983..f35357be462 100644 --- a/src/gui/folderwizard.cpp +++ b/src/gui/folderwizard.cpp @@ -224,9 +224,10 @@ void FolderWizardLocalPath::slotChooseLocalFolder() } // ================================================================================= -FolderWizardRemotePath::FolderWizardRemotePath() +FolderWizardRemotePath::FolderWizardRemotePath(AccountPtr account) : FormatWarningsWizardPage() ,_warnWasVisible(false) + ,_account(account) { _ui.setupUi(this); @@ -272,7 +273,7 @@ void FolderWizardRemotePath::slotCreateRemoteFolder(const QString &folder) } fullPath += "/" + folder; - MkColJob *job = new MkColJob(AccountManager::instance()->account(), fullPath, this); + MkColJob *job = new MkColJob(_account, fullPath, this); /* check the owncloud configuration file and query the ownCloud */ connect(job, SIGNAL(finished(QNetworkReply::NetworkError)), SLOT(slotCreateRemoteFolderFinished(QNetworkReply::NetworkError))); @@ -334,7 +335,7 @@ void FolderWizardRemotePath::recursiveInsert(QTreeWidgetItem *parent, QStringLis void FolderWizardRemotePath::slotUpdateDirectories(const QStringList &list) { - QString webdavFolder = QUrl(AccountManager::instance()->account()->davUrl()).path(); + QString webdavFolder = QUrl(_account->davUrl()).path(); QTreeWidgetItem *root = _ui.folderTreeWidget->topLevelItem(0); if (!root) { @@ -355,7 +356,7 @@ void FolderWizardRemotePath::slotUpdateDirectories(const QStringList &list) void FolderWizardRemotePath::slotRefreshFolders() { - LsColJob *job = new LsColJob(AccountManager::instance()->account(), "/", this); + LsColJob *job = new LsColJob(_account, "/", this); connect(job, SIGNAL(directoryListingSubfolders(QStringList)), SLOT(slotUpdateDirectories(QStringList))); job->start(); @@ -365,7 +366,7 @@ void FolderWizardRemotePath::slotRefreshFolders() void FolderWizardRemotePath::slotItemExpanded(QTreeWidgetItem *item) { QString dir = item->data(0, Qt::UserRole).toString(); - LsColJob *job = new LsColJob(AccountManager::instance()->account(), dir, this); + LsColJob *job = new LsColJob(_account, dir, this); connect(job, SIGNAL(directoryListingSubfolders(QStringList)), SLOT(slotUpdateDirectories(QStringList))); job->start(); @@ -436,10 +437,10 @@ void FolderWizardRemotePath::showWarn( const QString& msg ) const // ==================================================================================== -FolderWizardSelectiveSync::FolderWizardSelectiveSync() +FolderWizardSelectiveSync::FolderWizardSelectiveSync(AccountPtr account) { QVBoxLayout *layout = new QVBoxLayout(this); - _treeView = new SelectiveSyncTreeView(AccountManager::instance()->account(), this); + _treeView = new SelectiveSyncTreeView(account, this); layout->addWidget(new QLabel(tr("Choose What to Sync: You can optionally deselect remote subfolders you do not wish to synchronize."))); layout->addWidget(_treeView); } @@ -484,16 +485,16 @@ void FolderWizardSelectiveSync::cleanupPage() * Folder wizard itself */ -FolderWizard::FolderWizard( QWidget *parent ) +FolderWizard::FolderWizard(AccountPtr account, QWidget *parent) : QWizard(parent), _folderWizardSourcePage(new FolderWizardLocalPath), _folderWizardTargetPage(0), - _folderWizardSelectiveSyncPage(new FolderWizardSelectiveSync) + _folderWizardSelectiveSyncPage(new FolderWizardSelectiveSync(account)) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setPage(Page_Source, _folderWizardSourcePage ); if (!Theme::instance()->singleSyncFolder()) { - _folderWizardTargetPage = new FolderWizardRemotePath(); + _folderWizardTargetPage = new FolderWizardRemotePath(account); setPage(Page_Target, _folderWizardTargetPage ); } setPage(Page_SelectiveSync, _folderWizardSelectiveSyncPage); diff --git a/src/gui/folderwizard.h b/src/gui/folderwizard.h index bdf02e1c8be..88b86409b92 100644 --- a/src/gui/folderwizard.h +++ b/src/gui/folderwizard.h @@ -20,6 +20,7 @@ #include #include "folder.h" +#include "accountfwd.h" #include "ui_folderwizardsourcepage.h" #include "ui_folderwizardtargetpage.h" @@ -67,7 +68,7 @@ class FolderWizardRemotePath : public FormatWarningsWizardPage { Q_OBJECT public: - FolderWizardRemotePath(); + explicit FolderWizardRemotePath(AccountPtr account); ~FolderWizardRemotePath(); virtual bool isComplete() const Q_DECL_OVERRIDE; @@ -89,7 +90,7 @@ protected slots: void recursiveInsert(QTreeWidgetItem *parent, QStringList pathTrail, QString path); Ui_FolderWizardTargetPage _ui; bool _warnWasVisible; - + AccountPtr _account; }; @@ -97,7 +98,7 @@ class FolderWizardSelectiveSync : public QWizardPage { Q_OBJECT public: - FolderWizardSelectiveSync(); + explicit FolderWizardSelectiveSync(AccountPtr account); ~FolderWizardSelectiveSync(); virtual bool validatePage() Q_DECL_OVERRIDE; @@ -125,7 +126,7 @@ class FolderWizard : public QWizard Page_SelectiveSync }; - FolderWizard(QWidget *parent = 0); + explicit FolderWizard(AccountPtr account, QWidget *parent = 0); ~FolderWizard(); private: