1 #include "auditLogMode.h"
2 
3 #include <QAction>
4 
5 #include <KLocalizedString>
6 
7 #include "ksystemlog_debug.h"
8 
9 #include "auditAnalyzer.h"
10 #include "auditConfiguration.h"
11 #include "auditConfigurationWidget.h"
12 
13 #include "auditItemBuilder.h"
14 
AuditLogMode()15 AuditLogMode::AuditLogMode()
16     : LogMode(QStringLiteral(AUDIT_LOG_MODE_ID), i18n("Audit Log"), QStringLiteral(AUDIT_MODE_ICON))
17 {
18     d->logModeConfiguration = QSharedPointer<AuditConfiguration>(new AuditConfiguration());
19 
20     d->logModeConfigurationWidget = new AuditConfigurationWidget();
21 
22     d->itemBuilder = new AuditItemBuilder();
23 
24     d->action = createDefaultAction();
25     d->action->setText(i18n("Audit Log"));
26     d->action->setToolTip(i18n("Display the audit log."));
27     d->action->setWhatsThis(
28         i18n("Displays the audit log in the current tab. This log is generally used by non-specialized processes "
29              "(like \"sudo\" or \"fsck\" commands)"));
30 
31     checkLogFilesPresence(logModeConfiguration<AuditConfiguration *>()->logFilesPaths());
32 }
33 
createAnalyzer(const QVariant & options)34 Analyzer *AuditLogMode::createAnalyzer(const QVariant &options)
35 {
36     Q_UNUSED(options)
37     return new AuditAnalyzer(this);
38 }
39 
createLogFiles()40 QVector<LogFile> AuditLogMode::createLogFiles()
41 {
42     return logModeConfiguration<AuditConfiguration *>()->findGenericLogFiles();
43 }
44