diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,10 @@ include (ECMSetupQtPluginMacroNames) include(KDEClangFormat) +# C++17 +set (CMAKE_CXX_STANDARD 17) +set (CMAKE_CXX_STANDARD_REQUIRED ON) + # Qt find_package (Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core DBus Widgets) diff --git a/cmake/modules/CheckCxxFeatures.cmake b/cmake/modules/CheckCxxFeatures.cmake deleted file mode 100644 --- a/cmake/modules/CheckCxxFeatures.cmake +++ /dev/null @@ -1,109 +0,0 @@ -# Macro that tests and returns whether a C++ feature is present in the -# current compiler - -set(CXX_CHECK_FEATURE_MODULE_DIR "${CMAKE_SOURCE_DIR}/cmake/modules") -set(CXX_FEATURES_SUPPORTED "") -set(CXX_FEATURES_UNSUPPORTED "") - -macro(CXX_PERFORM_TEST TEST_SOURCE_FILE TEST_TEST_BINARY_DIR EXPECTED_RESULT RESULT COMPILE_DEFINITIONS) - - try_run( - RUN_RESULT_VAR COMPILE_RESULT_VAR - "${TEST_BINARY_DIR}" "${TEST_SOURCE_FILE}" - COMPILE_DEFINITIONS "${COMPILE_DEFINITIONS}" - COMPILE_OUTPUT_VARIABLE COMPILE_OUT - RUN_OUTPUT_VARIABLE RUN_OUT - ) - - set(RESULT_VAR FALSE) - - if (COMPILE_RESULT_VAR AND NOT RUN_RESULT_VAR) - set(RESULT_VAR TRUE) - endif (COMPILE_RESULT_VAR AND NOT RUN_RESULT_VAR) - - if (NOT ("${RESULT_VAR}" STREQUAL "${EXPECTED_RESULT}")) - # message ("Got ${RESULT_VAR} as a result, but ${EXPECTED_RESULT} expected") - - if (NOT ${COMPILE_RESULT_VAR}) - # message("------ compilation output ------") - # message("${COMPILE_OUT}") - endif (NOT ${COMPILE_RESULT_VAR}) - - if (${RUN_RESULT_VAR}) - # message("---------- run output ----------") - # message("${RUN_OUT}") - # message("Process returned: ${RUN_RESULT_VAR}") - endif (${RUN_RESULT_VAR}) - - # message("--------------------------------") - - set (${RESULT} FALSE) - - else () - set (${RESULT} TRUE) - - endif () - - - -endmacro(CXX_PERFORM_TEST TEST_SOURCE EXPECTED_RESULT RESULT) - - - -macro(CXX_CHECK_FEATURE CXX_VERSION FEATURE_NAME FEATURE_NUMBER RESULT_VAR COMPILE_DEFINITIONS) - - # Testing whether we have previously set the variable - if(NOT DEFINED ${RESULT_VAR}) - - set(TEST_BINARY_DIR - "${CMAKE_CURRENT_BINARY_DIR}/cxx-check-feature/cxx_${FEATURE_NUMBER}" - ) - - set(TEST_SOURCE_BASE - "${CXX_CHECK_FEATURE_MODULE_DIR}/${CXX_VERSION}-test-${FEATURE_NAME}-${FEATURE_NUMBER}" - ) - - set(TEST_SOURCE_FILE "${TEST_SOURCE_BASE}.cpp") - set(FAILTEST_SOURCE_FILE "${TEST_SOURCE_BASE}-fail.cpp") - - set(FEATURE_NAME - "'${FEATURE_NAME}' (${CXX_VERSION} N${FEATURE_NUMBER})" - ) - - message(STATUS "Checking C++ support for ${FEATURE_NAME}") - - string (COMPARE EQUAL "${CMAKE_CXX_COMPILER_ID}" "Clang" CMAKE_COMPILER_IS_CLANG) - string (COMPARE EQUAL "${CMAKE_CXX_COMPILER_ID}" "GNU" CMAKE_COMPILER_IS_GCC) - - set (ADD_COMPILE_DEFINITIONS "") - - if (EXISTS ${TEST_SOURCE_FILE}) - CXX_PERFORM_TEST(${TEST_SOURCE_FILE} ${TEST_BINARY_DIR} TRUE ${RESULT_VAR} "${COMPILE_DEFINITIONS} ${ADD_COMPILE_DEFINITIONS}") - endif () - - if (${RESULT_VAR} AND EXISTS ${FAILTEST_SOURCE_FILE}) - CXX_PERFORM_TEST(${FAILTEST_SOURCE_FILE} ${TEST_BINARY_DIR} FALSE ${RESULT_VAR} "${COMPILE_DEFINITIONS} ${ADD_COMPILE_DEFINITIONS}") - endif () - - if (${RESULT_VAR}) - message(STATUS "Checking C++ support for ${FEATURE_NAME} -- works") - set (CXX_FEATURES_SUPPORTED - "${CXX_FEATURES_SUPPORTED} ${FEATURE_NAME} (${FEATURE_NUMBER})," - ) - - else () - message(STATUS "Checking C++ support for ${FEATURE_NAME} -- not supported") - set (CXX_FEATURES_UNSUPPORTED - "${CXX_FEATURES_UNSUPPORTED} ${FEATURE_NAME} (${FEATURE_NUMBER})," - ) - - endif () - - # This would break the feature reporting on second call of cmake - # TODO: Fix? - # set(${RESULT_VAR} ${${RESULT_VAR}} CACHE INTERNAL "C++ support for ${FEATURE_NAME}") - - endif(NOT DEFINED ${RESULT_VAR}) - -endmacro(CXX_CHECK_FEATURE) - diff --git a/cmake/modules/c++-test-override-attr-none-fail.cpp b/cmake/modules/c++-test-override-attr-none-fail.cpp deleted file mode 100644 --- a/cmake/modules/c++-test-override-attr-none-fail.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2014 - 2016 by Ivan Cukic - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -class A { - public: - virtual int fn(int arg) { - return 10 * arg; - }; - -}; - -class B: public A { - public: - virtual int fn(long arg) __attribute__((override)) { - return 20 * arg; - }; - -}; - -int main() -{ - A * a = new A(); - A * b = new B(); - - int result = a->fn(2) - b->fn(1); - - return 0; -} diff --git a/cmake/modules/c++-test-override-attr-none.cpp b/cmake/modules/c++-test-override-attr-none.cpp deleted file mode 100644 --- a/cmake/modules/c++-test-override-attr-none.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2014 - 2016 by Ivan Cukic - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -class A { - public: - virtual int fn(int arg) { - return 10 * arg; - }; - -}; - -class B: public A { - public: - virtual int fn(long arg) __attribute__((override)) { - return 20 * arg; - }; - -}; - -int main() -{ - A * a = new A(); - A * b = new B(); - - int result = a->fn(2) - b->fn(1); - - return 0; -} diff --git a/cmake/modules/c++11-test-auto-N2546.cpp b/cmake/modules/c++11-test-auto-N2546.cpp deleted file mode 100644 --- a/cmake/modules/c++11-test-auto-N2546.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2014 - 2016 by Ivan Cukic - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -int main() -{ - auto i = 5; - auto f = 3.14159f; - auto d = 3.14159; - auto l = 3l; - - bool checkFloats = (sizeof(f) < sizeof(d)); - bool checkInts = (sizeof(i) == sizeof(int)); - bool checkLongs = (sizeof(l) == sizeof(long)); - - std::cout - << "Float sizes correct: " << checkFloats << std::endl - << "Integer size correct: " << checkFloats << std::endl - << "Long sizes correct: " << checkFloats << std::endl; - - return (checkFloats && checkInts && checkLongs) ? 0 : 1; -} diff --git a/cmake/modules/c++11-test-initializer-lists-N2672.cpp b/cmake/modules/c++11-test-initializer-lists-N2672.cpp deleted file mode 100644 --- a/cmake/modules/c++11-test-initializer-lists-N2672.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2014 - 2016 by Ivan Cukic - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// #include -// #include -#include - -struct test { - int i; - int j; - double k; - std::string s; -}; - -int main() -{ - test t { 1, 2, 4, "asdf" }; - // std::vector v { 1, 2, 3, 4 }; - - // return ( - // t.i == v[0] - // && t.j == v[1] - // && t.k > v[2] - // && t.s.size() == v[3] - // ) - // ? 0 : 1; - - return 0; -} diff --git a/cmake/modules/c++11-test-lambda-N2927.cpp b/cmake/modules/c++11-test-lambda-N2927.cpp deleted file mode 100644 --- a/cmake/modules/c++11-test-lambda-N2927.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2014 - 2016 by Ivan Cukic - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -int main() -{ - int ref = 10; - int pass = 2; - - ([&](int mul) { - ref *= mul; - })(pass); - - bool checkRefNoref = (ref == 10 * pass); - - int result = ([=](int mul) { - return ref * mul; - })(pass); - - bool checkReturn = (result == 10 * pass * pass); - - std::cout - << "Capture by reference: " << checkRefNoref << std::endl - << "Return a value: " << checkReturn << std::endl; - - return (checkRefNoref && checkReturn) ? 0 : 1; -} diff --git a/cmake/modules/c++11-test-nullptr-N2431-fail.cpp b/cmake/modules/c++11-test-nullptr-N2431-fail.cpp deleted file mode 100644 --- a/cmake/modules/c++11-test-nullptr-N2431-fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2014 - 2016 by Ivan Cukic - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -int main() -{ - int i = nullptr; - return 1; -} diff --git a/cmake/modules/c++11-test-nullptr-N2431.cpp b/cmake/modules/c++11-test-nullptr-N2431.cpp deleted file mode 100644 --- a/cmake/modules/c++11-test-nullptr-N2431.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2014 - 2016 by Ivan Cukic - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -int main() -{ - int * test = nullptr; - return test ? 1 : 0; -} diff --git a/cmake/modules/c++11-test-override-N3206-fail.cpp b/cmake/modules/c++11-test-override-N3206-fail.cpp deleted file mode 100644 --- a/cmake/modules/c++11-test-override-N3206-fail.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2014 - 2016 by Ivan Cukic - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -class A { - public: - virtual int fn(int arg) { - return 10 * arg; - }; - -}; - -class B: public A { - public: - virtual int fn(long arg) override { - return 20 * arg; - }; - -}; - -int main() -{ - A * a = new A(); - A * b = new B(); - - int result = a->fn(2) - b->fn(1); - - return 0; -} diff --git a/cmake/modules/c++11-test-override-N3206.cpp b/cmake/modules/c++11-test-override-N3206.cpp deleted file mode 100644 --- a/cmake/modules/c++11-test-override-N3206.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2014 - 2016 by Ivan Cukic - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -class A { - public: - virtual int fn(int arg) { - return 10 * arg; - }; - -}; - -class B: public A { - public: - virtual int fn(int arg) override { - return 20 * arg; - }; - -}; - -int main() -{ - A * a = new A(); - A * b = new B(); - - int result = a->fn(2) - b->fn(1); - - return 0; -} diff --git a/cmake/modules/c++11-test-unique_ptr-none.cpp b/cmake/modules/c++11-test-unique_ptr-none.cpp deleted file mode 100644 --- a/cmake/modules/c++11-test-unique_ptr-none.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2014 - 2016 by Ivan Cukic - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include - -struct Question { - long answer; - std::string description; -}; - -int main() -{ - std::unique_ptr < Question > node_original(new Question()); - - node_original->answer = 42; - node_original->description = "The Answer to the Ultimate Question of Life, the Universe, and Everything"; - - std::unique_ptr < Question > node_second(std::move(node_original)); - - return (!node_original && (node_second->answer == 42))?0:1; -} diff --git a/cmake/modules/c++11-test-variadic-templates-N2242.cpp b/cmake/modules/c++11-test-variadic-templates-N2242.cpp deleted file mode 100644 --- a/cmake/modules/c++11-test-variadic-templates-N2242.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2014 - 2016 by Ivan Cukic - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -template -int addall(T value) -{ - return value; -} - -template -int addall(T value, Args ... args) -{ - return value + addall(args...); -} - -int main() -{ - int v1 = addall(1, 2, 3, 4, 5); // 15 - int v2 = addall(1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4); // 40 - return ((v1 == 15) && (v2 == 40)) ? 0 : 1; -} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,16 +21,6 @@ add_definitions (-fexceptions) endif () -# Testing for C++0x/C++11 features -include (CheckCxxFeatures) -cxx_check_feature ("c++11" "auto" "N2546" HAVE_CXX11_AUTO "${ADDITIONAL_DEFINITIONS}") -cxx_check_feature ("c++11" "nullptr" "N2431" HAVE_CXX11_NULLPTR "${ADDITIONAL_DEFINITIONS}") -cxx_check_feature ("c++11" "lambda" "N2927" HAVE_CXX11_LAMBDA "${ADDITIONAL_DEFINITIONS}") -cxx_check_feature ("c++11" "override" "N3206" HAVE_CXX11_OVERRIDE "${ADDITIONAL_DEFINITIONS}") -cxx_check_feature ("c++11" "unique_ptr" "none" HAVE_CXX11_UNIQUE_PTR "${ADDITIONAL_DEFINITIONS}") -cxx_check_feature ("c++11" "variadic-templates" "N2242" HAVE_CXX11_VARIADIC_TEMPLATES "${ADDITIONAL_DEFINITIONS}") -cxx_check_feature ("c++11" "initializer-lists" "N2672" HAVE_CXX11_INITIALIZER_LISTS "${ADDITIONAL_DEFINITIONS}") - # ======================================================= # Starting the actual project definition diff --git a/src/service/plugins/runapplication/RunApplicationPlugin.cpp b/src/service/plugins/runapplication/RunApplicationPlugin.cpp --- a/src/service/plugins/runapplication/RunApplicationPlugin.cpp +++ b/src/service/plugins/runapplication/RunApplicationPlugin.cpp @@ -117,10 +117,14 @@ QDir directory(path); for (const auto& item: directory.entryList(QDir::Files)) { QString filePath = directory.filePath(item); - KService service(filePath); - if (service.isValid() && service.isApplication()) { - qCDebug(KAMD_LOG_APPLICATION) << "Starting: " << service.exec(); + if (QFileInfo fileInfo(filePath); fileInfo.suffix() == "sh" && fileInfo.isExecutable()) { + qCDebug(KAMD_LOG_APPLICATION) << "Starting a shell script: " << filePath; + QProcess::startDetached(filePath, QStringList()); + + } else if (KService service(filePath); service.isValid() && service.isApplication()) { + qCDebug(KAMD_LOG_APPLICATION) << "Starting application: " << service.exec(); QProcess::startDetached(service.exec(), QStringList()); + } else { qCDebug(KAMD_LOG_APPLICATION) << "Openning file: " << QUrl::fromLocalFile(filePath); QDesktopServices::openUrl(QUrl::fromLocalFile(filePath));