File indexing completed on 2025-01-05 04:49:29
0001 /* 0002 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "quicktext_export.h" 0010 #include <QModelIndex> 0011 #include <QWidget> 0012 class QuicktextTreeWidget; 0013 namespace MailCommon 0014 { 0015 class SnippetWidget; 0016 } 0017 class QuicktextManager; 0018 class QStackedWidget; 0019 class QUICKTEXT_EXPORT QuickTextWidget : public QWidget 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit QuickTextWidget(QWidget *parent = nullptr); 0024 ~QuickTextWidget() override; 0025 0026 void save(); 0027 void importQuickText(); 0028 void exportQuickText(); 0029 0030 private: 0031 enum class EditMode { 0032 AddSnippet, 0033 EditSnippet, 0034 AddGroup, 0035 EditGroup, 0036 Unknown, 0037 }; 0038 void addSnippet(); 0039 void editSnippet(); 0040 void addSnippetGroup(); 0041 void editSnippetGroup(); 0042 0043 void saveAddSnippet(); 0044 void saveEditSnippet(); 0045 void saveAddGroup(); 0046 void saveEditGroup(); 0047 void saveModelIndex(const QModelIndex &index); 0048 0049 QModelIndex mCurrentGroupIndex; 0050 EditMode mMode = EditMode::Unknown; 0051 0052 QuicktextTreeWidget *mTreeWidget = nullptr; 0053 MailCommon::SnippetWidget *mSnippetWidget = nullptr; 0054 QuicktextManager *mSnippetsManager = nullptr; 0055 QStackedWidget *mStackedWidget = nullptr; 0056 QWidget *mEmptyWidget = nullptr; 0057 };