00001 #include <qcheckbox.h> 00002 #include <qcombobox.h> 00003 #include <qspinbox.h> 00004 #include <qlineedit.h> 00005 00006 #include "kvncconndlg.h" 00007 00008 KVNCConnDlg::KVNCConnDlg( KRFBServer *options, 00009 QWidget *parent, char *name, bool modal ) 00010 : KVNCConnDlgBase( parent, name, modal, WStyle_ContextHelp ) 00011 { 00012 this->options=options; 00013 tmpOptions=*options; 00014 00015 serverHostname->setText(options->hostname); 00016 serverDisplay->setValue(options->display); 00017 serverPassword->setText(options->password); 00018 serverBookmark->setText(options->name); 00019 00020 hex->setChecked( options->hexTile ); 00021 corre->setChecked( options->corre ); 00022 rre->setChecked( options->rre ); 00023 copyRect->setChecked( options->copyrect ); 00024 00025 for (int i=0; i < scaleFactor->count(); ++i) { 00026 if (scaleFactor->text(i).toInt()==tmpOptions.scaleFactor) { 00027 scaleFactor->setCurrentItem(i); 00028 } 00029 } 00030 00031 // TODO 00032 hex->setEnabled( false ); 00033 corre->setEnabled( false ); 00034 rre->setEnabled( false ); 00035 // /TODO 00036 00037 deIconify->setChecked( options->deIconify ); 00038 bit->setChecked( options->colors256 ); 00039 shared->setChecked( options->shared ); 00040 timeBox->setValue( options->updateRate ); 00041 00042 serverPassword->setEchoMode(QLineEdit::Password); 00043 00044 connect(togglePassword, SIGNAL( stateChanged(int) ), this, SLOT( showPassword(int) ) ); 00045 00046 00047 } 00048 KVNCConnDlg::~KVNCConnDlg() 00049 { 00050 } 00051 00052 void KVNCConnDlg::accept() 00053 { 00054 save(); 00055 QDialog::accept(); 00056 } 00057 00058 void KVNCConnDlg::save() 00059 { 00060 tmpOptions.hexTile = hex->isChecked(); 00061 tmpOptions.corre = corre->isChecked(); 00062 tmpOptions.rre = rre->isChecked(); 00063 tmpOptions.copyrect = copyRect->isChecked(); 00064 tmpOptions.deIconify = deIconify->isChecked(); 00065 tmpOptions.colors256 = bit->isChecked(); 00066 tmpOptions.shared = shared->isChecked(); 00067 tmpOptions.hostname = serverHostname->text(); 00068 tmpOptions.password = serverPassword->text(); 00069 tmpOptions.display = serverDisplay->value(); 00070 tmpOptions.name = serverBookmark->text(); 00071 tmpOptions.scaleFactor = scaleFactor->currentText().toInt(); 00072 00073 if (!serverBookmark->text().isEmpty()) { 00074 if ( options) { 00075 *options=tmpOptions; 00076 } 00077 } 00078 } 00079 00080 void KVNCConnDlg::showPassword(int show) 00081 { 00082 if (show) 00083 serverPassword->setEchoMode(QLineEdit::Normal); 00084 else 00085 serverPassword->setEchoMode(QLineEdit::Password); 00086 }
1.4.2