From 1c618af70de66f304481efe05b8ebcc0d5d8d4f6 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Thu, 21 Nov 2013 01:34:25 +0100 Subject: Add progress bar to logout status dialog This resolves Bug 1667 --- ksmserver/shutdown.cpp | 16 +++++++++++----- ksmserver/shutdowndlg.cpp | 16 ++++++++++++++++ ksmserver/shutdowndlg.h | 5 +++++ 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/ksmserver/shutdown.cpp b/ksmserver/shutdown.cpp index 12743e892..a463c37d2 100644 --- a/ksmserver/shutdown.cpp +++ b/ksmserver/shutdown.cpp @@ -817,11 +817,14 @@ void KSMServer::completeShutdownOrCheckpoint() } } } + KSMShutdownIPDlg *shutdownNotifierDlg=static_cast(shutdownNotifierIPDlg); + shutdownNotifierDlg->setProgressBarTotalSteps(initialClientCount); + shutdownNotifierDlg->setProgressBarProgress(initialClientCount-clients.count()); if (nextClientToKill == "") { - static_cast(shutdownNotifierIPDlg)->setStatusMessage(i18n("Closing applications (%1/%2)...").arg(initialClientCount-clients.count()).arg(initialClientCount)); + shutdownNotifierDlg->setStatusMessage(i18n("Closing applications (%1/%2)...").arg(initialClientCount-clients.count()).arg(initialClientCount)); } else { - static_cast(shutdownNotifierIPDlg)->setStatusMessage(i18n("Closing applications (%1/%2, %3)...").arg(initialClientCount-clients.count()).arg(initialClientCount).arg(nextClientToKill)); + shutdownNotifierDlg->setStatusMessage(i18n("Closing applications (%1/%2, %3)...").arg(initialClientCount-clients.count()).arg(initialClientCount).arg(nextClientToKill)); } } if( waitForKNotify ) { @@ -886,12 +889,15 @@ void KSMServer::completeKilling() } if( wait ) { if (shutdownNotifierIPDlg) { - static_cast(shutdownNotifierIPDlg)->show(); + KSMShutdownIPDlg *shutdownNotifierDlg=static_cast(shutdownNotifierIPDlg); + shutdownNotifierDlg->setProgressBarTotalSteps(initialClientCount); + shutdownNotifierDlg->setProgressBarProgress(initialClientCount-clients.count()); + shutdownNotifierDlg->show(); if (nextClientToKill == "") { - static_cast(shutdownNotifierIPDlg)->setStatusMessage(i18n("Closing applications (%1/%2)...").arg(initialClientCount-clients.count()).arg(initialClientCount)); + shutdownNotifierDlg->setStatusMessage(i18n("Closing applications (%1/%2)...").arg(initialClientCount-clients.count()).arg(initialClientCount)); } else { - static_cast(shutdownNotifierIPDlg)->setStatusMessage(i18n("Closing applications (%1/%2, %3)...").arg(initialClientCount-clients.count()).arg(initialClientCount).arg(nextClientToKill)); + shutdownNotifierDlg->setStatusMessage(i18n("Closing applications (%1/%2, %3)...").arg(initialClientCount-clients.count()).arg(initialClientCount).arg(nextClientToKill)); } } return; diff --git a/ksmserver/shutdowndlg.cpp b/ksmserver/shutdowndlg.cpp index fde31d223..9cf0f3c32 100644 --- a/ksmserver/shutdowndlg.cpp +++ b/ksmserver/shutdowndlg.cpp @@ -1250,10 +1250,26 @@ void KSMShutdownIPDlg::setNotificationActionButtonsSkipText(TQString text) m_button1->setText(text); } +void KSMShutdownIPDlg::setProgressBarTotalSteps(int total_steps) +{ + m_progressbar->setTotalSteps(total_steps); +} + +void KSMShutdownIPDlg::setProgressBarProgress(int step) +{ + m_progressbar->setProgress(step); +} + KSMShutdownIPDlg::KSMShutdownIPDlg(TQWidget* parent) : KSMModalDialog( parent ) { + m_progressbar = new TQProgressBar(this); + m_progressbar->show(); + m_gridlayout->expand(4,3); + m_gridlayout->addMultiCellWidget( m_progressbar, 3, 3, 0, 2); + setFixedSize(sizeHint()); + setStatusMessage(i18n("Saving your settings...")); setNotificationActionButtonsSkipText(i18n("Skip Notification")); diff --git a/ksmserver/shutdowndlg.h b/ksmserver/shutdowndlg.h index 270979182..d8f6b9d3b 100644 --- a/ksmserver/shutdowndlg.h +++ b/ksmserver/shutdowndlg.h @@ -18,6 +18,7 @@ Copyright (C) 2000 Matthias Ettrich #include #include #include +#include class TQPushButton; class TQVButtonGroup; @@ -175,6 +176,8 @@ public: void showNotificationActionButtons(); void hideNotificationActionButtons(); void setNotificationActionButtonsSkipText(TQString text); + void setProgressBarTotalSteps(int total_steps); + void setProgressBarProgress(int step); signals: void abortLogoutClicked(); @@ -185,6 +188,8 @@ protected: private: KSMShutdownIPDlg( TQWidget* parent ); + + TQProgressBar *m_progressbar; }; class KSMDelayedPushButton : public KPushButton -- cgit v1.2.1