diff --git a/src/resultset.h b/src/resultset.h --- a/src/resultset.h +++ b/src/resultset.h @@ -74,7 +74,8 @@ Linked = 2 }; - QString resource() const; ///< URL of the resource + QString resource() const; ///< String representation of resource (can represent an url or a path) + QUrl url() const; ///< Url representation of a resource based on internal resource, cannot be set QString title() const; ///< Title of the resource, or URL if title is not known QString mimetype() const; ///< Mimetype of the resource, or URL if title is not known double score() const; ///< The score calculated based on the usage statistics diff --git a/src/resultset.cpp b/src/resultset.cpp --- a/src/resultset.cpp +++ b/src/resultset.cpp @@ -25,6 +25,8 @@ #include #include #include +#include +#include // Local #include @@ -112,6 +114,14 @@ #undef CREATE_GETTER_AND_SETTER +QUrl ResultSet::Result::url() const +{ + if (QDir::isAbsolutePath(d->resource)) { + return QUrl::fromLocalFile(d->resource); + } else { + return QUrl(d->resource); + } +} class ResultSetPrivate { public: