Esempio n. 1
0
void ZhscWidget::modifyBookmark()
{
  BookmarkList dbml;
  BookmarkList b;
  dbml.clear();

  Bookmark bm;
  BookmarkList::Iterator it;

  BMDialog *dlg = new BMDialog( this, "bmdialog" );
  dlg->setBML( bml );

  if ( dlg->exec() == QDialog::Accepted ) 
  {
    b = dlg->deletedBML();
    for ( it = b.begin(); it != b.end(); ++it )
    {
      bm.dynastyno = (*it).dynastyno;
      bm.poetno = (*it).poetno;
      bm.poemno = (*it).poemno;
      bm.content = (*it).content;

      dbml.append( bm );
    }

    if ( bConStatus )
    {
      QString sq = "select * from bookmark";
      QSqlQuery query( sq );

      for ( it = dbml.begin(); it != dbml.end(); ++it )
      {
        sq = "delete from bookmark where dynastyno = '" + (*it).dynastyno + "' and poetno = '" + (*it).poetno + "' and poemno = '" + (*it).poemno + "'";
        query.exec( sq );
      }
    }

    bookmark();
  }

  delete dlg;
}