File indexing completed on 2024-05-12 05:48:40

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 "sambaLogMode.h"
0008 
0009 #include <QAction>
0010 
0011 #include <KLocalizedString>
0012 
0013 #include "ksystemlog_debug.h"
0014 
0015 #include "sambaAnalyzer.h"
0016 #include "sambaConfiguration.h"
0017 #include "sambaConfigurationWidget.h"
0018 #include "sambaItemBuilder.h"
0019 
0020 SambaLogMode::SambaLogMode(QSharedPointer<SambaConfiguration> &sambaConfiguration,
0021                            SambaConfigurationWidget *sambaConfigurationWidget,
0022                            SambaItemBuilder *itemBuilder)
0023     : LogMode(QStringLiteral(SAMBA_LOG_MODE_ID), i18n("Samba Log"), QStringLiteral(SAMBA_MODE_ICON))
0024 {
0025     d->logModeConfiguration = sambaConfiguration;
0026     d->logModeConfigurationWidget = sambaConfigurationWidget;
0027     d->itemBuilder = itemBuilder;
0028 
0029     // Samba Log Action
0030     d->action = createDefaultAction();
0031     d->action->setToolTip(i18n("Display the Samba log."));
0032     d->action->setWhatsThis(
0033         i18n("Displays the Samba log in the current tab. Samba is the file sharing server which interacts with "
0034              "Microsoft Windows network."));
0035 
0036     checkLogFilesPresence(sambaConfiguration->sambaPaths());
0037 }
0038 
0039 SambaLogMode::~SambaLogMode()
0040 {
0041 }
0042 
0043 Analyzer *SambaLogMode::createAnalyzer(const QVariant &options)
0044 {
0045     Q_UNUSED(options)
0046     return new SambaAnalyzer(this);
0047 }
0048 
0049 QVector<LogFile> SambaLogMode::createLogFiles()
0050 {
0051     auto *sambaConfiguration = logModeConfiguration<SambaConfiguration *>();
0052     return sambaConfiguration->findNoModeLogFiles(sambaConfiguration->sambaPaths());
0053 }
0054 
0055 #include "moc_sambaLogMode.cpp"