7#include <QtCore/qloggingcategory.h>
8#include <QtQuickTemplates2/private/qquickdialogbuttonbox_p_p.h>
15Q_LOGGING_CATEGORY(lcFolderDialogCurrentFolder,
"qt.quick.dialogs.quickfolderdialogimpl.currentFolder")
16Q_LOGGING_CATEGORY(lcFolderDialogSelectedFolder, "qt.quick.dialogs.quickfolderdialogimpl.selectedFolder")
17Q_LOGGING_CATEGORY(lcFolderDialogOptions, "qt.quick.dialogs.quickfolderdialogimpl.options")
35 qmlWarning(
q).nospace() <<
"Can't update Open button's enabled state because it wasn't found";
58 int newSelectedFolderIndex = 0;
66 const int indexOfFolder = oldFolderPath.
indexOf(newFolderPath);
67 if (indexOfFolder != -1) {
73 newSelectedFolderPath = newFolderPath +
QLatin1Char(
'/') + relativePaths.first();
76 const QDir newFolderDir(newFolderPath);
78 if (!newFolderDir.
exists()) {
79 qmlWarning(
q) <<
"Directory" << newSelectedFolderPath <<
"doesn't exist; can't get a file entry list for it";
84 const QFileInfo newSelectedFileInfo(newSelectedFolderPath);
86 newSelectedFolderIndex = dirs.
indexOf(newSelectedFileInfo);
90 if (newSelectedFolderPath.
isEmpty()) {
97 QDir newFolderDir(newFolderPath);
98 if (newFolderDir.
exists()) {
100 if (!
files.isEmpty())
101 newSelectedFolderPath =
files.first().absoluteFilePath();
105 const bool folderSelected = !newSelectedFolderPath.
isEmpty();
115 if (folderSelected) {
117 currentItem->forceActiveFocus();
157 return d->currentFolder;
170 d->updateSelectedFolder(oldFolderPath);
177 return d->selectedFolder;
183 qCDebug(lcFolderDialogSelectedFolder).nospace() <<
"setSelectedFolder called with selectedFolder "
184 <<
selectedFolder <<
" (d->selectedFolder is " <<
d->selectedFolder <<
")";
201 qCDebug(lcFolderDialogOptions).nospace() <<
"setOptions called with:"
228 <<
"; failed to find Open button in DialogButtonBox of " <<
this;
232 acceptButton->setText(!
label.isEmpty()
246 <<
"; failed to find Open button in DialogButtonBox of " <<
this;
250 rejectButton->setText(!
label.isEmpty()
268 const int buttonCount =
d->buttonBox->count();
269 if (buttonCount == 0)
273 d->buttonBox->itemAt(buttonCount - 1));
274 if (!rightMostButton) {
275 qmlWarning(
this) <<
"Can't find right-most button in DialogButtonBox";
280 if (!keyNavigationAttached) {
281 qmlWarning(
this) <<
"Can't create attached KeyNavigation object on" << QDebug::toString(rightMostButton);
308 qmlAttachedPropertiesObject<QQuickFolderDialogImpl>(
q));
310 qmlWarning(
q) <<
"Expected FileDialogImpl attached object to be present on" <<
this;
316 auto folderDialogImpl = qobject_cast<QQuickFolderDialogImpl*>(
parent);
317 if (!folderDialogImpl)
321 if (!folderDialogDelegate)
324 folderDialogImpl->setSelectedFolder(folderDialogDelegate->file());
330 if (!qobject_cast<QQuickFolderDialogImpl*>(
parent)) {
331 qmlWarning(
this) <<
"FolderDialogImpl attached properties should only be "
332 <<
"accessed through the root FileDialogImpl instance";
339 return d->folderDialogListView;
359 return d->breadcrumbBar;
374#include "moc_qquickfolderdialogimpl_p.cpp"
QFileInfoList entryInfoList(Filters filters=NoFilter, SortFlags sort=NoSort) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool exists() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
AcceptMode acceptMode() const
QUrl initialDirectory() const
FileMode fileMode() const
\inmodule QtCore \reentrant
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
QObject * parent() const
Returns a pointer to the parent object.
static QString urlToLocalFileOrQrc(const QString &)
If url is a local file returns a path suitable for passing to QFile.
virtual void componentComplete()=0
Invoked after the root component that caused this instantiation has completed construction.
static QPlatformDialogHelper::ButtonRole buttonRole(QQuickAbstractButton *button)
Popup dialog with standard buttons and a title, used for short-term interaction with the user.
QQuickDialogButtonBox * buttonBox
QQuickTextField * textField
QQuickAbstractButton * upButton
QPointer< QQuickListView > folderDialogListView
void folderDialogListViewCurrentIndexChanged()
void setBreadcrumbBar(QQuickFolderBreadcrumbBar *breadcrumbBar)
void folderDialogListViewChanged()
void setFolderDialogListView(QQuickListView *folderDialogListView)
QQuickFolderBreadcrumbBar * breadcrumbBar
QQuickListView * folderDialogListView
void breadcrumbBarChanged()
QQuickFolderDialogImplAttached(QObject *parent=nullptr)
QQuickFolderDialogImplAttached * attachedOrWarn()
void updateSelectedFolder(const QString &oldFolderPath)
void handleClick(QQuickAbstractButton *button) override
void handleAccept() override
void setAcceptLabel(const QString &label)
QSharedPointer< QFileDialogOptions > options() const
void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) override
void setSelectedFolder(const QUrl &selectedFolder)
void setCurrentFolder(const QUrl &folder)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
QQuickFolderDialogImpl(QObject *parent=nullptr)
void setRejectLabel(const QString &label)
void selectedFolderChanged(const QUrl &folderUrl)
void setOptions(const QSharedPointer< QFileDialogOptions > &options)
static QQuickFolderDialogImplAttached * qmlAttachedProperties(QObject *object)
void currentFolderChanged(const QUrl &folderUrl)
void currentIndexChanged()
void setCurrentIndex(int idx)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Q_INVOKABLE void forceActiveFocus()
\qmlmethod point QtQuick::Item::mapToItem(Item item, real x, real y) \qmlmethod point QtQuick::Item::...
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
static QQuickKeyNavigationAttached * qmlAttachedProperties(QObject *)
Exception-safe wrapper around QObject::blockSignals().
\macro QT_RESTRICTED_CAST_FROM_ASCII
QStringList split(const QString &sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
qsizetype size() const
Returns the number of characters in this string.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
bool isValid() const
Returns true if the URL is non-empty and valid; otherwise returns false.
bool isEmpty() const
Returns true if the URL has no data; otherwise returns false.
Combined button and popup list for selecting options.
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
GLuint GLsizei const GLchar * label
[43]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLdouble GLdouble GLdouble GLdouble q
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
\inmodule QtCore \reentrant
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent