Example #1
0
void PersonView::removePhone( const QString &id )
{
  Polka::Phones cs = m_identity.phones();
  Polka::Phone c = cs.findPhone( id );
  cs.remove( c );
  m_identity.setPhones( cs );

  m_model->insert( m_identity, i18n("Remove phone %1 from %2")
    .arg( c.phoneNumber() ).arg( m_identity.name().value() ) );
}
Example #2
0
void PersonView::addPhone()
{
  PhoneEditor *editor = new PhoneEditor( this );
  if ( editor->exec() == PhoneEditor::Accepted ) {
    Polka::Phones cs = m_identity.phones();
    Polka::Phone c = editor->phone();
    c.setId( KRandom::randomString( 10 ) );
    cs.insert( c );
    m_identity.setPhones( cs );

    m_model->insert( m_identity, i18n("Add phone %1 to %2")
      .arg( c.phoneNumber() ).arg( m_identity.name().value() ) );
  }
}
Example #3
0
void PersonView::editPhone( const QString &id )
{
  Polka::Phone phone = m_identity.phones().findPhone( id );

  PhoneEditor *editor = new PhoneEditor( this );
  editor->setPhone( phone );
  if ( editor->exec() == PhoneEditor::Accepted ) {
    Polka::Phones cs = m_identity.phones();
    phone = editor->phone();
    cs.insert( phone );
    m_identity.setPhones( cs );

    m_model->insert( m_identity, i18n("Edit phone %1 of %2")
      .arg( phone.phoneNumber() ).arg( m_identity.name().value() ) );
  }
}
Example #4
0
void PhoneEditor::setPhone( const Polka::Phone &phone )
{
  m_phone = phone;

  setCaption( i18n("Edit phone number") );

  m_numberEdit->setText( phone.phoneNumber() );
}
Example #5
0
void PersonView::commentPhone( const QString &id )
{
  Polka::Phone p = m_identity.phones().findPhone( id );

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

  CommentEditor *editor = new CommentEditor( this );
  editor->setComment( comment.value() );
  if ( editor->exec() == CommentEditor::Accepted ) {
    Polka::Phones ps = m_identity.phones();
    comment.setValue( editor->comment() );
    p.setComment( comment );
    ps.insert( p );
    m_identity.setPhones( ps );

    m_model->insert( m_identity, i18n("Edit comment of phone %2")
      .arg( p.phoneNumber() ) );
  }
}