Now the systrayicon change it's color when a download is in progress. I simply change...
[kdenetwork.git] / kdict / queryview.h
blobe942d297de315e09a2d30b237f637f36d0859fda
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 <qvbox.h>
23 #include <khtml_part.h>
25 class QFile;
26 class KTempFile;
27 class KPopupMenu;
28 class DictComboAction;
31 QString getShortString(QString str,unsigned int length);
34 //******** SaveHelper *******************************************
37 class SaveHelper {
39 public:
41 SaveHelper(const QString &saveName, const QString &filter, QWidget *parent);
42 ~SaveHelper();
44 // returns a file open for writing
45 QFile* getFile(const QString &dialogTitle);
47 private:
49 QWidget *p_arent;
50 QString s_aveName, f_ilter;
51 KURL url;
52 QFile* file;
53 KTempFile* tmpFile;
54 static QString lastPath;
59 //******** BrowseData ******************************************
62 class BrowseData
65 public:
67 BrowseData(const QString &Nhtml, const QString &NqueryText);
69 QString html;
70 QString queryText;
71 int xPos,yPos;
75 //********* DictHTMLPart ***************************************
77 class DictHTMLPart : public KHTMLPart
79 Q_OBJECT
81 public:
83 DictHTMLPart(QWidget *parentWidget = 0, const char *widgetname = 0);
84 ~DictHTMLPart();
86 signals:
87 void middleButtonClicked();
89 protected:
91 virtual void khtmlMouseReleaseEvent(khtml::MouseReleaseEvent *event);
95 //********* QueryView ******************************************
98 class QueryView : public QVBox
100 Q_OBJECT
102 public:
104 QueryView(QWidget *_parent = 0L);
105 ~QueryView();
107 void setActions(KToolBarPopupAction* NactBack, KToolBarPopupAction* NactForward, DictComboAction* NactQueryCombo);
109 bool browseBackPossible() const;
110 bool browseForwardPossible() const;
112 void stop();
114 public slots:
115 void optionsChanged();
116 void printQuery();
117 void saveQuery();
118 void browseBack();
119 void browseForward();
120 void selectAll();
121 void copySelection();
122 void showFindDialog();
124 signals:
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&);
135 protected:
137 void paletteChange ( const QPalette & );
138 void fontChange ( const QFont & );
140 void saveCurrentResultPos();
141 void showResult();
143 protected slots:
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();
155 void popupDbInfo();
156 void enableAction(const char *, bool);
157 void browseBack(int);
158 void browseForward(int);
159 void updateBrowseActions();
161 private:
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;
175 bool isRendering;
178 #endif