* maximal -> maximum
[kdenetwork.git] / kppp / general.cpp
blobc7b1c9a976360b2dda3104b3b045ae0ff0ed0c73
1 /*
2 * kPPP: A pppd front end for the KDE project
4 * $Id$
6 * Copyright (C) 1997 Bernd Johannes Wuebben
7 * wuebben@math.cornell.edu
9 * based on EzPPP:
10 * Copyright (C) 1997 Jay Painter
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with this program; if not, write to the Free
24 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #include <termios.h>
28 #include <string.h>
30 //Added by qt3to4:
31 #include <QLabel>
32 #include <QVBoxLayout>
33 #include <QFrame>
34 #include <QHBoxLayout>
35 #include <QGridLayout>
37 #include <knuminput.h>
38 #include <qslider.h>
39 #include "general.h"
40 #include "version.h"
41 #include "miniterm.h"
42 #include "modeminfo.h"
43 #include "modemcmds.h"
44 #include "devices.h"
45 #include "pppdata.h"
46 #include <klocale.h>
47 #include <qlayout.h>
48 #include <q3grid.h>
50 /////////////////////////////////////////////////////////////////////////////
52 // Widget containing misc. configuration options
54 /////////////////////////////////////////////////////////////////////////////
55 GeneralWidget::GeneralWidget( QWidget *parent, const char *name)
56 : QWidget(parent)
58 setObjectName(name);
60 QVBoxLayout *tl = new QVBoxLayout(parent);
61 tl->setSpacing(KDialog::spacingHint());
62 tl->setMargin(0);
64 QHBoxLayout *hbox = new QHBoxLayout();
65 tl->addItem(hbox);
66 QLabel *label;
67 label = new QLabel(i18n("pppd version:"), parent);
68 hbox->addWidget(label);
69 QString version = gpppdata.pppdVersion();
70 if(version == "0.0.0")
71 version = "unknown";
72 label = new QLabel(version, parent);
73 label->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
74 hbox->addWidget(label);
76 KIntNumInput *pppdTimeout = new KIntNumInput(gpppdata.pppdTimeout(), parent);
77 pppdTimeout->setLabel(i18n("pppd &timeout:"));
78 pppdTimeout->setRange(1, TIMEOUT_SIZE, 5);
79 pppdTimeout->setSliderEnabled(true);
80 pppdTimeout->setSuffix(i18n(" sec"));
81 connect(pppdTimeout, SIGNAL(valueChanged(int)),
82 SLOT(pppdtimeoutchanged(int)));
83 tl->addWidget(pppdTimeout);
84 QString tmp = i18n("<i>kppp</i> will wait this number of seconds\n"
85 "to see if a PPP connection is established.\n"
86 "If no connection is made in this time frame,\n"
87 "<i>kppp</i> will give up and kill pppd.");
88 pppdTimeout->setWhatsThis(tmp);
90 tl->addSpacing(10);
92 QCheckBox *chkBox;
93 chkBox = new QCheckBox(i18n("Doc&k into panel on connect"), parent);
94 chkBox->setWhatsThis(
95 i18n("<p>After a connection is established, the\n"
96 "window is minimized and a small icon\n"
97 "in the KDE panel represents this window.\n"
98 "\n"
99 "Clicking on this icon will restore the\n"
100 "window to its original location and\n"
101 "size."));
103 chkBox->setChecked(gpppdata.get_dock_into_panel());
104 connect(chkBox,SIGNAL(toggled(bool)),
105 this, SLOT(docking_toggled(bool)));
106 tl->addWidget(chkBox);
108 chkBox = new QCheckBox(i18n("A&utomatic redial on disconnect"), parent);
109 chkBox->setChecked(gpppdata.automatic_redial());
110 connect(chkBox,SIGNAL(toggled(bool)),
111 this, SLOT(redial_toggled(bool)));
112 tl->addWidget(chkBox);
113 chkBox->setWhatsThis(
114 i18n("<p>When a connection is established and\n"
115 "it somehow gets disconnected, <i>kppp</i>\n"
116 "will try to reconnect to the same account.\n"
117 "\n"
118 "See <a href=\"#redial\">here</a> for more on this topic."));
120 chkBox = new QCheckBox(i18n("Automatic redial on NO &CARRIER"), parent);
121 chkBox->setChecked(gpppdata.get_redial_on_nocarrier());
122 connect(chkBox,SIGNAL(toggled(bool)),
123 this, SLOT(nocarrier_toggled(bool)));
124 tl->addWidget(chkBox);
125 chkBox->setWhatsThis(
126 i18n("<p>When dialing if modem returns NO CARRIER\n"
127 "the program will make a new attempt to redial\n"
128 "instead of waiting for user to click <CANCEL>\n"
129 "button."));
131 chkBox = new QCheckBox(i18n("&Show clock on caption"), parent);
132 chkBox->setChecked(gpppdata.get_show_clock_on_caption());
133 connect(chkBox, SIGNAL(toggled(bool)),
134 this, SLOT(caption_toggled(bool)));
135 tl->addWidget(chkBox);
136 chkBox->setWhatsThis(
137 i18n("When this option is checked, the window\n"
138 "title shows the time since a connection\n"
139 "was established. Very useful, so you \n"
140 "should turn this on"));
142 chkBox = new QCheckBox(i18n("Disco&nnect on X server shutdown"), parent);
143 chkBox->setChecked(gpppdata.get_xserver_exit_disconnect());
144 connect(chkBox, SIGNAL(toggled(bool)),
145 this, SLOT(xserver_toggled(bool)));
146 tl->addWidget(chkBox);
147 chkBox->setWhatsThis(
148 i18n("<p>Checking this option will close any\n"
149 "open connection when the X-server is\n"
150 "shut down. You should enable this option\n"
151 "unless you know what you are doing.\n"
152 "\n"
153 "See <a href=\"#disxserver\">here</a> for more on this."));
155 chkBox = new QCheckBox(i18n("&Quit on disconnect"), parent);
156 chkBox->setChecked(gpppdata.quit_on_disconnect());
157 connect(chkBox, SIGNAL(toggled(bool)),
158 this, SLOT(quit_toggled(bool)));
159 tl->addWidget(chkBox);
160 chkBox->setWhatsThis(
161 i18n("When this option is turned on, <i>kppp</i>\n"
162 "will be closed when you disconnect"));
164 chkBox = new QCheckBox(i18n("Minimi&ze window on connect"), parent);
165 chkBox->setChecked(gpppdata.get_iconify_on_connect());
166 connect(chkBox,SIGNAL(toggled(bool)),
167 this,SLOT(iconify_toggled(bool)));
168 tl->addWidget(chkBox);
169 chkBox->setWhatsThis(
170 i18n("Iconifies <i>kppp</i>'s window when a\n"
171 "connection is established"));
173 tl->addStretch();
178 void GeneralWidget::docking_toggled(bool on){
179 gpppdata.set_dock_into_panel(on);
183 void GeneralWidget::iconify_toggled(bool on){
184 gpppdata.set_iconify_on_connect(on);
188 void GeneralWidget::caption_toggled(bool on){
189 gpppdata.set_show_clock_on_caption(on);
193 void GeneralWidget::redial_toggled(bool on){
194 gpppdata.set_automatic_redial(on);
197 void GeneralWidget::nocarrier_toggled(bool on){
198 gpppdata.set_redial_on_nocarrier(on);
201 void GeneralWidget::xserver_toggled(bool on){
202 gpppdata.set_xserver_exit_disconnect(on);
206 void GeneralWidget::quit_toggled(bool on){
207 gpppdata.set_quit_on_disconnect(on);
211 void GeneralWidget::pppdtimeoutchanged(int n) {
212 gpppdata.setpppdTimeout(n);
217 ModemWidget::ModemWidget(QWidget *parent, bool isnewmodem)
218 : QWidget(parent)
220 QVBoxLayout *topLayout = new QVBoxLayout(parent);
221 topLayout->setSpacing(KDialog::spacingHint());
222 topLayout->setMargin(0);
223 topLayout->addWidget(this);
225 QGridLayout *tl = new QGridLayout(this );
226 tl->setSpacing( KDialog::spacingHint() );
228 connect_label = new QLabel(i18n("Modem &name:"), this);
229 tl->addWidget(connect_label, 0, 0);
231 connectname_l = new QLineEdit(this);
232 connectname_l->setMaxLength(ACCNAME_SIZE);
233 connect_label->setBuddy(connectname_l);
235 tl->addWidget(connectname_l, 0, 1);
236 QString tmp = i18n("Type in a unique name for this modem");
238 connect_label->setWhatsThis(tmp);
239 connectname_l->setWhatsThis(tmp);
241 label1 = new QLabel(i18n("Modem de&vice:"), this);
242 tl->addWidget(label1, 1, 0);
244 modemdevice = new QComboBox(this);
245 modemdevice->setEditable( false );
246 label1->setBuddy(modemdevice);
247 // ### deviceExist mechanism not functional right now
248 bool deviceExist = false;
249 for(int k = 0; devices[k]; k++)
251 if ( devices[k] == gpppdata.modemDevice())
252 deviceExist = true;
253 modemdevice->addItem(devices[k]);
255 if ( !deviceExist )
256 modemdevice->addItem(gpppdata.modemDevice());
258 tl->addWidget(modemdevice, 1, 1);
259 /* connect(modemdevice, SIGNAL(activated(int)),
260 SLOT(setmodemdc(int)));*/
261 tmp = i18n("This specifies the serial port your modem is attached \n"
262 "to. On Linux/x86, typically this is either /dev/ttyS0 \n"
263 "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n"
264 "\n"
265 "If you have an internal ISDN card with AT command\n"
266 "emulation (most cards under Linux support this), you\n"
267 "should select one of the /dev/ttyIx devices.");
269 label1->setWhatsThis(tmp);
270 modemdevice->setWhatsThis(tmp);
273 label2 = new QLabel(i18n("&Flow control:"), this);
274 tl->addWidget(label2, 2, 0);
276 flowcontrol = new QComboBox(this);
277 flowcontrol->setEditable( false );
278 label2->setBuddy(flowcontrol);
279 flowcontrol->addItem(i18n("Hardware [CRTSCTS]")); // sync with pppdata.cpp
280 flowcontrol->addItem(i18n("Software [XON/XOFF]"));
281 flowcontrol->addItem(i18n("None"));
283 flowListItem << "Hardware [CRTSCTS]";
284 flowListItem << "Software [XON/XOFF]";
285 flowListItem << "None";
287 tl->addWidget(flowcontrol, 2, 1);
288 /*connect(flowcontrol, SIGNAL(activated(int)),
289 SLOT(setflowcontrol(int)));*/
291 tmp = i18n("<p>Specifies how the serial port and modem\n"
292 "communicate. You should not change this unless\n"
293 "you know what you are doing.\n"
294 "\n"
295 "<b>Default</b>: CRTSCTS");
297 label2->setWhatsThis(tmp);
298 flowcontrol->setWhatsThis(tmp);
300 labelenter = new QLabel(i18n("&Line termination:"), this);
301 tl->addWidget(labelenter, 3, 0);
303 enter = new QComboBox(this);
304 enter->setEditable( false );
305 labelenter->setBuddy(enter);
306 enter->addItem("CR");
307 enter->addItem("LF");
308 enter->addItem("CR/LF");
309 tl->addWidget(enter, 3, 1);
310 /* connect(enter, SIGNAL(activated(int)), SLOT(setenter(int)));*/
311 tmp = i18n("<p>Specifies how AT commands are sent to your\n"
312 "modem. Most modems will work fine with the\n"
313 "default <i>CR/LF</i>. If your modem does not react\n"
314 "to the init string, you should try different\n"
315 "settings here\n"
316 "\n"
317 "<b>Default</b>: CR/LF");
319 labelenter->setWhatsThis(tmp);
320 enter->setWhatsThis( tmp);
322 baud_label = new QLabel(i18n("Co&nnection speed:"), this);
323 tl->addWidget(baud_label, 4, 0);
324 baud_c = new QComboBox(this);
325 baud_label->setBuddy(baud_c);
327 static const char *baudrates[] = {
329 #ifdef B460800
330 "460800",
331 #endif
333 #ifdef B230400
334 "230400",
335 #endif
337 #ifdef B115200
338 "115200",
339 #endif
341 #ifdef B57600
342 "57600",
343 #endif
345 "38400",
346 "19200",
347 "9600",
348 "2400",
351 for(int k = 0; baudrates[k]; k++)
352 baud_c->addItem(baudrates[k]);
354 baud_c->setCurrentIndex(3);
355 /*connect(baud_c, SIGNAL(activated(int)),
356 this, SLOT(speed_selection(int)));*/
357 tl->addWidget(baud_c, 4, 1);
359 tmp = i18n("Specifies the speed your modem and the serial\n"
360 "port talk to each other. You should begin with\n"
361 "at least 115200 bits/sec (or more if you know\n"
362 "that your serial port supports higher speeds).\n"
363 "If you have connection problems, try to reduce\n"
364 "this value.");
366 baud_label->setWhatsThis(tmp);
367 baud_c->setWhatsThis(tmp);
369 for(int i=0; i <= enter->count()-1; i++) {
370 if(gpppdata.enter() == enter->itemText(i))
371 enter->setCurrentIndex(i);
374 tl->addItem(new QSpacerItem(0, 10), 4, 0);
376 //Modem Lock File
377 modemlockfile = new QCheckBox(i18n("&Use lock file"), this);
379 modemlockfile->setChecked(gpppdata.modemLockFile());
380 /* connect(modemlockfile, SIGNAL(toggled(bool)),
381 SLOT(modemlockfilechanged(bool)));*/
382 tl->addWidget(modemlockfile, 5, 0, 1, 2);
383 // l12->addStretch(1);
384 modemlockfile->setWhatsThis(
385 i18n("<p>To prevent other programs from accessing the\n"
386 "modem while a connection is established, a\n"
387 "file can be created to indicate that the modem\n"
388 "is in use. On Linux an example file would be\n"
389 "<tt>/var/lock/LCK..ttyS1</tt>\n"
390 "Here you can select whether this locking will\n"
391 "be done.\n"
392 "\n"
393 "<b>Default</b>: On"));
395 // Modem Timeout Line Edit Box
397 modemtimeout = new KIntNumInput(gpppdata.modemTimeout(), this);
398 modemtimeout->setLabel(i18n("Modem &timeout:"));
399 modemtimeout->setRange(1, 120, 1);
400 modemtimeout->setSuffix(i18n(" sec"));
401 /* connect(modemtimeout, SIGNAL(valueChanged(int)),
402 SLOT(modemtimeoutchanged(int)));*/
403 tl->addWidget(modemtimeout, 6, 0, 1, 2);
405 modemtimeout->setWhatsThis(
406 i18n("This specifies how long <i>kppp</i> waits for a\n"
407 "<i>CONNECT</i> response from your modem. The\n"
408 "recommended value is 30 seconds."));
410 // Set defaults if editing an existing connection
411 if(!isnewmodem) {
412 connectname_l->setText(gpppdata.modname());
414 //set stuff from gpppdata
415 for(int i=0; i <= enter->count()-1; i++) {
416 if(gpppdata.enter() == enter->itemText(i))
417 enter->setCurrentIndex(i);
420 for(int i=0; i <= modemdevice->count()-1; i++) {
421 if(gpppdata.modemDevice() == modemdevice->itemText(i))
422 modemdevice->setCurrentIndex(i);
425 for(int i=0; i <= flowcontrol->count()-1; i++)
426 if(gpppdata.flowcontrol() == flowListItem[i])
427 flowcontrol->setCurrentIndex(i);
429 //set the modem speed
430 for(int i=0; i < baud_c->count(); i++)
431 if(baud_c->itemText(i) == gpppdata.speed())
432 baud_c->setCurrentIndex(i);
434 } else {
435 //Set the standard Items
436 enter->setCurrentIndex(0);
437 modemdevice->setCurrentIndex(0);
438 flowcontrol->setCurrentIndex(0);
439 baud_c->setCurrentIndex(0);
442 tl->setRowStretch(7, 1);
445 bool ModemWidget::save()
447 //first check to make sure that the modem name is unique!
448 if(connectname_l->text().isEmpty() ||
449 !gpppdata.isUniqueModname(connectname_l->text())) {
450 return false;
451 } else {
452 gpppdata.setModname(connectname_l->text());
453 gpppdata.setSpeed(baud_c->itemText(baud_c->currentIndex()));
454 gpppdata.setEnter(enter->itemText(enter->currentIndex()));
455 gpppdata.setModemDevice(modemdevice->itemText(modemdevice->currentIndex()));
456 gpppdata.setFlowcontrol(flowListItem[flowcontrol->currentIndex()]);
457 gpppdata.setModemLockFile(modemlockfile->isChecked());
458 gpppdata.setModemTimeout(modemtimeout->value());
459 return true;
464 ModemWidget2::ModemWidget2(QWidget *parent, const char *name)
465 : QWidget(parent)
467 setObjectName(name);
469 QVBoxLayout *topLayout = new QVBoxLayout(parent);
470 topLayout->setSpacing(KDialog::spacingHint());
471 topLayout->setMargin(0);
472 topLayout->addWidget(this);
474 QVBoxLayout *l1 = new QVBoxLayout(this);
475 l1->setSpacing(KDialog::spacingHint());
476 l1->setMargin(0);
479 waitfordt = new QCheckBox(i18n("&Wait for dial tone before dialing"), this);
480 waitfordt->setChecked(gpppdata.waitForDialTone());
481 // connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool)));
482 l1->addWidget(waitfordt);
483 waitfordt->setWhatsThis(
484 i18n("<p>Normally the modem waits for a dial tone\n"
485 "from your phone line, indicating that it can\n"
486 "start to dial a number. If your modem does not\n"
487 "recognize this sound, or your local phone system\n"
488 "does not emit such a tone, uncheck this option\n"
489 "\n"
490 "<b>Default:</b>: On"));
492 busywait = new KIntNumInput(gpppdata.busyWait(), this);
493 busywait->setLabel(i18n("B&usy wait:"));
494 busywait->setRange(0, 300, 5);
495 busywait->setSliderEnabled(true);
496 busywait->setSuffix(i18n(" sec"));
497 // connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int)));
498 l1->addWidget(busywait);
500 busywait->setWhatsThis(
501 i18n("Specifies the number of seconds to wait before\n"
502 "redial if all dialed numbers are busy. This is\n"
503 "necessary because some modems get stuck if the\n"
504 "same number is busy too often.\n"
505 "\n"
506 "The default is 0 seconds, you should not change\n"
507 "this unless you need to."));
509 l1->addSpacing(10);
511 QHBoxLayout *hbl = new QHBoxLayout;
512 hbl->setSpacing(KDialog::spacingHint());
514 QLabel *volumeLabel = new QLabel(i18n("Modem &volume:"), this);
515 hbl->addWidget(volumeLabel);
516 volume = new QSlider(Qt::Horizontal, this);
517 volume->setMinimum(0);
518 volume->setMaximum(2);
519 volume->setPageStep(1);
520 volume->setValue(gpppdata.volume());
521 volumeLabel->setBuddy(volume);
522 volume->setTickPosition(QSlider::TicksBelow);
523 hbl->addWidget(volume);
525 l1->addLayout(hbl);
527 /* connect(volume, SIGNAL(valueChanged(int)),
528 this, SLOT(volumeChanged(int)));*/
529 QString tmp = i18n("Most modems have a speaker which makes\n"
530 "a lot of noise when dialing. Here you can\n"
531 "either turn this completely off or select a\n"
532 "lower volume.\n"
533 "\n"
534 "If this does not work for your modem,\n"
535 "you must modify the modem volume command.");
537 volumeLabel->setWhatsThis(tmp);
538 volume->setWhatsThis( tmp);
540 l1->addSpacing(20);
542 #if 0
543 chkbox1 = new QCheckBox(i18n("Modem asserts CD line"), this);
544 chkbox1->setChecked(gpppdata.UseCDLine());
545 connect(chkbox1,SIGNAL(toggled(bool)),
546 this,SLOT(use_cdline_toggled(bool)));
547 l12->addWidget(chkbox1);
548 l12->addStretch(1);
549 l1->addStretch(1);
550 chkbox1->setWhatsThis(
551 i18n("This controls how <i>kppp</i> detects that the modem\n"
552 "is not responding. Unless you are having\n"
553 "problems with this, do not modify this setting.\n"
554 "\n"
555 "<b>Default</b>: Off"));
556 #endif
558 modemcmds = new QPushButton(i18n("Mod&em Commands..."), this);
559 modemcmds->setWhatsThis(
560 i18n("Allows you to change the AT command for\n"
561 "your modem."));
563 modeminfo_button = new QPushButton(i18n("&Query Modem..."), this);
564 modeminfo_button->setWhatsThis(
565 i18n("Most modems support the ATI command set to\n"
566 "find out vendor and revision of your modem.\n"
567 "\n"
568 "Press this button to query your modem for\n"
569 "this information. It can be useful to help\n"
570 "you set up the modem"));
572 terminal_button = new QPushButton(i18n("&Terminal..."), this);
573 terminal_button->setWhatsThis(
574 i18n("Opens the built-in terminal program. You\n"
575 "can use this if you want to play around\n"
576 "with your modem's AT command set"));
578 QHBoxLayout *hbox = new QHBoxLayout();
579 l1->addLayout(hbox);
580 hbox->addStretch(1);
581 QVBoxLayout *vbox = new QVBoxLayout();
582 hbox->addLayout(vbox);
584 vbox->addWidget(modemcmds);
585 vbox->addWidget(modeminfo_button);
586 vbox->addWidget(terminal_button);
588 hbox->addStretch(1);
589 l1->addStretch(1);
591 connect(modemcmds, SIGNAL(clicked()),
592 SLOT(modemcmdsbutton()));
593 connect(modeminfo_button, SIGNAL(clicked()),
594 SLOT(query_modem()));
595 connect(terminal_button, SIGNAL(clicked()),
596 SLOT(terminal()));
598 // Create the Modem Command so if the window is not opened they are autosaved anyway
599 mc = new ModemCommands(this);
603 void ModemWidget2::modemcmdsbutton() {
604 mc->exec();
608 void ModemWidget2::query_modem() {
609 ModemTransfer mt(this);
610 mt.exec();
614 void ModemWidget2::terminal() {
615 MiniTerm terminal(NULL,NULL);
616 terminal.exec();
620 #if 0
621 void ModemWidget2::use_cdline_toggled(bool on) {
622 gpppdata.setUseCDLine(on);
624 #endif
626 bool ModemWidget2::save()
628 gpppdata.setWaitForDialTone(waitfordt->isChecked());
629 gpppdata.setbusyWait(busywait->value());
630 gpppdata.setVolume(volume->value());
631 return true;
635 /////////////////////////////////////////////////////////////////////////////
637 // Setup widget for the graph
639 /////////////////////////////////////////////////////////////////////////////
640 GraphSetup::GraphSetup(QWidget *parent) :
641 QWidget(parent)
643 QVBoxLayout *tl = new QVBoxLayout(this);
645 bool enable;
646 QColor bg, text, in, out;
647 gpppdata.graphingOptions(enable, bg, text, in, out);
649 enable_check = new QCheckBox(i18n("&Enable throughput graph"), this);
650 tl->addWidget(enable_check);
652 grpColor = new Q3GroupBox(2, Qt::Horizontal,
653 i18n("Graph Colors"), this);
654 tl->addWidget(grpColor);
656 QLabel *label;
658 label = new QLabel(i18n("Bac&kground:"), grpColor);
659 bg_color = new KColorButton( bg, grpColor );
660 bg_color->setFixedSize(80, 24);
661 label->setBuddy(bg_color);
663 label = new QLabel(i18n("&Text:"), grpColor);
664 text_color = new KColorButton( text,grpColor );
665 text_color->setFixedSize(80, 24);
666 label->setBuddy(text_color);
668 label = new QLabel(i18n("I&nput bytes:"), grpColor);
669 in_color = new KColorButton( in,grpColor );
670 in_color->setFixedSize(80, 24);
671 label->setBuddy(in_color);
673 label = new QLabel(i18n("O&utput bytes:"), grpColor);
674 out_color = new KColorButton( out, grpColor );
675 out_color->setFixedSize(80, 24);
676 label->setBuddy(out_color);
678 tl->addStretch();
680 connect(enable_check, SIGNAL(toggled(bool)), this, SLOT(enableToggled(bool)));
681 connect(bg_color, SIGNAL(changed(const QColor &)),
682 SLOT(colorChanged(const QColor&)));
683 connect(text_color, SIGNAL(changed(const QColor &)),
684 SLOT(colorChanged(const QColor&)));
685 connect(in_color, SIGNAL(changed(const QColor &)),
686 SLOT(colorChanged(const QColor&)));
687 connect(out_color, SIGNAL(changed(const QColor &)),
688 SLOT(colorChanged(const QColor&)));
690 tl->activate();
692 enable_check->setChecked(enable);
693 enableToggled(enable);
696 void GraphSetup::enableToggled(bool b) {
697 grpColor->setEnabled(b);
698 save();
702 void GraphSetup::colorChanged(const QColor &) {
703 save();
706 void GraphSetup::save() {
707 gpppdata.setGraphingOptions(enable_check->isChecked(),
708 bg_color->color(),
709 text_color->color(),
710 in_color->color(),
711 out_color->color());
714 #include "general.moc"