Changeset View
Standalone View
src/platformtheme/kdeplatformfiledialoghelper.cpp
Show First 20 Lines • Show All 402 Lines • ▼ Show 20 Line(s) | |||||
403 | 403 | | |||
404 | QUrl KDEPlatformFileDialogHelper::directory() const | 404 | QUrl KDEPlatformFileDialogHelper::directory() const | ||
405 | { | 405 | { | ||
406 | return m_dialog->directory(); | 406 | return m_dialog->directory(); | ||
407 | } | 407 | } | ||
408 | 408 | | |||
409 | void KDEPlatformFileDialogHelper::selectFile(const QUrl &filename) | 409 | void KDEPlatformFileDialogHelper::selectFile(const QUrl &filename) | ||
410 | { | 410 | { | ||
411 | m_dialog->selectFile(filename); | 411 | m_dialog->selectFile(filename); | ||
412 | | ||||
413 | // Qt 5 at least <= 5.8.0 does not derive the directory from the passed url | | |||
414 | // and set the initialDirectory option accordingly, also not for known schemes | | |||
415 | // like file://, so we have to do it ourselves | | |||
416 | options()->setInitialDirectory(m_dialog->directory()); | | |||
417 | } | 412 | } | ||
graesslin: Shouldn't that be a runtime check? | |||||
Yes it should be but what is the easy way to do that? Do I have to parse the result of qVersion()? CMakeLists.txt says the minimum version is 5.5 so I can't use QVersionNumber? arichardson: Yes it should be but what is the easy way to do that? Do I have to parse the result of qVersion… | |||||
elvisangelaccio: > what is the easy way to do that?
There is KCoreAddons::version() | |||||
I want the version of Qt not KCoreAddons so that won't work. arichardson: I want the version of Qt not KCoreAddons so that won't work.
Do we really need a runtime Qt… | |||||
What about if (qVersion() < QStringLiteral("5.7.1")) {}? It doesn't work in the general case but it should work for this specific check. elvisangelaccio: What about `if (qVersion() < QStringLiteral("5.7.1")) {}`? It doesn't work in the general case… | |||||
Sorry but I didn't think about Qt 5.10.x which would break this check. So please ignore my suggestion here. elvisangelaccio: Sorry but I didn't think about Qt 5.10.x which would break this check. So please ignore my… | |||||
anthonyfieroni: http://doc.qt.io/qt-5/qversionnumber.html | |||||
I don't think we can depend on that yet, can we? Also I'm not sure we really need that runtime check. How likely is it that someone compiles plasma integration against Qt 5.7 and runs it with 5.8? Is that even supported? Aren't we using private APIs? arichardson: I don't think we can depend on that yet, can we? Also I'm not sure we really need that runtime… | |||||
It's likely (hypothetical), complied with 5.8 and run it with 5.7 is unsupported.
It's supported by Qt, by KDE pretty sure - not. anthonyfieroni: > How likely is it that someone compiles plasma integration against Qt 5.7 and runs it with 5.8? | |||||
418 | 413 | | |||
419 | void KDEPlatformFileDialogHelper::setDirectory(const QUrl &directory) | 414 | void KDEPlatformFileDialogHelper::setDirectory(const QUrl &directory) | ||
420 | { | 415 | { | ||
421 | if (!directory.isEmpty()) { | 416 | if (!directory.isEmpty()) { | ||
422 | m_dialog->setDirectory(directory); | 417 | m_dialog->setDirectory(directory); | ||
423 | } | 418 | } | ||
424 | } | 419 | } | ||
425 | 420 | | |||
Show All 13 Lines |
Shouldn't that be a runtime check?