Mercurial > trustbridge
annotate ui/processhelp.h @ 1401:ee807f64e21e 1.0
(Auto) Update translation line numbers
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 27 Jan 2015 15:18:10 +0100 |
parents | 23df332b2a4c |
children |
rev | line source |
---|---|
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
3 * |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=2) |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
6 * See LICENSE.txt for details. |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
7 * |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
8 * Parts of this code (especially windows) are based on kpimutils processes.cpp |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
9 * available under LGPL 2.1 or later. |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
10 */ |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
11 #ifndef PROCESSHELP_H |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
12 #define PROCESSHELP_H |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
13 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
14 #include <QList> |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
15 #include <QString> |
1371
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1255
diff
changeset
|
16 #include <QDateTime> |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
17 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
18 /** |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
19 * @file processhelp.h |
1053
78798d3af8f0
Fixed doxygen build warnings.
Emanuel Schuetze <emanuel@intevation.de>
parents:
782
diff
changeset
|
20 * @brief Static helper functions for process handling |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
21 */ |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
22 /** @brief Static helper functions for process handling */ |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
23 class ProcessHelp { |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
24 |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
25 public: |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
26 /** |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
27 * @brief look up process id's for a processName |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
28 * |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
29 * Looks up processes run by the current user. |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
30 * |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
31 * @param[in] processName the name of the process to look for |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
32 * @returns a list of pids that match this process. May be empty |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
33 */ |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
34 static const QList<int> getProcessesIdForName(const QString &processName); |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
35 |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
36 /** |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
37 * @brief check if another process with the same name exists |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
38 * |
1162
2a1206932f53
(issue107) Comment all TODO's and FIXME's with issues as documented in issue107
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1053
diff
changeset
|
39 * Under GNU/Linux this only works for processes that have a |
2a1206932f53
(issue107) Comment all TODO's and FIXME's with issues as documented in issue107
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1053
diff
changeset
|
40 * processName.pid file in QStandardPaths::DataLocation. |
2a1206932f53
(issue107) Comment all TODO's and FIXME's with issues as documented in issue107
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1053
diff
changeset
|
41 * |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
42 * @param[in] processName name of the process to look for. |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
43 * |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
44 * @returns true if one or more processes (other than the current process) exist |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
45 */ |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
46 static bool otherProcessesExist(const QString &processName); |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
47 |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
48 /** |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
49 * @brief Activates the window for first found process |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
50 * @param [in] executableName executableName (without path and .exe extension) |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
51 */ |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
52 static void activateWindowForProcess(const QString &executableName); |
782
20ca94680003
Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
606
diff
changeset
|
53 |
20ca94680003
Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
606
diff
changeset
|
54 /** |
20ca94680003
Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
606
diff
changeset
|
55 * @brief Clean up internaly used infrastructure like pid/lock files. |
20ca94680003
Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
606
diff
changeset
|
56 */ |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
57 static void cleanUp(void); |
1371
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1255
diff
changeset
|
58 |
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1255
diff
changeset
|
59 #ifndef WIN32 |
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1255
diff
changeset
|
60 /** |
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1255
diff
changeset
|
61 * @brief Read the signature timestamp from settings. |
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1255
diff
changeset
|
62 * |
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1255
diff
changeset
|
63 * @returns The signature timestamp as qdatetime or an invalid dt on error. |
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1255
diff
changeset
|
64 */ |
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1255
diff
changeset
|
65 static QDateTime getSigDtFromInstSettings(); |
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1255
diff
changeset
|
66 #endif |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
67 }; |
782
20ca94680003
Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
606
diff
changeset
|
68 |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
69 #endif // PROCESSHELP_H |