quazipnewinfo.cpp 1.6 KB

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