File indexing completed on 2024-05-19 05:49:18

0001 /*
0002     SPDX-FileCopyrightText: 2007 Nicolas Ternisien <nicolas.ternisien@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "systemLogMode.h"
0008 
0009 #include <KLocalizedString>
0010 
0011 #include "ksystemlog_debug.h"
0012 
0013 #include "systemAnalyzer.h"
0014 #include "systemConfiguration.h"
0015 #include "systemConfigurationWidget.h"
0016 
0017 #include "logModeItemBuilder.h"
0018 
0019 SystemLogMode::SystemLogMode()
0020     : LogMode(QStringLiteral(SYSTEM_LOG_MODE_ID), i18n("System Log"), QStringLiteral(SYSTEM_MODE_ICON))
0021 {
0022     d->logModeConfiguration = QSharedPointer<SystemConfiguration>(new SystemConfiguration());
0023 
0024     d->logModeConfigurationWidget = new SystemConfigurationWidget();
0025 
0026     d->itemBuilder = new LogModeItemBuilder();
0027 
0028     d->action = createDefaultAction();
0029     d->action->setToolTip(i18n("Display the system log."));
0030     d->action->setWhatsThis(
0031         i18n("Displays the system log in the current tab. This log is generally used by non-specialized processes "
0032              "(like \"sudo\" or \"fsck\" commands)"));
0033 
0034     checkLogFilesPresence(logModeConfiguration<SystemConfiguration *>()->logFilesPaths());
0035 }
0036 
0037 SystemLogMode::~SystemLogMode()
0038 {
0039 }
0040 
0041 Analyzer *SystemLogMode::createAnalyzer(const QVariant &options)
0042 {
0043     Q_UNUSED(options)
0044     return new SystemAnalyzer(this);
0045 }
0046 
0047 QVector<LogFile> SystemLogMode::createLogFiles()
0048 {
0049     return logModeConfiguration<SystemConfiguration *>()->findGenericLogFiles();
0050 }
0051 
0052 #include "moc_systemLogMode.cpp"