Skip to content

Commit

Permalink
add directory properties dialog to browser dock
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennesky committed Nov 3, 2012
1 parent 14b472d commit e3ccde1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
23 changes: 20 additions & 3 deletions src/app/qgsbrowserdockwidget.cpp
Expand Up @@ -33,6 +33,8 @@
#include "qgsapplication.h"
#include "qgsmapcanvas.h"
#include <ui_qgsbrowserlayerpropertiesbase.h>
#include <ui_qgsbrowserdirectorypropertiesbase.h>


#include <QDragEnterEvent>
/**
Expand Down Expand Up @@ -330,14 +332,13 @@ void QgsBrowserDockWidget::showContextMenu( const QPoint & pt )
// only favourites can be removed
menu->addAction( tr( "Remove favourite" ), this, SLOT( removeFavourite() ) );
}

menu->addAction( tr( "Properties" ), this, SLOT( showProperties( ) ) );
}
else if ( item->type() == QgsDataItem::Layer )
{
menu->addAction( tr( "Add Layer" ), this, SLOT( addCurrentLayer( ) ) );
menu->addAction( tr( "Add Selected Layers" ), this, SLOT( addSelectedLayers() ) );
menu->addAction( tr( "Properties" ), this, SLOT( showProperties( ) ) );

}
else if ( item->type() == QgsDataItem::Favourites )
{
Expand Down Expand Up @@ -523,8 +524,10 @@ void QgsBrowserDockWidget::showProperties( )
QgsDebugMsg( "Entered" );
QModelIndex index = mBrowserView->currentIndex();
QgsDataItem* item = dataItem( index );
if ( ! item )
return;

if ( item != NULL && item->type() == QgsDataItem::Layer )
if ( item->type() == QgsDataItem::Layer )
{
QgsLayerItem *layerItem = qobject_cast<QgsLayerItem*>( item );
if ( layerItem != NULL )
Expand Down Expand Up @@ -601,6 +604,20 @@ void QgsBrowserDockWidget::showProperties( )
dialog->show();
}
}
else if ( item->type() == QgsDataItem::Directory )
{
// initialize dialog
QDialog *dialog = new QDialog( this );
Ui::QgsBrowserDirectoryPropertiesBase ui;
ui.setupUi( dialog );

dialog->setWindowTitle( tr( "Directory Properties" ) );
ui.leSource->setText( item->path() );
QgsDirectoryParamWidget *paramWidget = new QgsDirectoryParamWidget( item->path(), dialog );
ui.lytWidget->addWidget( paramWidget );

dialog->show();
}
}

void QgsBrowserDockWidget::showFilterWidget( bool visible )
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgsbrowserlayerpropertiesbase.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>617</height>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
Expand Down

0 comments on commit e3ccde1

Please sign in to comment.