Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' of github.com:qgis/Quantum-GIS
  • Loading branch information
pcav committed Oct 17, 2011
2 parents 93c2fec + 3996d89 commit feaa671
Show file tree
Hide file tree
Showing 18 changed files with 513 additions and 435 deletions.
2 changes: 1 addition & 1 deletion src/app/qgsbrowserdockwidget.cpp
Expand Up @@ -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 );
}
Expand Down
2 changes: 1 addition & 1 deletion src/browser/qgsbrowser.cpp
Expand Up @@ -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 );
}
Expand Down
13 changes: 13 additions & 0 deletions src/core/qgsdataitem.cpp
Expand Up @@ -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()
{
}
19 changes: 19 additions & 0 deletions src/core/qgsdataitem.h
Expand Up @@ -46,6 +46,7 @@ class CORE_EXPORT QgsDataItem : public QObject
Collection,
Directory,
Layer,
Error,
};

QgsDataItem( QgsDataItem::Type type, QgsDataItem* parent, QString name, QString path );
Expand Down Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions src/gui/qgsattributeeditor.cpp
Expand Up @@ -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;
Expand Down
19 changes: 19 additions & 0 deletions src/mapserver/qgsconfigparser.cpp
Expand Up @@ -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()
Expand Down
17 changes: 15 additions & 2 deletions src/mapserver/qgsconfigparser.h
Expand Up @@ -23,6 +23,7 @@
#include <QFont>
#include <QList>
#include <QSet>
#include <QTemporaryFile>

class QgsComposition;
class QgsComposerLabel;
Expand All @@ -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;
Expand Down Expand Up @@ -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*/
Expand Down

0 comments on commit feaa671

Please sign in to comment.