1
/**************************************************************************
3
* Copyright 2015 Canonical Ltd.
4
* Copyright 2015 Carlos J Mazieri <carlos.mazieri@gmail.com>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation; version 3.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
* File: smblocationitemfile.h
22
#ifndef SMBLOCATIONITEMFILE_H
23
#define SMBLOCATIONITEMFILE_H
25
#include "locationitemfile.h"
26
#include "smbobject.h"
33
* \brief The SmbLocationItemFile class is similar to Qt QFile
36
class SmbLocationItemFile : public LocationItemFile, public SmbObject
40
explicit SmbLocationItemFile(QObject *parent = 0, Const_SmbUtil_Ptr smb = 0);
41
explicit SmbLocationItemFile(const QString& name, QObject *parent = 0, Const_SmbUtil_Ptr smb = 0);
42
~SmbLocationItemFile();
44
virtual QString fileName() const;
45
virtual bool rename(const QString& newName);
46
virtual bool rename(const QString& oldname, const QString& newName);
47
virtual bool remove();
48
virtual bool remove(const QString& name);
49
virtual bool link(const QString& linkName);
50
virtual bool open(QFile::OpenMode mode) ;
51
virtual qint64 read(char*, qint64);
52
virtual qint64 write(const char *, qint64);
54
virtual bool atEnd() const;
55
virtual qint64 size() const;
56
virtual bool isOpen() const;
57
virtual bool setPermissions(const QString& filename, QFile::Permissions perm);
58
virtual bool setPermissions(QFile::Permissions perm);
59
virtual QFile::Permissions permissions() const;
61
bool private_remove(const QString& smb_path);
62
void createContext(); // destroys the context if exists
63
void createContextIfNotExists(); // creates only if there is no context
65
Smb::FileHandler m_fd;
66
Smb::Context m_context;
67
qint64 m_curReadPosition;
68
QFile::OpenMode m_openMode;
71
#endif // SMBLOCATIONITEMFILE_H