MCPcopy Create free account
hub / github.com/TeXworks/texworks / addToRecentFiles

Method addToRecentFiles

src/TWApp.cpp:1371–1397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1369}
1370
1371void 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
1399void TWApp::clearRecentFiles()
1400{

Callers 2

saveRecentFileInfoMethod · 0.80
saveRecentFileInfoMethod · 0.80

Calls 2

setValueMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected