23 #include "kmprinter.h"
26 #include <tdelocale.h>
27 #include <kpushbutton.h>
29 #include <tqlineedit.h>
32 KMWSmb::KMWSmb(TQWidget *parent,
const char *name)
33 : KMWizardPage(parent,name)
35 m_title = i18n(
"SMB Printer Settings");
37 m_nextpage = KMWizard::Driver;
39 m_view =
new SmbView(
this,
"SmbView");
40 m_loginlabel =
new TQLabel(
this );
41 TQPushButton *m_scan =
new KPushButton(KGuiItem(i18n(
"Scan"),
"viewmag"),
this);
42 TQPushButton *m_abort =
new KPushButton(KGuiItem(i18n(
"Abort"),
"process-stop"),
this);
43 m_abort->setEnabled(
false);
44 TQLabel *m_worklabel =
new TQLabel(i18n(
"Workgroup:"),
this);
45 TQLabel *m_serverlabel =
new TQLabel(i18n(
"Server:"),
this);
46 TQLabel *m_printerlabel =
new TQLabel(i18n(
"Printer:"),
this);
47 m_work =
new TQLineEdit(
this);
48 m_server =
new TQLineEdit(
this);
49 m_printer =
new TQLineEdit(
this);
51 TQVBoxLayout *lay0 =
new TQVBoxLayout(
this, 0, 10);
52 TQGridLayout *lay1 =
new TQGridLayout(0, 3, 2, 0, 10);
53 TQHBoxLayout *lay3 =
new TQHBoxLayout(0, 0, 10);
54 lay0->addLayout(lay1,0);
55 lay0->addWidget(m_view,1);
56 lay0->addLayout(lay3,0);
58 lay1->setColStretch(1,1);
59 lay1->addWidget(m_worklabel,0,0);
60 lay1->addWidget(m_serverlabel,1,0);
61 lay1->addWidget(m_printerlabel,2,0);
62 lay1->addWidget(m_work,0,1);
63 lay1->addWidget(m_server,1,1);
64 lay1->addWidget(m_printer,2,1);
65 lay3->addWidget( m_loginlabel );
67 lay3->addWidget(m_scan);
68 lay3->addWidget(m_abort);
70 connect(m_scan,TQ_SIGNAL(clicked()),TQ_SLOT(slotScan()));
71 connect(m_abort,TQ_SIGNAL(clicked()),TQ_SLOT(slotAbort()));
72 connect(m_view,TQ_SIGNAL(printerSelected(
const TQString&,
const TQString&,
const TQString&)),TQ_SLOT(slotPrinterSelected(
const TQString&,
const TQString&,
const TQString&)));
73 connect(m_view,TQ_SIGNAL(running(
bool)),m_abort,TQ_SLOT(setEnabled(
bool)));
76 bool KMWSmb::isValid(TQString& msg)
78 if (m_server->text().isEmpty())
79 msg = i18n(
"Empty server name.");
80 else if (m_printer->text().isEmpty())
81 msg = i18n(
"Empty printer name.");
87 void KMWSmb::updatePrinter(KMPrinter *printer)
89 TQString uri = buildSmbURI( m_work->text(), m_server->text(), m_printer->text(), printer->option(
"kde-login" ), printer->option(
"kde-password" ) );
90 printer->setDevice( uri );
93 void KMWSmb::initPrinter(KMPrinter *printer)
97 TQString login = printer->option(
"kde-login" );
98 m_view->setLoginInfos(login,printer->option(
"kde-password"));
99 m_loginlabel->setText( i18n(
"Login: %1" ).arg( login.isEmpty() ? i18n(
"<anonymous>" ) : login ) );
103 void KMWSmb::slotScan()
108 void KMWSmb::slotAbort()
113 void KMWSmb::slotPrinterSelected(
const TQString& work,
const TQString& server,
const TQString& printer)
115 m_work->setText(work);
116 m_server->setText(server);
117 m_printer->setText(printer);
119 #include "kmwsmb.moc"