diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-04-15 23:59:35 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-04-15 23:59:35 +0200 |
commit | cc6d332afeb2ed940bcd3ca6bc307916b3ddf953 (patch) | |
tree | df470b3f9d62a4034b27cf37df93e3cfe38f60b3 /src/urlbar/listitem.h | |
parent | Merge commit 'refs/merge-requests/124' of git://gitorious.org/rekonq/mainline... (diff) | |
parent | introduce search listitem (diff) | |
download | rekonq-cc6d332afeb2ed940bcd3ca6bc307916b3ddf953.tar.xz |
Merge commit 'refs/merge-requests/77' of git://gitorious.org/rekonq/mainline into m77
Diffstat (limited to 'src/urlbar/listitem.h')
-rw-r--r-- | src/urlbar/listitem.h | 149 |
1 files changed, 142 insertions, 7 deletions
diff --git a/src/urlbar/listitem.h b/src/urlbar/listitem.h index 18ec8a33..6a6c433f 100644 --- a/src/urlbar/listitem.h +++ b/src/urlbar/listitem.h @@ -23,19 +23,25 @@ * * ============================================================ */ - #ifndef LISTITEM_H #define LISTITEM_H +// KDE Includes +#include <KToolBar> +#include <KAction> +#include <KService> + +// Local Includes +#include "urlresolver.h" // Qt Includes #include <QWidget> #include <QLayout> #include <QStyleOptionViewItemV4> +#include <QLabel> // Forward Declarations class UrlSearchItem; -class KUrl; class ListItem : public QWidget @@ -44,11 +50,16 @@ class ListItem : public QWidget public: ListItem(const UrlSearchItem &item, QWidget *parent = 0); - ~ListItem(); + virtual ~ListItem(); void activate(); void deactivate(); + KUrl url(); + +public slots: + virtual void nextItemSubChoice(); + signals: void itemClicked(ListItem *item, Qt::MouseButton); @@ -59,11 +70,135 @@ protected: virtual void mousePressEvent(QMouseEvent *e); private: - QString guessNameFromUrl(KUrl url); - void insertIcon(QLayout *layout, QString icon); + QStyleOptionViewItemV4 m_option; + +protected: + KUrl m_url; +}; + + +class TypeIcon : public QLabel +{ + Q_OBJECT + + public: + TypeIcon(int type, QWidget *parent = 0); + private: + QLabel *getIcon(QString icon); +}; + + +class ItemIcon : public QLabel +{ + Q_OBJECT + + public: + ItemIcon(QString icon, QWidget *parent = 0); +}; + + +class ItemText : public QLabel +{ + Q_OBJECT + + public: + ItemText(QString text, QString underlined, QWidget *parent = 0); + QString underlineText(QString text, QString textToUnderline); +}; + + +//------------------------------------------------------------------------------------------------- + +class EngineBar : public KToolBar +{ + Q_OBJECT + + public: + EngineBar(QString text, QString selectedEngine, QWidget *parent = 0); + static QString defaultEngine(); + void selectNextEngine(); + + signals: + void searchEngineChanged(QString url, QString engine); + + private slots: + void changeSearchEngine(); + + private: + KAction *newEngineAction(KService::Ptr service, QString selectedEngine, QString text); + + QActionGroup *m_engineGroup; +}; + + +class SearchListItem : public ListItem +{ + Q_OBJECT + + public: + SearchListItem(const UrlSearchItem &item, const QString &text, QWidget *parent = 0); + + public slots: + virtual void nextItemSubChoice(); + + protected: + + + private slots: + void changeSearchEngine(QString url, QString engine); + + private: + QString searchItemTitle(QString engine, QString text); + ItemText* m_titleLabel; + ItemIcon* m_iconLabel; + EngineBar* m_engineBar; + QString m_text; + static QString m_currentEngine; +}; + + +//------------------------------------------------------------------------------------------------- + +class PreviewListItem : public ListItem +{ + Q_OBJECT + + public: + PreviewListItem(const UrlSearchItem &item, const QString &text, QWidget *parent = 0); +}; + + +class ItemPreview : public QLabel +{ + Q_OBJECT + + public: + ItemPreview(QString url,int width, int height, QWidget *parent = 0); + + private: + static QString guessNameFromUrl(QUrl url); +}; + +//------------------------------------------------------------------------------------------------- + +class BrowseListItem : public ListItem +{ + Q_OBJECT - QStyleOptionViewItemV4 _option; + public: + BrowseListItem(const UrlSearchItem &item, const QString &text, QWidget *parent = 0); + protected: + +}; + +//------------------------------------------------------------------------------------------------- + +class ListItemFactory +{ + public: + static ListItem *create(const UrlSearchItem &item, const QString &text, QWidget *parent = 0); + }; -#endif // LISTITEM_H +#endif
\ No newline at end of file |