@ -62,7 +62,8 @@
enum connectionModes {
enum connectionModes {
ModeIdle = 0 ,
ModeIdle = 0 ,
ModeTerminate = 1
ModeUpdate = 1 ,
ModeDelete = 2
} ;
} ;
enum connectionStates {
enum connectionStates {
@ -71,18 +72,24 @@ enum connectionStates {
ModeIdle_StateProcessTerminalList = 2 ,
ModeIdle_StateProcessTerminalList = 2 ,
ModeIdle_StateWorkspaceListRequest = 3 ,
ModeIdle_StateWorkspaceListRequest = 3 ,
ModeIdle_StateProcessWorkspaceList = 4 ,
ModeIdle_StateProcessWorkspaceList = 4 ,
ModeIdle_StateDelay = 5 ,
ModeIdle_StateTerminalAuthGroupListRequest = 5 ,
ModeTerminate_TerminalServices = 6 ,
ModeIdle_StateProcessTerminalAuthGroupList = 6 ,
ModeTerminate_LaboratoryWorkspace = 7 ,
ModeIdle_StateWorkspaceServiceAuthGroupListRequest = 7 ,
ModeTerminate_CancelTerminationOfWorkspace = 8 ,
ModeIdle_StateProcessWorkspaceServiceAuthGroupList = 8 ,
ModeTerminate_ProcessResponse = 9
ModeIdle_StateDelay = 9 ,
ModeUpdate_TerminalServices = 10 ,
ModeUpdate_LaboratoryWorkspace = 11 ,
ModeUpdate_ProcessResponse = 12 ,
ModeDelete_TerminalServices = 13 ,
ModeDelete_LaboratoryWorkspace = 14 ,
ModeDelete_ProcessResponse = 15
} ;
} ;
namespace RemoteLab {
namespace RemoteLab {
typedef KParts : : GenericFactory < RemoteLab : : UserManagementPart > Factory ;
typedef KParts : : GenericFactory < RemoteLab : : UserManagementPart > Factory ;
# define CLIENT_LIBRARY "libremotelab_adminconsole"
# define CLIENT_LIBRARY "libremotelab_admin usermgmt "
K_EXPORT_COMPONENT_FACTORY ( libremotelab_admin console , RemoteLab : : Factory )
K_EXPORT_COMPONENT_FACTORY ( libremotelab_admin usermgmt , RemoteLab : : Factory )
UserManagementPart : : UserManagementPart ( TQWidget * parentWidget , const char * widgetName , TQObject * parent , const char * name , const TQStringList & )
UserManagementPart : : UserManagementPart ( TQWidget * parentWidget , const char * widgetName , TQObject * parent , const char * name , const TQStringList & )
: RemoteInstrumentPart ( parent , name ) , m_base ( NULL ) , m_commHandlerState ( 0 ) , m_connectionActiveAndValid ( false ) , m_tickerState ( 0 )
: RemoteInstrumentPart ( parent , name ) , m_base ( NULL ) , m_commHandlerState ( 0 ) , m_connectionActiveAndValid ( false ) , m_tickerState ( 0 )
@ -109,9 +116,14 @@ UserManagementPart::UserManagementPart(TQWidget *parentWidget, const char *widge
m_base = new UserManagementBase ( widget ( ) ) ;
m_base = new UserManagementBase ( widget ( ) ) ;
// Initialize widgets
// Initialize widgets
connect ( m_base - > ts_buttonKill , SIGNAL ( clicked ( ) ) , this , SLOT ( terminalServiceKillButtonClicked ( ) ) ) ;
connect ( m_base - > ts_buttonAddGroup , SIGNAL ( clicked ( ) ) , this , SLOT ( terminalServiceAddGroupButtonClicked ( ) ) ) ;
connect ( m_base - > workspace_buttonTerminate , SIGNAL ( clicked ( ) ) , this , SLOT ( workspaceTerminateButtonClicked ( ) ) ) ;
connect ( m_base - > ts_buttonModifyGroup , SIGNAL ( clicked ( ) ) , this , SLOT ( terminalServiceModifyGroupButtonClicked ( ) ) ) ;
connect ( m_base - > workspace_buttonCancelTermination , SIGNAL ( clicked ( ) ) , this , SLOT ( workspaceCancelTerminationButtonClicked ( ) ) ) ;
connect ( m_base - > ts_buttonDeleteGroup , SIGNAL ( clicked ( ) ) , this , SLOT ( terminalServiceDeleteGroupButtonClicked ( ) ) ) ;
connect ( m_base - > workspace_buttonAddGroup , SIGNAL ( clicked ( ) ) , this , SLOT ( workspaceAddGroupButtonClicked ( ) ) ) ;
connect ( m_base - > workspace_buttonModifyGroup , SIGNAL ( clicked ( ) ) , this , SLOT ( workspaceModifyGroupButtonClicked ( ) ) ) ;
connect ( m_base - > workspace_buttonDeleteGroup , SIGNAL ( clicked ( ) ) , this , SLOT ( workspaceDeleteGroupButtonClicked ( ) ) ) ;
connect ( m_base - > ts_list , SIGNAL ( doubleClicked ( TQListViewItem * , const TQPoint & , int ) ) , this , SLOT ( terminalServiceModifyGroupButtonClicked ( ) ) ) ;
connect ( m_base - > workspace_list , SIGNAL ( doubleClicked ( TQListViewItem * , const TQPoint & , int ) ) , this , SLOT ( workspaceModifyGroupButtonClicked ( ) ) ) ;
m_base - > ts_list - > setAllColumnsShowFocus ( true ) ;
m_base - > ts_list - > setAllColumnsShowFocus ( true ) ;
connect ( m_base - > ts_list , SIGNAL ( selectionChanged ( ) ) , this , SLOT ( terminalServiceListSelect ( ) ) ) ;
connect ( m_base - > ts_list , SIGNAL ( selectionChanged ( ) ) , this , SLOT ( terminalServiceListSelect ( ) ) ) ;
@ -141,25 +153,31 @@ void UserManagementPart::processLockouts() {
}
}
}
}
if ( ( m_connectionActiveAndValid = = true ) & & ( m_base - > ts_list - > selectedItem ( ) ) ) {
if ( m_connectionActiveAndValid = = true ) {
m_base - > ts_buttonKill - > setEnabled ( true ) ;
m_base - > ts_buttonAddGroup - > setEnabled ( true ) ;
m_base - > workspace_buttonAddGroup - > setEnabled ( true ) ;
}
}
else {
else {
m_base - > ts_buttonKill - > setEnabled ( false ) ;
m_base - > ts_buttonAddGroup - > setEnabled ( false ) ;
m_base - > workspace_buttonAddGroup - > setEnabled ( false ) ;
}
}
if ( ( m_connectionActiveAndValid = = true ) & & ( m_base - > workspace_list - > selectedItem ( ) ) ) {
if ( ( m_connectionActiveAndValid = = true ) & & ( m_base - > ts_list - > selectedItem ( ) ) ) {
m_base - > workspace_buttonTerminate - > setEnabled ( true ) ;
m_base - > ts_buttonModifyGroup - > setEnabled ( true ) ;
m_base - > ts_buttonDeleteGroup - > setEnabled ( true ) ;
}
}
else {
else {
m_base - > workspace_buttonTerminate - > setEnabled ( false ) ;
m_base - > ts_buttonModifyGroup - > setEnabled ( false ) ;
m_base - > ts_buttonDeleteGroup - > setEnabled ( false ) ;
}
}
if ( ( m_connectionActiveAndValid = = true ) & & ( m_base - > workspace_list - > selectedItem ( ) ) ) {
if ( ( m_connectionActiveAndValid = = true ) & & ( m_base - > workspace_list - > selectedItem ( ) ) ) {
m_base - > workspace_buttonCancelTermination - > setEnabled ( true ) ;
m_base - > workspace_buttonModifyGroup - > setEnabled ( true ) ;
m_base - > workspace_buttonDeleteGroup - > setEnabled ( true ) ;
}
}
else {
else {
m_base - > workspace_buttonCancelTermination - > setEnabled ( false ) ;
m_base - > workspace_buttonModifyGroup - > setEnabled ( false ) ;
m_base - > workspace_buttonDeleteGroup - > setEnabled ( false ) ;
}
}
}
}
@ -213,44 +231,171 @@ void UserManagementPart::connectionStatusChangedCallback() {
processLockouts ( ) ;
processLockouts ( ) ;
}
}
void UserManagementPart : : terminalServiceKillButtonClicked ( ) {
void UserManagementPart : : terminalServiceAddGroupButtonClicked ( ) {
GroupPermissionsDialog groupauthdlg ( 0 ) ;
groupauthdlg . setPermissionsSelectorLabel ( i18n ( " Allowed Servers " ) ) ;
{
TQKeyedStringList keyedServerList ;
for ( TQStringList : : Iterator it2 = m_availableTerminalServersList . begin ( ) ; it2 ! = m_availableTerminalServersList . end ( ) ; + + it2 ) {
keyedServerList . append ( TQKeyedStringPair ( TQString ( " %1 " ) . arg ( * it2 ) , 0 ) ) ;
}
groupauthdlg . setAvailableServers ( keyedServerList ) ;
}
if ( groupauthdlg . exec ( ) = = TQDialog : : Accepted ) {
m_updateTerminalServiceAuthGroupList . clear ( ) ;
TerminalServiceAuthGroupType agt ;
agt . groupName = groupauthdlg . groupName ( ) ;
TQKeyedStringList selectedServers = groupauthdlg . selectedServers ( ) ;
agt . allowedServerNames . clear ( ) ;
for ( TQKeyedStringList : : Iterator it = selectedServers . begin ( ) ; it ! = selectedServers . end ( ) ; + + it ) {
agt . allowedServerNames . append ( ( * it ) . first ) ;
}
m_updateTerminalServiceAuthGroupList . append ( agt ) ;
m_commHandlerNextState = ModeUpdate_TerminalServices ;
m_commHandlerNextMode = ModeUpdate ;
}
processLockouts ( ) ;
}
void UserManagementPart : : terminalServiceModifyGroupButtonClicked ( ) {
TQListViewItem * item = m_base - > ts_list - > selectedItem ( ) ;
GroupPermissionsDialog groupauthdlg ( 0 ) ;
groupauthdlg . setPermissionsSelectorLabel ( i18n ( " Allowed Servers " ) ) ;
{
TQKeyedStringList keyedServerList ;
for ( TQStringList : : Iterator it2 = m_availableTerminalServersList . begin ( ) ; it2 ! = m_availableTerminalServersList . end ( ) ; + + it2 ) {
keyedServerList . append ( TQKeyedStringPair ( TQString ( " %1 " ) . arg ( * it2 ) , 0 ) ) ;
}
groupauthdlg . setAvailableServers ( keyedServerList ) ;
}
TerminalServiceAuthGroupList : : iterator it = m_terminalServiceAuthGroupList . findByName ( item - > text ( 0 ) ) ;
if ( it ! = m_terminalServiceAuthGroupList . end ( ) ) {
TQKeyedStringList keyedServerList ;
for ( TQStringList : : Iterator it2 = ( * it ) . allowedServerNames . begin ( ) ; it2 ! = ( * it ) . allowedServerNames . end ( ) ; + + it2 ) {
keyedServerList . append ( TQKeyedStringPair ( TQString ( " %1 " ) . arg ( * it2 ) , 0 ) ) ;
}
groupauthdlg . setSelectedServers ( keyedServerList ) ;
}
groupauthdlg . setGroupName ( item - > text ( 0 ) , false ) ;
if ( groupauthdlg . exec ( ) = = TQDialog : : Accepted ) {
m_updateTerminalServiceAuthGroupList . clear ( ) ;
TerminalServiceAuthGroupType agt ;
agt . groupName = groupauthdlg . groupName ( ) ;
TQKeyedStringList selectedServers = groupauthdlg . selectedServers ( ) ;
agt . allowedServerNames . clear ( ) ;
for ( TQKeyedStringList : : Iterator it = selectedServers . begin ( ) ; it ! = selectedServers . end ( ) ; + + it ) {
agt . allowedServerNames . append ( ( * it ) . first ) ;
}
m_updateTerminalServiceAuthGroupList . append ( agt ) ;
m_commHandlerNextState = ModeUpdate_TerminalServices ;
m_commHandlerNextMode = ModeUpdate ;
}
processLockouts ( ) ;
}
void UserManagementPart : : terminalServiceDeleteGroupButtonClicked ( ) {
TQListViewItem * item = m_base - > ts_list - > selectedItem ( ) ;
TQListViewItem * item = m_base - > ts_list - > selectedItem ( ) ;
TerminateDialog termdlg ( 0 ) ;
if ( KMessageBox : : warningYesNo ( 0 , i18n ( " <qt><b>You are attempting to delete the group '%1'</b><br>You will not be able to undo this action<p>Do you wish to proceed?</qt> " ) . arg ( item - > text ( 0 ) ) , i18n ( " Delete group? " ) ) = = KMessageBox : : Yes ) {
termdlg . setWarningLabelText ( i18n ( " Configure termination of Terminal Services for user %1 " ) . arg ( item - > text ( 1 ) ) ) ;
m_updateTerminalServiceAuthGroupList . clear ( ) ;
termdlg . enableDelayedTermination ( false ) ;
TerminalServiceAuthGroupType agt ;
if ( termdlg . exec ( ) = = TQDialog : : Accepted ) {
agt . groupName = item - > text ( 0 ) ;
terminateSessionID = item - > text ( 0 ) ;
m_updateTerminalServiceAuthGroupList . append ( agt ) ;
terminateSessionDelayMinutes = termdlg . minutes ( ) ;
m_commHandlerNextState = ModeDelete_TerminalServices ;
m_commHandlerNextState = ModeTerminate_TerminalServices ;
m_commHandlerNextMode = ModeDelete ;
m_commHandlerNextMode = ModeTerminate ;
}
processLockouts ( ) ;
}
void UserManagementPart : : workspaceAddGroupButtonClicked ( ) {
GroupPermissionsDialog groupauthdlg ( 0 ) ;
groupauthdlg . setPermissionsSelectorLabel ( i18n ( " Allowed Stations " ) ) ;
{
TQKeyedStringList friendlyStations ;
for ( StationList : : iterator it = m_availableWorkspaceStationsList . begin ( ) ; it ! = m_availableWorkspaceStationsList . end ( ) ; + + it ) {
friendlyStations . append ( TQKeyedStringPair ( TQString ( " %1 " ) . arg ( ( * it ) . name ) , ( * it ) . id ) ) ;
}
groupauthdlg . setAvailableServers ( friendlyStations ) ;
}
if ( groupauthdlg . exec ( ) = = TQDialog : : Accepted ) {
m_updateWorkspaceServiceAuthGroupList . clear ( ) ;
WorkspaceServiceAuthGroupType agt ;
agt . groupName = groupauthdlg . groupName ( ) ;
TQKeyedStringList selectedStations = groupauthdlg . selectedServers ( ) ;
agt . allowedStationIDs . clear ( ) ;
for ( TQKeyedStringList : : Iterator it = selectedStations . begin ( ) ; it ! = selectedStations . end ( ) ; + + it ) {
agt . allowedStationIDs . append ( ( * it ) . second ) ;
}
m_updateWorkspaceServiceAuthGroupList . append ( agt ) ;
m_commHandlerNextState = ModeUpdate_LaboratoryWorkspace ;
m_commHandlerNextMode = ModeUpdate ;
}
}
processLockouts ( ) ;
processLockouts ( ) ;
}
}
void UserManagementPart : : workspaceTerminateButtonClicked ( ) {
void UserManagementPart : : workspace ModifyGroup ButtonClicked( ) {
TQListViewItem * item = m_base - > workspace_list - > selectedItem ( ) ;
TQListViewItem * item = m_base - > workspace_list - > selectedItem ( ) ;
TerminateDialog termdlg ( 0 ) ;
GroupPermissionsDialog groupauthdlg ( 0 ) ;
termdlg . setWarningLabelText ( i18n ( " Configure termination of Laboratory Workspace for user %1 " ) . arg ( item - > text ( 1 ) ) ) ;
groupauthdlg . setPermissionsSelectorLabel ( i18n ( " Allowed Stations " ) ) ;
termdlg . enableDelayedTermination ( true ) ;
{
if ( termdlg . exec ( ) = = TQDialog : : Accepted ) {
TQKeyedStringList friendlyStations ;
terminateSessionID = item - > text ( 0 ) ;
for ( StationList : : iterator it = m_availableWorkspaceStationsList . begin ( ) ; it ! = m_availableWorkspaceStationsList . end ( ) ; + + it ) {
terminateSessionDelayMinutes = termdlg . minutes ( ) ;
friendlyStations . append ( TQKeyedStringPair ( TQString ( " %1 " ) . arg ( ( * it ) . name ) , ( * it ) . id ) ) ;
m_commHandlerNextState = ModeTerminate_LaboratoryWorkspace ;
}
m_commHandlerNextMode = ModeTerminate ;
groupauthdlg . setAvailableServers ( friendlyStations ) ;
}
WorkspaceServiceAuthGroupList : : iterator it = m_workspaceAuthGroupList . findByName ( item - > text ( 0 ) ) ;
if ( it ! = m_workspaceAuthGroupList . end ( ) ) {
TQKeyedStringList friendlyStations ;
for ( TQInt32List : : Iterator it2 = ( * it ) . allowedStationIDs . begin ( ) ; it2 ! = ( * it ) . allowedStationIDs . end ( ) ; + + it2 ) {
int stationID = * it2 ;
StationList : : iterator stationInfoIterator = m_availableWorkspaceStationsList . findByID ( stationID ) ;
if ( stationInfoIterator ! = m_availableWorkspaceStationsList . end ( ) ) {
friendlyStations . append ( TQKeyedStringPair ( TQString ( " %1 " ) . arg ( ( * stationInfoIterator ) . name ) , ( * stationInfoIterator ) . id ) ) ;
}
else {
friendlyStations . append ( TQKeyedStringPair ( TQString ( " <unknown> " ) , stationID ) ) ;
}
}
groupauthdlg . setSelectedServers ( friendlyStations ) ;
}
groupauthdlg . setGroupName ( item - > text ( 0 ) , false ) ;
if ( groupauthdlg . exec ( ) = = TQDialog : : Accepted ) {
m_updateWorkspaceServiceAuthGroupList . clear ( ) ;
WorkspaceServiceAuthGroupType agt ;
agt . groupName = groupauthdlg . groupName ( ) ;
TQKeyedStringList selectedStations = groupauthdlg . selectedServers ( ) ;
agt . allowedStationIDs . clear ( ) ;
for ( TQKeyedStringList : : Iterator it = selectedStations . begin ( ) ; it ! = selectedStations . end ( ) ; + + it ) {
agt . allowedStationIDs . append ( ( * it ) . second ) ;
}
m_updateWorkspaceServiceAuthGroupList . append ( agt ) ;
m_commHandlerNextState = ModeUpdate_LaboratoryWorkspace ;
m_commHandlerNextMode = ModeUpdate ;
}
}
processLockouts ( ) ;
processLockouts ( ) ;
}
}
void UserManagementPart : : workspaceCancelTerminationButtonClicked ( ) {
void UserManagementPart : : workspace DeleteGroup ButtonClicked( ) {
TQListViewItem * item = m_base - > workspace_list - > selectedItem ( ) ;
TQListViewItem * item = m_base - > workspace_list - > selectedItem ( ) ;
terminateSessionID = item - > text ( 0 ) ;
if ( KMessageBox : : warningYesNo ( 0 , i18n ( " <qt><b>You are attempting to delete the group '%1'</b><br>You will not be able to undo this action<p>Do you wish to proceed?</qt> " ) . arg ( item - > text ( 0 ) ) , i18n ( " Delete group? " ) ) = = KMessageBox : : Yes ) {
m_commHandlerNextState = ModeTerminate_CancelTerminationOfWorkspace ;
m_updateWorkspaceServiceAuthGroupList . clear ( ) ;
m_commHandlerNextMode = ModeTerminate ;
WorkspaceServiceAuthGroupType agt ;
agt . groupName = item - > text ( 0 ) ;
agt . allowedStationIDs . clear ( ) ;
m_updateWorkspaceServiceAuthGroupList . append ( agt ) ;
m_commHandlerNextState = ModeDelete_LaboratoryWorkspace ;
m_commHandlerNextMode = ModeDelete ;
}
processLockouts ( ) ;
processLockouts ( ) ;
}
}
@ -383,7 +528,7 @@ void UserManagementPart::mainEventLoop() {
// Get status of remote system
// Get status of remote system
// Clear buffers to synchronize frames in case of data corruption
// Clear buffers to synchronize frames in case of data corruption
m_socket - > clearIncomingData ( ) ;
m_socket - > clearIncomingData ( ) ;
ds < < TQString ( " USERS " ) ;
ds < < TQString ( " LIST " ) ;
ds < < TQString ( " TERMINALS " ) ;
ds < < TQString ( " TERMINALS " ) ;
m_socket - > writeEndOfFrame ( ) ;
m_socket - > writeEndOfFrame ( ) ;
@ -395,23 +540,89 @@ void UserManagementPart::mainEventLoop() {
PAT_WATCHDOG_TIMER
PAT_WATCHDOG_TIMER
TQString status ;
TQString status ;
TerminalServiceStatusList list ;
ds > > status ;
ds > > status ;
if ( status = = " OK " ) {
if ( status = = " OK " ) {
ds > > list ;
ds > > m_availableTerminalServersList ;
m_socket - > clearFrameTail ( ) ;
setTickerMessage ( i18n ( " Connected " ) ) ;
}
SET_NEXT_STATE ( ModeIdle_StateWorkspaceListRequest ) ;
EXEC_NEXT_STATE_IMMEDIATELY
}
else {
if ( ! m_updateTimeoutTimer - > isActive ( ) ) {
UPDATEDISPLAY_TIMEOUT
}
}
break ;
case ModeIdle_StateWorkspaceListRequest :
// Get status of remote system
// Clear buffers to synchronize frames in case of data corruption
m_socket - > clearIncomingData ( ) ;
ds < < TQString ( " LIST " ) ;
ds < < TQString ( " WORKSPACES " ) ;
m_socket - > writeEndOfFrame ( ) ;
SET_NEXT_STATE ( ModeIdle_StateProcessWorkspaceList )
EXEC_NEXT_STATE_IMMEDIATELY
break ;
case ModeIdle_StateProcessWorkspaceList :
// Get all data
if ( m_socket - > canReadFrame ( ) ) {
PAT_WATCHDOG_TIMER
TQString status ;
ds > > status ;
if ( status = = " OK " ) {
ds > > m_availableWorkspaceStationsList ;
m_socket - > clearFrameTail ( ) ;
setTickerMessage ( i18n ( " Connected " ) ) ;
}
SET_NEXT_STATE ( ModeIdle_StateTerminalAuthGroupListRequest ) ;
EXEC_NEXT_STATE_IMMEDIATELY
}
else {
if ( ! m_updateTimeoutTimer - > isActive ( ) ) {
UPDATEDISPLAY_TIMEOUT
}
}
break ;
case ModeIdle_StateTerminalAuthGroupListRequest :
// Get status of remote system
// Clear buffers to synchronize frames in case of data corruption
m_socket - > clearIncomingData ( ) ;
ds < < TQString ( " LISTGROUPACCESS " ) ;
ds < < TQString ( " TERMINALS " ) ;
m_socket - > writeEndOfFrame ( ) ;
SET_NEXT_STATE ( ModeIdle_StateProcessTerminalAuthGroupList )
break ;
case ModeIdle_StateProcessTerminalAuthGroupList :
// Get all data
if ( m_socket - > canReadFrame ( ) ) {
PAT_WATCHDOG_TIMER
TQString status ;
ds > > status ;
if ( status = = " OK " ) {
ds > > m_terminalServiceAuthGroupList ;
m_socket - > clearFrameTail ( ) ;
m_socket - > clearFrameTail ( ) ;
TerminalServiceStatusList : : iterator it ;
TerminalService AuthGroup List: : iterator it ;
TQListViewItemIterator it2 ;
TQListViewItemIterator it2 ;
for ( it = list . begin ( ) ; it ! = list . end ( ) ; + + it ) {
for ( it = m_termina lServiceAuthGroupL ist. begin ( ) ; it ! = m_termina lServiceAuthGroupL ist. end ( ) ; + + it ) {
TerminalServiceStatusType info = * it ;
TerminalService AuthGroup Type info = * it ;
it2 = TQListViewItemIterator ( m_base - > ts_list ) ;
it2 = TQListViewItemIterator ( m_base - > ts_list ) ;
bool found = false ;
bool found = false ;
TQListViewItem * item = NULL ;
TQListViewItem * item = NULL ;
while ( it2 . current ( ) ) {
while ( it2 . current ( ) ) {
item = * it2 ;
item = * it2 ;
if ( info . sessionID = = item - > text ( 0 ) . toInt ( ) ) {
if ( info . groupName = = item - > text ( 0 ) ) {
found = true ;
found = true ;
break ;
break ;
}
}
@ -420,22 +631,16 @@ void UserManagementPart::mainEventLoop() {
if ( ! found ) {
if ( ! found ) {
item = new TQListViewItem ( m_base - > ts_list ) ;
item = new TQListViewItem ( m_base - > ts_list ) ;
}
}
item - > setText ( 0 , TQString ( " %1 " ) . arg ( info . sessionID ) ) ;
item - > setText ( 0 , TQString ( " %1 " ) . arg ( info . groupName ) ) ;
item - > setText ( 1 , info . username ) ;
item - > setText ( 1 , info . allowedServerNames . join ( " , " ) ) ;
item - > setText ( 2 , info . serverName ) ;
item - > setText ( 3 , TQString ( " %1 " ) . arg ( info . serverPID ) ) ;
item - > setText ( 4 , TQString ( " %1 " ) . arg ( info . wmPID ) ) ;
item - > setText ( 5 , TQString ( " :%1 " ) . arg ( info . display ) ) ;
item - > setText ( 6 , info . loginStamp . toString ( ) ) ;
item - > setText ( 7 , info . activityStamp . toString ( ) ) ;
}
}
it2 = TQListViewItemIterator ( m_base - > ts_list ) ;
it2 = TQListViewItemIterator ( m_base - > ts_list ) ;
while ( it2 . current ( ) ) {
while ( it2 . current ( ) ) {
TQListViewItem * item = * it2 ;
TQListViewItem * item = * it2 ;
bool found = false ;
bool found = false ;
for ( it = list. begin ( ) ; it ! = list. end ( ) ; + + it ) {
for ( it = m_terminalServiceAuthGroupList . begin ( ) ; it ! = m_terminalServiceAuthGroupList . end ( ) ; + + it ) {
TerminalService Status Type info = * it ;
TerminalService AuthGroup Type info = * it ;
if ( info . sessionID = = item - > text ( 0 ) . toInt ( ) ) {
if ( info . groupName = = item - > text ( 0 ) ) {
found = true ;
found = true ;
}
}
}
}
@ -448,7 +653,7 @@ void UserManagementPart::mainEventLoop() {
setTickerMessage ( i18n ( " Connected " ) ) ;
setTickerMessage ( i18n ( " Connected " ) ) ;
}
}
SET_NEXT_STATE ( ModeIdle_StateWorkspace ListRequest) ;
SET_NEXT_STATE ( ModeIdle_StateWorkspace ServiceAuthGroup ListRequest) ;
EXEC_NEXT_STATE_IMMEDIATELY
EXEC_NEXT_STATE_IMMEDIATELY
}
}
else {
else {
@ -457,43 +662,39 @@ void UserManagementPart::mainEventLoop() {
}
}
}
}
break ;
break ;
case ModeIdle_StateWorkspace ListRequest:
case ModeIdle_StateWorkspace ServiceAuthGroup ListRequest:
// Get status of remote system
// Get status of remote system
// Clear buffers to synchronize frames in case of data corruption
// Clear buffers to synchronize frames in case of data corruption
m_socket - > clearIncomingData ( ) ;
m_socket - > clearIncomingData ( ) ;
ds < < TQString ( " USER S" ) ;
ds < < TQString ( " LISTGROUPACCES S" ) ;
ds < < TQString ( " WORKSPACES " ) ;
ds < < TQString ( " WORKSPACES " ) ;
m_socket - > writeEndOfFrame ( ) ;
m_socket - > writeEndOfFrame ( ) ;
SET_NEXT_STATE ( ModeIdle_StateProcessWorkspace List)
SET_NEXT_STATE ( ModeIdle_StateProcessWorkspace ServiceAuthGroup List)
EXEC_NEXT_STATE_IMMEDIATELY
EXEC_NEXT_STATE_IMMEDIATELY
break ;
break ;
case ModeIdle_StateProcessWorkspace List:
case ModeIdle_StateProcessWorkspace ServiceAuthGroup List:
// Get all data
// Get all data
if ( m_socket - > canReadFrame ( ) ) {
if ( m_socket - > canReadFrame ( ) ) {
PAT_WATCHDOG_TIMER
PAT_WATCHDOG_TIMER
TQString status ;
TQString status ;
WorkspaceServiceStatusList list ;
ds > > status ;
ds > > status ;
if ( status = = " OK " ) {
if ( status = = " OK " ) {
ds > > l ist;
ds > > m_workspaceAuthGroupL ist;
m_socket - > clearFrameTail ( ) ;
m_socket - > clearFrameTail ( ) ;
WorkspaceService Status List: : iterator it ;
WorkspaceService AuthGroup List: : iterator it ;
TQListViewItemIterator it2 ;
TQListViewItemIterator it2 ;
for ( it = list . begin ( ) ; it ! = list . end ( ) ; + + it ) {
for ( it = m_workspaceAuthGroupList . begin ( ) ; it ! = m_workspaceAuthGroupList . end ( ) ; + + it ) {
WorkspaceServiceStatusType info = * it ;
WorkspaceServiceAuthGroupType info = * it ;
if ( info . serviceID ! = 0 ) {
continue ;
}
it2 = TQListViewItemIterator ( m_base - > workspace_list ) ;
it2 = TQListViewItemIterator ( m_base - > workspace_list ) ;
bool found = false ;
bool found = false ;
TQListViewItem * item = NULL ;
TQListViewItem * item = NULL ;
while ( it2 . current ( ) ) {
while ( it2 . current ( ) ) {
item = * it2 ;
item = * it2 ;
if ( info . sessionID = = item - > text ( 0 ) . toInt ( ) ) {
if ( info . groupName = = item - > text ( 0 ) ) {
found = true ;
found = true ;
break ;
break ;
}
}
@ -502,23 +703,27 @@ void UserManagementPart::mainEventLoop() {
if ( ! found ) {
if ( ! found ) {
item = new TQListViewItem ( m_base - > workspace_list ) ;
item = new TQListViewItem ( m_base - > workspace_list ) ;
}
}
item - > setText ( 0 , TQString ( " %1 " ) . arg ( info . sessionID ) ) ;
item - > setText ( 0 , TQString ( " %1 " ) . arg ( info . groupName ) ) ;
item - > setText ( 1 , info . username ) ;
TQString allowedStationsText ;
item - > setText ( 2 , info . realmname ) ;
TQInt32List : : iterator it3 ;
item - > setText ( 3 , TQString ( " %1 " ) . arg ( info . stationName ) ) ;
for ( it3 = info . allowedStationIDs . begin ( ) ; it3 ! = info . allowedStationIDs . end ( ) ; + + it3 ) {
item - > setText ( 4 , info . loginStamp . toString ( ) ) ;
StationList : : iterator stationInfoIterator = m_availableWorkspaceStationsList . findByID ( * it3 ) ;
item - > setText ( 5 , ( info . terminateStamp . toTime_t ( ) = = 0 ) ? i18n ( " Not Set " ) : info . terminateStamp . toString ( ) ) ;
if ( stationInfoIterator ! = m_availableWorkspaceStationsList . end ( ) ) {
if ( allowedStationsText ! = " " ) {
allowedStationsText . append ( " , " ) ;
}
allowedStationsText . append ( ( * stationInfoIterator ) . name ) ;
}
}
item - > setText ( 1 , allowedStationsText ) ;
}
}
it2 = TQListViewItemIterator ( m_base - > workspace_list ) ;
it2 = TQListViewItemIterator ( m_base - > workspace_list ) ;
while ( it2 . current ( ) ) {
while ( it2 . current ( ) ) {
TQListViewItem * item = * it2 ;
TQListViewItem * item = * it2 ;
bool found = false ;
bool found = false ;
for ( it = list . begin ( ) ; it ! = list . end ( ) ; + + it ) {
for ( it = m_workspaceAuthGroupList . begin ( ) ; it ! = m_workspaceAuthGroupList . end ( ) ; + + it ) {
WorkspaceServiceStatusType info = * it ;
WorkspaceServiceAuthGroupType info = * it ;
if ( info . serviceID ! = 0 ) {
if ( info . groupName = = item - > text ( 0 ) ) {
continue ;
}
if ( info . sessionID = = item - > text ( 0 ) . toInt ( ) ) {
found = true ;
found = true ;
}
}
}
}
@ -531,7 +736,7 @@ void UserManagementPart::mainEventLoop() {
setTickerMessage ( i18n ( " Connected " ) ) ;
setTickerMessage ( i18n ( " Connected " ) ) ;
}
}
if ( m_commHandlerState = = ModeIdle_StateProcessWorkspace List) {
if ( m_commHandlerState = = ModeIdle_StateProcessWorkspace ServiceAuthGroup List) {
m_pingDelayTimer - > start ( 250 , TRUE ) ;
m_pingDelayTimer - > start ( 250 , TRUE ) ;
SET_NEXT_STATE ( ModeIdle_StateDelay ) ;
SET_NEXT_STATE ( ModeIdle_StateDelay ) ;
}
}
@ -562,37 +767,73 @@ void UserManagementPart::mainEventLoop() {
break ;
break ;
}
}
}
}
else if ( m_commHandlerMode = = Mode Termin ate) {
else if ( m_commHandlerMode = = Mode Upd ate) {
switch ( m_commHandlerState ) {
switch ( m_commHandlerState ) {
case Mode Termin ate_TerminalServices:
case Mode Upd ate_TerminalServices:
ds < < TQString ( " SE SSION " ) ;
ds < < TQString ( " SE TGROUPACCE SS" ) ;
ds < < TQString ( " KILL_ TERMINAL" ) ;
ds < < TQString ( " TERMINALS " ) ;
ds < < terminateSessionID ;
ds < < m_updateTerminalServiceAuthGroupList ;
m_socket - > writeEndOfFrame ( ) ;
m_socket - > writeEndOfFrame ( ) ;
SET_NEXT_STATE ( ModeTerminate_ProcessResponse )
SET_NEXT_STATE ( ModeUpdate_ProcessResponse )
EXEC_NEXT_STATE_IMMEDIATELY
break ;
case ModeUpdate_LaboratoryWorkspace :
ds < < TQString ( " SETGROUPACCESS " ) ;
ds < < TQString ( " WORKSPACES " ) ;
ds < < m_updateWorkspaceServiceAuthGroupList ;
m_socket - > writeEndOfFrame ( ) ;
SET_NEXT_STATE ( ModeUpdate_ProcessResponse )
EXEC_NEXT_STATE_IMMEDIATELY
break ;
case ModeUpdate_ProcessResponse :
// Get all data
if ( m_socket - > canReadFrame ( ) ) {
PAT_WATCHDOG_TIMER
TQString status ;
WorkspaceServiceStatusList list ;
ds > > status ;
if ( status ! = " OK " ) {
// Command failed!
KMessageBox : : error ( 0 , i18n ( " Command Failure " ) , i18n ( " Unable to execute command! " ) ) ;
}
m_commHandlerMode = ModeIdle ;
SET_NEXT_STATE ( ModeIdle_StateTerminalListRequest ) ;
EXEC_NEXT_STATE_IMMEDIATELY
EXEC_NEXT_STATE_IMMEDIATELY
}
else {
if ( ! m_updateTimeoutTimer - > isActive ( ) ) {
UPDATEDISPLAY_TIMEOUT
}
}
break ;
break ;
case ModeTerminate_LaboratoryWorkspace :
}
ds < < TQString ( " SESSION " ) ;
}
ds < < TQString ( " KILL_WORKSPACE " ) ;
else if ( m_commHandlerMode = = ModeDelete ) {
ds < < terminateSessionID ;
switch ( m_commHandlerState ) {
ds < < terminateSessionDelayMinutes ;
case ModeDelete_TerminalServices :
ds < < TQString ( " DELETEGROUPACCESS " ) ;
ds < < TQString ( " TERMINALS " ) ;
ds < < m_updateTerminalServiceAuthGroupList ;
m_socket - > writeEndOfFrame ( ) ;
m_socket - > writeEndOfFrame ( ) ;
SET_NEXT_STATE ( ModeTerminate_ProcessResponse )
SET_NEXT_STATE ( Mode Dele te_ProcessResponse)
EXEC_NEXT_STATE_IMMEDIATELY
EXEC_NEXT_STATE_IMMEDIATELY
break ;
break ;
case ModeTerminate_CancelTerminationOfWorkspace :
case Mode Delete_Laboratory Workspace:
ds < < TQString ( " SESSION " ) ;
ds < < TQString ( " DELETEGROUPACCESS " ) ;
ds < < TQString ( " CANCEL_KILL_WORKSPACE " ) ;
ds < < TQString ( " WORKSPACES " ) ;
ds < < terminateSessionID ;
ds < < m_updateWorkspaceServiceAuthGroupList ;
m_socket - > writeEndOfFrame ( ) ;
m_socket - > writeEndOfFrame ( ) ;
SET_NEXT_STATE ( ModeTerminate_ProcessResponse )
SET_NEXT_STATE ( Mode Dele te_ProcessResponse)
EXEC_NEXT_STATE_IMMEDIATELY
EXEC_NEXT_STATE_IMMEDIATELY
break ;
break ;
case ModeTerminate_ProcessResponse :
case Mode Dele te_ProcessResponse:
// Get all data
// Get all data
if ( m_socket - > canReadFrame ( ) ) {
if ( m_socket - > canReadFrame ( ) ) {
PAT_WATCHDOG_TIMER
PAT_WATCHDOG_TIMER