Root/
| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2010 by Mirko Lindner * |
| 3 | * mirko@sharism.cc * |
| 4 | * * |
| 5 | * This program is free software; you can redistribute it and/or modify * |
| 6 | * it under the terms of the GNU General Public License as published by * |
| 7 | * the Free Software Foundation; either version 2 of the License, or * |
| 8 | * (at your option) any later version. * |
| 9 | * * |
| 10 | * This program is distributed in the hope that it will be useful, * |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 13 | * GNU General Public License for more details. * |
| 14 | * * |
| 15 | * You should have received a copy of the GNU General Public License * |
| 16 | * along with this program; if not, write to the * |
| 17 | * Free Software Foundation, Inc., * |
| 18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 19 | ***************************************************************************/ |
| 20 | |
| 21 | #include <QTextBrowser> |
| 22 | #include <QWidget> |
| 23 | #include <zim/file.h> |
| 24 | #include <zim/search.h> |
| 25 | |
| 26 | class UserEventFilter : public QObject |
| 27 | { |
| 28 | Q_OBJECT |
| 29 | |
| 30 | public: |
| 31 | UserEventFilter() : QObject() {} |
| 32 | |
| 33 | protected: |
| 34 | bool eventFilter(QObject *obj, QEvent *event); |
| 35 | }; |
| 36 | |
| 37 | class HtmlArea : public QTextBrowser |
| 38 | { |
| 39 | Q_OBJECT |
| 40 | |
| 41 | public: |
| 42 | HtmlArea(QWidget * parent = 0) : QTextBrowser(parent) {} |
| 43 | void searchArticle(QString term); |
| 44 | |
| 45 | private: |
| 46 | QString url; |
| 47 | QObject filter; |
| 48 | zim::Article getArticleFromUrl(QString url); |
| 49 | zim::Search::Results searchArticleFromTitle(QString phrase); |
| 50 | zim::Article getRandomArticle(); |
| 51 | const zim::File& get_file(); |
| 52 | void setNewContent( int method, QString str ); |
| 53 | QVariant loadResource(int type, const QUrl &name); |
| 54 | |
| 55 | protected: |
| 56 | virtual void keyPressEvent(QKeyEvent *e); |
| 57 | |
| 58 | public Q_SLOTS: |
| 59 | void linking( const QUrl &txt ); |
| 60 | void sourceChange( const QUrl &txt ); |
| 61 | void getRandom(); |
| 62 | void goToTop(); |
| 63 | }; |
| 64 |
Branches:
master
