Ejemplo n.º 1
0
void ExchangeDownload::download(const QDate &start, const QDate &end, bool showProgress)
{
    mCalendar = 0;
    mEvents = new QPtrList<KCal::Event>;

    if(showProgress)
    {
        //kdDebug() << "Creating progress dialog" << endl;
        mProgress = new ExchangeProgress();
        mProgress->show();

        connect(this, SIGNAL(startDownload()), mProgress, SLOT(slotTransferStarted()));
        connect(this, SIGNAL(finishDownload()), mProgress, SLOT(slotTransferFinished()));
    }

    QString sql = dateSelectQuery(start, end.addDays(1));

    increaseDownloads();

    KIO::DavJob *job = KIO::davSearch(mAccount->calendarURL(), "DAV:", "sql", sql, false);
    KIO::Scheduler::scheduleJob(job);
    job->setWindow(mWindow);
    connect(job, SIGNAL(result(KIO::Job *)),
            SLOT(slotSearchResult(KIO::Job *)));
}
Ejemplo n.º 2
0
void ObjectsRequestJob::davJobFinished(KJob *job)
{
    if (job->error()) {
        setError(job->error());
        setErrorText(job->errorText());
        emitResult();
        return;
    }

    KIO::DavJob *davJob = qobject_cast<KIO::DavJob *>(job);

    const QDomDocument document = davJob->response();

    QString errorText, errorStatus;
    if (DAVUtils::davErrorOccurred(document, errorText, errorStatus)) {
        setError(UserDefinedError);
        setErrorText(errorText);
        emitResult();
        return;
    }

    QDomElement multistatus = document.documentElement();
    QDomElement response = multistatus.firstChildElement(QStringLiteral("response"));
    while (!response.isNull()) {
        const QDomNodeList props = response.elementsByTagName(QStringLiteral("prop"));
        const QDomElement prop = props.at(0).toElement();
        mObjects.append(ObjectUtils::parseObject(prop, mFolder.module()));
        response = response.nextSiblingElement();
    }

    emitResult();
}
Ejemplo n.º 3
0
void ExchangeDelete::findUidSingleMaster(QString const &uid)
{
    QString query =
        "SELECT \"DAV:href\", \"urn:schemas:calendar:uid\"\r\n"
        "FROM Scope('shallow traversal of \"\"')\r\n"
        "WHERE \"urn:schemas:calendar:uid\" = '" + uid + "'\r\n"
        " AND (\"urn:schemas:calendar:instancetype\" = 0\r\n"
        "      OR \"urn:schemas:calendar:instancetype\" = 1)\r\n";

    KIO::DavJob *job = KIO::davSearch(mAccount->calendarURL(), "DAV:", "sql", query, false);
    job->setWindow(mWindow);
    connect(job, SIGNAL(result(KIO::Job *)), this, SLOT(slotFindUidResult(KIO::Job *)));
}
Ejemplo n.º 4
0
void ExchangeDownload::readAppointment(const KURL &url)
{
    QDomDocument doc;
    QDomElement root = addElement(doc, doc, "DAV:", "propfind");
    QDomElement prop = addElement(doc, root, "DAV:", "prop");
    addElement(doc, prop, "urn:schemas:calendar:", "uid");
    addElement(doc, prop, "urn:schemas:calendar:", "timezoneid");
    addElement(doc, prop, "urn:schemas:calendar:", "timezone");
    addElement(doc, prop, "urn:schemas:calendar:", "lastmodified");
    addElement(doc, prop, "urn:schemas:calendar:", "organizer");
    addElement(doc, prop, "urn:schemas:calendar:", "contact");
    addElement(doc, prop, "urn:schemas:httpmail:", "to");
    addElement(doc, prop, "urn:schemas:calendar:", "attendeestatus");
    addElement(doc, prop, "urn:schemas:calendar:", "attendeerole");
    addElement(doc, prop, "DAV:", "isreadonly");
    addElement(doc, prop, "urn:schemas:calendar:", "instancetype");
    addElement(doc, prop, "urn:schemas:calendar:", "created");
    addElement(doc, prop, "urn:schemas:calendar:", "dtstart");
    addElement(doc, prop, "urn:schemas:calendar:", "dtend");
    addElement(doc, prop, "urn:schemas:calendar:", "alldayevent");
    addElement(doc, prop, "urn:schemas:calendar:", "transparent");
    addElement(doc, prop, "urn:schemas:httpmail:", "textdescription");
    addElement(doc, prop, "urn:schemas:httpmail:", "subject");
    addElement(doc, prop, "urn:schemas:calendar:", "location");
    addElement(doc, prop, "urn:schemas:calendar:", "rrule");
    addElement(doc, prop, "urn:schemas:calendar:", "exdate");
    addElement(doc, prop, "urn:schemas:mailheader:", "sensitivity");
    addElement(doc, prop, "urn:schemas:calendar:", "reminderoffset");

    addElement(doc, prop, "urn:schemas-microsoft-com:office:office",
               "Keywords");

    //  addElement( doc, prop, "", "" );
    //  addElement( doc, prop, "DAV:", "" );
    //  addElement( doc, prop, "urn:schemas:calendar:", "" );
    //  addElement( doc, prop, "urn:content-classes:appointment", "" );
    //  addElement( doc, prop, "urn:schemas:httpmail:", "" );

    increaseDownloads();

    KIO::DavJob *job = KIO::davPropFind(url, doc, "0", false);
    KIO::Scheduler::scheduleJob(job);
    job->setWindow(mWindow);
    job->addMetaData("errorPage", "false");
    connect(job, SIGNAL(result(KIO::Job *)),
            SLOT(slotPropFindResult(KIO::Job *)));
}
Ejemplo n.º 5
0
bool GroupDavGlobals::interpretListItemsJob(KPIM::GroupwareDataAdaptor *adaptor,
        KIO::Job *job)
{
    KIO::DavJob *davjob = dynamic_cast<KIO::DavJob *>(job);

    if(!davjob)
    {
        return false;
    }
    QDomDocument doc = davjob->response();

    kdDebug(7000) << " Doc: " << doc.toString() << endl;
    kdDebug(7000) << " IdMapper: " << adaptor->idMapper()->asString() << endl;

    QDomElement docElem = doc.documentElement();
    QDomNode n = docElem.firstChild();
    while(!n.isNull())
    {
        QDomElement e = n.toElement(); // try to convert the node to an element.
        n = n.nextSibling();
        if(e.isNull())
            continue;

        const KURL &entry(e.namedItem("href").toElement().text());
        QDomElement propstat = e.namedItem("propstat").toElement();
        if(propstat.isNull())
            continue;
        QDomElement prop = propstat.namedItem("prop").toElement();
        if(prop.isNull())
            continue;
        QDomElement elem = prop.namedItem("getetag").toElement();
        const QString &newFingerprint = elem.text();
        if(elem.isNull() || newFingerprint.isEmpty())
            continue;

        KPIM::FolderLister::ContentType type = getContentType(prop);

        adaptor->processDownloadListItem(entry, newFingerprint, type);
    }

    return true;
}
Ejemplo n.º 6
0
void ExchangeDownload::handleRecurrence(QString uid)
{
    // kdDebug() << "Handling recurrence info for uid=" << uid << endl;
    QString query =
        "SELECT \"DAV:href\", \"urn:schemas:calendar:instancetype\"\r\n"
        "FROM Scope('shallow traversal of \"\"')\r\n"
        "WHERE \"urn:schemas:calendar:uid\" = '" + uid + "'\r\n"
        " AND (\"urn:schemas:calendar:instancetype\" = 1)\r\n";
    //        "      OR \"urn:schemas:calendar:instancetype\" = 3)\r\n" // FIXME: exception are not handled

    // kdDebug() << "Exchange master query: " << endl << query << endl;

    increaseDownloads();

    KIO::DavJob *job = KIO::davSearch(mAccount->calendarURL(), "DAV:", "sql",
                                      query, false);
    KIO::Scheduler::scheduleJob(job);
    job->setWindow(mWindow);
    connect(job, SIGNAL(result(KIO::Job *)),
            SLOT(slotMasterResult(KIO::Job *)));
}