KDELibs4Support

netaccess.h
1 /*
2  This file is part of the KDE libraries
3  Copyright (C) 1997 Torben Weis ([email protected])
4  Copyright (C) 1998 Matthias Ettrich ([email protected])
5  Copyright (C) 1999-2004 David Faure ([email protected])
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef KIO_NETACCESS_h
24 #define KIO_NETACCESS_h
25 
26 #include <QObject>
27 #include <QString>
28 #include <kdelibs4support_export.h>
29 #include <kio/global.h>
30 #include <kio/udsentry.h>
31 #include <kio/jobclasses.h> // for KIO::JobFlags
32 
33 class QStringList;
34 class QWidget;
35 
36 template<typename T, typename K> class QMap;
37 
38 class KJob;
39 namespace KIO
40 {
41 
42 class Job;
43 
44 class NetAccessPrivate;
68 class KDELIBS4SUPPORT_DEPRECATED_EXPORT NetAccess : public QObject
69 {
70  Q_OBJECT
71 
72 public:
73  enum StatSide {
74  SourceSide,
75  DestinationSide
76  };
77 
143  static bool download(const QUrl &src, QString &target, QWidget *window);
144 
156  static void removeTempFile(const QString &name);
157 
177  static bool upload(const QString &src, const QUrl &target, QWidget *window);
178 
196 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
197  static KDELIBS4SUPPORT_DEPRECATED bool file_copy(const QUrl &src, const QUrl &target, QWidget *window = nullptr);
198  static KDELIBS4SUPPORT_DEPRECATED bool copy(const QUrl &src, const QUrl &target,
199  QWidget *window = nullptr);
200 #endif
201 
223 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
224  static KDELIBS4SUPPORT_DEPRECATED bool dircopy(const QUrl &src, const QUrl &target, QWidget *window);
225 #endif
226 
231 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
232  static KDELIBS4SUPPORT_DEPRECATED bool dircopy(const QList<QUrl> &src, const QUrl &target, QWidget *window = nullptr);
233 #endif
234 
239 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
240  static KDELIBS4SUPPORT_DEPRECATED bool move(const QUrl &src, const QUrl &target, QWidget *window = nullptr);
241 #endif
242 
248 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
249  static KDELIBS4SUPPORT_DEPRECATED bool move(const QList<QUrl> &src, const QUrl &target, QWidget *window = nullptr);
250 #endif
251 
269 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
270  static KDELIBS4SUPPORT_DEPRECATED bool exists(const QUrl &url, bool source, QWidget *window);
271 #endif
272 
288  static bool exists(const QUrl &url, StatSide statSide, QWidget *window);
289 
307  static bool stat(const QUrl &url, KIO::UDSEntry &entry, QWidget *window);
308 
325  static QUrl mostLocalUrl(const QUrl &url, QWidget *window);
326 
342 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
343  static KDELIBS4SUPPORT_DEPRECATED bool del(const QUrl &url, QWidget *window);
344 #endif
345 
362 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
363  static KDELIBS4SUPPORT_DEPRECATED bool mkdir(const QUrl &url, QWidget *window, int permissions = -1);
364 #endif
365 
384  static QString fish_execute(const QUrl &url, const QString &command, QWidget *window);
385 
419  static bool synchronousRun(Job *job, QWidget *window, QByteArray *data = nullptr,
420  QUrl *finalURL = nullptr, QMap<QString, QString> *metaData = nullptr);
421 
441  static QString mimetype(const QUrl &url, QWidget *window);
442 
448  static QString lastErrorString();
449 
454  static int lastError();
455 
456 Q_SIGNALS:
457  void leaveModality();
458 private:
462  NetAccess();
463 
467  ~NetAccess();
468 
472  bool filecopyInternal(const QUrl &src, const QUrl &target, int permissions,
473  KIO::JobFlags flags, QWidget *window, bool move);
474  bool dircopyInternal(const QList<QUrl> &src, const QUrl &target,
475  QWidget *window, bool move);
476  bool statInternal(const QUrl &url, int details, StatSide side, QWidget *window = nullptr);
477 
478  bool delInternal(const QUrl &url, QWidget *window = nullptr);
479  bool mkdirInternal(const QUrl &url, int permissions, QWidget *window = nullptr);
480  QString fish_executeInternal(const QUrl &url, const QString &command, QWidget *window = nullptr);
481  bool synchronousRunInternal(Job *job, QWidget *window, QByteArray *data,
482  QUrl *finalURL, QMap<QString, QString> *metaData);
483 
484  QString mimetypeInternal(const QUrl &url, QWidget *window = nullptr);
485  void enter_loop();
486 
487  friend class I_like_this_class;
488 
489 private Q_SLOTS:
490  void slotResult(KJob *job);
491  void slotMimetype(KIO::Job *job, const QString &type);
492  void slotData(KIO::Job *, const QByteArray &);
493  void slotRedirection(KIO::Job *, const QUrl &);
494 
495 private:
496  NetAccessPrivate *const d;
497 };
498 
499 }
500 
501 #endif
int mkdir(const QString &pathname, mode_t mode)
replacement for mkdir() to handle pathnames in a platform independent way
Definition: kde_file.h:195
Net Transparency.
Definition: netaccess.h:68
Definition: netaccess.h:36
int stat(const QString &path, KDE_struct_stat *buf)
replacement for stat()/::stat64() to handle filenames in a platform independent way ...
Definition: kde_file.h:207
KIOCORE_EXPORT DeleteJob * del(const QUrl &src, JobFlags flags=DefaultFlags)
KIOCORE_EXPORT FileCopyJob * file_copy(const QUrl &src, const QUrl &dest, int permissions=-1, JobFlags flags=DefaultFlags)
KIOCORE_EXPORT CopyJob * copy(const QUrl &src, const QUrl &dest, JobFlags flags=DefaultFlags)
KIOCORE_EXPORT MimetypeJob * mimetype(const QUrl &url, JobFlags flags=DefaultFlags)
KIOCORE_EXPORT StatJob * mostLocalUrl(const QUrl &url, JobFlags flags=DefaultFlags)
KIOCORE_EXPORT CopyJob * move(const QUrl &src, const QUrl &dest, JobFlags flags=DefaultFlags)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Sep 17 2020 22:58:30 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.