Fix Qt bug on FileDialog for Windows that prevented remote file to be used.

This commit is contained in:
Julien Wadel 2024-02-14 15:56:41 +01:00
parent b900728003
commit d1fa93995f
2 changed files with 10 additions and 3 deletions

View file

@ -54,8 +54,15 @@ QSharedPointer<ContentModel> ContentListModel::add(std::shared_ptr<linphone::Con
return contentModel;
}
void ContentListModel::addFile(const QString& path){
void ContentListModel::addFile(QString path){
QFile file(path);
#ifdef _WIN32
// A bug from FileDialog suppose that the file is local and overwrite the uri by removing "\\".
if (!file.exists()) {
path.prepend("\\\\");
file.setFileName(path);
}
#endif
if (!file.exists())
return;
@ -168,4 +175,4 @@ void ContentListModel::updateAllTransferData(){
void ContentListModel::downloaded(){
for(auto content : mList)
content.objectCast<ContentModel>()->createThumbnail();
}
}

View file

@ -42,7 +42,7 @@ public:
int count();
QSharedPointer<ContentModel> add(std::shared_ptr<linphone::Content> content);
void addFile(const QString& path);
void addFile(QString path);
Q_INVOKABLE void remove(ContentModel * model);
void clear();