This file looks large and may slow your browser down if we attempt
to syntax highlight it, so we are showing it without any
pretty colors.
Highlight
it anyway.
| 1 |
require 'Qt4' |
| 2 |
|
| 3 |
class DefaultSiteLoginDialog < Qt::Dialog |
| 4 |
|
| 5 |
def initialize( site, user, pass, parent ) |
| 6 |
super parent |
| 7 |
|
| 8 |
setWindowTitle( tr( "Login" ) ) |
| 9 |
|
| 10 |
@site = Qt::LineEdit.new( self ) |
| 11 |
@user = Qt::LineEdit.new( self ) |
| 12 |
@pass = Qt::LineEdit.new( self ) |
| 13 |
@pass.echoMode = Qt::LineEdit::Password |
| 14 |
|
| 15 |
@site.text = site |
| 16 |
@user.text = user |
| 17 |
@pass.text = pass |
| 18 |
|
| 19 |
@login = Qt::PushButton.new( tr( "OK" ) ) |
| 20 |
@cancel = Qt::PushButton.new( tr( "Cancel" ) ) |
| 21 |
|
| 22 |
@login.connect(SIGNAL(:clicked)) { self.accept } |
| 23 |
@cancel.connect(SIGNAL(:clicked)) { self.reject } |
| 24 |
@bottomLayout = Qt::HBoxLayout.new |
| 25 |
@bottomLayout.addStretch |
| 26 |
@bottomLayout.addWidget( @login ) |
| 27 |
@bottomLayout.addWidget( @cancel ) |
| 28 |
|
| 29 |
@mainLayout = Qt::VBoxLayout.new |
| 30 |
@mainLayout.addWidget( Qt::Label.new( tr( "Website:" ) ) ) |
| 31 |
@mainLayout.addWidget( @site ) |
| 32 |
@mainLayout.addWidget( Qt::Label.new( tr( "Username:" ) ) ) |
| 33 |
@mainLayout.addWidget( @user ) |
| 34 |
@mainLayout.addWidget( Qt::Label.new( tr( "Password:" ) ) ) |
| 35 |
@mainLayout.addWidget( @pass ) |
| 36 |
@mainLayout.addItem( @bottomLayout ) |
| 37 |
|
| 38 |
setLayout( @mainLayout ) |
| 39 |
end |
| 40 |
|
| 41 |
def site |
| 42 |
return @site.text.strip |
| 43 |
end |
| 44 |
|
| 45 |
def username |
| 46 |
return @user.text |
| 47 |
end |
| 48 |
|
| 49 |
def password |
| 50 |
return @pass.text |
| 51 |
end |
| 52 |
|
| 53 |
end |