| 288 | } |
| 289 | |
| 290 | bool Settings::sync() |
| 291 | { |
| 292 | if (!d->syncEnabled) |
| 293 | return true; |
| 294 | |
| 295 | const QByteArray &json = d->toJson(d->settingData); |
| 296 | QFile file(d->settingFile); |
| 297 | if (!file.open(QFile::WriteOnly)) |
| 298 | return false; |
| 299 | |
| 300 | bool ok = file.write(json) == json.size(); |
| 301 | if (ok) |
| 302 | d->enableSync(false); |
| 303 | file.close(); |
| 304 | return ok; |
| 305 | } |
| 306 | |
| 307 | bool Settings::isAutoSync() |
| 308 | { |