Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
shibakaneki 14 years ago
commit 5b95b74a8a
  1. 26
      src/transition/UniboardSankoreTransition.cpp
  2. 1
      src/transition/UniboardSankoreTransition.h

@ -8,6 +8,8 @@
UniboardSankoreTransition::UniboardSankoreTransition(QObject *parent) : UniboardSankoreTransition::UniboardSankoreTransition(QObject *parent) :
QObject(parent) QObject(parent)
{ {
mOldSankoreDirectory = UBFileSystemUtils::normalizeFilePath(UBDesktopServices::storageLocation(QDesktopServices::DataLocation));
mUniboardSourceDirectory = UBFileSystemUtils::normalizeFilePath(UBDesktopServices::storageLocation(QDesktopServices::DataLocation)); mUniboardSourceDirectory = UBFileSystemUtils::normalizeFilePath(UBDesktopServices::storageLocation(QDesktopServices::DataLocation));
#if defined(Q_WS_MACX) #if defined(Q_WS_MACX)
mUniboardSourceDirectory.replace("Sankore/Sankore 3.1", "Uniboard"); mUniboardSourceDirectory.replace("Sankore/Sankore 3.1", "Uniboard");
@ -38,17 +40,20 @@ void UniboardSankoreTransition::rollbackDocumentsTransition(QFileInfoList& fileI
void UniboardSankoreTransition::documentTransition() void UniboardSankoreTransition::documentTransition()
{ {
if (QFileInfo(mUniboardSourceDirectory).exists()){ if (QFileInfo(mUniboardSourceDirectory).exists() || QFileInfo(mOldSankoreDirectory).exists()){
QString uniboardDocumentDirectory = mUniboardSourceDirectory + "/document"; QString uniboardDocumentDirectory = mUniboardSourceDirectory + "/document";
QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(uniboardDocumentDirectory); QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(uniboardDocumentDirectory);
fileInfoList << UBFileSystemUtils::allElementsInDirectory(mOldSankoreDirectory + "/document");
QString backupDirectoryPath = UBFileSystemUtils::normalizeFilePath(UBDesktopServices::storageLocation(QDesktopServices::DesktopLocation)); QString backupDirectoryPath = UBFileSystemUtils::normalizeFilePath(UBDesktopServices::storageLocation(QDesktopServices::DesktopLocation));
mTransitionDlg = new UBUpdateDlg(0, fileInfoList.count(), backupDirectoryPath); if (fileInfoList.count() != 0){
connect(mTransitionDlg, SIGNAL(updateFiles()), this, SLOT(startDocumentTransition())); mTransitionDlg = new UBUpdateDlg(0, fileInfoList.count(), backupDirectoryPath);
connect(this, SIGNAL(transitionFinished(bool)), mTransitionDlg, SLOT(onFilesUpdated(bool))); connect(mTransitionDlg, SIGNAL(updateFiles()), this, SLOT(startDocumentTransition()));
mTransitionDlg->show(); connect(this, SIGNAL(transitionFinished(bool)), mTransitionDlg, SLOT(onFilesUpdated(bool)));
mTransitionDlg->show();
}
} }
} }
@ -80,16 +85,9 @@ void UniboardSankoreTransition::startDocumentTransition()
rollbackDocumentsTransition(fileInfoList); rollbackDocumentsTransition(fileInfoList);
UBFileSystemUtils::deleteDir(backupDestinationPath); UBFileSystemUtils::deleteDir(backupDestinationPath);
} }
else else{
{ UBFileSystemUtils::deleteDir(mOldSankoreDirectory);
UBFileSystemUtils::deleteDir(mUniboardSourceDirectory); UBFileSystemUtils::deleteDir(mUniboardSourceDirectory);
// Notify the application that new documents have been added
// foreach(QString qstr, qslNewDocs)
// {
// UBDocumentProxy* pDoc = new UBDocumentProxy();
// pDoc->setMetaData(UBSettings::documentName, qstr);
// emit docAdded(pDoc);
// }
} }
emit transitionFinished(result); emit transitionFinished(result);

@ -21,6 +21,7 @@ private:
protected: protected:
QString mUniboardSourceDirectory; QString mUniboardSourceDirectory;
QString mOldSankoreDirectory;
signals: signals:
void transitionFinished(bool result); void transitionFinished(bool result);

Loading…
Cancel
Save