rendered paste bodyIndex: 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<SessType> 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 )
{
@@ -164,9 +163,11 @@ KGreeter::KGreeter( bool framed )
if (userView || userList)
insertUsers();
+ sessGroup = new QActionGroup( this );
+
sessMenu = new QMenu( this );
- connect( sessMenu, SIGNAL(triggered( QAction * )),
- SLOT(slotSessionSelected( QAction * )) );
+ connect( sessMenu, SIGNAL(triggered( QAction * )),
+ SLOT(slotSessionSelected()) );
insertSessions();
if (curPlugin < 0) {
@@ -419,7 +420,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 +428,7 @@ KGreeter::insertSessions()
case 2: nNormals++; break;
}
}
+ sessMenu->addActions( sessGroup->actions() );
}
void
@@ -466,16 +468,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 +553,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 +601,7 @@ KGreeter::verifyClear()
{
curUser.clear();
slotUserEntered();
- slotSessionSelected( 0 );
+ slotSessionSelected();
}
void
@@ -617,6 +612,7 @@ KGreeter::verifyOk()
dName :
dName + '_' + verify->pluginName(),
verify->getEntity() );
+ QAction* curSel = sessGroup->checkedAction();
if (curSel) {
gSendInt( G_PutDmrc );
gSendStr( "Session" );