コード例 #1
0
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";
    }
}
コード例 #2
0
ファイル: htmlexport.cpp プロジェクト: KDE/kcalutils
void HtmlExport::formatAttendees(QTextStream *ts,
                                 const Incidence::Ptr &incidence)
{
    Attendee::List attendees = incidence->attendees();
    if (attendees.count()) {
        *ts << "<em>";
        *ts << incidence->organizer()->fullName();
        *ts << "</em><br />";
        Attendee::List::ConstIterator it;
        for (it = attendees.constBegin(); it != attendees.constEnd(); ++it) {
            Attendee::Ptr a(*it);
            if (!a->email().isEmpty()) {
                *ts << "<a href=\"mailto:" << a->email();
                *ts << "\">" << cleanChars(a->name()) << "</a>";
            } else {
                *ts << "    " << cleanChars(a->name());
            }
            *ts << "<br />" << endl;
        }
    } else {
        *ts << "    &nbsp;" << endl;
    }
}
コード例 #3
0
bool KOMailClient::mailAttendees( IncidenceBase *incidence,
                                  const Identity &identity,
                                  bool bccMe, const QString &attachment,
                                  bool useSendmail )
{
  Attendee::List attendees = incidence->attendees();
  if ( attendees.count() == 0 ) {
    return false;
  }

  const QString from = incidence->organizer().fullName();
  const QString organizerEmail = incidence->organizer().email();

  QStringList toList;
  QStringList ccList;
  for ( int i=0; i<attendees.count(); ++i ) {
    Attendee *a = attendees.at(i);

    const QString email = a->email();
    if ( email.isEmpty() ) {
      continue;
    }

    // In case we (as one of our identities) are the organizer we are sending
    // this mail. We could also have added ourselves as an attendee, in which
    // case we don't want to send ourselves a notification mail.
    if ( organizerEmail == email ) {
      continue;
    }

    // Build a nice address for this attendee including the CN.
    QString tname, temail;
    const QString username = KPIMUtils::quoteNameIfNecessary( a->name() );
    // ignore the return value from extractEmailAddressAndName() because
    // it will always be false since tusername does not contain "@domain".
    KPIMUtils::extractEmailAddressAndName( username, temail, tname );
    tname += " <" + email + '>';

    // Optional Participants and Non-Participants are copied on the email
    if ( a->role() == Attendee::OptParticipant ||
         a->role() == Attendee::NonParticipant ) {
      ccList << tname;
    } else {
      toList << tname;
    }
  }
  if( toList.count() == 0 && ccList.count() == 0 ) {
    // Not really to be called a groupware meeting, eh
    return false;
  }
  QString to;
  if ( toList.count() > 0 ) {
    to = toList.join( ", " );
  }
  QString cc;
  if ( ccList.count() > 0 ) {
    cc = ccList.join( ", " );
  }

  QString subject;
  if ( incidence->type() != "FreeBusy" ) {
    Incidence *inc = static_cast<Incidence *>( incidence );
    subject = inc->summary();
  } else {
    subject = "Free Busy Object";
  }

  QString body = IncidenceFormatter::mailBodyStr( incidence, KSystemTimeZones::local() );

  return send( identity, from, to, cc, subject, body, false,
               bccMe, attachment, useSendmail );
}