当前位置: 首页>>代码示例>>C++>>正文


C++ kabc::Addressee类代码示例

本文整理汇总了C++中kabc::Addressee的典型用法代码示例。如果您正苦于以下问题:C++ Addressee类的具体用法?C++ Addressee怎么用?C++ Addressee使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Addressee类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: testDuplicate

void TestDistrList::testDuplicate()
{
    kDebug() ;
    // This is a special test for the case where we have a contact and a distr list with the same name
    KABC::AddressBook *ab = KABC::StdAddressBook::self();
    KABC::Addressee addr;
    addr.setName( "foo" );
    addr.insertEmail( "[email protected]", true );
    ab->insertAddressee( addr );

#if 0 // we need a findByFormattedName
    KABC::Addressee::List addrList = ab->findByName( "foo" );
    assert( addrList.count() == 2 );

    bool a = DistributionList::isDistributionList( addrList.first() );
    bool b = DistributionList::isDistributionList( addrList.last() );
    // one is a distr list, but not both
    assert( a || b );
    //
    assert( ! ( a && b ) );
#endif

    DistributionList dl = DistributionList::findByName( ab, "foo" );
    assert( !dl.isEmpty() );
    assert( DistributionList::isDistributionList( dl ) );
    assert( dl.formattedName() == "foo" );
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:27,代码来源:testdistrlist.cpp

示例2: add

void RecentAddresses::add( const QString& entry )
{
  if ( !entry.isEmpty() && m_maxCount > 0 ) {
    QStringList list = KPIM::splitEmailAddrList( entry );
    for( QStringList::const_iterator e_it = list.begin(); e_it != list.end(); ++e_it ) {
      KPIM::EmailParseResult errorCode = KPIM::isValidEmailAddress( *e_it );
      if ( errorCode != KPIM::AddressOk ) 
        continue;
      QString email;
      QString fullName;
      KABC::Addressee addr;

      KABC::Addressee::parseEmailAddress( *e_it, fullName, email );

      for ( KABC::Addressee::List::Iterator it = m_addresseeList.begin();
          it != m_addresseeList.end(); ++it )
      {
        if ( email == (*it).preferredEmail() ) {
          //already inside, remove it here and add it later at pos==1
          m_addresseeList.remove( it );
          break;
        }
      }
      addr.setNameFromString( fullName );
      addr.insertEmail( email, true );
      m_addresseeList.prepend( addr );
      adjustSize();
    }
  }
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例3: testNewList

void TestDistrList::testNewList()
{
    kDebug() ;
    DistributionList dl;
    dl.setName( "foo" );
    assert( !dl.isEmpty() );
    check( "name set", dl.formattedName(), "foo" );
    assert( DistributionList::isDistributionList( dl ) );

    KABC::AddressBook *ab = KABC::StdAddressBook::self();
    ab->insertAddressee( dl );
#if 0 // can't do that until we have KABC::AddressBook::findByFormattedName, or we use setName()
    KABC::Addressee::List addrList = ab->findByName( "foo" );
    assert( addrList.count() == 1 );
    KABC::Addressee addr = addrList.first();
    assert( !addr.isEmpty() );
    check( "correct name", addr.name(), "foo" );
    assert( DistributionList::isDistributionList( addr ) );
#else
    KABC::Addressee addr = dl;
#endif

    DistributionList dl2 = DistributionList::findByName( ab, "foo" );
    assert( !dl2.isEmpty() );
    check( "correct name", dl2.formattedName(), "foo" );
    assert( DistributionList::isDistributionList( dl2 ) );

    // Test the ctor that takes an addressee
    DistributionList dl3( addr );
    assert( !dl3.isEmpty() );
    assert( DistributionList::isDistributionList( dl3 ) );
    check( "correct name", dl3.formattedName(), "foo" );
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:33,代码来源:testdistrlist.cpp

示例4: setRecipients

void DistributionListDialog::setRecipients( const Recipient::List &recipients )
{
  Recipient::List::ConstIterator it;
  for( it = recipients.constBegin(); it != recipients.constEnd(); ++it ) {
    QStringList emails = KPIMUtils::splitAddressList( (*it).email() );
    QStringList::ConstIterator it2;
    for( it2 = emails.constBegin(); it2 != emails.constEnd(); ++it2 ) {
      QString name;
      QString email;
      KABC::Addressee::parseEmailAddress( *it2, name, email );
      if ( !email.isEmpty() ) {
        DistributionListItem *item = new DistributionListItem( mRecipientsList );
        KABC::Addressee::List addressees =
          KABC::StdAddressBook::self( true )->findByEmail( email );
        if ( addressees.isEmpty() ) {
          KABC::Addressee a;
          a.setNameFromString( name );
          a.insertEmail( email );
          item->setTransientAddressee( a, email );
          item->setCheckState( 0, Qt::Checked );
        } else {
          KABC::Addressee::List::ConstIterator it3;
          for( it3 = addressees.constBegin(); it3 != addressees.constEnd(); ++it3 ) {
            item->setAddressee( *it3, email );
            if ( it3 == addressees.constBegin() ) item->setCheckState( 0, Qt::Checked );
          }
        }
      }
    }
  }
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:31,代码来源:distributionlistdialog.cpp

示例5: interpretAddressBookDownloadItemsJob

bool GroupDavGlobals::interpretAddressBookDownloadItemsJob(
    KABC::AddressBookAdaptor *adaptor, KIO::Job *job, const QString &jobData)
{
    kdDebug(5800) << "GroupDavGlobals::interpretAddressBookDownloadItemsJob, vCard=" << endl;
    kdDebug(5800) << jobData << endl;
    if(!adaptor || !job) return false;

    KABC::VCardConverter conv;
    KABC::Addressee::List addrs(conv.parseVCards(jobData));

    if(addrs.count() != 1)
    {
        kdError() << "Parsed vCard does not contain exactly one addressee." << endl;
        return false;
    }

    KABC::Addressee a = addrs.first();

    KIO::SimpleJob *sjob = dynamic_cast<KIO::SimpleJob *>(job);
    KURL remoteId;
    if(sjob) remoteId = sjob->url();
    QString fingerprint = extractFingerprint(job, jobData);
    adaptor->addressbookItemDownloaded(a, a.uid(), remoteId, fingerprint,
                                       remoteId.prettyURL());
    return true;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:26,代码来源:groupdavglobals.cpp

示例6: sendFile

/**
 * Send the file to the contact
 * @param uid the KABC uid you are sending to.
 * @param sourceURL a KURL to send.
 * @param altFileName an alternate filename describing the file
 * @param fileSize file size in bytes
 */
void Addressbook::sendFile(const QString &uid, const KURL &sourceURL, const QString &altFileName, uint fileSize)
{
    if(uid.isEmpty())
    {
        focusAndShowErrorMessage(i18n("Another KDE application tried to use Konversation to send a file to a contact, but did not specify any contact to send the file to.  This is probably a bug in the other application."));
        return;
    }
    KABC::Addressee addressee = addressBook->findByUid(uid);
    if(addressee.isEmpty())
    {
        focusAndShowErrorMessage(i18n("Another KDE application tried to use Konversation to send a file to a contact, but Konversation could not find the specified contact in the KDE address book."));
        return;
    }
    NickInfoPtr nickInfo = getNickInfo(addressee);
    if(!nickInfo)
    {
        QString user = addressee.fullEmail();
        if(!user.isEmpty()) user = " (" + user + ')';
        focusAndShowErrorMessage(i18n("Another KDE application tried to use Konversation to send a file to a contact, but the requested user%1 is not currently online.").arg(user));
        return;
    }
    nickInfo->getServer()->addDccSend(nickInfo->getNickname(), sourceURL, altFileName, fileSize);
    QWidget *widget = nickInfo->getServer()->getViewContainer()->getWindow();
    KWin::demandAttention(widget->winId());       //If activeWindow request is denied, at least demand attention!
    KWin::activateWindow(widget->winId());        //May or may not work, depending on focus stealing prevention.

}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例7: itemIcon

QPixmap AddresseeEmailSelection::itemIcon( const KABC::Addressee &addressee, uint ) const
{
  if ( !addressee.photo().data().isNull() )
    return addressee.photo().data().smoothScale( 16, 16 );
  else
    return KGlobal::iconLoader()->loadIcon( "personal", KIcon::Small );
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例8: formatAttendees

void HtmlExport::formatAttendees( QTextStream *ts, Incidence *event )
{
    Attendee::List attendees = event->attendees();
    if (attendees.count()) {
        *ts << "<em>";
#ifndef KORG_NOKABC
        KABC::AddressBook *add_book = KABC::StdAddressBook::self( true );
        KABC::Addressee::List addressList;
        addressList = add_book->findByEmail(event->organizer().email());
        KABC::Addressee o = addressList.first();
        if (!o.isEmpty() && addressList.size()<2) {
            *ts << "<a href=\"mailto:" << event->organizer().email() << "\">";
            *ts << cleanChars(o.formattedName()) << "</a>\n";
        }
        else *ts << event->organizer().fullName();
#else
        *ts << event->organizer().fullName();
#endif
        *ts << "</em><br />";
        Attendee::List::ConstIterator it;
        for( it = attendees.begin(); it != attendees.end(); ++it ) {
            Attendee *a = *it;
            if (!a->email().isEmpty()) {
                *ts << "<a href=\"mailto:" << a->email();
                *ts << "\">" << cleanChars(a->name()) << "</a>";
            }
            else {
                *ts << "    " << cleanChars(a->name());
            }
            *ts << "<br />" << "\n";
        }
    } else {
        *ts << "    &nbsp;\n";
    }
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例9: addKey

void VCardXXPort::addKey( KABC::Addressee &addr, KABC::Key::Types type )
{
  QString fingerprint = addr.custom( "KADDRESSBOOK",
                                     (type == KABC::Key::PGP ? "OPENPGPFP" : "SMIMEFP") );
  if ( fingerprint.isEmpty() )
    return;

  GpgME::Context * context = GpgME::Context::createForProtocol( GpgME::Context::OpenPGP );
  if ( !context ) {
    kdError() << "No context available" << endl;
    return;
  }

  context->setArmor( false );
  context->setTextMode( false );

  QGpgME::QByteArrayDataProvider dataProvider;
  GpgME::Data dataObj( &dataProvider );
  GpgME::Error error = context->exportPublicKeys( fingerprint.latin1(), dataObj );
  delete context;

  if ( error ) {
    kdError() << error.asString() << endl;
    return;
  }

  KABC::Key key;
  key.setType( type );
  key.setBinaryData( dataProvider.data() );

  addr.insertKey( key );
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例10: widgetModified

void AddresseeEditorDialog::widgetModified()
{
  const KABC::Addressee addressee = mEditorWidget->addressee();
  if ( !addressee.isEmpty() )
    setTitle( addressee );

  enableButton( KDialogBase::Apply, true );
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例11: storeContact

void NameEditWidget::storeContact( KABC::Addressee &contact ) const
{
  contact.setPrefix( mContact.prefix() );
  contact.setGivenName( mContact.givenName() );
  contact.setAdditionalName( mContact.additionalName() );
  contact.setFamilyName( mContact.familyName() );
  contact.setSuffix( mContact.suffix() );
}
开发者ID:lenggi,项目名称:kcalcore,代码行数:8,代码来源:nameeditwidget.cpp

示例12: getName

QString ContactsModel::getName(KABC::Addressee contact) const
{
    QString name = contact.formattedName();
    if (name.isEmpty()) {
        name = QString("%1 %2").arg(contact.givenName()).arg(contact.familyName());
    }
    return name;
}
开发者ID:KDE,项目名称:simon-tools,代码行数:8,代码来源:contactsmodel.cpp

示例13: fromKABC

void KoRdfFoaF::fromKABC(KABC::Addressee addr)
{
    m_name = addr.realName();
    m_nick = addr.nickName();
    KABC::PhoneNumber ph = addr.phoneNumber(KABC::PhoneNumber::Work);
    m_phone = ph.number();
    m_homePage = addr.url().url();
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:8,代码来源:KoRdfFoaF.cpp

示例14: hasNameMatch

bool KABCHandler::hasNameMatch(const KABC::Addressee& contact, const QString& name)
{
    if (contact.assembledName().lower().find(name) != -1) return true;

    if (contact.formattedName().lower().find(name) != -1) return true;

    return false;
}
开发者ID:PabloCastellano,项目名称:portland,代码行数:8,代码来源:kabchandler.cpp

示例15: toKABC

KABC::Addressee KoRdfFoaF::toKABC() const
{
    KABC::Addressee addr;
    addr.setNameFromString(m_name);
    addr.setNickName(m_nick);
    KABC::PhoneNumber ph(m_phone, KABC::PhoneNumber::Work);
    addr.insertPhoneNumber(ph);
    return addr;
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:9,代码来源:KoRdfFoaF.cpp


注:本文中的kabc::Addressee类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。