andre@603: /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik andre@603: * Software engineering by Intevation GmbH andre@603: * andre@603: * This file is Free Software under the GNU GPL (v>=2) andre@603: * and comes with ABSOLUTELY NO WARRANTY! andre@603: * See LICENSE.txt for details. andre@603: * andre@603: * Parts of this code (especially windows) are based on kpimutils processes.cpp andre@603: * available under LGPL 2.1 or later. andre@603: */ andre@603: #ifndef PROCESSHELP_H andre@603: #define PROCESSHELP_H andre@603: andre@603: #include andre@603: #include andre@1371: #include andre@603: andre@603: /** andre@1255: * @file processhelp.h emanuel@1053: * @brief Static helper functions for process handling andre@603: */ andre@1255: /** @brief Static helper functions for process handling */ andre@1255: class ProcessHelp { andre@603: andre@1255: public: andre@606: /** andre@606: * @brief look up process id's for a processName andre@606: * andre@606: * Looks up processes run by the current user. andre@606: * andre@606: * @param[in] processName the name of the process to look for andre@606: * @returns a list of pids that match this process. May be empty andre@606: */ andre@1255: static const QList getProcessesIdForName(const QString &processName); andre@603: andre@606: /** andre@606: * @brief check if another process with the same name exists andre@606: * andre@1162: * Under GNU/Linux this only works for processes that have a andre@1162: * processName.pid file in QStandardPaths::DataLocation. andre@1162: * andre@606: * @param[in] processName name of the process to look for. andre@606: * andre@606: * @returns true if one or more processes (other than the current process) exist andre@606: */ andre@1255: static bool otherProcessesExist(const QString &processName); andre@603: andre@606: /** andre@606: * @brief Activates the window for first found process andre@606: * @param [in] executableName executableName (without path and .exe extension) andre@606: */ andre@1255: static void activateWindowForProcess(const QString &executableName); wilde@782: wilde@782: /** wilde@782: * @brief Clean up internaly used infrastructure like pid/lock files. wilde@782: */ andre@1255: static void cleanUp(void); andre@1371: andre@1371: #ifndef WIN32 andre@1371: /** andre@1371: * @brief Read the signature timestamp from settings. andre@1371: * andre@1371: * @returns The signature timestamp as qdatetime or an invalid dt on error. andre@1371: */ andre@1371: static QDateTime getSigDtFromInstSettings(); andre@1371: #endif andre@1255: }; wilde@782: andre@603: #endif // PROCESSHELP_H