• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeprint
 

tdeprint

  • tdeprint
  • management
kmwsmb.cpp
1/*
2 * This file is part of the KDE libraries
3 * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License version 2 as published by the Free Software Foundation.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 **/
19
20#include "kmwsmb.h"
21#include "kmwizard.h"
22#include "smbview.h"
23#include "kmprinter.h"
24#include "util.h"
25
26#include <tdelocale.h>
27#include <kpushbutton.h>
28#include <tqlayout.h>
29#include <tqlineedit.h>
30#include <tqlabel.h>
31
32KMWSmb::KMWSmb(TQWidget *parent, const char *name)
33: KMWizardPage(parent,name)
34{
35 m_title = i18n("SMB Printer Settings");
36 m_ID = KMWizard::SMB;
37 m_nextpage = KMWizard::Driver;
38
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);
50
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);
57 lay0->addSpacing(10);
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 );
66 lay3->addStretch(1);
67 lay3->addWidget(m_scan);
68 lay3->addWidget(m_abort);
69
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)));
74}
75
76bool KMWSmb::isValid(TQString& msg)
77{
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.");
82 else
83 return true;
84 return false;
85}
86
87void KMWSmb::updatePrinter(KMPrinter *printer)
88{
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 );
91}
92
93void KMWSmb::initPrinter(KMPrinter *printer)
94{
95 if (printer)
96 {
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 ) );
100 }
101}
102
103void KMWSmb::slotScan()
104{
105 m_view->init();
106}
107
108void KMWSmb::slotAbort()
109{
110 m_view->abort();
111}
112
113void KMWSmb::slotPrinterSelected(const TQString& work, const TQString& server, const TQString& printer)
114{
115 m_work->setText(work);
116 m_server->setText(server);
117 m_printer->setText(printer);
118}
119#include "kmwsmb.moc"

tdeprint

Skip menu "tdeprint"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeprint

Skip menu "tdeprint"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeprint by doxygen 1.9.4
This website is maintained by Timothy Pearson.