File indexing completed on 2024-04-21 05:51:37
0001 /* 0002 * SPDX-FileCopyrightText: 2002-2003 Jesper K. Pedersen <blackie@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-only 0005 **/ 0006 0007 #include "infopage.h" 0008 0009 #include <KHelpClient> 0010 #include <KLocalizedString> 0011 #include <QDesktopServices> 0012 0013 InfoPage::InfoPage(QWidget *parent) 0014 : QTextBrowser(parent) 0015 { 0016 setFrameShape(QFrame::NoFrame); 0017 0018 QString txt = QStringLiteral("<qt>") 0019 + i18nc("Translators, feel free to add yourself in the text below, asking for a postcard ;-), " 0020 "also feel free to add a section saying <h2>Translators</h2>. " 0021 "Kind regards, and thanks for your work - Jesper.", 0022 "<h1>Regular Expression Editor</h1>" 0023 "<p>What you are currently looking at is an editor for <i>Regular Expressions</i>.</p>" 0024 "<p>The upper part in the middle is the editing area, the lower part is a verification window where you can " 0025 "try your regular expressions right away. The row of buttons is the editing actions. " 0026 "This is actually very similar to common drawing programs. Select an editing tool to start " 0027 "editing your regular expression, and press the mouse button in the editing area where you want " 0028 "this item inserted.</p>" 0029 "<p>For a more detailed description of this editor see the <a href=\"doc://\">info pages</a></p>" 0030 0031 "<h2>What is a regular expression?</h2>" 0032 "If you do not know what a regular expression is, then it might be a good idea " 0033 "to read <a href=\"doc://whatIsARegExp\">the introduction to regular expressions</a>.<br />") 0034 + QStringLiteral("</qt>"); 0035 setText(txt); 0036 } 0037 0038 void InfoPage::doSetSource(const QUrl &name, QTextDocument::ResourceType type) 0039 { 0040 Q_UNUSED(type); 0041 0042 QString nm = name.toString(); 0043 0044 if (nm.startsWith(QStringLiteral("doc://"))) { 0045 KHelpClient::invokeHelp(nm.mid(6, nm.length() - 7), QStringLiteral("kregexpeditor")); 0046 } else { 0047 QDesktopServices::openUrl(name); // handle mailto and other links 0048 } 0049 }