From e17243bc1fd5d774a3a4d4d59c0a621f907edecd Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Wed, 25 Jun 2014 11:11:27 +0200 Subject: [PATCH] AccountMigrator: Read path from QDir::fromNativeSeperators(), add debug. --- src/mirall/account.cpp | 9 +++++++-- src/mirall/accountmigrator.cpp | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/mirall/account.cpp b/src/mirall/account.cpp index f057324ed..80be3365a 100644 --- a/src/mirall/account.cpp +++ b/src/mirall/account.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -124,12 +125,14 @@ Account* Account::restore() // if the settings file could not be opened, the childKeys list is empty if( settings->childKeys().isEmpty() ) { // Now try to open the original ownCloud settings to see if they exist. - QString oCCfgFile = settings->fileName(); + QString oCCfgFile = QDir::fromNativeSeparators( settings->fileName() ); // replace the last two segments with ownCloud/owncloud.cfg oCCfgFile = oCCfgFile.left( oCCfgFile.lastIndexOf('/')); oCCfgFile = oCCfgFile.left( oCCfgFile.lastIndexOf('/')); oCCfgFile += QLatin1String("/ownCloud/owncloud.cfg"); + qDebug() << "Migrate: checking old config " << oCCfgFile; + QFileInfo fi( oCCfgFile ); if( fi.isReadable() ) { QSettings *oCSettings = new QSettings(oCCfgFile, QSettings::IniFormat); @@ -142,7 +145,9 @@ Account* Account::restore() // in case the urls are equal reset the settings object to read from // the ownCloud settings object - if( oCUrl == overrideUrl ) { + qDebug() << "Migrate oC config if " << oCUrl << " == " << overrideUrl << ":" + << (QUrl(oCUrl) == QUrl(overrideUrl) ? "Yes" : "No"); + if( QUrl(oCUrl) == QUrl(overrideUrl) ) { migratedCreds = true; settings.reset( oCSettings ); } else { diff --git a/src/mirall/accountmigrator.cpp b/src/mirall/accountmigrator.cpp index 51e3f2ecb..ba4d49f43 100644 --- a/src/mirall/accountmigrator.cpp +++ b/src/mirall/accountmigrator.cpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace Mirall { @@ -55,7 +56,10 @@ QStringList AccountMigrator::migrateFolderDefinitons() oCPath = oCPath.left( oCPath.lastIndexOf('/')); themePath += QLatin1String( "folders"); - oCPath += QLatin1String( "ownCloud/folders" ); + oCPath += QLatin1String( "/ownCloud/folders" ); + + qDebug() << "Migrator: theme-path: " << themePath; + qDebug() << "Migrator: ownCloud path: " << oCPath; // get a dir listing of the ownCloud folder definitions and copy // them over to the theme dir @@ -69,6 +73,7 @@ QStringList AccountMigrator::migrateFolderDefinitons() QString oCFile = oCPath+QDir::separator()+file; if( QFile::copy( oCFile, themeFile ) ) { re.append(file); + qDebug() << "Migrator: Folder definition migrated: " << file; // fix the connection entry of the folder definition QSettings settings(themeFile, QSettings::IniFormat); @@ -79,7 +84,6 @@ QStringList AccountMigrator::migrateFolderDefinitons() } return re; - } }