本文整理汇总了C++中KUrl::cd方法的典型用法代码示例。如果您正苦于以下问题:C++ KUrl::cd方法的具体用法?C++ KUrl::cd怎么用?C++ KUrl::cd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KUrl
的用法示例。
在下文中一共展示了KUrl::cd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showRSSInfo
void WebTab::showRSSInfo(const QPoint &pos)
{
QWebElementCollection col = page()->mainFrame()->findAllElements("link[type=\"application/rss+xml\"]");
col.append(page()->mainFrame()->findAllElements("link[type=\"application/atom+xml\"]"));
QMap<KUrl, QString> map;
foreach(const QWebElement &el, col)
{
QString urlString;
if (el.attribute("href").startsWith(QL1S("http")))
urlString = el.attribute("href");
else
{
KUrl u = url();
// NOTE
// cd() is probably better than setPath() here,
// for all those url sites just having a path
if (u.cd(el.attribute("href")))
urlString = u.toMimeDataString();
}
QString title = el.attribute("title");
if (title.isEmpty())
title = el.attribute("href");
map.insert(KUrl(urlString), title);
}
示例2: switch
void SieveJob::schedule( Command command ) {
switch ( command ) {
case Get:
kDebug() << "get(" << mUrl.prettyUrl() << ")";
mJob = KIO::get( mUrl );
connect( mJob, SIGNAL(data(KIO::Job*,const QByteArray&)),
SLOT(slotData(KIO::Job*,const QByteArray&)) );
break;
case Put:
kDebug() << "put(" << mUrl.prettyUrl() << ")";
mJob = KIO::put( mUrl, 0600, KIO::Overwrite );
connect( mJob, SIGNAL(dataReq(KIO::Job*,QByteArray&)),
SLOT(slotDataReq(KIO::Job*,QByteArray&)) );
break;
case Activate:
kDebug() << "chmod(" << mUrl.prettyUrl() <<", 0700 )";
mJob = KIO::chmod( mUrl, 0700 );
break;
case Deactivate:
kDebug() << "chmod(" << mUrl.prettyUrl() <<", 0600 )";
mJob = KIO::chmod( mUrl, 0600 );
break;
case SearchActive:
kDebug() << "listDir(" << mUrl.prettyUrl() << ")";
{
KUrl url = mUrl;
QString query = url.query(); //save query part, because KUrl::cd() erases it
if ( !url.fileName().isEmpty() )
url.cd("..");
url.setQuery( query );
kDebug() << "listDir's real URL:" << url.prettyUrl();
mJob = KIO::listDir( url );
connect( mJob, SIGNAL(entries(KIO::Job*,const KIO::UDSEntryList&)),
SLOT(slotEntries(KIO::Job*,const KIO::UDSEntryList&)) );
break;
}
case List:
kDebug() << "listDir(" << mUrl.prettyUrl() << ")";
{
mJob = KIO::listDir( mUrl );
connect( mJob, SIGNAL( entries(KIO::Job *, const KIO::UDSEntryList & ) ),
SLOT( slotEntries( KIO::Job *, const KIO::UDSEntryList & ) ) );
break;
}
case Delete:
kDebug() << "delete(" << mUrl.prettyUrl() << ")";
mJob = KIO::del( mUrl );
break;
default:
assert( 0 );
}
// common to all jobs:
connect( mJob, SIGNAL(result(KJob*)), SLOT(slotResult(KJob*)) );
}