networkscanner.h

00001 /*
00002  *  This file is part of the KDE libraries
00003  *  Copyright (c) 2001-2002 Michael Goffioul <kdeprint@swing.be>
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Library General Public
00007  *  License version 2 as published by the Free Software Foundation.
00008  *
00009  *  This library is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  *  Library General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Library General Public License
00015  *  along with this library; see the file COPYING.LIB.  If not, write to
00016  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  *  Boston, MA 02110-1301, USA.
00018  **/
00019 
00020 #ifndef NETWORKSCANNER_H
00021 #define NETWORKSCANNER_H
00022 
00023 #include <qwidget.h>
00024 #include <kdialogbase.h>
00025 #include <qptrlist.h>
00026 
00027 
00028 class KDEPRINT_EXPORT NetworkScanner : public QWidget
00029 {
00030     Q_OBJECT
00031 
00032 public:
00033     NetworkScanner( int port = 9100, QWidget *parent = 0, const char *name = 0 );
00034     ~NetworkScanner();
00035 
00036     struct SocketInfo
00037     {
00038         QString IP;
00039         QString Name;
00040         int Port;
00041     };
00042 
00043     const QPtrList<NetworkScanner::SocketInfo>* printerList();
00044 
00045     int timeout() const;
00046     void setTimeout( int to );
00047     QString subnet() const;
00048     void setSubnet( const QString& );
00049     int port() const;
00050     void setPort( int );
00051     bool checkPrinter( const QString&, int );
00052 
00053 signals:
00054     void scanStarted();
00055     void scanFinished();
00056 
00057 protected slots:
00058     void slotConnectionSuccess();
00059     void slotConnectionFailed( int );
00060     void slotTimeout();
00061     void slotScanClicked();
00062     void slotSettingsClicked();
00063     void slotNext();
00064 
00065 protected:
00066     void next();
00067     void finish();
00068     void start();
00069 
00070 private:
00071     class NetworkScannerPrivate;
00072     NetworkScannerPrivate *d;
00073 };
00074 
00075 class QLineEdit;
00076 class QComboBox;
00077 
00078 class NetworkScannerConfig : public KDialogBase
00079 {
00080     Q_OBJECT
00081 
00082 public:
00083     NetworkScannerConfig(NetworkScanner *scanner, const char *name = 0);
00084     ~NetworkScannerConfig();
00085 
00086 protected slots:
00087     void slotOk();
00088 
00089 private:
00090     QLineEdit   *mask_, *tout_;
00091     QComboBox   *port_;
00092     NetworkScanner *scanner_;
00093 };
00094 
00095 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys