Пример #1
0
void LinkEditor::setLink( const Polka::Link &link )
{
  m_link = link;

  setCaption( i18n("Edit link") );

  m_urlEdit->setText( link.url() );
}
Пример #2
0
void PersonView::removeLink( const QString &id )
{
  Polka::Links cs = m_identity.links();
  Polka::Link c = cs.findLink( id );
  cs.remove( c );
  m_identity.setLinks( cs );

  m_model->insert( m_identity, i18n("Remove link %1 from %2")
    .arg( c.url() ).arg( m_identity.name().value() ) );
}
Пример #3
0
void PersonView::addLink()
{
  LinkEditor *editor = new LinkEditor( this );
  if ( editor->exec() == LinkEditor::Accepted ) {
    Polka::Links cs = m_identity.links();
    Polka::Link c = editor->link();
    c.setId( KRandom::randomString( 10 ) );
    cs.insert( c );
    m_identity.setLinks( cs );

    m_model->insert( m_identity, i18n("Add link %1 to %2")
      .arg( c.url() ).arg( m_identity.name().value() ) );
  }
}
Пример #4
0
void PersonView::editLink( const QString &id )
{
  Polka::Link link = m_identity.links().findLink( id );

  LinkEditor *editor = new LinkEditor( this );
  editor->setLink( link );
  if ( editor->exec() == LinkEditor::Accepted ) {
    Polka::Links cs = m_identity.links();
    link = editor->link();
    cs.insert( link );
    m_identity.setLinks( cs );

    m_model->insert( m_identity, i18n("Edit link %1 of %2")
      .arg( link.url() ).arg( m_identity.name().value() ) );
  }
}
Пример #5
0
void PersonView::commentLink( const QString &id )
{
  Polka::Link l = m_identity.links().findLink( id );

  Polka::Comment comment = l.comment();

  CommentEditor *editor = new CommentEditor( this );
  editor->setComment( comment.value() );
  if ( editor->exec() == CommentEditor::Accepted ) {
    Polka::Links ls = m_identity.links();
    comment.setValue( editor->comment() );
    l.setComment( comment );
    ls.insert( l );
    m_identity.setLinks( ls );

    m_model->insert( m_identity, i18n("Edit comment of link %2")
      .arg( l.url() ) );
  }
}