mirror of
https://github.com/savoirfairelinux/jami-client-qt.git
synced 2026-01-03 10:35:05 +08:00
filetransfer: adjust the url decoding for qml component file urls
Gitlab: #92 Change-Id: I10ae359b26c70cacdb1e1168658678f3f5b2a96e
This commit is contained in:
@@ -149,10 +149,7 @@ Item {
|
||||
|
||||
mode: JamiFileDialog.Mode.OpenFile
|
||||
|
||||
onAccepted: {
|
||||
// No need to trim file:///.
|
||||
AvAdapter.shareFile(jamiFileDialog.file)
|
||||
}
|
||||
onAccepted: AvAdapter.shareFile(jamiFileDialog.file)
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
||||
@@ -264,9 +264,9 @@ MessagesAdapter::sendImage(const QString& message)
|
||||
|
||||
QString msg(message);
|
||||
#ifdef Q_OS_WIN
|
||||
msg = msg.replace("file:///", "");
|
||||
msg = msg.replace("file://", "");
|
||||
#else
|
||||
msg = msg.replace("file:///", "/");
|
||||
msg = msg.replace("file://", "/");
|
||||
#endif
|
||||
QFileInfo fi(msg);
|
||||
QString fileName = fi.fileName();
|
||||
@@ -337,7 +337,7 @@ MessagesAdapter::deleteInteraction(const QString& arg)
|
||||
void
|
||||
MessagesAdapter::openFile(const QString& arg)
|
||||
{
|
||||
QUrl fileUrl("file:///" + arg);
|
||||
QUrl fileUrl("file://" + arg);
|
||||
if (!QDesktopServices::openUrl(fileUrl)) {
|
||||
qDebug() << "Couldn't open file: " << fileUrl;
|
||||
}
|
||||
@@ -399,9 +399,9 @@ MessagesAdapter::pasteKeyDetected()
|
||||
*/
|
||||
for (int i = 0; i < urlList.size(); ++i) {
|
||||
/*
|
||||
* Trim file:/// from url.
|
||||
* Trim file:// from url.
|
||||
*/
|
||||
QString filePath = urlList.at(i).toString().remove(0, 8);
|
||||
QString filePath = urlList.at(i).toString().remove("file://");
|
||||
QByteArray imageFormat = QImageReader::imageFormat(filePath);
|
||||
|
||||
/*
|
||||
|
||||
@@ -353,6 +353,9 @@ UtilsAdapter::toFileAbsolutepath(QString inputFileName)
|
||||
QString
|
||||
UtilsAdapter::getAbsPath(QString path)
|
||||
{
|
||||
// Note: this function is used on urls returned from qml-FileDialogs which
|
||||
// contain 'file:///' for reasons we don't understand.
|
||||
// TODO: this logic can be refactored into the JamiFileDialog component.
|
||||
#ifdef Q_OS_WIN
|
||||
return path.replace("file:///", "").replace("\n", "").replace("\r", "");
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user