@@ -113,20 +113,20 @@ void QgsServerSourceSelect::populateConnectionList()
113
113
}
114
114
setConnectionListPosition ();
115
115
116
- if (keys.begin () ! = keys.end ())
117
- {
118
- // Connections available - enable various buttons
119
- btnConnect->setEnabled (TRUE );
120
- btnEdit->setEnabled (TRUE );
121
- btnDelete->setEnabled (TRUE );
122
- }
116
+ if (keys.begin () = = keys.end ())
117
+ {
118
+ // No connections - disable various buttons
119
+ btnConnect->setEnabled (FALSE );
120
+ btnEdit->setEnabled (FALSE );
121
+ btnDelete->setEnabled (FALSE );
122
+ }
123
123
else
124
- {
125
- // No connections available - disable various buttons
126
- btnConnect->setEnabled (FALSE );
127
- btnEdit->setEnabled (FALSE );
128
- btnDelete->setEnabled (FALSE );
129
- }
124
+ {
125
+ // Connections - enable various buttons
126
+ btnConnect->setEnabled (TRUE );
127
+ btnEdit->setEnabled (TRUE );
128
+ btnDelete->setEnabled (TRUE );
129
+ }
130
130
}
131
131
void QgsServerSourceSelect::on_btnNew_clicked ()
132
132
{
@@ -726,6 +726,11 @@ void QgsServerSourceSelect::on_cmbConnections_activated(int)
726
726
serverChanged ();
727
727
}
728
728
729
+ void QgsServerSourceSelect::on_btnAddDefault_clicked ()
730
+ {
731
+ addDefaultServers ();
732
+ }
733
+
729
734
QString QgsServerSourceSelect::descriptionForEpsg (long epsg)
730
735
{
731
736
// We'll assume this function isn't called very often,
@@ -736,5 +741,33 @@ QString QgsServerSourceSelect::descriptionForEpsg(long epsg)
736
741
return qgisSrs.description ();
737
742
}
738
743
744
+ void QgsServerSourceSelect::addDefaultServers ()
745
+ {
746
+ QMap<QString, QString> exampleServers;
747
+ exampleServers[" NASA (JPL)" ] = " http://wms.jpl.nasa.gov/wms.cgi" ;
748
+ exampleServers[" DM Solutions GMap" ] = " http://www2.dmsolutions.ca/cgi-bin/mswms_gmap" ;
749
+ exampleServers[" TerraService" ] = " http://terraservice.net/ogccapabilities.ashx" ;
750
+ // Nice to have the qgis users map, but I'm not sure of the URL at the moment.
751
+ // exampleServers["Qgis users map"] = "http://qgis.org/wms.cgi";
752
+
753
+ QSettings settings;
754
+ QString basePath (" /Qgis/connections-wms/" );
755
+ QMap<QString, QString>::const_iterator i = exampleServers.constBegin ();
756
+ for (; i != exampleServers.constEnd (); ++i)
757
+ {
758
+ // Only do a server if it's name doesn't already exist.
759
+ QStringList keys = settings.subkeyList (basePath);
760
+ if (!keys.contains (i.key ()))
761
+ {
762
+ QString path = basePath + i.key ();
763
+ settings.setValue (path + " /proxyhost" , " " );
764
+ settings.setValue (path + " /proxyport" , 80 );
765
+ settings.setValue (path + " /proxyuser" , " " );
766
+ settings.setValue (path + " /proxypassword" , " " );
767
+ settings.setValue (path + " /url" , i.value ());
768
+ }
769
+ }
770
+ populateConnectionList ();
771
+ }
739
772
740
773
// ENDS
0 commit comments