mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Added and modified patch from AsamK
- Fixed bug in Qt for Windows Vista and higher. Convert path from native separators of filenames from QFileDialog::getOpenFileName(s) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5213 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
63104ceefc
commit
ee3677da2b
@ -288,12 +288,19 @@ bool misc::getOpenFileName(QWidget *parent, RshareSettings::enumLastDir type, co
|
||||
|
||||
file = QFileDialog::getOpenFileName(parent, caption, lastDir, filter, NULL, QFileDialog::DontResolveSymlinks);
|
||||
|
||||
if (file.isEmpty() == false) {
|
||||
if (file.isEmpty())
|
||||
return false;
|
||||
|
||||
lastDir = QFileInfo(file).absoluteDir().absolutePath();
|
||||
Settings->setLastDir(type, lastDir);
|
||||
}
|
||||
|
||||
return !file.isEmpty();
|
||||
#ifdef WINDOWS_SYS
|
||||
// fix bug in Qt for Windows Vista and higher, convert path from native separators
|
||||
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
|
||||
file = QDir::fromNativeSeparators(file);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool misc::getOpenFileNames(QWidget *parent, RshareSettings::enumLastDir type, const QString &caption, const QString &filter, QStringList &files)
|
||||
@ -302,12 +309,21 @@ bool misc::getOpenFileNames(QWidget *parent, RshareSettings::enumLastDir type, c
|
||||
|
||||
files = QFileDialog::getOpenFileNames(parent, caption, lastDir, filter, NULL, QFileDialog::DontResolveSymlinks);
|
||||
|
||||
if (files.isEmpty() == false) {
|
||||
if (files.isEmpty())
|
||||
return false;
|
||||
|
||||
lastDir = QFileInfo(*files.begin()).absoluteDir().absolutePath();
|
||||
Settings->setLastDir(type, lastDir);
|
||||
}
|
||||
|
||||
return !files.isEmpty();
|
||||
#ifdef WINDOWS_SYS
|
||||
// fix bug in Qt for Windows Vista and higher, convert path from native separators
|
||||
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
|
||||
for (QStringList::iterator file = files.begin(); file != files.end(); file++) {
|
||||
(*file) = QDir::fromNativeSeparators(*file);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool misc::getSaveFileName(QWidget *parent, RshareSettings::enumLastDir type, const QString &caption, const QString &filter, QString &file)
|
||||
@ -316,10 +332,11 @@ bool misc::getSaveFileName(QWidget *parent, RshareSettings::enumLastDir type, co
|
||||
|
||||
file = QFileDialog::getSaveFileName(parent, caption, lastDir, filter);
|
||||
|
||||
if (file.isEmpty() == false) {
|
||||
if (file.isEmpty())
|
||||
return false;
|
||||
|
||||
lastDir = QFileInfo(file).absoluteDir().absolutePath();
|
||||
Settings->setLastDir(type, lastDir);
|
||||
}
|
||||
|
||||
return !file.isEmpty();
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user