Skip to content

Commit 3dfc3d7

Browse files
committed
Don't use item(QString) while marking new content files
1 parent 0c6c71f commit 3dfc3d7

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

components/contentselector/model/contentmodel.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ void ContentSelectorModel::ContentModel::addFiles(const QString& path, bool newf
469469
file->setFilePath(info.absoluteFilePath());
470470
if (add)
471471
addFile(newFile.release());
472-
setNew(file->fileName(), newfiles);
472+
setNew(file, newfiles);
473473
continue;
474474
}
475475

@@ -525,7 +525,7 @@ void ContentSelectorModel::ContentModel::addFiles(const QString& path, bool newf
525525
// Put the file in the table
526526
if (add)
527527
addFile(newFile.release());
528-
setNew(file->fileName(), newfiles);
528+
setNew(file, newfiles);
529529
}
530530
catch (std::runtime_error& e)
531531
{
@@ -664,17 +664,12 @@ bool ContentSelectorModel::ContentModel::isNew(const QString& filepath) const
664664
return it.value();
665665
}
666666

667-
void ContentSelectorModel::ContentModel::setNew(const QString& filepath, bool isNew)
667+
void ContentSelectorModel::ContentModel::setNew(const EsmFile* file, bool isNew)
668668
{
669-
if (filepath.isEmpty())
670-
return;
671-
672-
const EsmFile* file = item(filepath);
673-
674669
if (!file)
675670
return;
676671

677-
mNewFiles[filepath] = isNew;
672+
mNewFiles[file->fileName()] = isNew;
678673
}
679674

680675
void ContentSelectorModel::ContentModel::setNonUserContent(const QStringList& fileList)

components/contentselector/model/contentmodel.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ namespace ContentSelectorModel
6161
bool isEnabled(const QModelIndex& index) const;
6262
bool setCheckState(const EsmFile* file, bool isChecked);
6363
bool isNew(const QString& filepath) const;
64-
void setNew(const QString& filepath, bool isChecked);
64+
void setNew(const EsmFile* file, bool isChecked);
6565
void setNonUserContent(const QStringList& fileList);
6666
void setContentList(const QStringList& fileList);
6767
ContentFileList checkedItems() const;

0 commit comments

Comments
 (0)