mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 12:35:43 +08:00
refs #577, improved resolution of distributor
This commit is contained in:
@@ -84,8 +84,16 @@ namespace BlackGui
|
|||||||
CDistributor CDbDistributorSelectorComponent::getDistributor() const
|
CDistributor CDbDistributorSelectorComponent::getDistributor() const
|
||||||
{
|
{
|
||||||
if (!hasProvider()) { return CDistributor(); }
|
if (!hasProvider()) { return CDistributor(); }
|
||||||
QString distributorKey(this->ui->le_Distributor->text().trimmed().toUpper());
|
QString distributorKeyOrAlias(this->ui->le_Distributor->text().trimmed().toUpper());
|
||||||
CDistributor d(getDistributors().findByKey(distributorKey));
|
if (distributorKeyOrAlias.isEmpty()) { return CDistributor(); }
|
||||||
|
if (this->m_currentDistributor.matchesKeyOrAlias(distributorKeyOrAlias)) { return this->m_currentDistributor; }
|
||||||
|
|
||||||
|
CDistributor d(getDistributors().findByKey(distributorKeyOrAlias));
|
||||||
|
if (d.hasValidDbKey())
|
||||||
|
{
|
||||||
|
// for some reason we have a new distributor here
|
||||||
|
// normally that should not happen
|
||||||
|
}
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,9 +187,9 @@ namespace BlackGui
|
|||||||
void CDbDistributorSelectorComponent::ps_dataChanged()
|
void CDbDistributorSelectorComponent::ps_dataChanged()
|
||||||
{
|
{
|
||||||
if (!hasProvider()) { return; }
|
if (!hasProvider()) { return; }
|
||||||
QString key(this->ui->le_Distributor->text().trimmed().toUpper());
|
QString keyOrAlias(this->ui->le_Distributor->text().trimmed().toUpper());
|
||||||
if (key.isEmpty()) { return; }
|
if (keyOrAlias.isEmpty()) { return; }
|
||||||
CDistributor d(this->getDistributors().findByKeyOrAlias(key));
|
CDistributor d(this->getDistributors().findByKeyOrAlias(keyOrAlias));
|
||||||
this->setDistributor(d);
|
this->setDistributor(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user