Skip to content

Commit feaa671

Browse files
committed
Merge branch 'master' of github.com:qgis/Quantum-GIS
2 parents 93c2fec + 3996d89 commit feaa671

18 files changed

+513
-435
lines changed

src/app/qgsbrowserdockwidget.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ void QgsBrowserDockWidget::refreshModel( const QModelIndex& index )
269269
for ( int i = 0 ; i < mModel->rowCount( index ); i++ )
270270
{
271271
QModelIndex idx = mModel->index( i, 0, index );
272-
if ( mBrowserView->isExpanded( idx ) )
272+
if ( mBrowserView->isExpanded( idx ) || !mModel->hasChildren( idx ) )
273273
{
274274
refreshModel( idx );
275275
}

src/browser/qgsbrowser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ void QgsBrowser::refresh( const QModelIndex& index )
531531
for ( int i = 0 ; i < mModel->rowCount( index ); i++ )
532532
{
533533
QModelIndex idx = mModel->index( i, 0, index );
534-
if ( treeView->isExpanded( idx ) )
534+
if ( treeView->isExpanded( idx ) || !mModel->hasChildren( idx ) )
535535
{
536536
refresh( idx );
537537
}

src/core/qgsdataitem.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -565,3 +565,16 @@ void QgsDirectoryParamWidget::showHideColumn()
565565
}
566566
settings.setValue( "/dataitem/directoryHiddenColumns", lst );
567567
}
568+
569+
570+
QgsErrorItem::QgsErrorItem( QgsDataItem* parent, QString error, QString path )
571+
: QgsDataItem( QgsDataItem::Error, parent, error, path )
572+
{
573+
mIcon = QIcon( getThemePixmap( "/mIconDelete.png" ) );
574+
575+
mPopulated = true; // no more children
576+
}
577+
578+
QgsErrorItem::~QgsErrorItem()
579+
{
580+
}

src/core/qgsdataitem.h

+19
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class CORE_EXPORT QgsDataItem : public QObject
4646
Collection,
4747
Directory,
4848
Layer,
49+
Error,
4950
};
5051

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

229+
/**
230+
Data item that can be used to report problems (e.g. network error)
231+
*/
232+
class CORE_EXPORT QgsErrorItem : public QgsDataItem
233+
{
234+
Q_OBJECT
235+
public:
236+
237+
QgsErrorItem( QgsDataItem* parent, QString error, QString path );
238+
~QgsErrorItem();
239+
240+
//QVector<QgsDataItem*> createChildren();
241+
//virtual bool equal( const QgsDataItem *other );
242+
};
243+
244+
245+
// ---------
246+
228247
class QgsDirectoryParamWidget : public QTreeWidget
229248
{
230249
Q_OBJECT

src/gui/qgsattributeeditor.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -762,9 +762,15 @@ bool QgsAttributeEditor::setValue( QWidget *editor, QgsVectorLayer *vl, int idx,
762762
case QgsVectorLayer::FileName:
763763
case QgsVectorLayer::Calendar:
764764
{
765-
QLineEdit *le = editor->findChild<QLineEdit *>();
766-
if ( le == NULL )
765+
QLineEdit* le = qobject_cast<QLineEdit*>( editor );
766+
if( !le )
767+
{
768+
le = editor->findChild<QLineEdit *>();
769+
}
770+
if ( !le )
771+
{
767772
return false;
773+
}
768774
le->setText( value.toString() );
769775
}
770776
break;

src/mapserver/qgsconfigparser.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,25 @@ QgsConfigParser::~QgsConfigParser()
4242
{
4343
delete it.value();
4444
}
45+
46+
//remove the temporary files
47+
for ( QList<QTemporaryFile*>::const_iterator it = mFilesToRemove.constBegin(); it != mFilesToRemove.constEnd(); ++it )
48+
{
49+
delete *it;
50+
}
51+
52+
//and also those the temporary file paths
53+
for ( QList<QString>::const_iterator it = mFilePathsToRemove.constBegin(); it != mFilePathsToRemove.constEnd(); ++it )
54+
{
55+
QFile::remove( *it );
56+
}
57+
58+
//delete the layers in the list
59+
QList<QgsMapLayer*>::iterator layer_it = mLayersToRemove.begin();
60+
for ( ; layer_it != mLayersToRemove.end(); ++layer_it )
61+
{
62+
delete *layer_it;
63+
}
4564
}
4665

4766
void QgsConfigParser::setDefaultLegendSettings()

src/mapserver/qgsconfigparser.h

+15-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <QFont>
2424
#include <QList>
2525
#include <QSet>
26+
#include <QTemporaryFile>
2627

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

4344
/**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.
44-
If no layers/style are found, an empty list is returned*/
45-
virtual QList<QgsMapLayer*> mapLayerFromStyle( const QString& layerName, const QString& styleName, bool allowCaching = true ) const = 0;
45+
If no layers/style are found, an empty list is returned
46+
@param allowCache true if layer can be read from / written to cache*/
47+
virtual QList<QgsMapLayer*> mapLayerFromStyle( const QString& layerName, const QString& styleName, bool useCache = true ) const = 0;
4648

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

129+
//todo: leave this to the layer cash?
130+
/**Stores pointers to layers that have to be removed in the destructor of QgsSLDParser*/
131+
mutable QList<QgsMapLayer*> mLayersToRemove;
132+
133+
/**Stores the temporary file objects. The class takes ownership of the objects and deletes them in the destructor*/
134+
mutable QList<QTemporaryFile*> mFilesToRemove;
135+
136+
/**Stores paths of files that need to be removed after each request (necessary because of contours shapefiles that \
137+
cannot be handles with QTemporaryFile*/
138+
mutable QList<QString> mFilePathsToRemove;
139+
127140
/**Layer font for GetLegendGraphics*/
128141
QFont mLegendLayerFont;
129142
/**Item font for GetLegendGraphics*/

0 commit comments

Comments
 (0)