FolderMan: fix a #warning in the migration path

This commit is contained in:
Olivier Goffart 2015-05-12 16:48:19 +02:00
parent de9770f52a
commit 299fa2dee6
2 changed files with 10 additions and 6 deletions

View file

@ -232,8 +232,10 @@ int FolderMan::setupFoldersMigration()
dir.setFilter(QDir::Files | QDir::Hidden);
QStringList list = dir.entryList();
// Normaly there should be only one account when migrating.
AccountState* accountState = AccountManager::instance()->accounts().value(0).data();
foreach ( const QString& alias, list ) {
Folder *f = setupFolderFromConfigFile( alias );
Folder *f = setupFolderFromOldConfigFile( alias, accountState );
if( f ) {
slotScheduleSync(f);
emit( folderSyncStateChange( f ) );
@ -325,7 +327,8 @@ QString FolderMan::unescapeAlias( const QString& alias ) const
// filename is the name of the file only, it does not include
// the configuration directory path
Folder* FolderMan::setupFolderFromConfigFile(const QString &file) {
Folder* FolderMan::setupFolderFromOldConfigFile(const QString &file, AccountState *accountState )
{
Folder *folder = 0;
qDebug() << " ` -> setting up:" << file;
@ -376,8 +379,6 @@ Folder* FolderMan::setupFolderFromConfigFile(const QString &file) {
targetPath.remove(0,1);
}
#warning fixme: which account does this folder use?
AccountState* accountState = AccountManager::instance()->accounts().value(0).data();
if (!accountState) {
qWarning() << "can't create folder without an account";
return 0;

View file

@ -55,8 +55,11 @@ public:
/** Returns the folder by alias or NULL if no folder with the alias exists. */
Folder *folder( const QString& );
/** Creates a folder for a specific configuration, identified by alias. */
Folder* setupFolderFromConfigFile(const QString & );
/**
* Migrate accounts from owncloud < 2.0
* Creates a folder for a specific configuration, identified by alias.
*/
Folder* setupFolderFromOldConfigFile(const QString &, AccountState *account );
/**
* Ensures that a given directory does not contain a .csync_journal.