| 88 | } |
| 89 | |
| 90 | void ProjectCore::addRecentOpenWidget(WindowService *windowService) |
| 91 | { |
| 92 | RecentOpenWidget *openedWidget = new RecentOpenWidget(); |
| 93 | auto editSrv = dpfGetService(EditorService); |
| 94 | connect(ProjectProxy::instance(), &ProjectProxy::switchedFile, this, [=](const QString &file) { |
| 95 | openedWidget->setOpenedFiles(editSrv->openedFiles().toVector()); |
| 96 | openedWidget->setListViewSelection(file); |
| 97 | }, |
| 98 | Qt::DirectConnection); |
| 99 | connect(openedWidget, &RecentOpenWidget::triggered, [=](const QModelIndex &index) { |
| 100 | QFileInfo info(index.data(RecentOpenWidget::RecentOpenedUserRole::FilePathRole).toString()); |
| 101 | if (info.exists() && info.isFile()) { |
| 102 | editor.openFile(QString(), info.filePath()); |
| 103 | } |
| 104 | }); |
| 105 | connect(openedWidget, &RecentOpenWidget::closePage, [=](const QModelIndex &index) { |
| 106 | QFileInfo info(index.data(RecentOpenWidget::RecentOpenedUserRole::FilePathRole).toString()); |
| 107 | if (info.exists() && info.isFile()) { |
| 108 | editor.closeFile(info.filePath()); |
| 109 | } |
| 110 | }); |
| 111 | connect(ProjectProxy::instance(), &ProjectProxy::modeRaised, this, [=](const QString &mode) { |
| 112 | if (mode != CM_EDIT || openFileWidgetInited) |
| 113 | return; |
| 114 | initOpenFilesWidget(windowService); |
| 115 | }, |
| 116 | Qt::DirectConnection); |
| 117 | auto openFilesWidget = new AbstractWidget(openedWidget); |
| 118 | openFilesWidget->setDisplayIcon(QIcon::fromTheme("opened_files")); |
| 119 | windowService->registerWidgetToMode(openFilesWidgetName, openFilesWidget, CM_EDIT, Position::Left, false, true); |
| 120 | windowService->setDockHeaderName(openFilesWidgetName, tr("Opened Files")); |
| 121 | } |
| 122 | |
| 123 | void ProjectCore::addAutoFocusSwitcher(WindowService *windowService, DToolButton *autoFocusSwitcher, DToolButton *focusFile) |
| 124 | { |
nothing calls this directly
no test coverage detected