File indexing completed on 2024-04-28 15:26:34

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 
0008 #ifndef KIO_SLAVEINTERFACEPRIVATE_H
0009 #define KIO_SLAVEINTERFACEPRIVATE_H
0010 
0011 #ifdef Q_OS_WIN
0012 #include <qt_windows.h>
0013 #include <winsock2.h> // struct timeval
0014 #endif
0015 
0016 #include "connection_p.h"
0017 #include "global.h"
0018 #include <QHostInfo>
0019 #include <QTimer>
0020 
0021 #include "kiocoredebug.h"
0022 
0023 static const unsigned int max_nums = 8;
0024 
0025 class KIO::SlaveInterfacePrivate
0026 {
0027 public:
0028     SlaveInterfacePrivate()
0029         : connection(nullptr)
0030         , filesize(0)
0031         , offset(0)
0032         , last_time(0)
0033         , start_time(0)
0034         , nums(0)
0035         , slave_calcs_speed(false)
0036     {
0037     }
0038     virtual ~SlaveInterfacePrivate()
0039     {
0040         delete connection;
0041     }
0042 
0043     Connection *connection;
0044     QTimer speed_timer;
0045 
0046     // We need some metadata here for our SSL code in messageBox() and for sslMetaData().
0047     MetaData sslMetaData;
0048 
0049     // Used to cache privilege operation details passed from the worker by the metadata hack
0050     // See WORKER_MESSAGEBOX_DETAILS_HACK
0051     QString messageBoxDetails;
0052 
0053     KIO::filesize_t sizes[max_nums];
0054     qint64 times[max_nums];
0055 
0056     KIO::filesize_t filesize, offset;
0057     size_t last_time;
0058     qint64 start_time;
0059     uint nums;
0060     bool slave_calcs_speed;
0061 
0062     void slotHostInfo(const QHostInfo &info);
0063 };
0064 
0065 #endif