Commit 6df0f114 authored by Claudio Valerio's avatar Claudio Valerio

All exported document will be checked against absolut path

parent 0edf49ad
...@@ -25,6 +25,8 @@ ...@@ -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) ...@@ -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 @@ ...@@ -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) ...@@ -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 ...@@ -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) ...@@ -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 ...@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment