Esempio n. 1
0
  void BookmarkStorage::storeBookmarks( const BookmarkList& bList, const ConferenceList& cList )
  {
    Tag* s = new Tag( "storage" );
    s->addAttribute( XMLNS, XMLNS_BOOKMARKS );

    BookmarkList::const_iterator itb = bList.begin();
    for( ; itb != bList.end(); ++itb )
    {
      Tag* i = new Tag( s, "url", "name", (*itb).name );
      i->addAttribute( "url", (*itb).url );
    }

    ConferenceList::const_iterator itc = cList.begin();
    for( ; itc != cList.end(); ++itc )
    {
      Tag* i = new Tag( s, "conference", "name", (*itc).name );
      i->addAttribute( "jid", (*itc).jid );
      i->addAttribute( "autojoin", (*itc).autojoin ? "true" : "false" );

      new Tag( i, "nick", (*itc).nick );
      new Tag( i, "password", (*itc).password );
    }

    storeXML( s, this );
  }
Esempio n. 2
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;
}
    virtual void handleBookmarks( const BookmarkList &bList, const ConferenceList &cList )
    {
      printf( "received bookmarks...\n" );

      BookmarkList::const_iterator it_b = bList.begin();
      for( ; it_b != bList.end(); it_b++ )
      {
        printf( "url: %s, name: %s\n", (*it_b).url.c_str(), (*it_b).name.c_str() );
      }
      ConferenceList::const_iterator it_c = cList.begin();
      for( ; it_c != cList.end(); it_c++ )
      {
        printf( "jid: %s, name: %s, nick: %s, pwd: %s\n", (*it_c).jid.c_str(), (*it_c).name.c_str(),
                (*it_c).nick.c_str(), (*it_c).password.c_str() );
      }

      BookmarkList mybList;
      ConferenceList mycList;

      BookmarkListItem bItem;
      bItem.url = "http://camaya.net/gloox";
      bItem.name = "gloox";
      mybList.push_back( bItem );

      bItem.url = "http://jabber.cc";
      bItem.name = "public jabber services";
      mybList.push_back( bItem );

      ConferenceListItem cItem;
      cItem.jid = "*****@*****.**";
      cItem.name = "jabber development";
      cItem.nick = "myNick";
      cItem.autojoin = false;
      mycList.push_back( cItem );

      cItem.jid = "*****@*****.**";
      cItem.name = "jabberd development";
      cItem.nick = "myOtherNick";
      cItem.password = "******";
      cItem.autojoin = true;
      mycList.push_back( cItem );

      b->storeBookmarks( mybList, mycList );
    }