summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2013-10-15 14:31:02 (GMT)
committerSwift Review <review@swift.im>2013-10-17 08:03:37 (GMT)
commit5f0eeca41f0559c5b416c78fd51445fd93cf61ff (patch)
treead4b7bb586385be7916213999dfb4248dae2c437 /Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp
parent040ceccfc67ce41fdd836ae874da68e04e6ca944 (diff)
downloadswift-5f0eeca41f0559c5b416c78fd51445fd93cf61ff.zip
swift-5f0eeca41f0559c5b416c78fd51445fd93cf61ff.tar.bz2
VCard: Assert existence of field widgets instead of if-testing.
Change-Id: Ie92f4f1714b8fb6dc5c1e2729151c8e00c33215b License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp')
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp38
1 files changed, 24 insertions, 14 deletions
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp
index d9bb4fe..f394af0 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp
@@ -138,20 +138,30 @@ VCard::Address QtVCardAddressField::getAddress() const {
}
void QtVCardAddressField::handleEditibleChanged(bool isEditable) {
- if (streetLineEdit) streetLineEdit->setEditable(isEditable);
- if (poboxLineEdit) poboxLineEdit->setEditable(isEditable);
- if (addressextLineEdit) addressextLineEdit->setEditable(isEditable);
- if (cityLineEdit) cityLineEdit->setEditable(isEditable);
- if (pocodeLineEdit) pocodeLineEdit->setEditable(isEditable);
- if (regionLineEdit) regionLineEdit->setEditable(isEditable);
- if (countryLineEdit) countryLineEdit->setEditable(isEditable);
-
- if (deliveryTypeLabel) {
- deliveryTypeLabel->setText(buttonGroup->checkedButton() == 0 ? "" : buttonGroup->checkedButton()->text());
- deliveryTypeLabel->setVisible(!isEditable);
- }
- if (domesticRadioButton) domesticRadioButton->setVisible(isEditable);
- if (internationalRadioButton) internationalRadioButton->setVisible(isEditable);
+ assert(streetLineEdit);
+ assert(poboxLineEdit);
+ assert(addressextLineEdit);
+ assert(cityLineEdit);
+ assert(pocodeLineEdit);
+ assert(regionLineEdit);
+ assert(countryLineEdit);
+ assert(deliveryTypeLabel);
+ assert(domesticRadioButton);
+ assert(internationalRadioButton);
+
+ streetLineEdit->setEditable(isEditable);
+ poboxLineEdit->setEditable(isEditable);
+ addressextLineEdit->setEditable(isEditable);
+ cityLineEdit->setEditable(isEditable);
+ pocodeLineEdit->setEditable(isEditable);
+ regionLineEdit->setEditable(isEditable);
+ countryLineEdit->setEditable(isEditable);
+
+ deliveryTypeLabel->setText(buttonGroup->checkedButton() == 0 ? "" : buttonGroup->checkedButton()->text());
+ deliveryTypeLabel->setVisible(!isEditable);
+
+ domesticRadioButton->setVisible(isEditable);
+ internationalRadioButton->setVisible(isEditable);
foreach (QWidget* widget, textFields) {
QtResizableLineEdit* lineEdit;