QFileDialog: emit urlsSelected+urlSelected in accept().
Not just filesSelected+fileSelected (which only happens for local files). Change-Id: Ife592c3c921231356f96cbc2871b6d724a15d2c8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
parent
616469bb76
commit
da088c5ace
@ -581,8 +581,8 @@ QFileDialogPrivate::~QFileDialogPrivate()
|
||||
void QFileDialogPrivate::initHelper(QPlatformDialogHelper *h)
|
||||
{
|
||||
QFileDialog *d = q_func();
|
||||
QObject::connect(h, SIGNAL(fileSelected(QUrl)), d, SLOT(_q_nativeFileSelected(QUrl)));
|
||||
QObject::connect(h, SIGNAL(filesSelected(QList<QUrl>)), d, SLOT(_q_nativeFilesSelected(QList<QUrl>)));
|
||||
QObject::connect(h, SIGNAL(fileSelected(QUrl)), d, SLOT(_q_emitUrlSelected(QUrl)));
|
||||
QObject::connect(h, SIGNAL(filesSelected(QList<QUrl>)), d, SLOT(_q_emitUrlsSelected(QList<QUrl>)));
|
||||
QObject::connect(h, SIGNAL(currentChanged(QUrl)), d, SLOT(_q_nativeCurrentChanged(QUrl)));
|
||||
QObject::connect(h, SIGNAL(directoryEntered(QUrl)), d, SLOT(_q_nativeEnterDirectory(QUrl)));
|
||||
QObject::connect(h, SIGNAL(filterSelected(QString)), d, SIGNAL(filterSelected(QString)));
|
||||
@ -2560,15 +2560,20 @@ void QFileDialog::done(int result)
|
||||
void QFileDialog::accept()
|
||||
{
|
||||
Q_D(QFileDialog);
|
||||
QStringList files = selectedFiles();
|
||||
if (files.isEmpty())
|
||||
return;
|
||||
if (!d->usingWidgets()) {
|
||||
d->emitFilesSelected(files);
|
||||
const QList<QUrl> urls = selectedUrls();
|
||||
if (urls.isEmpty())
|
||||
return;
|
||||
d->_q_emitUrlsSelected(urls);
|
||||
if (urls.count() == 1)
|
||||
d->_q_emitUrlSelected(urls.first());
|
||||
QDialog::accept();
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList files = selectedFiles();
|
||||
if (files.isEmpty())
|
||||
return;
|
||||
QString lineEditText = d->lineEdit()->text();
|
||||
// "hidden feature" type .. and then enter, and it will move up a dir
|
||||
// special case for ".."
|
||||
@ -3599,7 +3604,7 @@ void QFileDialogPrivate::_q_fileRenamed(const QString &path, const QString oldNa
|
||||
}
|
||||
}
|
||||
|
||||
void QFileDialogPrivate::_q_nativeFileSelected(const QUrl &file)
|
||||
void QFileDialogPrivate::_q_emitUrlSelected(const QUrl &file)
|
||||
{
|
||||
Q_Q(QFileDialog);
|
||||
emit q->urlSelected(file);
|
||||
@ -3607,7 +3612,7 @@ void QFileDialogPrivate::_q_nativeFileSelected(const QUrl &file)
|
||||
emit q->fileSelected(file.toLocalFile());
|
||||
}
|
||||
|
||||
void QFileDialogPrivate::_q_nativeFilesSelected(const QList<QUrl> &files)
|
||||
void QFileDialogPrivate::_q_emitUrlsSelected(const QList<QUrl> &files)
|
||||
{
|
||||
Q_Q(QFileDialog);
|
||||
emit q->urlsSelected(files);
|
||||
|
@ -287,8 +287,8 @@ private:
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_updateOkButton())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_currentChanged(const QModelIndex &index))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_enterDirectory(const QModelIndex &index))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_nativeFileSelected(const QUrl &))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_nativeFilesSelected(const QList<QUrl> &))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_emitUrlSelected(const QUrl &))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_emitUrlsSelected(const QList<QUrl> &))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_nativeCurrentChanged(const QUrl &))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_nativeEnterDirectory(const QUrl&))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_goToDirectory(const QString &path))
|
||||
|
@ -210,8 +210,8 @@ public:
|
||||
void _q_updateOkButton();
|
||||
void _q_currentChanged(const QModelIndex &index);
|
||||
void _q_enterDirectory(const QModelIndex &index);
|
||||
void _q_nativeFileSelected(const QUrl &file);
|
||||
void _q_nativeFilesSelected(const QList<QUrl> &files);
|
||||
void _q_emitUrlSelected(const QUrl &file);
|
||||
void _q_emitUrlsSelected(const QList<QUrl> &files);
|
||||
void _q_nativeCurrentChanged(const QUrl &file);
|
||||
void _q_nativeEnterDirectory(const QUrl &directory);
|
||||
void _q_goToDirectory(const QString &);
|
||||
|
Loading…
x
Reference in New Issue
Block a user