diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-06-11 14:50:04 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-06-11 14:52:11 +0100 |
commit | ab713ba1ffd00952ef8957f9b524e4e44f382f13 (patch) | |
tree | 42fd249a248030c5c56561df2e0a8f2355eebf1d /extensions | |
parent | 88e940f3150529a09265ab9d820c8189d6534011 (diff) |
Changing scanners has no effect
I guess no-one ever tested with multiple scanners but it just happens that my
laptops webcam is presented as a (non-functional) scanner alongside the real
one
Change-Id: Ie36651cfc867027ef19e272dbabe46de6c4261ee
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/scanner/sanedlg.cxx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index 4a8342448fda..af45214fa1a1 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -182,7 +182,6 @@ SaneDlg::SaneDlg( Window* pParent, Sane& rSane, bool bScanEnabled ) : get(mpRightField, "rightSpinbutton"); get(mpBottomField, "bottomSpinbutton"); get(mpDeviceBox, "deviceCombobox"); - mpDeviceBox->SetStyle(mpDeviceBox->GetStyle() | WB_SORT); get(mpReslBox, "reslCombobox"); get(mpAdvancedBox, "advancedCheckbutton"); get(mpVectorBox, "vectorSpinbutton-nospin"); @@ -264,13 +263,12 @@ void SaneDlg::InitDevices() mrSane.Close(); mrSane.ReloadDevices(); mpDeviceBox->Clear(); - for( int i = 0; i < Sane::CountDevices(); i++ ) - mpDeviceBox->InsertEntry( Sane::GetName( i ) ); + for (int i = 0; i < Sane::CountDevices(); ++i) + mpDeviceBox->InsertEntry(Sane::GetName(i)); if( Sane::CountDevices() ) { - mrSane.Open( 0 ); - mpDeviceBox->SelectEntry( Sane::GetName( 0 ) ); - + mrSane.Open(0); + mpDeviceBox->SelectEntryPos(0); } } @@ -599,12 +597,12 @@ IMPL_LINK( SaneDlg, SelectHdl, ListBox*, pListBox ) { if( pListBox == mpDeviceBox && Sane::IsSane() && Sane::CountDevices() ) { - OUString aNewDevice = mpDeviceBox->GetSelectEntry(); - int nNumber; - if( aNewDevice == Sane::GetName( nNumber = mrSane.GetDeviceNumber() ) ) + int nNewNumber = mpDeviceBox->GetSelectEntryPos(); + int nOldNumber = mrSane.GetDeviceNumber(); + if (nNewNumber != nOldNumber) { mrSane.Close(); - mrSane.Open( nNumber ); + mrSane.Open(nNewNumber); InitFields(); } } |