Index: kgreeter.h =================================================================== --- kgreeter.h (revision 801907) +++ kgreeter.h (working copy) @@ -35,6 +35,7 @@ class KdmItem; class KConfigGroup; class QListWidgetItem; +class QActionGroup; struct SessType { QString name, type; @@ -64,7 +65,7 @@ class KGreeter : public KGDialog, public void accept(); void reject(); void slotUserClicked( QListWidgetItem * ); - void slotSessionSelected( QAction * ); + void slotSessionSelected(); void slotUserEntered(); protected: @@ -81,9 +82,10 @@ class KGreeter : public KGDialog, public UserListView *userView; QStringList *userList; QMenu *sessMenu; + QActionGroup *sessGroup; QVector sessionTypes; int nNormals, nSpecials; - QAction *curPrev, *curSel; + QAction *curPrev; bool prevValid; bool needLoad; Index: kgreeter.cpp =================================================================== --- kgreeter.cpp (revision 801907) +++ kgreeter.cpp (working copy) @@ -145,7 +145,6 @@ KGreeter::KGreeter( bool framed ) , nNormals( 0 ) , nSpecials( 0 ) , curPrev( 0 ) - , curSel( 0 ) , prevValid( true ) , needLoad( false ) { @@ -166,7 +165,10 @@ KGreeter::KGreeter( bool framed ) sessMenu = new QMenu( this ); connect( sessMenu, SIGNAL(triggered( QAction * )), - SLOT(slotSessionSelected( QAction * )) ); + SLOT(slotSessionSelected()) ); + + sessGroup = new QActionGroup( this ); + insertSessions(); if (curPlugin < 0) { @@ -419,7 +421,7 @@ KGreeter::insertSessions() putSession( "failsafe", i18n("Failsafe"), false, "failsafe" ); qSort( sessionTypes ); for (int i = 0; i < sessionTypes.size() && !sessionTypes[i].hid; i++) { - sessionTypes[i].action = sessMenu->addAction( sessionTypes[i].name ); + sessionTypes[i].action = sessGroup->addAction( sessionTypes[i].name ); sessionTypes[i].action->setData( i ); sessionTypes[i].action->setCheckable( true ); switch (sessionTypes[i].prio) { @@ -427,6 +429,7 @@ KGreeter::insertSessions() case 2: nNormals++; break; } } + sessMenu->addActions( sessGroup->actions() ); } void @@ -466,16 +469,9 @@ KGreeter::slotUserClicked( QListWidgetIt } void -KGreeter::slotSessionSelected( QAction *action ) +KGreeter::slotSessionSelected() { - if (action != curSel) { - if (curSel) - curSel->setChecked( false ); - if (action) - action->setChecked( true ); - curSel = action; - verify->gplugActivity(); - } + verify->gplugChanged(); } void @@ -558,7 +554,7 @@ KGreeter::slotLoadPrevWM() setPrevWM( sessionTypes[i].action ); return; } - if (!curSel) + if (!sessGroup->checkedAction()) KFMsgBox::box( this, sorrybox, i18n("Your saved session type '%1' is not valid any more.\n" "Please select a new one, otherwise 'default' will be used.", sess ) ); @@ -606,7 +602,7 @@ KGreeter::verifyClear() { curUser.clear(); slotUserEntered(); - slotSessionSelected( 0 ); + slotSessionSelected(); } void @@ -617,7 +613,7 @@ KGreeter::verifyOk() dName : dName + '_' + verify->pluginName(), verify->getEntity() ); - if (curSel) { + if ( QAction *curSel = sessGroup->checkedAction() ) { gSendInt( G_PutDmrc ); gSendStr( "Session" ); gSendStr( sessionTypes[curSel->data().toInt()].type.toUtf8() );