예제 #1
0
void UBFeaturesWidget::deleteSelectedElements()
{
    QModelIndexList selected = featuresListView->selectionModel()->selectedIndexes();
    QList <QUrl> urls;
    foreach ( QModelIndex sel, selected )
    {
        UBFeature feature = sel.data( Qt::UserRole + 1 ).value<UBFeature>();
        if ( feature.isDeletable() )
            urls.append( feature.getFullPath() );
    }
예제 #2
0
void UBFeaturesWidget::currentSelected(const QModelIndex &current)
{
    if (!current.isValid()) {
        qWarning() << "SLOT:currentSelected, invalid index catched";
        return;
    }

    QString objName = sender()->objectName();

    if (objName.isEmpty()) {
        qWarning() << "incorrect sender";
    } else if (objName == objNamePathList) {
        //Calling to reset the model for listView. Maybe separate function needed
        controller->searchStarted("", centralWidget->listView());
    }

    UBFeature feature = controller->getFeature(current, objName);

    if ( feature.isFolder() ) {
        QString newPath = feature.getFullVirtualPath();

        controller->setCurrentElement(feature);
        controller->siftElements(newPath);

        centralWidget->switchTo(UBFeaturesCentralWidget::MainList);

        if ( feature.getType() == FEATURE_FAVORITE ) {
            mActionBar->setCurrentState( IN_FAVORITE );

        }  else if ( feature.getType() == FEATURE_CATEGORY && feature.getName() == "root" ) {
            mActionBar->setCurrentState( IN_ROOT );

        } else if (feature.getType() == FEATURE_TRASH) {
            mActionBar->setCurrentState(IN_TRASH);

        } else if (feature.getType() == FEATURE_SEARCH) {
            //The search feature behavior is not standard. If features list clicked - show empty element
            //else show existing saved features search QWebView
            if (sender()->objectName() == objNameFeatureList) {
                centralWidget->showElement(feature, UBFeaturesCentralWidget::FeaturesWebView);
            } else if (sender()->objectName() == objNamePathList) {
                centralWidget->switchTo(UBFeaturesCentralWidget::FeaturesWebView);
            }

        } else  {
            mActionBar->setCurrentState(IN_FOLDER);
        }

//    } else if (feature.getType() == FEATURE_SEARCH) {
//        centralWidget->showElement(feature, UBFeaturesCentralWidget::FeaturesWebView);

    } else {
        centralWidget->showElement(feature, UBFeaturesCentralWidget::FeaturePropertiesList);
        mActionBar->setCurrentState( IN_PROPERTIES );
    }
    mActionBar->cleanText();
}
예제 #3
0
void UBFeaturesWidget::currentPathChanged(const QModelIndex &index)
{
	if ( index.isValid() )	
	{
		UBFeature feature = featuresPathModel->data(index, Qt::UserRole + 1).value<UBFeature>();
		QString newPath = feature.getFullVirtualPath();

		featuresPathModel->setPath( newPath );
		featuresPathModel->invalidate();

		featuresListView->setModel( featuresProxyModel );
		featuresProxyModel->setFilterFixedString(newPath);
		featuresProxyModel->invalidate();
		switchToListView();
		controller->setCurrentElement( feature );
		if ( feature.getType() == FEATURE_CATEGORY && feature.getName() == "root" )
		{
			mActionBar->setCurrentState( IN_ROOT );
		}
		else if (feature.getType() == FEATURE_FAVORITE)
		{
			mActionBar->setCurrentState( IN_FAVORITE );
		}
		else if (feature.getType() == FEATURE_TRASH)
		{
			mActionBar->setCurrentState( IN_TRASH );
		}
		else
		{
			mActionBar->setCurrentState( IN_FOLDER );
		}
	}
}
예제 #4
0
void UBFeaturesWidget::currentSelected(const QModelIndex &current)
{
	if (current.isValid())
	{
		QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() );
		/*QString name = model->data(current).toString();
		QString path = model->data(current, Qt::UserRole).toString();
		eUBLibElementType type = (eUBLibElementType)model->data(current, Qt::UserRole + 1).toInt();*/
		UBFeature feature = model->data(current, Qt::UserRole + 1).value<UBFeature>();

		if ( feature.isFolder() )
		{
			QString newPath = feature.getFullVirtualPath();
			//pathViewer->addPathElement( feature.getThumbnail(), newPath );
			controller->setCurrentElement( feature );

			model->setFilterFixedString( newPath );
			model->invalidate();
			switchToListView();

			featuresPathModel->setPath( newPath );
			featuresPathModel->invalidate();
			if ( feature.getType() == FEATURE_FAVORITE )
			{
				mActionBar->setCurrentState( IN_FAVORITE );
			}
			else if (feature.getType() == FEATURE_TRASH)
			{
				mActionBar->setCurrentState( IN_TRASH );
			}
			else
			{
				mActionBar->setCurrentState( IN_FOLDER );
			}
		}
		else if ( feature.getType() == FEATURE_SEARCH )
		{
			webView->showElement( feature );
			switchToWebView();
		}
		else
		{
			featureProperties->showElement( feature );
			switchToProperties();
			mActionBar->setCurrentState( IN_PROPERTIES );
		}
		
	}
}