summaryrefslogtreecommitdiff
path: root/src/urlbar
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-07-17 16:46:24 +0200
committerAndrea Diamantini <adjam7@gmail.com>2011-07-17 16:46:24 +0200
commit82167d2422a4b6e3071dca68cf65a66e1da41ab4 (patch)
tree03c1f95a2aa60c48822a463cc3812b5c3415991e /src/urlbar
parentImproving tab previews (diff)
downloadrekonq-82167d2422a4b6e3071dca68cf65a66e1da41ab4.tar.xz
A round of the "new" astyle 2.01...
Diffstat (limited to 'src/urlbar')
-rw-r--r--src/urlbar/bookmarkwidget.cpp8
-rw-r--r--src/urlbar/completionwidget.cpp72
-rw-r--r--src/urlbar/listitem.cpp120
-rw-r--r--src/urlbar/rsswidget.cpp14
-rw-r--r--src/urlbar/stackedurlbar.cpp4
-rw-r--r--src/urlbar/urlbar.cpp96
-rw-r--r--src/urlbar/urlresolver.cpp78
-rw-r--r--src/urlbar/urlresolver.h40
-rw-r--r--src/urlbar/webshortcutwidget.cpp12
9 files changed, 222 insertions, 222 deletions
diff --git a/src/urlbar/bookmarkwidget.cpp b/src/urlbar/bookmarkwidget.cpp
index a7b3ded0..811e89be 100644
--- a/src/urlbar/bookmarkwidget.cpp
+++ b/src/urlbar/bookmarkwidget.cpp
@@ -46,8 +46,8 @@
BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
- : QMenu(parent)
- , m_bookmark(new KBookmark(bookmark))
+ : QMenu(parent)
+ , m_bookmark(new KBookmark(bookmark))
{
setAttribute(Qt::WA_DeleteOnClose);
setFixedWidth(350);
@@ -81,7 +81,7 @@ BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
QLabel *nameLabel = new QLabel(this);
nameLabel->setText(i18n("Name:"));
m_name = new KLineEdit(this);
- if (m_bookmark->isNull())
+ if(m_bookmark->isNull())
{
m_name->setEnabled(false);
}
@@ -120,7 +120,7 @@ void BookmarkWidget::showAt(const QPoint &pos)
void BookmarkWidget::accept()
{
- if (!m_bookmark->isNull() && m_name->text() != m_bookmark->fullText())
+ if(!m_bookmark->isNull() && m_name->text() != m_bookmark->fullText())
{
m_bookmark->setFullText(m_name->text());
rApp->bookmarkProvider()->bookmarkManager()->emitChanged();
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
index c8209fbc..1f697b19 100644
--- a/src/urlbar/completionwidget.cpp
+++ b/src/urlbar/completionwidget.cpp
@@ -52,10 +52,10 @@
CompletionWidget::CompletionWidget(QWidget *parent)
- : QFrame(parent, Qt::ToolTip)
- , _parent(parent)
- , _currentIndex(0)
- , _hasSuggestions(false)
+ : QFrame(parent, Qt::ToolTip)
+ , _parent(parent)
+ , _currentIndex(0)
+ , _hasSuggestions(false)
{
setFrameStyle(QFrame::Panel);
setLayoutDirection(Qt::LeftToRight);
@@ -68,7 +68,7 @@ CompletionWidget::CompletionWidget(QWidget *parent)
void CompletionWidget::insertItems(const UrlSearchList &list, const QString& text, int offset)
{
- Q_FOREACH(const UrlSearchItem &item, list)
+ Q_FOREACH(const UrlSearchItem & item, list)
{
ListItem *suggestion = ListItemFactory::create(item, text, this);
suggestion->setBackgroundRole(offset % 2 ? QPalette::AlternateBase : QPalette::Base);
@@ -90,11 +90,11 @@ void CompletionWidget::updateSearchList(const UrlSearchList &list, const QString
static int counter = 0;
counter++;
kDebug() << counter;
- if (_hasSuggestions || _typedString != text)
+ if(_hasSuggestions || _typedString != text)
return;
_hasSuggestions = true;
- if (_resList.count() > 0)
+ if(_resList.count() > 0)
{
clear();
@@ -114,7 +114,7 @@ void CompletionWidget::sizeAndPosition()
setFixedWidth(_parent->width());
int h = 0;
- for (int i = 0; i < layout()->count(); i++)
+ for(int i = 0; i < layout()->count(); i++)
{
QWidget *widget = layout()->itemAt(i)->widget();
h += widget->sizeHint().height();
@@ -131,7 +131,7 @@ void CompletionWidget::popup()
{
findChild<ListItem *>(QString::number(0))->activate(); //activate first listitem
sizeAndPosition();
- if (!isVisible())
+ if(!isVisible())
show();
}
@@ -141,7 +141,7 @@ void CompletionWidget::up()
// deactivate previous
findChild<ListItem *>(QString::number(_currentIndex))->deactivate(); // deactivate previous
- if (_currentIndex > 0)
+ if(_currentIndex > 0)
_currentIndex--;
else
_currentIndex = layout()->count() - 1;
@@ -154,7 +154,7 @@ void CompletionWidget::down()
{
findChild<ListItem *>(QString::number(_currentIndex))->deactivate(); // deactivate previous
- if (_currentIndex < _list.count() - 1)
+ if(_currentIndex < _list.count() - 1)
_currentIndex++;
else
_currentIndex = 0;
@@ -183,7 +183,7 @@ void CompletionWidget::activateCurrentListItem()
void CompletionWidget::clear()
{
QLayoutItem *child;
- while ((child = layout()->takeAt(0)) != 0)
+ while((child = layout()->takeAt(0)) != 0)
{
delete child->widget();
delete child;
@@ -198,37 +198,37 @@ bool CompletionWidget::eventFilter(QObject *obj, QEvent *ev)
int type = ev->type();
QWidget *wid = qobject_cast<QWidget*>(obj);
- if (obj == this)
+ if(obj == this)
{
return false;
}
// hide conditions of the CompletionWidget
- if (wid
+ if(wid
&& ((wid == _parent
&& (type == QEvent::Move || type == QEvent::Resize)) || ((wid->windowFlags() & Qt::Window)
&& (type == QEvent::Move || type == QEvent::Hide || type == QEvent::WindowDeactivate)
&& wid == _parent->window()) || (type == QEvent::MouseButtonPress && !isAncestorOf(wid)))
- )
+ )
{
hide();
return false;
}
//actions on the CompletionWidget
- if (wid && wid->isAncestorOf(_parent) && isVisible())
+ if(wid && wid->isAncestorOf(_parent) && isVisible())
{
ListItem *child;
UrlBar *w;
- if (type == QEvent::KeyPress)
+ if(type == QEvent::KeyPress)
{
QKeyEvent *kev = static_cast<QKeyEvent *>(ev);
- switch (kev->key())
+ switch(kev->key())
{
case Qt::Key_Up:
case Qt::Key_Backtab:
- if (kev->modifiers() == Qt::NoButton || (kev->modifiers() & Qt::ShiftModifier))
+ if(kev->modifiers() == Qt::NoButton || (kev->modifiers() & Qt::ShiftModifier))
{
up();
kev->accept();
@@ -238,13 +238,13 @@ bool CompletionWidget::eventFilter(QObject *obj, QEvent *ev)
case Qt::Key_Down:
case Qt::Key_Tab:
- if (kev->modifiers() == Qt::NoButton)
+ if(kev->modifiers() == Qt::NoButton)
{
down();
kev->accept();
return true;
}
- if (kev->modifiers() & Qt::ControlModifier)
+ if(kev->modifiers() & Qt::ControlModifier)
{
emit nextItemSubChoice();
kev->accept();
@@ -255,35 +255,35 @@ bool CompletionWidget::eventFilter(QObject *obj, QEvent *ev)
case Qt::Key_Enter:
case Qt::Key_Return:
w = qobject_cast<UrlBar *>(parent());
- if (kev->modifiers() == Qt::AltModifier)
+ if(kev->modifiers() == Qt::AltModifier)
{
- if (kev->key() == Qt::Key_Return || kev->key() == Qt::Key_Enter)
+ if(kev->key() == Qt::Key_Return || kev->key() == Qt::Key_Enter)
{
emit chosenUrl(w->text(), Rekonq::NewFocusedTab);
}
}
- if (!w->text().startsWith(QL1S("http://"), Qt::CaseInsensitive))
+ if(!w->text().startsWith(QL1S("http://"), Qt::CaseInsensitive))
{
QString append;
- if (kev->modifiers() == Qt::ControlModifier)
+ if(kev->modifiers() == Qt::ControlModifier)
{
append = QL1S(".com");
}
- else if (kev->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier))
+ else if(kev->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier))
{
append = QL1S(".org");
}
- else if (kev->modifiers() == Qt::ShiftModifier)
+ else if(kev->modifiers() == Qt::ShiftModifier)
{
append = QL1S(".net");
}
- if (!append.isEmpty())
+ if(!append.isEmpty())
{
QUrl url(QL1S("http://www.") + w->text());
QString host = url.host();
- if (!host.endsWith(append, Qt::CaseInsensitive))
+ if(!host.endsWith(append, Qt::CaseInsensitive))
{
host += append;
url.setHost(host);
@@ -294,10 +294,10 @@ bool CompletionWidget::eventFilter(QObject *obj, QEvent *ev)
}
- if (_currentIndex == -1)
+ if(_currentIndex == -1)
_currentIndex = 0;
child = findChild<ListItem *>(QString::number(_currentIndex));
- if (child && _currentIndex != 0) //the completionwidget is visible and the user had press down
+ if(child && _currentIndex != 0) //the completionwidget is visible and the user had press down
{
kDebug() << "USING LISTITEM URL: " << child->url();
kDebug() << "USING LISTITEM TITLE: " << child->text();
@@ -336,7 +336,7 @@ bool CompletionWidget::eventFilter(QObject *obj, QEvent *ev)
void CompletionWidget::setVisible(bool visible)
{
- if (visible)
+ if(visible)
{
rApp->installEventFilter(this);
}
@@ -352,7 +352,7 @@ void CompletionWidget::setVisible(bool visible)
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::NewFocusedTab);
@@ -376,16 +376,16 @@ void CompletionWidget::suggestUrls(const QString &text)
_typedString = text;
QWidget *w = qobject_cast<QWidget *>(parent());
- if (!w->hasFocus())
+ if(!w->hasFocus())
return;
- if (text.isEmpty())
+ if(text.isEmpty())
{
hide();
return;
}
- if (!isVisible())
+ if(!isVisible())
{
UrlResolver::setSearchEngine(SearchEngine::defaultEngine());
}
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
index 17a4585d..f268442f 100644
--- a/src/urlbar/listitem.cpp
+++ b/src/urlbar/listitem.cpp
@@ -60,9 +60,9 @@
ListItem::ListItem(const UrlSearchItem &item, QWidget *parent)
- : QWidget(parent)
- , m_option()
- , m_url(item.url)
+ : QWidget(parent)
+ , m_option()
+ , m_url(item.url)
{
m_option.initFrom(this);
m_option.direction = Qt::LeftToRight;
@@ -105,7 +105,7 @@ void ListItem::paintEvent(QPaintEvent *event)
m_option.rect = QRect(QPoint(), size());
painter.fillRect(m_option.rect, palette().brush(backgroundRole()));
- if (m_option.state.testFlag(QStyle::State_Selected) || m_option.state.testFlag(QStyle::State_MouseOver))
+ if(m_option.state.testFlag(QStyle::State_Selected) || m_option.state.testFlag(QStyle::State_MouseOver))
{
style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &m_option, &painter, this);
}
@@ -158,7 +158,7 @@ void ListItem::nextItemSubChoice()
TypeIconLabel::TypeIconLabel(int type, QWidget *parent)
- : QLabel(parent)
+ : QLabel(parent)
{
setMinimumWidth(40);
QHBoxLayout *hLayout = new QHBoxLayout;
@@ -166,15 +166,15 @@ TypeIconLabel::TypeIconLabel(int type, QWidget *parent)
hLayout->setAlignment(Qt::AlignRight);
setLayout(hLayout);
- if (type & UrlSearchItem::Search)
+ if(type & UrlSearchItem::Search)
hLayout->addWidget(getIcon("edit-find"));
- if (type & UrlSearchItem::Browse)
+ if(type & UrlSearchItem::Browse)
hLayout->addWidget(getIcon("applications-internet"));
- if (type & UrlSearchItem::Bookmark)
+ if(type & UrlSearchItem::Bookmark)
hLayout->addWidget(getIcon("rating"));
- if (type & UrlSearchItem::History)
+ if(type & UrlSearchItem::History)
hLayout->addWidget(getIcon("view-history"));
- if (type & UrlSearchItem::Suggestion)
+ if(type & UrlSearchItem::Suggestion)
hLayout->addWidget(getIcon("help-hint"));
}
@@ -193,7 +193,7 @@ QLabel *TypeIconLabel::getIcon(QString icon)
IconLabel::IconLabel(const QString &icon, QWidget *parent)
- : QLabel(parent)
+ : QLabel(parent)
{
QPixmap pixmapIcon = rApp->iconManager()->iconForUrl(KUrl(icon)).pixmap(16);
setFixedSize(16, 16);
@@ -202,7 +202,7 @@ IconLabel::IconLabel(const QString &icon, QWidget *parent)
IconLabel::IconLabel(const KIcon &icon, QWidget *parent)
- : QLabel(parent)
+ : QLabel(parent)
{
QPixmap pixmapIcon = icon.pixmap(16);
setFixedSize(16, 16);
@@ -217,63 +217,63 @@ static QString highlightWordsInText(const QString &text, const QStringList &word
{
QString ret = text;
QBitArray boldSections(ret.size());
- foreach(const QString &wordToPointOut, words)
+ foreach(const QString & wordToPointOut, words)
{
int index = ret.indexOf(wordToPointOut, 0, Qt::CaseInsensitive);
- while (index > -1)
+ while(index > -1)
{
boldSections.fill(true, index, index + wordToPointOut.size());
index = ret.indexOf(wordToPointOut, index + wordToPointOut.size(), Qt::CaseInsensitive);
}
}
-
- if (boldSections.isEmpty())
+
+ if(boldSections.isEmpty())
return ret;
-
+
int numSections = 0;
- for (int i = 0; i < boldSections.size() - 1; ++i)
+ for(int i = 0; i < boldSections.size() - 1; ++i)
{
- if (boldSections.testBit(i) && !boldSections.testBit(i + 1))
+ if(boldSections.testBit(i) && !boldSections.testBit(i + 1))
++numSections;
}
- if (boldSections.testBit(boldSections.size() - 1)) //last char was still part of a bold section
+ if(boldSections.testBit(boldSections.size() - 1)) //last char was still part of a bold section
++numSections;
const int tagLength = 7; // length of "<b>" and "</b>" we're going to add for each bold section.
ret.reserve(ret.size() + numSections * tagLength);
bool bold = false;
- for (int i = boldSections.size() - 1; i >= 0; --i)
+ for(int i = boldSections.size() - 1; i >= 0; --i)
{
- if (!bold && boldSections.testBit(i))
+ if(!bold && boldSections.testBit(i))
{
ret.insert(i + 1, QL1S("</b>"));
bold = true;
}
- else if (bold && !boldSections.testBit(i))
+ else if(bold && !boldSections.testBit(i))
{
ret.insert(i + 1, QL1S("<b>"));
bold = false;
}
}
- if (bold)
+ if(bold)
ret.insert(0, QL1S("<b>"));
return ret;
}
TextLabel::TextLabel(const QString &text, const QString &textToPointOut, QWidget *parent)
- : QLabel(parent)
+ : QLabel(parent)
{
setTextFormat(Qt::RichText);
setMouseTracking(false);
QString t = text;
const bool wasItalic = t.startsWith(QL1S("<i>"));
- if (wasItalic)
+ if(wasItalic)
t.remove(QRegExp(QL1S("<[/ib]*>")));
t = Qt::escape(t);
QStringList words = Qt::escape(textToPointOut.simplified()).split(QL1C(' '));
t = highlightWordsInText(t, words);
- if (wasItalic)
+ if(wasItalic)
t = QL1S("<i>") + t + QL1S("</i>");
setText(t);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
@@ -281,7 +281,7 @@ TextLabel::TextLabel(const QString &text, const QString &textToPointOut, QWidget
TextLabel::TextLabel(QWidget *parent)
- : QLabel(parent)
+ : QLabel(parent)
{
setTextFormat(Qt::RichText);
setMouseTracking(false);
@@ -299,14 +299,14 @@ void TextLabel::setEngineText(const QString &engine, const QString &text)
DescriptionLabel::DescriptionLabel(const QString &text, QWidget *parent)
- : QLabel(parent)
+ : QLabel(parent)
{
QString t = text;
const bool wasItalic = t.startsWith(QL1S("<i>"));
- if (wasItalic)
+ if(wasItalic)
t.remove(QRegExp("<[/ib]*>"));
- if (wasItalic)
+ if(wasItalic)
t = QL1S("<i>") + t + QL1S("</i>");
setWordWrap(false); //TODO: why setWordWrap(true) make items have a strange behavior ?
@@ -319,7 +319,7 @@ DescriptionLabel::DescriptionLabel(const QString &text, QWidget *parent)
PreviewListItem::PreviewListItem(const UrlSearchItem &item, const QString &text, QWidget *parent)
- : ListItem(item, parent)
+ : ListItem(item, parent)
{
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setSpacing(4);
@@ -335,7 +335,7 @@ PreviewListItem::PreviewListItem(const UrlSearchItem &item, const QString &text,
vLayout->setMargin(0);
QString title = item.title;
- if (title.isEmpty())
+ if(title.isEmpty())
{
title = item.url;
title = title.remove("http://");
@@ -357,13 +357,13 @@ PreviewListItem::PreviewListItem(const UrlSearchItem &item, const QString &text,
PreviewLabel::PreviewLabel(const QString &url, int width, int height, QWidget *parent)
- : QLabel(parent)
+ : QLabel(parent)
{
setFixedSize(width, height);
setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
KUrl u = KUrl(url);
- if (WebSnap::existsImage(KUrl(u)))
+ if(WebSnap::existsImage(KUrl(u)))
{
QPixmap preview;
preview.load(WebSnap::imagePathFromUrl(u));
@@ -376,11 +376,11 @@ PreviewLabel::PreviewLabel(const QString &url, int width, int height, QWidget *p
ImageLabel::ImageLabel(const QString &url, int width, int height, QWidget *parent)
- : QLabel(parent),
- m_url(url)
+ : QLabel(parent),
+ m_url(url)
{
setFixedSize(width, height);
- if (WebSnap::existsImage(KUrl(url)))
+ if(WebSnap::existsImage(KUrl(url)))
{
QPixmap pix;
pix.load(WebSnap::imagePathFromUrl(url));
@@ -407,7 +407,7 @@ void ImageLabel::slotData(KIO::Job *job, const QByteArray &data)
void ImageLabel::slotResult(KJob *)
{
QPixmap pix;
- if (!pix.loadFromData(m_data))
+ if(!pix.loadFromData(m_data))
kDebug() << "error while loading image: ";
setPixmap(pix);
pix.save(WebSnap::imagePathFromUrl(m_url), "PNG");
@@ -418,8 +418,8 @@ void ImageLabel::slotResult(KJob *)
SearchListItem::SearchListItem(const UrlSearchItem &item, const QString &text, QWidget *parent)
- : ListItem(item, parent)
- , m_text(text)
+ : ListItem(item, parent)
+ , m_text(text)
{
m_iconLabel = new IconLabel(SearchEngine::buildQuery(UrlResolver::searchEngine(), ""), this);
m_titleLabel = new TextLabel(this);
@@ -464,7 +464,7 @@ void SearchListItem::nextItemSubChoice()
EngineBar::EngineBar(KService::Ptr selectedEngine, QWidget *parent)
- : KToolBar(parent)
+ : KToolBar(parent)
{
setIconSize(QSize(16, 16));
setToolButtonStyle(Qt::ToolButtonIconOnly);
@@ -472,12 +472,12 @@ EngineBar::EngineBar(KService::Ptr selectedEngine, QWidget *parent)
m_engineGroup = new QActionGroup(this);
m_engineGroup->setExclusive(true);
- if (SearchEngine::defaultEngine().isNull())
+ if(SearchEngine::defaultEngine().isNull())
return;
m_engineGroup->addAction(newEngineAction(SearchEngine::defaultEngine(), selectedEngine));
- foreach(const KService::Ptr &engine, SearchEngine::favorites())
+ foreach(const KService::Ptr & engine, SearchEngine::favorites())
{
- if (engine->desktopEntryName() != SearchEngine::defaultEngine()->desktopEntryName())
+ if(engine->desktopEntryName() != SearchEngine::defaultEngine()->desktopEntryName())
{
m_engineGroup->addAction(newEngineAction(engine, selectedEngine));
}
@@ -495,7 +495,7 @@ KAction *EngineBar::newEngineAction(KService::Ptr engine, KService::Ptr selected
kDebug() << "Engine NAME: " << engine->name() << " URL: " << url;
KAction *a = new KAction(rApp->iconManager()->iconForUrl(url), engine->name(), this);
a->setCheckable(true);
- if (engine->desktopEntryName() == selectedEngine->desktopEntryName()) a->setChecked(true);
+ if(engine->desktopEntryName() == selectedEngine->desktopEntryName()) a->setChecked(true);
a->setData(engine->entryPath());
connect(a, SIGNAL(triggered(bool)), this, SLOT(changeSearchEngine()));
return a;
@@ -513,12 +513,12 @@ void EngineBar::selectNextEngine()
{
QList<QAction *> e = m_engineGroup->actions();
int i = 0;
- while (i < e.count() && !e.at(i)->isChecked())
+ while(i < e.count() && !e.at(i)->isChecked())
{
i++;
}
- if (i + 1 == e.count())
+ if(i + 1 == e.count())
{
e.at(0)->setChecked(true);
e.at(0)->trigger();
@@ -535,8 +535,8 @@ void EngineBar::selectNextEngine()
SuggestionListItem::SuggestionListItem(const UrlSearchItem &item, const QString &text, QWidget *parent)
- : ListItem(item, parent)
- , m_text(item.title)
+ : ListItem(item, parent)
+ , m_text(item.title)
{
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setSpacing(4);
@@ -559,15 +559,15 @@ QString SuggestionListItem::text()
VisualSuggestionListItem::VisualSuggestionListItem(const UrlSearchItem &item, const QString &text, QWidget *parent)
- : ListItem(item, parent)
- , m_text(item.title)
+ : ListItem(item, parent)
+ , m_text(item.title)
{
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setSpacing(4);
QLabel *previewLabelIcon = new QLabel(this);
- if (!item.image.isEmpty())
+ if(!item.image.isEmpty())
{
previewLabelIcon->setFixedSize(item.image_width + 10, item.image_height + 10);
new ImageLabel(item.image, item.image_width, item.image_height, previewLabelIcon);
@@ -605,7 +605,7 @@ QString VisualSuggestionListItem::text()
BrowseListItem::BrowseListItem(const UrlSearchItem &item, const QString &text, QWidget *parent)
- : ListItem(item, parent)
+ : ListItem(item, parent)
{
QString url = text;
@@ -627,34 +627,34 @@ BrowseListItem::BrowseListItem(const UrlSearchItem &item, const QString &text, Q
ListItem *ListItemFactory::create(const UrlSearchItem &item, const QString &text, QWidget *parent)
{
- if (item.type & UrlSearchItem::Search)
+ if(item.type & UrlSearchItem::Search)
{
kDebug() << "Search";
return new SearchListItem(item, text, parent);
}
- if (item.type & UrlSearchItem::Browse)
+ if(item.type & UrlSearchItem::Browse)
{
kDebug() << "Browse";
return new BrowseListItem(item, text, parent);
}
- if (item.type & UrlSearchItem::History)
+ if(item.type & UrlSearchItem::History)
{
kDebug() << "History";
return new PreviewListItem(item, text, parent);
}
- if (item.type & UrlSearchItem::Bookmark)
+ if(item.type & UrlSearchItem::Bookmark)
{
kDebug() << "Bookmark";
return new PreviewListItem(item, text, parent);
}
- if (item.type & UrlSearchItem::Suggestion)
+ if(item.type & UrlSearchItem::Suggestion)
{
kDebug() << "ITEM URL: " << item.url;
- if (item.description.isEmpty())
+ if(item.description.isEmpty())
{
kDebug() << "Suggestion";
return new SuggestionListItem(item, text, parent);
diff --git a/src/urlbar/rsswidget.cpp b/src/urlbar/rsswidget.cpp
index 006b2999..fc926e38 100644
--- a/src/urlbar/rsswidget.cpp
+++ b/src/urlbar/rsswidget.cpp
@@ -52,8 +52,8 @@
RSSWidget::RSSWidget(const QMap< KUrl, QString > &map, QWidget *parent)
- : QMenu(parent)
- , m_map(map)
+ : QMenu(parent)
+ , m_map(map)
{
setAttribute(Qt::WA_DeleteOnClose);
setMinimumWidth(250);
@@ -85,7 +85,7 @@ RSSWidget::RSSWidget(const QMap< KUrl, QString > &map, QWidget *parent)
m_feeds = new KComboBox(this);
m_feeds->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- foreach(const QString &title, m_map)
+ foreach(const QString & title, m_map)
{
m_feeds->addItem(title);
}
@@ -121,7 +121,7 @@ void RSSWidget::accept()
{
QString url = m_map.key(m_feeds->currentText()).toMimeDataString();
- if (m_agregators->currentIndex() == 0)
+ if(m_agregators->currentIndex() == 0)
addWithAkregator(url);
else
addWithGoogleReader(url);
@@ -140,12 +140,12 @@ void RSSWidget::addWithGoogleReader(const QString &url)
void RSSWidget::addWithAkregator(const QString &url)
{
// Akregator is running
- if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.akregator"))
+ if(QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.akregator"))
{
QDBusInterface akregator("org.kde.akregator", "/Akregator", "org.kde.akregator.part");
QDBusReply<void> reply = akregator.call("addFeedsToGroup", QStringList(url) , i18n("Imported Feeds"));
- if (!reply.isValid())
+ if(!reply.isValid())
{
KMessageBox::error(0, QString(i18n("Could not add feed to Akregator. Please add it manually:")
+ "<br /><br /> <a href=\"" + url + "\">" + url + "</a>"));
@@ -157,7 +157,7 @@ void RSSWidget::addWithAkregator(const QString &url)
KProcess proc;
proc << "akregator" << "-g" << i18n("Imported Feeds");
proc << "-a" << url;
- if (proc.startDetached() == 0)
+ if(proc.startDetached() == 0)
{
KMessageBox::error(0, QString(i18n("There was an error. Please verify Akregator is installed on your system.")
+ "<br /><br /> <a href=\"" + url + "\">" + url + "</a>"));
diff --git a/src/urlbar/stackedurlbar.cpp b/src/urlbar/stackedurlbar.cpp
index 1df9ce54..745818e3 100644
--- a/src/urlbar/stackedurlbar.cpp
+++ b/src/urlbar/stackedurlbar.cpp
@@ -33,7 +33,7 @@
StackedUrlBar::StackedUrlBar(QWidget *parent)
- : QStackedWidget(parent)
+ : QStackedWidget(parent)
{
// cosmetic
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
@@ -51,7 +51,7 @@ UrlBar *StackedUrlBar::currentUrlBar()
UrlBar *StackedUrlBar::urlBar(int index)
{
UrlBar *urlBar = qobject_cast<UrlBar*>(QStackedWidget::widget(index));
- if (!urlBar)
+ if(!urlBar)
{
kWarning() << "URL bar with index" << index << "not found. Returning NULL. line:" << __LINE__;
}
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 078dc6a6..292bf6c8 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -60,7 +60,7 @@
IconButton::IconButton(QWidget *parent)
- : QToolButton(parent)
+ : QToolButton(parent)
{
setToolButtonStyle(Qt::ToolButtonIconOnly);
setStyleSheet("IconButton { background-color:transparent; border: none; padding: 0px}");
@@ -78,10 +78,10 @@ void IconButton::mouseReleaseEvent(QMouseEvent* event)
UrlBar::UrlBar(QWidget *parent)
- : KLineEdit(parent)
- , _tab(0)
- , _icon(new IconButton(this))
- , _suggestionTimer(new QTimer(this))
+ : KLineEdit(parent)
+ , _tab(0)
+ , _icon(new IconButton(this))
+ , _suggestionTimer(new QTimer(this))
{
// initial style
setStyleSheet(QString("UrlBar { padding: 0 0 0 %1px;} ").arg(_icon->sizeHint().width()));
@@ -133,7 +133,7 @@ UrlBar::~UrlBar()
void UrlBar::setQUrl(const QUrl& url)
{
- if (url.scheme() == QL1S("about"))
+ if(url.scheme() == QL1S("about"))
{
clear();
setFocus();
@@ -163,7 +163,7 @@ void UrlBar::paintEvent(QPaintEvent *event)
QColor backgroundColor;
QColor foregroundColor;
- if (QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
+ if(QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
{
backgroundColor = QColor(220, 220, 220); // light gray
foregroundColor = Qt::black;
@@ -178,9 +178,9 @@ void UrlBar::paintEvent(QPaintEvent *event)
QPalette p = palette();
int progr = _tab->progress();
- if (progr == 0)
+ if(progr == 0)
{
- if (_tab->url().scheme() == QL1S("https"))
+ if(_tab->url().scheme() == QL1S("https"))
{
backgroundColor = colorScheme.background(KColorScheme::NeutralBackground).color(); // light yellow
foregroundColor = colorScheme.foreground(KColorScheme::NormalText).color();
@@ -198,7 +198,7 @@ void UrlBar::paintEvent(QPaintEvent *event)
QColor loadingColor(r, g, b);
- if (abs(loadingColor.lightness() - backgroundColor.lightness()) < 20) //eg. Gaia color scheme
+ if(abs(loadingColor.lightness() - backgroundColor.lightness()) < 20) //eg. Gaia color scheme
{
r = (2 * highlight.red() + backgroundColor.red()) / 3;
g = (2 * highlight.green() + backgroundColor.green()) / 3;
@@ -217,7 +217,7 @@ void UrlBar::paintEvent(QPaintEvent *event)
// you need this before our code to draw inside the line edit..
KLineEdit::paintEvent(event);
- if (text().isEmpty() && progr == 0)
+ if(text().isEmpty() && progr == 0)
{
QStyleOptionFrame option;
initStyleOption(&option);
@@ -236,36 +236,36 @@ void UrlBar::keyPressEvent(QKeyEvent *event)
{
// this handles the Modifiers + Return key combinations
QString currentText = text().trimmed();
- if (event->modifiers() == Qt::AltModifier)
+ if(event->modifiers() == Qt::AltModifier)
{
- if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)
+ if(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)
{
activated(currentText, Rekonq::NewFocusedTab);
}
}
- if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
+ if((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
&& !currentText.startsWith(QL1S("http://"), Qt::CaseInsensitive)
&& event->modifiers() != Qt::NoModifier)
{
QString append;
- if (event->modifiers() == Qt::ControlModifier)
+ if(event->modifiers() == Qt::ControlModifier)
{
append = QL1S(".com");
}
- else if (event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier))
+ else if(event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier))
{
append = QL1S(".org");
}
- else if (event->modifiers() == Qt::ShiftModifier)
+ else if(event->modifiers() == Qt::ShiftModifier)
{
append = QL1S(".net");
}
- if (!append.isEmpty())
+ if(!append.isEmpty())
{
QUrl url(QL1S("http://www.") + currentText);
QString host = url.host();
- if (!host.endsWith(append, Qt::CaseInsensitive))
+ if(!host.endsWith(append, Qt::CaseInsensitive))
{
host += append;
url.setHost(host);
@@ -276,17 +276,17 @@ void UrlBar::keyPressEvent(QKeyEvent *event)
}
}
- else if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
- && !currentText.isEmpty())
+ else if((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
+ && !currentText.isEmpty())
{
loadTyped(currentText);
}
- else if (event->key() == Qt::Key_Escape)
+ else if(event->key() == Qt::Key_Escape)
{
clearFocus();
- if (text() != rApp->mainWindow()->currentTab()->view()->url().toString()
- && !rApp->mainWindow()->currentTab()->view()->url().toString().startsWith("about"))
+ if(text() != rApp->mainWindow()->currentTab()->view()->url().toString()
+ && !rApp->mainWindow()->currentTab()->view()->url().toString().startsWith("about"))
setText(rApp->mainWindow()->currentTab()->view()->url().toString());
event->accept();
}
@@ -306,11 +306,11 @@ void UrlBar::focusInEvent(QFocusEvent *event)
void UrlBar::dropEvent(QDropEvent *event)
{
//handles only plain-text with url format
- if (event->mimeData()->hasFormat("text/plain") && event->source() != this)
+ if(event->mimeData()->hasFormat("text/plain") && event->source() != this)
{
QUrl url = QUrl::fromUserInput(event->mimeData()->data("text/plain"));
- if (url.isValid())
+ if(url.isValid())
{
setQUrl(url);
activated(text());
@@ -326,7 +326,7 @@ void UrlBar::dropEvent(QDropEvent *event)
void UrlBar::loadFinished()
{
- if (_tab->url().scheme() == QL1S("about"))
+ if(_tab->url().scheme() == QL1S("about"))
{
update();
return;
@@ -337,28 +337,28 @@ void UrlBar::loadFinished()
connect(bt, SIGNAL(clicked(const QPoint &)), this, SLOT(showBookmarkInfo(const QPoint &)));
// show KGet downloads??
- if (!KStandardDirs::findExe("kget").isNull() && ReKonfig::kgetList())
+ if(!KStandardDirs::findExe("kget").isNull() && ReKonfig::kgetList())
{
IconButton *bt = addRightIcon(UrlBar::KGet);
connect(bt, SIGNAL(clicked(QPoint)), _tab->page(), SLOT(downloadAllContentsWithKGet(QPoint)));
}
// show RSS
- if (_tab->hasRSSInfo())
+ if(_tab->hasRSSInfo())
{
IconButton *bt = addRightIcon(UrlBar::RSS);
connect(bt, SIGNAL(clicked(QPoint)), _tab, SLOT(showRSSInfo(QPoint)));
}
// show SSL
- if (_tab->url().scheme() == QL1S("https"))
+ if(_tab->url().scheme() == QL1S("https"))
{
IconButton *bt = addRightIcon(UrlBar::SSL);
connect(bt, SIGNAL(clicked(QPoint)), _tab->page(), SLOT(showSSLInfo(QPoint)));
}
// show add search engine
- if (_tab->hasNewSearchEngine())
+ if(_tab->hasNewSearchEngine())
{
IconButton *bt = addRightIcon(UrlBar::SearchEngine);
connect(bt, SIGNAL(clicked(QPoint)), _tab, SLOT(showSearchEngine(QPoint)));
@@ -375,16 +375,16 @@ void UrlBar::loadFinished()
void UrlBar::showBookmarkInfo(const QPoint &pos)
{
- if (_tab->url().scheme() == QL1S("about"))
+ if(_tab->url().scheme() == QL1S("about"))
return;
KBookmark bookmark = rApp->bookmarkProvider()->bookmarkForUrl(_tab->url());
IconButton *bt = qobject_cast<IconButton *>(this->sender());
- if (!bt)
+ if(!bt)
return;
- if (bookmark.isNull())
+ if(bookmark.isNull())
{
bookmark = rApp->bookmarkProvider()->bookmarkOwner()->bookmarkCurrentPage();
@@ -403,7 +403,7 @@ void UrlBar::showBookmarkInfo(const QPoint &pos)
void UrlBar::updateRightIcons()
{
- if (!_tab->isPageLoading())
+ if(!_tab->isPageLoading())
{
clearRightIcons();
loadFinished();
@@ -419,9 +419,9 @@ void UrlBar::loadTyped(const QString &text)
void UrlBar::activateSuggestions(bool b)
{
- if (b)
+ if(b)
{
- if (_box.isNull())
+ if(_box.isNull())
{
_box = new CompletionWidget(this);
installEventFilter(_box.data());
@@ -450,7 +450,7 @@ IconButton *UrlBar::addRightIcon(UrlBar::icon ic)
{
IconButton *rightIcon = new IconButton(this);
- switch (ic)
+ switch(ic)
{
case UrlBar::KGet:
rightIcon->setIcon(KIcon("download"));
@@ -465,7 +465,7 @@ IconButton *UrlBar::addRightIcon(UrlBar::icon ic)
rightIcon->setToolTip(i18n("Show SSL Info"));
break;
case UrlBar::BK:
- if (rApp->bookmarkProvider()->bookmarkForUrl(_tab->url()).isNull())
+ if(rApp->bookmarkProvider()->bookmarkForUrl(_tab->url()).isNull())
{
rightIcon->setIcon(KIcon("bookmarks").pixmap(32, 32, QIcon::Disabled));
rightIcon->setToolTip(i18n("Bookmark this page"));
@@ -479,7 +479,7 @@ IconButton *UrlBar::addRightIcon(UrlBar::icon ic)
case UrlBar::SearchEngine:
{
KIcon wsIcon("edit-web-search");
- if (wsIcon.isNull())
+ if(wsIcon.isNull())
{
wsIcon = KIcon("preferences-web-browser-shortcuts");
}
@@ -495,7 +495,7 @@ IconButton *UrlBar::addRightIcon(UrlBar::icon ic)
_rightIconsList << rightIcon;
int iconsCount = _rightIconsList.count();
int iconHeight = (height() - 18) / 2;
- rightIcon->move(width() - 23*iconsCount, iconHeight);
+ rightIcon->move(width() - 23 * iconsCount, iconHeight);
rightIcon->show();
return rightIcon;
@@ -517,10 +517,10 @@ void UrlBar::resizeEvent(QResizeEvent *event)
int iconsCount = _rightIconsList.count();
int w = width();
- for (int i = 0; i < iconsCount; ++i)
+ for(int i = 0; i < iconsCount; ++i)
{
IconButton *bt = _rightIconsList.at(i);
- bt->move(w - 25*(i + 1), newHeight);
+ bt->move(w - 25 * (i + 1), newHeight);
}
KLineEdit::resizeEvent(event);
@@ -529,13 +529,13 @@ void UrlBar::resizeEvent(QResizeEvent *event)
void UrlBar::detectTypedString(const QString &typed)
{
- if (typed.count() == 1)
+ if(typed.count() == 1)
{
QTimer::singleShot(0, this, SLOT(suggest()));
return;
}
- if (_suggestionTimer->isActive())
+ if(_suggestionTimer->isActive())
_suggestionTimer->stop();
_suggestionTimer->start(50);
}
@@ -543,21 +543,21 @@ void UrlBar::detectTypedString(const QString &typed)
void UrlBar::suggest()
{
- if (!_box.isNull())
+ if(!_box.isNull())
_box.data()->suggestUrls(text());
}
void UrlBar::refreshFavicon()
{
- if (QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
+ if(QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
{
_icon->setIcon(KIcon("view-media-artist"));
return;
}
KUrl u = _tab->url();
- if (u.scheme() == QL1S("about"))
+ if(u.scheme() == QL1S("about"))
{
_icon->setIcon(KIcon("arrow-right"));
return;
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp
index d89f27d0..0d8ecc12 100644
--- a/src/urlbar/urlresolver.cpp
+++ b/src/urlbar/urlresolver.cpp
@@ -67,14 +67,14 @@ QRegExp UrlResolver::_searchEnginesRegexp;
UrlResolver::UrlResolver(const QString &typedUrl)
- : QObject()
- , _typedString(typedUrl.trimmed())
- , _typedQuery()
+ : QObject()
+ , _typedString(typedUrl.trimmed())
+ , _typedQuery()
{
- if (!_searchEngine)
+ if(!_searchEngine)
setSearchEngine(SearchEngine::defaultEngine());
- if (_browseRegexp.isEmpty())
+ if(_browseRegexp.isEmpty())
{
kDebug() << "browse regexp empty. Setting value..";
@@ -100,14 +100,14 @@ UrlResolver::UrlResolver(const QString &typedUrl)
_browseRegexp = QRegExp('(' + protocol + ")|(" + localhost + ")|(" + local + ")|(" + address + ")|(" + ipv6 + ")|(" + ipv4 + ')');
}
- if (_searchEnginesRegexp.isEmpty())
+ if(_searchEnginesRegexp.isEmpty())
{
QString reg;
QString engineUrl;
Q_FOREACH(KService::Ptr s, SearchEngine::favorites())
{
engineUrl = QRegExp::escape(s->property("Query").toString()).replace("\\\\\\{@\\}", "[\\d\\w-.]+");
- if (reg.isEmpty())
+ if(reg.isEmpty())
reg = '(' + engineUrl + ')';
else
reg = reg + "|(" + engineUrl + ')';
@@ -119,7 +119,7 @@ UrlResolver::UrlResolver(const QString &typedUrl)
UrlSearchList UrlResolver::orderedSearchItems()
{
- if (_typedString.startsWith(QL1S("about:")))
+ if(_typedString.startsWith(QL1S("about:")))
{
UrlSearchList list;
UrlSearchItem home(UrlSearchItem::Browse, QString("about:home"), QL1S("home"));
@@ -162,7 +162,7 @@ UrlSearchList UrlResolver::orderLists()
UrlSearchList list;
- if (_browseRegexp.indexIn(_typedString) != -1)
+ if(_browseRegexp.indexIn(_typedString) != -1)
{
list << _qurlFromUserInput;
list << _webSearches;
@@ -183,19 +183,19 @@ UrlSearchList UrlResolver::orderLists()
// prefer items which are history items as well bookmarks item
// if there are more than 1000 bookmark results, the performance impact is noticeable
- if (bookmarksCount < 1000)
+ if(bookmarksCount < 1000)
{
//add as many items to the common list as there are available entries in the dropdown list
UrlSearchItem urlSearchItem;
- for (int i = 0; i < _history.count(); i++)
+ for(int i = 0; i < _history.count(); i++)
{
- if (_bookmarks.removeOne(_history.at(i)))
+ if(_bookmarks.removeOne(_history.at(i)))
{
urlSearchItem = _history.takeAt(i);
urlSearchItem.type |= UrlSearchItem::Bookmark;
common << urlSearchItem;
commonCount++;
- if (commonCount >= availableEntries)
+ if(commonCount >= availableEntries)
{
break;
}
@@ -203,7 +203,7 @@ UrlSearchList UrlResolver::orderLists()
}
commonCount = common.count();
- if (commonCount >= availableEntries)
+ if(commonCount >= availableEntries)
{
common = common.mid(0, availableEntries);
_history = UrlSearchList();
@@ -213,11 +213,11 @@ UrlSearchList UrlResolver::orderLists()
else //remove all items from the history and bookmarks list up to the remaining entries in the dropdown list
{
availableEntries -= commonCount;
- if (historyCount >= availableEntries)
+ if(historyCount >= availableEntries)
{
_history = _history.mid(0, availableEntries);
}
- if (bookmarksCount >= availableEntries)
+ if(bookmarksCount >= availableEntries)
{
_bookmarks = _bookmarks.mid(0, availableEntries);
}
@@ -226,19 +226,19 @@ UrlSearchList UrlResolver::orderLists()
else //if there are too many bookmarks items, remove all items up to the remaining entries in the dropdown list
{
- if (historyCount >= availableEntries)
+ if(historyCount >= availableEntries)
{
_history = _history.mid(0, availableEntries);
}
- if (bookmarksCount >= availableEntries)
+ if(bookmarksCount >= availableEntries)
{
_bookmarks = _bookmarks.mid(0, availableEntries);
}
UrlSearchItem urlSearchItem;
- for (int i = 0; i < _history.count(); i++)
+ for(int i = 0; i < _history.count(); i++)
{
- if (_bookmarks.removeOne(_history.at(i)))
+ if(_bookmarks.removeOne(_history.at(i)))
{
urlSearchItem = _history.takeAt(i);
urlSearchItem.type |= UrlSearchItem::Bookmark;
@@ -256,26 +256,26 @@ UrlSearchList UrlResolver::orderLists()
kDebug() << "HISTORY COUNT: " << historyCount;
//now fill the list to MAX_ELEMENTS
- if (availableEntries > 0)
+ if(availableEntries > 0)
{
int historyEntries = ((int)(availableEntries / 2)) + availableEntries % 2;
int bookmarksEntries = availableEntries - historyEntries;
- if (historyCount >= historyEntries && bookmarksCount >= bookmarksEntries)
+ if(historyCount >= historyEntries && bookmarksCount >= bookmarksEntries)
{
_history = _history.mid(0, historyEntries);
_bookmarks = _bookmarks.mid(0, bookmarksEntries);
}
- else if (historyCount < historyEntries && bookmarksCount >= bookmarksEntries)
+ else if(historyCount < historyEntries && bookmarksCount >= bookmarksEntries)
{
- if (historyCount + bookmarksCount > availableEntries)
+ if(historyCount + bookmarksCount > availableEntries)
{
_bookmarks = _bookmarks.mid(0, availableEntries - historyCount);
}
}
- else if (historyCount >= historyEntries && bookmarksCount < bookmarksEntries)
+ else if(historyCount >= historyEntries && bookmarksCount < bookmarksEntries)
{
- if (historyCount + bookmarksCount > availableEntries)
+ if(historyCount + bookmarksCount > availableEntries)
{
_history = _history.mid(0, availableEntries - bookmarksCount);
}
@@ -285,7 +285,7 @@ UrlSearchList UrlResolver::orderLists()
availableEntries -= _history.count();
availableEntries -= _bookmarks.count();
- if (_suggestions.count() > availableEntries + MIN_SUGGESTIONS)
+ if(_suggestions.count() > availableEntries + MIN_SUGGESTIONS)
{
_suggestions = _suggestions.mid(0, availableEntries + MIN_SUGGESTIONS);
}
@@ -306,7 +306,7 @@ void UrlResolver::computeQurlFromUserInput()
{
QString url = _typedString;
QUrl urlFromUserInput = QUrl::fromUserInput(url);
- if (urlFromUserInput.isValid())
+ if(urlFromUserInput.isValid())
{
QString gTitle = i18nc("Browse a website", "Browse");
UrlSearchItem gItem(UrlSearchItem::Browse, urlFromUserInput.toString(), gTitle);
@@ -320,13 +320,13 @@ void UrlResolver::computeWebSearches()
{
QString query = _typedString;
KService::Ptr engine = SearchEngine::fromString(_typedString);
- if (engine)
+ if(engine)
{
query = query.remove(0, _typedString.indexOf(SearchEngine::delimiter()) + 1);
setSearchEngine(engine);
}
- if (_searchEngine)
+ if(_searchEngine)
{
UrlSearchItem item = UrlSearchItem(UrlSearchItem::Search, SearchEngine::buildQuery(_searchEngine, query), query);
UrlSearchList list;
@@ -342,9 +342,9 @@ void UrlResolver::computeHistory()
QList<HistoryItem> found = rApp->historyManager()->find(_typedString);
qSort(found);
- Q_FOREACH(const HistoryItem &i, found)
+ Q_FOREACH(const HistoryItem & i, found)
{
- if (_searchEnginesRegexp.indexIn(i.url) == -1) //filter all urls that are search engine results
+ if(_searchEnginesRegexp.indexIn(i.url) == -1) //filter all urls that are search engine results
{
UrlSearchItem gItem(UrlSearchItem::History, i.url, i.title);
_history << gItem;
@@ -358,7 +358,7 @@ void UrlResolver::computeBookmarks()
{
QList<KBookmark> found = rApp->bookmarkProvider()->find(_typedString);
kDebug() << "FOUND: " << found.count();
- Q_FOREACH(const KBookmark &b, found)
+ Q_FOREACH(const KBookmark & b, found)
{
UrlSearchItem gItem(UrlSearchItem::Bookmark, b.url().url(), b.fullText());
_bookmarks << gItem;
@@ -371,7 +371,7 @@ void UrlResolver::computeSuggestions()
{
// if a string startsWith /, it is probably a local path
// so, no need for suggestions...
- if (_typedString.startsWith('/') || !rApp->opensearchManager()->isSuggestionAvailable())
+ if(_typedString.startsWith('/') || !rApp->opensearchManager()->isSuggestionAvailable())
{
UrlSearchList list;
emit suggestionsReady(list, _typedString);
@@ -380,7 +380,7 @@ void UrlResolver::computeSuggestions()
QString query = _typedString;
KService::Ptr engine = SearchEngine::fromString(_typedString);
- if (engine)
+ if(engine)
{
query = query.remove(0, _typedString.indexOf(SearchEngine::delimiter()) + 1);
setSearchEngine(engine);
@@ -398,15 +398,15 @@ void UrlResolver::computeSuggestions()
void UrlResolver::suggestionsReceived(const QString &text, const ResponseList &suggestions)
{
- if (text != _typedQuery)
+ if(text != _typedQuery)
return;
UrlSearchList sugList;
QString urlString;
- Q_FOREACH(const Response &i, suggestions)
+ Q_FOREACH(const Response & i, suggestions)
{
urlString = i.url;
- if (urlString.isEmpty())
+ if(urlString.isEmpty())
{
urlString = SearchEngine::buildQuery(UrlResolver::searchEngine(), i.title);
}
@@ -425,7 +425,7 @@ void UrlResolver::suggestionsReceived(const QString &text, const ResponseList &s
// QString dot = QString(QL1C('.'));
// QString test1 = QString(QL1C('/')) + _typedString + dot;
// QString test2 = dot + _typedString + dot;
-//
+//
// for (int i = 0; i < list->count(); i++)
// {
// item = list->at(i);
diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h
index 030d1deb..48ffece0 100644
--- a/src/urlbar/urlresolver.h
+++ b/src/urlbar/urlresolver.h
@@ -69,21 +69,21 @@ public:
QString bookmarkPath;
UrlSearchItem(const UrlSearchItem &item) : type(item.type),
- url(item.url),
- title(item.title),
- description(item.description),
- image(item.image),
- image_width(item.image_width),
- image_height(item.image_height)
+ url(item.url),
+ title(item.title),
+ description(item.description),
+ image(item.image),
+ image_width(item.image_width),
+ image_height(item.image_height)
{};
UrlSearchItem() : type(UrlSearchItem::Undefined),
- url(QString()),
- title(QString()),
- description(QString()),
- image(QString()),
- image_width(0),
- image_height(0)
+ url(QString()),
+ title(QString()),
+ description(QString()),
+ image(QString()),
+ image_width(0),
+ image_height(0)
{};
UrlSearchItem(const int &_type,
@@ -94,13 +94,13 @@ public:
const int &_image_width = 0,
const int &_image_height = 0
)
- : type(_type),
- url(_url),
- title(_title),
- description(_description),
- image(_image),
- image_width(_image_width),
- image_height(_image_height)
+ : type(_type),
+ url(_url),
+ title(_title),
+ description(_description),
+ image(_image),
+ image_width(_image_width),
+ image_height(_image_height)
{};
inline bool operator==(const UrlSearchItem &i) const
@@ -132,7 +132,7 @@ public:
static void setSearchEngine(KService::Ptr engine)
{
_searchEngine = engine;
- if (engine)
+ if(engine)
rApp->opensearchManager()->setSearchProvider(engine->desktopEntryName());
};
diff --git a/src/urlbar/webshortcutwidget.cpp b/src/urlbar/webshortcutwidget.cpp
index bf281177..492f2d83 100644
--- a/src/urlbar/webshortcutwidget.cpp
+++ b/src/urlbar/webshortcutwidget.cpp
@@ -37,7 +37,7 @@
#include <KServiceTypeTrader>
WebShortcutWidget::WebShortcutWidget(QWidget *parent)
- : QDialog(parent)
+ : QDialog(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout();
QHBoxLayout *titleLayout = new QHBoxLayout();
@@ -45,7 +45,7 @@ WebShortcutWidget::WebShortcutWidget(QWidget *parent)
QLabel *iconLabel = new QLabel(this);
KIcon wsIcon("edit-web-search");
- if (wsIcon.isNull())
+ if(wsIcon.isNull())
{
wsIcon = KIcon("preferences-web-browser-shortcuts");
}
@@ -154,11 +154,11 @@ void WebShortcutWidget::shortcutsChanged(const QString& newShorthands)
QString contenderName = "";
QString contenderWS = "";
- Q_FOREACH(const QString &shorthand, shorthands)
+ Q_FOREACH(const QString & shorthand, shorthands)
{
Q_FOREACH(KService::Ptr provider, m_providers)
{
- if (provider->property("Keys").toStringList().contains(shorthand))
+ if(provider->property("Keys").toStringList().contains(shorthand))
{
contenderName = provider->property("Name").toString();
contenderWS = shorthand;
@@ -167,7 +167,7 @@ void WebShortcutWidget::shortcutsChanged(const QString& newShorthands)
}
}
- if (!contenderName.isEmpty())
+ if(!contenderName.isEmpty())
{
m_okButton->setEnabled(false);
m_noteLabel->setText(i18n("The shortcut \"%1\" is already assigned to \"%2\".", contenderWS, contenderName));
@@ -180,7 +180,7 @@ void WebShortcutWidget::shortcutsChanged(const QString& newShorthands)
m_noteLabel->clear();
bool noteIsVisible = m_noteLabel->isVisible();
m_noteLabel->setVisible(false);
- if (noteIsVisible)
+ if(noteIsVisible)
{
resize(minimumSize());
}