File indexing completed on 2024-06-02 05:26:03

0001 /*
0002    SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #pragma once
0007 
0008 #include <KXMLGUIClient>
0009 #include <QDialog>
0010 
0011 class KNoteEdit;
0012 class KToolBar;
0013 class QLineEdit;
0014 class QPushButton;
0015 class KNoteEditDialog : public QDialog, virtual public KXMLGUIClient
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit KNoteEditDialog(bool readOnly, QWidget *parent = nullptr);
0020     ~KNoteEditDialog() override;
0021 
0022     void setAcceptRichText(bool b);
0023     QString text() const;
0024 
0025     void setText(const QString &text);
0026 
0027     QString title() const;
0028 
0029     void setTitle(const QString &text);
0030 
0031     KNoteEdit *noteEdit() const;
0032 
0033     void setReadOnly(bool b);
0034 
0035     void setTabSize(int size);
0036 
0037     void setAutoIndentMode(bool newmode);
0038 
0039     void setTextFont(const QFont &font);
0040 
0041     void setColor(const QColor &fg, const QColor &bg);
0042 
0043     void setCursorPositionFromStart(int pos);
0044 
0045     int cursorPositionFromStart() const;
0046 private Q_SLOTS:
0047     void slotTextChanged(const QString &text);
0048 
0049 private:
0050     void init(bool readOnly);
0051     void readConfig();
0052     void writeConfig();
0053     QLineEdit *mTitleEdit = nullptr;
0054     KNoteEdit *mNoteEdit = nullptr;
0055     KToolBar *mTool = nullptr;
0056     QPushButton *mOkButton = nullptr;
0057 };