本文整理汇总了C++中KUrl函数的典型用法代码示例。如果您正苦于以下问题:C++ KUrl函数的具体用法?C++ KUrl怎么用?C++ KUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KUrl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例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();
}
示例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;
}
}
示例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;
}
示例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);
}
}
示例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?";
}
}
示例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";
}
示例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." ) );
}
}
示例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);
}
}
}
示例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;
}
示例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()) );
}
示例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());
}
示例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."));
}
}
}
示例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;
}
示例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();
}