1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#include <qstring.h>
#include <qlayout.h>
#include <qframe.h>
#include <qspinbox.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qfont.h>
#include <assert.h>
#include "krfbconnection.h"
#include "kvncoptionsdlg.h"
#include "kvncconnectdlg.h"
KVNCConnectDlg::KVNCConnectDlg( KRFBConnection *con,
QWidget *parent, const char *name )
: QDialog( parent, name, true )
{
setCaption( tr("Connect to VNC server") );
assert( con );
this->con = con;
QGridLayout *inner = new QGridLayout( this, 3, 2, 6 );
QLabel *label = new QLabel( tr("Host Name:"),
this , "hostLabel");
hostNameCombo = new QComboBox( true, this );
hostNameCombo->setInsertionPolicy( QComboBox::AtTop );
hostNameCombo->setMaxCount( 10 );
hostNameCombo->insertItem( "localhost" );
hostNameCombo->setFocus();
inner->addWidget( label, 0, 0 );
inner->addWidget( hostNameCombo, 0, 1 );
label = new QLabel( tr("Display Number:"), this, "displayNumber" );
displayNumberEdit = new QSpinBox( this );
inner->addWidget( label, 1, 0 );
inner->addWidget( displayNumberEdit, 1, 1 );
// if ( viewer->display() != -1 ) {
// displayNumberEdit->setValue( viewer->display() );
displayNumberEdit->setValue( 1 );
// }
label = new QLabel( tr("Password:"), this );
inner->addWidget( label, 2, 0 );
passwordEdit = new QLineEdit( this );
passwordEdit->setEchoMode( QLineEdit::Password );
inner->addWidget( passwordEdit, 2, 1 );
inner->setColStretch( 0, 0 );
inner->setColStretch( 1, 15 );
}
void KVNCConnectDlg::accept()
{
int dis;
// viewer->setHost(hostNameCombo->currentText());
QString temp = displayNumberEdit->text();
if(temp.isEmpty())
dis = -1;
else
dis = temp.toUInt();
// viewer->setDisplay(dis);
QDialog::accept();
}
void KVNCConnectDlg::options()
{
KVNCOptionsDlg *wdg = new KVNCOptionsDlg( con->options(), this );
wdg->exec();
delete wdg;
}
|