MCPcopy Create free account
hub / github.com/dail8859/NotepadNext / openFileList

Method openFileList

src/dialogs/MainWindow.cpp:1087–1138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1085}
1086
1087void MainWindow::openFileList(const QStringList &fileNames)
1088{
1089 qInfo(Q_FUNC_INFO);
1090
1091 if (fileNames.size() == 0)
1092 return;
1093
1094 QList<ScintillaNext *> openedEditors;
1095 ScintillaNext *initialEditor = getInitialEditor();
1096
1097 for (const QString &filePath : fileNames) {
1098 qInfo("%s", qUtf8Printable(filePath));
1099
1100 // Search currently open editors to see if it is already open
1101 ScintillaNext *editor = app->getEditorManager()->getEditorByFilePath(filePath);
1102
1103 if (editor == Q_NULLPTR) {
1104 QFileInfo fileInfo(filePath);
1105
1106 if (!fileInfo.isFile()) {
1107 auto reply = QMessageBox::question(this, tr("Create File"), tr("<b>%1</b> does not exist. Do you want to create it?").arg(filePath));
1108
1109 if (reply == QMessageBox::Yes) {
1110 editor = app->getEditorManager()->createEditorFromFile(filePath, true);
1111 }
1112 else {
1113 // Make sure it is not still in the recent files list still.
1114 // Normally when a file is opened it is removed from the file list,
1115 // but if a user doesn't want to create the file, remove it explicitly.
1116 app->getRecentFilesListManager()->removeFile(filePath);
1117 continue;
1118 }
1119 }
1120 else {
1121 editor = app->getEditorManager()->createEditorFromFile(filePath);
1122 }
1123 }
1124
1125 if (editor) {
1126 openedEditors.append(editor);
1127 }
1128 }
1129
1130 // If any were successful, switch to the last one
1131 if (!openedEditors.empty()) {
1132 dockedEditor->switchToEditor(openedEditors.last());
1133 }
1134
1135 if (initialEditor) {
1136 initialEditor->close();
1137 }
1138}
1139
1140bool MainWindow::checkEditorsBeforeClose(const QVector<ScintillaNext *> &editors)
1141{

Callers

nothing calls this directly

Calls 9

getEditorByFilePathMethod · 0.80
getEditorManagerMethod · 0.80
isFileMethod · 0.80
createEditorFromFileMethod · 0.80
removeFileMethod · 0.80
closeMethod · 0.80
sizeMethod · 0.45
switchToEditorMethod · 0.45

Tested by

no test coverage detected