Windows: arrange for the file selection dialog to initially default to the Desktop, not the recoll install
This commit is contained in:
parent
568c4c3eb2
commit
ae1adc50c6
@ -29,6 +29,7 @@
|
|||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
#include "rclconfig.h"
|
#include "rclconfig.h"
|
||||||
@ -412,9 +413,23 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
QString myGetFileName(bool isdir, QString caption, bool filenosave)
|
QString myGetFileName(bool isdir, QString caption, bool filenosave)
|
||||||
{
|
{
|
||||||
LOGDEB1("myFileDialog: isdir " << (isdir) << "\n" );
|
LOGDEB1("myFileDialog: isdir " << isdir << "\n");
|
||||||
QFileDialog dialog(0, caption);
|
QFileDialog dialog(0, caption);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
// The default initial directory on WIndows is the Recoll install,
|
||||||
|
// which is not appropriate. Change it, only for the first call
|
||||||
|
// (next will start with the previous selection).
|
||||||
|
static bool first{true};
|
||||||
|
if (first) {
|
||||||
|
first = false;
|
||||||
|
// See https://doc.qt.io/qt-5/qfiledialog.html#setDirectoryUrl
|
||||||
|
// about the clsid magic (this one points to the desktop).
|
||||||
|
dialog.setDirectoryUrl(
|
||||||
|
QUrl("clsid:B4BFCC3A-DB2C-424C-B029-7FE99A87C641"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (isdir) {
|
if (isdir) {
|
||||||
dialog.setFileMode(QFileDialog::Directory);
|
dialog.setFileMode(QFileDialog::Directory);
|
||||||
dialog.setOptions(QFileDialog::ShowDirsOnly);
|
dialog.setOptions(QFileDialog::ShowDirsOnly);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user