summaryrefslogtreecommitdiffstats
path: root/src/core/type_conversion.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/type_conversion.h')
-rw-r--r--src/core/type_conversion.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h
index 023bed21e..b9e210c22 100644
--- a/src/core/type_conversion.h
+++ b/src/core/type_conversion.h
@@ -83,7 +83,7 @@ inline QString toQt(const base::string16 &string)
#endif
}
-inline QString toQt(const std::string &string)
+inline QString toQString(const std::string &string)
{
return QString::fromStdString(string);
}
@@ -93,6 +93,12 @@ inline QByteArray toQByteArray(const std::string &string)
return QByteArray::fromStdString(string);
}
+// ### should probably be toQByteArray
+inline QString toQt(const std::string &string)
+{
+ return toQString(string);
+}
+
inline base::string16 toString16(const QString &qString)
{
#if defined(OS_WIN)
@@ -109,12 +115,15 @@ inline base::NullableString16 toNullableString16(const QString &qString)
inline QUrl toQt(const GURL &url)
{
- return QUrl(QString::fromStdString(url.spec()));
+ if (url.is_valid())
+ return QUrl::fromEncoded(toQByteArray(url.spec()));
+
+ return QUrl(toQString(url.possibly_invalid_spec()));
}
inline GURL toGurl(const QUrl& url)
{
- return GURL(url.toString().toStdString());
+ return GURL(url.toEncoded().toStdString());
}
inline QPoint toQt(const gfx::Point &point)
@@ -265,7 +274,7 @@ inline std::vector<T> toVector(const QStringList &fileList)
{
std::vector<T> selectedFiles;
selectedFiles.reserve(fileList.size());
- Q_FOREACH (const QString &file, fileList)
+ for (const QString &file : fileList)
selectedFiles.push_back(fileListingHelper<T>(file));
return selectedFiles;
}