Changeset View
Changeset View
Standalone View
Standalone View
src/vimode/appcommands.cpp
Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Line(s) | 146 | if (argument.isEmpty() || argument == QLatin1String("!")) { | |||
---|---|---|---|---|---|
153 | } | 153 | } | ||
154 | } else { | 154 | } else { | ||
155 | QUrl base = view->document()->url(); | 155 | QUrl base = view->document()->url(); | ||
156 | QUrl url; | 156 | QUrl url; | ||
157 | QUrl arg2path(argument); | 157 | QUrl arg2path(argument); | ||
158 | if (base.isValid()) { // first try to use the same path as the current open document has | 158 | if (base.isValid()) { // first try to use the same path as the current open document has | ||
159 | url = QUrl(base.resolved(arg2path)); //resolved handles the case where the args is a relative path, and is the same as using QUrl(args) elsewise | 159 | url = QUrl(base.resolved(arg2path)); //resolved handles the case where the args is a relative path, and is the same as using QUrl(args) elsewise | ||
160 | } else { // else use the cwd | 160 | } else { // else use the cwd | ||
161 | url = QUrl(QUrl(QDir::currentPath() + QLatin1String("/")).resolved(arg2path)); // + "/" is needed because of http://lists.qt.nokia.com/public/qt-interest/2011-May/033913.html | 161 | url = QUrl(QUrl(QDir::currentPath() + QLatin1Char('/')).resolved(arg2path)); // + "/" is needed because of http://lists.qt.nokia.com/public/qt-interest/2011-May/033913.html | ||
162 | } | 162 | } | ||
163 | QFileInfo file(url.toLocalFile()); | 163 | QFileInfo file(url.toLocalFile()); | ||
164 | 164 | | |||
165 | KTextEditor::Document *doc = app->findUrl(url); | 165 | KTextEditor::Document *doc = app->findUrl(url); | ||
166 | 166 | | |||
167 | if (!doc) { | 167 | if (!doc) { | ||
168 | if (file.exists()) { | 168 | if (file.exists()) { | ||
169 | doc = app->openUrl(url); | 169 | doc = app->openUrl(url); | ||
▲ Show 20 Lines • Show All 356 Lines • Show Last 20 Lines |