示例#1
0
文件: polkaview.cpp 项目: wyuka/polka
void PolkaView::cloneGroup( const Polka::Identity &group )
{
  bool ok;
  QString name = KInputDialog::getText( i18n("Clone Group"),
    i18n("Enter name of new group"),
    i18n("Clone of %1").arg( group.name().value() ),
    &ok );
  if ( ok ) {
    Polka::Identity identity;
    identity.setType( "group" );
    Polka::Name n;
    n.setValue( name );
    identity.setName( n );
    Polka::Identity new_group = m_model->insert( identity,
      i18n("Clone group '%1' to '%2'").arg( group.name().value() )
        .arg( name ) );

    Polka::Identity::List members = m_model->identitiesOfGroup( group );
    foreach( Polka::Identity member, members ) {
      m_model->addIdentity( member, new_group );
    }

    m_model->addIdentity( new_group, m_group );
    
    showGroup( new_group );
  }
示例#2
0
void PersonView::editName()
{
  Polka::Name name = m_identity.name();
  QString oldNameString = name.value();

  bool ok;
  QString nameString = QInputDialog::getText( this, i18n("Edit name"),
    QString(), QLineEdit::Normal, oldNameString, &ok );
  if ( ok ) {
    name.setValue( nameString );
    m_identity.setName( name );

    m_model->insert( m_identity, i18n("Changed name from %1 to %2")
      .arg( oldNameString ).arg( nameString ) );
  }
}