本文整理汇总了C++中KHTMLView::topLevelWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ KHTMLView::topLevelWidget方法的具体用法?C++ KHTMLView::topLevelWidget怎么用?C++ KHTMLView::topLevelWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KHTMLView
的用法示例。
在下文中一共展示了KHTMLView::topLevelWidget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cookie
DOMString HTMLDocumentImpl::cookie() const
{
long windowId = 0;
KHTMLView *v = view();
if(v && v->topLevelWidget())
windowId = v->topLevelWidget()->winId();
QCString replyType;
QByteArray params, reply;
QDataStream stream(params, IO_WriteOnly);
stream << URL().url() << windowId;
if(!kapp->dcopClient()->call("kcookiejar", "kcookiejar", "findDOMCookies(QString,long int)", params, replyType, reply))
{
kdWarning(6010) << "Can't communicate with cookiejar!" << endl;
return DOMString();
}
QDataStream stream2(reply, IO_ReadOnly);
if(replyType != "QString")
{
kdError(6010) << "DCOP function findDOMCookies(...) returns " << replyType << ", expected QString" << endl;
return DOMString();
}
QString result;
stream2 >> result;
return DOMString(result);
}
示例2: setCookie
void HTMLDocumentImpl::setCookie(const DOMString &value)
{
long windowId = 0;
KHTMLView *v = view();
if(v && v->topLevelWidget())
windowId = v->topLevelWidget()->winId();
QByteArray params;
QDataStream stream(params, IO_WriteOnly);
QCString fake_header("Set-Cookie: ");
fake_header.append(value.string().latin1());
fake_header.append("\n");
stream << URL().url() << fake_header << windowId;
if(!kapp->dcopClient()->send("kcookiejar", "kcookiejar", "addCookies(QString,QCString,long int)", params))
{
// Maybe it wasn't running (e.g. we're opening local html files)
KApplication::startServiceByDesktopName("kcookiejar");
if(!kapp->dcopClient()->send("kcookiejar", "kcookiejar", "addCookies(QString,QCString,long int)", params))
kdWarning(6010) << "Can't communicate with cookiejar!" << endl;
}
}