Changeset View
Changeset View
Standalone View
Standalone View
kioclient/urlinfo.h
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 45 | if (QFile::exists(pathOrUrl)) { | |||
---|---|---|---|---|---|
47 | * create absolute file path, we will e.g. pass this over dbus to other processes | 47 | * create absolute file path, we will e.g. pass this over dbus to other processes | ||
48 | * and then we are done, no cursor can be detected here! | 48 | * and then we are done, no cursor can be detected here! | ||
49 | */ | 49 | */ | ||
50 | url = QUrl::fromLocalFile(QDir::current().absoluteFilePath(pathOrUrl)); | 50 | url = QUrl::fromLocalFile(QDir::current().absoluteFilePath(pathOrUrl)); | ||
51 | return; | 51 | return; | ||
52 | } | 52 | } | ||
53 | 53 | | |||
54 | /** | 54 | /** | ||
55 | * if the path starts with http:// or any other scheme, except file:// | ||||
56 | * we also don't want to do anything with URL | ||||
57 | */ | ||||
58 | if (!QUrl(pathOrUrl).isLocalFile()) { | ||||
59 | url = QUrl::fromUserInput(pathOrUrl, QDir::currentPath(), QUrl::DefaultResolution); | ||||
60 | return; | ||||
61 | } | ||||
62 | | ||||
63 | /** | ||||
55 | * ok, the path as is, is no existing file, now, cut away :xx:yy stuff as cursor | 64 | * ok, the path as is, is no existing file, now, cut away :xx:yy stuff as cursor | ||
56 | * this will make test:50 to test with line 50 | 65 | * this will make test:50 to test with line 50 | ||
57 | */ | 66 | */ | ||
58 | QString pathOrUrl2 = pathOrUrl; | 67 | QString pathOrUrl2 = pathOrUrl; | ||
59 | const auto match = QRegularExpression(QStringLiteral(":(\\d+)(?::(\\d+))?:?$")).match(pathOrUrl2); | 68 | const auto match = QRegularExpression(QStringLiteral(":(\\d+)(?::(\\d+))?:?$")).match(pathOrUrl2); | ||
60 | if (match.isValid()) { | 69 | if (match.isValid()) { | ||
61 | /** | 70 | /** | ||
62 | * cut away the line/column specification from the path | 71 | * cut away the line/column specification from the path | ||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |