summaryrefslogtreecommitdiff
path: root/src/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'src/dialogs')
-rw-r--r--src/dialogs/dialogs.pro2
-rw-r--r--src/dialogs/plugin.cpp5
-rw-r--r--src/dialogs/qquickabstractfiledialog.cpp8
-rw-r--r--src/dialogs/qquickabstractfiledialog_p.h4
-rw-r--r--src/dialogs/qquickplatformfiledialog.cpp14
5 files changed, 30 insertions, 3 deletions
diff --git a/src/dialogs/dialogs.pro b/src/dialogs/dialogs.pro
index ca5f408e..362f5584 100644
--- a/src/dialogs/dialogs.pro
+++ b/src/dialogs/dialogs.pro
@@ -3,7 +3,7 @@ requires(contains(QT_CONFIG, accessibility))
CXX_MODULE = qml
TARGET = dialogplugin
TARGETPATH = QtQuick/Dialogs
-IMPORT_VERSION = 1.2
+IMPORT_VERSION = 1.3
QMAKE_DOCS = $$PWD/doc/qtquickdialogs.qdocconf
diff --git a/src/dialogs/plugin.cpp b/src/dialogs/plugin.cpp
index a2fb1099..2e861fa5 100644
--- a/src/dialogs/plugin.cpp
+++ b/src/dialogs/plugin.cpp
@@ -72,7 +72,7 @@ static void initResources()
QT_BEGIN_NAMESPACE
/*!
- \qmlmodule QtQuick.Dialogs 1.2
+ \qmlmodule QtQuick.Dialogs 1.3
\title Qt Quick Dialogs QML Types
\ingroup qmlmodules
\brief Provides QML types for standard file, color picker and message dialogs
@@ -82,7 +82,7 @@ QT_BEGIN_NAMESPACE
To use the types in this module, import the module with the following line:
\code
- import QtQuick.Dialogs 1.2
+ import QtQuick.Dialogs 1.3
\endcode
*/
@@ -185,6 +185,7 @@ public:
#endif
qCDebug(lcRegistration) << " registering" << dialogQmlPath << "as Dialog";
qmlRegisterType(dialogQmlPath, uri, 1, 2, "Dialog");
+ qmlRegisterType(dialogQmlPath, uri, 1, 3, "Dialog");
}
}
diff --git a/src/dialogs/qquickabstractfiledialog.cpp b/src/dialogs/qquickabstractfiledialog.cpp
index 49d98a1a..b80bf86b 100644
--- a/src/dialogs/qquickabstractfiledialog.cpp
+++ b/src/dialogs/qquickabstractfiledialog.cpp
@@ -318,4 +318,12 @@ QJSValue QQuickAbstractFileDialog::__shortcuts()
return m_shortcutDetails;
}
+void QQuickAbstractFileDialog::setDefaultSuffix(const QString &suffix)
+{
+ if (suffix == m_options->defaultSuffix())
+ return;
+ m_options->setDefaultSuffix(suffix);
+ emit defaultSuffixChanged();
+}
+
QT_END_NAMESPACE
diff --git a/src/dialogs/qquickabstractfiledialog_p.h b/src/dialogs/qquickabstractfiledialog_p.h
index b4b7165d..cb7ac27e 100644
--- a/src/dialogs/qquickabstractfiledialog_p.h
+++ b/src/dialogs/qquickabstractfiledialog_p.h
@@ -74,6 +74,7 @@ class QQuickAbstractFileDialog : public QQuickAbstractDialog
Q_PROPERTY(QUrl fileUrl READ fileUrl NOTIFY selectionAccepted)
Q_PROPERTY(QList<QUrl> fileUrls READ fileUrls NOTIFY selectionAccepted)
Q_PROPERTY(bool sidebarVisible READ sidebarVisible WRITE setSidebarVisible NOTIFY sidebarVisibleChanged)
+ Q_PROPERTY(QString defaultSuffix READ defaultSuffix WRITE setDefaultSuffix NOTIFY defaultSuffixChanged)
Q_PROPERTY(QJSValue shortcuts READ shortcuts NOTIFY shortcutsChanged) // map of QStandardDirectory names to QUrls
Q_PROPERTY(QJSValue __shortcuts READ __shortcuts NOTIFY shortcutsChanged) // map of details for QML dialog implementations
@@ -95,6 +96,7 @@ public:
bool sidebarVisible() const { return m_sidebarVisible; }
QJSValue shortcuts();
QJSValue __shortcuts();
+ QString defaultSuffix() const { return m_options->defaultSuffix(); }
public Q_SLOTS:
void setVisible(bool v);
@@ -107,6 +109,7 @@ public Q_SLOTS:
void selectNameFilter(const QString &f);
void setSelectedNameFilterIndex(int idx);
void setSidebarVisible(bool s);
+ void setDefaultSuffix(const QString &suffix);
Q_SIGNALS:
void folderChanged();
@@ -116,6 +119,7 @@ Q_SIGNALS:
void selectionAccepted();
void sidebarVisibleChanged();
void shortcutsChanged();
+ void defaultSuffixChanged();
protected Q_SLOTS:
void updateFolder(const QUrl &f);
diff --git a/src/dialogs/qquickplatformfiledialog.cpp b/src/dialogs/qquickplatformfiledialog.cpp
index ab228d1f..b30f2b2b 100644
--- a/src/dialogs/qquickplatformfiledialog.cpp
+++ b/src/dialogs/qquickplatformfiledialog.cpp
@@ -422,4 +422,18 @@ void QQuickPlatformFileDialog::accept()
\l {Qt.labs.settings}{Settings}.
*/
+/*!
+ \qmlproperty string FileDialog::defaultSuffix
+ \since 5.10
+
+ This property holds the suffix added to the filename if no other suffix was
+ specified.
+
+ This property specifies a string that will be added to the filename if it
+ has no suffix already. The suffix is typically used to indicate the file
+ type (e.g. "txt" indicates a text file).
+
+ If the first character is a dot ('.'), it is removed.
+*/
+
QT_END_NAMESPACE