1 /* -------------------------------------------------------------
3 queryview.h (part of The KDE Dictionary Client)
5 Copyright (C) 2000-2001 Christian Gebauer <gebauer@kde.org>
7 This file is distributed under the Artistic License.
8 See LICENSE for details.
10 -------------------------------------------------------------
12 SaveHelper network transparent file saving
13 BrowseData data structure used for caching definitions
14 DictHTMLPart handling of middle mouse button clicks
15 QueryView widget that displays the definitions
17 ------------------------------------------------------------- */
25 #include <khtml_part.h>
30 class DictComboAction
;
31 class KToolBarPopupAction
;
33 QString
getShortString(QString str
,unsigned int length
);
36 //******** SaveHelper *******************************************
43 SaveHelper(const QString
&saveName
, const QString
&filter
, QWidget
*parent
);
46 // returns a file open for writing
47 QFile
* getFile(const QString
&dialogTitle
);
52 QString s_aveName
, f_ilter
;
55 KTemporaryFile
* tmpFile
;
56 static QString lastPath
;
61 //******** BrowseData ******************************************
69 BrowseData(const QString
&Nhtml
, const QString
&NqueryText
);
77 //********* DictHTMLPart ***************************************
79 class DictHTMLPart
: public KHTMLPart
85 DictHTMLPart(QWidget
*parentWidget
= 0, const char *widgetname
= 0);
89 void middleButtonClicked();
93 virtual void khtmlMouseReleaseEvent(khtml::MouseReleaseEvent
*event
);
97 //********* QueryView ******************************************
100 class QueryView
: public KVBox
106 QueryView(QWidget
*_parent
= 0L);
109 void setActions(KToolBarPopupAction
* NactBack
, KToolBarPopupAction
* NactForward
, DictComboAction
* NactQueryCombo
);
111 bool browseBackPossible() const;
112 bool browseForwardPossible() const;
117 void optionsChanged();
121 void browseForward();
123 void copySelection();
124 void showFindDialog();
128 void defineRequested(const QString
&query
);
129 void matchRequested(const QString
&query
);
130 void clipboardRequested();
131 void enableCopy(bool selected
); // emited when the user selects/deselects text
132 void enablePrintSave();
133 void renderingStarted();
134 void renderingStopped();
135 void newCaption(const QString
&);
139 void paletteChange ( const QPalette
& );
140 void fontChange ( const QFont
& );
142 void saveCurrentResultPos();
147 void resultReady(const QString
&result
, const QString
&query
);
148 void partCompleted();
149 void slotURLRequest (const KUrl
&url
, const KParts::URLArgs
&args
);
150 void middleButtonClicked();
151 void buildPopupMenu(const QString
&url
, const QPoint
&point
);
152 void popupDefineLink();
153 void popupMatchLink();
154 void popupOpenLink();
155 void popupDefineSelect();
156 void popupMatchSelect();
158 void enableAction(const char *, bool);
159 void browseBack(int);
160 void browseForward(int);
161 void updateBrowseActions();
165 DictHTMLPart
*part
; // Widgets
167 KToolBarPopupAction
*actBack
, *actForward
;
168 DictComboAction
*actQueryCombo
;
171 QString popupLink
,popupSelect
; // needed for rightbtn-popup menu
173 Q3PtrList
<BrowseData
> browseList
;
174 unsigned int browsePos
; // position in browseList
175 QString currentHTMLHeader
;