PageRenderTime 182ms CodeModel.GetById 80ms app.highlight 4ms RepoModel.GetById 97ms app.codeStats 0ms

/src/libtomahawk/thirdparty/quazip/quazip/quazipnewinfo.cpp

http://github.com/tomahawk-player/tomahawk
C++ | 51 lines | 23 code | 6 blank | 22 comment | 2 complexity | d89e406dd69d6abc567aac28c3999bfa MD5 | raw file
 1/*
 2Copyright (C) 2005-2011 Sergey A. Tachenov
 3
 4This program is free software; you can redistribute it and/or modify it
 5under the terms of the GNU Lesser General Public License as published by
 6the Free Software Foundation; either version 2 of the License, or (at
 7your option) any later version.
 8
 9This program is distributed in the hope that it will be useful, but
10WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
12General Public License for more details.
13
14You should have received a copy of the GNU Lesser General Public License
15along with this program; if not, write to the Free Software Foundation,
16Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18See COPYING file for the full LGPL text.
19
20Original ZIP package is copyrighted by Gilles Vollant, see
21quazip/(un)zip.h files for details, basically it's zlib license.
22*/
23
24#include <QFileInfo>
25
26#include "quazipnewinfo.h"
27
28
29QuaZipNewInfo::QuaZipNewInfo(const QString& name):
30  name(name), dateTime(QDateTime::currentDateTime()), internalAttr(0), externalAttr(0)
31{
32}
33
34QuaZipNewInfo::QuaZipNewInfo(const QString& name, const QString& file):
35  name(name), internalAttr(0), externalAttr(0)
36{
37  QFileInfo info(file);
38  QDateTime lm = info.lastModified();
39  if (!info.exists())
40    dateTime = QDateTime::currentDateTime();
41  else
42    dateTime = lm;
43}
44
45void QuaZipNewInfo::setFileDateTime(const QString& file)
46{
47  QFileInfo info(file);
48  QDateTime lm = info.lastModified();
49  if (info.exists())
50    dateTime = lm;
51}