Implemented adding to favorite from properties page

preferencesAboutTextFull
Anna Udovichenko 13 years ago
parent 4150279b9f
commit cfa100d2d8
  1. 19
      src/gui/UBFeaturesWidget.cpp
  2. 3
      src/gui/UBFeaturesWidget.h

@ -336,6 +336,17 @@ void UBFeaturesWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUr
}
void UBFeaturesWidget::addElementsToFavorite()
{
if ( currentStackedWidget == ID_PROPERTIES )
{
UBFeature feature = featureProperties->getCurrentElement();
if ( feature != UBFeature() && !UBApplication::isFromWeb( feature.getFullPath().toString() ) )
{
UBFeature elem = controller->addToFavorite( feature.getFullPath() );
featuresModel->addItem( elem );
}
}
else if ( currentStackedWidget == ID_LISTVIEW )
{
QModelIndexList selected = featuresListView->selectionModel()->selectedIndexes();
for ( int i = 0; i < selected.size(); ++i )
@ -345,6 +356,7 @@ void UBFeaturesWidget::addElementsToFavorite()
if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull() )
featuresModel->addItem( elem );
}
}
QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() );
model->invalidate();
}
@ -629,6 +641,13 @@ void UBFeatureProperties::showEvent (QShowEvent *event )
adaptSize();
}
UBFeature UBFeatureProperties::getCurrentElement() const
{
if ( mpElement )
return *mpElement;
return UBFeature();
}
void UBFeatureProperties::adaptSize()
{
if( NULL != mpOrigPixmap )

@ -152,8 +152,7 @@ public:
~UBFeatureProperties();
void showElement(const UBFeature &elem);
UBFeature getCurrentElement() const;
protected:
void resizeEvent(QResizeEvent *event);
void showEvent(QShowEvent *event);

Loading…
Cancel
Save