20#include "kmwdriverselect.h" 
   24#include "kmdriverdb.h" 
   28#include <kpushbutton.h> 
   29#include <tdelistbox.h> 
   31#include <tdemessagebox.h> 
   33KMWDriverSelect::KMWDriverSelect(TQWidget *parent, 
const char *name)
 
   34: KMWizardPage(parent,name)
 
   36    m_ID = KMWizard::DriverSelect;
 
   37    m_title = i18n(
"Driver Selection");
 
   38    m_nextpage = KMWizard::DriverTest;
 
   41    m_list = 
new TDEListBox(
this);
 
   42    TQLabel *l1 = 
new TQLabel(
this);
 
   43    l1->setText(i18n(
"<p>Several drivers have been detected for this model. Select the driver " 
   44             "you want to use. You will have the opportunity to test it as well as to " 
   45             "change it if necessary.</p>"));
 
   46    m_drivercomment = 
new KPushButton(i18n(
"Driver Information"), 
this);
 
   47    connect(m_drivercomment, TQ_SIGNAL(clicked()), TQ_SLOT(slotDriverComment()));
 
   49    TQVBoxLayout    *main_ = 
new TQVBoxLayout(
this, 0, 10);
 
   50    main_->addWidget(l1,0);
 
   51    main_->addWidget(m_list,1);
 
   52    TQHBoxLayout    *lay0 = 
new TQHBoxLayout(0, 0, 0);
 
   53    main_->addLayout(lay0,0);
 
   55    lay0->addWidget(m_drivercomment);
 
   58bool KMWDriverSelect::isValid(TQString& msg)
 
   60    if (m_list->currentItem() == -1)
 
   62        msg = i18n(
"You must select a driver.");
 
   68void KMWDriverSelect::initPrinter(KMPrinter *p)
 
   70    m_entries = KMDriverDB::self()->findEntry(p->manufacturer(),p->model());
 
   74        KMDBEntryListIterator   it(*m_entries);
 
   76        for (;it.current();++it)
 
   78            TQString    s(it.current()->description);
 
   79            if (it.current()->recommended)
 
   81                recomm = m_list->count();
 
   82                s.append(i18n(
" [recommended]"));
 
   84            m_list->insertItem(s);
 
   86        if (m_entries->count() > 0)
 
   87            m_list->setSelected(recomm, 
true);
 
   91void KMWDriverSelect::updatePrinter(KMPrinter *p)
 
   93    int index = m_list->currentItem();
 
   94    if (m_entries && index >= 0 && index < (
int)(m_entries->count()))
 
   96        KMDBEntry   *entry = m_entries->at(index);
 
   98        p->setDriverInfo(entry->description);
 
  103        p->setDriverInfo(TQString::null);
 
  107void KMWDriverSelect::slotDriverComment()
 
  109    int index = m_list->currentItem();
 
  110    if (m_entries && index >=0 && index < (
int)(m_entries->count()) && !m_entries->at(index)->drivercomment.isEmpty())
 
  111        KMessageBox::information(
this, m_entries->at(index)->drivercomment, TQString::null, TQString::null, KMessageBox::AllowLink);
 
  113        KMessageBox::error(
this, i18n(
"No information about the selected driver."));
 
  116#include "kmwdriverselect.moc"