MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / initData

Method initData

src/plugins/recent/mainframe/recentdisplaywidget.cpp:375–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373
374Q_DECL_DEPRECATED_X("-------------存在兼容代码需要删除")
375void RecentDisplayWidget::initData()
376{
377 const QString oldCfgFile = CustomPaths::user(CustomPaths::Configures) + QDir::separator() + "recent.support";
378 const QString newCfgFile = CustomPaths::user(CustomPaths::Configures) + QDir::separator() + "recent.json";
379 d->recentSettings.load("", newCfgFile);
380
381 QFile file(oldCfgFile);
382 if (file.open(QIODevice::ReadOnly)) {
383 auto doc = QJsonDocument::fromJson(file.readAll());
384 file.close();
385 file.remove();
386
387 QVariantList prjList;
388 QJsonArray prjArray = doc.object().value(kProjects).toArray();
389 for (const auto &prj : prjArray) {
390 auto prjObj = prj.toObject();
391 const auto &info = parseProjectInfo(prjObj);
392 if (!info.isEmpty())
393 prjList << info;
394 }
395 d->recentSettings.setValue(kRecentGroup, kProjects, prjList);
396
397 QVariantList docList;
398 QJsonArray docArray = doc.object().value(kDocuments).toArray();
399 for (const auto &doc : docArray) {
400 auto filePath = doc.toString();
401 if (!filePath.isEmpty())
402 docList << filePath;
403 }
404 d->recentSettings.setValue(kRecentGroup, kDocuments, docList);
405 }
406
407 d->recentListView->setItemList(d->recentSettings.value(kRecentGroup, kProjects).toList());
408 d->recentListView->setItemList(d->recentSettings.value(kRecentGroup, kDocuments).toList());
409 d->sessionListWidget->addSessionList(d->sessionSrv->sessionList());
410}
411
412void RecentDisplayWidget::showEvent(QShowEvent *event)
413{

Callers

nothing calls this directly

Calls 15

readAllMethod · 0.80
toArrayMethod · 0.80
toListMethod · 0.80
addSessionListMethod · 0.80
sessionListMethod · 0.80
loadMethod · 0.45
openMethod · 0.45
closeMethod · 0.45
removeMethod · 0.45
valueMethod · 0.45
objectMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected