diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d71f912..dcbbde80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,6 @@ kde4_optional_add_subdirectory(kmix) kde4_optional_add_subdirectory(krdc) kde4_optional_add_subdirectory(krfb) kde4_optional_add_subdirectory(ksnapshot) -kde4_optional_add_subdirectory(ksystemlog) kde4_optional_add_subdirectory(ktimer) kde4_optional_add_subdirectory(kuser) kde4_optional_add_subdirectory(kvkbd) diff --git a/ksystemlog/CMakeLists.txt b/ksystemlog/CMakeLists.txt deleted file mode 100644 index 4d88c4df..00000000 --- a/ksystemlog/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -project(KSystemLog) - -if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) - include(FeatureSummary) - - find_package(KDE4 4.23.0 REQUIRED) - include(KDE4Defaults) - include_directories(${KDE4_INCLUDES}) - add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) -endif() - -include(CheckIncludeFile) -include(CheckIncludeFiles) -include(CheckSymbolExists) -include(CheckFunctionExists) -include(CheckLibraryExists) -include(CheckTypeSize) - - -if(ENABLE_TESTING) - set(CMAKE_C_VISIBILITY_PRESET "default") - set(CMAKE_CXX_VISIBILITY_PRESET "default") -endif() - -########### Subfolders ########## - -add_subdirectory(src) - -if(ENABLE_TESTING) - add_subdirectory(tests) -endif() - -if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) - feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) -endif() diff --git a/ksystemlog/COPYING b/ksystemlog/COPYING deleted file mode 100644 index 8efe11aa..00000000 --- a/ksystemlog/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - 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. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/ksystemlog/Messages.sh b/ksystemlog/Messages.sh deleted file mode 100755 index 00f2d91e..00000000 --- a/ksystemlog/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh -$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp -$XGETTEXT `find . -name "*.cpp" -o -name "*.h"` -o $podir/ksystemlog.pot -rm -f rc.cpp diff --git a/ksystemlog/src/CMakeLists.txt b/ksystemlog/src/CMakeLists.txt deleted file mode 100644 index 6449c20a..00000000 --- a/ksystemlog/src/CMakeLists.txt +++ /dev/null @@ -1,188 +0,0 @@ - -########### Build ############### - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/lib - ${CMAKE_CURRENT_BINARY_DIR}/lib - ${CMAKE_CURRENT_SOURCE_DIR} - - ${CMAKE_CURRENT_SOURCE_DIR}/modes/acpid - ${CMAKE_CURRENT_SOURCE_DIR}/modes/apache - ${CMAKE_CURRENT_SOURCE_DIR}/modes/authentication - ${CMAKE_CURRENT_SOURCE_DIR}/modes/base - ${CMAKE_CURRENT_SOURCE_DIR}/modes/cron - ${CMAKE_CURRENT_SOURCE_DIR}/modes/cups - ${CMAKE_CURRENT_SOURCE_DIR}/modes/daemon - ${CMAKE_CURRENT_SOURCE_DIR}/modes/kernel - ${CMAKE_CURRENT_SOURCE_DIR}/modes/open - ${CMAKE_CURRENT_SOURCE_DIR}/modes/postfix - ${CMAKE_CURRENT_SOURCE_DIR}/modes/samba - ${CMAKE_CURRENT_SOURCE_DIR}/modes/system - ${CMAKE_CURRENT_SOURCE_DIR}/modes/xorg - ${CMAKE_CURRENT_SOURCE_DIR}/modes/xsession -) - -set(ksystemlog_library_sources - lib/analyzer.cpp - lib/logModeFactory.cpp - lib/logModeConfiguration.cpp - lib/logModeConfigurationWidget.cpp - lib/logModeItemBuilder.cpp - lib/logManager.cpp - lib/view.cpp - lib/globals.cpp - lib/logMode.cpp - lib/logLevel.cpp - lib/logFile.cpp - lib/logFileReader.cpp - lib/localLogFileReader.cpp - lib/processOutputLogFileReader.cpp - lib/kioLogFileReader.cpp - lib/logLine.cpp - lib/logViewModel.cpp - lib/logViewColumn.cpp - lib/logViewColumns.cpp - lib/logViewWidgetItem.cpp - lib/logViewWidget.cpp - lib/logViewExport.cpp - lib/logViewFilterWidget.cpp - lib/logViewSearchWidget.cpp - lib/loadingBar.cpp - lib/logModeAction.cpp - lib/simpleAction.cpp - lib/multipleActions.cpp - lib/levelPrintPage.cpp - - modes/base/parsingHelper.cpp - modes/base/fileList.cpp - modes/base/logLevelFileList.cpp - modes/base/multipleFileList.cpp - modes/base/fileListHelper.cpp - modes/base/logLevelSelectionDialog.cpp - modes/base/genericConfiguration.cpp - modes/base/syslogAnalyzer.cpp - modes/kernel/kernelFactory.cpp - modes/kernel/kernelAnalyzer.cpp - modes/kernel/kernelLogMode.cpp - modes/kernel/kernelItemBuilder.cpp - modes/system/systemFactory.cpp - modes/system/systemConfigurationWidget.cpp - modes/system/systemConfiguration.cpp - modes/system/systemAnalyzer.cpp - modes/system/systemLogMode.cpp -) - -set(ksystemlog_sources - modes/acpid/acpidConfigurationWidget.cpp - modes/acpid/acpidConfiguration.cpp - modes/acpid/acpidAnalyzer.cpp - modes/acpid/acpidItemBuilder.cpp - modes/acpid/acpidLogMode.cpp - modes/acpid/acpidFactory.cpp - modes/apache/apacheConfiguration.cpp - modes/apache/apacheConfigurationWidget.cpp - modes/apache/apacheAnalyzer.cpp - modes/apache/apacheItemBuilder.cpp - modes/apache/apacheAccessAnalyzer.cpp - modes/apache/apacheAccessItemBuilder.cpp - modes/apache/apacheFactory.cpp - modes/apache/apacheLogMode.cpp - modes/apache/apacheAccessLogMode.cpp - modes/authentication/authenticationConfigurationWidget.cpp - modes/authentication/authenticationConfiguration.cpp - modes/authentication/authenticationAnalyzer.cpp - modes/authentication/authenticationLogMode.cpp - modes/authentication/authenticationFactory.cpp - modes/cron/cronConfigurationWidget.cpp - modes/cron/cronConfiguration.cpp - modes/cron/cronAnalyzer.cpp - modes/cron/cronItemBuilder.cpp - modes/cron/cronLogMode.cpp - modes/cron/cronFactory.cpp - modes/cups/cupsConfiguration.cpp - modes/cups/cupsConfigurationWidget.cpp - modes/cups/cupsAnalyzer.cpp - modes/cups/cupsItemBuilder.cpp - modes/cups/cupsLogMode.cpp - modes/cups/cupsAccessAnalyzer.cpp - modes/cups/cupsAccessItemBuilder.cpp - modes/cups/cupsAccessLogMode.cpp - modes/cups/cupsPageAnalyzer.cpp - modes/cups/cupsPageItemBuilder.cpp - modes/cups/cupsPageLogMode.cpp - modes/cups/cupsPdfAnalyzer.cpp - modes/cups/cupsPdfItemBuilder.cpp - modes/cups/cupsPdfLogMode.cpp - modes/cups/cupsFactory.cpp - modes/daemon/daemonConfigurationWidget.cpp - modes/daemon/daemonConfiguration.cpp - modes/daemon/daemonLogMode.cpp - modes/daemon/daemonFactory.cpp - modes/open/openAnalyzer.cpp - modes/open/openFactory.cpp - modes/open/openLogMode.cpp - modes/postfix/postfixFactory.cpp - modes/postfix/postfixConfigurationWidget.cpp - modes/postfix/postfixConfiguration.cpp - modes/postfix/postfixAnalyzer.cpp - modes/postfix/postfixLogMode.cpp - modes/samba/sambaConfiguration.cpp - modes/samba/sambaConfigurationWidget.cpp - modes/samba/sambaAnalyzer.cpp - modes/samba/sambaLogMode.cpp - modes/samba/sambaItemBuilder.cpp - modes/samba/sambaAccessLogMode.cpp - modes/samba/netbiosLogMode.cpp - modes/samba/sambaFactory.cpp - modes/xorg/xorgConfigurationWidget.cpp - modes/xorg/xorgConfiguration.cpp - modes/xorg/xorgAnalyzer.cpp - modes/xorg/xorgItemBuilder.cpp - modes/xorg/xorgLogMode.cpp - modes/xorg/xorgFactory.cpp - modes/xsession/xsessionConfigurationWidget.cpp - modes/xsession/xsessionConfiguration.cpp - modes/xsession/xsessionAnalyzer.cpp - modes/xsession/xsessionItemBuilder.cpp - modes/xsession/xsessionLogMode.cpp - modes/xsession/xsessionFactory.cpp - - main.cpp - mainWindow.cpp - logModePluginsLoader.cpp - loggerDialog.cpp - detailDialog.cpp - generalConfigurationWidget.cpp - configurationDialog.cpp - tabLogViewsWidget.cpp - tabLogManager.cpp - statusBar.cpp -) - -kde4_add_kcfg_files(ksystemlog_library_sources ksystemlogConfig.kcfgc) - -add_executable(ksystemlog ${ksystemlog_library_sources} ${ksystemlog_sources}) - -target_link_libraries(ksystemlog - ${KDE4_KIO_LIBS} - ${KDE4_KDEUI_LIBS} - ${KDE4_KFILE_LIBS} - ${KDE4_KARCHIVE_LIBS} -) - -if(ENABLE_TESTING) - add_library(ksystemlog_library SHARED ${ksystemlog_library_sources}) - target_link_libraries(ksystemlog_library PUBLIC - ${KDE4_KIO_LIBS} - ${KDE4_KDEUI_LIBS} - ${KDE4_KFILE_LIBS} - ${KDE4_KARCHIVE_LIBS} - ) -endif() - -########### Installation ############### - -install(TARGETS ksystemlog ${INSTALL_TARGETS_DEFAULT_ARGS}) - -install(PROGRAMS ksystemlog.desktop DESTINATION ${KDE4_XDG_APPS_INSTALL_DIR}) -install(FILES ksystemlogui.rc DESTINATION ${KDE4_DATA_INSTALL_DIR}/ksystemlog) diff --git a/ksystemlog/src/configurationDialog.cpp b/ksystemlog/src/configurationDialog.cpp deleted file mode 100644 index e3bf8206..00000000 --- a/ksystemlog/src/configurationDialog.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/*************************************************************************** - * 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 "configurationDialog.h" - - -#include - -#include -#include - - -#include "generalConfigurationWidget.h" - -#include "logModeConfigurationWidget.h" - -#include "mainWindow.h" - -#include "globals.h" -#include "ksystemlogConfig.h" - -#include "logging.h" -#include "defaults.h" - -class ConfigurationDialogPrivate { -public: - - GeneralConfigurationWidget* generalConfiguration; - - QList logModeConfigurations; - - bool changed; -}; - -ConfigurationDialog::ConfigurationDialog(QWidget* parent) : - KConfigDialog(parent, i18n("Settings"), KSystemLogConfig::self()), - d(new ConfigurationDialogPrivate()) - { - - d->changed = false; - - setupGeneralConfiguration(); - - setupLogModeConfigurations(); - -} - -ConfigurationDialog::~ConfigurationDialog() { - //All configuration pages are managed by KConfigDialog - delete d; -} - -void ConfigurationDialog::setupLogModeConfigurations() { - logDebug() << "Setup Log Mode Configurations..."; - - - foreach(LogMode* logMode, Globals::instance()->logModes()) { - //Some Log mode does not need a configuration widget - if (logMode->logModeConfigurationWidget() == NULL) { - continue; - } - - //The configuration widget could be shared between Log Modes - if (d->logModeConfigurations.contains(logMode->logModeConfigurationWidget()) == true) { - continue; - } - - d->logModeConfigurations.append(logMode->logModeConfigurationWidget()); - } - - - foreach (LogModeConfigurationWidget* logModeConfigurationWidget, d->logModeConfigurations ) { - logDebug() << "Adding " << logModeConfigurationWidget->itemName() << " configuration..."; - - addPage(logModeConfigurationWidget, logModeConfigurationWidget->itemName(), logModeConfigurationWidget->iconName(), logModeConfigurationWidget->header(), false); - - connect(logModeConfigurationWidget, SIGNAL(configurationChanged()), this, SLOT(updateConfiguration())); - } -} - -void ConfigurationDialog::showConfiguration() { - logDebug() << "Showing Configuration dialog..."; - - show(); -} - -void ConfigurationDialog::setupGeneralConfiguration() { - d->generalConfiguration = new GeneralConfigurationWidget(); - - addPage(d->generalConfiguration, i18n("General"), QLatin1String( KSYSTEMLOG_ICON ), i18n("General"), false); - - connect(d->generalConfiguration, SIGNAL(configurationChanged()), this, SLOT(updateConfiguration())); -} - -void ConfigurationDialog::updateSettings() { - logDebug() << "Saving configuration..."; - - d->changed = false; - - d->generalConfiguration->saveConfig(); - - foreach (LogModeConfigurationWidget* logModeConfigurationWidget, d->logModeConfigurations ) { - logModeConfigurationWidget->saveConfig(); - } - - KSystemLogConfig::self()->writeConfig(); - - emit configurationSaved(); - - logDebug() << "Configuration saved"; -} - -bool ConfigurationDialog::hasChanged() { - logDebug() << "Current change status : " << d->changed; - return d->changed; -} - -void ConfigurationDialog::updateConfiguration() { - logDebug() << "Updating configuration..."; - - bool valid = d->generalConfiguration->isValid(); - if (valid) { - foreach (LogModeConfigurationWidget* logModeConfigurationWidget, d->logModeConfigurations ) { - if (logModeConfigurationWidget->isValid() == false) { - valid = false; - break; - } - } - } - - if (valid == true) { - enableButtonOk(true); - - updateButtons(); - } - else { - enableButtonOk(false); - enableButtonApply(false); - } - -} - -void ConfigurationDialog::updateButtons() { - logDebug() << "Updating configuration buttons..."; - - d->changed = true; - -} - -void ConfigurationDialog::updateWidgets() { - logDebug() << "Reading configuration..."; - - d->generalConfiguration->readConfig(); - foreach (LogModeConfigurationWidget* logModeConfigurationWidget, d->logModeConfigurations ) { - logModeConfigurationWidget->readConfig(); - } - - d->changed = false; -} - -void ConfigurationDialog::updateWidgetsDefault() { - logDebug() << "Loading default configuration..."; - - d->generalConfiguration->defaultConfig(); - foreach (LogModeConfigurationWidget* logModeConfigurationWidget, d->logModeConfigurations ) { - logModeConfigurationWidget->defaultConfig(); - } - - d->changed = false; -} - -bool ConfigurationDialog::isDefault() { - /** - * TODO Set this to true and find a way to retrieve defaults value - * of the configuration (see defaultConfig() methods of LogModeConfigurations) - */ - - return true; -} - -#include "moc_configurationDialog.cpp" - diff --git a/ksystemlog/src/configurationDialog.h b/ksystemlog/src/configurationDialog.h deleted file mode 100644 index 807dc8e5..00000000 --- a/ksystemlog/src/configurationDialog.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * 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 _CONFIGURATION_DIALOG_H_ -#define _CONFIGURATION_DIALOG_H_ - -#include - - -class ConfigurationDialogPrivate; - -class ConfigurationDialog: public KConfigDialog { - - Q_OBJECT - - public: - ConfigurationDialog(QWidget* parent); - - ~ConfigurationDialog(); - - void showConfiguration(); - - signals: - void configurationSaved(); - - protected slots: - - void updateWidgets(); - void updateWidgetsDefault(); - void updateSettings(); - void updateButtons(); - - private slots: - void updateConfiguration(); - - private: - bool hasChanged(); - bool isDefault(); - - ConfigurationDialogPrivate* const d; - - void setupGeneralConfiguration(); - - void setupLogModeConfigurations(); -}; - -#endif //_CONFIGURATION_DIALOG_H_ diff --git a/ksystemlog/src/detailDialog.cpp b/ksystemlog/src/detailDialog.cpp deleted file mode 100644 index ced76588..00000000 --- a/ksystemlog/src/detailDialog.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/*************************************************************************** - * 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 "detailDialog.h" - -//Qt includes - -#include -#include - -#include "logViewWidget.h" -#include "logViewWidgetItem.h" -#include "logLine.h" - -#include "logging.h" - -DetailDialog::DetailDialog(QWidget* parent) : - QDialog(parent), - logViewWidget(NULL) { - - setupUi(this); - - previous->setText(i18n("&Previous")); - previous->setIcon(KIcon( QLatin1String( "arrow-up" ))); - connect(previous, SIGNAL(clicked()), this, SLOT(previousItem())); - - next->setText(i18n("&Next")); - next->setIcon(KIcon( QLatin1String( "arrow-down" ))); - connect(next, SIGNAL(clicked()), this, SLOT(nextItem())); - - closeButton->setText(KStandardGuiItem::close().text()); - closeButton->setIcon(KStandardGuiItem::close().icon()); - connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); - -} - -DetailDialog::~DetailDialog() { - -} - -void DetailDialog::selectionChanged(LogViewWidget* logViewWidget) { - this->logViewWidget=logViewWidget; - - updateDetails(); -} - -//TODO Try to find a method that reload (an resize) correctly the content of the detail dialog -void DetailDialog::updateDetails() { - //logDebug() << "Updating Detail Dialog..."; - - //Get the current-last item selected - LogViewWidgetItem* item=logViewWidget->lastSelectedItem(); - if (item==NULL) { - logDebug() << "No item found."; - return; - } - - icon->setPixmap(DesktopIcon(item->logLine()->logLevel()->icon())); - - header->setText(item->logLine()->formattedText()); - - message->setText(item->logLine()->logItems().last()); - - if (logViewWidget->topLevelItem(logViewWidget->indexOfTopLevelItem(item) - 1)==NULL) - previous->setEnabled(false); - else - previous->setEnabled(true); - - if (logViewWidget->topLevelItem(logViewWidget->indexOfTopLevelItem(item) + 1 )==NULL) - next->setEnabled(false); - else - next->setEnabled(true); - - /* - header->adjustSize(); - this->adjustSize(); - */ -} - -void DetailDialog::moveToItem(int direction) { - if (direction < 0) - logDebug() << "Go to previous item..."; - else - logDebug() << "Go to next item..."; - - //Get the current-last item selected - LogViewWidgetItem* item=logViewWidget->lastSelectedItem(); - if (item==NULL) { - logDebug() << "No item found."; - return; - } - - QTreeWidgetItem* destinationItem = logViewWidget->topLevelItem( logViewWidget->indexOfTopLevelItem(item) + direction ); - if (destinationItem==NULL) { - if (direction < 0) - logDebug() << "No previous item found."; - else - logDebug() << "No next item found."; - return; - } - - logViewWidget->setItemSelected(item, false); - logViewWidget->setItemSelected(destinationItem, true); - logViewWidget->scrollToItem(destinationItem); - - updateDetails(); -} - -void DetailDialog::previousItem() { - moveToItem(-1); -} - -void DetailDialog::nextItem() { - moveToItem(1); -} - -#include "moc_detailDialog.cpp" diff --git a/ksystemlog/src/detailDialog.h b/ksystemlog/src/detailDialog.h deleted file mode 100644 index d135a88f..00000000 --- a/ksystemlog/src/detailDialog.h +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************** - * 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 _DETAIL_DIALOG_H_ -#define _DETAIL_DIALOG_H_ - -#include - -class LogViewWidget; - -#include "ui_detailDialogBase.h" - -class DetailDialog : public QDialog, public Ui::DetailDialogBase { - - Q_OBJECT - - public: - explicit DetailDialog(QWidget *parent); - - ~DetailDialog(); - - public slots: - void selectionChanged(LogViewWidget* logViewWidget); - - private slots: - void previousItem(); - void nextItem(); - - private: - void updateDetails(); - - /** - * Method that replaces the bugged itemAbove() and itemBelow() methods - */ - void moveToItem(int direction); - - LogViewWidget* logViewWidget; - -}; - -#endif //_DETAIL_DIALOG_H_ diff --git a/ksystemlog/src/detailDialogBase.ui b/ksystemlog/src/detailDialogBase.ui deleted file mode 100644 index 2a476a07..00000000 --- a/ksystemlog/src/detailDialogBase.ui +++ /dev/null @@ -1,189 +0,0 @@ - - DetailDialogBase - - - - 0 - 0 - 411 - 248 - - - - Log Line Details - - - This dialog displays detailed information about the currently selected log line. - - - - - - - 0 - 0 - - - - Message - - - true - - - - - - - - 0 - 0 - - - - Icon - - - false - - - - - - - - 2 - 0 - - - - Main information - - - false - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Move to the previous line - - - Moves to the previous line. This button is deactivated if there is no previous log line. - - - &Back - - - 14 - - - - - - - - 0 - 0 - - - - Move to the next line - - - Moves to the next line. This button is deactivated if there is no next log line. - - - &Forward - - - 15 - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 100 - 31 - - - - - - - - - 0 - 0 - - - - Close the Detail dialog. - - - Closes this Detail dialog. - - - &Close - - - 13 - - - - - - - - - - KTextEdit - QWidget -
ktextedit.h
-
- - KPushButton - QWidget -
kpushbutton.h
-
-
- - message - - - ktextedit.h - kpushbutton.h - kpushbutton.h - kpushbutton.h - - -
diff --git a/ksystemlog/src/generalConfigurationWidget.cpp b/ksystemlog/src/generalConfigurationWidget.cpp deleted file mode 100644 index e2721d2f..00000000 --- a/ksystemlog/src/generalConfigurationWidget.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/*************************************************************************** - * 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 "generalConfigurationWidget.h" - - -#include -#include -#include - -#include -#include -#include -#include - -#include "logging.h" -#include "defaults.h" -#include "globals.h" -#include "ksystemlogConfig.h" - -class GeneralConfigurationWidgetPrivate { -public: - QButtonGroup* dateFormatGroup; -}; - -GeneralConfigurationWidget::GeneralConfigurationWidget() : - QWidget(), - d(new GeneralConfigurationWidgetPrivate()) - { - - setupUi(this); - - startupLogMode->addItem(KIcon( QLatin1String( NO_MODE_ICON) ), i18n("No Log Mode"), QVariant(QLatin1String( "" ) )); - foreach(LogMode* logMode, Globals::instance()->logModes()) { - //Ignore this special case - if (logMode->id() == QLatin1String( "openLogMode" )) - continue; - - startupLogMode->addItem(KIcon(logMode->icon()), logMode->name(), QVariant(logMode->id())); - } - - connect(startupLogMode, SIGNAL(currentIndexChanged(int)), this, SIGNAL(configurationChanged())); - - connect(maxLines, SIGNAL(valueChanged(int)), this, SIGNAL(configurationChanged())); - - connect(deleteDuplicatedLines, SIGNAL(clicked()), this, SIGNAL(configurationChanged())); - - connect(deleteProcessId, SIGNAL(clicked()), this, SIGNAL(configurationChanged())); - - connect(colorizeLogLines, SIGNAL(clicked()), this, SIGNAL(configurationChanged())); - - d->dateFormatGroup = new QButtonGroup(this); - d->dateFormatGroup->addButton(formatShortDate, KLocale::ShortDate); - d->dateFormatGroup->addButton(formatLongDate, KLocale::LongDate); - d->dateFormatGroup->addButton(formatFancyShortDate, KLocale::FancyShortDate); - d->dateFormatGroup->addButton(formatFancyLongDate, KLocale::FancyLongDate); - - connect(d->dateFormatGroup, SIGNAL(buttonClicked(int)), this, SIGNAL(configurationChanged())); - - addDateFormatExample(); -} - - -GeneralConfigurationWidget::~GeneralConfigurationWidget() { - //dateFormatGroup is automatically deleted by Qt - - delete d; -} - -void GeneralConfigurationWidget::addDateFormatExample() { - foreach(QAbstractButton* button, d->dateFormatGroup->buttons()) { - QDateTime currentDateTime(QDateTime::currentDateTime()); - - KLocale::DateFormat currentButtonFormat = (KLocale::DateFormat) d->dateFormatGroup->id(button); - - QString formattedDate = KGlobal::locale()->formatDateTime(currentDateTime, currentButtonFormat, true); - - button->setText( i18nc("Date format Option (Date example)", "%1 (%2)", button->text(), formattedDate) ); - } -} - -void GeneralConfigurationWidget::readConfig() { - for (int i=0; icount(); ++i) { - if (KSystemLogConfig::startupLogMode() == startupLogMode->itemData(i).toString()) { - startupLogMode->setCurrentIndex(i); - break; - } - } - - maxLines->setValue(KSystemLogConfig::maxLines()); - - deleteDuplicatedLines->setChecked(KSystemLogConfig::deleteDuplicatedLines()); - - deleteProcessId->setChecked(KSystemLogConfig::deleteProcessIdentifier()); - - colorizeLogLines->setChecked(KSystemLogConfig::colorizeLogLines()); - - KLocale::DateFormat dateFormat = (KLocale::DateFormat) KSystemLogConfig::dateFormat(); - QAbstractButton* selectedButton = d->dateFormatGroup->button(dateFormat); - selectedButton->setChecked(true); -} - -void GeneralConfigurationWidget::saveConfig() const { - logDebug() << "Save config from General preferences"; - - KSystemLogConfig::setStartupLogMode(startupLogMode->itemData(startupLogMode->currentIndex()).toString()); - - KSystemLogConfig::setMaxLines(maxLines->value()); - KSystemLogConfig::setDeleteDuplicatedLines(deleteDuplicatedLines->isChecked()); - KSystemLogConfig::setDeleteProcessIdentifier(deleteProcessId->isChecked()); - KSystemLogConfig::setColorizeLogLines(colorizeLogLines->isChecked()); - - KSystemLogConfig::setDateFormat(d->dateFormatGroup->checkedId()); - -} - -void GeneralConfigurationWidget::defaultConfig() { - //TODO Find a way to read the configuration per default - readConfig(); -} - -bool GeneralConfigurationWidget::isValid() const { - if (maxLines->value()>0) { - logDebug() << "General configuration valid"; - return true; - } - - logDebug() << "General configuration not valid"; - return false; -} - -#include "moc_generalConfigurationWidget.cpp" diff --git a/ksystemlog/src/generalConfigurationWidget.h b/ksystemlog/src/generalConfigurationWidget.h deleted file mode 100644 index 51127f81..00000000 --- a/ksystemlog/src/generalConfigurationWidget.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - * 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 _GENERAL_CONFIGURATION_WIDGET_H_ -#define _GENERAL_CONFIGURATION_WIDGET_H_ - -#include - -#include "ui_generalConfigurationWidgetBase.h" - -class GeneralConfigurationWidgetPrivate; - -class GeneralConfigurationWidget : public QWidget, public Ui::GeneralConfigurationWidgetBase { - - Q_OBJECT - - public: - GeneralConfigurationWidget(); - - ~GeneralConfigurationWidget(); - - bool isValid() const; - - public slots: - void saveConfig() const; - - void defaultConfig(); - - void readConfig(); - - signals: - void configurationChanged(); - - private: - void addDateFormatExample(); - - GeneralConfigurationWidgetPrivate* const d; -}; - -#endif // _GENERAL_CONFIGURATION_WIDGET_H_ diff --git a/ksystemlog/src/generalConfigurationWidgetBase.ui b/ksystemlog/src/generalConfigurationWidgetBase.ui deleted file mode 100644 index bfcde8ab..00000000 --- a/ksystemlog/src/generalConfigurationWidgetBase.ui +++ /dev/null @@ -1,202 +0,0 @@ - - Nicolas Ternisien - GeneralConfigurationWidgetBase - - - - 0 - 0 - 368 - 497 - - - - - - - Startup - - - - - - Load this log mode at startup: - - - startupLogMode - - - - - - - The log mode which is loaded by default at startup - - - The log mode loaded by default at startup. Choose 'No Log Mode' if you do not want this to happen. - - - - - - - - - - Log Lines List - - - - - - - - Maximum lines displayed: - - - maxLines - - - - - - - - 0 - 0 - - - - Choose here the maximum number of log lines displayed in the main view. - - - You can choose here the maximum number of log lines displayed in the main view. - - - 10 - - - 30000 - - - 10 - - - - - - - - - Select this option if you want to delete duplicate log lines <b>(may be slow)</b>. - - - Select this option if you want to delete duplicate log lines. <b>This option can slow log reading</b>. - - - Remove &duplicate log lines (may be slower) - - - - - - - - - - Options - - - - - - Remove process identifier from process name. - - - Select this option if you want to remove the process identifier from the process name. For example, the <b>Process</b> column may contain entries such as <i>cron<b>[3433]</b></i>. If this option is activated, the bold part will be removed. - - - Remove &identifier from process name - - - - - - - This option allows log lines to be colored depending on their log level. - - - This option allows log lines to be colored depending on their log level. For example, errors will be shown in red, warnings in orange, and so on. This will help you to see problems more easily. - - - &Colored log lines - - - - - - - - - - Date Format - - - - - - - - - &Short date format - - - - - - - &Fancy short date format - - - - - - - &Long date format - - - - - - - Fanc&y long date format - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - KIntSpinBox - QSpinBox -
knuminput.h
-
-
- -
diff --git a/ksystemlog/src/ksystemlog.desktop b/ksystemlog/src/ksystemlog.desktop deleted file mode 100755 index b6960972..00000000 --- a/ksystemlog/src/ksystemlog.desktop +++ /dev/null @@ -1,174 +0,0 @@ -[Desktop Entry] -Name=KSystemLog -Name[ast]=KSystemLog -Name[bg]=Системни дневници -Name[bs]=KSystemLog -Name[ca]=KSystemLog -Name[ca@valencia]=KSystemLog -Name[cs]=KSystemLog -Name[da]=KSystemLog -Name[de]=KSystemLog -Name[el]=KSystemLog -Name[en_GB]=KSystemLog -Name[es]=KSystemLog -Name[et]=KSystemLog -Name[eu]=KSystemLog -Name[fi]=KSystemLog -Name[fr]=KSystemLog -Name[ga]=KSystemLog -Name[gl]=KSystemLog -Name[hne]=के-सिस्टम-लाग -Name[hr]=KSystemLog -Name[hu]=Rendszernapló-megjelenítő -Name[ia]=KSystemLog -Name[id]=KSystemLog -Name[is]=KSystemLog -Name[it]=KSystemLog -Name[ja]=KSystemLog -Name[kk]=KSystemLog -Name[ko]=KSystemLog -Name[lt]=KSystemLog -Name[lv]=KSystemLog -Name[ml]=കെസിസ്റ്റംലോഗ് -Name[mr]=के-सिस्टीम-लॉग -Name[nb]=KSystemLog -Name[nds]=KSystemLog -Name[nl]=KSystemLog -Name[nn]=KSystemlogg -Name[pa]=ਕੇ-ਸਿਸਟਮ-ਲਾਗ -Name[pl]=KSystemLog -Name[pt]=KSystemLog -Name[pt_BR]=KSystemLog -Name[ro]=KSystemLog -Name[ru]=KSystemLog -Name[sk]=KSystemLog -Name[sl]=KSystemLog -Name[sq]=KSystemLog -Name[sr]=К‑системски-дневник -Name[sr@ijekavian]=К‑системски-дневник -Name[sr@ijekavianlatin]=K‑sistemski-dnevnik -Name[sr@latin]=K‑sistemski-dnevnik -Name[sv]=Ksystemlog -Name[th]=ปูมบันทึกระบบ -Name[tr]=KSystemLog -Name[ug]=KSystemLog -Name[uk]=KSystemLog -Name[x-test]=xxKSystemLogxx -Name[zh_CN]=KSystemLog -Name[zh_TW]=KSystemLog -Categories=Qt;KDE;System;Monitor; -X-KDE-SubstituteUID=true -Exec=ksystemlog --icon '%i' --caption '%c' -Icon=utilities-log-viewer -Type=Application -X-DocPath=ksystemlog/index.html -Comment=System log viewer tool -Comment[ast]=Ferramienta de visor de rexistru de sistema -Comment[bg]=Инструмент за преглеждане на системните дневници -Comment[bs]=Alat za pregled sistemski zabilješki -Comment[ca]=Eina de visualització dels registres del sistema -Comment[ca@valencia]=Eina de visualització dels registres del sistema -Comment[cs]=Nástroj na prohlížení záznamů systému -Comment[da]=Fremviserværktøj til systemlog -Comment[de]=Betrachter für Systemprotokolle -Comment[el]=Εργαλείο εμφάνισης της καταγραφής του συστήματος -Comment[en_GB]=System log viewer tool -Comment[es]=Herramienta de visualización de registros del sistema -Comment[et]=Süsteemilogi näitaja -Comment[eu]=Sistema egunkariak erakusteko tresna -Comment[fi]=Järjestelmälokien katselin -Comment[fr]=Outil d'affichage des journaux du système -Comment[ga]=Amharcán ar logchomhaid an chórais -Comment[gl]=Visor dos rexistros do sistema -Comment[hne]=तंत्र लाग प्रदर्सक औजार -Comment[hr]=Alat za prikaz dnevnika sustava -Comment[hu]=Rendszernapló-megjelenítő eszköz -Comment[ia]=Instrumento pro vider registro de systema -Comment[id]=Alat pembaca Catatan sistem -Comment[is]=Tól til að skoða kerfisannála (system logs) -Comment[it]=Strumento di visione dei registri di sistema -Comment[ja]=システムログビューア -Comment[kk]=Жүйелік журналын қарау құралы -Comment[ko]=시스템 로그 뷰어 도구 -Comment[lt]=Sistemos žurnalų žiūryklė -Comment[lv]=Sistēmas žurnāla skatīšanas rīks -Comment[ml]=സിസ്റ്റം ലോഗ് കാണാന്നുള്ള ടൂള്‍ -Comment[mr]=प्रणाली लॉग प्रदर्शक साधन -Comment[nb]=Verktøy for å vise systemlogger -Comment[nds]=Kieker för Systeem-Logböker -Comment[nl]=Systeemlogs bekijken -Comment[nn]=Verktøy for vising av systemloggar -Comment[pa]=ਸਿਸਟਮ ਲਾਗ ਦਰਸ਼ਕ ਟੂਲ -Comment[pl]=Narzędzie do przeglądania dziennika systemowego -Comment[pt]=Ferramenta de visualização de registos do sistema -Comment[pt_BR]=Ferramenta de visualização de registros do sistema -Comment[ro]=Unealtă de vizualizare a jurnalelor de sistem -Comment[ru]=Программа просмотра системных журналов -Comment[sk]=Nástroj na prehliadanie záznamov systému -Comment[sl]=Orodje za pregledovanje sistemskih dnevnikov -Comment[sq]=Mjeti shfaqës i hyrjeve në sistem -Comment[sr]=Приказивач системских дневника -Comment[sr@ijekavian]=Приказивач системских дневника -Comment[sr@ijekavianlatin]=Prikazivač sistemskih dnevnika -Comment[sr@latin]=Prikazivač sistemskih dnevnika -Comment[sv]=Visningsverktyg för systemloggar -Comment[th]=เครื่องมือแสดงปูมบันทึกของระบบ -Comment[tr]=Sistem günlük kayıtlarını gösterme aracı -Comment[ug]=سىستېما خاتىرىسىنى كۆرۈش قورالى -Comment[uk]=Засіб перегляду системних журналів -Comment[x-test]=xxSystem log viewer toolxx -Comment[zh_CN]=系统日志查看工具 -Comment[zh_TW]=系統紀錄檢視工具 -Terminal=false -GenericName=System Log Viewer -GenericName[bg]=Преглед на системните дневници -GenericName[bs]=Preglednik sistemskih bilješki -GenericName[ca]=Visor dels registres del sistema -GenericName[ca@valencia]=Visor dels registres del sistema -GenericName[cs]=Prohlížeč záznamů systému -GenericName[da]=Systemlogfremviser -GenericName[de]=Systemprotokoll-Betrachter -GenericName[el]=Εμφάνιση καταγραφών του συστήματος -GenericName[en_GB]=System Log Viewer -GenericName[es]=Visor de registros del sistema -GenericName[et]=Süsteemi logide jälgija -GenericName[eu]=Sistema egunkarien erakuslea -GenericName[fi]=Järjestelmän lokitiedostojen katselin -GenericName[fr]=Afficheur des journaux du système -GenericName[ga]=Amharcán ar Logchomhaid an Chórais -GenericName[gl]=Visor dos rexistros do sistema -GenericName[hr]=Preglednik sistemskih zapisa -GenericName[hu]=Rendszernapló-megjelenítő -GenericName[ia]=Visor de registro de systema -GenericName[id]=Penampil Catatan Sistem -GenericName[is]=Kerfisannálabirtir -GenericName[it]=Visore dei registri di sistema -GenericName[ja]=システムログビューア -GenericName[kk]=Жүйелік журналын қарау -GenericName[ko]=시스템 로그 뷰어 -GenericName[lt]=Sistemos žurnalų žiūryklė -GenericName[mr]=प्रणाली लॉग प्रदर्शक -GenericName[nb]=Systemloggviser -GenericName[nds]=Kieker för't Systeemlogbook -GenericName[nl]=Systeemlog-weergaveprogramma -GenericName[nn]=Systemloggvisar -GenericName[pa]=ਸਿਸਟਮ ਲਾਗ ਦਰਸ਼ਕ -GenericName[pl]=Przeglądarka dziennika systemowego -GenericName[pt]=Visualizador de Registos do Sistema -GenericName[pt_BR]=Visualizador do registros do sistema -GenericName[ro]=Vizualizator jurnale de sistem -GenericName[ru]=Просмотр системных журналов -GenericName[sk]=Prehliadač záznamov systému -GenericName[sl]=Pregledovalnik sistemskih dnevnikov -GenericName[sr]=Приказивач системског дневника -GenericName[sr@ijekavian]=Приказивач системског дневника -GenericName[sr@ijekavianlatin]=Prikazivač sistemskog dnevnika -GenericName[sr@latin]=Prikazivač sistemskog dnevnika -GenericName[sv]=Visning av systemloggar -GenericName[th]=แสดงปูมบันทึกของระบบ -GenericName[tr]=Sistem Günlüğü İzleyici -GenericName[ug]=سىستېما خاتىرىسى كۆرگۈچ -GenericName[uk]=Переглядач системних журналів -GenericName[x-test]=xxSystem Log Viewerxx -GenericName[zh_CN]=系统日志查看器 -GenericName[zh_TW]=系統紀錄檔檢視器 diff --git a/ksystemlog/src/ksystemlog.kcfg b/ksystemlog/src/ksystemlog.kcfg deleted file mode 100644 index 8df3c2ae..00000000 --- a/ksystemlog/src/ksystemlog.kcfg +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - klocale.h - - - - - systemLogMode - - - - - 1000 - - - - - false - - - - - false - - - - - true - - - - - - true - - - - - true - - - - - true - - - - - KLocale::ShortDate - - - - - - - - diff --git a/ksystemlog/src/ksystemlog.lsm b/ksystemlog/src/ksystemlog.lsm deleted file mode 100644 index a9bdfe6a..00000000 --- a/ksystemlog/src/ksystemlog.lsm +++ /dev/null @@ -1,16 +0,0 @@ -Begin3 -Title: KSystemLog -- System Log Viewer Tool -Version: 0.1.1 -Entered-date: -Description: System Log Viewer Tool for KDE -Keywords: KDE Qt System Log -Author: Nicolas Ternisien -Maintained-by: Nicolas Ternisien -Home-page: http://www.kde-apps.org/content/show.php?content=23761 -Alternate-site: -Primary-site: http://annivernet.free.fr/images/divers/ksystemlog/ - 0.1.1 ksystemlog-0.1.1.tar.gz - 0.1.1 ksystemlog-0.1.1.lsm -Platform: Linux. Needs KDE -Copying-policy: GPL -End diff --git a/ksystemlog/src/ksystemlogConfig.kcfgc b/ksystemlog/src/ksystemlogConfig.kcfgc deleted file mode 100644 index 6d6954d2..00000000 --- a/ksystemlog/src/ksystemlogConfig.kcfgc +++ /dev/null @@ -1,4 +0,0 @@ -File=ksystemlog.kcfg -ClassName=KSystemLogConfig -Singleton=true -Mutators=true diff --git a/ksystemlog/src/ksystemlogui.rc b/ksystemlog/src/ksystemlogui.rc deleted file mode 100644 index 777a672b..00000000 --- a/ksystemlog/src/ksystemlogui.rc +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - &Edit - - - - - - - - - - - - - - Logs - - - - - &Window - - - - - - - - - - - - - - - - - - - Logs Toolbar - - - - - Main Toolbar - - - - - - - - - - diff --git a/ksystemlog/src/lib/CMakeLists.txt b/ksystemlog/src/lib/CMakeLists.txt deleted file mode 100644 index 3d8be1ca..00000000 --- a/ksystemlog/src/lib/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/.. - ${CMAKE_CURRENT_BINARY_DIR}/../config -) - -set(ksystemlog_lib_sources - analyzer.cpp - logModeFactory.cpp - logModeConfiguration.cpp - logModeConfigurationWidget.cpp - logModeItemBuilder.cpp - logManager.cpp - view.cpp - globals.cpp - logMode.cpp - logLevel.cpp - logFile.cpp - logFileReader.cpp - localLogFileReader.cpp - processOutputLogFileReader.cpp - kioLogFileReader.cpp - logLine.cpp - logViewModel.cpp - logViewColumn.cpp - logViewColumns.cpp - logViewWidgetItem.cpp - logViewWidget.cpp - logViewExport.cpp - logViewFilterWidget.cpp - logViewSearchWidget.cpp - loadingBar.cpp - logModeAction.cpp - simpleAction.cpp - multipleActions.cpp - - levelPrintPage.cpp -) - -add_library(ksystemlog_lib STATIC ${ksystemlog_lib_sources}) - -target_link_libraries(ksystemlog_lib - ${KDE4_KDEUI_LIBS} - ${KDE4_KIO_LIBS} - ${KDE4_KFILE_LIBS} -) diff --git a/ksystemlog/src/lib/analyzer.cpp b/ksystemlog/src/lib/analyzer.cpp deleted file mode 100644 index c025868c..00000000 --- a/ksystemlog/src/lib/analyzer.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/*************************************************************************** - * 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 "analyzer.h" - -#include - -#include "logging.h" -#include "ksystemlogConfig.h" - -#include "logViewModel.h" - -#include "logMode.h" -#include "logFileReader.h" - -#include "logFile.h" - -Analyzer::Analyzer(LogMode* logMode) : - QObject(NULL), - logViewModel(NULL), - logMode(logMode), - logLineInternalIdGenerator(0) { - - parsingPaused = false; - - insertionLocking = new QMutex(); -} - -Analyzer::~Analyzer() { - deleteLogFiles(); - - //logMode is managed by Globals - //logViewModel is managed by LogViewWidget -} - -void Analyzer::watchLogFiles(bool enabled) { - //Enable the log file watching, by revert order to read the most top file at last, and be sure its line will be kept - - QListIterator it(logFileReaders); - it.toBack(); - while (it.hasPrevious()) { - LogFileReader* logFileReader = it.previous(); - logFileReader->watchFile(enabled); - } - -} - -void Analyzer::deleteLogFiles() { - watchLogFiles(false); - - // Remove the watching on the monitored files - foreach (LogFileReader* logFileReader, logFileReaders) { - logDebug() << "Remove file : " << logFileReader->logFile().url().path(); - delete logFileReader; - } - - logFileReaders.clear(); -} - -bool Analyzer::isParsingPaused() const { - return parsingPaused; -} - -void Analyzer::setParsingPaused(bool paused) { - parsingPaused = paused; - - bool watching; - //If we resume the parsing, then parse files to know if new lines have been appended - if (parsingPaused==true) { - logDebug() << "Pausing reading"; - watching=false; - } - else { - logDebug() << "Relaunch reading"; - watching=true; - } - - watchLogFiles(watching); - -} - -void Analyzer::setLogViewModel(LogViewModel* logViewModel) { - this->logViewModel = logViewModel; -} - -void Analyzer::setLogFiles(const QList& logFiles) { - //Remove previous files - deleteLogFiles(); - - foreach(const LogFile &logFile, logFiles) { - LogFileReader* logFileReader = createLogFileReader(logFile); - logFileReaders.append(logFileReader); - - connect(logFileReader, SIGNAL(contentChanged(LogFileReader*,Analyzer::ReadingMode,QStringList)), this, SLOT(logFileChanged(LogFileReader*,Analyzer::ReadingMode,QStringList))); - connect(logFileReader, SIGNAL(statusBarChanged(QString)), this, SIGNAL(statusBarChanged(QString))); - connect(logFileReader, SIGNAL(errorOccured(QString,QString)), this, SIGNAL(errorOccured(QString,QString))); - } -} - -void Analyzer::logFileChanged(LogFileReader* logFileReader, ReadingMode readingMode, const QStringList& content) { - if (readingMode == Analyzer::FullRead) - logDebug() << "File " << logFileReader->logFile().url().path() << " has been modified on full read."; - else - logDebug() << "File " << logFileReader->logFile().url().path() << " has been modified on partial read"; - - if (parsingPaused == true) { - logDebug() << "Pause enabled. Nothing read."; - return; - } - - logDebug() << "Locking file modifications of " << logFileReader->logFile().url().path(); - QMutexLocker locker(insertionLocking); - logDebug() << "Unlocking file modifications of " << logFileReader->logFile().url().path(); - - QTime benchmark; - benchmark.start(); - - int insertedLogLineCount; - - logViewModel->startingMultipleInsertions(readingMode); - - if (readingMode == Analyzer::UpdatingRead) { - insertedLogLineCount = insertLines(content, logFileReader->logFile(), Analyzer::UpdatingRead); - } - else { - logDebug() << "Reading file "<< logFileReader->logFile().url().path(); - - emit statusBarChanged( i18n("Opening '%1'...", logFileReader->logFile().url().path()) ); - - //Inform that we are now reading the "index" file - emit readFileStarted(*logMode, logFileReader->logFile(), logFileReaders.count() - logFileReaders.indexOf(logFileReader), logFileReaders.count()); - - insertedLogLineCount = insertLines(content, logFileReader->logFile(), Analyzer::FullRead); - - emit statusBarChanged( i18n("Log file '%1' loaded successfully.", logFileReader->logFile().url().path()) ); - - - } - - logViewModel->endingMultipleInsertions(readingMode, insertedLogLineCount); - - //Inform connected LoadingBar that the reading is now finished - emit readEnded(); - - //Inform LogManager that new lines have been added - emit logUpdated(insertedLogLineCount); - - //Inform MainWindow status bar - emit statusBarChanged( i18n("Log file '%1' has changed.", logFileReader->logFile().url().path()) ); - - logDebug() << "Updating log files in " << benchmark.elapsed() << " ms"; -} - -int Analyzer::insertLines(const QStringList& bufferedLines, const LogFile& logFile, ReadingMode readingMode) { - logDebug() << "Inserting lines..."; - - //If there is no line - if (bufferedLines.size()==0) { - logWarning() << "File is empty : " << logFile.url().path(); - } - - - - int stop = 0; - int currentPosition = 0; - - QListIterator it(bufferedLines); - /** - * If the log file is sorted, then we can ignore the first lines - * if there are more lines in the log file than the max lines - * - * TODO Read revertly the file and ignore last lines if we are in Descending mode - */ - logDebug() << "Log file Sort mode is " << logFileSortMode(); - if (logFileSortMode() == Analyzer::AscendingSortedLogFile) { - //Calculate how many lines we will ignore - if (bufferedLines.size() > KSystemLogConfig::maxLines()) { - stop=bufferedLines.size() - KSystemLogConfig::maxLines(); - } - - //Ignore those lines - while (currentPosition < stop) { - it.next(); - ++currentPosition; - } - } - - int insertedLogLineCount = 0; - while (currentPosition < bufferedLines.size()) { - QString buffer(it.next()); - - bool inserted = insertLine(buffer, logFile, readingMode); - if (inserted) { - insertedLogLineCount++; - } - - if (readingMode == Analyzer::FullRead) { - informOpeningProgress(currentPosition, (bufferedLines.size()-1) - stop); - } - - ++currentPosition; - } - - logDebug() << "Total read lines :"<< (bufferedLines.size() - stop) << "(" << logFile.url().path() << ")"; - - return insertedLogLineCount; -} - -bool Analyzer::insertLine(const QString& buffer, const LogFile& originalFile, ReadingMode readingMode) { - LogLine* line=parseMessage(buffer, originalFile); - - //Invalid log line - if (line==NULL) { - return false; - } - - //On full reading, it is not needed to display the recent status - if (readingMode == Analyzer::FullRead) { - line->setRecent(false); - } - - return logViewModel->insertNewLogLine(line); -} - -inline void Analyzer::informOpeningProgress(int currentPosition, int total) { - int each=total / 100; - if (each==0) { - return; - } - - if (currentPosition%each==0) { - emit openingProgressed(); - } -} - -#include "moc_analyzer.cpp" diff --git a/ksystemlog/src/lib/analyzer.h b/ksystemlog/src/lib/analyzer.h deleted file mode 100644 index 3475e121..00000000 --- a/ksystemlog/src/lib/analyzer.h +++ /dev/null @@ -1,133 +0,0 @@ -/*************************************************************************** - * 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 _ANALYZER_H_ -#define _ANALYZER_H_ - -#include -#include -#include -#include - -#include - -#include "globals.h" - -#include "logLine.h" - -#include "logFile.h" -#include "logViewColumn.h" -#include "logViewColumns.h" - -class LogViewModel; -class LogFileReader; -class LogMode; - -class Analyzer : public QObject { - - Q_OBJECT - - public: - enum ReadingMode { - UpdatingRead, - FullRead - }; - Q_DECLARE_FLAGS(ReadingModes, ReadingMode) - - enum LogFileSortMode { - AscendingSortedLogFile, - FilteredLogFile, - UnsortedLogFile - }; - Q_DECLARE_FLAGS(LogFileSortModes, LogFileSortMode) - - explicit Analyzer(LogMode* logMode); - - ~Analyzer(); - - void watchLogFiles(bool enabled); - - - void setLogFiles(const QList& logFiles); - void setLogViewModel(LogViewModel* logViewModel); - - bool isParsingPaused() const; - - virtual LogViewColumns initColumns() = 0; - - public slots: - void setParsingPaused(bool paused); - - protected: - virtual LogFileReader* createLogFileReader(const LogFile& logFile) = 0; - virtual Analyzer::LogFileSortMode logFileSortMode() = 0; - - virtual LogLine* parseMessage(const QString& logLine, const LogFile& originalFile) = 0; - - private: - - inline void informOpeningProgress(int currentPosition, int total); - - void deleteLogFiles(); - - /** - * Parse and insert the buffered lines in the model - * Returns the count of inserted lines - */ - int insertLines(const QStringList& bufferedLines, const LogFile& logFile, ReadingMode readingMode); - - /** - * Parse and insert a line in the model - * Returns false if it was not inserted, true if it was - */ - bool insertLine(const QString& buffer, const LogFile& originalFile, ReadingMode readingMode); - - private slots: - void logFileChanged(LogFileReader* logFileReader, Analyzer::ReadingMode readingMode, const QStringList& content); - - signals: - void statusBarChanged(const QString& message); - void errorOccured(const QString& title, const QString& message); - - void openingProgressed(); - - void logUpdated(int lineTotal); - - void readFileStarted(const LogMode& logMode, const LogFile& logFile, int fileIndex, int fileCount); - void readEnded(); - - protected: - //TODO Move those members to a D-pointer (and think about subclasses accesses) - bool parsingPaused; - - LogViewModel* logViewModel; - - LogMode* logMode; - - QList logFileReaders; - - QMutex* insertionLocking; - - long logLineInternalIdGenerator; - -}; - -#endif diff --git a/ksystemlog/src/lib/defaults.h b/ksystemlog/src/lib/defaults.h deleted file mode 100644 index 05666eaf..00000000 --- a/ksystemlog/src/lib/defaults.h +++ /dev/null @@ -1,77 +0,0 @@ -/*************************************************************************** - * 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 _DEFAULTS_H_ -#define _DEFAULTS_H_ - -#define DEFAULT_LOG_FOLDER "/var/log" - -/** - * Icon name of KSystemLog - */ -#define KSYSTEMLOG_ICON "utilities-log-viewer" - -enum LogLevelIds { - NONE_LOG_LEVEL_ID=0, - DEBUG_LOG_LEVEL_ID, - INFORMATION_LOG_LEVEL_ID, - NOTICE_LOG_LEVEL_ID, - WARNING_LOG_LEVEL_ID, - ERROR_LOG_LEVEL_ID, - CRITICAL_LOG_LEVEL_ID, - ALERT_LOG_LEVEL_ID, - EMERGENCY_LOG_LEVEL_ID -}; - -//TODO Need a rewriting -/* -enum GroupByType { - NO_GROUP_BY=0, - GROUP_BY_LOG_LEVEL, - GROUP_BY_DAY, - GROUP_BY_HOUR, - GROUP_BY_LOG_FILE, - GROUP_BY_COLUMN -}; - -//This variable only counts GROUP_BY methods != than GROUP_BY_COLUMN -#define DEFAULT_GROUP_BY_COUNT 5 - -#define NO_GROUP_BY_ICON "process-stop" -#define GROUP_BY_LOG_LEVEL_ICON INFORMATION_LOG_LEVEL_ICON -#define GROUP_BY_DAY_ICON "go-jump-today" -#define GROUP_BY_HOUR_ICON "chronometer" -#define GROUP_BY_LOG_FILE_ICON "utilities-log-viewer" - -#define GROUP_BY_COLUMN_ICON "view-list-text" - - -//Icon of the Group By action -#define GROUP_BY_ICON "view-list-tree" -*/ - -/** - * Icon name of No Mode icon - */ -#define NO_MODE_ICON "text-x-generic" - - -#endif // _DEFAULTS_H_ diff --git a/ksystemlog/src/lib/globals.cpp b/ksystemlog/src/lib/globals.cpp deleted file mode 100644 index ed562581..00000000 --- a/ksystemlog/src/lib/globals.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/*************************************************************************** - * 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 "globals.h" - -#include -#include -#include - -#include - -#include "defaults.h" -#include "logLevel.h" -#include "logMode.h" -#include "logFile.h" - -#include "analyzer.h" -#include "logModeAction.h" -#include "logModeFactory.h" -#include "logModeConfiguration.h" -#include "logModeConfigurationWidget.h" - -Globals* Globals::self = NULL; - -Globals* Globals::instance() { - if (Globals::self == NULL) { - Globals::self = new Globals(); - } - - return Globals::self; -} - -class GlobalsPrivate { -public: - - /** - * Existing Log modes. - */ - QMap logModes; - - QList logModeActions; - - /* - LogMode* noMode; - */ - - /** - * Existing Log levels. The id value corresponds to the index in the vector - */ - QList logLevels; - - /** - * These value are only pointers to item of the previous vector, - * they are provided for convenience - */ - LogLevel* noLogLevel; - LogLevel* debugLogLevel; - LogLevel* informationLogLevel; - LogLevel* noticeLogLevel; - LogLevel* warningLogLevel; - LogLevel* errorLogLevel; - LogLevel* criticalLogLevel; - LogLevel* alertLogLevel; - LogLevel* emergencyLogLevel; - -}; - -Globals::Globals() : - d(new GlobalsPrivate()) { - - setupLogLevels(); - -} - -Globals::~Globals() { - - foreach(LogMode* logMode, d->logModes) { - delete logMode; - } - d->logModes.clear(); - - foreach(LogModeAction* logModeAction, d->logModeActions) { - delete logModeAction; - } - d->logModeActions.clear(); - - foreach(LogLevel* logLevel, d->logLevels) { - delete logLevel; - } - d->logLevels.clear(); - - delete d; - -} - -/* -void Globals::setupLogModes() { - d->noMode=new LogMode("noLogMode", i18n("No Log"), NO_MODE_ICON); - d->logModes.append(d->noMode); - - d->sambaMode=new LogMode("sambaLogMode", i18n("Samba Log"), SAMBA_MODE_ICON); - d->logModes.append(d->sambaMode); - - d->cupsMode=new LogMode("cupsLogMode", i18n("CUPS Log"), CUPS_MODE_ICON); - d->logModes.append(d->cupsMode); - - d->cupsAccessMode=new LogMode("cupsAccessLogMode", i18n("CUPS Access Log"), CUPS_ACCESS_MODE_ICON); - d->logModes.append(d->cupsAccessMode); - - d->postfixMode=new LogMode("postfixLogMode", i18n("Postfix Log"), POSTFIX_MODE_ICON); - d->logModes.append(d->postfixMode); - -} -*/ - -void Globals::setupLogLevels() { - d->noLogLevel=new LogLevel(NONE_LOG_LEVEL_ID, i18n("None"), QLatin1String( "help-contents" ), QColor(208, 210, 220)); - d->logLevels.append(d->noLogLevel); - - d->debugLogLevel=new LogLevel(DEBUG_LOG_LEVEL_ID, i18n("Debug"), QLatin1String( "attach" ), QColor(156, 157, 165)); - d->logLevels.append(d->debugLogLevel); - - d->informationLogLevel=new LogLevel(INFORMATION_LOG_LEVEL_ID, i18n("Information"), QLatin1String( "dialog-information" ), QColor(36, 49, 103) /*QColor(0, 0, 0)*/); - d->logLevels.append(d->informationLogLevel); - - d->noticeLogLevel=new LogLevel(NOTICE_LOG_LEVEL_ID, i18n("Notice"), QLatin1String( "book2" ), QColor(36, 138, 22)); - d->logLevels.append(d->noticeLogLevel); - - d->warningLogLevel=new LogLevel(WARNING_LOG_LEVEL_ID, i18n("Warning"), QLatin1String( "dialog-warning" ), QColor(238, 144, 21)); - d->logLevels.append(d->warningLogLevel); - - d->errorLogLevel=new LogLevel(ERROR_LOG_LEVEL_ID, i18n("Error"), QLatin1String( "dialog-close" ), QColor(173, 28, 28)); - d->logLevels.append(d->errorLogLevel); - - d->criticalLogLevel=new LogLevel(CRITICAL_LOG_LEVEL_ID, i18n("Critical"), QLatin1String( "exec" ), QColor(214, 26, 26)); - d->logLevels.append(d->criticalLogLevel); - - d->alertLogLevel=new LogLevel(ALERT_LOG_LEVEL_ID, i18n("Alert"), QLatin1String( "bell" ), QColor(214, 0, 0)); - d->logLevels.append(d->alertLogLevel); - - d->emergencyLogLevel=new LogLevel(EMERGENCY_LOG_LEVEL_ID, i18n("Emergency"), QLatin1String( "application-exit" ), QColor(255, 0, 0)); - d->logLevels.append(d->emergencyLogLevel); - -} - - -QList Globals::logModes() { - return d->logModes.values(); -} - -QList Globals::logLevels() { - return d->logLevels; -} - - -LogLevel* Globals::noLogLevel() { - return d->noLogLevel; -} -LogLevel* Globals::debugLogLevel() { - return d->debugLogLevel; -} -LogLevel* Globals::informationLogLevel() { - return d->informationLogLevel; -} -LogLevel* Globals::noticeLogLevel() { - return d->noticeLogLevel; -} -LogLevel* Globals::warningLogLevel() { - return d->warningLogLevel; -} -LogLevel* Globals::errorLogLevel() { - return d->errorLogLevel; -} -LogLevel* Globals::criticalLogLevel() { - return d->criticalLogLevel; -} -LogLevel* Globals::alertLogLevel() { - return d->alertLogLevel; -} -LogLevel* Globals::emergencyLogLevel() { - return d->emergencyLogLevel; -} - -void Globals::registerLogModeFactory(LogModeFactory* logModeFactory) { - QList logModes = logModeFactory->createLogModes(); - - foreach (LogMode* logMode, logModes) { - //Log mode - d->logModes.insert(logMode->id(), logMode); - } - - //Log mode Actions - LogModeAction* logModeAction = logModeFactory->createLogModeAction(); - if (logModeAction != NULL) { - d->logModeActions.append(logModeAction); - } - - delete logModeFactory; -} - -LogMode* Globals::findLogMode(const QString& logModeName) { - return d->logModes.value(logModeName); -} - -QList Globals::logModeActions() { - return d->logModeActions; -} diff --git a/ksystemlog/src/lib/globals.h b/ksystemlog/src/lib/globals.h deleted file mode 100644 index fc4003cc..00000000 --- a/ksystemlog/src/lib/globals.h +++ /dev/null @@ -1,83 +0,0 @@ -/*************************************************************************** - * 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 _GLOBALS_H_ -#define _GLOBALS_H_ - -#include -#include - -#include "logMode.h" -#include "logModeFactory.h" - - - -class LogModeFactory; - -class LogMode; -class LogModeAction; -class LogLevel; - -class Reader; - -class GlobalsPrivate; - -class Globals { - public: - static Globals* instance(); - - ~Globals(); - - QList logLevels(); - - LogLevel* noLogLevel(); - LogLevel* debugLogLevel(); - LogLevel* informationLogLevel(); - LogLevel* noticeLogLevel(); - LogLevel* warningLogLevel(); - LogLevel* errorLogLevel(); - LogLevel* criticalLogLevel(); - LogLevel* alertLogLevel(); - LogLevel* emergencyLogLevel(); - - /** - * Allow to add a new Reader for a new log mode - */ - void registerLogModeFactory(LogModeFactory* logModeFactory); - - QList logModes(); - - QList logModeActions(); - - LogMode* findLogMode(const QString& logModeName); - - private: - explicit Globals(); - - static Globals* self; - - void setupLogLevels(); - - GlobalsPrivate* const d; - -}; - -#endif diff --git a/ksystemlog/src/lib/kioLogFileReader.cpp b/ksystemlog/src/lib/kioLogFileReader.cpp deleted file mode 100644 index 3c228137..00000000 --- a/ksystemlog/src/lib/kioLogFileReader.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/*************************************************************************** - * 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 "kioLogFileReader.h" - -#include - -#include -#include - -#include - -#include "logFile.h" -#include "logging.h" - -#define READ_SIZE 10 - -class KioLogFileReaderPrivate { - -public: - - KioLogFileReaderPrivate(const LogFile& file) : - logFile(file) { - - } - - LogFile logFile; - - KIO::FileJob* fileJob; - - QString buffer; - qulonglong totalRead; - - KDirWatch* fileWatch; - -}; - -KioLogFileReader::KioLogFileReader(const LogFile& logFile) : - d(new KioLogFileReaderPrivate(logFile)) { - - d->fileJob = NULL; - d->totalRead = 0; - - d->fileWatch = new KDirWatch(this); - - connect(d->fileWatch, SIGNAL(dirty(QString)), this, SLOT(watchFile(QString))); - d->fileWatch->addFile(logFile.url().path()); - /* - d->fileWatch.setInterval(1000); - connect(& (d->fileWatch), SIGNAL(timeout()), this, SLOT(watchFile())); - */ - - logDebug() << "Starting " << logFile.url().path(); - - -} - - -KioLogFileReader::~KioLogFileReader() { - delete d; -} - -void KioLogFileReader::open() { - logDebug() << "Opening..."; - d->fileJob = KIO::open(d->logFile.url(), QIODevice::ReadOnly | QIODevice::Text); - - connect(d->fileJob, SIGNAL(open(KIO::Job*)), this, SLOT(openDone(KIO::Job*))); - connect(d->fileJob, SIGNAL(close(KIO::Job*)), this, SLOT(closeDone(KIO::Job*))); - - connect(d->fileJob, SIGNAL(data(KIO::Job*,QByteArray)), this, SLOT(dataReceived(KIO::Job*,QByteArray))); - connect(d->fileJob, SIGNAL(mimetype(KIO::Job*,QString)), this, SLOT(mimetypeReceived(KIO::Job*,QString))); - - logDebug() << "File opened."; -} - -void KioLogFileReader::close() { - d->fileJob->close(); -} - -void KioLogFileReader::openDone(KIO::Job* job) { - logDebug() << "Opening done..."; - - d->fileJob->read(READ_SIZE); - -} -void KioLogFileReader::closeDone(KIO::Job* job) { - logDebug() << "Closing done..."; -} - -void KioLogFileReader::dataReceived(KIO::Job* job, const QByteArray& data) { - if (job != d->fileJob) { - logDebug() << "Not the good job"; - return; - } - - if (data.isEmpty()) { - return; - } - - //logDebug() << "Receiving data... (" << d->totalRead << ")"; - d->buffer.append(QLatin1String( data )); - d->totalRead += data.size(); - - emitCompleteLines(); - - logDebug() << "Total read : " << d->totalRead << " of " << d->fileJob->size(); - if (d->totalRead < d->fileJob->size()) { - d->fileJob->read(READ_SIZE); - } - - //logDebug() << "Data received : " << d->buffer; - - //d->totalRead++; -} - -void KioLogFileReader::emitCompleteLines() { - - int endLinePos = d->buffer.indexOf(QLatin1String( "\n" )); - forever { - if (endLinePos==-1) - break; - - emit lineRead(d->buffer.left(endLinePos)); - - //Remove the emitted line and the end line character - d->buffer.remove(0, endLinePos+1); - - endLinePos = d->buffer.indexOf(QLatin1String( "\n" )); - } - - //If this is the end line and it does not terminate by a \n, we return it - if (d->totalRead == d->fileJob->size()) { - emit lineRead(d->buffer); - d->buffer.clear(); - - } - -} - -void KioLogFileReader::mimetypeReceived(KIO::Job* job, const QString& type) { - logDebug() << "Mimetype received " << type; -} - -void KioLogFileReader::watchFile(const QString& path) { - logDebug() << "Watch file : size : " << path; -} - -#include "moc_kioLogFileReader.cpp" diff --git a/ksystemlog/src/lib/kioLogFileReader.h b/ksystemlog/src/lib/kioLogFileReader.h deleted file mode 100644 index 2982a69c..00000000 --- a/ksystemlog/src/lib/kioLogFileReader.h +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************** - * 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 _KIO_LOG_FILE_READER_H_ -#define _KIO_LOG_FILE_READER_H_ - -#include -#include -#include - -#include "logFile.h" - -namespace KIO { - class Job; -} - -class KioLogFileReaderPrivate; - -/** - * TODO Inherits from LogFileReader - */ -class KioLogFileReader : public QObject { - - Q_OBJECT - - public: - - KioLogFileReader(const LogFile& logFile); - - virtual ~KioLogFileReader(); - - void open(); - void close(); - - signals: - void lineRead(const QString&); - - private slots: - void openDone(KIO::Job* job); - void closeDone(KIO::Job* job); - void dataReceived(KIO::Job* job, const QByteArray& data); - void mimetypeReceived(KIO::Job* job, const QString& type); - - void watchFile(const QString& path); - private: - void emitCompleteLines(); - - KioLogFileReaderPrivate* const d; -}; - -#endif // _KIO_LOG_FILE_READER_H_ diff --git a/ksystemlog/src/lib/levelPrintPage.cpp b/ksystemlog/src/lib/levelPrintPage.cpp deleted file mode 100644 index 0c318d74..00000000 --- a/ksystemlog/src/lib/levelPrintPage.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/*************************************************************************** - * 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 "levelPrintPage.h" - -#include -#include - -#include -#include -#include -#include - -#include "logLevel.h" -#include "logViewWidgetItem.h" -#include "logging.h" - -#include "globals.h" - -LevelPrintPage::LevelPrintPage(QWidget* parent) - : QWidget( parent) -{ - setWindowTitle(i18n("Log Level Printing")); - - //m_pageLayout = new QVBoxLayout(this, 3, 3); - m_pageLayout = new QVBoxLayout(this); - - m_lblChoose = new QLabel(this); - //m_lblChoose->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, m_lblChoose->sizePolicy().hasHeightForWidth() ) ); - m_lblChoose->setText( i18n( "Choose which log levels you wish to print in color." ) ); - m_pageLayout->addWidget( m_lblChoose ); - - m_btnGroup = new QButtonGroup(this); - /* - i18n("Log Levels"), - m_btnGroup->setColumnLayout(0, Qt::Vertical ); - m_btnGroup->layout()->setSpacing( 6 ); - m_btnGroup->layout()->setMargin( 11 ); - m_btnGroupLayout = new QGridLayout( m_btnGroup->layout() ); - m_btnGroupLayout->setAlignment( Qt::AlignTop ); - */ - - int row = 0, col = 0; - - foreach(LogLevel* level, Globals::instance()->logLevels()) { - - QCheckBox* button = new QCheckBox(level->name());//, m_btnGroup, 0 - - levelCheckBoxes.append(button); - m_btnGroup->addButton(button, level->id()); - m_btnGroupLayout->addWidget(button, row, col); - - logDebug() << "name: " << level->name() << " id: " << level->id(); - - row++; - if(row >= 4) { - row = 0; - col++; - } - } - - //m_pageLayout->addWidget(m_btnGroup); -} - -LevelPrintPage::~LevelPrintPage() { - // no need to delete child widgets, Qt does it all for us -} - -/* QPrinter Port: comment out as dialog page is not currently being used, so not ported - -void LevelPrintPage::getOptions( QMap& opts, bool incldef ) { - foreach(LogLevel* level, Globals::instance()->logLevels()) { - QString key = "kde-ksystemlog-print_" + level->name(); - - - QCheckBox* checkBox = static_cast(m_btnGroup->find(level->id())); - if(checkBox) { - if (checkBox->isChecked()) - opts[ key ] = "1"; - else - opts[ key ] = "0"; - } - - } -} - -void LevelPrintPage::setOptions( const QMap& opts ) { - foreach(LogLevel* level, Globals::instance()->logLevels()) { - QString key = "kde-ksystemlog-print_" + level->name(); - QString use = opts[ key ]; - - int chk = use.toInt(); - - - QCheckBox* checkBox = static_cast(m_btnGroup->find(level->id())); - if(checkBox) { - if(chk) - checkBox->setChecked(true); - else - checkBox->setChecked(false); - } - - - } -} - -*/ - -bool LevelPrintPage::isValid( QString& msg) { - return true; -} - - diff --git a/ksystemlog/src/lib/levelPrintPage.h b/ksystemlog/src/lib/levelPrintPage.h deleted file mode 100644 index 426de5fb..00000000 --- a/ksystemlog/src/lib/levelPrintPage.h +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * 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 LEVELPRINTPAGE_H -#define LEVELPRINTPAGE_H - -#include -#include - -#include -#include -#include -#include -#include - -/** - @author Bojan Djurkovic - */ -class LevelPrintPage : public QWidget { -public: - explicit LevelPrintPage(QWidget *parent = 0); - ~LevelPrintPage(); - - bool isValid(QString& msg); - -private: - QButtonGroup* m_btnGroup; - QGridLayout* m_btnGroupLayout; - QVBoxLayout* m_pageLayout; - QLabel* m_lblChoose; - QList levelCheckBoxes; -}; - -#endif diff --git a/ksystemlog/src/lib/loadingBar.cpp b/ksystemlog/src/lib/loadingBar.cpp deleted file mode 100644 index b061910a..00000000 --- a/ksystemlog/src/lib/loadingBar.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/*************************************************************************** - * 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 "loadingBar.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -class LoadingBarPrivate { -public: - //Attributes managing the position in the files loading of each log - int fileCount; - int currentFileIndex; - - bool firstLoading; - - QLabel* label; - - QProgressBar* progressBar; - -}; - -LoadingBar::LoadingBar(QWidget* parent) : - QWidget(parent), - d(new LoadingBarPrivate()) - { - - d->firstLoading = true; - - QHBoxLayout* widgetLayout = new QHBoxLayout(); - setLayout(widgetLayout); - - widgetLayout->addStretch(); - - QVBoxLayout* layout = new QVBoxLayout(); - widgetLayout->addLayout(layout); - - widgetLayout->addStretch(); - - d->label = new QLabel(i18n("Loading Progress...")); - d->label->setMinimumWidth(250); - layout->addWidget(d->label, 1, Qt::AlignBottom); - - d->progressBar = new QProgressBar(); - d->progressBar->setRange(0, 100); - d->progressBar->setMinimumWidth(250); - layout->addWidget(d->progressBar, 1, Qt::AlignCenter | Qt::AlignTop); - -} - -LoadingBar::~LoadingBar() { - delete d; -} - - -QProgressBar* LoadingBar::progressBar() { - return d->progressBar; -} - -void LoadingBar::startLoading(const LogMode& logMode, const LogFile& logFile, int fileIndex, int fileCount) { - emit displayed(true); - - d->progressBar->setValue(0); - - //Several files to load - if (fileCount>1 && fileIndex>=1) { - if (d->firstLoading) - d->label->setText(i18np("Loading %2...
%3 - (%4)", - "Loading %2...
%3 - (%4/%1 files)", - fileCount, logMode.name(), logFile.url().path(), fileIndex)); - else - d->label->setText(i18np("Reloading %2...
%3 - (%4)", - "Reloading %2...
%3 - (%4/%1 files)", - fileCount, logMode.name(), logFile.url().path(), fileIndex)); - } - //Only one file - else { - if (d->firstLoading) - d->label->setText(i18n("Loading %1...
%2", logMode.name(), logFile.url().path())); - else - d->label->setText(i18n("Reloading %1...
%2", logMode.name(), logFile.url().path())); - } - -} - -void LoadingBar::endLoading() { - emit displayed(false); - - d->progressBar->setValue(100); - - //If the endLoading has been called one time, it means it has already been loaded - d->firstLoading=false; - -} - -void LoadingBar::progressLoading() { - d->progressBar->setValue( d->progressBar->value() + 1 ); - - kapp->processEvents(); -} - -#include "moc_loadingBar.cpp" diff --git a/ksystemlog/src/lib/loadingBar.h b/ksystemlog/src/lib/loadingBar.h deleted file mode 100644 index f0676f5c..00000000 --- a/ksystemlog/src/lib/loadingBar.h +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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 _LOADING_BAR_H_ -#define _LOADING_BAR_H_ - -#include - -#include "logMode.h" -#include "logFile.h" - -#include -class LoadingBarPrivate; - -/** - * TODO Try to have a working Cancel button (for the moment, it only hide the Loading Dialog) - */ -class LoadingBar : public QWidget { - - Q_OBJECT - - public: - LoadingBar(QWidget* parent=NULL); - - ~LoadingBar(); - - QProgressBar* progressBar(); - - public slots: - - void startLoading(const LogMode& logMode, const LogFile& logFile, int fileIndex, int fileCount); - void endLoading(); - - void progressLoading(); - - signals: - void displayed(bool displayed); - - private: - LoadingBarPrivate* const d; - - -}; - -#endif // _LOADING_BAR_H_ diff --git a/ksystemlog/src/lib/localLogFileReader.cpp b/ksystemlog/src/lib/localLogFileReader.cpp deleted file mode 100644 index 41d1c180..00000000 --- a/ksystemlog/src/lib/localLogFileReader.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/*************************************************************************** - * 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 "localLogFileReader.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "logFileReader.h" -#include "logFileReaderPrivate.h" -#include "logging.h" - - -class LocalLogFileReaderPrivate : public LogFileReaderPrivate { - -public: - - KDirWatch* watch; - - long previousFilePosition; - - /** - * Mutex avoiding multiple logFileModified() calls - */ - QMutex insertionLocking; - -}; - - -LocalLogFileReader::LocalLogFileReader(const LogFile& logFile) : - LogFileReader(*new LocalLogFileReaderPrivate(), logFile) { - - init(); -} - - -LocalLogFileReader::LocalLogFileReader(LocalLogFileReaderPrivate& dd, const LogFile& logFile) : - LogFileReader(dd, logFile) { - - init(); -} - -LocalLogFileReader::~LocalLogFileReader() { - Q_D(LocalLogFileReader); - - //Delete the watching object - delete d->watch; - - //d pointer is deleted by the parent class -} - -void LocalLogFileReader::init() { - Q_D(LocalLogFileReader); - - d->watch=new KDirWatch(); - connect(d->watch, SIGNAL(dirty(QString)), this, SLOT(logFileModified())); - - //Init current file position - d->previousFilePosition = 0; - - logDebug() << "Reading local file " << d->logFile.url().path(); - -} - -void LocalLogFileReader::watchFile(bool enable) { - Q_D(LocalLogFileReader); - - if (enable == true) { - logDebug() << "Monitoring file : " << d->logFile.url().path(); - - if (d->watch->contains(d->logFile.url().path()) == false) { - d->watch->addFile(d->logFile.url().path()); - } - - //Reinit current file position - d->previousFilePosition = 0; - - //If we enable the watching, then we first try to see if new lines have appeared - logFileModified(); - } - else { - d->watch->removeFile(d->logFile.url().path()); - } -} - -QIODevice* LocalLogFileReader::open() { - Q_D(LocalLogFileReader); - - if (d->logFile.url().isValid()==false) { - QString message(i18n("This file is not valid. Please adjust it in the settings of KSystemLog.")); - emit errorOccured(i18n("File Does Not Exist"), message); - emit statusBarChanged(message); - } - - QString mimeType = KMimeType::findByFileContent( d->logFile.url().path() )->name(); - - logDebug() << d->logFile.url().path() << " : " << mimeType; - QIODevice* inputDevice; - - //Try to see if this file exists - QFile* file = new QFile(d->logFile.url().path()); - //If the file does not exist - if (! file->exists()) { - QString message(i18n("The file '%1' does not exist.", d->logFile.url().path())); - emit errorOccured(i18n("File Does Not Exist"), message); - emit statusBarChanged(message); - delete file; - return NULL; - } - - //Plain text file : we use a QFile object - if (mimeType == QLatin1String( "text/plain" ) || mimeType == QLatin1String( "application/octet-stream" )) { - logDebug() << "Using QFile input device"; - - inputDevice = file; - } - //Compressed file : we use the KFilterDev helper - else { - logDebug() << "Using KFilterDev input device"; - - const QString logFilePath = d->logFile.url().path(); - KDecompressor kdecompressor; - if (!kdecompressor.setType(KDecompressor::typeForMime(mimeType)) - && !kdecompressor.setType(KDecompressor::typeForFile(logFilePath))) { - QString message(i18n("Compressed file format is not supported '%1'.", logFilePath)); - emit errorOccured(i18n("Unable to open Compressed File"), message); - emit statusBarChanged(message); - return NULL; - } - - QFile logFileDevice(logFilePath); - if (!logFileDevice.open(QFile::ReadOnly)) { - QString message(i18n("Unable to open compressed file '%1': %2.", logFilePath, logFileDevice.errorString())); - emit errorOccured(i18n("Unable to open Compressed File"), message); - emit statusBarChanged(message); - return NULL; - } - - if (kdecompressor.process(logFileDevice.readAll())) { - QString message(i18n("Unable to uncompress '%1': '%2'.", logFilePath, kdecompressor.errorString())); - emit errorOccured(i18n("Unable to Uncompress File"), message); - emit statusBarChanged(message); - return NULL; - } - - inputDevice = new QBuffer(); - qobject_cast(inputDevice)->setData(kdecompressor.result()); - } - - if ( ! inputDevice->open( QIODevice::ReadOnly ) ) { - QString message(i18n("You do not have sufficient permissions to read '%1'.", d->logFile.url().path())); - emit errorOccured(i18n("Insufficient Permissions"), message); - emit statusBarChanged(message); - delete inputDevice; - return NULL; - } - - return inputDevice; -} - -void LocalLogFileReader::close(QIODevice* inputDevice) { - inputDevice->close(); - delete inputDevice; -} - -QStringList LocalLogFileReader::readContent(QIODevice* inputDevice) { - logDebug() << "Retrieving raw buffer..."; - - Q_D(LocalLogFileReader); - - QStringList rawBuffer; - - QTextStream inputStream(inputDevice); - while (inputStream.atEnd() == false) { - rawBuffer.append(inputStream.readLine()); - } - - logDebug() << "Raw buffer retrieved."; - - //Get the size file for the next calculation - d->previousFilePosition = inputDevice->size(); - logDebug() << "New file position : " << d->previousFilePosition << " (" << d->logFile.url().path() << ")"; - - return rawBuffer; -} - -void LocalLogFileReader::logFileModified() { - Q_D(LocalLogFileReader); - - logDebug() << "Locking log file modification..."; - if (d->insertionLocking.tryLock() == false) { - logDebug() << "Log file modification already detected."; - return; - } - - QIODevice* inputDevice = open(); - if (inputDevice == NULL) { - logError() << "Could not open file " << d->logFile.url().path(); - return; - } - - //If there are new lines in the file, insert only them or this is the first time we read this file - if (d->previousFilePosition!=0 && d->previousFilePosition <= inputDevice->size()) { - logDebug() << "Reading from position " << d->previousFilePosition << " (" << d->logFile.url().path() << ")"; - - if (inputDevice->isSequential()) { - logError() << "The file current position could not be modified"; - } - else { - //Place the cursor to the last line opened - inputDevice->seek(d->previousFilePosition); - } - - logDebug() << "Retrieving a part of the file..."; - - emit contentChanged(this, Analyzer::UpdatingRead, readContent(inputDevice)); - - } - //Else reread all lines, clear log list - else { - logDebug() << "New file or file truncated. (Re-)Loading log file"; - - emit contentChanged(this, Analyzer::FullRead, readContent(inputDevice)); - - } - - close(inputDevice); - - logDebug() << "Unlocking log file modification..."; - d->insertionLocking.unlock(); -} - -#include "moc_localLogFileReader.cpp" diff --git a/ksystemlog/src/lib/localLogFileReader.h b/ksystemlog/src/lib/localLogFileReader.h deleted file mode 100644 index 22edf693..00000000 --- a/ksystemlog/src/lib/localLogFileReader.h +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * 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 _LOCAL_LOG_FILE_READER_H_ -#define _LOCAL_LOG_FILE_READER_H_ - -#include -#include - -#include "logFile.h" - -#include "logFileReader.h" - - -class LocalLogFileReaderPrivate; - -class LocalLogFileReader : public LogFileReader { - - Q_OBJECT - - public: - - LocalLogFileReader(const LogFile& logFile); - - virtual ~LocalLogFileReader(); - - void watchFile(bool enable); - - void setPreviousFilePosition(long previousFilePosition); - - private slots: - void logFileModified(); - - private: - void init(); - - QIODevice* open(); - void close(QIODevice* inputDevice); - - QStringList readContent(QIODevice* inputDevice); - - protected: - LocalLogFileReader(LocalLogFileReaderPrivate& dd, const LogFile& logFile); - - private: - Q_DECLARE_PRIVATE(LocalLogFileReader) - -}; - -#endif // _LOCAL_LOG_FILE_READER_H_ diff --git a/ksystemlog/src/lib/logFile.cpp b/ksystemlog/src/lib/logFile.cpp deleted file mode 100644 index b025cd1c..00000000 --- a/ksystemlog/src/lib/logFile.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/*************************************************************************** - * 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 "logFile.h" - - -#include "logging.h" - -class LogFilePrivate { - -public: - KUrl url; - - LogLevel* defaultLogLevel; - -}; - -LogFile::LogFile() : - d(new LogFilePrivate()) { - //Nothing to do -} - -LogFile::LogFile(const LogFile& logFile) : - QObject(), - d(new LogFilePrivate()) { - - d->url = logFile.url(); - d->defaultLogLevel = logFile.defaultLogLevel(); -} - -LogFile::LogFile(const KUrl& url, LogLevel* defaultLogLevel) : - d(new LogFilePrivate()) { - - d->url = url; - d->defaultLogLevel = defaultLogLevel; -} - -LogFile::~LogFile() { - //defaultLogLevel is managed by Globals - - delete d; -} - -bool LogFile::operator==(const LogFile& other) { - if (d->url == other.url() && d->defaultLogLevel == other.defaultLogLevel()) - return true; - - return false; -} - -LogFile& LogFile::operator=(const LogFile& logFile) { - d->url = logFile.url(); - d->defaultLogLevel = logFile.defaultLogLevel(); - - return *this; -} - -KUrl LogFile::url() const { - return d->url; -} - -LogLevel* LogFile::defaultLogLevel() const { - return d->defaultLogLevel; -} - -QDataStream& operator<< (QDataStream& out, const LogFile& logFile) { - out << logFile.url().path(); - return out; -} - -QDebug& operator<< (QDebug& out, const LogFile& logFile) { - out << logFile.url().path(); - return out; -} - -#include "moc_logFile.cpp" diff --git a/ksystemlog/src/lib/logFile.h b/ksystemlog/src/lib/logFile.h deleted file mode 100644 index c7bfa8d8..00000000 --- a/ksystemlog/src/lib/logFile.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * 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 _LOG_FILE_H_ -#define _LOG_FILE_H_ - -#include -#include -#include - -#include - -class LogLevel; - -class LogFilePrivate; - -class LogFile : public QObject { - - Q_OBJECT - - public: - LogFile(); - - LogFile(const LogFile& logFile); - LogFile(const KUrl& url, LogLevel* defaultLogLevel); - - virtual ~LogFile(); - - bool operator==(const LogFile& other); - - LogFile& operator=(const LogFile& column); - - KUrl url() const; - - LogLevel* defaultLogLevel() const; - - private: - LogFilePrivate* const d; -}; - -QDataStream & operator<< (QDataStream& out, const LogFile& column); -QDebug & operator<< (QDebug& out, const LogFile& column); - -#endif // _LOG_FILE_H_ diff --git a/ksystemlog/src/lib/logFileReader.cpp b/ksystemlog/src/lib/logFileReader.cpp deleted file mode 100644 index 36a86092..00000000 --- a/ksystemlog/src/lib/logFileReader.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * 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 "logFileReader.h" - -#include "logFileReaderPrivate.h" - -#include "logging.h" - -LogFileReader::LogFileReader(const LogFile& logFile) : - d_ptr(new LogFileReaderPrivate) { - - Q_D(LogFileReader); - d->logFile = logFile; - -} - -LogFileReader::LogFileReader(LogFileReaderPrivate& dd, const LogFile& logFile) : - d_ptr(&dd) { - - Q_D(LogFileReader); - d->logFile = logFile; - -} - -LogFileReader::~LogFileReader() { - delete d_ptr; -} - -LogFile LogFileReader::logFile() const { - //const LogFileReaderPrivate * const d = d_func(); - Q_D(const LogFileReader); - return d->logFile; -} - -#include "moc_logFileReader.cpp" diff --git a/ksystemlog/src/lib/logFileReader.h b/ksystemlog/src/lib/logFileReader.h deleted file mode 100644 index 11d9719b..00000000 --- a/ksystemlog/src/lib/logFileReader.h +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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 _LOG_FILE_READER_H_ -#define _LOG_FILE_READER_H_ - -#include -#include -#include - -#include "analyzer.h" -#include "logFile.h" - -class LogFileReaderPrivate; - -class LogFileReader : public QObject { - - Q_OBJECT - - public: - - LogFileReader(const LogFile& logFile); - - virtual ~LogFileReader(); - - virtual void watchFile(bool enable) = 0; - - LogFile logFile() const; - - signals: - void contentChanged(LogFileReader* origin, Analyzer::ReadingMode readingMode, const QStringList& newLines); - - void statusBarChanged(const QString& message); - void errorOccured(const QString& title, const QString& message); - - protected: - LogFileReaderPrivate* const d_ptr; - LogFileReader(LogFileReaderPrivate& dd, const LogFile& logFile); - - private: - Q_DECLARE_PRIVATE(LogFileReader) - -}; - -#endif // _LOG_FILE_READER_H_ diff --git a/ksystemlog/src/lib/logFileReaderPrivate.h b/ksystemlog/src/lib/logFileReaderPrivate.h deleted file mode 100644 index be7dd5dd..00000000 --- a/ksystemlog/src/lib/logFileReaderPrivate.h +++ /dev/null @@ -1,37 +0,0 @@ -/*************************************************************************** - * 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 _LOG_FILE_READER_PRIVATE_H_ -#define _LOG_FILE_READER_PRIVATE_H_ - -#include "logFile.h" - -class LogFileReaderPrivate { - -public: - virtual ~LogFileReaderPrivate() { - - } - - LogFile logFile; -}; - -#endif // _LOG_FILE_READER_PRIVATE_H_ diff --git a/ksystemlog/src/lib/logLevel.cpp b/ksystemlog/src/lib/logLevel.cpp deleted file mode 100644 index db3c389b..00000000 --- a/ksystemlog/src/lib/logLevel.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************** - * 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 "logLevel.h" - -#include - -class LogLevelPrivate { -public: - int id; - QString name; - - QString icon; - - QColor color; - - QPixmap pixmap; - -}; - - -LogLevel::LogLevel(int id, const QString& nm, const QString& ic, const QColor& col) : - d(new LogLevelPrivate()) { - - d->id = id; - d->name = nm; - d->icon = ic; - d->color = col; - d->pixmap = SmallIcon(ic); - -} - - -LogLevel::~LogLevel() { - delete d; -} - -int LogLevel::id() { - return d->id; -} - -QString LogLevel::name() { - return d->name; -} - -QString LogLevel::icon() { - return d->icon; -} - -QColor LogLevel::color() { - return d->color; -} - -QPixmap LogLevel::pixmap() { - return d->pixmap; -} diff --git a/ksystemlog/src/lib/logLevel.h b/ksystemlog/src/lib/logLevel.h deleted file mode 100644 index ed28540c..00000000 --- a/ksystemlog/src/lib/logLevel.h +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * 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 _LOG_LEVEL_H_ -#define _LOG_LEVEL_H_ - -#include -#include -#include - -class LogLevelPrivate; - -class LogLevel { - - public: - explicit LogLevel(int id, const QString& name, const QString& icon, const QColor& color); - - virtual ~LogLevel(); - - int id(); - QString name(); - - QString icon(); - - QColor color(); - - QPixmap pixmap(); - - private: - LogLevelPrivate* const d; -}; - - -#endif diff --git a/ksystemlog/src/lib/logLine.cpp b/ksystemlog/src/lib/logLine.cpp deleted file mode 100644 index d1cb0d11..00000000 --- a/ksystemlog/src/lib/logLine.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/*************************************************************************** - * 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 "logLine.h" - -#include -#include - -#include "logMode.h" -#include "logModeItemBuilder.h" -#include "logViewWidgetItem.h" - -#include "logging.h" -#include "globals.h" -#include "ksystemlogConfig.h" - -class LogLinePrivate { -public: - - long internalId; - - QDateTime time; - - QStringList logItems; - - QString originalFile; - - LogLevel* logLevel; - - LogMode* logMode; - - bool recent; - - LogViewWidgetItem* item; - -}; - -LogLine::LogLine( - long internalId, - const QDateTime& dateTime, - const QStringList& logItems, - const QString& file, - LogLevel* logLevel, - LogMode* logMode) : - - d(new LogLinePrivate()) { - - d->internalId = internalId; - d->time=dateTime; - d->logItems = logItems; - d->originalFile = file; - d->logLevel = logLevel; - d->logMode = logMode; - - //No linked item when constructs this LogLine - d->item = NULL; - - //By default in newly created item has the recent state - setRecent(true); - -} - -LogLine::~LogLine() { - //logLevel is managed by Globals - - //item is managed by LogMode - //itemBuilder is managed by LogMode - - delete d; -} - - -LogMode* LogLine::logMode() const { - return d->logMode; -} - -void LogLine::setLogMode(LogMode* logMode) { - d->logMode = logMode; -} - -bool LogLine::equals(const LogLine& other) const { - if (logMode()->id() != other.logMode()->id()) - return false; - - if (time() != other.time()) - return false; - - if (logLevel()->id() != other.logLevel()->id()) - return false; - - if (d->logItems != other.d->logItems) - return false; - - return true; -} - -LogLevel* LogLine::logLevel() const { - return d->logLevel; -} - -void LogLine::setLogLevel(LogLevel* level) { - d->logLevel=level; -} - -QDateTime LogLine::time() const { - return d->time; -} - -void LogLine::setLogItems(const QStringList& logItems) { - d->logItems = logItems; -} - -QStringList LogLine::logItems() const { - return d->logItems; -} - -QString LogLine::sourceFileName() const { - return d->originalFile; -} - -bool LogLine::isOlderThan(const LogLine& other) const { - if (d->time == other.time()) - return d->internalId < other.internalId(); - - return d->time < other.time(); -} - -bool LogLine::isNewerThan(const LogLine& other) const { - if (d->time == other.time()) - return d->internalId > other.internalId(); - - return d->time > other.time(); -} - -bool LogLine::isSameTime(const LogLine& other) const { - return d->time==other.time(); -} - -long LogLine::internalId() const { - return d->internalId; -} - -void LogLine::setRecent(bool recent) { - d->recent = recent; - - if (d->item!=NULL) { - QFont currentFont = d->item->font(d->item->columnCount()-1); - - //We avoid doing the same process - if (d->recent != currentFont.bold()) { - currentFont.setBold(recent); - d->item->setFont(d->item->columnCount()-1, currentFont); - } - } -} - - -QString LogLine::exportToText() const { - - QString exporting; - - if (d->item == NULL) { - logError() << "Trying to export text from NULL item"; - return exporting; - } - - for (int i=0; i < d->item->columnCount(); ++i) { - if (i>0) - exporting.append(QLatin1Char( '\t' )); - - exporting.append(d->item->text(i)); - } - - return exporting; -} - -QString LogLine::formattedText() { - return d->logMode->itemBuilder()->createFormattedText(this); -} - -void LogLine::setItem(LogViewWidgetItem* item) { - d->item = item; - - initializeItem(); -} - -void LogLine::initializeItem() { - d->logMode->itemBuilder()->prepareItem(d->item); - - //Call methods that change the look of the item - setRecent(d->recent); - - if (KSystemLogConfig::colorizeLogLines()) { - //Last column index = d->logItems.count() = (d->logItems.count() -1) +1 (the date column) - d->item->setForeground(d->logItems.count(), QBrush(d->logLevel->color())); - } - - d->item->toggleToolTip(KSystemLogConfig::tooltipEnabled()); - -} diff --git a/ksystemlog/src/lib/logLine.h b/ksystemlog/src/lib/logLine.h deleted file mode 100644 index e62ab179..00000000 --- a/ksystemlog/src/lib/logLine.h +++ /dev/null @@ -1,92 +0,0 @@ -/*************************************************************************** - * 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 LOG_LINE_H -#define LOG_LINE_H - -#include -#include - -#include - -#include "globals.h" - -#include "logLevel.h" - -class LogViewWidget; -#include -#include -class LogViewWidgetItem; - -class LogLinePrivate; - -class LogLine { - - public: - LogLine( - long internalId, - const QDateTime& dateTime, - const QStringList& logItems, - const QString& originalFile, - LogLevel* level, - LogMode* logMode - ); - - virtual ~LogLine(); - - bool isOlderThan(const LogLine& other) const; - bool isNewerThan(const LogLine& other) const; - - bool equals(const LogLine& other) const; - - bool isSameTime(const LogLine& other) const; - - LogLevel* logLevel() const; - - long internalId() const; - QDateTime time() const; - QStringList logItems() const; - QString sourceFileName() const; - - LogMode* logMode() const; - - bool itemExists() const; - - void setLogItems(const QStringList& logItems); - void setLogLevel(LogLevel* level); - void setLogMode(LogMode* logMode); - - void setRecent(bool recent); - void setItem(LogViewWidgetItem* item); - - QString formattedText(); - - QString exportToText() const; - - protected: - LogLinePrivate* const d; - - private: - void initializeItem(); - -}; - -#endif diff --git a/ksystemlog/src/lib/logManager.cpp b/ksystemlog/src/lib/logManager.cpp deleted file mode 100644 index e352ff4e..00000000 --- a/ksystemlog/src/lib/logManager.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/*************************************************************************** - * 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 "logManager.h" - -#include - -#include - -#include "logging.h" -#include "analyzer.h" -#include "view.h" - -#include "logViewWidget.h" - -#include "loadingBar.h" - -class LogManagerPrivate { - friend class LogManager; - - QTime lastUpdate; - - LogMode* logMode; - - Analyzer* analyzer; - View* usedView; - -}; - -LogManager::LogManager(View* view) : - d(new LogManagerPrivate()) - { - - d->lastUpdate = QTime::currentTime(); - - d->logMode = NULL; - d->analyzer = NULL; - - d->usedView = view; - connect(d->usedView, SIGNAL(droppedUrls(KUrl::List)), this, SLOT(loadDroppedUrls(KUrl::List))); -} - -LogManager::~LogManager() { - cleanPreviousLogMode(); - - //usedView is managed by MainWindow - //logMode is managed by Globals - - delete d; -} - -View* LogManager::usedView() const { - return d->usedView; -} - -void LogManager::reload() { - if (d->logMode == NULL) { - logWarning() << "Log manager is not yet initialized"; - return; - } - - logDebug() << "Reloading with log mode " << d->logMode->name() << "..."; - - emit statusBarChanged(i18n("Loading log...")); - - // Change part of the main interface - emit tabTitleChanged(d->usedView, d->logMode->icon(), d->logMode->name()); - emit windowTitleChanged(d->logMode->name()); - - logDebug() << "Emptying view..."; - - // Empty the current list, to better fill it - d->usedView->logViewWidget()->model()->clear(); - - logDebug() << "Initializing view..."; - - // Init the Log View - logDebug() << "Initializing columns view..."; - - d->usedView->logViewWidget()->setColumns(d->analyzer->initColumns()); - - logDebug() << "Reading log..."; - - // Read the log files - d->analyzer->watchLogFiles(true); - - emit statusBarChanged(i18n("Log successfully loaded.")); - - // Log List has been totally reloaded - emit reloaded(); - - logDebug() << "Log mode " << d->logMode->name() << " reloaded"; - -} - -LogMode* LogManager::logMode() { - return d->logMode; -} - -const QTime& LogManager::lastUpdate() const { - return d->lastUpdate; -} - -void LogManager::updateLog(int lineCount) { - logDebug() << "Updating log " << lineCount << " new lines"; - - if (lineCount==0) - return; - - d->lastUpdate = QTime::currentTime(); - - emit logUpdated(d->usedView, lineCount); -} - -void LogManager::cleanPreviousLogMode() { - logDebug() << "Cleaning previous LogMode..."; - - d->logMode = NULL; - - delete d->analyzer; - d->analyzer = NULL; -} - -void LogManager::initialize(LogMode* mode) { - internalInitialize(mode, mode->createLogFiles()); -} - -void LogManager::internalInitialize(LogMode* mode, const QList& logFiles) { - logDebug() << "Initializing LogManager..."; - - logDebug() << "Using files" << logFiles; - - cleanPreviousLogMode(); - - //Use the new mode - d->logMode=mode; - - //Find the Analyzer instance used for this new mode - d->analyzer=mode->createAnalyzer(); - d->analyzer->setLogViewModel(d->usedView->logViewWidget()->model()); - - connect(d->analyzer, SIGNAL(statusBarChanged(QString)), this, SIGNAL(statusBarChanged(QString))); - connect(d->analyzer, SIGNAL(errorOccured(QString,QString)), this, SLOT(showErrorMessage(QString,QString))); - connect(d->analyzer, SIGNAL(logUpdated(int)), this, SLOT(updateLog(int))); - - connect(d->analyzer, SIGNAL(readFileStarted(LogMode,LogFile,int,int)), d->usedView->loadingBar(), SLOT(startLoading(LogMode,LogFile,int,int))); - connect(d->analyzer, SIGNAL(openingProgressed()), d->usedView->loadingBar(), SLOT(progressLoading())); - connect(d->analyzer, SIGNAL(readEnded()), d->usedView->loadingBar(), SLOT(endLoading())); - - //Find the log files used for this kind of mode, and set them to our log manager - d->analyzer->setLogFiles(logFiles); - - logDebug() << "LogManager initialized"; - -} - -void LogManager::showErrorMessage(const QString& title, const QString& message) { - KMessageBox::error( - d->usedView, - message, - title, - KMessageBox::Notify - ); -} - -void LogManager::setParsingPaused(bool paused) { - if (d->logMode == NULL) { - logWarning() << "Log manager is not yet initialized"; - return; - } - - d->analyzer->setParsingPaused(paused); -} - -bool LogManager::isParsingPaused() const { - if (d->logMode == NULL) { - logWarning() << "Log manager is not yet initialized"; - return false; - } - - return d->analyzer->isParsingPaused(); -} - -void LogManager::loadDroppedUrls(const KUrl::List& urls) { - logDebug() << "Drop " << urls; - - QList logFiles; - - foreach (const KUrl &url, urls) { - logFiles.append(LogFile(url, Globals::instance()->informationLogLevel())); - } - - if (logFiles.isEmpty() == false) { - internalInitialize(Globals::instance()->findLogMode(QLatin1String( "openLogMode" )), logFiles); - - reload(); - } -} - -#include "moc_logManager.cpp" diff --git a/ksystemlog/src/lib/logManager.h b/ksystemlog/src/lib/logManager.h deleted file mode 100644 index f68a3187..00000000 --- a/ksystemlog/src/lib/logManager.h +++ /dev/null @@ -1,91 +0,0 @@ -/*************************************************************************** - * 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 LOG_MANAGER_H -#define LOG_MANAGER_H - -#include - -#include - -#include "globals.h" - -#include "logMode.h" -#include "logFile.h" - -#include "logViewModel.h" -#include "logViewColumns.h" - -class View; - - -class LogManagerPrivate; - -class LogManager : public QObject { - Q_OBJECT - - public: - - explicit LogManager(View* view); - - ~LogManager(); - - View* usedView() const; - - const QTime& lastUpdate() const; - - LogMode* logMode(); - - void initialize(LogMode* mode); - - void setParsingPaused(bool paused); - bool isParsingPaused() const; - - void reload(); - - protected slots: - - void updateLog(int lineCount); - - void showErrorMessage(const QString& title, const QString& message); - - signals: - void tabTitleChanged(View* view, const QIcon& icon, const QString& label); - - void windowTitleChanged(const QString& caption); - void statusBarChanged(const QString& message); - - void reloaded(); - void logUpdated(View* view, int addedLines); - - private slots: - void loadDroppedUrls(const KUrl::List& urls); - - private: - void internalInitialize(LogMode* mode, const QList& logFiles); - - void cleanPreviousLogMode(); - - LogManagerPrivate* d; - -}; - -#endif //LOG_MANAGER_H diff --git a/ksystemlog/src/lib/logMode.cpp b/ksystemlog/src/lib/logMode.cpp deleted file mode 100644 index 837564d6..00000000 --- a/ksystemlog/src/lib/logMode.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/*************************************************************************** - * 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 "logMode.h" - -#include - -#include - -#include "multipleActions.h" -#include "logModeItemBuilder.h" - -LogMode::LogMode(const QString& id, const QString& name, const QString& iconName) : - d(new LogModePrivate()) { - - d->id = id; - d->name = name; - d->icon = SmallIcon(iconName); -} - -LogMode::~LogMode() { - delete d->action; - - delete d->itemBuilder; - - delete d; -} - -QString LogMode::id() const { - return d->id; -} - -QString LogMode::name() const { - return d->name; -} - -QPixmap LogMode::icon() const { - return d->icon; -} - -QAction* LogMode::action() const { - return d->action; -} - -LogModeItemBuilder* LogMode::itemBuilder() const { - return d->itemBuilder; -} - -LogModeConfigurationWidget* LogMode::logModeConfigurationWidget() const { - return d->logModeConfigurationWidget; -} - -LogModeConfiguration* LogMode::innerConfiguration() const { - return d->logModeConfiguration; -} - -QAction* LogMode::createDefaultAction() { - QAction* action = new QAction(d->icon, d->name, this); - action->setData(QVariant(d->id)); - - return action; -} - -#include "moc_logMode.cpp" diff --git a/ksystemlog/src/lib/logMode.h b/ksystemlog/src/lib/logMode.h deleted file mode 100644 index 13e161b7..00000000 --- a/ksystemlog/src/lib/logMode.h +++ /dev/null @@ -1,112 +0,0 @@ -/*************************************************************************** - * 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 LOG_MODE_H -#define LOG_MODE_H - -#include -#include -#include -#include - -#include "logFile.h" - -class Analyzer; -class LogModeItemBuilder; -class LogModeConfiguration; -class LogModeConfigurationWidget; - -#include - - -//TODO Do not let this class visible to other classes (except sub-classes) -class LogModePrivate { -public: - QString id; - - QString name; - - QString iconName; - - QPixmap icon; - - QAction* action; - - LogModeItemBuilder* itemBuilder; - - LogModeConfigurationWidget* logModeConfigurationWidget; - - LogModeConfiguration* logModeConfiguration; -}; - -class LogMode : public QObject { - - Q_OBJECT - - public: - LogMode(const QString& id, const QString& name, const QString& iconName); - - virtual ~LogMode(); - - QString id() const; - - QString name() const; - - QPixmap icon() const; - - QAction* action() const; - - LogModeItemBuilder* itemBuilder() const; - - /** - * Log mode configuration widget - */ - LogModeConfigurationWidget* logModeConfigurationWidget() const; - - template - T logModeConfiguration() { - return static_cast( innerConfiguration() ); - } - /** - * Create the Analyzer used to parse the log file - */ - virtual Analyzer* createAnalyzer() = 0; - - /** - * Create the log file list which will be read - */ - virtual QList createLogFiles() = 0; - - protected: - QAction* createDefaultAction(); - - LogModePrivate* const d; - - private: - /** - * Log Mode Configuration - */ - LogModeConfiguration* innerConfiguration() const; - -}; - - -#endif //LOG_MODE_H diff --git a/ksystemlog/src/lib/logModeAction.cpp b/ksystemlog/src/lib/logModeAction.cpp deleted file mode 100644 index e4f58662..00000000 --- a/ksystemlog/src/lib/logModeAction.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************** - * 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 "logModeAction.h" - -class LogModeActionPrivate { -public: - bool inToolBar; - - LogModeAction::Category category; -}; - -LogModeAction::LogModeAction() : - d(new LogModeActionPrivate()) { - - d->inToolBar = true; - d->category = LogModeAction::RootCategory; -} - -LogModeAction::~LogModeAction() { - delete d; -} - -void LogModeAction::setInToolBar(bool inToolBar) { - d->inToolBar = inToolBar; -} - -bool LogModeAction::isInToolBar() { - return d->inToolBar; -} - -void LogModeAction::setCategory(LogModeAction::Category category) { - d->category = category; -} - -LogModeAction::Category LogModeAction::category() { - return d->category; -} diff --git a/ksystemlog/src/lib/logModeAction.h b/ksystemlog/src/lib/logModeAction.h deleted file mode 100644 index bd0ac8ff..00000000 --- a/ksystemlog/src/lib/logModeAction.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * 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 _LOG_MODE_ACTION_H_ -#define _LOG_MODE_ACTION_H_ - -#include -#include -#include - -class LogModeActionPrivate; - -class LogModeAction : public QObject { - - Q_OBJECT - -public: - - enum Category { - RootCategory, - ServicesCategory, - OthersCategory - }; - Q_DECLARE_FLAGS(Categories, Category) - - LogModeAction(); - - virtual ~LogModeAction(); - - virtual QList innerActions() = 0; - - virtual QAction* actionMenu() = 0; - - void setInToolBar(bool inToolBar); - - bool isInToolBar(); - - void setCategory(Category category); - - Category category(); - -private: - LogModeActionPrivate* const d; - -}; - -#endif // _LOG_MODE_ACTION_H_ diff --git a/ksystemlog/src/lib/logModeConfiguration.cpp b/ksystemlog/src/lib/logModeConfiguration.cpp deleted file mode 100644 index b224b466..00000000 --- a/ksystemlog/src/lib/logModeConfiguration.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/*************************************************************************** - * 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 "logModeConfiguration.h" - -#include "logging.h" -#include "defaults.h" - -#include -#include - -#include "logFile.h" -#include "logLevel.h" - -#include "globals.h" - -#include "ksystemlogConfig.h" - -LogModeConfiguration::LogModeConfiguration() { - configuration = KSystemLogConfig::self(); -} - -LogModeConfiguration::~LogModeConfiguration() { - //configuration is managed by KDE -} - -//TODO Need a rewritting -/* -Reader* ReaderFactory::createReader(LogMode* logMode) { - - //Using Boot Mode in the current view - else if (logMode==Globals::bootMode) { - Reader* reader=new SystemReader(NULL, "boot_reader"); - return(reader); - } - - //Using Authentication Mode in the current view - else if (logMode==Globals::authenticationMode) { - Reader* reader=new SystemReader(NULL, "authentication_reader"); - return(reader); - } - - //Using Daemon Mode in the current view - else if (logMode==Globals::daemonMode) { - Reader* reader=new SystemReader(NULL, "daemon_reader"); - return(reader); - } - - //Using Cups Mode in the current view - else if (logMode==Globals::cupsMode) { - Reader* reader=new CupsReader(NULL, "cups_reader"); - return(reader); - } - - //Using Cups Access Mode in the current view - else if (logMode==Globals::cupsAccessMode) { - Reader* reader=new CupsAccessReader(NULL, "cups_access_reader"); - return(reader); - } - - //Using Postfix Mode in the current view - else if (logMode==Globals::postfixMode) { - Reader* reader=new SystemReader(NULL, "postfix_reader"); - return(reader); - } - - //Using Samba Mode in the current view - else if (logMode==Globals::sambaMode) { - Reader* reader=new SambaReader(NULL, "samba_reader"); - return(reader); - } - - //Using SSH Mode in the current view - else if (logMode==Globals::sshMode) { - Reader* reader=new SSHReader(NULL, "ssh_reader"); - return(reader); - } - - //Using X Session Mode in the current view - else if (logMode==Globals::xsessionMode) { - Reader* reader=new XSessionReader(NULL, "xsession_reader"); - return reader; - } - - logError() << "LogMode not found : returns NULL Reader"; - return NULL; -} -*/ - -//TODO Move this method in LogModeFactory subclasses -/* -QList LogFilesFactory::createLogFiles(LogMode* logMode) { - - else if (logMode==Globals::instance()->bootMode()) { - QList list; - list.append(LogFilesFactory::instance()->getBootLogFile()); - return list; - } - - else if (logMode==Globals::instance()->authenticationMode()) { - QList list; - list.append(LogFilesFactory::instance()->getAuthenticationLogFile()); - return list; - } - - else if (logMode==Globals::instance()->daemonMode()) { - return LogFilesFactory::getDaemonLogFiles(); - } - - else if (logMode==Globals::instance()->cupsMode()) { - return LogFilesFactory::getCupsLogFiles(); - } - - else if (logMode==Globals::instance()->cupsAccessMode()) { - return LogFilesFactory::getCupsAccessLogFiles(); - - } - - else if (logMode==Globals::instance()->postfixMode()) { - return LogFilesFactory::getPostfixLogFiles(); - } - - else if (logMode==Globals::instance()->sambaMode()) { - return LogFilesFactory::getSambaLogFiles(); - } - - else if (logMode==Globals::instance()->sshMode()) { - return LogFilesFactory::getSSHLogFiles(); - } - - - else if (logMode==Globals::instance()->xsessionMode()) { - return LogFilesFactory::getXSessionLogFiles(); - } - - logError() << "LogFiles not found : returns NULL Reader"; - - return QList(); - -} - - -LogFile LogFilesFactory::getBootLogFile() { - QString file=KSystemLogConfig::bootPath(); - return getGenericLogFile(file); -} - -LogFile LogFilesFactory::getAuthenticationLogFile() { - QString file=KSystemLogConfig::authenticationPath(); - return getGenericLogFile(file); -} - -QList LogFilesFactory::getDaemonLogFiles() { - QStringList files=KSystemLogConfig::daemonPaths(); - QList levels=KSystemLogConfig::daemonLevels(); - return LogFilesFactory::getGenericLogFiles(files, levels); -} - -QList LogFilesFactory::getCupsLogFiles() { - QStringList stringList=KSystemLogConfig::cupsPaths(); - return getNoModeLogFiles(stringList); -} - -QList LogFilesFactory::getCupsAccessLogFiles() { - QStringList stringList=KSystemLogConfig::cupsAccessPaths(); - return getNoModeLogFiles(stringList); -} - -QList LogFilesFactory::getPostfixLogFiles() { - QStringList files=KSystemLogConfig::postfixPaths(); - QList levels=KSystemLogConfig::postfixLevels(); - return LogFilesFactory::getGenericLogFiles(files, levels); -} - -QList LogFilesFactory::getSambaLogFiles() { - QStringList stringList=KSystemLogConfig::sambaPaths(); - return getNoModeLogFiles(stringList); -} - -QList LogFilesFactory::getSSHLogFiles() { - QStringList stringList=KSystemLogConfig::sshPaths(); - return getNoModeLogFiles(stringList); -} - -QList LogFilesFactory::getXSessionLogFiles() { - QStringList stringList=KSystemLogConfig::xSessionPaths(); - return getNoModeLogFiles(stringList); -} - -*/ - - -LogFile LogModeConfiguration::findGenericLogFile(const QString& file) { - - LogLevel* level=Globals::instance()->informationLogLevel(); - - KUrl url(file); - if (!url.isValid()) { - logWarning() << i18n("URL '%1' is not valid, skipping this URL.", url.path()); - return LogFile(KUrl(), Globals::instance()->noLogLevel()); - } - - return LogFile(url, level); -} - -QList LogModeConfiguration::findGenericLogFiles(const QStringList& files) { - QList logFiles; - - foreach(const QString &file, files) { - logFiles.append(findGenericLogFile(file)); - } - - return logFiles; -} - -QList LogModeConfiguration::findNoModeLogFiles(const QStringList& stringList) { - - QList logFiles; - - //Default level used for No Mode logs - LogLevel* level=Globals::instance()->noLogLevel(); - - foreach (const QString &string, stringList) { - - KUrl url(string); - if (!url.isValid()) { - logWarning() << i18n("URL '%1' is not valid, skipping this URL.", url.path()); - continue; - } - - logFiles.append(LogFile(url, level)); - - } - - return logFiles; -} - -#include "moc_logModeConfiguration.cpp" diff --git a/ksystemlog/src/lib/logModeConfiguration.h b/ksystemlog/src/lib/logModeConfiguration.h deleted file mode 100644 index 79341044..00000000 --- a/ksystemlog/src/lib/logModeConfiguration.h +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * 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 _LOG_MODE_CONFIGURATION_H_ -#define _LOG_MODE_CONFIGURATION_H_ - -#include -#include -#include - -#include "logFile.h" - - -class KSystemLogConfig; - -class LogModeConfiguration : public QObject { - - Q_OBJECT - - public: - LogModeConfiguration(); - - virtual ~LogModeConfiguration(); - - LogFile findGenericLogFile(const QString& file); - QList findGenericLogFiles(const QStringList& files); - - QList findNoModeLogFiles(const QStringList& stringList); - - protected: - KSystemLogConfig* configuration; -}; - -#endif // _LOG_MODE_CONFIGURATION_H_ diff --git a/ksystemlog/src/lib/logModeConfigurationWidget.cpp b/ksystemlog/src/lib/logModeConfigurationWidget.cpp deleted file mode 100644 index 7872136a..00000000 --- a/ksystemlog/src/lib/logModeConfigurationWidget.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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 "logModeConfigurationWidget.h" - -class LogModeConfigurationWidgetPrivate { -public: - QString itemName; - QString iconName; - QString header; -}; - -LogModeConfigurationWidget::LogModeConfigurationWidget(const QString& itemName, const QString& iconName, const QString& header) : - QWidget(), - d(new LogModeConfigurationWidgetPrivate()) - { - - d->itemName = itemName; - d->iconName = iconName; - d->header = header; -} - - -LogModeConfigurationWidget::~LogModeConfigurationWidget() { - delete d; -} - -QString LogModeConfigurationWidget::itemName() const { - return d->itemName; -} -QString LogModeConfigurationWidget::iconName() const { - return d->iconName; -} -QString LogModeConfigurationWidget::header() const { - return d->header; -} - -/** - * Default implementation - */ -bool LogModeConfigurationWidget::isValid() const { - return true; -} - -#include "moc_logModeConfigurationWidget.cpp" diff --git a/ksystemlog/src/lib/logModeConfigurationWidget.h b/ksystemlog/src/lib/logModeConfigurationWidget.h deleted file mode 100644 index 954a6b48..00000000 --- a/ksystemlog/src/lib/logModeConfigurationWidget.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - * 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 _LOG_MODE_CONFIGURATION_WIDGET_H_ -#define _LOG_MODE_CONFIGURATION_WIDGET_H_ - -#include -#include - -class LogModeConfigurationWidgetPrivate; - -class LogModeConfigurationWidget : public QWidget { - - Q_OBJECT - - public: - LogModeConfigurationWidget(const QString& itemName, const QString& iconName, const QString& header); - - virtual ~LogModeConfigurationWidget(); - - virtual bool isValid() const; - - virtual void saveConfig() = 0; - virtual void defaultConfig() = 0; - virtual void readConfig() = 0; - - signals: - void configurationChanged(); - - public: - QString itemName() const; - QString iconName() const; - QString header() const; - - private: - - LogModeConfigurationWidgetPrivate* const d; -}; - -#endif // _LOG_MODE_CONFIGURATION_WIDGET_H_ diff --git a/ksystemlog/src/lib/logModeFactory.cpp b/ksystemlog/src/lib/logModeFactory.cpp deleted file mode 100644 index 35d5f0f1..00000000 --- a/ksystemlog/src/lib/logModeFactory.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/*************************************************************************** - * 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 "logModeFactory.h" - -#include "logging.h" - -LogModeFactory::LogModeFactory() { - -} - - -LogModeFactory::~LogModeFactory() { - -} - - -#include "moc_logModeFactory.cpp" diff --git a/ksystemlog/src/lib/logModeFactory.h b/ksystemlog/src/lib/logModeFactory.h deleted file mode 100644 index 5d09c52e..00000000 --- a/ksystemlog/src/lib/logModeFactory.h +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * 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 _LOG_MODE_FACTORY_H_ -#define _LOG_MODE_FACTORY_H_ - -#include -#include - -class LogModeAction; -class LogMode; - -class LogModeFactory : public QObject { - - Q_OBJECT - - public: - explicit LogModeFactory(); - - virtual ~LogModeFactory(); - - virtual LogModeAction* createLogModeAction() const = 0; - - /** - * Create the log mode - */ - virtual QList createLogModes() const = 0; - -}; - - -#endif // _LOG_MODE_FACTORY_H_ - diff --git a/ksystemlog/src/lib/logModeItemBuilder.cpp b/ksystemlog/src/lib/logModeItemBuilder.cpp deleted file mode 100644 index 5e760244..00000000 --- a/ksystemlog/src/lib/logModeItemBuilder.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/*************************************************************************** - * 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 "logModeItemBuilder.h" - -#include -#include - -#include "logging.h" - -#include "logLine.h" -#include "logViewWidgetItem.h" -#include "logMode.h" - -#include "ksystemlogConfig.h" - -LogModeItemBuilder::LogModeItemBuilder() { - -} - -LogModeItemBuilder::~LogModeItemBuilder() { - -} - -QString LogModeItemBuilder::formatDate(const QDateTime& dateTime) const { - return KGlobal::locale()->formatDateTime(dateTime, (KLocale::DateFormat) KSystemLogConfig::dateFormat(), true); -} - -void LogModeItemBuilder::prepareItem(LogViewWidgetItem* item) const { - LogLine* line=item->logLine(); - - item->setText(0, formatDate(line->time())); - - int i=1; - foreach(const QString &label, line->logItems()) { - item->setText(i, label); - i++; - } - - item->setIcon(0, line->logLevel()->pixmap()); -} - -QString LogModeItemBuilder::createFormattedText(LogLine* line) const { - QString result; - - QListIterator it(line->logItems()); - - result.append(QLatin1String( "" )); - - result.append(labelMessageFormat(i18n("Date:"), formatDate(line->time()))); - result.append(labelMessageFormat(i18n("Hostname:"), it.next() )); - result.append(labelMessageFormat(i18n("Process:"), it.next() )); - result.append(labelMessageFormat(i18n("Level:"), line->logLevel()->name())); - result.append(labelMessageFormat(i18n("Original file:"), line->sourceFileName())); - - result.append(QLatin1String( "
" )); - - return result; - -} - -QString LogModeItemBuilder::createToolTipText(LogLine* line) const { - QString result; - - result.append(QLatin1String( "" )); - - result.append(labelMessageFormat(i18n("Date:"), formatDate(line->time()))); - result.append(labelMessageFormat(i18n("Level:"), line->logLevel()->name())); - result.append(labelMessageFormat(i18n("Original file:"), line->sourceFileName())); - - result.append(QLatin1String( "
" )); - - return result; -} - - -QString LogModeItemBuilder::labelMessageFormat(const QString& label, const QString& value) const { - return (QLatin1String( "" ) + label + QLatin1String( "" ) + messageFormat(value) + QLatin1String( "" )); -} - -QString LogModeItemBuilder::messageFormat(const QString& message) const { - QString transformation(message); - transformation.replace(QRegExp(QLatin1String( "&" )), QLatin1String( "&" )); - transformation.replace(QRegExp(QLatin1String( "<" )), QLatin1String( "<" )); - transformation.replace(QRegExp(QLatin1String( ">" )), QLatin1String( ">" )); - return transformation; -} diff --git a/ksystemlog/src/lib/logModeItemBuilder.h b/ksystemlog/src/lib/logModeItemBuilder.h deleted file mode 100644 index 1222d1bf..00000000 --- a/ksystemlog/src/lib/logModeItemBuilder.h +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * 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 _LOG_MODE_ITEM_BUILDER_H_ -#define _LOG_MODE_ITEM_BUILDER_H_ - -#include -#include - -class LogViewWidgetItem; -class LogLine; - -class LogModeItemBuilder { - - public: - LogModeItemBuilder(); - - virtual ~LogModeItemBuilder(); - - virtual void prepareItem(LogViewWidgetItem* item) const; - - virtual QString createFormattedText(LogLine* line) const; - virtual QString createToolTipText(LogLine* line) const; - - protected: - QString labelMessageFormat(const QString& label, const QString& value) const; - QString messageFormat(const QString& message) const; - - QString formatDate(const QDateTime& dateTime) const; - -}; - -#endif // _LOG_MODE_ITEM_BUILDER_H_ diff --git a/ksystemlog/src/lib/logViewColumn.cpp b/ksystemlog/src/lib/logViewColumn.cpp deleted file mode 100644 index 45ed168a..00000000 --- a/ksystemlog/src/lib/logViewColumn.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * 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 "logViewColumn.h" - - -#include -#include - - -#include -#include -#include - -class LogViewColumnPrivate { -public: - QString columnName; - - bool filtered; - bool grouped; - -}; - -LogViewColumn::LogViewColumn(const QString& name, bool filtered, bool grouped) : - d(new LogViewColumnPrivate()) { - - d->columnName = name; - d->filtered = filtered; - d->grouped = grouped; -} - -LogViewColumn::LogViewColumn(const LogViewColumn& column) : - d(new LogViewColumnPrivate()) { - - d->columnName = column.columnName(); - d->filtered = column.isFiltered(); - d->grouped = column.isGrouped(); -} - -LogViewColumn::~LogViewColumn() { - delete d; -} - -QString LogViewColumn::columnName() const { - return d->columnName; -} - -bool LogViewColumn::isGrouped() const { - return d->grouped; -} -bool LogViewColumn::isFiltered() const { - return d->filtered; -} - -LogViewColumn& LogViewColumn::operator=(const LogViewColumn& column) { - d->columnName = column.columnName(); - d->grouped = column.isGrouped(); - d->filtered = column.isFiltered(); - - return *this; -} - -QDataStream& operator<< (QDataStream& out, const LogViewColumn& column) { - out << column.columnName(); - return out; -} - -QDebug& operator<< (QDebug& out, const LogViewColumn& column) { - out << column.columnName(); - return out; -} diff --git a/ksystemlog/src/lib/logViewColumn.h b/ksystemlog/src/lib/logViewColumn.h deleted file mode 100644 index cdce8a2f..00000000 --- a/ksystemlog/src/lib/logViewColumn.h +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************** - * 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 LOG_VIEW_COLUMN_H -#define LOG_VIEW_COLUMN_H - -#include -#include -#include - -#include "globals.h" - -class LogViewColumnPrivate; - -class LogViewColumn { - - public: - LogViewColumn(const LogViewColumn& column); - - /* - * TODO For the moment, filtered and grouped parameters are useless : Use them or remove them - */ - explicit LogViewColumn(const QString& name, bool filtered=true, bool grouped=true); - - virtual ~LogViewColumn(); - - QString columnName() const; - bool isGrouped() const; - bool isFiltered() const; - - LogViewColumn& operator=(const LogViewColumn& column); - - private: - LogViewColumnPrivate* const d; - -}; - -QDataStream & operator<< (QDataStream& out, const LogViewColumn& column); -QDebug & operator<< (QDebug& out, const LogViewColumn& column); - -#endif //LOG_VIEW_COLUMN_H diff --git a/ksystemlog/src/lib/logViewColumns.cpp b/ksystemlog/src/lib/logViewColumns.cpp deleted file mode 100644 index 431a81a3..00000000 --- a/ksystemlog/src/lib/logViewColumns.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/*************************************************************************** - * 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 "logViewColumns.h" - -#include -#include - -#include "logging.h" -#include - -#include "globals.h" -#include "logViewColumn.h" - -class LogViewColumnsPrivate { -public: - - QList columns; - bool groupByLogLevel; - bool groupByDay; - bool groupByHour; - bool groupByLogFile; - -}; - -LogViewColumns::LogViewColumns() : - d(new LogViewColumnsPrivate()) { - - d->groupByLogLevel = true; - d->groupByDay = true; - d->groupByHour = true; - d->groupByLogFile = true; - - -} - -LogViewColumns::~LogViewColumns() { - delete d; -} - -void LogViewColumns::setGroupByLogLevel(bool value) { - d->groupByLogLevel=value; -} - -void LogViewColumns::setGroupByDay(bool value) { - d->groupByDay=value; -} - -void LogViewColumns::setGroupByHour(bool value) { - d->groupByHour=value; -} - -void LogViewColumns::setGroupByLogFile(bool value) { - d->groupByLogFile=value; -} - - -bool LogViewColumns::isGroupByLogLevel() const { - return d->groupByLogLevel; -} - -bool LogViewColumns::isGroupByDay() const { - return d->groupByDay; -} - -bool LogViewColumns::isGroupByHour() const { - return d->groupByHour; -} - -bool LogViewColumns::isGroupByLogFile() const { - return d->groupByLogFile; -} - -QStringList LogViewColumns::toStringList() const { - QStringList columnNames; - - foreach (const LogViewColumn& column, d->columns) { - columnNames.append(column.columnName()); - } - - return columnNames; -} - -void LogViewColumns::addColumn(const LogViewColumn& column) { - d->columns.append(column); -} - -QList LogViewColumns::columns() const { - return d->columns; -} - -LogViewColumns& LogViewColumns::operator=(const LogViewColumns& columns) { - d->columns = columns.columns(); - d->groupByLogLevel = columns.isGroupByLogLevel(); - d->groupByDay = columns.isGroupByDay(); - d->groupByHour = columns.isGroupByHour(); - d->groupByLogFile = columns.isGroupByLogFile(); - - return *this; -} - -QDataStream & operator<< (QDataStream& out, const LogViewColumns& columns) { - out << columns.columns(); - return out; -} -QDebug & operator<< (QDebug& out, const LogViewColumns& columns) { - out << columns.columns(); - return out; -} diff --git a/ksystemlog/src/lib/logViewColumns.h b/ksystemlog/src/lib/logViewColumns.h deleted file mode 100644 index 6f19765f..00000000 --- a/ksystemlog/src/lib/logViewColumns.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * 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 _LOG_VIEW_COLUMNS_H_ -#define _LOG_VIEW_COLUMNS_H_ - -#include -#include - -class LogViewColumn; -#include -class LogViewColumnsPrivate; - -class LogViewColumns { - - public: - LogViewColumns(); - - ~LogViewColumns(); - - bool isGroupByLogLevel() const; - bool isGroupByDay() const; - bool isGroupByHour() const; - bool isGroupByLogFile() const; - - void setGroupByLogLevel(bool value); - void setGroupByDay(bool value); - void setGroupByHour(bool value); - void setGroupByLogFile(bool value); - - QList columns() const; - - void addColumn(const LogViewColumn& column); - QStringList toStringList() const; - - LogViewColumns& operator=(const LogViewColumns& columns); - - private: - LogViewColumnsPrivate* const d; - -}; - - -QDataStream & operator<< (QDataStream& out, const LogViewColumns& columns); -QDebug & operator<< (QDebug& out, const LogViewColumns& columns); - -#endif diff --git a/ksystemlog/src/lib/logViewExport.cpp b/ksystemlog/src/lib/logViewExport.cpp deleted file mode 100644 index d667d371..00000000 --- a/ksystemlog/src/lib/logViewExport.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/*************************************************************************** - * 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 "logViewExport.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "logging.h" - -#include "logViewWidgetItem.h" -#include "logViewWidget.h" -#include "logLine.h" - -#include "levelPrintPage.h" - -LogViewExport::LogViewExport(QWidget* parent, LogViewWidget* logViewWidget) : - parent(parent), logViewWidget(logViewWidget) { - -} - -LogViewExport::~LogViewExport() { - -} - -void LogViewExport::sendMail() { - logDebug() << "Exporting to mail..."; - - QString body(i18n("Here are my logs:\n")); - - body+=i18n("---------------------------------------\n"); - - int i=0; - QTreeWidgetItemIterator it(logViewWidget, QTreeWidgetItemIterator::Selected); - while ( *it != NULL) { - LogViewWidgetItem* item=static_cast (*it); - - body+= item->logLine()->exportToText(); - body+=QLatin1Char( '\n' ); - - ++it; - ++i; - } - - body+=i18n("---------------------------------------\n"); - - //Too much lines selected - if (i>1000) { - KMessageBox::sorry(parent, i18n("You have selected too many lines. Please only select important log lines."), i18n("Too Many Lines Selected")); - return; - } - - // Parameters list of this method - //const QString & to, - //const QString & cc, - //const QString & subject, - //const QString & body, - //const QStringList & attachURLs, - //const QCString & startup_id - KToolInvocation::invokeMailer(QLatin1String( "" ), QLatin1String( "" ), i18n("Log Lines of my problem"), body, QStringList(), kapp->startupId()); -} - -void LogViewExport::printSelection() { - logDebug() << "Printing selection..."; - - QPrinter printer; - - // do some printer initialization - printer.setFullPage( true); - - /* - LevelPrintPage* dialogPage = new LevelPrintPage(parent); - printer.addDialogPage(dialogPage); - */ - - // initialize the printer using the print dialog - QPrintDialog *printDialog = KdePrint::createPrintDialog(&printer, parent); - if (printDialog->exec() == false) { - delete printDialog; - return; - } - delete printDialog; - - // create a painter to paint on the printer object - QPainter painter; - - // start painting - painter.begin( &printer ); - - QPen originalPen(painter.pen()); - - int dpiy = painter.device()->logicalDpiY(); - int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins - QRect printView(margin, margin, painter.device()->width() - 2*margin, painter.device()->height() - 2*margin ); - - int page = 1; - - int i = 0; - int movement = 0; - - QTreeWidgetItemIterator it(logViewWidget, QTreeWidgetItemIterator::Selected); - while ( *it != NULL) { - LogViewWidgetItem* item=static_cast (*it); - - /* - if(qtItem==NULL) - { - painter.setPen(originalPen); - printPageNumber(painter, printView, movement, page); - break; - }*/ - - QString body = item->logLine()->exportToText(); - //body+= "\n"; - - /* QPrinter Port: comment out as dialog page is not currently being used, so not ported - QString strUseColor = printer.option("kde-ksystemlog-print_"+ item->logLine()->logLevel()->name()); - int use = strUseColor.toInt(); - if (use) { - QPen pen(originalPen); - pen.setColor(item->logLine()->logLevel()->color()); - painter.setPen(pen); - } else {*/ - painter.setPen(originalPen); - //} - - painter.drawText(printView, Qt::AlignLeft | Qt::TextWordWrap, body); - - int fontHeight = painter.fontMetrics().height(); - int lines = painter.fontMetrics().width(body) / printView.width() + 1; - int moveBy = (fontHeight + 2) * lines; - painter.translate(0, moveBy); - - movement = movement + moveBy; - if (movement + margin >= printView.height()) { - painter.setPen(originalPen); - printPageNumber(painter, printView, movement, page); - printer.newPage(); - page++; - movement = 0; - } - - ++it; - ++i; - } - - // stop painting, this will automatically send the print data to the printer - painter.end(); - -} - -void LogViewExport::printPageNumber(QPainter& painter, QRect& printView, int movement, int page) { - logDebug() << "Printing page number..."; - - painter.translate(0, -movement); - printView.moveTo(QPoint(0, printView.height()) ); - painter.translate( 0, -printView.height() ); - painter.drawText(printView.right() - painter.fontMetrics().width(QString::number(page) ), printView.bottom()+ painter.fontMetrics().ascent() + 5, QString::number(page) ); - -} - -void LogViewExport::copyToClipboard() { - logDebug() << "Copying to clipboard..."; - - int nbCopied=0; - QString text; - - QTreeWidgetItemIterator it(logViewWidget, QTreeWidgetItemIterator::Selected); - while ( *it != NULL) { - LogViewWidgetItem* item=static_cast (*it); - - //Copy the item content to the text string - text.append(item->logLine()->exportToText()); - text.append(QLatin1Char( '\n' )); - - it++; - nbCopied++; - - } - - //Copy text value only if it is not empty - if (nbCopied==0) { - emit statusBarChanged(i18n("No items selected. Nothing copied to clipboard.")); - } else { - //Copy both to clipboard and X11-selection - QApplication::clipboard()->setText(text, QClipboard::Clipboard); - QApplication::clipboard()->setText(text, QClipboard::Selection); - - emit statusBarChanged(i18np("1 log line copied to clipboard.", "%1 log lines copied to clipboard.", nbCopied)); - } - - logDebug() << "Copied " << nbCopied << " log lines"; - -} - -void LogViewExport::fileSave() { - logDebug() << "Saving to a file..."; - - QTreeWidgetItemIterator it(logViewWidget, QTreeWidgetItemIterator::Selected); - - //No item selected - if ( *it == NULL) { - emit statusBarChanged(i18n("No items selected. Please select items to be able to save them.")); - return; - } - - QString filename = KFileDialog::getSaveFileName(KUrl(), QString(), parent); - if (filename.isEmpty() == true) { - return; - } - - QFile* ioDev = new QFile(filename); - if (ioDev->open(QIODevice::WriteOnly)) { - QTextStream stream(ioDev); - - int nbCopied=0; - - while ( *it != NULL) { - LogViewWidgetItem* item=static_cast (*it); - - //Copy the item content to the stream - stream << item->logLine()->exportToText() << '\n'; - - //Retrieve the next item - it++; - nbCopied++; - - } - - ioDev->close(); - - delete ioDev; - - emit statusBarChanged(i18np("1 log line saved to '%2'.", "%1 log lines saved to '%2'.", nbCopied, filename)); - } - else { - QString message(i18n("Unable to save file '%1': Permission Denied.", filename)); - KMessageBox::error(parent, message, i18n("Unable to save file.")); - } - - -} - -#include "moc_logViewExport.cpp" diff --git a/ksystemlog/src/lib/logViewExport.h b/ksystemlog/src/lib/logViewExport.h deleted file mode 100644 index ec804575..00000000 --- a/ksystemlog/src/lib/logViewExport.h +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************** - * 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 _LOG_VIEW_EXPORT_H_ -#define _LOG_VIEW_EXPORT_H_ - -#include -#include -#include - -class LogViewWidget; - -class LogViewExport : public QObject { - - Q_OBJECT - - public: - LogViewExport(QWidget* parent, LogViewWidget* logViewWidget); - - virtual ~LogViewExport(); - - void copyToClipboard(); - - void fileSave(); - - void sendMail(); - - void printSelection(); - - signals: - void statusBarChanged(const QString& message); - - private: - - void printPageNumber(QPainter& painter, QRect& printView, int movement, int page); - - QWidget* parent; - - LogViewWidget* logViewWidget; -}; - - -#endif //_LOG_VIEW_EXPORT_H_ diff --git a/ksystemlog/src/lib/logViewFilterWidget.cpp b/ksystemlog/src/lib/logViewFilterWidget.cpp deleted file mode 100644 index a8c016b7..00000000 --- a/ksystemlog/src/lib/logViewFilterWidget.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/*************************************************************************** - * 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 "logViewFilterWidget.h" - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "logViewWidget.h" - -#include "logViewColumn.h" -#include "logging.h" - - -class LogViewFilterWidgetPrivate { -public: - - LogViewWidgetSearchLine* filterLine; - - /** - * Filter of the column list - */ - KComboBox* filterList; - -}; - - -LogViewWidgetSearchLine::LogViewWidgetSearchLine() : - KTreeWidgetSearchLine() { - -} - -LogViewWidgetSearchLine::~LogViewWidgetSearchLine() { - -} - -void LogViewWidgetSearchLine::updateSearch(const QString& pattern) { - KTreeWidgetSearchLine::updateSearch(pattern); - - emit treeWidgetUpdated(); -} - - -LogViewFilterWidget::LogViewFilterWidget() : - d(new LogViewFilterWidgetPrivate()) { - - - QHBoxLayout* filterBarLayout = new QHBoxLayout(); - filterBarLayout->setMargin(0); - //filterBarLayout->setSpacing(-1); - setLayout(filterBarLayout); - - d->filterLine = new LogViewWidgetSearchLine(); - - d->filterLine->setToolTip(i18n("Type your filter here")); - d->filterLine->setWhatsThis(i18n("Allows you to only list items that match the content of this text.")); - d->filterLine->setClickMessage(i18n("Enter your search here...")); - - QLabel* filterIcon = new QLabel(); - filterIcon->setPixmap(SmallIcon(QLatin1String( "view-filter" ))); - filterIcon->setBuddy(d->filterLine); - filterBarLayout->addWidget(filterIcon); - - QLabel* filterLabel = new QLabel(i18n("Filter:")); - filterLabel->setBuddy(d->filterLine); - filterBarLayout->addWidget(filterLabel); - - filterBarLayout->addWidget(d->filterLine); - - initSearchListFilter(); - - filterBarLayout->addWidget(d->filterList); - -} - -LogViewFilterWidget::~LogViewFilterWidget() { - delete d; -} - - -void LogViewFilterWidget::initSearchListFilter() { - d->filterList=new KComboBox(); - - d->filterList->setToolTip(i18n("Choose the filtered column here")); - d->filterList->setWhatsThis(i18n("Allows you to apply the item filter only on the specified column here. \"All\" column means no specific filter.")); - - d->filterList->addItem(i18n("All")); - - d->filterList->setSizeAdjustPolicy(QComboBox::AdjustToContents); - - connect(d->filterList, SIGNAL(activated(int)), d->filterLine, SLOT(setFocus())); - connect(d->filterList, SIGNAL(activated(int)), this, SLOT(changeColumnFilter(int))); - connect(d->filterList, SIGNAL(activated(int)), d->filterLine, SLOT(updateSearch())); - -} - -void LogViewFilterWidget::updateFilterColumns(const LogViewColumns& columns) { - logDebug() << "Changing columns..."; - - //We first delete all items - d->filterList->clear(); - - //Then we insert the default items - d->filterList->addItem(i18n("All")); - - foreach(const LogViewColumn& column, columns.columns()) { - if (column.isFiltered()==true) { - d->filterList->addItem(column.columnName()); - } - } - - d->filterList->setCurrentIndex(0); -} - -void LogViewFilterWidget::changeColumnFilter(int column) { - //The user select all columns - if (column==0) { - logDebug() << "Searching on all columns"; - - d->filterLine->setSearchColumns(QList()); - return; - } - - logDebug() << "Searching on " << d->filterList->currentIndex() << " column"; - - QList filterColumns; - //currentIndex() - 1 to do not count the "All" columns item - filterColumns.append(d->filterList->currentIndex() - 1); - - d->filterLine->setSearchColumns(filterColumns); - -} - -KComboBox* LogViewFilterWidget::filterList() { - return d->filterList; -} - -LogViewWidgetSearchLine* LogViewFilterWidget::filterLine() { - return d->filterLine; -} - -#include "moc_logViewFilterWidget.cpp" diff --git a/ksystemlog/src/lib/logViewFilterWidget.h b/ksystemlog/src/lib/logViewFilterWidget.h deleted file mode 100644 index f26ec0df..00000000 --- a/ksystemlog/src/lib/logViewFilterWidget.h +++ /dev/null @@ -1,87 +0,0 @@ -/*************************************************************************** - * 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 LOG_VIEW_FILTER_WIDGET_H -#define LOG_VIEW_FILTER_WIDGET_H - -#include - -#include - -#include "logViewColumns.h" - -class LogViewWidget; -class LogViewWidgetSearchLine; -class KComboBox; - -class LogViewFilterWidgetPrivate; - -class LogViewFilterWidget : public QWidget { - - Q_OBJECT - -public: - LogViewFilterWidget(); - - ~LogViewFilterWidget(); - - KComboBox* filterList(); - LogViewWidgetSearchLine* filterLine(); - -public slots: - void updateFilterColumns(const LogViewColumns& list); - -private slots: - void changeColumnFilter(int column); - -signals: - void treeWidgetUpdated(); - -private: - void initSearchListFilter(); - - LogViewFilterWidgetPrivate* const d; - - -}; - - -class LogViewWidgetSearchLine : public KTreeWidgetSearchLine { - - Q_OBJECT - -public: - LogViewWidgetSearchLine(); - - ~LogViewWidgetSearchLine(); - -public: - /** - * Reimplemented just to send a signal _AFTER_ the tree updating - */ - void updateSearch(const QString& pattern = QString()); - -signals: - void treeWidgetUpdated(); - -}; - -#endif //LOG_VIEW_FILTER_WIDGET_H diff --git a/ksystemlog/src/lib/logViewModel.cpp b/ksystemlog/src/lib/logViewModel.cpp deleted file mode 100644 index 8bc8326d..00000000 --- a/ksystemlog/src/lib/logViewModel.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/*************************************************************************** - * 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 "logViewModel.h" - - -#include "view.h" -#include "logLine.h" - -#include "logViewWidgetItem.h" -#include "logViewWidget.h" -#include "logModeItemBuilder.h" - -#include "logging.h" - -#include "ksystemlogConfig.h" - -class LogViewModelPrivate { -public: - - LogViewWidget* logViewWidget; - - LogViewWidgetItem* oldestItem; - - int concurrentMultipleInsertions; - -}; - -LogViewModel::LogViewModel(LogViewWidget* logViewWidget) : - QObject(logViewWidget), - d(new LogViewModelPrivate()) - { - - d->logViewWidget = logViewWidget; - d->oldestItem = NULL; - - d->concurrentMultipleInsertions = 0; - -} - -LogViewModel::~LogViewModel() { - delete d; -} - - -bool LogViewModel::logLineAlreadyExists(LogLine* line) const { - LogViewWidgetItem* item = d->logViewWidget->findItem(line); - if (item!=NULL) - return true; - - return false; -} - -QList LogViewModel::logLines() { - return d->logViewWidget->logLines(); -} - -int LogViewModel::itemCount() const { - return d->logViewWidget->itemCount(); -} - -bool LogViewModel::isEmpty() const { - if (d->logViewWidget->itemCount() == 0) - return true; - - return false; -} - -void LogViewModel::removeRecentStatusOfLogLines() { - //The older lines are no longer recent - foreach(LogViewWidgetItem* item, d->logViewWidget->items()) { - item->logLine()->setRecent(false); - } -} - - -void LogViewModel::startingMultipleInsertions(Analyzer::ReadingMode /*readingMode*/) { - bool hasLocked = false; - - //Check the lock before adding this as locker - if (lockMultipleInsertions() == true) { - hasLocked = true; - } - - //Add a lock - d->concurrentMultipleInsertions++; - - if (hasLocked == true) { - logDebug() << "Starting multiple insertions..."; - - emit( processingMultipleInsertions(true) ); - - d->logViewWidget->setUpdatesEnabled(false); - - //Remove all recent states of previous log lines - removeRecentStatusOfLogLines(); - } - -} - -void LogViewModel::endingMultipleInsertions(Analyzer::ReadingMode readingMode, int insertedLogLineCount) { - //Remove a lock - d->concurrentMultipleInsertions--; - - if (lockMultipleInsertions() == true) { - logDebug() << "Ending multiple insertions..."; - - //Scroll to the newest item if some lines have been added - if (insertedLogLineCount>0) { - d->logViewWidget->scrollToNewestItem(); - } - - if (readingMode == Analyzer::FullRead) { - d->logViewWidget->resizeColumns(); - } - - logDebug() << "Enabling log view widget refresh..."; - d->logViewWidget->setUpdatesEnabled(true); - - emit( processingMultipleInsertions(false) ); - } -} - -bool LogViewModel::lockMultipleInsertions() { - if (d->concurrentMultipleInsertions == 0) { - return true; - } - - //Debug messages - if (d->concurrentMultipleInsertions > 0) { - logDebug() << "Existing multiple insertions request is still active"; - } - else if (d->concurrentMultipleInsertions < 0) { - logError() << "Existing multiple insertions forgot to call this method"; - } - - return false; -} - -bool LogViewModel::isProcessingMultipleInsertions() const { - if (d->concurrentMultipleInsertions == 0) - return false; - else - return true; -} - -void LogViewModel::clear() { - d->logViewWidget->clear(); - - //Reinit Oldest item - d->oldestItem = NULL; -} - -bool LogViewModel::isNewer(LogLine* newLine) const { - //No element in the list in this case - if (d->oldestItem==NULL) - return true; - - if (newLine->isNewerThan( *(d->oldestItem->logLine()) ) ) - return true; - - return false; -} - -void LogViewModel::removeOldestLogLine() { - //logDebug() << "Removing oldest log line"; - - if (isEmpty()==true) { - return; - } - - if (d->oldestItem==NULL) { - logWarning() << "Oldest item is null"; - return; - } - - //Remove the oldest item from the list - d->logViewWidget->takeTopLevelItem(d->logViewWidget->indexOfTopLevelItem(d->oldestItem)); - - delete d->oldestItem; - d->oldestItem = NULL; - - //Find the next oldest item - foreach(LogViewWidgetItem* item, d->logViewWidget->items()) { - if (d->oldestItem==NULL) { - d->oldestItem = item; - continue; - } - - if (d->oldestItem->logLine()->isNewerThan( *(item->logLine()) )) { - d->oldestItem = item; - } - } -} - -void LogViewModel::insert(LogLine* line) { - //The item is automatically added to the LogViewWidget - LogViewWidgetItem* item = new LogViewWidgetItem(d->logViewWidget, line); - - //Update the oldest item - if (d->oldestItem==NULL) { - d->oldestItem = item; - } - else if (d->oldestItem->logLine()->isNewerThan(*line)) { - d->oldestItem = item; - } -} - -bool LogViewModel::insertNewLogLine(LogLine* line) { - //If the Delete Duplicated Line option is checked - if (KSystemLogConfig::deleteDuplicatedLines()==true) { - if (logLineAlreadyExists(line)==true) { - delete line; - return false; - } - } - - //If there is still space in the buffer - if (itemCount()logItems(); - - return false; -} - -#include "moc_logViewModel.cpp" diff --git a/ksystemlog/src/lib/logViewModel.h b/ksystemlog/src/lib/logViewModel.h deleted file mode 100644 index f9e465e0..00000000 --- a/ksystemlog/src/lib/logViewModel.h +++ /dev/null @@ -1,95 +0,0 @@ -/*************************************************************************** - * 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 _LOG_VIEW_MODEL_H_ -#define _LOG_VIEW_MODEL_H_ - -#include - -#include "globals.h" -#include "analyzer.h" - -class LogLine; -class LogViewWidget; - -class LogViewModelPrivate; - -class LogViewModel : public QObject { - - Q_OBJECT - - public: - LogViewModel(LogViewWidget* logViewWidget); - - virtual ~LogViewModel(); - - /** - * Clear the model - */ - void clear(); - - bool insertNewLogLine(LogLine* line); - - int itemCount() const; - bool isEmpty() const; - - bool isProcessingMultipleInsertions() const; - - void startingMultipleInsertions(Analyzer::ReadingMode readingMode); - void endingMultipleInsertions(Analyzer::ReadingMode readingMode, int insertedLogLineCount); - - QList logLines(); - - signals: - void processingMultipleInsertions(bool currentlyInserting); - - private: - /** - * Prevent crossed multiple insertions between each LogFileReaders - */ - bool lockMultipleInsertions(); - - void setFirstReadProcessed(); - - bool logLineAlreadyExists(LogLine* line) const; - - bool isNewer(LogLine* line) const; - - /** - * Remove the oldest line - */ - void removeOldestLogLine(); - - /** - * Insert this line - */ - void insert(LogLine* line); - - /** - * Remove recent status on previously new log lines - */ - void removeRecentStatusOfLogLines(); - - LogViewModelPrivate* const d; - -}; - -#endif //_LOG_VIEW_MODEL_H_ diff --git a/ksystemlog/src/lib/logViewSearchWidget.cpp b/ksystemlog/src/lib/logViewSearchWidget.cpp deleted file mode 100644 index 8caea73a..00000000 --- a/ksystemlog/src/lib/logViewSearchWidget.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/*************************************************************************** - * 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 "logViewSearchWidget.h" - -#include -#include -#include -#include -#include -#include - - -#include -#include -#include - -#include "logging.h" -#include "logViewWidget.h" -#include "logViewWidgetItem.h" - -class LogViewSearchWidgetPrivate { -public: - - LogViewWidget* logViewWidget; - - QColor searchLineBaseColor; - QColor searchLineTextColor; - - QTimer* messageHidingTimer; -}; - -LogViewSearchWidget::LogViewSearchWidget() : - d(new LogViewSearchWidgetPrivate()) { - - d->logViewWidget = NULL; - - setupUi(this); - - //Get the searchLine base color to be able to restore it later - d->searchLineBaseColor = searchLine->palette().color(QPalette::Base); - d->searchLineTextColor = searchLine->palette().color(QPalette::Text); - - //Default configuration of the hiding message timer - d->messageHidingTimer = new QTimer(this); - d->messageHidingTimer->setSingleShot(true); - d->messageHidingTimer->setInterval(2000); - connect(d->messageHidingTimer, SIGNAL(timeout()), this, SLOT(hideMessage())); - - //The message widget is hidden by default - hideMessage(); - - closeButton->setIcon(KIcon( QLatin1String( "dialog-close" ))); - connect(closeButton, SIGNAL(clicked()), this, SLOT(hide())); - - next->setIcon(KIcon( QLatin1String( "arrow-down" ))); - connect(next, SIGNAL(clicked()), this, SLOT(findNext())); - - previous->setIcon(KIcon( QLatin1String( "arrow-up" ))); - connect(previous, SIGNAL(clicked()), this, SLOT(findPrevious())); - - searchLabel->setBuddy(searchLine); - - connect(searchLine, SIGNAL(textEdited(QString)), this, SLOT(findFirst(QString))); - connect(searchLine, SIGNAL(textEdited(QString)), this, SLOT(highlightAll())); - - connect(searchLine, SIGNAL(returnPressed()), this, SLOT(findNext())); - - connect(caseSensitive, SIGNAL(clicked()), this, SLOT(findFirst())); - - connect(caseSensitive, SIGNAL(clicked()), this, SLOT(highlightAll())); - connect(highlightAllButton, SIGNAL(clicked()), this, SLOT(highlightAll())); - - findFirst(searchLine->text()); - -} - -LogViewSearchWidget::~LogViewSearchWidget() { - //widgets and timer are automatically deleted by Qt - - delete d; -} - - -void LogViewSearchWidget::displaySearch() { - searchLine->setFocus(); - searchLine->setSelection(0, searchLine->text().length()); - show(); -} - -void LogViewSearchWidget::setTreeWidget(LogViewWidget* logViewWidget) { - d->logViewWidget = logViewWidget; -} - -void LogViewSearchWidget::findFirst(const QString & text) { - bool textIsNotEmpty = !text.isEmpty(); - next->setEnabled(textIsNotEmpty); - previous->setEnabled(textIsNotEmpty); - if(textIsNotEmpty) - findFirst(); -} - -void LogViewSearchWidget::findFirst() { - internalFind(NULL, LogViewSearchWidget::Next); -} - -void LogViewSearchWidget::findNext() { - logDebug() << "Finding next"; - - LogViewWidgetItem* lastSelectedItem = d->logViewWidget->lastSelectedItem(); - internalFind(lastSelectedItem, LogViewSearchWidget::Next); -} - -void LogViewSearchWidget::findPrevious() { - logDebug() << "Finding previous"; - - LogViewWidgetItem* firstSelectedItem = d->logViewWidget->firstSelectedItem(); - internalFind(firstSelectedItem, LogViewSearchWidget::Previous); -} - -void LogViewSearchWidget::internalFind(LogViewWidgetItem* fromItem, Direction direction) { - if (searchLine->text().isEmpty()) { - return; - } - - QTreeWidgetItemIterator it(d->logViewWidget, QTreeWidgetItemIterator::NotHidden); - initIterator(it, direction); - - //Go to the selected position + 1 (if we already found an item) - if (fromItem != NULL) { - - while ( *it != NULL) { - LogViewWidgetItem* item=static_cast (*it); - - if (item == fromItem) { - iteratorJump(it, direction); - break; - } - - iteratorJump(it, direction); - } - - } - - //Iterates to fromItem +1 to the last item of the list - while ( *it != NULL) { - LogViewWidgetItem* item=static_cast (*it); - - bool found = findItem(item); - if (found == true) - return; - - iteratorJump(it, direction); - } - - //If we do not begin the search from the beginning, we do it now - if (fromItem != NULL) { - it = QTreeWidgetItemIterator(d->logViewWidget, QTreeWidgetItemIterator::NotHidden); - initIterator(it, direction); - - LogViewWidgetItem* item = NULL; - while ( *it != NULL && item != fromItem) { - item=static_cast (*it); - - bool found = findItem(item); - if (found == true) { - showMessage(i18n("Reached end of list."), QLatin1String( "dialog-information" )); - return; - } - - iteratorJump(it, direction); - } - - } - - setSearchLineNotFound(true); - -} - -inline void LogViewSearchWidget::initIterator(QTreeWidgetItemIterator& it, Direction direction) { - //Previous direction : Go to the last item - if (direction == LogViewSearchWidget::Previous) { - QTreeWidgetItemIterator testedIterator(it); - while (true) { - ++testedIterator; - if ( *testedIterator == NULL ) { - break; - } - - ++it; - - } - } -} - -inline void LogViewSearchWidget::iteratorJump(QTreeWidgetItemIterator& it, Direction direction) { - if (direction == LogViewSearchWidget::Next) { - ++it; - } - else { - --it; - } -} - -bool LogViewSearchWidget::compareItem(LogViewWidgetItem* item) { - Qt::CaseSensitivity caseSensitivity = Qt::CaseInsensitive; - if (caseSensitive->isChecked()) { - caseSensitivity = Qt::CaseSensitive; - } - - if (searchLine->text().isEmpty()) - return false; - - if (item->logLine()->exportToText().contains(searchLine->text(), caseSensitivity)) { - return true; - } - - return false; -} - -bool LogViewSearchWidget::findItem(LogViewWidgetItem* item) { - if (compareItem(item) == true) { - unselectAll(); - - setSearchLineNotFound(false); - item->setSelected(true); - d->logViewWidget->setCurrentItem(item); - d->logViewWidget->scrollToItem(item); - return true; - } - - return false; -} - -void LogViewSearchWidget::setSearchLineNotFound(bool notFound) { - QPalette palette = searchLine->palette(); - if (notFound == true) { - palette.setColor(QPalette::Base, QColor(255, 102, 102)); //or Qt::red or QColor(235, 0, 0) - palette.setColor(QPalette::Text, QColor(255, 255, 255)); - } - else { - palette.setColor(QPalette::Base, d->searchLineBaseColor); - palette.setColor(QPalette::Text, d->searchLineTextColor); - } - - searchLine->setPalette(palette); - - if (notFound==true) - showMessage(i18n("Phrase not found."), QLatin1String( "dialog-error" )); - else - hideMessage(); - -} - -void LogViewSearchWidget::unselectAll() { - QList selectedItems = d->logViewWidget->selectedItems(); - foreach(QTreeWidgetItem* item, selectedItems) { - item->setSelected(false); - } -} - -void LogViewSearchWidget::showMessage(const QString& text, const QString& iconText) { - message->setText(text); - message->show(); - - messageIcon->setPixmap(SmallIcon(iconText)); - messageIcon->show(); - - d->messageHidingTimer->start(); - -} - -void LogViewSearchWidget::hideMessage() { - message->hide(); - messageIcon->hide(); - - d->messageHidingTimer->stop(); -} - -void LogViewSearchWidget::highlightAll() { - if (highlightAllButton->isChecked()) { - unlightAll(); - - logDebug() << "Highlighting all"; - QTreeWidgetItemIterator it(d->logViewWidget, QTreeWidgetItemIterator::All); - while ( *it != NULL ) { - LogViewWidgetItem* item=static_cast (*it); - - if (compareItem(item) == true) { - item->setBackground(item->columnCount()-1, QColor(255, 255, 16*8+11)); - } - - ++it; - } - - } - else { - unlightAll(); - - } - -} - -void LogViewSearchWidget::unlightAll() { - logDebug() << "Unlighting all"; - - QTreeWidgetItemIterator it(d->logViewWidget, QTreeWidgetItemIterator::All); - while ( *it != NULL ) { - LogViewWidgetItem* item=static_cast (*it); - - //We retrieve the default column background using the first column data, where the background never changes - item->setBackground(item->columnCount()-1, qvariant_cast(item->data(0, Qt::BackgroundRole))); - - ++it; - } -} - -#include "moc_logViewSearchWidget.cpp" diff --git a/ksystemlog/src/lib/logViewSearchWidget.h b/ksystemlog/src/lib/logViewSearchWidget.h deleted file mode 100644 index 94f709f2..00000000 --- a/ksystemlog/src/lib/logViewSearchWidget.h +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************** - * 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 _LOG_VIEW_SEARCH_WIDGET_H_ -#define _LOG_VIEW_SEARCH_WIDGET_H_ - -#include -#include - -#include "ui_logViewSearchWidgetBase.h" - -class LogViewWidget; -class LogViewWidgetItem; - -class LogViewSearchWidgetPrivate; - -class LogViewSearchWidget : public QWidget, public Ui::LogViewSearchWidgetBase { - - Q_OBJECT - -public: - LogViewSearchWidget(); - - ~LogViewSearchWidget(); - - void setTreeWidget(LogViewWidget* logViewWidget); - -public slots: - void displaySearch(); - - void findFirst(); - - void findFirst(const QString &); - void findNext(); - void findPrevious(); - -private slots: - void hideMessage(); - - void highlightAll(); - -private: - enum Direction { - Next, - Previous - }; - Q_DECLARE_FLAGS(Directions, Direction) - - void showMessage(const QString& text, const QString& iconText); - - void internalFind(LogViewWidgetItem* fromItem, Direction direction); - - void setSearchLineNotFound(bool notFound); - void unselectAll(); - bool findItem(LogViewWidgetItem* item); - - bool compareItem(LogViewWidgetItem* item); - - void unlightAll(); - - inline void initIterator(QTreeWidgetItemIterator& it, Direction direction); - inline void iteratorJump(QTreeWidgetItemIterator& it, Direction direction); - - LogViewSearchWidgetPrivate* const d; - -}; - -#endif //_LOG_VIEW_SEARCH_WIDGET_H_ diff --git a/ksystemlog/src/lib/logViewSearchWidgetBase.ui b/ksystemlog/src/lib/logViewSearchWidgetBase.ui deleted file mode 100644 index d6973b8c..00000000 --- a/ksystemlog/src/lib/logViewSearchWidgetBase.ui +++ /dev/null @@ -1,128 +0,0 @@ - - LogViewSearchWidgetBase - - - - 0 - 0 - 705 - 27 - - - - - -1 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - true - - - - - - - Find: - - - - - - - - 0 - 0 - - - - - - - - &Next - - - true - - - - - - - &Previous - - - true - - - - - - - Match &case - - - - - - - &Highlight all - - - - - - - - - - - - - - - 0 - 0 - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 40 - 20 - - - - - - - - diff --git a/ksystemlog/src/lib/logViewWidget.cpp b/ksystemlog/src/lib/logViewWidget.cpp deleted file mode 100644 index 9628e232..00000000 --- a/ksystemlog/src/lib/logViewWidget.cpp +++ /dev/null @@ -1,306 +0,0 @@ -/*************************************************************************** - * 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 "logViewWidget.h" - -#include -#include - -#include -#include - -#include "logging.h" - -#include "logViewColumn.h" - -#include "logViewWidgetItem.h" -#include "logLine.h" -#include "logViewModel.h" - -#include "ksystemlogConfig.h" - -class LogViewWidgetPrivate { -public: - LogViewModel* logViewModel; - - QActionGroup* headersTogglingActions; - -}; - -LogViewWidget::LogViewWidget(QWidget* parent) : - QTreeWidget(parent), - d(new LogViewWidgetPrivate()) { - - //TODO Add this setWhatsThis() to all columns each time they change - //setWhatThis(i18n("

This is the main view of KSystemLog. It displays the last lines of the selected log. Please see the documentation to discovers the meaning of each icons and existing log.

Log lines in bold are the last added to the list.

")); - - QStringList headerLabels; - headerLabels.append(QLatin1String( "Date" )); - headerLabels.append(QLatin1String( "Message" )); - - d->logViewModel = new LogViewModel(this); - d->headersTogglingActions = new QActionGroup(this); - d->headersTogglingActions->setExclusive(false); - connect(d->headersTogglingActions, SIGNAL(triggered(QAction*)), this, SLOT(toggleHeader(QAction*))); - - setHeaderLabels(headerLabels); - - //Header - header()->setContextMenuPolicy(Qt::ActionsContextMenu); - header()->setMovable(true); - - setSortingEnabled(true); - sortItems(0, Qt::AscendingOrder); - - setAnimated(true); - - setRootIsDecorated(false); - - setAllColumnsShowFocus(true); - - setAlternatingRowColors(true); - - setSelectionMode(QAbstractItemView::ExtendedSelection); - - setContextMenuPolicy(Qt::ActionsContextMenu); -} - -LogViewWidget::~LogViewWidget() { - delete d->logViewModel; - - delete d; -} - -void LogViewWidget::setColumns(const LogViewColumns& columns) { - logDebug() << "Updating columns using " << columns << "..."; - - //First, delete all current columns - setColumnCount(0); - - setHeaderLabels(columns.toStringList()); - - sortItems(0, Qt::AscendingOrder); - - //Remove previous header actions - QListIterator it(d->headersTogglingActions->actions()); - it.toBack(); - while (it.hasPrevious()) { - QAction* action = it.previous(); - - header()->removeAction( action ); - d->headersTogglingActions->removeAction( action ); - - delete action; - } - - //Add new actions - int columnIndex = 0; - - foreach(const LogViewColumn &column, columns.columns()) { - QAction* action = new QAction(this); - action->setText(column.columnName()); - //helloAction->setIcon(KIcon( QLatin1String( "media-playback-start" ))); - //helloAction->setShortcut(Qt::CTRL + Qt::Key_M); - action->setCheckable(true); - action->setChecked(true); - action->setToolTip(i18n("Display/Hide the '%1' column", column.columnName())); - action->setData(QVariant(columnIndex)); - - d->headersTogglingActions->addAction(action); - - ++columnIndex; - } - - header()->addActions(d->headersTogglingActions->actions()); - - - emit columnsChanged(columns); - - logDebug() << "Log View Widget updated..."; - -} - -void LogViewWidget::resizeColumns() { - //Resize all columns except the last one (which always take the last available space) - for (int i=0; i0 ) - QTreeWidget::selectAll(); -} - -int LogViewWidget::itemCount() const { - return topLevelItemCount(); -} - -QList LogViewWidget::logLines() { - QList logLines; - - QTreeWidgetItemIterator it(this); - while (*it != NULL) { - LogViewWidgetItem* item = static_cast(*it); - logLines.append(item->logLine()); - ++it; - } - - return logLines; -} - -LogViewWidgetItem* LogViewWidget::findNewestItem() { - LogViewWidgetItem* newestItem = NULL; - - QTreeWidgetItemIterator it(this); - while (*it != NULL) { - LogViewWidgetItem* item = static_cast(*it); - if (newestItem==NULL || newestItem->logLine()->isOlderThan( *(item->logLine()) )) { - newestItem = item; - } - - ++it; - } - - return newestItem; - -} - -LogViewWidgetItem* LogViewWidget::findItem(LogLine* searchedLogLine) { - QTreeWidgetItemIterator it(this); - while (*it != NULL) { - LogViewWidgetItem* item = static_cast(*it); - if (item->logLine()->equals(*searchedLogLine)) - return item; - - ++it; - } - - return NULL; -} - -QList LogViewWidget::items() { - QList items; - - QTreeWidgetItemIterator it(this); - while (*it != NULL) { - items.append(static_cast(*it)); - ++it; - } - - return items; -} - -LogViewModel* LogViewWidget::model() const { - return d->logViewModel; -} - -bool LogViewWidget::hasItemsSelected() { - return ( !selectedItems ().isEmpty() ); -} - -LogViewWidgetItem* LogViewWidget::firstSelectedItem() { - QTreeWidgetItemIterator it(this, QTreeWidgetItemIterator::Selected); - - //Returns the first selected item or NULL is there is no item selected - return static_cast (*it); -} - -LogViewWidgetItem* LogViewWidget::lastSelectedItem() { - QTreeWidgetItemIterator it(this, QTreeWidgetItemIterator::Selected); - - QTreeWidgetItem* item=NULL; - while (*it) { - item=(*it); - - it++; - } - - //Returns the last selected item or NULL is there is no item selected - return static_cast(item); -} - - -void LogViewWidget::expandAll() { - QTreeWidgetItemIterator it(this); - while (*it != NULL) { - expandItem(*it); - ++it; - } -} - -void LogViewWidget::collapseAll() { - QTreeWidgetItemIterator it(this); - while (*it != NULL) { - collapseItem(*it); - ++it; - } -} - -void LogViewWidget::toggleToolTip(bool enabled) { - logDebug() << "Toggle tool tip "; - - QTreeWidgetItemIterator it(this); - while (*it != NULL) { - LogViewWidgetItem* item = static_cast(*it); - item->toggleToolTip(enabled); - - ++it; - } - -} - -void LogViewWidget::scrollToNewestItem() { - logDebug() << "Scrolling to the newest item..."; - - //Scroll to last item if requested - if (KSystemLogConfig::newLinesDisplayed() == true) { - LogViewWidgetItem* newestItem = findNewestItem(); - if (newestItem!=NULL) { - scrollToItem(newestItem); - } - } -} - -int LogViewWidget::notHiddenItemCount() { - int count = 0; - - QTreeWidgetItemIterator it(this, QTreeWidgetItemIterator::NotHidden); - while (*it != NULL) { - count++; - ++it; - } - - return count; -} - -void LogViewWidget::toggleHeader(QAction* action) { - logDebug() << "Toggling header"; - - int columnIndex = action->data().toInt(); - if (header()->isSectionHidden(columnIndex) == true) - header()->setSectionHidden(columnIndex, false); - else - header()->setSectionHidden(columnIndex, true); -} - - -#include "moc_logViewWidget.cpp" diff --git a/ksystemlog/src/lib/logViewWidget.h b/ksystemlog/src/lib/logViewWidget.h deleted file mode 100644 index b4c55ca6..00000000 --- a/ksystemlog/src/lib/logViewWidget.h +++ /dev/null @@ -1,87 +0,0 @@ -/*************************************************************************** - * 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 LOG_VIEW_WIDGET_H -#define LOG_VIEW_WIDGET_H - -#include -#include - -#include "logViewColumns.h" - -class LogViewWidgetItem; -class LogViewModel; -class LogLine; - -class LogViewWidgetPrivate; - -class LogViewWidget : public QTreeWidget { - - Q_OBJECT - - public: - LogViewWidget(QWidget* parent = NULL); - - virtual ~LogViewWidget(); - virtual void selectAll(); - void setColumns(const LogViewColumns& columns); - - int itemCount() const; - int notHiddenItemCount(); - - QList items(); - QList logLines(); - - /** - * Return the related widget item of this logLine or NULL if it has not been found - */ - LogViewWidgetItem* findItem(LogLine* logLine); - - LogViewWidgetItem* findNewestItem(); - - LogViewModel* model() const; - - bool hasItemsSelected(); - LogViewWidgetItem* firstSelectedItem(); - LogViewWidgetItem* lastSelectedItem(); - - void scrollToNewestItem(); - - void expandAll(); - void collapseAll(); - - void resizeColumns(); - - public slots: - void toggleToolTip(bool enabled); - - signals: - void columnsChanged(const LogViewColumns& columns); - - private slots: - void toggleHeader(QAction* action); - - private: - LogViewWidgetPrivate* const d; -}; - - -#endif //LOG_VIEW_WIDGET_H diff --git a/ksystemlog/src/lib/logViewWidgetItem.cpp b/ksystemlog/src/lib/logViewWidgetItem.cpp deleted file mode 100644 index f8ece695..00000000 --- a/ksystemlog/src/lib/logViewWidgetItem.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/*************************************************************************** - * 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 "logViewWidgetItem.h" - -//Qt includes - -#include - - -#include - -//KDE includes -#include -#include -#include "logging.h" - -#include "logModeItemBuilder.h" -#include "logViewWidget.h" -#include "logViewWidgetItem.h" - -#include "logMode.h" - -LogViewWidgetItem::LogViewWidgetItem(LogViewWidget* list, LogLine* l) : - QTreeWidgetItem(list), - line(l) - { - - //Add this item to the LogLine, to let the LogLine initialize it - line->setItem(this); -} - -LogViewWidgetItem::~LogViewWidgetItem() { - delete line; -} - -LogLine* LogViewWidgetItem::logLine() const { - return line; -} - -void LogViewWidgetItem::toggleToolTip(bool displayed) { - if (displayed == true) - setToolTip(columnCount()-1, line->logMode()->itemBuilder()->createToolTipText(line)); - else - setToolTip(columnCount()-1, QLatin1String( "" )); -} - -bool LogViewWidgetItem::operator<(const QTreeWidgetItem & other) const { - int sortedColumn = treeWidget()->sortColumn(); - - //If we sort items by date (always the first column) - if (sortedColumn == 0) { - const LogViewWidgetItem& otherItem=static_cast (other); - return line->isOlderThan( *(otherItem.logLine()) ); - } - //Default sorting - else { - return text(sortedColumn) < other.text(sortedColumn); - } -} diff --git a/ksystemlog/src/lib/logViewWidgetItem.h b/ksystemlog/src/lib/logViewWidgetItem.h deleted file mode 100644 index a6a5b5f8..00000000 --- a/ksystemlog/src/lib/logViewWidgetItem.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * 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 LOG_VIEW_WIDGET_ITEM_H -#define LOG_VIEW_WIDGET_ITEM_H - - -#include - - -#include "globals.h" - -#include "logLine.h" - -class LogViewWidget; - -class LogLine; - -class LogViewWidgetItem: public QTreeWidgetItem { - - public: - LogViewWidgetItem(LogViewWidget* logViewWidget, LogLine* line); - - ~LogViewWidgetItem(); - - bool operator<(const QTreeWidgetItem & other) const; - - LogLine* logLine() const; - - void toggleToolTip(bool displayed); - - - private: - //TODO Move this log line to QTreeWidgetItem::data() method - LogLine* line; - -}; - -#endif // LOG_VIEW_WIDGET_ITEM_H diff --git a/ksystemlog/src/lib/logging.h b/ksystemlog/src/lib/logging.h deleted file mode 100644 index d734084c..00000000 --- a/ksystemlog/src/lib/logging.h +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************** - * 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 _KSYSTEMLOG_LOGGING_H_ -#define _KSYSTEMLOG_LOGGING_H_ - - -#include - -/** - * Existing logging functions are : - * - logDebug() - * - logWarning() - * - logError() - * - logFatal() - * - * Use it like kDebug() function : - * logDebug() << "Debug message" << list.size(); - */ - -/* - * Log prefix of any log message - * The regexp removes the parameters and return type of the method prototype - * - * Example : - * [LogManager::synchronizeLogView(547)] Synchronizing the model... - * - */ - -#define KSYSTEM_LOG_KDEBUG_ID 87500 - -/** - * Colored logging - -#define LOG_DEFAULT_COLOR "\033[m" - -#define LOG_DEBUG_COLOR "\033[37m" -#define LOG_ERROR_COLOR "\033[31m" -#define LOG_FATAL_COLOR "\033[31m" -#define LOG_WARNING_COLOR "\033[33m" - -#define LOG_PREFIX(logColor) logColor << "[" << __LINE__ << "]" << LOG_DEFAULT_COLOR - - */ - -#define LOG_DEFAULT_COLOR "" - -#define LOG_DEBUG_COLOR "" -#define LOG_ERROR_COLOR "" -#define LOG_FATAL_COLOR "" -#define LOG_WARNING_COLOR "" - -#define LOG_PREFIX(logColor) "" - -#define logDebug() kDebug(KSYSTEM_LOG_KDEBUG_ID) << LOG_PREFIX(LOG_DEBUG_COLOR) -#define logWarning() kWarning(KSYSTEM_LOG_KDEBUG_ID) << LOG_PREFIX(LOG_WARNING_COLOR) -#define logError() kError(KSYSTEM_LOG_KDEBUG_ID) << LOG_PREFIX(LOG_ERROR_COLOR) -#define logFatal() kFatal(KSYSTEM_LOG_KDEBUG_ID) << LOG_PREFIX(LOG_FATAL_COLOR) - -#endif // _KSYSTEMLOG_LOGGING_H_ diff --git a/ksystemlog/src/lib/multipleActions.cpp b/ksystemlog/src/lib/multipleActions.cpp deleted file mode 100644 index d36ea19f..00000000 --- a/ksystemlog/src/lib/multipleActions.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * 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 "multipleActions.h" - -#include - -#include "logging.h" - -MultipleActions::MultipleActions(const KIcon& icon, const QString& text, QObject* parent) { - action = new KActionMenu(icon, text, parent); - -} - -MultipleActions::~MultipleActions() { - delete action; -} - -QList MultipleActions::innerActions() { - return actions; -} - -QAction* MultipleActions::actionMenu() { - return action; -} - -void MultipleActions::addInnerAction(QAction* innerAction) { - action->addAction(innerAction); - actions.append(innerAction); - -} - -#include "moc_multipleActions.cpp" diff --git a/ksystemlog/src/lib/multipleActions.h b/ksystemlog/src/lib/multipleActions.h deleted file mode 100644 index ea152649..00000000 --- a/ksystemlog/src/lib/multipleActions.h +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * 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_ACTIONS_H_ -#define _MULTIPLE_ACTIONS_H_ - -#include -#include -#include - -#include -#include - -#include "globals.h" - -#include "logModeAction.h" - -#include - -/** - * This class is used by LogModeFactory to provide multiple actions - * and be able to retrieve them when necessary, using actions(). - * This method will return QAction added using addInnerAction(). - */ -class MultipleActions : public LogModeAction { - - Q_OBJECT - - public: - MultipleActions(const KIcon& icon, const QString& text, QObject* parent); - - virtual ~MultipleActions(); - - QList innerActions(); - - QAction* actionMenu(); - - /** - * This method is not called addAction() to avoid name collision with - * parent class - */ - void addInnerAction(QAction* action); - - private: - QList actions; - - KActionMenu* action; -}; - -#endif // _MULTIPLE_ACTIONS_H_ diff --git a/ksystemlog/src/lib/processOutputLogFileReader.cpp b/ksystemlog/src/lib/processOutputLogFileReader.cpp deleted file mode 100644 index a02b7372..00000000 --- a/ksystemlog/src/lib/processOutputLogFileReader.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/*************************************************************************** - * 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 "processOutputLogFileReader.h" - -#include -#include -#include - -#include -#include - -#include "logFileReader.h" -#include "logFileReaderPrivate.h" - -#include "logging.h" - - -class ProcessOutputLogFileReaderPrivate : public LogFileReaderPrivate { - -public: - long previousLinesCount; - - QTimer processUpdater; - - QProcess* process; - - QString buffer; - QStringList availableStandardOutput; -}; - - -ProcessOutputLogFileReader::ProcessOutputLogFileReader(const LogFile& logFile) : - LogFileReader(*new ProcessOutputLogFileReaderPrivate(), logFile) { - - init(); -} - - -ProcessOutputLogFileReader::ProcessOutputLogFileReader(ProcessOutputLogFileReaderPrivate& dd, const LogFile& logFile) : - LogFileReader(dd, logFile) { - - init(); -} - -ProcessOutputLogFileReader::~ProcessOutputLogFileReader() { - //d pointer is deleted by the parent class -} - -void ProcessOutputLogFileReader::init() { - Q_D(ProcessOutputLogFileReader); - - //Init current file position - d->previousLinesCount = 0; - d->availableStandardOutput.clear(); - d->process = NULL; - - d->processUpdater.setInterval(PROCESS_OUTPUT_UPDATER_INTERVAL); - connect(&(d->processUpdater), SIGNAL(timeout()), this, SLOT(startProcess())); - - logDebug() << "Using process name " << d->logFile.url().path(); -} - -void ProcessOutputLogFileReader::watchFile(bool enable) { - Q_D(ProcessOutputLogFileReader); - - if (enable == true) { - logDebug() << "Monitoring process : " << d->logFile.url().path(); - - //Reinit current file position - d->previousLinesCount = 0; - - //Launch the timer - d->processUpdater.start(); - - //Launch immediately the process updater - startProcess(); - } - else { - //Stop regularly start process - d->processUpdater.stop(); - } -} - -void ProcessOutputLogFileReader::startProcess() { - logDebug() << "Starting process..."; - - Q_D(ProcessOutputLogFileReader); - - if (d->logFile.url().isValid()==false) { - QString message(i18n("This file is not valid. Please adjust it in the settings of KSystemLog.")); - emit errorOccured(i18n("File Does Not Exist"), message); - emit statusBarChanged(message); - } - - logDebug() << "Starting process..."; - - d->process = new QProcess(); - connect(d->process, SIGNAL(readyReadStandardOutput()), this, SLOT(logFileModified())); - connect(d->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(emitProcessOutput(int,QProcess::ExitStatus))); - - d->process->start(d->logFile.url().path(), QIODevice::ReadOnly | QIODevice::Text); - - d->process->waitForStarted(); - - logDebug() << "Process started"; -} - -void ProcessOutputLogFileReader::closeProcess() { - logDebug() << "Closing process..."; - - Q_D(ProcessOutputLogFileReader); - - //Get the size file for the next calculation - d->previousLinesCount = d->availableStandardOutput.count(); - logDebug() << "New lines count : " << d->previousLinesCount << " (" << d->logFile.url().path() << ")"; - - d->availableStandardOutput.clear(); - - if(d->process) { - d->process->close(); - delete d->process; - d->process = NULL; - } - - logDebug() << "Process closed"; -} - -void ProcessOutputLogFileReader::emitProcessOutput(int /*exitCode*/, QProcess::ExitStatus exitStatus) { - Q_D(ProcessOutputLogFileReader); - - //First commit last lines of the buffer to the line list - emptyBuffer(); - - logDebug() << "Process terminated" << d->previousLinesCount << "previously /" << d->availableStandardOutput.count() << "currently"; - - if (exitStatus==QProcess::CrashExit) { - QString message(i18n("The process '%1' crashed.", d->logFile.url().path())); - emit errorOccured(i18n("Process Crashed"), message); - emit statusBarChanged(message); - } - - // If there is no new lines - if (d->previousLinesCount == d->availableStandardOutput.count()) { - /* - //Emit an empty log lines list - emit contentChanged(this, false, QStringList()); - */ - } - // If there are new lines in the file, insert only them or this is the first time we read this file - else if (d->previousLinesCount!=0 && d->previousLinesCount <= d->availableStandardOutput.count()) { - logDebug() << "Reading from line " << d->previousLinesCount << " (" << d->logFile.url().path() << ")"; - - QStringList newOutputs; - - int index = d->previousLinesCount - 1; - while (index < d->availableStandardOutput.count()) { - newOutputs.append(d->availableStandardOutput.at(index)); - - ++index; - } - - logDebug() << "Retrieving a part of the file..."; - - emit contentChanged(this, Analyzer::UpdatingRead, newOutputs); - - } - // Else reread all lines, clear log list - else { - logDebug() << "New process or process already read. Reading entire content"; - - emit contentChanged(this, Analyzer::FullRead, d->availableStandardOutput); - - } - - closeProcess(); - -} - -void ProcessOutputLogFileReader::logFileModified() { - Q_D(ProcessOutputLogFileReader); - - logDebug() << "Content available on process output..."; - - //New added lines - QByteArray bytesOutput = d->process->readAllStandardOutput(); - d->buffer.append(QLatin1String(bytesOutput)); - - //Parse buffer - int endLinePos = d->buffer.indexOf(QLatin1String( "\n" )); - forever { - if (endLinePos==-1) - break; - - //Add the new found lines and - d->availableStandardOutput.append(d->buffer.left(endLinePos)); - d->buffer.remove(0, endLinePos+1); - - endLinePos = d->buffer.indexOf(QLatin1String( "\n" )); - } - - logDebug() << "Received a total of" << d->availableStandardOutput.count() << "new lines"; -} - - -/** - * The buffer could contains some last characters that are added at last - * (Normally useless) - */ -void ProcessOutputLogFileReader::emptyBuffer() { - Q_D(ProcessOutputLogFileReader); - - if (d->buffer.isEmpty() == false) { - logWarning() << "Buffer was not empty !!"; - d->availableStandardOutput.append(d->buffer); - d->buffer.clear(); - } -} - -#include "moc_processOutputLogFileReader.cpp" diff --git a/ksystemlog/src/lib/processOutputLogFileReader.h b/ksystemlog/src/lib/processOutputLogFileReader.h deleted file mode 100644 index 66ecdbad..00000000 --- a/ksystemlog/src/lib/processOutputLogFileReader.h +++ /dev/null @@ -1,73 +0,0 @@ -/*************************************************************************** - * 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 _PROCESS_OUTPUT_LOG_FILE_READER_H_ -#define _PROCESS_OUTPUT_LOG_FILE_READER_H_ - -#define PROCESS_OUTPUT_UPDATER_INTERVAL 10000 - -#include - -#include "logFile.h" - -#include "logFileReader.h" - -#include - -class ProcessOutputLogFileReaderPrivate; - -class ProcessOutputLogFileReader : public LogFileReader { - - Q_OBJECT - - public: - - ProcessOutputLogFileReader(const LogFile& logFile); - - virtual ~ProcessOutputLogFileReader(); - - void watchFile(bool enable); - - void setPreviousFilePosition(long previousFilePosition); - - private slots: - void startProcess(); - - void logFileModified(); - - void emitProcessOutput(int, QProcess::ExitStatus); - - private: - void init(); - - void closeProcess(); - - void emptyBuffer(); - - protected: - ProcessOutputLogFileReader(ProcessOutputLogFileReaderPrivate& dd, const LogFile& logFile); - - private: - Q_DECLARE_PRIVATE(ProcessOutputLogFileReader) - -}; - -#endif // _PROCESS_OUTPUT_LOG_FILE_READER_H_ diff --git a/ksystemlog/src/lib/simpleAction.cpp b/ksystemlog/src/lib/simpleAction.cpp deleted file mode 100644 index 63c443d7..00000000 --- a/ksystemlog/src/lib/simpleAction.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * 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 "simpleAction.h" - -#include - -#include "logging.h" - -SimpleAction::SimpleAction(const QIcon& icon, const QString& text, QObject* parent) { - action = new QAction(icon, text, parent); -} - -SimpleAction::SimpleAction(QAction* originAction, QObject* parent) { - - action = new QAction(parent); - action->setIcon(originAction->icon()); - action->setText(originAction->text()); - action->setData(originAction->data()); - action->setToolTip(originAction->toolTip()); - action->setWhatsThis(originAction->whatsThis()); -} - -SimpleAction::~SimpleAction() { - delete action; -} - -QList SimpleAction::innerActions() { - QList actions; - actions.append(action); - - return actions; -} - -QAction* SimpleAction::actionMenu() { - return action; -} - -#include "moc_simpleAction.cpp" diff --git a/ksystemlog/src/lib/simpleAction.h b/ksystemlog/src/lib/simpleAction.h deleted file mode 100644 index 692c74f8..00000000 --- a/ksystemlog/src/lib/simpleAction.h +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * 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 _SIMPLE_ACTIONS_H_ -#define _SIMPLE_ACTIONS_H_ - -#include -#include -#include - -#include "globals.h" - -#include "logModeAction.h" - -#include - -class SimpleAction : public LogModeAction { - - Q_OBJECT - - public: - SimpleAction(const QIcon& icon, const QString& text, QObject* parent); - - SimpleAction(QAction* action, QObject* parent); - - virtual ~SimpleAction(); - - QList innerActions(); - - QAction* actionMenu(); - - private: - QAction* action; -}; - -#endif // _SIMPLE_ACTIONS_H_ diff --git a/ksystemlog/src/lib/view.cpp b/ksystemlog/src/lib/view.cpp deleted file mode 100644 index 89966a6d..00000000 --- a/ksystemlog/src/lib/view.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/*************************************************************************** - * 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 "view.h" - -#include - - -#include -#include - -#include - -#include - -#include -#include -#include - -#include "logging.h" - -#include "logViewWidget.h" - -#include "logViewFilterWidget.h" -#include "logViewSearchWidget.h" - -#include "logLine.h" -#include "logViewColumn.h" -#include "logViewColumns.h" - -#include "ksystemlogConfig.h" - -#include "loadingBar.h" - -class ViewPrivate { - -public: - /* - * Log view - */ - LogViewWidget* logViewWidget; - - /** - * Filter widget - */ - LogViewFilterWidget* logViewFilterWidget; - - /** - * Search widget - */ - LogViewSearchWidget* logViewSearchWidget; - - LoadingBar* loadingBar; -}; - -View::View(QWidget *parent) : - QWidget(parent), - d(new ViewPrivate()) { - - d->logViewWidget = NULL; - - QVBoxLayout* topLayout = new QVBoxLayout(); - topLayout->setMargin(2); - topLayout->setSpacing(2); - this->setLayout(topLayout); - - d->logViewFilterWidget = new LogViewFilterWidget(); - connect(d->logViewFilterWidget->filterLine(), SIGNAL(treeWidgetUpdated()), this, SIGNAL(searchFilterChanged())); - connect(d->logViewFilterWidget->filterLine(), SIGNAL(treeWidgetUpdated()), this, SLOT(unselectHiddenItems())); - - d->logViewFilterWidget->setVisible(KSystemLogConfig::toggleFilterBar()); - - topLayout->addWidget(d->logViewFilterWidget); - - d->logViewWidget=new LogViewWidget(this); - connect(d->logViewWidget, SIGNAL(columnsChanged(LogViewColumns)), d->logViewFilterWidget, SLOT(updateFilterColumns(LogViewColumns))); - - d->logViewFilterWidget->filterLine()->setTreeWidget(d->logViewWidget); - topLayout->addWidget(d->logViewWidget); - - - d->logViewSearchWidget = new LogViewSearchWidget(); - d->logViewSearchWidget->setTreeWidget(d->logViewWidget); - - //The search line is hidden by default - d->logViewSearchWidget->hide(); - - topLayout->addWidget(d->logViewSearchWidget); - - d->loadingBar = new LoadingBar(); - connect(d->loadingBar, SIGNAL(displayed(bool)), this, SLOT(displayLoadingBar(bool))); - - topLayout->addWidget(d->loadingBar); - d->loadingBar->hide(); - - //Accept Drag and Drop - setAcceptDrops(true); - -} - -View::~View() { - //All widgets are deleted automatically by Qt - - delete d; -} - -LogViewWidget* View::logViewWidget() const { - return d->logViewWidget; -} - -LoadingBar* View::loadingBar() const { - return d->loadingBar; -} - -void View::displayLoadingBar(bool display) { - if (display == true) { - d->logViewWidget->hide(); - d->logViewSearchWidget->hide(); - d->logViewFilterWidget->hide(); - - d->loadingBar->show(); - } - else { - d->logViewWidget->show(); - d->logViewFilterWidget->setVisible(KSystemLogConfig::toggleFilterBar()); - d->logViewFilterWidget->filterLine()->updateSearch(); - //No need to redisplay the search bar - - d->loadingBar->hide(); - } - -} - -void View::toggleLogViewFilter(bool display) { - if (display == true) { - d->logViewFilterWidget->show(); - } else { - d->logViewFilterWidget->filterLine()->clear(); - d->logViewFilterWidget->hide(); - } -} - -void View::toggleLogViewSearch(bool display) { - if (display == true) - d->logViewSearchWidget->displaySearch(); - else - d->logViewSearchWidget->hide(); -} - -LogViewSearchWidget* View::logViewSearch() const { - return d->logViewSearchWidget; -} - -void View::unselectHiddenItems() { - QTreeWidgetItemIterator it(d->logViewWidget, QTreeWidgetItemIterator::Selected); - - while ( *it != NULL) { - QTreeWidgetItem* item = *it; - - if (item->isHidden()) { - item->setSelected(false); - } - - ++it; - } -} - -QSize View::sizeHint() const { - return QSize(500, 500); -} - -void View::dropEvent(QDropEvent* event) { - KUrl::List urls = KUrl::List::fromMimeData( event->mimeData() ); - - //If URLs have been dropped - if ( ! urls.isEmpty() ) { - - emit droppedUrls(urls); - } -} - -void View::dragEnterEvent(QDragEnterEvent* event) { - KUrl::List urls = KUrl::List::fromMimeData( event->mimeData() ); - - //If URLs have been dropped - if (urls.isEmpty() ) { - logWarning() << "Empty drag and drop"; - return; - } - - foreach (const KUrl &url, urls) { - QFileInfo fileInfo(url.path()); - - //TODO Add a recognition of binary files (using the Url mimetype) and refuse them - - if (fileInfo.isReadable() == false) { - logWarning() << "The drag and dropped file is not readable " << url.path(); - return; - } - - if (fileInfo.isDir()) { - logWarning() << "Tried to drag and drop a directory " << url.path(); - return; - } - } - - //Accept those urls - event->acceptProposedAction(); - -} - -#include "moc_view.cpp" diff --git a/ksystemlog/src/lib/view.h b/ksystemlog/src/lib/view.h deleted file mode 100644 index 5be43e42..00000000 --- a/ksystemlog/src/lib/view.h +++ /dev/null @@ -1,92 +0,0 @@ -/*************************************************************************** - * 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 VIEW_H -#define VIEW_H - -//Qt includes -#include - -#include "globals.h" - -#include "logViewColumn.h" -#include "logViewColumns.h" - -#include -#include - - -class LoadingBar; - -class LogViewWidget; -class LogViewSearchWidget; - -class ViewPrivate; - -class View : public QWidget { - - Q_OBJECT - - public: - explicit View(QWidget *parent); - - virtual ~View(); - - LogViewWidget* logViewWidget() const; - - LoadingBar* loadingBar() const; - - LogViewSearchWidget* logViewSearch() const; - - QSize sizeHint() const; - - public slots: - void displayLoadingBar(bool display); - - void toggleLogViewFilter(bool display); - void toggleLogViewSearch(bool display); - - protected: - /** - * Method which contains the action to do when receiving a drag and drop event - */ - void dragEnterEvent(QDragEnterEvent* event); - - /** - * Method which accepts - */ - void dropEvent(QDropEvent *event); - - private slots: - void unselectHiddenItems(); - - signals: - void searchFilterChanged(); - - void droppedUrls(const KUrl::List& urls); - - private: - ViewPrivate* const d; - -}; - -#endif // VIEW_H - diff --git a/ksystemlog/src/logModePluginsLoader.cpp b/ksystemlog/src/logModePluginsLoader.cpp deleted file mode 100644 index aff74b60..00000000 --- a/ksystemlog/src/logModePluginsLoader.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/*************************************************************************** - * 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 "logModePluginsLoader.h" - -#include "globals.h" - -#include "logging.h" -#include "defaults.h" - -//Includes existing log modes -#include "openFactory.h" - -#include "systemFactory.h" - -#include "kernelFactory.h" -#include "xorgFactory.h" -#include "cronFactory.h" -#include "daemonFactory.h" -#include "authenticationFactory.h" -#include "apacheFactory.h" -#include "cupsFactory.h" -#include "postfixFactory.h" -#include "acpidFactory.h" -#include "xsessionFactory.h" -#include "sambaFactory.h" - - -LogModePluginsLoader::LogModePluginsLoader(QWidget* parent) : - parent(parent) { - -} - -LogModePluginsLoader::~LogModePluginsLoader() { - -} - -void LogModePluginsLoader::loadPlugins() { - //Open Log mode needs the current window to display error messages and open dialogs - Globals::instance()->registerLogModeFactory(new OpenLogModeFactory(parent)); - - //System - Globals::instance()->registerLogModeFactory(new SystemLogModeFactory()); - - //Kernel - Globals::instance()->registerLogModeFactory(new KernelLogModeFactory()); - - //Authentication - Globals::instance()->registerLogModeFactory(new AuthenticationLogModeFactory()); - - //Daemon - Globals::instance()->registerLogModeFactory(new DaemonLogModeFactory()); - - //Xorg - Globals::instance()->registerLogModeFactory(new XorgLogModeFactory()); - - //Cron - Globals::instance()->registerLogModeFactory(new CronLogModeFactory()); - - //Apache - Globals::instance()->registerLogModeFactory(new ApacheLogModeFactory()); - - //Postfix - Globals::instance()->registerLogModeFactory(new PostfixLogModeFactory()); - - //Cups - Globals::instance()->registerLogModeFactory(new CupsLogModeFactory()); - - //Samba - Globals::instance()->registerLogModeFactory(new SambaLogModeFactory()); - - //Acpid - Globals::instance()->registerLogModeFactory(new AcpidLogModeFactory()); - - //XSession - Globals::instance()->registerLogModeFactory(new XSessionLogModeFactory()); - -} diff --git a/ksystemlog/src/logModePluginsLoader.h b/ksystemlog/src/logModePluginsLoader.h deleted file mode 100644 index b24127f7..00000000 --- a/ksystemlog/src/logModePluginsLoader.h +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - * 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 _LOG_MODE_PLUGINS_LOADER_H_ -#define _LOG_MODE_PLUGINS_LOADER_H_ - -#include - -class LogModePluginsLoader: public QObject { - - Q_OBJECT - - public: - LogModePluginsLoader(QWidget* parent); - - ~LogModePluginsLoader(); - - void loadPlugins(); - - private: - QWidget* parent; -}; - -#endif //_LOG_MODE_PLUGINS_LOADER_H_ diff --git a/ksystemlog/src/loggerDialog.cpp b/ksystemlog/src/loggerDialog.cpp deleted file mode 100644 index faae8ea1..00000000 --- a/ksystemlog/src/loggerDialog.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/*************************************************************************** - * 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 "loggerDialog.h" - -#include - -#include -#include - -//Project includes -#include "logging.h" - -#include "logLevel.h" -#include "globals.h" - -class LoggerDialogPrivate { -public: - QMap facilities; - - QMap priorities; - QMap priorityIcons; - -}; - -LoggerDialog::LoggerDialog(QWidget *parent) : - QDialog(parent), - d(new LoggerDialogPrivate()) { - - setupUi(this); - - connect(buttonOK, SIGNAL(clicked()), this, SLOT(sendMessage())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(hide())); - - connect(tagActivation, SIGNAL(toggled(bool)), this, SLOT(changeTagActivation(bool))); - connect(fileActivation, SIGNAL(toggled(bool)), this, SLOT(changeFileActivation(bool))); - connect(messageActivation, SIGNAL(toggled(bool)), this, SLOT(changeMessageActivation(bool))); - - - connect(file, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); - connect(message, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); - connect(tag, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); - - buildMaps(); - - //Fill the priority ComboBox - QList prioKeys(d->priorities.keys()); - - QList::Iterator itPriority; - for (itPriority=prioKeys.begin(); itPriority!=prioKeys.end(); ++itPriority) { - priority->addItem(d->priorityIcons[*itPriority], *itPriority); - } - - - //Select the right priority - for (int i=0; icount(); ++i) { - if (priority->itemText(i)==Globals::instance()->noticeLogLevel()->name()) { - priority->setCurrentIndex(i); - break; - } - } - - //Fill the priority ComboBox - QList keys(d->facilities.keys()); - - QList::Iterator itFacility; - for (itFacility=keys.begin(); itFacility!=keys.end(); ++itFacility) { - facility->addItem(*itFacility); - } - - //Select the right facility - for (int i=0; icount(); ++i) { - if (facility->itemText(i)==i18n("User")) { - facility->setCurrentIndex(i); - break; - } - } - tag->setEnabled(false); - -} - -LoggerDialog::~LoggerDialog() { - delete d; -} - -void LoggerDialog::initialize() { - logDebug() << "Initializing Logger dialog..."; - - message->clear(); - message->setFocus(); -} - -void LoggerDialog::buildMaps() { - - //Fill the facility map - d->facilities[i18n("Authentication")]=QLatin1String( "auth" ); - d->facilities[i18n("Private Authentication")]=QLatin1String( "authpriv" ); - d->facilities[i18n("Cron")]=QLatin1String( "cron" ); - d->facilities[i18n("Daemon")]=QLatin1String( "daemon" ); - d->facilities[i18n("FTP")]=QLatin1String( "ftp" ); - d->facilities[i18n("Kernel")]=QLatin1String( "kern" ); - d->facilities[i18n("LPR")]=QLatin1String( "lpr" ); - d->facilities[i18n("Mail")]=QLatin1String( "mail" ); - d->facilities[i18n("News")]=QLatin1String( "news" ); - d->facilities[i18n("Syslog")]=QLatin1String( "syslog" ); - d->facilities[i18n("User")]=QLatin1String( "user" ); - d->facilities[i18n("UUCP")]=QLatin1String( "uucp" ); - - d->facilities[i18n("Local 0")]=QLatin1String( "local0" ); - d->facilities[i18n("Local 1")]=QLatin1String( "local1" ); - d->facilities[i18n("Local 2")]=QLatin1String( "local2" ); - d->facilities[i18n("Local 3")]=QLatin1String( "local3" ); - d->facilities[i18n("Local 4")]=QLatin1String( "local4" ); - d->facilities[i18n("Local 5")]=QLatin1String( "local5" ); - d->facilities[i18n("Local 6")]=QLatin1String( "local6" ); - d->facilities[i18n("Local 7")]=QLatin1String( "local7" ); - - //Fill the priority map - d->priorities[Globals::instance()->debugLogLevel()->name()]=QLatin1String( "debug" ); - d->priorities[Globals::instance()->informationLogLevel()->name()]=QLatin1String( "info" ); - d->priorities[Globals::instance()->noticeLogLevel()->name()]=QLatin1String( "notice" ); - d->priorities[Globals::instance()->warningLogLevel()->name()]=QLatin1String( "warning" ); - d->priorities[Globals::instance()->errorLogLevel()->name()]=QLatin1String( "err" ); - d->priorities[Globals::instance()->criticalLogLevel()->name()]=QLatin1String( "crit" ); - d->priorities[Globals::instance()->alertLogLevel()->name()]=QLatin1String( "alert" ); - d->priorities[Globals::instance()->emergencyLogLevel()->name()]=QLatin1String( "emerg" ); - - //Fill the priority icon map - d->priorityIcons[Globals::instance()->debugLogLevel()->name()]=Globals::instance()->debugLogLevel()->icon(); - d->priorityIcons[Globals::instance()->informationLogLevel()->name()]=Globals::instance()->informationLogLevel()->icon(); - d->priorityIcons[Globals::instance()->noticeLogLevel()->name()]=Globals::instance()->noticeLogLevel()->icon(); - d->priorityIcons[Globals::instance()->warningLogLevel()->name()]=Globals::instance()->warningLogLevel()->icon(); - d->priorityIcons[Globals::instance()->errorLogLevel()->name()]=Globals::instance()->errorLogLevel()->icon(); - d->priorityIcons[Globals::instance()->criticalLogLevel()->name()]=Globals::instance()->criticalLogLevel()->icon(); - d->priorityIcons[Globals::instance()->alertLogLevel()->name()]=Globals::instance()->alertLogLevel()->icon(); - d->priorityIcons[Globals::instance()->emergencyLogLevel()->name()]=Globals::instance()->emergencyLogLevel()->icon(); - -} - -void LoggerDialog::textChanged() { - if (fileActivation->isChecked() && file->url().isEmpty()) { - buttonOK->setEnabled(false); - return; - } - - if (tagActivation->isChecked() && tag->text().isEmpty()) { - buttonOK->setEnabled(false); - return; - } - - if (messageActivation->isChecked() && message->text().isEmpty()) { - buttonOK->setEnabled(false); - return; - } - - buttonOK->setEnabled(true); - -} - -void LoggerDialog::changeTagActivation(bool activation) { - tag->setEnabled(activation); - - textChanged(); -} - -void LoggerDialog::changeFileActivation(bool activation) { - file->setEnabled(activation); - - textChanged(); -} - -void LoggerDialog::changeMessageActivation(bool activation) { - message->setEnabled(activation); - - textChanged(); -} - - -void LoggerDialog::sendMessage() { - - QProcess process; - - QStringList arguments; - - if (useProcessIdentifier->isChecked()) { - arguments << QLatin1String( "-i" ); - } - - if (tagActivation->isChecked()) { - arguments << QLatin1String( "-t" ); - - arguments << tag->text(); - } - - QString prioritySelected=priority->currentText(); - - if (prioritySelected!=Globals::instance()->noLogLevel()->name()) { - arguments << QLatin1String( "-p" ); - - QString p(d->facilities[facility->currentText()]); - p+=QLatin1Char( '.' ); - p+=d->priorities[priority->currentText()]; - - arguments << p; - } - - //If we read the content of a file - if (fileActivation->isChecked()) { - arguments << QLatin1String( "-f" ); - - arguments << file->url().path(); - } - //Else, the user types the content of its message - else { - //Remove bad "\n" characters - arguments << message->text().replace(QLatin1String( "\n" ), QLatin1String( " " )); - } - - // QProcess::Block, QProcess::Stdout - process.start(QLatin1String( "logger" ), arguments); - - //If the launching of the command failed - if (process.error() == QProcess::FailedToStart) { - KMessageBox::error(this, i18n("Unable to find the 'logger' command on your system. Please type 'logger' in a Konsole to determine whether this command is installed."), i18n("Command not found")); - return; - } - - if (process.exitStatus() == QProcess::CrashExit) { - KMessageBox::error(this, i18n("The 'logger' command has not been properly exited."), i18n("Execution problem")); - return; - } - - //No such file or directory - if (process.exitCode()==1) { - KMessageBox::error(this, i18n("This file does not exist, please choose another."), i18n("File not valid")); - return; - } - - //Hide the Logger Dialog - hide(); -} - - -#include "moc_loggerDialog.cpp" diff --git a/ksystemlog/src/loggerDialog.h b/ksystemlog/src/loggerDialog.h deleted file mode 100644 index 1991612b..00000000 --- a/ksystemlog/src/loggerDialog.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * 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 _LOGGER_DIALOG_H_ -#define _LOGGER_DIALOG_H_ - -#include - - -#include "ui_loggerDialogBase.h" - -class LoggerDialogPrivate; - -class LoggerDialog: public QDialog, public Ui::LoggerDialogBase { - Q_OBJECT - public: - explicit LoggerDialog(QWidget* parent = NULL); - - virtual ~LoggerDialog(); - - void initialize(); - - protected slots: - void sendMessage(); - - void textChanged(); - - void changeTagActivation(bool activation); - void changeFileActivation(bool activation); - void changeMessageActivation(bool activation); - - private: - void buildMaps(); - - LoggerDialogPrivate* const d; - -}; - -#endif // _LOGGER_DIALOG_H_ diff --git a/ksystemlog/src/loggerDialogBase.ui b/ksystemlog/src/loggerDialogBase.ui deleted file mode 100644 index a2a3d9b8..00000000 --- a/ksystemlog/src/loggerDialogBase.ui +++ /dev/null @@ -1,348 +0,0 @@ - - - Nicolas Ternisien - Dialog that allows the user to send a message with the logger command - LoggerDialogBase - - - - 0 - 0 - 440 - 429 - - - - - 300 - 300 - - - - true - - - Log Message - - - false - - - - - - Message - - - - - - &Message: - - - true - - - - - - - - - - &File content: - - - - - - - false - - - - 1 - 0 - - - - - - - - - - - Properties - - - - - - 0 - - - - - - 0 - 0 - - - - &Priority: - - - false - - - priority - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 84 - 24 - - - - - - - - - 1 - 0 - - - - - - - - - - 0 - - - - - - 0 - 0 - - - - &Facility: - - - false - - - facility - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 84 - 24 - - - - - - - - - 1 - 0 - - - - - - - - - - - - - Options - - - - - - 0 - - - - - Qt::TabFocus - - - &Tag: - - - - - - - - - - - - Log process &identifier - - - true - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 31 - 31 - - - - - - - - 0 - - - - - - 0 - 0 - - - - Open the 'logger' command manual. - - - This link opens the 'logger' command manual. - - - <a href="https://linux.die.net/man/1/logger">Logger Manual</a> - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 155 - 26 - - - - - - - - false - - - &OK - - - - - - true - - - true - - - - - - - &Cancel - - - - - - true - - - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
- - KUrlRequester - QWidget -
kurlrequester.h
-
-
- - buttonOK - buttonCancel - loggerManual - - - klineedit.h - kurlrequester.h - klineedit.h - kpushbutton.h - kcombobox.h - kcombobox.h - klineedit.h - QLabel - - -
diff --git a/ksystemlog/src/main.cpp b/ksystemlog/src/main.cpp deleted file mode 100644 index 846b6cda..00000000 --- a/ksystemlog/src/main.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/*************************************************************************** - * 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 -#include -#include -#include -#include - -#include "mainWindow.h" -#include "logging.h" - -int main(int argc, char** argv) { - - KAboutData about( - "ksystemlog", - 0, - ki18n("KSystemlog"), - "0.4", - ki18n("System Logs Viewer for KDE"), - KAboutData::License_GPL_V2, - ki18n("(C) 2007, Nicolas Ternisien"), - ki18n("Do not hesitate to report bugs and problems to Nicolas Ternisien nicolas.ternisien@gmail.com"), - "http://ksystemlog.forum-software.org", - "nicolas.ternisien@gmail.com" - ); - - about.addAuthor( - ki18n("Nicolas Ternisien"), - ki18n("Main developer"), - "nicolas.ternisien@gmail.com", - "http://www.forum-software.org" - ); - - about.setProgramIconName(QLatin1String( "utilities-log-viewer" )); - about.addCredit(ki18n("Bojan Djurkovic"), ki18n("Log Printing"), "dbojan@gmail.com"); - - KCmdLineArgs::init(argc, argv, &about); - - KCmdLineOptions options; - options.add("+[URL]", ki18n("Document to open")); - - KCmdLineArgs::addCmdLineOptions( options ); - - KApplication app; - - //See if we are starting with session management - if (app.isSessionRestored()) { - RESTORE(KSystemLog::MainWindow); - } - else { - //No session... Just start up normally - KCmdLineArgs* args=KCmdLineArgs::parsedArgs(); - if (args->count()==0) { - new KSystemLog::MainWindow(); - } - else { - /*KSystemLog::MainWindow* mainWindow;*/ - new KSystemLog::MainWindow(); - for (int i = 0; i < args->count(); i++) { - logDebug() << "Loading file " << args->url(i); - //TODO Implement this kind of loading - //LogManager* firstLogManager = d->tabs->createTab(); - //d->tabs->load(Globals::instance()->findLogMode("openLogMode"), firstLogManager); - //Open log mode need to automatically find the passed url : args->url(i) - - } - } - - args->clear(); - } - - return app.exec(); -} diff --git a/ksystemlog/src/mainWindow.cpp b/ksystemlog/src/mainWindow.cpp deleted file mode 100644 index 26f94d13..00000000 --- a/ksystemlog/src/mainWindow.cpp +++ /dev/null @@ -1,802 +0,0 @@ -/*************************************************************************** - * 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 "mainWindow.h" - -//Qt includes - -#include -#include -#include -#include - -//KDE includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//Project includes -#include "ksystemlogConfig.h" - -#include "statusBar.h" - -#include "logViewWidget.h" -#include "tabLogViewsWidget.h" -#include "configurationDialog.h" - -#include "loggerDialog.h" - -#include "detailDialog.h" - -#include "logModeConfiguration.h" -#include "logManager.h" - -#include "logMode.h" -#include "logLevel.h" -#include "logFile.h" - -#include "logging.h" - -#include "view.h" -#include "logViewSearchWidget.h" -#include "logModePluginsLoader.h" - -#include "globals.h" -#include "logModeAction.h" - -namespace KSystemLog { - -class MainWindowPrivate { - -public: - - KAction* saveAction; - KAction* copyAction; - - KAction* reloadAction; - - KAction* sendMailAction; - KAction* logMessageAction; - - KAction* filterBarAction; - - KAction* selectAllAction; - - KAction* expandAllAction; - KAction* collapseAllAction; - - KAction* resumePauseAction; - KAction* detailAction; - KAction* printAction; - - KAction* findAction; - KAction* findNextAction; - KAction* findPreviousAction; - - KAction* tooltipEnabledAction; - KAction* newLinesDisplayedAction; - - /** - * Action groups which stores all Log Mode Actions - */ - QActionGroup* logModesActionGroup; - - - QPrinter* printer; - - /** - * Detail dialog - */ - DetailDialog* detailDialog; - - /** - * Logged Dialog - */ - LoggerDialog* loggedDialog; - - ConfigurationDialog* configurationDialog; - - /** - * Tab widget managing different views - */ - TabLogViewsWidget* tabs; - - KSystemLog::StatusBar* statusBar; - -}; - -MainWindow::MainWindow() : - KXmlGuiWindow(0), - d(new MainWindowPrivate()) - { - - d->printer = NULL; - d->detailDialog = NULL; - d->configurationDialog = NULL; - d->tabs = NULL; - d->statusBar = NULL; - - logDebug() << "Starting KSystemLog..."; - - //Load log modes plugins - loadLogModePlugins(); - - //Create the GUI from XML configuration - logDebug() << "Creating Gui..."; - createGUI(); - - //TODO Improve the status bar to add a custom widget which shows an history of latest message, and add a LogLevel for each ones - //Initialize the Status Bar - setupStatusBar(); - - //Setup the main tab bar - setupTabLogViews(); - - //Setup the Actions - setupActions(); - - // Apply the create the main window and ask the mainwindow to - // automatically save settings if changed: window size, toolbar - // position, icon size, etc. Also to add actions for the statusbar - // toolbar, and keybindings if necessary. - logDebug() << "Setup Gui..."; - setupGUI(); - - setupLogActions(); - - //Apply the saved mainwindow settings, if any, and ask the main window - //to automatically save settings if changed: window size, tool bar - //position, icon size, etc. - setAutoSaveSettings(); - - //TODO Try to find an improvement of this _big_ hack to set its default size, the first time KSystemLog is loaded - - //Show KSystemLog before loading the first log file - show(); - - LogManager* firstLogManager = d->tabs->createTab(); - - if (KSystemLogConfig::startupLogMode().isEmpty() == false) { - d->tabs->load(Globals::instance()->findLogMode(KSystemLogConfig::startupLogMode()), firstLogManager); - } - - //Set focus to the list - firstLogManager->usedView()->logViewWidget()->setFocus(); -} - -void MainWindow::loadLogModePlugins() { - LogModePluginsLoader pluginsLoader(this); - pluginsLoader.loadPlugins(); -} - -void MainWindow::setupTabLogViews() { - logDebug() << "Creating tab widget..."; - - d->tabs=new TabLogViewsWidget(); - - connect(d->tabs, SIGNAL(statusBarChanged(QString)), this, SLOT(changeStatusBar(QString))); - connect(d->tabs, SIGNAL(logManagerCreated(LogManager*)), this, SLOT(prepareCreatedLogManager(LogManager*))); - connect(d->tabs, SIGNAL(currentChanged(int)), this, SLOT(changeCurrentTab())); - - setCentralWidget(d->tabs); -} - -MainWindow::~MainWindow() { - delete d->loggedDialog; - - delete d->detailDialog; - - delete d->configurationDialog; - - delete d; -} - - -void MainWindow::setupStatusBar() { - d->statusBar = new KSystemLog::StatusBar(this); - - setStatusBar(d->statusBar); -} - -void MainWindow::prepareCreatedLogManager(LogManager* manager) { - logDebug() << "Connecting to actions the new log manager and view..."; - - //Contextual menu Log Manager signals - QAction* separator; - - manager->usedView()->logViewWidget()->addAction(d->reloadAction); - manager->usedView()->logViewWidget()->addAction(d->selectAllAction); - - separator = new QAction(this); - separator->setSeparator(true); - manager->usedView()->logViewWidget()->addAction(separator); - - manager->usedView()->logViewWidget()->addAction(d->copyAction); - manager->usedView()->logViewWidget()->addAction(d->saveAction); - - separator = new QAction(this); - separator->setSeparator(true); - manager->usedView()->logViewWidget()->addAction(separator); - - manager->usedView()->logViewWidget()->addAction(d->tooltipEnabledAction); - manager->usedView()->logViewWidget()->addAction(d->newLinesDisplayedAction); - - separator = new QAction(this); - separator->setSeparator(true); - manager->usedView()->logViewWidget()->addAction(separator); - - manager->usedView()->logViewWidget()->addAction(d->detailAction); - - //Log Manager and View signals - connect(manager, SIGNAL(windowTitleChanged(QString)), this, SLOT(changeWindowTitle(QString))); - connect(manager, SIGNAL(statusBarChanged(QString)), this, SLOT(changeStatusBar(QString))); - connect(manager, SIGNAL(logUpdated(View*,int)), this, SLOT(updateStatusBar())); - connect(manager, SIGNAL(reloaded()), this, SLOT(changeCurrentTab())); - - connect(manager->usedView(), SIGNAL(searchFilterChanged()), this, SLOT(updateStatusBar())); - connect(manager->usedView()->logViewWidget(), SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(showDetailsDialog())); - connect(manager->usedView()->logViewWidget(), SIGNAL(itemSelectionChanged()), this, SLOT(updateSelection())); - connect(manager->usedView()->logViewWidget()->model(), SIGNAL(processingMultipleInsertions(bool)), this, SLOT(updateReloading())); - - //Correctly initialize the Status Bar - updateStatusBar(); - -} - -void MainWindow::updateDetailDialog() { - LogManager* currentManager=d->tabs->activeLogManager(); - if (d->detailDialog!=NULL) { - d->detailDialog->selectionChanged(currentManager->usedView()->logViewWidget()); - } -} - -void MainWindow::updateSelection() { - //logDebug() << "Updating selection..."; - - LogManager* currentLogManager = d->tabs->activeLogManager(); - - updateDetailDialog(); - - bool selection=currentLogManager->usedView()->logViewWidget()->hasItemsSelected(); - - d->copyAction->setEnabled(selection); - d->saveAction->setEnabled(selection); - d->detailAction->setEnabled(selection); - d->sendMailAction->setEnabled(selection); - d->printAction->setEnabled(selection); - -} - -void MainWindow::updateReloading() { - View* currentView = d->tabs->activeLogManager()->usedView(); - - bool enabled = ! currentView->logViewWidget()->model()->isProcessingMultipleInsertions(); - - d->reloadAction->setEnabled(enabled); - d->resumePauseAction->setEnabled(enabled); - d->findAction->setEnabled(enabled); - d->findNextAction->setEnabled(enabled); - d->findPreviousAction->setEnabled(enabled); - - //Enables/Disables all Log Mode actions - d->logModesActionGroup->setEnabled(enabled); - - d->tabs->changeReloadingTab(currentView, !enabled); - - //Enables/Disables all Log Mode menus (useful for multiple actions menus) - foreach(LogModeAction* logModeAction, Globals::instance()->logModeActions()) { - logModeAction->actionMenu()->setEnabled(enabled); - } - -} - -void MainWindow::closeEvent(QCloseEvent *event) { - logDebug() << "Saving configuration before exit..."; - //Write the config to the file - KSystemLogConfig::self()->writeConfig(); - KXmlGuiWindow::closeEvent(event); -} - -TabLogViewsWidget* MainWindow::tabs() { - return d->tabs; -} - -void MainWindow::showDetailsDialog() { - //Create the Detail dialog if it was not created - if (d->detailDialog==NULL) { - d->detailDialog=new DetailDialog(this); - updateDetailDialog(); - } - - d->detailDialog->show(); - -} - -void MainWindow::toggleItemTooltip(bool enabled) { - KSystemLogConfig::setTooltipEnabled(enabled); - - foreach (LogManager* manager, d->tabs->logManagers()) { - manager->usedView()->logViewWidget()->toggleToolTip(enabled); - } -} - -void MainWindow::toggleNewLinesDisplaying(bool displayed) { - KSystemLogConfig::setNewLinesDisplayed(displayed); -} - -void MainWindow::updateStatusBar() { - logDebug() << "Updating status bar..."; - - LogManager* currentManager=d->tabs->activeLogManager(); - - int itemCount = currentManager->usedView()->logViewWidget()->itemCount(); - int notHiddenItemCount = currentManager->usedView()->logViewWidget()->notHiddenItemCount(); - - if (itemCount == notHiddenItemCount) { - d->statusBar->changeLineCountMessage(i18ncp("Total displayed lines", "1 line.", "%1 lines.", currentManager->usedView()->logViewWidget()->itemCount())); - } - else { - d->statusBar->changeLineCountMessage(i18ncp("Line not hidden by search / Total displayed lines", "1 line / %2 total.", "%1 lines / %2 total.", notHiddenItemCount, itemCount)); - } - - d->statusBar->changeLastModification(currentManager->lastUpdate()); - -} - -void MainWindow::toggleResumePauseParsing(bool paused) { - logDebug() << "Pausing parsing : " << paused; - - LogManager* currentLogManager = d->tabs->activeLogManager(); - if (currentLogManager != NULL) { - currentLogManager->setParsingPaused(paused); - } - - logDebug() << "Parsing paused : " << paused; -} - -void MainWindow::changeResumePauseAction(bool paused) { - - if (paused == true) { - d->resumePauseAction->setText(i18n("Resu&me")); - d->resumePauseAction->setIcon(KIcon( QLatin1String( "media-playback-start" ))); - d->resumePauseAction->setShortcut(Qt::CTRL + Qt::Key_M); - d->resumePauseAction->setToolTip(i18n("Resume the watching of the current log")); - d->resumePauseAction->setWhatsThis(i18n("Resumes the watching of the current log. This action is only available when the user has already paused the reading.")); - d->resumePauseAction->setChecked(true); - } - else { - d->resumePauseAction->setText(i18n("S&top")); - d->resumePauseAction->setIcon(KIcon( QLatin1String( "media-playback-stop" ))); - d->resumePauseAction->setShortcut(Qt::CTRL + Qt::Key_P); - d->resumePauseAction->setToolTip(i18n("Pause the watching of the current log")); - d->resumePauseAction->setWhatsThis(i18n("Pauses the watching of the current log. This action is particularly useful when the system is writing too many lines to log files, causing KSystemLog to reload too frequently.")); - d->resumePauseAction->setChecked(false); - } - - //Be sur that the button will always have a good size - foreach (QWidget* widget, d->resumePauseAction->associatedWidgets()) { - if (widget->sizeHint().width() > widget->size().width()) { - widget->setMinimumSize(widget->sizeHint()); - } - } -} - -void MainWindow::fileOpen() { - //Launch the actualizing - d->tabs->load(Globals::instance()->findLogMode(QLatin1String( "openLogMode" )), d->tabs->activeLogManager()); -} - -void MainWindow::showConfigurationDialog() { - logDebug() << "Showing configuration dialog..."; - - if (d->configurationDialog == NULL) { - d->configurationDialog = new ConfigurationDialog(this); - connect(d->configurationDialog, SIGNAL(configurationSaved()), d->tabs, SLOT(reloadAll())); - } - - d->configurationDialog->showConfiguration(); -} - -void MainWindow::showLogMessageDialog() { - logDebug() << "Launching the Send message dialog box..."; - - if (d->loggedDialog == NULL) { - d->loggedDialog = new LoggerDialog(this); - } - - d->loggedDialog->initialize(); - d->loggedDialog->exec(); - -} - -void MainWindow::changeStatusBar(const QString& text) { - d->statusBar->changeMessage(text); -} - -void MainWindow::changeWindowTitle(const QString& text) { - //Display this text on the caption - setCaption(text); -} - - -void MainWindow::changeCurrentTab() { - logDebug() << "Tab has changed"; - - LogManager* currentManager=d->tabs->activeLogManager(); - - //If the tab changed, the selection changes too - updateSelection(); - - //Update the status bar - updateStatusBar(); - - //Updating the current reloading status - updateReloading(); - - bool enabledReloading = ! currentManager->usedView()->logViewWidget()->model()->isProcessingMultipleInsertions(); - - bool enabledAction; - //Change the title of the window - if (currentManager->logMode() == NULL) { - changeWindowTitle(i18nc("Newly created tab", "Empty Log")); - enabledAction = false; - } - else { - changeWindowTitle(currentManager->logMode()->name()); - enabledAction = true; - } - - if (enabledReloading==true && enabledAction==true) { - d->reloadAction->setEnabled(true); - d->resumePauseAction->setEnabled(true); - } - else { - d->reloadAction->setEnabled(false); - d->resumePauseAction->setEnabled(false); - } - - - //Update Resume/Pause action state - if (currentManager->isParsingPaused()) - changeResumePauseAction(true); - else - changeResumePauseAction(false); - - //Updating Detail dialog - updateDetailDialog(); - - logDebug() << "Tab changing done"; -} - -/** - * TODO Implements the session restoring - * - * The 'config' object points to the session managed - * config file. anything you write here will be available - * later when this app is restored - */ -void MainWindow::saveProperties(KConfigGroup & /*configuration*/) { - logDebug() << "Saving properties..."; -} - -/** - * TODO Implements the session restoring - * - * The 'config' object points to the session managed - * config file. this function is automatically called whenever - * the app is being restored. read in here whatever you wrote - * in 'saveProperties' - */ -void MainWindow::readProperties( const KConfigGroup& /*configuration*/) { - logDebug() << "Reading properties..."; -} - -void MainWindow::toggleFilterBar() { - logDebug() << "Toggling filter bar..." << d->filterBarAction->isChecked(); - - foreach (LogManager* manager, d->tabs->logManagers()) { - manager->usedView()->toggleLogViewFilter(d->filterBarAction->isChecked()); - } - - KSystemLogConfig::setToggleFilterBar(d->filterBarAction->isChecked()); -} - -void MainWindow::findNext() { - showSearchBar(); - d->tabs->activeLogManager()->usedView()->logViewSearch()->findNext(); -} - -void MainWindow::findPrevious() { - showSearchBar(); - d->tabs->activeLogManager()->usedView()->logViewSearch()->findPrevious(); -} - -void MainWindow::showSearchBar() { - logDebug() << "Showing search bar..."; - - LogManager* activeLogManager = d->tabs->activeLogManager(); - - foreach (LogManager* manager, d->tabs->logManagers()) { - if (manager != activeLogManager) { - manager->usedView()->toggleLogViewSearch(true); - } - } - - //Be sure to display the view search of the active LogManager at last, and focus to it - d->tabs->activeLogManager()->usedView()->toggleLogViewSearch(true); - -} - -void MainWindow::setupActions() { - logDebug() << "Creating actions..."; - - QAction* fileOpenAction = actionCollection()->addAction(KStandardAction::Open, this, SLOT(fileOpen())); - fileOpenAction->setToolTip(i18n("Open a file in KSystemLog")); - fileOpenAction->setWhatsThis(i18n("Opens a file in KSystemLog and displays its content in the current tab.")); - - d->printAction = actionCollection()->addAction(KStandardAction::Print); - d->printAction->setText(i18n("&Print Selection...")); - d->printAction->setToolTip(i18n("Print the selection")); - d->printAction->setWhatsThis(i18n("Prints the selection. Simply select the important lines and click on this menu entry to print the selection.")); - d->printAction->setEnabled(false); - - d->saveAction = actionCollection()->addAction(KStandardAction::SaveAs); - //TODO Retrieve the system's shortcut of the save action (and not Save as...) - d->saveAction->setShortcut(Qt::CTRL + Qt::Key_S); - d->saveAction->setToolTip(i18n("Save the selection to a file")); - d->saveAction->setWhatsThis(i18n("Saves the selection to a file. This action is useful if you want to create an attachment or a backup of a particular log.")); - d->saveAction->setEnabled(false); - - QAction* fileQuitAction = actionCollection()->addAction(KStandardAction::Quit, kapp, SLOT(quit())); - fileQuitAction->setToolTip(i18n("Quit KSystemLog")); - fileQuitAction->setWhatsThis(i18n("Quits KSystemLog.")); - - d->copyAction = actionCollection()->addAction(KStandardAction::Copy); - d->copyAction->setToolTip(i18n("Copy the selection to the clipboard")); - d->copyAction->setWhatsThis(i18n("Copies the selection to the clipboard. This action is useful if you want to paste the selection in a chat or an email.")); - d->copyAction->setEnabled(false); - - d->expandAllAction = actionCollection()->addAction( QLatin1String( "expand_all" )); - d->expandAllAction->setText(i18n("Ex&pand All")); - d->expandAllAction->setShortcut(Qt::CTRL + Qt::Key_X); - d->expandAllAction->setToolTip(i18n("Expand all categories")); - d->expandAllAction->setWhatsThis(i18n("This action opens all main categories. This is enabled only if an option has been selected in the Group By menu.")); - d->expandAllAction->setEnabled(false); - - d->collapseAllAction = actionCollection()->addAction( QLatin1String( "collapse_all" )); - d->collapseAllAction->setText(i18n("Col&lapse All")); - d->collapseAllAction->setShortcut(Qt::CTRL + Qt::Key_L); - d->collapseAllAction->setToolTip(i18n("Collapse all categories")); - d->collapseAllAction->setWhatsThis(i18n("This action closes all main categories. This is enabled only if an option has been selected in the Group By menu.")); - d->collapseAllAction->setEnabled(false); - - d->sendMailAction = actionCollection()->addAction( QLatin1String( "send_mail" )); - d->sendMailAction->setText(i18n("&Email Selection...")); - d->sendMailAction->setIcon(KIcon( QLatin1String( "mail-message-new" ))); - d->sendMailAction->setShortcut(Qt::CTRL + Qt::Key_M); - d->sendMailAction->setToolTip(i18n("Send the selection by mail")); - d->sendMailAction->setWhatsThis(i18n("Sends the selection by mail. Simply select the important lines and click on this menu entry to send the selection to a friend or a mailing list.")); - d->sendMailAction->setEnabled(false); - - d->logMessageAction = actionCollection()->addAction( QLatin1String( "log_message" ), this, SLOT(showLogMessageDialog())); - d->logMessageAction->setText(i18n("&Add Log Entry...")); - d->logMessageAction->setIcon(KIcon( QLatin1String( "document-new" ))); - d->logMessageAction->setShortcut(Qt::CTRL + Qt::Key_L); - d->logMessageAction->setToolTip(i18n("Add a log entry to the log system")); - d->logMessageAction->setWhatsThis(i18n("This action will open a dialog which lets you send a message to the log system.")); - - d->selectAllAction = actionCollection()->addAction(KStandardAction::SelectAll); - d->selectAllAction->setToolTip(i18n("Select all lines of the current log")); - d->selectAllAction->setWhatsThis(i18n("Selects all lines of the current log. This action is useful if you want, for example, to save all the content of the current log in a file.")); - - d->findAction = actionCollection()->addAction(KStandardAction::Find, this, SLOT(showSearchBar())); - d->findNextAction = actionCollection()->addAction(KStandardAction::FindNext, this, SLOT(findNext())); - d->findPreviousAction = actionCollection()->addAction(KStandardAction::FindPrev, this, SLOT(findPrevious())); - - - actionCollection()->addAction(KStandardAction::Preferences, this, SLOT(showConfigurationDialog())); - - //TODO Find a solution to display at the right place this action (see Akregator interface) - d->filterBarAction = actionCollection()->addAction( QLatin1String( "show_quick_filter" ), this, SLOT(toggleFilterBar())); - d->filterBarAction->setText(i18n("Show &Filter Bar")); - d->filterBarAction->setEnabled(true); - d->filterBarAction->setCheckable(true); - d->filterBarAction->setChecked(KSystemLogConfig::toggleFilterBar()); - - KAction* newTabAction = actionCollection()->addAction( QLatin1String( "new_tab" ), d->tabs, SLOT(createTab())); - newTabAction->setText(i18n("&New Tab")); - newTabAction->setIcon(KIcon( QLatin1String( "tab-new" ))); - newTabAction->setShortcut(Qt::CTRL + Qt::Key_T); - newTabAction->setToolTip(i18n("Create a new tab")); - newTabAction->setWhatsThis(i18n("Creates a new tab which can display another log.")); - d->tabs->addAction(newTabAction); - - KAction* closeTabAction = actionCollection()->addAction( QLatin1String( "close_tab" ), d->tabs, SLOT(closeTab())); - closeTabAction->setText(i18n("&Close Tab")); - closeTabAction->setIcon(KIcon( QLatin1String( "tab-close" ))); - closeTabAction->setShortcut(Qt::CTRL+Qt::Key_W); - closeTabAction->setToolTip(i18n("Close the current tab")); - closeTabAction->setWhatsThis(i18n("Closes the current tab.")); - d->tabs->addAction(closeTabAction); - - KAction* duplicateTabAction = actionCollection()->addAction( QLatin1String( "duplicate_tab" ), d->tabs, SLOT(duplicateTab())); - duplicateTabAction->setText(i18n("&Duplicate Tab")); - duplicateTabAction->setIcon(KIcon( QLatin1String( "tab-duplicate" ))); - duplicateTabAction->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_N); - duplicateTabAction->setToolTip(i18n("Duplicate the current tab")); - duplicateTabAction->setWhatsThis(i18n("Duplicates the current tab.")); - d->tabs->addAction(duplicateTabAction); - - QAction* separatorAction = new QAction(this); - separatorAction->setSeparator(true); - d->tabs->addAction(separatorAction); - - KAction* moveTabLeftAction = actionCollection()->addAction( QLatin1String( "move_tab_left" ), d->tabs, SLOT(moveTabLeft())); - moveTabLeftAction->setText(i18n("Move Tab &Left")); - moveTabLeftAction->setIcon(KIcon( QLatin1String( "arrow-left" ))); - moveTabLeftAction->setShortcut(Qt::SHIFT+Qt::CTRL+Qt::Key_Left); - moveTabLeftAction->setToolTip(i18n("Move the current tab to the left")); - moveTabLeftAction->setWhatsThis(i18n("Moves the current tab to the left.")); - d->tabs->addAction(moveTabLeftAction); - - KAction* moveTabRightAction = actionCollection()->addAction( QLatin1String( "move_tab_right" ), d->tabs, SLOT(moveTabRight())); - moveTabRightAction->setText(i18n("Move Tab &Right")); - moveTabRightAction->setIcon(KIcon( QLatin1String( "arrow-right" ))); - moveTabRightAction->setShortcut(Qt::SHIFT+Qt::CTRL+Qt::Key_Right); - moveTabRightAction->setToolTip(i18n("Move the current tab to the right")); - moveTabRightAction->setWhatsThis(i18n("Moves the current tab to the right.")); - d->tabs->addAction(moveTabRightAction); - - d->reloadAction = actionCollection()->addAction( QLatin1String( "reload" ), d->tabs, SLOT(reloadCurrent())); - d->reloadAction->setText(i18n("&Reload")); - d->reloadAction->setIcon(KIcon( QLatin1String( "view-refresh" ))); - d->reloadAction->setShortcut(Qt::Key_F5); - d->reloadAction->setToolTip(i18n("Reload the current log")); - d->reloadAction->setWhatsThis(i18n("Reloads the current log, if you want to be sure that the view is correctly updated.")); - - d->resumePauseAction = actionCollection()->addAction( QLatin1String( "resume_pause_parsing" )); - d->resumePauseAction->setCheckable(true); - connect(d->resumePauseAction, SIGNAL(toggled(bool)), this, SLOT(changeResumePauseAction(bool))); - connect(d->resumePauseAction, SIGNAL(toggled(bool)), this, SLOT(toggleResumePauseParsing(bool))); - changeResumePauseAction(false); - - d->detailAction = actionCollection()->addAction( QLatin1String( "details" ), this, SLOT(showDetailsDialog())); - d->detailAction->setText(i18n("&Details")); - d->detailAction->setIcon(KIcon( QLatin1String( "document-preview" ))); - d->detailAction->setShortcut(Qt::ALT + Qt::Key_Return); - d->detailAction->setToolTip(i18n("Display details on the selected line")); - d->detailAction->setWhatsThis(i18n("Displays a dialog box which contains details on the selected line. You are able to navigate through the logs from this dialog box with the Previous and Next buttons.")); - d->detailAction->setEnabled(false); - - d->tooltipEnabledAction = actionCollection()->addAction( QLatin1String( "tooltipEnabled" )); - d->tooltipEnabledAction->setText(i18n("&Enable Detailed Tooltips")); - d->tooltipEnabledAction->setToolTip(i18n("Disable/Enable the tooltip on the current view")); - d->tooltipEnabledAction->setWhatsThis(i18n("Disables/Enables the tooltip displayed when the cursor hovers a log line.")); - d->tooltipEnabledAction->setCheckable(true); - d->tooltipEnabledAction->setChecked(KSystemLogConfig::tooltipEnabled()); - connect(d->tooltipEnabledAction, SIGNAL(toggled(bool)), this, SLOT(toggleItemTooltip(bool))); - - d->newLinesDisplayedAction = actionCollection()->addAction( QLatin1String( "newLinesDisplayed" )); - d->newLinesDisplayedAction->setText(i18n("&Scroll to New Lines")); - d->newLinesDisplayedAction->setToolTip(i18n("Scrolls or not to the new lines when the log changes")); - d->newLinesDisplayedAction->setWhatsThis(i18n("Scrolls or not to the new lines when the log changes. Check this option if you do not want the application to scroll automatically at the bottom of the log each time it is refreshed.")); - d->newLinesDisplayedAction->setCheckable(true); - d->newLinesDisplayedAction->setChecked(KSystemLogConfig::newLinesDisplayed()); - connect(d->newLinesDisplayedAction, SIGNAL(toggled(bool)), this, SLOT(toggleNewLinesDisplaying(bool))); - - //Toolbar and Menu signals - connect(d->expandAllAction, SIGNAL(triggered()), d->tabs, SLOT(expandAllCurrentView())); - connect(d->collapseAllAction, SIGNAL(triggered()), d->tabs, SLOT(collapseAllCurrentView())); - connect(d->saveAction, SIGNAL(triggered()), d->tabs, SLOT(fileSaveCurrentView())); - connect(d->copyAction, SIGNAL(triggered()), d->tabs, SLOT(copyToClipboardCurrentView())); - connect(d->sendMailAction, SIGNAL(triggered()), d->tabs, SLOT(sendMailCurrentView())); - connect(d->printAction, SIGNAL(triggered()), d->tabs, SLOT(printSelectionCurrentView())); - connect(d->selectAllAction, SIGNAL(triggered()), d->tabs, SLOT(selectAllCurrentView())); - -} - -void MainWindow::selectLogModeAction(QAction* action) { - QString selectedModeId = action->data().toString(); - - LogMode* currentMode = NULL; - foreach(LogMode* logMode, Globals::instance()->logModes()) { - if (logMode->id() == selectedModeId) { - currentMode = logMode; - break; - } - } - - if (currentMode==NULL) { - logError() << "The selected mode does not exist"; - return; - } - - logDebug() << "Selecting " << currentMode->name() << " (" << currentMode->id() << ")"; - - /* - //If the user uses the middle button OR left button + shift OR left button + control : = it opens the log in a new tab - if (state==Qt::MiddleButton || (state==Qt::ControlModifier+Qt::LeftButton) || (state==Qt::ShiftModifier+Qt::LeftButton)) - createTab(); - */ - - d->tabs->load(currentMode, d->tabs->activeLogManager()); -} - -void MainWindow::setupLogActions() { - QList menuLogModeActions; - QList toolBarLogModeActions; - - KActionMenu* servicesAction = new KActionMenu(KIcon( QLatin1String( "preferences-system-session-services") ), i18n("Services"), this); - KActionMenu* othersAction = new KActionMenu(KIcon( QLatin1String( "preferences-other")), i18n("Others"), this); - - d->logModesActionGroup=new QActionGroup(actionCollection()); - - connect(d->logModesActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(selectLogModeAction(QAction*))); - - foreach(LogModeAction* logModeAction, Globals::instance()->logModeActions()) { - foreach(QAction* action, logModeAction->innerActions()) { - d->logModesActionGroup->addAction(action); - } - - if (logModeAction->category() == LogModeAction::RootCategory) - menuLogModeActions.append( logModeAction->actionMenu() ); - else if (logModeAction->category() == LogModeAction::ServicesCategory) - servicesAction->addAction( logModeAction->actionMenu() ); - else if (logModeAction->category() == LogModeAction::OthersCategory) - othersAction->addAction( logModeAction->actionMenu() ); - - if (logModeAction->isInToolBar() == true) { - toolBarLogModeActions.append( logModeAction->actionMenu() ); - } - } - - menuLogModeActions.append( servicesAction ); - menuLogModeActions.append( othersAction ); - - //Menu dynamic action list - unplugActionList(QLatin1String( "log_mode_list" )); - plugActionList(QLatin1String( "log_mode_list" ), menuLogModeActions); - - //ToolBar dynamic action list - unplugActionList(QLatin1String( "tool_bar_log_mode_list" )); - plugActionList(QLatin1String( "tool_bar_log_mode_list" ), toolBarLogModeActions); - -} - -} - -#include "moc_mainWindow.cpp" diff --git a/ksystemlog/src/mainWindow.h b/ksystemlog/src/mainWindow.h deleted file mode 100644 index 65cd0bbc..00000000 --- a/ksystemlog/src/mainWindow.h +++ /dev/null @@ -1,142 +0,0 @@ -/*************************************************************************** - * 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 MAIN_WINDOW_H -#define MAIN_WINDOW_H - -#include - -//KDE includes -#include -#include -#include -#include - -#include - -#include - -class LogManager; -class LogMode; - -class View; - -class TabLogViewsWidget; - -namespace KSystemLog { - -class MainWindowPrivate; - -/** - * This class serves as the main window for ksystemlog. It handles the - * menus, toolbars, and status bars. - */ -class MainWindow : public KXmlGuiWindow { - - Q_OBJECT - - public: - /** - * Default Constructor - */ - MainWindow(); - - /** - * Default Destructor - */ - virtual ~MainWindow(); - - TabLogViewsWidget* tabs(); - - protected: - /** - * This function is called when it is time for the app to save its - * properties for session management purposes. - */ - void saveProperties(KConfigGroup& configuration); - - /** - * This function is called when this app is restored. The KConfig - * object points to the session management config file that was saved - * with @ref saveProperties - */ - void readProperties(const KConfigGroup& configuration); - - /** - * Reimplemented to save configuration when closing. - */ - void closeEvent(QCloseEvent *event); - - public slots: - void changeStatusBar(const QString& text); - void changeWindowTitle(const QString& text); - - void updateStatusBar(); - - void prepareCreatedLogManager(LogManager* logManager); - - private slots: - void fileOpen(); - - void showConfigurationDialog(); - void showDetailsDialog(); - void showLogMessageDialog(); - - //Transmits signals to active LogManager - void showSearchBar(); - void findNext(); - void findPrevious(); - - void updateSelection(); - void updateReloading(); - - void toggleFilterBar(); - - void toggleItemTooltip(bool enabled); - void toggleNewLinesDisplaying(bool displayed); - void toggleResumePauseParsing(bool paused); - - void changeCurrentTab(); - - void changeResumePauseAction(bool paused); - void selectLogModeAction(QAction* action); - - private: - - void loadLogModePlugins(); - - void setupStatusBar(); - - void setupTabLogViews(); - - void setupActions(); - void setupLogActions(); - - void updateDetailDialog(); - - MainWindowPrivate* const d; - -}; - -} - -#endif //MAIN_WINDOW_H - diff --git a/ksystemlog/src/modes/acpid/acpidAnalyzer.cpp b/ksystemlog/src/modes/acpid/acpidAnalyzer.cpp deleted file mode 100644 index ba64b933..00000000 --- a/ksystemlog/src/modes/acpid/acpidAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "acpidAnalyzer.h" diff --git a/ksystemlog/src/modes/acpid/acpidAnalyzer.h b/ksystemlog/src/modes/acpid/acpidAnalyzer.h deleted file mode 100644 index 8355b19f..00000000 --- a/ksystemlog/src/modes/acpid/acpidAnalyzer.h +++ /dev/null @@ -1,140 +0,0 @@ -/*************************************************************************** - * 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 _ACPID_ANALYZER_H_ -#define _ACPID_ANALYZER_H_ - -#include - -#include "analyzer.h" - -#include "localLogFileReader.h" -#include "parsingHelper.h" -#include "acpidLogMode.h" - - -class AcpidAnalyzer : public Analyzer { - Q_OBJECT - - public: - AcpidAnalyzer(LogMode* logMode) : - Analyzer(logMode) { - - } - - virtual ~AcpidAnalyzer() { - - } - - LogViewColumns initColumns() { - LogViewColumns columns; - columns.addColumn(LogViewColumn(i18n("Date"), true, false)); - columns.addColumn(LogViewColumn(i18n("Type"), true, true)); - columns.addColumn(LogViewColumn(i18n("Message"), true, false)); - - return columns; - } - - - protected: - LogFileReader* createLogFileReader(const LogFile& logFile) { - return new LocalLogFileReader(logFile); - } - - Analyzer::LogFileSortMode logFileSortMode() { - return Analyzer::AscendingSortedLogFile; - } - - LogLine* parseMessage(const QString& logLine, const LogFile& originalFile) { - QString line(logLine); - - int dateBegin=line.indexOf(QLatin1String( "[" )); - int dateEnd=line.indexOf(QLatin1String( "]" )); - - QString type; - QString message; - QDate date; - QTime time; - - //If there is a format problem in the line - if (dateBegin==-1 || dateEnd==-1) { - type=QLatin1String( "" ); //No type - message=line; - date=QDate::currentDate(); - time=QTime::currentTime(); - } - else { - - QString strDate=line.mid(dateBegin+1, dateEnd-dateBegin-1); - - QString month=strDate.mid(4, 3); - - QString day=strDate.mid(8, 2); - - QString hour=strDate.mid(11, 2); - QString min=strDate.mid(14, 2); - QString sec=strDate.mid(17, 2); - - QString year=strDate.mid(20, 4); - - date=QDate(year.toInt(), ParsingHelper::instance()->parseSyslogMonth(month), day.toInt()); - time=QTime(hour.toInt(), min.toInt(), sec.toInt()); - - //logDebug() << "Date=" << date.toString(); - //logDebug() << "Time=" << time.toString(); - - line=line.remove(0, dateEnd+2); - - int endType=line.indexOf(QLatin1String( "\"" )); - - //If the " character does not exist, it means that there is no Type category - if (endType==-1) { - type=QLatin1String( "" ); //No type - message=line; - } - else { - type=line.left(endType-1); - line=line.remove(0, endType+1); - - message=line.left(line.length()-2); - } - - } - - - QStringList list; - - list.append(type); - list.append(message); - - return new LogLine( - logLineInternalIdGenerator++, - QDateTime(date, time), - list, - originalFile.url().path(), - Globals::instance()->informationLogLevel(), - logMode - ); - } - -}; - -#endif // _ACPID_ANALYZER_H_ diff --git a/ksystemlog/src/modes/acpid/acpidConfiguration.cpp b/ksystemlog/src/modes/acpid/acpidConfiguration.cpp deleted file mode 100644 index 83760589..00000000 --- a/ksystemlog/src/modes/acpid/acpidConfiguration.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "acpidConfiguration.h" diff --git a/ksystemlog/src/modes/acpid/acpidConfiguration.h b/ksystemlog/src/modes/acpid/acpidConfiguration.h deleted file mode 100644 index e12bd57f..00000000 --- a/ksystemlog/src/modes/acpid/acpidConfiguration.h +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************** - * 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 _ACPID_CONFIGURATION_H_ -#define _ACPID_CONFIGURATION_H_ - -#include - -#include "logModeConfiguration.h" - -#include "logging.h" -#include "defaults.h" - -#include "acpidLogMode.h" - -#include "ksystemlogConfig.h" - -class AcpidConfigurationPrivate { -public: - QStringList acpidPaths; -}; - -class AcpidConfiguration : public LogModeConfiguration { - - Q_OBJECT - - public: - AcpidConfiguration() : - d(new AcpidConfigurationPrivate()) { - - configuration->setCurrentGroup(QLatin1String( "AcpidLogMode" )); - - QStringList defaultAcpidPaths; - defaultAcpidPaths << QLatin1String( "/var/log/acpid" ); - configuration->addItemStringList(QLatin1String( "LogFilesPaths" ), d->acpidPaths, defaultAcpidPaths, QLatin1String( "LogFilesPaths" )); - - } - - virtual ~AcpidConfiguration() { - delete d; - } - - QStringList acpidPaths() const { - return d->acpidPaths; - } - - void setAcpidPaths(const QStringList& acpidPaths) { - d->acpidPaths = acpidPaths; - } - - private: - AcpidConfigurationPrivate* const d; - -}; - -#endif // _ACPID_CONFIGURATION_H_ diff --git a/ksystemlog/src/modes/acpid/acpidConfigurationWidget.cpp b/ksystemlog/src/modes/acpid/acpidConfigurationWidget.cpp deleted file mode 100644 index dcd3dd4e..00000000 --- a/ksystemlog/src/modes/acpid/acpidConfigurationWidget.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * KApacheLog, a apache 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 "acpidConfigurationWidget.h" diff --git a/ksystemlog/src/modes/acpid/acpidConfigurationWidget.h b/ksystemlog/src/modes/acpid/acpidConfigurationWidget.h deleted file mode 100644 index 63513cf3..00000000 --- a/ksystemlog/src/modes/acpid/acpidConfigurationWidget.h +++ /dev/null @@ -1,101 +0,0 @@ -/*************************************************************************** - * 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 _ACPID_CONFIGURATION_WIDGET_H_ -#define _ACPID_CONFIGURATION_WIDGET_H_ - - -#include - -#include "globals.h" -#include "logging.h" -#include "fileList.h" - -#include "logLevel.h" - -#include "acpidConfiguration.h" -#include "acpidLogMode.h" - -#include "logModeConfigurationWidget.h" - -class FileList; - -class AcpidConfigurationWidget : public LogModeConfigurationWidget { - - Q_OBJECT - - public: - AcpidConfigurationWidget() : - LogModeConfigurationWidget(i18n("Acpid Log"), QLatin1String( ACPID_MODE_ICON ), i18n("Acpid Log")) - { - - QHBoxLayout* layout = new QHBoxLayout(); - this->setLayout(layout); - - fileList=new FileList(this, i18n("

These files will be analyzed to show the Acpid log.

") - ); - connect(fileList, SIGNAL(fileListChanged()), this, SIGNAL(configurationChanged())); - layout->addWidget(fileList); - } - - - - ~AcpidConfigurationWidget() { - - } - - public slots: - - void saveConfig() { - AcpidConfiguration* acpidConfiguration = Globals::instance()->findLogMode(QLatin1String(ACPID_LOG_MODE_ID ))->logModeConfiguration(); - - acpidConfiguration->setAcpidPaths(fileList->paths()); - } - - void readConfig() { - AcpidConfiguration* acpidConfiguration = Globals::instance()->findLogMode(QLatin1String( ACPID_LOG_MODE_ID ))->logModeConfiguration(); - - fileList->removeAllItems(); - - fileList->addPaths(acpidConfiguration->acpidPaths()); - } - - void defaultConfig() { - //TODO Find a way to read the configuration per default - readConfig(); - } - - protected: - bool isValid() const { - if (fileList->isEmpty()==false) { - return true; - } - - return false; - - } - - private: - FileList* fileList; - -}; - -#endif // _ACPID_CONFIGURATION_WIDGET_H_ diff --git a/ksystemlog/src/modes/acpid/acpidFactory.cpp b/ksystemlog/src/modes/acpid/acpidFactory.cpp deleted file mode 100644 index 88a1f812..00000000 --- a/ksystemlog/src/modes/acpid/acpidFactory.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * 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 "acpidFactory.h" - -#include - - -#include "logMode.h" -#include "logging.h" - -#include "simpleAction.h" -#include "acpidLogMode.h" - -#include "logModeFactory.h" - -QList AcpidLogModeFactory::createLogModes() const { - QList logModes; - logModes.append(new AcpidLogMode()); - return logModes; -} - -LogModeAction* AcpidLogModeFactory::createLogModeAction() const { - LogMode* logMode = Globals::instance()->findLogMode(QLatin1String( ACPID_LOG_MODE_ID )); - SimpleAction* logModeAction = new SimpleAction(logMode->action(), logMode); - logModeAction->setInToolBar(false); - logModeAction->setCategory(LogModeAction::OthersCategory); - - return logModeAction; -} diff --git a/ksystemlog/src/modes/acpid/acpidFactory.h b/ksystemlog/src/modes/acpid/acpidFactory.h deleted file mode 100644 index ac4e483e..00000000 --- a/ksystemlog/src/modes/acpid/acpidFactory.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * 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 _ACPID_FACTORY_H_ -#define _ACPID_FACTORY_H_ - -#include - -#include "logModeFactory.h" - -class LogModeAction; -class LogMode; - -class AcpidLogModeFactory : public LogModeFactory { - - Q_OBJECT - - public: - - QList createLogModes() const; - - LogModeAction* createLogModeAction() const; - -}; - -#endif // _ACPID_FACTORY_H_ - diff --git a/ksystemlog/src/modes/acpid/acpidItemBuilder.cpp b/ksystemlog/src/modes/acpid/acpidItemBuilder.cpp deleted file mode 100644 index 4d3d5607..00000000 --- a/ksystemlog/src/modes/acpid/acpidItemBuilder.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "acpidItemBuilder.h" diff --git a/ksystemlog/src/modes/acpid/acpidItemBuilder.h b/ksystemlog/src/modes/acpid/acpidItemBuilder.h deleted file mode 100644 index 6834cfcd..00000000 --- a/ksystemlog/src/modes/acpid/acpidItemBuilder.h +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * 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 _ACPID_ITEM_BUILDER_H_ -#define _ACPID_ITEM_BUILDER_H_ - -#include - -#include - -#include "logging.h" - -#include "logLine.h" -#include "logViewWidgetItem.h" -#include "logMode.h" - -#include "logModeItemBuilder.h" - -class LogLine; - -class AcpidItemBuilder : public LogModeItemBuilder { - - public: - AcpidItemBuilder() { - - } - - virtual ~AcpidItemBuilder() { - - } - - QString createFormattedText(LogLine* line) const { - QString result; - - QListIterator it(line->logItems()); - - result.append(QLatin1String( "" )); - - result.append(labelMessageFormat(i18n("Date:"), formatDate(line->time()))); - result.append(labelMessageFormat(i18n("Level:"), line->logLevel()->name())); - result.append(labelMessageFormat(i18n("Type:"), it.next())); - - result.append(QLatin1String( "
" )); - - return result; - } - -}; - -#endif // _ACPID_ITEM_BUILDER_H_ diff --git a/ksystemlog/src/modes/acpid/acpidLogMode.cpp b/ksystemlog/src/modes/acpid/acpidLogMode.cpp deleted file mode 100644 index c2b9eeb7..00000000 --- a/ksystemlog/src/modes/acpid/acpidLogMode.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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 "acpidLogMode.h" - -#include - -#include -#include - -#include "logging.h" -#include "logMode.h" - -#include "acpidAnalyzer.h" -#include "acpidItemBuilder.h" -#include "acpidConfigurationWidget.h" -#include "acpidConfiguration.h" - -AcpidLogMode::AcpidLogMode() : - LogMode(QLatin1String( ACPID_LOG_MODE_ID ), i18n("ACPI Log"),QLatin1String( ACPID_MODE_ICON )) { - - d->logModeConfiguration = new AcpidConfiguration(); - - d->logModeConfigurationWidget = new AcpidConfigurationWidget(); - - d->itemBuilder = new AcpidItemBuilder(); - - d->action = createDefaultAction(); - d->action->setToolTip(i18n("Display the ACPI log.")); - d->action->setWhatsThis(i18n("Displays the ACPI log in the current tab. ACPI is used to manage the hardware components of your computer, like notebook batteries, reset buttons...")); - -} - -AcpidLogMode::~AcpidLogMode() { - -} - -Analyzer* AcpidLogMode::createAnalyzer() { - return new AcpidAnalyzer(this); -} - -QList AcpidLogMode::createLogFiles() { - AcpidConfiguration* configuration = logModeConfiguration(); - return configuration->findNoModeLogFiles(configuration->acpidPaths()); -} diff --git a/ksystemlog/src/modes/acpid/acpidLogMode.h b/ksystemlog/src/modes/acpid/acpidLogMode.h deleted file mode 100644 index cc407998..00000000 --- a/ksystemlog/src/modes/acpid/acpidLogMode.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * 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 _ACPID_LOG_MODE_H_ -#define _ACPID_LOG_MODE_H_ - -/** - * Acpid Log Mode Identifier - */ -#define ACPID_LOG_MODE_ID "acpidLogMode" - -/** - * Acpid Log Icon - */ -#define ACPID_MODE_ICON "battery" - -#include - -#include "logFile.h" - -#include "logMode.h" - -class AcpidLogMode : public LogMode { - - Q_OBJECT - -public: - explicit AcpidLogMode(); - - ~AcpidLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _ACPID_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/apache/apacheAccessAnalyzer.cpp b/ksystemlog/src/modes/apache/apacheAccessAnalyzer.cpp deleted file mode 100644 index 353a334a..00000000 --- a/ksystemlog/src/modes/apache/apacheAccessAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "apacheAccessAnalyzer.h" diff --git a/ksystemlog/src/modes/apache/apacheAccessAnalyzer.h b/ksystemlog/src/modes/apache/apacheAccessAnalyzer.h deleted file mode 100644 index 75f51ab5..00000000 --- a/ksystemlog/src/modes/apache/apacheAccessAnalyzer.h +++ /dev/null @@ -1,149 +0,0 @@ -/*************************************************************************** - * 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 _APACHE_ACCESS_ANALYZER_H_ -#define _APACHE_ACCESS_ANALYZER_H_ - - -#include - -#include "analyzer.h" - -#include "localLogFileReader.h" -#include "logging.h" -#include "parsingHelper.h" - -#include "apacheAccessLogMode.h" - -class ApacheAccessAnalyzer : public Analyzer { - - Q_OBJECT - - public: - explicit ApacheAccessAnalyzer(LogMode* logMode) : - Analyzer(logMode) { - - } - - virtual ~ApacheAccessAnalyzer() { - - } - - LogViewColumns initColumns() { - LogViewColumns columns; - - columns.addColumn(LogViewColumn(i18n("Date"), true, false)); - columns.addColumn(LogViewColumn(i18n("Host Name"), true, true)); - columns.addColumn(LogViewColumn(i18n("Id."), true, true)); //=Identification protocol [From RFC1413 (see Google for more infos)] - columns.addColumn(LogViewColumn(i18n("User"), true, true)); - columns.addColumn(LogViewColumn(i18n("Response"), true, true)); - columns.addColumn(LogViewColumn(i18n("Bytes Sent"), true, false)); - columns.addColumn(LogViewColumn(i18n("Agent Identity"), true, true)); - columns.addColumn(LogViewColumn(i18n("HTTP Request"), true, false)); - columns.addColumn(LogViewColumn(i18n("URL"), true, true)); - - return columns; - } - - - protected: - - LogFileReader* createLogFileReader(const LogFile& logFile) { - return new LocalLogFileReader(logFile); - } - - Analyzer::LogFileSortMode logFileSortMode() { - return Analyzer::AscendingSortedLogFile; - } - - LogLine* parseMessage(const QString& logLine, const LogFile& originalLogFile) { - QString line(logLine); - - int spacePos=line.indexOf(QLatin1Char( ' ' )); - - QString hostName=line.left(spacePos); - line=line.remove(0, spacePos+1); - - spacePos=line.indexOf(QLatin1Char( ' ' )); - QString identd=line.left(spacePos); - line=line.remove(0, spacePos+1); - - spacePos=line.indexOf(QLatin1Char( ' ' )); - QString userName=line.left(spacePos); - line=line.remove(0, spacePos+1); - - int endDate=line.indexOf(QLatin1Char( ']' )); - QString strDateTime=line.left(endDate); - line=line.remove(0, endDate+3); - - QDateTime dateTime=ParsingHelper::instance()->parseHttpDateTime(strDateTime.mid(1, strDateTime.count()-2)); - - int endQuote=line.indexOf(QLatin1Char( '\"' )); - QString message=line.left(endQuote); - line=line.remove(0, endQuote+2); - - spacePos=line.indexOf(QLatin1Char( ' ' )); - QString httpResponse=ParsingHelper::instance()->parseHttpResponse(line.left(spacePos)); - line=line.remove(0, spacePos+1); - - spacePos=line.indexOf(QLatin1Char( ' ' )); - QString bytesSent=ParsingHelper::instance()->parseSize(line.left(spacePos)); - line=line.remove(0, spacePos+2); - - QString url; - - endQuote=line.indexOf(QLatin1Char( '\"' )); - if (endQuote!=-1) { - url=line.left(endQuote); - line=line.remove(0, endQuote+3); - } - - QString agent; - - //TODO Convert this value to find a more simple name for the Agent - endQuote=line.indexOf(QLatin1Char( '\"' )); - if (endQuote!=-1) { - agent=ParsingHelper::instance()->parseAgent(line.left(endQuote)); - } - - QStringList list; - list.append(hostName); - list.append(identd); - list.append(userName); - list.append(httpResponse); - list.append(bytesSent); - list.append(agent); - list.append(message); - list.append(url); - - return new LogLine( - logLineInternalIdGenerator++, - dateTime, - list, - originalLogFile.url().path(), - Globals::instance()->informationLogLevel(), - logMode - ); - } - -}; - -#endif // _APACHE_ACCESS_ANALYZER_H_ diff --git a/ksystemlog/src/modes/apache/apacheAccessItemBuilder.cpp b/ksystemlog/src/modes/apache/apacheAccessItemBuilder.cpp deleted file mode 100644 index c6a5d581..00000000 --- a/ksystemlog/src/modes/apache/apacheAccessItemBuilder.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "apacheAccessItemBuilder.h" diff --git a/ksystemlog/src/modes/apache/apacheAccessItemBuilder.h b/ksystemlog/src/modes/apache/apacheAccessItemBuilder.h deleted file mode 100644 index ddabf069..00000000 --- a/ksystemlog/src/modes/apache/apacheAccessItemBuilder.h +++ /dev/null @@ -1,72 +0,0 @@ -/*************************************************************************** - * 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 _APACHE_ACCESS_ITEM_BUILDER_H_ -#define _APACHE_ACCESS_ITEM_BUILDER_H_ - -#include - -#include "logModeItemBuilder.h" - -#include - -#include "logging.h" - -#include "logLine.h" -#include "logViewWidgetItem.h" -#include "logMode.h" - -class ApacheAccessItemBuilder : public LogModeItemBuilder { - - public: - ApacheAccessItemBuilder() { - - } - - virtual ~ApacheAccessItemBuilder() { - - } - - QString createFormattedText(LogLine* line) const { - QString result; - - QListIterator it(line->logItems()); - - result.append(QLatin1String( "" )); - - result.append(labelMessageFormat(i18n("Date:"), formatDate(line->time()))); - result.append(labelMessageFormat(i18n("Level:"), line->logLevel()->name())); - result.append(labelMessageFormat(i18n("Host Name:"), it.next() )); - result.append(labelMessageFormat(i18n("Identification:"), it.next() )); - result.append(labelMessageFormat(i18n("Username:"), it.next() )); - result.append(labelMessageFormat(i18n("HTTP Response:"), it.next() )); - result.append(labelMessageFormat(i18n("Bytes Sent:"), it.next() )); - result.append(labelMessageFormat(i18n("Agent Identity:"), it.next() )); - result.append(labelMessageFormat(i18n("HTTP Request:"), it.next() )); - - result.append(QLatin1String( "
" )); - - return result; - } - -}; - -#endif // _APACHE_ACCESS_ITEM_BUILDER_H_ diff --git a/ksystemlog/src/modes/apache/apacheAccessLogMode.cpp b/ksystemlog/src/modes/apache/apacheAccessLogMode.cpp deleted file mode 100644 index 904d1991..00000000 --- a/ksystemlog/src/modes/apache/apacheAccessLogMode.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************** - * 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(ApacheConfiguration* apacheConfiguration, ApacheConfigurationWidget* apacheConfigurationWidget) : - LogMode(QLatin1String( APACHE_ACCESS_LOG_MODE_ID ), i18n("Apache Access Log"), QLatin1String( 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.")); - -} - -ApacheAccessLogMode::~ApacheAccessLogMode() { - -} - -Analyzer* ApacheAccessLogMode::createAnalyzer() { - return new ApacheAccessAnalyzer(this); -} - -QList ApacheAccessLogMode::createLogFiles() { - ApacheConfiguration* apacheConfiguration = logModeConfiguration(); - return apacheConfiguration->findNoModeLogFiles(apacheConfiguration->apacheAccessPaths()); -} diff --git a/ksystemlog/src/modes/apache/apacheAccessLogMode.h b/ksystemlog/src/modes/apache/apacheAccessLogMode.h deleted file mode 100644 index 0d0228f9..00000000 --- a/ksystemlog/src/modes/apache/apacheAccessLogMode.h +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************** - * 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 _APACHE_ACCESS_LOG_MODE_H_ -#define _APACHE_ACCESS_LOG_MODE_H_ - -/** - * Apache Access Log Mode Identifier - */ -#define APACHE_ACCESS_LOG_MODE_ID "apacheAccessLogMode" - -/** - * Apache Access Log Icon - */ -#define APACHE_ACCESS_MODE_ICON "network-server" - - -#include - -#include "logFile.h" - -#include "logMode.h" - -class ApacheConfiguration; -class ApacheConfigurationWidget; - -class ApacheAccessLogMode : public LogMode { - - Q_OBJECT - -public: - explicit ApacheAccessLogMode(ApacheConfiguration* apacheConfiguration, ApacheConfigurationWidget* apacheConfigurationWidget); - - ~ApacheAccessLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _APACHE_ACCESS_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/apache/apacheAnalyzer.cpp b/ksystemlog/src/modes/apache/apacheAnalyzer.cpp deleted file mode 100644 index 15864582..00000000 --- a/ksystemlog/src/modes/apache/apacheAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "apacheAnalyzer.h" diff --git a/ksystemlog/src/modes/apache/apacheAnalyzer.h b/ksystemlog/src/modes/apache/apacheAnalyzer.h deleted file mode 100644 index c5bb0ee9..00000000 --- a/ksystemlog/src/modes/apache/apacheAnalyzer.h +++ /dev/null @@ -1,183 +0,0 @@ -/*************************************************************************** - * 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 _APACHE_ANALYZER_H_ -#define _APACHE_ANALYZER_H_ - - -#include - -#include "analyzer.h" - -#include "logging.h" - -#include "localLogFileReader.h" -#include "apacheLogMode.h" -#include "parsingHelper.h" - -class ApacheAnalyzer : public Analyzer { - - Q_OBJECT - - public: - explicit ApacheAnalyzer(LogMode* logMode) : - Analyzer(logMode) { - - initializeTypeLevels(); - } - - virtual ~ApacheAnalyzer() { - - } - - LogViewColumns initColumns() { - LogViewColumns columns; - columns.addColumn(LogViewColumn(i18n("Date"), true, false)); - columns.addColumn(LogViewColumn(i18n("Client"), true, false)); - columns.addColumn(LogViewColumn(i18n("Message"), true, false)); - - return columns; - } - - - - protected: - LogFileReader* createLogFileReader(const LogFile& logFile) { - return new LocalLogFileReader(logFile); - } - - Analyzer::LogFileSortMode logFileSortMode() { - return Analyzer::AscendingSortedLogFile; - } - - /* - * Log line examples : - * [Wed May 18 22:16:02 2005] [error] [client 127.0.0.1] File does not exist: /var/www/html/ksystemlog/screenshots/small/kernel-view.png, referer: http://localhost.localdomain/ksystemlog/screenshots.php - * [Wed May 18 22:16:02 2005] [error] [client 127.0.0.1] File does not exist: /var/www/html/ksystemlog/screenshots/small/system-filter.png, referer: http://localhost.localdomain/ksystemlog/screenshots.php - * [Thu May 19 18:00:19 2005] [notice] mod_jk2.post_config() first invocation - * [Thu May 19 18:00:19 2005] [notice] Digest: generating secret for digest authentication ... - * [client 127.0.0.1] PHP Parse error: parse error, unexpected T_PRIVATE, expecting T_STRING in /mnt/boulot/web/annivernet/src/fonctions/formulaire.inc.php on line 25 - */ - LogLine* parseMessage(const QString& logLine, const LogFile& originalLogFile) { - - QString line(logLine); - - QDate date; - QTime time; - - QString level; - - //Temporary variable - int squareBracket; - - //Special case which sometimes happens - if (line.indexOf(QLatin1String( "[client" ))==0) { - date=QDate::currentDate(); - time=QTime::currentTime(); - level=QLatin1String( "notice" ); - } - else { - - //The Date - int dateBegin=line.indexOf(QLatin1String( "[" )); - int dateEnd=line.indexOf(QLatin1String( "]" )); - - QString type; - QString message; - - - QString strDate=line.mid(dateBegin+1, dateEnd-dateBegin-1); - - QString month=strDate.mid(4, 3); - - QString day=strDate.mid(8, 2); - - QString hour=strDate.mid(11, 2); - QString min=strDate.mid(14, 2); - QString sec=strDate.mid(17, 2); - - QString year=strDate.mid(20, 4); - - date=QDate(year.toInt(), ParsingHelper::instance()->parseSyslogMonth(month), day.toInt()); - time=QTime(hour.toInt(), min.toInt(), sec.toInt()); - - line=line.remove(0, dateEnd+3); - - - //The log level - squareBracket=line.indexOf(QLatin1String( "]" )); - level=line.left(squareBracket); - line=line.remove(0, squareBracket+2); - } - - //The client - int beginSquareBracket=line.indexOf(QLatin1String( "[client" )); - squareBracket=line.indexOf(QLatin1String( "]" )); - QString client; - if (beginSquareBracket==-1 || squareBracket==-1) { - client=QLatin1String( "" ); - } - else { - client=line.mid(8, squareBracket-8); //8=strlen("[client ") - line=line.remove(0, squareBracket+2); - } - - - QStringList list; - list.append(client); - list.append(line); - - return new LogLine( - logLineInternalIdGenerator++, - QDateTime(date, time), - list, - originalLogFile.url().path(), - findLogLevel(level), - logMode - ); - } - - private: - QMap mapTypeLevels; - - void initializeTypeLevels() { - mapTypeLevels[QLatin1String( "notice" )]=Globals::instance()->informationLogLevel(); - mapTypeLevels[QLatin1String( "warn" )]=Globals::instance()->warningLogLevel(); - mapTypeLevels[QLatin1String( "error" )]=Globals::instance()->errorLogLevel(); - } - - LogLevel* findLogLevel(const QString& type) { - QMap::iterator it; - - it=mapTypeLevels.find(type); - if (it!=mapTypeLevels.end()) { - return (*it); - } - else { - logError() << "New Log Level detected: Please send this log file to the KSystemLog developer to add it (" << type << ")"; - return Globals::instance()->noLogLevel(); - } - } - - -}; - -#endif // _APACHE_ANALYZER_H_ diff --git a/ksystemlog/src/modes/apache/apacheConfiguration.cpp b/ksystemlog/src/modes/apache/apacheConfiguration.cpp deleted file mode 100644 index eac17be8..00000000 --- a/ksystemlog/src/modes/apache/apacheConfiguration.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "apacheConfiguration.h" diff --git a/ksystemlog/src/modes/apache/apacheConfiguration.h b/ksystemlog/src/modes/apache/apacheConfiguration.h deleted file mode 100644 index 7980580e..00000000 --- a/ksystemlog/src/modes/apache/apacheConfiguration.h +++ /dev/null @@ -1,87 +0,0 @@ -/*************************************************************************** - * 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 _APACHE_CONFIGURATION_H_ -#define _APACHE_CONFIGURATION_H_ - -#include - -#include "logModeConfiguration.h" - -#include "logging.h" -#include "defaults.h" - -#include "apacheLogMode.h" - -#include "ksystemlogConfig.h" - -class ApacheConfigurationPrivate { -public: - QStringList apachePaths; - - QStringList apacheAccessPaths; -}; - -class ApacheConfiguration : public LogModeConfiguration { - - Q_OBJECT - - public: - ApacheConfiguration() : - d(new ApacheConfigurationPrivate()) { - - configuration->setCurrentGroup(QLatin1String( "ApacheLogMode" )); - - QStringList defaultApachePaths; - defaultApachePaths << QLatin1String( "/var/log/apache2/error.log" ); - configuration->addItemStringList(QLatin1String( "ApacheLogFilesPaths" ), d->apachePaths, defaultApachePaths, QLatin1String( "ApacheLogFilesPaths" )); - - QStringList defaultApacheAccessPaths; - defaultApacheAccessPaths << QLatin1String( "/var/log/apache2/access.log" ); - configuration->addItemStringList(QLatin1String( "ApacheAccessLogFilesPaths" ), d->apacheAccessPaths, defaultApacheAccessPaths, QLatin1String( "ApacheAccessLogFilesPaths" )); - } - - virtual ~ApacheConfiguration() { - delete d; - } - - QStringList apachePaths() const { - return d->apachePaths; - } - - QStringList apacheAccessPaths() const { - return d->apacheAccessPaths; - } - - void setApachePaths(const QStringList& apachePaths) { - d->apachePaths = apachePaths; - } - - void setApacheAccessPaths(const QStringList& apacheAccessPaths) { - d->apacheAccessPaths = apacheAccessPaths; - } - - private: - ApacheConfigurationPrivate* const d; - -}; - -#endif // _APACHE_CONFIGURATION_H_ diff --git a/ksystemlog/src/modes/apache/apacheConfigurationWidget.cpp b/ksystemlog/src/modes/apache/apacheConfigurationWidget.cpp deleted file mode 100644 index 39546807..00000000 --- a/ksystemlog/src/modes/apache/apacheConfigurationWidget.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * KApacheLog, a apache 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 "apacheConfigurationWidget.h" diff --git a/ksystemlog/src/modes/apache/apacheConfigurationWidget.h b/ksystemlog/src/modes/apache/apacheConfigurationWidget.h deleted file mode 100644 index f10d508f..00000000 --- a/ksystemlog/src/modes/apache/apacheConfigurationWidget.h +++ /dev/null @@ -1,111 +0,0 @@ -/*************************************************************************** - * 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 _APACHE_CONFIGURATION_WIDGET_H_ -#define _APACHE_CONFIGURATION_WIDGET_H_ - -#include "logModeConfigurationWidget.h" - - -#include - -#include "globals.h" -#include "logging.h" -#include "multipleFileList.h" - -#include "logLevel.h" - -#include "apacheConfiguration.h" -#include "apacheLogMode.h" - -class ApacheConfigurationWidget : public LogModeConfigurationWidget { - - Q_OBJECT - - public: - ApacheConfigurationWidget() : - LogModeConfigurationWidget(i18n("Apache Log"),QLatin1String( APACHE_MODE_ICON ), i18n("Apache Log")) - { - - QHBoxLayout* layout = new QHBoxLayout(); - this->setLayout(layout); - - apacheFileList=new MultipleFileList(this, i18n("

These files will be analyzed to show the Apache log and the Apache Access log.

")); - - apachePathsId = apacheFileList->addCategory(i18n("Apache Log Files"), i18n("Add Apache File...")); - apacheAccessPathsId = apacheFileList->addCategory(i18n("Apache Access Log Files"), i18n("Add Apache Access File...")); - - connect(apacheFileList, SIGNAL(fileListChanged()), this, SIGNAL(configurationChanged())); - - layout->addWidget(apacheFileList); - } - - ~ApacheConfigurationWidget() { - - } - - - public slots: - - void saveConfig() { - logDebug() << "Saving config from Apache Options..."; - - ApacheConfiguration* apacheConfiguration = Globals::instance()->findLogMode(QLatin1String( APACHE_LOG_MODE_ID ))->logModeConfiguration(); - apacheConfiguration->setApachePaths(apacheFileList->paths(apachePathsId)); - apacheConfiguration->setApacheAccessPaths(apacheFileList->paths(apacheAccessPathsId)); - } - - void defaultConfig() { - //TODO Find a way to read the configuration per default - readConfig(); - } - - void readConfig() { - ApacheConfiguration* apacheConfiguration = Globals::instance()->findLogMode(QLatin1String( APACHE_LOG_MODE_ID ))->logModeConfiguration(); - - apacheFileList->removeAllItems(); - - apacheFileList->addPaths(apachePathsId, apacheConfiguration->apachePaths()); - apacheFileList->addPaths(apacheAccessPathsId, apacheConfiguration->apacheAccessPaths()); - } - - protected: - bool isValid() const { - if (apacheFileList->isOneOfCategoryEmpty()==true) { - logDebug() << "Apache configuration not valid"; - return false; - } - - logDebug() << "Apache configuration valid"; - return true; - - } - - private: - - MultipleFileList* apacheFileList; - - int apachePathsId; - int apacheAccessPathsId; - -}; - -#endif // _APACHE_CONFIGURATION_WIDGET_H_ diff --git a/ksystemlog/src/modes/apache/apacheFactory.cpp b/ksystemlog/src/modes/apache/apacheFactory.cpp deleted file mode 100644 index b9db7354..00000000 --- a/ksystemlog/src/modes/apache/apacheFactory.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * KApacheLog, a apache 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 "apacheFactory.h" - - -#include - -#include "multipleActions.h" -#include "logMode.h" -#include "logging.h" - -#include "apacheLogMode.h" -#include "apacheAccessLogMode.h" - -#include "apacheConfigurationWidget.h" -#include "apacheConfiguration.h" - -QList ApacheLogModeFactory::createLogModes() const { - - //Create the shared configuration and configuration widget between the logModes - - ApacheConfiguration* logModeConfiguration = new ApacheConfiguration(); - ApacheConfigurationWidget* logModeConfigurationWidget = new ApacheConfigurationWidget(); - - QList logModes; - logModes.append(new ApacheLogMode(logModeConfiguration, logModeConfigurationWidget)); - logModes.append(new ApacheAccessLogMode(logModeConfiguration, logModeConfigurationWidget)); - - return logModes; -} - -LogModeAction* ApacheLogModeFactory::createLogModeAction() const { - LogMode* apacheLogMode = Globals::instance()->findLogMode(QLatin1String( APACHE_LOG_MODE_ID )); - - MultipleActions* multipleActions = new MultipleActions(KIcon( QLatin1String(APACHE_MODE_ICON) ), i18n("Apache"), apacheLogMode); - multipleActions->addInnerAction(apacheLogMode->action()); - multipleActions->addInnerAction(Globals::instance()->findLogMode(QLatin1String( APACHE_ACCESS_LOG_MODE_ID ))->action()); - - multipleActions->setInToolBar(false); - multipleActions->setCategory(LogModeAction::ServicesCategory); - - return multipleActions; -} diff --git a/ksystemlog/src/modes/apache/apacheFactory.h b/ksystemlog/src/modes/apache/apacheFactory.h deleted file mode 100644 index 1aaade48..00000000 --- a/ksystemlog/src/modes/apache/apacheFactory.h +++ /dev/null @@ -1,41 +0,0 @@ -/*************************************************************************** - * 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 _APACHE_LOG_MODE_FACTORY_H_ -#define _APACHE_LOG_MODE_FACTORY_H_ - -#include - -#include "logModeFactory.h" - -class ApacheLogModeFactory : public LogModeFactory { - - Q_OBJECT - - public: - - QList createLogModes() const; - - LogModeAction* createLogModeAction() const; -}; - -#endif // _APACHE_LOG_MODE_FACTORY_H_ - diff --git a/ksystemlog/src/modes/apache/apacheItemBuilder.cpp b/ksystemlog/src/modes/apache/apacheItemBuilder.cpp deleted file mode 100644 index 9f8f5e9b..00000000 --- a/ksystemlog/src/modes/apache/apacheItemBuilder.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "apacheItemBuilder.h" diff --git a/ksystemlog/src/modes/apache/apacheItemBuilder.h b/ksystemlog/src/modes/apache/apacheItemBuilder.h deleted file mode 100644 index 2d83f006..00000000 --- a/ksystemlog/src/modes/apache/apacheItemBuilder.h +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - * 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 _APACHE_ITEM_BUILDER_H_ -#define _APACHE_ITEM_BUILDER_H_ - -#include - -#include "logModeItemBuilder.h" - -#include - -#include "logging.h" - -#include "logLine.h" -#include "logViewWidgetItem.h" -#include "logMode.h" - -class ApacheItemBuilder : public LogModeItemBuilder { - - public: - ApacheItemBuilder() { - - } - - virtual ~ApacheItemBuilder() { - - } - - QString createFormattedText(LogLine* line) const { - QString result; - - QListIterator it(line->logItems()); - - result.append(QLatin1String( "" )); - - result.append(labelMessageFormat(i18n("Date:"), formatDate(line->time()))); - result.append(labelMessageFormat(i18n("Level:"), line->logLevel()->name())); - result.append(labelMessageFormat(i18n("Client:"), it.next() )); - - result.append(QLatin1String( "
" )); - - return result; - - } -}; - - -#endif // _APACHE_ITEM_BUILDER_H_ diff --git a/ksystemlog/src/modes/apache/apacheLogMode.cpp b/ksystemlog/src/modes/apache/apacheLogMode.cpp deleted file mode 100644 index 800663b4..00000000 --- a/ksystemlog/src/modes/apache/apacheLogMode.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************** - * 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(ApacheConfiguration* apacheConfiguration, ApacheConfigurationWidget* apacheConfigurationWidget) : - LogMode(QLatin1String( APACHE_LOG_MODE_ID ), i18n("Apache Log"),QLatin1String( 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.")); - -} - -ApacheLogMode::~ApacheLogMode() { - -} - -Analyzer* ApacheLogMode::createAnalyzer() { - return new ApacheAnalyzer(this); -} - -QList ApacheLogMode::createLogFiles() { - ApacheConfiguration* apacheConfiguration = logModeConfiguration(); - return apacheConfiguration->findNoModeLogFiles(apacheConfiguration->apachePaths()); -} diff --git a/ksystemlog/src/modes/apache/apacheLogMode.h b/ksystemlog/src/modes/apache/apacheLogMode.h deleted file mode 100644 index 29a8cb0c..00000000 --- a/ksystemlog/src/modes/apache/apacheLogMode.h +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************** - * 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 _APACHE_LOG_MODE_H_ -#define _APACHE_LOG_MODE_H_ - -/** - * Apache Log Mode Identifier - */ -#define APACHE_LOG_MODE_ID "apacheLogMode" - -/** - * Apache Log Icon - */ -#define APACHE_MODE_ICON "network-server" - - -#include - -#include "logFile.h" - -#include "logMode.h" - -class ApacheConfiguration; -class ApacheConfigurationWidget; - -class ApacheLogMode : public LogMode { - - Q_OBJECT - -public: - explicit ApacheLogMode(ApacheConfiguration* apacheConfiguration, ApacheConfigurationWidget* apacheConfigurationWidget); - - ~ApacheLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _APACHE_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/authentication/authenticationAnalyzer.cpp b/ksystemlog/src/modes/authentication/authenticationAnalyzer.cpp deleted file mode 100644 index 4ac0ba40..00000000 --- a/ksystemlog/src/modes/authentication/authenticationAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "authenticationAnalyzer.h" diff --git a/ksystemlog/src/modes/authentication/authenticationAnalyzer.h b/ksystemlog/src/modes/authentication/authenticationAnalyzer.h deleted file mode 100644 index 99a35908..00000000 --- a/ksystemlog/src/modes/authentication/authenticationAnalyzer.h +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - * 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 _AUTHENTICATION_ANALYZER_H_ -#define _AUTHENTICATION_ANALYZER_H_ - -#include - -#include "syslogAnalyzer.h" - -#include "authenticationLogMode.h" -#include "authenticationConfiguration.h" - -class AuthenticationAnalyzer : public SyslogAnalyzer { - Q_OBJECT - - public: - - AuthenticationAnalyzer(LogMode* logMode) : - SyslogAnalyzer(logMode) { - - } - - virtual ~AuthenticationAnalyzer() { - - } - - LogLine* parseMessage(const QString& logLine, const LogFile& originalLogFile) { - LogLine* syslogLine = SyslogAnalyzer::parseMessage(logLine, originalLogFile); - - QString message = syslogLine->logItems().at(syslogLine->logItems().count() - 1); - - if (hasErrorKeywords(message)) - syslogLine->setLogLevel(Globals::instance()->errorLogLevel()); - else if (hasWarningKeywords(message)) - syslogLine->setLogLevel(Globals::instance()->warningLogLevel()); - - return syslogLine; - } - - - private: - bool hasWarningKeywords(const QString& message) { - AuthenticationConfiguration* configuration = logMode->logModeConfiguration(); - return hasKeywords(message, configuration->warningKeywords()); - } - - bool hasErrorKeywords(const QString& message) { - AuthenticationConfiguration* configuration = logMode->logModeConfiguration(); - return hasKeywords(message, configuration->errorKeywords()); - } - - bool hasKeywords(const QString& message, const QStringList& keywords) { - foreach(const QString& keyword, keywords) { - if (message.contains(keyword, Qt::CaseInsensitive)) { - return true; - } - } - - return false; - } - - -}; - -#endif diff --git a/ksystemlog/src/modes/authentication/authenticationConfiguration.cpp b/ksystemlog/src/modes/authentication/authenticationConfiguration.cpp deleted file mode 100644 index b4950a61..00000000 --- a/ksystemlog/src/modes/authentication/authenticationConfiguration.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "authenticationConfiguration.h" diff --git a/ksystemlog/src/modes/authentication/authenticationConfiguration.h b/ksystemlog/src/modes/authentication/authenticationConfiguration.h deleted file mode 100644 index 10c7cde4..00000000 --- a/ksystemlog/src/modes/authentication/authenticationConfiguration.h +++ /dev/null @@ -1,92 +0,0 @@ -/*************************************************************************** - * 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 _AUTHENTICATION_CONFIGURATION_H_ -#define _AUTHENTICATION_CONFIGURATION_H_ - -#include - -#include "logModeConfiguration.h" - -#include "logging.h" -#include "defaults.h" - -#include "authenticationLogMode.h" - -#include "ksystemlogConfig.h" - -class AuthenticationConfigurationPrivate { -public: - QString authenticationPath; - - QStringList warningKeywords; - QStringList errorKeywords; -}; - -class AuthenticationConfiguration : public LogModeConfiguration { - - Q_OBJECT - - public: - AuthenticationConfiguration() : - d(new AuthenticationConfigurationPrivate()) { - - configuration->setCurrentGroup(QLatin1String( "AuthenticationLogMode" )); - - QString defaultAuthenticationPath(QLatin1String( "/var/log/auth.log" )); - configuration->addItemString(QLatin1String( "LogFilePath" ), d->authenticationPath, defaultAuthenticationPath, QLatin1String( "LogFilePath" )); - - QStringList defaultWarningKeywords; - defaultWarningKeywords.append(QLatin1String( "failed" )); - configuration->addItemStringList(QLatin1String( "WarningKeywords" ), d->warningKeywords, defaultWarningKeywords, QLatin1String( "WarningKeywords" )); - - QStringList defaultErrorKeywords; - defaultErrorKeywords.append(QLatin1String( "error" )); - configuration->addItemStringList(QLatin1String( "ErrorKeywords" ), d->errorKeywords, defaultErrorKeywords, QLatin1String( "ErrorKeywords" )); - - } - - virtual ~AuthenticationConfiguration() { - delete d; - } - - QString authenticationPath() const { - return d->authenticationPath; - } - - void setAuthenticationPath(const QString& authenticationPath) { - d->authenticationPath = authenticationPath; - } - - QStringList warningKeywords() const { - return d->warningKeywords; - } - - QStringList errorKeywords() const { - return d->errorKeywords; - } - - private: - AuthenticationConfigurationPrivate* const d; - -}; - -#endif // _AUTHENTICATION_CONFIGURATION_H_ diff --git a/ksystemlog/src/modes/authentication/authenticationConfigurationWidget.cpp b/ksystemlog/src/modes/authentication/authenticationConfigurationWidget.cpp deleted file mode 100644 index ec9d1178..00000000 --- a/ksystemlog/src/modes/authentication/authenticationConfigurationWidget.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * KApacheLog, a apache 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 "authenticationConfigurationWidget.h" diff --git a/ksystemlog/src/modes/authentication/authenticationConfigurationWidget.h b/ksystemlog/src/modes/authentication/authenticationConfigurationWidget.h deleted file mode 100644 index d708d200..00000000 --- a/ksystemlog/src/modes/authentication/authenticationConfigurationWidget.h +++ /dev/null @@ -1,115 +0,0 @@ -/*************************************************************************** - * 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 _AUTHENTICATION_CONFIGURATION_WIDGET_H_ -#define _AUTHENTICATION_CONFIGURATION_WIDGET_H_ - -#include -#include - -#include -#include - -#include "globals.h" -#include "logging.h" -#include "fileList.h" - -#include "logLevel.h" - -#include "authenticationConfiguration.h" -#include "authenticationLogMode.h" - -#include "logModeConfigurationWidget.h" - - -class AuthenticationConfigurationWidget : public LogModeConfigurationWidget { - - Q_OBJECT - - public: - AuthenticationConfigurationWidget() : - LogModeConfigurationWidget(i18n("Authentication Log"),QLatin1String( AUTHENTICATION_MODE_ICON ), i18n("Authentication Log")) - { - - QVBoxLayout* layout = new QVBoxLayout(); - this->setLayout(layout); - - //Authentication log file - QGroupBox* authenticationBox=new QGroupBox(i18n("Authentication Log File")); - QHBoxLayout* authenticationLayout = new QHBoxLayout(); - authenticationBox->setLayout(authenticationLayout); - - layout->addWidget(authenticationBox); - - authenticationLayout->addWidget(new QLabel(i18n("Authentication log file:"))); - - authenticationUrlRequester=new KUrlRequester(authenticationBox); - authenticationUrlRequester->setMode(KFile::File); - - authenticationUrlRequester->setToolTip(i18n("You can type or choose the authentication log file (example: /var/log/auth.log).")); - authenticationUrlRequester->setWhatsThis(i18n("You can type or choose here the authentication log file. This file will be analyzed when you select the Authentication log menu. Generally, its name is /var/log/auth.log")); - authenticationLayout->addWidget(authenticationUrlRequester); - - connect(authenticationUrlRequester, SIGNAL(textChanged(const QString&)), this, SIGNAL(configurationChanged())); - - layout->addStretch(); - - } - - ~AuthenticationConfigurationWidget() { - - } - - public slots: - - void saveConfig() { - AuthenticationConfiguration* authenticationConfiguration = Globals::instance()->findLogMode(QLatin1String( AUTHENTICATION_LOG_MODE_ID ))->logModeConfiguration(); - - authenticationConfiguration->setAuthenticationPath(authenticationUrlRequester->url().path()); - } - - void readConfig() { - AuthenticationConfiguration* authenticationConfiguration = Globals::instance()->findLogMode(QLatin1String( AUTHENTICATION_LOG_MODE_ID ))->logModeConfiguration(); - - authenticationUrlRequester->setUrl(KUrl(authenticationConfiguration->authenticationPath())); - } - - void defaultConfig() { - //TODO Find a way to read the configuration per default - readConfig(); - } - - protected: - bool isValid() const { - if (authenticationUrlRequester->url().path().isEmpty()==false) { - return true; - } - - return false; - - } - - private: - KUrlRequester* authenticationUrlRequester; - -}; - -#endif // _AUTHENTICATION_CONFIGURATION_WIDGET_H_ diff --git a/ksystemlog/src/modes/authentication/authenticationFactory.cpp b/ksystemlog/src/modes/authentication/authenticationFactory.cpp deleted file mode 100644 index 80bbad81..00000000 --- a/ksystemlog/src/modes/authentication/authenticationFactory.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/*************************************************************************** - * 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 "authenticationFactory.h" - -#include - - -#include "logMode.h" -#include "logging.h" - -#include "simpleAction.h" -#include "authenticationLogMode.h" - -#include "logModeFactory.h" - -QList AuthenticationLogModeFactory::createLogModes() const { - QList logModes; - logModes.append(new AuthenticationLogMode()); - return logModes; -} - -LogModeAction* AuthenticationLogModeFactory::createLogModeAction() const { - LogMode* logMode = Globals::instance()->findLogMode(QLatin1String( AUTHENTICATION_LOG_MODE_ID )); - SimpleAction* logModeAction = new SimpleAction(logMode->action(), logMode); - - return logModeAction; -} diff --git a/ksystemlog/src/modes/authentication/authenticationFactory.h b/ksystemlog/src/modes/authentication/authenticationFactory.h deleted file mode 100644 index 5cb15afa..00000000 --- a/ksystemlog/src/modes/authentication/authenticationFactory.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * 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 _AUTHENTICATION_FACTORY_H_ -#define _AUTHENTICATION_FACTORY_H_ - -#include - -#include "logModeFactory.h" - -class LogModeAction; -class LogMode; - -class AuthenticationLogModeFactory : public LogModeFactory { - - Q_OBJECT - - public: - - QList createLogModes() const; - - LogModeAction* createLogModeAction() const; - -}; - -#endif // _AUTHENTICATION_FACTORY_H_ - diff --git a/ksystemlog/src/modes/authentication/authenticationLogMode.cpp b/ksystemlog/src/modes/authentication/authenticationLogMode.cpp deleted file mode 100644 index bcaad5e9..00000000 --- a/ksystemlog/src/modes/authentication/authenticationLogMode.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * 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 "authenticationLogMode.h" - -#include - -#include -#include - -#include "logging.h" -#include "logMode.h" - -#include "authenticationAnalyzer.h" -#include "logModeItemBuilder.h" -#include "authenticationConfigurationWidget.h" -#include "authenticationConfiguration.h" - -AuthenticationLogMode::AuthenticationLogMode() : - LogMode(QLatin1String( AUTHENTICATION_LOG_MODE_ID ), i18n("Authentication Log"),QLatin1String( AUTHENTICATION_MODE_ICON )) { - - d->logModeConfiguration = new AuthenticationConfiguration(); - - d->logModeConfigurationWidget = new AuthenticationConfigurationWidget(); - - d->itemBuilder = new LogModeItemBuilder(); - - d->action = createDefaultAction(); - d->action->setToolTip(i18n("Display the authentication log.")); - d->action->setWhatsThis(i18n("Displays the authentication log in the current tab. This log displays all logins made by each user of the system, and can help you to know if someone tried to crack your system.")); - -} - -AuthenticationLogMode::~AuthenticationLogMode() { - -} - -Analyzer* AuthenticationLogMode::createAnalyzer() { - return new AuthenticationAnalyzer(this); -} - -QList AuthenticationLogMode::createLogFiles() { - AuthenticationConfiguration* configuration = logModeConfiguration(); - - QList logFiles; - logFiles.append(configuration->findGenericLogFile(configuration->authenticationPath())); - return logFiles; -} diff --git a/ksystemlog/src/modes/authentication/authenticationLogMode.h b/ksystemlog/src/modes/authentication/authenticationLogMode.h deleted file mode 100644 index 6a66cdff..00000000 --- a/ksystemlog/src/modes/authentication/authenticationLogMode.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * 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 _AUTHENTICATION_LOG_MODE_H_ -#define _AUTHENTICATION_LOG_MODE_H_ - -/** - * Acpid Log Mode Identifier - */ -#define AUTHENTICATION_LOG_MODE_ID "authenticationLogMode" - -/** - * Authentication Log Icon - */ -#define AUTHENTICATION_MODE_ICON "document-encrypt" - -#include - -#include "logFile.h" - -#include "logMode.h" - -class AuthenticationLogMode : public LogMode { - - Q_OBJECT - -public: - explicit AuthenticationLogMode(); - - ~AuthenticationLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _AUTHENTICATION_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/base/fileList.cpp b/ksystemlog/src/modes/base/fileList.cpp deleted file mode 100644 index 7b6b9db9..00000000 --- a/ksystemlog/src/modes/base/fileList.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/*************************************************************************** - * 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 "fileList.h" - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "defaults.h" - -#include "logging.h" - -FileList::FileList(QWidget* parent, const QString& descriptionText) : - QWidget(parent), - fileListHelper(this) - { - - logDebug() << "Initializing file list..."; - - setupUi(this); - - description->setText(descriptionText); - - fileListHelper.prepareButton(add, KIcon( QLatin1String( "document-new" )), this, SLOT(addItem()), fileList); - - fileListHelper.prepareButton(modify, KIcon( QLatin1String( "document-open" )), this, SLOT(modifyItem()), fileList); - - //Add a separator in the FileList - QAction* separator = new QAction(this); - separator->setSeparator(true); - fileList->addAction(separator); - - fileListHelper.prepareButton(remove, KIcon( QLatin1String( "list-remove" )), this, SLOT(removeSelectedItem()), fileList); - - fileListHelper.prepareButton(up, KIcon( QLatin1String( "go-up" )), this, SLOT(moveUpItem()), fileList); - - fileListHelper.prepareButton(down, KIcon( QLatin1String( "go-down" )), this, SLOT(moveDownItem()), fileList); - - fileListHelper.prepareButton(removeAll, KIcon( QLatin1String( "trash-empty" )), this, SLOT(removeAllItems()), fileList); - - connect(fileList, SIGNAL(itemSelectionChanged()), this, SLOT(updateButtons())); - connect(fileList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifyItem(QListWidgetItem*))); - connect(this, SIGNAL(fileListChanged()), this, SLOT(updateButtons())); - - updateButtons(); - - logDebug() << "File list initialized"; - -} - -FileList::~FileList() { - -} - -int FileList::count() const { - return fileList->count(); -} - -bool FileList::isEmpty() const { - return (fileList->count() == 0); -} - -void FileList::addItem() { - //Open a standard Filedialog - KUrl::List urls=fileListHelper.openUrls(); - - QStringList paths=fileListHelper.findPaths(urls); - foreach(const QString &path, paths) { - fileList->addItem(path); - } - - emit fileListChanged(); -} - -void FileList::modifyItem() { - modifyItem(fileList->item(fileList->currentRow())); -} - -void FileList::modifyItem(QListWidgetItem* item) { - QString previousPath = item->text(); - - //Open a standard Filedialog - KUrl url=fileListHelper.openUrl(previousPath); - - KUrl::List urls; - urls.append(url); - QStringList paths=fileListHelper.findPaths(urls); - - //We only take the first path - if (paths.count() >= 1) { - item->setText(paths.at(0)); - } - - emit fileListChanged(); -} - -void FileList::removeSelectedItem() { - QList selectedItems = fileList->selectedItems(); - - foreach(QListWidgetItem* item, selectedItems) { - delete fileList->takeItem(fileList->row(item)); - } - - //fileList->setCurrentRow(fileList->count()-1); - - emit fileListChanged(); -} - -void FileList::unselectAllItems() { - QList selectedItems = fileList->selectedItems(); - foreach(QListWidgetItem* item, selectedItems) { - item->setSelected(false); - } -} - -void FileList::moveItem(int direction) { - QList selectedItems = fileList->selectedItems(); - - QListWidgetItem* item = selectedItems.at(0); - - int itemIndex = fileList->row(item); - - fileList->takeItem(itemIndex); - - unselectAllItems(); - - fileList->insertItem(itemIndex + direction, item); - - fileList->setCurrentRow(fileList->row(item)); - - emit fileListChanged(); -} - -void FileList::moveUpItem() { - moveItem(-1); -} - -void FileList::moveDownItem() { - moveItem(+1); -} - -void FileList::removeAllItems() { - fileList->clear(); - - emit fileListChanged(); -} - - -void FileList::updateButtons() { - if (fileList->count()==0) - fileListHelper.setEnabledAction(removeAll, false); - else - fileListHelper.setEnabledAction(removeAll, true); - - QList selectedItems = fileList->selectedItems(); - if (selectedItems.isEmpty()==false) { - - fileListHelper.setEnabledAction(remove, true); - fileListHelper.setEnabledAction(modify, true); - - QListWidgetItem* selection = selectedItems.at(0); - - //If the item is at the top of the list, it could not be upped anymore - if (fileList->row(selection)==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 (fileList->row(selection)==fileList->count()-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); - } - -} - -QVBoxLayout* FileList::buttonsLayout() { - return vboxLayout1; -} - -void FileList::addPaths(const QStringList& paths) { - foreach(const QString &path, paths) { - fileList->addItem(path); - } - - updateButtons(); -} - -QStringList FileList::paths() { - QStringList paths; - for (int i=0; icount(); i++) { - paths.append(fileList->item(i)->text()); - } - - return paths; -} - -#include "moc_fileList.cpp" diff --git a/ksystemlog/src/modes/base/fileList.h b/ksystemlog/src/modes/base/fileList.h deleted file mode 100644 index 0672be8e..00000000 --- a/ksystemlog/src/modes/base/fileList.h +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - * 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 _FILE_LIST_H_ -#define _FILE_LIST_H_ - -#include -#include - -#include "fileListHelper.h" - -#include "ui_fileListBase.h" - -#include - -class FileList : public QWidget, public Ui::FileListBase { - - Q_OBJECT - - public: - FileList(QWidget* parent, const QString& descriptionText); - virtual ~FileList(); - - int count() const; - - bool isEmpty() const; - - QStringList paths(); - - void addPaths(const QStringList& paths); - - public slots: - void removeAllItems(); - - signals: - void fileListChanged(); - - private slots: - - void updateButtons(); - - void removeSelectedItem(); - void moveUpItem(); - void moveDownItem(); - - protected slots: - virtual void addItem(); - - void modifyItem(); - void modifyItem(QListWidgetItem* item); - - protected: - void removeItem(int id); - - void moveItem(int direction); - void unselectAllItems(); - - /** - * Convenient method which returns the layout which manage the button list - */ - QVBoxLayout* buttonsLayout(); - - FileListHelper fileListHelper; -}; - -#endif //_FILE_LIST_H_ diff --git a/ksystemlog/src/modes/base/fileListBase.ui b/ksystemlog/src/modes/base/fileListBase.ui deleted file mode 100644 index 71c4ff3b..00000000 --- a/ksystemlog/src/modes/base/fileListBase.ui +++ /dev/null @@ -1,219 +0,0 @@ - - - FileListBase - - - - 0 - 0 - 487 - 476 - - - - - 200 - 400 - - - - - 0 - - - 0 - - - 0 - - - - - File List Description - - - Qt::AlignJustify|Qt::AlignVCenter - - - true - - - true - - - - - - - Log Files - - - - - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Choose a new file</p></body></html> - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Opens a dialog box to choose a new file to be added to the list.</p></body></html> - - - &Add File... - - - - - - - &Modify File... - - - - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Delete the current file(s)</p></body></html> - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Deletes the files selected on the list.</p></body></html> - - - &Remove - - - - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Remove all files</p></body></html> - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Remove all the files on the list, even if they are not selected.</p></body></html> - - - Rem&ove All - - - - - - - true - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Move up the current file(s)</p></body></html> - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Moves the selected files up in the list. This option allows the files to be read <span style=" font-weight:600;">in first</span> by KSystemLog.</p></body></html> - - - Move &Up - - - - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Move down the current file(s)</p></body></html> - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Moves the selected files down in the list. This option allows the files to be read <span style=" font-weight:600;">in last</span> by KSystemLog.</p></body></html> - - - Move &Down - - - - - - - Qt::Vertical - - - QSizePolicy::MinimumExpanding - - - - 20 - 40 - - - - - - - - - - <p style='margin-top:0px;margin-bottom:0px;'><b>Notes:</b></p><ul style='margin-top:0px'><li>Files are read using the order of this list.</li><li>Compressed and plain text files are accepted <i>(*.log, *.gz, *.bz2,...)</i>.</li><li>Use the <b>'*'</b> wildcard to select multiple log files when adding files.</li></ul> - - - true - - - - - - - Qt::ActionsContextMenu - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">List of files used by this log type.</p></body></html> - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Here is a list of every file that will be read by KSystemLog to display the current log lines.</p></body></html> - - - QAbstractItemView::InternalMove - - - - - - - - - - add - - - - - diff --git a/ksystemlog/src/modes/base/fileListHelper.cpp b/ksystemlog/src/modes/base/fileListHelper.cpp deleted file mode 100644 index afc78750..00000000 --- a/ksystemlog/src/modes/base/fileListHelper.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/*************************************************************************** - * 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 "fileListHelper.h" - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "defaults.h" - -#include "logging.h" - -FileListHelper::FileListHelper(QWidget* p) : - parent(p) { - -} - -FileListHelper::~FileListHelper() { - -} - -QAction* FileListHelper::prepareButtonAndAction(QPushButton* button, const QIcon& icon) { - //Initialize action - QAction* action = new QAction(button); - action->setIcon(icon); - action->setText(button->text()); - - //Initialize button - button->setIcon(icon); - //Allow the disabling of the matching action when disabling this button - button->addAction(action); - - //Assert that when an action is triggered, the related button sends a clicked() event - //(the button is the QObject which is connected to custom slots) - connect(action, SIGNAL(triggered(bool)), button, SLOT(click())); - - return action; -} - -QAction* FileListHelper::prepareButtonAndAction(QPushButton* button, const QIcon& icon, const QObject* receiver, const char* member) { - QAction* action = prepareButtonAndAction(button, icon); - connect(button, SIGNAL(clicked(bool)), receiver, member); - - return action; -} - -void FileListHelper::prepareButton(QPushButton* button, const QIcon& icon, const QObject* receiver, const char* member, QWidget* fileList) { - //Initialize action - QAction* action = prepareButtonAndAction(button, icon, receiver, member); - fileList->addAction(action); -} - -QStringList FileListHelper::findPaths(KUrl::List urls) { - QStringList paths; - - for (KUrl::List::ConstIterator it=urls.constBegin(); it!=urls.constEnd(); ++it) { - KUrl url(*it); - - if (isValidFile(url)) { - - //If this Url uses a joker (i.e. : "/var/log/apache2/*") - if (url.fileName().contains(QLatin1Char( '*' ))) { - const QStringList foundPaths = expandJoker(url.path()); - logDebug() << "Found paths of " << url.path() << ":" << foundPaths; - foreach(const QString &foundPath, foundPaths) { - paths.append(foundPath); - } - } - else { - paths.append(url.path()); - } - } - } - - return paths; -} - -bool FileListHelper::isValidFile(const KUrl& url) { - QString message; - - //If it is not valid - if (!url.isValid()) { - return false; - } - - //If it is not a local file - if (!url.isLocalFile()) { - message=i18n("'%1' is not a local file.", url.path()); - KMessageBox::error(parent, message, i18n("File selection failed"), KMessageBox::Notify); - return false; - } - - //If it's a directory, it's not valid - if (QDir(url.path()).exists()) { - return false; - } - - return true; -} - -KUrl::List FileListHelper::openUrls() { - KFileDialog fileDialog(KUrl(DEFAULT_LOG_FOLDER), QLatin1String( "*|" ) + i18n("All Files (*)") + QLatin1String( "\n*.log|" ) + i18n("Log Files (*.log)"), parent); - fileDialog.setCaption(i18n("Choose Log File")); - fileDialog.setMode(KFile::Files); - - fileDialog.exec(); - return fileDialog.selectedUrls(); -} - -KUrl FileListHelper::openUrl(const QString& originPath) { - KFileDialog fileDialog(KUrl(originPath), QLatin1String( "*|" ) + i18n("All Files (*)") + QLatin1String( "\n*.log|" ) + i18n("Log Files (*.log)"), parent); - fileDialog.setCaption(i18n("Choose Log File")); - fileDialog.setMode(KFile::File); - - fileDialog.exec(); - return fileDialog.selectedUrl(); -} - -QStringList FileListHelper::expandJoker(const KUrl& url) { - QDir directory = QDir(url.path().left(url.path().count() - url.fileName().count())); - - logDebug() << "Dir " << directory.path(); - QString filename = url.fileName(); - - if (filename.isEmpty()) { - return QStringList(); - } - - QStringList foundPaths; - const QStringList files = directory.entryList(QStringList(filename), QDir::Files | QDir::NoSymLinks); - foreach(const QString &file, files) { - foundPaths.append(directory.absoluteFilePath(file)); - } - - return foundPaths; -} - -void FileListHelper::setEnabledAction(QPushButton* button, bool enabled) { - button->setEnabled(enabled); - - QList actions = button->actions(); - foreach (QAction* action, actions) { - action->setEnabled(enabled); - } -} - -#include "moc_fileListHelper.cpp" diff --git a/ksystemlog/src/modes/base/fileListHelper.h b/ksystemlog/src/modes/base/fileListHelper.h deleted file mode 100644 index d80a2214..00000000 --- a/ksystemlog/src/modes/base/fileListHelper.h +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************** - * 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 _FILE_LIST_HELPER_H_ -#define _FILE_LIST_HELPER_H_ - -#include -#include - -#include - -#include -#include - -/** - * Class which maintains common behavior between - * FileList classes - */ -class FileListHelper : public QObject { - - Q_OBJECT - - public: - FileListHelper(QWidget* parent); - virtual ~FileListHelper(); - - QStringList findPaths(KUrl::List urls); - bool isValidFile(const KUrl& url); - QStringList expandJoker(const KUrl& url); - - KUrl::List openUrls(); - KUrl openUrl(const QString& originPath); - - /** - * Change the enabled status of the button and of its QActions - */ - void setEnabledAction(QPushButton* button, bool enabled); - - /** - * TODO Do this inline (and remove this method) - */ - void prepareButton(QPushButton* button, const QIcon& icon, const QObject* receiver, const char* member, QWidget* fileList); - - QAction* prepareButtonAndAction(QPushButton* button, const QIcon& icon); - QAction* prepareButtonAndAction(QPushButton* button, const QIcon& icon, const QObject* receiver, const char* member); - - private: - QWidget* parent; -}; - -#endif //_FILE_LIST_HELPER_H_ diff --git a/ksystemlog/src/modes/base/genericConfiguration.cpp b/ksystemlog/src/modes/base/genericConfiguration.cpp deleted file mode 100644 index 07f6916a..00000000 --- a/ksystemlog/src/modes/base/genericConfiguration.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/*************************************************************************** - * 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 "genericConfiguration.h" - -#include - -#include "logging.h" -#include "defaults.h" - -#include "globals.h" - -#include "ksystemlogConfig.h" - -class GenericLogModeConfigurationPrivate { -public: - QStringList logFilesPaths; - - QList logFilesLevels; - -}; - -GenericLogModeConfiguration::GenericLogModeConfiguration(const QString& configurationGroup, const QStringList& defaultLogFilesPaths, const QList defaultLogFilesLevels) : - d(new GenericLogModeConfigurationPrivate()) { - - logDebug() << "Using Configuration Group : " << configurationGroup; - configuration->setCurrentGroup(configurationGroup); - - configuration->addItemStringList(QLatin1String( "LogFilesPaths" ), d->logFilesPaths, defaultLogFilesPaths, QLatin1String( "LogFilesPaths" )); - - configuration->addItemIntList(QLatin1String( "LogFilesLevels" ), d->logFilesLevels, defaultLogFilesLevels, QLatin1String( "LogFilesLevels" )); - -} - -GenericLogModeConfiguration::~GenericLogModeConfiguration() { - delete d; -} - - -QStringList GenericLogModeConfiguration::logFilesPaths() const { - return d->logFilesPaths; -} - -QList GenericLogModeConfiguration::logFilesLevels() const { - return d->logFilesLevels; -} - -void GenericLogModeConfiguration::setLogFilesPaths(const QStringList& logFilesPaths) { - d->logFilesPaths = logFilesPaths; -} - -void GenericLogModeConfiguration::setLogFilesLevels(const QList& logFilesLevels) { - d->logFilesLevels = logFilesLevels; -} - - -QList GenericLogModeConfiguration::findGenericLogFiles() { - - QList logFiles; - - if (d->logFilesPaths.size() != d->logFilesLevels.size()) { - logDebug() << i18n("The two arrays size are different, skipping the reading of log files."); - return logFiles; - } - - LogLevel* level; - - QListIterator itString(d->logFilesPaths); - QListIterator itInt(d->logFilesLevels); - - while (itString.hasNext()) { - int intValue=itInt.next(); - QString stringValue=itString.next(); - - if (intValue>=0 && intValue<(int) Globals::instance()->logLevels().count()) - level=Globals::instance()->logLevels().at(intValue); - else - level=Globals::instance()->informationLogLevel(); - - KUrl url(stringValue); - if (!url.isValid()) { - logWarning() << i18n("URL '%1' is not valid, skipping this URL.", url.path()); - continue; - } - - logFiles.append(LogFile(url, level)); - - } - - return logFiles; -} - - -#include "moc_genericConfiguration.cpp" diff --git a/ksystemlog/src/modes/base/genericConfiguration.h b/ksystemlog/src/modes/base/genericConfiguration.h deleted file mode 100644 index ab616c33..00000000 --- a/ksystemlog/src/modes/base/genericConfiguration.h +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************** - * 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 _GENERIC_LOG_MODE_CONFIGURATION_H_ -#define _GENERIC_LOG_MODE_CONFIGURATION_H_ - -#include -#include - -#include "logFile.h" - -#include "logModeConfiguration.h" - -class GenericLogModeConfigurationPrivate; - -class GenericLogModeConfiguration : public LogModeConfiguration { - - Q_OBJECT - - public: - GenericLogModeConfiguration(const QString& configurationGroup, const QStringList& defaultLogFilesPaths, const QList defaultLogFilesLevels); - virtual ~GenericLogModeConfiguration(); - - QStringList logFilesPaths() const; - - QList logFilesLevels() const; - - void setLogFilesPaths(const QStringList& logFilesPaths); - - void setLogFilesLevels(const QList& logFilesLevels); - - QList findGenericLogFiles(); - - private: - GenericLogModeConfigurationPrivate* const d; -}; - -#endif // _GENERIC_LOG_MODE_CONFIGURATION_H_ diff --git a/ksystemlog/src/modes/base/logLevelFileList.cpp b/ksystemlog/src/modes/base/logLevelFileList.cpp deleted file mode 100644 index 07ee5066..00000000 --- a/ksystemlog/src/modes/base/logLevelFileList.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/*************************************************************************** - * 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 "logLevelFileList.h" - -#include -#include -#include - -#include - -// KDE includes -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "defaults.h" - -#include "logging.h" -#include "globals.h" - -#include "logLevel.h" -#include "logLevelSelectionDialog.h" - -int LogLevelFileList::LogLevelRole = 33; - -LogLevelFileList::LogLevelFileList(QWidget* parent, const QString& description) : - FileList(parent, description) - { - - logDebug() << "Initializing specific file list..."; - - changeItem=new QPushButton(i18n("&Change Status...")); - changeItem->setToolTip(i18n("Change the level of the current file(s)")); - changeItem->setWhatsThis(i18n("Changes the level of the current file(s). See KSystemLog documentation for more information about each log level.")); - - //Insert the button just after the "Modify File" button - buttonsLayout()->insertWidget(2, changeItem); - - QAction* action = fileListHelper.prepareButtonAndAction(changeItem, KIcon( QLatin1String( "favorites" )), this, SLOT(changeItemType())); - - //Insert the action just after the "Modify File" action - fileList->insertAction(fileList->actions().at(2), action); - - changeItem->setEnabled(false); - - connect(fileList, SIGNAL(itemSelectionChanged()), this, SLOT(updateSpecificButtons())); - connect(this, SIGNAL(fileListChanged()), this, SLOT(updateSpecificButtons())); - - disconnect(fileList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifyItem(QListWidgetItem*))); - connect(fileList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(changeItemType())); - - updateSpecificButtons(); - - logDebug() << "Specific file list initialized"; - -} - - -LogLevelFileList::~LogLevelFileList() { - //changeItem is managed automatically -} - -void LogLevelFileList::insertItem(LogLevel* level, const QString& itemText) { - QListWidgetItem* item = new QListWidgetItem(QIcon(level->pixmap()), itemText, fileList); - item->setData(LogLevelFileList::LogLevelRole, level->id()); -} - -void LogLevelFileList::addItem() { - //Open a standard Filedialog - KUrl::List urls=fileListHelper.openUrls(); - - QStringList paths=fileListHelper.findPaths(urls); - foreach(const QString &path, paths) { - insertItem(Globals::instance()->informationLogLevel(), path); - } - - emit fileListChanged(); -} - -void LogLevelFileList::updateSpecificButtons() { - if (fileList->selectedItems().count()>0) - changeItem->setEnabled(true); - else - changeItem->setEnabled(false); - -} - -void LogLevelFileList::changeItemType() { - logDebug() << "Changing item type..."; - - LogLevelSelectionDialog logLevelSelectionDialog(this); - - foreach (LogLevel* level, Globals::instance()->logLevels()) { - logLevelSelectionDialog.logLevels()->addItem(new QListWidgetItem(QIcon(level->pixmap()), level->name())); - } - - int choice=logLevelSelectionDialog.exec(); - - if (choice==QDialog::Accepted) { - - QList selectedLogLevels = logLevelSelectionDialog.logLevels()->selectedItems(); - if (selectedLogLevels.isEmpty()==false) { - QListWidgetItem* logLevel = selectedLogLevels.at(0); - int selectedLogLevel=logLevelSelectionDialog.logLevels()->row(logLevel); - - - QList selectedItems = fileList->selectedItems(); - foreach (QListWidgetItem* item, selectedItems) { - item->setIcon(logLevel->icon()); - item->setData(LogLevelFileList::LogLevelRole, selectedLogLevel); - } - - emit fileListChanged(); - } - - } - -} - - -LogLevel* LogLevelFileList::level(int i) { - return Globals::instance()->logLevels().at( fileList->item(i)->data(LogLevelFileList::LogLevelRole).toInt() ); -} - - -QList LogLevelFileList::levels() { - QList levels; - int count=fileList->count(); - - for (int i=0; ilevel(i)->id()); - } - - return levels; - -} - -void LogLevelFileList::addPaths(const QStringList& stringList, const QList& valueList) { - //A little security test - if (stringList.size() != valueList.size()) { - logDebug() << i18n("The two arrays size are different, skipping the reading of generic paths."); - return; - } - - QListIterator itString(stringList); - QListIterator itInt=(valueList); - - while (itString.hasNext()) { - int valueInt = itInt.next(); - QString valueString = itString.next(); - - LogLevel* level; - if (valueInt>=0 && valueInt<(int) Globals::instance()->logLevels().count()) - level=Globals::instance()->logLevels().at(valueInt); - else - level=Globals::instance()->informationLogLevel(); - - insertItem(level, valueString); - - } - - emit fileListChanged(); -} - - -#include "moc_logLevelFileList.cpp" diff --git a/ksystemlog/src/modes/base/logLevelFileList.h b/ksystemlog/src/modes/base/logLevelFileList.h deleted file mode 100644 index 714d1a34..00000000 --- a/ksystemlog/src/modes/base/logLevelFileList.h +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * 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 _LOG_LEVEL_FILE_LIST_H_ -#define _LOG_LEVEL_FILE_LIST_H_ - -#include "fileList.h" - -#include -class LogLevel; - - -class LogLevelFileList : public FileList { - - Q_OBJECT - - public: - LogLevelFileList(QWidget* parent, const QString& description); - - virtual ~LogLevelFileList(); - - QList levels(); - - void addPaths(const QStringList& filePaths, const QList& fileLevels); - - private: - LogLevel* level(int i); - - void insertItem(LogLevel* level, const QString& itemText); - - static int LogLevelRole; - - QPushButton* changeItem; - - protected slots: - void addItem(); - - private slots: - void updateSpecificButtons(); - - - void changeItemType(); - - - -}; - -#endif //_LOG_LEVEL_FILE_LIST_H_ diff --git a/ksystemlog/src/modes/base/logLevelSelectionDialog.cpp b/ksystemlog/src/modes/base/logLevelSelectionDialog.cpp deleted file mode 100644 index 822eb0b7..00000000 --- a/ksystemlog/src/modes/base/logLevelSelectionDialog.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * 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 "logLevelSelectionDialog.h" - -#include - -#include -#include - - -LogLevelSelectionDialog::LogLevelSelectionDialog(QWidget* parent) : - QDialog(parent) { - - setupUi(this); - - QPushButton* okButton = buttonBox->button(QDialogButtonBox::Ok); - okButton->setIcon(KStandardGuiItem::ok().icon()); - - QPushButton* cancelButton = buttonBox->button(QDialogButtonBox::Cancel); - cancelButton->setIcon(KStandardGuiItem::cancel().icon()); - -} - - -LogLevelSelectionDialog::~LogLevelSelectionDialog() { - -} - -QListWidget* LogLevelSelectionDialog::logLevels() const { - return logLevelsList; -} - diff --git a/ksystemlog/src/modes/base/logLevelSelectionDialog.h b/ksystemlog/src/modes/base/logLevelSelectionDialog.h deleted file mode 100644 index 85e2c417..00000000 --- a/ksystemlog/src/modes/base/logLevelSelectionDialog.h +++ /dev/null @@ -1,41 +0,0 @@ -/*************************************************************************** - * 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 _LOG_LEVEL_SELECTION_DIALOG_H_ -#define _LOG_LEVEL_SELECTION_DIALOG_H_ - -#include - -#include "ui_logLevelSelectionDialogBase.h" - -class LogLevelSelectionDialog : public QDialog, public Ui::LogLevelSelectionDialogBase { - - public: - explicit LogLevelSelectionDialog(QWidget* parent = NULL); - - virtual ~LogLevelSelectionDialog(); - - QListWidget* logLevels() const; - -}; - - -#endif //_LOG_LEVEL_SELECTION_DIALOG_H_ diff --git a/ksystemlog/src/modes/base/logLevelSelectionDialogBase.ui b/ksystemlog/src/modes/base/logLevelSelectionDialogBase.ui deleted file mode 100644 index 2604b393..00000000 --- a/ksystemlog/src/modes/base/logLevelSelectionDialogBase.ui +++ /dev/null @@ -1,111 +0,0 @@ - - LogLevelSelectionDialogBase - - - - 0 - 0 - 227 - 292 - - - - Selecting File Type - - - true - - - - - - Please select the type of this file: - - - logLevelsList - - - - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">List of existing log levels</p></body></html> - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This is the list of all existing log levels. </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Please select one of them to be used for the files selected on the list.</p></body></html> - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok - - - true - - - - - - - - buttonBox - accepted() - LogLevelSelectionDialogBase - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - LogLevelSelectionDialogBase - reject() - - - 316 - 260 - - - 286 - 274 - - - - - logLevelsList - itemDoubleClicked(QListWidgetItem*) - LogLevelSelectionDialogBase - accept() - - - 189 - 138 - - - 189 - 145 - - - - - diff --git a/ksystemlog/src/modes/base/multipleFileList.cpp b/ksystemlog/src/modes/base/multipleFileList.cpp deleted file mode 100644 index 4e3e60db..00000000 --- a/ksystemlog/src/modes/base/multipleFileList.cpp +++ /dev/null @@ -1,432 +0,0 @@ -/*************************************************************************** - * 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); - - description->setText(descriptionText); - - fileListHelper.prepareButton(modify, KIcon( QLatin1String( "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, KIcon( QLatin1String( "list-remove" )), this, SLOT(removeSelectedItem()), fileList); - - fileListHelper.prepareButton(up, KIcon( QLatin1String( "go-up" )), this, SLOT(moveUpItem()), fileList); - - fileListHelper.prepareButton(down, KIcon( QLatin1String( "go-down" )), this, SLOT(moveDownItem()), fileList); - - fileListHelper.prepareButton(removeAll, KIcon( QLatin1String( "trash-empty" )), this, SLOT(removeAllItems()), fileList); - - connect(fileList, SIGNAL(itemSelectionChanged()), this, SLOT(updateButtons())); - connect(fileList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(modifyItem(QTreeWidgetItem*))); - connect(this, SIGNAL(fileListChanged()), this, SLOT(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; itopLevelItemCount(); ++i) { - if (categoryCount(i) != 0) { - logDebug() << "Is not empty"; - return false; - } - } - - logDebug() << "Is empty"; - return true; - -} - -bool MultipleFileList::isOneOfCategoryEmpty() const { - for (int i=0; itopLevelItemCount(); ++i) { - if (categoryCount(i) == 0) { - logDebug() << "A category is empty"; - return true; - } - } - - logDebug() << "No category empty"; - return false; - -} - -int MultipleFileList::categoryCount(int index) const { - QTreeWidgetItem* item = fileList->topLevelItem(index); - if (item==NULL) { - logError() << "Index out of range" << index; - return 0; - } - - int count = 0; - for(int i=0; ichildCount(); ++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, KIcon( QLatin1String( "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 - KUrl::List 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)); - categoryItem->addChild(item); - categoryItem->setExpanded(true); -} - -QTreeWidgetItem* MultipleFileList::findCategoryOfChild(QTreeWidgetItem* childItem) { - logDebug() << "Finding Category of" << childItem->text(0); - - for(int i=0; itopLevelItemCount(); ++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 - KUrl url=fileListHelper.openUrl(previousPath); - - KUrl::List 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; itopLevelItemCount(); ++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; categoryIndextopLevelItemCount(); ++categoryIndex) { - QTreeWidgetItem* categoryItem = fileList->topLevelItem(categoryIndex); - - logDebug() << "Removing empty items of " << categoryItem->text(0); - - for(int i=0; ichildCount(); ++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) { - QTreeWidgetItem* categoryItem = fileList->topLevelItem(category); - - foreach(const QString &path, paths) { - addItemInternal(categoryItem, path); - } - - updateEmptyItems(); - - updateButtons(); -} - -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; -} - -#include "moc_multipleFileList.cpp" diff --git a/ksystemlog/src/modes/base/multipleFileList.h b/ksystemlog/src/modes/base/multipleFileList.h deleted file mode 100644 index 24ad4868..00000000 --- a/ksystemlog/src/modes/base/multipleFileList.h +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * 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 "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; -}; - -#endif //_MULTIPLE_FILE_LIST_H_ diff --git a/ksystemlog/src/modes/base/multipleFileListBase.ui b/ksystemlog/src/modes/base/multipleFileListBase.ui deleted file mode 100644 index e1d3f4d6..00000000 --- a/ksystemlog/src/modes/base/multipleFileListBase.ui +++ /dev/null @@ -1,187 +0,0 @@ - - MultipleFileListBase - - - - 0 - 0 - 398 - 442 - - - - - 200 - 400 - - - - - 0 - - - 0 - - - 0 - - - - - File List Description - - - Qt::AlignJustify|Qt::AlignVCenter - - - true - - - - - - - Log Files - - - - - - Qt::ActionsContextMenu - - - false - - - false - - - - 1 - - - - - - - - - - &Modify File... - - - - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Delete the current file(s)</p></body></html> - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Deletes the selected files of the list.</p></body></html> - - - &Remove - - - - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Remove all files</p></body></html> - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Remove all files of the list, even if they are not selected.</p></body></html> - - - Rem&ove All - - - - - - - true - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Move up the current file(s)</p></body></html> - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Moves up the selected files in the list. This option allows the files to be read <span style=" font-weight:600;">in first</span> by KSystemLog.</p></body></html> - - - Move &Up - - - - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Move down the current file(s)</p></body></html> - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Moves down the selected files in the list. This option allows the files to be read <span style=" font-weight:600;">at last</span> by KSystemLog.</p></body></html> - - - Move &Down - - - - - - - Qt::Vertical - - - QSizePolicy::MinimumExpanding - - - - 20 - 40 - - - - - - - - - - <p style='margin-top:0px;margin-bottom:0px;'><b>Notes:</b></p><ul style='margin-top:0px'><li>Files are read using the order of this list.</li><li>Compressed and plain text files are accepted <i>(*.log, *.gz, *.bz2,...)</i>.</li><li>Use the <b>'*'</b> joker to select multiple log files when adding files.</li></ul> - - - true - - - - - - - - - - diff --git a/ksystemlog/src/modes/base/parsingHelper.cpp b/ksystemlog/src/modes/base/parsingHelper.cpp deleted file mode 100644 index b66bc0ba..00000000 --- a/ksystemlog/src/modes/base/parsingHelper.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/*************************************************************************** - * 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 "parsingHelper.h" - -#include -#include - -#include "logging.h" - - -ParsingHelper* ParsingHelper::self = NULL; - -ParsingHelper* ParsingHelper::instance() { - if (ParsingHelper::self == NULL) { - ParsingHelper::self = new ParsingHelper(); - } - - return ParsingHelper::self; -} - -ParsingHelper::ParsingHelper() { - //Initialize Existing months - mapMonths[QLatin1String( "Jan" )]=1; - mapMonths[QLatin1String( "Feb" )]=2; - mapMonths[QLatin1String( "Mar" )]=3; - mapMonths[QLatin1String( "Apr" )]=4; - mapMonths[QLatin1String( "May" )]=5; - mapMonths[QLatin1String( "Jun" )]=6; - mapMonths[QLatin1String( "Jul" )]=7; - mapMonths[QLatin1String( "Aug" )]=8; - mapMonths[QLatin1String( "Sep" )]=9; - mapMonths[QLatin1String( "Oct" )]=10; - mapMonths[QLatin1String( "Nov" )]=11; - mapMonths[QLatin1String( "Dec" )]=12; - - //Initialize HTTP Responses - //1xx Responses - mapHTTPResponse[QLatin1String( "100" )]=QLatin1String( "Continue" ); - mapHTTPResponse[QLatin1String( "101" )]=QLatin1String( "Switching Protocols" ); - - //2xx Responses - mapHTTPResponse[QLatin1String( "200" )]=QLatin1String( "OK" ); - mapHTTPResponse[QLatin1String( "201" )]=QLatin1String( "Created" ); - mapHTTPResponse[QLatin1String( "202" )]=QLatin1String( "Accepted" ); - mapHTTPResponse[QLatin1String( "203" )]=QLatin1String( "Non-Authoritative Information" ); - mapHTTPResponse[QLatin1String( "204" )]=QLatin1String( "No Content" ); - mapHTTPResponse[QLatin1String( "205" )]=QLatin1String( "Reset Content" ); - mapHTTPResponse[QLatin1String( "206" )]=QLatin1String( "Partial Content" ); - - //3xx Responses - mapHTTPResponse[QLatin1String( "300" )]=QLatin1String( "OK" ); - mapHTTPResponse[QLatin1String( "301" )]=QLatin1String( "Moved Permanently" ); - mapHTTPResponse[QLatin1String( "302" )]=QLatin1String( "Found" ); - mapHTTPResponse[QLatin1String( "303" )]=QLatin1String( "See Other" ); - mapHTTPResponse[QLatin1String( "304" )]=QLatin1String( "Not Modified" ); - mapHTTPResponse[QLatin1String( "305" )]=QLatin1String( "Use Proxy" ); - mapHTTPResponse[QLatin1String( "306" )]=QLatin1String( "(Unused)" ); - mapHTTPResponse[QLatin1String( "307" )]=QLatin1String( "Temporary Redirect" ); - - //4xx Responses - mapHTTPResponse[QLatin1String( "400" )]=QLatin1String( "Bad Request" ); - mapHTTPResponse[QLatin1String( "401" )]=QLatin1String( "Unauthorized" ); - mapHTTPResponse[QLatin1String( "402" )]=QLatin1String( "Payment Required" ); - mapHTTPResponse[QLatin1String( "403" )]=QLatin1String( "Forbidden" ); - mapHTTPResponse[QLatin1String( "404" )]=QLatin1String( "Not Found" ); - mapHTTPResponse[QLatin1String( "405" )]=QLatin1String( "Method Not Allowed" ); - mapHTTPResponse[QLatin1String( "406" )]=QLatin1String( "Not Acceptable" ); - mapHTTPResponse[QLatin1String( "407" )]=QLatin1String( "Proxy Authentication Required" ); - mapHTTPResponse[QLatin1String( "408" )]=QLatin1String( "Request Timeout" ); - mapHTTPResponse[QLatin1String( "409" )]=QLatin1String( "Conflict" ); - mapHTTPResponse[QLatin1String( "410" )]=QLatin1String( "Gone" ); - mapHTTPResponse[QLatin1String( "411" )]=QLatin1String( "Length Required" ); - mapHTTPResponse[QLatin1String( "412" )]=QLatin1String( "Precondition Failed" ); - mapHTTPResponse[QLatin1String( "413" )]=QLatin1String( "Request Entity Too Large" ); - mapHTTPResponse[QLatin1String( "414" )]=QLatin1String( "Request-URI Too Long" ); - mapHTTPResponse[QLatin1String( "415" )]=QLatin1String( "Unsupported Media Type" ); - mapHTTPResponse[QLatin1String( "416" )]=QLatin1String( "Requested Range Not Satisfiable" ); - mapHTTPResponse[QLatin1String( "417" )]=QLatin1String( "Expectation Failed" ); - - //5xx Responses - mapHTTPResponse[QLatin1String( "500" )]=QLatin1String( "Internal Server Error" ); - mapHTTPResponse[QLatin1String( "501" )]=QLatin1String( "Not Implemented" ); - mapHTTPResponse[QLatin1String( "502" )]=QLatin1String( "Bad Gateway" ); - mapHTTPResponse[QLatin1String( "503" )]=QLatin1String( "Service Unavailable" ); - mapHTTPResponse[QLatin1String( "504" )]=QLatin1String( "Gateway Timeout" ); - mapHTTPResponse[QLatin1String( "505" )]=QLatin1String( "HTTP Version Not Supported" ); - -} - -ParsingHelper::~ParsingHelper() { - -} - -QDateTime ParsingHelper::parseHttpDateTime(const QString& logLine) { - //Format example : 22/May/2005:01:50:34 +0200 - - QString day=logLine.mid(0,2); - QString month=logLine.mid(3,3); - QString year=logLine.mid(7,4); - - QString hour=logLine.mid(12,2); - QString min=logLine.mid(15,2); - QString sec=logLine.mid(18,2); - - //QString zone=logLine.mid(22,5); - - return QDateTime(QDate(year.toInt(), parseSyslogMonth(month), day.toInt()), QTime(hour.toInt(), min.toInt(), sec.toInt())); -} - -/** - * Example : "Oct 1 09:11:45 2005" - */ -QDateTime ParsingHelper::parseSyslogDateTime(const QString& dateTime) { - //TODO Create this regexp in constructor - QRegExp regex(QLatin1String( "(\\S*)[ ]+(\\d*) (\\d*):(\\d*):(\\d*) (\\d*)" )); - - int firstPosition = regex.indexIn(dateTime); - if (firstPosition == -1) { - logDebug() << "Unable to parse date " << dateTime; - return QDateTime::currentDateTime(); - } - - return QDateTime(QDate(regex.cap(6).toInt(), parseSyslogMonth(regex.cap(1)), regex.cap(2).toInt()), QTime(regex.cap(3).toInt(), regex.cap(4).toInt(), regex.cap(5).toInt(), 0)); -} - -QString ParsingHelper::syslogDateTimeRegexp() { - return QLatin1String( "(\\S*[ ]+\\d* \\d*:\\d*:\\d* \\d*)" ); -} - -int ParsingHelper::parseSyslogMonth(const QString& string) { - return mapMonths.value(string, 1); - -} - -QString ParsingHelper::parseSize(const QString& stringSize) { - qint64 size=stringSize.toLongLong(); - - return KGlobal::locale()->formatByteSize(size); -} - -QString ParsingHelper::parseHttpResponse(const QString& response) { - //Search the response string in the map - QMap::Iterator it=mapHTTPResponse.find(response); - if (it!=mapHTTPResponse.end()) - return i18nc("HttpResponseNumber HttpResponseDescription", "%1 %2", response, *it); - else - return response; - -} - -QString ParsingHelper::parseAgent(const QString& agent) { - return agent; -} diff --git a/ksystemlog/src/modes/base/parsingHelper.h b/ksystemlog/src/modes/base/parsingHelper.h deleted file mode 100644 index 9b3285ba..00000000 --- a/ksystemlog/src/modes/base/parsingHelper.h +++ /dev/null @@ -1,70 +0,0 @@ -/*************************************************************************** - * 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 _PARSING_HELPER_H_ -#define _PARSING_HELPER_H_ - -#include - -#include -#include - -/** - * TODO Fork this class in SyslogParsingHelper and HttpParsingHelper - */ -class ParsingHelper { - - public: - static ParsingHelper* instance(); - - ~ParsingHelper(); - - /** - * Returns the months number represented by the 3 first letters in the QString parameter - */ - int parseSyslogMonth(const QString& month); - - QDateTime parseHttpDateTime(const QString& dateTime); - - /* - * TODO Use this method in SyslogAnalyzer, and add a parameter to use the current year instead - * of trying to search it in string - */ - QDateTime parseSyslogDateTime(const QString& dateTime); - QString syslogDateTimeRegexp(); - - QString parseSize(const QString& size); - - QString parseHttpResponse(const QString& response); - - QString parseAgent(const QString& agent); - - private: - explicit ParsingHelper(); - - static ParsingHelper* self; - - QMap mapMonths; - - QMap mapHTTPResponse; -}; - -#endif diff --git a/ksystemlog/src/modes/base/syslogAnalyzer.cpp b/ksystemlog/src/modes/base/syslogAnalyzer.cpp deleted file mode 100644 index 2ab5a84a..00000000 --- a/ksystemlog/src/modes/base/syslogAnalyzer.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/*************************************************************************** - * 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 "syslogAnalyzer.h" - - -#include -#include - -#include - -#include - -#include "globals.h" -#include "logging.h" - -#include "localLogFileReader.h" -#include "logLine.h" -#include "logMode.h" -#include "logLevel.h" -#include "logViewWidget.h" - -#include "logViewModel.h" - -#include "parsingHelper.h" - -#include "ksystemlogConfig.h" - -SyslogAnalyzer::SyslogAnalyzer(LogMode* logMode) : - Analyzer(logMode) { - -} - -SyslogAnalyzer::~SyslogAnalyzer() { - -} - -LogViewColumns SyslogAnalyzer::initColumns() { - LogViewColumns columns; - columns.addColumn(LogViewColumn(i18n("Date"), true, false)); - columns.addColumn(LogViewColumn(i18n("Host"), true, true)); - columns.addColumn(LogViewColumn(i18n("Process"), true, true)); - columns.addColumn(LogViewColumn(i18n("Message"), true, false)); - - return columns; -} - -LogFileReader* SyslogAnalyzer::createLogFileReader(const LogFile& logFile) { - return new LocalLogFileReader(logFile); -} - -Analyzer::LogFileSortMode SyslogAnalyzer::logFileSortMode() { - return Analyzer::AscendingSortedLogFile; -} - -/** - * TODO Improve speed of this method (with KRegExp class for example) - */ -LogLine* SyslogAnalyzer::parseMessage(const QString& logLine, const LogFile& originalFile) { - //logDebug() << QTime::currentTime() << " : Reading line : " << logLine << " from " << originalFile.url.path(); - - //15 is the default date size format - if (logLine.length()<15) { - logDebug() << "Too short line"; - return undefinedLogLine(logLine, originalFile); - } - - int year=QDate::currentDate().year(); - - //Month number - QString month(logLine.left(3)); - - QString line(logLine); - - line=line.remove(0, 4); - int monthNum=ParsingHelper::instance()->parseSyslogMonth(month); - - //Day number - QString day(line.left(2)); - int dayNum=day.toInt(); - - line=line.remove(0, 3); - - //Time - QString stringTime(line.left(8)); - int h=stringTime.left(2).toInt(); - stringTime.remove(0, 3); - int m=stringTime.left(2).toInt(); - stringTime.remove(0, 3); - int s=stringTime.left(2).toInt(); - stringTime.remove(0, 3); - - QDateTime dateTime(QDate(year, monthNum, dayNum), QTime(h, m, s)); - if (dateTime.isValid() == false) { - logDebug() << "Malformed date and time"; - return undefinedLogLine(logLine, originalFile); - } - - line=line.remove(0, 9); - - QString hostname; - - int nextSpace = line.indexOf(QLatin1Char( ' ' )); - int nextDoubleDot=line.indexOf(QLatin1Char( ':' )); - - //Normal case or no process name - if (nextSpace < nextDoubleDot || nextDoubleDot == -1) { - //Host name - hostname = line.left(nextSpace); - line=line.remove(0, nextSpace+1); - } - //No host name case (very rare) - else { - //Host name - hostname = undefinedHostName(); - } - - //Refresh double dot once the line has been substr'ed - nextDoubleDot=line.indexOf(QLatin1Char( ':' )); - - QString process; - QString message; - - //Process name - if (nextDoubleDot!=-1) { - process=line.left(nextDoubleDot); - - //If the delete process identifier option is enabled - if (KSystemLogConfig::deleteProcessIdentifier()==true) { - int squareBracket=process.indexOf(QLatin1Char( '[' )); - - //If we find a bracket, we remove the useless part - if (squareBracket!=-1) { - process=process.left(squareBracket); - } - - } - line=line.remove(0, nextDoubleDot+1); - - message=line.remove(0, 1); - } - //If we can't find any ':' character, it means that this line is a - //internal message of syslogd - else { - if (line.contains(QLatin1String( "last message repeated" )) || line.contains(QLatin1String( "-- MARK --" ))) { - process=QLatin1String( "syslog" ); - } - else { - process=undefinedProcess(); - } - - message=line; - } - - QStringList list; - list.append(hostname); - list.append(process); - list.append(message); - - return new LogLine( - logLineInternalIdGenerator++, - dateTime, - list, - originalFile.url().path(), - originalFile.defaultLogLevel(), - logMode - ); -} - -inline LogLine* SyslogAnalyzer::undefinedLogLine(const QString& message, const LogFile& originalFile) { - QStringList items; - items << undefinedHostName() << undefinedProcess() << message; - return new LogLine( - logLineInternalIdGenerator++, - QDateTime::currentDateTime(), - items, - originalFile.url().path(), - originalFile.defaultLogLevel(), - logMode - ); - -} - -inline QString SyslogAnalyzer::undefinedHostName() { - //i18nc("Undefined host name", "undefined"); - return QLatin1String( "" ); -} - -inline QString SyslogAnalyzer::undefinedProcess() { - //i18nc("Undefined process", "undefined"); - return QLatin1String( "" ); -} - -#include "moc_syslogAnalyzer.cpp" diff --git a/ksystemlog/src/modes/base/syslogAnalyzer.h b/ksystemlog/src/modes/base/syslogAnalyzer.h deleted file mode 100644 index fc080258..00000000 --- a/ksystemlog/src/modes/base/syslogAnalyzer.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - * 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 _SYSLOG_ANALYZER_H_ -#define _SYSLOG_ANALYZER_H_ - -#include - -#include "analyzer.h" - -#include "logFile.h" - -class LogFileReader; - -class LogMode; -class LogLine; - -class SyslogAnalyzer : public Analyzer { - - Q_OBJECT - - public: - explicit SyslogAnalyzer(LogMode* logMode); - - virtual ~SyslogAnalyzer(); - - virtual LogViewColumns initColumns(); - - protected: - virtual LogFileReader* createLogFileReader(const LogFile& logFile); - virtual Analyzer::LogFileSortMode logFileSortMode(); - virtual LogLine* parseMessage(const QString& logLine, const LogFile& originalFile); - - private: - inline QString undefinedHostName(); - inline QString undefinedProcess(); - inline LogLine* undefinedLogLine(const QString& message, const LogFile& originalFile); -}; - -#endif // _SYSLOG_ANALYZER_H_ diff --git a/ksystemlog/src/modes/cron/cronAnalyzer.cpp b/ksystemlog/src/modes/cron/cronAnalyzer.cpp deleted file mode 100644 index 7bed1dcf..00000000 --- a/ksystemlog/src/modes/cron/cronAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "cronAnalyzer.h" diff --git a/ksystemlog/src/modes/cron/cronAnalyzer.h b/ksystemlog/src/modes/cron/cronAnalyzer.h deleted file mode 100644 index e66f4b66..00000000 --- a/ksystemlog/src/modes/cron/cronAnalyzer.h +++ /dev/null @@ -1,129 +0,0 @@ -/*************************************************************************** - * 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 _CRON_ANALYZER_H_ -#define _CRON_ANALYZER_H_ - -#include - -#include "syslogAnalyzer.h" - -#include "cronLogMode.h" -#include "cronConfiguration.h" - -class LogMode; - -class CronAnalyzer : public SyslogAnalyzer { - - Q_OBJECT - - public: - - CronAnalyzer(LogMode* logMode) : - SyslogAnalyzer(logMode) { - - } - - virtual ~CronAnalyzer() { - - } - - LogViewColumns initColumns() { - LogViewColumns columns; - columns.addColumn(LogViewColumn(i18n("Date"), true, false)); - columns.addColumn(LogViewColumn(i18n("Host"), true, true)); - columns.addColumn(LogViewColumn(i18n("Process"), true, true)); - columns.addColumn(LogViewColumn(i18n("User"), true, true)); - columns.addColumn(LogViewColumn(i18n("Command"), true, false)); - return columns; - } - - Analyzer::LogFileSortMode logFileSortMode() { - return Analyzer::FilteredLogFile; - } - - /* - * Cron line example : - * Sep 16 01:39:01 localhost /USR/SBIN/CRON[11069]: (root) CMD ( [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -r -0 rm) - * Sep 16 18:39:05 localhost /usr/sbin/cron[5479]: (CRON) INFO (pidfile fd = 3) - * Sep 16 18:39:05 localhost /usr/sbin/cron[5480]: (CRON) STARTUP (fork ok) - * Sep 16 18:39:05 localhost /usr/sbin/cron[5480]: (CRON) INFO (Running @reboot jobs) - * - */ - LogLine* parseMessage(const QString& logLine, const LogFile& originalFile) { - - //Use the default parsing - LogLine* syslogLine=SyslogAnalyzer::parseMessage(logLine, originalFile); - - QStringList list=syslogLine->logItems(); - - if (isCronLine(syslogLine) == false) { - delete syslogLine; - return NULL; - } - - //Gets the message column (last item) and deletes it - QString message=list.takeLast(); - - int leftBracket=message.indexOf(QLatin1Char( '(' )); - int rightBracket=message.indexOf(QLatin1Char( ')' )); - - QString user=message.mid(leftBracket+1, rightBracket-leftBracket-1); - - list.append(user); - - if (message.indexOf(QLatin1String( "CMD" )) != -1) { - // Ignore this : ") CMD (" (length = 7) - message=message.right(message.length() - rightBracket - 7); - message=message.simplified(); - syslogLine->setLogLevel(Globals::instance()->informationLogLevel()); - } - else { - // Ignore this : ") " (for INFO and STARTUP cases) - message=message.right(message.length() - rightBracket - 2); - syslogLine->setLogLevel(Globals::instance()->noticeLogLevel()); - } - - list.append(message); - - syslogLine->setLogItems(list); - - return syslogLine; - } - - inline bool isCronLine(LogLine* syslogLine) { - CronConfiguration* cronConfiguration = logMode->logModeConfiguration(); - if (cronConfiguration->processFilter().isEmpty()) { - return true; - } - - //If the process line does not match the cron process, then ignore this line - const QStringList list = syslogLine->logItems(); - QString processLine = list.at(1); - if (processLine.contains(cronConfiguration->processFilter(), Qt::CaseInsensitive) == true) { - return true; - } - - return false; - } -}; - -#endif diff --git a/ksystemlog/src/modes/cron/cronConfiguration.cpp b/ksystemlog/src/modes/cron/cronConfiguration.cpp deleted file mode 100644 index 118fa45a..00000000 --- a/ksystemlog/src/modes/cron/cronConfiguration.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "cronConfiguration.h" diff --git a/ksystemlog/src/modes/cron/cronConfiguration.h b/ksystemlog/src/modes/cron/cronConfiguration.h deleted file mode 100644 index c7f14f57..00000000 --- a/ksystemlog/src/modes/cron/cronConfiguration.h +++ /dev/null @@ -1,88 +0,0 @@ -/*************************************************************************** - * 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 _CRON_CONFIGURATION_H_ -#define _CRON_CONFIGURATION_H_ - -#include - -#include "logModeConfiguration.h" - -#include "logging.h" -#include "defaults.h" - -#include "cronLogMode.h" - -#include "ksystemlogConfig.h" - -class CronConfigurationPrivate { -public: - QStringList cronPaths; - - QString processFilter; -}; - -class CronConfiguration : public LogModeConfiguration { - - Q_OBJECT - - public: - CronConfiguration() : - d(new CronConfigurationPrivate()) { - - configuration->setCurrentGroup(QLatin1String( "CronLogMode" )); - - QStringList defaultCronPaths; - defaultCronPaths << QLatin1String( "/var/log/syslog" ); - configuration->addItemStringList(QLatin1String( "LogFilesPaths" ), d->cronPaths, defaultCronPaths, QLatin1String( "LogFilesPaths" )); - - QString defaultProcessFilter(QLatin1String( "/usr/sbin/cron" )); - configuration->addItemString(QLatin1String( "ProcessFilter" ), d->processFilter, defaultProcessFilter, QLatin1String( "ProcessFilter" )); - - - } - - virtual ~CronConfiguration() { - delete d; - } - - QString processFilter() const { - return d->processFilter; - } - - void setProcessFilter(const QString& processFilter) { - d->processFilter = processFilter; - } - - QStringList cronPaths() const { - return d->cronPaths; - } - - void setCronPaths(const QStringList& cronPaths) { - d->cronPaths = cronPaths; - } - - private: - CronConfigurationPrivate* const d; - -}; - -#endif // _CRON_CONFIGURATION_H_ diff --git a/ksystemlog/src/modes/cron/cronConfigurationWidget.cpp b/ksystemlog/src/modes/cron/cronConfigurationWidget.cpp deleted file mode 100644 index 068ba81b..00000000 --- a/ksystemlog/src/modes/cron/cronConfigurationWidget.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "cronConfigurationWidget.h" diff --git a/ksystemlog/src/modes/cron/cronConfigurationWidget.h b/ksystemlog/src/modes/cron/cronConfigurationWidget.h deleted file mode 100644 index 16c73522..00000000 --- a/ksystemlog/src/modes/cron/cronConfigurationWidget.h +++ /dev/null @@ -1,159 +0,0 @@ -/*************************************************************************** - * 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 _CRON_CONFIGURATION_WIDGET_H_ -#define _CRON_CONFIGURATION_WIDGET_H_ - -#include "logModeConfigurationWidget.h" - -#include -#include -#include - -#include - -#include "globals.h" -#include "logging.h" - -#include "fileList.h" - -#include "logLevel.h" - -#include "cronConfiguration.h" -#include "cronLogMode.h" - -class CronConfigurationWidget : public LogModeConfigurationWidget { - - Q_OBJECT - - public: - CronConfigurationWidget() : - LogModeConfigurationWidget(i18n("Cron Log"),QLatin1String( CRON_MODE_ICON ), i18n("Cron Log")) - { - - QVBoxLayout* layout = new QVBoxLayout(); - this->setLayout(layout); - - QString description = i18n("

These files will be analyzed to show the Cron Logs (i.e. planned tasks logs). More information...

"); - - fileList = new FileList(this, description); - - connect(fileList, SIGNAL(fileListChanged()), this, SIGNAL(configurationChanged())); - - layout->addWidget(fileList); - - processFilterGroup = new QGroupBox(i18n("Enable Process Filtering")); - processFilterGroup->setCheckable(true); - - connect(processFilterGroup, SIGNAL(clicked(bool)), this, SLOT(toggleProcessFilterEnabling(bool))); - connect(processFilterGroup, SIGNAL(clicked(bool)), this, SIGNAL(configurationChanged())); - - layout->addWidget(processFilterGroup); - - QHBoxLayout* processFilterLayout = new QHBoxLayout(); - - processFilterGroup->setLayout(processFilterLayout); - - processFilterLabel = new QLabel(i18n("Only keeps lines which matches this process :")); - processFilter = new QLineEdit(this); - - processFilterLabel->setBuddy(processFilter); - connect(processFilter, SIGNAL(textEdited(const QString&)), this, SIGNAL(configurationChanged())); - - processFilterLayout->addWidget(processFilterLabel); - processFilterLayout->addWidget(processFilter); - - } - - virtual ~CronConfigurationWidget() { - - } - - bool isValid() const { - if (fileList->isEmpty() == true) { - logDebug() << "Cron configuration not valid"; - return false; - } - - if (processFilterGroup->isChecked() && processFilter->text().isEmpty()) { - logDebug() << "Cron configuration not valid"; - return false; - } - - logDebug() << "Cron configuration valid"; - return true; - } - - void saveConfig() { - logDebug() << "Saving config from Cron Options..."; - - CronConfiguration* cronConfiguration = Globals::instance()->findLogMode(QLatin1String( CRON_LOG_MODE_ID ))->logModeConfiguration(); - cronConfiguration->setCronPaths(fileList->paths()); - - if (processFilterGroup->isChecked() == false) { - cronConfiguration->setProcessFilter(QLatin1String( "" )); - } - else { - cronConfiguration->setProcessFilter(processFilter->text()); - } - } - - void readConfig() { - CronConfiguration* cronConfiguration = Globals::instance()->findLogMode(QLatin1String( CRON_LOG_MODE_ID ))->logModeConfiguration(); - - fileList->removeAllItems(); - - fileList->addPaths(cronConfiguration->cronPaths()); - - if (cronConfiguration->processFilter().isEmpty()) { - processFilterGroup->setChecked(false); - } - else { - processFilterGroup->setChecked(true); - processFilter->setText(cronConfiguration->processFilter()); - } - - - } - - void defaultConfig() { - //TODO Find a way to read the configuration per default - readConfig(); - } - - private slots: - void toggleProcessFilterEnabling(bool enabled) { - processFilter->setEnabled(enabled); - processFilterLabel->setEnabled(enabled); - } - - private: - FileList* fileList; - - QGroupBox* processFilterGroup; - - QLineEdit* processFilter; - QLabel* processFilterLabel; - - -}; - -#endif // _CRON_CONFIGURATION_WIDGET_H_ diff --git a/ksystemlog/src/modes/cron/cronFactory.cpp b/ksystemlog/src/modes/cron/cronFactory.cpp deleted file mode 100644 index 264758ef..00000000 --- a/ksystemlog/src/modes/cron/cronFactory.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * 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 "cronFactory.h" - -#include - - -#include "logMode.h" -#include "logging.h" - -#include "simpleAction.h" -#include "cronLogMode.h" - -#include "logModeFactory.h" - -QList CronLogModeFactory::createLogModes() const { - QList logModes; - logModes.append(new CronLogMode()); - return logModes; -} - -LogModeAction* CronLogModeFactory::createLogModeAction() const { - LogMode* logMode = Globals::instance()->findLogMode(QLatin1String( CRON_LOG_MODE_ID )); - SimpleAction* logModeAction = new SimpleAction(logMode->action(), logMode); - logModeAction->setInToolBar(false); - logModeAction->setCategory(LogModeAction::ServicesCategory); - - return logModeAction; -} diff --git a/ksystemlog/src/modes/cron/cronFactory.h b/ksystemlog/src/modes/cron/cronFactory.h deleted file mode 100644 index c9cdfd53..00000000 --- a/ksystemlog/src/modes/cron/cronFactory.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * 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 _CRON_FACTORY_H_ -#define _CRON_FACTORY_H_ - -#include - -#include "logModeFactory.h" - -class LogModeAction; -class LogMode; - -class CronLogModeFactory : public LogModeFactory { - - Q_OBJECT - - public: - - QList createLogModes() const; - - LogModeAction* createLogModeAction() const; - -}; - -#endif // _CRON_FACTORY_H_ - diff --git a/ksystemlog/src/modes/cron/cronItemBuilder.cpp b/ksystemlog/src/modes/cron/cronItemBuilder.cpp deleted file mode 100644 index 558d72f3..00000000 --- a/ksystemlog/src/modes/cron/cronItemBuilder.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "cronItemBuilder.h" diff --git a/ksystemlog/src/modes/cron/cronItemBuilder.h b/ksystemlog/src/modes/cron/cronItemBuilder.h deleted file mode 100644 index 233b860b..00000000 --- a/ksystemlog/src/modes/cron/cronItemBuilder.h +++ /dev/null @@ -1,70 +0,0 @@ -/*************************************************************************** - * 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 _CRON_ITEM_BUILDER_H_ -#define _CRON_ITEM_BUILDER_H_ - -#include - -#include "logModeItemBuilder.h" - -#include - -#include "logging.h" - -#include "logLine.h" -#include "logViewWidgetItem.h" -#include "logMode.h" - -class CronItemBuilder : public LogModeItemBuilder { - - public: - CronItemBuilder() { - - } - - virtual ~CronItemBuilder() { - - } - - QString createFormattedText(LogLine* line) const { - QString result; - - result.append(QLatin1String( "" )); - - QListIterator it(line->logItems()); - - result.append(labelMessageFormat(i18n("Date:"), formatDate(line->time()))); - result.append(labelMessageFormat(i18n("Hostname:"), it.next() )); - result.append(labelMessageFormat(i18n("Process:"), it.next() )); - result.append(labelMessageFormat(i18n("User:"), it.next() )); - result.append(labelMessageFormat(i18n("Level:"), line->logLevel()->name())); - result.append(labelMessageFormat(i18n("Original file:"), line->sourceFileName())); - - result.append(QLatin1String( "
" )); - - return result; - - } -}; - - -#endif // _CRON_ITEM_BUILDER_H_ diff --git a/ksystemlog/src/modes/cron/cronLogMode.cpp b/ksystemlog/src/modes/cron/cronLogMode.cpp deleted file mode 100644 index 000b9776..00000000 --- a/ksystemlog/src/modes/cron/cronLogMode.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************** - * 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 "cronLogMode.h" - -#include - -#include -#include - -#include "logging.h" -#include "logMode.h" - -#include "cronAnalyzer.h" -#include "cronConfigurationWidget.h" -#include "cronConfiguration.h" -#include "cronItemBuilder.h" - -CronLogMode::CronLogMode() : - LogMode(QLatin1String( CRON_LOG_MODE_ID ), i18n("Cron Log"),QLatin1String( CRON_MODE_ICON )) { - - d->logModeConfiguration = new CronConfiguration(); - - d->logModeConfigurationWidget = new CronConfigurationWidget(); - - d->itemBuilder = new CronItemBuilder(); - - d->action = createDefaultAction(); - d->action->setToolTip(i18n("Display the planned tasks log (Cron log).")); - d->action->setWhatsThis(i18n("Displays the planned tasks log in the current tab. Cron process is a program in charge of launching planned tasks on your system, like security checks, or auto-restarting of some services. Use this menu to see the recently launched processes.")); - -} - -CronLogMode::~CronLogMode() { - -} - -Analyzer* CronLogMode::createAnalyzer() { - return new CronAnalyzer(this); -} - -QList CronLogMode::createLogFiles() { - CronConfiguration* cronConfiguration = logModeConfiguration(); - return cronConfiguration->findNoModeLogFiles(cronConfiguration->cronPaths()); -} - diff --git a/ksystemlog/src/modes/cron/cronLogMode.h b/ksystemlog/src/modes/cron/cronLogMode.h deleted file mode 100644 index 0c66994e..00000000 --- a/ksystemlog/src/modes/cron/cronLogMode.h +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************** - * 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 _CRON_LOG_MODE_H_ -#define _CRON_LOG_MODE_H_ - -/** - * Cron Log Mode Identifier - */ -#define CRON_LOG_MODE_ID "cronLogMode" - -/** - * Cron Log Icon - */ -#define CRON_MODE_ICON "chronometer" - -#include - -#include "logFile.h" -#include "logMode.h" - -class CronLogMode : public LogMode { - - Q_OBJECT - -public: - explicit CronLogMode(); - - ~CronLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _CRON_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/cups/cupsAccessAnalyzer.cpp b/ksystemlog/src/modes/cups/cupsAccessAnalyzer.cpp deleted file mode 100644 index 6da515c0..00000000 --- a/ksystemlog/src/modes/cups/cupsAccessAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "cupsAccessAnalyzer.h" diff --git a/ksystemlog/src/modes/cups/cupsAccessAnalyzer.h b/ksystemlog/src/modes/cups/cupsAccessAnalyzer.h deleted file mode 100644 index b2b78f29..00000000 --- a/ksystemlog/src/modes/cups/cupsAccessAnalyzer.h +++ /dev/null @@ -1,132 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_ACCESS_ANALYZER_H_ -#define _CUPS_ACCESS_ANALYZER_H_ - - -#include - -#include "analyzer.h" - -#include "localLogFileReader.h" -#include "logging.h" -#include "parsingHelper.h" - -#include "cupsAccessLogMode.h" - -class CupsAccessAnalyzer : public Analyzer { - - Q_OBJECT - - public: - explicit CupsAccessAnalyzer(LogMode* logMode) : - Analyzer(logMode), - cupsAccessRegex(QLatin1String( "(\\S*) (\\S*) (\\S*) \\[(.*)\\] \"(.*)\" (\\S*) (\\S*) (\\S*) (\\S*)" )) { - } - - virtual ~CupsAccessAnalyzer() { - - } - - LogViewColumns initColumns() { - LogViewColumns columns; - - columns.addColumn(LogViewColumn(i18n("Date"), true, false)); - columns.addColumn(LogViewColumn(i18n("Host"), true, true)); - columns.addColumn(LogViewColumn(i18n("Group"), true, true)); - columns.addColumn(LogViewColumn(i18n("User"), true, true)); - columns.addColumn(LogViewColumn(i18n("HTTP Request"), true, false)); - columns.addColumn(LogViewColumn(i18n("Status"), true, true)); - columns.addColumn(LogViewColumn(i18n("Bytes"), true, false)); - columns.addColumn(LogViewColumn(i18n("IPP Operation"), true, false)); - columns.addColumn(LogViewColumn(i18n("IPP Status"), true, false)); - - return columns; - } - - - protected: - - QRegExp cupsAccessRegex; - - LogFileReader* createLogFileReader(const LogFile& logFile) { - return new LocalLogFileReader(logFile); - } - - Analyzer::LogFileSortMode logFileSortMode() { - return Analyzer::AscendingSortedLogFile; - } - - /* - * http://www.cups.org/documentation.php/ref-access_log.html - * - * host group user date-time \"method resource version\" status bytes ipp-operation ipp-status - * 10.0.1.2 - - [01/Dec/2005:21:50:28 +0000] "POST / HTTP/1.1" 200 317 CUPS-Get-Printers successful-ok-ignored-or-substituted-attributes - * localhost - - [01/Dec/2005:21:50:32 +0000] "GET /admin HTTP/1.1" 200 0 - - - * localhost - - [01/Dec/2005:21:50:32 +0000] "POST / HTTP/1.1" 200 157 CUPS-Get-Printers successful-ok-ignored-or-substituted-attributes - * localhost - - [01/Dec/2005:21:50:32 +0000] "POST / HTTP/1.1" 200 1411 CUPS-Get-Devices - - * localhost - - [01/Dec/2005:21:50:32 +0000] "GET /admin HTTP/1.1" 200 6667 - - - * - */ - LogLine* parseMessage(const QString& logLine, const LogFile& originalLogFile) { - - QString line(logLine); - - int firstPosition = cupsAccessRegex.indexIn(logLine); - if (firstPosition == -1) { - logDebug() << "Unable to parse line " << logLine; - return NULL; - } - - QStringList capturedTexts = cupsAccessRegex.capturedTexts(); - - //Remove full line - capturedTexts.removeAt(0); - - capturedTexts.replace(5, ParsingHelper::instance()->parseHttpResponse(capturedTexts.at(5))); - capturedTexts.replace(6, ParsingHelper::instance()->parseSize(capturedTexts.at(6))); - - QDateTime dateTime=ParsingHelper::instance()->parseHttpDateTime(capturedTexts.takeAt(3)); - - LogLevel* logLevel = findLevel(capturedTexts.at(capturedTexts.count()-1)); - - return new LogLine( - logLineInternalIdGenerator++, - dateTime, - capturedTexts, - originalLogFile.url().path(), - logLevel, - logMode - ); - } - - inline LogLevel* findLevel(const QString& status) const { - if (status == QLatin1String( "successful-ok" )) - return Globals::instance()->informationLogLevel(); - else if (status == QLatin1String( "ignored" )) - return Globals::instance()->warningLogLevel(); - - return Globals::instance()->noticeLogLevel(); - } -}; - -#endif // _CUPS_ACCESS_ANALYZER_H_ diff --git a/ksystemlog/src/modes/cups/cupsAccessItemBuilder.cpp b/ksystemlog/src/modes/cups/cupsAccessItemBuilder.cpp deleted file mode 100644 index d1b9616c..00000000 --- a/ksystemlog/src/modes/cups/cupsAccessItemBuilder.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "cupsAccessItemBuilder.h" diff --git a/ksystemlog/src/modes/cups/cupsAccessItemBuilder.h b/ksystemlog/src/modes/cups/cupsAccessItemBuilder.h deleted file mode 100644 index 7fb89527..00000000 --- a/ksystemlog/src/modes/cups/cupsAccessItemBuilder.h +++ /dev/null @@ -1,70 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_ACCESS_ITEM_BUILDER_H_ -#define _CUPS_ACCESS_ITEM_BUILDER_H_ - -#include - -#include "logModeItemBuilder.h" - -#include - -#include "logging.h" - -#include "logLine.h" -#include "logViewWidgetItem.h" -#include "logMode.h" - -class CupsAccessItemBuilder : public LogModeItemBuilder { - - public: - CupsAccessItemBuilder() { - - } - - virtual ~CupsAccessItemBuilder() { - - } - - QString createFormattedText(LogLine* line) const { - QString result; - - QListIterator it(line->logItems()); - - result.append(QLatin1String( "" )); - - result.append(labelMessageFormat(i18n("Date:"), formatDate(line->time()))); - result.append(labelMessageFormat(i18n("Level:"), line->logLevel()->name())); - result.append(labelMessageFormat(i18n("Hostname:"), it.next() )); - result.append(labelMessageFormat(i18n("Identification:"), it.next() )); - result.append(labelMessageFormat(i18n("Username:"), it.next() )); - result.append(labelMessageFormat(i18n("HTTP Response:"), it.next() )); - result.append(labelMessageFormat(i18n("Bytes Sent:"), it.next() )); - - result.append(QLatin1String( "
" )); - - return result; - } - -}; - -#endif // _CUPS_ACCESS_ITEM_BUILDER_H_ diff --git a/ksystemlog/src/modes/cups/cupsAccessLogMode.cpp b/ksystemlog/src/modes/cups/cupsAccessLogMode.cpp deleted file mode 100644 index 38725d64..00000000 --- a/ksystemlog/src/modes/cups/cupsAccessLogMode.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * 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(CupsConfiguration* cupsConfiguration, CupsConfigurationWidget* cupsConfigurationWidget) : - LogMode(QLatin1String( CUPS_ACCESS_LOG_MODE_ID ), i18n("Cups Web Log"),QLatin1String( 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).")); - -} - - - -CupsAccessLogMode::~CupsAccessLogMode() { - -} - -Analyzer* CupsAccessLogMode::createAnalyzer() { - return new CupsAccessAnalyzer(this); -} - -QList CupsAccessLogMode::createLogFiles() { - CupsConfiguration* cupsConfiguration = logModeConfiguration(); - return cupsConfiguration->findNoModeLogFiles(cupsConfiguration->cupsAccessPaths()); -} diff --git a/ksystemlog/src/modes/cups/cupsAccessLogMode.h b/ksystemlog/src/modes/cups/cupsAccessLogMode.h deleted file mode 100644 index 9714e94f..00000000 --- a/ksystemlog/src/modes/cups/cupsAccessLogMode.h +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_ACCESS_LOG_MODE_H_ -#define _CUPS_ACCESS_LOG_MODE_H_ - -/** - * Cups Access Log Mode Identifier - */ -#define CUPS_ACCESS_LOG_MODE_ID "cupsAccessLogMode" - -/** - * Cups Access Log Icon - */ -#define CUPS_ACCESS_MODE_ICON "printer" - - -#include - -#include "logFile.h" - -#include "logMode.h" - -class CupsConfiguration; -class CupsConfigurationWidget; - -class CupsAccessLogMode : public LogMode { - - Q_OBJECT - -public: - explicit CupsAccessLogMode(CupsConfiguration* cupsConfiguration, CupsConfigurationWidget* cupsConfigurationWidget); - - ~CupsAccessLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _CUPS_ACCESS_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/cups/cupsAnalyzer.cpp b/ksystemlog/src/modes/cups/cupsAnalyzer.cpp deleted file mode 100644 index 5e5995e7..00000000 --- a/ksystemlog/src/modes/cups/cupsAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "cupsAnalyzer.h" diff --git a/ksystemlog/src/modes/cups/cupsAnalyzer.h b/ksystemlog/src/modes/cups/cupsAnalyzer.h deleted file mode 100644 index 69cca86b..00000000 --- a/ksystemlog/src/modes/cups/cupsAnalyzer.h +++ /dev/null @@ -1,149 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_ANALYZER_H_ -#define _CUPS_ANALYZER_H_ - - -#include - -#include "analyzer.h" - -#include "logging.h" - -#include "localLogFileReader.h" -#include "cupsLogMode.h" -#include "parsingHelper.h" - -#define DEBUG2_LOG_LEVEL_ICON "source" - -class CupsAnalyzer : public Analyzer { - - Q_OBJECT - - public: - explicit CupsAnalyzer(LogMode* logMode) : - Analyzer(logMode) { - - initializeTypeLevels(); - } - - virtual ~CupsAnalyzer() { - - } - - LogViewColumns initColumns() { - LogViewColumns columns; - columns.addColumn(LogViewColumn(i18n("Date"), true, false)); - columns.addColumn(LogViewColumn(i18n("Message"), true, false)); - - return columns; - } - - - - protected: - LogFileReader* createLogFileReader(const LogFile& logFile) { - return new LocalLogFileReader(logFile); - } - - Analyzer::LogFileSortMode logFileSortMode() { - return Analyzer::AscendingSortedLogFile; - } - - /* - * Also sees : - * http://www.cups.org/documentation.php/ref-error_log.html - * level date-time message - * - * Levels : - * A - Alert message (LogLevel alert) - * C - Critical error message (LogLevel crit) - * D - Debugging message (LogLevel debug) - * d - Detailed debugging message (LogLevel debug2) - * E - Normal error message (LogLevel error) - * I - Informational message (LogLevel info) - * N - Notice message (LogLevel notice) - * W - Warning message (LogLevel warn) - * X - Emergency error message (LogLevel emerg) - * - * Log line examples : - * I [15/Feb/2004:01:29:32 +0100] LoadPPDs: No new or changed PPDs... - * E [15/Feb/2004:01:43:15 +0100] Scheduler shutting down due to SIGTERM. - * - */ - LogLine* parseMessage(const QString& logLine, const LogFile& originalLogFile) { - QString line(logLine); - - QChar level=logLine[0]; - - QDateTime dateTime=ParsingHelper::instance()->parseHttpDateTime( logLine.mid(3, 26) ); - - QString message=line.remove(0, 31); - - QStringList list; - list.append(message); - - return new LogLine( - logLineInternalIdGenerator++, - dateTime, - list, - originalLogFile.url().path(), - findLogLevel(level), - logMode - ); - } - - private: - QMap mapTypeLevels; - - void initializeTypeLevels() { - mapTypeLevels[QLatin1Char( 'd' )]=new LogLevel(20, i18n("debug 2"), QLatin1String( DEBUG2_LOG_LEVEL_ICON ), QColor(169, 189, 165)); - mapTypeLevels[QLatin1Char( 'D' )]=Globals::instance()->debugLogLevel(); - mapTypeLevels[QLatin1Char( 'I' )]=Globals::instance()->informationLogLevel(); - mapTypeLevels[QLatin1Char( 'N' )]=Globals::instance()->noticeLogLevel(); - mapTypeLevels[QLatin1Char( 'W' )]=Globals::instance()->warningLogLevel(); - mapTypeLevels[QLatin1Char( 'E' )]=Globals::instance()->errorLogLevel(); - mapTypeLevels[QLatin1Char( 'C' )]=Globals::instance()->criticalLogLevel(); - mapTypeLevels[QLatin1Char( 'A' )]=Globals::instance()->alertLogLevel(); - mapTypeLevels[QLatin1Char( 'X' )]=Globals::instance()->emergencyLogLevel(); - mapTypeLevels[QLatin1Char( ' ' )]=Globals::instance()->noLogLevel(); - } - - LogLevel* findLogLevel(const QChar& type) { - QMap::iterator it; - - it=mapTypeLevels.find(type); - if (it!=mapTypeLevels.end()) { - return(*it); - } - else { - logError() << i18n("New Log Level detected: Please send this log file to the KSystemLog developer to add it."); - return(Globals::instance()->noLogLevel()); - } - } - - - - -}; - -#endif // _CUPS_ANALYZER_H_ diff --git a/ksystemlog/src/modes/cups/cupsConfiguration.cpp b/ksystemlog/src/modes/cups/cupsConfiguration.cpp deleted file mode 100644 index 9487698c..00000000 --- a/ksystemlog/src/modes/cups/cupsConfiguration.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "cupsConfiguration.h" diff --git a/ksystemlog/src/modes/cups/cupsConfiguration.h b/ksystemlog/src/modes/cups/cupsConfiguration.h deleted file mode 100644 index 0f5d0c1b..00000000 --- a/ksystemlog/src/modes/cups/cupsConfiguration.h +++ /dev/null @@ -1,115 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_CONFIGURATION_H_ -#define _CUPS_CONFIGURATION_H_ - -#include - -#include "logModeConfiguration.h" - -#include "logging.h" -#include "defaults.h" - -#include "cupsLogMode.h" - -#include "ksystemlogConfig.h" - -class CupsConfigurationPrivate { -public: - QStringList cupsPaths; - - QStringList cupsAccessPaths; - - QStringList cupsPagePaths; - - QStringList cupsPdfPaths; -}; - -class CupsConfiguration : public LogModeConfiguration { - - Q_OBJECT - - public: - CupsConfiguration() : - d(new CupsConfigurationPrivate()) { - - configuration->setCurrentGroup(QLatin1String( "CupsLogMode" )); - - QStringList defaultCupsPaths; - defaultCupsPaths << QLatin1String( "/var/log/cups/error_log" ); - configuration->addItemStringList(QLatin1String( "CupsLogFilesPaths" ), d->cupsPaths, defaultCupsPaths, QLatin1String( "CupsLogFilesPaths" )); - - QStringList defaultCupsAccessPaths; - defaultCupsAccessPaths << QLatin1String( "/var/log/cups/access_log" ); - configuration->addItemStringList(QLatin1String( "CupsAccessLogFilesPaths" ), d->cupsAccessPaths, defaultCupsAccessPaths, QLatin1String( "CupsAccessLogFilesPaths" )); - - QStringList defaultCupsPagePaths; - defaultCupsPagePaths << QLatin1String( "/var/log/cups/page_log" ); - configuration->addItemStringList(QLatin1String( "CupsPageLogFilesPaths" ), d->cupsPagePaths, defaultCupsPagePaths, QLatin1String( "CupsPageLogFilesPaths" )); - - QStringList defaultCupsPdfPaths; - defaultCupsPdfPaths << QLatin1String( "/var/log/cups/cups-pdf_log" ); - configuration->addItemStringList(QLatin1String( "CupsPdfLogFilesPaths" ), d->cupsPdfPaths, defaultCupsPdfPaths, QLatin1String( "CupsPdfLogFilesPaths" )); - } - - virtual ~CupsConfiguration() { - delete d; - } - - QStringList cupsPaths() const { - return d->cupsPaths; - } - - QStringList cupsAccessPaths() const { - return d->cupsAccessPaths; - } - - QStringList cupsPagePaths() const { - return d->cupsPagePaths; - } - - QStringList cupsPdfPaths() const { - return d->cupsPdfPaths; - } - - void setCupsPaths(const QStringList& cupsPaths) { - d->cupsPaths = cupsPaths; - } - - void setCupsAccessPaths(const QStringList& cupsAccessPaths) { - d->cupsAccessPaths = cupsAccessPaths; - } - - void setCupsPagePaths(const QStringList& cupsPagePaths) { - d->cupsPagePaths = cupsPagePaths; - } - - void setCupsPdfPaths(const QStringList& cupsPdfPaths) { - d->cupsPdfPaths = cupsPdfPaths; - } - - private: - CupsConfigurationPrivate* const d; - -}; - -#endif // _CUPS_CONFIGURATION_H_ diff --git a/ksystemlog/src/modes/cups/cupsConfigurationWidget.cpp b/ksystemlog/src/modes/cups/cupsConfigurationWidget.cpp deleted file mode 100644 index 388a9845..00000000 --- a/ksystemlog/src/modes/cups/cupsConfigurationWidget.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * KApacheLog, a apache 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 "cupsConfigurationWidget.h" diff --git a/ksystemlog/src/modes/cups/cupsConfigurationWidget.h b/ksystemlog/src/modes/cups/cupsConfigurationWidget.h deleted file mode 100644 index 6d2d4178..00000000 --- a/ksystemlog/src/modes/cups/cupsConfigurationWidget.h +++ /dev/null @@ -1,120 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_CONFIGURATION_WIDGET_H_ -#define _CUPS_CONFIGURATION_WIDGET_H_ - -#include "logModeConfigurationWidget.h" - - -#include - -#include "globals.h" -#include "logging.h" -#include "multipleFileList.h" - -#include "logLevel.h" - -#include "cupsConfiguration.h" -#include "cupsLogMode.h" - -class CupsConfigurationWidget : public LogModeConfigurationWidget { - - Q_OBJECT - - public: - CupsConfigurationWidget() : - LogModeConfigurationWidget(i18n("Cups Log"),QLatin1String( CUPS_MODE_ICON ), i18n("Cups & Cups Web Server Log")) - { - - QHBoxLayout* layout = new QHBoxLayout(); - this->setLayout(layout); - - cupsFileList=new MultipleFileList(this, i18n("

These files will be analyzed to show the Cups log and the Cups Web Access log.

")); - - cupsPathsId = cupsFileList->addCategory(i18n("Cups Log Files"), i18n("Add Cups File...")); - cupsAccessPathsId = cupsFileList->addCategory(i18n("Cups Access Log Files"), i18n("Add Cups Access File...")); - cupsPagePathsId = cupsFileList->addCategory(i18n("Cups Page Log Files"), i18n("Add Cups Page File...")); - cupsPdfPathsId = cupsFileList->addCategory(i18n("Cups PDF Log Files"), i18n("Add Cups PDF File...")); - - connect(cupsFileList, SIGNAL(fileListChanged()), this, SIGNAL(configurationChanged())); - - layout->addWidget(cupsFileList); - } - - ~CupsConfigurationWidget() { - - } - - - public slots: - - void saveConfig() { - logDebug() << "Saving config from Cups Options..."; - - CupsConfiguration* cupsConfiguration = Globals::instance()->findLogMode(QLatin1String( CUPS_LOG_MODE_ID ))->logModeConfiguration(); - cupsConfiguration->setCupsPaths(cupsFileList->paths(cupsPathsId)); - cupsConfiguration->setCupsAccessPaths(cupsFileList->paths(cupsAccessPathsId)); - cupsConfiguration->setCupsPagePaths(cupsFileList->paths(cupsPagePathsId)); - cupsConfiguration->setCupsPdfPaths(cupsFileList->paths(cupsPdfPathsId)); - - } - - void defaultConfig() { - //TODO Find a way to read the configuration per default - readConfig(); - } - - void readConfig() { - CupsConfiguration* cupsConfiguration = Globals::instance()->findLogMode(QLatin1String( CUPS_LOG_MODE_ID ))->logModeConfiguration(); - - cupsFileList->removeAllItems(); - - cupsFileList->addPaths(cupsPathsId, cupsConfiguration->cupsPaths()); - cupsFileList->addPaths(cupsAccessPathsId, cupsConfiguration->cupsAccessPaths()); - cupsFileList->addPaths(cupsPagePathsId, cupsConfiguration->cupsPagePaths()); - cupsFileList->addPaths(cupsPdfPathsId, cupsConfiguration->cupsPdfPaths()); - } - - protected: - bool isValid() const { - if (cupsFileList->isOneOfCategoryEmpty()==true) { - logDebug() << "Cups configuration not valid"; - return false; - } - - logDebug() << "Cups configuration valid"; - return true; - - } - - private: - - MultipleFileList* cupsFileList; - - int cupsPathsId; - int cupsAccessPathsId; - int cupsPagePathsId; - int cupsPdfPathsId; - -}; - -#endif // _CUPS_CONFIGURATION_WIDGET_H_ diff --git a/ksystemlog/src/modes/cups/cupsFactory.cpp b/ksystemlog/src/modes/cups/cupsFactory.cpp deleted file mode 100644 index fb3fafa6..00000000 --- a/ksystemlog/src/modes/cups/cupsFactory.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * KCupsLog, a cups 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 "cupsFactory.h" - - -#include - -#include "multipleActions.h" -#include "logMode.h" -#include "logging.h" - -#include "cupsLogMode.h" -#include "cupsAccessLogMode.h" -#include "cupsPageLogMode.h" -#include "cupsPdfLogMode.h" - -#include "cupsConfigurationWidget.h" -#include "cupsConfiguration.h" - -QList CupsLogModeFactory::createLogModes() const { - - //Create the shared configuration and configuration widget between the logModes - - CupsConfiguration* logModeConfiguration = new CupsConfiguration(); - CupsConfigurationWidget* logModeConfigurationWidget = new CupsConfigurationWidget(); - - QList logModes; - logModes.append(new CupsLogMode(logModeConfiguration, logModeConfigurationWidget)); - logModes.append(new CupsAccessLogMode(logModeConfiguration, logModeConfigurationWidget)); - logModes.append(new CupsPageLogMode(logModeConfiguration, logModeConfigurationWidget)); - logModes.append(new CupsPdfLogMode(logModeConfiguration, logModeConfigurationWidget)); - - return logModes; -} - -LogModeAction* CupsLogModeFactory::createLogModeAction() const { - LogMode* cupsLogMode = Globals::instance()->findLogMode(QLatin1String( CUPS_LOG_MODE_ID )); - - MultipleActions* multipleActions = new MultipleActions(KIcon( QLatin1String( CUPS_MODE_ICON) ), i18n("Cups"), cupsLogMode); - multipleActions->addInnerAction(cupsLogMode->action()); - multipleActions->addInnerAction(Globals::instance()->findLogMode(QLatin1String( CUPS_ACCESS_LOG_MODE_ID ))->action()); - multipleActions->addInnerAction(Globals::instance()->findLogMode(QLatin1String( CUPS_PAGE_LOG_MODE_ID ))->action()); - multipleActions->addInnerAction(Globals::instance()->findLogMode(QLatin1String( CUPS_PDF_LOG_MODE_ID ))->action()); - - multipleActions->setInToolBar(false); - multipleActions->setCategory(LogModeAction::ServicesCategory); - - return multipleActions; -} diff --git a/ksystemlog/src/modes/cups/cupsFactory.h b/ksystemlog/src/modes/cups/cupsFactory.h deleted file mode 100644 index a1490385..00000000 --- a/ksystemlog/src/modes/cups/cupsFactory.h +++ /dev/null @@ -1,41 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_LOG_MODE_FACTORY_H_ -#define _CUPS_LOG_MODE_FACTORY_H_ - -#include - -#include "logModeFactory.h" - -class CupsLogModeFactory : public LogModeFactory { - - Q_OBJECT - - public: - - QList createLogModes() const; - - LogModeAction* createLogModeAction() const; -}; - -#endif // _CUPS_LOG_MODE_FACTORY_H_ - diff --git a/ksystemlog/src/modes/cups/cupsItemBuilder.cpp b/ksystemlog/src/modes/cups/cupsItemBuilder.cpp deleted file mode 100644 index b67fb563..00000000 --- a/ksystemlog/src/modes/cups/cupsItemBuilder.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "cupsItemBuilder.h" diff --git a/ksystemlog/src/modes/cups/cupsItemBuilder.h b/ksystemlog/src/modes/cups/cupsItemBuilder.h deleted file mode 100644 index f55ce771..00000000 --- a/ksystemlog/src/modes/cups/cupsItemBuilder.h +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_ITEM_BUILDER_H_ -#define _CUPS_ITEM_BUILDER_H_ - -#include - -#include "logModeItemBuilder.h" - -#include - -#include "logging.h" - -#include "logLine.h" -#include "logViewWidgetItem.h" -#include "logMode.h" - -class CupsItemBuilder : public LogModeItemBuilder { - - public: - CupsItemBuilder() { - - } - - virtual ~CupsItemBuilder() { - - } - - QString createFormattedText(LogLine* line) const { - QString result; - - result.append(QLatin1String( "" )); - - result.append(labelMessageFormat(i18n("Date:"), formatDate(line->time()))); - result.append(labelMessageFormat(i18n("Level:"), line->logLevel()->name())); - - result.append(QLatin1String( "
" )); - - return result; - } -}; - - -#endif // _CUPS_ITEM_BUILDER_H_ diff --git a/ksystemlog/src/modes/cups/cupsLogMode.cpp b/ksystemlog/src/modes/cups/cupsLogMode.cpp deleted file mode 100644 index 7e98e34e..00000000 --- a/ksystemlog/src/modes/cups/cupsLogMode.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************** - * 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(CupsConfiguration* cupsConfiguration, CupsConfigurationWidget* cupsConfigurationWidget) : - LogMode(QLatin1String( CUPS_LOG_MODE_ID ), i18n("Cups Log"),QLatin1String( 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.")); - -} - -CupsLogMode::~CupsLogMode() { - -} - -Analyzer* CupsLogMode::createAnalyzer() { - return new CupsAnalyzer(this); -} - -QList CupsLogMode::createLogFiles() { - CupsConfiguration* cupsConfiguration = logModeConfiguration(); - return cupsConfiguration->findNoModeLogFiles(cupsConfiguration->cupsPaths()); -} diff --git a/ksystemlog/src/modes/cups/cupsLogMode.h b/ksystemlog/src/modes/cups/cupsLogMode.h deleted file mode 100644 index 72d7c740..00000000 --- a/ksystemlog/src/modes/cups/cupsLogMode.h +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_LOG_MODE_H_ -#define _CUPS_LOG_MODE_H_ - -/** - * Cups Log Mode Identifier - */ -#define CUPS_LOG_MODE_ID "cupsLogMode" - -/** - * Cups Log Icon - */ -#define CUPS_MODE_ICON "document-print" - - -#include - -#include "logFile.h" - -#include "logMode.h" - -class CupsConfiguration; -class CupsConfigurationWidget; - -class CupsLogMode : public LogMode { - - Q_OBJECT - -public: - explicit CupsLogMode(CupsConfiguration* cupsConfiguration, CupsConfigurationWidget* cupsConfigurationWidget); - - ~CupsLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _CUPS_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/cups/cupsPageAnalyzer.cpp b/ksystemlog/src/modes/cups/cupsPageAnalyzer.cpp deleted file mode 100644 index 0fe2e47c..00000000 --- a/ksystemlog/src/modes/cups/cupsPageAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "cupsPageAnalyzer.h" diff --git a/ksystemlog/src/modes/cups/cupsPageAnalyzer.h b/ksystemlog/src/modes/cups/cupsPageAnalyzer.h deleted file mode 100644 index 63e895e6..00000000 --- a/ksystemlog/src/modes/cups/cupsPageAnalyzer.h +++ /dev/null @@ -1,112 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_PAGE_ANALYZER_H_ -#define _CUPS_PAGE_ANALYZER_H_ - - -#include - -#include "analyzer.h" - -#include "localLogFileReader.h" -#include "logging.h" -#include "parsingHelper.h" - -#include "cupsPageLogMode.h" - -class CupsPageAnalyzer : public Analyzer { - - Q_OBJECT - - public: - explicit CupsPageAnalyzer(LogMode* logMode) : - Analyzer(logMode), - cupsPageRegex(QLatin1String( "(\\S*) (\\S*) (\\S*) \\[(.*)\\] (\\S*) (\\S*) (\\S*)" )) { - } - - virtual ~CupsPageAnalyzer() { - - } - - LogViewColumns initColumns() { - LogViewColumns columns; - - columns.addColumn(LogViewColumn(i18n("Date"), true, false)); - columns.addColumn(LogViewColumn(i18n("Printer"), true, true)); - columns.addColumn(LogViewColumn(i18n("User"), true, true)); - columns.addColumn(LogViewColumn(i18n("Job Id"), true, true)); - columns.addColumn(LogViewColumn(i18n("Page Number"), true, false)); - columns.addColumn(LogViewColumn(i18n("Num Copies"), true, true)); - columns.addColumn(LogViewColumn(i18n("Job Billing"), true, false)); - - return columns; - } - - - protected: - - QRegExp cupsPageRegex; - - LogFileReader* createLogFileReader(const LogFile& logFile) { - return new LocalLogFileReader(logFile); - } - - Analyzer::LogFileSortMode logFileSortMode() { - return Analyzer::AscendingSortedLogFile; - } - - /* - * http://www.cups.org/documentation.php/ref-page_log.html - * Format : printer user job-id date-time page-number num-copies job-billing - * - * DeskJet root 2 [20/May/1999:19:21:05 +0000] 1 1 acme-123 - * DeskJet root 2 [20/May/1999:19:21:05 +0000] 2 1 acme-123 - */ - LogLine* parseMessage(const QString& logLine, const LogFile& originalLogFile) { - - QString line(logLine); - - int firstPosition = cupsPageRegex.indexIn(logLine); - if (firstPosition == -1) { - logDebug() << "Unable to parse line " << logLine; - return NULL; - } - - QStringList capturedTexts = cupsPageRegex.capturedTexts(); - - //Remove full line - capturedTexts.removeAt(0); - - QDateTime dateTime=ParsingHelper::instance()->parseHttpDateTime(capturedTexts.takeAt(3)); - - return new LogLine( - logLineInternalIdGenerator++, - dateTime, - capturedTexts, - originalLogFile.url().path(), - Globals::instance()->informationLogLevel(), - logMode - ); - } -}; - -#endif // _CUPS_PAGE_ANALYZER_H_ diff --git a/ksystemlog/src/modes/cups/cupsPageItemBuilder.cpp b/ksystemlog/src/modes/cups/cupsPageItemBuilder.cpp deleted file mode 100644 index 77dd6d66..00000000 --- a/ksystemlog/src/modes/cups/cupsPageItemBuilder.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "cupsPageItemBuilder.h" diff --git a/ksystemlog/src/modes/cups/cupsPageItemBuilder.h b/ksystemlog/src/modes/cups/cupsPageItemBuilder.h deleted file mode 100644 index e06ab8d9..00000000 --- a/ksystemlog/src/modes/cups/cupsPageItemBuilder.h +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_PAGE_ITEM_BUILDER_H_ -#define _CUPS_PAGE_ITEM_BUILDER_H_ - -#include - -#include "logModeItemBuilder.h" - -#include - -#include "logging.h" - -#include "logLine.h" -#include "logViewWidgetItem.h" -#include "logMode.h" - -class CupsPageItemBuilder : public LogModeItemBuilder { - - public: - CupsPageItemBuilder() { - - } - - virtual ~CupsPageItemBuilder() { - - } - - QString createFormattedText(LogLine* line) const { - QString result; - - QListIterator it(line->logItems()); - - result.append(QLatin1String( "" )); - - result.append(labelMessageFormat(i18n("Date:"), formatDate(line->time()))); - result.append(labelMessageFormat(i18n("Level:"), line->logLevel()->name())); - result.append(labelMessageFormat(i18n("Printer:"), it.next() )); - result.append(labelMessageFormat(i18n("Username:"), it.next() )); - result.append(labelMessageFormat(i18n("Job Id:"), it.next() )); - result.append(labelMessageFormat(i18n("Page Number:"), it.next() )); - result.append(labelMessageFormat(i18n("Num Copies:"), it.next() )); - result.append(labelMessageFormat(i18n("Job Billing:"), it.next() )); - - result.append(QLatin1String( "
" )); - - return result; - } - -}; - -#endif // _CUPS_PAGE_ITEM_BUILDER_H_ diff --git a/ksystemlog/src/modes/cups/cupsPageLogMode.cpp b/ksystemlog/src/modes/cups/cupsPageLogMode.cpp deleted file mode 100644 index 0508953c..00000000 --- a/ksystemlog/src/modes/cups/cupsPageLogMode.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * 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(CupsConfiguration* cupsConfiguration, CupsConfigurationWidget* cupsConfigurationWidget) : - LogMode(QLatin1String( CUPS_PAGE_LOG_MODE_ID ), i18n("Cups Page Log"), QLatin1String( 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).")); - -} - - - -CupsPageLogMode::~CupsPageLogMode() { - -} - -Analyzer* CupsPageLogMode::createAnalyzer() { - return new CupsPageAnalyzer(this); -} - -QList CupsPageLogMode::createLogFiles() { - CupsConfiguration* cupsConfiguration = logModeConfiguration(); - return cupsConfiguration->findNoModeLogFiles(cupsConfiguration->cupsPagePaths()); -} diff --git a/ksystemlog/src/modes/cups/cupsPageLogMode.h b/ksystemlog/src/modes/cups/cupsPageLogMode.h deleted file mode 100644 index 0eb37cbb..00000000 --- a/ksystemlog/src/modes/cups/cupsPageLogMode.h +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_PAGE_LOG_MODE_H_ -#define _CUPS_PAGE_LOG_MODE_H_ - -/** - * Cups Page Log Mode Identifier - */ -#define CUPS_PAGE_LOG_MODE_ID "cupsPageLogMode" - -/** - * Cups Page Log Icon - */ -#define CUPS_PAGE_MODE_ICON "document-new" - - -#include - -#include "logFile.h" - -#include "logMode.h" - -class CupsConfiguration; -class CupsConfigurationWidget; - -class CupsPageLogMode : public LogMode { - - Q_OBJECT - -public: - explicit CupsPageLogMode(CupsConfiguration* cupsConfiguration, CupsConfigurationWidget* cupsConfigurationWidget); - - ~CupsPageLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _CUPS_PAGE_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/cups/cupsPdfAnalyzer.cpp b/ksystemlog/src/modes/cups/cupsPdfAnalyzer.cpp deleted file mode 100644 index 3003a3d4..00000000 --- a/ksystemlog/src/modes/cups/cupsPdfAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "cupsPdfAnalyzer.h" diff --git a/ksystemlog/src/modes/cups/cupsPdfAnalyzer.h b/ksystemlog/src/modes/cups/cupsPdfAnalyzer.h deleted file mode 100644 index f95452d8..00000000 --- a/ksystemlog/src/modes/cups/cupsPdfAnalyzer.h +++ /dev/null @@ -1,127 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_PDF_ANALYZER_H_ -#define _CUPS_PDF_ANALYZER_H_ - - -#include - -#include "analyzer.h" - -#include "localLogFileReader.h" -#include "logging.h" -#include "parsingHelper.h" - -#include "cupsPdfLogMode.h" - -class CupsPdfAnalyzer : public Analyzer { - - Q_OBJECT - - public: - //Fri Sep 30 21:58:37 2005 [ERROR] failed to create spool directory (/var/spool/cups-pdf/SPOOL) - explicit CupsPdfAnalyzer(LogMode* logMode) : - Analyzer(logMode), - cupsPdfRegex(QLatin1String( "\\S* " ) + ParsingHelper::instance()->syslogDateTimeRegexp() + QLatin1String( "[ ]+\\[(\\w*)\\][ ]+(.*)" )) { // \\[(.*)\\] (\\S*) (\\S*) (\\S*) - } - - virtual ~CupsPdfAnalyzer() { - - } - - LogViewColumns initColumns() { - LogViewColumns columns; - - columns.addColumn(LogViewColumn(i18n("Date"), true, false)); - columns.addColumn(LogViewColumn(i18n("Message"), true, false)); - - return columns; - } - - - protected: - - QRegExp cupsPdfRegex; - - LogFileReader* createLogFileReader(const LogFile& logFile) { - return new LocalLogFileReader(logFile); - } - - Analyzer::LogFileSortMode logFileSortMode() { - return Analyzer::AscendingSortedLogFile; - } - - /* - * http://www.physik.uni-wuerzburg.de/~vrbehr/cups-pdf/documentation.shtml (cups-pdf_log) - * - * Thu Jun 14 12:40:35 2007 [STATUS] identification string sent - * Thu Jun 14 12:43:07 2007 [ERROR] failed to set file mode for PDF file (non fatal) (/var/spool/cups-pdf/root/Test_Pdf.pdf) - * Thu Jun 14 12:43:07 2007 [STATUS] PDF creation successfully finished (root) - * Fri Sep 30 21:58:37 2005 [ERROR] failed to create spool directory (/var/spool/cups-pdf/SPOOL) - * Sat Oct 1 09:11:45 2005 [ERROR] failed to create spool directory (/var/spool/cups-pdf/SPOOL) - */ - LogLine* parseMessage(const QString& logLine, const LogFile& originalLogFile) { - - QString line(logLine); - - int firstPosition = cupsPdfRegex.indexIn(logLine); - if (firstPosition == -1) { - logDebug() << "Unable to parse line " << logLine; - return NULL; - } - - QStringList capturedTexts = cupsPdfRegex.capturedTexts(); - - /* - logDebug() << "------------------------------------------"; - foreach(QString cap, capturedTexts) { - logDebug() << cap; - } - logDebug() << "------------------------------------------"; - */ - - //Remove full line - capturedTexts.removeAt(0); - - QDateTime dateTime=ParsingHelper::instance()->parseSyslogDateTime(capturedTexts.takeAt(0)); - LogLevel* logLevel = findLogLevel(capturedTexts.takeAt(0)); - - return new LogLine( - logLineInternalIdGenerator++, - dateTime, - capturedTexts, - originalLogFile.url().path(), - logLevel, - logMode - ); - } - - LogLevel* findLogLevel(const QString& level) { - if ( level == QLatin1String( "ERROR" )) - return Globals::instance()->errorLogLevel(); - - //level == "STATUS" - return Globals::instance()->informationLogLevel(); - } -}; - -#endif // _CUPS_PDF_ANALYZER_H_ diff --git a/ksystemlog/src/modes/cups/cupsPdfItemBuilder.cpp b/ksystemlog/src/modes/cups/cupsPdfItemBuilder.cpp deleted file mode 100644 index c1422881..00000000 --- a/ksystemlog/src/modes/cups/cupsPdfItemBuilder.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "cupsPdfItemBuilder.h" diff --git a/ksystemlog/src/modes/cups/cupsPdfItemBuilder.h b/ksystemlog/src/modes/cups/cupsPdfItemBuilder.h deleted file mode 100644 index b7373dbe..00000000 --- a/ksystemlog/src/modes/cups/cupsPdfItemBuilder.h +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_PDF_ITEM_BUILDER_H_ -#define _CUPS_PDF_ITEM_BUILDER_H_ - -#include - -#include "logModeItemBuilder.h" - -#include - -#include "logging.h" - -#include "logLine.h" -#include "logViewWidgetItem.h" -#include "logMode.h" - -class CupsPdfItemBuilder : public LogModeItemBuilder { - - public: - CupsPdfItemBuilder() { - - } - - virtual ~CupsPdfItemBuilder() { - - } - - QString createFormattedText(LogLine* line) const { - QString result; - - QListIterator it(line->logItems()); - - result.append(QLatin1String( "" )); - - result.append(labelMessageFormat(i18n("Date:"), formatDate(line->time()))); - result.append(labelMessageFormat(i18n("Level:"), line->logLevel()->name())); - result.append(labelMessageFormat(i18n("Message:"), it.next() )); - - result.append(QLatin1String( "
" )); - - return result; - } - -}; - -#endif // _CUPS_PDF_ITEM_BUILDER_H_ diff --git a/ksystemlog/src/modes/cups/cupsPdfLogMode.cpp b/ksystemlog/src/modes/cups/cupsPdfLogMode.cpp deleted file mode 100644 index 7a978125..00000000 --- a/ksystemlog/src/modes/cups/cupsPdfLogMode.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * 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(CupsConfiguration* cupsConfiguration, CupsConfigurationWidget* cupsConfigurationWidget) : - LogMode(QLatin1String( CUPS_PDF_LOG_MODE_ID ), i18n("Cups PDF Log"), QLatin1String( 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).")); - -} - - - -CupsPdfLogMode::~CupsPdfLogMode() { - -} - -Analyzer* CupsPdfLogMode::createAnalyzer() { - return new CupsPdfAnalyzer(this); -} - -QList CupsPdfLogMode::createLogFiles() { - CupsConfiguration* cupsConfiguration = logModeConfiguration(); - return cupsConfiguration->findNoModeLogFiles(cupsConfiguration->cupsPdfPaths()); -} diff --git a/ksystemlog/src/modes/cups/cupsPdfLogMode.h b/ksystemlog/src/modes/cups/cupsPdfLogMode.h deleted file mode 100644 index d915e53c..00000000 --- a/ksystemlog/src/modes/cups/cupsPdfLogMode.h +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************** - * 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 _CUPS_PDF_LOG_MODE_H_ -#define _CUPS_PDF_LOG_MODE_H_ - -/** - * Cups Pdf Log Mode Identifier - */ -#define CUPS_PDF_LOG_MODE_ID "cupsPdfLogMode" - -/** - * Cups Pdf Log Icon - */ -#define CUPS_PDF_MODE_ICON "application-pdf" - - -#include - -#include "logFile.h" - -#include "logMode.h" - -class CupsConfiguration; -class CupsConfigurationWidget; - -class CupsPdfLogMode : public LogMode { - - Q_OBJECT - -public: - explicit CupsPdfLogMode(CupsConfiguration* cupsConfiguration, CupsConfigurationWidget* cupsConfigurationWidget); - - ~CupsPdfLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _CUPS_PDF_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/daemon/daemonConfiguration.cpp b/ksystemlog/src/modes/daemon/daemonConfiguration.cpp deleted file mode 100644 index 76103221..00000000 --- a/ksystemlog/src/modes/daemon/daemonConfiguration.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "daemonConfiguration.h" diff --git a/ksystemlog/src/modes/daemon/daemonConfiguration.h b/ksystemlog/src/modes/daemon/daemonConfiguration.h deleted file mode 100644 index 26c8e25c..00000000 --- a/ksystemlog/src/modes/daemon/daemonConfiguration.h +++ /dev/null @@ -1,72 +0,0 @@ -/*************************************************************************** - * 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 _DAEMON_CONFIGURATION_H_ -#define _DAEMON_CONFIGURATION_H_ - -#include - -#include "logModeConfiguration.h" - -#include "logging.h" -#include "defaults.h" - -#include "ksystemlogConfig.h" - -class DaemonConfigurationPrivate { -public: - QStringList daemonPaths; -}; - -class DaemonConfiguration : public LogModeConfiguration { - - Q_OBJECT - - public: - DaemonConfiguration() : - d(new DaemonConfigurationPrivate()) { - - configuration->setCurrentGroup(QLatin1String( "DaemonLogMode" )); - - QStringList defaultDaemonPaths; - defaultDaemonPaths << QLatin1String( "/var/log/daemon.log" ); - configuration->addItemStringList(QLatin1String( "LogFilesPaths" ), d->daemonPaths, defaultDaemonPaths, QLatin1String( "LogFilesPaths" )); - - } - - virtual ~DaemonConfiguration() { - delete d; - } - - QStringList daemonPaths() const { - return d->daemonPaths; - } - - void setDaemonPaths(const QStringList& daemonPaths) { - d->daemonPaths = daemonPaths; - } - - private: - DaemonConfigurationPrivate* const d; - -}; - -#endif // _DAEMON_CONFIGURATION_H_ diff --git a/ksystemlog/src/modes/daemon/daemonConfigurationWidget.cpp b/ksystemlog/src/modes/daemon/daemonConfigurationWidget.cpp deleted file mode 100644 index 8ab61664..00000000 --- a/ksystemlog/src/modes/daemon/daemonConfigurationWidget.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * KApacheLog, a apache 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 "daemonConfigurationWidget.h" diff --git a/ksystemlog/src/modes/daemon/daemonConfigurationWidget.h b/ksystemlog/src/modes/daemon/daemonConfigurationWidget.h deleted file mode 100644 index 58c76f8f..00000000 --- a/ksystemlog/src/modes/daemon/daemonConfigurationWidget.h +++ /dev/null @@ -1,99 +0,0 @@ -/*************************************************************************** - * 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 _DAEMON_CONFIGURATION_WIDGET_H_ -#define _DAEMON_CONFIGURATION_WIDGET_H_ - - -#include - -#include "globals.h" -#include "logging.h" -#include "fileList.h" - -#include "logLevel.h" - -#include "daemonConfiguration.h" -#include "daemonLogMode.h" - -#include "logModeConfigurationWidget.h" - -class FileList; - -class DaemonConfigurationWidget : public LogModeConfigurationWidget { - - Q_OBJECT - - public: - DaemonConfigurationWidget() : - LogModeConfigurationWidget(i18n("Daemons' Logs"),QLatin1String( DAEMON_MODE_ICON ), i18n("Daemons' Logs")) - { - - QHBoxLayout* layout = new QHBoxLayout(); - this->setLayout(layout); - - fileList=new FileList(this, i18n("

These files will be analyzed to show the Daemons' Logs.

")); - connect(fileList, SIGNAL(fileListChanged()), this, SIGNAL(configurationChanged())); - layout->addWidget(fileList); - - } - - ~DaemonConfigurationWidget() { - - } - - public slots: - - void saveConfig() { - DaemonConfiguration* daemonConfiguration = Globals::instance()->findLogMode(QLatin1String( DAEMON_LOG_MODE_ID ))->logModeConfiguration(); - - daemonConfiguration->setDaemonPaths(fileList->paths()); - } - - void readConfig() { - DaemonConfiguration* daemonConfiguration = Globals::instance()->findLogMode(QLatin1String( DAEMON_LOG_MODE_ID ))->logModeConfiguration(); - - fileList->removeAllItems(); - - fileList->addPaths(daemonConfiguration->daemonPaths()); - } - - void defaultConfig() { - //TODO Find a way to read the configuration per default - readConfig(); - } - - protected: - bool isValid() const { - if (fileList->isEmpty()==false) { - return true; - } - - return false; - - } - - private: - FileList* fileList; - -}; - -#endif // _DAEMON_CONFIGURATION_WIDGET_H_ diff --git a/ksystemlog/src/modes/daemon/daemonFactory.cpp b/ksystemlog/src/modes/daemon/daemonFactory.cpp deleted file mode 100644 index 06b3f4bd..00000000 --- a/ksystemlog/src/modes/daemon/daemonFactory.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************** - * 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 "daemonFactory.h" - -#include - - -#include "logMode.h" -#include "logging.h" - -#include "simpleAction.h" -#include "daemonLogMode.h" - -#include "logModeFactory.h" - -QList DaemonLogModeFactory::createLogModes() const { - QList logModes; - logModes.append(new DaemonLogMode()); - return logModes; -} - -LogModeAction* DaemonLogModeFactory::createLogModeAction() const { - LogMode* logMode = Globals::instance()->findLogMode(QLatin1String( DAEMON_LOG_MODE_ID )); - return new SimpleAction(logMode->action(), logMode); -} diff --git a/ksystemlog/src/modes/daemon/daemonFactory.h b/ksystemlog/src/modes/daemon/daemonFactory.h deleted file mode 100644 index 578c7719..00000000 --- a/ksystemlog/src/modes/daemon/daemonFactory.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * 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 _DAEMON_FACTORY_H_ -#define _DAEMON_FACTORY_H_ - -#include - -#include "logModeFactory.h" - -class LogModeAction; -class LogMode; - -class DaemonLogModeFactory : public LogModeFactory { - - Q_OBJECT - - public: - - QList createLogModes() const; - - LogModeAction* createLogModeAction() const; - -}; - -#endif // _DAEMON_FACTORY_H_ - diff --git a/ksystemlog/src/modes/daemon/daemonLogMode.cpp b/ksystemlog/src/modes/daemon/daemonLogMode.cpp deleted file mode 100644 index 7ab0fb1d..00000000 --- a/ksystemlog/src/modes/daemon/daemonLogMode.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************** - * 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 "daemonLogMode.h" - -#include - -#include -#include - -#include "logging.h" -#include "logMode.h" - -#include "syslogAnalyzer.h" -#include "daemonConfigurationWidget.h" -#include "daemonConfiguration.h" - -#include "logModeItemBuilder.h" - -DaemonLogMode::DaemonLogMode() : - LogMode(QLatin1String( DAEMON_LOG_MODE_ID ), i18n("Daemons' Logs"), QLatin1String( DAEMON_MODE_ICON )) { - - d->logModeConfiguration = new DaemonConfiguration(); - - d->logModeConfigurationWidget = new DaemonConfigurationWidget(); - - d->itemBuilder = new LogModeItemBuilder(); - - d->action = createDefaultAction(); - d->action->setToolTip(i18n("Display the daemons' logs.")); - d->action->setWhatsThis(i18n("Displays the daemons' logs in the current tab. The daemons are all processes launched in the background of the system. See this log if you want to know what occurs in the background of your system.")); - -} - -DaemonLogMode::~DaemonLogMode() { - -} - -Analyzer* DaemonLogMode::createAnalyzer() { - return new SyslogAnalyzer(this); -} - -QList DaemonLogMode::createLogFiles() { - DaemonConfiguration* configuration = logModeConfiguration(); - return configuration->findGenericLogFiles(configuration->daemonPaths()); -} diff --git a/ksystemlog/src/modes/daemon/daemonLogMode.h b/ksystemlog/src/modes/daemon/daemonLogMode.h deleted file mode 100644 index 0e7ea10e..00000000 --- a/ksystemlog/src/modes/daemon/daemonLogMode.h +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - * 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 _DAEMON_LOG_MODE_H_ -#define _DAEMON_LOG_MODE_H_ - -/** - * Daemon Log Mode Identifier - */ -#define DAEMON_LOG_MODE_ID "daemonLogMode" - -/** - * Daemon Log Icon - */ -#define DAEMON_MODE_ICON "utilities-terminal" - - -#include - -#include -#include - -#include "logging.h" -#include "logMode.h" - -#include "syslogAnalyzer.h" -#include "daemonConfigurationWidget.h" -#include "daemonConfiguration.h" - -#include "logModeItemBuilder.h" - -class DaemonLogMode : public LogMode { - - Q_OBJECT - -public: - explicit DaemonLogMode(); - - - ~DaemonLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _DAEMON_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/kernel/kernelAnalyzer.cpp b/ksystemlog/src/modes/kernel/kernelAnalyzer.cpp deleted file mode 100644 index ebbb7d51..00000000 --- a/ksystemlog/src/modes/kernel/kernelAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "kernelAnalyzer.h" diff --git a/ksystemlog/src/modes/kernel/kernelAnalyzer.h b/ksystemlog/src/modes/kernel/kernelAnalyzer.h deleted file mode 100644 index 382a6220..00000000 --- a/ksystemlog/src/modes/kernel/kernelAnalyzer.h +++ /dev/null @@ -1,167 +0,0 @@ -/*************************************************************************** - * 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 _KERNEL_ANALYZER_H_ -#define _KERNEL_ANALYZER_H_ - -#include -#include -#include - -#include - -#include "logging.h" - -#include "analyzer.h" - -#include "localLogFileReader.h" -#include "processOutputLogFileReader.h" -#include "kernelLogMode.h" - -class LogMode; - -class KernelAnalyzer : public Analyzer { - - Q_OBJECT - - public: - - KernelAnalyzer(LogMode* logMode) : - Analyzer(logMode) { - - startupTime(); - } - - virtual ~KernelAnalyzer() { - - } - - LogViewColumns initColumns() { - LogViewColumns columns; - columns.addColumn(LogViewColumn(i18n("Date"), true, false)); - columns.addColumn(LogViewColumn(i18n("Component"), true, false)); - columns.addColumn(LogViewColumn(i18n("Message"), true, false)); - - return columns; - } - - protected: - LogFileReader* createLogFileReader(const LogFile& logFile) { - return new ProcessOutputLogFileReader(logFile); - } - - Analyzer::LogFileSortMode logFileSortMode() { - return Analyzer::AscendingSortedLogFile; - } - - void startupTime() { - QFile file(QLatin1String( UPTIME_FILE )); - - file.open(QIODevice::ReadOnly | QIODevice::Text); - - QTextStream in(&file); - QString line = in.readLine(); - - //Format : 1618.72 1382.98 (uptime / something) - QStringList times = line.split(QLatin1String( " " )); - - QString secondsString = times.at(0); - QString pureSecondsString = secondsString.left(secondsString.indexOf(QLatin1String( "." ))); - long updateSeconds = pureSecondsString.toLong(); - - startupDateTime = QDateTime::currentDateTime().addSecs(- updateSeconds); - logDebug() << "Startup time : " << startupDateTime; - - } - - LogLine* parseMessage(const QString& logLine, const LogFile& originalLogFile) { - QRegExp timeRegex(QLatin1String( "\\[\\ *(\\d*)\\.(\\d*)\\]\\s+(.*)" )); - -// QRegExp componentRegexp(timeRegex + "([^\\s:]{,20})[:\\s\\t]+(.*)"); -// QRegExp messageRegexp(timeRegex + "(.*)"); - - QDateTime dateTime(startupDateTime); - QStringList messages; - - int timeExists = timeRegex.indexIn(logLine); - - //If we have the date, we are able to update the start date - if (timeExists != -1) { - - //logDebug() << componentRegexp.cap(1).toInt() << "and" << componentRegexp.cap(2).toInt(); - dateTime = dateTime.addSecs( timeRegex.cap(1).toInt() ); - dateTime = dateTime.addMSecs( timeRegex.cap(2).toInt()/1000 ); - - parseComponentMessage(timeRegex.cap(3), messages); - - } - //Else, the date will never change - else { - parseComponentMessage(logLine, messages); - } - - /* - logDebug() << "--------------------------------"; - logDebug() << logLine; - logDebug() << "Secs : " << dateTime.time().second(); - logDebug() << "MSec : " << dateTime.time().msec(); - logDebug() << "Comp : " << messages.at(0); - logDebug() << "Msg : " << messages.at(1); - logDebug() << "--------------------------------"; - */ - - LogLine* line = new LogLine( - logLineInternalIdGenerator++, - dateTime, - messages, - originalLogFile.url().path(), - Globals::instance()->informationLogLevel(), - logMode - ); - - return line; - } - - inline void parseComponentMessage(const QString& logLine, QStringList& messages) { - QString message(logLine); - QString component; - - int doublePointPosition = message.indexOf(QLatin1String( ":" )); - - //Estimate the max size of a component - if (doublePointPosition != -1 && doublePointPosition < 20) { - component = message.left(doublePointPosition); - //Remove component length + ": " - message = message.remove(0, doublePointPosition +2); - - } - - messages.append( component ); - messages.append( message.simplified() ); - - } - - protected: - QDateTime startupDateTime; - -}; - -#endif diff --git a/ksystemlog/src/modes/kernel/kernelFactory.cpp b/ksystemlog/src/modes/kernel/kernelFactory.cpp deleted file mode 100644 index 6cf50fdd..00000000 --- a/ksystemlog/src/modes/kernel/kernelFactory.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************** - * 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 "kernelFactory.h" - -#include - - -#include "logMode.h" -#include "logging.h" - -#include "simpleAction.h" -#include "kernelLogMode.h" - -#include "logModeFactory.h" - -QList KernelLogModeFactory::createLogModes() const { - QList logModes; - logModes.append(new KernelLogMode()); - return logModes; -} - -LogModeAction* KernelLogModeFactory::createLogModeAction() const { - LogMode* logMode = Globals::instance()->findLogMode(QLatin1String( KERNEL_LOG_MODE_ID )); - return new SimpleAction(logMode->action(), logMode); -} diff --git a/ksystemlog/src/modes/kernel/kernelFactory.h b/ksystemlog/src/modes/kernel/kernelFactory.h deleted file mode 100644 index 3b31535a..00000000 --- a/ksystemlog/src/modes/kernel/kernelFactory.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * 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 _KERNEL_FACTORY_H_ -#define _KERNEL_FACTORY_H_ - -#include - -#include "logModeFactory.h" - -class LogModeAction; -class LogMode; - -class KernelLogModeFactory : public LogModeFactory { - - Q_OBJECT - - public: - - QList createLogModes() const; - - LogModeAction* createLogModeAction() const; - -}; - -#endif // _KERNEL_FACTORY_H_ - diff --git a/ksystemlog/src/modes/kernel/kernelItemBuilder.cpp b/ksystemlog/src/modes/kernel/kernelItemBuilder.cpp deleted file mode 100644 index 6bb300a3..00000000 --- a/ksystemlog/src/modes/kernel/kernelItemBuilder.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "kernelItemBuilder.h" diff --git a/ksystemlog/src/modes/kernel/kernelItemBuilder.h b/ksystemlog/src/modes/kernel/kernelItemBuilder.h deleted file mode 100644 index 3d092d9f..00000000 --- a/ksystemlog/src/modes/kernel/kernelItemBuilder.h +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * 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 _KERNEL_ITEM_BUILDER_H_ -#define _KERNEL_ITEM_BUILDER_H_ - -#include - -#include - -#include "logging.h" - -#include "logLine.h" -#include "logViewWidgetItem.h" -#include "logMode.h" - -#include "logModeItemBuilder.h" - -class LogLine; - -class KernelItemBuilder : public LogModeItemBuilder { - - public: - KernelItemBuilder() { - - } - - virtual ~KernelItemBuilder() { - - } - - QString createFormattedText(LogLine* line) const { - QString result; - - QListIterator it(line->logItems()); - - result.append(QLatin1String( "" )); - - result.append(labelMessageFormat(i18n("Date:"), formatDate(line->time()))); - result.append(labelMessageFormat(i18n("Level:"), line->logLevel()->name())); - result.append(labelMessageFormat(i18n("Component:"), it.next())); - - result.append(QLatin1String( "
" )); - - return result; - } - -}; - -#endif // _KERNEL_ITEM_BUILDER_H_ diff --git a/ksystemlog/src/modes/kernel/kernelLogMode.cpp b/ksystemlog/src/modes/kernel/kernelLogMode.cpp deleted file mode 100644 index 9d58c41d..00000000 --- a/ksystemlog/src/modes/kernel/kernelLogMode.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************** - * 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 "kernelLogMode.h" - -#include -#include - -#include -#include - -#include "logging.h" - -#include "logMode.h" - -#include "kernelAnalyzer.h" -#include "kernelItemBuilder.h" - -KernelLogMode::KernelLogMode() : - LogMode(QLatin1String( KERNEL_LOG_MODE_ID ), i18n("Kernel Log"),QLatin1String( KERNEL_MODE_ICON )) { - - d->logModeConfiguration = NULL; - - d->logModeConfigurationWidget = NULL; - - d->itemBuilder = new KernelItemBuilder(); - - d->action = createDefaultAction(); - d->action->setToolTip(i18n("Display the kernel log.")); - d->action->setWhatsThis(i18n("Displays the kernel log in the current tab. This log is only useful for users who want to know why the Kernel does not detect their hardware or what is the cause of the last kernel panic/oops.")); - -} - -KernelLogMode::~KernelLogMode() { - -} - -Analyzer* KernelLogMode::createAnalyzer() { - return new KernelAnalyzer(this); -} - -QList KernelLogMode::createLogFiles() { - QList logFiles; - logFiles.append(LogFile(KUrl("/bin/dmesg"), Globals::instance()->informationLogLevel())); - return logFiles; -} diff --git a/ksystemlog/src/modes/kernel/kernelLogMode.h b/ksystemlog/src/modes/kernel/kernelLogMode.h deleted file mode 100644 index 08923fe5..00000000 --- a/ksystemlog/src/modes/kernel/kernelLogMode.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - * 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 _KERNEL_LOG_MODE_H_ -#define _KERNEL_LOG_MODE_H_ - -/** - * Kernel Log Mode Identifier - */ -#define KERNEL_LOG_MODE_ID "kernelLogMode" - -/** - * Kernel Log Icon - */ -#define KERNEL_MODE_ICON "utilities-system-monitor" - -#define UPTIME_FILE "/proc/uptime" - -#include - -#include "logFile.h" -#include "logMode.h" - -class KernelLogMode : public LogMode { - - Q_OBJECT - -public: - explicit KernelLogMode(); - - ~KernelLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _KERNEL_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/open/openAnalyzer.cpp b/ksystemlog/src/modes/open/openAnalyzer.cpp deleted file mode 100644 index 2fe6e566..00000000 --- a/ksystemlog/src/modes/open/openAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "openAnalyzer.h" diff --git a/ksystemlog/src/modes/open/openAnalyzer.h b/ksystemlog/src/modes/open/openAnalyzer.h deleted file mode 100644 index e190ea52..00000000 --- a/ksystemlog/src/modes/open/openAnalyzer.h +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * 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 _OPEN_ANALYZER_H_ -#define _OPEN_ANALYZER_H_ - - -#include - -#include "syslogAnalyzer.h" - -#include "logging.h" -#include "logFile.h" - -#include "openLogMode.h" - -class OpenAnalyzer : public SyslogAnalyzer { - - Q_OBJECT - - public: - OpenAnalyzer(LogMode* logMode) : - SyslogAnalyzer(logMode) { - - } - - virtual ~OpenAnalyzer() { - - } - -}; - -#endif diff --git a/ksystemlog/src/modes/open/openFactory.cpp b/ksystemlog/src/modes/open/openFactory.cpp deleted file mode 100644 index 8a6f6ab6..00000000 --- a/ksystemlog/src/modes/open/openFactory.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * 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 "openFactory.h" - -#include "logMode.h" -#include "defaults.h" -#include "logFile.h" -#include "logging.h" -#include "ksystemlogConfig.h" - -#include "openLogMode.h" -#include "logModeItemBuilder.h" - - -OpenLogModeFactory::OpenLogModeFactory(QWidget* parent) : - parent(parent) { - -} - -OpenLogModeFactory::~OpenLogModeFactory() { - -} - -QList OpenLogModeFactory::createLogModes() const { - QList logModes; - logModes.append(new OpenLogMode(parent)); - return logModes; -} - -LogModeAction* OpenLogModeFactory::createLogModeAction() const { - return NULL; -} diff --git a/ksystemlog/src/modes/open/openFactory.h b/ksystemlog/src/modes/open/openFactory.h deleted file mode 100644 index 86e8d4e7..00000000 --- a/ksystemlog/src/modes/open/openFactory.h +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * 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 _OPEN_LOG_MODE_FACTORY_H_ -#define _OPEN_LOG_MODE_FACTORY_H_ - - -#include "logModeFactory.h" -#include "logModeConfiguration.h" - -class OpenLogModeFactory : public LogModeFactory { - - Q_OBJECT - - public: - explicit OpenLogModeFactory(QWidget* parent); - - ~OpenLogModeFactory(); - - QList createLogModes() const; - - LogModeAction* createLogModeAction() const; - - private: - - QWidget* parent; -}; - -#endif // _OPEN_LOG_MODE_FACTORY_H_ - diff --git a/ksystemlog/src/modes/open/openLogMode.cpp b/ksystemlog/src/modes/open/openLogMode.cpp deleted file mode 100644 index f1a9e3fb..00000000 --- a/ksystemlog/src/modes/open/openLogMode.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************** - * 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 "openLogMode.h" - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include "logging.h" -#include "logMode.h" - -#include "logModeItemBuilder.h" -#include "openAnalyzer.h" - -OpenLogMode::OpenLogMode(QWidget* parent) : - LogMode(QLatin1String( OPEN_LOG_MODE_ID ), i18n("Log File"),QLatin1String( OPEN_MODE_ICON )), - parent(parent) { - - d->logModeConfiguration = NULL; - - d->logModeConfigurationWidget = NULL; - - d->itemBuilder = new LogModeItemBuilder(); - - d->action = NULL; - -} - -OpenLogMode::~OpenLogMode() { - -} - -Analyzer* OpenLogMode::createAnalyzer() { - return new OpenAnalyzer(this); -} - -QList OpenLogMode::createLogFiles() { - //Open a standard Filedialog - KUrl openingFileName(KFileDialog::getOpenUrl(KUrl(), QString(), parent, i18n("Open Location"))); - logDebug() << "Opening file : " << openingFileName.url(); - - if (openingFileName.isEmpty()) { - return QList(); - } - - if (openingFileName.isValid()) { - LogFile logFile(openingFileName, Globals::instance()->informationLogLevel()); - QList logFiles; - logFiles.append(logFile); - - return logFiles; - - } - - QString message(i18n("Malformed URL. Unable to open this file.")); - KMessageBox::error(parent, message, i18n("Unable to open this file."), KMessageBox::Notify); - - return QList(); -} diff --git a/ksystemlog/src/modes/open/openLogMode.h b/ksystemlog/src/modes/open/openLogMode.h deleted file mode 100644 index 54a69644..00000000 --- a/ksystemlog/src/modes/open/openLogMode.h +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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 _OPEN_LOG_MODE_H_ -#define _OPEN_LOG_MODE_H_ - -/** - * Open Log Mode Identifier - */ -#define OPEN_LOG_MODE_ID "openLogMode" - -/** - * System Log Icon - */ -#define OPEN_MODE_ICON "document-open" - - -#include - - -#include "logFile.h" - -#include "logMode.h" - -#include - -class OpenLogMode : public LogMode { - - Q_OBJECT - -public: - explicit OpenLogMode(QWidget* parent); - - ~OpenLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -private: - QWidget* parent; -}; - -#endif // _OPEN_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/postfix/postfixAnalyzer.cpp b/ksystemlog/src/modes/postfix/postfixAnalyzer.cpp deleted file mode 100644 index 1dd93bae..00000000 --- a/ksystemlog/src/modes/postfix/postfixAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "postfixAnalyzer.h" diff --git a/ksystemlog/src/modes/postfix/postfixAnalyzer.h b/ksystemlog/src/modes/postfix/postfixAnalyzer.h deleted file mode 100644 index a068fea5..00000000 --- a/ksystemlog/src/modes/postfix/postfixAnalyzer.h +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * 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 _POSTFIX_ANALYZER_H_ -#define _POSTFIX_ANALYZER_H_ - -#include - -#include "syslogAnalyzer.h" - -#include "logMode.h" -#include "logging.h" - -class PostfixAnalyzer : public SyslogAnalyzer { - - Q_OBJECT - - public: - - PostfixAnalyzer(LogMode* logMode) : - SyslogAnalyzer(logMode) { - - } - - virtual ~PostfixAnalyzer() { - - } - - /* - * Just a test of multilines log lines (and it works well !) - */ - /* - LogLine* parseMessage(const QString& logLine, const LogFile& originalFile) { - LogLine* syslogLine = SyslogAnalyzer::parseMessage(logLine, originalFile); - - QStringList items = syslogLine->logItems(); - QString message = items.takeLast(); - - items.append(message + "\n" + message); - - logDebug() << "Coucou" << items.at(items.count()-1); - - syslogLine->setLogItems(items); - return syslogLine; - } - */ - -}; - -#endif diff --git a/ksystemlog/src/modes/postfix/postfixConfiguration.cpp b/ksystemlog/src/modes/postfix/postfixConfiguration.cpp deleted file mode 100644 index be48b8f9..00000000 --- a/ksystemlog/src/modes/postfix/postfixConfiguration.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "postfixConfiguration.h" diff --git a/ksystemlog/src/modes/postfix/postfixConfiguration.h b/ksystemlog/src/modes/postfix/postfixConfiguration.h deleted file mode 100644 index cfbd1988..00000000 --- a/ksystemlog/src/modes/postfix/postfixConfiguration.h +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * 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 _POSTFIX_CONFIGURATION_H_ -#define _POSTFIX_CONFIGURATION_H_ - -#include -#include - -#include "genericConfiguration.h" -#include "globals.h" -#include "defaults.h" - -#include "postfixLogMode.h" - -class PostfixConfiguration : public GenericLogModeConfiguration { - - Q_OBJECT - - public: - PostfixConfiguration() : - GenericLogModeConfiguration( - QLatin1String( POSTFIX_LOG_MODE_ID ), - QStringList() << QLatin1String( "/var/log/mail.log" ) << QLatin1String( "/var/log/mail.info" ) << QLatin1String( "/var/log/mail.warn" ) << QLatin1String( "/var/log/mail.err" ), - QList() << NOTICE_LOG_LEVEL_ID << INFORMATION_LOG_LEVEL_ID << WARNING_LOG_LEVEL_ID << ERROR_LOG_LEVEL_ID - ) { - - } - - virtual ~PostfixConfiguration() { - - } - -}; - -#endif // _POSTFIX_CONFIGURATION_H_ - diff --git a/ksystemlog/src/modes/postfix/postfixConfigurationWidget.cpp b/ksystemlog/src/modes/postfix/postfixConfigurationWidget.cpp deleted file mode 100644 index a5c7accd..00000000 --- a/ksystemlog/src/modes/postfix/postfixConfigurationWidget.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "postfixConfigurationWidget.h" diff --git a/ksystemlog/src/modes/postfix/postfixConfigurationWidget.h b/ksystemlog/src/modes/postfix/postfixConfigurationWidget.h deleted file mode 100644 index 0eb26122..00000000 --- a/ksystemlog/src/modes/postfix/postfixConfigurationWidget.h +++ /dev/null @@ -1,105 +0,0 @@ -/*************************************************************************** - * 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 _POSTFIX_CONFIGURATION_WIDGET_H_ -#define _POSTFIX_CONFIGURATION_WIDGET_H_ - -#include "logModeConfigurationWidget.h" - -#include - -#include - -#include "globals.h" -#include "logging.h" - -#include "logLevelFileList.h" - -#include "logLevel.h" - -#include "postfixConfiguration.h" - -#include "postfixLogMode.h" - -class PostfixConfigurationWidget : public LogModeConfigurationWidget { - - Q_OBJECT - - public: - PostfixConfigurationWidget() : - LogModeConfigurationWidget(i18n("Postfix Log"),QLatin1String( POSTFIX_MODE_ICON ), i18n("Postfix Log")) - { - - QVBoxLayout* layout = new QVBoxLayout(); - this->setLayout(layout); - - QString description = i18n("

These files will be analyzed to show the Postfix Logs.

"); - - fileList = new LogLevelFileList(this, description); - - connect(fileList, SIGNAL(fileListChanged()), this, SIGNAL(configurationChanged())); - - layout->addWidget(fileList); - - } - - virtual ~PostfixConfigurationWidget() { - - } - - bool isValid() const { - if (fileList->isEmpty() == false) { - logDebug() << "Postfix configuration valid"; - return true; - } - - logDebug() << "Postfix configuration not valid"; - return false; - } - - void saveConfig() { - logDebug() << "Saving config from Postfix Options..."; - - PostfixConfiguration* configuration = Globals::instance()->findLogMode(QLatin1String( POSTFIX_LOG_MODE_ID ))->logModeConfiguration(); - configuration->setLogFilesPaths(fileList->paths()); - configuration->setLogFilesLevels(fileList->levels()); - } - - void readConfig() { - PostfixConfiguration* configuration = Globals::instance()->findLogMode(QLatin1String( POSTFIX_LOG_MODE_ID ))->logModeConfiguration(); - - fileList->removeAllItems(); - - fileList->addPaths(configuration->logFilesPaths(), configuration->logFilesLevels()); - } - - void defaultConfig() { - //TODO Find a way to read the configuration per default - readConfig(); - } - - private: - - LogLevelFileList* fileList; - -}; - -#endif // _POSTFIX_CONFIGURATION_WIDGET_H_ diff --git a/ksystemlog/src/modes/postfix/postfixFactory.cpp b/ksystemlog/src/modes/postfix/postfixFactory.cpp deleted file mode 100644 index d2329183..00000000 --- a/ksystemlog/src/modes/postfix/postfixFactory.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************** - * 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 "postfixFactory.h" - -#include - - -#include "logMode.h" -#include "logging.h" - -#include "simpleAction.h" -#include "postfixLogMode.h" - -#include "logModeFactory.h" - -QList PostfixLogModeFactory::createLogModes() const { - QList logModes; - logModes.append(new PostfixLogMode()); - return logModes; -} - -LogModeAction* PostfixLogModeFactory::createLogModeAction() const { - LogMode* logMode = Globals::instance()->findLogMode(QLatin1String( POSTFIX_LOG_MODE_ID )); - SimpleAction* logModeAction = new SimpleAction(logMode->action(), logMode); - - logModeAction->setInToolBar(false); - logModeAction->setCategory(LogModeAction::ServicesCategory); - - return logModeAction; -} diff --git a/ksystemlog/src/modes/postfix/postfixFactory.h b/ksystemlog/src/modes/postfix/postfixFactory.h deleted file mode 100644 index 57493104..00000000 --- a/ksystemlog/src/modes/postfix/postfixFactory.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * 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 _POSTFIX_FACTORY_H_ -#define _POSTFIX_FACTORY_H_ - -#include - -#include "logModeFactory.h" - -class LogModeAction; -class LogMode; - -class PostfixLogModeFactory : public LogModeFactory { - - Q_OBJECT - - public: - - QList createLogModes() const; - - LogModeAction* createLogModeAction() const; - -}; - -#endif // _POSTFIX_FACTORY_H_ - diff --git a/ksystemlog/src/modes/postfix/postfixLogMode.cpp b/ksystemlog/src/modes/postfix/postfixLogMode.cpp deleted file mode 100644 index 17fdc3eb..00000000 --- a/ksystemlog/src/modes/postfix/postfixLogMode.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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 "postfixLogMode.h" - -#include - -#include -#include - -#include "logging.h" -#include "logMode.h" - -#include "postfixAnalyzer.h" -#include "postfixConfigurationWidget.h" -#include "postfixConfiguration.h" - -#include "logModeItemBuilder.h" - -PostfixLogMode::PostfixLogMode() : - LogMode(QLatin1String( POSTFIX_LOG_MODE_ID ), i18n("Postfix Log"),QLatin1String( POSTFIX_MODE_ICON )) { - - d->logModeConfiguration = new PostfixConfiguration(); - - d->logModeConfigurationWidget = new PostfixConfigurationWidget(); - - d->itemBuilder = new LogModeItemBuilder(); - - d->action = createDefaultAction(); - d->action->setToolTip(i18n("Display the Postfix log.")); - d->action->setWhatsThis(i18n("Displays the Postfix log in the current tab. Postfix is the most known and used mail server in the Linux world.")); - -} - -PostfixLogMode::~PostfixLogMode() { - -} - -Analyzer* PostfixLogMode::createAnalyzer() { - return new PostfixAnalyzer(this); -} - -QList PostfixLogMode::createLogFiles() { - return logModeConfiguration()->findGenericLogFiles(); -} diff --git a/ksystemlog/src/modes/postfix/postfixLogMode.h b/ksystemlog/src/modes/postfix/postfixLogMode.h deleted file mode 100644 index 8981f368..00000000 --- a/ksystemlog/src/modes/postfix/postfixLogMode.h +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************** - * 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 _POSTFIX_LOG_MODE_H_ -#define _POSTFIX_LOG_MODE_H_ - -/** - * Postfix Log Mode Identifier - */ -#define POSTFIX_LOG_MODE_ID "postfixLogMode" - -/** - * Postfix Log Icon - */ -#define POSTFIX_MODE_ICON "mail-message" - -#include - -#include "logFile.h" -#include "logMode.h" - -class PostfixLogMode : public LogMode { - - Q_OBJECT - -public: - explicit PostfixLogMode(); - - ~PostfixLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _POSTFIX_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/samba/netbiosLogMode.cpp b/ksystemlog/src/modes/samba/netbiosLogMode.cpp deleted file mode 100644 index 8fabf63d..00000000 --- a/ksystemlog/src/modes/samba/netbiosLogMode.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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(SambaConfiguration* sambaConfiguration, SambaConfigurationWidget* sambaConfigurationWidget, SambaItemBuilder* itemBuilder) : - LogMode(QLatin1String( NETBIOS_LOG_MODE_ID ), i18n("Netbios Log"), QLatin1String( 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.")); - -} - -NetbiosLogMode::~NetbiosLogMode() { - -} - -Analyzer* NetbiosLogMode::createAnalyzer() { - return new SambaAnalyzer(this); -} - -QList NetbiosLogMode::createLogFiles() { - SambaConfiguration* sambaConfiguration = logModeConfiguration(); - return sambaConfiguration->findNoModeLogFiles(sambaConfiguration->netbiosPaths()); -} diff --git a/ksystemlog/src/modes/samba/netbiosLogMode.h b/ksystemlog/src/modes/samba/netbiosLogMode.h deleted file mode 100644 index af3f6cf5..00000000 --- a/ksystemlog/src/modes/samba/netbiosLogMode.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * 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 _NETBIOS_LOG_MODE_H_ -#define _NETBIOS_LOG_MODE_H_ - -/** - * Netbios Log Mode Identifier - */ -#define NETBIOS_LOG_MODE_ID "netbiosLogMode" - -/** - * Netbios Log Icon - */ -#define NETBIOS_MODE_ICON "folder-remote" - - -#include - -#include "logFile.h" - -#include "logMode.h" - -class SambaConfiguration; -class SambaConfigurationWidget; -class SambaItemBuilder; - -class NetbiosLogMode : public LogMode { - - Q_OBJECT - -public: - explicit NetbiosLogMode(SambaConfiguration* sambaConfiguration, SambaConfigurationWidget* sambaConfigurationWidget, SambaItemBuilder* itemBuilder); - - ~NetbiosLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _NETBIOS_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/samba/sambaAccessLogMode.cpp b/ksystemlog/src/modes/samba/sambaAccessLogMode.cpp deleted file mode 100644 index ba6f4a5b..00000000 --- a/ksystemlog/src/modes/samba/sambaAccessLogMode.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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(SambaConfiguration* sambaConfiguration, SambaConfigurationWidget* sambaConfigurationWidget, SambaItemBuilder* itemBuilder) : - LogMode(QLatin1String( SAMBA_ACCESS_LOG_MODE_ID ), i18n("Samba Access Log"),QLatin1String( 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.")); - -} - -SambaAccessLogMode::~SambaAccessLogMode() { - -} - -Analyzer* SambaAccessLogMode::createAnalyzer() { - return new SambaAnalyzer(this); -} - -QList SambaAccessLogMode::createLogFiles() { - SambaConfiguration* sambaConfiguration = logModeConfiguration(); - return sambaConfiguration->findNoModeLogFiles(sambaConfiguration->sambaAccessPaths()); -} diff --git a/ksystemlog/src/modes/samba/sambaAccessLogMode.h b/ksystemlog/src/modes/samba/sambaAccessLogMode.h deleted file mode 100644 index 16cee319..00000000 --- a/ksystemlog/src/modes/samba/sambaAccessLogMode.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * 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 _SAMBA_ACCESS_LOG_MODE_H_ -#define _SAMBA_ACCESS_LOG_MODE_H_ - -/** - * Samba Access Log Mode Identifier - */ -#define SAMBA_ACCESS_LOG_MODE_ID "sambaAccessLogMode" - -/** - * Samba Access Log Icon - */ -#define SAMBA_ACCESS_MODE_ICON "network-workgroup" - - -#include - -#include "logFile.h" - -#include "logMode.h" - -class SambaConfiguration; -class SambaConfigurationWidget; -class SambaItemBuilder; - -class SambaAccessLogMode : public LogMode { - - Q_OBJECT - -public: - explicit SambaAccessLogMode(SambaConfiguration* sambaConfiguration, SambaConfigurationWidget* sambaConfigurationWidget, SambaItemBuilder* itemBuilder); - - ~SambaAccessLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _SAMBA_ACCESS_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/samba/sambaAnalyzer.cpp b/ksystemlog/src/modes/samba/sambaAnalyzer.cpp deleted file mode 100644 index 59bcaa46..00000000 --- a/ksystemlog/src/modes/samba/sambaAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "sambaAnalyzer.h" diff --git a/ksystemlog/src/modes/samba/sambaAnalyzer.h b/ksystemlog/src/modes/samba/sambaAnalyzer.h deleted file mode 100644 index 12957174..00000000 --- a/ksystemlog/src/modes/samba/sambaAnalyzer.h +++ /dev/null @@ -1,189 +0,0 @@ -/*************************************************************************** - * 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 _SAMBA_ANALYZER_H_ -#define _SAMBA_ANALYZER_H_ - - -#include - -#include "analyzer.h" - -#include "logging.h" - -#include "localLogFileReader.h" -#include "sambaLogMode.h" -#include "parsingHelper.h" - -class SambaAnalyzer : public Analyzer { - - Q_OBJECT - - public: - explicit SambaAnalyzer(LogMode* logMode) : - Analyzer(logMode) { - - currentLogLine = NULL; - } - - virtual ~SambaAnalyzer() { - - } - - LogViewColumns initColumns() { - LogViewColumns columns; - - columns.addColumn(LogViewColumn(i18n("Date"), true, false)); - columns.addColumn(LogViewColumn(i18n("Source File"), true, true)); - columns.addColumn(LogViewColumn(i18n("Function"), true, true)); - columns.addColumn(LogViewColumn(i18n("Line"), true, true)); - columns.addColumn(LogViewColumn(i18n("Message"), true, false)); - - return columns; - } - - - - protected: - LogFileReader* createLogFileReader(const LogFile& logFile) { - return new LocalLogFileReader(logFile); - } - - Analyzer::LogFileSortMode logFileSortMode() { - return Analyzer::AscendingSortedLogFile; - } - - - /* - * Log line examples : - * [2005/06/27 21:06:01, 0] nmbd/nmbd.c:main(668) - * Netbios nameserver version 3.0.14a started. - * Copyright Andrew Tridgell and the Samba Team 1994-2004 - * [2005/06/27 21:11:46, 0] nmbd/nmbd_become_lmb.c:become_local_master_stage2(396) - * ***** - * Samba name server STEAKHACHE is now a local master browser for workgroup MAISON on subnet 192.168.1.33 - * - * ***** - * [2005/06/28 06:41:03, 0] nmbd/nmbd.c:terminate(56) - * Got SIGTERM: going down... - * [2005/06/28 18:08:11, 0] nmbd/nmbd.c:main(668) - * Netbios nameserver version 3.0.14a started. - * Copyright Andrew Tridgell and the Samba Team 1994-2004 - * - * Note: - * This analyzer nevers return the last line of a log file because it's never sure - * that the last file line is the last message of the current log line. - * So the previous last line will be returned at the next file update, - */ - LogLine* parseMessage(const QString& logLine, const LogFile& originalLogFile) { - QString line(logLine); - - - //The Date - int dateBegin=line.indexOf(QLatin1String( "[" )); - int dateEnd=line.indexOf(QLatin1String( "]" )); - - if (dateBegin != -1) { - - QString strDate=line.mid(dateBegin+1, dateEnd-dateBegin-1); - - QString year=strDate.mid(0, 4); - QString month=strDate.mid(5, 2); - QString day=strDate.mid(8, 2); - - QString hour=strDate.mid(11, 2); - QString min=strDate.mid(14, 2); - QString sec=strDate.mid(17, 2); - - QDate date=QDate(year.toInt(), month.toInt(), day.toInt()); - QTime time=QTime(hour.toInt(), min.toInt(), sec.toInt()); - - line=line.remove(0, dateEnd+2); - - - //The source file - int doubleDot; - doubleDot=line.indexOf(QLatin1String( ":" )); - QString file=line.left(doubleDot); - line=line.remove(0, doubleDot+1); - - //The function - int bracket=line.indexOf(QLatin1String( "(" )); - QString function=line.left(bracket); - line=line.remove(0, bracket+1); - - //The line number - bracket=line.indexOf(QLatin1String( ")" )); - QString lineNumber=line.left(bracket); - - //Remove the first return character and the two useless space of the first message line - line=line.remove(0, bracket+4); - - QStringList list; - list.append(file); - list.append(function); - list.append(lineNumber); - - logDebug() << "Creating new line "; - - LogLine* returnedLogLine = currentLogLine; - - currentLogLine = new LogLine( - logLineInternalIdGenerator++, - QDateTime(date, time), - list, - originalLogFile.url().path(), - Globals::instance()->informationLogLevel(), - logMode - ); - - return returnedLogLine; - } - - if (line.indexOf(QLatin1String( " " )) != -1) { - if (currentLogLine != NULL) { - - QStringList list = currentLogLine->logItems(); - - - //A line has already been added - if (list.count() == 4) { - QString currentMessage = list.takeLast(); - list.append(currentMessage + QLatin1String( "\n" ) + line.simplified()); - } - //First time we add a line for the current Log line - else { - list.append(line.simplified()); - } - - currentLogLine->setLogItems(list); - - } - } - - return NULL; - } - - LogLine* currentLogLine; - -}; - -#endif // _SAMBA_ANALYZER_H_ diff --git a/ksystemlog/src/modes/samba/sambaConfiguration.cpp b/ksystemlog/src/modes/samba/sambaConfiguration.cpp deleted file mode 100644 index 93621323..00000000 --- a/ksystemlog/src/modes/samba/sambaConfiguration.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "sambaConfiguration.h" diff --git a/ksystemlog/src/modes/samba/sambaConfiguration.h b/ksystemlog/src/modes/samba/sambaConfiguration.h deleted file mode 100644 index ed2f91ed..00000000 --- a/ksystemlog/src/modes/samba/sambaConfiguration.h +++ /dev/null @@ -1,101 +0,0 @@ -/*************************************************************************** - * 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 _SAMBA_CONFIGURATION_H_ -#define _SAMBA_CONFIGURATION_H_ - -#include - -#include "logModeConfiguration.h" - -#include "logging.h" -#include "defaults.h" - -#include "sambaLogMode.h" - -#include "ksystemlogConfig.h" - -class SambaConfigurationPrivate { -public: - QStringList sambaPaths; - - QStringList sambaAccessPaths; - - QStringList netbiosPaths; -}; - -class SambaConfiguration : public LogModeConfiguration { - - Q_OBJECT - - public: - SambaConfiguration() : - d(new SambaConfigurationPrivate()) { - - configuration->setCurrentGroup(QLatin1String( "SambaLogMode" )); - - QStringList defaultSambaPaths; - defaultSambaPaths << QLatin1String( "/var/log/samba/log.smbd" ); - configuration->addItemStringList(QLatin1String( "SambaLogFilesPaths" ), d->sambaPaths, defaultSambaPaths, QLatin1String( "SambaLogFilesPaths" )); - - QStringList defaultSambaAccessPaths; - defaultSambaAccessPaths << QLatin1String( "/var/log/samba/log.localhost" ) << QLatin1String( "/var/log/samba/log.127.0.0.1" ); - configuration->addItemStringList(QLatin1String( "SambaAccessLogFilesPaths" ), d->sambaAccessPaths, defaultSambaAccessPaths, QLatin1String( "SambaAccessLogFilesPaths" )); - - QStringList defaultNetbiosPaths; - defaultNetbiosPaths << QLatin1String( "/var/log/samba/log.nmbd" ); - configuration->addItemStringList(QLatin1String( "NetbiosLogFilesPaths" ), d->netbiosPaths, defaultNetbiosPaths, QLatin1String( "NetbiosLogFilesPaths" )); - } - - virtual ~SambaConfiguration() { - delete d; - } - - QStringList sambaPaths() const { - return d->sambaPaths; - } - - QStringList sambaAccessPaths() const { - return d->sambaAccessPaths; - } - - QStringList netbiosPaths() const { - return d->netbiosPaths; - } - - void setSambaPaths(const QStringList& sambaPaths) { - d->sambaPaths = sambaPaths; - } - - void setNetbiosPaths(const QStringList& netbiosPaths) { - d->netbiosPaths = netbiosPaths; - } - - void setSambaAccessPaths(const QStringList& sambaAccessPaths) { - d->sambaAccessPaths = sambaAccessPaths; - } - - private: - SambaConfigurationPrivate* const d; - -}; - -#endif // _SAMBA_CONFIGURATION_H_ diff --git a/ksystemlog/src/modes/samba/sambaConfigurationWidget.cpp b/ksystemlog/src/modes/samba/sambaConfigurationWidget.cpp deleted file mode 100644 index f041c095..00000000 --- a/ksystemlog/src/modes/samba/sambaConfigurationWidget.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * KApacheLog, a apache 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 "sambaConfigurationWidget.h" diff --git a/ksystemlog/src/modes/samba/sambaConfigurationWidget.h b/ksystemlog/src/modes/samba/sambaConfigurationWidget.h deleted file mode 100644 index c4bc20d2..00000000 --- a/ksystemlog/src/modes/samba/sambaConfigurationWidget.h +++ /dev/null @@ -1,115 +0,0 @@ -/*************************************************************************** - * 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 _SAMBA_CONFIGURATION_WIDGET_H_ -#define _SAMBA_CONFIGURATION_WIDGET_H_ - -#include "logModeConfigurationWidget.h" - - -#include - -#include "globals.h" -#include "logging.h" -#include "multipleFileList.h" - -#include "logLevel.h" - -#include "sambaConfiguration.h" -#include "sambaLogMode.h" - -class SambaConfigurationWidget : public LogModeConfigurationWidget { - - Q_OBJECT - - public: - SambaConfigurationWidget() : - LogModeConfigurationWidget(i18n("Samba Log"),QLatin1String( SAMBA_MODE_ICON ), i18n("Samba Log")) - { - - QHBoxLayout* layout = new QHBoxLayout(); - this->setLayout(layout); - - sambaFileList=new MultipleFileList(this, i18n("

These files will be analyzed to show Samba log, Samba Access log and Netbios log.

")); - - sambaPathsId = sambaFileList->addCategory(i18n("Samba Log Files"), i18n("Add Samba File...")); - sambaAccessPathsId = sambaFileList->addCategory(i18n("Samba Access Log Files"), i18n("Add Samba Access File...")); - netbiosPathsId = sambaFileList->addCategory(i18n("Netbios Log Files"), i18n("Add Netbios File...")); - - connect(sambaFileList, SIGNAL(fileListChanged()), this, SIGNAL(configurationChanged())); - - layout->addWidget(sambaFileList); - } - - ~SambaConfigurationWidget() { - - } - - - public slots: - - void saveConfig() { - logDebug() << "Saving config from Samba Options..."; - - SambaConfiguration* sambaConfiguration = Globals::instance()->findLogMode(QLatin1String( SAMBA_LOG_MODE_ID ))->logModeConfiguration(); - sambaConfiguration->setSambaPaths(sambaFileList->paths(sambaPathsId)); - sambaConfiguration->setSambaAccessPaths(sambaFileList->paths(sambaAccessPathsId)); - sambaConfiguration->setNetbiosPaths(sambaFileList->paths(netbiosPathsId)); - } - - void defaultConfig() { - //TODO Find a way to read the configuration per default - readConfig(); - } - - void readConfig() { - SambaConfiguration* sambaConfiguration = Globals::instance()->findLogMode(QLatin1String( SAMBA_LOG_MODE_ID ))->logModeConfiguration(); - - sambaFileList->removeAllItems(); - - sambaFileList->addPaths(sambaPathsId, sambaConfiguration->sambaPaths()); - sambaFileList->addPaths(sambaAccessPathsId, sambaConfiguration->sambaAccessPaths()); - sambaFileList->addPaths(netbiosPathsId, sambaConfiguration->netbiosPaths()); - } - - protected: - bool isValid() const { - if (sambaFileList->isOneOfCategoryEmpty()==true) { - logDebug() << "Samba configuration not valid"; - return false; - } - - logDebug() << "Samba configuration valid"; - return true; - - } - - private: - - MultipleFileList* sambaFileList; - - int sambaPathsId; - int sambaAccessPathsId; - int netbiosPathsId; - -}; - -#endif // _SAMBA_CONFIGURATION_WIDGET_H_ diff --git a/ksystemlog/src/modes/samba/sambaFactory.cpp b/ksystemlog/src/modes/samba/sambaFactory.cpp deleted file mode 100644 index f7908d19..00000000 --- a/ksystemlog/src/modes/samba/sambaFactory.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - * KSambaLog, a samba 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 "sambaFactory.h" - - -#include - -#include "multipleActions.h" -#include "logMode.h" -#include "logging.h" - -#include "sambaLogMode.h" -#include "sambaAccessLogMode.h" -#include "netbiosLogMode.h" - -#include "sambaConfigurationWidget.h" -#include "sambaConfiguration.h" -#include "sambaItemBuilder.h" - -QList SambaLogModeFactory::createLogModes() const { - - //Create the shared configuration and configuration widget between the logModes - - SambaConfiguration* logModeConfiguration = new SambaConfiguration(); - SambaConfigurationWidget* logModeConfigurationWidget = new SambaConfigurationWidget(); - SambaItemBuilder* itemBuilder = new SambaItemBuilder(); - - QList logModes; - logModes.append(new SambaLogMode(logModeConfiguration, logModeConfigurationWidget, itemBuilder)); - logModes.append(new SambaAccessLogMode(logModeConfiguration, logModeConfigurationWidget, itemBuilder)); - logModes.append(new NetbiosLogMode(logModeConfiguration, logModeConfigurationWidget, itemBuilder)); - - return logModes; -} - -LogModeAction* SambaLogModeFactory::createLogModeAction() const { - LogMode* sambaLogMode = Globals::instance()->findLogMode(QLatin1String( SAMBA_LOG_MODE_ID )); - - MultipleActions* multipleActions = new MultipleActions(KIcon( QLatin1String( SAMBA_MODE_ICON) ), i18n("Samba"), sambaLogMode); - multipleActions->addInnerAction(sambaLogMode->action()); - multipleActions->addInnerAction(Globals::instance()->findLogMode(QLatin1String( SAMBA_ACCESS_LOG_MODE_ID ))->action()); - multipleActions->addInnerAction(Globals::instance()->findLogMode(QLatin1String( NETBIOS_LOG_MODE_ID ))->action()); - - multipleActions->setInToolBar(false); - multipleActions->setCategory(LogModeAction::ServicesCategory); - - return multipleActions; -} diff --git a/ksystemlog/src/modes/samba/sambaFactory.h b/ksystemlog/src/modes/samba/sambaFactory.h deleted file mode 100644 index ab140b45..00000000 --- a/ksystemlog/src/modes/samba/sambaFactory.h +++ /dev/null @@ -1,41 +0,0 @@ -/*************************************************************************** - * 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 _SAMBA_LOG_MODE_FACTORY_H_ -#define _SAMBA_LOG_MODE_FACTORY_H_ - -#include - -#include "logModeFactory.h" - -class SambaLogModeFactory : public LogModeFactory { - - Q_OBJECT - - public: - - QList createLogModes() const; - - LogModeAction* createLogModeAction() const; -}; - -#endif // _SAMBA_LOG_MODE_FACTORY_H_ - diff --git a/ksystemlog/src/modes/samba/sambaItemBuilder.cpp b/ksystemlog/src/modes/samba/sambaItemBuilder.cpp deleted file mode 100644 index e0b218db..00000000 --- a/ksystemlog/src/modes/samba/sambaItemBuilder.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "sambaItemBuilder.h" diff --git a/ksystemlog/src/modes/samba/sambaItemBuilder.h b/ksystemlog/src/modes/samba/sambaItemBuilder.h deleted file mode 100644 index 7410e5b7..00000000 --- a/ksystemlog/src/modes/samba/sambaItemBuilder.h +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************** - * 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 _SAMBA_ITEM_BUILDER_H_ -#define _SAMBA_ITEM_BUILDER_H_ - -#include - -#include "logModeItemBuilder.h" - -#include - -#include "logging.h" - -#include "logLine.h" -#include "logViewWidgetItem.h" -#include "logMode.h" - -class SambaItemBuilder : public LogModeItemBuilder { - - public: - SambaItemBuilder() { - - } - - virtual ~SambaItemBuilder() { - - } - - QString createFormattedText(LogLine* line) const { - QString result; - - QListIterator it(line->logItems()); - - result.append(QLatin1String( "" )); - - result.append(labelMessageFormat(i18n("Date:"), formatDate(line->time()))); - result.append(labelMessageFormat(i18n("Level:"), line->logLevel()->name())); - result.append(labelMessageFormat(i18n("Source File:"), it.next() )); - result.append(labelMessageFormat(i18n("Function:"), it.next() )); - result.append(labelMessageFormat(i18n("Line:"), it.next() )); - - result.append(QLatin1String( "
" )); - - return result; - - } -}; - - -#endif // _SAMBA_ITEM_BUILDER_H_ diff --git a/ksystemlog/src/modes/samba/sambaLogMode.cpp b/ksystemlog/src/modes/samba/sambaLogMode.cpp deleted file mode 100644 index 950c0697..00000000 --- a/ksystemlog/src/modes/samba/sambaLogMode.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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(SambaConfiguration* sambaConfiguration, SambaConfigurationWidget* sambaConfigurationWidget, SambaItemBuilder* itemBuilder) : - LogMode(QLatin1String( SAMBA_LOG_MODE_ID ), i18n("Samba Log"),QLatin1String( 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.")); - -} - -SambaLogMode::~SambaLogMode() { - -} - -Analyzer* SambaLogMode::createAnalyzer() { - return new SambaAnalyzer(this); -} - -QList SambaLogMode::createLogFiles() { - SambaConfiguration* sambaConfiguration = logModeConfiguration(); - return sambaConfiguration->findNoModeLogFiles(sambaConfiguration->sambaPaths()); -} diff --git a/ksystemlog/src/modes/samba/sambaLogMode.h b/ksystemlog/src/modes/samba/sambaLogMode.h deleted file mode 100644 index 35bfabe7..00000000 --- a/ksystemlog/src/modes/samba/sambaLogMode.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * 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 _SAMBA_LOG_MODE_H_ -#define _SAMBA_LOG_MODE_H_ - -/** - * Samba Log Mode Identifier - */ -#define SAMBA_LOG_MODE_ID "sambaLogMode" - -/** - * Samba Log Icon - */ -#define SAMBA_MODE_ICON "folder-remote" - - -#include - -#include "logFile.h" - -#include "logMode.h" - -class SambaConfiguration; -class SambaConfigurationWidget; -class SambaItemBuilder; - -class SambaLogMode : public LogMode { - - Q_OBJECT - -public: - explicit SambaLogMode(SambaConfiguration* sambaConfiguration, SambaConfigurationWidget* sambaConfigurationWidget, SambaItemBuilder* itemBuilder); - - ~SambaLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _SAMBA_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/system/systemAnalyzer.cpp b/ksystemlog/src/modes/system/systemAnalyzer.cpp deleted file mode 100644 index 44561694..00000000 --- a/ksystemlog/src/modes/system/systemAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "systemAnalyzer.h" diff --git a/ksystemlog/src/modes/system/systemAnalyzer.h b/ksystemlog/src/modes/system/systemAnalyzer.h deleted file mode 100644 index 3e5a4365..00000000 --- a/ksystemlog/src/modes/system/systemAnalyzer.h +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * 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 _SYSTEM_ANALYZER_H_ -#define _SYSTEM_ANALYZER_H_ - -#include - -#include "syslogAnalyzer.h" - -#include "systemLogMode.h" - -class SystemAnalyzer : public SyslogAnalyzer { - - Q_OBJECT - - public: - - SystemAnalyzer(LogMode* logMode) : - SyslogAnalyzer(logMode) { - - } - - virtual ~SystemAnalyzer() { - - } - -}; - -#endif diff --git a/ksystemlog/src/modes/system/systemConfiguration.cpp b/ksystemlog/src/modes/system/systemConfiguration.cpp deleted file mode 100644 index ef2fe02a..00000000 --- a/ksystemlog/src/modes/system/systemConfiguration.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "systemConfiguration.h" diff --git a/ksystemlog/src/modes/system/systemConfiguration.h b/ksystemlog/src/modes/system/systemConfiguration.h deleted file mode 100644 index 67260e92..00000000 --- a/ksystemlog/src/modes/system/systemConfiguration.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * 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 _SYSTEM_CONFIGURATION_H_ -#define _SYSTEM_CONFIGURATION_H_ - -#include -#include - -#include "genericConfiguration.h" -#include "globals.h" -#include "defaults.h" - -#include "systemLogMode.h" - -class SystemConfiguration : public GenericLogModeConfiguration { - - Q_OBJECT - - public: - SystemConfiguration() : - GenericLogModeConfiguration( - QLatin1String( SYSTEM_LOG_MODE_ID ), - QStringList() << QLatin1String( "/var/log/syslog" ), - QList() << INFORMATION_LOG_LEVEL_ID - ) { - - /* - /var/log/messages,/var/log/syslog,/var/log/debug - 2,2,1 - */ - - } - - virtual ~SystemConfiguration() { - - } - -}; - -#endif // _SYSTEM_CONFIGURATION_H_ - diff --git a/ksystemlog/src/modes/system/systemConfigurationWidget.cpp b/ksystemlog/src/modes/system/systemConfigurationWidget.cpp deleted file mode 100644 index 18e77a87..00000000 --- a/ksystemlog/src/modes/system/systemConfigurationWidget.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "systemConfigurationWidget.h" diff --git a/ksystemlog/src/modes/system/systemConfigurationWidget.h b/ksystemlog/src/modes/system/systemConfigurationWidget.h deleted file mode 100644 index 7102c2d9..00000000 --- a/ksystemlog/src/modes/system/systemConfigurationWidget.h +++ /dev/null @@ -1,105 +0,0 @@ -/*************************************************************************** - * 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 _SYSTEM_CONFIGURATION_WIDGET_H_ -#define _SYSTEM_CONFIGURATION_WIDGET_H_ - -#include "logModeConfigurationWidget.h" - -#include - -#include - -#include "globals.h" -#include "logging.h" - -#include "logLevelFileList.h" - -#include "logLevel.h" - -#include "systemConfiguration.h" - -#include "systemLogMode.h" - -class SystemConfigurationWidget : public LogModeConfigurationWidget { - - Q_OBJECT - - public: - SystemConfigurationWidget() : - LogModeConfigurationWidget(i18n("System Log"),QLatin1String( SYSTEM_MODE_ICON ), i18n("System Log")) - { - - QVBoxLayout* layout = new QVBoxLayout(); - this->setLayout(layout); - - QString description = i18n("

These files will be analyzed to show the System logs.

"); - - fileList = new LogLevelFileList(this, description); - - connect(fileList, SIGNAL(fileListChanged()), this, SIGNAL(configurationChanged())); - - layout->addWidget(fileList); - - } - - virtual ~SystemConfigurationWidget() { - - } - - bool isValid() const { - if (fileList->isEmpty() == false) { - logDebug() << "System configuration valid"; - return true; - } - - logDebug() << "System configuration not valid"; - return false; - } - - void saveConfig() { - logDebug() << "Saving config from System Options..."; - - SystemConfiguration* systemConfiguration = Globals::instance()->findLogMode(QLatin1String( SYSTEM_LOG_MODE_ID ))->logModeConfiguration(); - systemConfiguration->setLogFilesPaths(fileList->paths()); - systemConfiguration->setLogFilesLevels(fileList->levels()); - } - - void readConfig() { - SystemConfiguration* systemConfiguration = Globals::instance()->findLogMode(QLatin1String( SYSTEM_LOG_MODE_ID ))->logModeConfiguration(); - - fileList->removeAllItems(); - - fileList->addPaths(systemConfiguration->logFilesPaths(), systemConfiguration->logFilesLevels()); - } - - void defaultConfig() { - //TODO Find a way to read the configuration per default - readConfig(); - } - - private: - - LogLevelFileList* fileList; - -}; - -#endif // _SYSTEM_CONFIGURATION_WIDGET_H_ diff --git a/ksystemlog/src/modes/system/systemFactory.cpp b/ksystemlog/src/modes/system/systemFactory.cpp deleted file mode 100644 index 80259e30..00000000 --- a/ksystemlog/src/modes/system/systemFactory.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************** - * 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 "systemFactory.h" - -#include - - -#include "logMode.h" -#include "logging.h" - -#include "simpleAction.h" -#include "systemLogMode.h" - -#include "logModeFactory.h" - -QList SystemLogModeFactory::createLogModes() const { - QList logModes; - logModes.append(new SystemLogMode()); - return logModes; -} - -LogModeAction* SystemLogModeFactory::createLogModeAction() const { - LogMode* logMode = Globals::instance()->findLogMode(QLatin1String( SYSTEM_LOG_MODE_ID )); - return new SimpleAction(logMode->action(), logMode); -} diff --git a/ksystemlog/src/modes/system/systemFactory.h b/ksystemlog/src/modes/system/systemFactory.h deleted file mode 100644 index 06b2fc97..00000000 --- a/ksystemlog/src/modes/system/systemFactory.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * 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 _SYSTEM_FACTORY_H_ -#define _SYSTEM_FACTORY_H_ - -#include - -#include "logModeFactory.h" - -class LogModeAction; -class LogMode; - -class SystemLogModeFactory : public LogModeFactory { - - Q_OBJECT - - public: - - QList createLogModes() const; - - LogModeAction* createLogModeAction() const; - -}; - -#endif // _SYSTEM_FACTORY_H_ - diff --git a/ksystemlog/src/modes/system/systemLogMode.cpp b/ksystemlog/src/modes/system/systemLogMode.cpp deleted file mode 100644 index b7cc636a..00000000 --- a/ksystemlog/src/modes/system/systemLogMode.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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 "systemLogMode.h" - -#include - -#include -#include - -#include "logging.h" -#include "logMode.h" - -#include "systemAnalyzer.h" -#include "systemConfigurationWidget.h" -#include "systemConfiguration.h" - -#include "logModeItemBuilder.h" - -SystemLogMode::SystemLogMode() : - LogMode(QLatin1String( SYSTEM_LOG_MODE_ID ), i18n("System Log"),QLatin1String( SYSTEM_MODE_ICON )) { - - d->logModeConfiguration = new SystemConfiguration(); - - d->logModeConfigurationWidget = new SystemConfigurationWidget(); - - d->itemBuilder = new LogModeItemBuilder(); - - d->action = createDefaultAction(); - d->action->setToolTip(i18n("Display the system log.")); - d->action->setWhatsThis(i18n("Displays the system log in the current tab. This log is generally used by non-specialized processes (like \"sudo\" or \"fsck\" commands)")); - -} - -SystemLogMode::~SystemLogMode() { - -} - -Analyzer* SystemLogMode::createAnalyzer() { - return new SystemAnalyzer(this); -} - -QList SystemLogMode::createLogFiles() { - return logModeConfiguration()->findGenericLogFiles(); -} diff --git a/ksystemlog/src/modes/system/systemLogMode.h b/ksystemlog/src/modes/system/systemLogMode.h deleted file mode 100644 index c183040e..00000000 --- a/ksystemlog/src/modes/system/systemLogMode.h +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************** - * 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 _SYSTEM_LOG_MODE_H_ -#define _SYSTEM_LOG_MODE_H_ - -/** - * System Log Mode Identifier - */ -#define SYSTEM_LOG_MODE_ID "systemLogMode" - -/** - * System Log Icon - */ -#define SYSTEM_MODE_ICON "computer" - -#include - -#include "logFile.h" -#include "logMode.h" - -class SystemLogMode : public LogMode { - - Q_OBJECT - -public: - explicit SystemLogMode(); - - ~SystemLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _SYSTEM_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/xorg/xorgAnalyzer.cpp b/ksystemlog/src/modes/xorg/xorgAnalyzer.cpp deleted file mode 100644 index 662fb075..00000000 --- a/ksystemlog/src/modes/xorg/xorgAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "xorgAnalyzer.h" diff --git a/ksystemlog/src/modes/xorg/xorgAnalyzer.h b/ksystemlog/src/modes/xorg/xorgAnalyzer.h deleted file mode 100644 index 72c2bc79..00000000 --- a/ksystemlog/src/modes/xorg/xorgAnalyzer.h +++ /dev/null @@ -1,144 +0,0 @@ -/*************************************************************************** - * 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 _XORG_ANALYZER_H_ -#define _XORG_ANALYZER_H_ - -#include - -#include "analyzer.h" - -#include "localLogFileReader.h" -#include "parsingHelper.h" -#include "xorgLogMode.h" - - -#define CONFIG_FILE_LOG_LEVEL_ICON "configure" -#define DEFAULT_SETTING_LOG_LEVEL_ICON "configure-toolbars" -#define COMMAND_LINE_LOG_LEVEL_ICON "konsole" -#define PROBED_LOG_LEVEL_ICON "favorites" -#define NOT_IMPLEMENTED_LOG_LEVEL_ICON "document-new" - -class XorgAnalyzer : public Analyzer { - Q_OBJECT - - public: - XorgAnalyzer(LogMode* logMode) : - Analyzer(logMode), - currentDateTime(QDateTime::currentDateTime()) - { - - initializeTypeName(); - } - - virtual ~XorgAnalyzer() { - - } - - LogViewColumns initColumns() { - LogViewColumns columns; - - columns.addColumn(LogViewColumn(i18n("Line"), false, false)); - columns.addColumn(LogViewColumn(i18n("Type"), false, false)); - columns.addColumn(LogViewColumn(i18n("Message"), false, false)); - - columns.setGroupByDay(false); - columns.setGroupByHour(false); - - return columns; - } - - - protected: - LogFileReader* createLogFileReader(const LogFile& logFile) { - return new LocalLogFileReader(logFile); - } - - Analyzer::LogFileSortMode logFileSortMode() { - return Analyzer::AscendingSortedLogFile; - } - - LogLine* parseMessage(const QString& logLine, const LogFile& originalFile) { - - QString string(logLine); - - QString type; - - type=string.left(4); - - LogLevel* logLineType=findTypeName(type); - - //If the type is not empty, the log message has a type, so we can delete it - if (logLineType!=NULL) { - string=string.remove(0, 5); - } - else { - logLineType=Globals::instance()->informationLogLevel(); - } - - QStringList list; - list.append(logLineType->name()); - list.append(string); - - return new LogLine( - logLineInternalIdGenerator++, - currentDateTime, - list, - originalFile.url().path(), - logLineType, - logMode - ); - } - - private: - - QMap xorgLevels; - - void initializeTypeName() { - xorgLevels[QLatin1String( "(--)" )]=new LogLevel(1001, i18n("Probed"),QLatin1String( PROBED_LOG_LEVEL_ICON ), QColor(246, 206, 30)); - xorgLevels[QLatin1String( "(**)" )]=new LogLevel(1002, i18n("From config file"),QLatin1String( CONFIG_FILE_LOG_LEVEL_ICON ), QColor(161, 133, 240)); - xorgLevels[QLatin1String( "(==)" )]=new LogLevel(1003, i18n("Default setting"),QLatin1String( DEFAULT_SETTING_LOG_LEVEL_ICON ), QColor(169, 189, 165)); - xorgLevels[QLatin1String( "(++)" )]=new LogLevel(1004, i18n("From command Line"),QLatin1String( COMMAND_LINE_LOG_LEVEL_ICON ), QColor(179, 181, 214)); - xorgLevels[QLatin1String( "(!!)" )]=Globals::instance()->noticeLogLevel(); - xorgLevels[QLatin1String( "(II)" )]=Globals::instance()->informationLogLevel(); - xorgLevels[QLatin1String( "(WW)" )]=Globals::instance()->warningLogLevel(); - xorgLevels[QLatin1String( "(EE)" )]=Globals::instance()->errorLogLevel(); - xorgLevels[QLatin1String( "(NI)" )]=new LogLevel(1005, i18n("Not implemented"),QLatin1String( NOT_IMPLEMENTED_LOG_LEVEL_ICON ), QColor(136, 146, 240)); - xorgLevels[QLatin1String( "(\?\?)" )]=Globals::instance()->noLogLevel(); - - } - - LogLevel* findTypeName(const QString& type) { - QMap::iterator it; - - it=xorgLevels.find(type); - if (it!=xorgLevels.end()) - return *it; - else - return NULL; - - } - - QDateTime currentDateTime; - -}; - -#endif // _XORG_ANALYZER_H_ diff --git a/ksystemlog/src/modes/xorg/xorgConfiguration.cpp b/ksystemlog/src/modes/xorg/xorgConfiguration.cpp deleted file mode 100644 index c81466d0..00000000 --- a/ksystemlog/src/modes/xorg/xorgConfiguration.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "xorgConfiguration.h" diff --git a/ksystemlog/src/modes/xorg/xorgConfiguration.h b/ksystemlog/src/modes/xorg/xorgConfiguration.h deleted file mode 100644 index 11871522..00000000 --- a/ksystemlog/src/modes/xorg/xorgConfiguration.h +++ /dev/null @@ -1,73 +0,0 @@ -/*************************************************************************** - * 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 _XORG_CONFIGURATION_H_ -#define _XORG_CONFIGURATION_H_ - -#include - -#include "logModeConfiguration.h" - -#include "logging.h" -#include "defaults.h" -#include "ksystemlogConfig.h" - -#include "xorgLogMode.h" - -class XorgConfigurationPrivate { -public: - QStringList xorgPaths; -}; - -class XorgConfiguration : public LogModeConfiguration { - - Q_OBJECT - - public: - XorgConfiguration() : - d(new XorgConfigurationPrivate()) { - - configuration->setCurrentGroup(QLatin1String( "XorgLogMode" )); - - QStringList defaultXorgPaths; - defaultXorgPaths << QLatin1String( "/var/log/Xorg.0.log" ); - configuration->addItemStringList(QLatin1String( "LogFilesPaths" ), d->xorgPaths, defaultXorgPaths, QLatin1String( "LogFilesPaths" )); - - } - - virtual ~XorgConfiguration() { - delete d; - } - - QStringList xorgPaths() const { - return d->xorgPaths; - } - - void setXorgPaths(const QStringList& xorgPaths) { - d->xorgPaths = xorgPaths; - } - - private: - XorgConfigurationPrivate* const d; - -}; - -#endif // _XORG_CONFIGURATION_H_ diff --git a/ksystemlog/src/modes/xorg/xorgConfigurationWidget.cpp b/ksystemlog/src/modes/xorg/xorgConfigurationWidget.cpp deleted file mode 100644 index 4d3dd72e..00000000 --- a/ksystemlog/src/modes/xorg/xorgConfigurationWidget.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * KApacheLog, a apache 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 "xorgConfigurationWidget.h" diff --git a/ksystemlog/src/modes/xorg/xorgConfigurationWidget.h b/ksystemlog/src/modes/xorg/xorgConfigurationWidget.h deleted file mode 100644 index 39a89fb1..00000000 --- a/ksystemlog/src/modes/xorg/xorgConfigurationWidget.h +++ /dev/null @@ -1,98 +0,0 @@ -/*************************************************************************** - * 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 _XORG_CONFIGURATION_WIDGET_H_ -#define _XORG_CONFIGURATION_WIDGET_H_ - - -#include - -#include "globals.h" -#include "logging.h" -#include "fileList.h" - -#include "logLevel.h" -#include "logModeConfigurationWidget.h" - -#include "xorgConfiguration.h" -#include "xorgLogMode.h" - -class FileList; - -class XorgConfigurationWidget : public LogModeConfigurationWidget { - - Q_OBJECT - - public: - XorgConfigurationWidget() : - LogModeConfigurationWidget(i18n("X.org Log"),QLatin1String( XORG_MODE_ICON ), i18n("X.org Log")) - { - - QHBoxLayout* layout = new QHBoxLayout(); - this->setLayout(layout); - - fileList=new FileList(this, i18n("

These files will be analyzed to show the X.org log.

")); - connect(fileList, SIGNAL(fileListChanged()), this, SIGNAL(configurationChanged())); - layout->addWidget(fileList); - - } - - ~XorgConfigurationWidget() { - - } - - public slots: - - void saveConfig() { - XorgConfiguration* xorgConfiguration = Globals::instance()->findLogMode(QLatin1String( XORG_LOG_MODE_ID ))->logModeConfiguration(); - - xorgConfiguration->setXorgPaths(fileList->paths()); - } - - void readConfig() { - XorgConfiguration* xorgConfiguration = Globals::instance()->findLogMode(QLatin1String( XORG_LOG_MODE_ID ))->logModeConfiguration(); - - fileList->removeAllItems(); - - fileList->addPaths(xorgConfiguration->xorgPaths()); - } - - void defaultConfig() { - //TODO Find a way to read the configuration per default - readConfig(); - } - - protected: - bool isValid() const { - if (fileList->isEmpty()==false) { - return true; - } - - return false; - - } - - private: - FileList* fileList; - -}; - -#endif // _XORG_CONFIGURATION_WIDGET_H_ diff --git a/ksystemlog/src/modes/xorg/xorgFactory.cpp b/ksystemlog/src/modes/xorg/xorgFactory.cpp deleted file mode 100644 index e4f8fabd..00000000 --- a/ksystemlog/src/modes/xorg/xorgFactory.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************** - * 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 "xorgFactory.h" - -#include - - -#include "logMode.h" -#include "logging.h" - -#include "simpleAction.h" -#include "xorgLogMode.h" - -#include "logModeFactory.h" - -QList XorgLogModeFactory::createLogModes() const { - QList logModes; - logModes.append(new XorgLogMode()); - return logModes; -} - -LogModeAction* XorgLogModeFactory::createLogModeAction() const { - LogMode* logMode = Globals::instance()->findLogMode(QLatin1String( XORG_LOG_MODE_ID )); - SimpleAction* logModeAction = new SimpleAction(logMode->action(), logMode); - logModeAction->setCategory(LogModeAction::ServicesCategory); - - return logModeAction; -} diff --git a/ksystemlog/src/modes/xorg/xorgFactory.h b/ksystemlog/src/modes/xorg/xorgFactory.h deleted file mode 100644 index c6f6daa4..00000000 --- a/ksystemlog/src/modes/xorg/xorgFactory.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * 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 _XORG_FACTORY_H_ -#define _XORG_FACTORY_H_ - -#include - -#include "logModeFactory.h" - -class LogModeAction; -class LogMode; - -class XorgLogModeFactory : public LogModeFactory { - - Q_OBJECT - - public: - - QList createLogModes() const; - - LogModeAction* createLogModeAction() const; - -}; - -#endif // _XORG_FACTORY_H_ - diff --git a/ksystemlog/src/modes/xorg/xorgItemBuilder.cpp b/ksystemlog/src/modes/xorg/xorgItemBuilder.cpp deleted file mode 100644 index 00a20ec3..00000000 --- a/ksystemlog/src/modes/xorg/xorgItemBuilder.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "xorgItemBuilder.h" diff --git a/ksystemlog/src/modes/xorg/xorgItemBuilder.h b/ksystemlog/src/modes/xorg/xorgItemBuilder.h deleted file mode 100644 index db62d52f..00000000 --- a/ksystemlog/src/modes/xorg/xorgItemBuilder.h +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************************** - * 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 _XORG_ITEM_BUILDER_H_ -#define _XORG_ITEM_BUILDER_H_ - -#include - -#include - -#include "logging.h" - -#include "logLine.h" -#include "logViewWidgetItem.h" -#include "logMode.h" - -#include "logModeItemBuilder.h" - -class LogLine; - -class XorgItemBuilder : public LogModeItemBuilder { - - public: - XorgItemBuilder() { - - } - - virtual ~XorgItemBuilder() { - - } - - - void prepareItem(LogViewWidgetItem* item) const { - LogLine* line=item->logLine(); - - item->setText(0, QLatin1String( "" )); - - int i=1; - foreach(const QString &label, line->logItems()) { - item->setText(i, label); - i++; - } - - item->setIcon(0, line->logLevel()->pixmap()); - } - - QString createToolTipText(LogLine* line) const { - QString result; - - QListIterator it(line->logItems()); - - result.append(QLatin1String( "" )); - - QString type=it.next(); - if (type.isEmpty()) - result.append(labelMessageFormat(i18n("Type:"), i18n("none"))); - else - result.append(labelMessageFormat(i18n("Type:"), type )); - - result.append(labelMessageFormat(i18n("Original file:"), line->sourceFileName())); - - result.append(QLatin1String( "
" )); - - return result; - } - - - QString createFormattedText(LogLine* line) const { - //It uses the same formating than the tool tip - return createToolTipText(line); - } - -}; - -#endif // _XORG_ITEM_BUILDER_H_ diff --git a/ksystemlog/src/modes/xorg/xorgLogMode.cpp b/ksystemlog/src/modes/xorg/xorgLogMode.cpp deleted file mode 100644 index 68c751e0..00000000 --- a/ksystemlog/src/modes/xorg/xorgLogMode.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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 "xorgLogMode.h" - -#include - -#include -#include - -#include "logging.h" -#include "logMode.h" - -#include "xorgAnalyzer.h" -#include "xorgItemBuilder.h" -#include "xorgConfigurationWidget.h" -#include "xorgConfiguration.h" - -XorgLogMode::XorgLogMode() : - LogMode(QLatin1String( XORG_LOG_MODE_ID ), i18n("X.org Log"),QLatin1String( XORG_MODE_ICON )) { - - d->logModeConfiguration = new XorgConfiguration(); - - d->logModeConfigurationWidget = new XorgConfigurationWidget(); - - d->itemBuilder = new XorgItemBuilder(); - - d->action = createDefaultAction(); - d->action->setToolTip(i18n("Display the X.org log.")); - d->action->setWhatsThis(i18n("Displays the X.org log in the current tab. X.org is the service which displays on screen your desktop and manage your graphical hardware. See this log if you want to know why you do not have 3D accelerations or why your input device is not recognized.")); - -} - -XorgLogMode::~XorgLogMode() { - -} - -Analyzer* XorgLogMode::createAnalyzer() { - return new XorgAnalyzer(this); -} - -QList XorgLogMode::createLogFiles() { - XorgConfiguration* configuration = logModeConfiguration(); - return configuration->findNoModeLogFiles(configuration->xorgPaths()); -} diff --git a/ksystemlog/src/modes/xorg/xorgLogMode.h b/ksystemlog/src/modes/xorg/xorgLogMode.h deleted file mode 100644 index 2c2e045f..00000000 --- a/ksystemlog/src/modes/xorg/xorgLogMode.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * 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 _XORG_LOG_MODE_H_ -#define _XORG_LOG_MODE_H_ - -/** - * Xorg Log Mode Identifier - */ -#define XORG_LOG_MODE_ID "xorgLogMode" - -/** - * Xorg Log Icon - */ -#define XORG_MODE_ICON "xorg" - -#include - -#include "logFile.h" - -#include "logMode.h" - -class XorgLogMode : public LogMode { - - Q_OBJECT - -public: - explicit XorgLogMode(); - - ~XorgLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _XORG_LOG_MODE_H_ - diff --git a/ksystemlog/src/modes/xsession/xsessionAnalyzer.cpp b/ksystemlog/src/modes/xsession/xsessionAnalyzer.cpp deleted file mode 100644 index 3c239fcc..00000000 --- a/ksystemlog/src/modes/xsession/xsessionAnalyzer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "xsessionAnalyzer.h" diff --git a/ksystemlog/src/modes/xsession/xsessionAnalyzer.h b/ksystemlog/src/modes/xsession/xsessionAnalyzer.h deleted file mode 100644 index 741d148a..00000000 --- a/ksystemlog/src/modes/xsession/xsessionAnalyzer.h +++ /dev/null @@ -1,159 +0,0 @@ -/*************************************************************************** - * 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 _X_SESSION_ANALYZER_H_ -#define _X_SESSION_ANALYZER_H_ - -#include - -#include "analyzer.h" - -#include "localLogFileReader.h" -#include "parsingHelper.h" - -#include "xsessionLogMode.h" -#include "xsessionConfiguration.h" - -class XSessionAnalyzer : public Analyzer { - Q_OBJECT - - public: - XSessionAnalyzer(LogMode* logMode) : - Analyzer(logMode), - currentDateTime(QDateTime::currentDateTime()) - { - - } - - virtual ~XSessionAnalyzer() { - - } - - LogViewColumns initColumns() { - LogViewColumns columns; - - columns.addColumn(LogViewColumn(i18n("Line"), true, false)); - columns.addColumn(LogViewColumn(i18n("Program"), true, false)); - columns.addColumn(LogViewColumn(i18n("Message"), true, false)); - - columns.setGroupByDay(false); - columns.setGroupByHour(false); - - return columns; - } - - - protected: - LogFileReader* createLogFileReader(const LogFile& logFile) { - return new LocalLogFileReader(logFile); - } - - Analyzer::LogFileSortMode logFileSortMode() { - XSessionConfiguration* configuration = logMode->logModeConfiguration(); - if (configuration->isIgnoreXorgErrors()) - return Analyzer::FilteredLogFile; - else - return Analyzer::AscendingSortedLogFile; - } - - LogLine* parseMessage(const QString& logLine, const LogFile& originalFile) { - int classPrototypePosition=logLine.indexOf(QLatin1String( "::" )); - int programPos=logLine.indexOf(QLatin1Char( ':' )); - - //If the first found : is the begin of a :: (example: QFile::at:) then we move to the next : - if (classPrototypePosition != -1 && programPos==classPrototypePosition) { - programPos=logLine.indexOf(QLatin1Char( ':' ), classPrototypePosition+2); - } - - QString program; - QString message; - if (programPos==-1) { - program = QLatin1String( "" ); - message = logLine.simplified(); - } - else { - program = logLine.left(programPos); - message = logLine.right(logLine.length()-programPos-1); - } - - message = message.simplified(); - - //Do not add this line if this is a X error that the user wants to ignore - if (isXorgError(program) == true) { - return NULL; - } - - //Find the right log level - LogLevel* logLevel; - if (hasErrorKeywords(message)) - logLevel = Globals::instance()->errorLogLevel(); - else if (hasWarningKeywords(message)) - logLevel = Globals::instance()->warningLogLevel(); - else - logLevel = Globals::instance()->informationLogLevel(); - - - - return new LogLine( - logLineInternalIdGenerator++, - currentDateTime, - QStringList() << program << message, - originalFile.url().path(), - logLevel, - logMode - ); - } - - private: - bool isXorgError(const QString& program) { - XSessionConfiguration* configuration = logMode->logModeConfiguration(); - if (configuration->isIgnoreXorgErrors() && configuration->xorgErrorKeywords().contains(program)) - return true; - - return false; - } - - bool hasWarningKeywords(const QString& message) { - XSessionConfiguration* configuration = logMode->logModeConfiguration(); - return hasKeywords(message, configuration->warningKeywords()); - } - - bool hasErrorKeywords(const QString& message) { - XSessionConfiguration* configuration = logMode->logModeConfiguration(); - return hasKeywords(message, configuration->errorKeywords()); - } - - bool hasKeywords(const QString& message, const QStringList& keywords) { - foreach(const QString& keyword, keywords) { - if (message.contains(keyword, Qt::CaseInsensitive)) { - return true; - } - } - - return false; - } - - - QDateTime currentDateTime; - -}; - -#endif // _X_SESSION_ANALYZER_H_ diff --git a/ksystemlog/src/modes/xsession/xsessionConfiguration.cpp b/ksystemlog/src/modes/xsession/xsessionConfiguration.cpp deleted file mode 100644 index 2d2728e5..00000000 --- a/ksystemlog/src/modes/xsession/xsessionConfiguration.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "xsessionConfiguration.h" diff --git a/ksystemlog/src/modes/xsession/xsessionConfiguration.h b/ksystemlog/src/modes/xsession/xsessionConfiguration.h deleted file mode 100644 index 90e0e18a..00000000 --- a/ksystemlog/src/modes/xsession/xsessionConfiguration.h +++ /dev/null @@ -1,116 +0,0 @@ -/*************************************************************************** - * 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 _X_SESSION_CONFIGURATION_H_ -#define _X_SESSION_CONFIGURATION_H_ - -#include - -#include "logModeConfiguration.h" - -#include "logging.h" -#include "defaults.h" - -#include "xsessionLogMode.h" - -#include "ksystemlogConfig.h" - -class XSessionConfigurationPrivate { -public: - QString xsessionPath; - - bool ignoreXorgErrors; - - QStringList xorgErrorKeywords; - - QStringList warningKeywords; - QStringList errorKeywords; -}; - -class XSessionConfiguration : public LogModeConfiguration { - - Q_OBJECT - - public: - XSessionConfiguration() : - d(new XSessionConfigurationPrivate()) { - - configuration->setCurrentGroup(QLatin1String( "XSessionLogMode" )); - - configuration->addItemString(QLatin1String( "LogFilePath" ), d->xsessionPath, QLatin1String( "~/.xsession-errors" ), QLatin1String( "LogFilePath" )); - - configuration->addItemBool(QLatin1String( "IgnoreXorgErrors" ), d->ignoreXorgErrors, false, QLatin1String( "IgnoreXorgErrors" )); - - QStringList defaultXorgErrorKeywords; - defaultXorgErrorKeywords.append(QLatin1String( "X Error" )); - defaultXorgErrorKeywords.append(QLatin1String( " Major opcode" )); - defaultXorgErrorKeywords.append(QLatin1String( " Minor opcode" )); - defaultXorgErrorKeywords.append(QLatin1String( " Resource id" )); - configuration->addItemStringList(QLatin1String( "XorgErrorKeywords" ), d->xorgErrorKeywords, defaultXorgErrorKeywords, QLatin1String( "XorgErrorKeywords" )); - - QStringList defaultWarningKeywords; - defaultWarningKeywords.append(QLatin1String( "WARNING" )); - configuration->addItemStringList(QLatin1String( "WarningKeywords" ), d->warningKeywords, defaultWarningKeywords, QLatin1String( "WarningKeywords" )); - - QStringList defaultErrorKeywords; - defaultErrorKeywords.append(QLatin1String( "ERROR" )); - configuration->addItemStringList(QLatin1String( "ErrorKeywords" ), d->errorKeywords, defaultErrorKeywords, QLatin1String( "ErrorKeywords" )); - - } - - virtual ~XSessionConfiguration() { - delete d; - } - - QStringList xorgErrorKeywords() const { - return d->xorgErrorKeywords; - } - - bool isIgnoreXorgErrors() const { - return d->ignoreXorgErrors; - } - - void setIgnoreXorgErrors(bool ignore) { - d->ignoreXorgErrors = ignore; - } - - QString xsessionPath() const { - return d->xsessionPath; - } - - void setXSessionPath(const QString& xsessionPath) { - d->xsessionPath = xsessionPath; - } - - QStringList warningKeywords() const { - return d->warningKeywords; - } - - QStringList errorKeywords() const { - return d->errorKeywords; - } - - private: - XSessionConfigurationPrivate* const d; - -}; - -#endif // _X_SESSION_CONFIGURATION_H_ diff --git a/ksystemlog/src/modes/xsession/xsessionConfigurationWidget.cpp b/ksystemlog/src/modes/xsession/xsessionConfigurationWidget.cpp deleted file mode 100644 index 5f71f37b..00000000 --- a/ksystemlog/src/modes/xsession/xsessionConfigurationWidget.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * KApacheLog, a apache 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 "xsessionConfigurationWidget.h" diff --git a/ksystemlog/src/modes/xsession/xsessionConfigurationWidget.h b/ksystemlog/src/modes/xsession/xsessionConfigurationWidget.h deleted file mode 100644 index 6144eb8e..00000000 --- a/ksystemlog/src/modes/xsession/xsessionConfigurationWidget.h +++ /dev/null @@ -1,153 +0,0 @@ -/*************************************************************************** - * 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 _X_SESSION_CONFIGURATION_WIDGET_H_ -#define _X_SESSION_CONFIGURATION_WIDGET_H_ - -#include -#include - -#include -#include - -#include "globals.h" -#include "logging.h" -#include "fileList.h" - -#include "logLevel.h" - -#include "xsessionConfiguration.h" -#include "xsessionLogMode.h" - -#include "logModeConfigurationWidget.h" - -#include "ui_xsessionConfigurationWidgetBase.h" - - -class XSessionConfigurationWidget : public LogModeConfigurationWidget, public Ui::XSessionConfigurationWidgetBase { - - Q_OBJECT - - public: - XSessionConfigurationWidget() : - LogModeConfigurationWidget(i18n("X Session Log"), QLatin1String( X_SESSION_MODE_ICON ), i18n("X Session Log")) - { - - setupUi(this); - /* - - QVBoxLayout* layout = new QVBoxLayout(); - this->setLayout(layout); - - //Authentication log file - QGroupBox* xsessionBox=new QGroupBox(i18n("X Session Log File")); - QGridLayout* xsessionLayout = new QGridLayout(); - xsessionBox->setLayout(xsessionLayout); - - layout->addWidget(xsessionBox); - - xsessionLayout->addWidget(new QLabel(i18n("Log file:")), 0, 0); - - xsessionUrlRequester=new KUrlRequester(xsessionBox); - - xsessionLayout->addWidget(xsessionUrlRequester, 0, 1); - - ignoreXorgErrors = new QCheckBox(i18n("Ignore Xorg Errors"), this); - xsessionLayout->addWidget(xsessionUrlRequester, 1, 0, 1, 2); - - layout->addStretch(); - */ - - xsessionUrlRequester->setToolTip(i18n("You can type or choose the X Session log file (example: ~/.xsession-errors).")); - xsessionUrlRequester->setWhatsThis(i18n("You can type or choose here the X Session log file. This file will be analyzed when you select the X Session log menu. Generally, its name is ~/.xsession-errors")); - xsessionUrlRequester->setMode(KFile::File); - xsessionUrlRequester->setEnabled(true); - - connect(xsessionUrlRequester, SIGNAL(textChanged(const QString&)), this, SIGNAL(configurationChanged())); - connect(ignoreXorgErrors, SIGNAL(stateChanged(int)), this, SIGNAL(configurationChanged())); - - connect(ignoreXorgErrors, SIGNAL(toggled(bool)), xorgErrorsDescription, SLOT(setEnabled(bool))); - - xorgErrorsDescriptionDefined = false; - - } - - ~XSessionConfigurationWidget() { - - } - - public slots: - - void saveConfig() { - XSessionConfiguration* configuration = Globals::instance()->findLogMode(QLatin1String( X_SESSION_LOG_MODE_ID ))->logModeConfiguration(); - - configuration->setXSessionPath(xsessionUrlRequester->url().path()); - configuration->setIgnoreXorgErrors(ignoreXorgErrors->isChecked()); - } - - void readConfig() { - XSessionConfiguration* configuration = Globals::instance()->findLogMode(QLatin1String( X_SESSION_LOG_MODE_ID ))->logModeConfiguration(); - - xsessionUrlRequester->setUrl(KUrl(configuration->xsessionPath())); - ignoreXorgErrors->setChecked(configuration->isIgnoreXorgErrors()); - - prepareXorgErrorsDescription(); - } - - void defaultConfig() { - //TODO Find a way to read the configuration per default - readConfig(); - } - - protected: - bool isValid() const { - if (xsessionUrlRequester->url().path().isEmpty()==false) { - return true; - } - - return false; - - } - - private: - void prepareXorgErrorsDescription() { - XSessionConfiguration* configuration = Globals::instance()->findLogMode(QLatin1String( X_SESSION_LOG_MODE_ID ))->logModeConfiguration(); - - //Prepare Ignore Xorg Errors description - if (xorgErrorsDescriptionDefined == false) { - QString text = xorgErrorsDescription->text(); - text.append(QLatin1String( "
    " )); - - foreach(const QString &xorgErrorKeyword, configuration->xorgErrorKeywords()) { - text.append(i18n("
  • %1: ...
  • ", xorgErrorKeyword)); - } - text.append(QLatin1String( "
" )); - xorgErrorsDescription->setText(text); - - xorgErrorsDescriptionDefined = true; - } - - } - - bool xorgErrorsDescriptionDefined; -}; - -#endif // _X_SESSION_CONFIGURATION_WIDGET_H_ diff --git a/ksystemlog/src/modes/xsession/xsessionConfigurationWidgetBase.ui b/ksystemlog/src/modes/xsession/xsessionConfigurationWidgetBase.ui deleted file mode 100644 index 168434ae..00000000 --- a/ksystemlog/src/modes/xsession/xsessionConfigurationWidgetBase.ui +++ /dev/null @@ -1,91 +0,0 @@ - - XSessionConfigurationWidgetBase - - - - 0 - 0 - 400 - 300 - - - - - - - X Session Log File - - - - - - Log file: - - - xsessionUrlRequester - - - - - - - false - - - - 1 - 0 - - - - - - - - Check this option to remove Xorg errors - - - Check this option to remove Xorg errors - - - Ignore Xorg errors - - - - - - - <p><b>Note:</b> Check this option to remove X.org errors.</p><p style="margin-bottom:0px">The following lines will be ignored:</p> - - - true - - - - - - - - - - Qt::Vertical - - - - 20 - 31 - - - - - - - - - KUrlRequester - QWidget -
kurlrequester.h
-
-
- -
diff --git a/ksystemlog/src/modes/xsession/xsessionFactory.cpp b/ksystemlog/src/modes/xsession/xsessionFactory.cpp deleted file mode 100644 index 4c696ba0..00000000 --- a/ksystemlog/src/modes/xsession/xsessionFactory.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************** - * 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 "xsessionFactory.h" - -#include - - -#include "logMode.h" -#include "logging.h" - -#include "simpleAction.h" -#include "xsessionLogMode.h" - -#include "logModeFactory.h" - -QList XSessionLogModeFactory::createLogModes() const { - QList logModes; - logModes.append(new XSessionLogMode()); - return logModes; -} - -LogModeAction* XSessionLogModeFactory::createLogModeAction() const { - LogMode* logMode = Globals::instance()->findLogMode(QLatin1String( X_SESSION_LOG_MODE_ID )); - SimpleAction* logModeAction = new SimpleAction(logMode->action(), logMode); - - logModeAction->setInToolBar(false); - logModeAction->setCategory(LogModeAction::OthersCategory); - - return logModeAction; -} diff --git a/ksystemlog/src/modes/xsession/xsessionFactory.h b/ksystemlog/src/modes/xsession/xsessionFactory.h deleted file mode 100644 index 6ddbef2a..00000000 --- a/ksystemlog/src/modes/xsession/xsessionFactory.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * 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 _X_SESSION_FACTORY_H_ -#define _X_SESSION_FACTORY_H_ - -#include - -#include "logModeFactory.h" - -class LogModeAction; -class LogMode; - -class XSessionLogModeFactory : public LogModeFactory { - - Q_OBJECT - - public: - - QList createLogModes() const; - - LogModeAction* createLogModeAction() const; - -}; - -#endif // _X_SESSION_FACTORY_H_ - diff --git a/ksystemlog/src/modes/xsession/xsessionItemBuilder.cpp b/ksystemlog/src/modes/xsession/xsessionItemBuilder.cpp deleted file mode 100644 index 4cbc0ab0..00000000 --- a/ksystemlog/src/modes/xsession/xsessionItemBuilder.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * 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 "xsessionItemBuilder.h" diff --git a/ksystemlog/src/modes/xsession/xsessionItemBuilder.h b/ksystemlog/src/modes/xsession/xsessionItemBuilder.h deleted file mode 100644 index 877e0d89..00000000 --- a/ksystemlog/src/modes/xsession/xsessionItemBuilder.h +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************************** - * 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 _X_SESSION_ITEM_BUILDER_H_ -#define _X_SESSION_ITEM_BUILDER_H_ - -#include - -#include - -#include "logging.h" - -#include "logLine.h" -#include "logViewWidgetItem.h" -#include "logMode.h" - -#include "logModeItemBuilder.h" - -class LogLine; - -class XSessionItemBuilder : public LogModeItemBuilder { - - public: - XSessionItemBuilder() { - - } - - virtual ~XSessionItemBuilder() { - - } - - - void prepareItem(LogViewWidgetItem* item) const { - LogLine* line=item->logLine(); - - item->setText(0, QLatin1String( "" )); - - int i=1; - foreach(const QString &label, line->logItems()) { - item->setText(i, label); - i++; - } - - item->setIcon(0, QIcon(line->logLevel()->pixmap())); - } - - QString createToolTipText(LogLine* line) const { - QString result; - - QListIterator it(line->logItems()); - - result.append(QLatin1String( "" )); - - QString type=it.next(); - if (type.isEmpty()) - result.append(labelMessageFormat(i18n("Program:"), i18n("none"))); - else - result.append(labelMessageFormat(i18n("Program:"), type )); - - result.append(labelMessageFormat(i18n("Original file:"), line->sourceFileName())); - - result.append(QLatin1String( "
" )); - - return result; - } - - - QString createFormattedText(LogLine* line) const { - //It uses the same formating than the tool tip - return createToolTipText(line); - } - -}; - -#endif // _X_SESSION_ITEM_BUILDER_H_ diff --git a/ksystemlog/src/modes/xsession/xsessionLogMode.cpp b/ksystemlog/src/modes/xsession/xsessionLogMode.cpp deleted file mode 100644 index d623e863..00000000 --- a/ksystemlog/src/modes/xsession/xsessionLogMode.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * 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 "xsessionLogMode.h" - -#include - -#include -#include - -#include "logging.h" -#include "logMode.h" - -#include "xsessionAnalyzer.h" -#include "xsessionItemBuilder.h" -#include "xsessionConfigurationWidget.h" -#include "xsessionConfiguration.h" - -XSessionLogMode::XSessionLogMode() : - LogMode(QLatin1String( X_SESSION_LOG_MODE_ID ), i18n("X Session Log"), QLatin1String( X_SESSION_MODE_ICON )) { - - d->logModeConfiguration = new XSessionConfiguration(); - - d->logModeConfigurationWidget = new XSessionConfigurationWidget(); - - d->itemBuilder = new XSessionItemBuilder(); - - d->action = createDefaultAction(); - d->action->setToolTip(i18n("Display the X Session log.")); - d->action->setWhatsThis(i18n("Displays the X Session log in the current tab. X Session log is the place where graphical programs write their output. See this log if you want to know why a program has crashed, or why your display manager (KDE, Gnome,...) has not started.")); - -} - -XSessionLogMode::~XSessionLogMode() { - -} - -Analyzer* XSessionLogMode::createAnalyzer() { - return new XSessionAnalyzer(this); -} - -QList XSessionLogMode::createLogFiles() { - XSessionConfiguration* configuration = Globals::instance()->findLogMode(QLatin1String( X_SESSION_LOG_MODE_ID ))->logModeConfiguration(); - - QList logFiles; - logFiles.append(configuration->findGenericLogFile(configuration->xsessionPath())); - return logFiles; -} diff --git a/ksystemlog/src/modes/xsession/xsessionLogMode.h b/ksystemlog/src/modes/xsession/xsessionLogMode.h deleted file mode 100644 index 35d8d57e..00000000 --- a/ksystemlog/src/modes/xsession/xsessionLogMode.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * 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 _X_SESSION_LOG_MODE_H_ -#define _X_SESSION_LOG_MODE_H_ - -/** - * Xorg Log Mode Identifier - */ -#define X_SESSION_LOG_MODE_ID "xsessionLogMode" - -/** - * Xorg Log Icon - */ -#define X_SESSION_MODE_ICON "utilities-log-viewer" - -#include - -#include "logFile.h" - -#include "logMode.h" - -class XSessionLogMode : public LogMode { - - Q_OBJECT - -public: - explicit XSessionLogMode(); - - ~XSessionLogMode(); - - Analyzer* createAnalyzer(); - - QList createLogFiles(); - -}; - -#endif // _X_SESSION_LOG_MODE_H_ - diff --git a/ksystemlog/src/statusBar.cpp b/ksystemlog/src/statusBar.cpp deleted file mode 100644 index 8ca6ad90..00000000 --- a/ksystemlog/src/statusBar.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/*************************************************************************** - * 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 "statusBar.h" - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include "logging.h" - -namespace KSystemLog { - -class StatusBarPrivate { - -public: - - QLabel* lineCountLabel; - - KComboBox* messageList; - - QLabel* lastModificationLabel; - -}; - -StatusBar::StatusBar(QWidget* parent) : - KStatusBar(parent), - d(new StatusBarPrivate()) { - - d->lineCountLabel = new QLabel(QLatin1String( "" ), this); - d->lineCountLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); - - //TODO Set a vertical right border to separate each labels - /* - d->lineCountLabel->setFrameStyle(QFrame::Box | QFrame::Sunken); - d->lineCountLabel->setLineWidth(2); - d->lineCountLabel->setMidLineWidth(2); - */ - addPermanentWidget(d->lineCountLabel, 1); - - d->messageList = new KComboBox(this); - d->messageList->setInsertPolicy(QComboBox::InsertAtTop); - d->messageList->setMaxVisibleItems(5); -/* - //TODO Define a specifical palette (and make it works !) - QPalette palette(d->messageList->palette()); - palette.setColor(QPalette::HighlightedText, Qt::red); //palette.color(QPalette::Base) - palette.setColor(QPalette::Base, Qt::red); //palette.color(QPalette::Base) - palette.setColor(QPalette::Text, QColor(212, 140, 95)); //palette.color(QPalette::Base) - d->messageList->setPalette(palette); - //d->messageList->repaint(); -*/ - addPermanentWidget(d->messageList, 4); - - d->lastModificationLabel = new QLabel(QLatin1String( "" ), this); - d->lastModificationLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); - addPermanentWidget(d->lastModificationLabel, 1); - - -} - -StatusBar::~StatusBar() { - //QLabels are automatically deleted - delete d; -} - -void StatusBar::changeLineCountMessage(const QString& lineCountMessage) { - d->lineCountLabel->setText(lineCountMessage); -} - -void StatusBar::changeLastModification(const QTime& lastModification) { - d->lastModificationLabel->setText(i18n("Last updated: %1.", KGlobal::locale()->formatTime(lastModification, true, false) )); -} - -void StatusBar::changeMessage(const QString& message) { - d->messageList->insertItem(0, i18n("%1: %2", KGlobal::locale()->formatTime(QTime::currentTime(), true, false), message)); - - //100 log history message max. - if (d->messageList->count() > 100) { - d->messageList->removeItem(d->messageList->count() -1); - } - d->messageList->setCurrentIndex(0); -} - -} - -#include "moc_statusBar.cpp" diff --git a/ksystemlog/src/statusBar.h b/ksystemlog/src/statusBar.h deleted file mode 100644 index c0c17d5f..00000000 --- a/ksystemlog/src/statusBar.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * 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 _STATUS_BAR_ -#define _STATUS_BAR_ - - -#include - -#include -#include - - -namespace KSystemLog { - -class StatusBarPrivate; - -/** - * Status Bar - */ -class StatusBar : public KStatusBar { - - Q_OBJECT - -public: - explicit StatusBar(QWidget* parent); - - virtual ~StatusBar(); - - void changeLineCountMessage(const QString& lineCountMessage); - void changeLastModification(const QTime& lastModification); - - void changeMessage(const QString& message); -private: - - StatusBarPrivate* const d; - -}; - -} - -#endif // _STATUS_BAR_ diff --git a/ksystemlog/src/tabLogManager.cpp b/ksystemlog/src/tabLogManager.cpp deleted file mode 100644 index b91141bd..00000000 --- a/ksystemlog/src/tabLogManager.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/*************************************************************************** - * 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 "tabLogManager.h" - - - -#include - -#include "logging.h" - -#include "view.h" - -#include "logMode.h" -#include "defaults.h" -#include "logManager.h" - -class TabLogManagerPrivate { -public: - LogManager* logManager; - int newLinesCount; - -}; - -TabLogManager::TabLogManager(LogManager* logManager) : - d(new TabLogManagerPrivate()) { - - d->logManager = logManager; - - d->newLinesCount = 0; -} - -TabLogManager::~TabLogManager() { - - delete d->logManager->usedView(); - - delete d->logManager; - - delete d; -} - - -LogManager* TabLogManager::logManager() { - return d->logManager; -} - -void TabLogManager::addNewLinesCount(int newLines) { - d->newLinesCount += newLines; -} - -void TabLogManager::initNewLinesCount() { - d->newLinesCount = 0; -} - -QString TabLogManager::title() { - if (d->newLinesCount == 0) - return logModeName(); - else - return i18nc("Log mode name (added lines count)", "%1 (%2)", d->logManager->logMode()->name(), d->newLinesCount); -} - -QString TabLogManager::logModeName() { - if (d->logManager->logMode() == NULL) - return i18nc("Newly created tab", "Empty Log"); - else - return d->logManager->logMode()->name(); -} - -#include "moc_tabLogManager.cpp" diff --git a/ksystemlog/src/tabLogManager.h b/ksystemlog/src/tabLogManager.h deleted file mode 100644 index ba072149..00000000 --- a/ksystemlog/src/tabLogManager.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * 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 _TAB_LOG_MANAGER_H_ -#define _TAB_LOG_MANAGER_H_ - - -#include - -#include - -class LogManager; - - -class TabLogManagerPrivate; - -/** - * Class that wrap a LogManager inside a tabbed view - */ -class TabLogManager : public QObject { - - Q_OBJECT - -public: - TabLogManager(LogManager* logManager); - - virtual ~TabLogManager(); - - LogManager* logManager(); - - void addNewLinesCount(int newLines); - void initNewLinesCount(); - - QString title(); - -private: - QString logModeName(); - - TabLogManagerPrivate* const d; - -}; - - -#endif // _TAB_LOG_MANAGER_H_ diff --git a/ksystemlog/src/tabLogViewsWidget.cpp b/ksystemlog/src/tabLogViewsWidget.cpp deleted file mode 100644 index 68a7e0d0..00000000 --- a/ksystemlog/src/tabLogViewsWidget.cpp +++ /dev/null @@ -1,422 +0,0 @@ -/*************************************************************************** - * 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 "tabLogViewsWidget.h" - -#include -#include -#include - -#include -#include -#include - -#include "logging.h" - -#include "view.h" -#include "logViewExport.h" - -#include "logMode.h" -#include "defaults.h" -#include "logManager.h" -#include "tabLogManager.h" -#include "logViewWidget.h" - -class TabLogViewsWidgetPrivate { -public: - QList tabLogManagers; - - QMenu* contextMenu; -}; - -TabLogViewsWidget::TabLogViewsWidget(QWidget* parent) : - KTabWidget(parent), - d(new TabLogViewsWidgetPrivate()) { - - d->contextMenu = NULL; - - QPushButton* tabNewTabButton=new QPushButton(SmallIcon(QLatin1String( "tab-new" )), QLatin1String( "" ), this); - connect(tabNewTabButton, SIGNAL(clicked()), this, SLOT(createTab())); - - tabNewTabButton->setToolTip(i18n("Create a new tab")); - tabNewTabButton->setWhatsThis(i18n("Creates a new tab which can display another log.")); - - QPushButton* tabCloseTabButton=new QPushButton(SmallIcon(QLatin1String( "tab-close" )), QLatin1String( "" ), this); - connect(tabCloseTabButton, SIGNAL(clicked()), this, SLOT(closeTab())); - - tabCloseTabButton->setToolTip(i18n("Close the current tab")); - tabCloseTabButton->setWhatsThis(i18n("Closes the current tab.")); - - setCornerWidget(tabNewTabButton, Qt::TopLeftCorner); - setCornerWidget(tabCloseTabButton, Qt::TopRightCorner); - - setUsesScrollButtons(true); - - //The context menu is managed manually - //setContextMenuPolicy(Qt::ActionsContextMenu); - - connect(this, SIGNAL(mouseDoubleClick()), this, SLOT(createTab())); - connect(this, SIGNAL(contextMenu(QPoint)), this, SLOT(showContextMenu(QPoint))); - connect(this, SIGNAL(contextMenu(QWidget*,QPoint)), this, SLOT(showContextMenu(QWidget*,QPoint))); - - //TODO Use this (need to connect to movedTab(int, int) signal and update the QList - //setTabReorderingEnabled(true); - - connect(this, SIGNAL(currentChanged(int)), this, SLOT(changeCurrentTab())); -} - -TabLogViewsWidget::~TabLogViewsWidget() { - //TODO Try to do not crash KSystemLog at exitting - /* - QList copy = d->tabLogManagers; - - //Delete existing tabs and related tabLogManagers - foreach(TabLogManager* tabLogManager, copy) { - logDebug() << "Deleting " << tabLogManager->logManager()->logMode()->name(); - removePage(tabLogManager->logManager()->usedView()); - - d->tabLogManagers.removeAll(tabLogManager); - delete tabLogManager; - logDebug() << tabLogManager->logManager()->logMode()->name() << " deleted"; - } - */ - - delete d; -} - -void TabLogViewsWidget::newTab(View* view) { - logDebug() << "Inserting to a new tab the view "; - - //Add a tab at the end of the widget - insertTab(count(), view, SmallIcon(QLatin1String( NO_MODE_ICON )), i18n("No Log")); - - if (count()>1) - setTabBarHidden(false); - else - setTabBarHidden(true); - -} - -void TabLogViewsWidget::changeTab(View* view, const QIcon& icon, const QString& label) { - logDebug() << "Changing tab " << label; - int index = indexOf(view); - setTabIcon(index, icon); - setTabText(index, label); -} - -QList TabLogViewsWidget::logManagers() { - QList logManagers; - foreach(TabLogManager* tabLogManager, d->tabLogManagers) { - logManagers.append(tabLogManager->logManager()); - } - - return logManagers; -} - -LogManager* TabLogViewsWidget::findRelatedLogManager(View* view) { - return findRelatedTabLogManager(view)->logManager(); -} - -TabLogManager* TabLogViewsWidget::findRelatedTabLogManager(View* view) { - foreach (TabLogManager* tabLogManager, d->tabLogManagers) { - if (tabLogManager->logManager()->usedView()==view) { - return tabLogManager; - } - } - - logError() << "No log manager found"; - return NULL; -} - -TabLogManager* TabLogViewsWidget::activeTabLogManager() { - View* currentView=static_cast (currentWidget()); - - return findRelatedTabLogManager(currentView); -} - -LogManager* TabLogViewsWidget::activeLogManager() { - return activeTabLogManager()->logManager(); -} - -LogManager* TabLogViewsWidget::createTab() { - logDebug() << "Creating a new tab"; - - return newTabLogManager()->logManager(); -} - -void TabLogViewsWidget::moveTabLeft() { - logDebug() << "Duplicate tab to the left"; - - TabLogManager* currentTabLogManager=activeTabLogManager(); - int position=indexOf(currentTabLogManager->logManager()->usedView()); - - if (position<=0) { - logError() << "Tab Position <= 0 : " << position; - return; - } - - d->tabLogManagers.removeAt(position); - d->tabLogManagers.insert(position-1, currentTabLogManager); - - moveTab(position, position-1); - -} - -void TabLogViewsWidget::moveTabRight() { - logDebug() << "Duplicate tab to the right"; - - TabLogManager* currentTabLogManager=activeTabLogManager(); - int position=indexOf(currentTabLogManager->logManager()->usedView()); - - if (position>=count()-1) { - logError() << "Tab Position >= count()-1 : " << position; - return; - } - - d->tabLogManagers.removeAt(position); - d->tabLogManagers.insert(position+1, currentTabLogManager); - - moveTab(position, position+1); - -} - -LogManager* TabLogViewsWidget::duplicateTab() { - logDebug() << "Duplicate current tab"; - - TabLogManager* currentManager=activeTabLogManager(); - - TabLogManager* tabLogManager=newTabLogManager(); - - LogMode* mode=currentManager->logManager()->logMode(); - - load(mode, tabLogManager->logManager()); - - //Returns the newly created LogManager - return tabLogManager->logManager(); -} - -TabLogManager* TabLogViewsWidget::newTabLogManager() { - logDebug() << "Creating new View..."; - - View* view = new View(this); - - logDebug() << "Creating new LogManager..."; - - LogManager* logManager=new LogManager(view); - - //Signals from LogManager to Main Class - connect(logManager, SIGNAL(tabTitleChanged(View*,QIcon,QString)), this, SLOT(changeTab(View*,QIcon,QString))); - connect(logManager, SIGNAL(logUpdated(View*,int)), this, SLOT(changeTitleAddedLines(View*,int))); - - TabLogManager* tabLogManager = new TabLogManager(logManager); - d->tabLogManagers.append(tabLogManager); - - logDebug() << "New LogManager created"; - - //Finally add the view to the tabs - newTab(view); - - emit logManagerCreated(logManager); - - setCurrentIndex(count()-1); - - //Set focus to the list - view->logViewWidget()->setFocus(); - - //Returns the newly created TabLogManager - return tabLogManager; - -} - -void TabLogViewsWidget::closeTab() { - if (count()==1) { - logError() << "Cannot close tab, one tab left"; - return; - } - - TabLogManager* currentTabLogManager=activeTabLogManager(); - - d->tabLogManagers.removeAll(currentTabLogManager); - - int position=indexOf(currentTabLogManager->logManager()->usedView()); - removeTab(position); - if (count()==1) { - setTabBarHidden(true); - } - - delete currentTabLogManager; - -} - -void TabLogViewsWidget::load(LogMode* logMode, LogManager* manager) { - logDebug() << "Loading a new mode : " << logMode->name(); - - if (manager==NULL || logMode==NULL) { - logError() << "Error while loading a manager"; - return; - } - - //The manager is now using the Log mode passed in parameter - manager->initialize(logMode); - - //Launch the reading - manager->reload(); -} - -void TabLogViewsWidget::reloadCurrent() { - logDebug() << "Reloading current log manager..."; - - LogManager* manager=activeLogManager(); - - if (manager!=NULL) { - manager->reload(); - } - -} - -void TabLogViewsWidget::reloadAll() { - logDebug() << "Reloading all tabs..."; - - foreach (TabLogManager* tabLogManager, d->tabLogManagers) { - //Log manager without log mode does not need to be reloaded - if (tabLogManager->logManager()->logMode() == NULL) { - continue; - } - - //Do a simple reload if it is an open log mode - if (tabLogManager->logManager()->logMode()->id()==QLatin1String( "openLogMode" )) { - tabLogManager->logManager()->reload(); - continue; - } - - //Do a full loading of other log modes (needed if log files have been modified) - load(tabLogManager->logManager()->logMode(), tabLogManager->logManager()); - - } - - -} - -void TabLogViewsWidget::changeCurrentTab() { - logDebug() << "Changing current tab..."; - - TabLogManager* tabLogManager=activeTabLogManager(); - - //Reinit the new lines count since last selection - tabLogManager->initNewLinesCount(); - - //If the tab displayed the new added line count, rename it to the default log mode name - changeTab(tabLogManager->logManager()->usedView(), logModeIcon(tabLogManager->logManager()->logMode()), tabLogManager->title()); - - logDebug() << "Current tab changed"; -} - -void TabLogViewsWidget::changeReloadingTab(View* view, bool reloading) { - TabLogManager* tabLogManager = findRelatedTabLogManager(view); - - if (reloading == true) - changeTab(tabLogManager->logManager()->usedView(), KIcon( QLatin1String( "view-refresh" )), tabLogManager->title()); - else - changeTab(tabLogManager->logManager()->usedView(), logModeIcon(tabLogManager->logManager()->logMode()), tabLogManager->title()); -} - -void TabLogViewsWidget::changeTitleAddedLines(View* view, int addedLinesSinceLastUpdate) { - logDebug() << "Changing title" << addedLinesSinceLastUpdate << " added lines..."; - LogManager* currentManager=activeLogManager(); - - //Only display added line on tab title if this is not an update of the current tab - if (currentManager->usedView() != view) { - TabLogManager* tabLogManager = findRelatedTabLogManager(view); - tabLogManager->addNewLinesCount(addedLinesSinceLastUpdate); - - //Update the tab title - changeTab(tabLogManager->logManager()->usedView(), logModeIcon(tabLogManager->logManager()->logMode()), tabLogManager->title()); - } -} -void TabLogViewsWidget::expandAllCurrentView() { - activeLogManager()->usedView()->logViewWidget()->expandAll(); -} - -void TabLogViewsWidget::collapseAllCurrentView() { - activeLogManager()->usedView()->logViewWidget()->collapseAll(); -} - -void TabLogViewsWidget::selectAllCurrentView() { - activeLogManager()->usedView()->logViewWidget()->selectAll(); -} - -void TabLogViewsWidget::fileSaveCurrentView() { - LogViewExport logViewExport(this, activeLogManager()->usedView()->logViewWidget()); - connect(&logViewExport, SIGNAL(statusBarChanged(QString)), this, SIGNAL(statusBarChanged(QString))); - logViewExport.fileSave(); -} - -void TabLogViewsWidget::copyToClipboardCurrentView() { - LogViewExport logViewExport(this, activeLogManager()->usedView()->logViewWidget()); - connect(&logViewExport, SIGNAL(statusBarChanged(QString)), this, SIGNAL(statusBarChanged(QString))); - logViewExport.copyToClipboard(); -} -void TabLogViewsWidget::sendMailCurrentView() { - LogViewExport logViewExport(this, activeLogManager()->usedView()->logViewWidget()); - connect(&logViewExport, SIGNAL(statusBarChanged(QString)), this, SIGNAL(statusBarChanged(QString))); - logViewExport.sendMail(); -} -void TabLogViewsWidget::printSelectionCurrentView() { - LogViewExport logViewExport(this, activeLogManager()->usedView()->logViewWidget()); - connect(&logViewExport, SIGNAL(statusBarChanged(QString)), this, SIGNAL(statusBarChanged(QString))); - logViewExport.printSelection(); -} - -QIcon TabLogViewsWidget::logModeIcon(LogMode* logMode) { - if ( logMode == NULL) - return KIcon(QLatin1String( NO_MODE_ICON )); - else - return logMode->icon(); - -} - -void TabLogViewsWidget::prepareContextMenu(bool /*onTab*/) { - if (d->contextMenu == NULL) { - d->contextMenu = new QMenu(this); - d->contextMenu->addActions(actions()); - } - - //TODO Disable some actions, depending of the onTab value -} - -void TabLogViewsWidget::showContextMenu(const QPoint& cursorPosition) { - logDebug() << "Showing context menu at " << cursorPosition; - - prepareContextMenu(false); - - d->contextMenu->popup(cursorPosition); - -} - -void TabLogViewsWidget::showContextMenu(QWidget* tab, const QPoint& cursorPosition) { - logDebug() << "Showing context menu at " << cursorPosition << " at " << tab->objectName(); - - prepareContextMenu(true); - - d->contextMenu->popup(cursorPosition); - -} -#include "moc_tabLogViewsWidget.cpp" diff --git a/ksystemlog/src/tabLogViewsWidget.h b/ksystemlog/src/tabLogViewsWidget.h deleted file mode 100644 index 5f0b5ade..00000000 --- a/ksystemlog/src/tabLogViewsWidget.h +++ /dev/null @@ -1,116 +0,0 @@ -/*************************************************************************** - * 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 _TAB_LOG_VIEWS_WIDGET_H_ -#define _TAB_LOG_VIEWS_WIDGET_H_ - -#include -#include - -#include -#include - -class LogManager; -class TabLogManager; -class View; -class LogMode; - -class TabLogViewsWidgetPrivate; - -class TabLogViewsWidget : public KTabWidget { - - Q_OBJECT - -public: - TabLogViewsWidget(QWidget* parent = NULL); - - virtual ~TabLogViewsWidget(); - - QList logManagers(); - - LogManager* activeLogManager(); - - void load(LogMode* logMode, LogManager* manager); - -public slots: - - LogManager* createTab(); - LogManager* duplicateTab(); - - void closeTab(); - - void moveTabLeft(); - void moveTabRight(); - - void reloadCurrent(); - void reloadAll(); - - /** - * Display a reload icon on the specified view tab - */ - void changeReloadingTab(View* view, bool reloading); - - //Methods that transmit a signal to the current logViewWidget - void expandAllCurrentView(); - void collapseAllCurrentView(); - void selectAllCurrentView(); - - void fileSaveCurrentView(); - void copyToClipboardCurrentView(); - void sendMailCurrentView(); - void printSelectionCurrentView(); - -private slots: - void changeTab(View* view, const QIcon& icon, const QString& label); - - void changeCurrentTab(); - void changeTitleAddedLines(View*, int); - - void showContextMenu(const QPoint& cursorPosition); - void showContextMenu(QWidget* tab, const QPoint& cursorPosition); - -signals: - void tabCreationRequested(); - void tabClosingRequested(); - - void logManagerCreated(LogManager* manager); - - void statusBarChanged(const QString& message); - -private: - TabLogManager* newTabLogManager(); - - void newTab(View* view); - - LogManager* findRelatedLogManager(View* view); - - QIcon logModeIcon(LogMode* icon); - - TabLogManager* activeTabLogManager(); - TabLogManager* findRelatedTabLogManager(View* view); - - void prepareContextMenu(bool onTab); - - TabLogViewsWidgetPrivate* const d; - -}; - -#endif // _TAB_LOG_VIEWS_WIDGET_H_ diff --git a/ksystemlog/tests/CMakeLists.txt b/ksystemlog/tests/CMakeLists.txt deleted file mode 100644 index 89efab6b..00000000 --- a/ksystemlog/tests/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../src - ${CMAKE_CURRENT_BINARY_DIR}/../src - ${CMAKE_CURRENT_SOURCE_DIR}/../src/lib - ${CMAKE_CURRENT_SOURCE_DIR}/../src/modes/system - ${CMAKE_CURRENT_SOURCE_DIR}/../src/modes/kernel -) - -macro(ksystemlog_unit_tests) - foreach(unitTest ${ARGN}) - set(unitTest_sources - ${unitTest}.cpp - testUtil.cpp - ) - - kde4_add_test(ksystemlog-${unitTest} ${unitTest_sources}) - - target_link_libraries(ksystemlog-${unitTest} - ${QT_QTTEST_LIBRARY} - ksystemlog_library - ) - endforeach(unitTest) -endmacro(ksystemlog_unit_tests) - -ksystemlog_unit_tests( - logModeFactoryTest - systemAnalyzerTest - kernelAnalyzerTest -) - -macro(ksystemlog_manual_tests) - foreach(unitTest ${ARGN}) - set(unitTest_sources - ${unitTest}.cpp - testUtil.cpp - ) - - kde4_add_manual_test(ksystemlog-${unitTest} ${unitTest_sources}) - - target_link_libraries(ksystemlog-${unitTest} - ${QT_QTTEST_LIBRARY} - ksystemlog_library - ) - endforeach(unitTest) -endmacro(ksystemlog_manual_tests) - -# Not real unit tests -ksystemlog_manual_tests( - kioLogFileReaderTest - findIncompatibleKioTest -) diff --git a/ksystemlog/tests/findIncompatibleKioTest.cpp b/ksystemlog/tests/findIncompatibleKioTest.cpp deleted file mode 100644 index 3070536d..00000000 --- a/ksystemlog/tests/findIncompatibleKioTest.cpp +++ /dev/null @@ -1,294 +0,0 @@ -/*************************************************************************** - * 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 -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "logging.h" - -class FindIncompatibleKioTest : public QObject { - -Q_OBJECT - -private slots: - - void initTestCase(); - - void find(); - -private: - void displayFoundMethods(const QStringList& methods, const KUrl& url, QTextStream& out); - - QStringList headerContent(const KUrl& url); - QString convertMethod(const QString& method); - - QMap findMethods(const QStringList& methods, const KUrl& url); - -}; - -void FindIncompatibleKioTest::initTestCase() { - -} - - -void FindIncompatibleKioTest::find() { - QString kdelibs = QLatin1String("/home/nicolas/workspace/kdelibs"); - QString kdebase = QLatin1String("/home/nicolas/workspace/kdebase"); - - QString outputPath = QLatin1String("/home/nicolas/compatibleKioSlaves.html"); - - QStringList existingMethods; - existingMethods << QLatin1String("void SlaveBase::openConnection(void)"); - existingMethods << QLatin1String("void SlaveBase::closeConnection(void)"); - existingMethods << QLatin1String("void SlaveBase::stat(KUrl const &)"); - existingMethods << QLatin1String("void SlaveBase::put(KUrl const &, int, bool, bool)"); - existingMethods << QLatin1String("void SlaveBase::special(const QByteArray &)"); - existingMethods << QLatin1String("void SlaveBase::listDir(KUrl const &)"); - existingMethods << QLatin1String("void SlaveBase::get(KUrl const & )"); - existingMethods << QLatin1String("void SlaveBase::open(KUrl const &, QIODevice::OpenMode)"); - existingMethods << QLatin1String("void SlaveBase::read(KIO::filesize_t)"); - existingMethods << QLatin1String("void SlaveBase::write(const QByteArray &)"); - existingMethods << QLatin1String("void SlaveBase::seek(KIO::filesize_t)"); - existingMethods << QLatin1String("void SlaveBase::close()"); - existingMethods << QLatin1String("void SlaveBase::mimetype(KUrl const &url)"); - existingMethods << QLatin1String("void SlaveBase::rename(KUrl const &, KUrl const &, bool)"); - existingMethods << QLatin1String("void SlaveBase::symlink(QString const &, KUrl const &, bool)"); - existingMethods << QLatin1String("void SlaveBase::copy(KUrl const &, KUrl const &, int, bool)"); - existingMethods << QLatin1String("void SlaveBase::del(KUrl const &, bool)"); - existingMethods << QLatin1String("void SlaveBase::setLinkDest(const KUrl &, const QString&)"); - existingMethods << QLatin1String("void SlaveBase::mkdir(KUrl const &, int)"); - existingMethods << QLatin1String("void SlaveBase::chmod(KUrl const &, int)"); - existingMethods << QLatin1String("void SlaveBase::setModificationTime(KUrl const &, const QDateTime&)"); - existingMethods << QLatin1String("void SlaveBase::chown(KUrl const &, const QString &, const QString &)"); - existingMethods << QLatin1String("void SlaveBase::setSubUrl(KUrl const &)"); - - //logDebug() << existingMethods; - - QFile file(outputPath); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - logError() << "Unable to open the output file" << outputPath; - return; - } - - QTextStream out(&file); - - out << "" << endl; - out << "" << endl; - out << "" << endl; - out << "" << endl; - out << "" << endl; - - out << "
KIO Slaves Analyzing
" << endl; - out << "" << endl; - - QList parsingUrls; - - parsingUrls.append(KUrl(kdelibs + QLatin1String("/kioslave/http/http.h"))); - parsingUrls.append(KUrl(kdelibs + QLatin1String("/kioslave/ftp/ftp.h"))); - parsingUrls.append(KUrl(kdelibs + QLatin1String("/kioslave/file/file.h"))); - parsingUrls.append(KUrl(kdelibs + QLatin1String("/kioslave/metainfo/metainfo.h"))); - - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/about/kio_about.h"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/cgi/cgi.h"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/filter/filter.h"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/finger/kio_finger.h"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/fish/fish.h"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/floppy/kio_floppy.h"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/info/info.h"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/man/kio_man.h"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/media/kio_media.h"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/nfs/kio_nfs.h"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/remote/kio_remote.h"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/settings/kio_settings.cc"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/sftp/kio_sftp.h"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/smb/kio_smb.h"))); - //parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/tar/tar.h"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/thumbnail/thumbnail.h"))); - parsingUrls.append(KUrl(kdebase + QLatin1String("/runtime/kioslave/trash/kio_trash.h"))); - - - out << "
" << endl; - out << "

Analyzed KIO Slaves

" << endl; - out << "
    " << endl; - foreach(const KUrl &url, parsingUrls) { - out << "
  • " << url.path() << "
  • " << endl; - } - out << "
" << endl; - - - foreach(const KUrl &url, parsingUrls) { - displayFoundMethods(existingMethods, url, out); - } - - out << "
" << endl; - out << "

SlaveBase methods to implement

" << endl; - out << "
    " << endl; - foreach(const QString &method, existingMethods) { - out << "
  • " << method << "
  • " << endl; - } - out << "
" << endl; - - out << "" << endl; - out << "" << endl; - - file.close(); -} - -void FindIncompatibleKioTest::displayFoundMethods(const QStringList& methods, const KUrl& url, QTextStream& out) { - QMap foundMethods = findMethods(methods, url); - - - out << endl; - out << "
" << endl; - out << "

" << url.path() << "

" << endl; - - if (foundMethods.isEmpty()) { - out << "No file found" << endl; - out << "
" << endl; - return; - } - - out << "
" << endl; - out << "

Found and Not Found methods :

" << endl; - out << "
    " << endl; - - //Found methods - QMapIterator i(foundMethods); - while (i.hasNext()) { - i.next(); - - if (i.value() == true) { - out << "
  • " << i.key() << "
  • " << endl; - } - } - - - //Found methods - i = foundMethods; - while (i.hasNext()) { - i.next(); - - if (i.value() == false) { - out << "
  • " << i.key() << "
  • " << endl; - } - } - - out << "
" << endl; - -} - -QMap FindIncompatibleKioTest::findMethods(const QStringList& methods, const KUrl& url) { - - QStringList lines = headerContent(url); - if (lines.isEmpty()) - return QMap(); - - QMap foundMethods; - foreach(const QString &method, methods) { - foundMethods.insert(method, false); - } - - foreach(QString line, lines) { - line = convertMethod(line); - - if (line.contains(QLatin1String("void")) == false) - continue; - - //logDebug() << "Line" << convertMethod(line) << endl; - - foreach(const QString &method, methods) { - if (line == convertMethod(method)) { - foundMethods.insert(method, true); - } - /* - else { - logDebug() << method << " != " << line << endl; - } - */ - } - - } - - logDebug(); - - return foundMethods; -} - -QString FindIncompatibleKioTest::convertMethod(const QString& method) { - QString result(method); - result = result.remove(QLatin1String("SlaveBase::")); - result = result.remove(QLatin1String("virtual")); - // result = result.remove(QLatin1String(" ")); - // result = result.replace('\t', ' '); - result = result.remove(QLatin1String(";")); - result = result.simplified(); - - int firstParenthesis = result.indexOf(QLatin1String("(")); - int lastParenthesis = result.indexOf(QLatin1String(")")); - if (firstParenthesis != -1&& lastParenthesis != -1) - result = result.remove(firstParenthesis+1, lastParenthesis-firstParenthesis-1); - - return result; -} - -QStringList FindIncompatibleKioTest::headerContent(const KUrl& url) { - QStringList kioHeaderContent; - - QString tmpFile; - if (KIO::NetAccess::download(url, tmpFile, new QWidget()) ) { - - QFile file(tmpFile); - file.open(QIODevice::ReadOnly); - - //If the file does not exist - if (!file.exists()) { - return QStringList(); - } - - QTextStream inputStream(&file); - while (inputStream.atEnd() == false) { - kioHeaderContent.append(inputStream.readLine()); - } - - file.close(); - - KIO::NetAccess::removeTempFile(tmpFile ); - } else { - logDebug() << KIO::NetAccess::lastErrorString(); - } - - return kioHeaderContent; -} - -QTEST_KDEMAIN(FindIncompatibleKioTest, GUI) - -#include "findIncompatibleKioTest.moc" diff --git a/ksystemlog/tests/kernelAnalyzerTest.cpp b/ksystemlog/tests/kernelAnalyzerTest.cpp deleted file mode 100644 index a223f241..00000000 --- a/ksystemlog/tests/kernelAnalyzerTest.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/*************************************************************************** - * KKernelLog, a kernel 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 -#include -#include - -#include - -#include -#include - -#include "testUtil.h" - -#include "analyzer.h" -#include "globals.h" - -#include "logLevel.h" -#include "logFile.h" -#include "logViewModel.h" -#include "logViewWidget.h" - -#include "ksystemlogConfig.h" - -#include "logging.h" - -#include "kernelAnalyzer.h" -#include "localLogFileReader.h" - -/** - * Reimplements the Kernel Analyzer using a Local File Reader - */ -class KernelAnalyzerLocalReader : public KernelAnalyzer { - public: - - KernelAnalyzerLocalReader(LogMode* logMode) : - KernelAnalyzer(logMode) { - - } - - virtual ~KernelAnalyzerLocalReader() { - - } - - QDateTime findStartupTime() { - return startupDateTime; - } - - protected: - LogFileReader* createLogFileReader(const LogFile& logFile) { - return new LocalLogFileReader(logFile); - } - -}; - - -class KernelAnalyzerTest : public QObject { - - Q_OBJECT - -private slots: - - void initTestCase(); - - void testUbuntuDmesg(); - void testSuseDmesg(); - -private: - void compareWithMinTime(QList lines, const QDateTime& minTime); - -private: - TestUtil testUtil; - -}; - -void KernelAnalyzerTest::initTestCase() { - testUtil.registerLogModeFactories(); -} - -void KernelAnalyzerTest::testUbuntuDmesg() { - - //Specifical configuration - KSystemLogConfig::setMaxLines(1000); - KSystemLogConfig::setDeleteDuplicatedLines(false); - - LogMode* logMode = Globals::instance()->findLogMode(QLatin1String("kernelLogMode")); - KernelAnalyzerLocalReader* kernelAnalyzer = new KernelAnalyzerLocalReader(logMode); - LogViewModel* model = testUtil.defineLogViewModel(kernelAnalyzer); - - QVERIFY(kernelAnalyzer); - QVERIFY(model); - - QList logFiles = testUtil.createLogFiles(QLatin1String(KDESRCDIR "/testFiles/kernel/ubuntu.dmesg")); - - kernelAnalyzer->setLogFiles(logFiles); - - kernelAnalyzer->watchLogFiles(true); - - QCOMPARE(model->itemCount(), 25); - QCOMPARE(model->isEmpty(), false); - - QList logLines = model->logLines(); - - QStringList items = QStringList() << QLatin1String("ADDRCONF(NETDEV_UP)") << QLatin1String("eth0: link is not ready"); - QDateTime assertedDateTime = kernelAnalyzer->findStartupTime(); - assertedDateTime = assertedDateTime.addSecs(22); - assertedDateTime = assertedDateTime.addMSecs(232); - - testUtil.testLine( - logLines.at(0), - logFiles.at(0).url().path(), - Globals::instance()->informationLogLevel(), - assertedDateTime, - items - ); - - testUtil.destroyReader(kernelAnalyzer); -} - -void KernelAnalyzerTest::testSuseDmesg() { - - //Specifical configuration - KSystemLogConfig::setMaxLines(1000); - KSystemLogConfig::setDeleteDuplicatedLines(false); - - LogMode* logMode = Globals::instance()->findLogMode(QLatin1String("kernelLogMode")); - KernelAnalyzerLocalReader* kernelAnalyzer = new KernelAnalyzerLocalReader(logMode); - LogViewModel* model = testUtil.defineLogViewModel(kernelAnalyzer); - - QVERIFY(kernelAnalyzer); - QVERIFY(model); - - QList logFiles = testUtil.createLogFiles(QLatin1String(KDESRCDIR "/testFiles/kernel/suse.dmesg")); - - kernelAnalyzer->setLogFiles(logFiles); - - kernelAnalyzer->watchLogFiles(true); - - QCOMPARE(model->itemCount(), 23); - QCOMPARE(model->isEmpty(), false); - - QList logLines = model->logLines(); - - QStringList items = QStringList() << QLatin1String("r8169") << QLatin1String("eth0: link down"); - - testUtil.testLine( - logLines.at(0), - logFiles.at(0).url().path(), - Globals::instance()->informationLogLevel(), - kernelAnalyzer->findStartupTime(), - items - ); - - testUtil.destroyReader(kernelAnalyzer); -} - - -QTEST_KDEMAIN(KernelAnalyzerTest, GUI) - -#include "kernelAnalyzerTest.moc" diff --git a/ksystemlog/tests/kioLogFileReaderTest.cpp b/ksystemlog/tests/kioLogFileReaderTest.cpp deleted file mode 100644 index c498bf85..00000000 --- a/ksystemlog/tests/kioLogFileReaderTest.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** - * 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 - -#include -#include - -#include "logFile.h" -#include "kioLogFileReader.h" - -#include "testUtil.h" - -#include "logging.h" - -class KioLogFileReaderTest: public QObject { - - Q_OBJECT - -private slots: - - void initTestCase(); - - void testKioLogFileReader(); - - void readLine(const QString& line); - -private: - TestUtil testUtil; - -}; - - -void KioLogFileReaderTest::initTestCase() { - logDebug() << "Hello"; -} - - -void KioLogFileReaderTest::testKioLogFileReader() { - /* - QList logFiles = testUtil.createLogFiles(KDESRCDIR "/logs/logFileReader/file.txt"); - LogFile logFile = logFiles.first(); - */ - - ///home/nicolas/test.txt - LogFile logFile(KUrl("http://localhost/test.txt"), Globals::instance()->informationLogLevel()); - - KioLogFileReader* logFileReader = new KioLogFileReader(logFile); - - logFileReader->open(); - - - connect(logFileReader, SIGNAL(lineRead(QString)), this, SLOT(readLine(QString))); - - QTest::qWait(100000); - - - -} - -void KioLogFileReaderTest::readLine(const QString& line) { - logDebug() << "Line " << line; -} - -QTEST_KDEMAIN(KioLogFileReaderTest, GUI) - -#include "kioLogFileReaderTest.moc" diff --git a/ksystemlog/tests/logModeFactoryTest.cpp b/ksystemlog/tests/logModeFactoryTest.cpp deleted file mode 100644 index 607df8fb..00000000 --- a/ksystemlog/tests/logModeFactoryTest.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/*************************************************************************** - * 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 -#include - -#include "testUtil.h" - -#include "analyzer.h" -#include "globals.h" - -#include "logLevel.h" -#include "logMode.h" -#include "logFile.h" -#include "logViewModel.h" -#include "logViewWidget.h" - -#include "logging.h" - -class LogModeFactoryTest: public QObject { - - Q_OBJECT - -private slots: - - void initTestCase(); - - void testLogModes(); - - void testReaderFactory(); -private: - TestUtil testUtil; - -}; - - -void LogModeFactoryTest::initTestCase() { - testUtil.registerLogModeFactories(); -} - - -void LogModeFactoryTest::testLogModes() { - - LogMode* systemLogMode = Globals::instance()->findLogMode(QLatin1String("systemLogMode")); - QVERIFY(systemLogMode); - - QCOMPARE(systemLogMode->id(), QString::fromLatin1("systemLogMode")); - -} - -void LogModeFactoryTest::testReaderFactory() { - LogViewModel* model = NULL; - Analyzer* systemAnalyzer = testUtil.createAnalyzer(QLatin1String("systemLogMode"), &model); - - QVERIFY(systemAnalyzer); - QVERIFY(model); - - -} - -QTEST_KDEMAIN(LogModeFactoryTest, GUI) - -#include "logModeFactoryTest.moc" diff --git a/ksystemlog/tests/systemAnalyzerTest.cpp b/ksystemlog/tests/systemAnalyzerTest.cpp deleted file mode 100644 index d0ed0e84..00000000 --- a/ksystemlog/tests/systemAnalyzerTest.cpp +++ /dev/null @@ -1,365 +0,0 @@ -/*************************************************************************** - * 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 -#include -#include - -#include - -#include -#include - -#include "testUtil.h" - -#include "analyzer.h" -#include "globals.h" - -#include "logLevel.h" -#include "logFile.h" -#include "logViewModel.h" -#include "logViewWidget.h" - -#include "ksystemlogConfig.h" - -#include "logging.h" - -class SystemAnalyzerTest : public QObject { - - Q_OBJECT - -private slots: - - void initTestCase(); - - void testMultipleLines(); - void testOneLine(); - void testTwoLines(); - void testStrangeLines(); - - void testDeleteProcessIdentifier(); - void testMaxLines(); - void testRemoveDuplicates(); - -private: - void compareWithMinTime(QList lines, const QDateTime& minTime); - -private: - TestUtil testUtil; - -}; - -void SystemAnalyzerTest::initTestCase() { - testUtil.registerLogModeFactories(); -} - -void SystemAnalyzerTest::testOneLine() { - - LogViewModel* model= NULL; - - Analyzer* systemAnalyzer = testUtil.createAnalyzer(QLatin1String("systemLogMode"), &model); - QVERIFY(systemAnalyzer); - QVERIFY(model); - - QList logFiles = testUtil.createLogFiles(QLatin1String(KDESRCDIR "/testFiles/default/one-line.log")); - - systemAnalyzer->setLogFiles(logFiles); - - systemAnalyzer->watchLogFiles(true); - - QCOMPARE(model->itemCount(), 1); - QCOMPARE(model->isEmpty(), false); - - QList logLines = model->logLines(); - - QStringList items = QStringList() << QLatin1String("localhost") << QLatin1String("kernel") << QLatin1String("[11663.656000] eth1: no IPv6 routers present"); - - const int year = QDate::currentDate().year(); - testUtil.testLine(logLines.at(0), logFiles.at(0).url().path(), logFiles.at(0).defaultLogLevel(), QDateTime(QDate(year, 8, 21), QTime(22, 52, 44)), items - - ); - - testUtil.destroyReader(systemAnalyzer); -} - -void SystemAnalyzerTest::testTwoLines() { - - LogViewModel* model= NULL; - - Analyzer* systemAnalyzer = testUtil.createAnalyzer(QLatin1String("systemLogMode"), &model); - QVERIFY(systemAnalyzer); - QVERIFY(model); - - //Specifical configuration - KSystemLogConfig::setMaxLines(1000); - - QList logFiles = testUtil.createLogFiles(QLatin1String(KDESRCDIR "/testFiles/default/two-lines.log")); - - systemAnalyzer->setLogFiles(logFiles); - - systemAnalyzer->watchLogFiles(true); - - QCOMPARE(model->itemCount(), 2); - QCOMPARE(model->isEmpty(), false); - - testUtil.destroyReader(systemAnalyzer); -} - -void SystemAnalyzerTest::testMultipleLines() { - LogViewModel* model= NULL; - - Analyzer* systemAnalyzer = testUtil.createAnalyzer(QLatin1String("systemLogMode"), &model); - QVERIFY(systemAnalyzer); - QVERIFY(model); - - //Specifical configuration - KSystemLogConfig::setMaxLines(1000); - - QList logFiles = testUtil.createLogFiles(QLatin1String(KDESRCDIR "/testFiles/system/system.log")); - LogFile logFile = logFiles.at(0); - - systemAnalyzer->setLogFiles(logFiles); - - - QSignalSpy stateSpy(systemAnalyzer, SIGNAL(logUpdated(int))); - QList arguments; - - //Each watching relaunch a reading - systemAnalyzer->watchLogFiles(true); - - //Assert that the model has been updated - QCOMPARE(model->itemCount(), 24); - - //Assert that the logUpdated signal emits the right count - QCOMPARE(stateSpy.count(), 1); - arguments = stateSpy.takeFirst(); - QCOMPARE(arguments.at(0).toInt(), 24); - - //Each watching relaunch a reading - systemAnalyzer->watchLogFiles(true); - - //Assert that the model has been updated - QCOMPARE(model->itemCount(), 48); - - //Assert that the logUpdated signal emits the right count - QCOMPARE(stateSpy.count(), 1); - arguments = stateSpy.takeFirst(); - QCOMPARE(arguments.at(0).toInt(), 24); - - QStringList addedLines; - addedLines << QLatin1String("Aug 18 17:04:28 localhost test: Test line 1"); - addedLines << QLatin1String("Aug 18 17:04:30 localhost test: Test line 2"); - - testUtil.addLogLines(logFile.url().path(), addedLines); - - //Assert that the model has been updated - QCOMPARE(model->itemCount(), 50); - - //Assert that the logUpdated signal emits the right count - QCOMPARE(stateSpy.count(), 1); - arguments = stateSpy.takeFirst(); - QCOMPARE(arguments.at(0).toInt(), 2); - - testUtil.destroyReader(systemAnalyzer); -} - -void SystemAnalyzerTest::testStrangeLines() { - LogViewModel* model= NULL; - - Analyzer* systemAnalyzer = testUtil.createAnalyzer(QLatin1String("systemLogMode"), &model); - QVERIFY(systemAnalyzer); - QVERIFY(model); - - //Specifical configuration - KSystemLogConfig::setMaxLines(1000); - KSystemLogConfig::setDeleteProcessIdentifier(false); - - QList logFiles = testUtil.createLogFiles(QLatin1String(KDESRCDIR "/testFiles/system/strange-lines.log")); - - systemAnalyzer->setLogFiles(logFiles); - - systemAnalyzer->watchLogFiles(true); - - QCOMPARE(model->itemCount(), 8); - - //i18n("undefined") - QString undefined = QLatin1String(""); - - QStringList items; - - const int year = QDate::currentDate().year(); - QSKIP("This test/code is broken", SkipAll); - - //Classical log line - items = QStringList() << QLatin1String("localhost") << QLatin1String("kernel") << QLatin1String("Kernel panic"); - testUtil.testLine(model->logLines().at(0), logFiles.at(0).url().path(), logFiles.at(0).defaultLogLevel(), QDateTime(QDate(year, 8, 10), QTime(17, 04, 28)), items); - - //-- MARK -- log line - items = QStringList() << QLatin1String("localhost") << QLatin1String("syslog") << QLatin1String("-- MARK --"); - testUtil.testLine(model->logLines().at(1), logFiles.at(0).url().path(), logFiles.at(0).defaultLogLevel(), QDateTime(QDate(year, 8, 11), QTime(13, 49, 38)), items); - - //Last message repeated n time log line - items = QStringList() << QLatin1String("localhost") << QLatin1String("syslog") << QLatin1String("last message repeated 4 times"); - testUtil.testLine(model->logLines().at(2), logFiles.at(0).url().path(), logFiles.at(0).defaultLogLevel(), QDateTime(QDate(year, 8, 12), QTime(18, 10, 32)), items); - - //"Aug 13 17:04:28 testprocess: Say ouhou " -> No host name - items = QStringList() << undefined << QLatin1String("testprocess") << QLatin1String("Say ouhou "); - testUtil.testLine(model->logLines().at(3), logFiles.at(0).url().path(), logFiles.at(0).defaultLogLevel(), QDateTime(QDate(year, 8, 13), QTime(17, 04, 28)), items); - - //"Aug 14 17:04:28 localhost kernel say ouhou" -> No process name and not a syslog message - items = QStringList() << QLatin1String("localhost") << undefined << QLatin1String("kernel say ouhou"); - testUtil.testLine(model->logLines().at(4), logFiles.at(0).url().path(), logFiles.at(0).defaultLogLevel(), QDateTime(QDate(year, 8, 14), QTime(17, 04, 28)), items); - - //"Aug 15 22:39:01 localhost /USR/SBIN/CRON[9433]: (root) CMD ( [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -r -0 rm)" -> Long log line - items = QStringList() << QLatin1String("localhost") << QLatin1String("/USR/SBIN/CRON[9433]") - << QLatin1String("(root) CMD ( [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -r -0 rm)"); - testUtil.testLine(model->logLines().at(5), logFiles.at(0).url().path(), logFiles.at(0).defaultLogLevel(), QDateTime(QDate(year, 8, 15), QTime(22, 39, 01)), items); - - //"blablalbla" -> Invalid line - items = QStringList() << undefined << undefined << QLatin1String(""); - QCOMPARE(model->logLines().at(6)->logItems(), items); - - //"" -> Empty line - items = QStringList() << undefined << undefined << QLatin1String("blablalbla"); - QCOMPARE(model->logLines().at(7)->logItems(), items); - - testUtil.destroyReader(systemAnalyzer); -} - -void SystemAnalyzerTest::testDeleteProcessIdentifier() { - LogViewModel* model= NULL; - - Analyzer* systemAnalyzer = testUtil.createAnalyzer(QLatin1String("systemLogMode"), &model); - QVERIFY(systemAnalyzer); - QVERIFY(model); - - //Specifical configuration - KSystemLogConfig::setMaxLines(1000); - KSystemLogConfig::setDeleteProcessIdentifier(true); - - QList logFiles = testUtil.createLogFiles(QLatin1String(KDESRCDIR "/testFiles/system/delete-process-identifier.log")); - - systemAnalyzer->setLogFiles(logFiles); - - systemAnalyzer->watchLogFiles(true); - - QCOMPARE(model->itemCount(), 2); - - QStringList items; - - //Cron log line - items = QStringList() << QLatin1String("localhost") << QLatin1String("/USR/SBIN/CRON") << QLatin1String("Hello"); - QCOMPARE(model->logLines().at(0)->logItems(), items); - - //"f" process - items = QStringList() << QLatin1String("localhost") << QLatin1String("f") <logLines().at(1)->logItems(), items); - - testUtil.destroyReader(systemAnalyzer); -} - -void SystemAnalyzerTest::testMaxLines() { - LogViewModel* model= NULL; - - Analyzer* systemAnalyzer = testUtil.createAnalyzer(QLatin1String("systemLogMode"), &model); - QVERIFY(systemAnalyzer); - QVERIFY(model); - - //Specifical configuration - KSystemLogConfig::setMaxLines(5); - - QList logFiles = testUtil.createLogFiles(QLatin1String(KDESRCDIR "/testFiles/system/max-lines.log")); - LogFile logFile = logFiles.at(0); - - systemAnalyzer->setLogFiles(logFiles); - - systemAnalyzer->watchLogFiles(true); - - QCOMPARE(model->itemCount(), 5); - - //Asserts that there is no line before the oldest one's time - compareWithMinTime(model->logLines(), QDateTime(QDate(2007, 8, 18), QTime(11, 0, 0))); - - QStringList addedLines; - - addedLines << QLatin1String("Aug 18 10:00:00 localhost test: Line 8"); - testUtil.addLogLines(logFile.url().path(), addedLines); - - QCOMPARE(model->itemCount(), 5); - compareWithMinTime(model->logLines(), QDateTime(QDate(2007, 8, 18), QTime(11, 0, 0))); - - //Specifical configuration - KSystemLogConfig::setMaxLines(6); - - addedLines.clear(); - addedLines << QLatin1String("Aug 18 10:00:00 localhost test: Line 9"); - addedLines << QLatin1String("Aug 18 19:00:00 localhost test: Line 10"); - testUtil.addLogLines(logFile.url().path(), addedLines); - - QCOMPARE(model->itemCount(), 6); - compareWithMinTime(model->logLines(), QDateTime(QDate(2007, 8, 18), QTime(11, 0, 0))); - - addedLines.clear(); - addedLines << QLatin1String("Aug 18 20:00:00 localhost test: Line 11"); - addedLines << QLatin1String("Aug 18 21:00:00 localhost test: Line 12"); - testUtil.addLogLines(logFile.url().path(), addedLines); - - QCOMPARE(model->itemCount(), 6); - compareWithMinTime(model->logLines(), QDateTime(QDate(2007, 8, 18), QTime(13, 0, 0))); - - testUtil.destroyReader(systemAnalyzer); -} - -void SystemAnalyzerTest::compareWithMinTime(QList logLines, const QDateTime& minTime) { - logDebug() << "Min time : " << minTime.toString(); - - foreach (LogLine* logLine, logLines) { - if (logLine->time() < minTime) { - QFAIL( QString::fromLatin1("The line '%1' has a lesser time than the required min time (%2)").arg(logLine->logItems().join(QLatin1String(" "))).arg(logLine->time().toString()).toUtf8() ); - } - } - -} - -void SystemAnalyzerTest::testRemoveDuplicates() { - LogViewModel* model= NULL; - - Analyzer* systemAnalyzer = testUtil.createAnalyzer(QLatin1String("systemLogMode"), &model); - QVERIFY(systemAnalyzer); - QVERIFY(model); - - //Specifical configuration - KSystemLogConfig::setMaxLines(1000); - KSystemLogConfig::setDeleteDuplicatedLines(true); - - QList logFiles = testUtil.createLogFiles(QLatin1String(KDESRCDIR "/testFiles/system/duplicate-lines.log")); - - systemAnalyzer->setLogFiles(logFiles); - - systemAnalyzer->watchLogFiles(true); - - QCOMPARE(model->itemCount(), 5); -} - - -QTEST_KDEMAIN(SystemAnalyzerTest, GUI) - -#include "systemAnalyzerTest.moc" diff --git a/ksystemlog/tests/testFiles/apache/access.log b/ksystemlog/tests/testFiles/apache/access.log deleted file mode 100644 index b49a2e79..00000000 --- a/ksystemlog/tests/testFiles/apache/access.log +++ /dev/null @@ -1,19 +0,0 @@ -127.0.0.1 - - [11/Sep/2007:07:52:25 +0200] "GET /favicon.ico HTTP/1.1" 404 318 "-" "Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.7 (like Gecko)" -127.0.0.1 - - [11/Sep/2007:07:52:25 +0200] "GET /favicon.ico HTTP/1.1" 404 318 "-" "Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.7 (like Gecko)" -::1 - - [11/Sep/2007:07:53:02 +0200] "GET / HTTP/1.0" 200 1128 "-" "Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu5 (internal dummy connection)" -::1 - - [11/Sep/2007:07:53:02 +0200] "GET / HTTP/1.0" 200 1128 "-" "Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu5 (internal dummy connection)" -::1 - - [11/Sep/2007:07:53:02 +0200] "GET / HTTP/1.0" 200 1128 "-" "Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu5 (internal dummy connection)" -::1 - - [11/Sep/2007:07:53:02 +0200] "GET / HTTP/1.0" 200 1128 "-" "Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu5 (internal dummy connection)" -::1 - - [11/Sep/2007:07:53:02 +0200] "GET / HTTP/1.0" 200 1128 "-" "Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu5 (internal dummy connection)" -::1 - - [11/Sep/2007:07:53:02 +0200] "GET / HTTP/1.0" 200 1128 "-" "Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu5 (internal dummy connection)" -::1 - - [11/Sep/2007:07:53:02 +0200] "GET / HTTP/1.0" 200 1128 "-" "Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu5 (internal dummy connection)" -::1 - - [11/Sep/2007:07:53:02 +0200] "GET / HTTP/1.0" 200 1128 "-" "Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu5 (internal dummy connection)" -127.0.0.1 - - [11/Sep/2007:07:53:56 +0200] "GET / HTTP/1.0" 200 1130 "-" "Wget/1.10.2" -127.0.0.1 - - [11/Sep/2007:07:54:48 +0200] "GET /file.txt HTTP/1.1" 200 219 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20070827 Ubuntu/7.10 (gutsy) Firefox/2.0.0.6" -127.0.0.1 - - [11/Sep/2007:07:54:48 +0200] "GET /favicon.ico HTTP/1.1" 404 318 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20070827 Ubuntu/7.10 (gutsy) Firefox/2.0.0.6" -::1 - - [11/Sep/2007:09:00:20 +0200] "GET / HTTP/1.0" 200 1308 "-" "Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu5 (internal dummy connection)" -::1 - - [11/Sep/2007:09:00:20 +0200] "GET / HTTP/1.0" 200 1308 "-" "Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu5 (internal dummy connection)" -::1 - - [11/Sep/2007:09:00:20 +0200] "GET / HTTP/1.0" 200 1308 "-" "Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu5 (internal dummy connection)" -::1 - - [11/Sep/2007:09:00:20 +0200] "GET / HTTP/1.0" 200 1308 "-" "Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu5 (internal dummy connection)" -::1 - - [11/Sep/2007:09:00:20 +0200] "GET / HTTP/1.0" 200 1308 "-" "Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu5 (internal dummy connection)" -::1 - - [11/Sep/2007:09:00:20 +0200] "GET / HTTP/1.0" 200 1308 "-" "Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu5 (internal dummy connection)" diff --git a/ksystemlog/tests/testFiles/apache/error.log b/ksystemlog/tests/testFiles/apache/error.log deleted file mode 100644 index cdb1a0f3..00000000 --- a/ksystemlog/tests/testFiles/apache/error.log +++ /dev/null @@ -1,34 +0,0 @@ -PHP Warning: Module 'PDO' already loaded in Unknown on line 0 -PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0 -[Sun Sep 02 06:25:34 2007] [notice] Apache/2.2.3 (Ubuntu) mod_jk/1.2.18 PHP/5.2.1 configured -- resuming normal operations -[Mon Sep 03 09:48:06 2007] [error] [client 192.168.2.209] File does not exist: /home/www/favicon.ico -[Sun Sep 16 07:35:19 2007] [notice] Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu5 configured -- resuming normal operations -[Tue Sep 18 13:32:21 2007] [notice] caught SIGWINCH, shutting down gracefully -[Tue Sep 18 13:33:15 2007] [notice] Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu5 configured -- resuming normal operations -[Tue Sep 18 17:08:35 2007] [error] [client 127.0.0.1] File does not exist: /var/www/timeout.ph -[Tue Sep 18 17:08:36 2007] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico -[Tue Sep 18 17:08:39 2007] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico -[Tue Sep 18 17:08:40 2007] [error] [client 127.0.0.1] File does not exist: /var/www/timeout.phop -[Wed Sep 19 10:00:19 2007] [notice] caught SIGWINCH, shutting down gracefully -[Wed Sep 19 10:01:34 2007] [notice] Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu5 configured -- resuming normal operations -[Wed Sep 19 10:02:37 2007] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico -[Wed Sep 19 10:02:37 2007] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico -[Wed Sep 19 10:35:22 2007] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico -[Wed Sep 19 10:40:28 2007] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico -[Wed Sep 19 10:54:47 2007] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico -[Wed Sep 19 10:57:22 2007] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico -[Wed Sep 19 10:58:48 2007] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico -[Wed Sep 19 10:59:31 2007] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico -[Wed Sep 19 12:06:07 2007] [notice] caught SIGWINCH, shutting down gracefully -[Wed Sep 19 12:06:18 2007] [notice] Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu5 configured -- resuming normal operations -[Wed Sep 19 12:06:33 2007] [error] [client 127.0.0.1] client denied by server configuration: /var/www/sdf -[Wed Sep 19 12:06:38 2007] [error] [client 127.0.0.1] client denied by server configuration: /var/www/timeout.php -[Wed Sep 19 12:06:42 2007] [error] [client 127.0.0.1] client denied by server configuration: /var/www/timeout-flusher.php -[Wed Sep 19 12:07:50 2007] [alert] [client 127.0.0.1] /var/www/.htaccess: Invalid command 'mod_gzip_on', perhaps misspelled or defined by a module not included in the server configuration -[Wed Sep 19 12:07:52 2007] [alert] [client 127.0.0.1] /var/www/.htaccess: Invalid command 'mod_gzip_on', perhaps misspelled or defined by a module not included in the server configuration -[Wed Sep 19 12:07:56 2007] [alert] [client 127.0.0.1] /var/www/.htaccess: Invalid command 'mod_gzip_on', perhaps misspelled or defined by a module not included in the server configuration -[Wed Sep 19 12:07:57 2007] [alert] [client 127.0.0.1] /var/www/.htaccess: Invalid command 'mod_gzip_on', perhaps misspelled or defined by a module not included in the server configuration -[Wed Sep 19 12:07:58 2007] [alert] [client 127.0.0.1] /var/www/.htaccess: Invalid command 'mod_gzip_on', perhaps misspelled or defined by a module not included in the server configuration -[Wed Sep 19 12:07:58 2007] [alert] [client 127.0.0.1] /var/www/.htaccess: Invalid command 'mod_gzip_on', perhaps misspelled or defined by a module not included in the server configuration -[Wed Sep 19 12:07:59 2007] [alert] [client 127.0.0.1] /var/www/.htaccess: Invalid command 'mod_gzip_on', perhaps misspelled or defined by a module not included in the server configuration -[Wed Sep 19 12:07:59 2007] [alert] [client 127.0.0.1] /var/www/.htaccess: Invalid command 'mod_gzip_on', perhaps misspelled or defined by a module not included in the server configuration diff --git a/ksystemlog/tests/testFiles/cups/access_log b/ksystemlog/tests/testFiles/cups/access_log deleted file mode 100644 index cb31d87f..00000000 --- a/ksystemlog/tests/testFiles/cups/access_log +++ /dev/null @@ -1,233 +0,0 @@ -localhost - - [14/Sep/2007:12:12:34 +0200] "POST / HTTP/1.1" 200 419 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:12:13:03 +0200] "POST / HTTP/1.1" 200 419 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:12:13:30 +0200] "POST / HTTP/1.1" 200 419 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:12:14:03 +0200] "POST / HTTP/1.1" 200 419 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:12:14:17 +0200] "POST / HTTP/1.1" 200 419 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:12:05 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:12:08 +0200] "GET /ppd/HPLaserJet4100.ppd HTTP/1.1" 200 21119 - - -localhost - - [14/Sep/2007:15:12:08 +0200] "POST /printers/HPLaserJet4100 HTTP/1.1" 200 2308742 Print-Job successful-ok -localhost - - [14/Sep/2007:15:12:09 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:12:09 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:12:09 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:12:09 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:12:14 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:12:14 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:12:19 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes ignored -localhost - - [14/Sep/2007:15:12:19 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs ignored -localhost - - [14/Sep/2007:15:12:24 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes substituted-attributes -localhost - - [14/Sep/2007:15:12:24 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs substituted-attributes -localhost - - [14/Sep/2007:15:12:29 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes - -localhost - - [14/Sep/2007:15:12:29 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs - -localhost - - [14/Sep/2007:15:12:34 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:12:34 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:12:39 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:12:39 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:12:44 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:12:44 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:12:49 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:12:49 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:12:54 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:12:54 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:12:59 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:12:59 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:13:04 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:13:04 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:13:09 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:13:09 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:13:14 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:13:14 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:13:19 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:13:19 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:13:24 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:13:24 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:13:29 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:13:29 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:13:34 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:13:34 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:13:39 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:13:39 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:13:44 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:13:44 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:13:49 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:13:49 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:13:54 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:13:54 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:13:59 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:13:59 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:14:04 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:14:04 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:14:09 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:14:09 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:14:14 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:14:14 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:14:19 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:14:19 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:14:24 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:14:24 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:14:29 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:14:29 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:14:34 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:14:34 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:14:39 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:14:39 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:14:44 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:14:44 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:14:49 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:14:49 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:14:54 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:14:54 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:20:19 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:20:21 +0200] "GET /ppd/HPLaserJet4100.ppd HTTP/1.1" 200 21119 - - -localhost - - [14/Sep/2007:15:20:21 +0200] "POST /printers/HPLaserJet4100 HTTP/1.1" 200 2306438 Print-Job successful-ok -localhost - - [14/Sep/2007:15:20:22 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:20:22 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:20:22 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:20:22 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:20:27 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:20:27 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:20:32 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:20:32 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:20:37 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:20:37 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:20:42 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:20:42 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:20:47 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:20:47 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:20:52 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:20:52 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:20:57 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:20:57 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:21:02 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:21:02 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:21:07 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:21:07 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:21:12 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:21:12 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:21:17 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:21:17 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:21:22 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:21:22 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:21:27 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:21:27 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:21:32 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:21:32 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:21:37 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:21:37 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:21:42 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:21:42 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:21:47 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:21:47 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:21:52 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:21:52 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:21:57 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:21:57 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:22:02 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:22:02 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:22:07 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:22:07 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:22:12 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:22:12 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:22:17 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:22:17 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:22:22 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:22:22 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:22:27 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:22:27 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:22:32 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:22:32 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:22:37 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:22:37 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:22:42 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:22:42 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:22:47 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:22:47 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:22:52 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:22:52 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:22:57 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:22:57 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:23:02 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:23:02 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:23:07 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:23:07 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:23:12 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:23:12 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:23:17 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:23:17 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:23:22 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:23:22 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:23:27 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:23:27 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:23:32 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:23:32 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:23:37 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:23:37 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:23:42 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:23:42 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:23:47 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:23:47 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:23:52 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:23:52 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:23:57 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:23:57 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:24:02 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:24:02 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:24:07 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:24:07 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:24:12 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:24:12 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:24:17 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:24:17 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:24:22 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:24:22 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:24:27 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:24:27 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:24:32 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:24:32 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:24:37 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:24:37 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:24:42 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:24:42 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:24:47 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:24:47 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:24:52 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:24:52 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:24:57 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:24:57 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:25:02 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:25:02 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:25:07 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:25:07 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:25:12 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:25:12 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:25:17 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:25:17 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:25:22 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:25:22 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:25:27 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:25:27 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:25:32 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:25:32 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:25:37 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:25:37 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:25:42 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:25:42 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:25:47 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:25:47 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:25:52 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:25:52 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:25:57 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:25:57 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:26:02 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:26:02 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:26:07 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:26:07 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:26:12 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:26:12 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:26:17 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:26:17 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:26:22 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:26:22 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:26:27 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:26:27 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok -localhost - - [14/Sep/2007:15:26:32 +0200] "POST /classes/ HTTP/1.1" 200 221 CUPS-Get-Classes successful-ok -localhost - - [14/Sep/2007:15:26:32 +0200] "POST / HTTP/1.1" 200 380 Get-Jobs successful-ok diff --git a/ksystemlog/tests/testFiles/cups/cups-pdf_log b/ksystemlog/tests/testFiles/cups/cups-pdf_log deleted file mode 100644 index d791e82b..00000000 --- a/ksystemlog/tests/testFiles/cups/cups-pdf_log +++ /dev/null @@ -1,26 +0,0 @@ -Thu Jun 14 21:00:38 2007 [STATUS] directory created (/pdf) -Thu Jun 14 21:00:38 2007 [ERROR] failed to set file mode for PDF file (non fatal) (/pdf/Test_Page. -Thu Jun 14 21:00:38 2007 [STATUS] PDF creation successfully finished (root) -Thu Jun 14 21:00:55 2007 [ERROR] failed to set file mode for PDF file (non fatal) (/pdf/Test_Page. -Thu Jun 14 21:00:55 2007 [STATUS] PDF creation successfully finished (root) -Thu Jun 14 12:38:14 2007 [STATUS] identification string sent -Thu Jun 14 12:38:14 2007 [STATUS] identification string sent -Thu Jun 14 12:40:35 2007 [STATUS] identification string sent -Thu Jun 14 12:40:35 2007 [STATUS] identification string sent -Thu Jun 14 12:43:07 2007 [ERROR] failed to set file mode for PDF file (non fatal) (/var/spool/cups-pdf/root/Test_Page.pdf) -Thu Jun 14 12:43:07 2007 [STATUS] PDF creation successfully finished (root) -Thu Jun 14 12:48:36 2007 [ERROR] failed to set file mode for PDF file (non fatal) (/var/spool/cups-pdf/ANONYMOUS/Test_Page.pdf -Thu Jun 14 12:48:36 2007 [STATUS] PDF creation successfully finished (nobody) -Fri Sep 30 21:58:37 2005 [ERROR] failed to create spool directory (/var/spool/cups-pdf/SPOOL) -Fri Sep 30 22:31:46 2005 [ERROR] failed to create spool directory (/var/spool/cups-pdf/SPOOL) -Fri Sep 30 22:35:11 2005 [ERROR] failed to create spool directory (/var/spool/cups-pdf/SPOOL) -Sat Oct 1 09:11:45 2005 [ERROR] failed to create spool directory (/var/spool/cups-pdf/SPOOL) -Sat Oct 1 09:16:42 2005 [ERROR] failed to create spool directory (/var/spool/cups-pdf/SPOOL) -Sat Oct 1 09:21:16 2005 [ERROR] failed to create spool directory (/var/spool/cups-pdf/SPOOL) -Sat Oct 1 12:12:17 2005 [ERROR] failed to create spool directory (/var/spool/cups-pdf/SPOOL) -Sat Oct 1 12:18:50 2005 [ERROR] failed to create spool directory (/var/spool/cups-pdf/SPOOL) -Sat Oct 1 12:30:53 2005 [ERROR] failed to create spool directory (/var/spool/cups-pdf/SPOOL) -Sat Oct 1 16:31:29 2005 [ERROR] failed to create spool directory (/var/spool/cups-pdf/SPOOL) -Sun Oct 2 12:07:19 2005 [STATUS] identification string sent -Sun Oct 2 13:15:56 2005 [STATUS] identification string sent -Sun Oct 2 13:49:33 2005 [STATUS] identification string sent \ No newline at end of file diff --git a/ksystemlog/tests/testFiles/cups/error_log b/ksystemlog/tests/testFiles/cups/error_log deleted file mode 100644 index 26de0487..00000000 --- a/ksystemlog/tests/testFiles/cups/error_log +++ /dev/null @@ -1,4 +0,0 @@ -E [29/Jun/2007:11:39:56 +0200] Creating missing directory "/var/run/cups/certs" -I [20/May/1999:19:18:28 +0000] Job 1 queued on 'DeskJet' by 'mike'. -I [20/May/1999:19:21:02 +0000] Job 2 queued on 'DeskJet' by 'mike'. -I [20/May/1999:19:22:24 +0000] Job 2 was cancelled by 'mike'. \ No newline at end of file diff --git a/ksystemlog/tests/testFiles/cups/page_log b/ksystemlog/tests/testFiles/cups/page_log deleted file mode 100644 index 70b204f3..00000000 --- a/ksystemlog/tests/testFiles/cups/page_log +++ /dev/null @@ -1,3 +0,0 @@ -DeskJet root 2 [20/May/1999:19:21:05 +0000] 1 1 acme-123 -DeskJet root 2 [20/May/1999:19:21:05 +0000] 2 1 acme-123 - diff --git a/ksystemlog/tests/testFiles/default/one-line.log b/ksystemlog/tests/testFiles/default/one-line.log deleted file mode 100644 index e0c928e3..00000000 --- a/ksystemlog/tests/testFiles/default/one-line.log +++ /dev/null @@ -1 +0,0 @@ -Aug 21 22:52:44 localhost kernel: [11663.656000] eth1: no IPv6 routers present \ No newline at end of file diff --git a/ksystemlog/tests/testFiles/default/two-lines.log b/ksystemlog/tests/testFiles/default/two-lines.log deleted file mode 100644 index 7daf2a76..00000000 --- a/ksystemlog/tests/testFiles/default/two-lines.log +++ /dev/null @@ -1,2 +0,0 @@ -Aug 21 22:52:44 localhost kernel: [11663.656000] eth1: no IPv6 routers present -Aug 21 22:53:44 localhost kernel: [11663.656000] eth0: no IPv6 routers present again... \ No newline at end of file diff --git a/ksystemlog/tests/testFiles/kernel/suse.dmesg b/ksystemlog/tests/testFiles/kernel/suse.dmesg deleted file mode 100644 index 438fdae1..00000000 --- a/ksystemlog/tests/testFiles/kernel/suse.dmesg +++ /dev/null @@ -1,23 +0,0 @@ -r8169: eth0: link down -NET: Registered protocol family 10 -lo: Disabled Privacy Extensions -ADDRCONF(NETDEV_UP): eth0: link is not ready -ADDRCONF(NETDEV_UP): eth1: link is not ready -ppdev: user-space parallel port driver -audit(1194102016.839:3): type=1503 operation="inode_permission" requested_mask="a" denied_mask="a" name="/dev/tty" pid=5184 profile="/usr/sbin/cupsd" -apm: BIOS not found. -fglrx: module license 'Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY' taints kernel. -[fglrx] Maximum main memory to use for locked dma buffers: 1414 MBytes. -[fglrx] module loaded - fglrx 8.37.6 [May 25 2007] on minor 0 -ACPI: PCI Interrupt 0000:01:00.0[A] -> GSI 16 (level, low) -> IRQ 16 -Failure registering capabilities with primary security module. -[fglrx] total GART = 130023424 -[fglrx] free GART = 114032640 -[fglrx] max single GART = 114032640 -[fglrx] total LFB = 268304384 -[fglrx] free LFB = 253915136 -[fglrx] max single LFB = 253915136 -[fglrx] total Inv = 0 -[fglrx] free Inv = 0 -[fglrx] max single Inv = 0 -[fglrx] total TIM = 0 diff --git a/ksystemlog/tests/testFiles/kernel/ubuntu.dmesg b/ksystemlog/tests/testFiles/kernel/ubuntu.dmesg deleted file mode 100644 index b40ab9aa..00000000 --- a/ksystemlog/tests/testFiles/kernel/ubuntu.dmesg +++ /dev/null @@ -1,25 +0,0 @@ -[ 22.232000] ADDRCONF(NETDEV_UP): eth0: link is not ready -[ 22.232000] ADDRCONF(NETDEV_UP): eth1: link is not ready -[ 22.636000] ppdev: user-space parallel port driver -[ 23.044000] audit(1194105334.184:3): type=1503 operation="inode_permission" requested_mask="a" denied_mask="a" name="/dev/tty" pid=5172 profile="/usr/sbin/cupsd" -[ 23.116000] apm: BIOS not found. -[ 23.836000] fglrx: module license 'Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY' taints kernel. -[ 23.840000] [fglrx] Maximum main memory to use for locked dma buffers: 1414 MBytes. -[ 23.840000] [fglrx] module loaded - fglrx 8.37.6 [May 25 2007] on minor 0 -[ 23.964000] ACPI: PCI Interrupt 0000:01:00.0[A] -> GSI 16 (level, low) -> IRQ 16 -[ 24.924000] Failure registering capabilities with primary security module. -[ 27.076000] [fglrx] total GART = 130023424 -[ 27.076000] [fglrx] free GART = 114032640 -[ 27.076000] [fglrx] max single GART = 114032640 -[ 27.076000] [fglrx] total LFB = 268304384 -[ 27.076000] [fglrx] free LFB = 253915136 -[ 27.076000] [fglrx] max single LFB = 253915136 -[ 27.076000] [fglrx] total Inv = 0 -[ 27.076000] [fglrx] free Inv = 0 -[ 27.076000] [fglrx] max single Inv = 0 -[ 27.076000] [fglrx] total TIM = 0 -[ 77.252000] NET: Registered protocol family 17 -[ 80.416000] ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready -[ 91.128000] eth1: no IPv6 routers present -[ 96.452000] ieee80211_crypt: registered algorithm 'CCMP' -[ 97.424000] ieee80211_crypt: registered algorithm 'T diff --git a/ksystemlog/tests/testFiles/logFileReader/file.txt b/ksystemlog/tests/testFiles/logFileReader/file.txt deleted file mode 100644 index 04546dc7..00000000 --- a/ksystemlog/tests/testFiles/logFileReader/file.txt +++ /dev/null @@ -1,15 +0,0 @@ -sdf -sdf2 -sdf3 -sdf4 -sdf5 -sdf6 -sdf -TestTestTestTestTestTest1 -TestTestTestTestTestTest2 -TestTestTestTestTestTest4 -TestTestTestTestTestTest3 -TestTestTestTestTestTest5 -TestTestTestTestTestTest6 -TestTestTestTestTestTest7 -sdf diff --git a/ksystemlog/tests/testFiles/mysql/mysql-slow.log b/ksystemlog/tests/testFiles/mysql/mysql-slow.log deleted file mode 100644 index 0b37e44d..00000000 --- a/ksystemlog/tests/testFiles/mysql/mysql-slow.log +++ /dev/null @@ -1,94 +0,0 @@ -/usr/sbin/mysqld, Version: 5.0.45-Debian_1ubuntu2-log (Debian etch distribution). started with: -Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock -Time Id Command Argument -# Time: 070920 11:33:41 -# User@Host: debian-sys-maint[debian-sys-maint] @ localhost [] -# Query_time: 0 Lock_time: 0 Rows_sent: 1 Rows_examined: 4 -SELECT count(*) FROM mysql.user WHERE user='root' and password=''; -# Time: 070920 11:39:28 -# User@Host: root[root] @ localhost [] -# Query_time: 0 Lock_time: 0 Rows_sent: 62 Rows_examined: 62 -use alfresco; -SELECT *, - `TABLE_SCHEMA` AS `Db`, - `TABLE_NAME` AS `Name`, - `ENGINE` AS `Engine`, - `ENGINE` AS `Type`, - `VERSION` AS `Version`, - `ROW_FORMAT` AS `Row_format`, - `TABLE_ROWS` AS `Rows`, - `AVG_ROW_LENGTH` AS `Avg_row_length`, - `DATA_LENGTH` AS `Data_length`, - `MAX_DATA_LENGTH` AS `Max_data_length`, - `INDEX_LENGTH` AS `Index_length`, - `DATA_FREE` AS `Data_free`, - `AUTO_INCREMENT` AS `Auto_increment`, - `CREATE_TIME` AS `Create_time`, - `UPDATE_TIME` AS `Update_time`, - `CHECK_TIME` AS `Check_time`, - `TABLE_COLLATION` AS `Collation`, - `CHECKSUM` AS `Checksum`, - `CREATE_OPTIONS` AS `Create_options`, - `TABLE_COMMENT` AS `Comment` - FROM `information_schema`.`TABLES` - WHERE BINARY `TABLE_SCHEMA` IN ('alfresco'); -# User@Host: root[root] @ localhost [] -# Query_time: 0 Lock_time: 0 Rows_sent: 1 Rows_examined: 2 -SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = 'alfresco' LIMIT 1; -# Time: 070920 11:39:29 -# User@Host: root[root] @ localhost [] -# Query_time: 0 Lock_time: 0 Rows_sent: 62 Rows_examined: 62 -SELECT *, - `TABLE_SCHEMA` AS `Db`, - `TABLE_NAME` AS `Name`, - `ENGINE` AS `Engine`, - `ENGINE` AS `Type`, - `VERSION` AS `Version`, - `ROW_FORMAT` AS `Row_format`, - `TABLE_ROWS` AS `Rows`, - `AVG_ROW_LENGTH` AS `Avg_row_length`, - `DATA_LENGTH` AS `Data_length`, - `MAX_DATA_LENGTH` AS `Max_data_length`, - `INDEX_LENGTH` AS `Index_length`, - `DATA_FREE` AS `Data_free`, - `AUTO_INCREMENT` AS `Auto_increment`, - `CREATE_TIME` AS `Create_time`, - `UPDATE_TIME` AS `Update_time`, - `CHECK_TIME` AS `Check_time`, - `TABLE_COLLATION` AS `Collation`, - `CHECKSUM` AS `Checksum`, - `CREATE_OPTIONS` AS `Create_options`, - `TABLE_COMMENT` AS `Comment` - FROM `information_schema`.`TABLES` - WHERE BINARY `TABLE_SCHEMA` IN ('alfresco'); -# Time: 070920 11:39:31 -# User@Host: root[root] @ localhost [] -# Query_time: 0 Lock_time: 0 Rows_sent: 62 Rows_examined: 62 -SELECT *, - `TABLE_SCHEMA` AS `Db`, - `TABLE_NAME` AS `Name`, - `ENGINE` AS `Engine`, - `ENGINE` AS `Type`, - `VERSION` AS `Version`, - `ROW_FORMAT` AS `Row_format`, - `TABLE_ROWS` AS `Rows`, - `AVG_ROW_LENGTH` AS `Avg_row_length`, - `DATA_LENGTH` AS `Data_length`, - `MAX_DATA_LENGTH` AS `Max_data_length`, - `INDEX_LENGTH` AS `Index_length`, - `DATA_FREE` AS `Data_free`, - `AUTO_INCREMENT` AS `Auto_increment`, - `CREATE_TIME` AS `Create_time`, - `UPDATE_TIME` AS `Update_time`, - `CHECK_TIME` AS `Check_time`, - `TABLE_COLLATION` AS `Collation`, - `CHECKSUM` AS `Checksum`, - `CREATE_OPTIONS` AS `Create_options`, - `TABLE_COMMENT` AS `Comment` - FROM `information_schema`.`TABLES` - WHERE BINARY `TABLE_SCHEMA` IN ('alfresco'); -# Time: 070920 11:39:43 -# User@Host: root[root] @ localhost [] -# Query_time: 0 Lock_time: 0 Rows_sent: 30 Rows_examined: 30 -select * from node - LIMIT 0, 30; diff --git a/ksystemlog/tests/testFiles/mysql/mysql.log b/ksystemlog/tests/testFiles/mysql/mysql.log deleted file mode 100644 index dd6be77b..00000000 --- a/ksystemlog/tests/testFiles/mysql/mysql.log +++ /dev/null @@ -1,194 +0,0 @@ -/usr/sbin/mysqld, Version: 5.0.45-Debian_1ubuntu2-log (Debian etch distribution). started with: -Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock -Time Id Command Argument -070920 11:33:41 1 Connect debian-sys-maint@localhost on - 1 Quit - 2 Connect debian-sys-maint@localhost on - 2 Quit - 3 Connect debian-sys-maint@localhost on - 3 Query show /*!40003 GLOBAL */ variables - 3 Quit - 4 Connect debian-sys-maint@localhost on mysql - 4 Query select @@version_comment limit 1 - 4 Query show variables like 'datadir' - 4 Quit - 5 Connect debian-sys-maint@localhost on - 5 Query select @@version_comment limit 1 - 5 Query SELECT count(*) FROM mysql.user WHERE user='root' and password='' - 5 Quit - 6 Connect debian-sys-maint@localhost on - 6 Query SHOW DATABASES - 6 Init DB alfresco - 6 Query SHOW /*!50002 FULL*/ TABLES -070920 11:33:42 6 Query CHECK TABLE `access_control_entry` FAST - 6 Query CHECK TABLE `access_control_list` FAST - 6 Query CHECK TABLE `applied_patch` FAST - 6 Query CHECK TABLE `auth_ext_keys` FAST - 6 Query CHECK TABLE `authority` FAST - 6 Query CHECK TABLE `child_assoc` FAST - 6 Query CHECK TABLE `gu_adress` FAST - 6 Query CHECK TABLE `gu_banner` FAST - 6 Query CHECK TABLE `gu_bannerclient` FAST - 6 Query CHECK TABLE `gu_bannerfinish` FAST - 6 Query CHECK TABLE `gu_categories` FAST - 6 Query CHECK TABLE `gu_components` FAST - 6 Query CHECK TABLE `gu_contact_details` FAST - 6 Query CHECK TABLE `gu_content` FAST - 6 Query CHECK TABLE `gu_content_frontpage` FAST - 6 Query CHECK TABLE `gu_content_rating` FAST - 6 Query CHECK TABLE `gu_core_acl_aro` FAST - 6 Query CHECK TABLE `gu_core_acl_aro_groups` FAST - 6 Query CHECK TABLE `gu_core_acl_aro_sections` FAST - 6 Query CHECK TABLE `gu_core_acl_groups_aro_map` FAST - 6 Query CHECK TABLE `gu_core_log_items` FAST - 6 Query CHECK TABLE `gu_core_log_searches` FAST - 6 Query CHECK TABLE `gu_extcal_categories` FAST - 6 Query CHECK TABLE `gu_extcal_config` FAST - 6 Query CHECK TABLE `gu_extcal_events` FAST - 6 Query CHECK TABLE `gu_extcal_plugins` FAST - 6 Query CHECK TABLE `gu_gm_edit` FAST - 6 Query CHECK TABLE `gu_gm_editown` FAST - 6 Query CHECK TABLE `gu_gm_groupe` FAST - 6 Query CHECK TABLE `gu_gm_groupeimbrique` FAST - 6 Query CHECK TABLE `gu_gm_membre` FAST - 6 Query CHECK TABLE `gu_gm_publish` FAST - 6 Query CHECK TABLE `gu_groups` FAST - 6 Query CHECK TABLE `gu_letterman` FAST - 6 Query CHECK TABLE `gu_letterman_subscribers` FAST - 6 Query CHECK TABLE `gu_mambots` FAST - 6 Query CHECK TABLE `gu_menu` FAST - 6 Query CHECK TABLE `gu_messages` FAST - 6 Query CHECK TABLE `gu_messages_cfg` FAST - 6 Query CHECK TABLE `gu_modules` FAST - 6 Query CHECK TABLE `gu_modules_menu` FAST - 6 Query CHECK TABLE `gu_newsfeeds` FAST - 6 Query CHECK TABLE `gu_poll_data` FAST - 6 Query CHECK TABLE `gu_poll_date` FAST - 6 Query CHECK TABLE `gu_poll_menu` FAST - 6 Query CHECK TABLE `gu_polls` FAST - 6 Query CHECK TABLE `gu_sections` FAST - 6 Query CHECK TABLE `gu_session` FAST - 6 Query CHECK TABLE `gu_stats_agents` FAST - 6 Query CHECK TABLE `gu_template_positions` FAST - 6 Query CHECK TABLE `gu_templates_menu` FAST - 6 Query CHECK TABLE `gu_users` FAST - 6 Query CHECK TABLE `gu_usertypes` FAST - 6 Query CHECK TABLE `gu_weblinks` FAST - 6 Query CHECK TABLE `node` FAST - 6 Query CHECK TABLE `node_aspects` FAST - 6 Query CHECK TABLE `node_assoc` FAST - 6 Query CHECK TABLE `node_properties` FAST - 6 Query CHECK TABLE `node_status` FAST - 6 Query CHECK TABLE `permission` FAST - 6 Query CHECK TABLE `store` FAST - 6 Query CHECK TABLE `version_count` FAST - 6 Init DB mysql - 6 Query SHOW /*!50002 FULL*/ TABLES - 6 Query CHECK TABLE `columns_priv` FAST - 6 Query CHECK TABLE `db` FAST - 6 Query CHECK TABLE `func` FAST - 6 Query CHECK TABLE `help_category` FAST - 6 Query CHECK TABLE `help_keyword` FAST - 6 Query CHECK TABLE `help_relation` FAST - 6 Query CHECK TABLE `help_topic` FAST - 6 Query CHECK TABLE `host` FAST - 6 Query CHECK TABLE `proc` FAST - 6 Query CHECK TABLE `procs_priv` FAST - 6 Query CHECK TABLE `tables_priv` FAST - 6 Query CHECK TABLE `time_zone` FAST - 6 Query CHECK TABLE `time_zone_leap_second` FAST - 6 Query CHECK TABLE `time_zone_name` FAST - 6 Query CHECK TABLE `time_zone_transition` FAST - 6 Query CHECK TABLE `time_zone_transition_type` FAST - 6 Query CHECK TABLE `user` FAST - 6 Quit -070920 11:37:24 7 Connect root@localhost on - 7 Query SELECT VERSION() - 7 Query SET NAMES utf8 - 7 Query SET collation_connection = 'utf8_unicode_ci' - 7 Query SET NAMES utf8 - 7 Query SET collation_connection = 'utf8_unicode_ci' - 7 Query SHOW SESSION VARIABLES LIKE 'collation_connection' - 7 Query SHOW SESSION VARIABLES LIKE 'character_set_connection' - 7 Query SHOW CHARACTER SET - 7 Query SHOW COLLATION - 7 Query SHOW DATABASES - 7 Quit - 8 Connect root@localhost on - 8 Query SELECT VERSION() - 8 Query SET NAMES utf8 - 8 Query SET collation_connection = 'utf8_unicode_ci' - 8 Query SET NAMES utf8 - 8 Query SET collation_connection = 'utf8_unicode_ci' - 8 Query SHOW SESSION VARIABLES LIKE 'collation_connection' - 8 Query SHOW SESSION VARIABLES LIKE 'character_set_connection' - 8 Query SHOW CHARACTER SET - 8 Query SHOW COLLATION - 8 Query SHOW DATABASES - 8 Query SELECT COUNT(*) FROM mysql.user - 8 Query SELECT COUNT(*) FROM mysql.user - 8 Query SHOW GRANTS - 8 Query SELECT COUNT(*) FROM mysql.user - 8 Query SELECT USER() - 8 Query SHOW MASTER LOGS - 8 Quit - 9 Connect root@localhost on - 9 Query SELECT VERSION() - 9 Query SET NAMES utf8 - 9 Query SET collation_connection = 'utf8_unicode_ci' - 9 Query SET NAMES utf8 - 9 Query SET collation_connection = 'utf8_unicode_ci' - 9 Query SHOW SESSION VARIABLES LIKE 'collation_connection' - 9 Query SHOW SESSION VARIABLES LIKE 'character_set_connection' - 9 Query SHOW CHARACTER SET - 9 Query SHOW COLLATION - 9 Query SHOW DATABASES - 9 Query SHOW TABLES FROM `alfresco` - 9 Query SHOW TABLES FROM `information_schema` - 9 Query SHOW TABLES FROM `mysql` - 9 Quit -070920 11:37:48 10 Connect root@localhost on - 10 Query SELECT VERSION() - 10 Query SET NAMES utf8 - 10 Query SET collation_connection = 'utf8_unicode_ci' - 10 Query SET NAMES utf8 - 10 Query SET collation_connection = 'utf8_unicode_ci' - 10 Query SHOW SESSION VARIABLES LIKE 'collation_connection' - 10 Query SHOW SESSION VARIABLES LIKE 'character_set_connection' - 10 Query SHOW CHARACTER SET - 10 Query SHOW COLLATION - 10 Query SHOW DATABASES - 10 Quit - 11 Connect root@localhost on - 11 Query SELECT VERSION() - 11 Query SET NAMES utf8 - 11 Query SET collation_connection = 'utf8_unicode_ci' - 11 Query SET NAMES utf8 - 11 Query SET collation_connection = 'utf8_unicode_ci' - 11 Query SHOW SESSION VARIABLES LIKE 'collation_connection' - 11 Query SHOW SESSION VARIABLES LIKE 'character_set_connection' - 11 Query SHOW CHARACTER SET - 11 Query SHOW COLLATION - 11 Query SHOW DATABASES - 11 Query SHOW TABLES FROM `alfresco` - 11 Query SHOW TABLES FROM `information_schema` - 11 Query SHOW TABLES FROM `mysql` - 11 Quit - 12 Connect root@localhost on - 12 Query SELECT VERSION() - 12 Query SET NAMES utf8 - 12 Query SET collation_connection = 'utf8_unicode_ci' - 12 Query SET NAMES utf8 - 12 Query SET collation_connection = 'utf8_unicode_ci' - 12 Query SHOW SESSION VARIABLES LIKE 'collation_connection' - 12 Query SHOW SESSION VARIABLES LIKE 'character_set_connection' - 12 Query SHOW CHARACTER SET - 12 Query SHOW COLLATION - 12 Query SHOW DATABASES - 12 Query SELECT COUNT(*) FROM mysql.user - 12 Query SELECT COUNT(*) FROM mysql.user - 12 Query SHOW GRANTS - 12 Query SELECT COUNT(*) FROM mysql.user - 12 Query SELECT USER() - 12 Query SHOW MASTER LOGS -070920 11:37:49 12 Quit diff --git a/ksystemlog/tests/testFiles/samba/log.hostname1 b/ksystemlog/tests/testFiles/samba/log.hostname1 deleted file mode 100644 index 4ff511ba..00000000 --- a/ksystemlog/tests/testFiles/samba/log.hostname1 +++ /dev/null @@ -1,50 +0,0 @@ -[2007/02/23 15:11:42, 0] lib/util_sock.c:write_data(562) - write_data: write failure in writing to client 192.168.2.243. Error Connexion ré-initialisée par le correspondant -[2007/02/23 15:11:42, 0] lib/util_sock.c:send_smb(769) - Error writing 4 bytes to client. -1. (Connexion ré-initialisée par le correspondant) -[2007/02/24 01:51:47, 0] lib/util_sock.c:write_data(562) - write_data: write failure in writing to client 192.168.2.243. Error Connexion ré-initialisée par le correspondant -[2007/02/24 01:51:47, 0] lib/util_sock.c:send_smb(769) - Error writing 4 bytes to client. -1. (Connexion ré-initialisée par le correspondant) -[2007/02/24 02:55:47, 0] lib/util_sock.c:write_data(562) - write_data: write failure in writing to client 192.168.2.243. Error Connexion ré-initialisée par le correspondant -[2007/02/24 02:55:47, 0] lib/util_sock.c:send_smb(769) - Error writing 4 bytes to client. -1. (Connexion ré-initialisée par le correspondant) -[2007/02/24 03:27:47, 0] lib/util_sock.c:read_data(534) - read_data: read failure for 4 bytes to client 192.168.2.243. Error = Connexion ré-initialisée par le correspondant -[2007/02/24 03:59:48, 0] lib/util_sock.c:write_data(562) - write_data: write failure in writing to client 192.168.2.243. Error Connexion ré-initialisée par le correspondant -[2007/02/24 03:59:48, 0] lib/util_sock.c:send_smb(769) - Error writing 4 bytes to client. -1. (Connexion ré-initialisée par le correspondant) -[2007/02/24 04:31:48, 0] lib/util_sock.c:read_data(534) - read_data: read failure for 4 bytes to client 192.168.2.243. Error = Connexion ré-initialisée par le correspondant -[2007/02/24 05:03:48, 0] lib/util_sock.c:write_data(562) - write_data: write failure in writing to client 192.168.2.243. Error Connexion ré-initialisée par le correspondant -[2007/02/24 05:03:48, 0] lib/util_sock.c:send_smb(769) - Error writing 4 bytes to client. -1. (Connexion ré-initialisée par le correspondant) -[2007/02/24 07:43:49, 0] lib/util_sock.c:write_data(562) - write_data: write failure in writing to client 192.168.2.243. Error Connexion ré-initialisée par le correspondant -[2007/02/24 07:43:49, 0] lib/util_sock.c:send_smb(769) - Error writing 4 bytes to client. -1. (Connexion ré-initialisée par le correspondant) -[2007/02/24 11:27:50, 0] lib/util_sock.c:write_data(562) - write_data: write failure in writing to client 192.168.2.243. Error Connexion ré-initialisée par le correspondant -[2007/02/24 11:27:50, 0] lib/util_sock.c:send_smb(769) - Error writing 4 bytes to client. -1. (Connexion ré-initialisée par le correspondant) -[2007/02/24 11:59:50, 0] lib/util_sock.c:write_data(562) - write_data: write failure in writing to client 192.168.2.243. Error Connexion ré-initialisée par le correspondant -[2007/02/24 11:59:50, 0] lib/util_sock.c:send_smb(769) - Error writing 4 bytes to client. -1. (Connexion ré-initialisée par le correspondant) -[2007/02/24 12:31:50, 0] lib/util_sock.c:write_data(562) - write_data: write failure in writing to client 192.168.2.243. Error Connexion ré-initialisée par le correspondant -[2007/02/24 12:31:50, 0] lib/util_sock.c:send_smb(769) - Error writing 4 bytes to client. -1. (Connexion ré-initialisée par le correspondant) -[2007/02/24 14:39:56, 0] lib/util_sock.c:read_data(534) - read_data: read failure for 4 bytes to client 192.168.2.243. Error = Connexion ré-initialisée par le correspondant -[2007/02/24 15:43:57, 0] lib/util_sock.c:write_data(562) - write_data: write failure in writing to client 0.0.0.0. Error Connexion ré-initialisée par le correspondant -[2007/02/24 15:43:57, 0] lib/util_sock.c:send_smb(769) - Error writing 4 bytes to client. -1. (Connexion ré-initialisée par le correspondant) -[2007/02/26 15:25:49, 0] lib/util_sock.c:write_data(562) - write_data: write failure in writing to client 192.168.2.243. Error Connexion ré-initialisée par le correspondant -[2007/02/26 15:25:49, 0] lib/util_sock.c:send_smb(769) - Error writing 4 bytes to client. -1. (Connexion ré-initialisée par le correspondant) diff --git a/ksystemlog/tests/testFiles/samba/log.ip2 b/ksystemlog/tests/testFiles/samba/log.ip2 deleted file mode 100644 index ef7d42a7..00000000 --- a/ksystemlog/tests/testFiles/samba/log.ip2 +++ /dev/null @@ -1,4 +0,0 @@ -[2007/08/21 17:44:17, 1] smbd/service.c:make_connection_snum(950) - 192.168.2.137 (192.168.2.137) connect to service TESTS initially as user nobody (uid=65534, gid=65534) (pid 14256) -[2007/08/21 17:44:34, 1] smbd/service.c:close_cnum(1150) - 192.168.2.137 (192.168.2.137) closed connection to service TESTS diff --git a/ksystemlog/tests/testFiles/samba/log.nmbd b/ksystemlog/tests/testFiles/samba/log.nmbd deleted file mode 100644 index af3da380..00000000 --- a/ksystemlog/tests/testFiles/samba/log.nmbd +++ /dev/null @@ -1,33 +0,0 @@ -[2007/09/18 13:32:21, 0] nmbd/nmbd.c:terminate(58) - Got SIGTERM: going down... -[2007/09/18 13:33:08, 0] nmbd/nmbd.c:main(697) - Netbios nameserver version 3.0.25b started. - Copyright Andrew Tridgell and the Samba Team 1992-2007 -[2007/09/18 13:38:37, 0] nmbd/nmbd_become_lmb.c:become_local_master_stage2(396) - ***** - - Samba name server NICOLAS is now a local master browser for workgroup BOULOT on subnet 192.168.2.2 - - ***** -[2007/09/19 10:00:20, 0] nmbd/nmbd.c:terminate(58) - Got SIGTERM: going down... -[2007/09/19 10:01:27, 0] nmbd/nmbd.c:main(697) - Netbios nameserver version 3.0.25b started. - Copyright Andrew Tridgell and the Samba Team 1992-2007 -[2007/09/19 10:06:53, 0] nmbd/nmbd_become_lmb.c:become_local_master_stage2(396) - ***** - - Samba name server NICOLAS is now a local master browser for workgroup BOULOT on subnet 192.168.2.2 - - ***** -[2007/09/20 10:05:59, 0] nmbd/nmbd.c:terminate(58) - Got SIGTERM: going down... -[2007/09/20 10:07:10, 0] nmbd/nmbd.c:main(697) - Netbios nameserver version 3.0.26a started. - Copyright Andrew Tridgell and the Samba Team 1992-2007 -[2007/09/20 10:12:36, 0] nmbd/nmbd_become_lmb.c:become_local_master_stage2(396) - ***** - - Samba name server NICOLAS is now a local master browser for workgroup BOULOT on subnet 192.168.2.2 - - ***** diff --git a/ksystemlog/tests/testFiles/samba/log.smbd b/ksystemlog/tests/testFiles/samba/log.smbd deleted file mode 100644 index 0843172e..00000000 --- a/ksystemlog/tests/testFiles/samba/log.smbd +++ /dev/null @@ -1,13 +0,0 @@ -[2007/09/18 13:33:09, 0] smbd/server.c:main(944) - smbd version 3.0.25b started. - Copyright Andrew Tridgell and the Samba Team 1992-2007 -[2007/09/18 18:17:57, 0] lib/util_sock.c:get_peer_addr(1232) - getpeername failed. Error was Transport endpoint is not connected -[2007/09/19 10:01:28, 0] smbd/server.c:main(944) - smbd version 3.0.25b started. - Copyright Andrew Tridgell and the Samba Team 1992-2007 -[2007/09/19 13:43:46, 0] lib/util_sock.c:get_peer_addr(1232) - getpeername failed. Error was Transport endpoint is not connected -[2007/09/20 10:07:10, 0] smbd/server.c:main(944) - smbd version 3.0.26a started. - Copyright Andrew Tridgell and the Samba Team 1992-2007 diff --git a/ksystemlog/tests/testFiles/system/delete-process-identifier.log b/ksystemlog/tests/testFiles/system/delete-process-identifier.log deleted file mode 100644 index cceba7fd..00000000 --- a/ksystemlog/tests/testFiles/system/delete-process-identifier.log +++ /dev/null @@ -1,2 +0,0 @@ -Aug 15 22:39:01 localhost /USR/SBIN/CRON[9433]: Hello -Aug 15 22:39:02 localhost f[9433]: Ola \ No newline at end of file diff --git a/ksystemlog/tests/testFiles/system/duplicate-lines.log b/ksystemlog/tests/testFiles/system/duplicate-lines.log deleted file mode 100644 index 8bfbb04a..00000000 --- a/ksystemlog/tests/testFiles/system/duplicate-lines.log +++ /dev/null @@ -1,9 +0,0 @@ -Aug 18 10:00:00 localhost test: Line 1 -Aug 18 10:00:00 localhost test: Line 1 -Aug 18 10:00:00 localhost test: Line 1 -Aug 18 11:00:00 localhost test: Line 1 -Aug 18 14:00:00 localhost test: Line 2 -Aug 18 14:00:00 localhost test: Line 2 -Aug 18 15:00:00 localhost test: Line 10 -Aug 18 15:00:00 localhost test: Line 10 -Aug 18 15:00:00 localhost test: Line 11 diff --git a/ksystemlog/tests/testFiles/system/max-lines.log b/ksystemlog/tests/testFiles/system/max-lines.log deleted file mode 100644 index e2e602ac..00000000 --- a/ksystemlog/tests/testFiles/system/max-lines.log +++ /dev/null @@ -1,7 +0,0 @@ -Aug 18 09:00:00 localhost test: Line 1 -Aug 18 10:00:00 localhost test: Line 2 -Aug 18 11:00:00 localhost test: Line 3 -Aug 18 12:00:00 localhost test: Line 4 -Aug 18 13:00:00 localhost test: Line 5 -Aug 18 14:00:00 localhost test: Line 6 -Aug 18 15:00:00 localhost test: Line 7 diff --git a/ksystemlog/tests/testFiles/system/strange-lines.log b/ksystemlog/tests/testFiles/system/strange-lines.log deleted file mode 100644 index 2c23e34f..00000000 --- a/ksystemlog/tests/testFiles/system/strange-lines.log +++ /dev/null @@ -1,8 +0,0 @@ -Aug 10 17:04:28 localhost kernel: Kernel panic -Aug 11 13:49:38 localhost -- MARK -- -Aug 12 18:10:32 localhost last message repeated 4 times -Aug 13 17:04:28 testprocess: Say ouhou -Aug 14 17:04:28 localhost kernel say ouhou -Aug 15 22:39:01 localhost /USR/SBIN/CRON[9433]: (root) CMD ( [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -r -0 rm) - -blablalbla diff --git a/ksystemlog/tests/testFiles/system/system.log b/ksystemlog/tests/testFiles/system/system.log deleted file mode 100644 index fec5bcb4..00000000 --- a/ksystemlog/tests/testFiles/system/system.log +++ /dev/null @@ -1,24 +0,0 @@ -Aug 18 17:04:28 localhost kernel: [ 17.092000] ieee80211_crypt: registered algorithm 'NULL' -Aug 18 17:04:28 localhost kernel: [ 17.232000] PCI: Setting latency timer of device 0000:03:00.0 to 64 -Aug 18 17:04:28 localhost kernel: [ 17.364000] PCI: Setting latency timer of device 0000:00:1b.0 to 64 -Aug 18 17:04:28 localhost kernel: [ 100.596000] set_level status: 0 -Aug 18 17:04:29 localhost NetworkManager: [1187449469.325281] nm_hal_device_added(): New device added (hal udi is '/org/freedesktop/Hal/devices/storage_model_CD/DVDW_TS_L632D'). -Aug 18 17:04:42 localhost kernel: [ 115.084000] eth1: no IPv6 routers present -Aug 18 17:05:23 localhost NetworkManager: [1187449523.399765] nm_hal_device_added(): New device added (hal udi is '/org/freedesktop/Hal/devices/usb_device_46d_c016_noserial'). -Aug 18 17:05:23 localhost NetworkManager: [1187449523.521428] nm_hal_device_added(): New device added (hal udi is '/org/freedesktop/Hal/devices/usb_device_46d_c016_noserial_if0'). -Aug 18 17:05:23 localhost NetworkManager: [1187449523.554409] nm_hal_device_added(): New device added (hal udi is '/org/freedesktop/Hal/devices/usb_device_46d_c016_noserial_usbraw'). -Aug 18 17:05:23 localhost NetworkManager: [1187449523.576442] nm_hal_device_added(): New device added (hal udi is '/org/freedesktop/Hal/devices/usb_device_46d_c016_noserial_if0_logicaldev_input'). -Aug 18 17:06:13 localhost NetworkManager: [1187449573.852443] nm_device_802_11_wireless_get_activation_ap(): Forcing AP '3Com' -Aug 18 17:06:23 localhost NetworkManager: [1187449583.277856] nm_device_802_11_wireless_get_activation_ap(): Forcing AP '3Com' -Aug 18 17:06:33 localhost kernel: [ 226.604000] eth1: no IPv6 routers present -Aug 18 17:08:40 localhost kernel: [ 353.700000] eth1: no IPv6 routers present -Aug 18 17:11:52 localhost NetworkManager: [1187449912.758477] nm_device_802_11_wireless_get_activation_ap(): Forcing AP '3Com' -Aug 18 17:12:05 localhost kernel: [ 559.152000] eth1: no IPv6 routers present -Aug 18 17:14:15 localhost kernel: [ 688.808000] eth1: no IPv6 routers present -Aug 19 10:45:51 localhost NetworkManager: [1187513151.426711] nm_device_802_11_wireless_get_activation_ap(): Forcing AP '3Com' -Aug 19 10:46:03 localhost kernel: [63797.588000] eth1: no IPv6 routers present -Aug 19 10:48:10 localhost kernel: [63924.112000] eth1: no IPv6 routers present -Aug 19 16:22:32 localhost NetworkManager: [1187533352.507843] nm_print_open_socks(): Open Sockets List: -Aug 19 16:22:32 localhost NetworkManager: [1187533352.507872] nm_print_open_socks(): Open Sockets List Done. -Aug 19 18:55:53 localhost kernel: [ 0.000000] Entering add_active_range(0, 0, 393136) 0 entries of 256 used -Aug 19 18:55:53 localhost kernel: [ 0.000000] On node 0 totalpages: 393136 \ No newline at end of file diff --git a/ksystemlog/tests/testFiles/user/user.log b/ksystemlog/tests/testFiles/user/user.log deleted file mode 100644 index 1b9dfd7c..00000000 --- a/ksystemlog/tests/testFiles/user/user.log +++ /dev/null @@ -1,88 +0,0 @@ -Sep 20 10:47:28 testhost gconfd (root-8801): Sortie -Sep 20 11:36:42 testhost gconfd (user-5838): Failed to send buffer -Sep 13 17:34:40 testhost gconfd (user-5822): Sortie -Sep 14 09:23:29 testhost dhcdbd: Started up. -Sep 14 09:23:32 testhost hpiod: 1.7.3 accepting connections at 2208... -Sep 14 09:30:51 testhost gconfd (user-6112): démarrage (version 2.18.0.1), pid 6112 utilisateur « user » -Sep 14 09:30:51 testhost gconfd (user-6112): Adresse « xml:readonly:/etc/gconf/gconf.xml.mandatory » résolue vers une source de configuration en lecture seule à la position 0 -Sep 14 09:30:51 testhost gconfd (user-6112): Adresse « xml:readwrite:/home/user/.gconf » résolue vers une source de configuration accessible en écriture à la position 1 -Sep 14 09:30:51 testhost gconfd (user-6112): Adresse « xml:readonly:/etc/gconf/gconf.xml.defaults » résolue vers une source de configuration en lecture seule à la position 2 -Sep 14 09:30:51 testhost gconfd (user-6112): Adresse « xml:readonly:/var/lib/gconf/debian.defaults » résolue vers une source de configuration en lecture seule à la position 3 -Sep 14 09:30:51 testhost gconfd (user-6112): Adresse « xml:readonly:/var/lib/gconf/defaults » résolue vers une source de configuration en lecture seule à la position 4 -Sep 14 09:30:57 testhost gconfd (user-6112): Adresse « xml:readwrite:/home/user/.gconf » résolue vers une source de configuration accessible en écriture à la position 0 -Sep 14 09:31:41 testhost gconfd (root-6402): démarrage (version 2.18.0.1), pid 6402 utilisateur « root » -Sep 14 09:31:41 testhost gconfd (root-6402): Adresse « xml:readonly:/etc/gconf/gconf.xml.mandatory » résolue vers une source de configuration en lecture seule à la position 0 -Sep 14 09:31:41 testhost gconfd (root-6402): Adresse « xml:readwrite:/root/.gconf » résolue vers une source de configuration accessible en écriture à la position 1 -Sep 14 09:31:41 testhost gconfd (root-6402): Adresse « xml:readonly:/etc/gconf/gconf.xml.defaults » résolue vers une source de configuration en lecture seule à la position 2 -Sep 14 09:31:41 testhost gconfd (root-6402): Adresse « xml:readonly:/var/lib/gconf/debian.defaults » résolue vers une source de configuration en lecture seule à la position 3 -Sep 14 09:31:41 testhost gconfd (root-6402): Adresse « xml:readonly:/var/lib/gconf/defaults » résolue vers une source de configuration en lecture seule à la position 4 -Sep 14 09:32:11 testhost gconfd (root-6402): SIGHUP reçu, rechargement de toutes les bases de données -Sep 14 09:32:11 testhost gconfd (root-6402): Adresse « xml:readonly:/etc/gconf/gconf.xml.mandatory » résolue vers une source de configuration en lecture seule à la position 0 -Sep 14 09:32:11 testhost gconfd (root-6402): Adresse « xml:readwrite:/root/.gconf » résolue vers une source de configuration accessible en écriture à la position 1 -Sep 14 09:32:11 testhost gconfd (root-6402): Adresse « xml:readonly:/etc/gconf/gconf.xml.defaults » résolue vers une source de configuration en lecture seule à la position 2 -Sep 14 09:32:11 testhost gconfd (root-6402): Adresse « xml:readonly:/var/lib/gconf/debian.defaults » résolue vers une source de configuration en lecture seule à la position 3 -Sep 14 09:32:11 testhost gconfd (root-6402): Adresse « xml:readonly:/var/lib/gconf/defaults » résolue vers une source de configuration en lecture seule à la position 4 -Sep 14 09:32:11 testhost gconfd (root-6402): Le serveur GConf n'est pas en cours d'utilisation, arrêt. -Sep 14 09:32:11 testhost gconfd (root-6402): Sortie -Sep 14 14:12:33 testhost gconfd (root-17578): démarrage (version 2.18.0.1), pid 17578 utilisateur « root » -Sep 14 14:12:33 testhost gconfd (root-17578): Adresse « xml:readonly:/etc/gconf/gconf.xml.mandatory » résolue vers une source de configuration en lecture seule à la position 0 -Sep 14 14:12:33 testhost gconfd (root-17578): Adresse « xml:readwrite:/root/.gconf » résolue vers une source de configuration accessible en écriture à la position 1 -Sep 14 14:12:33 testhost gconfd (root-17578): Adresse « xml:readonly:/etc/gconf/gconf.xml.defaults » résolue vers une source de configuration en lecture seule à la position 2 -Sep 14 14:12:33 testhost gconfd (root-17578): Adresse « xml:readonly:/var/lib/gconf/debian.defaults » résolue vers une source de configuration en lecture seule à la position 3 -Sep 14 14:12:33 testhost gconfd (root-17578): Adresse « xml:readonly:/var/lib/gconf/defaults » résolue vers une source de configuration en lecture seule à la position 4 -Sep 14 14:13:03 testhost gconfd (root-17578): SIGHUP reçu, rechargement de toutes les bases de données -Sep 14 14:13:03 testhost gconfd (root-17578): Adresse « xml:readonly:/etc/gconf/gconf.xml.mandatory » résolue vers une source de configuration en lecture seule à la position 0 -Sep 14 14:13:03 testhost gconfd (root-17578): Adresse « xml:readwrite:/root/.gconf » résolue vers une source de configuration accessible en écriture à la position 1 -Sep 14 14:13:03 testhost gconfd (root-17578): Adresse « xml:readonly:/etc/gconf/gconf.xml.defaults » résolue vers une source de configuration en lecture seule à la position 2 -Sep 14 14:13:03 testhost gconfd (root-17578): Adresse « xml:readonly:/var/lib/gconf/debian.defaults » résolue vers une source de configuration en lecture seule à la position 3 -Sep 14 14:13:03 testhost gconfd (root-17578): Adresse « xml:readonly:/var/lib/gconf/defaults » résolue vers une source de configuration en lecture seule à la position 4 -Sep 14 14:13:03 testhost gconfd (root-17578): Le serveur GConf n'est pas en cours d'utilisation, arrêt. -Sep 14 14:13:03 testhost gconfd (root-17578): Sortie -Sep 14 17:00:11 testhost gconfd (user-6112): Sortie -Sep 17 09:22:23 testhost dhcdbd: Started up. -Sep 17 09:22:26 testhost hpiod: 1.7.3 accepting connections at 2208... -Sep 17 09:25:42 testhost gconfd (user-5841): démarrage (version 2.18.0.1), pid 5841 utilisateur « user » -Sep 17 09:25:42 testhost gconfd (user-5841): Adresse « xml:readonly:/etc/gconf/gconf.xml.mandatory » résolue vers une source de configuration en lecture seule à la position 0 -Sep 17 09:25:42 testhost gconfd (user-5841): Adresse « xml:readwrite:/home/user/.gconf » résolue vers une source de configuration accessible en écriture à la position 1 -Sep 17 09:25:42 testhost gconfd (user-5841): Adresse « xml:readonly:/etc/gconf/gconf.xml.defaults » résolue vers une source de configuration en lecture seule à la position 2 -Sep 17 09:25:42 testhost gconfd (user-5841): Adresse « xml:readonly:/var/lib/gconf/debian.defaults » résolue vers une source de configuration en lecture seule à la position 3 -Sep 17 09:25:42 testhost gconfd (user-5841): Adresse « xml:readonly:/var/lib/gconf/defaults » résolue vers une source de configuration en lecture seule à la position 4 -Sep 17 09:25:50 testhost gconfd (user-5841): Adresse « xml:readwrite:/home/user/.gconf » résolue vers une source de configuration accessible en écriture à la position 0 -Sep 17 10:40:45 testhost gconfd (root-9025): démarrage (version 2.18.0.1), pid 9025 utilisateur « root » -Sep 17 10:40:45 testhost gconfd (root-9025): Adresse « xml:readonly:/etc/gconf/gconf.xml.mandatory » résolue vers une source de configuration en lecture seule à la position 0 -Sep 17 10:40:45 testhost gconfd (root-9025): Adresse « xml:readwrite:/root/.gconf » résolue vers une source de configuration accessible en écriture à la position 1 -Sep 17 10:40:45 testhost gconfd (root-9025): Adresse « xml:readonly:/etc/gconf/gconf.xml.defaults » résolue vers une source de configuration en lecture seule à la position 2 -Sep 17 10:40:45 testhost gconfd (root-9025): Adresse « xml:readonly:/var/lib/gconf/debian.defaults » résolue vers une source de configuration en lecture seule à la position 3 -Sep 17 10:40:45 testhost gconfd (root-9025): Adresse « xml:readonly:/var/lib/gconf/defaults » résolue vers une source de configuration en lecture seule à la position 4 -Sep 17 10:40:54 testhost gconfd (root-9025): Sortie -Sep 17 10:41:13 testhost gconfd (user-5841): SIGHUP reçu, rechargement de toutes les bases de données -Sep 17 10:41:13 testhost gconfd (user-5841): Adresse « xml:readonly:/etc/gconf/gconf.xml.mandatory » résolue vers une source de configuration en lecture seule à la position 0 -Sep 17 10:41:13 testhost gconfd (user-5841): Adresse « xml:readwrite:/home/user/.gconf » résolue vers une source de configuration accessible en écriture à la position 1 -Sep 17 10:41:13 testhost gconfd (user-5841): Adresse « xml:readonly:/etc/gconf/gconf.xml.defaults » résolue vers une source de configuration en lecture seule à la position 2 -Sep 17 10:41:13 testhost gconfd (user-5841): Adresse « xml:readonly:/var/lib/gconf/debian.defaults » résolue vers une source de configuration en lecture seule à la position 3 -Sep 17 10:41:13 testhost gconfd (user-5841): Adresse « xml:readonly:/var/lib/gconf/defaults » résolue vers une source de configuration en lecture seule à la position 4 -Sep 17 18:00:10 testhost gconfd (root-22226): démarrage (version 2.18.0.1), pid 22226 utilisateur « root » -Sep 17 18:00:10 testhost gconfd (root-22226): Adresse « xml:readonly:/etc/gconf/gconf.xml.mandatory » résolue vers une source de configuration en lecture seule à la position 0 -Sep 17 18:00:10 testhost gconfd (root-22226): Adresse « xml:readwrite:/root/.gconf » résolue vers une source de configuration accessible en écriture à la position 1 -Sep 17 18:00:10 testhost gconfd (root-22226): Adresse « xml:readonly:/etc/gconf/gconf.xml.defaults » résolue vers une source de configuration en lecture seule à la position 2 -Sep 17 18:00:10 testhost gconfd (root-22226): Adresse « xml:readonly:/var/lib/gconf/debian.defaults » résolue vers une source de configuration en lecture seule à la position 3 -Sep 17 18:00:10 testhost gconfd (root-22226): Adresse « xml:readonly:/var/lib/gconf/defaults » résolue vers une source de configuration en lecture seule à la position 4 -Sep 17 18:00:40 testhost gconfd (root-22226): Le serveur GConf n'est pas en cours d'utilisation, arrêt. -Sep 17 18:00:40 testhost gconfd (root-22226): Sortie -Sep 18 09:29:34 testhost gnome-power-manager: (user) Déconnexion interactive GNOME car le bouton de mise sous tension a été appuyé -Sep 18 15:52:55 testhost gnome-power-manager: (user) Déconnexion interactive GNOME car le bouton de mise sous tension a été appuyé -Sep 18 15:54:01 testhost dhcdbd: Started up. -Sep 18 15:54:04 testhost hpiod: 1.7.3 accepting connections at 2208... -Sep 18 15:55:33 testhost gconfd (user-6085): démarrage (version 2.18.0.1), pid 6085 utilisateur « user » -Sep 18 15:55:33 testhost gconfd (user-6085): Adresse « xml:readonly:/etc/gconf/gconf.xml.mandatory » résolue vers une source de configuration en lecture seule à la position 0 -Sep 18 15:55:33 testhost gconfd (user-6085): Adresse « xml:readwrite:/home/user/.gconf » résolue vers une source de configuration accessible en écriture à la position 1 -Sep 18 15:55:33 testhost gconfd (user-6085): Adresse « xml:readonly:/etc/gconf/gconf.xml.defaults » résolue vers une source de configuration en lecture seule à la position 2 -Sep 18 15:55:33 testhost gconfd (user-6085): Adresse « xml:readonly:/var/lib/gconf/debian.defaults » résolue vers une source de configuration en lecture seule à la position 3 -Sep 18 15:55:33 testhost gconfd (user-6085): Adresse « xml:readonly:/var/lib/gconf/defaults » résolue vers une source de configuration en lecture seule à la position 4 -Sep 18 15:55:41 testhost gconfd (user-6085): Adresse « xml:readwrite:/home/user/.gconf » résolue vers une source de configuration accessible en écriture à la position 0 -Sep 18 17:33:42 testhost gconfd (user-6085): Sortie -Sep 19 09:21:51 testhost dhcdbd: Started up. -Sep 19 09:21:54 testhost hpiod: 1.7.3 accepting connections at 2208... -Sep 19 09:22:22 testhost gconfd (user-5989): démarrage (version 2.18.0.1), pid 5989 utilisateur « user » -Sep 19 09:22:22 testhost gconfd (user-5989): Adresse « xml:readonly:/etc/gconf/gconf.xml.mandatory » résolue vers une source de configuration en lecture seule à la position 0 -Sep 19 09:22:22 testhost gconfd (user-5989): Adresse « xml:readwrite:/home/user/.gconf » résolue vers une source de configuration accessible en écriture à la position 1 diff --git a/ksystemlog/tests/testFiles/xsession/xsession-error b/ksystemlog/tests/testFiles/xsession/xsession-error deleted file mode 100644 index 8af3b7d2..00000000 --- a/ksystemlog/tests/testFiles/xsession/xsession-error +++ /dev/null @@ -1,46 +0,0 @@ -X Error: BadPixmap (invalid Pixmap parameter) 4 - Major opcode: 54 - Minor opcode: 0 - Resource id: 0x1604e8b -kbuildsycoca running... -Reusing existing ksycoca -kio (KService*): WARNING: The desktop entry file .hidden/dirfilterplugin.desktop has Type=Service but is located under "apps" instead of "services" -kio (KService*): WARNING: Invalid Service : .hidden/dirfilterplugin.desktop -kbuildsycoca running... -Reusing existing ksycoca -kio (KService*): WARNING: The desktop entry file .hidden/dirfilterplugin.desktop has Type=Service but is located under "apps" instead of "services" -kio (KService*): WARNING: Invalid Service : .hidden/dirfilterplugin.desktop -kbuildsycoca running... -Reusing existing ksycoca -kio (KService*): WARNING: The desktop entry file .hidden/dirfilterplugin.desktop has Type=Service but is located under "apps" instead of "services" -kio (KService*): WARNING: Invalid Service : .hidden/dirfilterplugin.desktop -kbuildsycoca running... -Reusing existing ksycoca -kio (KService*): WARNING: The desktop entry file .hidden/dirfilterplugin.desktop has Type=Service but is located under "apps" instead of "services" -kio (KService*): WARNING: Invalid Service : .hidden/dirfilterplugin.desktop -DCOP Cleaning up dead connections. -kbuildsycoca running... -Reusing existing ksycoca -kio (KService*): WARNING: The desktop entry file .hidden/dirfilterplugin.desktop has Type=Service but is located under "apps" instead of "services" -kio (KService*): WARNING: Invalid Service : .hidden/dirfilterplugin.desktop -kbuildsycoca running... -Reusing existing ksycoca -kio (KService*): WARNING: The desktop entry file .hidden/dirfilterplugin.desktop has Type=Service but is located under "apps" instead of "services" -kio (KService*): WARNING: Invalid Service : .hidden/dirfilterplugin.desktop -DCOP Cleaning up dead connections. -X Error: BadPixmap (invalid Pixmap parameter) 4 - Major opcode: 54 - Minor opcode: 0 - Resource id: 0x1604e27 -X Error: BadMatch (invalid parameter attributes) 8 - Major opcode: 161 - Minor opcode: 6 - Resource id: 0x1604e27 -X Error: BadPixmap (invalid Pixmap parameter) 4 - Major opcode: 54 - Minor opcode: 0 - Resource id: 0x160533a -X Error: BadMatch (invalid parameter attributes) 8 - Major opcode: 161 - Minor opcode: 6 - Resource id: 0x160533a diff --git a/ksystemlog/tests/testUtil.cpp b/ksystemlog/tests/testUtil.cpp deleted file mode 100644 index 074910d0..00000000 --- a/ksystemlog/tests/testUtil.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/*************************************************************************** - * 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 "testUtil.h" -#include - -#include -#include - -#include "systemFactory.h" -#include "kernelFactory.h" - -#include "logging.h" - -#include "logViewModel.h" -#include "logViewWidget.h" - -#include "analyzer.h" - -TestUtil::TestUtil() { - -} - -TestUtil::~TestUtil() { - -} - -void TestUtil::registerLogModeFactories() const { - logDebug() << "Registering existing log mode factories"; - Globals::instance()->registerLogModeFactory(new SystemLogModeFactory()); - Globals::instance()->registerLogModeFactory(new KernelLogModeFactory()); -} - -LogViewModel* TestUtil::defineLogViewModel(Analyzer* analyzer) const { - LogViewWidget* logViewWidget = new LogViewWidget(); - LogViewModel* model = new LogViewModel(logViewWidget); - - analyzer->setLogViewModel(model); - - return model; -} - -Analyzer* TestUtil::createAnalyzer(const QString& logModeName, LogViewModel** model) const { - Analyzer* analyzer = Globals::instance()->findLogMode(logModeName)->createAnalyzer(); - - *model = defineLogViewModel(analyzer); - - return analyzer; -} - -void TestUtil::destroyReader(Analyzer* analyzer) const { - //TODO Unable to delete the created LogViewWidget, because the LogViewModel is not accessible from Reader - delete analyzer; -} - -QList TestUtil::createLogFiles(const QString& resourceFileName) const { - logDebug() << "Using log file name " << resourceFileName; - - LogLevel* informationLogLevel = Globals::instance()->informationLogLevel(); - - QList logFiles; - LogFile logFile(KUrl(resourceFileName), informationLogLevel); - logFiles.append(logFile); - - return logFiles; -} - - -void TestUtil::testLine( - LogLine* line, - const QString& originalFileName, - LogLevel* logLevel, - const QDateTime& time, - const QStringList& items) const { - - QCOMPARE (line->time(), time); - QCOMPARE (line->sourceFileName(), originalFileName); - QCOMPARE (line->logLevel()->id(), logLevel->id()); - - //Test log line items - QStringList logItems = line->logItems(); - QCOMPARE (logItems.count(), items.count()); - QCOMPARE (logItems, items); - -} - - -void TestUtil::addLogLines(const QString& fileName, const QStringList& addedLines) const { - //Wait 1 sec to be sure the dirty signal will be emitted - QTest::qWait(1000); - - QFile data(fileName); - if (data.open(QFile::Append | QIODevice::Text)) { - logDebug() << "Opening "<< fileName << " for writing " << addedLines.count() << " line(s)."; - - QTextStream out(&data); - foreach (const QString &line, addedLines) { - out << line << endl; - } - - out.flush(); - data.close(); - } - else { - QFAIL( QString::fromLatin1("Unable to open the test log file %1").arg(fileName).toUtf8() ); - } - - //Wait 3 secs to be sure the log file changed have been processed - QTest::qWait(1000); -} - -#include "moc_testUtil.cpp" diff --git a/ksystemlog/tests/testUtil.h b/ksystemlog/tests/testUtil.h deleted file mode 100644 index 4c1b553d..00000000 --- a/ksystemlog/tests/testUtil.h +++ /dev/null @@ -1,89 +0,0 @@ -/*************************************************************************** - * 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 TEST_UTIL_H -#define TEST_UTIL_H - -#include - -#include -#include - -class LogViewModel; -class Analyzer; - -#include "logFile.h" -#include "logLine.h" - -#include "globals.h" - -class TestUtil : public QObject { - - Q_OBJECT - - public: - TestUtil(); - - virtual ~TestUtil(); - - /* - * Init method, used to register existing Log Modes - */ - void registerLogModeFactories() const; - - - LogViewModel* defineLogViewModel(Analyzer* analyzer) const; - - /** - * Find a reader and initialize it. - * If the model == NULL, then a new model is created and the pointer is update - */ - Analyzer* createAnalyzer(const QString& logModeName, LogViewModel** model) const; - - /* - * Delete the reader provided in parameter - */ - void destroyReader(Analyzer* analyzer) const; - - /* - * Create a LogFile list from a single resourceFileName - */ - QList createLogFiles(const QString& resourceFileName) const; - - /* - * Add the "addedLines" list to the file "fileName" - */ - void addLogLines(const QString& fileName, const QStringList& addedLines) const; - - /* - * Test every fields of the logLine with the other parameters - */ - void testLine( - LogLine* line, - const QString& originalFileName, - LogLevel* logLevel, - const QDateTime& time, - const QStringList& items) const; - -}; - - -#endif //TEST_UTIL_H