当前位置: 首页>>代码示例>>C++>>正文


C++ KUrl::addPath方法代码示例

本文整理汇总了C++中KUrl::addPath方法的典型用法代码示例。如果您正苦于以下问题:C++ KUrl::addPath方法的具体用法?C++ KUrl::addPath怎么用?C++ KUrl::addPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KUrl的用法示例。


在下文中一共展示了KUrl::addPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: listDir

void RemoteProtocol::listDir(const KUrl &url)
{
	kDebug(1220) << "RemoteProtocol::listDir: " << url;

	if ( url.path().length() <= 1 )
	{
		listRoot();
		return;
	}

	int second_slash_idx = url.path().indexOf( '/', 1 );
	const QString root_dirname = url.path().mid( 1, second_slash_idx-1 );

	KUrl target = m_impl.findBaseURL( root_dirname );
	kDebug(1220) << "possible redirection target : " << target;
	if( target.isValid() )
	{
		if ( second_slash_idx < 0 ) {
			second_slash_idx = url.path().size();
		}
		target.addPath( url.path().remove(0, second_slash_idx) );
		kDebug(1220) << "complete redirection target : " << target;
		redirection(target);
		finished();
		return;
	}

	error(KIO::ERR_MALFORMED_URL, url.prettyUrl());
}
开发者ID:fluxer,项目名称:kde-workspace,代码行数:29,代码来源:kio_remote.cpp

示例2: restore

void TrashProtocol::restore( const KUrl& trashURL )
{
    int trashId;
    QString fileId, relativePath;
    bool ok = TrashImpl::parseURL( trashURL, trashId, fileId, relativePath );
    if ( !ok ) {
        error( KIO::ERR_SLAVE_DEFINED, i18n( "Malformed URL %1", trashURL.prettyUrl() ) );
        return;
    }
    TrashedFileInfo info;
    ok = impl.infoForFile( trashId, fileId, info );
    if ( !ok ) {
        error( impl.lastErrorCode(), impl.lastErrorMessage() );
        return;
    }
    KUrl dest;
    dest.setPath( info.origPath );
    if ( !relativePath.isEmpty() )
        dest.addPath( relativePath );

    // Check that the destination directory exists, to improve the error code in case it doesn't.
    const QString destDir = dest.directory();
    KDE_struct_stat buff;
    if ( KDE_lstat( QFile::encodeName( destDir ), &buff ) == -1 ) {
        error( KIO::ERR_SLAVE_DEFINED,
               i18n( "The directory %1 does not exist anymore, so it is not possible to restore this item to its original location. "
                     "You can either recreate that directory and use the restore operation again, or drag the item anywhere else to restore it.", destDir ) );
        return;
    }

    copyOrMove( trashURL, dest, false /*overwrite*/, Move );
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:32,代码来源:kio_trash.cpp

示例3: slotDocbookGenerationFinished

void DocbookGenerator::slotDocbookGenerationFinished(const QString& tmpFileName)
{
    uDebug() << "Generation Finished" << tmpFileName;
    KUrl url = umlDoc->url();
    QString fileName = url.fileName();
    fileName.replace(QRegExp(".xmi$"),".docbook");
    url.setPath(m_destDir.path());
    url.addPath(fileName);

    KIO::Job* job = KIO::file_copy(KUrl::fromPath(tmpFileName), url, -1, KIO::Overwrite | KIO::HideProgressInfo);
    if ( KIO::NetAccess::synchronousRun( job, (QWidget*)UMLApp::app() ) ) {
        umlDoc->writeToStatusBar(i18n("Docbook Generation Complete..."));
        m_pStatus = true;
    } else {
        umlDoc->writeToStatusBar(i18n("Docbook Generation Failed..."));
        m_pStatus = false;
    }

    while ( m_pThreadFinished == false ) {
        // wait for thread to finish
        qApp->processEvents();
    }

    emit finished(m_pStatus);
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:25,代码来源:docbookgenerator.cpp

示例4: slotUrlsDropped

void ScanGallery::slotUrlsDropped(QDropEvent *ev, FileTreeViewItem *item)
{
    KUrl::List urls = ev->mimeData()->urls();
    if (urls.isEmpty()) return;

    kDebug() << "onto" << (item==NULL ? "NULL" : item->url().prettyUrl())
             << "srcs" << urls.count() << "first" << urls.first();
    
    if (item==NULL) return;
    KUrl dest = item->url();

    // Check whether the drop is on top of a directory (in which case we
    // want to move/copy into it) or a file (move/copy into its containing
    // directory).
    if (!item->isDir()) dest.setFileName(QString::null);
    dest.adjustPath(KUrl::AddTrailingSlash);
    kDebug() << "resolved destination" << dest;

    // Make the last URL to copy the one to select next
    KUrl nextSel = dest;
    nextSel.addPath(urls.back().fileName(KUrl::ObeyTrailingSlash));
    m_nextUrlToShow = nextSel;

    KIO::Job *job;
    // TODO: top level window as 3rd parameter?
    if (ev->dropAction()==Qt::MoveAction) job = KIO::move(urls, dest);
    else job = KIO::copy(urls, dest);
    connect(job, SIGNAL(result(KJob *)), SLOT(slotJobResult(KJob *)));
}
开发者ID:KDE,项目名称:kooka,代码行数:29,代码来源:scangallery.cpp

示例5: extractTemplate

void TemplatePage::extractTemplate()
{
    QModelIndex index = ui->treeView->currentIndex();
    QString archiveName= ui->treeView->model()->data(index, KDevelop::TemplatesModel::ArchiveFileRole).toString();

    QFileInfo info(archiveName);
    if (!info.exists())
    {
        ui->extractButton->setEnabled(false);
        return;
    }

    QScopedPointer<KArchive> archive;
    if (info.suffix() == QLatin1String("zip"))
    {
        archive.reset(new KZip(archiveName));
    }
    else
    {
        archive.reset(new KTar(archiveName));
    }

    archive->open(QIODevice::ReadOnly);

    KUrl destination = KUrl::fromLocalFile(KFileDialog::getExistingDirectory());
    destination.addPath(info.baseName());
    archive->directory()->copyTo(destination.toLocalFile());
}
开发者ID:caidongyun,项目名称:kdevplatform,代码行数:28,代码来源:templatepage.cpp

示例6: buildUrl

KUrl LaconicaSearch::buildUrl(const SearchInfo &searchInfo,
                              ChoqokId sinceStatusId, uint count, uint page)
{
    kDebug();

    QString formattedQuery;
    switch ( searchInfo.option ) {
        case ToUser:
            formattedQuery = searchInfo.query + "/replies/rss";
            break;
        case FromUser:
            formattedQuery = searchInfo.query + "/rss";
            break;
        case ReferenceGroup:
            formattedQuery = "group/" + searchInfo.query + "/rss";
            break;
        case ReferenceHashtag:
            formattedQuery = searchInfo.query;
            break;
        default:
            formattedQuery = searchInfo.query + "/rss";
            break;
    };

    KUrl url;
    TwitterApiAccount *theAccount = qobject_cast<TwitterApiAccount*>(searchInfo.account);
    Q_ASSERT(theAccount);
    if( searchInfo.option == ReferenceHashtag ) {
        url = theAccount->apiUrl();
        url.addPath("/search.atom");
        url.addQueryItem("q", formattedQuery);
        if( !sinceStatusId.isEmpty() )
            url.addQueryItem( "since_id", sinceStatusId );
        int cntStr = Choqok::BehaviorSettings::countOfPosts();
        if( count && count <= 100 )
            cntStr =  count;
        url.addQueryItem( "rpp", QString::number(cntStr) );
        if( page > 1 )
            url.addQueryItem( "page", QString::number( page ) );
    } else {
        url = theAccount->apiUrl().url(KUrl::AddTrailingSlash).remove("api/", Qt::CaseInsensitive);
        url.addPath( formattedQuery );
    }
    return url;
}
开发者ID:Boris-de,项目名称:choqok,代码行数:45,代码来源:laconicasearch.cpp

示例7: isValidDirectory

bool CvsProxy::isValidDirectory(KUrl dirPath) const
{
    QFileInfo fsObject( dirPath.toLocalFile() );
    if( !fsObject.isDir() )
        dirPath.setFileName( QString() );

    dirPath.addPath( "CVS" );
    fsObject.setFile( dirPath.toLocalFile() );
    return fsObject.exists();
}
开发者ID:caidongyun,项目名称:kdevplatform,代码行数:10,代码来源:cvsproxy.cpp

示例8: processFile

QString DirSortPlugin::processFile( BatchRenamer* b, int index, const QString &, EPluginType )
{
    QString errorMsg = QString::null;

    if( index == 0 )
    {
        // Initialize plugin
        m_dirCounter = m_widget->spinStart->value();
        m_fileCounter = 0;
        m_filesPerDir = m_widget->spinFiles->value();
        m_digits = m_widget->spinDigits->value();
        m_baseDirectory = m_widget->outputUrl->url();

        if( !KIO::NetAccess::exists( m_baseDirectory, true, m_widget->spinStart ) ) 
        {
            m_valid = false;
            return this->name() + 
                i18n(": The output directory %1 does not exist.", 
                     m_baseDirectory.prettyUrl() ); 
        }
        else 
        {
            m_valid = true;

            m_currentDirectory = createNewSubdirectory();
        }
    }
    
    if( !m_valid ) 
        return errorMsg;

    if( m_fileCounter == m_filesPerDir ) 
    {
        m_fileCounter = 0;
        m_dirCounter++;

        m_currentDirectory = createNewSubdirectory();
    }

    KUrl srcUrl = b->buildDestinationUrl( (*b->files())[index] );
    KUrl dstUrl = m_currentDirectory;
    dstUrl.addPath( srcUrl.fileName() );
    KIO::JobFlags flags = KIO::DefaultFlags | KIO::HideProgressInfo;
    KIO::Job* job = KIO::file_move( srcUrl, dstUrl, -1, flags );
    m_fileCounter++;
    if( m_valid && job && !KIO::NetAccess::synchronousRun( job, m_widget->spinStart ) ) 
    {
        errorMsg = i18n("Error renaming %2 (to %1)", 
                        dstUrl.prettyUrl(), 
                        srcUrl.prettyUrl());
    } 

    return errorMsg;
}
开发者ID:inactivist,项目名称:Krename,代码行数:54,代码来源:dirsortplugin.cpp

示例9: exportImageToTmpDir

void KPrHtmlExport::exportImageToTmpDir()
{
    // Export slides as image into the temporary export directory
    KUrl fileUrl;
    for(int i=0; i < m_parameters.slides.size(); ++i){
        fileUrl = m_tmpDirPath;
        fileUrl.addPath(QString("slide%1.png").arg(i));
        KoPAPageBase *slide = m_parameters.slides.at(i);
        m_parameters.kprView->exportPageThumbnail(slide,fileUrl, slide->size().toSize(), "PNG", -1);
    }
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:11,代码来源:KPrHtmlExport.cpp

示例10: isVersionControlled

bool CvsProxy::isVersionControlled(KUrl filePath) const
{
    QFileInfo fsObject( filePath.toLocalFile() );
    if( !fsObject.isDir() )
        filePath.setFileName( QString() );

    filePath.addPath( "CVS" );
    QFileInfo cvsObject( filePath.toLocalFile() );
    if( !cvsObject.exists() )
        return false;

    if( fsObject.isDir() )
        return true;

    filePath.addPath( "Entries" );
    QFile cvsEntries( filePath.toLocalFile() );
    cvsEntries.open( QIODevice::ReadOnly );
    QString cvsEntriesData = cvsEntries.readAll();
    cvsEntries.close();
    return ( cvsEntriesData.indexOf( fsObject.fileName() ) != -1 );
}
开发者ID:caidongyun,项目名称:kdevplatform,代码行数:21,代码来源:cvsproxy.cpp

示例11: buildTimelineQuery

// only used for the queries
bool Nepomuk2::TimelineProtocol::rewriteUrl( const KUrl& url, KUrl& newURL )
{
    if ( parseTimelineUrl( url, &m_date, &m_filename ) == DayFolder ) {
        newURL = buildTimelineQuery( m_date ).toSearchUrl();
        newURL.addPath( m_filename );
        kDebug() << url << newURL;
        return true;
    }
    else {
        return false;
    }
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:13,代码来源:kio_timeline.cpp

示例12: slotHtmlGenerated

/**
 * Triggered when the copying of the HTML result file is finished.
 * Emits the signal finished().
 * @param tmpFileName   temporary file name
 */
void XhtmlGenerator::slotHtmlGenerated(const QString& tmpFileName)
{
    uDebug() << "HTML Generated " << tmpFileName;
    KUrl url = m_umlDoc->url();
    QString fileName = url.fileName();
    fileName.replace(QRegExp(".xmi$"),".html");
    url.setPath(m_destDir.path());
    url.addPath(fileName);

    KIO::Job* htmlCopyJob = KIO::file_copy( KUrl::fromPath( tmpFileName ), url, -1, KIO::Overwrite | KIO::HideProgressInfo );
    if ( KIO::NetAccess::synchronousRun( htmlCopyJob, (QWidget*)UMLApp::app() ) ) {
        m_umlDoc->writeToStatusBar(i18n("XHTML Generation Complete..."));
    } else {
        m_pStatus = false;
        return;
    }

    m_umlDoc->writeToStatusBar(i18n("Copying CSS..."));

    QString cssFileName(KGlobal::dirs()->findResource("appdata","xmi.css"));
    KUrl cssUrl = m_destDir;
    cssUrl.addPath("xmi.css");
    KIO::Job* cssJob = KIO::file_copy(cssFileName,cssUrl,-1, KIO::Overwrite | KIO::HideProgressInfo );

    if ( KIO::NetAccess::synchronousRun( cssJob, (QWidget*)UMLApp::app() ) ) {
        m_umlDoc->writeToStatusBar(i18n("Finished Copying CSS..."));
        m_pStatus = true;
    } else {
        m_umlDoc->writeToStatusBar(i18n("Failed Copying CSS..."));
        m_pStatus = false;
    }

    while ( m_pThreadFinished == false ) {
        // wait for thread to finish
        qApp->processEvents();
    }

    emit finished( m_pStatus );
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:44,代码来源:xhtmlgenerator.cpp

示例13: getConfigFilePath

bool HgConfig::getConfigFilePath()
{
    switch (m_configType) {
    case RepoConfig:
        {
            KUrl repoBase = KUrl(HgWrapper::instance()->getBaseDir());
            repoBase.addPath(QLatin1String(".hg/hgrc"));
            m_configFilePath = repoBase.path();
            break;
        }
    case GlobalConfig:
        {
            KUrl homeUrl = KUrl(QDir::homePath());
            homeUrl.addPath(QLatin1String(".hgrc"));
            m_configFilePath = homeUrl.path();
            break;
        }
    case TempConfig:
        break;
    }
    return true;
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:22,代码来源:hgconfig.cpp

示例14: slotShowOriginalFile

void KonqPopupMenuPrivate::slotShowOriginalFile()
{
    const KFileItem item = m_popupItemProperties.items().first();
    const QString dest = item.linkDest();
    KUrl destUrl = m_sViewURL;
    if (dest.startsWith('/')) {
        destUrl.setPath(dest);
    } else {
        destUrl.addPath(dest);
    }
    // Now destUrl points to the target file, let's go up to parent dir
    destUrl.setPath(destUrl.directory());
    KRun::runUrl(destUrl, "inode/directory", m_parentWidget);
}
开发者ID:blue-shell,项目名称:folderview,代码行数:14,代码来源:konq_popupmenu.cpp

示例15: createNewSubdirectory

KUrl DirSortPlugin::createNewSubdirectory() const
{
    KUrl url = m_baseDirectory;

    QString dir;
    dir.sprintf("%0*i", m_digits, m_dirCounter );
    url.addPath( dir );

    if( !KIO::NetAccess::mkdir( url, m_widget->spinStart ) ) {
        KMessageBox::error( m_widget->spinStart, 
                            i18n("Cannot create directory %1", url.prettyUrl()) );
    }
    
    return url;    
}
开发者ID:inactivist,项目名称:Krename,代码行数:15,代码来源:dirsortplugin.cpp


注:本文中的KUrl::addPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。