mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Check the file size when updating and only compare the dates if it's enabled
This commit is contained in:
parent
5dac3e1402
commit
fa10409a31
@ -40,12 +40,14 @@ void LibraryCreator::createLibrary(const QString &source, const QString &target)
|
||||
|
||||
void LibraryCreator::updateLibrary(const QString &source, const QString &target)
|
||||
{
|
||||
checkModifiedDatesOnUpdate = settings->value(COMPARE_MODIFIED_DATE_ON_LIBRARY_UPDATES, false).toBool();
|
||||
partialUpdate = false;
|
||||
processLibrary(source, target);
|
||||
}
|
||||
|
||||
void LibraryCreator::updateFolder(const QString &source, const QString &target, const QString &sourceFolder, const QModelIndex &dest)
|
||||
{
|
||||
checkModifiedDatesOnUpdate = settings->value(COMPARE_MODIFIED_DATE_ON_LIBRARY_UPDATES, false).toBool();
|
||||
partialUpdate = true;
|
||||
folderDestinationModelIndex = dest;
|
||||
|
||||
@ -571,14 +573,17 @@ void LibraryCreator::update(QDir dirS)
|
||||
{
|
||||
DBHelper::removeFromDB(fileInfoD, _database);
|
||||
j++;
|
||||
} else // same file
|
||||
} else // file with the same name
|
||||
{
|
||||
if (fileInfoS.isFile() && !fileInfoD->isDir()) {
|
||||
auto comicDB = static_cast<ComicDB *>(fileInfoD);
|
||||
auto lastModified = fileInfoS.lastModified().toSecsSinceEpoch();
|
||||
auto added = comicDB->info.added.toULongLong();
|
||||
|
||||
if (added > 0 && added < lastModified) {
|
||||
auto sizeHasChanged = comicDB->getFileSize() != fileInfoS.size();
|
||||
auto hasBeenModified = added > 0 && added < lastModified && checkModifiedDatesOnUpdate;
|
||||
|
||||
if (sizeHasChanged || hasBeenModified) {
|
||||
#ifdef Q_OS_MACOS
|
||||
QStringList src = _source.split("/");
|
||||
QString filePath = fileInfoS.absoluteFilePath();
|
||||
|
@ -56,6 +56,7 @@ private:
|
||||
bool partialUpdate;
|
||||
QModelIndex folderDestinationModelIndex;
|
||||
QSettings *settings;
|
||||
bool checkModifiedDatesOnUpdate;
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
|
Loading…
x
Reference in New Issue
Block a user