Here a patch showing hoverlink preview in urlbar instead of popup at window 
bottom.

What do you think?

Cédric

ps:

Url size patch have not been commited to git, i know url bar may look good 
with oxygen but:
http://kde-apps.org/content/show.php?content=94258&forumpage=9

From QtCurve Dev: "The location bar entry field is too tall. It looks ok with 
oxygen (but still bigger than other oxygen editable combos). But if you use a 
style such as skulpture, bespin, plastique, etc, then it looks way too tall - 
almost the full height of the toolbar."

Same for new tab button, no response to my question, it looks ok with 0.3.10 
but don't understand why calculating Y position...

In fact, with 0.3.10, it works but we can see button jump at rekonq start.

Cédric ;)
diff --git a/src/mainview.cpp b/src/mainview.cpp
index ebcad08..a2e2f6f 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -572,7 +572,7 @@ void MainView::webViewIconChanged()
         label->setMovie(0);
         label->setPixmap(icon.pixmap(16, 16));
 
-        urlBar()->updateUrl();
+        urlBar()->updateUrl(true);
     }
 }
 
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 137f0f2..df5c49f 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -213,7 +213,7 @@ void MainWindow::postLaunch()
 {
     // notification system
     connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), this, SLOT(notifyMessage(const QString&, Rekonq::Notify)));
-    connect(m_view, SIGNAL(linkHovered(const QString&)), this, SLOT(notifyMessage(const QString&)));
+    connect(m_view, SIGNAL(linkHovered(const QString&)), this, SLOT(showLinkInUrlBar(const QString&)));
 
     // --------- connect signals and slots
     connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(updateWindowTitle(const QString &)));
@@ -1070,6 +1070,18 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)
     m_popup->show(QPoint(x,y));
 }
 
+void MainWindow::showLinkInUrlBar(const QString &msg)
+{
+
+    if (this != QApplication::activeWindow())
+    {
+        return;
+    }
+    if (msg == "")
+        m_view->urlBar()->showLink(currentTab()->url());
+    else 
+        m_view->urlBar()->showLink(QUrl(msg));
+}
 
 void MainWindow::clearPrivateData()
 {
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 64ce696..297a41e 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -98,6 +98,9 @@ public slots:
      */
     void notifyMessage(const QString &msg, Rekonq::Notify status = Rekonq::Info);
 
+    // Show current hovered link in url bar
+    void showLinkInUrlBar(const QString &msg);
+
     void printRequested(QWebFrame *frame = 0);
 
 
diff --git a/src/urlbar.cpp b/src/urlbar.cpp
index d2ab66d..3921dab 100644
--- a/src/urlbar.cpp
+++ b/src/urlbar.cpp
@@ -144,10 +144,9 @@ void UrlBar::setUrl(const QUrl& url)
     else
         m_currentUrl = url;
 
-    updateUrl();
+    updateUrl(true);
 }
 
-
 void UrlBar::setProgress(int progress)
 {
     m_progress = progress;
@@ -155,29 +154,42 @@ void UrlBar::setProgress(int progress)
 }
 
 
-void UrlBar::updateUrl()
+void UrlBar::updateUrl(bool updateFavicon)
 {
     // Don't change my typed url...
     // FIXME this is not a proper solution (also if it works...)
-    if(hasFocus())
+    if (hasFocus())
     {
         kDebug() << "Don't change my typed url...";
         return;
     }
 
-    KIcon icon;
-    if(m_currentUrl.isEmpty()) icon = KIcon("arrow-right");
-    else icon = Application::icon(m_currentUrl);
-
-    if (count())
+    if (updateFavicon)
     {
-        changeUrl(0, icon, m_currentUrl);
+        KIcon icon;
+        if(m_currentUrl.isEmpty()) icon = KIcon("arrow-right");
+        else icon = Application::icon(m_currentUrl);
+
+        if (count())
+        {
+            changeUrl(0, icon, m_currentUrl);
+        }
+        else
+        {
+            insertUrl(0, icon, m_currentUrl);
+        }
     }
     else
     {
-        insertUrl(0, icon, m_currentUrl);
+        if (count())
+        {
+            changeUrl(0, m_currentUrl);
+        }
+        else
+        {
+            insertUrl(0, m_currentUrl);
+        }
     }
-
     setCurrentIndex(0);
 
     // important security consideration: always display the beginning
@@ -307,6 +319,12 @@ bool UrlBar::isLoading()
     return true;
 }
 
+void UrlBar::showLink(const QUrl& url)
+{
+    m_currentUrl = url;
+    updateUrl(false);
+}
+
 void UrlBar::keyPressEvent(QKeyEvent *event)
 {
     QString currentText = m_lineEdit->text().trimmed();
@@ -338,4 +356,4 @@ void UrlBar::keyPressEvent(QKeyEvent *event)
     }
 
     KHistoryComboBox::keyPressEvent(event);
-}
\ No newline at end of file
+}
diff --git a/src/urlbar.h b/src/urlbar.h
index 6d8422d..a5d250d 100644
--- a/src/urlbar.h
+++ b/src/urlbar.h
@@ -61,6 +61,7 @@ public:
     QSize sizeHint() const;
     void setBackgroundColor(QColor);
     bool isLoading();
+    void showLink(const QUrl& url);
     
     void setProgress(int progress);
 
@@ -70,7 +71,7 @@ signals:
 public slots:
     void setUrl(const QUrl &url);
     void updateProgress(int progress);
-    void updateUrl();
+    void updateUrl(bool updateFavicon);
     
 private slots:
     void activated(const QString& url);
_______________________________________________
rekonq mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/rekonq

Reply via email to