1 | /** |
2 | * This file is part of the kpimutils library. |
3 | * |
4 | * Copyright (C) 2008 Jarosław Staniek <staniek@kde.org> |
5 | * |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Lesser General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2.1 of the License, or (at your option) any later version. |
10 | * |
11 | * This library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Lesser General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Lesser General Public |
17 | * License along with this library; if not, write to the Free Software |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
19 | * 02110-1301 USA |
20 | */ |
21 | /** |
22 | @file |
23 | This file is part of the KDEPIM Utilities library and provides |
24 | static methods for process handling. |
25 | |
26 | @brief |
27 | Process handling methods. |
28 | |
29 | @author Jarosław Staniek \<staniek@kde.org\> |
30 | */ |
31 | |
32 | #ifndef KDEPIMUTILS_PROCESSES_H |
33 | #define KDEPIMUTILS_PROCESSES_H |
34 | |
35 | #include "kpimutils_export.h" |
36 | |
37 | #include <QtCore/QList> |
38 | |
39 | class QString; |
40 | |
41 | namespace KPIMUtils { |
42 | |
43 | #ifdef Q_WS_WIN |
44 | /** |
45 | * Sets @a pids to a list of processes having name @a processName. |
46 | */ |
47 | KPIMUTILS_EXPORT void getProcessesIdForName( const QString &processName, QList<int> &pids ); |
48 | |
49 | /** |
50 | * @return true if one or more processes (other than the current process) exist |
51 | * for name @a processName; false otherwise. |
52 | */ |
53 | KPIMUTILS_EXPORT bool otherProcessesExist( const QString &processName ); |
54 | |
55 | /** |
56 | * Terminates or kills all processes with name @a processName. |
57 | * First, SIGTERM is sent to a process, then if that fails, we try with SIGKILL. |
58 | * @return true on successful termination of all processes or false if at least |
59 | * one process failed to terminate. |
60 | */ |
61 | KPIMUTILS_EXPORT bool killProcesses( const QString &processName ); |
62 | |
63 | /** |
64 | * Activates window for first found process with executable @a executableName |
65 | * (without path and .exe extension) |
66 | */ |
67 | KPIMUTILS_EXPORT void activateWindowForProcess( const QString &executableName ); |
68 | #endif |
69 | |
70 | } |
71 | |
72 | #endif |
73 | |
74 | |