All exported document will be checked against absolut path

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent 0edf49ad36
commit 6df0f11422
  1. 5
      src/adaptors/UBExportDocument.cpp
  2. 6
      src/adaptors/UBWebPublisher.cpp
  3. 10
      src/transition/UniboardSankoreTransition.cpp
  4. 3
      src/transition/UniboardSankoreTransition.h

@ -25,6 +25,8 @@
#include "quazip.h" #include "quazip.h"
#include "quazipfile.h" #include "quazipfile.h"
#include "transition/UniboardSankoreTransition.h"
#include "core/memcheck.h" #include "core/memcheck.h"
UBExportDocument::UBExportDocument(QObject *parent) UBExportDocument::UBExportDocument(QObject *parent)
@ -64,6 +66,9 @@ void UBExportDocument::persist(UBDocumentProxy* pDocumentProxy)
void UBExportDocument::persistsDocument(UBDocumentProxy* pDocumentProxy, QString filename) void UBExportDocument::persistsDocument(UBDocumentProxy* pDocumentProxy, QString filename)
{ {
UniboardSankoreTransition document;
QString documentPath(pDocumentProxy->persistencePath());
document.checkDocumentDirectory(documentPath);
QuaZip zip(filename); QuaZip zip(filename);
zip.setFileNameCodec("UTF-8"); zip.setFileNameCodec("UTF-8");

@ -21,6 +21,8 @@
#include "core/memcheck.h" #include "core/memcheck.h"
#include "transition/UniboardSankoreTransition.h"
UBWebPublisher::UBWebPublisher(QObject *parent) UBWebPublisher::UBWebPublisher(QObject *parent)
: UBExportAdaptor(parent) : UBExportAdaptor(parent)
{ {
@ -45,6 +47,10 @@ void UBWebPublisher::persist(UBDocumentProxy* pDocumentProxy)
if (!pDocumentProxy) if (!pDocumentProxy)
return; return;
UniboardSankoreTransition document;
QString documentPath(pDocumentProxy->persistencePath());
document.checkDocumentDirectory(documentPath);
UBDocumentPublisher* publisher = new UBDocumentPublisher(pDocumentProxy, this); // the publisher will self delete when publication finishes UBDocumentPublisher* publisher = new UBDocumentPublisher(pDocumentProxy, this); // the publisher will self delete when publication finishes
publisher->publish(); publisher->publish();

@ -65,6 +65,15 @@ void UniboardSankoreTransition::rollbackDocumentsTransition(QFileInfoList& fileI
} }
} }
bool UniboardSankoreTransition::checkDocumentDirectory(QString& documentDirectoryPath)
{
bool result = true;
result = updateSankoreHRef(documentDirectoryPath);
QString sankoreWidgetPath = documentDirectoryPath + "/widgets";
result &= updateIndexWidget(sankoreWidgetPath);
return result;
}
void UniboardSankoreTransition::documentTransition() void UniboardSankoreTransition::documentTransition()
{ {
if (QFileInfo(mUniboardSourceDirectory).exists() || QFileInfo(mOldSankoreDirectory).exists()){ if (QFileInfo(mUniboardSourceDirectory).exists() || QFileInfo(mOldSankoreDirectory).exists()){
@ -206,7 +215,6 @@ bool UniboardSankoreTransition::updateSankoreHRef(QString& sankoreDocumentPath)
QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(sankoreDocumentPath); QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(sankoreDocumentPath);
QFileInfoList::iterator fileInfo; QFileInfoList::iterator fileInfo;
QString sankoreDocumentDirectory = UBSettings::uniboardDocumentDirectory();
for (fileInfo = fileInfoList.begin(); fileInfo != fileInfoList.end() && result; fileInfo += 1) { for (fileInfo = fileInfoList.begin(); fileInfo != fileInfoList.end() && result; fileInfo += 1) {
if (fileInfo->fileName().endsWith("svg")){ if (fileInfo->fileName().endsWith("svg")){

@ -38,6 +38,9 @@ class UniboardSankoreTransition : public QObject
public: public:
explicit UniboardSankoreTransition(QObject *parent = 0); explicit UniboardSankoreTransition(QObject *parent = 0);
~UniboardSankoreTransition(); ~UniboardSankoreTransition();
bool checkDocumentDirectory(QString& documentDirectoryPath);
void documentTransition(); void documentTransition();
bool checkPage(QString& sankorePagePath); bool checkPage(QString& sankorePagePath);
bool updateSankoreHRef(QString &sankoreDocumentPath); bool updateSankoreHRef(QString &sankoreDocumentPath);

Loading…
Cancel
Save