diff --git a/src/modes/apache/apacheAccessLogMode.cpp b/src/modes/apache/apacheAccessLogMode.cpp index d5fb605..75d476f 100644 --- a/src/modes/apache/apacheAccessLogMode.cpp +++ b/src/modes/apache/apacheAccessLogMode.cpp @@ -1,70 +1,71 @@ /*************************************************************************** * KSystemLog, a system log viewer tool * * Copyright (C) 2007 by Nicolas Ternisien * * nicolas.ternisien@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "apacheAccessLogMode.h" #include +#include #include #include "logging.h" #include "logMode.h" #include "apacheAccessAnalyzer.h" #include "apacheAccessItemBuilder.h" #include "apacheConfigurationWidget.h" #include "apacheConfiguration.h" ApacheAccessLogMode::ApacheAccessLogMode(QSharedPointer &apacheConfiguration, ApacheConfigurationWidget *apacheConfigurationWidget) : LogMode(QStringLiteral(APACHE_ACCESS_LOG_MODE_ID), i18n("Apache Access Log"), QStringLiteral(APACHE_ACCESS_MODE_ICON)) { d->logModeConfiguration = apacheConfiguration; d->logModeConfigurationWidget = apacheConfigurationWidget; d->itemBuilder = new ApacheAccessItemBuilder(); // Apache Log Action d->action = createDefaultAction(); d->action->setToolTip(i18n("Display the Apache Access log.")); d->action->setWhatsThis(i18n( "Displays the Apache Access log in the current tab. Apache is the main used Web server in the world. " "This log saves all requests performed by the Apache web server.")); checkLogFilesPresence(apacheConfiguration->apacheAccessPaths()); } ApacheAccessLogMode::~ApacheAccessLogMode() { } Analyzer *ApacheAccessLogMode::createAnalyzer(const QVariant &options) { Q_UNUSED(options) return new ApacheAccessAnalyzer(this); } QList ApacheAccessLogMode::createLogFiles() { ApacheConfiguration *apacheConfiguration = logModeConfiguration(); return apacheConfiguration->findNoModeLogFiles(apacheConfiguration->apacheAccessPaths()); } diff --git a/src/modes/apache/apacheLogMode.cpp b/src/modes/apache/apacheLogMode.cpp index d0d68e9..a634ec8 100644 --- a/src/modes/apache/apacheLogMode.cpp +++ b/src/modes/apache/apacheLogMode.cpp @@ -1,68 +1,69 @@ /*************************************************************************** * KSystemLog, a system log viewer tool * * Copyright (C) 2007 by Nicolas Ternisien * * nicolas.ternisien@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "apacheLogMode.h" #include +#include #include #include "logging.h" #include "logMode.h" #include "apacheAnalyzer.h" #include "apacheItemBuilder.h" #include "apacheConfigurationWidget.h" #include "apacheConfiguration.h" ApacheLogMode::ApacheLogMode(QSharedPointer &apacheConfiguration, ApacheConfigurationWidget *apacheConfigurationWidget) : LogMode(QStringLiteral(APACHE_LOG_MODE_ID), i18n("Apache Log"), QStringLiteral(APACHE_MODE_ICON)) { d->logModeConfiguration = apacheConfiguration; d->logModeConfigurationWidget = apacheConfigurationWidget; d->itemBuilder = new ApacheItemBuilder(); // Apache Log Action d->action = createDefaultAction(); d->action->setToolTip(i18n("Display the Apache log.")); d->action->setWhatsThis( i18n("Displays the Apache log in the current tab. Apache is the main used Web server in the world.")); checkLogFilesPresence(apacheConfiguration->apachePaths()); } ApacheLogMode::~ApacheLogMode() { } Analyzer *ApacheLogMode::createAnalyzer(const QVariant &options) { Q_UNUSED(options) return new ApacheAnalyzer(this); } QList ApacheLogMode::createLogFiles() { ApacheConfiguration *apacheConfiguration = logModeConfiguration(); return apacheConfiguration->findNoModeLogFiles(apacheConfiguration->apachePaths()); } diff --git a/src/modes/base/multipleFileList.cpp b/src/modes/base/multipleFileList.cpp index ffaa9b4..ab705cd 100644 --- a/src/modes/base/multipleFileList.cpp +++ b/src/modes/base/multipleFileList.cpp @@ -1,469 +1,470 @@ /*************************************************************************** * KSystemLog, a system log viewer tool * * Copyright (C) 2007 by Nicolas Ternisien * * nicolas.ternisien@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "multipleFileList.h" #include #include #include +#include #include #include #include #include #include #include #include "defaults.h" #include "logging.h" MultipleFileList::MultipleFileList(QWidget *parent, const QString &descriptionText) : QWidget(parent) , fileListHelper(this) { logDebug() << "Initializing multiple file list..."; setupUi(this); missingFiles = false; warningBox = new KMessageWidget(this); warningBox->setVisible(false); warningBox->setMessageType(KMessageWidget::Warning); warningBox->setText(i18n("Some log files do not exist.\n" "Modes with missing log files will be unavailable.")); warningBox->setCloseButtonVisible(false); warningBox->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning"))); vboxLayout->insertWidget(1, warningBox); description->setText(descriptionText); fileListHelper.prepareButton(modify, QIcon::fromTheme(QStringLiteral("document-open")), this, SLOT(modifyItem()), fileList); fileList->header()->setVisible(false); // Add a separator in the MultipleFileList QAction *separator = new QAction(this); separator->setSeparator(true); fileList->addAction(separator); fileListHelper.prepareButton(remove, QIcon::fromTheme(QStringLiteral("list-remove")), this, SLOT(removeSelectedItem()), fileList); fileListHelper.prepareButton(up, QIcon::fromTheme(QStringLiteral("go-up")), this, SLOT(moveUpItem()), fileList); fileListHelper.prepareButton(down, QIcon::fromTheme(QStringLiteral("go-down")), this, SLOT(moveDownItem()), fileList); fileListHelper.prepareButton(removeAll, QIcon::fromTheme(QStringLiteral("trash-empty")), this, SLOT(removeAllItems()), fileList); connect(fileList, &QTreeWidget::itemSelectionChanged, this, &MultipleFileList::updateButtons); connect(fileList, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(modifyItem(QTreeWidgetItem *))); connect(this, &MultipleFileList::fileListChanged, this, &MultipleFileList::updateButtons); connect(&addButtons, SIGNAL(buttonClicked(int)), this, SLOT(addItem(int))); updateButtons(); logDebug() << "Multiple File list initialized"; } MultipleFileList::~MultipleFileList() { } void MultipleFileList::updateButtons() { logDebug() << "Updating buttons..."; if (isFileListsEmpty() == true) fileListHelper.setEnabledAction(removeAll, false); else fileListHelper.setEnabledAction(removeAll, true); QList selectedItems = fileList->selectedItems(); // If the selection is not empty and a empty item is not selected QTreeWidgetItem *categoryItem = NULL; if (selectedItems.isEmpty() == false && isEmptyItem(selectedItems.at(0)) == false) { categoryItem = findCategoryOfChild(selectedItems.at(0)); } if (categoryItem != NULL) { int categoryIndex = fileList->indexOfTopLevelItem(categoryItem); fileListHelper.setEnabledAction(remove, true); fileListHelper.setEnabledAction(modify, true); QTreeWidgetItem *selectedItem = selectedItems.at(0); // If the item is at the top of the list, it could not be upped anymore if (categoryItem->indexOfChild(selectedItem) == 0) fileListHelper.setEnabledAction(up, false); else fileListHelper.setEnabledAction(up, true); // If the item is at bottom of the list, it could not be downed anymore if (categoryItem->indexOfChild(selectedItem) == categoryCount(categoryIndex) - 1) fileListHelper.setEnabledAction(down, false); else fileListHelper.setEnabledAction(down, true); } // If nothing is selected, disabled special buttons else { fileListHelper.setEnabledAction(remove, false); fileListHelper.setEnabledAction(modify, false); fileListHelper.setEnabledAction(up, false); fileListHelper.setEnabledAction(down, false); } logDebug() << "Buttons updated"; } bool MultipleFileList::isFileListsEmpty() const { for (int i = 0; i < fileList->topLevelItemCount(); ++i) { if (categoryCount(i) != 0) { logDebug() << "Is not empty"; return false; } } logDebug() << "Is empty"; return true; } bool MultipleFileList::isOneOfCategoryEmpty() const { for (int i = 0; i < fileList->topLevelItemCount(); ++i) { if (categoryCount(i) == 0) { logDebug() << "A category is empty"; return true; } } logDebug() << "No category is empty"; return false; } int MultipleFileList::categoryCount(int index) const { QTreeWidgetItem *item = fileList->topLevelItem(index); if (item == NULL) { logCritical() << "Index out of range" << index; return 0; } int count = 0; for (int i = 0; i < item->childCount(); ++i) { QTreeWidgetItem *childItem = item->child(i); if (isEmptyItem(childItem) == false) count++; } return count; } int MultipleFileList::addCategory(const QString &itemName, const QString &buttonName) { QTreeWidgetItem *item = new QTreeWidgetItem(fileList, QStringList(itemName)); item->setExpanded(true); QFont font = item->font(0); font.setBold(true); item->setFont(0, font); int index = fileList->indexOfTopLevelItem(item); QPushButton *addButton = new QPushButton(buttonName, this); QAction *action = fileListHelper.prepareButtonAndAction(addButton, QIcon::fromTheme(QStringLiteral("document-new"))); // Insert the action in first position fileList->insertAction(fileList->actions().at(addButtons.buttons().size()), action); addButtons.addButton(addButton, index); vboxLayout1->insertWidget(index, addButton); updateEmptyItems(); updateButtons(); return index; } void MultipleFileList::addItem(int category) { logDebug() << "Adding item" << category; // Open a standard Filedialog QList urls = fileListHelper.openUrls(); QTreeWidgetItem *categoryItem = fileList->topLevelItem(category); QStringList paths = fileListHelper.findPaths(urls); foreach (const QString &path, paths) { addItemInternal(categoryItem, path); } updateEmptyItems(); emit fileListChanged(); } void MultipleFileList::addItemInternal(QTreeWidgetItem *categoryItem, const QString &path) { logDebug() << "Adding" << path << "to" << categoryItem->text(0); QTreeWidgetItem *item = new QTreeWidgetItem(QStringList(path)); QFileInfo checkFile(path); if (!checkFile.exists()) { missingFiles = true; item->setForeground(0, Qt::red); } categoryItem->addChild(item); categoryItem->setExpanded(true); } QTreeWidgetItem *MultipleFileList::findCategoryOfChild(QTreeWidgetItem *childItem) { logDebug() << "Finding Category of" << childItem->text(0); for (int i = 0; i < fileList->topLevelItemCount(); ++i) { QTreeWidgetItem *item = fileList->topLevelItem(i); if (item->indexOfChild(childItem) != -1) { logDebug() << "Category of" << childItem->text(0) << "is" << item->text(0); return item; } } logDebug() << "No Category of" << childItem->text(0); return NULL; } void MultipleFileList::modifyItem() { QList selectedItems = fileList->selectedItems(); modifyItem(selectedItems.at(0)); } void MultipleFileList::modifyItem(QTreeWidgetItem *item) { // If the user tries to modify a category item, we do nothing if (findCategoryOfChild(item) == NULL || isEmptyItem(item) == true) return; QString previousPath = item->text(0); // Open a standard Filedialog QUrl url = fileListHelper.openUrl(previousPath); if (url.isEmpty()) return; QList urls; urls.append(url); QStringList paths = fileListHelper.findPaths(urls); // We only take the first path if (paths.count() >= 1) { item->setText(0, paths.at(0)); } emit fileListChanged(); } void MultipleFileList::removeSelectedItem() { QList selectedItems = fileList->selectedItems(); foreach (QTreeWidgetItem *item, selectedItems) { QTreeWidgetItem *categoryItem = findCategoryOfChild(item); delete categoryItem->takeChild(categoryItem->indexOfChild(item)); } updateEmptyItems(); emit fileListChanged(); } void MultipleFileList::moveItem(int direction) { QList selectedItems = fileList->selectedItems(); QTreeWidgetItem *item = selectedItems.at(0); QTreeWidgetItem *categoryItem = findCategoryOfChild(item); int itemIndex = categoryItem->indexOfChild(item); categoryItem->takeChild(itemIndex); unselectAllItems(); categoryItem->insertChild(itemIndex + direction, item); fileList->setCurrentItem(item); // item->setSelected(true); emit fileListChanged(); } void MultipleFileList::moveUpItem() { moveItem(-1); } void MultipleFileList::moveDownItem() { moveItem(1); } void MultipleFileList::removeAllItems() { QTreeWidgetItemIterator it(fileList, QTreeWidgetItemIterator::All); while (*it != NULL) { QTreeWidgetItem *item = *it; QList children = item->takeChildren(); foreach (QTreeWidgetItem *childItem, children) { delete childItem; } ++it; } updateEmptyItems(); emit fileListChanged(); } void MultipleFileList::unselectAllItems() { QList selectedItems = fileList->selectedItems(); foreach (QTreeWidgetItem *item, selectedItems) { item->setSelected(false); } } void MultipleFileList::updateEmptyItems() { logDebug() << "Updating empty items..."; logDebug() << "Adding empty items..."; for (int i = 0; i < fileList->topLevelItemCount(); ++i) { QTreeWidgetItem *categoryItem = fileList->topLevelItem(i); // If it's a category item and it's empty if (categoryItem->childCount() == 0) { addEmptyItem(categoryItem); } } removeEmptyItems(); logDebug() << "Empty items updated"; } void MultipleFileList::removeEmptyItems() { logDebug() << "Removing empty items..."; // Remove empty items of lists for (int categoryIndex = 0; categoryIndex < fileList->topLevelItemCount(); ++categoryIndex) { QTreeWidgetItem *categoryItem = fileList->topLevelItem(categoryIndex); logDebug() << "Removing empty items of " << categoryItem->text(0); for (int i = 0; i < categoryItem->childCount(); ++i) { QTreeWidgetItem *childItem = categoryItem->child(i); if (isEmptyItem(childItem) == true && categoryItem->childCount() > 1) { logDebug() << "Remove a child item"; delete categoryItem->takeChild(i); break; } } logDebug() << "Empty items of " << categoryItem->text(0) << "removed"; } } bool MultipleFileList::isEmptyItem(QTreeWidgetItem *item) const { if (item->font(0).italic() == true) return true; else return false; } void MultipleFileList::addEmptyItem(QTreeWidgetItem *item) { logDebug() << "Adding an empty item..."; QTreeWidgetItem *emptyItem = new QTreeWidgetItem(item, QStringList(i18n("No log file..."))); item->setExpanded(true); QFont font = emptyItem->font(0); font.setItalic(true); emptyItem->setFont(0, font); } void MultipleFileList::addPaths(int category, const QStringList &paths) { missingFiles = false; QTreeWidgetItem *categoryItem = fileList->topLevelItem(category); foreach (const QString &path, paths) { addItemInternal(categoryItem, path); } updateEmptyItems(); updateButtons(); warningBox->setVisible(missingFiles); } QStringList MultipleFileList::paths(int category) { QTreeWidgetItem *categoryItem = fileList->topLevelItem(category); QTreeWidgetItemIterator it(fileList, QTreeWidgetItemIterator::All); QStringList paths; while (*it != NULL) { QTreeWidgetItem *item = *it; if (categoryItem->indexOfChild(item) != -1) { paths.append(item->text(0)); } ++it; } return paths; } diff --git a/src/modes/base/multipleFileList.h b/src/modes/base/multipleFileList.h index 6ace503..648df8d 100644 --- a/src/modes/base/multipleFileList.h +++ b/src/modes/base/multipleFileList.h @@ -1,94 +1,95 @@ /*************************************************************************** * KSystemLog, a system log viewer tool * * Copyright (C) 2007 by Nicolas Ternisien * * nicolas.ternisien@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef _MULTIPLE_FILE_LIST_H_ #define _MULTIPLE_FILE_LIST_H_ #include +#include #include #include "fileListHelper.h" #include "ui_multipleFileListBase.h" class MultipleFileList : public QWidget, public Ui::MultipleFileListBase { Q_OBJECT public: MultipleFileList(QWidget *parent, const QString &descriptionText); virtual ~MultipleFileList(); bool isOneOfCategoryEmpty() const; QStringList paths(int categoryIndex); void addPaths(int categoryIndex, const QStringList &paths); int addCategory(const QString &itemName, const QString &buttonName); public slots: void removeAllItems(); signals: void fileListChanged(); private slots: void updateButtons(); void removeSelectedItem(); void moveUpItem(); void moveDownItem(); protected slots: virtual void addItem(int category); void modifyItem(); void modifyItem(QTreeWidgetItem *item); protected: void addItemInternal(QTreeWidgetItem *categoryItem, const QString &path); void moveItem(int direction); void unselectAllItems(); void updateEmptyItems(); void removeEmptyItems(); void addEmptyItem(QTreeWidgetItem *item); bool isEmptyItem(QTreeWidgetItem *item) const; bool isFileListsEmpty() const; int categoryCount(int index) const; QTreeWidgetItem *findCategoryOfChild(QTreeWidgetItem *childItem); FileListHelper fileListHelper; QButtonGroup addButtons; private: KMessageWidget *warningBox; bool missingFiles; }; #endif //_MULTIPLE_FILE_LIST_H_ diff --git a/src/modes/cups/cupsAccessLogMode.cpp b/src/modes/cups/cupsAccessLogMode.cpp index f39b064..4d55876 100644 --- a/src/modes/cups/cupsAccessLogMode.cpp +++ b/src/modes/cups/cupsAccessLogMode.cpp @@ -1,71 +1,72 @@ /*************************************************************************** * KSystemLog, a system log viewer tool * * Copyright (C) 2007 by Nicolas Ternisien * * nicolas.ternisien@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "cupsAccessLogMode.h" #include +#include #include #include "logging.h" #include "logMode.h" #include "cupsAccessAnalyzer.h" #include "cupsAccessItemBuilder.h" #include "cupsConfigurationWidget.h" #include "cupsConfiguration.h" CupsAccessLogMode::CupsAccessLogMode(QSharedPointer &cupsConfiguration, CupsConfigurationWidget *cupsConfigurationWidget) : LogMode(QStringLiteral(CUPS_ACCESS_LOG_MODE_ID), i18n("Cups Web Log"), QStringLiteral(CUPS_ACCESS_MODE_ICON)) { d->logModeConfiguration = cupsConfiguration; d->logModeConfigurationWidget = cupsConfigurationWidget; d->itemBuilder = new CupsAccessItemBuilder(); // Cups Log Action d->action = createDefaultAction(); d->action->setToolTip(i18n("Display the CUPS Web Server Access log.")); d->action->setWhatsThis(i18n( "Displays the CUPS Web Server Access log in the current tab. CUPS is the program which manages " "printing on your computer. This log saves all requests performed to the CUPS embedded web server " "(default: http://localhost:631).")); checkLogFilesPresence(cupsConfiguration->cupsAccessPaths()); } CupsAccessLogMode::~CupsAccessLogMode() { } Analyzer *CupsAccessLogMode::createAnalyzer(const QVariant &options) { Q_UNUSED(options) return new CupsAccessAnalyzer(this); } QList CupsAccessLogMode::createLogFiles() { CupsConfiguration *cupsConfiguration = logModeConfiguration(); return cupsConfiguration->findNoModeLogFiles(cupsConfiguration->cupsAccessPaths()); } diff --git a/src/modes/cups/cupsLogMode.cpp b/src/modes/cups/cupsLogMode.cpp index 921b50a..7d3e04c 100644 --- a/src/modes/cups/cupsLogMode.cpp +++ b/src/modes/cups/cupsLogMode.cpp @@ -1,69 +1,70 @@ /*************************************************************************** * KSystemLog, a system log viewer tool * * Copyright (C) 2007 by Nicolas Ternisien * * nicolas.ternisien@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "cupsLogMode.h" #include +#include #include #include "logging.h" #include "logMode.h" #include "cupsAnalyzer.h" #include "cupsItemBuilder.h" #include "cupsConfigurationWidget.h" #include "cupsConfiguration.h" CupsLogMode::CupsLogMode(QSharedPointer &cupsConfiguration, CupsConfigurationWidget *cupsConfigurationWidget) : LogMode(QStringLiteral(CUPS_LOG_MODE_ID), i18n("Cups Log"), QStringLiteral(CUPS_MODE_ICON)) { d->logModeConfiguration = cupsConfiguration; d->logModeConfigurationWidget = cupsConfigurationWidget; d->itemBuilder = new CupsItemBuilder(); // Cups Log Action d->action = createDefaultAction(); d->action->setToolTip(i18n("Display the Cups log.")); d->action->setWhatsThis(i18n( "Displays the CUPS log in the current tab. CUPS is the program which manages printing on your " "computer.")); checkLogFilesPresence(cupsConfiguration->cupsPaths()); } CupsLogMode::~CupsLogMode() { } Analyzer *CupsLogMode::createAnalyzer(const QVariant &options) { Q_UNUSED(options) return new CupsAnalyzer(this); } QList CupsLogMode::createLogFiles() { CupsConfiguration *cupsConfiguration = logModeConfiguration(); return cupsConfiguration->findNoModeLogFiles(cupsConfiguration->cupsPaths()); } diff --git a/src/modes/cups/cupsPageLogMode.cpp b/src/modes/cups/cupsPageLogMode.cpp index 0cf50c2..1931b61 100644 --- a/src/modes/cups/cupsPageLogMode.cpp +++ b/src/modes/cups/cupsPageLogMode.cpp @@ -1,70 +1,71 @@ /*************************************************************************** * KSystemLog, a system log viewer tool * * Copyright (C) 2007 by Nicolas Ternisien * * nicolas.ternisien@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "cupsPageLogMode.h" #include +#include #include #include "logging.h" #include "logMode.h" #include "cupsPageAnalyzer.h" #include "cupsPageItemBuilder.h" #include "cupsConfigurationWidget.h" #include "cupsConfiguration.h" CupsPageLogMode::CupsPageLogMode(QSharedPointer &cupsConfiguration, CupsConfigurationWidget *cupsConfigurationWidget) : LogMode(QStringLiteral(CUPS_PAGE_LOG_MODE_ID), i18n("Cups Page Log"), QStringLiteral(CUPS_PAGE_MODE_ICON)) { d->logModeConfiguration = cupsConfiguration; d->logModeConfigurationWidget = cupsConfigurationWidget; d->itemBuilder = new CupsPageItemBuilder(); // Cups Log Action d->action = createDefaultAction(); d->action->setToolTip(i18n("Display the CUPS Page log.")); d->action->setWhatsThis(i18n( "Displays the CUPS Page log in the current tab. CUPS is the program which manages printing on your " "computer. This log saves all requests performed to the CUPS embedded web server (default: " "http://localhost:631).")); checkLogFilesPresence(cupsConfiguration->cupsPagePaths()); } CupsPageLogMode::~CupsPageLogMode() { } Analyzer *CupsPageLogMode::createAnalyzer(const QVariant &options) { Q_UNUSED(options) return new CupsPageAnalyzer(this); } QList CupsPageLogMode::createLogFiles() { CupsConfiguration *cupsConfiguration = logModeConfiguration(); return cupsConfiguration->findNoModeLogFiles(cupsConfiguration->cupsPagePaths()); } diff --git a/src/modes/cups/cupsPdfLogMode.cpp b/src/modes/cups/cupsPdfLogMode.cpp index f9a0726..40dcd32 100644 --- a/src/modes/cups/cupsPdfLogMode.cpp +++ b/src/modes/cups/cupsPdfLogMode.cpp @@ -1,70 +1,71 @@ /*************************************************************************** * KSystemLog, a system log viewer tool * * Copyright (C) 2007 by Nicolas Ternisien * * nicolas.ternisien@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "cupsPdfLogMode.h" #include +#include #include #include "logging.h" #include "logMode.h" #include "cupsPdfAnalyzer.h" #include "cupsPdfItemBuilder.h" #include "cupsConfigurationWidget.h" #include "cupsConfiguration.h" CupsPdfLogMode::CupsPdfLogMode(QSharedPointer &cupsConfiguration, CupsConfigurationWidget *cupsConfigurationWidget) : LogMode(QStringLiteral(CUPS_PDF_LOG_MODE_ID), i18n("Cups PDF Log"), QStringLiteral(CUPS_PDF_MODE_ICON)) { d->logModeConfiguration = cupsConfiguration; d->logModeConfigurationWidget = cupsConfigurationWidget; d->itemBuilder = new CupsPdfItemBuilder(); // Cups Log Action d->action = createDefaultAction(); d->action->setToolTip(i18n("Display the CUPS PDF log.")); d->action->setWhatsThis(i18n( "Displays the CUPS PDF log in the current tab. CUPS is the program which manages printing on your " "computer. This log saves all requests performed to the CUPS embedded web server (default: " "http://localhost:631).")); checkLogFilesPresence(cupsConfiguration->cupsPdfPaths()); } CupsPdfLogMode::~CupsPdfLogMode() { } Analyzer *CupsPdfLogMode::createAnalyzer(const QVariant &options) { Q_UNUSED(options) return new CupsPdfAnalyzer(this); } QList CupsPdfLogMode::createLogFiles() { CupsConfiguration *cupsConfiguration = logModeConfiguration(); return cupsConfiguration->findNoModeLogFiles(cupsConfiguration->cupsPdfPaths()); } diff --git a/src/modes/journald/journaldLogMode.cpp b/src/modes/journald/journaldLogMode.cpp index dfbdead..6a982ba 100644 --- a/src/modes/journald/journaldLogMode.cpp +++ b/src/modes/journald/journaldLogMode.cpp @@ -1,86 +1,88 @@ /*************************************************************************** * KSystemLog, a system log viewer tool * * Copyright (C) 2007 by Nicolas Ternisien * * nicolas.ternisien@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "journaldLogMode.h" +#include + #include #include "logging.h" #include "logMode.h" #include "journaldLocalAnalyzer.h" #include "journaldNetworkAnalyzer.h" #include "journaldConfigurationWidget.h" #include "journaldConfiguration.h" #include "journaldItemBuilder.h" JournaldLogMode::JournaldLogMode() : LogMode(QLatin1String(JOURNALD_LOG_MODE_ID), i18n("Journald Log"), QLatin1String(JOURNALD_MODE_ICON)) { d->logModeConfiguration = QSharedPointer(new JournaldConfiguration()); d->logModeConfigurationWidget = new JournaldConfigurationWidget(); connect(qobject_cast(d->logModeConfigurationWidget), &JournaldConfigurationWidget::configSaved, this, &JournaldLogMode::menuChanged); d->itemBuilder = new JournaldItemBuilder(); d->action = createDefaultAction(); d->action->setToolTip(i18n("Display the Journald log.")); d->action->setWhatsThis(i18n("Displays the journald log in the current tab.")); } JournaldLogMode::~JournaldLogMode() { } Analyzer *JournaldLogMode::createAnalyzer(const QVariant &analyzerOptions) { JournaldAnalyzerOptions options = analyzerOptions.value(); switch (options.analyzerType) { case JournaldAnalyzerType::Local: return new JournaldLocalAnalyzer(this, options.filter); break; case JournaldAnalyzerType::Network: return new JournaldNetworkAnalyzer(this, options); break; default: break; } return new JournaldLocalAnalyzer(this); } QList JournaldLogMode::createLogFiles() { // No log file for journald. return QList(); } void JournaldLogMode::updateJournalFilters(const JournalAddress &address, const JournalFilters &filters) { m_remoteJournalFilters[address] = filters; } JournalFilters JournaldLogMode::filters(const JournalAddress &address) const { return m_remoteJournalFilters[address]; } diff --git a/src/modes/samba/netbiosLogMode.cpp b/src/modes/samba/netbiosLogMode.cpp index bb86c14..35ce7a7 100644 --- a/src/modes/samba/netbiosLogMode.cpp +++ b/src/modes/samba/netbiosLogMode.cpp @@ -1,69 +1,70 @@ /*************************************************************************** * KSystemLog, a system log viewer tool * * Copyright (C) 2007 by Nicolas Ternisien * * nicolas.ternisien@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "netbiosLogMode.h" #include +#include #include #include "logging.h" #include "logMode.h" #include "sambaAnalyzer.h" #include "sambaItemBuilder.h" #include "sambaConfigurationWidget.h" #include "sambaConfiguration.h" NetbiosLogMode::NetbiosLogMode(QSharedPointer &sambaConfiguration, SambaConfigurationWidget *sambaConfigurationWidget, SambaItemBuilder *itemBuilder) : LogMode(QStringLiteral(NETBIOS_LOG_MODE_ID), i18n("Netbios Log"), QStringLiteral(NETBIOS_MODE_ICON)) { d->logModeConfiguration = sambaConfiguration; d->logModeConfigurationWidget = sambaConfigurationWidget; d->itemBuilder = itemBuilder; // Netbios Log Action d->action = createDefaultAction(); d->action->setToolTip(i18n("Display the Netbios log.")); d->action->setWhatsThis( i18n("Displays the Netbios log in the current tab. Netbios is the file sharing protocol developed by " "Microsoft.")); checkLogFilesPresence(sambaConfiguration->netbiosPaths()); } NetbiosLogMode::~NetbiosLogMode() { } Analyzer *NetbiosLogMode::createAnalyzer(const QVariant &options) { Q_UNUSED(options) return new SambaAnalyzer(this); } QList NetbiosLogMode::createLogFiles() { SambaConfiguration *sambaConfiguration = logModeConfiguration(); return sambaConfiguration->findNoModeLogFiles(sambaConfiguration->netbiosPaths()); } diff --git a/src/modes/samba/sambaAccessLogMode.cpp b/src/modes/samba/sambaAccessLogMode.cpp index 5cb7dc9..abfbe82 100644 --- a/src/modes/samba/sambaAccessLogMode.cpp +++ b/src/modes/samba/sambaAccessLogMode.cpp @@ -1,70 +1,71 @@ /*************************************************************************** * KSystemLog, a system log viewer tool * * Copyright (C) 2007 by Nicolas Ternisien * * nicolas.ternisien@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "sambaAccessLogMode.h" #include +#include #include #include "logging.h" #include "logMode.h" #include "sambaAnalyzer.h" #include "sambaItemBuilder.h" #include "sambaConfigurationWidget.h" #include "sambaConfiguration.h" SambaAccessLogMode::SambaAccessLogMode(QSharedPointer &sambaConfiguration, SambaConfigurationWidget *sambaConfigurationWidget, SambaItemBuilder *itemBuilder) : LogMode(QStringLiteral(SAMBA_ACCESS_LOG_MODE_ID), i18n("Samba Access Log"), QStringLiteral(SAMBA_ACCESS_MODE_ICON)) { d->logModeConfiguration = sambaConfiguration; d->logModeConfigurationWidget = sambaConfigurationWidget; d->itemBuilder = itemBuilder; // Samba Log Action d->action = createDefaultAction(); d->action->setToolTip(i18n("Display the Samba Access log.")); d->action->setWhatsThis(i18n( "Displays the Samba Access log in the current tab. This log mode allows you to see connections " "between your shares and remote hosts.")); checkLogFilesPresence(sambaConfiguration->sambaAccessPaths()); } SambaAccessLogMode::~SambaAccessLogMode() { } Analyzer *SambaAccessLogMode::createAnalyzer(const QVariant &options) { Q_UNUSED(options) return new SambaAnalyzer(this); } QList SambaAccessLogMode::createLogFiles() { SambaConfiguration *sambaConfiguration = logModeConfiguration(); return sambaConfiguration->findNoModeLogFiles(sambaConfiguration->sambaAccessPaths()); } diff --git a/src/modes/samba/sambaLogMode.cpp b/src/modes/samba/sambaLogMode.cpp index 0218ba1..e8411a4 100644 --- a/src/modes/samba/sambaLogMode.cpp +++ b/src/modes/samba/sambaLogMode.cpp @@ -1,68 +1,69 @@ /*************************************************************************** * KSystemLog, a system log viewer tool * * Copyright (C) 2007 by Nicolas Ternisien * * nicolas.ternisien@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "sambaLogMode.h" #include +#include #include #include "logging.h" #include "logMode.h" #include "sambaAnalyzer.h" #include "sambaItemBuilder.h" #include "sambaConfigurationWidget.h" #include "sambaConfiguration.h" SambaLogMode::SambaLogMode(QSharedPointer &sambaConfiguration, SambaConfigurationWidget *sambaConfigurationWidget, SambaItemBuilder *itemBuilder) : LogMode(QStringLiteral(SAMBA_LOG_MODE_ID), i18n("Samba Log"), QStringLiteral(SAMBA_MODE_ICON)) { d->logModeConfiguration = sambaConfiguration; d->logModeConfigurationWidget = sambaConfigurationWidget; d->itemBuilder = itemBuilder; // Samba Log Action d->action = createDefaultAction(); d->action->setToolTip(i18n("Display the Samba log.")); d->action->setWhatsThis(i18n( "Displays the Samba log in the current tab. Samba is the file sharing server which interacts with " "Microsoft Windows network.")); checkLogFilesPresence(sambaConfiguration->sambaPaths()); } SambaLogMode::~SambaLogMode() { } Analyzer *SambaLogMode::createAnalyzer(const QVariant &options) { Q_UNUSED(options) return new SambaAnalyzer(this); } QList SambaLogMode::createLogFiles() { SambaConfiguration *sambaConfiguration = logModeConfiguration(); return sambaConfiguration->findNoModeLogFiles(sambaConfiguration->sambaPaths()); }