diff --git a/modules/saneui/hg_settingdialog.cpp b/modules/saneui/hg_settingdialog.cpp index c2bb8d61..a2b608f6 100644 --- a/modules/saneui/hg_settingdialog.cpp +++ b/modules/saneui/hg_settingdialog.cpp @@ -923,7 +923,12 @@ void hg_settingdialog::slot_checkedClicked() m_list_IdValueTitle.append(QPair, QString>(QPair(id, checkBoxcurrentState), md5(opt->title))); SANE_Int method = 0; - m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &checkBoxcurrentState, &method); + SANE_Status ret = m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &checkBoxcurrentState, &method); + if (ret == SANE_STATUS_UNSUPPORTED) + { + QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported")); + return; + } if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) updateUIStatus(); else if(method & SANE_INFO_INEXACT) @@ -977,7 +982,12 @@ void hg_settingdialog::slot_string_list_comboBoxClicked() *((SANE_Fixed*)buf) = SANE_FIX(atof(comboBoxcurrentItem.c_str())); else strcpy(buf, comboBoxcurrentItem.c_str()); - m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, buf, &method); + SANE_Status ret = m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, buf, &method); + if (ret == SANE_STATUS_UNSUPPORTED) + { + QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported")); + return; + } if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) updateUIStatus(); else if(method & SANE_INFO_INEXACT) @@ -1002,7 +1012,12 @@ void hg_settingdialog::slot_pushButtonClicked() after = 0; // restore to default setting ? - m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, NULL, &after); + SANE_Status ret = m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, NULL, &after); + if (ret == SANE_STATUS_UNSUPPORTED) + { + QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported")); + return; + } if((after & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) updateUIStatus(); @@ -1229,7 +1244,12 @@ void hg_settingdialog::slot_word_list_comboBoxClicked(int value) SANE_Int method = 0; - m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &temp, &method); + SANE_Status ret = m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &temp, &method); + if (ret == SANE_STATUS_UNSUPPORTED) + { + QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported")); + return; + } if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) updateUIStatus(); else if(method & SANE_INFO_INEXACT) @@ -1285,7 +1305,12 @@ void hg_settingdialog::slot_sliderClicked(int value) m_list_IdValueTitle.append(QPair, QString>(QPair(id, temp), md5(opt->title))); } - m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &val, &method); + SANE_Status ret = m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &val, &method); + if (ret == SANE_STATUS_UNSUPPORTED) + { + QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported")); + return; + } if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) updateUIStatus(); else if(method & SANE_INFO_INEXACT) @@ -1354,7 +1379,12 @@ void hg_settingdialog::slot_spinBoxClicked(int value) m_list_IdValueTitle.append(QPair, QString>(QPair(id, temp), md5(opt->title))); SANE_Int method = 0; - m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &temp, &method); + SANE_Status ret = m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &temp, &method); + if (ret == SANE_STATUS_UNSUPPORTED) + { + QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported")); + return; + } if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) updateUIStatus(); else if(value != temp) @@ -1405,7 +1435,12 @@ void hg_settingdialog::slot_lineEditInput() buf = malloc(opt->size * 2 + 4); strcpy((char*)buf, lineEditCurrentText.c_str()); } - m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, buf, &method); + SANE_Status ret = m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, buf, &method); + if (ret == SANE_STATUS_UNSUPPORTED) + { + QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported")); + return; + } if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) updateUIStatus(); else if(method & SANE_INFO_INEXACT)