Fixed an issue related to the transition of old files.

preferencesAboutTextFull
Isa Kindov 14 years ago
parent 9b447a64ad
commit d21d046158
  1. 10
      src/transition/UniboardSankoreTransition.cpp

@ -10,9 +10,11 @@ UniboardSankoreTransition::UniboardSankoreTransition(QObject *parent) :
, mTransitionDlg(NULL) , mTransitionDlg(NULL)
{ {
mOldSankoreDirectory = UBFileSystemUtils::normalizeFilePath(UBDesktopServices::storageLocation(QDesktopServices::DataLocation)); mOldSankoreDirectory = UBFileSystemUtils::normalizeFilePath(UBDesktopServices::storageLocation(QDesktopServices::DataLocation));
qDebug() << mOldSankoreDirectory;
mUniboardSourceDirectory = UBFileSystemUtils::normalizeFilePath(UBDesktopServices::storageLocation(QDesktopServices::DataLocation)); mUniboardSourceDirectory = UBFileSystemUtils::normalizeFilePath(UBDesktopServices::storageLocation(QDesktopServices::DataLocation));
#if defined(Q_WS_MACX) #if defined(Q_WS_MACX)
mOldSankoreDirectory.replace("Sankore/Sankore 3.1", "Sankore 3.1");
mUniboardSourceDirectory.replace("Sankore/Sankore 3.1", "Uniboard"); mUniboardSourceDirectory.replace("Sankore/Sankore 3.1", "Uniboard");
#else #else
mUniboardSourceDirectory.replace("Sankore/Sankore 3.1", "Mnemis/Uniboard"); mUniboardSourceDirectory.replace("Sankore/Sankore 3.1", "Mnemis/Uniboard");
@ -65,11 +67,13 @@ void UniboardSankoreTransition::documentTransition()
void UniboardSankoreTransition::startDocumentTransition() void UniboardSankoreTransition::startDocumentTransition()
{ {
bool result = false; bool result = false;
QString backupDestinationPath = mTransitionDlg->backupPath() + "/UniboardBackup"; QString backupDestinationPath = mTransitionDlg->backupPath() + "/OldSankoreAndUniboardVersionsBackup";
result = UBFileSystemUtils::copyDir(mUniboardSourceDirectory, backupDestinationPath); result = UBFileSystemUtils::copyDir(mUniboardSourceDirectory + "/document", backupDestinationPath);
result &= UBFileSystemUtils::copyDir(mOldSankoreDirectory + "/document", backupDestinationPath);
QString uniboardDocumentDirectory = mUniboardSourceDirectory + "/document"; QString uniboardDocumentDirectory = mUniboardSourceDirectory + "/document";
QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(uniboardDocumentDirectory); QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(uniboardDocumentDirectory);
fileInfoList.append(UBFileSystemUtils::allElementsInDirectory(mOldSankoreDirectory + "/document"));
QFileInfoList::iterator fileInfo; QFileInfoList::iterator fileInfo;
QString sankoreDocumentDirectory = UBSettings::uniboardDocumentDirectory(); QString sankoreDocumentDirectory = UBSettings::uniboardDocumentDirectory();
@ -77,7 +81,7 @@ void UniboardSankoreTransition::startDocumentTransition()
QStringList qslNewDocs; QStringList qslNewDocs;
for (fileInfo = fileInfoList.begin(); fileInfo != fileInfoList.end() && result; fileInfo += 1) { for (fileInfo = fileInfoList.begin(); fileInfo != fileInfoList.end() && result; fileInfo += 1) {
if (fileInfo->isDir() && fileInfo->fileName().startsWith("Uniboard Document ")){ if (fileInfo->isDir() && (fileInfo->fileName().startsWith("Uniboard Document ") || fileInfo->fileName().startsWith("Sankore Document "))){
QString sankoreDocumentName = fileInfo->fileName(); QString sankoreDocumentName = fileInfo->fileName();
sankoreDocumentName.replace("Uniboard","Sankore"); sankoreDocumentName.replace("Uniboard","Sankore");
result = UBFileSystemUtils::copyDir(fileInfo->filePath(),sankoreDocumentDirectory + "/" + sankoreDocumentName); result = UBFileSystemUtils::copyDir(fileInfo->filePath(),sankoreDocumentDirectory + "/" + sankoreDocumentName);

Loading…
Cancel
Save