Changeset View
Changeset View
Standalone View
Standalone View
kate/kateapp.cpp
Show First 20 Lines • Show All 169 Lines • ▼ Show 20 Line(s) | 147 | { | |||
---|---|---|---|---|---|
170 | KStartupInfo::setNewStartupId(activeKateMainWindow(), KStartupInfo::startupId()); | 170 | KStartupInfo::setNewStartupId(activeKateMainWindow(), KStartupInfo::startupId()); | ||
171 | 171 | | |||
172 | QTextCodec *codec = m_args.isSet(QStringLiteral("encoding")) ? QTextCodec::codecForName(m_args.value(QStringLiteral("encoding")).toUtf8()) : nullptr; | 172 | QTextCodec *codec = m_args.isSet(QStringLiteral("encoding")) ? QTextCodec::codecForName(m_args.value(QStringLiteral("encoding")).toUtf8()) : nullptr; | ||
173 | bool tempfileSet = m_args.isSet(QStringLiteral("tempfile")); | 173 | bool tempfileSet = m_args.isSet(QStringLiteral("tempfile")); | ||
174 | 174 | | |||
175 | KTextEditor::Document *doc = nullptr; | 175 | KTextEditor::Document *doc = nullptr; | ||
176 | const QString codec_name = codec ? QString::fromLatin1(codec->name()) : QString(); | 176 | const QString codec_name = codec ? QString::fromLatin1(codec->name()) : QString(); | ||
177 | 177 | | |||
178 | Q_FOREACH(const QString positionalArgument, m_args.positionalArguments()) { | 178 | // Fix to bug 397913: Don't reverse order of files opened from the command line | ||
ngraham: This comment should describe why you're doing this, not just the bug. Something like `//… | |||||
179 | QString positionalArgument; | ||||
180 | for (int i = m_args.positionalArguments().count()-1; i >= 0; i--) { | ||||
181 | positionalArgument = m_args.positionalArguments().at(i); | ||||
179 | UrlInfo info(positionalArgument); | 182 | UrlInfo info(positionalArgument); | ||
180 | 183 | | |||
181 | // this file is no local dir, open it, else warn | 184 | // this file is no local dir, open it, else warn | ||
182 | bool noDir = !info.url.isLocalFile() || !QFileInfo(info.url.toLocalFile()).isDir(); | 185 | bool noDir = !info.url.isLocalFile() || !QFileInfo(info.url.toLocalFile()).isDir(); | ||
183 | 186 | | |||
184 | if (noDir) { | 187 | if (noDir) { | ||
185 | doc = openDocUrl(info.url, codec_name, tempfileSet); | 188 | doc = openDocUrl(info.url, codec_name, tempfileSet); | ||
186 | if (info.cursor.isValid()) { | 189 | if (info.cursor.isValid()) { | ||
▲ Show 20 Lines • Show All 259 Lines • ▼ Show 20 Line(s) | 444 | { | |||
446 | if (!jsonMessage.isObject()) | 449 | if (!jsonMessage.isObject()) | ||
447 | return; | 450 | return; | ||
448 | 451 | | |||
449 | /** | 452 | /** | ||
450 | * open all passed urls | 453 | * open all passed urls | ||
451 | */ | 454 | */ | ||
452 | const QJsonArray urls = jsonMessage.object().value(QLatin1String("urls")).toArray(); | 455 | const QJsonArray urls = jsonMessage.object().value(QLatin1String("urls")).toArray(); | ||
453 | Q_FOREACH(QJsonValue urlObject, urls) { | 456 | Q_FOREACH(QJsonValue urlObject, urls) { | ||
457 | | ||||
ngraham: Unnecessary/unrelated whitespace change | |||||
454 | /** | 458 | /** | ||
455 | * get url meta data | 459 | * get url meta data | ||
456 | */ | 460 | */ | ||
457 | const QUrl url = urlObject.toObject().value(QLatin1String("url")).toVariant().toUrl(); | 461 | const QUrl url = urlObject.toObject().value(QLatin1String("url")).toVariant().toUrl(); | ||
458 | const int line = urlObject.toObject().value(QLatin1String("line")).toVariant().toInt(); | 462 | const int line = urlObject.toObject().value(QLatin1String("line")).toVariant().toInt(); | ||
459 | const int column = urlObject.toObject().value(QLatin1String("column")).toVariant().toInt(); | 463 | const int column = urlObject.toObject().value(QLatin1String("column")).toVariant().toInt(); | ||
460 | 464 | | |||
461 | /** | 465 | /** | ||
Show All 16 Lines |
This comment should describe why you're doing this, not just the bug. Something like // Reverse the order here so the new tabs are opened in same order as the files were passed in on the command line