void FormulaEdit::openRule ()
{
  QString s("*");
  QString s2;
  config.getData(Config::IndicatorPath, s2);
  SymbolDialog *dialog = new SymbolDialog(this,
                                          s2,
  					  s2,
					  s,
					  QFileDialog::ExistingFiles);
  dialog->setCaption(tr("Select rule to open."));

  int rc = dialog->exec();

  if (rc != QDialog::Accepted)
  {
    delete dialog;
    return;
  }

  QStringList selection = dialog->selectedFile();
  delete dialog;

  if (! selection.count())
    return;

  QFile f(selection[0]);
  if (! f.open(IO_ReadOnly))
  {
    qDebug("FormulaEdit::openRule:can't read file %s", selection[0].latin1());
    return;
  }
  QTextStream stream(&f);
  
  QString script;
  while(stream.atEnd() == 0)
  {
    s = stream.readLine();
    s = s.stripWhiteSpace();
    if (s.contains("script="))
      script = s;
  }
  f.close();

  setLine(script);
}
void TestPage::deleteTest()
{
  QString s("*");
  QString s2;
  config.getData(Config::TestPath, s2);
  SymbolDialog *dialog = new SymbolDialog(this,
                                          s2,
  					  s2,
					  s,
					  QFileDialog::DirectoryOnly);
  dialog->setCaption(tr("Select Backtest rule To Delete"));

  int rc = dialog->exec();

  if (rc == QDialog::Accepted)
  {
    rc = QMessageBox::warning(this,
  			      tr("Qtstalker: Warning"),
			      tr("Are you sure you want to delete backtest rule?"),
			      QMessageBox::Yes,
			      QMessageBox::No,
			      QMessageBox::NoButton);

    if (rc == QMessageBox::No)
    {
      delete dialog;
      return;
    }

    s = "rm -r " + dialog->selectedFile();
    
    if (system(s.latin1()) == -1)
      qDebug("TestPage::deleteTest:command failed");
    
    updateList();

    testNoSelection();
  }

  delete dialog;
}