File indexing completed on 2023-10-03 03:04:58
0001 /* 0002 This file is part of Kiten, a KDE Japanese Reference Tool... 0003 SPDX-FileCopyrightText: 2001 Jason Katz-Brown <jason@katzbrown.com> 0004 SPDX-FileCopyrightText: 2005 Paul Temple <paul.temple@gmx.net> 0005 SPDX-FileCopyrightText: 2006 Joseph Kerian <jkerian@gmail.com> 0006 SPDX-FileCopyrightText: 2006 Eric Kjeldergaard <kjelderg@gmail.com> 0007 SPDX-FileCopyrightText: 2011 Daniel E. Moctezuma <democtezuma@gmail.com> 0008 0009 SPDX-License-Identifier: GPL-2.0-or-later 0010 */ 0011 0012 #ifndef KITEN_H 0013 #define KITEN_H 0014 0015 #include <KXmlGuiWindow> 0016 0017 #include "dictionarymanager.h" 0018 #include "dictquery.h" 0019 #include "entry.h" 0020 #include "historyptrlist.h" 0021 0022 class QAction; 0023 class KListAction; 0024 class KProcess; 0025 class QStatusBar; 0026 class KStatusNotifierItem; 0027 class KToggleAction; 0028 class KitenConfigSkeleton; 0029 0030 class QDockWidget; 0031 0032 class ConfigureDialog; 0033 class DictionaryUpdateManager; 0034 class EntryListView; 0035 class ResultsView; 0036 class SearchStringInput; 0037 0038 class Kiten : public KXmlGuiWindow 0039 { 0040 Q_OBJECT 0041 0042 // Constructors and other setup/takedown related methods 0043 public: 0044 explicit Kiten(QWidget *parent = nullptr, const char *name = nullptr); 0045 ~Kiten() override; 0046 0047 KitenConfigSkeleton *getConfig(); 0048 0049 // The following will be available via dbus. 0050 public Q_SLOTS: 0051 void searchTextAndRaise(const QString &str); 0052 void addExportListEntry(int index); 0053 0054 protected: 0055 void setupActions(); 0056 void setupExportListDock(); 0057 bool queryClose() override; // overridden from KXmlGuiWindow (called@shutdown) override 0058 0059 private Q_SLOTS: 0060 void finishInit(); 0061 void focusResultsView(); 0062 0063 // Searching related methods 0064 void searchFromEdit(); 0065 void searchText(const QString &); 0066 void searchClipboard(); 0067 void searchAndDisplay(const DictQuery &); 0068 void searchInResults(); 0069 void displayResults(EntryList *); 0070 void radicalSearch(); 0071 void kanjiBrowserSearch(); 0072 // void searchOnTheSpot(); 0073 0074 // Configuration related slots 0075 void slotConfigure(); 0076 void slotConfigureHide(); 0077 void slotConfigureDestroy(); 0078 void configureToolBars(); 0079 void configureGlobalKeys(); 0080 void newToolBarConfig(); 0081 void updateConfiguration(); 0082 void loadDictionaries(); 0083 void loadDictConfig(const QString &); 0084 0085 // Other 0086 void print(); 0087 0088 // History related methods 0089 void back(); 0090 void forward(); 0091 void goInHistory(int); 0092 void displayHistoryItem(); 0093 void addHistory(EntryList *); 0094 void enableHistoryButtons(); 0095 void setCurrentScrollValue(int value); 0096 0097 // void createEEdit(); 0098 // void kanjiDictChange(); 0099 // void slotLearnConfigure(); 0100 // Q_SIGNALS: 0101 // void saveLists(); 0102 // void add( Entry* ); 0103 0104 private: 0105 QStatusBar *_statusBar = nullptr; 0106 DictionaryManager _dictionaryManager; 0107 DictionaryUpdateManager *_dictionaryUpdateManager = nullptr; 0108 SearchStringInput *_inputManager = nullptr; 0109 ResultsView *_mainView = nullptr; 0110 0111 DictQuery _lastQuery; 0112 KToggleAction *_autoSearchToggle = nullptr; 0113 KListAction *_historyAction = nullptr; 0114 QAction *_irAction = nullptr; 0115 QAction *_backAction = nullptr; 0116 QAction *_forwardAction = nullptr; 0117 KProcess *_radselect_proc = nullptr; 0118 KProcess *_kanjibrowser_proc = nullptr; 0119 0120 // TODO: this should probably be a standardaction 0121 QAction *_globalShortcutsAction = nullptr; 0122 0123 // ResultsView *detachedView; 0124 QAction *_globalSearchAction = nullptr; 0125 0126 KStatusNotifierItem *_sysTrayIcon = nullptr; 0127 0128 // Export list related: 0129 QDockWidget *_exportListDock = nullptr; 0130 QWidget *_exportListDockContents = nullptr; 0131 EntryListView *_exportList = nullptr; 0132 0133 ConfigureDialog *_optionDialog = nullptr; 0134 KitenConfigSkeleton *_config = nullptr; 0135 0136 HistoryPtrList _historyList; 0137 QString _personalDict; 0138 }; 0139 0140 #endif