| 1369 | } |
| 1370 | |
| 1371 | void TWApp::addToRecentFiles(const QMap<QString,QVariant>& fileProperties) |
| 1372 | { |
| 1373 | Tw::Settings settings; |
| 1374 | |
| 1375 | QString fileName = fileProperties.value(QString::fromLatin1("path")).toString(); |
| 1376 | if (fileName.isEmpty()) |
| 1377 | return; |
| 1378 | |
| 1379 | QList<QVariant> fileList = settings.value(QString::fromLatin1("recentFiles")).toList(); |
| 1380 | QList<QVariant>::iterator i = fileList.begin(); |
| 1381 | while (i != fileList.end()) { |
| 1382 | QMap<QString,QVariant> h = i->toMap(); |
| 1383 | if (h.value(QString::fromLatin1("path")).toString() == fileName) |
| 1384 | i = fileList.erase(i); |
| 1385 | else |
| 1386 | ++i; |
| 1387 | } |
| 1388 | |
| 1389 | fileList.prepend(fileProperties); |
| 1390 | |
| 1391 | while (fileList.size() > maxRecentFiles()) |
| 1392 | fileList.removeLast(); |
| 1393 | |
| 1394 | settings.setValue(QString::fromLatin1("recentFiles"), QVariant::fromValue(fileList)); |
| 1395 | |
| 1396 | updateRecentFileActions(); |
| 1397 | } |
| 1398 | |
| 1399 | void TWApp::clearRecentFiles() |
| 1400 | { |
no test coverage detected