|
|
@ -121,7 +121,8 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale |
|
|
|
connect( mActionBar, SIGNAL( deleteElements(const QMimeData &) ), this, SLOT( deleteElements(const QMimeData &) ) );
|
|
|
|
connect( mActionBar, SIGNAL( deleteElements(const QMimeData &) ), this, SLOT( deleteElements(const QMimeData &) ) );
|
|
|
|
connect( mActionBar, SIGNAL( addToFavorite(const QMimeData &) ), this, SLOT( addToFavorite(const QMimeData &) ) ); |
|
|
|
connect( mActionBar, SIGNAL( addToFavorite(const QMimeData &) ), this, SLOT( addToFavorite(const QMimeData &) ) ); |
|
|
|
connect( mActionBar, SIGNAL( removeFromFavorite(const QMimeData &) ), this, SLOT( removeFromFavorite(const QMimeData &) ) ); |
|
|
|
connect( mActionBar, SIGNAL( removeFromFavorite(const QMimeData &) ), this, SLOT( removeFromFavorite(const QMimeData &) ) ); |
|
|
|
connect ( mActionBar, SIGNAL( addElementsToFavorite() ), this, SLOT ( addElementsToFavorite() ) );
|
|
|
|
connect( mActionBar, SIGNAL( addElementsToFavorite() ), this, SLOT ( addElementsToFavorite() ) ); |
|
|
|
|
|
|
|
connect( mActionBar, SIGNAL( removeElementsFromFavorite() ), this, SLOT ( removeElementsFromFavorite() ) ); |
|
|
|
connect( pathListView, SIGNAL(clicked( const QModelIndex & ) ), |
|
|
|
connect( pathListView, SIGNAL(clicked( const QModelIndex & ) ), |
|
|
|
this, SLOT( currentPathChanged( const QModelIndex & ) ) ); |
|
|
|
this, SLOT( currentPathChanged( const QModelIndex & ) ) ); |
|
|
|
connect( thumbSlider, SIGNAL( sliderMoved(int) ), this, SLOT(thumbnailSizeChanged( int ) ) ); |
|
|
|
connect( thumbSlider, SIGNAL( sliderMoved(int) ), this, SLOT(thumbnailSizeChanged( int ) ) ); |
|
|
@ -348,6 +349,25 @@ void UBFeaturesWidget::addElementsToFavorite() |
|
|
|
model->invalidate(); |
|
|
|
model->invalidate(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::removeElementsFromFavorite() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QModelIndexList selected = featuresListView->selectionModel()->selectedIndexes(); |
|
|
|
|
|
|
|
//qSort( selected.begin(), selected.end(), qGreater<QModelIndex>() );
|
|
|
|
|
|
|
|
QList <QUrl> items; |
|
|
|
|
|
|
|
for ( int i = 0; i < selected.size(); ++i ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBFeature feature = selected.at(i).data( Qt::UserRole + 1 ).value<UBFeature>(); |
|
|
|
|
|
|
|
items.append( feature.getFullPath() ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
foreach ( QUrl url, items ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->removeFromFavorite( url ); |
|
|
|
|
|
|
|
featuresModel->deleteFavoriteItem( url.toString() ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() ); |
|
|
|
|
|
|
|
model->invalidate(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::switchToListView() |
|
|
|
void UBFeaturesWidget::switchToListView() |
|
|
|
{ |
|
|
|
{ |
|
|
|
stackedWidget->setCurrentIndex(ID_LISTVIEW); |
|
|
|
stackedWidget->setCurrentIndex(ID_LISTVIEW); |
|
|
@ -854,7 +874,7 @@ void UBFeaturesModel::deleteFavoriteItem( const QString &path ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for ( int i = 0; i < featuresList->size(); ++i ) |
|
|
|
for ( int i = 0; i < featuresList->size(); ++i ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ( !QString::compare( featuresList->at(i).getUrl(), path, Qt::CaseInsensitive ) && |
|
|
|
if ( !QString::compare( featuresList->at(i).getFullPath().toString(), path, Qt::CaseInsensitive ) && |
|
|
|
!QString::compare( featuresList->at(i).getVirtualPath(), "/root/favorites", Qt::CaseInsensitive ) ) |
|
|
|
!QString::compare( featuresList->at(i).getVirtualPath(), "/root/favorites", Qt::CaseInsensitive ) ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
removeRow( i, QModelIndex() ); |
|
|
|
removeRow( i, QModelIndex() ); |
|
|
@ -889,6 +909,7 @@ bool UBFeaturesModel::removeRow( int row, const QModelIndex & parent ) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const |
|
|
|
Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
Qt::ItemFlags defaultFlags = QAbstractItemModel::flags(index); |
|
|
|
Qt::ItemFlags defaultFlags = QAbstractItemModel::flags(index); |
|
|
|