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

preferencesAboutTextFull
shibakaneki 14 years ago
commit 5b95b74a8a
  1. 18
      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,18 +40,21 @@ 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));
if (fileInfoList.count() != 0){
mTransitionDlg = new UBUpdateDlg(0, fileInfoList.count(), backupDirectoryPath); mTransitionDlg = new UBUpdateDlg(0, fileInfoList.count(), backupDirectoryPath);
connect(mTransitionDlg, SIGNAL(updateFiles()), this, SLOT(startDocumentTransition())); connect(mTransitionDlg, SIGNAL(updateFiles()), this, SLOT(startDocumentTransition()));
connect(this, SIGNAL(transitionFinished(bool)), mTransitionDlg, SLOT(onFilesUpdated(bool))); connect(this, SIGNAL(transitionFinished(bool)), mTransitionDlg, SLOT(onFilesUpdated(bool)));
mTransitionDlg->show(); mTransitionDlg->show();
} }
}
} }
void UniboardSankoreTransition::startDocumentTransition() void UniboardSankoreTransition::startDocumentTransition()
@ -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