File indexing completed on 2024-05-19 05:19:21

0001 /*
0002     This file is a part of KJots.
0003 
0004     SPDX-FileCopyrightText: 2008 Stephen Kelly <steveire@gmail.com>
0005                   2020 Igor Poboiko <igor.poboiko@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef KJOTSLINKDIALOG_H
0011 #define KJOTSLINKDIALOG_H
0012 
0013 #include <QDialog>
0014 
0015 namespace Ui {
0016     class LinkDialog;
0017 }
0018 
0019 class QListView;
0020 
0021 class KDescendantsProxyModel;
0022 
0023 class QAbstractItemModel;
0024 class QString;
0025 
0026 
0027 class KJotsLinkDialog : public QDialog
0028 {
0029     Q_OBJECT
0030 public:
0031     explicit KJotsLinkDialog(QAbstractItemModel *kjotsModel, QWidget *parent = nullptr);
0032     ~KJotsLinkDialog();
0033 
0034     /**
0035      * Returns the link text shown in the dialog
0036      * @param linkText The initial text
0037      */
0038     void setLinkText(const QString &linkText);
0039 
0040     /**
0041      * Sets the target link url shown in the dialog
0042      * @param linkUrl The initial link target url
0043      */
0044     void setLinkUrl(const QString &linkUrl);
0045 
0046     /**
0047      * Returns the link text entered by the user.
0048      * @return The link text
0049      */
0050     QString linkText() const;
0051 
0052     /**
0053      * Returns the target link url entered by the user.
0054      * @return The link url
0055      */
0056     QString linkUrl() const;
0057 private:
0058     void slotTextChanged();
0059     std::unique_ptr<Ui::LinkDialog> ui;
0060     std::unique_ptr<KDescendantsProxyModel> m_descendantsProxyModel;
0061 };
0062 
0063 #endif