[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/kdesktop/lock
From: Chris Howells <howells () kde ! org>
Date: 2005-06-10 18:54:15
Message-ID: 1118429655.496738.21127.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 424085 by howells:
Aaron-inspired progress reminder to visibly tell you how much time there is left \
before automatic logout occurs
M +13 -6 autologout.cc
M +3 -1 autologout.h
--- trunk/KDE/kdebase/kdesktop/lock/autologout.cc #424084:424085
@@ -23,8 +23,8 @@
#include <qstyle.h>
#include <qapplication.h>
#include <qdialog.h>
+#include <qprogressbar.h
-//FIXME don't hardcode the time
#define COUNTDOWN 30*1000
AutoLogout::AutoLogout(LockProcess *parent) : QDialog(parent, "password dialog", \
true, WX11BypassWM) @@ -42,6 +42,10 @@
mStatusLabel = new QLabel("<b> </b>", frame);
mStatusLabel->setAlignment(QLabel::AlignCenter);
+ QLabel *mProgressLabel = new QLabel("Time Remaining:", frame);
+ mProgressRemaining = new QProgressBar(frame);
+ mProgressRemaining->setPercentageVisible(false);
+
QVBoxLayout *unlockDialogLayout = new QVBoxLayout( this );
unlockDialogLayout->addWidget( frame );
@@ -50,16 +54,18 @@
frameLayout->addWidget(greetLabel, 0, 1);
frameLayout->addWidget(mStatusLabel, 1, 1);
frameLayout->addWidget(infoLabel, 2, 1);
+ frameLayout->addWidget(mProgressLabel, 3, 1);
+ frameLayout->addWidget(mProgressRemaining, 4, 1);
// get the time remaining in seconds for the status label
mRemaining = COUNTDOWN/1000;
- updateLabel(mRemaining);
+ mProgressRemaining->setTotalSteps(mRemaining);
- // event second we want to update the label
+ updateInfo(mRemaining);
+
mCountdownTimerId = startTimer(1000);
- // we found some activity so dismiss the dialog
connect(qApp, SIGNAL(activity()), SLOT(slotActivity()));
}
@@ -68,18 +74,19 @@
hide();
}
-void AutoLogout::updateLabel(int timeout)
+void AutoLogout::updateInfo(int timeout)
{
mStatusLabel->setText(i18n("<nobr><qt>You will be automatically logged out in 1 \
second</qt></nobr>",
"<nobr><qt>You will be automatically logged out in %n \
seconds</qt></nobr>", timeout) );
+ mProgressRemaining->setProgress(mRemaining);
}
void AutoLogout::timerEvent(QTimerEvent *ev)
{
if (ev->timerId() == mCountdownTimerId)
{
- updateLabel(mRemaining);
+ updateInfo(mRemaining);
--mRemaining;
if (mRemaining < 0)
{
--- trunk/KDE/kdebase/kdesktop/lock/autologout.h #424084:424085
@@ -18,6 +18,7 @@
class QGridLayout;
class QLabel;
class QDialog;
+class QProgressBar;
class AutoLogout : public QDialog
{
@@ -35,13 +36,14 @@
void slotActivity();
private:
- void updateLabel(int);
+ void updateInfo(int);
QFrame *frame;
QGridLayout *frameLayout;
QLabel *mStatusLabel;
int mCountdownTimerId;
int mRemaining;
QTimer countDownTimer;
+ QProgressBar *mProgressRemaining;
void logout();
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic