//=========================================================================== // // This file is part of the KDE project // // Copyright (c) 2010 Timothy Pearson #include #include "querydlg.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef AF_LOCAL # define AF_LOCAL AF_UNIX #endif //=========================================================================== // // Simple dialog for displaying a password/PIN entry dialog // QueryDlg::QueryDlg(LockProcess *parent) : TQDialog(parent, "query dialog", true, WX11BypassWM), mUnlockingFailed(false) { frame = new TQFrame( this ); frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); frame->setLineWidth( 2 ); mpixLabel = new TQLabel( frame, "pixlabel" ); mpixLabel->setPixmap(DesktopIcon("unlock")); KUser user; mtqStatusLabel = new TQLabel( " ", frame ); //mtqStatusLabel->tqsetAlignment( TQLabel::AlignCenter ); mtqStatusLabel->tqsetAlignment( TQLabel::AlignLeft ); KSeparator *sep = new KSeparator( KSeparator::HLine, frame ); ok = new KPushButton( i18n("Unl&ock"), frame ); TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); unlockDialogLayout->addWidget( frame ); TQHBoxLayout *laytqStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); laytqStatus->addWidget( mtqStatusLabel ); TQHBoxLayout *layPin = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); pin_box = new KPasswordEdit( this, "pin_box" ); layPin->addWidget( pin_box ); pin_box->setFocus(); TQHBoxLayout *layButtons = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); layButtons->addStretch(); layButtons->addWidget( ok ); frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); frameLayout->addMultiCellWidget( mpixLabel, 0, 2, 0, 0, AlignTop ); frameLayout->addLayout( laytqStatus, 0, 1 ); frameLayout->addLayout( layPin, 2, 1 ); frameLayout->addMultiCellWidget( sep, 3, 3, 0, 1 ); frameLayout->addMultiCellLayout( layButtons, 4, 4, 0, 1 ); connect(ok, TQT_SIGNAL(clicked()), TQT_SLOT(slotOK())); installEventFilter(this); } QueryDlg::~QueryDlg() { hide(); } void QueryDlg::slotOK() { close(); } const char * QueryDlg::getEntry() { return pin_box->password(); } void QueryDlg::updateLabel(TQString &txt) { mtqStatusLabel->setPaletteForegroundColor(Qt::black); mtqStatusLabel->setText("" + txt + ""); } void QueryDlg::setUnlockIcon() { mpixLabel->setPixmap(DesktopIcon("unlock")); } void QueryDlg::setWarningIcon() { mpixLabel->setPixmap(DesktopIcon("messagebox_warning")); } void QueryDlg::show() { TQDialog::show(); TQApplication::flushX(); } #include "querydlg.moc"