2 changes: 1 addition & 1 deletion images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,14 @@
<file>themes/gis/plugins/quick_print.png</file>
<file>themes/gis/plugins/scale_bar.png</file>
<file>themes/gis/plugins/spit.png</file>
<file>themes/gis/plugins/wfs.png</file>
<file>splash/splash.png</file>
<file>north_arrows/default.png</file>
<file>themes/default/locked.png</file>
<file>themes/default/unlocked.png</file>
<file>themes/default/plugins/copyright_label.png</file>
<file>themes/default/plugins/north_arrow.png</file>
<file>themes/default/plugins/scale_bar.png</file>
<file>themes/default/mActionAddWfsLayer.png</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
Expand Down
File renamed without changes
Binary file removed images/themes/gis/plugins/wfs.png
Binary file not shown.
32 changes: 32 additions & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ void QgisApp::createActions()
connect( mActionAddPgLayer, SIGNAL( triggered() ), this, SLOT( addDatabaseLayer() ) );
connect( mActionAddSpatiaLiteLayer, SIGNAL( triggered() ), this, SLOT( addSpatiaLiteLayer() ) );
connect( mActionAddWmsLayer, SIGNAL( triggered() ), this, SLOT( addWmsLayer() ) );
connect( mActionAddWfsLayer, SIGNAL( triggered() ), this, SLOT( addWfsLayer() ) );
connect( mActionOpenTable, SIGNAL( triggered() ), this, SLOT( attributeTable() ) );
connect( mActionToggleEditing, SIGNAL( triggered() ), this, SLOT( toggleEditing() ) );
connect( mActionSaveEdits, SIGNAL( triggered() ), this, SLOT( saveEdits() ) );
Expand Down Expand Up @@ -1468,6 +1469,7 @@ void QgisApp::setTheme( QString theThemeName )
mActionNewBookmark->setIcon( getThemeIcon( "/mActionNewBookmark.png" ) );
mActionCustomProjection->setIcon( getThemeIcon( "/mActionCustomProjection.png" ) );
mActionAddWmsLayer->setIcon( getThemeIcon( "/mActionAddWmsLayer.png" ) );
mActionAddWfsLayer->setIcon( getThemeIcon( "/mActionAddWfsLayer.png" ) );
mActionAddToOverview->setIcon( getThemeIcon( "/mActionInOverview.png" ) );
mActionAnnotation->setIcon( getThemeIcon( "/mActionAnnotation.png" ) );
mActionFormAnnotation->setIcon( getThemeIcon( "/mActionFormAnnotation.png" ) );
Expand Down Expand Up @@ -2427,6 +2429,36 @@ void QgisApp::addWmsLayer()
delete wmss;
}

void QgisApp::addWfsLayer()
{
if ( mMapCanvas && mMapCanvas->isDrawing() )
{
return;
}
// Fudge for now
QgsDebugMsg( "about to addWfsLayer" );

// TODO: QDialog for now, switch to QWidget in future
QDialog *wfss = dynamic_cast<QDialog*>( QgsProviderRegistry::instance()->selectWidget( QString( "WFS" ), this ) );
if ( !wfss )
{
QMessageBox::warning( this, tr( "WFS" ), tr( "Cannot get WFS select dialog from provider." ) );
return;
}
connect( wfss , SIGNAL( addWfsLayer( QString, QString ) ),
this , SLOT( addWfsLayer( QString, QString ) ) );

wfss->exec();
delete wfss;
}

void QgisApp::addWfsLayer( QString uri, QString typeName )
{
// TODO: this should be eventually moved to a more reasonable place
addVectorLayer( uri, typeName, "WFS" );
}


void QgisApp::fileExit()
{
if ( mMapCanvas && mMapCanvas->isDrawing() )
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QAction *actionAddPgLayer() { return mActionAddPgLayer; }
QAction *actionAddSpatiaLiteLayer() { return mActionAddSpatiaLiteLayer; };
QAction *actionAddWmsLayer() { return mActionAddWmsLayer; }
QAction *actionAddWfsLayer() { return mActionAddWfsLayer; }
QAction *actionOpenTable() { return mActionOpenTable; }
QAction *actionToggleEditing() { return mActionToggleEditing; }
QAction *actionSaveEdits() { return mActionSaveEdits; }
Expand Down Expand Up @@ -435,6 +436,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QString const & format,
QString const & crs );

void addWfsLayer( QString uri, QString typeName );

void versionReplyFinished();

protected:
Expand Down Expand Up @@ -689,6 +692,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
void fileExit();
//! Add a WMS layer to the map
void addWmsLayer();
//! Add a WFS layer to the map
void addWfsLayer();
//! Set map tool to Zoom out
void zoomOut();
//! Set map tool to Zoom in
Expand Down
61 changes: 60 additions & 1 deletion src/app/qgsbrowserdockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
#include <QTreeView>
#include <QMenu>
#include <QSettings>
#include <QToolButton>

#include "qgsbrowsermodel.h"
#include "qgsdataitem.h"
#include "qgslogger.h"
#include "qgsmaplayerregistry.h"
#include "qgsrasterlayer.h"
#include "qgsvectorlayer.h"
#include "qgisapp.h"

#include <QDragEnterEvent>
/**
Expand Down Expand Up @@ -52,7 +54,22 @@ QgsBrowserDockWidget::QgsBrowserDockWidget( QWidget * parent ) :
setWindowTitle( tr( "Browser" ) );

mBrowserView = new QgsBrowserTreeView( this );
setWidget( mBrowserView );

mRefreshButton = new QToolButton( this );
mRefreshButton->setIcon( QgisApp::instance()->getThemeIcon( "mActionDraw.png" ) );
mRefreshButton->setText( tr( "Refresh" ) );
mRefreshButton->setAutoRaise( true );
connect( mRefreshButton, SIGNAL( clicked() ), this, SLOT( refresh() ) );

QVBoxLayout* layout = new QVBoxLayout( this );
layout->setContentsMargins( 0, 0, 0, 0 );
layout->setSpacing( 0 );
layout->addWidget( mRefreshButton );
layout->addWidget( mBrowserView );

QWidget* innerWidget = new QWidget( this );
innerWidget->setLayout( layout );
setWidget( innerWidget );

connect( mBrowserView, SIGNAL( customContextMenuRequested( const QPoint & ) ), this, SLOT( showContextMenu( const QPoint & ) ) );
//connect( mBrowserView, SIGNAL( clicked( const QModelIndex& ) ), this, SLOT( itemClicked( const QModelIndex& ) ) );
Expand Down Expand Up @@ -170,6 +187,15 @@ void QgsBrowserDockWidget::showContextMenu( const QPoint & pt )
}
}

QList<QAction*> actions = item->actions();
if ( !actions.isEmpty() )
{
if ( !menu->actions().isEmpty() )
menu->addSeparator();
// add action to the menu
menu->addActions( actions );
}

if ( menu->actions().count() == 0 )
{
delete menu;
Expand Down Expand Up @@ -216,3 +242,36 @@ void QgsBrowserDockWidget::removeFavourite()
// reload the browser model so that the favourite directory is not shown anymore
mModel->reload();
}

void QgsBrowserDockWidget::refresh()
{
refreshModel( QModelIndex() );
}

void QgsBrowserDockWidget::refreshModel( const QModelIndex& index )
{
QgsDebugMsg( "Entered" );
if ( index.isValid() )
{
QgsDataItem *item = mModel->dataItem( index );
if ( item )
{
QgsDebugMsg( "path = " + item->path() );
}
else
{
QgsDebugMsg( "invalid item" );
}
}

mModel->refresh( index );

for ( int i = 0 ; i < mModel->rowCount( index ); i++ )
{
QModelIndex idx = mModel->index( i, 0, index );
if ( mBrowserView->isExpanded( idx ) )
{
refreshModel( idx );
}
}
}
6 changes: 6 additions & 0 deletions src/app/qgsbrowserdockwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
class QgsBrowserModel;
class QModelIndex;
class QTreeView;
class QToolButton;

class QgsBrowserDockWidget : public QDockWidget
{
Expand All @@ -22,11 +23,16 @@ class QgsBrowserDockWidget : public QDockWidget
void addFavourite();
void removeFavourite();

void refresh();

protected:

void refreshModel( const QModelIndex& index );

void showEvent( QShowEvent * event );

QTreeView* mBrowserView;
QToolButton* mRefreshButton;
QgsBrowserModel* mModel;
};

Expand Down
3 changes: 3 additions & 0 deletions src/core/qgsdataitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class CORE_EXPORT QgsDataItem : public QObject

virtual QWidget * paramWidget() { return 0; }

// list of actions provided by this item - usually used for popup menu on right-click
virtual QList<QAction*> actions() { return QList<QAction*>(); }

//

enum Capability
Expand Down
3 changes: 2 additions & 1 deletion src/gui/qgsprojectionselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,8 @@ void QgsProjectionSelector::coordinateSystemSelected( QTreeWidgetItem * theItem
else
{
// Not an CRS - remove the highlight so the user doesn't get too confused
theItem->setSelected( false );
if ( theItem )
theItem->setSelected( false );
teProjection->setText( "" );
}
}
Expand Down
1 change: 0 additions & 1 deletion src/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ ENDIF (POSTGRES_FOUND)

IF (EXPAT_FOUND)
ADD_SUBDIRECTORY(gps_importer)
ADD_SUBDIRECTORY(wfs)
ENDIF (EXPAT_FOUND)

IF (GSL_FOUND)
Expand Down
50 changes: 0 additions & 50 deletions src/plugins/wfs/CMakeLists.txt

This file was deleted.

Loading