diff --git a/src/adaptors/publishing/UBDocumentPublisher.cpp b/src/adaptors/publishing/UBDocumentPublisher.cpp index c7630b48..39174dba 100644 --- a/src/adaptors/publishing/UBDocumentPublisher.cpp +++ b/src/adaptors/publishing/UBDocumentPublisher.cpp @@ -301,7 +301,7 @@ void UBDocumentPublisher::upgradeDocumentForPublishing() QString startFile = widget->mainHtmlFileName(); jsonFile.write(QString(" \"startFile\": \"%1\",\n").arg(startFile).toUtf8()); - QMap preferences = widget->preferences(); + QMap preferences = widget->UBGraphicsWidgetItem::preferences(); jsonFile.write(QString(" \"preferences\": {\n").toUtf8()); @@ -360,7 +360,7 @@ void UBDocumentPublisher::upgradeDocumentForPublishing() void UBDocumentPublisher::generateWidgetPropertyScript(UBGraphicsW3CWidgetItem *widgetItem, int pageNumber) { - QMap preferences = widgetItem->preferences(); + QMap preferences = widgetItem->UBGraphicsWidgetItem::preferences(); QMap datastoreEntries = widgetItem->datastoreEntries(); QString startFileName = widgetItem->mainHtmlFileName(); diff --git a/src/api/UBW3CWidgetAPI.cpp b/src/api/UBW3CWidgetAPI.cpp index 80d30c55..fddcafb1 100644 --- a/src/api/UBW3CWidgetAPI.cpp +++ b/src/api/UBW3CWidgetAPI.cpp @@ -118,7 +118,7 @@ void UBW3CWidgetAPI::openURL(const QString& url) } -UBW3CWidgetPreferenceAPI::UBW3CWidgetPreferenceAPI(UBGraphicsW3CWidgetItem *graphicsWidget, QOBject *parent) +UBW3CWidgetPreferenceAPI::UBW3CWidgetPreferenceAPI(UBGraphicsW3CWidgetItem *graphicsWidget, QObject *parent) : UBW3CWebStorage(parent) , mGraphicsW3CWidget(graphicsWidget) { @@ -133,7 +133,7 @@ UBW3CWidgetPreferenceAPI::~UBW3CWidgetPreferenceAPI() QString UBW3CWidgetPreferenceAPI::key(int index) { - QMap w3CPrefs = mGraphicsW3CWidget->preferences(); + QMap w3CPrefs = mGraphicsW3CWidget->preferences(); if (index < w3CPrefs.size()) return w3CPrefs.keys().at(index); @@ -141,22 +141,28 @@ QString UBW3CWidgetPreferenceAPI::key(int index) return ""; } - QString UBW3CWidgetPreferenceAPI::getItem(const QString& key) { if (mGraphicsW3CWidget) { - QMap w3cPref = mGraphicsW3CWidget->preferences(); + QMap docPref = mGraphicsW3CWidget->UBGraphicsWidgetItem::preferences(); + if (docPref.contains(key)) + return docPref.value(key); + } + + QMap w3cPrefs = mGraphicsW3CWidget->preferences(); - if (w3cPref.contains(key)) - return w3cPref.value(key).value; + if (w3cPrefs.contains(key)) { + UBGraphicsW3CWidgetItem::PreferenceValue pref = w3cPrefs.value(key); + return pref.value; } - return ""; -} + else + return ""; +} int UBW3CWidgetPreferenceAPI::length() { - QMap w3cPrefs = mGraphicsW3CWidget-->preferences(); + QMap w3cPrefs = mGraphicsW3CWidget->preferences(); return w3cPrefs.size(); } @@ -165,7 +171,7 @@ int UBW3CWidgetPreferenceAPI::length() void UBW3CWidgetPreferenceAPI::setItem(const QString& key, const QString& value) { if (mGraphicsW3CWidget) { - QMap w3cPrefs = mGraphicsW3CWidget->preferences(); + QMap w3cPrefs = mGraphicsW3CWidget->preferences(); if (w3cPrefs.contains(key) && !w3cPrefs.value(key).readonly) mGraphicsW3CWidget->setPreference(key, value); @@ -173,6 +179,8 @@ void UBW3CWidgetPreferenceAPI::setItem(const QString& key, const QString& value) } + + void UBW3CWidgetPreferenceAPI::removeItem(const QString& key) { if (mGraphicsW3CWidget) diff --git a/src/api/UBW3CWidgetAPI.h b/src/api/UBW3CWidgetAPI.h index bd7cc2e9..cc00efe0 100644 --- a/src/api/UBW3CWidgetAPI.h +++ b/src/api/UBW3CWidgetAPI.h @@ -108,7 +108,7 @@ class UBW3CWidgetPreferenceAPI : public UBW3CWebStorage Q_OBJECT; public: - UBW3CWidgetPreferenceAPI(UBGraphicsW3CWidgetItem *graphicsWidget, QOBject *parent = 0); + UBW3CWidgetPreferenceAPI(UBGraphicsW3CWidgetItem *graphicsWidget, QObject *parent = 0); virtual ~UBW3CWidgetPreferenceAPI(); diff --git a/src/api/UBWidgetMessageAPI.cpp b/src/api/UBWidgetMessageAPI.cpp index c4286e30..306f2702 100644 --- a/src/api/UBWidgetMessageAPI.cpp +++ b/src/api/UBWidgetMessageAPI.cpp @@ -17,7 +17,7 @@ #include "core/UBApplication.h" -#include "domain/UBGraphicsWidget.h" +#include "domain/UBGraphicsWebView.h" #include "core/memcheck.h" diff --git a/src/api/UBWidgetUniboardAPI.cpp b/src/api/UBWidgetUniboardAPI.cpp index ba163d4e..14fc1d87 100644 --- a/src/api/UBWidgetUniboardAPI.cpp +++ b/src/api/UBWidgetUniboardAPI.cpp @@ -79,7 +79,7 @@ UBWidgetUniboardAPI::UBWidgetUniboardAPI(UBGraphicsScene *pScene, UBGraphicsWidg if (w3CGraphicsWidget) { - mMessagesAPI = new UBWidgetMessageAPI(w3CGraphicsWidget->w3cWidget()); + mMessagesAPI = new UBWidgetMessageAPI(w3CGraphicsWidget); mDatastoreAPI = new UBDatastoreAPI(w3CGraphicsWidget); } @@ -547,7 +547,7 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QDropEvent *event) QDropEvent readyEvent(dropPoint, dropActions, &dropMimeData, dropMouseButtons, dropModifiers); //sending event to destination either it had been downloaded or not - QApplication::sendEvent(mGraphicsWidget->widgetWebView(),&readyEvent); + QApplication::sendEvent(mGraphicsWidget,&readyEvent); readyEvent.acceptProposedAction(); } @@ -602,11 +602,11 @@ void UBWidgetUniboardAPI::onDownloadFinished(bool pSuccess, sDownloadFileDesc de //To make js interpreter accept drop event we need to generate move event first. QDragMoveEvent pseudoMove(dropPoint, desc.dropActions, &dropMimeData, desc.dropMouseButtons, desc.dropModifiers); - QApplication::sendEvent(mGraphicsWidget->widgetWebView(),&pseudoMove); + QApplication::sendEvent(mGraphicsWidget,&pseudoMove); QDropEvent readyEvent(dropPoint, desc.dropActions, &dropMimeData, desc.dropMouseButtons, desc.dropModifiers); //sending event to destination either it had been downloaded or not - QApplication::sendEvent(mGraphicsWidget->widgetWebView(),&readyEvent); + QApplication::sendEvent(mGraphicsWidget,&readyEvent); readyEvent.acceptProposedAction(); } diff --git a/src/api/UBWidgetUniboardAPI.h b/src/api/UBWidgetUniboardAPI.h index 1f42508b..385f9417 100644 --- a/src/api/UBWidgetUniboardAPI.h +++ b/src/api/UBWidgetUniboardAPI.h @@ -57,7 +57,7 @@ class UBWidgetUniboardAPI : public QObject * * some potential values are * - * enlocale + * en * en-UK * fr * fr-CH diff --git a/src/domain/UBGraphicsWebView.cpp b/src/domain/UBGraphicsWebView.cpp index e244191e..0071882e 100644 --- a/src/domain/UBGraphicsWebView.cpp +++ b/src/domain/UBGraphicsWebView.cpp @@ -48,7 +48,7 @@ UBGraphicsWebView::~UBGraphicsWebView() QVariant UBGraphicsWebView::itemChange(GraphicsItemChange change, const QVariant &value) { - if (change == QGraphicsItem::ItemCursorHasChanged && scene()) + /*if (change == QGraphicsItem::ItemCursorHasChanged && scene()) { unsetCursor(); } @@ -66,10 +66,11 @@ QVariant UBGraphicsWebView::itemChange(GraphicsItemChange change, const QVariant scene()->setActiveWindow(0); } } - } + }*/ QVariant newValue = mDelegate->itemChange(change, value); return QGraphicsWebView::itemChange(change, newValue); + //return QGraphicsWebView::itemChange(change, value); } void UBGraphicsWebView::setUuid(const QUuid &pUuid) diff --git a/src/domain/UBGraphicsWidgetItem.cpp b/src/domain/UBGraphicsWidgetItem.cpp index 798d30df..b388df6f 100644 --- a/src/domain/UBGraphicsWidgetItem.cpp +++ b/src/domain/UBGraphicsWidgetItem.cpp @@ -924,9 +924,9 @@ UBItem* UBGraphicsW3CWidgetItem::deepCopy() const copy->resize(this->size().width(), this->size().height()); - foreach(QString key, mPreferences.keys()) + foreach(QString key, UBGraphicsWidgetItem::preferences().keys()) { - copy->setPreference(key, mPreferences.value(key)); + copy->setPreference(key, UBGraphicsWidgetItem::preferences().value(key)); } foreach(QString key, mDatastore.keys()) diff --git a/src/domain/UBGraphicsWidgetItem.h b/src/domain/UBGraphicsWidgetItem.h index b19ddf98..d9914da1 100644 --- a/src/domain/UBGraphicsWidgetItem.h +++ b/src/domain/UBGraphicsWidgetItem.h @@ -100,8 +100,6 @@ class UBGraphicsWidgetItem : public UBGraphicsWebView bool hasEmbededObjects(); bool hasEmbededFlash(); - void resize(qreal width, qreal height); - QSize nominalSize() const { return mNominalSize; @@ -191,7 +189,7 @@ class UBGraphicsWidgetItem : public UBGraphicsWebView virtual void injectInlineJavaScript(); virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); - virtual void dropEvent(QDropEvent *); + //virtual void dropEvent(QDropEvent *); /* end from */ protected slots: @@ -274,6 +272,26 @@ class UBGraphicsW3CWidgetItem : public UBGraphicsWidgetItem static bool hasNPAPIWrapper(const QString& pMimeType); + class PreferenceValue + { + public: + + PreferenceValue() + { + // NOOP + } + + + PreferenceValue(const QString& pValue, bool pReadonly) + { + value = pValue; + readonly = pReadonly; + } + + QString value; + bool readonly; + }; + class Metadata { public: @@ -286,6 +304,10 @@ class UBGraphicsW3CWidgetItem : public UBGraphicsWidgetItem QString version; }; + QMap preferences() + { + return mPreferences; + } Metadata metadatas() const { @@ -300,6 +322,8 @@ class UBGraphicsW3CWidgetItem : public UBGraphicsWidgetItem private: + QMap mPreferences; + UBW3CWidgetAPI* mW3CWidgetAPI; static bool sTemplateLoaded; diff --git a/src/gui/UBToolWidget.cpp b/src/gui/UBToolWidget.cpp index a12b2cd7..7c4caa3a 100644 --- a/src/gui/UBToolWidget.cpp +++ b/src/gui/UBToolWidget.cpp @@ -131,12 +131,12 @@ void UBToolWidget::javaScriptWindowObjectCleared() mToolWidget->page()->mainFrame()->addToJavaScriptWindowObject("sankore", uniboardAPI); - UBW3CWidget* w3c = dynamic_cast(mToolWidget); + /*UBW3CWidget* w3c = dynamic_cast(mToolWidget); if (w3c) { UBW3CWidgetAPI* widgetAPI = new UBW3CWidgetAPI(w3c); mToolWidget->page()->mainFrame()->addToJavaScriptWindowObject("widget", widgetAPI); - } + }*/ }