Commit 70efd6d9 authored by Claudio Valerio's avatar Claudio Valerio

fixed issue af flash not showed

parent a7415550
...@@ -343,6 +343,8 @@ void UBTeacherGuideEditionWidget::onAddItemClicked(QTreeWidgetItem* widget, int ...@@ -343,6 +343,8 @@ void UBTeacherGuideEditionWidget::onAddItemClicked(QTreeWidgetItem* widget, int
} }
} }
else if(column == 1 && addSubItemWidgetType == eUBTGAddSubItemWidgetType_None){ else if(column == 1 && addSubItemWidgetType == eUBTGAddSubItemWidgetType_None){
UBTGMediaWidget* media = dynamic_cast<UBTGMediaWidget*>(mpTreeWidget->itemWidget(widget,0));
if(media) media->removeSource();
int index = mpTreeWidget->currentIndex().row(); int index = mpTreeWidget->currentIndex().row();
QTreeWidgetItem* toBeDeletedWidgetItem = widget->parent()->takeChild(index); QTreeWidgetItem* toBeDeletedWidgetItem = widget->parent()->takeChild(index);
delete toBeDeletedWidgetItem; delete toBeDeletedWidgetItem;
......
...@@ -342,6 +342,15 @@ void UBTGMediaWidget::initializeWithDom(QDomElement element) ...@@ -342,6 +342,15 @@ void UBTGMediaWidget::initializeWithDom(QDomElement element)
mIsInitializationMode = false; mIsInitializationMode = false;
} }
void UBTGMediaWidget::removeSource()
{
QFileInfo fileInfo(mMediaPath);
if(fileInfo.isFile())
QFile(mMediaPath).remove();
else
UBFileSystemUtils::deleteDir(mMediaPath);
}
void UBTGMediaWidget::hideEvent(QHideEvent* event) void UBTGMediaWidget::hideEvent(QHideEvent* event)
{ {
if(mpWebView) if(mpWebView)
...@@ -361,9 +370,11 @@ tUBGEElementNode* UBTGMediaWidget::saveData() ...@@ -361,9 +370,11 @@ tUBGEElementNode* UBTGMediaWidget::saveData()
if(!mpTitle) if(!mpTitle)
return 0; return 0;
tUBGEElementNode* result = new tUBGEElementNode(); tUBGEElementNode* result = new tUBGEElementNode();
QString relativePath = mMediaPath;
relativePath = relativePath.replace(UBApplication::boardController->activeDocument()->persistencePath()+"/","");
result->name = "media"; result->name = "media";
result->attributes.insert("title",mpTitle->text()); result->attributes.insert("title",mpTitle->text());
result->attributes.insert("relativePath",mMediaPath.replace(UBApplication::boardController->activeDocument()->persistencePath()+"/","")); result->attributes.insert("relativePath",relativePath);
result->attributes.insert("mediaType",mMediaType); result->attributes.insert("mediaType",mMediaType);
return result; return result;
} }
......
...@@ -140,6 +140,7 @@ public: ...@@ -140,6 +140,7 @@ public:
~UBTGMediaWidget(); ~UBTGMediaWidget();
tUBGEElementNode* saveData(); tUBGEElementNode* saveData();
void initializeWithDom(QDomElement element); void initializeWithDom(QDomElement element);
void removeSource();
protected: protected:
void dragEnterEvent(QDragEnterEvent* event); void dragEnterEvent(QDragEnterEvent* event);
......
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