|
|
@ -1,3 +1,5 @@ |
|
|
|
|
|
|
|
#include <QDomDocument> |
|
|
|
|
|
|
|
|
|
|
|
#include "UBFeaturesWidget.h" |
|
|
|
#include "UBFeaturesWidget.h" |
|
|
|
#include "domain/UBAbstractWidget.h" |
|
|
|
#include "domain/UBAbstractWidget.h" |
|
|
|
#include "gui/UBThumbnailWidget.h" |
|
|
|
#include "gui/UBThumbnailWidget.h" |
|
|
@ -6,6 +8,7 @@ |
|
|
|
#include "core/UBApplication.h" |
|
|
|
#include "core/UBApplication.h" |
|
|
|
#include "core/UBDownloadManager.h" |
|
|
|
#include "core/UBDownloadManager.h" |
|
|
|
#include "globals/UBGlobals.h" |
|
|
|
#include "globals/UBGlobals.h" |
|
|
|
|
|
|
|
#include "board/UBBoardController.h" |
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent) |
|
|
|
UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -49,12 +52,14 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale |
|
|
|
|
|
|
|
|
|
|
|
//featuresListView->setStyleSheet( QString("background: #EEEEEE;border-radius: 10px;border: 2px solid #999999;") );
|
|
|
|
//featuresListView->setStyleSheet( QString("background: #EEEEEE;border-radius: 10px;border: 2px solid #999999;") );
|
|
|
|
featuresListView->setDragDropMode( QAbstractItemView::DragDrop ); |
|
|
|
featuresListView->setDragDropMode( QAbstractItemView::DragDrop ); |
|
|
|
|
|
|
|
featuresListView->setSelectionMode( QAbstractItemView::ContiguousSelection ); |
|
|
|
featuresListView->setModel( featuresProxyModel ); |
|
|
|
featuresListView->setModel( featuresProxyModel ); |
|
|
|
|
|
|
|
|
|
|
|
featuresListView->setResizeMode( QListView::Adjust ); |
|
|
|
featuresListView->setResizeMode( QListView::Adjust ); |
|
|
|
featuresListView->setViewMode( QListView::IconMode ); |
|
|
|
featuresListView->setViewMode( QListView::IconMode ); |
|
|
|
itemDelegate = new UBFeaturesItemDelegate( this, featuresListView ); |
|
|
|
itemDelegate = new UBFeaturesItemDelegate( this, featuresListView ); |
|
|
|
featuresListView->setItemDelegate( itemDelegate ); |
|
|
|
featuresListView->setItemDelegate( itemDelegate ); |
|
|
|
|
|
|
|
//featuresListView->setSelectionRectVisible(false);
|
|
|
|
|
|
|
|
|
|
|
|
featuresListView->setIconSize( QSize(defaultThumbnailSize, defaultThumbnailSize) ); |
|
|
|
featuresListView->setIconSize( QSize(defaultThumbnailSize, defaultThumbnailSize) ); |
|
|
|
featuresListView->setGridSize( QSize(defaultThumbnailSize * 1.75, defaultThumbnailSize * 1.75) ); |
|
|
|
featuresListView->setGridSize( QSize(defaultThumbnailSize * 1.75, defaultThumbnailSize * 1.75) ); |
|
|
@ -70,13 +75,17 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale |
|
|
|
pathListView->setSelectionMode( QAbstractItemView::NoSelection ); |
|
|
|
pathListView->setSelectionMode( QAbstractItemView::NoSelection ); |
|
|
|
pathListView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); |
|
|
|
pathListView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); |
|
|
|
pathListView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); |
|
|
|
pathListView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); |
|
|
|
|
|
|
|
pathListView->setFlow( QListView::LeftToRight ); |
|
|
|
|
|
|
|
pathListView->setWrapping(false); |
|
|
|
|
|
|
|
|
|
|
|
//pathListView->setResizeMode( QListView::Adjust );
|
|
|
|
//pathListView->setResizeMode( QListView::Adjust );
|
|
|
|
//pathListView->setMovement( QListView::Static );
|
|
|
|
//pathListView->setMovement( QListView::Static );
|
|
|
|
pathListView->setDragDropMode( QAbstractItemView::DragDrop ); |
|
|
|
pathListView->setDragDropMode( QAbstractItemView::DropOnly ); |
|
|
|
|
|
|
|
|
|
|
|
pathScene = new QGraphicsScene(this); |
|
|
|
pathScene = new QGraphicsScene(this); |
|
|
|
//pathViewer = new UBFeaturesPathViewer( QPixmap(":images/libpalette/home.png"), controller->getRootPath(), pathScene, this );
|
|
|
|
//pathViewer = new UBFeaturesPathViewer( QPixmap(":images/libpalette/home.png"), controller->getRootPath(), pathScene, this );
|
|
|
|
featureProperties = new UBFeatureProperties(this); |
|
|
|
featureProperties = new UBFeatureProperties(this); |
|
|
|
|
|
|
|
webView = new UBFeaturesWebView(this); |
|
|
|
|
|
|
|
|
|
|
|
//layout->addWidget( pathViewer );
|
|
|
|
//layout->addWidget( pathViewer );
|
|
|
|
//pathViewer->show();
|
|
|
|
//pathViewer->show();
|
|
|
@ -86,6 +95,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale |
|
|
|
|
|
|
|
|
|
|
|
stackedWidget->addWidget( featuresListView ); |
|
|
|
stackedWidget->addWidget( featuresListView ); |
|
|
|
stackedWidget->addWidget( featureProperties ); |
|
|
|
stackedWidget->addWidget( featureProperties ); |
|
|
|
|
|
|
|
stackedWidget->addWidget( webView ); |
|
|
|
stackedWidget->setCurrentIndex(ID_LISTVIEW); |
|
|
|
stackedWidget->setCurrentIndex(ID_LISTVIEW); |
|
|
|
currentStackedWidget = ID_LISTVIEW; |
|
|
|
currentStackedWidget = ID_LISTVIEW; |
|
|
|
|
|
|
|
|
|
|
@ -169,11 +179,20 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mActionBar->setCurrentState( IN_FAVORITE ); |
|
|
|
mActionBar->setCurrentState( IN_FAVORITE ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if (feature.getType() == FEATURE_TRASH) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mActionBar->setCurrentState( IN_TRASH ); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
mActionBar->setCurrentState( IN_FOLDER ); |
|
|
|
mActionBar->setCurrentState( IN_FOLDER ); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if ( feature.getType() == FEATURE_SEARCH ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
webView->showElement( feature ); |
|
|
|
|
|
|
|
switchToWebView(); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
featureProperties->showElement( feature ); |
|
|
|
featureProperties->showElement( feature ); |
|
|
@ -207,6 +226,10 @@ void UBFeaturesWidget::currentPathChanged(const QModelIndex &index) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mActionBar->setCurrentState( IN_FAVORITE ); |
|
|
|
mActionBar->setCurrentState( IN_FAVORITE ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if (feature.getType() == FEATURE_TRASH) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mActionBar->setCurrentState( IN_TRASH ); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
mActionBar->setCurrentState( IN_FOLDER ); |
|
|
|
mActionBar->setCurrentState( IN_FOLDER ); |
|
|
@ -223,7 +246,6 @@ void UBFeaturesWidget::createNewFolder() |
|
|
|
featuresModel->addItem( newFolder ); |
|
|
|
featuresModel->addItem( newFolder ); |
|
|
|
featuresProxyModel->invalidate(); |
|
|
|
featuresProxyModel->invalidate(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::deleteElements( const QMimeData & mimeData ) |
|
|
|
void UBFeaturesWidget::deleteElements( const QMimeData & mimeData ) |
|
|
@ -295,6 +317,11 @@ void UBFeaturesWidget::switchToProperties() |
|
|
|
currentStackedWidget = ID_PROPERTIES; |
|
|
|
currentStackedWidget = ID_PROPERTIES; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::switchToWebView() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
stackedWidget->setCurrentIndex(ID_WEBVIEW); |
|
|
|
|
|
|
|
currentStackedWidget = ID_WEBVIEW; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
@ -314,11 +341,39 @@ UBFeaturesWidget::~UBFeaturesWidget() |
|
|
|
{ |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesListView::UBFeaturesListView( QWidget* parent, const char* name ) : QListView(parent) |
|
|
|
UBFeaturesListView::UBFeaturesListView( QWidget* parent, const char* name )
|
|
|
|
|
|
|
|
: QListView(parent) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setObjectName(name); |
|
|
|
setObjectName(name); |
|
|
|
|
|
|
|
//rubberBand = new UBRubberBand( QRubberBand::Rectangle, this );
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
void UBFeaturesListView::mousePressEvent( QMouseEvent *event ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
rubberOrigin = event->pos(); |
|
|
|
|
|
|
|
rubberBand->setGeometry( QRect( rubberOrigin, QSize() ) ); |
|
|
|
|
|
|
|
//qDebug() << rubberOrigin.x() << rubberOrigin.y();
|
|
|
|
|
|
|
|
rubberBand->show(); |
|
|
|
|
|
|
|
QListView::mousePressEvent(event); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesListView::mouseMoveEvent( QMouseEvent *event ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QPoint current = event->pos(); |
|
|
|
|
|
|
|
rubberBand->setGeometry( QRect( rubberOrigin, current ).normalized() ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//setSelection( rubberBand->rect(), QItemSelectionModel::Select );
|
|
|
|
|
|
|
|
QListView::mouseMoveEvent(event); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesListView::mouseReleaseEvent( QMouseEvent *event ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
rubberBand->hide(); |
|
|
|
|
|
|
|
QListView::mouseReleaseEvent(event); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
void UBFeaturesListView::dragEnterEvent( QDragEnterEvent *event ) |
|
|
|
void UBFeaturesListView::dragEnterEvent( QDragEnterEvent *event ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ( event->mimeData()->hasUrls() ) |
|
|
|
if ( event->mimeData()->hasUrls() ) |
|
|
@ -335,6 +390,96 @@ void UBFeaturesListView::dropEvent( QDropEvent *event ) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget(parent) |
|
|
|
|
|
|
|
, mpView(NULL) |
|
|
|
|
|
|
|
, mpWebSettings(NULL) |
|
|
|
|
|
|
|
, mpLayout(NULL) |
|
|
|
|
|
|
|
, mpSankoreAPI(NULL) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
setObjectName(name); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SET_STYLE_SHEET(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mpLayout = new QVBoxLayout(); |
|
|
|
|
|
|
|
setLayout(mpLayout); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mpView = new QWebView(this); |
|
|
|
|
|
|
|
mpView->setObjectName("SearchEngineView"); |
|
|
|
|
|
|
|
mpSankoreAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene()); |
|
|
|
|
|
|
|
mpView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mpSankoreAPI); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mpWebSettings = QWebSettings::globalSettings(); |
|
|
|
|
|
|
|
mpWebSettings->setAttribute(QWebSettings::JavaEnabled, true); |
|
|
|
|
|
|
|
mpWebSettings->setAttribute(QWebSettings::PluginsEnabled, true); |
|
|
|
|
|
|
|
mpWebSettings->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true); |
|
|
|
|
|
|
|
mpWebSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true); |
|
|
|
|
|
|
|
mpWebSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); |
|
|
|
|
|
|
|
mpWebSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true); |
|
|
|
|
|
|
|
mpWebSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mpLayout->addWidget(mpView); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(mpView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesWebView::~UBFeaturesWebView() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(NULL != mpSankoreAPI){ |
|
|
|
|
|
|
|
delete mpSankoreAPI; |
|
|
|
|
|
|
|
mpSankoreAPI = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(NULL != mpView){ |
|
|
|
|
|
|
|
delete mpView; |
|
|
|
|
|
|
|
mpView = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(NULL != mpLayout){ |
|
|
|
|
|
|
|
delete mpLayout; |
|
|
|
|
|
|
|
mpLayout = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWebView::showElement(const UBFeature &elem) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QString qsWidgetName; |
|
|
|
|
|
|
|
QString path = elem.getFullPath(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString qsConfigPath = QString("%0/config.xml").arg(path); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(QFile::exists(qsConfigPath)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QFile f(qsConfigPath); |
|
|
|
|
|
|
|
if(f.open(QIODevice::ReadOnly)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QDomDocument domDoc; |
|
|
|
|
|
|
|
domDoc.setContent(QString(f.readAll())); |
|
|
|
|
|
|
|
QDomElement root = domDoc.documentElement(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QDomNode node = root.firstChild(); |
|
|
|
|
|
|
|
while(!node.isNull()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(node.toElement().tagName() == "content") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QDomAttr srcAttr = node.toElement().attributeNode("src"); |
|
|
|
|
|
|
|
qsWidgetName = srcAttr.value(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
node = node.nextSibling(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
f.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mpView->load(QUrl::fromLocalFile(QString("%0/%1").arg(path).arg(qsWidgetName)));
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWebView::onLoadFinished(bool ok) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(ok && NULL != mpSankoreAPI){ |
|
|
|
|
|
|
|
mpView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mpSankoreAPI); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) : QWidget(parent) |
|
|
|
UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) : QWidget(parent) |
|
|
|
, mpLayout(NULL) |
|
|
|
, mpLayout(NULL) |
|
|
|
, mpButtonLayout(NULL) |
|
|
|
, mpButtonLayout(NULL) |
|
|
@ -460,6 +605,16 @@ void UBFeatureProperties::onAddToPage() |
|
|
|
|
|
|
|
|
|
|
|
UBFeatureProperties::~UBFeatureProperties() |
|
|
|
UBFeatureProperties::~UBFeatureProperties() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if ( mpOrigPixmap ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete mpOrigPixmap; |
|
|
|
|
|
|
|
mpOrigPixmap = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ( mpElement ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete mpElement; |
|
|
|
|
|
|
|
mpElement = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBFeatureItemButton::UBFeatureItemButton(QWidget *parent, const char *name):QPushButton(parent) |
|
|
|
UBFeatureItemButton::UBFeatureItemButton(QWidget *parent, const char *name):QPushButton(parent) |
|
|
@ -536,19 +691,15 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act |
|
|
|
|
|
|
|
|
|
|
|
int endRow = 0; |
|
|
|
int endRow = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeature parentFeature; |
|
|
|
if ( !parent.isValid() ) |
|
|
|
if ( !parent.isValid() ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return false; |
|
|
|
parentFeature = dynamic_cast<UBFeaturesWidget *>(QObject::parent())->getFeaturesController()->getCurrentElement(); |
|
|
|
/*if (row < 0)
|
|
|
|
|
|
|
|
endRow = featuresList->size(); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
endRow = qMin( row, featuresList->size() );*/ |
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else |
|
|
|
else |
|
|
|
endRow = parent.row(); |
|
|
|
{ |
|
|
|
Q_UNUSED(endRow) //why do we need this variable?
|
|
|
|
parentFeature = parent.data( Qt::UserRole + 1).value<UBFeature>(); |
|
|
|
|
|
|
|
} |
|
|
|
UBFeature parentFeature = parent.data( Qt::UserRole + 1).value<UBFeature>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QList<QUrl> urls = mimeData->urls(); |
|
|
|
QList<QUrl> urls = mimeData->urls(); |
|
|
|
|
|
|
|
|
|
|
@ -627,8 +778,25 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const |
|
|
|
return Qt::ItemIsDragEnabled | defaultFlags; |
|
|
|
return Qt::ItemIsDragEnabled | defaultFlags; |
|
|
|
if ( item.isFolder() && !item.getFullPath().isNull() ) |
|
|
|
if ( item.isFolder() && !item.getFullPath().isNull() ) |
|
|
|
return defaultFlags | Qt::ItemIsDropEnabled; |
|
|
|
return defaultFlags | Qt::ItemIsDropEnabled; |
|
|
|
else return defaultFlags; |
|
|
|
else return defaultFlags | Qt::ItemIsDropEnabled; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/*if ( index.isValid() )
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBFeature item = index.data( Qt::UserRole + 1 ).value<UBFeature>(); |
|
|
|
|
|
|
|
switch( item.getType() ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case FEATURE_CATEGORY: |
|
|
|
|
|
|
|
case FEATURE_FOLDER: |
|
|
|
|
|
|
|
case FEATURE_FAVORITE: |
|
|
|
|
|
|
|
case FEATURE_TRASH: |
|
|
|
|
|
|
|
return Qt::ItemIsDropEnabled | Qt::ItemIsEnabled; |
|
|
|
|
|
|
|
case FEATURE_INTERACTIVE: |
|
|
|
|
|
|
|
case FEATURE_INTERNAL: |
|
|
|
|
|
|
|
case FEATURE_ITEM:
|
|
|
|
|
|
|
|
return Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsSelectable; |
|
|
|
|
|
|
|
default:; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}*/ |
|
|
|
return defaultFlags | Qt::ItemIsDropEnabled; |
|
|
|
return defaultFlags | Qt::ItemIsDropEnabled; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -692,13 +860,7 @@ QString UBFeaturesItemDelegate::displayText ( const QVariant & value, const QLoc |
|
|
|
{ |
|
|
|
{ |
|
|
|
const QFontMetrics fm = listView->fontMetrics(); |
|
|
|
const QFontMetrics fm = listView->fontMetrics(); |
|
|
|
const QSize iSize = listView->iconSize(); |
|
|
|
const QSize iSize = listView->iconSize(); |
|
|
|
|
|
|
|
return elidedText( fm, iSize.width(), Qt::ElideRight, text ); |
|
|
|
if ( iSize.width() > 0 && fm.width(text) > iSize.width() ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
while (fm.width(text) > iSize.width()) |
|
|
|
|
|
|
|
text.resize(text.size()-1); |
|
|
|
|
|
|
|
text += "..."; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return text; |
|
|
|
return text; |
|
|
|
} |
|
|
|
} |
|
|
|