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

@ -337,6 +337,17 @@ void UBFeaturesWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUr
void UBFeaturesWidget::addElementsToFavorite() 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(); QModelIndexList selected = featuresListView->selectionModel()->selectedIndexes();
for ( int i = 0; i < selected.size(); ++i ) for ( int i = 0; i < selected.size(); ++i )
{ {
@ -345,6 +356,7 @@ void UBFeaturesWidget::addElementsToFavorite()
if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull() ) if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull() )
featuresModel->addItem( elem ); featuresModel->addItem( elem );
} }
}
QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() ); QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() );
model->invalidate(); model->invalidate();
} }
@ -629,6 +641,13 @@ void UBFeatureProperties::showEvent (QShowEvent *event )
adaptSize(); adaptSize();
} }
UBFeature UBFeatureProperties::getCurrentElement() const
{
if ( mpElement )
return *mpElement;
return UBFeature();
}
void UBFeatureProperties::adaptSize() void UBFeatureProperties::adaptSize()
{ {
if( NULL != mpOrigPixmap ) if( NULL != mpOrigPixmap )

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

Loading…
Cancel
Save