diff options
| author | Peter Penz <[email protected]> | 2007-02-17 18:25:46 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-02-17 18:25:46 +0000 |
| commit | 4bf793794fd3842b857acde4af5db83be3a1f15d (patch) | |
| tree | b111f951d1c1791063de2f98e93aef5639e9e40d /src/urlnavigator.h | |
| parent | 00b23eaa5233666bf7fa04800ae365234b50aed4 (diff) | |
Allow the pasting of a text clipboard content to the URL navigator by pressing the middle mouse button. Although this is quite a hidden feature, I think it makes happy a lot of people who just want to paste a URL available as text to the URL navigator without switching from the breadcrump view to the traditional view.
Very nice "side effect": the URL navigator is now completely flicker free when changing URLs because of using the whole available width :-)
TODO: I'm not 100 % sure whether checking the middle mousebutton by 'if (event->button() == Qt::MidButton) { ... }' is the right approach (maybe there is a more generic way to check the 'paste button').
svn path=/trunk/KDE/kdebase/apps/; revision=634595
Diffstat (limited to 'src/urlnavigator.h')
| -rw-r--r-- | src/urlnavigator.h | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/urlnavigator.h b/src/urlnavigator.h index b2e1da90e..6a3d7d579 100644 --- a/src/urlnavigator.h +++ b/src/urlnavigator.h @@ -22,13 +22,15 @@ #ifndef URLNAVIGATOR_H #define URLNAVIGATOR_H -#include <khbox.h> #include <kurl.h> +#include <QWidget> #include <QLinkedList> +class QCheckBox; +class QHBoxLayout; class QLabel; class QLineEdit; -class QCheckBox; +class QMouseEvent; class KUrl; class KFileItem; @@ -58,7 +60,7 @@ class ProtocolCombo; typedef QLinkedList<KUrl> UrlStack; -class UrlNavigator : public KHBox +class UrlNavigator : public QWidget { Q_OBJECT @@ -221,10 +223,18 @@ signals: const KUrl& destination); protected: - /** If the Escape key is pressed, the navigation bar should switch - to the browse mode. */ + /** + * If the Escape key is pressed, the navigation bar should switch + * to the browse mode. + */ virtual void keyReleaseEvent(QKeyEvent* event); + /** + * Paste the clipboard content as URL, if the middle mouse + * button has been clicked. + */ + virtual void mouseReleaseEvent(QMouseEvent* event); + private slots: void slotReturnPressed(const QString& text); void slotUrlActivated(const KUrl& url); @@ -270,9 +280,19 @@ private: */ void deleteButtons(); + /** + * Appends the widget at the end of the URL navigator. It is assured + * that the filler widget remains as last widget to fill the remaining + * width. + */ + void appendWidget(QWidget* widget); + private: bool m_active; int m_historyIndex; + + QHBoxLayout* m_layout; + QLinkedList<HistoryElem> m_history; QCheckBox* m_toggleButton; BookmarkSelector* m_bookmarkSelector; |
