void QMathMLFileViewer::fileFind()
{
	filesTable->setRowCount(0);

	QString fileName = fileComboBox->currentText();
	QString path = directoryComboBox->currentText();
	updateComboBox(fileComboBox);
	updateComboBox(directoryComboBox);
	m_currentDir = QDir(path);
	if( fileName.isEmpty() ) fileName = DEFAULT_MASK;

	//QApplication::setOverrideCursor( Qt::WaitCursor );

	QStringList files;
	if( isRecursive() )
	{
		QProgressDialog progress("Searching files...", "Abort Search", 0, 100, this);
		progress.setWindowModality(Qt::WindowModal);
		progress.setMinimumDuration( 500 );
		progress.setValue( 0 );
		fileFind( files, m_currentDir, QStringList(fileName), &progress );
		//progress.setValue( 100 + files.size() );
		progress.setValue( progress.maximum() );
	}
	else
	{
		//QStringList newFiles = m_currentDir.entryList(QStringList(fileName), QDir::Files | QDir::NoSymLinks);
		//for( QStringList::const_iterator item = newFiles.constBegin(); item != newFiles.constEnd(); item++ )
		//	files.append(m_currentDir.absoluteFilePath(*item));
		files = m_currentDir.entryList(QStringList(fileName), QDir::Files | QDir::NoSymLinks);
	}

	if(files.size() > 0)
	{
		filesTable->show();
		showFiles(files);
		filesTable->resizeRowsToContents();
		filesTable->resizeColumnsToContents();
		foundMessage->setText(QString(tr("%1 file(s) shown of %2 found").arg(filesTable->rowCount()).arg(files.size())));
		emit hasFound( true );
	}
	else
	{
		filesTable->hide();
		foundMessage->setText(QString(tr("No files found to match %1")).arg(fileName));
		emit hasFound( false );
	}

	//QApplication::restoreOverrideCursor();
}
 string minWindow(string S, string T) {
     // Start typing your C/C++ solution below
     // DO NOT write int main() function
     int lens = S.size();
     int lent = T.size();
     vector<int> needFind(256, 0);
     vector<int> hasFound(256, 0);
     for(int i = 0; i < lent; i++)
     {
         needFind[T[i]]++;
     }
     int minw = INT_MAX;
     string ret;
     int begin = 0;
     for(int i = 0; i < lens; i++)
     {
         if(needFind[S[i]] == 0)
             continue;
         hasFound[S[i]]++;
         if(hasFound[S[i]] <= needFind[S[i]])
                 lent--;
         if(lent == 0)
         {
             while(needFind[S[begin]] == 0 || hasFound[S[begin]] > needFind[S[begin]])
             {
                 if(hasFound[S[begin]] > needFind[S[begin]])
                     hasFound[S[begin]]--;
                 begin++;
             }
             int curlen = i-begin+1;
             if(curlen < minw)
             {
                 minw = curlen;
                 ret = S.substr(begin, minw);
             }
         }
     }
     return ret;
 }