File indexing completed on 2024-05-19 05:21:42
0001 /** 0002 * klinkdialog 0003 * 0004 * SPDX-FileCopyrightText: 2008 Stephen Kelly <steveire@gmail.com> 0005 * 0006 * SPDX-License-Identifier: LGPL-2.1-or-later 0007 */ 0008 0009 #pragma once 0010 0011 //@cond PRIVATE 0012 0013 #include <QDialog> 0014 0015 class QDialogButtonBox; 0016 class QLabel; 0017 class QLineEdit; 0018 namespace KPIMTextEdit 0019 { 0020 /** 0021 @short Dialog to allow user to configure a hyperlink. 0022 @author Stephen Kelly 0023 @since 4.1 0024 @internal 0025 0026 This class provides a dialog to ask the user for a link target url and 0027 text. 0028 0029 The size of the dialog is automatically saved to and restored from the 0030 global KDE config file. 0031 */ 0032 class KLinkDialog : public QDialog 0033 { 0034 Q_OBJECT 0035 public: 0036 /** 0037 * Create a link dialog. 0038 * @param parent Parent widget. 0039 */ 0040 explicit KLinkDialog(QWidget *parent = nullptr); 0041 0042 /** 0043 * Destructor 0044 */ 0045 ~KLinkDialog() override; 0046 0047 /** 0048 * Returns the link text shown in the dialog 0049 * @param linkText The initial text 0050 */ 0051 void setLinkText(const QString &linkText); 0052 0053 /** 0054 * Sets the target link url shown in the dialog 0055 * @param linkUrl The initial link target url 0056 */ 0057 void setLinkUrl(const QString &linkUrl); 0058 0059 /** 0060 * Returns the link text entered by the user. 0061 * @return The link text 0062 */ 0063 [[nodiscard]] QString linkText() const; 0064 0065 /** 0066 * Returns the target link url entered by the user. 0067 * @return The link url 0068 */ 0069 [[nodiscard]] QString linkUrl() const; 0070 0071 private: 0072 void slotTextChanged(const QString &); 0073 QLabel *const textLabel; 0074 QLineEdit *const textLineEdit; 0075 QLabel *const linkUrlLabel; 0076 QLineEdit *const linkUrlLineEdit; 0077 QDialogButtonBox *const buttonBox; 0078 }; 0079 } 0080 //@endcond