misc/quazip/quazipnewinfo.cpp
author sheepluva
Wed, 25 Apr 2012 08:23:48 +0200
changeset 6928 9562ace15141
parent 5752 ea95ee97c805
child 7889 57b117d441b9
permissions -rw-r--r--
nemo said I was boring for removing the "hello" randomizer on room join. That was actually an accident, fixed by this commit. Now find an actual reason to call me boring (there are many to choose from :P) nemo!
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5752
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     1
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     2
Copyright (C) 2005-2011 Sergey A. Tachenov
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     3
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     4
This program is free software; you can redistribute it and/or modify it
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     5
under the terms of the GNU Lesser General Public License as published by
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     6
the Free Software Foundation; either version 2 of the License, or (at
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     7
your option) any later version.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     8
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     9
This program is distributed in the hope that it will be useful, but
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    10
WITHOUT ANY WARRANTY; without even the implied warranty of
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    12
General Public License for more details.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    13
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    14
You should have received a copy of the GNU Lesser General Public License
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    15
along with this program; if not, write to the Free Software Foundation,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    16
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    17
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    18
See COPYING file for the full LGPL text.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    19
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    20
Original ZIP package is copyrighted by Gilles Vollant, see
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    21
quazip/(un)zip.h files for details, basically it's zlib license.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    22
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    23
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    24
#include <QFileInfo>
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    25
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    26
#include "quazipnewinfo.h"
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    27
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    28
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    29
QuaZipNewInfo::QuaZipNewInfo(const QString& name):
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    30
  name(name), dateTime(QDateTime::currentDateTime()), internalAttr(0), externalAttr(0)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    31
{
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    32
}
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    33
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    34
QuaZipNewInfo::QuaZipNewInfo(const QString& name, const QString& file):
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    35
  name(name), internalAttr(0), externalAttr(0)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    36
{
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    37
  QFileInfo info(file);
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    38
  QDateTime lm = info.lastModified();
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    39
  if (!info.exists())
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    40
    dateTime = QDateTime::currentDateTime();
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    41
  else
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    42
    dateTime = lm;
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    43
}
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    44
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    45
void QuaZipNewInfo::setFileDateTime(const QString& file)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    46
{
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    47
  QFileInfo info(file);
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    48
  QDateTime lm = info.lastModified();
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    49
  if (info.exists())
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    50
    dateTime = lm;
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    51
}