FolderMan: Migrate folderlist if no folder definitions can be found

and the account indicates that it was migrated. In that case,
read the folder definitions from the ownCloud config directory.
This commit is contained in:
Klaas Freitag 2014-06-12 16:53:46 +02:00
parent 6ed6f84f6e
commit 653b8494f5

View file

@ -13,10 +13,13 @@
*/ */
#include "mirall/folderman.h" #include "mirall/folderman.h"
#include "mirall/account.h"
#include "mirall/mirallconfigfile.h" #include "mirall/mirallconfigfile.h"
#include "mirall/folder.h" #include "mirall/folder.h"
#include "mirall/syncresult.h" #include "mirall/syncresult.h"
#include "mirall/theme.h" #include "mirall/theme.h"
#include "mirall/accountmigrator.h"
#include <neon/ne_socket.h> #include <neon/ne_socket.h>
@ -147,6 +150,15 @@ int FolderMan::setupFolders()
dir.setFilter(QDir::Files | QDir::Hidden); dir.setFilter(QDir::Files | QDir::Hidden);
QStringList list = dir.entryList(); QStringList list = dir.entryList();
if( list.count() == 0 ) {
// maybe the account was just migrated.
Account *acc = AccountManager::instance()->account();
if ( acc && acc->wasMigrated() ) {
AccountMigrator accMig;
list = accMig.migrateFolderDefinitons();
}
}
foreach ( const QString& alias, list ) { foreach ( const QString& alias, list ) {
Folder *f = setupFolderFromConfigFile( alias ); Folder *f = setupFolderFromConfigFile( alias );
if( f ) { if( f ) {