Skip to content
Permalink
Browse files

[FEATURE] Add 'open directory' action to right click menu for

folders in browser dock

Opens the folder in the OS' file explorer
  • Loading branch information
nyalldawson committed Sep 19, 2017
1 parent dc72e14 commit 6ce3c6100df98fc9e4e29fba7618e6b6ba96c2f4
Showing with 18 additions and 0 deletions.
  1. +3 −0 python/core/qgsdataitem.sip
  2. +13 −0 src/core/qgsdataitem.cpp
  3. +2 −0 src/core/qgsdataitem.h
@@ -533,6 +533,9 @@ Check if the given path is hidden from the browser model
:rtype: bool
%End

virtual QList<QAction *> actions();



public slots:
virtual void childrenCreated();
@@ -27,6 +27,7 @@
#include <QTreeWidgetItem>
#include <QVector>
#include <QStyle>
#include <QDesktopServices>

#include "qgis.h"
#include "qgsdataitem.h"
@@ -852,6 +853,18 @@ bool QgsDirectoryItem::hiddenPath( const QString &path )
return ( idx > -1 );
}

QList<QAction *> QgsDirectoryItem::actions()
{
QList<QAction *> result;
QAction *openFolder = new QAction( tr( "Open Directory…" ), this );
connect( openFolder, &QAction::triggered, this, [ = ]
{
QDesktopServices::openUrl( QUrl::fromLocalFile( mDirPath ) );
} );
result << openFolder;
return result;
}


void QgsDirectoryItem::childrenCreated()
{
@@ -476,6 +476,8 @@ class CORE_EXPORT QgsDirectoryItem : public QgsDataCollectionItem
//! Check if the given path is hidden from the browser model
static bool hiddenPath( const QString &path );

QList<QAction *> actions() override;


public slots:
virtual void childrenCreated() override;

0 comments on commit 6ce3c61

Please sign in to comment.
You can’t perform that action at this time.