File indexing completed on 2024-04-21 15:55:39
0001 /*************************************************************************** 0002 begin : 2004 0003 copyright : (C) 2004-2012 by Holger Danielsson (holger.danielsson@versanet.de) 0004 (C) 2019 by Michel Ludwig (michel.ludwig@kdemail.net) 0005 ***************************************************************************/ 0006 0007 /*************************************************************************** 0008 * * 0009 * This program is free software; you can redistribute it and/or modify * 0010 * it under the terms of the GNU General Public License as published by * 0011 * the Free Software Foundation; either version 2 of the License, or * 0012 * (at your option) any later version. * 0013 * * 0014 ***************************************************************************/ 0015 0016 #ifndef KILEHELP_H 0017 #define KILEHELP_H 0018 0019 #include <QMap> 0020 0021 #include <KActionMenu> 0022 #include <KTextEditor/View> 0023 0024 #include "editorextension.h" 0025 #include "userhelp.h" 0026 0027 namespace KileDocument { 0028 class EditorExtension; 0029 } 0030 0031 namespace KileHelp 0032 { 0033 0034 enum HelpType 0035 { 0036 HelpKileRefs, 0037 HelpLatex2eRefs, 0038 HelpLatexIndex, 0039 HelpLatexCommand, 0040 HelpLatexEnvironment 0041 }; 0042 0043 class Help : public QObject 0044 { 0045 Q_OBJECT 0046 0047 public: 0048 Help(KileDocument::EditorExtension *edit, QWidget *mainWindow); 0049 ~Help(); 0050 0051 void setUserhelp(KileTool::Manager *manager, KActionMenu *userHelpActionMenu); 0052 void update(); 0053 0054 // calls for help 0055 void helpKeyword(KTextEditor::View *view); 0056 void noHelpAvailableFor(const QString &word); 0057 void userHelpDialog() { 0058 m_userhelp->userHelpDialog(); 0059 } 0060 void enableUserhelpEntries(bool state); 0061 0062 public Q_SLOTS: 0063 inline void helpLatexIndex() { 0064 helpLatex(KileHelp::HelpLatexIndex); 0065 } 0066 inline void helpLatexCommand() { 0067 helpLatex(KileHelp::HelpLatexCommand); 0068 } 0069 inline void helpLatexEnvironment() { 0070 helpLatex(KileHelp::HelpLatexEnvironment); 0071 } 0072 void helpKeyword(); 0073 void helpDocBrowser(); 0074 0075 private: 0076 QWidget *m_mainWindow; 0077 KileTool::Manager *m_manager; 0078 KileDocument::EditorExtension *m_edit; 0079 UserHelp *m_userhelp; 0080 QString m_helpDir; 0081 0082 QString m_latex2eReference; 0083 QString m_kileReference; 0084 0085 HelpType m_contextHelpType; 0086 QMap<QString, QString> m_dictHelpTex; 0087 0088 void initContextHelp(); 0089 0090 void readHelpList(const QString &filename); 0091 void showHelpFile(const QString ¶meter); 0092 0093 void helpLatex(HelpType type); 0094 QString getKeyword(KTextEditor::View *view); 0095 HelpType contextHelpType(); 0096 0097 }; 0098 } 0099 0100 #endif