00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "passwordbase_p.h"
00010
00011 #include <qlabel.h>
00012 #include <qlineedit.h>
00013 #include <qpushbutton.h>
00014 #include <qlayout.h>
00015 #include <qvariant.h>
00016 #include <qtooltip.h>
00017 #include <qwhatsthis.h>
00018
00019
00020
00021
00022
00023 PasswordBase::PasswordBase( QWidget* parent, const char* name, WFlags fl )
00024 : QWidget( parent, name, fl )
00025 {
00026 if ( !name )
00027 setName( "PasswordBase" );
00028 resize( 243, 293 );
00029 QFont f( font() );
00030 f.setPointSize( 24 );
00031 setFont( f );
00032 PasswordBaseLayout = new QGridLayout( this );
00033 PasswordBaseLayout->setSpacing( 6 );
00034 PasswordBaseLayout->setMargin( 11 );
00035
00036 button_1 = new QLabel( this, "button_1" );
00037 button_1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, button_1->sizePolicy().hasHeightForWidth() ) );
00038 button_1->setFrameShape( QLabel::Box );
00039 button_1->setFrameShadow( QLabel::Raised );
00040 button_1->setText( tr( "1" ) );
00041 button_1->setAlignment( int( QLabel::AlignCenter ) );
00042
00043 PasswordBaseLayout->addWidget( button_1, 2, 0 );
00044
00045 button_2 = new QLabel( this, "button_2" );
00046 button_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, button_2->sizePolicy().hasHeightForWidth() ) );
00047 button_2->setFrameShape( QLabel::Box );
00048 button_2->setFrameShadow( QLabel::Raised );
00049 button_2->setText( tr( "2" ) );
00050 button_2->setAlignment( int( QLabel::AlignCenter ) );
00051
00052 PasswordBaseLayout->addWidget( button_2, 2, 1 );
00053
00054 button_3 = new QLabel( this, "button_3" );
00055 button_3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, button_3->sizePolicy().hasHeightForWidth() ) );
00056 button_3->setFrameShape( QLabel::Box );
00057 button_3->setFrameShadow( QLabel::Raised );
00058 button_3->setText( tr( "3" ) );
00059 button_3->setAlignment( int( QLabel::AlignCenter ) );
00060
00061 PasswordBaseLayout->addWidget( button_3, 2, 2 );
00062
00063 button_4 = new QLabel( this, "button_4" );
00064 button_4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, button_4->sizePolicy().hasHeightForWidth() ) );
00065 button_4->setFrameShape( QLabel::Box );
00066 button_4->setFrameShadow( QLabel::Raised );
00067 button_4->setText( tr( "4" ) );
00068 button_4->setAlignment( int( QLabel::AlignCenter ) );
00069
00070 PasswordBaseLayout->addWidget( button_4, 3, 0 );
00071
00072 button_5 = new QLabel( this, "button_5" );
00073 button_5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, button_5->sizePolicy().hasHeightForWidth() ) );
00074 button_5->setFrameShape( QLabel::Box );
00075 button_5->setFrameShadow( QLabel::Raised );
00076 button_5->setText( tr( "5" ) );
00077 button_5->setAlignment( int( QLabel::AlignCenter ) );
00078
00079 PasswordBaseLayout->addWidget( button_5, 3, 1 );
00080
00081 button_6 = new QLabel( this, "button_6" );
00082 button_6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, button_6->sizePolicy().hasHeightForWidth() ) );
00083 button_6->setFrameShape( QLabel::Box );
00084 button_6->setFrameShadow( QLabel::Raised );
00085 button_6->setText( tr( "6" ) );
00086 button_6->setAlignment( int( QLabel::AlignCenter ) );
00087
00088 PasswordBaseLayout->addWidget( button_6, 3, 2 );
00089
00090 button_7 = new QLabel( this, "button_7" );
00091 button_7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, button_7->sizePolicy().hasHeightForWidth() ) );
00092 button_7->setFrameShape( QLabel::Box );
00093 button_7->setFrameShadow( QLabel::Raised );
00094 button_7->setText( tr( "7" ) );
00095 button_7->setAlignment( int( QLabel::AlignCenter ) );
00096
00097 PasswordBaseLayout->addWidget( button_7, 4, 0 );
00098
00099 button_8 = new QLabel( this, "button_8" );
00100 button_8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, button_8->sizePolicy().hasHeightForWidth() ) );
00101 button_8->setFrameShape( QLabel::Box );
00102 button_8->setFrameShadow( QLabel::Raised );
00103 button_8->setText( tr( "8" ) );
00104 button_8->setAlignment( int( QLabel::AlignCenter ) );
00105
00106 PasswordBaseLayout->addWidget( button_8, 4, 1 );
00107
00108 button_9 = new QLabel( this, "button_9" );
00109 button_9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, button_9->sizePolicy().hasHeightForWidth() ) );
00110 button_9->setFrameShape( QLabel::Box );
00111 button_9->setFrameShadow( QLabel::Raised );
00112 button_9->setText( tr( "9" ) );
00113 button_9->setAlignment( int( QLabel::AlignCenter ) );
00114
00115 PasswordBaseLayout->addWidget( button_9, 4, 2 );
00116
00117 button_0 = new QLabel( this, "button_0" );
00118 button_0->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, button_0->sizePolicy().hasHeightForWidth() ) );
00119 button_0->setFrameShape( QLabel::Box );
00120 button_0->setFrameShadow( QLabel::Raised );
00121 button_0->setText( tr( "0" ) );
00122 button_0->setAlignment( int( QLabel::AlignCenter ) );
00123
00124 PasswordBaseLayout->addWidget( button_0, 5, 0 );
00125
00126 button_OK = new QLabel( this, "button_OK" );
00127 button_OK->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, button_OK->sizePolicy().hasHeightForWidth() ) );
00128 button_OK->setFrameShape( QLabel::Box );
00129 button_OK->setFrameShadow( QLabel::Raised );
00130 button_OK->setText( tr( "OK" ) );
00131 button_OK->setAlignment( int( QLabel::AlignCenter ) );
00132
00133 PasswordBaseLayout->addMultiCellWidget( button_OK, 5, 5, 1, 2 );
00134
00135 prompt = new QLabel( this, "prompt" );
00136 QFont prompt_font( prompt->font() );
00137 prompt_font.setPointSize( 18 );
00138 prompt->setFont( prompt_font );
00139 prompt->setText( tr( "Enter passcode" ) );
00140
00141 PasswordBaseLayout->addMultiCellWidget( prompt, 0, 0, 0, 2 );
00142
00143 display = new QLineEdit( this, "display" );
00144 display->setEnabled( FALSE );
00145 QPalette pal;
00146 QColorGroup cg;
00147 cg.setColor( QColorGroup::Foreground, black );
00148 cg.setColor( QColorGroup::Button, QColor( 228, 228, 228) );
00149 cg.setColor( QColorGroup::Light, white );
00150 cg.setColor( QColorGroup::Midlight, QColor( 242, 242, 242) );
00151 cg.setColor( QColorGroup::Dark, QColor( 78, 78, 78) );
00152 cg.setColor( QColorGroup::Mid, QColor( 183, 183, 183) );
00153 cg.setColor( QColorGroup::Text, black );
00154 cg.setColor( QColorGroup::BrightText, white );
00155 cg.setColor( QColorGroup::ButtonText, black );
00156 cg.setColor( QColorGroup::Base, white );
00157 cg.setColor( QColorGroup::Background, QColor( 220, 220, 220) );
00158 cg.setColor( QColorGroup::Shadow, black );
00159 cg.setColor( QColorGroup::Highlight, QColor( 10, 95, 137) );
00160 cg.setColor( QColorGroup::HighlightedText, white );
00161 pal.setActive( cg );
00162 cg.setColor( QColorGroup::Foreground, black );
00163 cg.setColor( QColorGroup::Button, QColor( 228, 228, 228) );
00164 cg.setColor( QColorGroup::Light, white );
00165 cg.setColor( QColorGroup::Midlight, QColor( 242, 242, 242) );
00166 cg.setColor( QColorGroup::Dark, QColor( 78, 78, 78) );
00167 cg.setColor( QColorGroup::Mid, QColor( 183, 183, 183) );
00168 cg.setColor( QColorGroup::Text, black );
00169 cg.setColor( QColorGroup::BrightText, white );
00170 cg.setColor( QColorGroup::ButtonText, black );
00171 cg.setColor( QColorGroup::Base, white );
00172 cg.setColor( QColorGroup::Background, QColor( 220, 220, 220) );
00173 cg.setColor( QColorGroup::Shadow, black );
00174 cg.setColor( QColorGroup::Highlight, QColor( 10, 95, 137) );
00175 cg.setColor( QColorGroup::HighlightedText, white );
00176 pal.setInactive( cg );
00177 cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) );
00178 cg.setColor( QColorGroup::Button, QColor( 228, 228, 228) );
00179 cg.setColor( QColorGroup::Light, white );
00180 cg.setColor( QColorGroup::Midlight, white );
00181 cg.setColor( QColorGroup::Dark, QColor( 114, 114, 114) );
00182 cg.setColor( QColorGroup::Mid, QColor( 152, 152, 152) );
00183 cg.setColor( QColorGroup::Text, black );
00184 cg.setColor( QColorGroup::BrightText, white );
00185 cg.setColor( QColorGroup::ButtonText, black );
00186 cg.setColor( QColorGroup::Base, white );
00187 cg.setColor( QColorGroup::Background, QColor( 220, 220, 220) );
00188 cg.setColor( QColorGroup::Shadow, black );
00189 cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
00190 cg.setColor( QColorGroup::HighlightedText, white );
00191 pal.setDisabled( cg );
00192 display->setPalette( pal );
00193 display->setEchoMode( QLineEdit::Password );
00194
00195 PasswordBaseLayout->addMultiCellWidget( display, 1, 1, 0, 2 );
00196 }
00197
00198
00199
00200
00201 PasswordBase::~PasswordBase()
00202 {
00203
00204 }
00205
00206
00207
00208
00209
00210 bool PasswordBase::event( QEvent* ev )
00211 {
00212 bool ret = QWidget::event( ev );
00213 if ( ev->type() == QEvent::ApplicationFontChange ) {
00214 QFont prompt_font( prompt->font() );
00215 prompt_font.setPointSize( 18 );
00216 prompt->setFont( prompt_font );
00217 }
00218 return ret;
00219 }
00220