File indexing completed on 2024-05-05 05:48:39
0001 /* 0002 SPDX-FileCopyrightText: 2008 Volker Lanz <vl@fidra.de> 0003 SPDX-FileCopyrightText: 2014-2018 Andrius Štikonas <andrius@stikonas.eu> 0004 0005 SPDX-License-Identifier: GPL-3.0-or-later 0006 */ 0007 0008 #include "core/copysourcefile.h" 0009 0010 #include <QFile> 0011 #include <QFileInfo> 0012 0013 /** Constructs a CopySourceFile from the given @p filename. 0014 @param filename filename of the file to copy from 0015 */ 0016 CopySourceFile::CopySourceFile(const QString& filename) : 0017 CopySource(), 0018 m_File(filename) 0019 { 0020 } 0021 0022 /** Opens the file. 0023 @return true on success 0024 */ 0025 bool CopySourceFile::open() 0026 { 0027 return file().open(QIODevice::ReadOnly); 0028 } 0029 0030 /** Returns the length of the file in bytes. 0031 @return length of the file in bytes. 0032 */ 0033 qint64 CopySourceFile::length() const 0034 { 0035 return QFileInfo(file()).size(); 0036 }