summaryrefslogtreecommitdiff
path: root/src/urlbar/urlbar.cpp
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/urlbar.cpp
parentImproving tab previews (diff)
downloadrekonq-82167d2422a4b6e3071dca68cf65a66e1da41ab4.tar.xz
A round of the "new" astyle 2.01...
Diffstat (limited to 'src/urlbar/urlbar.cpp')
-rw-r--r--src/urlbar/urlbar.cpp96
1 files changed, 48 insertions, 48 deletions
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;