Skip to content

Commit 5e1348b

Browse files
committed
address comment, update (and vectorize) zip icon
1 parent 29ac3f4 commit 5e1348b

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

images/images.qrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@
483483
<file>themes/default/mIconWcs.svg</file>
484484
<file>themes/default/mIconWfs.svg</file>
485485
<file>themes/default/mIconWms.svg</file>
486-
<file>themes/default/mIconZip.png</file>
486+
<file>themes/default/mIconZip.svg</file>
487487
<file>themes/default/mIconZoom.svg</file>
488488
<file>themes/default/mIndicatorFilter.svg</file>
489489
<file>themes/default/mLayoutItem.svg</file>

images/themes/default/mIconZip.png

-966 Bytes
Binary file not shown.

images/themes/default/mIconZip.svg

Lines changed: 1 addition & 0 deletions
Loading

src/core/qgsdataitem.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ QVariant QgsFavoritesItem::sortKey() const
111111

112112
QIcon QgsZipItem::iconZip()
113113
{
114-
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconZip.png" ) );
115-
// icon from http://www.softicons.com/free-icons/application-icons/mega-pack-icons-1-by-nikolay-verin/winzip-folder-icon
114+
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconZip.svg" ) );
116115
}
117116

118117
QgsAnimatedIcon *QgsDataItem::sPopulatingIcon = nullptr;
@@ -802,14 +801,16 @@ QVector<QgsDataItem *> QgsDirectoryItem::createChildren()
802801
QString path = dir.absoluteFilePath( name );
803802
QFileInfo fileInfo( path );
804803

805-
if ( fileInfo.suffix() == QLatin1String( "qgs" ) || fileInfo.suffix() == QLatin1String( "qgz" ) )
804+
if ( fileInfo.suffix().compare( QLatin1String( "qgs" ), Qt::CaseInsensitive ) == 0 ||
805+
fileInfo.suffix().compare( QLatin1String( "qgz" ), Qt::CaseInsensitive ) == 0 )
806806
{
807807
QgsDataItem *item = new QgsProjectItem( this, fileInfo.completeBaseName(), path );
808808
children.append( item );
809809
continue;
810810
}
811811

812-
if ( fileInfo.suffix() == QLatin1String( "zip" ) )
812+
if ( fileInfo.suffix().compare( QLatin1String( "zip" ), Qt::CaseInsensitive ) == 0 ||
813+
fileInfo.suffix().compare( QLatin1String( "tar" ), Qt::CaseInsensitive ) == 0 )
813814
{
814815
QgsDataItem *item = QgsZipItem::itemFromPath( this, path, name, mPath + '/' + name );
815816
if ( item )
@@ -1280,12 +1281,12 @@ QgsZipItem::QgsZipItem( QgsDataItem *parent, const QString &name, const QString
12801281
void QgsZipItem::init()
12811282
{
12821283
mType = Collection; //Zip??
1283-
mIconName = QStringLiteral( "/mIconZip.png" );
1284+
mIconName = QStringLiteral( "/mIconZip.svg" );
12841285
mVsiPrefix = vsiPrefix( mFilePath );
12851286

12861287
if ( sProviderNames.isEmpty() )
12871288
{
1288-
sProviderNames << QStringLiteral( "OGR" ) << QStringLiteral( "OGR" );
1289+
sProviderNames << QStringLiteral( "OGR" ) << QStringLiteral( "GDAL" );
12891290
}
12901291
}
12911292

@@ -1408,13 +1409,12 @@ QgsDataItem *QgsZipItem::itemFromPath( QgsDataItem *parent, const QString &fileP
14081409
}
14091410

14101411
// only display if has children or if is not populated
1411-
if ( zipItem && ( !populated || zipItem->rowCount() > 1 ) )
1412+
if ( zipItem && ( !populated || zipItem->rowCount() > 0 ) )
14121413
{
14131414
QgsDebugMsgLevel( "returning zipItem", 3 );
14141415
return zipItem;
14151416
}
14161417

1417-
// if 1 or 0 child found, let provider(s) create individual items
14181418
return nullptr;
14191419
}
14201420

src/providers/gdal/qgsgdaldataitems.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class QgsGdalDataItemProvider : public QgsDataItemProvider
4545
public:
4646
QString name() override { return QStringLiteral( "GDAL" ); }
4747

48-
int capabilities() override { return QgsDataProvider::File | QgsDataProvider::Dir; }
48+
int capabilities() override { return QgsDataProvider::File | QgsDataProvider::Dir | QgsDataProvider::Net; }
4949

5050
QgsDataItem *createDataItem( const QString &pathIn, QgsDataItem *parentItem ) override;
5151
};

src/providers/ogr/qgsogrdataitems.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class QgsOgrDataItemProvider : public QgsDataItemProvider
108108
public:
109109
QString name() override { return QStringLiteral( "OGR" ); }
110110

111-
int capabilities() override { return QgsDataProvider::File | QgsDataProvider::Dir; }
111+
int capabilities() override { return QgsDataProvider::File | QgsDataProvider::Dir | QgsDataProvider::Net; }
112112

113113
QgsDataItem *createDataItem( const QString &path, QgsDataItem *parentItem ) override;
114114

0 commit comments

Comments
 (0)