Skip to content
Permalink
Browse files

Merge branch 'master' of github.com:qgis/Quantum-GIS

  • Loading branch information
pcav committed Oct 17, 2011
2 parents 93c2fec + 3996d89 commit feaa671e276cbfc5482edc26a291beaf41f1d16c
@@ -269,7 +269,7 @@ void QgsBrowserDockWidget::refreshModel( const QModelIndex& index )
for ( int i = 0 ; i < mModel->rowCount( index ); i++ )
{
QModelIndex idx = mModel->index( i, 0, index );
if ( mBrowserView->isExpanded( idx ) )
if ( mBrowserView->isExpanded( idx ) || !mModel->hasChildren( idx ) )
{
refreshModel( idx );
}
@@ -531,7 +531,7 @@ void QgsBrowser::refresh( const QModelIndex& index )
for ( int i = 0 ; i < mModel->rowCount( index ); i++ )
{
QModelIndex idx = mModel->index( i, 0, index );
if ( treeView->isExpanded( idx ) )
if ( treeView->isExpanded( idx ) || !mModel->hasChildren( idx ) )
{
refresh( idx );
}
@@ -565,3 +565,16 @@ void QgsDirectoryParamWidget::showHideColumn()
}
settings.setValue( "/dataitem/directoryHiddenColumns", lst );
}


QgsErrorItem::QgsErrorItem( QgsDataItem* parent, QString error, QString path )
: QgsDataItem( QgsDataItem::Error, parent, error, path )
{
mIcon = QIcon( getThemePixmap( "/mIconDelete.png" ) );

mPopulated = true; // no more children
}

QgsErrorItem::~QgsErrorItem()
{
}
@@ -46,6 +46,7 @@ class CORE_EXPORT QgsDataItem : public QObject
Collection,
Directory,
Layer,
Error,
};

QgsDataItem( QgsDataItem::Type type, QgsDataItem* parent, QString name, QString path );
@@ -225,6 +226,24 @@ class CORE_EXPORT QgsDirectoryItem : public QgsDataCollectionItem
static QVector<QLibrary*> mLibraries;
};

/**
Data item that can be used to report problems (e.g. network error)
*/
class CORE_EXPORT QgsErrorItem : public QgsDataItem
{
Q_OBJECT
public:

QgsErrorItem( QgsDataItem* parent, QString error, QString path );
~QgsErrorItem();

//QVector<QgsDataItem*> createChildren();
//virtual bool equal( const QgsDataItem *other );
};


// ---------

class QgsDirectoryParamWidget : public QTreeWidget
{
Q_OBJECT
@@ -762,9 +762,15 @@ bool QgsAttributeEditor::setValue( QWidget *editor, QgsVectorLayer *vl, int idx,
case QgsVectorLayer::FileName:
case QgsVectorLayer::Calendar:
{
QLineEdit *le = editor->findChild<QLineEdit *>();
if ( le == NULL )
QLineEdit* le = qobject_cast<QLineEdit*>( editor );
if( !le )
{
le = editor->findChild<QLineEdit *>();
}
if ( !le )
{
return false;
}
le->setText( value.toString() );
}
break;
@@ -42,6 +42,25 @@ QgsConfigParser::~QgsConfigParser()
{
delete it.value();
}

//remove the temporary files
for ( QList<QTemporaryFile*>::const_iterator it = mFilesToRemove.constBegin(); it != mFilesToRemove.constEnd(); ++it )
{
delete *it;
}

//and also those the temporary file paths
for ( QList<QString>::const_iterator it = mFilePathsToRemove.constBegin(); it != mFilePathsToRemove.constEnd(); ++it )
{
QFile::remove( *it );
}

//delete the layers in the list
QList<QgsMapLayer*>::iterator layer_it = mLayersToRemove.begin();
for ( ; layer_it != mLayersToRemove.end(); ++layer_it )
{
delete *layer_it;
}
}

void QgsConfigParser::setDefaultLegendSettings()
@@ -23,6 +23,7 @@
#include <QFont>
#include <QList>
#include <QSet>
#include <QTemporaryFile>

class QgsComposition;
class QgsComposerLabel;
@@ -41,8 +42,9 @@ class QgsConfigParser
virtual void layersAndStylesCapabilities( QDomElement& parentElement, QDomDocument& doc ) const = 0;

/**Returns one or possibly several maplayers for a given layer name and style. If there are several layers, the layers should be drawn in inverse list order.
If no layers/style are found, an empty list is returned*/
virtual QList<QgsMapLayer*> mapLayerFromStyle( const QString& layerName, const QString& styleName, bool allowCaching = true ) const = 0;
If no layers/style are found, an empty list is returned
@param allowCache true if layer can be read from / written to cache*/
virtual QList<QgsMapLayer*> mapLayerFromStyle( const QString& layerName, const QString& styleName, bool useCache = true ) const = 0;

/**Returns number of layers in configuration*/
virtual int numberOfLayers() const = 0;
@@ -124,6 +126,17 @@ class QgsConfigParser
/**List of GML datasets passed outside SLD (e.g. in a SOAP request). Key of the map is the layer name*/
QMap<QString, QDomDocument*> mExternalGMLDatasets;

//todo: leave this to the layer cash?
/**Stores pointers to layers that have to be removed in the destructor of QgsSLDParser*/
mutable QList<QgsMapLayer*> mLayersToRemove;

/**Stores the temporary file objects. The class takes ownership of the objects and deletes them in the destructor*/
mutable QList<QTemporaryFile*> mFilesToRemove;

/**Stores paths of files that need to be removed after each request (necessary because of contours shapefiles that \
cannot be handles with QTemporaryFile*/
mutable QList<QString> mFilePathsToRemove;

/**Layer font for GetLegendGraphics*/
QFont mLegendLayerFont;
/**Item font for GetLegendGraphics*/

0 comments on commit feaa671

Please sign in to comment.
You can’t perform that action at this time.