• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ KUrl函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: dialog

void KPrHtmlExportDialog::browserAction()
{
    KFileDialog dialog(KUrl(), QString("*.zip"), this);
    if (dialog.exec() == QDialog::Accepted) {
        if (verifyZipFile(dialog.selectedFile())) {
            QString name (dialog.selectedUrl().fileName());
            if (name.endsWith(QLatin1String(".zip"), Qt::CaseInsensitive)) {
                name.chop(4);
            }
            ui.kcombobox->addItem(name, dialog.selectedFile());
            ui.kcombobox->setCurrentIndex(ui.kcombobox->count() - 1);
        }
        this->updateFavoriteButton();
    }
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:15,代码来源:KPrHtmlExportDialog.cpp


示例2: myDialog

// static
KUrl KDirSelectDialog::selectDirectory( const KUrl& startDir,
                                        bool localOnly,
                                        QWidget *parent,
                                        const QString& caption)
{
    KDirSelectDialog myDialog( startDir, localOnly, parent);

    if ( !caption.isNull() )
        myDialog.setCaption( caption );

    if ( myDialog.exec() == QDialog::Accepted )
        return KIO::NetAccess::mostLocalUrl(myDialog.url(),parent);
    else
        return KUrl();
}
开发者ID:vasi,项目名称:kdelibs,代码行数:16,代码来源:kdirselectdialog.cpp


示例3: QStringList

void KonqPixmapProvider::load( KConfigGroup& kc, const QString& key )
{
    iconMap.clear();
    const QStringList list = kc.readPathEntry( key, QStringList() );
    QStringList::const_iterator it = list.begin();
    QStringList::const_iterator itEnd = list.end();
    while ( it != itEnd ) {
        const QString url (*it);
        if ( (++it) == itEnd )
            break;
        const QString icon (*it);
        iconMap.insert( KUrl( url ), icon );
        ++it;
    }
}
开发者ID:blue-shell,项目名称:folderview,代码行数:15,代码来源:konqpixmapprovider.cpp


示例4: setEncoding

bool KCHMViewWindow_KHTMLPart::openPage (const QString& url)
{
	// Set or change the encoding
	if ( m_currentEncoding != ::mainWindow->chmFile()->currentEncoding()
	&& appConfig.m_advAutodetectEncoding )
	{
		m_currentEncoding = ::mainWindow->chmFile()->currentEncoding();
		setEncoding ( m_currentEncoding->qtcodec, TRUE );
	}
	
	QString fullurl = "ms-its:" + ::mainWindow->getOpenedFileName() + "::" + url;
	KHTMLPart::openUrl ( KUrl(fullurl) );
	
	return true;
}
开发者ID:karatchov,项目名称:kchmviewer-for-Maemo,代码行数:15,代码来源:kchmviewwindow_khtmlpart.cpp


示例5: TRAPD

/**
Test MSdpElementBuilder::BuildURLL()
*/
void CT_DataSdpElementBuilder::DoCmdBuildURLL(MSdpElementBuilder& aElementBuilder, const TDesC& aSection)
{
    iDataWrapper.INFO_PRINTF1(_L("MSdpElementBuilder BuildURLL Call"));

    TPtrC 								theString;
    if( iDataWrapper.GetStringFromConfig(aSection, KUrl(), theString) )
    {
        HBufC8*	theString8=HBufC8::NewLC(theString.Length());
        theString8->Des().Copy(theString);
        TPtrC8	stringPtr = theString8->Des();
        TRAPD(err, aElementBuilder.BuildURLL(stringPtr));
        if(err != KErrNone)
        {
            iDataWrapper.ERR_PRINTF2(_L("MSdpElementBuilder BuildURLL failed with error %d"), err);
            iDataWrapper.SetError(err);
        }
        CleanupStack::PopAndDestroy(theString8);
    }
    else
    {
        iDataWrapper.ERR_PRINTF2(_L("Missing parameter %S"), &KUrl());
        iDataWrapper.SetBlockResult(EFail);
    }
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:27,代码来源:T_DataSdpElementBuilder.cpp


示例6: KUrl

void KOEventPopupMenu::forward()
{
  KOrg::MainWindow *w = ActionManager::findInstance( KUrl() );
  if ( !w || !mCurrentIncidence ) {
    return;
  }

  KActionCollection *ac = w->getActionCollection();
  QAction *action = ac->action( "schedule_forward" );
  if ( action ) {
    action->trigger();
  } else {
    kError() << "What happened to the schedule_forward action?";
  }
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:15,代码来源:koeventpopupmenu.cpp


示例7: kDebug

void ImageTransform::run()
{
    kDebug() << "thread started for operation" << mOperation;

    QImage resultImg;
    QMatrix m;

    switch (mOperation)
    {
case ImageTransform::Rotate90:
        emit statusMessage(i18n("Rotate image +90 degrees"));
        m.rotate(+90);
        resultImg = mImage.transformed(m);
        break;

case ImageTransform::MirrorBoth:
case ImageTransform::Rotate180:
        emit statusMessage(i18n("Rotate image 180 degrees"));
        resultImg = mImage.mirrored(true, true);
        break;

case ImageTransform::Rotate270:
        emit statusMessage(i18n("Rotate image -90 degrees"));
        m.rotate(-90);
        resultImg = mImage.transformed(m);
        break;

case ImageTransform::MirrorHorizontal:
        emit statusMessage(i18n("Mirror image horizontally"));
        resultImg = mImage.mirrored(true, false);
        break;


case ImageTransform::MirrorVertical:
        emit statusMessage(i18n("Mirror image vertically"));
        resultImg = mImage.mirrored(false, true);
        break;

default:
        kDebug() << "Unknown operation" << mOperation;
        break;
    }

    if (resultImg.save(mFileName)) emit done(KUrl(mFileName));
    else emit statusMessage(i18n("Error updating image %1", mFileName));

    kDebug() << "thread finished";
}
开发者ID:KDE,项目名称:kooka,代码行数:48,代码来源:imagetransform.cpp


示例8: KUrl

void KTNEFMain::viewFileAs()
{
  if ( !mView->getSelection().isEmpty() ) {
    KUrl::List list;
    list.append( KUrl( extractTemp( mView->getSelection().first() ) ) );

    if ( !list.isEmpty() ) {
      KRun::displayOpenWithDialog( list, this );
    }
  } else {
    KMessageBox::information(
      this,
      i18nc( "@info",
             "There is no file selected. Please select a file an try again." ) );
  }
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:16,代码来源:ktnefmain.cpp


示例9: i18n

/**
 * Slot for clicked events generated by the export button of the logger.
 * Writes the content of the logger widget to a file.
 */
void CodeGenStatusPage::loggerExport()
{
    const QString caption = i18n("Umbrello Code Generation - Logger Export");
    QString fileName = KFileDialog::getSaveFileName(KUrl(), QString(), 0, caption);
    if (!fileName.isEmpty()) {
        QFile file(fileName);
        if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
            QTextStream out(&file);
            out << ui_textEditLogger->toHtml();
            file.close();
        }
        else {
            KMessageBox::error(this, i18n("Cannot open file!"), caption);
        }
    }
}
开发者ID:behlingc,项目名称:umbrello-behlingc,代码行数:20,代码来源:codegenstatuspage.cpp


示例10: checkNetworkAccess

static bool checkNetworkAccess() {
    if ( s_networkAccess == Unknown ) {
        QTime tm;
        tm.start();
        KIO::Job* job = KIO::get( KUrl( s_iconUrl ), KIO::NoReload, KIO::HideProgressInfo );
        if( KIO::NetAccess::synchronousRun( job, 0 ) ) {
            s_networkAccess = Yes;
            s_downloadTime = tm.elapsed();
	    qDebug( "Network access OK. Download time %d", s_downloadTime );
        } else {
            qWarning( "%s", qPrintable( KIO::NetAccess::lastErrorString() ) );
            s_networkAccess = No;
        }
    }
    return s_networkAccess == Yes;
}
开发者ID:blue-shell,项目名称:folderview,代码行数:16,代码来源:favicontest.cpp


示例11: KUrl

/** First step of three in the download process */
void POTDElement::step1StartDownload()
{
  // Start downloading the picture
  if ( !mFirstStepCompleted && !mFirstStepJob ) {
    KUrl url = KUrl( "http://en.wikipedia.org/w/index.php?title=Template:POTD/" +
                     mDate.toString( Qt::ISODate ) + "&action=raw" );
                // The file at that URL contains the file name for the POTD

    mFirstStepJob = KIO::storedGet( url, KIO::NoReload, KIO::HideProgressInfo );
    KIO::Scheduler::setJobPriority( mFirstStepJob, 1 );

    connect( mFirstStepJob, SIGNAL(result(KJob*)),
             this, SLOT(step1Result(KJob*)) );
    connect( this, SIGNAL(step1Success()),
             this, SLOT(step2GetImagePage()) );
  }
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:17,代码来源:picoftheday.cpp


示例12: KUrl

void CImagePropertiesDialog::set(const QString &file, int width, int height, int pos, bool onWindowBorder)
{
    if(properties&SCALE)
    {
        scaleImage->setChecked(0!=width || 0!=height);
        scaleWidth->setValue(width<MIN_SIZE || width>MAX_SIZE ? DEF_SIZE : width);
        scaleHeight->setValue(height<MIN_SIZE || height>MAX_SIZE ? DEF_SIZE : height);
    }

    if(properties&BORDER)
        onBorder->setChecked(onWindowBorder);
    if(properties&POS)
        posCombo->setCurrentIndex(pos);

    fileRequester->setUrl(QFile::exists(file) && !QFileInfo(file).isDir() ? KUrl(file) : KUrl());
}
开发者ID:Pulfer,项目名称:qtcurve,代码行数:16,代码来源:imagepropertiesdialog.cpp


示例13: slotSaveToFile

void LogView::slotSaveToFile()
{
    QString savePath = KFileDialog::getSaveFileName(KUrl(), "*.txt");

    if (!savePath.isEmpty()) {
        QFile file(savePath);

        if (file.open(QIODevice::WriteOnly)) {
            QTextStream stream(&file);
            stream << toPlainText();
            file.close();
        } else {
            KMessageBox::error(0L, i18n("Unable to open file for writing."));
        }
    }
}
开发者ID:netrunner-debian-kde-extras,项目名称:kftpgrabber,代码行数:16,代码来源:logview.cpp


示例14: KUrl

KUrl OpenSearchEngine::suggestionsUrl(const QString &searchTerm) const
{
    if (m_suggestionsUrlTemplate.isEmpty())
    {
        return KUrl();
    }

    KUrl retVal = KUrl::fromEncoded(parseTemplate(searchTerm, m_suggestionsUrlTemplate).toUtf8());

    QList<Parameter>::const_iterator i;
    for (i = m_suggestionsParameters.constBegin(); i != m_suggestionsParameters.constEnd(); ++i)
    {
        retVal.addQueryItem(i->first, parseTemplate(searchTerm, i->second));
    }
    return retVal;
}
开发者ID:vhonsel,项目名称:rekonq,代码行数:16,代码来源:opensearchengine.cpp


示例15: i18n

void Editor::loadBoard()
{
    if (!testSave()) {
        return;
    }

    KUrl url = KFileDialog::getOpenUrl(KUrl(), i18n("*.layout|Board Layout (*.layout)\n*|All File"
        "s"), this, i18n("Open Board Layout"));

    if (url.isEmpty()) {
            return;
    }

    theBoard.loadBoardLayout(url.path());
    update();
}
开发者ID:jsj2008,项目名称:kdegames,代码行数:16,代码来源:Editor.cpp


示例16: accept

	void PropertiesDlg::accept()
	{
		if (move_on_completion_enabled->isChecked())
		{
			tc->setMoveWhenCompletedDir(move_on_completion_url->url());
		}
		else
		{
			tc->setMoveWhenCompletedDir(KUrl());
		}
		
		tc->setFeatureEnabled(bt::DHT_FEATURE,dht->isChecked());
		tc->setFeatureEnabled(bt::UT_PEX_FEATURE,pex->isChecked());
		tc->setSuperSeeding(superseeding->isChecked());
		QDialog::accept();
	}
开发者ID:ashl1,项目名称:ktorrent-stream,代码行数:16,代码来源:propertiesdlg.cpp


示例17: KDialog

SearchProviderDialog::SearchProviderDialog(SearchProvider *provider, QList<SearchProvider*> &providers, QWidget *parent)
    : KDialog( parent )
    , m_provider(provider)
{
    setModal(true);
    setButtons( Ok | Cancel );

    m_dlg.setupUi(mainWidget());

    m_dlg.leQuery->setMinimumWidth(kapp->fontMetrics().averageCharWidth() * 50);

    connect(m_dlg.leName,      SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(m_dlg.leQuery,     SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(m_dlg.leShortcut,  SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(m_dlg.leShortcut,  SIGNAL(textChanged(QString)), SLOT(shortcutsChanged(QString)));
    connect(m_dlg.pbPaste,     SIGNAL(clicked()),            SLOT(pastePlaceholder()));

    // Data init
    m_providers = providers;
    QStringList charsets = KGlobal::charsets()->availableEncodingNames();
    charsets.prepend(i18nc("@item:inlistbox The default character set", "Default"));
    m_dlg.cbCharset->addItems(charsets);
    if (m_provider)
    {
        setPlainCaption(i18n("Modify Web Shortcut"));
        m_dlg.leName->setText(m_provider->name());
        m_dlg.leQuery->setText(m_provider->query());
        m_dlg.leShortcut->setText(m_provider->keys().join(","));
        m_dlg.cbCharset->setCurrentIndex(m_provider->charset().isEmpty() ? 0 : charsets.indexOf(m_provider->charset()));
        m_dlg.leName->setEnabled(false);
        m_dlg.leQuery->setFocus();
    }
    else
    {
        setPlainCaption(i18n("New Web Shortcut"));
        m_dlg.leName->setFocus();

        //If the clipboard contains a url copy it to the query lineedit
        const QClipboard *clipboard = QApplication::clipboard();
        const QString url = clipboard->text();

        if (!KUrl(url).host().isEmpty())
            m_dlg.leQuery->setText(url);

        enableButton(Ok, false);
    }
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:47,代码来源:searchproviderdlg.cpp


示例18: KFileDialog

void KoPAView::importDocument()
{
    KFileDialog *dialog = new KFileDialog( KUrl("kfiledialog:///OpenDialog"),QString(), this );
    dialog->setObjectName( "file dialog" );
    dialog->setMode( KFile::File );
    if ( d->doc->pageType() == KoPageApp::Slide ) {
        dialog->setCaption(i18n("Import Slideshow"));
    }
    else {
        dialog->setCaption(i18n("Import Document"));
    }

    // TODO make it possible to select also other supported types (then the default format) here.
    // this needs to go via the filters to get the file in the correct format.
    // For now we only support the native mime types
    QStringList mimeFilter;
#if 1
    mimeFilter << KoOdf::mimeType( d->doc->documentType() ) << KoOdf::templateMimeType( d->doc->documentType() );
#else
    mimeFilter = KoFilterManager::mimeFilter( KoDocument::readNativeFormatMimeType(d->doc->componentData()), KoFilterManager::Import,
                                              KoDocument::readExtraNativeMimeTypes() );
#endif

    dialog->setMimeFilter( mimeFilter );
    if (dialog->exec() == QDialog::Accepted) {
        KUrl url(dialog->selectedUrl());
        QString tmpFile;
        if ( KIO::NetAccess::download( url, tmpFile, 0 ) ) {
            QFile file( tmpFile );
            file.open( QIODevice::ReadOnly );
            QByteArray ba;
            ba = file.readAll();

            // set the correct mime type as otherwise it does not find the correct tag when loading
            QMimeData data;
            data.setData( KoOdf::mimeType( d->doc->documentType() ), ba);
            KoPAPastePage paste( d->doc,d->activePage );
            if ( ! paste.paste( d->doc->documentType(), &data ) ) {
                KMessageBox::error(0, i18n("Could not import\n%1", url.pathOrUrl()));
            }
        }
        else {
            KMessageBox::error(0, i18n("Could not import\n%1", url.pathOrUrl()));
        }
    }
    delete dialog;
}
开发者ID:KDE,项目名称:calligra-history,代码行数:47,代码来源:KoPAView.cpp


示例19: setState

void Connection::processResponse(const QDomDocument &xml)
{
    QString status = xml.documentElement().attribute("status");
    if (status == "running") {
        setState(DebugSession::ActiveState);
    } else if (status == "stopping") {
        setState(DebugSession::StoppingState);
    } else if (status == "stopped") {
        setState(DebugSession::StoppedState);
    } else if (status == "break") {
        setState(DebugSession::PausedState);
        QDomElement el = xml.documentElement().firstChildElement();
        if (el.nodeName() == "xdebug:message") {
            KUrl file = KUrl(el.attribute("filename"));
            int lineNum = el.attribute("lineno").toInt()-1;
            emit currentPositionChanged(file, lineNum);
        }
    }
    if (xml.documentElement().attribute("command") == "feature_get" && xml.documentElement().attribute("feature_name") == "encoding") {
        QTextCodec* c = QTextCodec::codecForName(xml.documentElement().text().toAscii());
        if (c) {
            m_codec = c;
        }
    }

    CallbackBase* callback = 0;
    if (xml.documentElement().hasAttribute("transaction_id")) {
        int transactionId = xml.documentElement().attribute("transaction_id").toInt();
        if (m_callbacks.contains(transactionId)) {
            callback = m_callbacks[transactionId];
            m_callbacks.remove(transactionId);
        }
    }
    if (callback && !callback->allowError()) {
        //if callback doesn't handle errors himself
        QDomElement el = xml.documentElement().firstChildElement();
        if (el.nodeName() == "error") {
            kWarning() << "error" << el.attribute("code") << "for transaction" << xml.documentElement().attribute("transaction_id");
            kDebug() << el.firstChildElement().text();
            Q_ASSERT(false);
        }
    }
    if (callback) {
        callback->execute(xml);
        delete callback;
    }
}
开发者ID:KDE,项目名称:kdev-xdebug,代码行数:47,代码来源:connection.cpp


示例20: imageFile

bool MPForm::addFile(const QString& name,const QString& path)
{
    KMimeType::Ptr ptr = KMimeType::findByUrl(path);
    QString mime       = ptr->name();
    if (mime.isEmpty())
    {
        // if we ourselves can't determine the mime of the local file,
        // very unlikely the remote site will be able to identify it
        return false;
    }

    QFile imageFile(path);
    if (!imageFile.open(QIODevice::ReadOnly))
        return false;

    QByteArray imageData = imageFile.readAll();

    QString str;
    QString file_size = QString("%1").arg(imageFile.size());

    str += "--";
    str += m_boundary;
    str += "\r\n";
    str += "Content-Disposition: form-data; name=\"";
    str += name.toAscii();
    str += "\"; ";
    str += "filename=\"";
    str += QFile::encodeName(KUrl(path).fileName());
    str += "\"\r\n";
    str += "Content-Length: " ;
    str +=  file_size.toAscii();
    str += "\r\n";
    str += "Content-Type: ";
    str +=  mime.toAscii();
    str += "\r\n\r\n";

    imageFile.close();
    m_buffer.append(str.toUtf8());

    int oldSize = m_buffer.size();
    m_buffer.resize(oldSize + imageData.size() + 2);
    memcpy(m_buffer.data() + oldSize, imageData.data(), imageData.size());
    m_buffer[m_buffer.size()-2] = '\r';
    m_buffer[m_buffer.size()-1] = '\n';

    return true;
}
开发者ID:UIKit0,项目名称:digikam,代码行数:47,代码来源:mpform.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ KVI_ASSERT函数代码示例发布时间:2022-05-30
下一篇:
C++ KURL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap