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 10 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>
@ -74,10 +74,12 @@ InfoDlg::InfoDlg(LockProcess *parent)
setCaption(i18n("Information"));
frame = new TQFrame( this );
if (trinity_desktop_lock_use_system_modal_dialogs)
if (trinity_desktop_lock_use_system_modal_dialogs) {
frame->setFrameStyle( TQFrame::NoFrame );
else
}
else {
frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised );
}
frame->setLineWidth( 2 );
mpixLabel = new TQLabel( frame, "pixlabel" );
@ -100,7 +102,7 @@ InfoDlg::InfoDlg(LockProcess *parent)
installEventFilter(this);
setFixedSize( sizeHint() );
}
}
InfoDlg::~InfoDlg()
{

@ -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__
@ -28,7 +28,7 @@ class InfoDlg : public TQDialog
{
Q_OBJECT
public:
public:
InfoDlg(LockProcess *parent);
~InfoDlg();
virtual void show();
@ -40,7 +40,7 @@ public:
void setWarningIcon();
void setErrorIcon();
private:
private:
TQFrame *frame;
TQGridLayout *frameLayout;
TQLabel *mStatusLabel;

@ -1,10 +1,11 @@
//===========================================================================
//
// 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) 2003 Chris Howells <howells@kde.org>
// Copyright (c) 2003 Oswald Buddenhagen <ossi@kde.org>
// Copyright (c) 2010 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
#include <config.h>
@ -110,10 +111,12 @@ void PasswordDlg::init(GreeterPluginHandle *plugin)
setCaption(i18n("Desktop Session Locked"));
frame = new TQFrame( this );
if (trinity_desktop_lock_use_system_modal_dialogs)
if (trinity_desktop_lock_use_system_modal_dialogs) {
frame->setFrameStyle( TQFrame::NoFrame );
else
}
else {
frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised );
}
frame->setLineWidth( 2 );
TQLabel *pixLabel = NULL;
@ -152,13 +155,15 @@ void PasswordDlg::init(GreeterPluginHandle *plugin)
ok = new KPushButton( i18n("Unl&ock"), frame );
ok->setDefault(true);
bool show_cancel_button = !trinity_desktop_lock_hide_cancel_button ||
trinity_desktop_lock_use_sak ||
!trinity_desktop_lock_use_system_modal_dialogs;
if (show_cancel_button)
bool show_cancel_button = !trinity_desktop_lock_hide_cancel_button
|| trinity_desktop_lock_use_sak
|| !trinity_desktop_lock_use_system_modal_dialogs;
if (show_cancel_button) {
cancel = new KPushButton( KStdGuiItem::cancel(), frame );
else
}
else {
cancel = NULL;
}
greet = plugin->info->create( this, 0, this, mLayoutButton, TQString::null,
KGreeterPlugin::Authenticate, KGreeterPlugin::ExUnlock );
@ -174,8 +179,9 @@ void PasswordDlg::init(GreeterPluginHandle *plugin)
layButtons->addWidget( mNewSessButton );
layButtons->addStretch();
layButtons->addWidget(ok);
if (show_cancel_button)
if (show_cancel_button) {
layButtons->addWidget(cancel);
}
if (trinity_desktop_lock_use_system_modal_dialogs) {
KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame );
@ -210,27 +216,25 @@ void PasswordDlg::init(GreeterPluginHandle *plugin)
frameLayout->addMultiCellLayout( layButtons, 4, 4, 0, 1 );
}
if (show_cancel_button)
{
if (show_cancel_button) {
setTabOrder( ok, cancel );
setTabOrder( cancel, mNewSessButton );
}
else
{
else {
setTabOrder( ok, mNewSessButton );
}
setTabOrder( mNewSessButton, mLayoutButton );
connect(mLayoutButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(layoutClicked()));
if (show_cancel_button)
{
if (show_cancel_button) {
connect(cancel, TQT_SIGNAL(clicked()), TQT_SLOT(reject()));
}
connect(ok, TQT_SIGNAL(clicked()), TQT_SLOT(slotOK()));
connect(mNewSessButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotSwitchUser()));
if (!DM().isSwitchable() || !kapp->authorize("switch_user"))
if (!DM().isSwitchable() || !kapp->authorize("switch_user")) {
mNewSessButton->hide();
}
installEventFilter(this);
setFixedSize( sizeHint() );
@ -258,9 +262,12 @@ void PasswordDlg::init(GreeterPluginHandle *plugin)
setLayoutText("err");
else
setLayoutText(*currLayout);
} else
}
else {
mLayoutButton->hide();
} else {
}
}
else {
mLayoutButton->hide(); // no kxkb running
}
capsLocked();
@ -275,18 +282,19 @@ PasswordDlg::~PasswordDlg()
void PasswordDlg::reject()
{
if (!trinity_desktop_lock_hide_cancel_button || trinity_desktop_lock_use_sak ||
!trinity_desktop_lock_use_system_modal_dialogs || trinity_desktop_lock_autohide_lockdlg)
{
if (!trinity_desktop_lock_hide_cancel_button
|| trinity_desktop_lock_use_sak
|| !trinity_desktop_lock_use_system_modal_dialogs
|| trinity_desktop_lock_autohide_lockdlg) {
TQDialog::reject();
}
}
void PasswordDlg::layoutClicked()
{
if( ++currLayout == layoutsList.end() )
if( ++currLayout == layoutsList.end() ) {
currLayout = layoutsList.begin();
}
DCOPRef kxkb("kxkb", "kxkb");
setLayoutText( kxkb.call("setLayout", *currLayout) ? *currLayout : "err" );
@ -303,21 +311,17 @@ void PasswordDlg::setLayoutText( const TQString &txt )
void PasswordDlg::updateLabel()
{
if (mUnlockingFailed)
{
if (mUnlockingFailed) {
mStatusLabel->setPaletteForegroundColor(Qt::black);
mStatusLabel->setText(i18n("<b>Unlocking failed</b>"));
// mStatusLabel->show();
}
else
if (mCapsLocked)
{
else if (mCapsLocked) {
mStatusLabel->setPaletteForegroundColor(Qt::red);
mStatusLabel->setText(i18n("<b>Warning: Caps Lock on</b>"));
// mStatusLabel->show();
}
else
{
else {
mStatusLabel->setText("<b> </b>");
// mStatusLabel->hide();
}
@ -329,27 +333,25 @@ void PasswordDlg::updateLabel()
//
void PasswordDlg::timerEvent(TQTimerEvent *ev)
{
if (ev->timerId() == mTimeoutTimerId)
{
if (trinity_desktop_lock_autohide_lockdlg)
{
if (ev->timerId() == mTimeoutTimerId) {
if (trinity_desktop_lock_autohide_lockdlg) {
// Force dialog rejection regardless of the value of trinity_desktop_lock_hide_cancel_button
TQDialog::reject();
}
else
{
else {
slotActivity();
}
}
else if (ev->timerId() == mFailedTimerId)
{
else if (ev->timerId() == mFailedTimerId) {
killTimer(mFailedTimerId);
mFailedTimerId = 0;
// Show the normal password prompt.
mUnlockingFailed = false;
updateLabel();
ok->setEnabled(true);
if (cancel) cancel->setEnabled(true);
if (cancel) {
cancel->setEnabled(true);
}
mNewSessButton->setEnabled( true );
greet->revive();
greet->start();
@ -358,8 +360,9 @@ void PasswordDlg::timerEvent(TQTimerEvent *ev)
bool PasswordDlg::eventFilter(TQObject *, TQEvent *ev)
{
if (ev->type() == TQEvent::KeyPress || ev->type() == TQEvent::KeyRelease)
if (ev->type() == TQEvent::KeyPress || ev->type() == TQEvent::KeyRelease) {
capsLocked();
}
return false;
}
@ -378,17 +381,20 @@ int PasswordDlg::Reader (void *buf, int count)
int ret, rlen;
for (rlen = 0; rlen < count; ) {
dord:
dord:
ret = ::read (sFd, (void *)((char *)buf + rlen), count - rlen);
if (ret < 0) {
if (errno == EINTR)
if (errno == EINTR) {
goto dord;
if (errno == EAGAIN)
}
if (errno == EAGAIN) {
break;
}
return -1;
}
if (!ret)
if (!ret) {
break;
}
rlen += ret;
}
return rlen;
@ -430,14 +436,16 @@ bool PasswordDlg::GRecvArr (char **ret)
int len;
char *buf;
if (!GRecvInt(&len))
if (!GRecvInt(&len)) {
return false;
}
if (!len) {
*ret = 0;
return true;
}
if (!(buf = (char *)::malloc (len)))
if (!(buf = (char *)::malloc (len))) {
return false;
}
*ret = buf;
return GRead (buf, len);
}
@ -464,7 +472,9 @@ void PasswordDlg::reapVerify()
updateLabel();
mFailedTimerId = startTimer(1500);
ok->setEnabled(false);
if (cancel) cancel->setEnabled(false);
if (cancel) {
cancel->setEnabled(false);
}
mNewSessButton->setEnabled( false );
return;
case AuthAbort:
@ -532,8 +542,9 @@ void PasswordDlg::handleVerify()
void PasswordDlg::gplugReturnText( const char *text, int tag )
{
GSendStr( text );
if (text)
if (text) {
GSendInt( tag );
}
handleVerify();
}
@ -542,12 +553,16 @@ void PasswordDlg::gplugReturnBinary( const char *data )
if (data) {
unsigned const char *up = (unsigned const char *)data;
int len = up[3] | (up[2] << 8) | (up[1] << 16) | (up[0] << 24);
if (!len)
if (!len) {
GSendArr( 4, data );
else
}
else {
GSendArr( len, data );
} else
}
}
else {
GSendArr( 0, 0 );
}
handleVerify();
}
@ -617,10 +632,12 @@ void PasswordDlg::gplugMsgBox( TQMessageBox::Icon type, const TQString &text )
}
dialog.setCaption(i18n("Authentication Subsystem Notice"));
TQFrame *winFrame = new TQFrame( &dialog );
if (trinity_desktop_lock_use_system_modal_dialogs)
if (trinity_desktop_lock_use_system_modal_dialogs) {
winFrame->setFrameStyle( TQFrame::NoFrame );
else
}
else {
winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised );
}
winFrame->setLineWidth( 2 );
TQVBoxLayout *vbox = new TQVBoxLayout( &dialog );
vbox->addWidget( winFrame );
@ -675,18 +692,19 @@ void PasswordDlg::slotStartNewSession()
dialog->setCaption(i18n("New Session"));
TQFrame *winFrame = new TQFrame( dialog );
if (trinity_desktop_lock_use_system_modal_dialogs)
if (trinity_desktop_lock_use_system_modal_dialogs) {
winFrame->setFrameStyle( TQFrame::NoFrame );
else
}
else {
winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised );
}
winFrame->setLineWidth( 2 );
TQVBoxLayout *vbox = new TQVBoxLayout( dialog );
vbox->addWidget( winFrame );
TQLabel *label1 = new TQLabel( winFrame );
label1->setPixmap( TQMessageBox::standardIcon( TQMessageBox::Warning ) );
TQString qt_text =
i18n("You have chosen to open another desktop session "
TQString qt_text = i18n("You have chosen to open another desktop session "
"instead of resuming the current one.<br>"
"The current session will be hidden "
"and a new login screen will be displayed.<br>"
@ -733,23 +751,22 @@ void PasswordDlg::slotStartNewSession()
rt.setWidth(pref_width);
int used_width = rt.widthUsed();
pref_height = rt.height();
if (used_width <= pref_width)
{
while(true)
{
if (used_width <= pref_width) {
while(true) {
int new_width = (used_width * 9) / 10;
rt.setWidth(new_width);
int new_height = rt.height();
if (new_height > pref_height)
if (new_height > pref_height) {
break;
}
used_width = rt.widthUsed();
if (used_width > new_width)
if (used_width > new_width) {
break;
}
}
pref_width = used_width;
}
else
{
else {
if (used_width > (pref_width *2))
pref_width = pref_width *2;
else
@ -763,8 +780,9 @@ void PasswordDlg::slotStartNewSession()
delete dialog;
if (ret == TQDialog::Accepted) {
if (cb->isChecked())
if (cb->isChecked()) {
KMessageBox::saveDontShowAgainContinue( ":confirmNewSession" );
}
DM().startReserve();
}
@ -772,10 +790,8 @@ void PasswordDlg::slotStartNewSession()
}
class LockListViewItem : public TQListViewItem {
public:
LockListViewItem( TQListView *parent,
const TQString &sess, const TQString &loc, int _vt )
: TQListViewItem( parent )
public:
LockListViewItem( TQListView *parent, const TQString &sess, const TQString &loc, int _vt ) : TQListViewItem( parent )
, vt( _vt )
{
setText( 0, sess );
@ -801,10 +817,12 @@ void PasswordDlg::slotSwitchUser()
dialog.setCaption(i18n("Switch User"));
TQFrame *winFrame = new TQFrame( &dialog );
if (trinity_desktop_lock_use_system_modal_dialogs)
if (trinity_desktop_lock_use_system_modal_dialogs) {
winFrame->setFrameStyle( TQFrame::NoFrame );
else
}
else {
winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised );
}
winFrame->setLineWidth( 2 );
TQBoxLayout *vbox = new TQVBoxLayout( &dialog );
vbox->addWidget( winFrame );
@ -818,7 +836,6 @@ void PasswordDlg::slotSwitchUser()
SessList sess;
if (dm.localSessions( sess )) {
lv = new TQListView( winFrame );
connect( lv, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint&, int)), TQT_SLOT(slotSessionActivated()) );
connect( lv, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint&, int)), &dialog, TQT_SLOT(accept()) );
@ -833,8 +850,9 @@ void PasswordDlg::slotSwitchUser()
for (SessList::ConstIterator it = sess.begin(); it != sess.end(); ++it) {
DM::sess2Str2( *it, user, loc );
itm = new LockListViewItem( lv, user, loc, (*it).vt );
if (!(*it).vt)
if (!(*it).vt) {
itm->setEnabled( false );
}
if ((*it).self) {
lv->setCurrentItem( itm );
itm->setSelected( true );
@ -857,8 +875,7 @@ void PasswordDlg::slotSwitchUser()
vbox2->addStretch( 2 );
}
if (kapp->authorize("start_new_session") && (p = dm.numReserve()) >= 0)
{
if (kapp->authorize("start_new_session") && (p = dm.numReserve()) >= 0) {
btn = new KPushButton( KGuiItem(i18n("Start &New Session"), "fork"), winFrame );
connect( btn, TQT_SIGNAL(clicked()), TQT_SLOT(slotStartNewSession()) );
connect( btn, TQT_SIGNAL(clicked()), &dialog, TQT_SLOT(accept()) );
@ -883,8 +900,9 @@ void PasswordDlg::slotSwitchUser()
void PasswordDlg::slotSessionActivated()
{
LockListViewItem *itm = (LockListViewItem *)lv->currentItem();
if (itm && itm->vt > 0)
if (itm && itm->vt > 0) {
DM().switchVT( itm->vt );
}
}
void PasswordDlg::capsLocked()

@ -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) 2003 Oswald Buddenhagen <ossi@kde.org>
// Copyright (c) 2010 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
//
#ifndef __LOCKDLG_H__
@ -34,7 +35,7 @@ class PasswordDlg : public TQDialog, public KGreeterPluginHandler
{
Q_OBJECT
public:
public:
PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin);
PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, TQDateTime lockStartDateTime);
~PasswordDlg();
@ -49,11 +50,11 @@ public:
virtual void gplugActivity();
virtual void gplugMsgBox( TQMessageBox::Icon type, const TQString &text );
protected:
protected:
virtual void timerEvent(TQTimerEvent *);
virtual bool eventFilter(TQObject *, TQEvent *);
private slots:
private slots:
void slotSwitchUser();
void slotSessionActivated();
void slotStartNewSession();
@ -61,10 +62,10 @@ private slots:
void layoutClicked();
void slotActivity();
protected slots:
protected slots:
virtual void reject();
private:
private:
void setLayoutText( const TQString &txt );
void capsLocked();
void updateLabel();

@ -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>
@ -74,10 +74,12 @@ QueryDlg::QueryDlg(LockProcess *parent)
setCaption(i18n("Information Needed"));
frame = new TQFrame( this );
if (trinity_desktop_lock_use_system_modal_dialogs)
if (trinity_desktop_lock_use_system_modal_dialogs) {
frame->setFrameStyle( TQFrame::NoFrame );
else
}
else {
frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised );
}
frame->setLineWidth( 2 );
mpixLabel = new TQLabel( frame, "pixlabel" );

@ -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__
@ -30,7 +30,7 @@ class QueryDlg : public TQDialog
{
Q_OBJECT
public:
public:
QueryDlg(LockProcess *parent);
~QueryDlg();
virtual void show();
@ -40,10 +40,10 @@ public:
void setWarningIcon();
const char * getEntry();
private slots:
private slots:
void slotOK();
private:
private:
TQFrame *frame;
TQGridLayout *frameLayout;
TQLabel *mStatusLabel;

@ -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>
@ -76,10 +76,12 @@ SAKDlg::SAKDlg(LockProcess *parent)
setCaption(i18n("Desktop Session Locked"));
frame = new TQFrame( this );
if (trinity_desktop_lock_use_system_modal_dialogs)
if (trinity_desktop_lock_use_system_modal_dialogs) {
frame->setFrameStyle( TQFrame::NoFrame );
else
}
else {
frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised );
}
frame->setLineWidth( 2 );
KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame );
@ -113,7 +115,9 @@ SAKDlg::SAKDlg(LockProcess *parent)
void SAKDlg::slotSAKProcessExited()
{
int retcode = mSAKProcess->exitStatus();
if (retcode != 0) trinity_desktop_lock_use_sak = false;
if (retcode != 0) {
trinity_desktop_lock_use_sak = false;
}
hide();
}

@ -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__
@ -28,7 +28,7 @@ class SAKDlg : public TQDialog
{
Q_OBJECT
public:
public:
SAKDlg(LockProcess *parent);
~SAKDlg();
virtual void show();
@ -36,13 +36,13 @@ public:
void updateLabel( TQString &txt );
void closeDialogForced();
private slots:
private slots:
void slotSAKProcessExited();
protected slots:
protected slots:
virtual void reject();
private:
private:
TQFrame *frame;
TQGridLayout *frameLayout;
TQLabel *mStatusLabel;

@ -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>
@ -76,10 +76,12 @@ SecureDlg::SecureDlg(LockProcess *parent)
setCaption(i18n("Secure Desktop Area"));
frame = new TQFrame( this );
if (trinity_desktop_lock_use_system_modal_dialogs)
if (trinity_desktop_lock_use_system_modal_dialogs) {
frame->setFrameStyle( TQFrame::NoFrame );
else
}
else {
frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised );
}
frame->setLineWidth( 2 );
KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame );

@ -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__
@ -29,7 +29,7 @@ class SecureDlg : public TQDialog
{
Q_OBJECT
public:
public:
SecureDlg(LockProcess *parent);
~SecureDlg();
virtual void show();
@ -37,17 +37,17 @@ public:
void closeDialogForced();
void setRetInt(int *);
private slots:
private slots:
void slotBtnCancel();
void slotBtnLock();
void slotBtnTask();
void slotBtnShutdown();
void slotBtnSwitchUser();
protected slots:
protected slots:
virtual void reject();
private:
private:
TQFrame *frame;
TQGridLayout *frameLayout;
TQLabel *mLogonStatus;

Loading…
Cancel
Save