Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[ui] resurrect home folder
  • Loading branch information
nirvn committed Oct 3, 2018
1 parent 359986d commit 3235fb5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions images/themes/default/mIconFolderHome.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions python/core/auto_generated/qgsdataitem.sip.in
Expand Up @@ -508,6 +508,13 @@ A Collection: logical collection of layers or subcollections, e.g. GRASS locatio
%Docstring
Shared open directory icon.

.. versionadded:: 3.4
%End

static QIcon homeDirIcon();
%Docstring
Shared home directory icon.

.. versionadded:: 3.4
%End
};
Expand Down
3 changes: 0 additions & 3 deletions src/core/qgsbrowsermodel.cpp
Expand Up @@ -90,9 +90,6 @@ void QgsBrowserModel::addRootItems()
// give the home directory a prominent third place
QgsDirectoryItem *item = new QgsDirectoryItem( nullptr, tr( "Home" ), QDir::homePath(), QStringLiteral( HOME_PREFIX ) + QDir::homePath() );
item->setSortKey( QStringLiteral( " 2" ) );
QStyle *style = QApplication::style();
QIcon homeIcon( style->standardIcon( QStyle::SP_DirHomeIcon ) );
item->setIcon( homeIcon );
connectItem( item );
mRootItems << item;

Expand Down
8 changes: 8 additions & 0 deletions src/core/qgsdataitem.cpp
Expand Up @@ -94,6 +94,11 @@ QIcon QgsDataCollectionItem::openDirIcon()
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconFolderOpen.svg" ) );
}

QIcon QgsDataCollectionItem::homeDirIcon()
{
return QgsApplication::getThemeIcon( QStringLiteral( "mIconFolderHome.svg" ) );
}

QIcon QgsDataCollectionItem::iconDir()
{
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconFolder.svg" ) );
Expand Down Expand Up @@ -730,6 +735,9 @@ void QgsDirectoryItem::init()

QIcon QgsDirectoryItem::icon()
{
if ( mDirPath == QDir::homePath() )
return homeDirIcon();

// still loading? show the spinner
if ( state() == Populating )
return QgsDataItem::icon();
Expand Down
6 changes: 6 additions & 0 deletions src/core/qgsdataitem.h
Expand Up @@ -530,6 +530,12 @@ class CORE_EXPORT QgsDataCollectionItem : public QgsDataItem
* \since QGIS 3.4
*/
static QIcon openDirIcon();

/**
* Shared home directory icon.
* \since QGIS 3.4
*/
static QIcon homeDirIcon();
};

/**
Expand Down

0 comments on commit 3235fb5

Please sign in to comment.