diff --git a/src/board/UBFeaturesController.cpp b/src/board/UBFeaturesController.cpp index fee95d61..677b8333 100644 --- a/src/board/UBFeaturesController.cpp +++ b/src/board/UBFeaturesController.cpp @@ -359,16 +359,14 @@ UBFeature UBFeaturesController::newFolder( const QString &name ) void UBFeaturesController::addItemToPage(const UBFeature &item) { UBApplication::boardController->downloadURL( item.getFullPath() ); - /*if ( item.getType() == FEATURE_INTERNAL ) - { - UBApplication::boardController->downloadURL( QUrl( item.getFullPath() ) ); - } - else - { - UBApplication::boardController->downloadURL( QUrl::fromLocalFile( item.getFullPath() ) ); - }*/ } +void UBFeaturesController::addItemAsBackground(const UBFeature &item) +{ + UBApplication::boardController->downloadURL( item.getFullPath(), QPointF(), QSize(), true ); +} + + UBFeature UBFeaturesController::getDestinationForItem( const QUrl &url ) { QString mimetype = UBFileSystemUtils::mimeTypeFromFileName( fileNameFromUrl(url) ); diff --git a/src/board/UBFeaturesController.h b/src/board/UBFeaturesController.h index 92f6a6a9..8569b499 100644 --- a/src/board/UBFeaturesController.h +++ b/src/board/UBFeaturesController.h @@ -70,7 +70,8 @@ public: const QString& getRootPath()const { return rootPath; } - void addItemToPage(const UBFeature &item); + void addItemToPage( const UBFeature &item ); + void addItemAsBackground( const UBFeature &item ); const UBFeature& getCurrentElement()const { return currentElement; } void setCurrentElement( const UBFeature &elem ) { currentElement = elem; } const UBFeature & getTrashElement () const { return trashElement; } diff --git a/src/gui/UBFeaturesWidget.cpp b/src/gui/UBFeaturesWidget.cpp index 5b211c83..f2d686c3 100644 --- a/src/gui/UBFeaturesWidget.cpp +++ b/src/gui/UBFeaturesWidget.cpp @@ -555,7 +555,8 @@ UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) : mpObjInfos->setStyleSheet("background:white;"); mpLayout->addWidget(mpObjInfos, 1); - connect(mpAddPageButton, SIGNAL(clicked()), this, SLOT(onAddToPage())); + connect( mpAddPageButton, SIGNAL(clicked()), this, SLOT(onAddToPage()) ); + connect( mpSetAsBackgroundButton, SIGNAL( clicked() ), this, SLOT( onSetAsBackground() ) ); } @@ -626,22 +627,13 @@ void UBFeatureProperties::onAddToPage() QWidget *w = parentWidget()->parentWidget(); UBFeaturesWidget* featuresWidget = dynamic_cast( w ); featuresWidget->getFeaturesController()->addItemToPage( *mpElement ); - /*if ( UBApplication::isFromWeb( mpElement->getVirtualPath() ) ) - { - sDownloadFileDesc desc; - desc.isBackground = false; - desc.modal = true; - desc.name = QFileInfo( mpElement->getName() ).fileName(); - desc.url = mpElement->getVirtualPath(); - UBDownloadManager::downloadManager()->addFileToDownload(desc); +} - } - else - { - QWidget *w = parentWidget()->parentWidget(); - UBFeaturesWidget* featuresWidget = dynamic_cast( w ); - featuresWidget->getFeaturesController()->addItemToPage( *mpElement ); - }*/ +void UBFeatureProperties::onSetAsBackground() +{ + QWidget *w = parentWidget()->parentWidget(); + UBFeaturesWidget* featuresWidget = dynamic_cast( w ); + featuresWidget->getFeaturesController()->addItemAsBackground( *mpElement ); } UBFeatureProperties::~UBFeatureProperties() @@ -704,14 +696,15 @@ QMimeData* UBFeaturesModel::mimeData(const QModelIndexList &indexes) const if ( index.isValid() ) { UBFeature element = data( index, Qt::UserRole + 1 ).value(); - if ( element.getType() == FEATURE_INTERNAL ) + urlList.push_back( element.getFullPath() ); + /*if ( element.getType() == FEATURE_INTERNAL ) { urlList.push_back( QUrl( element.getFullPath() ) ); } else if ( element.getType() == FEATURE_INTERACTIVE || element.getType() == FEATURE_ITEM ) { urlList.push_back( element.getFullPath() ); - } + }*/ } } mimeData->setUrls( urlList ); diff --git a/src/gui/UBFeaturesWidget.h b/src/gui/UBFeaturesWidget.h index 572adbc6..a76584b7 100644 --- a/src/gui/UBFeaturesWidget.h +++ b/src/gui/UBFeaturesWidget.h @@ -157,7 +157,7 @@ protected: private slots: void onAddToPage(); //void onAddToLib(); - //void onSetAsBackground(); + void onSetAsBackground(); //void onBack(); private: