Fix QUrl string encoding issue

Don't go through QUrl -> QString -> QUrl when opening files from the
argument list.
Don't be strict when opening URLs that come from the dbus interface.

REVIEW: 127042
frameworks
Aleix Pol 10 years ago
parent 67f69c8871
commit 154c98fdaa
  1. 3
      shell/okular_main.cpp
  2. 9
      shell/shell.cpp
  3. 2
      shell/shell.h

@ -166,7 +166,8 @@ Status main(const QStringList &paths, const QString &serializedOptions)
{
// Page only makes sense if we are opening one file
const QString page = ShellUtils::page(serializedOptions);
if ( shell->openDocument( ShellUtils::urlFromArg(paths[i], ShellUtils::qfileExistFunc(), page).url(), serializedOptions) )
const QUrl url = ShellUtils::urlFromArg(paths[i], ShellUtils::qfileExistFunc(), page);
if ( shell->openDocument( url, serializedOptions) )
{
++i;
}

@ -188,7 +188,7 @@ Shell::~Shell()
// Open a new document if we have space for it
// This can hang if called on a unique instance and openUrl pops a messageBox
bool Shell::openDocument( const QString& urlString, const QString &serializedOptions )
bool Shell::openDocument( const QUrl& url, const QString &serializedOptions )
{
if( m_tabs.size() <= 0 )
return false;
@ -203,11 +203,16 @@ bool Shell::openDocument( const QString& urlString, const QString &serializedOpt
return false;
}
openUrl( QUrl( urlString, QUrl::StrictMode) , serializedOptions );
openUrl( url, serializedOptions );
return true;
}
bool Shell::openDocument( const QString& urlString, const QString &serializedOptions )
{
return openDocument(QUrl(urlString), serializedOptions);
}
bool Shell::canOpenDocs( int numDocs, int desktop )
{
if( m_tabs.size() <= 0 || numDocs <= 0 || m_unique )

@ -67,6 +67,8 @@ public:
**/
bool isValid() const;
bool openDocument(const QUrl &url, const QString &serializedOptions);
public slots:
Q_SCRIPTABLE Q_NOREPLY void tryRaise();
Q_SCRIPTABLE bool openDocument(const QString &urlString, const QString &serializedOptions = QString() );

Loading…
Cancel
Save