fix(PackProfile): don't reset dirty if component list saving failed

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2026-01-26 21:48:27 +05:00
parent 9776fb8d68
commit c6072ff434
No known key found for this signature in database
GPG key ID: B77C34313AEE1FFF
2 changed files with 9 additions and 6 deletions

View file

@ -167,6 +167,7 @@ static bool savePackProfile(const QString& filename, const ComponentContainer& c
}
if (!outFile.commit()) {
qCCritical(instanceProfileC) << "Couldn't save" << outFile.fileName() << "because:" << outFile.errorString();
return false;
}
return true;
}
@ -229,9 +230,8 @@ static PackProfile::Result loadPackProfile(PackProfile* parent,
void PackProfile::saveNow()
{
if (saveIsScheduled()) {
if (saveIsScheduled() && save_internal()) {
d->m_saveTimer.stop();
save_internal();
}
}
@ -279,12 +279,15 @@ QString PackProfile::patchFilePathForUid(const QString& uid) const
return patchesPattern().arg(uid);
}
void PackProfile::save_internal()
bool PackProfile::save_internal()
{
qDebug() << d->m_instance->name() << "|" << "Component list save performed now";
auto filename = componentsFilePath();
savePackProfile(filename, d->components);
d->dirty = false;
if (savePackProfile(filename, d->components)) {
d->dirty = false;
return true;
}
return false;
}
PackProfile::Result PackProfile::load()

View file

@ -175,7 +175,7 @@ class PackProfile : public QAbstractListModel {
QString patchesPattern() const;
private slots:
void save_internal();
bool save_internal();
void updateSucceeded();
void updateFailed(const QString& error);
void componentDataChanged();