You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
156 lines
4.0 KiB
156 lines
4.0 KiB
13 years ago
|
//===========================================================================
|
||
|
//
|
||
9 years ago
|
// This file is part of the TDE project
|
||
13 years ago
|
//
|
||
9 years ago
|
// Copyright (c) 2010 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
|
||
13 years ago
|
|
||
|
#include <config.h>
|
||
|
|
||
|
#include "sakdlg.h"
|
||
|
|
||
|
#include <dmctl.h>
|
||
|
|
||
12 years ago
|
#include <tdeapplication.h>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
13 years ago
|
#include <kpushbutton.h>
|
||
|
#include <kseparator.h>
|
||
|
#include <kstandarddirs.h>
|
||
12 years ago
|
#include <tdeglobalsettings.h>
|
||
12 years ago
|
#include <tdeconfig.h>
|
||
13 years ago
|
#include <kiconloader.h>
|
||
13 years ago
|
#include <tdesu/defaults.h>
|
||
13 years ago
|
#include <kpassdlg.h>
|
||
|
#include <kdebug.h>
|
||
|
#include <kuser.h>
|
||
|
#include <dcopref.h>
|
||
12 years ago
|
#include <tdemessagebox.h>
|
||
13 years ago
|
#include <kdialog.h>
|
||
13 years ago
|
|
||
13 years ago
|
#include <tqlayout.h>
|
||
13 years ago
|
#include <tqpushbutton.h>
|
||
|
#include <tqmessagebox.h>
|
||
|
#include <tqsimplerichtext.h>
|
||
|
#include <tqlabel.h>
|
||
|
#include <tqstringlist.h>
|
||
|
#include <tqfontmetrics.h>
|
||
|
#include <tqstyle.h>
|
||
|
#include <tqapplication.h>
|
||
|
#include <tqlistview.h>
|
||
|
#include <tqheader.h>
|
||
|
#include <tqcheckbox.h>
|
||
|
|
||
|
#include <ctype.h>
|
||
|
#include <unistd.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <errno.h>
|
||
|
#include <pwd.h>
|
||
|
#include <sys/types.h>
|
||
|
#include <sys/socket.h>
|
||
|
|
||
|
#include <X11/Xutil.h>
|
||
|
#include <X11/keysym.h>
|
||
|
#include <X11/Xatom.h>
|
||
|
#include <fixx11h.h>
|
||
|
|
||
|
#ifndef AF_LOCAL
|
||
|
# define AF_LOCAL AF_UNIX
|
||
|
#endif
|
||
|
|
||
|
extern bool trinity_desktop_lock_use_system_modal_dialogs;
|
||
|
extern bool trinity_desktop_lock_use_sak;
|
||
|
|
||
|
//===========================================================================
|
||
|
//
|
||
|
// Simple dialog for displaying an unlock status or recurring error message
|
||
|
//
|
||
|
SAKDlg::SAKDlg(LockProcess *parent)
|
||
9 years ago
|
: TQDialog(parent, "information dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))),
|
||
|
mUnlockingFailed(false)
|
||
13 years ago
|
{
|
||
9 years ago
|
if (trinity_desktop_lock_use_system_modal_dialogs) {
|
||
|
// Signal that we do not want any window controls to be shown at all
|
||
|
Atom kde_wm_system_modal_notification;
|
||
|
kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False);
|
||
|
XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L);
|
||
|
}
|
||
|
setCaption(i18n("Desktop Session Locked"));
|
||
13 years ago
|
|
||
9 years ago
|
frame = new TQFrame( this );
|
||
|
if (trinity_desktop_lock_use_system_modal_dialogs) {
|
||
|
frame->setFrameStyle( TQFrame::NoFrame );
|
||
|
}
|
||
|
else {
|
||
|
frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised );
|
||
|
}
|
||
|
frame->setLineWidth( 2 );
|
||
13 years ago
|
|
||
9 years ago
|
KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame );
|
||
13 years ago
|
|
||
9 years ago
|
KUser user;
|
||
13 years ago
|
|
||
9 years ago
|
mStatusLabel = new TQLabel( "<b> </b>", frame );
|
||
|
mStatusLabel->setAlignment( TQLabel::AlignVCenter );
|
||
13 years ago
|
|
||
9 years ago
|
TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this );
|
||
|
unlockDialogLayout->addWidget( frame );
|
||
13 years ago
|
|
||
9 years ago
|
TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint());
|
||
|
layStatus->addWidget( mStatusLabel );
|
||
13 years ago
|
|
||
9 years ago
|
frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
|
||
|
frameLayout->addMultiCellWidget( theader, 0, 0, 0, 1, AlignTop | AlignLeft );
|
||
|
frameLayout->addMultiCellLayout( layStatus, 1, 1, 0, 1, AlignLeft | AlignVCenter);
|
||
13 years ago
|
|
||
9 years ago
|
mStatusLabel->setText("<b>" + i18n("Press Ctrl+Alt+Del to begin.") + "</b><p>" + i18n("This process helps keep your password secure.") + "<br>" + i18n("It prevents unauthorized users from emulating the login screen."));
|
||
13 years ago
|
|
||
9 years ago
|
installEventFilter(this);
|
||
|
setFixedSize( sizeHint() );
|
||
13 years ago
|
|
||
9 years ago
|
mSAKProcess = new TDEProcess;
|
||
|
*mSAKProcess << "tdmtsak";
|
||
|
connect(mSAKProcess, TQT_SIGNAL(processExited(TDEProcess*)), this, TQT_SLOT(slotSAKProcessExited()));
|
||
|
mSAKProcess->start();
|
||
13 years ago
|
}
|
||
|
|
||
12 years ago
|
void SAKDlg::slotSAKProcessExited()
|
||
13 years ago
|
{
|
||
9 years ago
|
int retcode = mSAKProcess->exitStatus();
|
||
|
if (retcode != 0) {
|
||
|
trinity_desktop_lock_use_sak = false;
|
||
|
}
|
||
|
hide();
|
||
13 years ago
|
}
|
||
|
|
||
|
SAKDlg::~SAKDlg()
|
||
|
{
|
||
9 years ago
|
if ((mSAKProcess) && (mSAKProcess->isRunning())) {
|
||
9 years ago
|
mSAKProcess->kill(SIGKILL);
|
||
9 years ago
|
delete mSAKProcess;
|
||
|
}
|
||
|
hide();
|
||
13 years ago
|
}
|
||
|
|
||
13 years ago
|
void SAKDlg::closeDialogForced()
|
||
|
{
|
||
9 years ago
|
TQDialog::reject();
|
||
13 years ago
|
}
|
||
|
|
||
13 years ago
|
void SAKDlg::reject()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
void SAKDlg::updateLabel(TQString &txt)
|
||
|
{
|
||
9 years ago
|
mStatusLabel->setPaletteForegroundColor(Qt::black);
|
||
|
mStatusLabel->setText("<b>" + txt + "</b>");
|
||
13 years ago
|
}
|
||
|
|
||
|
void SAKDlg::show()
|
||
|
{
|
||
9 years ago
|
TQDialog::show();
|
||
|
TQApplication::flushX();
|
||
13 years ago
|
}
|
||
|
|
||
|
#include "sakdlg.moc"
|