1 | |
2 | #ifndef KHC_MAINWINDOW_H |
3 | #define KHC_MAINWINDOW_H |
4 | |
5 | #include <KXmlGuiWindow> |
6 | #include <KUrl> |
7 | |
8 | #include <kio/job.h> |
9 | #include <kparts/browserextension.h> |
10 | |
11 | #include "navigator.h" |
12 | #include "glossary.h" |
13 | |
14 | class QSplitter; |
15 | |
16 | class LogDialog; |
17 | |
18 | namespace KHC { |
19 | |
20 | class View; |
21 | |
22 | class MainWindow : public KXmlGuiWindow |
23 | { |
24 | Q_OBJECT |
25 | Q_CLASSINFO("D-Bus Interface" , "org.kde.khelpcenter.khelpcenter" ) |
26 | public: |
27 | MainWindow(); |
28 | ~MainWindow(); |
29 | |
30 | public Q_SLOTS: |
31 | Q_SCRIPTABLE void openUrl( const QString &url ); |
32 | Q_SCRIPTABLE void openUrl( const QString &url, const QByteArray& startup_id ); |
33 | Q_SCRIPTABLE void showHome(); |
34 | Q_SCRIPTABLE void lastSearch(); |
35 | |
36 | public Q_SLOTS: |
37 | void print(); |
38 | void statusBarMessage(const QString &m); |
39 | void slotShowHome(); |
40 | void slotLastSearch(); |
41 | void showSearchStderr(); |
42 | /** |
43 | Show document corresponding to given URL in viewer part. |
44 | */ |
45 | void viewUrl( const QString & ); |
46 | |
47 | /** |
48 | Open document corresponding to given URL, i.e. show it in the viewer part |
49 | and select the corresponding entry in the navigator widget. |
50 | */ |
51 | void openUrl( const KUrl &url ); |
52 | |
53 | protected: |
54 | void setupActions(); |
55 | /** |
56 | Show document corresponding to given URL in viewer part. |
57 | */ |
58 | void viewUrl( const KUrl &url, |
59 | const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(), |
60 | const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments() ); |
61 | |
62 | virtual void saveProperties( KConfigGroup &config ); |
63 | virtual void readProperties( const KConfigGroup &config ); |
64 | |
65 | void readConfig(); |
66 | void writeConfig(); |
67 | |
68 | protected Q_SLOTS: |
69 | void enableLastSearchAction(); |
70 | void enableCopyTextAction(); |
71 | |
72 | private: |
73 | void stop(); |
74 | |
75 | private Q_SLOTS: |
76 | void slotGlossSelected(const GlossaryEntry &entry); |
77 | void slotStarted(KIO::Job *job); |
78 | void slotInfoMessage(KJob *, const QString &); |
79 | void goInternalUrl( const KUrl & ); |
80 | /** |
81 | This function is called when the user clicks on a link in the viewer part. |
82 | */ |
83 | void slotOpenURLRequest( const KUrl &url, |
84 | const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(), |
85 | const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments()); |
86 | void documentCompleted(); |
87 | void slotIncFontSizes(); |
88 | void slotDecFontSizes(); |
89 | void slotConfigureFonts(); |
90 | void slotCopySelectedText(); |
91 | |
92 | private: |
93 | void updateFontScaleActions(); |
94 | |
95 | QSplitter *mSplitter; |
96 | View *mDoc; |
97 | Navigator *mNavigator; |
98 | |
99 | QAction *mLastSearchAction; |
100 | QAction *mCopyText; |
101 | LogDialog *mLogDialog; |
102 | }; |
103 | |
104 | } |
105 | |
106 | #endif //KHC_MAINWINDOW_H |
107 | // vim:ts=2:sw=2:et |
108 | |