AccountMigrator: Read path from QDir::fromNativeSeperators(), add debug.

This commit is contained in:
Klaas Freitag 2014-06-25 11:11:27 +02:00
parent 0e45dd7a3d
commit e17243bc1f
2 changed files with 13 additions and 4 deletions

View file

@ -29,6 +29,7 @@
#include <QSslSocket>
#include <QNetworkCookieJar>
#include <QFileInfo>
#include <QDir>
#include <QDebug>
@ -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 {

View file

@ -21,6 +21,7 @@
#include <QStringList>
#include <QDir>
#include <QFileInfo>
#include <QDebug>
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;
}
}