55
57
setButtonText(User1, i18n("Reload devices list"));
57
59
m_btnGroup = new QButtonGroup(this);
59
61
m_btnBox = new QGroupBox;
60
m_btnLayout = new QVBoxLayout;
61
62
QVBoxLayout *layout = new QVBoxLayout;
62
63
m_btnContainer = new QWidget;
63
64
m_btnLayout = new QVBoxLayout(m_btnContainer);
64
65
QScrollArea *area = new QScrollArea;
66
67
m_btnBox->setLayout(layout);
70
new QLabel(i18n("<html>The SANE (Scanner Access Now Easy) system could not find any device.<br>"
71
"Check that the scanner is plugged in and turned on<br>"
72
"or check your systems scanner setup.<br>"
73
"For details about SANE see the "
74
"<a href='http://www.sane-project.org/'>SANE homepage</a>.</html>"));
75
explanation->setOpenExternalLinks(true);
77
layout->getContentsMargins(&l, &t, &r, &b);
78
explanation->setContentsMargins(l, t, r, b);
80
layout->addWidget(explanation);
81
m_btnBox->adjustSize(); // make sure to see the complete explanation text
68
82
layout->addWidget(area);
69
83
layout->setContentsMargins(0,0,0,0);
71
85
area->setWidgetResizable(true);
72
86
area->setFrameShape(QFrame::NoFrame);
73
87
area->setWidget(m_btnContainer);
75
89
setMainWidget(m_btnBox);
76
90
setMinimumHeight(200);
77
91
m_findDevThread = FindSaneDevicesThread::getInstance();
93
107
delete m_btnGroup->buttons().takeFirst();
95
109
m_btnBox->setTitle(i18n("Looking for devices. Please wait."));
110
m_btnBox->layout()->itemAt(0)->widget()->hide(); // explanation
96
111
enableButton(KDialog::User1, false);
98
113
if(!m_findDevThread->isRunning()) {
131
146
const QList<KSaneWidget::DeviceInfo> list = m_findDevThread->devicesList();
132
147
if (list.isEmpty()) {
133
148
m_btnBox->setTitle(i18n("Sorry. No devices found."));
149
m_btnBox->layout()->itemAt(0)->widget()->show(); // explanation
150
m_btnBox->layout()->itemAt(1)->widget()->hide(); // scroll area
134
151
enableButton(KDialog::User1, true);
139
156
m_btnLayout = new QVBoxLayout;
140
157
m_btnContainer->setLayout(m_btnLayout);
141
158
m_btnBox->setTitle(i18n("Found devices:"));
159
m_btnBox->layout()->itemAt(0)->widget()->hide(); // explanation
160
m_btnBox->layout()->itemAt(1)->widget()->show(); // scroll area
143
162
for (int i=0; i< list.size(); i++) {
144
163
QRadioButton *b = new QRadioButton(this);
145
164
b->setObjectName(list[i].name);