Skip to content

Commit 3235fb5

Browse files
committed
[ui] resurrect home folder
1 parent 359986d commit 3235fb5

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed
Loading

python/core/auto_generated/qgsdataitem.sip.in

+7
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,13 @@ A Collection: logical collection of layers or subcollections, e.g. GRASS locatio
508508
%Docstring
509509
Shared open directory icon.
510510

511+
.. versionadded:: 3.4
512+
%End
513+
514+
static QIcon homeDirIcon();
515+
%Docstring
516+
Shared home directory icon.
517+
511518
.. versionadded:: 3.4
512519
%End
513520
};

src/core/qgsbrowsermodel.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ void QgsBrowserModel::addRootItems()
9090
// give the home directory a prominent third place
9191
QgsDirectoryItem *item = new QgsDirectoryItem( nullptr, tr( "Home" ), QDir::homePath(), QStringLiteral( HOME_PREFIX ) + QDir::homePath() );
9292
item->setSortKey( QStringLiteral( " 2" ) );
93-
QStyle *style = QApplication::style();
94-
QIcon homeIcon( style->standardIcon( QStyle::SP_DirHomeIcon ) );
95-
item->setIcon( homeIcon );
9693
connectItem( item );
9794
mRootItems << item;
9895

src/core/qgsdataitem.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ QIcon QgsDataCollectionItem::openDirIcon()
9494
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconFolderOpen.svg" ) );
9595
}
9696

97+
QIcon QgsDataCollectionItem::homeDirIcon()
98+
{
99+
return QgsApplication::getThemeIcon( QStringLiteral( "mIconFolderHome.svg" ) );
100+
}
101+
97102
QIcon QgsDataCollectionItem::iconDir()
98103
{
99104
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconFolder.svg" ) );
@@ -730,6 +735,9 @@ void QgsDirectoryItem::init()
730735

731736
QIcon QgsDirectoryItem::icon()
732737
{
738+
if ( mDirPath == QDir::homePath() )
739+
return homeDirIcon();
740+
733741
// still loading? show the spinner
734742
if ( state() == Populating )
735743
return QgsDataItem::icon();

src/core/qgsdataitem.h

+6
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,12 @@ class CORE_EXPORT QgsDataCollectionItem : public QgsDataItem
530530
* \since QGIS 3.4
531531
*/
532532
static QIcon openDirIcon();
533+
534+
/**
535+
* Shared home directory icon.
536+
* \since QGIS 3.4
537+
*/
538+
static QIcon homeDirIcon();
533539
};
534540

535541
/**

0 commit comments

Comments
 (0)