1 | /* |
2 | Copyright (C) 2009 George Kiagiadakis <gkiagia@users.sourceforge.net> |
3 | |
4 | This program is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by |
6 | the Free Software Foundation, either version 2 of the License, or |
7 | (at your option) any later version. |
8 | |
9 | This program is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU General Public License |
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | */ |
17 | #ifndef CRASHEDAPPLICATION_H |
18 | #define CRASHEDAPPLICATION_H |
19 | |
20 | #include <QtCore/QObject> |
21 | #include <QtCore/QDateTime> |
22 | #include <QtCore/QFileInfo> |
23 | |
24 | #include "bugreportaddress.h" |
25 | |
26 | class KCrashBackend; |
27 | |
28 | class CrashedApplication : public QObject |
29 | { |
30 | Q_OBJECT |
31 | public: |
32 | virtual ~CrashedApplication(); |
33 | |
34 | /** Returns the crashed program's name, possibly translated (ex. "The KDE Crash Handler") */ |
35 | QString name() const; |
36 | |
37 | /** Returns a QFileInfo with information about the executable that crashed */ |
38 | QFileInfo executable() const; |
39 | |
40 | /** When an application is run via kdeinit, the executable() method returns kdeinit4, but |
41 | * we still need a way to know which is the application that was loaded by kdeinit. So, |
42 | * this method returns the base name of the executable that would have been launched if |
43 | * the app had not been loaded by kdeinit (ex. "plasma-desktop"). If the application was |
44 | * not launched via kdeinit, this method returns executable().baseName(); |
45 | */ |
46 | QString fakeExecutableBaseName() const; |
47 | |
48 | /** Returns the version of the crashed program */ |
49 | QString version() const; |
50 | |
51 | /** Returns the address where the bug report for this application should go */ |
52 | BugReportAddress bugReportAddress() const; |
53 | |
54 | /** Returns the pid of the crashed program */ |
55 | int pid() const; |
56 | |
57 | /** Returns the signal number that the crashed program received */ |
58 | int signalNumber() const; |
59 | |
60 | /** Returns the name of the signal (ex. SIGSEGV) */ |
61 | QString signalName() const; |
62 | |
63 | bool hasBeenRestarted() const; |
64 | |
65 | int thread() const; |
66 | |
67 | const QDateTime& datetime() const; |
68 | |
69 | public slots: |
70 | void restart(); |
71 | |
72 | signals: |
73 | void restarted(bool success); |
74 | |
75 | protected: |
76 | friend class KCrashBackend; |
77 | CrashedApplication(QObject *parent = 0); |
78 | |
79 | int m_pid; |
80 | int m_signalNumber; |
81 | QString m_name; |
82 | QFileInfo m_executable; |
83 | QString m_fakeBaseName; |
84 | QString m_version; |
85 | BugReportAddress m_reportAddress; |
86 | bool m_restarted; |
87 | int m_thread; |
88 | QDateTime m_datetime; |
89 | }; |
90 | |
91 | QString getSuggestedKCrashFilename(const CrashedApplication* app); |
92 | |
93 | #endif // CRASHEDAPPLICATION_H |
94 | |