Version: .19 (using KDE KDE 3.4.2) Installed from: Unlisted Binary Package Compiler: GCC 4.0.1 OS: Linux I called this a security problem this morning, but it is really more of a provacy thing. When my KDE session is locked with a blank screen, the konversation OSD still shows up on the display, so even if my session is locked, a casual observer can monitor the irc session by watching the osd.
SVN commit 450606 by shin: Don't show messages on the OSD widget when the desktop is locked BUG: 110840 I took the code to know if KDesktopLock is running from KPilot. Thank you, the kpilot team :) M +53 -1 osd.cpp M +3 -0 osd.h --- trunk/extragear/network/konversation/src/osd.cpp #450605:450606 @@ -19,6 +19,8 @@ #include <qpainter.h> #include <qregexp.h> +#include <dcopclient.h> +#include <kapplication.h> #include <kdebug.h> #include <kglobalsettings.h> //unsetColors() @@ -121,7 +123,7 @@ } -void OSDWidget::showOSD( const QString &text, bool preemptive ) +void OSDWidget::showOSD( const QString &text, bool preemptive ) // slot { if ( isEnabled() && !text.isEmpty() ) { @@ -236,6 +238,13 @@ void OSDWidget::show() { + // Don't show the OSD widget when the desktop is locked + if ( isKDesktopLockRunning() ) + { + minReached(); // don't queue the message + return; + } + if ( m_dirty ) renderOSDText( m_currentText ); QWidget::show(); @@ -388,4 +397,47 @@ } } + + +// the code was taken from pilotDaemon.cc in KPilot +OSDWidget::KDesktopLockStatus OSDWidget::isKDesktopLockRunning() // static +{ + DCOPClient *dcopptr = KApplication::kApplication()->dcopClient(); + + // Can't tell, very weird, err on the side of safety. + if (!dcopptr || !dcopptr->isAttached()) + { + kdWarning() << k_funcinfo << ": Could not make DCOP connection. " + << "Assuming screensaver is active." << endl; + return DCOPError; + } + + QByteArray data,returnValue; + QCString returnType; + + if (!dcopptr->call("kdesktop","KScreensaverIface","isBlanked()", + data,returnType,returnValue,true)) + { + kdWarning() << k_funcinfo << ": Check for screensaver failed." + << "Assuming screensaver is active." << endl; + // Err on the side of safety again. + return DCOPError; + } + + if (returnType == "bool") + { + bool b; + QDataStream reply(returnValue,IO_ReadOnly); + reply >> b; + return (b ? Locked : NotLocked); + } + else + { + kdWarning() << k_funcinfo << ": Strange return value from screensaver. " + << "Assuming screensaver is active." << endl; + // Err on the side of safety. + return DCOPError; + } +} + #include "osd.moc" --- trunk/extragear/network/konversation/src/osd.h #450605:450606 @@ -70,6 +70,9 @@ /* called after most set*() calls to update the OSD */ void refresh(); + enum KDesktopLockStatus { NotLocked=0, Locked=1, DCOPError=2 }; + static KDesktopLockStatus isKDesktopLockRunning(); + static const int MARGIN = 15; QString m_appName;