diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-04-07 04:18:36 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-04-07 04:18:36 +0000 |
commit | c97349f53a15c930ce1f5f53ef37c44318a1981a (patch) | |
tree | 6064071088838d50234a4b6fe9d855e7136dea74 /kdesktop/lock/infodlg.cc | |
parent | 1c9a50141d128a02150d0adca3684f957e3e994f (diff) | |
download | tdebase-c97349f53a15c930ce1f5f53ef37c44318a1981a.tar.gz tdebase-c97349f53a15c930ce1f5f53ef37c44318a1981a.zip |
Added initial support for pipe-based root-only control of all running kdesktop_lock processes
Right now this allows a background authentication process to display pop-up status messages on all screens
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1111946 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdesktop/lock/infodlg.cc')
-rw-r--r-- | kdesktop/lock/infodlg.cc | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/kdesktop/lock/infodlg.cc b/kdesktop/lock/infodlg.cc new file mode 100644 index 000000000..86351dd7b --- /dev/null +++ b/kdesktop/lock/infodlg.cc @@ -0,0 +1,117 @@ +//=========================================================================== +// +// This file is part of the KDE project +// +// Copyright (c) 2010 Timothy Pearson <[email protected]> + +#include <config.h> + +#include "infodlg.h" + +#include <dmctl.h> + +#include <kapplication.h> +#include <klocale.h> +#include <kpushbutton.h> +#include <kseparator.h> +#include <kstandarddirs.h> +#include <kglobalsettings.h> +#include <kconfig.h> +#include <kiconloader.h> +#include <kdesu/defaults.h> +#include <kpassdlg.h> +#include <kdebug.h> +#include <kuser.h> +#include <dcopref.h> +#include <kmessagebox.h> + +#include <qlayout.h> +#include <qpushbutton.h> +#include <qmessagebox.h> +#include <qsimplerichtext.h> +#include <qlabel.h> +#include <qstringlist.h> +#include <qfontmetrics.h> +#include <qstyle.h> +#include <qapplication.h> +#include <qlistview.h> +#include <qheader.h> +#include <qcheckbox.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 <fixx11h.h> + +#ifndef AF_LOCAL +# define AF_LOCAL AF_UNIX +#endif + +//=========================================================================== +// +// Simple dialog for displaying an unlock status or recurring error message +// +InfoDlg::InfoDlg(LockProcess *parent) + : QDialog(parent, "information dialog", true, WX11BypassWM), + mUnlockingFailed(false) +{ + frame = new QFrame( this ); + frame->setFrameStyle( QFrame::Panel | QFrame::Raised ); + frame->setLineWidth( 2 ); + + mpixLabel = new QLabel( frame, "pixlabel" ); + mpixLabel->setPixmap(DesktopIcon("unlock")); + + KUser user; + + mStatusLabel = new QLabel( "<b> </b>", frame ); + mStatusLabel->setAlignment( QLabel::AlignCenter ); + + QVBoxLayout *unlockDialogLayout = new QVBoxLayout( this ); + unlockDialogLayout->addWidget( frame ); + + QHBoxLayout *layStatus = new QHBoxLayout( 0, 0, KDialog::spacingHint()); + layStatus->addWidget( mStatusLabel ); + + frameLayout = new QGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); + frameLayout->addMultiCellWidget( mpixLabel, 0, 2, 0, 0, AlignTop ); + frameLayout->addLayout( layStatus, 1, 1 ); + + installEventFilter(this); +} + +InfoDlg::~InfoDlg() +{ + hide(); +} + +void InfoDlg::updateLabel(QString &txt) +{ + mStatusLabel->setPaletteForegroundColor(Qt::black); + mStatusLabel->setText("<b>" + txt + "</b>"); +} + +void InfoDlg::setUnlockIcon() +{ + mpixLabel->setPixmap(DesktopIcon("unlock")); +} + +void InfoDlg::setWarningIcon() +{ + mpixLabel->setPixmap(DesktopIcon("messagebox_warning")); +} + +void InfoDlg::show() +{ + QDialog::show(); + QApplication::flushX(); +} + +#include "infodlg.moc" |