Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
remove server search URL from settings
remove server search tab from OWS dialog
  • Loading branch information
alexbruy authored and nyalldawson committed Apr 24, 2020
1 parent b8c3b0e commit 81911c1
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 216 deletions.
5 changes: 1 addition & 4 deletions python/gui/auto_generated/qgsowssourceselect.sip.in
Expand Up @@ -154,13 +154,10 @@ Returns a textual description for the authority id



void addWmsListRow( const QDomElement &item, int row );
virtual void enableLayersForCrs( QTreeWidgetItem *item );
%Docstring
layer name derived from latest layer selection (updated as long it's not edited manually)
%End
void addWmsListItem( const QDomElement &el, int row, int column );

virtual void enableLayersForCrs( QTreeWidgetItem *item );

QString selectedFormat();
%Docstring
Expand Down
6 changes: 0 additions & 6 deletions src/app/qgsoptions.cpp
Expand Up @@ -403,9 +403,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
mSettings->setValue( QStringLiteral( "clear_auth_cache_on_errors" ), checked, QgsSettings::Section::Auth );
} );

//wms search server
leWmsSearch->setText( mSettings->value( QStringLiteral( "/qgis/WMSSearchUrl" ), "http://geopole.org/wms/search?search=%1&type=rss" ).toString() );

// set the attribute table default filter
cmbAttrTableBehavior->clear();
cmbAttrTableBehavior->addItem( tr( "Show all features" ), QgsAttributeTableFilterModel::ShowAll );
Expand Down Expand Up @@ -1472,9 +1469,6 @@ void QgsOptions::saveOptions()

QgisApp::instance()->namUpdate();

//wms search url
mSettings->setValue( QStringLiteral( "/qgis/WMSSearchUrl" ), leWmsSearch->text() );

//general settings
mSettings->setValue( QStringLiteral( "/Map/searchRadiusMM" ), spinBoxIdentifyValue->value() );
mSettings->setValue( QStringLiteral( "/Map/highlight/color" ), mIdentifyHighlightColorButton->color().name() );
Expand Down
93 changes: 0 additions & 93 deletions src/gui/qgsowssourceselect.cpp
Expand Up @@ -71,8 +71,6 @@ QgsOWSSourceSelect::QgsOWSSourceSelect( const QString &service, QWidget *parent,
connect( mLayersTreeWidget, &QTreeWidget::itemSelectionChanged, this, &QgsOWSSourceSelect::mLayersTreeWidget_itemSelectionChanged );
connect( mConnectionsComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::activated ), this, &QgsOWSSourceSelect::mConnectionsComboBox_activated );
connect( mAddDefaultButton, &QPushButton::clicked, this, &QgsOWSSourceSelect::mAddDefaultButton_clicked );
connect( mSearchButton, &QPushButton::clicked, this, &QgsOWSSourceSelect::mSearchButton_clicked );
connect( mSearchTableWidget, &QTableWidget::itemSelectionChanged, this, &QgsOWSSourceSelect::mSearchTableWidget_itemSelectionChanged );
connect( mTilesetsTableWidget, &QTableWidget::itemClicked, this, &QgsOWSSourceSelect::mTilesetsTableWidget_itemClicked );
connect( mLayerUpButton, &QPushButton::clicked, this, &QgsOWSSourceSelect::mLayerUpButton_clicked );
connect( mLayerDownButton, &QPushButton::clicked, this, &QgsOWSSourceSelect::mLayerDownButton_clicked );
Expand Down Expand Up @@ -634,97 +632,6 @@ void QgsOWSSourceSelect::addDefaultServers()
"need to set the proxy settings in the QGIS options dialog." ) + "</p>" );
}

void QgsOWSSourceSelect::addWmsListRow( const QDomElement &item, int row )
{
QDomElement title = item.firstChildElement( QStringLiteral( "title" ) );
addWmsListItem( title, row, 0 );
QDomElement description = item.firstChildElement( QStringLiteral( "description" ) );
addWmsListItem( description, row, 1 );
QDomElement link = item.firstChildElement( QStringLiteral( "link" ) );
addWmsListItem( link, row, 2 );
}

void QgsOWSSourceSelect::addWmsListItem( const QDomElement &el, int row, int column )
{
if ( !el.isNull() )
{
QTableWidgetItem *tableItem = new QTableWidgetItem( el.text() );
// TODO: add linebreaks to long tooltips?
tableItem->setToolTip( el.text() );
mSearchTableWidget->setItem( row, column, tableItem );
}
}

void QgsOWSSourceSelect::mSearchButton_clicked()
{
// clear results
mSearchTableWidget->clearContents();
mSearchTableWidget->setRowCount( 0 );

// disable Add WMS button
mSearchAddButton->setEnabled( false );

QApplication::setOverrideCursor( Qt::WaitCursor );

QgsSettings settings;
// geopole.org (geopole.ch) 25.4.2012 : 503 Service Unavailable, archive: Recently added 20 Jul 2011
QString mySearchUrl = settings.value( QStringLiteral( "qgis/WMSSearchUrl" ), "http://geopole.org/wms/search?search=%1&type=rss" ).toString();
QUrl url( mySearchUrl.arg( mSearchTermLineEdit->text() ) );
QgsDebugMsg( url.toString() );

QNetworkReply *r = QgsNetworkAccessManager::instance()->get( QNetworkRequest( url ) );
connect( r, &QNetworkReply::finished, this, &QgsOWSSourceSelect::searchFinished );
}

void QgsOWSSourceSelect::searchFinished()
{
QApplication::restoreOverrideCursor();

QNetworkReply *r = qobject_cast<QNetworkReply *>( sender() );
if ( !r )
return;

if ( r->error() == QNetworkReply::NoError )
{
// parse results
QDomDocument doc( QStringLiteral( "RSS" ) );
QByteArray res = r->readAll();
QString error;
int line, column;
if ( doc.setContent( res, &error, &line, &column ) )
{
QDomNodeList list = doc.elementsByTagName( QStringLiteral( "item" ) );
mSearchTableWidget->setRowCount( list.size() );
for ( int i = 0; i < list.size(); i++ )
{
if ( list.item( i ).isElement() )
{
QDomElement item = list.item( i ).toElement();
addWmsListRow( item, i );
}
}

mSearchTableWidget->resizeColumnsToContents();
}
else
{
QgsDebugMsg( QStringLiteral( "setContent failed" ) );
showStatusMessage( tr( "parse error at row %1, column %2: %3" ).arg( line ).arg( column ).arg( error ) );
}
}
else
{
showStatusMessage( tr( "network error: %1" ).arg( r->error() ) );
}

r->deleteLater();
}

void QgsOWSSourceSelect::mSearchTableWidget_itemSelectionChanged()
{
mSearchAddButton->setEnabled( mSearchTableWidget->currentRow() != -1 );
}

void QgsOWSSourceSelect::mLayerUpButton_clicked()
{
QList<QTreeWidgetItem *> selectionList = mLayerOrderTreeWidget->selectedItems();
Expand Down
7 changes: 0 additions & 7 deletions src/gui/qgsowssourceselect.h
Expand Up @@ -156,9 +156,6 @@ class GUI_EXPORT QgsOWSSourceSelect : public QgsAbstractDataSourceWidget, protec

QMap<QString, QString> mCrsNames;

void addWmsListRow( const QDomElement &item, int row );
void addWmsListItem( const QDomElement &el, int row, int column );

virtual void enableLayersForCrs( QTreeWidgetItem *item );

//! Returns currently selected format
Expand Down Expand Up @@ -204,8 +201,6 @@ class GUI_EXPORT QgsOWSSourceSelect : public QgsAbstractDataSourceWidget, protec
*/
void mConnectButton_clicked();

void searchFinished();

//! Opens the Spatial Reference System dialog.
void mChangeCRSButton_clicked();

Expand Down Expand Up @@ -233,8 +228,6 @@ class GUI_EXPORT QgsOWSSourceSelect : public QgsAbstractDataSourceWidget, protec
QMap<QString, QString> mMimeLabelMap;

private slots:
void mSearchButton_clicked();
void mSearchTableWidget_itemSelectionChanged();
void mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
void mLayerUpButton_clicked();
void mLayerDownButton_clicked();
Expand Down
1 change: 0 additions & 1 deletion src/providers/wcs/qgswcssourceselect.cpp
Expand Up @@ -36,7 +36,6 @@ QgsWCSSourceSelect::QgsWCSSourceSelect( QWidget *parent, Qt::WindowFlags fl, Qgs
mLayersTab->layout()->removeWidget( mWMSGroupBox );
mTabWidget->removeTab( mTabWidget->indexOf( mLayerOrderTab ) );
mTabWidget->removeTab( mTabWidget->indexOf( mTilesetsTab ) );
mTabWidget->removeTab( mTabWidget->indexOf( mSearchTab ) );
mAddDefaultButton->hide();

mLayersTreeWidget->setSelectionMode( QAbstractItemView::SingleSelection );
Expand Down
71 changes: 28 additions & 43 deletions src/ui/qgsoptionsbase.ui
Expand Up @@ -332,7 +332,7 @@
<item>
<widget class="QStackedWidget" name="mOptionsStackedWidget">
<property name="currentIndex">
<number>0</number>
<number>13</number>
</property>
<widget class="QWidget" name="mOptionsPageGeneral">
<layout class="QVBoxLayout" name="verticalLayout_3">
Expand Down Expand Up @@ -360,9 +360,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-339</y>
<width>833</width>
<height>1003</height>
<y>0</y>
<width>843</width>
<height>917</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_28">
Expand Down Expand Up @@ -606,7 +606,7 @@
</widget>
</item>
<item>
<widget class="QFontComboBox" name="mFontFamilyComboBox" />
<widget class="QFontComboBox" name="mFontFamilyComboBox"/>
</item>
<item>
<widget class="QLabel" name="label_20">
Expand Down Expand Up @@ -1118,8 +1118,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>539</width>
<height>1114</height>
<width>541</width>
<height>1072</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_22">
Expand Down Expand Up @@ -1654,8 +1654,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>555</width>
<height>501</height>
<width>552</width>
<height>509</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_15">
Expand Down Expand Up @@ -1867,8 +1867,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>530</width>
<height>678</height>
<width>499</width>
<height>615</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_27">
Expand Down Expand Up @@ -2173,8 +2173,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>695</width>
<height>1139</height>
<width>674</width>
<height>1057</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_22">
Expand Down Expand Up @@ -2959,8 +2959,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>529</width>
<height>309</height>
<width>501</width>
<height>293</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_25">
Expand Down Expand Up @@ -3270,8 +3270,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>606</width>
<height>741</height>
<width>604</width>
<height>671</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_30">
Expand Down Expand Up @@ -3775,8 +3775,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<rect>
<x>0</x>
<y>0</y>
<width>181</width>
<height>318</height>
<width>157</width>
<height>265</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_46">
Expand Down Expand Up @@ -3943,8 +3943,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<rect>
<x>0</x>
<y>0</y>
<width>570</width>
<height>827</height>
<width>543</width>
<height>801</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_31">
Expand Down Expand Up @@ -4552,8 +4552,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<rect>
<x>0</x>
<y>0</y>
<width>469</width>
<height>572</height>
<width>480</width>
<height>538</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_39">
Expand Down Expand Up @@ -4821,8 +4821,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<rect>
<x>0</x>
<y>0</y>
<width>506</width>
<height>367</height>
<width>412</width>
<height>372</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
Expand Down Expand Up @@ -4990,8 +4990,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<rect>
<x>0</x>
<y>0</y>
<width>633</width>
<height>750</height>
<width>857</width>
<height>682</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_33">
Expand All @@ -5001,20 +5001,6 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<string>General</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_34">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>WMS search address</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="leWmsSearch"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
Expand Down Expand Up @@ -5492,7 +5478,7 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.AppleSystemUIFont'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Noto Sans'; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
Expand Down Expand Up @@ -5868,7 +5854,6 @@ p, li { white-space: pre-wrap; }
<tabstop>lstGdalDrivers</tabstop>
<tabstop>mAuthConfigsGrpBx</tabstop>
<tabstop>mOptionsScrollArea_10</tabstop>
<tabstop>leWmsSearch</tabstop>
<tabstop>mNetworkTimeoutSpinBox</tabstop>
<tabstop>mDefaultCapabilitiesExpirySpinBox</tabstop>
<tabstop>mDefaultTileExpirySpinBox</tabstop>
Expand Down

0 comments on commit 81911c1

Please sign in to comment.