summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kdesktop/lock/lockprocess.cc92
-rw-r--r--kdesktop/lock/lockprocess.h5
-rw-r--r--kdesktop/lock/securedlg.cc25
-rw-r--r--kdesktop/lock/securedlg.h2
4 files changed, 81 insertions, 43 deletions
diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc
index 3ec3ad74b..271581dff 100644
--- a/kdesktop/lock/lockprocess.cc
+++ b/kdesktop/lock/lockprocess.cc
@@ -162,21 +162,23 @@ LockProcess::LockProcess(bool child, bool useBlankOnly)
mRestoreXF86Lock(false),
mForbidden(false),
mAutoLogout(false),
+ resizeTimer(NULL),
+ hackResumeTimer(NULL),
mVkbdProcess(NULL),
mKWinModule(NULL),
mPipeOpen(false),
mPipeOpen_out(false),
mInfoMessageDisplayed(false),
- mForceReject(false),
mDialogControlLock(false),
+ mForceReject(false),
currentDialog(NULL),
- resizeTimer(NULL),
- hackResumeTimer(NULL),
mForceContinualLockDisplayTimer(NULL),
mEnsureVRootWindowSecurityTimer(NULL),
mHackDelayStartupTimer(NULL),
mHackDelayStartupTimeout(0),
mHackStartupEnabled(true),
+ m_rootPixmap(NULL),
+ mBackingStartupDelayTimer(0),
m_startupStatusDialog(NULL)
{
setupSignals();
@@ -301,6 +303,11 @@ LockProcess::~LockProcess()
greetPlugin.library->unload();
}
+ if (m_rootPixmap) {
+ m_rootPixmap->stop();
+ delete m_rootPixmap;
+ }
+
mPipeOpen = false;
mPipeOpen_out = false;
}
@@ -310,13 +317,17 @@ static int signal_pipe[2];
static void sigterm_handler(int)
{
char tmp = 'T';
- ::write( signal_pipe[1], &tmp, 1);
+ if (::write( signal_pipe[1], &tmp, 1) == -1) {
+ // Error handler to shut up gcc warnings
+ }
}
static void sighup_handler(int)
{
char tmp = 'H';
- ::write( signal_pipe[1], &tmp, 1);
+ if (::write( signal_pipe[1], &tmp, 1) == -1) {
+ // Error handler to shut up gcc warnings
+ }
}
bool LockProcess::closeCurrentWindow()
@@ -418,7 +429,7 @@ void LockProcess::checkPipe()
InfoDlg inDlg( this );
inDlg.updateLabel(to_display);
inDlg.setUnlockIcon();
- int ret = execDialog( &inDlg );
+ execDialog( &inDlg );
mForceReject = false;
return;
}
@@ -442,7 +453,7 @@ void LockProcess::checkPipe()
if (readbuf[0] == 'I') inDlg.setInfoIcon();
if (readbuf[0] == 'W') inDlg.setWarningIcon();
if (readbuf[0] == 'E') inDlg.setErrorIcon();
- int ret = execDialog( &inDlg );
+ execDialog( &inDlg );
mForceReject = false;
return;
}
@@ -464,13 +475,17 @@ void LockProcess::checkPipe()
qryDlg.updateLabel(to_display);
qryDlg.setUnlockIcon();
mForceReject = false;
- int ret = execDialog( &qryDlg );
+ execDialog( &qryDlg );
if (mForceReject == false) {
pin_entry = qryDlg.getEntry();
mInfoMessageDisplayed=false;
if (mPipeOpen_out == true) {
- write(mPipe_fd_out, pin_entry, strlen(pin_entry)+1);
- write(mPipe_fd_out, "\n\r", 3);
+ if (write(mPipe_fd_out, pin_entry, strlen(pin_entry)+1) == -1) {
+ // Error handler to shut up gcc warnings
+ }
+ if (write(mPipe_fd_out, "\n\r", 3) == -1) {
+ // Error handler to shut up gcc warnings
+ }
}
}
mForceReject = false;
@@ -509,7 +524,9 @@ void LockProcess::setupSignals()
act.sa_flags = 0;
sigaction(SIGHUP, &act, 0L);
- pipe(signal_pipe);
+ if (pipe(signal_pipe) == -1) {
+ // Error handler to shut up gcc warnings
+ }
TQSocketNotifier* notif = new TQSocketNotifier(signal_pipe[0],
TQSocketNotifier::Read, TQT_TQOBJECT(this) );
connect( notif, TQT_SIGNAL(activated(int)), TQT_SLOT(signalPipeSignal()));
@@ -519,7 +536,9 @@ void LockProcess::setupSignals()
void LockProcess::signalPipeSignal()
{
char tmp;
- ::read( signal_pipe[0], &tmp, 1);
+ if (::read( signal_pipe[0], &tmp, 1) == -1) {
+ // Error handler to shut up gcc warnings
+ }
if( tmp == 'T' )
quitSaver();
else if( tmp == 'H' ) {
@@ -531,11 +550,13 @@ void LockProcess::signalPipeSignal()
//---------------------------------------------------------------------------
bool LockProcess::lock()
{
+#ifdef USE_SECURING_DESKTOP_NOTIFICATION
m_startupStatusDialog = new KSMModalDialog(this);
m_startupStatusDialog->setStatusMessage(i18n("Securing desktop session").append("..."));
m_startupStatusDialog->show();
m_startupStatusDialog->setActiveWindow();
tqApp->processEvents();
+#endif
if (startSaver()) {
// In case of a forced lock we don't react to events during
@@ -589,6 +610,12 @@ void LockProcess::quitSaver()
//---------------------------------------------------------------------------
void LockProcess::startSecureDialog()
{
+ if ((backingPixmap.isNull()) && (mBackingStartupDelayTimer < 100)) {
+ TQTimer::singleShot(10, this, TQT_SLOT(startSecureDialog()));
+ mBackingStartupDelayTimer++;
+ return;
+ }
+
int ret;
SecureDlg inDlg( this );
inDlg.setRetInt(&ret);
@@ -620,7 +647,9 @@ void LockProcess::startSecureDialog()
mBusy = false;
}
if (ret == 2) {
- system("ksysguard &");
+ if (system("ksysguard &") == -1) {
+ // Error handler to shut up gcc warnings
+ }
kapp->quit();
}
// FIXME
@@ -630,14 +659,17 @@ void LockProcess::startSecureDialog()
bool LockProcess::runSecureDialog()
{
+#ifdef USE_SECURING_DESKTOP_NOTIFICATION
m_startupStatusDialog = new KSMModalDialog(this);
m_startupStatusDialog->setStatusMessage(i18n("Securing desktop session").append("..."));
m_startupStatusDialog->show();
m_startupStatusDialog->setActiveWindow();
tqApp->processEvents();
+#endif
trinity_desktop_lock_in_sec_dlg = true;
if (startSaver()) {
+ mBackingStartupDelayTimer = 0;
TQTimer::singleShot(0, this, TQT_SLOT(startSecureDialog()));
return true;
}
@@ -1105,12 +1137,10 @@ bool LockProcess::startSaver()
}
if (trinity_desktop_lock_use_system_modal_dialogs) {
// Try to get the root pixmap
- TQString filename = getenv("USER");
- filename.prepend("/tmp/kde-");
- filename.append("/krootbacking.png");
- remove(filename.ascii());
- system("krootbacking &");
- TQTimer::singleShot( 0, this, SLOT(slotPaintBackground()) );
+ m_rootPixmap = new KRootPixmap(this);
+ m_rootPixmap->setCustomPainting(true);
+ connect(m_rootPixmap, TQT_SIGNAL(backgroundUpdated(const TQPixmap &)), this, TQT_SLOT(slotPaintBackground(const TQPixmap &)));
+ m_rootPixmap->start();
}
if (trinity_desktop_lock_in_sec_dlg == FALSE) {
@@ -1143,7 +1173,9 @@ void LockProcess::stopSaver()
ungrabInput();
const char *out = "GOAWAY!";
for (TQValueList<int>::ConstIterator it = child_sockets.begin(); it != child_sockets.end(); ++it)
- write(*it, out, sizeof(out));
+ if (write(*it, out, sizeof(out)) == -1) {
+ // Error handler to shut up gcc warnings
+ }
}
}
@@ -1479,7 +1511,7 @@ bool LockProcess::checkPass()
if (trinity_desktop_lock_use_sak) {
// Wait for SAK press before continuing...
SAKDlg inDlg( this );
- int ret = execDialog( &inDlg );
+ execDialog( &inDlg );
if (trinity_desktop_lock_closing_windows)
return 0;
}
@@ -1576,21 +1608,9 @@ int LockProcess::execDialog( TQDialog *dlg )
return rt;
}
-void LockProcess::slotPaintBackground()
+void LockProcess::slotPaintBackground(const TQPixmap &rpm)
{
- TQPixmap pm;
- TQString filename = getenv("USER");
- filename.prepend("/tmp/kde-");
- filename.append("/krootbacking.png");
- bool success = pm.load(filename, "PNG");
- if (!success) {
- sleep(1);
- success = pm.load(filename, "PNG");
- if (!success) {
- pm = TQPixmap(kapp->desktop()->width(), kapp->desktop()->height());
- pm.fill(Qt::black);
- }
- }
+ TQPixmap pm = rpm;
if (TQPaintDevice::x11AppDepth() == 32) {
// Remove the alpha components from the image
@@ -1695,7 +1715,7 @@ bool LockProcess::x11Event(XEvent *event)
ENABLE_CONTINUOUS_LOCKDLG_DISPLAY
if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE);
}
- if (!mLocked)
+ if ((!mLocked) && (!trinity_desktop_lock_in_sec_dlg))
{
stopSaver();
kapp->quit();
diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h
index 1b5fa9fbf..a986d42c4 100644
--- a/kdesktop/lock/lockprocess.h
+++ b/kdesktop/lock/lockprocess.h
@@ -13,6 +13,7 @@
#include <kprocess.h>
#include <kpixmap.h>
+#include <krootpixmap.h>
#include <tqwidget.h>
#include <tqtimer.h>
@@ -71,7 +72,7 @@ public slots:
void desktopResized();
void doDesktopResizeFinish();
void doFunctionKeyBroadcast();
- void slotPaintBackground();
+ void slotPaintBackground(const TQPixmap &pm);
protected:
virtual bool x11Event(XEvent *);
@@ -186,6 +187,8 @@ private:
bool mHackStartupEnabled;
TQPixmap backingPixmap;
+ KRootPixmap *m_rootPixmap;
+ int mBackingStartupDelayTimer;
KSMModalDialog* m_startupStatusDialog;
};
diff --git a/kdesktop/lock/securedlg.cc b/kdesktop/lock/securedlg.cc
index ac3d3d113..4577f5784 100644
--- a/kdesktop/lock/securedlg.cc
+++ b/kdesktop/lock/securedlg.cc
@@ -104,28 +104,34 @@ SecureDlg::SecureDlg(LockProcess *parent)
mShutdownButton->setText(i18n("Logoff Menu"));
mShutdownButton->setEnabled(false); // FIXME
+ mSwitchButton = new TQPushButton( frame );
+ mSwitchButton->setText(i18n("Switch User"));
+ mSwitchButton->setEnabled(false); // FIXME
+
TQVBoxLayout *unlockDialogLayout = new TQVBoxLayout( this );
unlockDialogLayout->addWidget( frame );
TQHBoxLayout *layStatus = new TQHBoxLayout( 0, 0, KDialog::spacingHint());
layStatus->addWidget( mLogonStatus );
- TQHBoxLayout *layPBRow1 = new TQHBoxLayout( 0, 0, KDialog::spacingHint());
- layPBRow1->addWidget( mLockButton );
- layPBRow1->addWidget( mTaskButton );
- layPBRow1->addWidget( mShutdownButton );
- layPBRow1->addWidget( mCancelButton );
+ TQGridLayout *layPBGrid = new TQGridLayout( 0, 0, KDialog::spacingHint());
+ layPBGrid->addWidget( mLockButton, 0, 0 );
+ layPBGrid->addWidget( mTaskButton, 0, 1 );
+ layPBGrid->addWidget( mShutdownButton, 0, 2 );
+ layPBGrid->addWidget( mCancelButton, 0, 3 );
+ layPBGrid->addWidget( mSwitchButton, 1, 0 );
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);
frameLayout->addMultiCellWidget( sep, 2, 2, 0, 1 );
- frameLayout->addMultiCellLayout( layPBRow1, 3, 3, 0, 1, AlignLeft | AlignVCenter);
+ frameLayout->addMultiCellLayout( layPBGrid, 3, 3, 0, 1, AlignLeft | AlignVCenter);
connect(mCancelButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnCancel()));
connect(mLockButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnLock()));
connect(mTaskButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnTask()));
connect(mShutdownButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnShutdown()));
+ connect(mSwitchButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBtnSwitchUser()));
TQSize dlgSz = sizeHint();
int btnSize = dlgSz.width();
@@ -135,6 +141,7 @@ SecureDlg::SecureDlg(LockProcess *parent)
mTaskButton->setFixedWidth(btnSize);
mCancelButton->setFixedWidth(btnSize);
mShutdownButton->setFixedWidth(btnSize);
+ mSwitchButton->setFixedWidth(btnSize);
installEventFilter(this);
}
@@ -168,6 +175,12 @@ void SecureDlg::slotBtnShutdown()
hide();
}
+void SecureDlg::slotBtnSwitchUser()
+{
+ if (retInt) *retInt = 4;
+ hide();
+}
+
void SecureDlg::setRetInt(int *i)
{
retInt = i;
diff --git a/kdesktop/lock/securedlg.h b/kdesktop/lock/securedlg.h
index b9278d8d7..d616bf2e7 100644
--- a/kdesktop/lock/securedlg.h
+++ b/kdesktop/lock/securedlg.h
@@ -42,6 +42,7 @@ private slots:
void slotBtnLock();
void slotBtnTask();
void slotBtnShutdown();
+ void slotBtnSwitchUser();
protected slots:
virtual void reject();
@@ -54,6 +55,7 @@ private:
TQButton *mLockButton;
TQButton *mTaskButton;
TQButton *mShutdownButton;
+ TQButton *mSwitchButton;
int mCapsLocked;
bool mUnlockingFailed;
TQStringList layoutsList;