~popey/ubuntu-filemanager-app/add-click-deps

« back to all changes in this revision

Viewing changes to src/plugin/folderlistmodel/disk/disklocationitemfile.cpp

  • Committer: Tarmac
  • Author(s): carlos-mazieri
  • Date: 2015-08-22 15:57:06 UTC
  • mfrom: (430.5.3 samba-actions-12)
  • Revision ID: tarmac-20150822155706-ytx3y93et2lw3x9l
nherited Location classes now provide inherited LocationItemFile classes which will replace Qt QFile class in Actions.
DiskLocation provides DiskLocationItemFile and SmbLocation provides SmbLocationItemFile.

Approved by Ubuntu Phone Apps Jenkins Bot, Arto Jalkanen.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**************************************************************************
 
2
 *
 
3
 * Copyright 2015 Canonical Ltd.
 
4
 * Copyright 2015 Carlos J Mazieri <carlos.mazieri@gmail.com>
 
5
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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/>.
 
17
 *
 
18
 * File: disklocationitemfile.cpp
 
19
 * Date: 20/04/2015
 
20
 */
 
21
 
 
22
#include "disklocationitemfile.h"
 
23
 
 
24
DiskLocationItemFile::DiskLocationItemFile(QObject *parent)
 
25
  : LocationItemFile(parent)
 
26
  , m_qtFile( new QFile() )
 
27
{
 
28
 
 
29
}
 
30
 
 
31
DiskLocationItemFile::DiskLocationItemFile(const QString &name, QObject *parent)
 
32
  : LocationItemFile(parent)
 
33
  , m_qtFile( new QFile(name) )
 
34
{
 
35
 
 
36
}
 
37
 
 
38
 
 
39
DiskLocationItemFile::~DiskLocationItemFile()
 
40
{
 
41
    delete m_qtFile;
 
42
}
 
43
 
 
44
 
 
45
QString DiskLocationItemFile::fileName() const
 
46
{
 
47
    return m_qtFile->fileName();
 
48
}
 
49
 
 
50
 
 
51
bool DiskLocationItemFile::rename(const QString& newName)
 
52
{
 
53
    return m_qtFile->rename(newName);
 
54
}
 
55
 
 
56
 
 
57
bool DiskLocationItemFile::rename(const QString& oldname, const QString &newName)
 
58
{
 
59
    return QFile::rename(oldname, newName);
 
60
}
 
61
 
 
62
 
 
63
bool DiskLocationItemFile::remove()
 
64
{
 
65
   return m_qtFile->remove();
 
66
}
 
67
 
 
68
 
 
69
bool DiskLocationItemFile::remove(const QString& name)
 
70
{
 
71
    return QFile::remove(name);
 
72
}
 
73
 
 
74
 
 
75
bool DiskLocationItemFile::link(const QString& linkName)
 
76
{
 
77
    return m_qtFile->link(linkName);
 
78
}
 
79
 
 
80
 
 
81
bool DiskLocationItemFile::open(QIODevice::OpenMode mode)
 
82
{
 
83
    return m_qtFile->open(mode);
 
84
}
 
85
 
 
86
 
 
87
qint64 DiskLocationItemFile::read(char * buffer, qint64 bytes)
 
88
{
 
89
    return m_qtFile->read(buffer, bytes);
 
90
}
 
91
 
 
92
 
 
93
qint64 DiskLocationItemFile::write(const char *buffer, qint64 bytes)
 
94
{
 
95
    return m_qtFile->write(buffer, bytes);
 
96
}
 
97
 
 
98
 
 
99
void DiskLocationItemFile::close()
 
100
{
 
101
    m_qtFile->close();
 
102
}
 
103
 
 
104
 
 
105
bool DiskLocationItemFile::atEnd() const
 
106
{
 
107
    return m_qtFile->atEnd();
 
108
}
 
109
 
 
110
 
 
111
qint64 DiskLocationItemFile::size() const
 
112
{
 
113
    return m_qtFile->size();
 
114
}
 
115
 
 
116
 
 
117
bool DiskLocationItemFile::isOpen() const
 
118
{
 
119
    return m_qtFile->isOpen();
 
120
}
 
121
 
 
122
 
 
123
bool DiskLocationItemFile::setPermissions(QFileDevice::Permissions perm)
 
124
{
 
125
    return m_qtFile->setPermissions(perm);
 
126
}
 
127
 
 
128
 
 
129
bool DiskLocationItemFile::setPermissions(const QString &filename, QFileDevice::Permissions perm)
 
130
{
 
131
    return QFile::setPermissions(filename, perm);
 
132
}
 
133
 
 
134
 
 
135
QFile::Permissions DiskLocationItemFile::permissions() const
 
136
{
 
137
    return m_qtFile->permissions();
 
138
}