diff options
Diffstat (limited to 'ksystemlog/src/system')
-rw-r--r-- | ksystemlog/src/system/Makefile.am | 7 | ||||
-rw-r--r-- | ksystemlog/src/system/systemOptions.cpp | 102 | ||||
-rw-r--r-- | ksystemlog/src/system/systemOptions.h | 63 | ||||
-rw-r--r-- | ksystemlog/src/system/systemReader.cpp | 51 | ||||
-rw-r--r-- | ksystemlog/src/system/systemReader.h | 53 |
5 files changed, 276 insertions, 0 deletions
diff --git a/ksystemlog/src/system/Makefile.am b/ksystemlog/src/system/Makefile.am new file mode 100644 index 0000000..bd7cf60 --- /dev/null +++ b/ksystemlog/src/system/Makefile.am @@ -0,0 +1,7 @@ +INCLUDES = -I$(top_srcdir)/ksystemlog/src -I$(top_builddir)/ksystemlog/src/config $(all_includes) +METASOURCES = AUTO + +noinst_LTLIBRARIES = libksystemlog_system.la +libksystemlog_system_la_LDFLAGS = $(all_libraries) +libksystemlog_system_la_SOURCES = systemOptions.cpp systemReader.cpp +noinst_HEADERS = systemOptions.h systemReader.h diff --git a/ksystemlog/src/system/systemOptions.cpp b/ksystemlog/src/system/systemOptions.cpp new file mode 100644 index 0000000..7d63856 --- /dev/null +++ b/ksystemlog/src/system/systemOptions.cpp @@ -0,0 +1,102 @@ +/*************************************************************************** + * Copyright (C) 2005 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. * + ***************************************************************************/ + +//Qt includes +#include <qlayout.h> +#include <qvgroupbox.h> +#include <qbuttongroup.h> +#include <qlabel.h> +#include <qpushbutton.h> +#include <qvbox.h> +#include <qhbox.h> + +//KDE includes +#include <klocale.h> +#include <kactioncollection.h> +#include <kbuttonbox.h> +#include <klistbox.h> +#include <kfiledialog.h> +#include <kurl.h> +#include <kmessagebox.h> +#include <kiconloader.h> +#include <kdebug.h> + +//Project includes +#include "systemOptions.h" +#include "ksystemlogConfig.h" + +SystemOptions::SystemOptions(QWidget *parent) : + QWidget(parent) + { + + QVBoxLayout* layout = new QVBoxLayout(this); + //layout->setAutoAdd(true); + + QString description= i18n("<qt><p>These files will be analyzed to display <b>System logs</b>. This list also determines the order in which the files are read.</p></qt>"); + fileList=new SpecificFileList(this, description); + + connect(fileList, SIGNAL(fileListChanged(int)), this, SLOT(slotFileListChanged(int))); + + layout->addWidget(fileList); + + readConfig(); + + +} + +SystemOptions::~SystemOptions() { + +} + +bool SystemOptions::isValid() { + if (fileList->count()>0) + return(true); + else + return(false); +} + +void SystemOptions::slotFileListChanged(int itemLeft) { + if (itemLeft==0) + emit optionsChanged(false); + else + emit optionsChanged(true); +} + +void SystemOptions::saveConfig() { + kdDebug() << "Saving config from System Options..." << endl; + + QStringList stringList; + QValueList<int> valueList; + + fileList->saveConfig(stringList, valueList); + + KSystemLogConfig::setSystemPaths(stringList); + KSystemLogConfig::setSystemLevels(valueList); +} + +void SystemOptions::readConfig() { + QStringList stringList=KSystemLogConfig::systemPaths(); + QValueList<int> valueList=KSystemLogConfig::systemLevels(); + + fileList->readConfig(stringList, valueList); +} + + +#include "systemOptions.moc" diff --git a/ksystemlog/src/system/systemOptions.h b/ksystemlog/src/system/systemOptions.h new file mode 100644 index 0000000..5a29c0c --- /dev/null +++ b/ksystemlog/src/system/systemOptions.h @@ -0,0 +1,63 @@ +/*************************************************************************** + * Copyright (C) 2005 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 _SYSTEM_OPTIONS_H_ +#define _SYSTEM_OPTIONS_H_ + +#include <qframe.h> +#include <qspinbox.h> + +#include <qcheckbox.h> +#include <kpopupmenu.h> +#include <kconfig.h> +#include <kdialogbase.h> +#include <kurlrequester.h> +#include <kurl.h> +#include <kaction.h> + +#include "globals.h" +#include "specificFileList.h" + +#include "logLevel.h" + + +class SystemOptions : public QWidget { + Q_OBJECT + public: + SystemOptions(QWidget *parent = 0); + ~SystemOptions(); + + bool isValid(); + public slots: + void saveConfig(); + void readConfig(); + + void slotFileListChanged(int itemLeft); + + signals: + void optionsChanged(bool valid); + + private: + + SpecificFileList* fileList; + +}; + +#endif diff --git a/ksystemlog/src/system/systemReader.cpp b/ksystemlog/src/system/systemReader.cpp new file mode 100644 index 0000000..65b44be --- /dev/null +++ b/ksystemlog/src/system/systemReader.cpp @@ -0,0 +1,51 @@ +/*************************************************************************** + * Copyright (C) 2005 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 "systemReader.h" + +#include <klocale.h> +#include <kmessagebox.h> + +SystemReader::SystemReader(QObject *parent, const char *name) : + DefaultReader(parent, name) + { +} + + +SystemReader::~SystemReader() { + +} + + +void SystemReader::initColumns(LogViewColumns* columns) { + columns->append(new LogViewColumn(i18n("Date"), true, false)); + columns->append(new LogViewColumn(i18n("Host Name"), true, true)); + columns->append(new LogViewColumn(i18n("Process"), true, true)); + columns->append(new LogViewColumn(i18n("Message"), true, false)); + +} + +LogLine* SystemReader::parseMessage(QString& logLine, LogFile* logFile) { + //For the moment this method is correct + return(DefaultReader::parseMessage(logLine, logFile)); +} + + +#include "systemReader.moc" diff --git a/ksystemlog/src/system/systemReader.h b/ksystemlog/src/system/systemReader.h new file mode 100644 index 0000000..6449c25 --- /dev/null +++ b/ksystemlog/src/system/systemReader.h @@ -0,0 +1,53 @@ +/*************************************************************************** + * Copyright (C) 2005 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 _SYSTEM_READER_H_ +#define _SYSTEM_READER_H_ + +#include <qobject.h> +#include <qstringlist.h> +#include <kurl.h> +#include <qfile.h> + +#include "view.h" +#include "globals.h" + +#include "defaultReader.h" + + +/** + * @author Nicolas Ternisien + */ +class SystemReader : public DefaultReader { + Q_OBJECT + + public: + SystemReader(QObject *parent = 0, const char *name = 0); + + virtual ~SystemReader(); + + virtual void initColumns(LogViewColumns* columns); + + protected: + + virtual LogLine* parseMessage(QString& logLine, LogFile* logFile); + +}; + +#endif |