| 56 | } |
| 57 | |
| 58 | QString findSwitchCandidate(const QUrl& docUrl) |
| 59 | { |
| 60 | QMimeDatabase db; |
| 61 | IBuddyDocumentFinder* finder = IBuddyDocumentFinder::finderForMimeType(db.mimeTypeForUrl(docUrl).name()); |
| 62 | if (finder) { |
| 63 | // get the first entry that exists, use that as candidate |
| 64 | const auto potentialBuddies = finder->potentialBuddies(docUrl); |
| 65 | for (const QUrl& buddyUrl : potentialBuddies) { |
| 66 | if (!QFile::exists(buddyUrl.toLocalFile())) { |
| 67 | continue; |
| 68 | } |
| 69 | |
| 70 | return buddyUrl.toLocalFile(); |
| 71 | } |
| 72 | } |
| 73 | return QString(); |
| 74 | } |
| 75 | |
| 76 | } |
| 77 |
no test coverage detected