62
* Returns a static pointer to this class.
52
* This function returns a static pointer to this class.
54
* @returns a static pointer to the Smb4KPrint class.
64
56
static Smb4KIPAddressScanner *self();
67
* Triggers a scan for IP addresses. This function calls lookupIPAddresses(),
68
* except the scanner is in auto scan mode. In this case it will return immediately
69
* without doing anything.
74
* Sets the scanner in automatic scan mode, if @p interval is non-zero.
76
* @param interval The interval between the scans in milliseconds.
78
void setAutoScan( int interval );
81
* Returns TRUE if the scanner is in auto scan mode and FALSE otherwise.
83
* @returns TRUE if the scanner is in auto scan mode.
85
bool autoScan() { return m_auto_scan; }
88
* Lookup the IP address of a certain host. You need to connect to the
89
* ipAddress() signal to get the result. The IP address scan will be
90
* executed when the scanner is idle the next time.
92
* Please make sure that the pointer to @p host stays valid until the
93
* search for the IP address finished and the ipAddress() signal is
96
* @param host The Smb4KHost item for which the IP address
97
* should be looked up.
59
* Starts a IP address lookup for all hosts currently present
60
* in the global hosts list. If @p force is TRUE, the all IP
61
* addresses will be looked up regardless whether the host already
64
* @param force Force the lookup
66
* @param parent The parent widget
68
void lookup( bool force = false,
69
QWidget *parent = 0 );
72
* Get the IP address for the master browser of @p workgroup. This is
73
* a convenience function and only searches Smb4KGlobal::hostList()
74
* for the right host and copies the IP address. If you want to do an
75
* IP address lookup, use the lookup() function.
77
* @param host The Smb4KHost object
79
void getIPAddress( Smb4KWorkgroup *workgroup );
82
* Get the IP address for @p host. This is a convenience function and
83
* only searches Smb4KGlobal::hostList() for the right host and copies
84
* the IP address to @p host. If you want to do an IP address lookup, use
85
* the lookup() function.
87
* @param host The Smb4KHost object
99
89
void getIPAddress( Smb4KHost *host );
92
* This function tells you if at least one IP address lookup job is
95
* @returns TRUE if at least one lookup job is running
100
* This function aborts all searches at once.
105
* This function starts the composite job
103
* This signal is emitted, when an IP address was found for a host. It passed
104
* the associated Smb4KHost object.
106
* @param host The Smb4KHost object that carries the discovered
111
* This signal is emitted when a lookup process is about to be started.
112
* It passes the host to the receiver.
114
* @param host The host
116
void aboutToStart( Smb4KHost *host );
119
* This signal is emitted when a lookup process has finished. It passes
120
* the host to the receiver.
122
* @param host The host
124
void finished( Smb4KHost *host );
127
* This signal is emitted when an IP address was successfully looked
130
* @param host The host
109
132
void ipAddress( Smb4KHost *host );
113
* Reimplemented from QObject.
115
void timerEvent( QTimerEvent *e );
119
* This slot is connected to the KProcess::readyReadStandardOutput()
120
* signal and collects the IP addresses from the output.
122
void slotReceivedIPAddresses();
125
* This slot is called, when the process exited.
127
* @param exitCode The exit code of the process
129
* @param exitStatus The exit status of the process (@see QProcess::ExitStatus)
131
void slotProcessFinished( int exitCode, QProcess::ExitStatus exitStatus );
134
* This slot is invoked when an error occurred with the process.
136
* @param errorCode The error code returned by the process
138
void slotProcessError( QProcess::ProcessError errorCode );
136
* Invoked by start() function
138
void slotStartJobs();
141
* Processes the host if it is a master browser.
143
void slotProcessIPAddress( Smb4KHost *host );
146
* Invoked by KJob::result() signal
148
void slotJobFinished( KJob *job );
151
* Called when the program is about to quit
153
void slotAboutToQuit();
144
159
Smb4KIPAddressScanner();
149
164
~Smb4KIPAddressScanner();
152
* This function loops through the global hosts list and initiates
153
* an IP address lookup process for every host, that has not been
156
void lookupIPAddresses();
164
* The id of the timer
169
* The scanner is working
179
* The process error code
181
QProcess::ProcessError m_process_error;
184
* The queue for buffering scan requests that were received
185
* through the getIPAddress() function.
187
QList<Smb4KHost> m_queue;