void KCookiesManagement::getCookies(QListViewItem *cookieDom)
{
    CookieListViewItem *ckd = static_cast< CookieListViewItem * >(cookieDom);
    if(ckd->cookiesLoaded())
        return;

    QValueList< int > fields;
    fields << 0 << 1 << 2 << 3;

    DCOPReply reply = DCOPRef("kded", "kcookiejar")
                          .call("findCookies", DCOPArg(fields, "QValueList<int>"), ckd->domain(), QString::null, QString::null, QString::null);
    if(reply.isValid())
    {
        QStringList fieldVal = reply;
        QStringList::Iterator fIt = fieldVal.begin();

        while(fIt != fieldVal.end())
        {
            CookieProp *details = new CookieProp;
            details->domain = *fIt++;
            details->path = *fIt++;
            details->name = *fIt++;
            details->host = *fIt++;
            details->allLoaded = false;
            new CookieListViewItem(cookieDom, details);
        }

        static_cast< CookieListViewItem * >(cookieDom)->setCookiesLoaded();
    }
}
bool KCookiesManagement::cookieDetails(CookieProp *cookie)
{
    QValueList< int > fields;
    fields << 4 << 5 << 7;

    DCOPReply reply = DCOPRef("kded", "kcookiejar")
                          .call("findCookies", DCOPArg(fields, "QValueList<int>"), cookie->domain, cookie->host, cookie->path, cookie->name);
    if(!reply.isValid())
        return false;

    QStringList fieldVal = reply;

    QStringList::Iterator c = fieldVal.begin();
    cookie->value = *c++;
    unsigned tmp = (*c++).toUInt();

    if(tmp == 0)
        cookie->expireDate = i18n("End of session");
    else
    {
        QDateTime expDate;
        expDate.setTime_t(tmp);
        cookie->expireDate = KGlobal::locale()->formatDateTime(expDate);
    }

    tmp = (*c).toUInt();
    cookie->secure = i18n(tmp ? "Yes" : "No");
    cookie->allLoaded = true;
    return true;
}
Esempio n. 3
0
void K3bExporter::exportViaDCOP( const KURL::List &urls, DCOPRef &ref, int openmode )
{
    QValueList<DCOPRef> projectList;
    DCOPReply projectListReply = ref.call("projects()");

    if( !projectListReply.get<QValueList<DCOPRef> >(projectList, "QValueList<DCOPRef>") ) {
        DCOPErrorMessage();
        return;
    }

    if( projectList.count() == 0 && !startNewK3bProject(ref, openmode) )
        return;

    if( !ref.send( "addUrls(KURL::List)", DCOPArg(urls, "KURL::List") ) ) {
        DCOPErrorMessage();
        return;
    }
}