//=========================================================================== // // This file is part of the KDE project // // Copyright (c) 2010 Timothy Pearson #include #include "infodlg.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 an unlock status or recurring error message // InfoDlg::InfoDlg(LockProcess *parent) : TQDialog(parent, "information dialog", true, (WFlags)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; mStatusLabel = new TQLabel( " ", frame ); mStatusLabel->tqsetAlignment( TQLabel::AlignCenter ); TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); unlockDialogLayout->addWidget( frame ); TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); layStatus->addWidget( mStatusLabel ); frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); frameLayout->addMultiCellWidget( mpixLabel, 0, 2, 0, 0, Qt::AlignTop ); frameLayout->addLayout( layStatus, 1, 1 ); installEventFilter(this); } InfoDlg::~InfoDlg() { hide(); } void InfoDlg::updateLabel(TQString &txt) { mStatusLabel->setPaletteForegroundColor(Qt::black); mStatusLabel->setText("" + txt + ""); } void InfoDlg::setUnlockIcon() { mpixLabel->setPixmap(DesktopIcon("unlock")); } void InfoDlg::setKDEIcon() { mpixLabel->setPixmap(DesktopIcon("about_kde")); } void InfoDlg::setInfoIcon() { mpixLabel->setPixmap(DesktopIcon("messagebox_info")); } void InfoDlg::setWarningIcon() { mpixLabel->setPixmap(DesktopIcon("messagebox_warning")); } void InfoDlg::setErrorIcon() { mpixLabel->setPixmap(DesktopIcon("messagebox_critical")); } void InfoDlg::show() { TQDialog::show(); TQApplication::flushX(); } #include "infodlg.moc"