MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / sync

Method sync

src/settings.cpp:530–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

528}
529
530QSettings::Status Settings::sync() const
531{
532 m_Settings.sync();
533
534 const auto s = m_Settings.status();
535
536 // there's a bug in Qt at least until 5.15.0 where a utf-8 bom in the ini is
537 // handled correctly but still sets FormatError
538 //
539 // see qsettings.cpp, in QConfFileSettingsPrivate::readIniFile(), there's a
540 // specific check for utf-8, which adjusts `dataPos` so it's skipped, but
541 // the FLUSH_CURRENT_SECTION() macro uses `currentSectionStart`, and that one
542 // isn't adjusted when changing `dataPos` on the first line and so stays 0
543 //
544 // this puts the bom in `unparsedIniSections` and eventually sets FormatError
545 // somewhere
546 //
547 //
548 // the other problem is that the status is never reset, not even when calling
549 // sync(), so the FormatError that's returned here is actually from reading
550 // the ini, not writing it
551 //
552 //
553 // since it's impossible to get a FormatError on write, it's considered to
554 // be a NoError here
555
556 if (s == QSettings::FormatError) {
557 return QSettings::NoError;
558 } else {
559 return s;
560 }
561}
562
563QSettings::Status Settings::iniStatus() const
564{

Callers 4

setPersistentMethod · 0.80
saveMetaMethod · 0.80
finishMethod · 0.80
OrganizerCoreMethod · 0.80

Calls 1

statusMethod · 0.80

Tested by

no test coverage detected