summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo/sysloginfo.cpp
Unidiff
Diffstat (limited to 'noncore/settings/sysinfo/sysloginfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/sysloginfo.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/noncore/settings/sysinfo/sysloginfo.cpp b/noncore/settings/sysinfo/sysloginfo.cpp
index 21427f4..279c335 100644
--- a/noncore/settings/sysinfo/sysloginfo.cpp
+++ b/noncore/settings/sysinfo/sysloginfo.cpp
@@ -1,32 +1,30 @@
1/********************************************************************** 1/**********************************************************************
2** SyslogInfo 2** SyslogInfo
3** 3**
4** Display Syslog information 4** Display Syslog information
5** 5**
6** Copyright (C) 2004, Michael Lauer 6** Copyright (C) 2004-2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
7** mickey@tm.informatik.uni-frankfurt.de
8** http://www.Vanille.de
9** 7**
10** This file may be distributed and/or modified under the terms of the 8** This file may be distributed and/or modified under the terms of the
11** GNU General Public License version 2 as published by the Free Software 9** GNU General Public License version 2 as published by the Free Software
12** Foundation and appearing in the file LICENSE.GPL included in the 10** Foundation and appearing in the file LICENSE.GPL included in the
13** packaging of this file. 11** packaging of this file.
14** 12**
15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 13** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 14** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17** 15**
18**********************************************************************/ 16**********************************************************************/
19 17
20#include "sysloginfo.h" 18#include "sysloginfo.h"
21#include "detail.h" 19#include "detail.h"
22 20
23/* OPIE */ 21/* OPIE */
24#include <opie2/olistview.h> 22#include <opie2/olistview.h>
25#include <opie2/oconfig.h> 23#include <opie2/oconfig.h>
26using namespace Opie::Core; 24using namespace Opie::Core;
27using namespace Opie::Ui; 25using namespace Opie::Ui;
28 26
29/* QT */ 27/* QT */
30#include <qcombobox.h> 28#include <qcombobox.h>
31#include <qfile.h> 29#include <qfile.h>
32#include <qlayout.h> 30#include <qlayout.h>
@@ -48,49 +46,49 @@ using namespace Opie::Ui;
48#include <string.h> 46#include <string.h>
49#include <errno.h> 47#include <errno.h>
50 48
51#define SYSLOG_READ 2 49#define SYSLOG_READ 2
52#define SYSLOG_READ_ALL 3 50#define SYSLOG_READ_ALL 3
53#define SYSLOG_READ_ALL_CLEAR 4 51#define SYSLOG_READ_ALL_CLEAR 4
54#define SYSLOG_UNREAD 9 52#define SYSLOG_UNREAD 9
55 53
56#undef APPEND 54#undef APPEND
57 55
58const unsigned int bufsize = 16384; 56const unsigned int bufsize = 16384;
59char buf[bufsize]; 57char buf[bufsize];
60 58
61SyslogInfo::SyslogInfo( QWidget* parent, const char* name, WFlags fl ) 59SyslogInfo::SyslogInfo( QWidget* parent, const char* name, WFlags fl )
62 : QWidget( parent, name, fl ) 60 : QWidget( parent, name, fl )
63{ 61{
64 QGridLayout *layout = new QGridLayout( this ); 62 QGridLayout *layout = new QGridLayout( this );
65 layout->setSpacing( 2 ); 63 layout->setSpacing( 2 );
66 layout->setMargin( 0 ); 64 layout->setMargin( 0 );
67 65
68 syslogview = new QTextView( this ); 66 syslogview = new QTextView( this );
69 syslogview->setTextFormat( PlainText ); 67 syslogview->setTextFormat( PlainText );
70 OConfig cfg( "qpe" ); 68 OConfig cfg( "qpe" );
71 cfg.setGroup( "Appearance" ); 69 cfg.setGroup( "Appearance" );
72 syslogview->setFont( QFont( "Fixed", cfg.readNumEntry( "FontSize", 10 ) ) ); 70 syslogview->setFont( QFont( cfg.readEntry( "FixedFontFamily", "Fixed" ), cfg.readNumEntry( "FixedFontSize", 10 ) ) );
73 layout->addWidget( syslogview, 0, 0 ); 71 layout->addWidget( syslogview, 0, 0 );
74 syslogview->setText( "..." ); 72 syslogview->setText( "..." );
75 73
76 memset( buf, 0, bufsize ); 74 memset( buf, 0, bufsize );
77 ::klogctl( SYSLOG_READ_ALL, buf, bufsize ); 75 ::klogctl( SYSLOG_READ_ALL, buf, bufsize );
78 syslogview->setText( buf ); 76 syslogview->setText( buf );
79 77
80#ifdef APPEND 78#ifdef APPEND
81 fd = ::open( "/proc/kmsg", O_RDONLY|O_SYNC ); 79 fd = ::open( "/proc/kmsg", O_RDONLY|O_SYNC );
82 if ( fd == -1 ) 80 if ( fd == -1 )
83 { 81 {
84 syslogview->setText( "Couldn't open /proc/kmsg: " + QString( strerror( errno ) ) ); 82 syslogview->setText( "Couldn't open /proc/kmsg: " + QString( strerror( errno ) ) );
85 return; 83 return;
86 } 84 }
87 QSocketNotifier *sn = new QSocketNotifier( fd, QSocketNotifier::Read, this ); 85 QSocketNotifier *sn = new QSocketNotifier( fd, QSocketNotifier::Read, this );
88 QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(updateData()) ); 86 QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(updateData()) );
89#else 87#else
90 QPushButton* pb = new QPushButton( "&Refresh", this ); 88 QPushButton* pb = new QPushButton( "&Refresh", this );
91 layout->addWidget( pb, 1, 0 ); 89 layout->addWidget( pb, 1, 0 );
92 QObject::connect( pb, SIGNAL(clicked()), this, SLOT(updateData()) ); 90 QObject::connect( pb, SIGNAL(clicked()), this, SLOT(updateData()) );
93#endif 91#endif
94} 92}
95 93
96SyslogInfo::~SyslogInfo() 94SyslogInfo::~SyslogInfo()