void AddFolderToHistory( clPtr<FS>* fs, FSPath* path ) { if ( fs && fs->Ptr() && path ) { // collect all needed path information PathList::Data data; if ( PathListFSToData( data, fs, path ) ) { // check if item already exists in the list const int index = g_dataList.FindByName( data.name.data() ); if ( index != -1 ) { // remove existing item g_dataList.Remove( index ); } // add item to the and of the list g_dataList.Add( data.name.data(), data.conf ); // limit number of elements in the list while ( g_dataList.GetCount() > MAX_FOLDERS_HISTORY_COUNT ) { g_dataList.Remove( 0 ); } } } }
FoldersHistoryDlg( NCDialogParent* parent, PathList& dataList ) : PathListDlg( parent, m_historyWin, _LT( "Folders History" ), 0 ) , m_historyWin( this, dataList ) , m_lo( 10, 10 ) { m_ListWin.Show(); m_ListWin.Enable(); m_lo.AddWin( &m_ListWin, 0, 0, 9, 0 ); m_lo.SetLineGrowth( 9 ); AddLayout( &m_lo ); SetPosition(); m_ListWin.SetFocus(); if ( dataList.GetCount() > 0 ) { // select the last item and make it visible m_ListWin.MoveCurrent( dataList.GetCount() - 1 ); } }
void AddFileToHistory( const int CurrIndex, const PathList::Data& Data ) { if ( CurrIndex != -1 ) { // remove existing item g_ViewList.Remove( CurrIndex ); } // add item to the end of the list g_ViewList.Add( Data.name.data(), Data.conf ); // limit number of elements in the list while ( g_ViewList.GetCount() > MAX_VIEW_HISTORY_COUNT ) { g_ViewList.Remove( 0 ); } }