Skip to content
Permalink
Browse files
Speculative fix for the "Add WMS Layer" dialog crash if you press "Co…
…nnect" on an empty server list - "Connect" should now be disabled if no servers are available.

git-svn-id: http://svn.osgeo.org/qgis/trunk@4908 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
morb_au committed Feb 26, 2006
1 parent 8fc79ce commit ecf20c12e0f862129b30cb1cc9c4aa93fbb51861
Showing with 162 additions and 118 deletions.
  1. +15 −1 src/gui/qgsserversourceselect.cpp
  2. +147 −117 src/ui/qgsserversourceselectbase.ui
@@ -55,7 +55,6 @@ QgsServerSourceSelect::QgsServerSourceSelect(QgisApp * app, QWidget * parent, Qt
hbox->addStretch();
btnGrpImageEncoding->setLayout(hbox);

btnAdd->setEnabled(false);
populateConnectionList();
// connect the double-click signal to the addSingleLayer slot in the parent

@@ -79,6 +78,21 @@ void QgsServerSourceSelect::populateConnectionList()
cmbConnections->insertItem(*it);
++it;
}

if (keys.begin() != keys.end())
{
// Connections available - enable various buttons
btnConnect->setEnabled(TRUE);
btnEdit->setEnabled(TRUE);
btnDelete->setEnabled(TRUE);
}
else
{
// No connections available - disable various buttons
btnConnect->setEnabled(FALSE);
btnEdit->setEnabled(FALSE);
btnDelete->setEnabled(FALSE);
}
}
void QgsServerSourceSelect::on_btnNew_clicked()
{
@@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>577</width>
<height>552</height>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle" >
@@ -21,75 +21,61 @@
<property name="sizeGripEnabled" >
<bool>true</bool>
</property>
<property name="modal" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" colspan="4" >
<widget class="QGroupBox" name="GroupBox1" >
<property name="title" >
<string>Server Connections</string>
<item row="4" column="3" >
<widget class="QPushButton" name="btnCancel" >
<property name="text" >
<string>C&amp;lose</string>
</property>
<property name="shortcut" >
<string>Alt+L</string>
</property>
<property name="autoDefault" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="1" >
<widget class="QPushButton" name="btnNew" >
<property name="text" >
<string>&amp;New</string>
</property>
</widget>
</item>
<item row="1" column="3" >
<widget class="QPushButton" name="btnDelete" >
<property name="text" >
<string>Delete</string>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QPushButton" name="btnEdit" >
<property name="text" >
<string>Edit</string>
</property>
</widget>
</item>
<item row="1" column="4" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>171</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" >
<widget class="QPushButton" name="btnConnect" >
<property name="text" >
<string>C&amp;onnect</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="5" >
<widget class="QComboBox" name="cmbConnections" />
</item>
</layout>
</widget>
</item>
<item row="4" column="0" >
<widget class="QPushButton" name="btnHelp" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Help</string>
</property>
<property name="shortcut" >
<string>F1</string>
</property>
<property name="autoDefault" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>284</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="4" >
<widget class="QGroupBox" name="btnGrpImageEncoding" >
<property name="sizePolicy" >
@@ -164,6 +150,96 @@
</layout>
</widget>
</item>
<item row="4" column="2" >
<widget class="QPushButton" name="btnAdd" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>&amp;Add</string>
</property>
<property name="shortcut" >
<string>Alt+A</string>
</property>
<property name="autoDefault" >
<bool>true</bool>
</property>
<property name="default" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4" >
<widget class="QGroupBox" name="GroupBox1" >
<property name="title" >
<string>Server Connections</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="1" >
<widget class="QPushButton" name="btnNew" >
<property name="text" >
<string>&amp;New</string>
</property>
</widget>
</item>
<item row="1" column="3" >
<widget class="QPushButton" name="btnDelete" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Delete</string>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QPushButton" name="btnEdit" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Edit</string>
</property>
</widget>
</item>
<item row="1" column="4" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>171</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" >
<widget class="QPushButton" name="btnConnect" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>C&amp;onnect</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="5" >
<widget class="QComboBox" name="cmbConnections" />
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="4" >
<widget class="QGroupBox" name="btnGrpSrs" >
<property name="title" >
@@ -202,64 +278,18 @@
</layout>
</widget>
</item>
<item row="4" column="2" >
<widget class="QPushButton" name="btnAdd" >
<property name="text" >
<string>&amp;Add</string>
</property>
<property name="shortcut" >
<string>Alt+A</string>
</property>
<property name="autoDefault" >
<bool>true</bool>
</property>
<property name="default" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QPushButton" name="btnHelp" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Help</string>
</property>
<property name="shortcut" >
<string>F1</string>
</property>
<property name="autoDefault" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>284</width>
<height>31</height>
</size>
<item row="5" column="0" colspan="4" >
<widget class="QLabel" name="labelStatus" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</spacer>
</item>
<item row="4" column="3" >
<widget class="QPushButton" name="btnCancel" >
<property name="text" >
<string>C&amp;lose</string>
</property>
<property name="shortcut" >
<string>Alt+L</string>
</property>
<property name="autoDefault" >
<bool>true</bool>
<string>Ready</string>
</property>
</widget>
</item>

0 comments on commit ecf20c1

Please sign in to comment.