本文整理汇总了C++中KUrl::isRelative方法的典型用法代码示例。如果您正苦于以下问题:C++ KUrl::isRelative方法的具体用法?C++ KUrl::isRelative怎么用?C++ KUrl::isRelative使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KUrl
的用法示例。
在下文中一共展示了KUrl::isRelative方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: finishInteraction
void HyperlinkStrategy::finishInteraction(Qt::KeyboardModifiers modifiers)
{
if (!d->textRect.contains(d->lastPoint)) {
return;
}
Q_UNUSED(modifiers)
selection()->activeSheet()->showStatusMessage(i18n("Link %1 activated", d->url));
const KUrl url(d->url);
if (!url.isValid() || url.isRelative()) {
const Region region(d->url, selection()->activeSheet()->map(), selection()->activeSheet());
if (region.isValid()) {
if (region.firstSheet() != selection()->activeSheet()) {
selection()->emitVisibleSheetRequested(region.firstSheet());
}
selection()->initialize(region);
if (!region.firstRange().isNull()) {
const Cell cell = Cell(region.firstSheet(), region.firstRange().topLeft());
}
}
} else {
const QString type = KMimeType::findByUrl(url, 0, url.isLocalFile())->name();
if (!Util::localReferenceAnchor(d->url)) {
const bool executable = KRun::isExecutableFile(url, type);
if (executable) {
const QString question = i18n("This link points to the program or script '%1'.\n"
"Malicious programs can harm your computer. "
"Are you sure that you want to run this program?", d->url);
// this will also start local programs, so adding a "don't warn again"
// checkbox will probably be too dangerous
const int answer = KMessageBox::warningYesNo(tool()->canvas()->canvasWidget(), question,
i18n("Open Link?"));
if (answer != KMessageBox::Yes) {
return;
}
}
QDesktopServices::openUrl(url);
}
}
tool()->repaintDecorations();
}