diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e73f92..1037e31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,121 +1,124 @@ project(smb4k) set(VERSION_MAJOR 3) set(VERSION_MINOR 0) set(VERSION_PATCH 70) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) # Minimum required CMake version cmake_minimum_required(VERSION 3.2 FATAL_ERROR) # CMake policies cmake_policy(SET CMP0037 NEW) if (POLICY CMP0071) cmake_policy(SET CMP0071 NEW) endif() # Minimum required versions of Qt5 and KF5 set(QT_MIN_VERSION "5.6.0") set(KF5_MIN_VERSION "5.25.0") if(KF5_VERSION VERSION_GREATER "5.55.0") set(AUTHLIB KF5::AuthCore) else() set(AUTHLIB KF5::Auth) endif() find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/) include(KDEInstallDirs) include(KDECompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) include(FeatureSummary) include(ECMInstallIcons) +include(ECMSetupVersion) + +ecm_setup_version(${VERSION} VARIABLE_PREFIX SMB4K VERSION_HEADER smb4k_version.h) # Qt5 modules find_package(Qt5Core ${QT_MIN_VERSION} REQUIRED) find_package(Qt5Gui ${QT_MIN_VERSION} REQUIRED) find_package(Qt5Network ${QT_MIN_VERSION} REQUIRED) find_package(Qt5PrintSupport ${QT_MIN_VERSION} REQUIRED) find_package(Qt5Qml ${QT_MIN_VERSION} REQUIRED) find_package(Qt5Test ${QT_MIN_VERSION} REQUIRED) find_package(Qt5Widgets ${QT_MIN_VERSION} REQUIRED) # KF5 modules find_package(KF5Auth ${KF5_MIN_VERSION} REQUIRED) find_package(KF5Completion ${KF5_MIN_VERSION} REQUIRED) find_package(KF5Config ${KF5_MIN_VERSION} REQUIRED) find_package(KF5ConfigWidgets ${KF5_MIN_VERSION} REQUIRED) find_package(KF5CoreAddons ${KF5_MIN_VERSION} REQUIRED) find_package(KF5DBusAddons ${KF5_MIN_VERSION} REQUIRED) find_package(KF5DocTools ${KF5_MIN_VERSION} REQUIRED) find_package(KF5I18n ${KF5_MIN_VERSION} REQUIRED) find_package(KF5IconThemes ${KF5_MIN_VERSION} REQUIRED) find_package(KF5JobWidgets ${KF5_MIN_VERSION} REQUIRED) find_package(KF5KIO ${KF5_MIN_VERSION} REQUIRED) find_package(KF5Notifications ${KF5_MIN_VERSION} REQUIRED) find_package(KF5Solid ${KF5_MIN_VERSION} REQUIRED) find_package(KF5Wallet ${KF5_MIN_VERSION} REQUIRED) find_package(KF5WidgetsAddons ${KF5_MIN_VERSION} REQUIRED) find_package(KF5WindowSystem ${KF5_MIN_VERSION} REQUIRED) find_package(KF5XmlGui ${KF5_MIN_VERSION} REQUIRED) find_package(KF5Crash ${KF5_MIN_VERSION} REQUIRED) find_package(KF5Plasma ${KF5_MIN_VERSION}) set_package_properties(KF5Plasma PROPERTIES TYPE RUNTIME) # Find libsmbclient.h find_package(Libsmbclient REQUIRED MODULE) # Make sure that Smb4K builds when several custom targets # with the same name exist (happens in the po directory). if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/po") set_property(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS ON) endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/po") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) # Make sure that all libraries, plugins, etc. are installed # into the right place. set(KDE_INSTALL_USE_QT_SYS_PATHS ON CACHE BOOLEAN "Use Qt system paths for installation" FORCE) # Add subdirectories add_subdirectory(core) add_subdirectory(helpers) add_subdirectory(smb4k) add_subdirectory(data) add_subdirectory(doc) if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/po") ki18n_install(po) if(KF5DocTools_FOUND) kdoctools_install(po) endif(KF5DocTools_FOUND) endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/po") # Install the header files if desired option(INSTALL_HEADER_FILES "Install header files" OFF) if (INSTALL_HEADER_FILES) message(STATUS "Installing core header files (-DINSTALL_HEADER_FILES=false to disable)") elseif (NOT INSTALL_HEADER_FILES) message(STATUS "Not installing core header files (-DINSTALL_HEADER_FILES=true to enable)") endif(INSTALL_HEADER_FILES) # Do not install the plasmoid if not desired option(INSTALL_PLASMOID "Install the plasmoid" ON) if (INSTALL_PLASMOID) message(STATUS "Installing plasmoid (-DINSTALL_PLASMOID=false to disable)") add_subdirectory(plasmoid) elseif(NOT INSTALL_PLASMOID) message(STATUS "Not installing plasmoid (-DINSTALL_PLASMOID=true to enable)") endif(INSTALL_PLASMOID) ########### install files ############### feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/smb4k/main.cpp b/smb4k/main.cpp index dc7a12f..f830911 100644 --- a/smb4k/main.cpp +++ b/smb4k/main.cpp @@ -1,203 +1,205 @@ /*************************************************************************** Main file of the Smb4K program. ------------------- begin : Sam Mär 1 14:57:21 CET 2003 copyright : (C) 2003-2016 by Alexander Reinholdt email : alexander.reinholdt@kdemail.net ***************************************************************************/ /*************************************************************************** * 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) any later version. * * * * 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, write to the * * Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,* * MA 02110-1335, USA * ***************************************************************************/ #include // application specific includes #include "smb4kmainwindow.h" #include "core/smb4ksettings.h" #include "core/smb4kglobal.h" // Qt includes #include #include // KDE includes #include #include #include #include #include #include +#include + using namespace Smb4KGlobal; int main(int argc, char **argv) { // Migrate KDE4 configuration and XML files QStringList configFiles; configFiles << QLatin1String("smb4krc"); Kdelibs4ConfigMigrator migrator(QLatin1String("smb4k")); migrator.setConfigFiles(configFiles); if (migrator.migrate()) { Kdelibs4Migration migration; if (migration.kdeHomeFound()) { // // NOTE: We need the 'smb4k' subdirectory, since no QApplication // is running at this point. // // New location QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)+QDir::separator()+"smb4k"; // XML files QString bookmarks = migration.locateLocal("data", "smb4k/bookmarks.xml"); QString options = migration.locateLocal("data", "smb4k/custom_options.xml"); QString homes = migration.locateLocal("data", "smb4k/homes_shares.xml"); // Copy the files if they don't already exist if (!bookmarks.isEmpty() && QFile().exists(bookmarks)) { if (!QDir().exists(path)) { QDir().mkpath(path); } else { // Do nothing } QFile(bookmarks).copy(path+QDir::separator()+"bookmarks.xml"); } else { // Do nothing } if (!options.isEmpty() && QFile().exists(options)) { if (!QDir().exists(path)) { QDir().mkpath(path); } else { // Do nothing } QFile(options).copy(path+QDir::separator()+"custom_options.xml"); } else { // Do nothing } if (!homes.isEmpty() && QFile().exists(homes)) { if (!QDir().exists(path)) { QDir().mkpath(path); } else { // Do nothing } QFile(homes).copy(path+QDir::separator()+"homes_shares.xml"); } else { // Do nothing } } else { // Do nothing } } else { // Do nothing } // Set attributes QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); // Create the application QApplication app(argc, argv); // Connect the application with the translation catalog KLocalizedString::setApplicationDomain("smb4k"); // Create the about data for Smb4K - KAboutData aboutData(QStringLiteral("smb4k"), i18n("Smb4K"), QStringLiteral(VERSION), + KAboutData aboutData(QStringLiteral("smb4k"), i18n("Smb4K"), QStringLiteral(SMB4K_VERSION_STRING), i18n("Advanced network neighborhood browser and Samba share mounting utility"), KAboutLicense::GPL_V2, i18n("\u00A9 2003-2019 Alexander Reinholdt"), QString(), QStringLiteral("https://smb4k.sourceforge.io")); // DBus prefix aboutData.setOrganizationDomain("kde.org"); // Authors aboutData.addAuthor(i18n("Alexander Reinholdt"), i18n("Developer"), QStringLiteral("alexander.reinholdt@kdemail.net")); // Credits: // People who supported the Smb4K development by donating // money aboutData.addCredit(i18n("Wolfgang Geisendörfer"), i18n("Donator"), QStringLiteral("wdm-lin@gmx.net")); // Register about data KAboutData::setApplicationData(aboutData); // Now add the data to the application app.setApplicationName(aboutData.componentName()); app.setApplicationDisplayName(aboutData.displayName()); app.setOrganizationDomain(aboutData.organizationDomain()); app.setApplicationVersion(aboutData.version()); // We need to set this property because otherwise the application // will quit when it is embedded into the system tray, the main window // is hidden and the last window that was opened through the system // tray is closed. app.setQuitOnLastWindowClosed(false); // Support high dpi screens app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); // Program icon app.setWindowIcon(QIcon::fromTheme(QLatin1String("smb4k"))); // Launch the main window Smb4KMainWindow *mainWindow = new Smb4KMainWindow(); mainWindow->setVisible(!Smb4KSettings::startMainWindowDocked()); // Initialize the core. Use a busy cursor. initCore(true); // Unique application const KDBusService service(KDBusService::Unique); // Use a crash handler KCrash::setDrKonqiEnabled(true); // Start the application return app.exec(); }