KIOSlave
file.h
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2000-2002 Stephan Kulow <coolo@kde.org> 00003 Copyright (C) 2000-2002 David Faure <faure@kde.org> 00004 Copyright (C) 2000-2002 Waldo Bastian <bastian@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License (LGPL) as published by the Free Software Foundation; 00009 either version 2 of the License, or (at your option) any later 00010 version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef __file_h__ 00024 #define __file_h__ 00025 00026 #include "kioslave_file_export.h" 00027 #include <kio/global.h> 00028 #include <kio/slavebase.h> 00029 00030 #include <QtCore/QObject> 00031 #include <QtCore/QHash> 00032 00033 #include <config-acl.h> 00034 00035 #ifdef HAVE_POSIX_ACL 00036 #include <sys/acl.h> 00037 #include <acl/libacl.h> 00038 #endif 00039 00040 #include <sys/types.h> 00041 #include <sys/stat.h> 00042 00043 #include <stdio.h> 00044 #include <unistd.h> 00045 00046 class KIOSLAVE_FILE_EXPORT FileProtocol : public QObject, public KIO::SlaveBase 00047 { 00048 Q_OBJECT 00049 public: 00050 FileProtocol( const QByteArray &pool, const QByteArray &app); 00051 virtual ~FileProtocol(); 00052 00053 virtual void get( const KUrl& url ); 00054 virtual void put( const KUrl& url, int _mode, 00055 KIO::JobFlags _flags ); 00056 virtual void copy( const KUrl &src, const KUrl &dest, 00057 int mode, KIO::JobFlags flags ); 00058 virtual void rename( const KUrl &src, const KUrl &dest, 00059 KIO::JobFlags flags ); 00060 virtual void symlink( const QString &target, const KUrl &dest, 00061 KIO::JobFlags flags ); 00062 00063 virtual void stat( const KUrl& url ); 00064 virtual void listDir( const KUrl& url ); 00065 virtual void mkdir( const KUrl& url, int permissions ); 00066 virtual void chmod( const KUrl& url, int permissions ); 00067 virtual void chown( const KUrl& url, const QString& owner, const QString& group ); 00068 virtual void setModificationTime( const KUrl& url, const QDateTime& mtime ); 00069 virtual void del( const KUrl& url, bool isfile); 00070 virtual void open( const KUrl &url, QIODevice::OpenMode mode ); 00071 virtual void read( KIO::filesize_t size ); 00072 virtual void write( const QByteArray &data ); 00073 virtual void seek( KIO::filesize_t offset ); 00074 virtual void close(); 00075 00081 virtual void special( const QByteArray &data ); 00082 void unmount( const QString& point ); 00083 void mount( bool _ro, const char *_fstype, const QString& dev, const QString& point ); 00084 bool pumount( const QString &point ); 00085 bool pmount( const QString &dev ); 00086 00087 #ifdef HAVE_POSIX_ACL 00088 static bool isExtendedACL(acl_t acl); 00089 #endif 00090 00091 private: 00092 bool createUDSEntry( const QString & filename, const QByteArray & path, KIO::UDSEntry & entry, 00093 short int details, bool withACL ); 00094 int setACL( const char *path, mode_t perm, bool _directoryDefault ); 00095 00096 QString getUserName( uid_t uid ) const; 00097 QString getGroupName( gid_t gid ) const; 00098 00099 bool deleteRecursive(const QString& path); 00100 00101 private: 00102 mutable QHash<uid_t, QString> mUsercache; 00103 mutable QHash<gid_t, QString> mGroupcache; 00104 int openFd; 00105 QString openPath; 00106 }; 00107 00108 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Mon Jan 21 2019 12:37:22 by doxygen 1.7.5.1 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2019 The KDE developers.
Generated on Mon Jan 21 2019 12:37:22 by doxygen 1.7.5.1 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.