All pastes #1000179 Raw Edit

Something

public text v1 · immutable
#1000179 ·published 2008-04-28 09:35 UTC
rendered paste body
Index: kfrontend/kdm_greet.c
===================================================================
--- kfrontend/kdm_greet.c	(revision 801907)
+++ kfrontend/kdm_greet.c	(working copy)
@@ -738,6 +738,7 @@ main( int argc ATTR_UNUSED, char **argv
 	int i;
 	char qtrc[40];
 
+#if 0
 	if (!(ci = getenv( "CONINFO" ))) {
 		fprintf( stderr, "This program is part of kdm and should not be run manually.\n" );
 		return 1;
@@ -798,6 +799,7 @@ main( int argc ATTR_UNUSED, char **argv
 
 		setenv( "LANGUAGE", _language, 1 );
 	}
+#endif
 
 	kg_main( argv[0] );
 
Index: kfrontend/kgreeter.h
===================================================================
--- kfrontend/kgreeter.h	(revision 801907)
+++ kfrontend/kgreeter.h	(working copy)
@@ -35,6 +35,7 @@ class KdmItem;
 
 class KConfigGroup;
 class QListWidgetItem;
+class QActionGroup;
 
 struct SessType {
 	QString name, type;
@@ -64,7 +65,6 @@ class KGreeter : public KGDialog, public
 	void accept();
 	void reject();
 	void slotUserClicked( QListWidgetItem * );
-	void slotSessionSelected( QAction * );
 	void slotUserEntered();
 
   protected:
@@ -81,9 +81,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: kfrontend/kgreeter.cpp
===================================================================
--- kfrontend/kgreeter.cpp	(revision 801907)
+++ kfrontend/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 * )), verify, 
+		SLOT(slotActivity()) );
 	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,19 +468,6 @@ KGreeter::slotUserClicked( QListWidgetIt
 }
 
 void
-KGreeter::slotSessionSelected( QAction *action )
-{
-	if (action != curSel) {
-		if (curSel)
-			curSel->setChecked( false );
-		if (action)
-			action->setChecked( true );
-		curSel = action;
-		verify->gplugActivity();
-	}
-}
-
-void
 KGreeter::reject()
 {
 	verify->reject();
@@ -558,7 +547,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 +595,7 @@ KGreeter::verifyClear()
 {
 	curUser.clear();
 	slotUserEntered();
-	slotSessionSelected( 0 );
+	QTimer::singleShot(0, verify, SLOT(slotActivity()));
 }
 
 void
@@ -617,6 +606,7 @@ KGreeter::verifyOk()
 		                         dName :
 		                         dName + '_' + verify->pluginName(),
 		                      verify->getEntity() );
+	QAction* curSel = sessGroup->checkedAction();
 	if (curSel) {
 		gSendInt( G_PutDmrc );
 		gSendStr( "Session" );