Commit 5a694cabdd8390a28b6abd44405a39fd6e337469

  • avatar
  • icefox
  • Tue Jun 23 04:44:29 CEST 2009
When a file is passed as an argument to the application the path does
not have to be absolute unlike the location bar which must be an
absolute path.

Issue: 496
  
106106 QCoreApplication::setApplicationVersion(version);
107107#ifndef AUTOTESTS
108108 QStringList args = QCoreApplication::arguments();
109 QString message = (args.count() > 1) ? args.last() : QString();
109 QString message = (args.count() > 1) ? parseArgumentUrl(args.last()) : QString();
110110 if (sendMessage(message))
111111 return;
112112 // not sure what else to do...
178178 networkAccessManager()->loadSettings();
179179}
180180
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.
183QString 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
181192void BrowserApplication::messageReceived(const QString &message)
182193{
183194 if (!message.isEmpty()) {
255255 QStringList args = QCoreApplication::arguments();
256256
257257 if (args.count() > 1) {
258 QString argumentUrl = parseArgumentUrl(args.last());
258259 switch (startup) {
259260 case 2: {
260261 restoreLastSession();
261 mainWindow()->tabWidget()->loadString(args.last(), TabWidget::NewSelectedTab);
262 mainWindow()->tabWidget()->loadString(argumentUrl, TabWidget::NewSelectedTab);
262263 break;
263264 }
264265 default:
265 mainWindow()->tabWidget()->loadString(args.last());
266 mainWindow()->tabWidget()->loadString(argumentUrl);
266267 break;
267268 }
268269 } else {
  
144144 void privacyChanged(bool isPrivate);
145145
146146private:
147 QString parseArgumentUrl(const QString &string) const;
147148 void clean();
148149
149150 static HistoryManager *s_historyManager;