summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <aleixpol@kde.org>2016-02-26 16:04:40 (GMT)
committerAleix Pol <aleixpol@kde.org>2016-02-26 16:04:40 (GMT)
commit154c98fdaab2e593091fe644cfaeed96dd9fefaf (patch)
tree444dec18bb46120718a8f97872fab03c2ae2ea6b
parent67f69c8871d39e7538cfefb3303b030eca82d83c (diff)
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
-rw-r--r--shell/okular_main.cpp3
-rw-r--r--shell/shell.cpp9
-rw-r--r--shell/shell.h2
3 files changed, 11 insertions, 3 deletions
diff --git a/shell/okular_main.cpp b/shell/okular_main.cpp
index 9bdc1fe..2285f64 100644
--- a/shell/okular_main.cpp
+++ b/shell/okular_main.cpp
@@ -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;
}
diff --git a/shell/shell.cpp b/shell/shell.cpp
index c97054a..60b22ea 100644
--- a/shell/shell.cpp
+++ b/shell/shell.cpp
@@ -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 )
diff --git a/shell/shell.h b/shell/shell.h
index c7c155b..a6b9479 100644
--- a/shell/shell.h
+++ b/shell/shell.h
@@ -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() );