aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <[email protected]>2017-03-03 17:26:31 +0100
committerAleix Pol <[email protected]>2017-03-06 14:59:25 +0100
commitc6305f5edbbd15244d79cfc7569352cf6f6ea4d6 (patch)
treee6ca80f55935eecfd79c80ac768dcfbf921c3d0d
parentf5f2c5e5f428d945f3ae66deb7d5344b008beca7 (diff)
Fix cmake warning
Summary: Use the native dialog if there's no QApplication Test Plan: Adds a test Reviewers: #frameworks, mart Reviewed By: mart Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D4926
-rw-r--r--autotests/CMakeLists.txt2
-rw-r--r--autotests/tst_filedialog.qml24
-rw-r--r--src/platformtheme/CMakeLists.txt4
-rw-r--r--src/platformtheme/kdeplatformtheme.cpp2
4 files changed, 28 insertions, 4 deletions
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index ddf3ba1..9ab55c2 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -83,6 +83,8 @@ frameworkintegration_tests(
)
if(Qt5Qml_FOUND)
+ add_test(NAME qmltests COMMAND qmltestrunner WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
frameworkintegration_tests(kfiledialogqml_unittest)
target_link_libraries(kfiledialogqml_unittest Qt5::Qml)
endif()
diff --git a/autotests/tst_filedialog.qml b/autotests/tst_filedialog.qml
new file mode 100644
index 0000000..27c4edf
--- /dev/null
+++ b/autotests/tst_filedialog.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.2
+import QtTest 1.0
+import QtQuick.Dialogs 1.2
+TestCase {
+ id: testCase
+ width: 400
+ height: 400
+ visible: true
+ when: windowShown
+ name: "FileDialogTest"
+
+ FileDialog {
+ id: fileDialog
+ folder: shortcuts.home
+ }
+
+ function test_filedialog() {
+ //At the moment it just makes sure that something opens and doesn't crash.
+ //Since this is a QGuiApplication (and not a QApplication)
+ fileDialog.visible = true
+ testCase.wait(200)
+ fileDialog.visible = false
+ }
+}
diff --git a/src/platformtheme/CMakeLists.txt b/src/platformtheme/CMakeLists.txt
index 04acb13..96a22c0 100644
--- a/src/platformtheme/CMakeLists.txt
+++ b/src/platformtheme/CMakeLists.txt
@@ -8,9 +8,7 @@ if(HAVE_X11)
find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED X11Extras)
find_package(XCB COMPONENTS XCB)
- set_package_properties(XCB PROPERTIES DESCRIPTION "Required for exposing the global menu on X11"
- TYPE REQUIRED
- )
+ set_package_properties(XCB PROPERTIES TYPE REQUIRED)
endif()
configure_file(config-platformtheme.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-platformtheme.h )
diff --git a/src/platformtheme/kdeplatformtheme.cpp b/src/platformtheme/kdeplatformtheme.cpp
index c19d85b..704f176 100644
--- a/src/platformtheme/kdeplatformtheme.cpp
+++ b/src/platformtheme/kdeplatformtheme.cpp
@@ -257,7 +257,7 @@ QList<QKeySequence> KdePlatformTheme::keyBindings(QKeySequence::StandardKey key)
bool KdePlatformTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const
{
- return type == QPlatformTheme::FileDialog;
+ return type == QPlatformTheme::FileDialog && qobject_cast<QApplication*>(QCoreApplication::instance());
}
QString KdePlatformTheme::standardButtonText(int button) const