예제 #1
0
    foreach (const QString &headerRow, headerLines) {
        QRegExp messageIdRx("^Message-ID: (.*)$", Qt::CaseInsensitive);
        QRegExp fromRx("^From: (.*)$", Qt::CaseInsensitive);
        QRegExp toRx("^To: (.*)$", Qt::CaseInsensitive);
        QRegExp ccRx("^Cc: (.*)$", Qt::CaseInsensitive);
        QRegExp subjectRx("^Subject: (.*)$", Qt::CaseInsensitive);
        QRegExp dateRx("^Date: (.*)$", Qt::CaseInsensitive);
        QRegExp mimeVerstionRx("^MIME-Version: (.*)$", Qt::CaseInsensitive);
        QRegExp contentTransferEncodingRx("^Content-Transfer-Encoding: (.*)$", Qt::CaseInsensitive);
        QRegExp contentTypeRx("^Content-Type: (.*)$", Qt::CaseInsensitive);

        if (messageIdRx.indexIn(headerRow) != -1)
            setMessageId(messageIdRx.cap(1));
        else if (fromRx.indexIn(headerRow) != -1)
            setFrom(headerDecode(fromRx.cap(1)));
        else if (toRx.indexIn(headerRow) != -1)
            setTo(headerDecode(toRx.cap(1)));
        else if (ccRx.indexIn(headerRow) != -1)
            setCc(headerDecode(ccRx.cap(1)));
        else if (subjectRx.indexIn(headerRow) != -1)
            setSubject(headerDecode(subjectRx.cap(1)));
        else if (dateRx.indexIn(headerRow) != -1) {
            QDateTime date = QDateTime::fromString(dateRx.cap(1), Qt::RFC2822Date);
            setDate(date);
        } else if (mimeVerstionRx.indexIn(headerRow) != -1)
            setMimeVersion(mimeVerstionRx.cap(1));
        else if (contentTransferEncodingRx.indexIn(headerRow) != -1)
            setContentTransferEncoding(IqPostmanAbstractContent::contentTransferEncodingFromString(headerRow));
        else if (contentTypeRx.indexIn(headerRow) != -1)
            setContentType(IqPostmanAbstractContentType::createFromString(headerRow));
    }
예제 #2
0
파일: xmpsubjects.cpp 프로젝트: KDE/digikam
XMPSubjects::XMPSubjects(QWidget* const parent)
    : SubjectWidget(parent)
{
    // Subject string do not accept these characters:
    // - '*' (\x2A)
    // - ':' (\x3A)
    // - '?' (\x3F)
    QRegExp subjectRx(QLatin1String("[^*:?]+$"));
    QValidator* const subjectValidator = new QRegExpValidator(subjectRx, this);

    // --------------------------------------------------------

    m_iprEdit->setText(QLatin1String("XMP"));
    m_iprEdit->setValidator(subjectValidator);
    m_iprEdit->setWhatsThis(i18n("Enter here the Informative Provider Reference. "
                                 "I.P.R is a name registered with the XMP/NAA, identifying the "
                                 "provider that provides an indicator of the content. "
                                 "The default value for the I.P.R is \"XMP\" if a standard Reference "
                                 "Code is used."));

    m_refEdit->setWhatsThis(i18n("Enter here the Subject Reference Number. "
                                 "Provides a numeric code to indicate the Subject Name plus "
                                 "optional Subject Matter and Subject Detail Names in the "
                                 "language of the service. Subject Reference is a number "
                                 "from the range 01000000 to 17999999 and represent a "
                                 "language independent international reference to "
                                 "a Subject. A Subject is identified by its Reference Number "
                                 "and corresponding Names taken from a standard lists given "
                                 "by XMP/NAA. If a standard reference code is used, these lists "
                                 "are the English language reference versions. "
                                 "This field is limited to 8 digit code."));

    m_nameEdit->setValidator(subjectValidator);
    m_nameEdit->setWhatsThis(i18n("Enter here the Subject Name. English language is used "
                                  "if you selected a standard XMP/NAA reference code."));

    m_matterEdit->setValidator(subjectValidator);
    m_matterEdit->setWhatsThis(i18n("Enter here the Subject Matter Name. English language is used "
                                    "if you selected a standard XMP/NAA reference code."));

    m_detailEdit->setValidator(subjectValidator);
    m_detailEdit->setWhatsThis(i18n("Enter here the Subject Detail Name. English language is used "
                                    "if you selected a standard XMP/NAA reference code."));

    // reset the note label, not used in XMP view
    delete m_note;

    m_subjectsCheck->setVisible(true);
    m_subjectsCheck->setEnabled(true);
}
/*!
    Constructor for AppointmentDetailsForm
*/
AppointmentDetailsForm::AppointmentDetailsForm(Appointment *appointment,
                                               QList <Calendar *> *calendars,
                                               QWidget *parent) :
    QWidget(parent), ptrAppointment(appointment)
{
    setupUi(this);

    setAttribute(Qt::WA_DeleteOnClose, true);

    QRegExp subjectRx("^.{3,45}$");
    subjectEdit->setValidator(new QRegExpValidator(subjectRx, this));

    ptrCalendars = new QList <Calendar *>();

    // Create icons for calendar combobox.
    QListIterator <Calendar *> i(*calendars);
    int j = 0;
    while(i.hasNext())
    {
        Calendar *cal = i.next();

        if(cal->isSelected())
        {
            QPixmap map(16,16);
            map.fill(cal->color());
            QIcon icon(map);

            calendarCombo->addItem(icon, cal->name(), cal->key());

            ptrCalendars->append(cal);

            if(appointment->calendar() != 0)
                if(cal == appointment->calendar())
                    calendarCombo->setCurrentIndex(j);

            j++;
        }
    }

    startDateEdit->calendarWidget()->setFirstDayOfWeek(Qt::Monday);
    startDateEdit->setDate(appointment->startDate());
    startTimeEdit->setTime(appointment->startTime());

    endDateEdit->calendarWidget()->setFirstDayOfWeek(Qt::Monday);
    endDateEdit->setDate(appointment->endDate());
    endTimeEdit->setTime(appointment->endTime());

    subjectEdit->setText(appointment->subject());
    placeEdit->setText(appointment->place());
    descriptionEdit->setPlainText(appointment->description());

    if(ptrAppointment->key() == 0)
        deleteAppointmentButton->hide();    

    connect(startDateEdit, SIGNAL(dateTimeChanged(const QDateTime &)),
            this, SLOT(startDateTimeChanged(const QDateTime &)));
    connect(startTimeEdit, SIGNAL(dateTimeChanged(const QDateTime &)),
            this, SLOT(startDateTimeChanged(const QDateTime &)));
    connect(endDateEdit, SIGNAL(dateTimeChanged(const QDateTime &)),
            this, SLOT(endDateTimeChanged(const QDateTime &)));
    connect(endTimeEdit, SIGNAL(dateTimeChanged(const QDateTime &)),
            this, SLOT(endDateTimeChanged(const QDateTime &)));

    connect(saveChangesButton, SIGNAL(clicked()), this, SLOT(onSaveChanges()));
    connect(discardChangesButton, SIGNAL(clicked()), this, SLOT(onDiscardChanges()));
    connect(deleteAppointmentButton, SIGNAL(clicked()), this, SLOT(onDeleteAppointment()));

    connect(subjectEdit, SIGNAL(returnPressed()), this, SLOT(onSaveChanges()));
    connect(placeEdit, SIGNAL(returnPressed()), this, SLOT(onSaveChanges()));
}