diff options
Diffstat (limited to 'src/urlbar')
| -rw-r--r-- | src/urlbar/completionwidget.cpp | 6 | ||||
| -rw-r--r-- | src/urlbar/completionwidget.h | 2 | ||||
| -rw-r--r-- | src/urlbar/listitem.cpp | 13 | ||||
| -rw-r--r-- | src/urlbar/listitem.h | 2 | ||||
| -rw-r--r-- | src/urlbar/rsswidget.cpp | 7 | ||||
| -rw-r--r-- | src/urlbar/urlbar.cpp | 15 | ||||
| -rw-r--r-- | src/urlbar/urlresolver.cpp | 44 | ||||
| -rw-r--r-- | src/urlbar/urlresolver.h | 13 | 
8 files changed, 67 insertions, 35 deletions
| diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp index acec2d4f..a71e9611 100644 --- a/src/urlbar/completionwidget.cpp +++ b/src/urlbar/completionwidget.cpp @@ -79,7 +79,7 @@ void CompletionWidget::insertSearchList(const UrlSearchList &list, const QString      {          ListItem *suggestion = ListItemFactory::create(item, text, this);          suggestion->setBackgroundRole(i % 2 ? QPalette::AlternateBase : QPalette::Base); -        connect(suggestion, SIGNAL(itemClicked(ListItem *, Qt::MouseButton)), this, SLOT(itemChosen(ListItem *, Qt::MouseButton))); +        connect(suggestion, SIGNAL(itemClicked(ListItem *, Qt::MouseButton, Qt::KeyboardModifiers)), this, SLOT(itemChosen(ListItem *, Qt::MouseButton, Qt::KeyboardModifiers)));          connect(this, SIGNAL(nextItemSubChoice()), suggestion, SLOT(nextItemSubChoice()));          suggestion->setObjectName(QString::number(i++));          layout()->addWidget(suggestion); @@ -270,9 +270,9 @@ void CompletionWidget::setVisible(bool visible)  } -void CompletionWidget::itemChosen(ListItem *item, Qt::MouseButton button) +void CompletionWidget::itemChosen(ListItem *item, Qt::MouseButton button, Qt::KeyboardModifiers modifier)  { -    if (button == Qt::MidButton) +    if (button == Qt::MidButton || modifier == Qt::ControlModifier)          emit chosenUrl(item->url(), Rekonq::NewCurrentTab);      else          emit chosenUrl(item->url(), Rekonq::CurrentTab); diff --git a/src/urlbar/completionwidget.h b/src/urlbar/completionwidget.h index 90cd2b23..18212d0f 100644 --- a/src/urlbar/completionwidget.h +++ b/src/urlbar/completionwidget.h @@ -64,7 +64,7 @@ public:      void suggestUrls(const QString &text);  private slots: -    void itemChosen(ListItem *item, Qt::MouseButton = Qt::LeftButton); +    void itemChosen(ListItem *item, Qt::MouseButton = Qt::LeftButton, Qt::KeyboardModifiers = Qt::NoModifier);  signals:      void chosenUrl(const KUrl &, Rekonq::OpenType); diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index 13535a74..78a929a8 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -129,7 +129,7 @@ void ListItem::leaveEvent(QEvent *e)  void ListItem::mousePressEvent(QMouseEvent *e)  { -    emit itemClicked(this, e->button()); +    emit itemClicked(this, e->button(), e->modifiers());      QWidget::mousePressEvent(e);  } @@ -220,7 +220,16 @@ PreviewListItem::PreviewListItem(const UrlSearchItem &item, const QString &text,      QVBoxLayout *vLayout = new QVBoxLayout;      vLayout->setMargin(0); -    vLayout->addWidget(new TextLabel(item.title, text, this)); + +    QString title = item.title; +    if (title.isEmpty()) +    { +        title = item.url.url(); +        title = title.remove("http://"); +	title.truncate(title.indexOf("/")); +    } + +    vLayout->addWidget(new TextLabel(title, text, this));      vLayout->addWidget(new TextLabel("<i>" + item.url.url() + "</i>", text, this));      hLayout->addLayout(vLayout); diff --git a/src/urlbar/listitem.h b/src/urlbar/listitem.h index c26a1893..dcb4f76d 100644 --- a/src/urlbar/listitem.h +++ b/src/urlbar/listitem.h @@ -66,7 +66,7 @@ public slots:      virtual void nextItemSubChoice();  signals: -    void itemClicked(ListItem *item, Qt::MouseButton); +    void itemClicked(ListItem *item, Qt::MouseButton, Qt::KeyboardModifiers);  protected:      virtual void paintEvent(QPaintEvent *event); diff --git a/src/urlbar/rsswidget.cpp b/src/urlbar/rsswidget.cpp index 35095c07..6cd63b95 100644 --- a/src/urlbar/rsswidget.cpp +++ b/src/urlbar/rsswidget.cpp @@ -115,9 +115,12 @@ RSSWidget::~RSSWidget()  void RSSWidget::showAt(const QPoint &pos)  { +    adjustSize(); +          QPoint p; -    p.setX(pos.x() - 200); +    p.setX(pos.x() - width());      p.setY(pos.y() + 10); +          move(p);      show();  } @@ -160,7 +163,7 @@ void RSSWidget::addWithAkregator(const QString &url)          if (!reply.isValid())          { -            KMessageBox::error(0, QString(i18n("Could not add stream to akregator, Please add it manually :") +            KMessageBox::error(0, QString(i18n("Could not add feed to Akregator. Please add it manually:")                                            + "<br /><br /> <a href=\"" + url + "\">" + url + "</a>"));          }      } diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index 6ec461a2..b46eccdb 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -91,7 +91,7 @@ UrlBar::UrlBar(QWidget *parent)      setUrlDropsEnabled(true);      // tooltip -    setToolTip(i18n("Type here to search your bookmarks, history and the web..")); +    setToolTip(i18n("Type here to search your bookmarks, history and the web..."));      // accept focus, via tabbing, clicking & wheeling      setFocusPolicy(Qt::WheelFocus); @@ -101,6 +101,8 @@ UrlBar::UrlBar(QWidget *parent)      _tab = qobject_cast<WebTab *>(parent); +    connect(_tab, SIGNAL(loadProgressing()), this, SLOT(update())); +          connect(_tab->view(), SIGNAL(urlChanged(const QUrl &)), this, SLOT(setQUrl(const QUrl &)));      connect(_tab->view(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));      connect(_tab->view(), SIGNAL(loadStarted()), this, SLOT(clearRightIcons())); @@ -152,7 +154,7 @@ void UrlBar::activated(const KUrl& url, Rekonq::OpenType type)  void UrlBar::paintEvent(QPaintEvent *event) -{ +{         QColor backgroundColor;      if (_privateMode)      { @@ -177,10 +179,13 @@ void UrlBar::paintEvent(QPaintEvent *event)      }      else      { -        QColor loadingColor = QColor(116, 192, 250); +        // NOTE: I chose this instead of the old QColor(116, 192, 250) +        // to try respecting style colors +        QColor loadingColor = Application::palette().color(QPalette::ToolTipBase); -        QLinearGradient gradient(0, 0, width(), 0); +        QLinearGradient gradient( QPoint(0, 0), QPoint(width(), height()) );          gradient.setColorAt(0, loadingColor); +        gradient.setColorAt(((double)progr) / 100 - .000001, loadingColor);          gradient.setColorAt(((double)progr) / 100, backgroundColor);          p.setBrush(QPalette::Base, gradient);      } @@ -198,7 +203,7 @@ void UrlBar::paintEvent(QPaintEvent *event)          painter.setPen(Qt::gray);          painter.drawText(textRect,                           Qt::AlignVCenter | Qt::AlignCenter, -                         i18n("Type here to search your bookmarks, history and the web..") +                         i18n("Type here to search your bookmarks, history and the web...")                          );      }  } diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index 21e3fe9c..7333e305 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -74,7 +74,7 @@ UrlResolver::UrlResolver(const QString &typedUrl)      {          kDebug() << "browse regexp empty. Setting value.."; -        QString protocol = "^(http://|https://|file://|ftp://)"; +        QString protocol = "^(http://|https://|file://|ftp://|man:|info:)";          QString local = "^/"; @@ -91,7 +91,7 @@ UrlResolver::UrlResolver(const QString &typedUrl)          "y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|mil|museum|name|net|org|"\          "pro)"; -        _browseRegexp = QRegExp("(" + protocol + ")|(" + local + ")|(" + address + ")|(" + ipv6 + ")|(" + ipv4 +")"); +        _browseRegexp = QRegExp('(' + protocol + ")|(" + local + ")|(" + address + ")|(" + ipv6 + ")|(" + ipv4 +')');      }  } @@ -141,12 +141,23 @@ UrlSearchList UrlResolver::orderedSearchItems()      int checkPoint = 9 - firstResults;      UrlSearchList historyList = historyResolution(); +    UrlSearchItem privileged = privilegedItem(&historyList);      int historyResults = historyList.count(); +     +    UrlSearchList bookmarksList = bookmarksResolution();  +    if (privileged.type == UrlSearchItem::Undefined) +    { +        privileged = privilegedItem(&bookmarksList); +    } +     +    if (privileged.type != UrlSearchItem::Undefined) +    { +        list.insert(0,privileged); +    } -    UrlSearchList bookmarksList = bookmarksResolution(); -    int bookmarkResults = bookmarksList.count(); +    int bookmarksResults = bookmarksList.count(); -    if (historyResults + bookmarkResults > checkPoint) +    if (historyResults + bookmarksResults > checkPoint)      {          historyList = historyList.mid(0, 3);          bookmarksList = bookmarksList.mid(0, 3); @@ -178,8 +189,6 @@ UrlSearchList UrlResolver::orderedSearchItems()              list << i;      } -    list = placeTypedDomaineNameOnTop(list); -      return list;  } @@ -246,22 +255,19 @@ UrlSearchList UrlResolver::bookmarksResolution()  } -UrlSearchList UrlResolver::placeTypedDomaineNameOnTop(UrlSearchList list) +UrlSearchItem UrlResolver::privilegedItem(UrlSearchList* list)  { -    int i = 0; -    bool found = false; - -    while(i<list.count() && !found) +    int i=0; +    while(i<list->count())      { -        UrlSearchItem item = list.at(i); -        if (item.url.url().contains("."+_typedString+".") || item.url.url().contains("/"+_typedString+".")) +        UrlSearchItem item = list->at(i); +        kDebug() << item.url.host(); +        if (item.url.host().contains( _typedString + QL1C('.') ) )          { -            list.removeAt(i); -            list.insert(0,item); -            found = true; +            list->removeAt(i); +            return item;          }          i++;      } -     -    return list; +    return UrlSearchItem();  } diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h index 0c7df8c8..2249ea32 100644 --- a/src/urlbar/urlresolver.h +++ b/src/urlbar/urlresolver.h @@ -45,6 +45,7 @@ public:      enum types      { +        Undefined       = 0x00000000,          Search          = 0x00000001,          Browse          = 0x00000010,          History         = 0x00000100, @@ -54,7 +55,15 @@ public:      int type;      KUrl url;      QString title; - +     +    UrlSearchItem(const UrlSearchItem &item) +    : type(item.type), url(item.url), title(item.title) +    {}; +     +    UrlSearchItem() +    : type(UrlSearchItem::Undefined), url(KUrl()), title("") +    {}; +          UrlSearchItem(const int &_type, const KUrl &_url, const QString &_title = QString())              : type(_type), url(_url), title(_title)      {}; @@ -82,7 +91,7 @@ private:      UrlSearchList historyResolution();      UrlSearchList qurlFromUserInputResolution();      UrlSearchList bookmarksResolution(); -    UrlSearchList placeTypedDomaineNameOnTop(UrlSearchList list); +    UrlSearchItem privilegedItem(UrlSearchList* list);      static QRegExp _browseRegexp;  }; | 
