| 1069 | } |
| 1070 | |
| 1071 | QUrl DocumentController::nextEmptyDocumentUrl() |
| 1072 | { |
| 1073 | int nextEmptyDocNumber = 0; |
| 1074 | const auto& pattern = emptyDocumentPattern(); |
| 1075 | const auto openDocuments = Core::self()->documentControllerInternal()->openDocuments(); |
| 1076 | for (IDocument* doc : openDocuments) { |
| 1077 | if (DocumentController::isEmptyDocumentUrl(doc->url())) { |
| 1078 | const auto match = pattern.match(doc->url().toDisplayString(QUrl::PreferLocalFile)); |
| 1079 | if (match.hasMatch()) { |
| 1080 | const auto num = match.capturedView(1).toInt(); |
| 1081 | nextEmptyDocNumber = qMax(nextEmptyDocNumber, num + 1); |
| 1082 | } else { |
| 1083 | nextEmptyDocNumber = qMax(nextEmptyDocNumber, 1); |
| 1084 | } |
| 1085 | } |
| 1086 | } |
| 1087 | |
| 1088 | QUrl url; |
| 1089 | if (nextEmptyDocNumber > 0) |
| 1090 | url = QUrl::fromLocalFile(QStringLiteral("/%1 (%2)").arg(EMPTY_DOCUMENT_URL).arg(nextEmptyDocNumber)); |
| 1091 | else |
| 1092 | url = QUrl::fromLocalFile(QLatin1Char('/') + EMPTY_DOCUMENT_URL); |
| 1093 | return url; |
| 1094 | } |
| 1095 | |
| 1096 | IDocumentFactory* DocumentController::factory(const QString& mime) const |
| 1097 | { |
nothing calls this directly
no test coverage detected