Fix the most egregious style guide violations in the kdesktoplock plugin sources

No functional changes were made to the source
pull/2/head
Timothy Pearson 9 years ago
parent b45b9ed9b1
commit c54c4e7003

@ -1,8 +1,8 @@
//=========================================================================== //===========================================================================
// //
// This file is part of the KDE project // This file is part of the TDE project
// //
// Copyright (c) 2010 Timothy Pearson <kb9vqf@pearsoncomputing.net> // Copyright (c) 2010 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
#include <config.h> #include <config.h>
@ -62,86 +62,88 @@ extern bool trinity_desktop_lock_use_system_modal_dialogs;
// Simple dialog for displaying an unlock status or recurring error message // Simple dialog for displaying an unlock status or recurring error message
// //
InfoDlg::InfoDlg(LockProcess *parent) InfoDlg::InfoDlg(LockProcess *parent)
: TQDialog(parent, "information dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), : TQDialog(parent, "information dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))),
mUnlockingFailed(false) mUnlockingFailed(false)
{ {
if (trinity_desktop_lock_use_system_modal_dialogs) { if (trinity_desktop_lock_use_system_modal_dialogs) {
// Signal that we do not want any window controls to be shown at all // Signal that we do not want any window controls to be shown at all
Atom kde_wm_system_modal_notification; Atom kde_wm_system_modal_notification;
kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); 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); XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L);
} }
setCaption(i18n("Information")); setCaption(i18n("Information"));
frame = new TQFrame( this ); frame = new TQFrame( this );
if (trinity_desktop_lock_use_system_modal_dialogs) if (trinity_desktop_lock_use_system_modal_dialogs) {
frame->setFrameStyle( TQFrame::NoFrame ); frame->setFrameStyle( TQFrame::NoFrame );
else }
frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); else {
frame->setLineWidth( 2 ); frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised );
}
frame->setLineWidth( 2 );
mpixLabel = new TQLabel( frame, "pixlabel" ); mpixLabel = new TQLabel( frame, "pixlabel" );
mpixLabel->setPixmap(DesktopIcon("unlock")); mpixLabel->setPixmap(DesktopIcon("unlock"));
KUser user; KUser user;
mStatusLabel = new TQLabel( "<b> </b>", frame ); mStatusLabel = new TQLabel( "<b> </b>", frame );
mStatusLabel->setAlignment( TQLabel::AlignCenter ); mStatusLabel->setAlignment( TQLabel::AlignCenter );
TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this );
unlockDialogLayout->addWidget( frame ); unlockDialogLayout->addWidget( frame );
TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint());
layStatus->addWidget( mStatusLabel ); layStatus->addWidget( mStatusLabel );
frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
frameLayout->addMultiCellWidget( mpixLabel, 0, 2, 0, 0, Qt::AlignTop ); frameLayout->addMultiCellWidget( mpixLabel, 0, 2, 0, 0, Qt::AlignTop );
frameLayout->addLayout( layStatus, 1, 1 ); frameLayout->addLayout( layStatus, 1, 1 );
installEventFilter(this); installEventFilter(this);
setFixedSize( sizeHint() ); setFixedSize( sizeHint() );
} }
InfoDlg::~InfoDlg() InfoDlg::~InfoDlg()
{ {
hide(); hide();
} }
void InfoDlg::updateLabel(TQString &txt) void InfoDlg::updateLabel(TQString &txt)
{ {
mStatusLabel->setPaletteForegroundColor(Qt::black); mStatusLabel->setPaletteForegroundColor(Qt::black);
mStatusLabel->setText("<b>" + txt + "</b>"); mStatusLabel->setText("<b>" + txt + "</b>");
} }
void InfoDlg::setUnlockIcon() void InfoDlg::setUnlockIcon()
{ {
mpixLabel->setPixmap(DesktopIcon("unlock")); mpixLabel->setPixmap(DesktopIcon("unlock"));
} }
void InfoDlg::setKDEIcon() void InfoDlg::setKDEIcon()
{ {
mpixLabel->setPixmap(DesktopIcon("about_kde")); mpixLabel->setPixmap(DesktopIcon("about_kde"));
} }
void InfoDlg::setInfoIcon() void InfoDlg::setInfoIcon()
{ {
mpixLabel->setPixmap(DesktopIcon("messagebox_info")); mpixLabel->setPixmap(DesktopIcon("messagebox_info"));
} }
void InfoDlg::setWarningIcon() void InfoDlg::setWarningIcon()
{ {
mpixLabel->setPixmap(DesktopIcon("messagebox_warning")); mpixLabel->setPixmap(DesktopIcon("messagebox_warning"));
} }
void InfoDlg::setErrorIcon() void InfoDlg::setErrorIcon()
{ {
mpixLabel->setPixmap(DesktopIcon("messagebox_critical")); mpixLabel->setPixmap(DesktopIcon("messagebox_critical"));
} }
void InfoDlg::show() void InfoDlg::show()
{ {
TQDialog::show(); TQDialog::show();
TQApplication::flushX(); TQApplication::flushX();
} }
#include "infodlg.moc" #include "infodlg.moc"

@ -1,8 +1,8 @@
//=========================================================================== //===========================================================================
// //
// This file is part of the KDE project // This file is part of the TDE project
// //
// Copyright (c) 2010 Timothy Pearson <kb9vqf@pearsoncomputing.net> // Copyright (c) 2010 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
// //
#ifndef __INFODLG_H__ #ifndef __INFODLG_H__
@ -26,30 +26,30 @@ class TQListView;
// //
class InfoDlg : public TQDialog class InfoDlg : public TQDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
InfoDlg(LockProcess *parent); InfoDlg(LockProcess *parent);
~InfoDlg(); ~InfoDlg();
virtual void show(); virtual void show();
void updateLabel( TQString &txt ); void updateLabel( TQString &txt );
void setUnlockIcon(); void setUnlockIcon();
void setKDEIcon(); void setKDEIcon();
void setInfoIcon(); void setInfoIcon();
void setWarningIcon(); void setWarningIcon();
void setErrorIcon(); void setErrorIcon();
private: private:
TQFrame *frame; TQFrame *frame;
TQGridLayout *frameLayout; TQGridLayout *frameLayout;
TQLabel *mStatusLabel; TQLabel *mStatusLabel;
TQLabel *mpixLabel; TQLabel *mpixLabel;
int mCapsLocked; int mCapsLocked;
bool mUnlockingFailed; bool mUnlockingFailed;
TQStringList layoutsList; TQStringList layoutsList;
TQStringList::iterator currLayout; TQStringList::iterator currLayout;
int sPid, sFd; int sPid, sFd;
}; };
#endif #endif

File diff suppressed because it is too large Load Diff

@ -1,9 +1,10 @@
//=========================================================================== //===========================================================================
// //
// This file is part of the KDE project // This file is part of the TDE project
// //
// Copyright (c) 1999 Martin R. Jones <mjones@kde.org> // Copyright (c) 1999 Martin R. Jones <mjones@kde.org>
// Copyright (c) 2003 Oswald Buddenhagen <ossi@kde.org> // Copyright (c) 2003 Oswald Buddenhagen <ossi@kde.org>
// Copyright (c) 2010 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
// //
#ifndef __LOCKDLG_H__ #ifndef __LOCKDLG_H__
@ -32,69 +33,69 @@ class TQListView;
// //
class PasswordDlg : public TQDialog, public KGreeterPluginHandler class PasswordDlg : public TQDialog, public KGreeterPluginHandler
{ {
Q_OBJECT Q_OBJECT
public: public:
PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin); PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin);
PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, TQDateTime lockStartDateTime); PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, TQDateTime lockStartDateTime);
~PasswordDlg(); ~PasswordDlg();
void init(GreeterPluginHandle *plugin); void init(GreeterPluginHandle *plugin);
virtual void show(); virtual void show();
// from KGreetPluginHandler // from KGreetPluginHandler
virtual void gplugReturnText( const char *text, int tag ); virtual void gplugReturnText( const char *text, int tag );
virtual void gplugReturnBinary( const char *data ); virtual void gplugReturnBinary( const char *data );
virtual void gplugSetUser( const TQString & ); virtual void gplugSetUser( const TQString & );
virtual void gplugStart(); virtual void gplugStart();
virtual void gplugActivity(); virtual void gplugActivity();
virtual void gplugMsgBox( TQMessageBox::Icon type, const TQString &text ); virtual void gplugMsgBox( TQMessageBox::Icon type, const TQString &text );
protected: protected:
virtual void timerEvent(TQTimerEvent *); virtual void timerEvent(TQTimerEvent *);
virtual bool eventFilter(TQObject *, TQEvent *); virtual bool eventFilter(TQObject *, TQEvent *);
private slots: private slots:
void slotSwitchUser(); void slotSwitchUser();
void slotSessionActivated(); void slotSessionActivated();
void slotStartNewSession(); void slotStartNewSession();
void slotOK(); void slotOK();
void layoutClicked(); void layoutClicked();
void slotActivity(); void slotActivity();
protected slots: protected slots:
virtual void reject(); virtual void reject();
private: private:
void setLayoutText( const TQString &txt ); void setLayoutText( const TQString &txt );
void capsLocked(); void capsLocked();
void updateLabel(); void updateLabel();
int Reader (void *buf, int count); int Reader (void *buf, int count);
bool GRead (void *buf, int count); bool GRead (void *buf, int count);
bool GWrite (const void *buf, int count); bool GWrite (const void *buf, int count);
bool GSendInt (int val); bool GSendInt (int val);
bool GSendStr (const char *buf); bool GSendStr (const char *buf);
bool GSendArr (int len, const char *buf); bool GSendArr (int len, const char *buf);
bool GRecvInt (int *val); bool GRecvInt (int *val);
bool GRecvArr (char **buf); bool GRecvArr (char **buf);
void handleVerify(); void handleVerify();
void reapVerify(); void reapVerify();
void cantCheck(); void cantCheck();
GreeterPluginHandle *mPlugin; GreeterPluginHandle *mPlugin;
KGreeterPlugin *greet; KGreeterPlugin *greet;
TQFrame *frame; TQFrame *frame;
TQGridLayout *frameLayout; TQGridLayout *frameLayout;
TQLabel *mStatusLabel; TQLabel *mStatusLabel;
KPushButton *mNewSessButton, *ok, *cancel; KPushButton *mNewSessButton, *ok, *cancel;
TQPushButton *mLayoutButton; TQPushButton *mLayoutButton;
int mFailedTimerId; int mFailedTimerId;
int mTimeoutTimerId; int mTimeoutTimerId;
int mCapsLocked; int mCapsLocked;
bool mUnlockingFailed; bool mUnlockingFailed;
TQStringList layoutsList; TQStringList layoutsList;
TQStringList::iterator currLayout; TQStringList::iterator currLayout;
int sPid, sFd; int sPid, sFd;
TQListView *lv; TQListView *lv;
TQDateTime m_lockStartDT; TQDateTime m_lockStartDT;
}; };
#endif #endif

@ -1,8 +1,8 @@
//=========================================================================== //===========================================================================
// //
// This file is part of the KDE project // This file is part of the TDE project
// //
// Copyright (c) 2010 Timothy Pearson <kb9vqf@pearsoncomputing.net> // Copyright (c) 2010 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
#include <config.h> #include <config.h>
@ -62,100 +62,102 @@ extern bool trinity_desktop_lock_use_system_modal_dialogs;
// Simple dialog for displaying a password/PIN entry dialog // Simple dialog for displaying a password/PIN entry dialog
// //
QueryDlg::QueryDlg(LockProcess *parent) QueryDlg::QueryDlg(LockProcess *parent)
: TQDialog(parent, "query dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), : TQDialog(parent, "query dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))),
mUnlockingFailed(false) mUnlockingFailed(false)
{ {
if (trinity_desktop_lock_use_system_modal_dialogs) { if (trinity_desktop_lock_use_system_modal_dialogs) {
// Signal that we do not want any window controls to be shown at all // Signal that we do not want any window controls to be shown at all
Atom kde_wm_system_modal_notification; Atom kde_wm_system_modal_notification;
kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); 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); XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L);
} }
setCaption(i18n("Information Needed")); setCaption(i18n("Information Needed"));
frame = new TQFrame( this ); frame = new TQFrame( this );
if (trinity_desktop_lock_use_system_modal_dialogs) if (trinity_desktop_lock_use_system_modal_dialogs) {
frame->setFrameStyle( TQFrame::NoFrame ); frame->setFrameStyle( TQFrame::NoFrame );
else }
frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); else {
frame->setLineWidth( 2 ); frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised );
}
mpixLabel = new TQLabel( frame, "pixlabel" ); frame->setLineWidth( 2 );
mpixLabel->setPixmap(DesktopIcon("unlock"));
mpixLabel = new TQLabel( frame, "pixlabel" );
KUser user; mpixLabel->setPixmap(DesktopIcon("unlock"));
mStatusLabel = new TQLabel( "<b> </b>", frame ); KUser user;
//mStatusLabel->setAlignment( TQLabel::AlignCenter );
mStatusLabel->setAlignment( TQLabel::AlignLeft ); mStatusLabel = new TQLabel( "<b> </b>", frame );
//mStatusLabel->setAlignment( TQLabel::AlignCenter );
KSeparator *sep = new KSeparator( KSeparator::HLine, frame ); mStatusLabel->setAlignment( TQLabel::AlignLeft );
ok = new KPushButton( i18n("Unl&ock"), frame ); KSeparator *sep = new KSeparator( KSeparator::HLine, frame );
TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); ok = new KPushButton( i18n("Unl&ock"), frame );
unlockDialogLayout->addWidget( frame );
TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this );
TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); unlockDialogLayout->addWidget( frame );
layStatus->addWidget( mStatusLabel );
TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint());
TQHBoxLayout *layPin = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); layStatus->addWidget( mStatusLabel );
pin_box = new KPasswordEdit( this, "pin_box" );
layPin->addWidget( pin_box ); TQHBoxLayout *layPin = new TQHBoxLayout( 0, 0, KDialog::spacingHint());
pin_box->setFocus(); pin_box = new KPasswordEdit( this, "pin_box" );
layPin->addWidget( pin_box );
TQHBoxLayout *layButtons = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); pin_box->setFocus();
layButtons->addStretch();
layButtons->addWidget( ok ); TQHBoxLayout *layButtons = new TQHBoxLayout( 0, 0, KDialog::spacingHint());
layButtons->addStretch();
frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); layButtons->addWidget( ok );
frameLayout->addMultiCellWidget( mpixLabel, 0, 2, 0, 0, Qt::AlignTop );
frameLayout->addLayout( layStatus, 0, 1 ); frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
frameLayout->addLayout( layPin, 2, 1 ); frameLayout->addMultiCellWidget( mpixLabel, 0, 2, 0, 0, Qt::AlignTop );
frameLayout->addMultiCellWidget( sep, 3, 3, 0, 1 ); frameLayout->addLayout( layStatus, 0, 1 );
frameLayout->addMultiCellLayout( layButtons, 4, 4, 0, 1 ); frameLayout->addLayout( layPin, 2, 1 );
frameLayout->addMultiCellWidget( sep, 3, 3, 0, 1 );
connect(ok, TQT_SIGNAL(clicked()), TQT_SLOT(slotOK())); frameLayout->addMultiCellLayout( layButtons, 4, 4, 0, 1 );
installEventFilter(this); connect(ok, TQT_SIGNAL(clicked()), TQT_SLOT(slotOK()));
setFixedSize( sizeHint() );
installEventFilter(this);
setFixedSize( sizeHint() );
} }
QueryDlg::~QueryDlg() QueryDlg::~QueryDlg()
{ {
hide(); hide();
} }
void QueryDlg::slotOK() void QueryDlg::slotOK()
{ {
close(); close();
} }
const char * QueryDlg::getEntry() const char * QueryDlg::getEntry()
{ {
return pin_box->password(); return pin_box->password();
} }
void QueryDlg::updateLabel(TQString &txt) void QueryDlg::updateLabel(TQString &txt)
{ {
mStatusLabel->setPaletteForegroundColor(Qt::black); mStatusLabel->setPaletteForegroundColor(Qt::black);
mStatusLabel->setText("<b>" + txt + "</b>"); mStatusLabel->setText("<b>" + txt + "</b>");
} }
void QueryDlg::setUnlockIcon() void QueryDlg::setUnlockIcon()
{ {
mpixLabel->setPixmap(DesktopIcon("unlock")); mpixLabel->setPixmap(DesktopIcon("unlock"));
} }
void QueryDlg::setWarningIcon() void QueryDlg::setWarningIcon()
{ {
mpixLabel->setPixmap(DesktopIcon("messagebox_warning")); mpixLabel->setPixmap(DesktopIcon("messagebox_warning"));
} }
void QueryDlg::show() void QueryDlg::show()
{ {
TQDialog::show(); TQDialog::show();
TQApplication::flushX(); TQApplication::flushX();
} }
#include "querydlg.moc" #include "querydlg.moc"

@ -1,8 +1,8 @@
//=========================================================================== //===========================================================================
// //
// This file is part of the KDE project // This file is part of the TDE project
// //
// Copyright (c) 2010 Timothy Pearson <kb9vqf@pearsoncomputing.net> // Copyright (c) 2010 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
// //
#ifndef __QUERYDLG_H__ #ifndef __QUERYDLG_H__
@ -28,33 +28,33 @@ class TQListView;
// //
class QueryDlg : public TQDialog class QueryDlg : public TQDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
QueryDlg(LockProcess *parent); QueryDlg(LockProcess *parent);
~QueryDlg(); ~QueryDlg();
virtual void show(); virtual void show();
void updateLabel( TQString &txt ); void updateLabel( TQString &txt );
void setUnlockIcon(); void setUnlockIcon();
void setWarningIcon(); void setWarningIcon();
const char * getEntry(); const char * getEntry();
private slots: private slots:
void slotOK(); void slotOK();
private: private:
TQFrame *frame; TQFrame *frame;
TQGridLayout *frameLayout; TQGridLayout *frameLayout;
TQLabel *mStatusLabel; TQLabel *mStatusLabel;
TQLabel *mpixLabel; TQLabel *mpixLabel;
int mCapsLocked; int mCapsLocked;
bool mUnlockingFailed; bool mUnlockingFailed;
TQStringList layoutsList; TQStringList layoutsList;
TQStringList::iterator currLayout; TQStringList::iterator currLayout;
int sPid, sFd; int sPid, sFd;
KPushButton *ok; KPushButton *ok;
KPasswordEdit *pin_box; KPasswordEdit *pin_box;
}; };
#endif #endif

@ -1,8 +1,8 @@
//=========================================================================== //===========================================================================
// //
// This file is part of the KDE project // This file is part of the TDE project
// //
// Copyright (c) 2010-2011 Timothy Pearson <kb9vqf@pearsoncomputing.net> // Copyright (c) 2010 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
#include <config.h> #include <config.h>
@ -64,71 +64,75 @@ extern bool trinity_desktop_lock_use_sak;
// Simple dialog for displaying an unlock status or recurring error message // Simple dialog for displaying an unlock status or recurring error message
// //
SAKDlg::SAKDlg(LockProcess *parent) SAKDlg::SAKDlg(LockProcess *parent)
: TQDialog(parent, "information dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), : TQDialog(parent, "information dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))),
mUnlockingFailed(false) mUnlockingFailed(false)
{ {
if (trinity_desktop_lock_use_system_modal_dialogs) { if (trinity_desktop_lock_use_system_modal_dialogs) {
// Signal that we do not want any window controls to be shown at all // Signal that we do not want any window controls to be shown at all
Atom kde_wm_system_modal_notification; Atom kde_wm_system_modal_notification;
kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); 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); XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L);
} }
setCaption(i18n("Desktop Session Locked")); setCaption(i18n("Desktop Session Locked"));
frame = new TQFrame( this ); frame = new TQFrame( this );
if (trinity_desktop_lock_use_system_modal_dialogs) if (trinity_desktop_lock_use_system_modal_dialogs) {
frame->setFrameStyle( TQFrame::NoFrame ); frame->setFrameStyle( TQFrame::NoFrame );
else }
frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); else {
frame->setLineWidth( 2 ); frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised );
}
frame->setLineWidth( 2 );
KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame ); KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame );
KUser user; KUser user;
mStatusLabel = new TQLabel( "<b> </b>", frame ); mStatusLabel = new TQLabel( "<b> </b>", frame );
mStatusLabel->setAlignment( TQLabel::AlignVCenter ); mStatusLabel->setAlignment( TQLabel::AlignVCenter );
TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this );
unlockDialogLayout->addWidget( frame ); unlockDialogLayout->addWidget( frame );
TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint());
layStatus->addWidget( mStatusLabel ); layStatus->addWidget( mStatusLabel );
frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
frameLayout->addMultiCellWidget( theader, 0, 0, 0, 1, AlignTop | AlignLeft ); frameLayout->addMultiCellWidget( theader, 0, 0, 0, 1, AlignTop | AlignLeft );
frameLayout->addMultiCellLayout( layStatus, 1, 1, 0, 1, AlignLeft | AlignVCenter); frameLayout->addMultiCellLayout( layStatus, 1, 1, 0, 1, AlignLeft | AlignVCenter);
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.")); 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."));
installEventFilter(this); installEventFilter(this);
setFixedSize( sizeHint() ); setFixedSize( sizeHint() );
mSAKProcess = new TDEProcess; mSAKProcess = new TDEProcess;
*mSAKProcess << "tdmtsak"; *mSAKProcess << "tdmtsak";
connect(mSAKProcess, TQT_SIGNAL(processExited(TDEProcess*)), this, TQT_SLOT(slotSAKProcessExited())); connect(mSAKProcess, TQT_SIGNAL(processExited(TDEProcess*)), this, TQT_SLOT(slotSAKProcessExited()));
mSAKProcess->start(); mSAKProcess->start();
} }
void SAKDlg::slotSAKProcessExited() void SAKDlg::slotSAKProcessExited()
{ {
int retcode = mSAKProcess->exitStatus(); int retcode = mSAKProcess->exitStatus();
if (retcode != 0) trinity_desktop_lock_use_sak = false; if (retcode != 0) {
hide(); trinity_desktop_lock_use_sak = false;
}
hide();
} }
SAKDlg::~SAKDlg() SAKDlg::~SAKDlg()
{ {
if ((mSAKProcess) && (mSAKProcess->isRunning())) { if ((mSAKProcess) && (mSAKProcess->isRunning())) {
mSAKProcess->kill(SIGTERM); mSAKProcess->kill(SIGTERM);
delete mSAKProcess; delete mSAKProcess;
} }
hide(); hide();
} }
void SAKDlg::closeDialogForced() void SAKDlg::closeDialogForced()
{ {
TQDialog::reject(); TQDialog::reject();
} }
void SAKDlg::reject() void SAKDlg::reject()
@ -138,14 +142,14 @@ void SAKDlg::reject()
void SAKDlg::updateLabel(TQString &txt) void SAKDlg::updateLabel(TQString &txt)
{ {
mStatusLabel->setPaletteForegroundColor(Qt::black); mStatusLabel->setPaletteForegroundColor(Qt::black);
mStatusLabel->setText("<b>" + txt + "</b>"); mStatusLabel->setText("<b>" + txt + "</b>");
} }
void SAKDlg::show() void SAKDlg::show()
{ {
TQDialog::show(); TQDialog::show();
TQApplication::flushX(); TQApplication::flushX();
} }
#include "sakdlg.moc" #include "sakdlg.moc"

@ -1,8 +1,8 @@
//=========================================================================== //===========================================================================
// //
// This file is part of the KDE project // This file is part of the TDE project
// //
// Copyright (c) 2010 Timothy Pearson <kb9vqf@pearsoncomputing.net> // Copyright (c) 2010 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
// //
#ifndef __SAKDLG_H__ #ifndef __SAKDLG_H__
@ -26,32 +26,32 @@ class TQListView;
// //
class SAKDlg : public TQDialog class SAKDlg : public TQDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
SAKDlg(LockProcess *parent); SAKDlg(LockProcess *parent);
~SAKDlg(); ~SAKDlg();
virtual void show(); virtual void show();
void updateLabel( TQString &txt ); void updateLabel( TQString &txt );
void closeDialogForced(); void closeDialogForced();
private slots: private slots:
void slotSAKProcessExited(); void slotSAKProcessExited();
protected slots: protected slots:
virtual void reject(); virtual void reject();
private: private:
TQFrame *frame; TQFrame *frame;
TQGridLayout *frameLayout; TQGridLayout *frameLayout;
TQLabel *mStatusLabel; TQLabel *mStatusLabel;
int mCapsLocked; int mCapsLocked;
bool mUnlockingFailed; bool mUnlockingFailed;
TQStringList layoutsList; TQStringList layoutsList;
TQStringList::iterator currLayout; TQStringList::iterator currLayout;
int sPid, sFd; int sPid, sFd;
TDEProcess* mSAKProcess; TDEProcess* mSAKProcess;
}; };
#endif #endif

@ -1,8 +1,8 @@
//=========================================================================== //===========================================================================
// //
// This file is part of the KDE project // This file is part of the TDE project
// //
// Copyright (c) 2010-2011 Timothy Pearson <kb9vqf@pearsoncomputing.net> // Copyright (c) 2010 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
#include <config.h> #include <config.h>
@ -64,152 +64,154 @@ extern bool trinity_desktop_lock_use_sak;
// Simple dialog for displaying an unlock status or recurring error message // Simple dialog for displaying an unlock status or recurring error message
// //
SecureDlg::SecureDlg(LockProcess *parent) SecureDlg::SecureDlg(LockProcess *parent)
: TQDialog(parent, "information dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), : TQDialog(parent, "information dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))),
mUnlockingFailed(false), retInt(NULL) mUnlockingFailed(false), retInt(NULL)
{ {
if (trinity_desktop_lock_use_system_modal_dialogs) { if (trinity_desktop_lock_use_system_modal_dialogs) {
// Signal that we do not want any window controls to be shown at all // Signal that we do not want any window controls to be shown at all
Atom kde_wm_system_modal_notification; Atom kde_wm_system_modal_notification;
kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_TDE_WM_MODAL_SYS_NOTIFICATION", False); 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); XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L);
} }
setCaption(i18n("Secure Desktop Area")); setCaption(i18n("Secure Desktop Area"));
frame = new TQFrame( this ); frame = new TQFrame( this );
if (trinity_desktop_lock_use_system_modal_dialogs) if (trinity_desktop_lock_use_system_modal_dialogs) {
frame->setFrameStyle( TQFrame::NoFrame ); frame->setFrameStyle( TQFrame::NoFrame );
else }
frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); else {
frame->setLineWidth( 2 ); frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised );
}
KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame ); frame->setLineWidth( 2 );
KUser user; KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame );
mLogonStatus = new TQLabel( frame ); KUser user;
TQString userString = user.fullName();
if (userString == "") { mLogonStatus = new TQLabel( frame );
userString = user.loginName(); TQString userString = user.fullName();
} if (userString == "") {
if (userString != "") { userString = user.loginName();
mLogonStatus->setText(i18n("'%1' is currently logged on").arg( user.fullName() )); }
} if (userString != "") {
else { mLogonStatus->setText(i18n("'%1' is currently logged on").arg( user.fullName() ));
mLogonStatus->setText(i18n("You are currently logged on")); // We should never get here, and this message is somewhat obtuse, but it is better than displaying two qotation marks with no text between them... }
} else {
mLogonStatus->setText(i18n("You are currently logged on")); // We should never get here, and this message is somewhat obtuse, but it is better than displaying two qotation marks with no text between them...
KSeparator *sep = new KSeparator( KSeparator::HLine, frame ); }
mLockButton = new TQPushButton( frame ); KSeparator *sep = new KSeparator( KSeparator::HLine, frame );
mLockButton->setText(i18n("Lock Session"));
mLockButton = new TQPushButton( frame );
mTaskButton = new TQPushButton( frame ); mLockButton->setText(i18n("Lock Session"));
mTaskButton->setText(i18n("Task Manager"));
mTaskButton = new TQPushButton( frame );
mShutdownButton = new TQPushButton( frame ); mTaskButton->setText(i18n("Task Manager"));
mShutdownButton->setText(i18n("Logoff Menu"));
mShutdownButton = new TQPushButton( frame );
mCancelButton = new TQPushButton( frame ); mShutdownButton->setText(i18n("Logoff Menu"));
mCancelButton->setText(i18n("Cancel"));
mCancelButton = new TQPushButton( frame );
mSwitchButton = new TQPushButton( frame ); mCancelButton->setText(i18n("Cancel"));
mSwitchButton->setText(i18n("Switch User"));
mSwitchButton->setEnabled(false); // FIXME mSwitchButton = new TQPushButton( frame );
mSwitchButton->setText(i18n("Switch User"));
TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this ); mSwitchButton->setEnabled(false); // FIXME
unlockDialogLayout->addWidget( frame );
TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this );
TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint()); unlockDialogLayout->addWidget( frame );
layStatus->addWidget( mLogonStatus );
TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint());
TQGridLayout *layPBGrid = new TQGridLayout( 0, 0, KDialog::spacingHint()); layStatus->addWidget( mLogonStatus );
layPBGrid->addWidget( mLockButton, 0, 0 );
layPBGrid->addWidget( mTaskButton, 0, 1 ); TQGridLayout *layPBGrid = new TQGridLayout( 0, 0, KDialog::spacingHint());
layPBGrid->addWidget( mShutdownButton, 0, 2 ); layPBGrid->addWidget( mLockButton, 0, 0 );
layPBGrid->addWidget( mCancelButton, 0, 3 ); layPBGrid->addWidget( mTaskButton, 0, 1 );
layPBGrid->addWidget( mSwitchButton, 1, 0 ); layPBGrid->addWidget( mShutdownButton, 0, 2 );
layPBGrid->addWidget( mCancelButton, 0, 3 );
frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); layPBGrid->addWidget( mSwitchButton, 1, 0 );
frameLayout->addMultiCellWidget( theader, 0, 0, 0, 1, AlignTop | AlignLeft );
frameLayout->addMultiCellLayout( layStatus, 1, 1, 0, 1, AlignLeft | AlignVCenter); frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
frameLayout->addMultiCellWidget( sep, 2, 2, 0, 1 ); frameLayout->addMultiCellWidget( theader, 0, 0, 0, 1, AlignTop | AlignLeft );
frameLayout->addMultiCellLayout( layPBGrid, 3, 3, 0, 1, AlignLeft | AlignVCenter); frameLayout->addMultiCellLayout( layStatus, 1, 1, 0, 1, AlignLeft | AlignVCenter);
frameLayout->addMultiCellWidget( sep, 2, 2, 0, 1 );
connect(mCancelButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnCancel())); frameLayout->addMultiCellLayout( layPBGrid, 3, 3, 0, 1, AlignLeft | AlignVCenter);
connect(mLockButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnLock()));
connect(mTaskButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnTask())); connect(mCancelButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnCancel()));
connect(mShutdownButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnShutdown())); connect(mLockButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnLock()));
connect(mSwitchButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnSwitchUser())); connect(mTaskButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnTask()));
connect(mShutdownButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnShutdown()));
TQSize dlgSz = sizeHint(); connect(mSwitchButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnSwitchUser()));
int btnSize = dlgSz.width();
btnSize = btnSize / 4; TQSize dlgSz = sizeHint();
btnSize = btnSize - (KDialog::spacingHint() / 2); int btnSize = dlgSz.width();
mLockButton->setFixedWidth(btnSize); btnSize = btnSize / 4;
mTaskButton->setFixedWidth(btnSize); btnSize = btnSize - (KDialog::spacingHint() / 2);
mCancelButton->setFixedWidth(btnSize); mLockButton->setFixedWidth(btnSize);
mShutdownButton->setFixedWidth(btnSize); mTaskButton->setFixedWidth(btnSize);
mSwitchButton->setFixedWidth(btnSize); mCancelButton->setFixedWidth(btnSize);
mShutdownButton->setFixedWidth(btnSize);
installEventFilter(this); mSwitchButton->setFixedWidth(btnSize);
setFixedSize( sizeHint() );
installEventFilter(this);
setFixedSize( sizeHint() );
} }
SecureDlg::~SecureDlg() SecureDlg::~SecureDlg()
{ {
hide(); hide();
} }
void SecureDlg::slotBtnCancel() void SecureDlg::slotBtnCancel()
{ {
if (retInt) *retInt = 0; if (retInt) *retInt = 0;
hide(); hide();
} }
void SecureDlg::slotBtnLock() void SecureDlg::slotBtnLock()
{ {
if (retInt) *retInt = 1; if (retInt) *retInt = 1;
hide(); hide();
} }
void SecureDlg::slotBtnTask() void SecureDlg::slotBtnTask()
{ {
if (retInt) *retInt = 2; if (retInt) *retInt = 2;
hide(); hide();
} }
void SecureDlg::slotBtnShutdown() void SecureDlg::slotBtnShutdown()
{ {
if (retInt) *retInt = 3; if (retInt) *retInt = 3;
hide(); hide();
} }
void SecureDlg::slotBtnSwitchUser() void SecureDlg::slotBtnSwitchUser()
{ {
if (retInt) *retInt = 4; if (retInt) *retInt = 4;
hide(); hide();
} }
void SecureDlg::setRetInt(int *i) void SecureDlg::setRetInt(int *i)
{ {
retInt = i; retInt = i;
} }
void SecureDlg::closeDialogForced() void SecureDlg::closeDialogForced()
{ {
if (retInt) *retInt = 0; if (retInt) *retInt = 0;
TQDialog::reject(); TQDialog::reject();
} }
void SecureDlg::reject() void SecureDlg::reject()
{ {
closeDialogForced(); closeDialogForced();
} }
void SecureDlg::show() void SecureDlg::show()
{ {
TQDialog::show(); TQDialog::show();
TQApplication::flushX(); TQApplication::flushX();
} }
#include "securedlg.moc" #include "securedlg.moc"

@ -1,8 +1,8 @@
//=========================================================================== //===========================================================================
// //
// This file is part of the KDE project // This file is part of the TDE project
// //
// Copyright (c) 2010 Timothy Pearson <kb9vqf@pearsoncomputing.net> // Copyright (c) 2010 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
// //
#ifndef __SECUREDLG_H__ #ifndef __SECUREDLG_H__
@ -27,41 +27,41 @@ class TQListView;
// //
class SecureDlg : public TQDialog class SecureDlg : public TQDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
SecureDlg(LockProcess *parent); SecureDlg(LockProcess *parent);
~SecureDlg(); ~SecureDlg();
virtual void show(); virtual void show();
void closeDialogForced(); void closeDialogForced();
void setRetInt(int *); void setRetInt(int *);
private slots: private slots:
void slotBtnCancel(); void slotBtnCancel();
void slotBtnLock(); void slotBtnLock();
void slotBtnTask(); void slotBtnTask();
void slotBtnShutdown(); void slotBtnShutdown();
void slotBtnSwitchUser(); void slotBtnSwitchUser();
protected slots: protected slots:
virtual void reject(); virtual void reject();
private: private:
TQFrame *frame; TQFrame *frame;
TQGridLayout *frameLayout; TQGridLayout *frameLayout;
TQLabel *mLogonStatus; TQLabel *mLogonStatus;
TQButton *mCancelButton; TQButton *mCancelButton;
TQButton *mLockButton; TQButton *mLockButton;
TQButton *mTaskButton; TQButton *mTaskButton;
TQButton *mShutdownButton; TQButton *mShutdownButton;
TQButton *mSwitchButton; TQButton *mSwitchButton;
int mCapsLocked; int mCapsLocked;
bool mUnlockingFailed; bool mUnlockingFailed;
TQStringList layoutsList; TQStringList layoutsList;
TQStringList::iterator currLayout; TQStringList::iterator currLayout;
int sPid, sFd; int sPid, sFd;
int* retInt; int* retInt;
}; };
#endif #endif

Loading…
Cancel
Save