Skip to content

Commit e3ccde1

Browse files
committedNov 3, 2012
add directory properties dialog to browser dock
1 parent 14b472d commit e3ccde1

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed
 

‎src/app/qgsbrowserdockwidget.cpp

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include "qgsapplication.h"
3434
#include "qgsmapcanvas.h"
3535
#include <ui_qgsbrowserlayerpropertiesbase.h>
36+
#include <ui_qgsbrowserdirectorypropertiesbase.h>
37+
3638

3739
#include <QDragEnterEvent>
3840
/**
@@ -330,14 +332,13 @@ void QgsBrowserDockWidget::showContextMenu( const QPoint & pt )
330332
// only favourites can be removed
331333
menu->addAction( tr( "Remove favourite" ), this, SLOT( removeFavourite() ) );
332334
}
333-
335+
menu->addAction( tr( "Properties" ), this, SLOT( showProperties( ) ) );
334336
}
335337
else if ( item->type() == QgsDataItem::Layer )
336338
{
337339
menu->addAction( tr( "Add Layer" ), this, SLOT( addCurrentLayer( ) ) );
338340
menu->addAction( tr( "Add Selected Layers" ), this, SLOT( addSelectedLayers() ) );
339341
menu->addAction( tr( "Properties" ), this, SLOT( showProperties( ) ) );
340-
341342
}
342343
else if ( item->type() == QgsDataItem::Favourites )
343344
{
@@ -523,8 +524,10 @@ void QgsBrowserDockWidget::showProperties( )
523524
QgsDebugMsg( "Entered" );
524525
QModelIndex index = mBrowserView->currentIndex();
525526
QgsDataItem* item = dataItem( index );
527+
if ( ! item )
528+
return;
526529

527-
if ( item != NULL && item->type() == QgsDataItem::Layer )
530+
if ( item->type() == QgsDataItem::Layer )
528531
{
529532
QgsLayerItem *layerItem = qobject_cast<QgsLayerItem*>( item );
530533
if ( layerItem != NULL )
@@ -601,6 +604,20 @@ void QgsBrowserDockWidget::showProperties( )
601604
dialog->show();
602605
}
603606
}
607+
else if ( item->type() == QgsDataItem::Directory )
608+
{
609+
// initialize dialog
610+
QDialog *dialog = new QDialog( this );
611+
Ui::QgsBrowserDirectoryPropertiesBase ui;
612+
ui.setupUi( dialog );
613+
614+
dialog->setWindowTitle( tr( "Directory Properties" ) );
615+
ui.leSource->setText( item->path() );
616+
QgsDirectoryParamWidget *paramWidget = new QgsDirectoryParamWidget( item->path(), dialog );
617+
ui.lytWidget->addWidget( paramWidget );
618+
619+
dialog->show();
620+
}
604621
}
605622

606623
void QgsBrowserDockWidget::showFilterWidget( bool visible )

‎src/ui/qgsbrowserlayerpropertiesbase.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>800</width>
10-
<height>617</height>
10+
<height>600</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">

0 commit comments

Comments
 (0)
Please sign in to comment.