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 ------------------------------------------------------------- */
23 #include <khtml_part.h>
28 class DictComboAction
;
31 QString
getShortString(QString str
,unsigned int length
);
34 //******** SaveHelper *******************************************
41 SaveHelper(const QString
&saveName
, const QString
&filter
, QWidget
*parent
);
44 // returns a file open for writing
45 QFile
* getFile(const QString
&dialogTitle
);
50 QString s_aveName
, f_ilter
;
54 static QString lastPath
;
59 //******** BrowseData ******************************************
67 BrowseData(const QString
&Nhtml
, const QString
&NqueryText
);
75 //********* DictHTMLPart ***************************************
77 class DictHTMLPart
: public KHTMLPart
83 DictHTMLPart(QWidget
*parentWidget
= 0, const char *widgetname
= 0);
87 void middleButtonClicked();
91 virtual void khtmlMouseReleaseEvent(khtml::MouseReleaseEvent
*event
);
95 //********* QueryView ******************************************
98 class QueryView
: public QVBox
104 QueryView(QWidget
*_parent
= 0L);
107 void setActions(KToolBarPopupAction
* NactBack
, KToolBarPopupAction
* NactForward
, DictComboAction
* NactQueryCombo
);
109 bool browseBackPossible() const;
110 bool browseForwardPossible() const;
115 void optionsChanged();
119 void browseForward();
121 void copySelection();
122 void showFindDialog();
126 void defineRequested(const QString
&query
);
127 void matchRequested(const QString
&query
);
128 void clipboardRequested();
129 void enableCopy(bool selected
); // emited when the user selects/deselects text
130 void enablePrintSave();
131 void renderingStarted();
132 void renderingStopped();
133 void newCaption(const QString
&);
137 void paletteChange ( const QPalette
& );
138 void fontChange ( const QFont
& );
140 void saveCurrentResultPos();
145 void resultReady(const QString
&result
, const QString
&query
);
146 void partCompleted();
147 void slotURLRequest (const KURL
&url
, const KParts::URLArgs
&args
);
148 void middleButtonClicked();
149 void buildPopupMenu(const QString
&url
, const QPoint
&point
);
150 void popupDefineLink();
151 void popupMatchLink();
152 void popupOpenLink();
153 void popupDefineSelect();
154 void popupMatchSelect();
156 void enableAction(const char *, bool);
157 void browseBack(int);
158 void browseForward(int);
159 void updateBrowseActions();
163 DictHTMLPart
*part
; // Widgets
165 KToolBarPopupAction
*actBack
, *actForward
;
166 DictComboAction
*actQueryCombo
;
168 KPopupMenu
*rightBtnMenu
;
169 QString popupLink
,popupSelect
; // needed for rightbtn-popup menu
171 QPtrList
<BrowseData
> browseList
;
172 unsigned int browsePos
; // position in browseList
173 QString currentHTMLHeader
;