Statusbar improvements:
[kdenetwork.git] / kppp / general.cpp
blobc55c0bc23fc950605fca98273535efae28a74109
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);
89 label->setBuddy(pppdTimeout);
91 tl->addSpacing(10);
93 QCheckBox *chkBox;
94 chkBox = new QCheckBox(i18n("Doc&k into panel on connect"), parent);
95 chkBox->setWhatsThis(
96 i18n("<p>After a connection is established, the\n"
97 "window is minimized and a small icon\n"
98 "in the KDE panel represents this window.\n"
99 "\n"
100 "Clicking on this icon will restore the\n"
101 "window to its original location and\n"
102 "size."));
104 chkBox->setChecked(gpppdata.get_dock_into_panel());
105 connect(chkBox,SIGNAL(toggled(bool)),
106 this, SLOT(docking_toggled(bool)));
107 tl->addWidget(chkBox);
109 chkBox = new QCheckBox(i18n("A&utomatic redial on disconnect"), parent);
110 chkBox->setChecked(gpppdata.automatic_redial());
111 connect(chkBox,SIGNAL(toggled(bool)),
112 this, SLOT(redial_toggled(bool)));
113 tl->addWidget(chkBox);
114 chkBox->setWhatsThis(
115 i18n("<p>When a connection is established and\n"
116 "it somehow gets disconnected, <i>kppp</i>\n"
117 "will try to reconnect to the same account.\n"
118 "\n"
119 "See <a href=\"#redial\">here</a> for more on this topic."));
121 chkBox = new QCheckBox(i18n("Automatic redial on NO &CARRIER"), parent);
122 chkBox->setChecked(gpppdata.get_redial_on_nocarrier());
123 connect(chkBox,SIGNAL(toggled(bool)),
124 this, SLOT(nocarrier_toggled(bool)));
125 tl->addWidget(chkBox);
126 chkBox->setWhatsThis(
127 i18n("<p>When dialing if modem returns NO CARRIER\n"
128 "the program will make a new attempt to redial\n"
129 "instead of waiting for user to click <CANCEL>\n"
130 "button."));
132 chkBox = new QCheckBox(i18n("&Show clock on caption"), parent);
133 chkBox->setChecked(gpppdata.get_show_clock_on_caption());
134 connect(chkBox, SIGNAL(toggled(bool)),
135 this, SLOT(caption_toggled(bool)));
136 tl->addWidget(chkBox);
137 chkBox->setWhatsThis(
138 i18n("When this option is checked, the window\n"
139 "title shows the time since a connection\n"
140 "was established. Very useful, so you \n"
141 "should turn this on"));
143 chkBox = new QCheckBox(i18n("Disco&nnect on X server shutdown"), parent);
144 chkBox->setChecked(gpppdata.get_xserver_exit_disconnect());
145 connect(chkBox, SIGNAL(toggled(bool)),
146 this, SLOT(xserver_toggled(bool)));
147 tl->addWidget(chkBox);
148 chkBox->setWhatsThis(
149 i18n("<p>Checking this option will close any\n"
150 "open connection when the X-server is\n"
151 "shut down. You should enable this option\n"
152 "unless you know what you are doing.\n"
153 "\n"
154 "See <a href=\"#disxserver\">here</a> for more on this."));
156 chkBox = new QCheckBox(i18n("&Quit on disconnect"), parent);
157 chkBox->setChecked(gpppdata.quit_on_disconnect());
158 connect(chkBox, SIGNAL(toggled(bool)),
159 this, SLOT(quit_toggled(bool)));
160 tl->addWidget(chkBox);
161 chkBox->setWhatsThis(
162 i18n("When this option is turned on, <i>kppp</i>\n"
163 "will be closed when you disconnect"));
165 chkBox = new QCheckBox(i18n("Minimi&ze window on connect"), parent);
166 chkBox->setChecked(gpppdata.get_iconify_on_connect());
167 connect(chkBox,SIGNAL(toggled(bool)),
168 this,SLOT(iconify_toggled(bool)));
169 tl->addWidget(chkBox);
170 chkBox->setWhatsThis(
171 i18n("Iconifies <i>kppp</i>'s window when a\n"
172 "connection is established"));
174 tl->addStretch();
179 void GeneralWidget::docking_toggled(bool on){
180 gpppdata.set_dock_into_panel(on);
184 void GeneralWidget::iconify_toggled(bool on){
185 gpppdata.set_iconify_on_connect(on);
189 void GeneralWidget::caption_toggled(bool on){
190 gpppdata.set_show_clock_on_caption(on);
194 void GeneralWidget::redial_toggled(bool on){
195 gpppdata.set_automatic_redial(on);
198 void GeneralWidget::nocarrier_toggled(bool on){
199 gpppdata.set_redial_on_nocarrier(on);
202 void GeneralWidget::xserver_toggled(bool on){
203 gpppdata.set_xserver_exit_disconnect(on);
207 void GeneralWidget::quit_toggled(bool on){
208 gpppdata.set_quit_on_disconnect(on);
212 void GeneralWidget::pppdtimeoutchanged(int n) {
213 gpppdata.setpppdTimeout(n);
218 ModemWidget::ModemWidget(QWidget *parent, bool isnewmodem)
219 : QWidget(parent)
221 QVBoxLayout *topLayout = new QVBoxLayout(parent);
222 topLayout->setSpacing(KDialog::spacingHint());
223 topLayout->setMargin(0);
224 topLayout->addWidget(this);
226 QGridLayout *tl = new QGridLayout(this );
227 tl->setSpacing( KDialog::spacingHint() );
229 connect_label = new QLabel(i18n("Modem &name:"), this);
230 tl->addWidget(connect_label, 0, 0);
232 connectname_l = new QLineEdit(this);
233 connectname_l->setMaxLength(ACCNAME_SIZE);
234 connect_label->setBuddy(connectname_l);
236 tl->addWidget(connectname_l, 0, 1);
237 QString tmp = i18n("Type in a unique name for this modem");
239 connect_label->setWhatsThis(tmp);
240 connectname_l->setWhatsThis(tmp);
242 label1 = new QLabel(i18n("Modem de&vice:"), this);
243 tl->addWidget(label1, 1, 0);
245 modemdevice = new QComboBox(this);
246 modemdevice->setEditable( false );
247 label1->setBuddy(modemdevice);
248 // ### deviceExist mechanism not functional right now
249 bool deviceExist = false;
250 for(int k = 0; devices[k]; k++)
252 if ( devices[k] == gpppdata.modemDevice())
253 deviceExist = true;
254 modemdevice->addItem(devices[k]);
256 if ( !deviceExist )
257 modemdevice->addItem(gpppdata.modemDevice());
259 tl->addWidget(modemdevice, 1, 1);
260 /* connect(modemdevice, SIGNAL(activated(int)),
261 SLOT(setmodemdc(int)));*/
262 tmp = i18n("This specifies the serial port your modem is attached \n"
263 "to. On Linux/x86, typically this is either /dev/ttyS0 \n"
264 "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n"
265 "\n"
266 "If you have an internal ISDN card with AT command\n"
267 "emulation (most cards under Linux support this), you\n"
268 "should select one of the /dev/ttyIx devices.");
270 label1->setWhatsThis(tmp);
271 modemdevice->setWhatsThis(tmp);
274 label2 = new QLabel(i18n("&Flow control:"), this);
275 tl->addWidget(label2, 2, 0);
277 flowcontrol = new QComboBox(this);
278 flowcontrol->setEditable( false );
279 label2->setBuddy(flowcontrol);
280 flowcontrol->addItem(i18n("Hardware [CRTSCTS]")); // sync with pppdata.cpp
281 flowcontrol->addItem(i18n("Software [XON/XOFF]"));
282 flowcontrol->addItem(i18n("None"));
284 flowListItem << "Hardware [CRTSCTS]";
285 flowListItem << "Software [XON/XOFF]";
286 flowListItem << "None";
288 tl->addWidget(flowcontrol, 2, 1);
289 /*connect(flowcontrol, SIGNAL(activated(int)),
290 SLOT(setflowcontrol(int)));*/
292 tmp = i18n("<p>Specifies how the serial port and modem\n"
293 "communicate. You should not change this unless\n"
294 "you know what you are doing.\n"
295 "\n"
296 "<b>Default</b>: CRTSCTS");
298 label2->setWhatsThis(tmp);
299 flowcontrol->setWhatsThis(tmp);
301 labelenter = new QLabel(i18n("&Line termination:"), this);
302 tl->addWidget(labelenter, 3, 0);
304 enter = new QComboBox(this);
305 enter->setEditable( false );
306 labelenter->setBuddy(enter);
307 enter->addItem("CR");
308 enter->addItem("LF");
309 enter->addItem("CR/LF");
310 tl->addWidget(enter, 3, 1);
311 /* connect(enter, SIGNAL(activated(int)), SLOT(setenter(int)));*/
312 tmp = i18n("<p>Specifies how AT commands are sent to your\n"
313 "modem. Most modems will work fine with the\n"
314 "default <i>CR/LF</i>. If your modem does not react\n"
315 "to the init string, you should try different\n"
316 "settings here\n"
317 "\n"
318 "<b>Default</b>: CR/LF");
320 labelenter->setWhatsThis(tmp);
321 enter->setWhatsThis( tmp);
323 baud_label = new QLabel(i18n("Co&nnection speed:"), this);
324 tl->addWidget(baud_label, 4, 0);
325 baud_c = new QComboBox(this);
326 baud_label->setBuddy(baud_c);
328 static const char *baudrates[] = {
330 #ifdef B460800
331 "460800",
332 #endif
334 #ifdef B230400
335 "230400",
336 #endif
338 #ifdef B115200
339 "115200",
340 #endif
342 #ifdef B57600
343 "57600",
344 #endif
346 "38400",
347 "19200",
348 "9600",
349 "2400",
352 for(int k = 0; baudrates[k]; k++)
353 baud_c->addItem(baudrates[k]);
355 baud_c->setCurrentIndex(3);
356 /*connect(baud_c, SIGNAL(activated(int)),
357 this, SLOT(speed_selection(int)));*/
358 tl->addWidget(baud_c, 4, 1);
360 tmp = i18n("Specifies the speed your modem and the serial\n"
361 "port talk to each other. You should begin with\n"
362 "at least 115200 bits/sec (or more if you know\n"
363 "that your serial port supports higher speeds).\n"
364 "If you have connection problems, try to reduce\n"
365 "this value.");
367 baud_label->setWhatsThis(tmp);
368 baud_c->setWhatsThis(tmp);
370 for(int i=0; i <= enter->count()-1; i++) {
371 if(gpppdata.enter() == enter->itemText(i))
372 enter->setCurrentIndex(i);
375 tl->addItem(new QSpacerItem(0, 10), 4, 0);
377 //Modem Lock File
378 modemlockfile = new QCheckBox(i18n("&Use lock file"), this);
380 modemlockfile->setChecked(gpppdata.modemLockFile());
381 /* connect(modemlockfile, SIGNAL(toggled(bool)),
382 SLOT(modemlockfilechanged(bool)));*/
383 tl->addWidget(modemlockfile, 5, 0, 1, 2);
384 // l12->addStretch(1);
385 modemlockfile->setWhatsThis(
386 i18n("<p>To prevent other programs from accessing the\n"
387 "modem while a connection is established, a\n"
388 "file can be created to indicate that the modem\n"
389 "is in use. On Linux an example file would be\n"
390 "<tt>/var/lock/LCK..ttyS1</tt>\n"
391 "Here you can select whether this locking will\n"
392 "be done.\n"
393 "\n"
394 "<b>Default</b>: On"));
396 // Modem Timeout Line Edit Box
398 modemtimeout = new KIntNumInput(gpppdata.modemTimeout(), this);
399 modemtimeout->setLabel(i18n("Modem &timeout:"));
400 modemtimeout->setRange(1, 120, 1);
401 modemtimeout->setSuffix(i18n(" sec"));
402 /* connect(modemtimeout, SIGNAL(valueChanged(int)),
403 SLOT(modemtimeoutchanged(int)));*/
404 tl->addWidget(modemtimeout, 6, 0, 1, 2);
406 modemtimeout->setWhatsThis(
407 i18n("This specifies how long <i>kppp</i> waits for a\n"
408 "<i>CONNECT</i> response from your modem. The\n"
409 "recommended value is 30 seconds."));
411 // Set defaults if editing an existing connection
412 if(!isnewmodem) {
413 connectname_l->setText(gpppdata.modname());
415 //set stuff from gpppdata
416 for(int i=0; i <= enter->count()-1; i++) {
417 if(gpppdata.enter() == enter->itemText(i))
418 enter->setCurrentIndex(i);
421 for(int i=0; i <= modemdevice->count()-1; i++) {
422 if(gpppdata.modemDevice() == modemdevice->itemText(i))
423 modemdevice->setCurrentIndex(i);
426 for(int i=0; i <= flowcontrol->count()-1; i++)
427 if(gpppdata.flowcontrol() == flowListItem[i])
428 flowcontrol->setCurrentIndex(i);
430 //set the modem speed
431 for(int i=0; i < baud_c->count(); i++)
432 if(baud_c->itemText(i) == gpppdata.speed())
433 baud_c->setCurrentIndex(i);
435 } else {
436 //Set the standard Items
437 enter->setCurrentIndex(0);
438 modemdevice->setCurrentIndex(0);
439 flowcontrol->setCurrentIndex(0);
440 baud_c->setCurrentIndex(0);
443 tl->setRowStretch(7, 1);
446 bool ModemWidget::save()
448 //first check to make sure that the modem name is unique!
449 if(connectname_l->text().isEmpty() ||
450 !gpppdata.isUniqueModname(connectname_l->text())) {
451 return false;
452 } else {
453 gpppdata.setModname(connectname_l->text());
454 gpppdata.setSpeed(baud_c->itemText(baud_c->currentIndex()));
455 gpppdata.setEnter(enter->itemText(enter->currentIndex()));
456 gpppdata.setModemDevice(modemdevice->itemText(modemdevice->currentIndex()));
457 gpppdata.setFlowcontrol(flowListItem[flowcontrol->currentIndex()]);
458 gpppdata.setModemLockFile(modemlockfile->isChecked());
459 gpppdata.setModemTimeout(modemtimeout->value());
460 return true;
465 ModemWidget2::ModemWidget2(QWidget *parent, const char *name)
466 : QWidget(parent)
468 setObjectName(name);
470 QVBoxLayout *topLayout = new QVBoxLayout(parent);
471 topLayout->setSpacing(KDialog::spacingHint());
472 topLayout->setMargin(0);
473 topLayout->addWidget(this);
475 QVBoxLayout *l1 = new QVBoxLayout(this);
476 l1->setSpacing(KDialog::spacingHint());
477 l1->setMargin(0);
480 waitfordt = new QCheckBox(i18n("&Wait for dial tone before dialing"), this);
481 waitfordt->setChecked(gpppdata.waitForDialTone());
482 // connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool)));
483 l1->addWidget(waitfordt);
484 waitfordt->setWhatsThis(
485 i18n("<p>Normally the modem waits for a dial tone\n"
486 "from your phone line, indicating that it can\n"
487 "start to dial a number. If your modem does not\n"
488 "recognize this sound, or your local phone system\n"
489 "does not emit such a tone, uncheck this option\n"
490 "\n"
491 "<b>Default:</b>: On"));
493 busywait = new KIntNumInput(gpppdata.busyWait(), this);
494 busywait->setLabel(i18n("B&usy wait:"));
495 busywait->setRange(0, 300, 5);
496 busywait->setSliderEnabled(true);
497 busywait->setSuffix(i18n(" sec"));
498 // connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int)));
499 l1->addWidget(busywait);
501 busywait->setWhatsThis(
502 i18n("Specifies the number of seconds to wait before\n"
503 "redial if all dialed numbers are busy. This is\n"
504 "necessary because some modems get stuck if the\n"
505 "same number is busy too often.\n"
506 "\n"
507 "The default is 0 seconds, you should not change\n"
508 "this unless you need to."));
510 l1->addSpacing(10);
512 QHBoxLayout *hbl = new QHBoxLayout;
513 hbl->setSpacing(KDialog::spacingHint());
515 QLabel *volumeLabel = new QLabel(i18n("Modem &volume:"), this);
516 hbl->addWidget(volumeLabel);
517 volume = new QSlider(Qt::Horizontal, this);
518 volume->setMinimum(0);
519 volume->setMaximum(2);
520 volume->setPageStep(1);
521 volume->setValue(gpppdata.volume());
522 volumeLabel->setBuddy(volume);
523 volume->setTickPosition(QSlider::TicksBelow);
524 hbl->addWidget(volume);
526 l1->addLayout(hbl);
528 /* connect(volume, SIGNAL(valueChanged(int)),
529 this, SLOT(volumeChanged(int)));*/
530 QString tmp = i18n("Most modems have a speaker which makes\n"
531 "a lot of noise when dialing. Here you can\n"
532 "either turn this completely off or select a\n"
533 "lower volume.\n"
534 "\n"
535 "If this does not work for your modem,\n"
536 "you must modify the modem volume command.");
538 volumeLabel->setWhatsThis(tmp);
539 volume->setWhatsThis( tmp);
541 l1->addSpacing(20);
543 #if 0
544 chkbox1 = new QCheckBox(i18n("Modem asserts CD line"), this);
545 chkbox1->setChecked(gpppdata.UseCDLine());
546 connect(chkbox1,SIGNAL(toggled(bool)),
547 this,SLOT(use_cdline_toggled(bool)));
548 l12->addWidget(chkbox1);
549 l12->addStretch(1);
550 l1->addStretch(1);
551 chkbox1->setWhatsThis(
552 i18n("This controls how <i>kppp</i> detects that the modem\n"
553 "is not responding. Unless you are having\n"
554 "problems with this, do not modify this setting.\n"
555 "\n"
556 "<b>Default</b>: Off"));
557 #endif
559 modemcmds = new QPushButton(i18n("Mod&em Commands..."), this);
560 modemcmds->setWhatsThis(
561 i18n("Allows you to change the AT command for\n"
562 "your modem."));
564 modeminfo_button = new QPushButton(i18n("&Query Modem..."), this);
565 modeminfo_button->setWhatsThis(
566 i18n("Most modems support the ATI command set to\n"
567 "find out vendor and revision of your modem.\n"
568 "\n"
569 "Press this button to query your modem for\n"
570 "this information. It can be useful to help\n"
571 "you set up the modem"));
573 terminal_button = new QPushButton(i18n("&Terminal..."), this);
574 terminal_button->setWhatsThis(
575 i18n("Opens the built-in terminal program. You\n"
576 "can use this if you want to play around\n"
577 "with your modem's AT command set"));
579 QHBoxLayout *hbox = new QHBoxLayout();
580 l1->addLayout(hbox);
581 hbox->addStretch(1);
582 QVBoxLayout *vbox = new QVBoxLayout();
583 hbox->addLayout(vbox);
585 vbox->addWidget(modemcmds);
586 vbox->addWidget(modeminfo_button);
587 vbox->addWidget(terminal_button);
589 hbox->addStretch(1);
590 l1->addStretch(1);
592 connect(modemcmds, SIGNAL(clicked()),
593 SLOT(modemcmdsbutton()));
594 connect(modeminfo_button, SIGNAL(clicked()),
595 SLOT(query_modem()));
596 connect(terminal_button, SIGNAL(clicked()),
597 SLOT(terminal()));
599 // Create the Modem Command so if the window is not opened they are autosaved anyway
600 mc = new ModemCommands(this);
604 void ModemWidget2::modemcmdsbutton() {
605 mc->exec();
609 void ModemWidget2::query_modem() {
610 ModemTransfer mt(this);
611 mt.exec();
615 void ModemWidget2::terminal() {
616 MiniTerm terminal(NULL,NULL);
617 terminal.exec();
621 #if 0
622 void ModemWidget2::use_cdline_toggled(bool on) {
623 gpppdata.setUseCDLine(on);
625 #endif
627 bool ModemWidget2::save()
629 gpppdata.setWaitForDialTone(waitfordt->isChecked());
630 gpppdata.setbusyWait(busywait->value());
631 gpppdata.setVolume(volume->value());
632 return true;
636 /////////////////////////////////////////////////////////////////////////////
638 // Setup widget for the graph
640 /////////////////////////////////////////////////////////////////////////////
641 GraphSetup::GraphSetup(QWidget *parent) :
642 QWidget(parent)
644 QVBoxLayout *tl = new QVBoxLayout(this);
646 bool enable;
647 QColor bg, text, in, out;
648 gpppdata.graphingOptions(enable, bg, text, in, out);
650 enable_check = new QCheckBox(i18n("&Enable throughput graph"), this);
651 tl->addWidget(enable_check);
653 grpColor = new Q3GroupBox(2, Qt::Horizontal,
654 i18n("Graph Colors"), this);
655 tl->addWidget(grpColor);
657 QLabel *label;
659 label = new QLabel(i18n("Bac&kground:"), grpColor);
660 bg_color = new KColorButton( bg, grpColor );
661 bg_color->setFixedSize(80, 24);
662 label->setBuddy(bg_color);
664 label = new QLabel(i18n("&Text:"), grpColor);
665 text_color = new KColorButton( text,grpColor );
666 text_color->setFixedSize(80, 24);
667 label->setBuddy(text_color);
669 label = new QLabel(i18n("I&nput bytes:"), grpColor);
670 in_color = new KColorButton( in,grpColor );
671 in_color->setFixedSize(80, 24);
672 label->setBuddy(in_color);
674 label = new QLabel(i18n("O&utput bytes:"), grpColor);
675 out_color = new KColorButton( out, grpColor );
676 out_color->setFixedSize(80, 24);
677 label->setBuddy(out_color);
679 tl->addStretch();
681 connect(enable_check, SIGNAL(toggled(bool)), this, SLOT(enableToggled(bool)));
682 connect(bg_color, SIGNAL(changed(const QColor &)),
683 SLOT(colorChanged(const QColor&)));
684 connect(text_color, SIGNAL(changed(const QColor &)),
685 SLOT(colorChanged(const QColor&)));
686 connect(in_color, SIGNAL(changed(const QColor &)),
687 SLOT(colorChanged(const QColor&)));
688 connect(out_color, SIGNAL(changed(const QColor &)),
689 SLOT(colorChanged(const QColor&)));
691 tl->activate();
693 enable_check->setChecked(enable);
694 enableToggled(enable);
697 void GraphSetup::enableToggled(bool b) {
698 grpColor->setEnabled(b);
699 save();
703 void GraphSetup::colorChanged(const QColor &) {
704 save();
707 void GraphSetup::save() {
708 gpppdata.setGraphingOptions(enable_check->isChecked(),
709 bg_color->color(),
710 text_color->color(),
711 in_color->color(),
712 out_color->color());
715 #include "general.moc"