fix some layouts everwhere in kopete
[kdenetwork.git] / kdict / queryview.h
blobf0a6ab7df3ad8a01d173e554b612a55feccdd915
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 ------------------------------------------------------------- */
19 #ifndef _QUERYVIEW_H_
20 #define _QUERYVIEW_H_
22 #include <kvbox.h>
23 //Added by qt3to4:
24 #include <Q3PtrList>
25 #include <khtml_part.h>
27 class QFile;
28 class KTemporaryFile;
29 class KMenu;
30 class DictComboAction;
31 class KToolBarPopupAction;
33 QString getShortString(QString str,unsigned int length);
36 //******** SaveHelper *******************************************
39 class SaveHelper {
41 public:
43 SaveHelper(const QString &saveName, const QString &filter, QWidget *parent);
44 ~SaveHelper();
46 // returns a file open for writing
47 QFile* getFile(const QString &dialogTitle);
49 private:
51 QWidget *p_arent;
52 QString s_aveName, f_ilter;
53 KUrl url;
54 QFile* file;
55 KTemporaryFile* tmpFile;
56 static QString lastPath;
61 //******** BrowseData ******************************************
64 class BrowseData
67 public:
69 BrowseData(const QString &Nhtml, const QString &NqueryText);
71 QString html;
72 QString queryText;
73 int xPos,yPos;
77 //********* DictHTMLPart ***************************************
79 class DictHTMLPart : public KHTMLPart
81 Q_OBJECT
83 public:
85 DictHTMLPart(QWidget *parentWidget = 0, const char *widgetname = 0);
86 ~DictHTMLPart();
88 signals:
89 void middleButtonClicked();
91 protected:
93 virtual void khtmlMouseReleaseEvent(khtml::MouseReleaseEvent *event);
97 //********* QueryView ******************************************
100 class QueryView : public KVBox
102 Q_OBJECT
104 public:
106 QueryView(QWidget *_parent = 0L);
107 ~QueryView();
109 void setActions(KToolBarPopupAction* NactBack, KToolBarPopupAction* NactForward, DictComboAction* NactQueryCombo);
111 bool browseBackPossible() const;
112 bool browseForwardPossible() const;
114 void stop();
116 public slots:
117 void optionsChanged();
118 void printQuery();
119 void saveQuery();
120 void browseBack();
121 void browseForward();
122 void selectAll();
123 void copySelection();
124 void showFindDialog();
126 signals:
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&);
137 protected:
139 void paletteChange ( const QPalette & );
140 void fontChange ( const QFont & );
142 void saveCurrentResultPos();
143 void showResult();
145 protected slots:
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();
157 void popupDbInfo();
158 void enableAction(const char *, bool);
159 void browseBack(int);
160 void browseForward(int);
161 void updateBrowseActions();
163 private:
165 DictHTMLPart *part; // Widgets
167 KToolBarPopupAction *actBack, *actForward;
168 DictComboAction *actQueryCombo;
170 KMenu *rightBtnMenu;
171 QString popupLink,popupSelect; // needed for rightbtn-popup menu
173 Q3PtrList<BrowseData> browseList;
174 unsigned int browsePos; // position in browseList
175 QString currentHTMLHeader;
177 bool isRendering;
180 #endif