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


C++ KUrl类代码示例

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


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

示例1: totalSize

void TrashProtocol::listRoot()
{
    INIT_IMPL;
    const TrashedFileInfoList lst = impl.list();
    totalSize( lst.count() );
    KIO::UDSEntry entry;
    createTopLevelDirEntry( entry );
    listEntry( entry, false );
    for ( TrashedFileInfoList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) {
        const KUrl url = TrashImpl::makeURL( (*it).trashId, (*it).fileId, QString() );
        KUrl origURL;
        origURL.setPath( (*it).origPath );
        entry.clear();
        const QString fileDisplayName = (*it).fileId;
        if ( createUDSEntry( (*it).physicalPath, fileDisplayName, url.fileName(), entry, *it ) )
            listEntry( entry, false );
    }
    entry.clear();
    listEntry( entry, true );
    finished();
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:21,代码来源:kio_trash.cpp

示例2: foreach

bool
AmpacheServiceFactory::possiblyContainsTrack(const KUrl & url) const
{
    AmpacheConfig config;
    foreach( const AmpacheServerEntry &server, config.servers() )
    {
        if ( url.url().contains( server.url, Qt::CaseInsensitive ) )
            return true;
    }

    return false;
}
开发者ID:weiligang512,项目名称:apue-test,代码行数:12,代码来源:AmpacheService.cpp

示例3: KUrl

bool Document::getURL( const QString &types )
{
	KUrl url = KFileDialog::getSaveUrl( KUrl(), types, KTechlab::self(), i18n("Save Location"));
	
	if ( url.isEmpty() ) return false;
	
	if ( QFile::exists( url.path() ) )
	{
		int query = KMessageBox::warningYesNo( KTechlab::self(),
			   i18n( "A file named \"%1\" already exists. Are you sure you want to overwrite it?" ).arg( url.fileName() ),
			   i18n( "Overwrite File?" ),
			   //i18n( "Overwrite" ),
			   KStandardGuiItem::cancel() );
		if ( query == KMessageBox::No )
			return false;
	}
	
	setURL(url);
	
	return true;
}
开发者ID:ktechlab,项目名称:ktechlab-0.3,代码行数:21,代码来源:document.cpp

示例4: config

    ScanFolder::ScanFolder(ScanThread* scanner, const KUrl& dir, bool recursive)
        : scanner(scanner),
          scan_directory(dir),
          watch(0),
          recursive(recursive)
    {
        bt::Out(SYS_SNF | LOG_NOTICE) << "ScanFolder: scanning " << dir << endl;

        KConfigGroup config(KGlobal::config(), "DirWatch");
        config.writeEntry("NFSPollInterval", 5000);
        config.writeEntry("nfsPreferredMethod", "Stat"); // Force the usage of Stat method for NFS
        config.sync();

        watch = new KDirWatch(this);
        connect(watch, SIGNAL(dirty(QString)), this, SLOT(scanDir(QString)));
        connect(watch, SIGNAL(created(QString)), this, SLOT(scanDir(QString)));

        watch->addDir(dir.toLocalFile(), recursive ? KDirWatch::WatchSubDirs : KDirWatch::WatchDirOnly);

        scanner->addDirectory(dir.toLocalFile(), recursive);
    }
开发者ID:dreamsxin,项目名称:ktorrent,代码行数:21,代码来源:scanfolder.cpp

示例5: AlarmResource

KAResourceRemote::KAResourceRemote(Type type, const KUrl& downloadUrl, const KUrl& uploadUrl)
	: AlarmResource(type),
	  mDownloadUrl(downloadUrl),
	  mUploadUrl(uploadUrl.isEmpty() ? mDownloadUrl : uploadUrl),
	  mDownloadJob(0),
	  mUploadJob(0),
	  mShowProgress(false),
	  mUseCacheFile(false),
	  mRemoteReadOnly(false)
{
	init();
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:12,代码来源:resourceremote.cpp

示例6:

SecurityOrigin::SecurityOrigin(const KUrl& url) :
      m_protocol(url.protocol().toLower())
    , m_host(url.host().toLower())
    , m_port(url.port())
    , m_domainWasSetInDOM(false)
    , m_isUnique(false)
{
    // These protocols do not create security origins; the owner frame provides the origin
    if (m_protocol == "about" || m_protocol == "javascript")
        m_protocol = "";

    // For edge case URLs that were probably misparsed, make sure that the origin is unique.
    if (m_host.isEmpty() && KProtocolInfo::protocolClass(m_protocol) == QLatin1String(":internet"))
        m_isUnique = true;

    // document.domain starts as m_host, but can be set by the DOM.
    m_domain = m_host;

    if (url.port() == -1 || isDefaultPortForProtocol(m_port, m_protocol))
        m_port = 0;
}
开发者ID:vasi,项目名称:kdelibs,代码行数:21,代码来源:security_origin.cpp

示例7: RenameTargetImageFile

QString BatchProcessImagesDialog::RenameTargetImageFile(QFileInfo* fi)
{
    QString Temp;
    int Enumerator = 0;
    KUrl NewDestUrl;

    do
    {
        ++Enumerator;
        Temp = Temp.setNum(Enumerator);
        NewDestUrl = fi->filePath().left(fi->filePath().lastIndexOf('.', -1)) + '_' + Temp + '.'
                     + fi->filePath().section('.', -1);
    }
    while (Enumerator < 100 &&
           KIO::NetAccess::exists(NewDestUrl, KIO::NetAccess::SourceSide, kapp->activeWindow()) == true);

    if (Enumerator == 100)
        return QString();

    return (NewDestUrl.path());
}
开发者ID:rickysarraf,项目名称:digikam,代码行数:21,代码来源:batchprocessimagesdialog.cpp

示例8: highlightedFileTreeViewItem

void ScanGallery::slotImportFile()
{
    FileTreeViewItem *curr = highlightedFileTreeViewItem();
    if( ! curr ) return;

    KUrl impTarget = curr->url();

    if( ! curr->isDir() )
    {
        FileTreeViewItem *pa = static_cast<FileTreeViewItem*>(curr->parent());
        impTarget = pa->url();
    }
    kDebug() << "Importing to" << impTarget;

    KUrl impUrl = KFileDialog::getImageOpenUrl(KUrl("kfiledialog:///importImage"), this, i18n("Import Image File to Gallery"));
    if (impUrl.isEmpty()) return;

    impTarget.addPath(impUrl.fileName());		// append the name of the sourcefile to the path
    m_nextUrlToShow = impTarget;
    ImgSaver::copyImage(impUrl, impTarget);
}
开发者ID:KDE,项目名称:kooka,代码行数:21,代码来源:scangallery.cpp

示例9: open

void PhotoLayoutsEditor::open(const KUrl & fileUrl)
{
    if (m_canvas && m_canvas->file() == fileUrl)
        return;

    if (fileUrl.isValid())
    {
        closeDocument();
        createCanvas(fileUrl);
        refreshActions();
    }
}
开发者ID:tejastank,项目名称:kipi-plugins,代码行数:12,代码来源:photolayoutseditor.cpp

示例10: LoadFailure

/**
 * This constructor can be used to load previously translated and saved unit:
 * the typical way is to load a PCH files
 */
TranslationUnit::TranslationUnit(
    CXIndex index
  , const KUrl& filename_url
  )
  : m_filename(filename_url.toLocalFile().toUtf8())
  , m_unit(clang_createTranslationUnit(index, m_filename.constData()))
{
    if (!m_unit)
        throw Exception::LoadFailure(
            i18nc("@item:intext", "Fail to load a preparsed file").toAscii().constData()
          );
}
开发者ID:zaufi,项目名称:kate-cpp-helper-plugin,代码行数:16,代码来源:translation_unit.cpp

示例11: update

void unsaved_files_list::update(const KUrl& file, const QString& text)
{
    if (!m_updating)
        initiate_updating();

    assert("Sanity check" && m_updating);
    assert("Sanity check" && !file.toLocalFile().isEmpty());

    auto it = m_index.find(file);
    if (it == end(m_index))                                 // Is it in a primary index already?
    {                                                       // (prevent double update)
        // No! Try to find it in a previous generation
        it = m_index_prev.find(file);
        if (it == end(m_index_prev))
        {
            // That is really new file: add content to the storage
            auto entry_it = m_unsaved_files.emplace(
                end(m_unsaved_files)
              , file.toLocalFile().toUtf8()
              , text.toUtf8()
              );
            // ... and update the primary index
            m_index.emplace(file, entry_it);
        }
        else
        {
            // Ok, lets set a new content to previously existed file
            auto tmp = text.toUtf8();
            it->second->second.swap(tmp);
            m_index.emplace(file, it->second);
        }
    }
    else
    {
        // Huh, file already in the new/updated index,
        // so lets update the content again
        auto tmp = text.toUtf8();
        it->second->second.swap(tmp);
    }
}
开发者ID:luislezcair,项目名称:kate-cpp-helper-plugin,代码行数:40,代码来源:unsaved_files_list.cpp

示例12: make_webdav_destination_env

/*
 这个函数是webdav的辅助函数。
 检查webdav的destination头,把destination解析,别名映射检查,并检查扩展映射。
 如果成功,则会把注册变量DAV_DESTINATION,映射到物理地址上。
 */
bool make_webdav_destination_env(KHttpRequest *rq, KRedirect *rd,
		KEnvInterface *env, bool chrooted) {
	bool make_result = false;
	size_t skip_length = 0;
	if (chrooted && rq->svh) {
		skip_length = rq->svh->vh->doc_root.size() - 1;
	}
	KHttpHeader *av = rq->parser.getHeaders();
	while (av) {
		if (is_attr(av, "Destination")) {
			KUrl url;
			memset(&url, 0, sizeof(url));
			char *val = xstrdup(av->val);
			url_decode(val, 0, &url);
			if (parse_url(val, &url)) {
				KFileName file;
				char *tripedDir = file.tripDir2(url.path, PATH_SPLIT_CHAR);
				char *new_path = rq->svh->vh->alias(TEST(rq->workModel,WORK_MODEL_INTERNAL)>0,tripedDir);
				//bool result;
				if (new_path) {
					file.giveName(new_path);
				} else {
					file.setName(rq->svh->vh->doc_root.c_str(),
							tripedDir, rq->getFollowLink());
				}
				xfree(tripedDir);
				if (rq->svh->vh->isPathRedirect(rq, &file, true, rd)) {
					//todo register env
					env->addEnv("DAV_DESTINATION", file.getName() + skip_length);
					make_result = true;
				}
			}
			url.destroy();
			xfree(val);
			break;
		}
		av = av->next;
	}
	return make_result;
}
开发者ID:andrew-morris,项目名称:kangle,代码行数:45,代码来源:HttpCore.cpp

示例13: xml

void
CoverFetchInfoPayload::prepareDiscogsUrls( const QByteArray &data )
{
    QXmlStreamReader xml( QString::fromUtf8(data) );
    while( !xml.atEnd() && !xml.hasError() )
    {
        xml.readNext();
        if( xml.isStartElement() && xml.name() == "searchresults" )
        {
            while( !xml.atEnd() && !xml.hasError() )
            {
                xml.readNext();
                const QStringRef &n = xml.name();
                if( xml.isEndElement() && n == "searchresults" )
                    break;
                if( !xml.isStartElement() )
                    continue;
                if( n == "result" )
                {
                    while( !xml.atEnd() && !xml.hasError() )
                    {
                        xml.readNext();
                        if( xml.isEndElement() && n == "result" )
                            break;
                        if( !xml.isStartElement() )
                            continue;
                        if( xml.name() == "uri" )
                        {
                            KUrl releaseUrl( xml.readElementText() );
                            QString releaseStr = releaseUrl.url( KUrl::RemoveTrailingSlash );
                            QString releaseId = releaseStr.split( '/' ).last();

                            KUrl url;
                            url.setScheme( "http" );
                            url.setHost( "www.discogs.com" );
                            url.setPath( "/release/" + releaseId );
                            url.addQueryItem( "api_key", Amarok::discogsApiKey() );
                            url.addQueryItem( "f", "xml" );

                            CoverFetch::Metadata metadata;
                            metadata[ "source" ] = "Discogs";

                            if( url.isValid() )
                                m_urls.insert( url, metadata );
                        }
                        else
                            xml.skipCurrentElement();
                    }
                }
                else
                    xml.skipCurrentElement();
            }
        }
    }
}
开发者ID:ErrAza,项目名称:amarok,代码行数:55,代码来源:CoverFetchUnit.cpp

示例14: KFileWidget

KexiFileWidget::KexiFileWidget(
    const KUrl &startDirOrVariable, Mode mode, QWidget *parent)
        :  KFileWidget(startDirOrVariable, parent)
        , d(new Private())
{
    kDebug() << startDirOrVariable.scheme();
    if (startDirOrVariable.protocol() == "kfiledialog") {
        KFileDialog::getStartUrl(startDirOrVariable, d->recentDirClass);
    }
    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    setMode(mode);
    QAction *previewAction = actionCollection()->action("preview");
    if (previewAction)
        previewAction->setChecked(false);

    //setMinimumHeight(100);
    //setSizeGripEnabled ( false );

    //dirty hack to customize filedialog view:
    /* {
        QList<QPushButton*> l = findChildren<QPushButton*>();
        foreach (QPushButton* btn, l)
          btn->hide();
        QList<QWidget*> wl = findChildren<QWidget*>();
        foreach (QWidget* w, wl)
          w->installEventFilter(this);
      } */

    /* Qt4
    #ifdef Q_WS_WIN
      if (startDirOrVariable.startsWith(":"))
        m_lastVisitedPathsVariable = startDirOrVariable; //store for later use
    #else*/
// toggleSpeedbar(false);
    setFocusProxy(locationEdit());
//#endif

    connect(this, SIGNAL(fileHighlighted(QString)),
            this, SLOT(slotExistingFileHighlighted(QString)));
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:40,代码来源:KexiFileWidget.cpp

示例15: thread_getProjectFiles

static KUrl::List thread_getProjectFiles(const KUrl dir, bool recursive, const QStringList include,
                                         const QStringList exlude, volatile bool &abort)
{
    ///@todo This is not thread-safe!
    KDevelop::IProject *project = KDevelop::ICore::self()->projectController()->findProjectForUrl( dir );
    KUrl::List res;
    if(!project)
        return res;

    const QSet<IndexedString> fileSet = project->fileSet();
    foreach( const IndexedString &item, fileSet )
    {
        if(abort)
            break;
        KUrl url = item.toUrl();
        if( !url.equals(dir) )
        {
            if( recursive && !dir.isParentOf(url) )
                continue;
            if( !recursive && !url.upUrl().equals(dir, KUrl::CompareWithoutTrailingSlash))
                continue;
        }
        if( QDir::match(include, url.fileName()) && !QDir::match(exlude, url.toLocalFile()) )
            res << url;
    }

    return res;
}
开发者ID:caidongyun,项目名称:kdevplatform,代码行数:28,代码来源:grepfindthread.cpp


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