newntui/discovermdi/src/dockablebrowser.cpp
//----------------------------------------------------------------------------------------
// Saves current results and browser status in the history
//----------------------------------------------------------------------------------------
Saves current results and browser status in the history
Saves current results and browser status in the history
void CDockableBrowser::SaveHistory(CString command) {
CString serverVarName;
	CString result;
	CString cmd;
	cmd="size $DiscoverAll";
	result=ExecuteCommand(cmd);
	int size = atoi(result);
	m_ResultWasEmpty=FALSE;
	if(size==0) {
		m_ResultWasEmpty=TRUE;
		return;
	}
	if(m_InHistory>=30) m_History.RemoveHead();
	else                m_InHistory++;
	serverVarName.Format("__discover_history_%d__",m_VarIndex);
	if(command.GetLength()==0)
	    cmd.Format("set %s $DiscoverAll",serverVarName);
	else
	    cmd.Format("set %s [nil_set]",serverVarName);
	ExecuteCommand(cmd);
	CHistoryEntry entry;
	entry.m_Mode           = m_CurrentMode;
	entry.m_ServerVariable = serverVarName;
	entry.m_ProjectName    = m_CurrentProject;
	entry.m_CategoryName   = m_CurrentCategory;
	entry.m_QueryName      = m_CurrentQuery;
	entry.m_GroupName      = m_CurrentGroup;
	entry.m_Command        = command;
	int count = 0;
	POSITION pos;
    pos=m_CurrentHistoryEntry;
	if(pos) m_History.GetNext(pos);
	while(pos) {
		CHistoryEntry entry;
		entry=m_History.GetAt(pos);
		cmd.Format("unset %s",entry.m_ServerVariable);
		ExecuteCommand(cmd);
		count++;
		m_History.GetNext(pos);
	}
	for(int i=0;i<count;i++) m_History.RemoveTail();
	m_CurrentHistoryEntry  = m_History.AddTail(entry);
    m_VarIndex=++m_VarIndex%30;
}
void CDockableBrowser :: SaveHistory ( CString command ) { CString serverVarName ; CString result ; CString cmd ; cmd = " " ; result = ExecuteCommand ( cmd ) ; int size = atoi ( result ) ; m_ResultWasEmpty = FALSE ; if ( size == 0 ) { m_ResultWasEmpty = TRUE ; return ; } if ( m_InHistory >= 30 ) m_History . RemoveHead ( ) ; else m_InHistory ++ ; serverVarName . Format ( " " , m_VarIndex ) ; if ( command . GetLength ( ) == 0 ) cmd . Format ( " " , serverVarName ) ; else cmd . Format ( " " , serverVarName ) ; ExecuteCommand ( cmd ) ; CHistoryEntry entry ; entry . m_Mode = m_CurrentMode ; entry . m_ServerVariable = serverVarName ; entry . m_ProjectName = m_CurrentProject ; entry . m_CategoryName = m_CurrentCategory ; entry . m_QueryName = m_CurrentQuery ; entry . m_GroupName = m_CurrentGroup ; entry . m_Command = command ; int count = 0 ; POSITION pos ; pos = m_CurrentHistoryEntry ; if ( pos ) m_History . GetNext ( pos ) ; while ( pos ) { CHistoryEntry entry ; entry = m_History . GetAt ( pos ) ; cmd . Format ( " " , entry . m_ServerVariable ) ; ExecuteCommand ( cmd ) ; count ++ ; m_History . GetNext ( pos ) ; } for ( int i = 0 ; i < count ; i ++ ) m_History . RemoveTail ( ) ; m_CurrentHistoryEntry = m_History . AddTail ( entry ) ; m_VarIndex = ++ m_VarIndex % 30 ; }
Saves current results and browser status in the history
Saves current results and browser status in the history
// Setting server history variable // Filling client history entry