diff options
| author | Tobias Markmann <tm@ayena.de> | 2012-04-24 15:54:09 (GMT) | 
|---|---|---|
| committer | Remko Tronçon <git@el-tramo.be> | 2012-04-24 17:45:57 (GMT) | 
| commit | 36a00c5338df2df1be827c014dff63bfbf16cb34 (patch) | |
| tree | a3c3bfdf349effa01c1fa429112d750c56f1a303 | |
| parent | f8e77a8cbf9e6ad1fc2a51ed16f89a41c0da560b (diff) | |
| download | swift-contrib-36a00c5338df2df1be827c014dff63bfbf16cb34.zip swift-contrib-36a00c5338df2df1be827c014dff63bfbf16cb34.tar.bz2 | |
In contact name selection, only select text edit field, if it doesn't match any suggestion.
Resolves: #1098
License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
| -rw-r--r-- | Swift/QtUI/QtContactEditWidget.cpp | 13 | 
1 files changed, 9 insertions, 4 deletions
| diff --git a/Swift/QtUI/QtContactEditWidget.cpp b/Swift/QtUI/QtContactEditWidget.cpp index 5e2915f..9d071b9 100644 --- a/Swift/QtUI/QtContactEditWidget.cpp +++ b/Swift/QtUI/QtContactEditWidget.cpp @@ -121,11 +121,16 @@ void QtContactEditWidget::setNameSuggestions(const std::vector<std::string>& sug  	nameRadioButton_ = new QRadioButton(tr("Name:"), this);  	suggestionsLayout_->insertWidget(nameLayout_->count(), nameRadioButton_); -	if (name_->text().isEmpty()) { -		QRadioButton* suggestedRadioButton = dynamic_cast<QRadioButton*>(suggestionsLayout_->itemAt(0)->widget()); -		if (suggestedRadioButton) { -			suggestedRadioButton->setChecked(true); +	QRadioButton* suggestedRadioButton = 0; +	QList<QRadioButton*> radioButtons = findChildren<QRadioButton*>(); +	foreach (QRadioButton* candidate, radioButtons) { +		if (candidate->text() == name_->text()) { +			suggestedRadioButton = candidate; +			break;  		} +	} +	if (suggestedRadioButton) { +		suggestedRadioButton->setChecked(true);  	} else {  		nameRadioButton_->setChecked(true);  	} | 
 Swift
 Swift