summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-03-20 18:04:02 (UTC)
committer mickeyl <mickeyl>2005-03-20 18:04:02 (UTC)
commitd330608d5c2713f8bde051b91382d0e0e54317ba (patch) (unidiff)
tree6ee1b6db2ec51caf4e71cba477f5f14900bfbc22
parent64104e14e4026658551e7283498eafbe3855e6d5 (diff)
downloadopie-d330608d5c2713f8bde051b91382d0e0e54317ba.zip
opie-d330608d5c2713f8bde051b91382d0e0e54317ba.tar.gz
opie-d330608d5c2713f8bde051b91382d0e0e54317ba.tar.bz2
sysinfo: reduce margin on syslogtab
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/sysloginfo.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/sysinfo/sysloginfo.cpp b/noncore/settings/sysinfo/sysloginfo.cpp
index a9e98e3..21427f4 100644
--- a/noncore/settings/sysinfo/sysloginfo.cpp
+++ b/noncore/settings/sysinfo/sysloginfo.cpp
@@ -17,98 +17,98 @@
17** 17**
18**********************************************************************/ 18**********************************************************************/
19 19
20#include "sysloginfo.h" 20#include "sysloginfo.h"
21#include "detail.h" 21#include "detail.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <opie2/olistview.h> 24#include <opie2/olistview.h>
25#include <opie2/oconfig.h> 25#include <opie2/oconfig.h>
26using namespace Opie::Core; 26using namespace Opie::Core;
27using namespace Opie::Ui; 27using namespace Opie::Ui;
28 28
29/* QT */ 29/* QT */
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qlayout.h> 32#include <qlayout.h>
33#include <qmessagebox.h> 33#include <qmessagebox.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#include <qsocketnotifier.h> 35#include <qsocketnotifier.h>
36#include <qtextbrowser.h> 36#include <qtextbrowser.h>
37#include <qtimer.h> 37#include <qtimer.h>
38#include <qwhatsthis.h> 38#include <qwhatsthis.h>
39#include <qtextview.h> 39#include <qtextview.h>
40 40
41/* STD */ 41/* STD */
42#include <sys/klog.h> 42#include <sys/klog.h>
43#include <sys/types.h> 43#include <sys/types.h>
44#include <sys/stat.h> 44#include <sys/stat.h>
45#include <fcntl.h> 45#include <fcntl.h>
46#include <assert.h> 46#include <assert.h>
47#include <unistd.h> 47#include <unistd.h>
48#include <string.h> 48#include <string.h>
49#include <errno.h> 49#include <errno.h>
50 50
51#define SYSLOG_READ 2 51#define SYSLOG_READ 2
52#define SYSLOG_READ_ALL 3 52#define SYSLOG_READ_ALL 3
53#define SYSLOG_READ_ALL_CLEAR 4 53#define SYSLOG_READ_ALL_CLEAR 4
54#define SYSLOG_UNREAD 9 54#define SYSLOG_UNREAD 9
55 55
56#undef APPEND 56#undef APPEND
57 57
58const unsigned int bufsize = 16384; 58const unsigned int bufsize = 16384;
59char buf[bufsize]; 59char buf[bufsize];
60 60
61SyslogInfo::SyslogInfo( QWidget* parent, const char* name, WFlags fl ) 61SyslogInfo::SyslogInfo( QWidget* parent, const char* name, WFlags fl )
62 : QWidget( parent, name, fl ) 62 : QWidget( parent, name, fl )
63{ 63{
64 QGridLayout *layout = new QGridLayout( this ); 64 QGridLayout *layout = new QGridLayout( this );
65 layout->setSpacing( 4 ); 65 layout->setSpacing( 2 );
66 layout->setMargin( 4 ); 66 layout->setMargin( 0 );
67 67
68 syslogview = new QTextView( this ); 68 syslogview = new QTextView( this );
69 syslogview->setTextFormat( PlainText ); 69 syslogview->setTextFormat( PlainText );
70 OConfig cfg( "qpe" ); 70 OConfig cfg( "qpe" );
71 cfg.setGroup( "Appearance" ); 71 cfg.setGroup( "Appearance" );
72 syslogview->setFont( QFont( "Fixed", cfg.readNumEntry( "FontSize", 10 ) ) ); 72 syslogview->setFont( QFont( "Fixed", cfg.readNumEntry( "FontSize", 10 ) ) );
73 layout->addWidget( syslogview, 0, 0 ); 73 layout->addWidget( syslogview, 0, 0 );
74 syslogview->setText( "..." ); 74 syslogview->setText( "..." );
75 75
76 memset( buf, 0, bufsize ); 76 memset( buf, 0, bufsize );
77 ::klogctl( SYSLOG_READ_ALL, buf, bufsize ); 77 ::klogctl( SYSLOG_READ_ALL, buf, bufsize );
78 syslogview->setText( buf ); 78 syslogview->setText( buf );
79 79
80#ifdef APPEND 80#ifdef APPEND
81 fd = ::open( "/proc/kmsg", O_RDONLY|O_SYNC ); 81 fd = ::open( "/proc/kmsg", O_RDONLY|O_SYNC );
82 if ( fd == -1 ) 82 if ( fd == -1 )
83 { 83 {
84 syslogview->setText( "Couldn't open /proc/kmsg: " + QString( strerror( errno ) ) ); 84 syslogview->setText( "Couldn't open /proc/kmsg: " + QString( strerror( errno ) ) );
85 return; 85 return;
86 } 86 }
87 QSocketNotifier *sn = new QSocketNotifier( fd, QSocketNotifier::Read, this ); 87 QSocketNotifier *sn = new QSocketNotifier( fd, QSocketNotifier::Read, this );
88 QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(updateData()) ); 88 QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(updateData()) );
89#else 89#else
90 QPushButton* pb = new QPushButton( "&Refresh", this ); 90 QPushButton* pb = new QPushButton( "&Refresh", this );
91 layout->addWidget( pb, 1, 0 ); 91 layout->addWidget( pb, 1, 0 );
92 QObject::connect( pb, SIGNAL(clicked()), this, SLOT(updateData()) ); 92 QObject::connect( pb, SIGNAL(clicked()), this, SLOT(updateData()) );
93#endif 93#endif
94} 94}
95 95
96SyslogInfo::~SyslogInfo() 96SyslogInfo::~SyslogInfo()
97{ 97{
98 if ( fd != -1 ) ::close( fd ); 98 if ( fd != -1 ) ::close( fd );
99} 99}
100 100
101void SyslogInfo::updateData() 101void SyslogInfo::updateData()
102{ 102{
103 qDebug( "SyslogInfo: updateData" ); 103 qDebug( "SyslogInfo: updateData" );
104#ifdef APPEND 104#ifdef APPEND
105 memset( buf, 0, bufsize ); 105 memset( buf, 0, bufsize );
106 int num = ::read( fd, buf, bufsize ); 106 int num = ::read( fd, buf, bufsize );
107 if ( num ) // -1 = error (permission denied) 107 if ( num ) // -1 = error (permission denied)
108 { 108 {
109 syslogview->append( "\n" ); 109 syslogview->append( "\n" );
110 syslogview->append( buf ); 110 syslogview->append( buf );
111 qDebug( "SyslogInfo: adding '%s'", buf ); 111 qDebug( "SyslogInfo: adding '%s'", buf );
112 } 112 }
113#else 113#else
114 memset( buf, 0, bufsize ); 114 memset( buf, 0, bufsize );