Use new modal system nofitication dialog in kdebase smserver

Add fancy startup dialog to match the fancy shutdown dialog
This is only used if the themed splash screen is turned off


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1253056 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 13 years ago
parent 9925fc58bc
commit b971f9aae7

@ -40,7 +40,7 @@ install( FILES move_session_config.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
tde_add_kdeinit_executable( ksmserver AUTOMOC
SOURCES
main.cpp server.cpp shutdowndlg.cpp
main.cpp server.cpp shutdowndlg.cpp startupdlg.cpp
legacy.cpp startup.cpp shutdown.cpp client.cpp
KSMServerInterface.skel server.skel timed.ui
LINK dmctl-static kdeui-shared krsync-shared ${HAL_LIBRARIES} ${DBUS_TQT_LIBRARIES}

@ -579,7 +579,7 @@ extern "C" int _IceTransNoListen(const char * protocol);
#endif
KSMServer::KSMServer( const TQString& windowManager, bool _only_local )
: DCOPObject("ksmserver"), sessionGroup( "" ), shutdownNotifierIPDlg(0)
: DCOPObject("ksmserver"), sessionGroup( "" ), startupNotifierIPDlg(0), shutdownNotifierIPDlg(0)
{
the_server = this;
clean = false;

@ -176,6 +176,7 @@ private:
void saveCurrentSession();
void saveCurrentSessionAs( TQString );
TQWidget* startupNotifierIPDlg;
TQWidget* shutdownNotifierIPDlg;
private:

@ -204,7 +204,7 @@ void KSMServer::shutdownInternal( KApplication::ShutdownConfirm confirm,
KRsync krs(this, "");
krs.executeLogoutAutoSync();
if (shutdownNotifierIPDlg) {
static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setStatusMessage("");
static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setStatusMessage(i18n("Saving your settings..."));
}
if ( saveSession )
@ -572,7 +572,7 @@ void KSMServer::killWM()
state = KillingWM;
bool iswm = false;
if (shutdownNotifierIPDlg) {
shutdownNotifierIPDlg->close();
static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->closeSMDialog();
shutdownNotifierIPDlg=0;
}
for ( KSMClient* c = clients.first(); c; c = clients.next() ) {

@ -1106,104 +1106,16 @@ TQWidget* KSMShutdownIPDlg::showShutdownIP()
kapp->enableStyles();
KSMShutdownIPDlg* l = new KSMShutdownIPDlg( 0 );
// Show dialog (will save the background in showEvent)
TQSize sh = l->tqsizeHint();
TQRect rect = KGlobalSettings::desktopGeometry(TQCursor::pos());
l->move(rect.x() + (rect.width() - sh.width())/2,
rect.y() + (rect.height() - sh.height())/2);
kapp->disableStyles();
return l;
}
void KSMShutdownIPDlg::setStatusMessage(TQString message)
{
if (message == "") {
m_statusLabel->setText(i18n("Saving your settings").append("..."));
}
else {
m_statusLabel->setText(message);
}
}
KSMShutdownIPDlg::KSMShutdownIPDlg(TQWidget* parent)
: TQWidget( 0, "", Qt::WStyle_Customize | Qt::WType_Dialog | Qt::WStyle_Title | Qt::WStyle_StaysOnTop | Qt::WDestructiveClose )
: KSMModalDialog( parent )
{
// Signal that we do not want any window controls to be shown at all
Atom kde_wm_system_modal_notification;
kde_wm_system_modal_notification = XInternAtom(qt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False);
XChangeProperty(qt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L);
TQVBoxLayout* vbox = new TQVBoxLayout( this );
TQFrame* frame = new TQFrame( this );
frame->setFrameStyle( TQFrame::NoFrame );
frame->setLineWidth( tqstyle().tqpixelMetric( TQStyle::PM_DefaultFrameWidth, frame ) );
// we need to set the minimum size for the window
frame->setMinimumWidth(400);
vbox->addWidget( frame );
TQGridLayout* gbox = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
TQHBoxLayout* centerbox = new TQHBoxLayout( frame, 0, KDialog::spacingHint() );
TQHBoxLayout* seperatorbox = new TQHBoxLayout( frame, 0, 0 );
TQWidget* ticon = new TQWidget( frame );
KIconLoader * ldr = KGlobal::iconLoader();
TQPixmap trinityPixmap = ldr->loadIcon("kmenu", KIcon::Panel, KIcon::SizeLarge, KIcon::DefaultState, 0L, true);
// Manually draw the alpha portions of the icon onto the widget background color...
TQRgb backgroundRgb = ticon->paletteBackgroundColor().rgb();
TQImage correctedImage = trinityPixmap.convertToImage();
correctedImage = correctedImage.convertDepth(32);
correctedImage.setAlphaBuffer(true);
int w = correctedImage.width();
int h = correctedImage.height();
for (int y = 0; y < h; ++y) {
TQRgb *ls = (TQRgb *)correctedImage.scanLine( y );
for (int x = 0; x < w; ++x) {
TQRgb l = ls[x];
float alpha_adjust = tqAlpha( l )/255.0;
int r = int( (tqRed( l ) * alpha_adjust) + (tqRed( backgroundRgb ) * (1.0-alpha_adjust)) );
int g = int( (tqGreen( l ) * alpha_adjust) + (tqGreen( backgroundRgb ) * (1.0-alpha_adjust)) );
int b = int( (tqBlue( l ) * alpha_adjust) + (tqBlue( backgroundRgb ) * (1.0-alpha_adjust)) );
int a = int( 255 );
ls[x] = tqRgba( r, g, b, a );
}
}
trinityPixmap.convertFromImage(correctedImage);
ticon->setBackgroundPixmap(trinityPixmap);
ticon->setMinimumSize(trinityPixmap.size());
ticon->setMaximumSize(trinityPixmap.size());
ticon->resize(trinityPixmap.size());
centerbox->addWidget( ticon, AlignCenter );
TQWidget* swidget = new TQWidget( frame );
swidget->resize(2, frame->sizeHint().width());
swidget->setBackgroundColor(Qt::black);
seperatorbox->addWidget( swidget, AlignCenter );
TQLabel* label = new TQLabel( i18n("Trinity Desktop Environment"), frame );
TQFont fnt = label->font();
fnt.setBold( true );
fnt.setPointSize( fnt.pointSize() * 3 / 2 );
label->setFont( fnt );
centerbox->addWidget( label, AlignCenter );
m_statusLabel = new TQLabel( i18n("Saving your settings..."), frame );
fnt = m_statusLabel->font();
fnt.setBold( false );
fnt.setPointSize( fnt.pointSize() * 1 );
m_statusLabel->setFont( fnt );
gbox->addMultiCellWidget( m_statusLabel, 2, 2, 0, 0, AlignLeft | AlignVCenter );
gbox->addLayout(centerbox, 0, 0);
gbox->addLayout(seperatorbox, 1, 0);
setFixedSize( sizeHint() );
setCaption( i18n("Please wait...") );
setStatusMessage(i18n("Saving your settings..."));
show();
setActiveWindow();
@ -1211,15 +1123,6 @@ KSMShutdownIPDlg::KSMShutdownIPDlg(TQWidget* parent)
KSMShutdownIPDlg::~KSMShutdownIPDlg()
{
}
void KSMShutdownIPDlg::closeEvent(TQCloseEvent *e)
{
//---------------------------------------------
// Don't call the base function because
// we want to ignore the close event
//---------------------------------------------
}
KSMDelayedPushButton::KSMDelayedPushButton( const KGuiItem &item,

@ -10,7 +10,7 @@ Copyright (C) 2000 Matthias Ettrich <ettrich@kde.org>
#include <tqpixmap.h>
#include <tqimage.h>
#include <tqdatetime.h>
#include <tqdialog.h>
#include <kdialog.h>
#include <kpushbutton.h>
#include <tqpushbutton.h>
#include <tqframe.h>
@ -141,23 +141,18 @@ private:
};
// The shutdown-in-progress dialog
class KSMShutdownIPDlg : public TQWidget
class KSMShutdownIPDlg : public KSMModalDialog
{
Q_OBJECT
public:
static TQWidget* showShutdownIP();
void setStatusMessage(TQString message);
protected:
~KSMShutdownIPDlg();
protected slots:
void closeEvent(TQCloseEvent *e);
private:
KSMShutdownIPDlg( TQWidget* parent );
TQLabel* m_statusLabel;
};
class KSMDelayedPushButton : public KPushButton

@ -81,15 +81,26 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "server.h"
#include "global.h"
#include "startupdlg.h"
#include "client.h"
#include <kdebug.h>
// shall we show a nice fancy login screen?
bool showFancyLogin = FALSE;
bool trinity_startup_main_sequence_done = FALSE;
/*! Restores the previous session. Ensures the window manager is
running (if specified).
*/
void KSMServer::restoreSession( TQString sessionName )
{
showFancyLogin = KConfigGroup(KGlobal::config(), "Login").readBoolEntry("showFancyLogin", true);
KConfig ksplashcfg( "ksplashrc", true );
ksplashcfg.setGroup( "KSplash" );
if ( ksplashcfg.readEntry( "Theme", "Default" ) != TQString("None") )
showFancyLogin = false;
if( state != Idle )
return;
state = LaunchingWM;
@ -131,8 +142,14 @@ void KSMServer::restoreSession( TQString sessionName )
// visually more appealing startup.
for (uint i = 0; i < wmCommands.count(); i++)
startApplication( wmCommands[i] );
if ((showFancyLogin) && (!startupNotifierIPDlg)) {
startupNotifierIPDlg = KSMStartupIPDlg::showStartupIP();
}
TQTimer::singleShot( 4000, this, TQT_SLOT( autoStart0() ) );
} else {
if ((showFancyLogin) && (!startupNotifierIPDlg)) {
startupNotifierIPDlg = KSMStartupIPDlg::showStartupIP();
}
autoStart0();
}
}
@ -144,6 +161,12 @@ void KSMServer::restoreSession( TQString sessionName )
*/
void KSMServer::startDefaultSession()
{
showFancyLogin = KConfigGroup(KGlobal::config(), "Login").readBoolEntry("showFancyLogin", true);
KConfig ksplashcfg( "ksplashrc", true );
ksplashcfg.setGroup( "KSplash" );
if ( ksplashcfg.readEntry( "Theme", "Default" ) != TQString("None") )
showFancyLogin = false;
if( state != Idle )
return;
@ -158,6 +181,9 @@ void KSMServer::startDefaultSession()
connectDCOPSignal( launcher, launcher, "autoStart2Done()",
"autoStart2Done()", true);
startApplication( wm );
if ((showFancyLogin) && (!startupNotifierIPDlg)) {
startupNotifierIPDlg = KSMStartupIPDlg::showStartupIP();
}
TQTimer::singleShot( 4000, this, TQT_SLOT( autoStart0() ) );
}
@ -348,6 +374,13 @@ void KSMServer::finishStartup()
state = Idle;
// [FIXME] When this fires applications are still being loaded, especially the task tray apps
// See if there is a way to detect when all session managed applications have been fully started and wait to fire this until that point!
if (startupNotifierIPDlg) {
static_cast<KSMStartupIPDlg*>(startupNotifierIPDlg)->closeSMDialog();
startupNotifierIPDlg=0;
}
setupXIOErrorHandler(); // From now on handle X errors as normal shutdown.
}
@ -417,6 +450,12 @@ void KSMServer::publishProgress( int progress, bool max )
void KSMServer::upAndRunning( const TQString& msg )
{
if (startupNotifierIPDlg) {
static_cast<KSMStartupIPDlg*>(startupNotifierIPDlg)->setStartupPhase(msg);
if (msg == TQString("session ready")) {
trinity_startup_main_sequence_done = TRUE;
}
}
DCOPRef( "ksplash" ).send( "upAndRunning", msg );
XEvent e;
e.xclient.type = ClientMessage;

@ -0,0 +1,86 @@
/*****************************************************************
ksmserver - the KDE session management server
Copyright (C) 2010-2011 Timothy Pearson <kb9vqf@pearsoncomputing.net>
Copyright (C) 2000 Matthias Ettrich <ettrich@kde.org>
******************************************************************/
#include "startupdlg.h"
#include <tqapplication.h>
#include <tqlayout.h>
#include <tqgroupbox.h>
#include <tqvbuttongroup.h>
#include <tqlabel.h>
#include <tqvbox.h>
#include <tqtimer.h>
#include <tqstyle.h>
#include <tqcombobox.h>
#include <tqcursor.h>
#include <tqmessagebox.h>
#include <tqbuttongroup.h>
#include <tqiconset.h>
#include <tqpixmap.h>
#include <tqpopupmenu.h>
#include <tqtooltip.h>
#include <tqimage.h>
#include <tqpainter.h>
#include <tqfontmetrics.h>
#include <tqregexp.h>
#include <tqeventloop.h>
#include <klocale.h>
#include <kconfig.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kpushbutton.h>
#include <kstdguiitem.h>
#include <kguiitem.h>
#include <kiconloader.h>
#include <kglobalsettings.h>
#include <kwin.h>
#include <kuser.h>
#include <kpixmap.h>
#include <kimageeffect.h>
#include <kdialog.h>
#include <kseparator.h>
#include <kconfig.h>
#include <dcopclient.h>
#include <dcopref.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <stdlib.h>
#include <math.h>
#include <dmctl.h>
#include <kaction.h>
#include <netwm.h>
#include <X11/Xlib.h>
#include "startupdlg.moc"
TQWidget* KSMStartupIPDlg::showStartupIP()
{
kapp->enableStyles();
KSMStartupIPDlg* l = new KSMStartupIPDlg( 0 );
kapp->disableStyles();
return l;
}
KSMStartupIPDlg::KSMStartupIPDlg(TQWidget* parent)
: KSMModalDialog( parent )
{
setStatusMessage(i18n("Loading your settings").append("..."));
show();
setActiveWindow();
}
KSMStartupIPDlg::~KSMStartupIPDlg()
{
}

@ -0,0 +1,60 @@
/*****************************************************************
ksmserver - the KDE session management server
Copyright (C) 2000 Matthias Ettrich <ettrich@kde.org>
******************************************************************/
#ifndef STARTUPDLG_H
#define STARTUPDLG_H
#include <tqpixmap.h>
#include <tqimage.h>
#include <tqdatetime.h>
#include <kdialog.h>
#include <kpushbutton.h>
#include <tqpushbutton.h>
#include <tqframe.h>
#include <kguiitem.h>
#include <tqtoolbutton.h>
#include <ksharedpixmap.h>
class TQPushButton;
class TQVButtonGroup;
class TQPopupMenu;
class TQTimer;
class TQPainter;
class TQString;
class KAction;
#include "timed.h"
#include <kapplication.h>
#include <kpixmapio.h>
#include <config.h>
#ifndef NO_QT3_DBUS_SUPPORT
/* We acknowledge the the dbus API is unstable */
#define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/connection.h>
#endif // NO_QT3_DBUS_SUPPORT
#ifdef COMPILE_HALBACKEND
#include <hal/libhal.h>
#endif
// The startup-in-progress dialog
class KSMStartupIPDlg : public KSMModalDialog
{
Q_OBJECT
public:
static TQWidget* showStartupIP();
protected:
~KSMStartupIPDlg();
private:
KSMStartupIPDlg( TQWidget* parent );
};
#endif
Loading…
Cancel
Save