* maximal -> maximum
[kdenetwork.git] / kppp / debug.cpp
blob669b67c8eb753f88d48a70c7add73df5fece0a5a
1 /*
2 * kPPP: A pppd front end for the KDE project
4 * $Id$
5 * Copyright (C) 1997 Bernd Wuebben
6 * wuebben@math.cornel.edu
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #include "debug.h"
24 #include "main.h"
25 #include "pppdata.h"
26 #include <klocale.h>
28 #include <assert.h>
29 //Added by qt3to4:
30 #include <QHideEvent>
31 #include <QLabel>
32 #include <QFrame>
33 #include <QResizeEvent>
35 extern KPPPWidget *p_kppp;
37 myMultiEdit::myMultiEdit(QWidget *parent, const char *name)
38 : Q3MultiLineEdit(parent, name)
40 setReadOnly(true);
43 void myMultiEdit::newLine() {
44 Q3MultiLineEdit::newLine();
48 DebugWidget::DebugWidget(QWidget *parent)
49 : QDialog(parent)
51 setModal( false );
52 setWindowTitle(i18n("Login Script Debug Window"));
54 text_window = new myMultiEdit(this,"debugwindow");
55 text_window->setGeometry(2,5,400, 300);
56 // text_window->setReadOnly(FALSE);
58 statuslabel = new QLabel(QString(), this );
59 statuslabel->setObjectName("statuslabel");
61 statuslabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
62 statuslabel->setAlignment( Qt::AlignLeft|Qt::AlignVCenter );
63 statuslabel->setGeometry(2, 307, 400, 20);
64 //statusPageLabel->setFont( KGlobalSettings::generalFont() );
66 dismiss = new QPushButton(this);
67 dismiss->setGeometry(330,340,70,30);
68 dismiss->setText(i18n("&Close"));
69 dismiss->setFocus();
70 connect(dismiss, SIGNAL(clicked()), SLOT(hide()));
73 /* fline = new QFrame(this,"line");
74 fline->setFrameStyle(QFrame::HLine |QFrame::Sunken);
75 fline->setGeometry(2,332,398,5);*/
76 adjustSize();
77 setMinimumSize(width(),height());
81 void DebugWidget::hideEvent(QHideEvent *)
83 assert(p_kppp);
84 p_kppp->con->debug->setChecked(false);
87 void DebugWidget::clear() {
88 text_window->clear();
92 void DebugWidget::addChar(unsigned char c) {
93 QString stuff;
95 if(c == '\r' || c == '\n') {
96 if(c == '\n')
97 text_window->newLine();
98 } else
99 text_window->insert(QString(c));
103 void DebugWidget::statusLabel(const QString &s) {
104 statuslabel->setText(s);
109 void DebugWidget::keyPressEvent(QKeyEvent *k) {
113 void DebugWidget::resizeEvent(QResizeEvent *e){
114 int w = width() ;
115 int h = height();
116 e = e;
118 text_window->setGeometry(2,5,w - 2 ,h - 63);
119 statuslabel->setGeometry(2, h - 56 , w -2 , 20);
120 dismiss->setGeometry(w - 72 , h - 32, 70, 30);
121 // fline->setGeometry(2,h -70 ,w - 4,5);
125 void DebugWidget::enter() {
126 text_window->append("\r\n");
130 void DebugWidget::toggleVisibility() {
131 if(isVisible())
132 hide();
133 else
134 show();
136 bool showlog = isVisible();
137 gpppdata.set_show_log_window(showlog);
141 #include "debug.moc"