Commit 5a694cabdd8390a28b6abd44405a39fd6e337469
- Diff rendering mode:
- inline
- side by side
src/browserapplication.cpp
(15 / 3)
|   | |||
| 106 | 106 | QCoreApplication::setApplicationVersion(version); | |
| 107 | 107 | #ifndef AUTOTESTS | |
| 108 | 108 | QStringList args = QCoreApplication::arguments(); | |
| 109 | QString message = (args.count() > 1) ? args.last() : QString(); | ||
| 109 | QString message = (args.count() > 1) ? parseArgumentUrl(args.last()) : QString(); | ||
| 110 | 110 | if (sendMessage(message)) | |
| 111 | 111 | return; | |
| 112 | 112 | // not sure what else to do... | |
| … | … | ||
| 178 | 178 | networkAccessManager()->loadSettings(); | |
| 179 | 179 | } | |
| 180 | 180 | ||
| 181 | // The only special property of an argument url is that the file's | ||
| 182 | // can be local, they don't have to be absolute. | ||
| 183 | QString BrowserApplication::parseArgumentUrl(const QString &string) const | ||
| 184 | { | ||
| 185 | if (QFile::exists(string)) { | ||
| 186 | QFileInfo info(string); | ||
| 187 | return info.canonicalFilePath(); | ||
| 188 | } | ||
| 189 | return string; | ||
| 190 | } | ||
| 191 | |||
| 181 | 192 | void BrowserApplication::messageReceived(const QString &message) | |
| 182 | 193 | { | |
| 183 | 194 | if (!message.isEmpty()) { | |
| … | … | ||
| 255 | 255 | QStringList args = QCoreApplication::arguments(); | |
| 256 | 256 | ||
| 257 | 257 | if (args.count() > 1) { | |
| 258 | QString argumentUrl = parseArgumentUrl(args.last()); | ||
| 258 | 259 | switch (startup) { | |
| 259 | 260 | case 2: { | |
| 260 | 261 | restoreLastSession(); | |
| 261 | mainWindow()->tabWidget()->loadString(args.last(), TabWidget::NewSelectedTab); | ||
| 262 | mainWindow()->tabWidget()->loadString(argumentUrl, TabWidget::NewSelectedTab); | ||
| 262 | 263 | break; | |
| 263 | 264 | } | |
| 264 | 265 | default: | |
| 265 | mainWindow()->tabWidget()->loadString(args.last()); | ||
| 266 | mainWindow()->tabWidget()->loadString(argumentUrl); | ||
| 266 | 267 | break; | |
| 267 | 268 | } | |
| 268 | 269 | } else { |
src/browserapplication.h
(1 / 0)
|   | |||
| 144 | 144 | void privacyChanged(bool isPrivate); | |
| 145 | 145 | ||
| 146 | 146 | private: | |
| 147 | QString parseArgumentUrl(const QString &string) const; | ||
| 147 | 148 | void clean(); | |
| 148 | 149 | ||
| 149 | 150 | static HistoryManager *s_historyManager; |

