summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/adblock/adblockmanager.cpp150
-rw-r--r--src/adblock/adblockmanager.h72
-rw-r--r--src/adblock/adblocknetworkreply.cpp8
-rw-r--r--src/adblock/adblocknetworkreply.h4
-rw-r--r--src/adblock/adblockrule.cpp72
-rw-r--r--src/adblock/adblockrule.h14
-rw-r--r--src/application.cpp158
-rw-r--r--src/application.h64
-rw-r--r--src/bookmarks/bookmarkcontextmenu.cpp48
-rw-r--r--src/bookmarks/bookmarksmanager.cpp66
-rw-r--r--src/bookmarks/bookmarksmanager.h14
-rw-r--r--src/bookmarks/bookmarkspanel.cpp46
-rw-r--r--src/bookmarks/bookmarksproxy.cpp18
-rw-r--r--src/bookmarks/bookmarksproxy.h6
-rw-r--r--src/bookmarks/bookmarkstreemodel.cpp172
-rw-r--r--src/bookmarks/bookmarkstreemodel.h12
-rw-r--r--src/clicktoflash.cpp48
-rw-r--r--src/clicktoflash.h12
-rw-r--r--src/filterurljob.cpp14
-rw-r--r--src/filterurljob.h8
-rw-r--r--src/findbar.cpp20
-rw-r--r--src/findbar.h4
-rw-r--r--src/history/autosaver.cpp4
-rw-r--r--src/history/autosaver.h4
-rw-r--r--src/history/historymanager.cpp50
-rw-r--r--src/history/historymanager.h24
-rw-r--r--src/history/historymodels.cpp8
-rw-r--r--src/history/historymodels.h4
-rw-r--r--src/history/historypanel.cpp26
-rw-r--r--src/history/historypanel.h6
-rw-r--r--src/main.cpp14
-rw-r--r--src/mainview.cpp180
-rw-r--r--src/mainview.h16
-rw-r--r--src/mainwindow.cpp292
-rw-r--r--src/mainwindow.h8
-rw-r--r--src/networkaccessmanager.cpp32
-rw-r--r--src/networkaccessmanager.h4
-rw-r--r--src/newtabpage.cpp272
-rw-r--r--src/newtabpage.h32
-rw-r--r--src/paneltreeview.cpp44
-rw-r--r--src/previewselectorbar.cpp40
-rw-r--r--src/previewselectorbar.h22
-rw-r--r--src/protocolhandler.cpp176
-rw-r--r--src/protocolhandler.h16
-rw-r--r--src/rekonqprivate_export.h12
-rw-r--r--src/searchengine.cpp60
-rw-r--r--src/searchengine.h10
-rw-r--r--src/sessionmanager.cpp12
-rw-r--r--src/sessionmanager.h2
-rw-r--r--src/settings/adblockwidget.cpp92
-rw-r--r--src/settings/adblockwidget.h10
-rw-r--r--src/settings/networkwidget.cpp40
-rw-r--r--src/settings/networkwidget.h6
-rw-r--r--src/settings/settingsdialog.cpp52
-rw-r--r--src/settings/settingsdialog.h6
-rw-r--r--src/sslinfodialog_p.h4
-rw-r--r--src/tabbar.cpp82
-rw-r--r--src/tabbar.h14
-rw-r--r--src/tests/findbar_test.cpp8
-rw-r--r--src/tests/mainview_test.cpp42
-rw-r--r--src/tests/mainwindow_test.cpp6
-rw-r--r--src/tests/networkaccessmanager_test.cpp10
-rw-r--r--src/tests/protocolhandler_test.cpp42
-rw-r--r--src/tests/sessionmanager_test.cpp10
-rw-r--r--src/tests/tabbar_test.cpp38
-rw-r--r--src/tests/urlbar_test.cpp10
-rw-r--r--src/tests/walletbar_test.cpp10
-rw-r--r--src/tests/webpage_test.cpp14
-rw-r--r--src/tests/websnap_test.cpp10
-rw-r--r--src/tests/webtab_test.cpp8
-rw-r--r--src/tests/webview_test.cpp10
-rw-r--r--src/urlbar/completionwidget.cpp172
-rw-r--r--src/urlbar/completionwidget.h20
-rw-r--r--src/urlbar/listitem.cpp170
-rw-r--r--src/urlbar/listitem.h40
-rw-r--r--src/urlbar/rsswidget.cpp52
-rw-r--r--src/urlbar/rsswidget.h12
-rw-r--r--src/urlbar/urlbar.cpp130
-rw-r--r--src/urlbar/urlbar.h12
-rw-r--r--src/urlbar/urlresolver.cpp84
-rw-r--r--src/urlbar/urlresolver.h16
-rw-r--r--src/walletbar.cpp32
-rw-r--r--src/walletbar.h8
-rw-r--r--src/webinspectorpanel.cpp22
-rw-r--r--src/webinspectorpanel.h14
-rw-r--r--src/webpage.cpp340
-rw-r--r--src/webpage.h14
-rw-r--r--src/webpluginfactory.cpp26
-rw-r--r--src/webpluginfactory.h10
-rw-r--r--src/websnap.cpp60
-rw-r--r--src/websnap.h16
-rw-r--r--src/websslinfo.cpp161
-rw-r--r--src/websslinfo.h54
-rw-r--r--src/webtab.cpp76
-rw-r--r--src/webtab.h8
-rw-r--r--src/webview.cpp192
-rw-r--r--src/webview.h10
97 files changed, 2350 insertions, 2325 deletions
diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp
index 0a139bdc..26874e39 100644
--- a/src/adblock/adblockmanager.cpp
+++ b/src/adblock/adblockmanager.cpp
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -47,10 +47,10 @@
AdBlockManager::AdBlockManager(QObject *parent)
- : QObject(parent)
- , _isAdblockEnabled(false)
- , _isHideAdsEnabled(false)
- , _index(0)
+ : QObject(parent)
+ , _isAdblockEnabled(false)
+ , _isHideAdsEnabled(false)
+ , _index(0)
{
}
@@ -64,38 +64,38 @@ void AdBlockManager::loadSettings(bool checkUpdateDate)
{
_index = 0;
_buffer.clear();
-
+
_whiteList.clear();
_blackList.clear();
_hideList.clear();
-
+
_isAdblockEnabled = ReKonfig::adBlockEnabled();
kDebug() << "ADBLOCK ENABLED = " << _isAdblockEnabled;
-
+
// no need to load filters if adblock is not enabled :)
- if(!_isAdblockEnabled)
+ if (!_isAdblockEnabled)
return;
-
+
// just to be sure..
_isHideAdsEnabled = ReKonfig::hideAdsEnabled();
-
+
// local settings
KSharedConfig::Ptr config = KGlobal::config();
- KConfigGroup rulesGroup( config, "rules" );
+ KConfigGroup rulesGroup(config, "rules");
QStringList rules;
- rules = rulesGroup.readEntry( "local-rules" , QStringList() );
+ rules = rulesGroup.readEntry("local-rules" , QStringList());
loadRules(rules);
// ----------------------------------------------------------
-
+
QDateTime today = QDateTime::currentDateTime();
QDateTime lastUpdate = ReKonfig::lastUpdate(); // the day of the implementation.. :)
int days = ReKonfig::updateInterval();
-
- if( !checkUpdateDate || today > lastUpdate.addDays( days ) )
+
+ if (!checkUpdateDate || today > lastUpdate.addDays(days))
{
- ReKonfig::setLastUpdate( today );
-
+ ReKonfig::setLastUpdate(today);
+
updateNextSubscription();
return;
}
@@ -104,7 +104,7 @@ void AdBlockManager::loadSettings(bool checkUpdateDate)
QStringList titles = ReKonfig::subscriptionTitles();
foreach(const QString &title, titles)
{
- rules = rulesGroup.readEntry( title + "-rules" , QStringList() );
+ rules = rulesGroup.readEntry(title + "-rules" , QStringList());
loadRules(rules);
}
}
@@ -115,34 +115,34 @@ void AdBlockManager::loadRules(const QStringList &rules)
foreach(const QString &stringRule, rules)
{
// ! rules are comments
- if( stringRule.startsWith('!') )
+ if (stringRule.startsWith('!'))
continue;
-
+
// [ rules are ABP infos
- if( stringRule.startsWith('[') )
+ if (stringRule.startsWith('['))
continue;
-
- // empty rules are just dangerous..
+
+ // empty rules are just dangerous..
// (an empty rule in whitelist allows all, in blacklist blocks all..)
- if( stringRule.isEmpty() )
+ if (stringRule.isEmpty())
continue;
-
+
// white rules
- if( stringRule.startsWith( QLatin1String("@@") ) )
+ if (stringRule.startsWith(QLatin1String("@@")))
{
- AdBlockRule rule( stringRule.mid(2) );
+ AdBlockRule rule(stringRule.mid(2));
_whiteList << rule;
continue;
}
-
+
// hide (CSS) rules
- if( stringRule.startsWith( QLatin1String("##") ) )
+ if (stringRule.startsWith(QLatin1String("##")))
{
_hideList << stringRule.mid(2);
continue;
}
- AdBlockRule rule( stringRule );
+ AdBlockRule rule(stringRule);
_blackList << rule;
}
}
@@ -152,39 +152,39 @@ QNetworkReply *AdBlockManager::block(const QNetworkRequest &request, WebPage *pa
{
if (!_isAdblockEnabled)
return 0;
-
+
// we (ad)block just http traffic
- if(request.url().scheme() != QLatin1String("http"))
+ if (request.url().scheme() != QLatin1String("http"))
return 0;
-
+
QString urlString = request.url().toString();
// check white rules before :)
foreach(const AdBlockRule &filter, _whiteList)
{
- if(filter.match(urlString))
+ if (filter.match(urlString))
{
kDebug() << "****ADBLOCK: WHITE RULE (@@) Matched: ***********";
kDebug() << "Filter exp: " << filter.pattern();
kDebug() << "UrlString: " << urlString;
- return 0;
+ return 0;
}
}
-
+
// then check the black ones :(
foreach(const AdBlockRule &filter, _blackList)
{
- if(filter.match(urlString))
+ if (filter.match(urlString))
{
kDebug() << "****ADBLOCK: BLACK RULE Matched: ***********";
kDebug() << "Filter exp: " << filter.pattern();
kDebug() << "UrlString: " << urlString;
-
+
QWebElement document = page->mainFrame()->documentElement();
QWebElementCollection elements = document.findAll("*");
- foreach (QWebElement el, elements)
+ foreach(QWebElement el, elements)
{
- if(filter.match( el.attribute("src") ) )
+ if (filter.match(el.attribute("src")))
{
kDebug() << "MATCHES ATTRIBUTE!!!!!";
el.setStyleProperty(QLatin1String("visibility"), QLatin1String("hidden"));
@@ -192,12 +192,12 @@ QNetworkReply *AdBlockManager::block(const QNetworkRequest &request, WebPage *pa
el.setStyleProperty(QLatin1String("height"), QLatin1String("0"));
}
}
-
+
AdBlockNetworkReply *reply = new AdBlockNetworkReply(request, urlString, this);
- return reply;
+ return reply;
}
}
-
+
// no match
return 0;
}
@@ -205,25 +205,25 @@ QNetworkReply *AdBlockManager::block(const QNetworkRequest &request, WebPage *pa
void AdBlockManager::applyHidingRules(WebPage *page)
{
- if(!page)
+ if (!page)
return;
-
+
if (!_isAdblockEnabled)
return;
-
+
if (!_isHideAdsEnabled)
return;
QWebElement document = page->mainFrame()->documentElement();
-
+
// HIDE RULES
foreach(const QString &filter, _hideList)
{
QWebElementCollection elements = document.findAll(filter);
- foreach (QWebElement el, elements)
+ foreach(QWebElement el, elements)
{
- if(el.isNull())
+ if (el.isNull())
continue;
kDebug() << "Hide element: " << el.localName();
el.setStyleProperty(QLatin1String("visibility"), QLatin1String("hidden"));
@@ -236,17 +236,17 @@ void AdBlockManager::applyHidingRules(WebPage *page)
void AdBlockManager::updateNextSubscription()
{
QStringList locations = ReKonfig::subscriptionLocations();
-
- if( _index < locations.size() )
+
+ if (_index < locations.size())
{
QString urlString = locations.at(_index);
kDebug() << "DOWNLOADING FROM " << urlString;
- KUrl subUrl = KUrl( urlString );
-
- KIO::TransferJob* job = KIO::get( subUrl , KIO::Reload , KIO::HideProgressInfo );
- connect(job, SIGNAL(data(KIO::Job*, const QByteArray&)), this, SLOT(subscriptionData(KIO::Job*, const QByteArray&)));
+ KUrl subUrl = KUrl(urlString);
+
+ KIO::TransferJob* job = KIO::get(subUrl , KIO::Reload , KIO::HideProgressInfo);
+ connect(job, SIGNAL(data(KIO::Job*, const QByteArray&)), this, SLOT(subscriptionData(KIO::Job*, const QByteArray&)));
connect(job, SIGNAL(result(KJob*)), this, SLOT(slotResult(KJob*)));
-
+
return;
}
@@ -258,7 +258,7 @@ void AdBlockManager::updateNextSubscription()
void AdBlockManager::slotResult(KJob *job)
{
kDebug() << "SLOTRESULT";
- if(job->error())
+ if (job->error())
return;
QList<QByteArray> list = _buffer.split('\n');
@@ -270,9 +270,9 @@ void AdBlockManager::slotResult(KJob *job)
}
loadRules(ruleList);
saveRules(ruleList);
-
+
_index++;
-
+
// last..
updateNextSubscription();
}
@@ -282,13 +282,13 @@ void AdBlockManager::subscriptionData(KIO::Job* job, const QByteArray& data)
{
kDebug() << "subscriptionData";
Q_UNUSED(job)
-
+
if (data.isEmpty())
return;
-
+
int oldSize = _buffer.size();
- _buffer.resize( _buffer.size() + data.size() );
- memcpy( _buffer.data() + oldSize, data.data(), data.size() );
+ _buffer.resize(_buffer.size() + data.size());
+ memcpy(_buffer.data() + oldSize, data.data(), data.size());
}
@@ -297,32 +297,32 @@ void AdBlockManager::saveRules(const QStringList &rules)
QStringList cleanedRules;
foreach(const QString &r, rules)
{
- if( !r.startsWith('!') && !r.startsWith('[') && !r.isEmpty() )
+ if (!r.startsWith('!') && !r.startsWith('[') && !r.isEmpty())
cleanedRules << r;
}
-
+
QStringList titles = ReKonfig::subscriptionTitles();
QString title = titles.at(_index) + "-rules";
-
+
KSharedConfig::Ptr config = KGlobal::config();
- KConfigGroup cg( config , "rules" );
- cg.writeEntry( title, cleanedRules );
+ KConfigGroup cg(config , "rules");
+ cg.writeEntry(title, cleanedRules);
}
void AdBlockManager::addSubscription(const QString &title, const QString &location)
{
QStringList titles = ReKonfig::subscriptionTitles();
- if( titles.contains(title) )
+ if (titles.contains(title))
return;
-
+
QStringList locations = ReKonfig::subscriptionLocations();
- if( locations.contains(location) )
+ if (locations.contains(location))
return;
-
+
titles << title;
locations << location;
-
+
ReKonfig::setSubscriptionTitles(titles);
ReKonfig::setSubscriptionLocations(locations);
}
diff --git a/src/adblock/adblockmanager.h b/src/adblock/adblockmanager.h
index 9b1cc915..20ca1b6e 100644
--- a/src/adblock/adblockmanager.h
+++ b/src/adblock/adblockmanager.h
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -30,42 +30,42 @@
// NOTE: AdBlockPlus Filters (fast) summary
-//
+//
// ### Basic Filter rules
-//
-// RULE = http://example.com/ads/*
+//
+// RULE = http://example.com/ads/*
// this should block every link containing all things from that link
-//
+//
// ### Exception rules (@@)
-//
+//
// RULE = @@advice*
-//
+//
// this will save every site, also that matched by other rules, cointaining words
// that starts with "advice". Wildcards && regular expression allowed here.
-//
+//
// ### Beginning/end matching rules (||)
-//
+//
// RULE=||http://badsite.com
-//
+//
// will stop all links starting with http://badsite.com
-//
+//
// RULE=*swf||
-//
+//
// will stop all links to direct flash contents
-//
+//
// ### Comments (!)
-//
+//
// RULE=!azz..
-//
+//
// Every rule starting with a ! is commented out and should not be checked
-//
+//
// ### Filter Options
-//
-// You can also specify a number of options to modify the behavior of a filter.
+//
+// You can also specify a number of options to modify the behavior of a filter.
// You list these options separated with commas after a dollar sign ($) at the end of the filter
-//
+//
// RULE=*/ads/*$element,match-case
-//
+//
// where $element can be one of the following:
// $script external scripts loaded via HTML script tag
// $image regular images, typically loaded via HTML img tag
@@ -80,25 +80,25 @@
// $subdocument embedded pages, usually included via HTML frames
// $document the page itself (only exception rules can be applied to the page)
// $other types of requests not covered in the list above
-//
+//
// Inverse type options are allowed through the ~ sign, for example:
-//
+//
// RULE=*/ads/*~$script,match-case
-//
+//
// ### Regular expressions
-//
+//
// They usually allow to check for (a lot of) sites, using just one rule, but be careful:
// BASIC FILTERS ARE PROCESSED FASTER THAN REGULAR EXPRESSIONS (In ADP! In rekonq, I don't know...)
-//
-//
+//
+//
// ### ELEMENT HIDING (##)
-//
-// This is quite different from usual adblock (but, for me, more powerful!). Sometimes you will find advertisements
+//
+// This is quite different from usual adblock (but, for me, more powerful!). Sometimes you will find advertisements
// that can’t be blocked because they are embedded as text in the web page itself.
// All you can do there is HIDE the element :)
-//
+//
// RULE=##div.advise
-//
+//
// The previous rule will hide every div whose class is named "advise". Usual CSS selectors apply here :)
//
// END NOTE ----------------------------------------------------------------------------------------------------------
@@ -125,8 +125,8 @@ typedef QList<AdBlockRule> AdBlockRuleList;
class REKONQ_TESTS_EXPORT AdBlockManager : public QObject
{
-Q_OBJECT
-
+ Q_OBJECT
+
public:
AdBlockManager(QObject *parent = 0);
~AdBlockManager();
@@ -134,7 +134,7 @@ public:
QNetworkReply *block(const QNetworkRequest &request, WebPage *page);
void applyHidingRules(WebPage *page);
void addSubscription(const QString &title, const QString &location);
-
+
public slots:
void loadSettings(bool checkUpdateDate = true);
@@ -142,11 +142,11 @@ private:
void updateNextSubscription();
void saveRules(const QStringList &);
void loadRules(const QStringList &);
-
+
private slots:
void slotResult(KJob *);
void subscriptionData(KIO::Job*, const QByteArray&);
-
+
private:
bool _isAdblockEnabled;
bool _isHideAdsEnabled;
diff --git a/src/adblock/adblocknetworkreply.cpp b/src/adblock/adblocknetworkreply.cpp
index 3b73b8a0..e0ba3b77 100644
--- a/src/adblock/adblocknetworkreply.cpp
+++ b/src/adblock/adblocknetworkreply.cpp
@@ -36,9 +36,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
+ * by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -63,12 +63,12 @@
AdBlockNetworkReply::AdBlockNetworkReply(const QNetworkRequest &request, const QString &urlString, QObject *parent)
- : QNetworkReply(parent)
+ : QNetworkReply(parent)
{
setOperation(QNetworkAccessManager::GetOperation);
setRequest(request);
setUrl(request.url());
- setError(QNetworkReply::ContentAccessDenied, i18n("Blocked by AdBlockRule: %1", urlString) );
+ setError(QNetworkReply::ContentAccessDenied, i18n("Blocked by AdBlockRule: %1", urlString));
QTimer::singleShot(0, this, SLOT(delayedFinished()));
}
diff --git a/src/adblock/adblocknetworkreply.h b/src/adblock/adblocknetworkreply.h
index bbc3471e..c70ecb38 100644
--- a/src/adblock/adblocknetworkreply.h
+++ b/src/adblock/adblocknetworkreply.h
@@ -36,9 +36,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
+ * by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/adblock/adblockrule.cpp b/src/adblock/adblockrule.cpp
index c0c3fd5b..d11cc026 100644
--- a/src/adblock/adblockrule.cpp
+++ b/src/adblock/adblockrule.cpp
@@ -38,9 +38,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
+ * by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -67,34 +67,34 @@
AdBlockRule::AdBlockRule(const QString &filter)
- : m_optionMatchRule(false)
+ : m_optionMatchRule(false)
{
bool isRegExpRule = false;
QString parsedLine = filter;
-
- if ( parsedLine.startsWith( QL1C('/') ) && parsedLine.endsWith( QL1C('/') ) )
+
+ if (parsedLine.startsWith(QL1C('/')) && parsedLine.endsWith(QL1C('/')))
{
parsedLine = parsedLine.mid(1);
parsedLine = parsedLine.left(parsedLine.size() - 1);
isRegExpRule = true;
}
-
- int optionsNumber = parsedLine.indexOf( QL1C('$'), 0);
+
+ int optionsNumber = parsedLine.indexOf(QL1C('$'), 0);
QStringList options;
-
- if (optionsNumber >= 0)
+
+ if (optionsNumber >= 0)
{
options = parsedLine.mid(optionsNumber + 1).split(QL1C(','));
parsedLine = parsedLine.left(optionsNumber);
}
- if(!isRegExpRule)
+ if (!isRegExpRule)
parsedLine = convertPatternToRegExp(parsedLine);
-
+
m_regExp = QRegExp(parsedLine, Qt::CaseInsensitive, QRegExp::RegExp2);
- if ( options.contains( QL1S("match-case") ))
+ if (options.contains(QL1S("match-case")))
{
m_regExp.setCaseSensitivity(Qt::CaseSensitive);
m_optionMatchRule = true;
@@ -111,19 +111,19 @@ bool AdBlockRule::match(const QString &encodedUrl) const
// TODO: Reimplement this in rekonq 0.5 :)
//
-// if (matched && !m_options.isEmpty())
+// if (matched && !m_options.isEmpty())
// {
// // we only support domain right now
// if (m_options.count() == 1)
// {
-// foreach (const QString &option, m_options)
+// foreach (const QString &option, m_options)
// {
-// if (option.startsWith( QL1S("domain=") ))
+// if (option.startsWith( QL1S("domain=") ))
// {
// QUrl url = QUrl::fromEncoded(encodedUrl.toUtf8());
// QString host = url.host();
// QStringList domainOptions = option.mid(7).split( QL1C('|') );
-// foreach (QString domainOption, domainOptions)
+// foreach (QString domainOption, domainOptions)
// {
// bool negate = domainOption.at(0) == QL1C('~');
// if (negate)
@@ -147,36 +147,36 @@ bool AdBlockRule::match(const QString &encodedUrl) const
QString AdBlockRule::convertPatternToRegExp(const QString &wildcardPattern)
{
QString pattern = wildcardPattern;
-
+
// remove multiple wildcards
- pattern.replace(QRegExp( QL1S("\\*+") ), QL1S("*") );
-
+ pattern.replace(QRegExp(QL1S("\\*+")), QL1S("*"));
+
// remove anchors following separator placeholder
- pattern.replace(QRegExp( QL1S("\\^\\|$") ), QL1S("^") );
-
+ pattern.replace(QRegExp(QL1S("\\^\\|$")), QL1S("^"));
+
// remove leading wildcards
- pattern.replace(QRegExp( QL1S("^(\\*)") ), QL1S("") );
-
+ pattern.replace(QRegExp(QL1S("^(\\*)")), QL1S(""));
+
// remove trailing wildcards
- pattern.replace(QRegExp( QL1S("(\\*)$") ), QL1S("") );
-
+ pattern.replace(QRegExp(QL1S("(\\*)$")), QL1S(""));
+
// escape special symbols
- pattern.replace(QRegExp( QL1S("(\\W)") ), QL1S("\\\\1") );
-
+ pattern.replace(QRegExp(QL1S("(\\W)")), QL1S("\\\\1"));
+
// process extended anchor at expression start
- pattern.replace(QRegExp( QL1S("^\\\\\\|\\\\\\|") ), QL1S("^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?") );
-
+ pattern.replace(QRegExp(QL1S("^\\\\\\|\\\\\\|")), QL1S("^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?"));
+
// process separator placeholders
- pattern.replace(QRegExp( QL1S("\\\\\\^") ), QL1S("(?:[^\\w\\d\\-.%]|$)") );
-
+ pattern.replace(QRegExp(QL1S("\\\\\\^")), QL1S("(?:[^\\w\\d\\-.%]|$)"));
+
// process anchor at expression start
- pattern.replace(QRegExp( QL1S("^\\\\\\|") ), QL1S("^") );
-
+ pattern.replace(QRegExp(QL1S("^\\\\\\|")), QL1S("^"));
+
// process anchor at expression end
- pattern.replace(QRegExp( QL1S("\\\\\\|$") ), QL1S("$") );
-
+ pattern.replace(QRegExp(QL1S("\\\\\\|$")), QL1S("$"));
+
// replace wildcards by .*
- pattern.replace(QRegExp( QL1S("\\\\\\*") ), QL1S(".*") );
+ pattern.replace(QRegExp(QL1S("\\\\\\*")), QL1S(".*"));
// Finally, return...
return pattern;
diff --git a/src/adblock/adblockrule.h b/src/adblock/adblockrule.h
index ee4825d1..8990630a 100644
--- a/src/adblock/adblockrule.h
+++ b/src/adblock/adblockrule.h
@@ -37,9 +37,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
+ * by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -69,14 +69,14 @@ public:
AdBlockRule(const QString &filter);
bool match(const QString &encodedUrl) const;
-
+
QString pattern() const;
-
-private:
+
+private:
QString convertPatternToRegExp(const QString &wildcardPattern);
-
+
QRegExp m_regExp;
-
+
// Rule Options
bool m_optionMatchRule;
};
diff --git a/src/application.cpp b/src/application.cpp
index fd030232..0302558f 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -12,9 +12,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -71,10 +71,10 @@ QWeakPointer<AdBlockManager> Application::s_adblockManager;
Application::Application()
- : KUniqueApplication()
+ : KUniqueApplication()
{
- connect(Weaver::instance(), SIGNAL( jobDone(ThreadWeaver::Job*) ),
- this, SLOT( loadResolvedUrl(ThreadWeaver::Job*) ) );
+ connect(Weaver::instance(), SIGNAL(jobDone(ThreadWeaver::Job*)),
+ this, SLOT(loadResolvedUrl(ThreadWeaver::Job*)));
}
@@ -84,8 +84,8 @@ Application::~Application()
// Don't recover on next load..
ReKonfig::setRecoverOnCrash(0);
saveConfiguration();
-
- foreach( QWeakPointer<MainWindow> window, m_mainWindows)
+
+ foreach(QWeakPointer<MainWindow> window, m_mainWindows)
{
delete window.data();
window.clear();
@@ -93,13 +93,13 @@ Application::~Application()
delete s_bookmarkProvider.data();
s_bookmarkProvider.clear();
-
+
delete s_historyManager.data();
s_historyManager.clear();
-
+
delete s_sessionManager.data();
s_sessionManager.clear();
-
+
delete s_adblockManager.data();
s_adblockManager.clear();
}
@@ -107,7 +107,7 @@ Application::~Application()
int Application::newInstance()
{
- KCmdLineArgs::setCwd( QDir::currentPath().toUtf8() );
+ KCmdLineArgs::setCwd(QDir::currentPath().toUtf8());
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
bool isFirstLoad = m_mainWindows.isEmpty();
@@ -121,52 +121,52 @@ int Application::newInstance()
kDebug() << "session restored";
return 1;
}
-
- if(args->count() == 0)
+
+ if (args->count() == 0)
{
- if(isFirstLoad) // we are starting rekonq, for the first time with no args: use startup behaviour
+ if (isFirstLoad) // we are starting rekonq, for the first time with no args: use startup behaviour
{
- switch(ReKonfig::startupBehaviour())
+ switch (ReKonfig::startupBehaviour())
{
- case 0: // open home page
- mainWindow()->homePage();
- break;
- case 1: // open new tab page
- loadUrl( KUrl("about:home") );
- break;
- case 2: // restore session
- if(sessionManager()->restoreSession())
- break;
- default:
- mainWindow()->homePage();
+ case 0: // open home page
+ mainWindow()->homePage();
+ break;
+ case 1: // open new tab page
+ loadUrl(KUrl("about:home"));
+ break;
+ case 2: // restore session
+ if (sessionManager()->restoreSession())
break;
- }
+ default:
+ mainWindow()->homePage();
+ break;
+ }
}
else // rekonq has just been started. Just open a new window
{
- loadUrl( KUrl("about:home") , Rekonq::NewWindow );
+ loadUrl(KUrl("about:home") , Rekonq::NewWindow);
}
}
else
{
- if(isFirstLoad)
+ if (isFirstLoad)
{
// No windows in the current desktop? No windows at all?
// Create a new one and load there sites...
loadUrl(args->arg(0), Rekonq::CurrentTab);
for (int i = 1; i < args->count(); ++i)
- loadUrl( KUrl( args->arg(i) ), Rekonq::SettingOpenTab);
+ loadUrl(KUrl(args->arg(i)), Rekonq::SettingOpenTab);
}
else
{
// are there any windows there? use it
int index = m_mainWindows.size();
- if(index > 0)
+ if (index > 0)
{
MainWindow *m = m_mainWindows.at(index - 1).data();
m->activateWindow();
for (int i = 0; i < args->count(); ++i)
- loadUrl( KUrl( args->arg(i) ), Rekonq::NewCurrentTab);
+ loadUrl(KUrl(args->arg(i)), Rekonq::NewCurrentTab);
}
}
}
@@ -183,19 +183,19 @@ Application *Application::instance()
void Application::postLaunch()
-{
+{
// updating rekonq configuration
updateConfiguration();
setWindowIcon(KIcon("rekonq"));
-
+
// set Icon Database Path to store "favicons" associated with web sites
QString directory = KStandardDirs::locateLocal("cache" , "" , true);
QWebSettings::setIconDatabasePath(directory);
Application::historyManager();
Application::sessionManager();
-
+
// bookmarks loading
connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)),
Application::instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType&)));
@@ -215,12 +215,12 @@ void Application::saveConfiguration() const
MainWindow *Application::mainWindow()
{
- if(m_mainWindows.isEmpty())
+ if (m_mainWindows.isEmpty())
return newMainWindow();
-
+
MainWindow *active = qobject_cast<MainWindow*>(QApplication::activeWindow());
-
- if(!active)
+
+ if (!active)
{
return m_mainWindows.at(0).data();
}
@@ -230,10 +230,10 @@ MainWindow *Application::mainWindow()
HistoryManager *Application::historyManager()
{
- if ( s_historyManager.isNull() )
+ if (s_historyManager.isNull())
{
s_historyManager = new HistoryManager();
- QWebHistoryInterface::setDefaultInterface( s_historyManager.data() );
+ QWebHistoryInterface::setDefaultInterface(s_historyManager.data());
}
return s_historyManager.data();
}
@@ -241,7 +241,7 @@ HistoryManager *Application::historyManager()
BookmarkProvider *Application::bookmarkProvider()
{
- if ( s_bookmarkProvider.isNull() )
+ if (s_bookmarkProvider.isNull())
{
s_bookmarkProvider = new BookmarkProvider(instance());
}
@@ -251,7 +251,7 @@ BookmarkProvider *Application::bookmarkProvider()
SessionManager *Application::sessionManager()
{
- if( s_sessionManager.isNull() )
+ if (s_sessionManager.isNull())
{
s_sessionManager = new SessionManager(instance());
}
@@ -262,21 +262,21 @@ SessionManager *Application::sessionManager()
KIcon Application::icon(const KUrl &url)
{
// avoid infinite loop at startup
- if( Application::instance()->mainWindowList().isEmpty() )
+ if (Application::instance()->mainWindowList().isEmpty())
return KIcon("text-html");
// first things first..
- if(url.isEmpty())
+ if (url.isEmpty())
return KIcon("text-html");
// rekonq icons..
- if(url == KUrl("about:closedTabs"))
+ if (url == KUrl("about:closedTabs"))
return KIcon("tab-close");
- if(url == KUrl("about:history"))
+ if (url == KUrl("about:history"))
return KIcon("view-history");
- if(url == KUrl("about:bookmarks"))
+ if (url == KUrl("about:bookmarks"))
return KIcon("bookmarks");
- if(url == KUrl("about:favorites"))
+ if (url == KUrl("about:favorites"))
return KIcon("emblem-favorite");
KIcon icon = KIcon(QWebSettings::iconForUrl(url));
@@ -293,7 +293,7 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
if (url.isEmpty())
return;
- if ( !url.isValid() )
+ if (!url.isValid())
{
KMessageBox::error(0, i18n("Malformed URL:\n%1", url.url(KUrl::RemoveTrailingSlash)));
return;
@@ -302,11 +302,11 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
// first, create the webview(s) to not let hangs UI..
WebTab *tab = 0;
MainWindow *w = 0;
- w = (type == Rekonq::NewWindow)
+ w = (type == Rekonq::NewWindow)
? newMainWindow()
: mainWindow();
-
- switch(type)
+
+ switch (type)
{
case Rekonq::SettingOpenTab:
tab = w->mainView()->newWebTab(!ReKonfig::openTabsBack(), ReKonfig::openTabsNearCurrent());
@@ -322,9 +322,9 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
tab = w->mainView()->currentWebTab();
break;
};
-
+
WebView *view = tab->view();
-
+
if (view)
{
FilterUrlJob *job = new FilterUrlJob(view, url.pathOrUrl(), this);
@@ -336,13 +336,13 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
MainWindow *Application::newMainWindow(bool withTab)
{
MainWindow *w = new MainWindow();
-
- if(withTab)
+
+ if (withTab)
w->mainView()->newWebTab(); // remember using newWebTab and NOT newTab here!!
-
+
m_mainWindows.prepend(w);
w->show();
-
+
return w;
}
@@ -361,7 +361,7 @@ MainWindowList Application::mainWindowList()
AdBlockManager *Application::adblockManager()
{
- if( s_adblockManager.isNull() )
+ if (s_adblockManager.isNull())
{
s_adblockManager = new AdBlockManager(instance());
}
@@ -374,37 +374,37 @@ void Application::loadResolvedUrl(ThreadWeaver::Job *job)
FilterUrlJob *threadedJob = static_cast<FilterUrlJob *>(job);
KUrl url = threadedJob->url();
WebView *view = threadedJob->view();
-
+
// Bye and thanks :)
delete threadedJob;
-
+
if (view)
{
- view->load(url);
-
+ view->load(url);
+
// we are sure of the url now, let's add it to history
// anyway we store here just http sites because local and ftp ones are
// added trough the protocol handler and the other are ignored
- if( url.protocol() == QLatin1String("http") || url.protocol() == QLatin1String("https") )
- historyManager()->addHistoryEntry( url.prettyUrl() );
+ if (url.protocol() == QLatin1String("http") || url.protocol() == QLatin1String("https"))
+ historyManager()->addHistoryEntry(url.prettyUrl());
}
}
void Application::newWindow()
{
- loadUrl( KUrl("about:home"), Rekonq::NewWindow );
+ loadUrl(KUrl("about:home"), Rekonq::NewWindow);
mainWindow()->mainView()->urlBarWidget()->setFocus();
}
void Application::updateConfiguration()
{
- // FIXME:
- // all things related to mainview can be
+ // FIXME:
+ // all things related to mainview can be
// improved/moved/replicated in all the mainwindows
MainView *view = mainWindow()->mainView();
-
+
// ============== General ==================
view->updateTabBar();
@@ -413,12 +413,12 @@ void Application::updateConfiguration()
view->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
else
view->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectRightTab);
-
+
// =========== Encodings & Fonts ==============
QWebSettings *defaultSettings = QWebSettings::globalSettings();
- defaultSettings->setDefaultTextEncoding( ReKonfig::defaultEncoding() );
-
+ defaultSettings->setDefaultTextEncoding(ReKonfig::defaultEncoding());
+
int fnSize = ReKonfig::fontSize();
int minFnSize = ReKonfig::minFontSize();
@@ -441,8 +441,8 @@ void Application::updateConfiguration()
defaultSettings->setAttribute(QWebSettings::LinksIncludedInFocusChain, ReKonfig::linksIncludedInFocusChain());
defaultSettings->setAttribute(QWebSettings::ZoomTextOnly, ReKonfig::zoomTextOnly());
defaultSettings->setAttribute(QWebSettings::PrintElementBackgrounds, ReKonfig::printElementBackgrounds());
-
- if(ReKonfig::pluginsEnabled() == 2)
+
+ if (ReKonfig::pluginsEnabled() == 2)
defaultSettings->setAttribute(QWebSettings::PluginsEnabled, false);
else
defaultSettings->setAttribute(QWebSettings::PluginsEnabled, true);
@@ -451,7 +451,7 @@ void Application::updateConfiguration()
defaultSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, ReKonfig::offlineStorageDatabaseEnabled());
defaultSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, ReKonfig::offlineWebApplicationCacheEnabled());
defaultSettings->setAttribute(QWebSettings::LocalStorageEnabled, ReKonfig::localStorageEnabled());
- if(ReKonfig::localStorageEnabled())
+ if (ReKonfig::localStorageEnabled())
{
QString path = KStandardDirs::locateLocal("cache", QString("WebkitLocalStorage/rekonq"), true);
path.remove("rekonq");
@@ -461,14 +461,14 @@ void Application::updateConfiguration()
// Applies user defined CSS to all open webpages. If there no longer is a
// user defined CSS removes it from all open webpages.
- if(ReKonfig::userCSS().isEmpty())
- defaultSettings->setUserStyleSheetUrl( KUrl(KStandardDirs::locate("appdata" , "default.css")) );
+ if (ReKonfig::userCSS().isEmpty())
+ defaultSettings->setUserStyleSheetUrl(KUrl(KStandardDirs::locate("appdata" , "default.css")));
else
defaultSettings->setUserStyleSheetUrl(ReKonfig::userCSS());
// ====== load Settings on main classes
Application::historyManager()->loadSettings();
Application::adblockManager()->loadSettings();
-
+
defaultSettings = 0;
}
diff --git a/src/application.h b/src/application.h
index 87d395eb..9a8031ea 100644
--- a/src/application.h
+++ b/src/application.h
@@ -12,9 +12,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -59,31 +59,31 @@ typedef QList< QWeakPointer<MainWindow> > MainWindowList;
namespace Rekonq
{
- /**
- * @short notifying message status
- * Different message status
- */
+/**
+ * @short notifying message status
+ * Different message status
+ */
- enum Notify
- {
- Success, ///< url successfully (down)loaded
- Error, ///< url failed to (down)load
- Download, ///< downloading url
- Info ///< information, (default)
- };
+enum Notify
+{
+ Success, ///< url successfully (down)loaded
+ Error, ///< url failed to (down)load
+ Download, ///< downloading url
+ Info ///< information, (default)
+};
- /**
- * @short Open link options
- * Different modes of opening new tab
- */
- enum OpenType
- {
- CurrentTab, ///< open url in current tab
- SettingOpenTab, ///< open url according to users settings
- NewCurrentTab, ///< open url in new tab and make it current
- NewBackTab, ///< open url in new tab in background
- NewWindow ///< open url in new window
- };
+/**
+ * @short Open link options
+ * Different modes of opening new tab
+ */
+enum OpenType
+{
+ CurrentTab, ///< open url in current tab
+ SettingOpenTab, ///< open url according to users settings
+ NewCurrentTab, ///< open url in new tab and make it current
+ NewBackTab, ///< open url in new tab in background
+ NewWindow ///< open url in new window
+};
}
@@ -104,14 +104,14 @@ public:
MainWindow *mainWindow();
MainWindow *newMainWindow(bool withTab = true);
MainWindowList mainWindowList();
-
+
static KIcon icon(const KUrl &url);
static HistoryManager *historyManager();
static BookmarkProvider *bookmarkProvider();
static SessionManager *sessionManager();
static AdBlockManager *adblockManager();
-
+
public slots:
/**
* Save application's configuration
@@ -120,8 +120,8 @@ public slots:
*/
void saveConfiguration() const;
- void loadUrl( const KUrl& url,
- const Rekonq::OpenType& type = Rekonq::CurrentTab
+ void loadUrl(const KUrl& url,
+ const Rekonq::OpenType& type = Rekonq::CurrentTab
);
void newWindow();
@@ -135,15 +135,15 @@ private slots:
void postLaunch();
void loadResolvedUrl(ThreadWeaver::Job *);
-
+
void updateConfiguration();
-
+
private:
static QWeakPointer<HistoryManager> s_historyManager;
static QWeakPointer<BookmarkProvider> s_bookmarkProvider;
static QWeakPointer<SessionManager> s_sessionManager;
static QWeakPointer<AdBlockManager> s_adblockManager;
-
+
MainWindowList m_mainWindows;
};
diff --git a/src/bookmarks/bookmarkcontextmenu.cpp b/src/bookmarks/bookmarkcontextmenu.cpp
index aab6af90..df8bf5e0 100644
--- a/src/bookmarks/bookmarkcontextmenu.cpp
+++ b/src/bookmarks/bookmarkcontextmenu.cpp
@@ -42,8 +42,8 @@
BookmarkContextMenu::BookmarkContextMenu(const KBookmark & bookmark, KBookmarkManager *manager, KBookmarkOwner *owner, QWidget *parent)
- : KBookmarkContextMenu(bookmark, manager, owner, parent)
- , m_ac(new KActionCollection(this))
+ : KBookmarkContextMenu(bookmark, manager, owner, parent)
+ , m_ac(new KActionCollection(this))
{
setupActions();
}
@@ -120,7 +120,7 @@ void BookmarkContextMenu::addBookmarkActions()
void BookmarkContextMenu::addFolderActions()
{
- if(!bookmark().toGroup().first().isNull())
+ if (!bookmark().toGroup().first().isNull())
{
addAction(m_ac->action("open_all"));
addSeparator();
@@ -151,17 +151,17 @@ void BookmarkContextMenu::addSeparatorActions()
void BookmarkContextMenu::addActions()
{
- if(bookmark().isGroup())
+ if (bookmark().isGroup())
{
addFolderActions();
}
- else if(bookmark().isSeparator())
+ else if (bookmark().isSeparator())
{
addSeparatorActions();
}
- else if(bookmark().isNull())
+ else if (bookmark().isNull())
{
addAction(m_ac->action("bookmark_page"));
addAction(m_ac->action("folder_new"));
@@ -195,7 +195,7 @@ void BookmarkContextMenu::openInNewWindow()
void BookmarkContextMenu::copyToClipboard()
{
- if(bookmark().isNull())
+ if (bookmark().isNull())
return;
QClipboard *cb = QApplication::clipboard();
@@ -209,14 +209,14 @@ void BookmarkContextMenu::deleteBookmark()
bool folder = bm.isGroup();
if (KMessageBox::warningContinueCancel(
- QApplication::activeWindow(),
- folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", bm.text())
- : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", bm.text()),
- folder ? i18n("Bookmark Folder Deletion")
- : i18n("Bookmark Deletion"),
- KStandardGuiItem::del())
- != KMessageBox::Continue
- )
+ QApplication::activeWindow(),
+ folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", bm.text())
+ : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", bm.text()),
+ folder ? i18n("Bookmark Folder Deletion")
+ : i18n("Bookmark Deletion"),
+ KStandardGuiItem::del())
+ != KMessageBox::Continue
+ )
return;
bm.parentGroup().deleteBookmark(bm);
@@ -236,7 +236,7 @@ void BookmarkContextMenu::editBookmark()
void BookmarkContextMenu::openFolderInTabs()
{
- if(bookmark().isGroup())
+ if (bookmark().isGroup())
owner()->openFolderinTabs(bookmark().toGroup());
}
@@ -246,9 +246,9 @@ void BookmarkContextMenu::newBookmarkGroup()
KBookmark selected = bookmark();
KBookmarkDialog *dialog = owner()->bookmarkDialog(manager(), QApplication::activeWindow());
- if(!selected.isNull())
+ if (!selected.isNull())
{
- if(selected.isGroup())
+ if (selected.isGroup())
{
dialog->createNewFolder("New folder", selected);
}
@@ -275,9 +275,9 @@ void BookmarkContextMenu::newSeparator()
KBookmark selected = bookmark();
KBookmark newBk;
- if(!selected.isNull())
+ if (!selected.isNull())
{
- if(selected.isGroup())
+ if (selected.isGroup())
newBk = selected.toGroup().createNewSeparator();
else
newBk = selected.parentGroup().createNewSeparator();
@@ -292,7 +292,7 @@ void BookmarkContextMenu::newSeparator()
newBk.setIcon(("edit-clear"));
parent.addBookmark(newBk);
- if(!selected.isNull())
+ if (!selected.isNull())
parent.moveBookmark(newBk, selected);
manager()->emitChanged();
@@ -304,11 +304,11 @@ void BookmarkContextMenu::bookmarkCurrentPage()
KBookmarkGroup parent = Application::bookmarkProvider()->rootGroup();
KBookmark selected = bookmark();
- if(!selected.isNull())
+ if (!selected.isNull())
{
parent = selected.parentGroup();
- if(selected.isGroup())
+ if (selected.isGroup())
parent = selected.toGroup();
KBookmark newBk = parent.addBookmark(owner()->currentTitle(), KUrl(owner()->currentUrl()), "text-html");
@@ -317,7 +317,7 @@ void BookmarkContextMenu::bookmarkCurrentPage()
else
{
- parent.addBookmark(owner()->currentTitle(), KUrl(owner()->currentUrl()), "text-html");
+ parent.addBookmark(owner()->currentTitle(), KUrl(owner()->currentUrl()), "text-html");
}
manager()->emitChanged();
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index b3354c57..a8866fe7 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -13,9 +13,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -55,8 +55,8 @@
BookmarkOwner::BookmarkOwner(QObject *parent)
- : QObject(parent)
- , KBookmarkOwner()
+ : QObject(parent)
+ , KBookmarkOwner()
{
}
@@ -98,9 +98,9 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bookmark)
{
QList<KUrl> urlList = bookmark.groupUrlList();
- if(urlList.length() > 8)
+ if (urlList.length() > 8)
{
- if(!(KMessageBox::warningContinueCancel(Application::instance()->mainWindow(), i18n("You are about to open %1 tabs.\nAre you sure ?", QString::number(urlList.length()))) == KMessageBox::Continue))
+ if (!(KMessageBox::warningContinueCancel(Application::instance()->mainWindow(), i18n("You are about to open %1 tabs.\nAre you sure ?", QString::number(urlList.length()))) == KMessageBox::Continue))
return;
}
@@ -117,7 +117,7 @@ QList< QPair<QString, QString> > BookmarkOwner::currentBookmarkList() const
QList< QPair<QString, QString> > bkList;
int tabNumber = Application::instance()->mainWindow()->mainView()->count();
- for(int i = 0; i < tabNumber; i++)
+ for (int i = 0; i < tabNumber; i++)
{
QPair<QString, QString> item;
item.first = Application::instance()->mainWindow()->mainView()->webTab(i)->view()->title();
@@ -135,10 +135,10 @@ BookmarkMenu::BookmarkMenu(KBookmarkManager *manager,
KBookmarkOwner *owner,
KMenu *menu,
KActionCollection* actionCollection)
- : KBookmarkMenu(manager, owner, menu, actionCollection)
+ : KBookmarkMenu(manager, owner, menu, actionCollection)
{
KAction *a = KStandardAction::addBookmark(this, SLOT(slotAddBookmark()), this);
- actionCollection->addAction(QLatin1String("rekonq_add_bookmark"),a);
+ actionCollection->addAction(QLatin1String("rekonq_add_bookmark"), a);
refill();
}
@@ -147,7 +147,7 @@ BookmarkMenu::BookmarkMenu(KBookmarkManager *manager,
KBookmarkOwner *owner,
KMenu *parentMenu,
const QString &parentAddress)
- : KBookmarkMenu(manager, owner, parentMenu, parentAddress)
+ : KBookmarkMenu(manager, owner, parentMenu, parentAddress)
{
refill();
}
@@ -162,9 +162,9 @@ KMenu * BookmarkMenu::contextMenu(QAction *act)
{
KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(act);
- if (!action)
- return 0;
- return new BookmarkContextMenu(action->bookmark(), manager(), owner());
+ if (!action)
+ return 0;
+ return new BookmarkContextMenu(action->bookmark(), manager(), owner());
}
@@ -186,20 +186,20 @@ void BookmarkMenu::slotAddBookmark()
QAction * BookmarkMenu::actionForBookmark(const KBookmark &bookmark)
{
- if(bookmark.isGroup())
+ if (bookmark.isGroup())
{
KBookmarkActionMenu *actionMenu = new KBookmarkActionMenu(bookmark, this);
new BookmarkMenu(manager(), owner(), actionMenu->menu(), bookmark.address());
return actionMenu;
}
- else if(bookmark.isSeparator())
+ else if (bookmark.isSeparator())
{
return KBookmarkMenu::actionForBookmark(bookmark);
}
else
{
Application::bookmarkProvider()->completionObject()->addItem(bookmark.url().url());
- return new KBookmarkAction( bookmark, owner(), this );
+ return new KBookmarkAction(bookmark, owner(), this);
}
}
@@ -208,10 +208,10 @@ void BookmarkMenu::refill()
{
fillBookmarks();
- if(parentMenu()->actions().count() > 0)
+ if (parentMenu()->actions().count() > 0)
parentMenu()->addSeparator();
- if(isRoot())
+ if (isRoot())
{
addAddBookmark();
addAddBookmarksList();
@@ -234,19 +234,19 @@ void BookmarkMenu::addOpenFolderInTabs()
KAction *action;
KBookmarkGroup group = manager()->findByAddress(parentAddress()).toGroup();
- if(!group.first().isNull())
+ if (!group.first().isNull())
{
KBookmark bookmark = group.first();
- while(bookmark.isGroup() || bookmark.isSeparator())
+ while (bookmark.isGroup() || bookmark.isSeparator())
{
bookmark = group.next(bookmark);
}
- if(!bookmark.isNull())
+ if (!bookmark.isNull())
{
action = new KAction(KIcon("tab-new"), i18n("Open Folder in Tabs"), this);
- action->setHelpText( i18n( "Open all bookmarks in this folder as a new tab." ) );
+ action->setHelpText(i18n("Open all bookmarks in this folder as a new tab."));
connect(action, SIGNAL(triggered(bool)), this, SLOT(slotOpenFolderInTabs()));
parentMenu()->addAction(action);
}
@@ -267,7 +267,7 @@ BookmarkProvider::BookmarkProvider(QObject *parent)
{
// take care of the completion object
m_completion = new KCompletion;
- m_completion->setOrder( KCompletion::Weighted );
+ m_completion->setOrder(KCompletion::Weighted);
KUrl bookfile = KUrl("~/.kde/share/apps/konqueror/bookmarks.xml"); // share konqueror bookmarks
@@ -287,7 +287,7 @@ BookmarkProvider::BookmarkProvider(QObject *parent)
}
m_manager = KBookmarkManager::managerForFile(bookfile.path(), "rekonq");
-
+
connect(m_manager, SIGNAL(changed(const QString &, const QString &)),
this, SLOT(slotBookmarksChanged(const QString &, const QString &)));
@@ -353,11 +353,11 @@ QAction *BookmarkProvider::actionByName(const QString &name)
void BookmarkProvider::contextMenu(const QPoint &point)
{
- if(m_bookmarkToolBars.isEmpty())
+ if (m_bookmarkToolBars.isEmpty())
return;
KToolBar *bookmarkToolBar = m_bookmarkToolBars.at(0);
- if(!bookmarkToolBar)
+ if (!bookmarkToolBar)
return;
KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(bookmarkToolBar->actionAt(point));
@@ -386,10 +386,10 @@ KActionMenu* BookmarkProvider::bookmarkActionMenu(QWidget *parent)
void BookmarkProvider::fillBookmarkBar(KToolBar *toolBar)
{
KBookmarkGroup root = m_manager->toolbar();
- if(root.isNull())
+ if (root.isNull())
return;
- for(KBookmark bookmark = root.first(); !bookmark.isNull(); bookmark = root.next(bookmark))
+ for (KBookmark bookmark = root.first(); !bookmark.isNull(); bookmark = root.next(bookmark))
{
if (bookmark.isGroup())
{
@@ -400,7 +400,7 @@ void BookmarkProvider::fillBookmarkBar(KToolBar *toolBar)
toolBar->addAction(menuAction);
}
- else if(bookmark.isSeparator())
+ else if (bookmark.isSeparator())
{
toolBar->addSeparator();
}
@@ -440,12 +440,12 @@ QString BookmarkProvider::titleForBookmarkUrl(QString url)
title = titleForBookmarkUrl(bookmark, url);
bookmark = bookGroup.next(bookmark);
}
-
+
if (title.isEmpty())
{
title = url;
}
-
+
return title;
}
@@ -463,10 +463,10 @@ QString BookmarkProvider::titleForBookmarkUrl(const KBookmark &bookmark, QString
bm = group.next(bm);
}
}
- else if(!bookmark.isSeparator() && bookmark.url()==url)
+ else if (!bookmark.isSeparator() && bookmark.url() == url)
{
title = bookmark.fullText();
}
-
+
return title;
}
diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h
index 38726724..05426243 100644
--- a/src/bookmarks/bookmarksmanager.h
+++ b/src/bookmarks/bookmarksmanager.h
@@ -224,9 +224,15 @@ public:
*/
KBookmarkGroup rootGroup();
- KBookmarkManager *bookmarkManager() { return m_manager; }
- BookmarkOwner *bookmarkOwner() { return m_owner; }
-
+ KBookmarkManager *bookmarkManager()
+ {
+ return m_manager;
+ }
+ BookmarkOwner *bookmarkOwner()
+ {
+ return m_owner;
+ }
+
/**
* @returns the KCompletion object.
*/
@@ -260,7 +266,7 @@ public slots:
*/
void slotBookmarksChanged(const QString &group, const QString &caller);
-
+
private:
void fillBookmarkBar(KToolBar *toolBar);
QString titleForBookmarkUrl(const KBookmark &bookmark, QString url);
diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp
index 0caf0f31..0f4e64b8 100644
--- a/src/bookmarks/bookmarkspanel.cpp
+++ b/src/bookmarks/bookmarkspanel.cpp
@@ -51,9 +51,9 @@
BookmarksPanel::BookmarksPanel(const QString &title, QWidget *parent, Qt::WindowFlags flags)
- : QDockWidget(title, parent, flags)
- , m_treeView(new PanelTreeView(this))
- , m_loadingState(false)
+ : QDockWidget(title, parent, flags)
+ , m_treeView(new PanelTreeView(this))
+ , m_loadingState(false)
{
setup();
setShown(ReKonfig::showBookmarksPanel());
@@ -81,7 +81,7 @@ void BookmarksPanel::setup()
KLineEdit *search = new KLineEdit;
search->setClearButtonShown(true);
searchLayout->addWidget(search);
- searchLabel->setBuddy( search );
+ searchLabel->setBuddy(search);
// setup tree view
m_treeView->setUniformRowHeights(true);
@@ -103,10 +103,10 @@ void BookmarksPanel::setup()
ui->setLayout(vBoxLayout);
setWidget(ui);
- BookmarksTreeModel *model = new BookmarksTreeModel( this );
+ BookmarksTreeModel *model = new BookmarksTreeModel(this);
BookmarksProxy *proxy = new BookmarksProxy(ui);
- proxy->setSourceModel( model );
- m_treeView->setModel( proxy );
+ proxy->setSourceModel(model);
+ m_treeView->setModel(proxy);
connect(m_treeView, SIGNAL(contextMenuItemRequested(const QPoint &)), this, SLOT(contextMenu(const QPoint &)));
connect(m_treeView, SIGNAL(contextMenuGroupRequested(const QPoint &)), this, SLOT(contextMenu(const QPoint &)));
@@ -121,20 +121,20 @@ void BookmarksPanel::setup()
KBookmark BookmarksPanel::bookmarkForIndex(const QModelIndex &index)
{
- if(!index.isValid())
+ if (!index.isValid())
return KBookmark();
const QAbstractProxyModel* proxyModel = dynamic_cast< const QAbstractProxyModel* >(index.model());
QModelIndex originalIndex = proxyModel->mapToSource(index);
- BtmItem *node = static_cast< BtmItem* >( originalIndex.internalPointer() );
+ BtmItem *node = static_cast< BtmItem* >(originalIndex.internalPointer());
return node->getBkm();
}
void BookmarksPanel::onCollapse(const QModelIndex &index)
{
- if(m_loadingState)
+ if (m_loadingState)
return;
KBookmark bookmark = bookmarkForIndex(index);
@@ -145,7 +145,7 @@ void BookmarksPanel::onCollapse(const QModelIndex &index)
void BookmarksPanel::onExpand(const QModelIndex &index)
{
- if(m_loadingState)
+ if (m_loadingState)
return;
KBookmark bookmark = bookmarkForIndex(index);
@@ -168,10 +168,10 @@ void BookmarksPanel::loadFoldedState(const QModelIndex &root)
int count = m_treeView->model()->rowCount(root);
QModelIndex index;
- for(int i = 0; i < count; i++)
+ for (int i = 0; i < count; i++)
{
index = m_treeView->model()->index(i, 0, root);
- if(index.isValid() && bookmarkForIndex(index).isGroup())
+ if (index.isValid() && bookmarkForIndex(index).isGroup())
{
m_treeView->setExpanded(index, bookmarkForIndex(index).toGroup().isOpen());
loadFoldedState(index);
@@ -183,7 +183,7 @@ void BookmarksPanel::loadFoldedState(const QModelIndex &root)
void BookmarksPanel::contextMenu(const QPoint &pos)
{
QModelIndex index = m_treeView->indexAt(pos);
- if(m_loadingState)
+ if (m_loadingState)
return;
KBookmark selected = bookmarkForIndex(index);
@@ -196,21 +196,21 @@ void BookmarksPanel::contextMenu(const QPoint &pos)
void BookmarksPanel::deleteBookmark()
{
QModelIndex index = m_treeView->currentIndex();
- if(!index.isValid())
+ if (!index.isValid())
return;
KBookmark bm = bookmarkForIndex(index);
bool folder = bm.isGroup();
if (KMessageBox::warningContinueCancel(
- QApplication::activeWindow(),
- folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", bm.text())
- : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", bm.text()),
- folder ? i18n("Bookmark Folder Deletion")
- : i18n("Bookmark Deletion"),
- KStandardGuiItem::del())
- != KMessageBox::Continue
- )
+ QApplication::activeWindow(),
+ folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", bm.text())
+ : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", bm.text()),
+ folder ? i18n("Bookmark Folder Deletion")
+ : i18n("Bookmark Deletion"),
+ KStandardGuiItem::del())
+ != KMessageBox::Continue
+ )
return;
diff --git a/src/bookmarks/bookmarksproxy.cpp b/src/bookmarks/bookmarksproxy.cpp
index 7fa34b3f..4e4b4f06 100644
--- a/src/bookmarks/bookmarksproxy.cpp
+++ b/src/bookmarks/bookmarksproxy.cpp
@@ -30,27 +30,27 @@
#include "bookmarksproxy.moc"
-BookmarksProxy::BookmarksProxy( QObject *parent )
- : QSortFilterProxyModel( parent )
+BookmarksProxy::BookmarksProxy(QObject *parent)
+ : QSortFilterProxyModel(parent)
{
}
-bool BookmarksProxy::filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const
+bool BookmarksProxy::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
- QModelIndex idx = sourceModel()->index( source_row, 0, source_parent );
- return recursiveMatch( idx );
+ QModelIndex idx = sourceModel()->index(source_row, 0, source_parent);
+ return recursiveMatch(idx);
}
-bool BookmarksProxy::recursiveMatch( const QModelIndex &index ) const
+bool BookmarksProxy::recursiveMatch(const QModelIndex &index) const
{
- if( index.data().toString().contains( filterRegExp() ) )
+ if (index.data().toString().contains(filterRegExp()))
return true;
- for( int childRow = 0; childRow < sourceModel()->rowCount( index ); ++childRow )
+ for (int childRow = 0; childRow < sourceModel()->rowCount(index); ++childRow)
{
- if( recursiveMatch( sourceModel()->index( childRow, 0, index ) ) )
+ if (recursiveMatch(sourceModel()->index(childRow, 0, index)))
return true;
}
return false;
diff --git a/src/bookmarks/bookmarksproxy.h b/src/bookmarks/bookmarksproxy.h
index 2bf1d63a..8b2cf95e 100644
--- a/src/bookmarks/bookmarksproxy.h
+++ b/src/bookmarks/bookmarksproxy.h
@@ -42,13 +42,13 @@ class REKONQ_TESTS_EXPORT BookmarksProxy : public QSortFilterProxyModel
Q_DISABLE_COPY(BookmarksProxy)
public:
- BookmarksProxy( QObject *parent = 0 );
+ BookmarksProxy(QObject *parent = 0);
protected:
- virtual bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const;
+ virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
// returns true if any child(or children-child...) matches filter
- bool recursiveMatch( const QModelIndex &index ) const;
+ bool recursiveMatch(const QModelIndex &index) const;
};
#endif // BOOKMARKSPROXY_H
diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp
index 836401a6..5fffa3da 100644
--- a/src/bookmarks/bookmarkstreemodel.cpp
+++ b/src/bookmarks/bookmarkstreemodel.cpp
@@ -42,8 +42,8 @@
BtmItem::BtmItem(const KBookmark &bm)
- : m_parent(0)
- , m_kbm(bm)
+ : m_parent(0)
+ , m_kbm(bm)
{
}
@@ -54,32 +54,32 @@ BtmItem::~BtmItem()
}
-QVariant BtmItem::data( int role ) const
+QVariant BtmItem::data(int role) const
{
- if( m_kbm.isNull() )
+ if (m_kbm.isNull())
return QVariant(); // should only happen for root item
- if( role == Qt::DisplayRole )
+ if (role == Qt::DisplayRole)
return m_kbm.text();
- if( role == Qt::DecorationRole )
- return KIcon( m_kbm.icon() );
- if( role == Qt::UserRole )
+ if (role == Qt::DecorationRole)
+ return KIcon(m_kbm.icon());
+ if (role == Qt::UserRole)
return m_kbm.url();
- if( role == Qt::ToolTipRole)
+ if (role == Qt::ToolTipRole)
{
QString tooltip = "";
-
- if(!m_kbm.text().isEmpty())
- {
+
+ if (!m_kbm.text().isEmpty())
+ {
tooltip += m_kbm.text();
- }
- if(m_kbm.isGroup())
- {
+ }
+ if (m_kbm.isGroup())
+ {
tooltip += " [" + QString::number(childCount()) + " " + i18n("Items") + "]";
- }
- if(!m_kbm.url().url().isEmpty())
+ }
+ if (!m_kbm.url().url().isEmpty())
{
- if(!tooltip.isEmpty())
+ if (!tooltip.isEmpty())
tooltip += "\n";
tooltip += m_kbm.url().url();
}
@@ -92,8 +92,8 @@ QVariant BtmItem::data( int role ) const
int BtmItem::row() const
{
- if(m_parent)
- return m_parent->m_children.indexOf( const_cast< BtmItem* >( this ) );
+ if (m_parent)
+ return m_parent->m_children.indexOf(const_cast< BtmItem* >(this));
return 0;
}
@@ -104,10 +104,10 @@ int BtmItem::childCount() const
}
-BtmItem* BtmItem::child( int n )
+BtmItem* BtmItem::child(int n)
{
- Q_ASSERT(n>=0);
- Q_ASSERT(n<childCount());
+ Q_ASSERT(n >= 0);
+ Q_ASSERT(n < childCount());
return m_children.at(n);
}
@@ -121,7 +121,7 @@ BtmItem* BtmItem::parent() const
void BtmItem::appendChild(BtmItem *child)
{
- if( !child )
+ if (!child)
return;
child->m_parent = this;
@@ -144,13 +144,13 @@ KBookmark BtmItem::getBkm() const
BookmarksTreeModel::BookmarksTreeModel(QObject *parent)
- : QAbstractItemModel(parent)
- , m_root(0)
+ : QAbstractItemModel(parent)
+ , m_root(0)
{
resetModel();
- connect( this, SIGNAL(bookmarksUpdated()), parent, SLOT(loadFoldedState()));
- connect( Application::bookmarkProvider()->bookmarkManager(), SIGNAL( changed(QString,QString) ), this, SLOT( bookmarksChanged() ) );
- connect( parent, SIGNAL(saveOnlyRequested()), this, SLOT(saveOnly()) );
+ connect(this, SIGNAL(bookmarksUpdated()), parent, SLOT(loadFoldedState()));
+ connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString, QString)), this, SLOT(bookmarksChanged()));
+ connect(parent, SIGNAL(saveOnlyRequested()), this, SLOT(saveOnly()));
}
@@ -163,13 +163,13 @@ BookmarksTreeModel::~BookmarksTreeModel()
int BookmarksTreeModel::rowCount(const QModelIndex &parent) const
{
BtmItem *parentItem = 0;
- if( !parent.isValid() )
+ if (!parent.isValid())
{
parentItem = m_root;
}
- else
+ else
{
- parentItem = static_cast< BtmItem* >( parent.internalPointer() );
+ parentItem = static_cast< BtmItem* >(parent.internalPointer());
}
return parentItem->childCount();
@@ -186,11 +186,11 @@ int BookmarksTreeModel::columnCount(const QModelIndex &parent) const
QVariant BookmarksTreeModel::headerData(int section, Qt::Orientation orientation, int role) const
{
- if( orientation == Qt::Horizontal
- && role == Qt::DisplayRole
- && section == 0
- )
- return i18n( "Bookmark" );
+ if (orientation == Qt::Horizontal
+ && role == Qt::DisplayRole
+ && section == 0
+ )
+ return i18n("Bookmark");
return QVariant();
}
@@ -199,41 +199,41 @@ QVariant BookmarksTreeModel::headerData(int section, Qt::Orientation orientation
Qt::ItemFlags BookmarksTreeModel::flags(const QModelIndex &index) const
{
Qt::ItemFlags flags = QAbstractItemModel::flags(index);
-
- if(!index.isValid())
+
+ if (!index.isValid())
return flags | Qt::ItemIsDropEnabled;
flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
- if(bookmarkForIndex(index).isGroup())
+ if (bookmarkForIndex(index).isGroup())
flags |= Qt::ItemIsDropEnabled;
-
+
return flags;
}
QModelIndex BookmarksTreeModel::index(int row, int column, const QModelIndex &parent) const
{
- if( !hasIndex( row, column, parent ) )
+ if (!hasIndex(row, column, parent))
{
return QModelIndex();
}
BtmItem *parentItem;
- if( !parent.isValid() )
+ if (!parent.isValid())
{
parentItem = m_root;
}
- else
+ else
{
- parentItem = static_cast< BtmItem* >( parent.internalPointer() );
+ parentItem = static_cast< BtmItem* >(parent.internalPointer());
}
- BtmItem *childItem = parentItem->child( row );
- if( childItem )
+ BtmItem *childItem = parentItem->child(row);
+ if (childItem)
{
- return createIndex( row, column, childItem );
+ return createIndex(row, column, childItem);
}
return QModelIndex();
@@ -242,42 +242,42 @@ QModelIndex BookmarksTreeModel::index(int row, int column, const QModelIndex &pa
QModelIndex BookmarksTreeModel::parent(const QModelIndex &index) const
{
- if( !index.isValid() )
+ if (!index.isValid())
{
return QModelIndex();
}
- BtmItem *childItem = static_cast< BtmItem* >( index.internalPointer() );
+ BtmItem *childItem = static_cast< BtmItem* >(index.internalPointer());
BtmItem *parentItem = childItem->parent();
- if( parentItem == m_root )
+ if (parentItem == m_root)
{
return QModelIndex();
}
- return createIndex( parentItem->row(), 0, parentItem );
+ return createIndex(parentItem->row(), 0, parentItem);
}
QVariant BookmarksTreeModel::data(const QModelIndex &index, int role) const
{
- if( !index.isValid() )
+ if (!index.isValid())
{
return QVariant();
}
- BtmItem *node = static_cast< BtmItem* >( index.internalPointer() );
- if( node && node == m_root )
+ BtmItem *node = static_cast< BtmItem* >(index.internalPointer());
+ if (node && node == m_root)
{
- if( role == Qt::DisplayRole )
- return i18n( "Bookmarks" );
- if( role == Qt::DecorationRole )
- return KIcon( "bookmarks" );
+ if (role == Qt::DisplayRole)
+ return i18n("Bookmarks");
+ if (role == Qt::DecorationRole)
+ return KIcon("bookmarks");
}
- else
+ else
{
- if( node )
- return node->data( role );
+ if (node)
+ return node->data(role);
}
return QVariant();
@@ -302,30 +302,30 @@ void BookmarksTreeModel::setRoot(KBookmarkGroup bmg)
delete m_root;
m_root = new BtmItem(KBookmark());
- if( bmg.isNull() )
+ if (bmg.isNull())
return;
- populate( m_root, bmg );
+ populate(m_root, bmg);
reset();
}
-void BookmarksTreeModel::populate( BtmItem *node, KBookmarkGroup bmg)
+void BookmarksTreeModel::populate(BtmItem *node, KBookmarkGroup bmg)
{
node->clear();
- if( bmg.isNull() )
+ if (bmg.isNull())
return;
KBookmark bm = bmg.first();
- while( !bm.isNull() )
+ while (!bm.isNull())
{
- BtmItem *newChild = new BtmItem( bm );
- if( bm.isGroup() )
- populate( newChild, bm.toGroup() );
+ BtmItem *newChild = new BtmItem(bm);
+ if (bm.isGroup())
+ populate(newChild, bm.toGroup());
- node->appendChild( newChild );
- bm = bmg.next( bm );
+ node->appendChild(newChild);
+ bm = bmg.next(bm);
}
}
@@ -338,36 +338,36 @@ KBookmark BookmarksTreeModel::bookmarkForIndex(const QModelIndex index) const
void BookmarksTreeModel::saveOnly()
{
- disconnect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString,QString)), this, SLOT(bookmarksChanged()));
- connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString,QString)), this, SLOT(reconnectManager()));
+ disconnect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString, QString)), this, SLOT(bookmarksChanged()));
+ connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString, QString)), this, SLOT(reconnectManager()));
Application::bookmarkProvider()->bookmarkManager()->emitChanged();
}
void BookmarksTreeModel::reconnectManager()
{
- connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL( changed(QString,QString) ), this, SLOT(bookmarksChanged()));
+ connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString, QString)), this, SLOT(bookmarksChanged()));
}
-Qt::DropActions BookmarksTreeModel::supportedDropActions () const
+Qt::DropActions BookmarksTreeModel::supportedDropActions() const
{
return Qt::MoveAction;
}
-QStringList BookmarksTreeModel::mimeTypes () const
+QStringList BookmarksTreeModel::mimeTypes() const
{
return KBookmark::List::mimeDataTypes();
}
-QMimeData* BookmarksTreeModel::mimeData( const QModelIndexList & indexes ) const
+QMimeData* BookmarksTreeModel::mimeData(const QModelIndexList & indexes) const
{
QMimeData *mimeData = new QMimeData;
QByteArray addresse = bookmarkForIndex(indexes.first()).address().toLatin1();
- mimeData->setData( "application/rekonq-bookmark", addresse);
+ mimeData->setData("application/rekonq-bookmark", addresse);
bookmarkForIndex(indexes.first()).populateMimeData(mimeData);
return mimeData;
@@ -376,9 +376,9 @@ QMimeData* BookmarksTreeModel::mimeData( const QModelIndexList & indexes ) const
bool BookmarksTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex & parent)
{
- if(action == Qt::MoveAction)
+ if (action == Qt::MoveAction)
{
- if(data->hasFormat("application/rekonq-bookmark"))
+ if (data->hasFormat("application/rekonq-bookmark"))
{
QByteArray addresses = data->data("application/rekonq-bookmark");
KBookmark bookmark = Application::bookmarkProvider()->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data()));
@@ -386,16 +386,16 @@ bool BookmarksTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
QModelIndex destIndex = index(row, column, parent);
KBookmark dropDestBookmark;
- if(destIndex.isValid())
+ if (destIndex.isValid())
dropDestBookmark = bookmarkForIndex(destIndex);
KBookmarkGroup root = Application::bookmarkProvider()->rootGroup();
- if(parent.isValid())
+ if (parent.isValid())
root = bookmarkForIndex(parent).toGroup();
- if(!destIndex.isValid())
+ if (!destIndex.isValid())
{
- if(!parent.isValid()) // Drop into a blank area
+ if (!parent.isValid()) // Drop into a blank area
{
Application::bookmarkProvider()->rootGroup().deleteBookmark(bookmark);
Application::bookmarkProvider()->rootGroup().addBookmark(bookmark);
@@ -409,7 +409,7 @@ bool BookmarksTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
else
{
- if(row == -1)
+ if (row == -1)
{
root.deleteBookmark(bookmark);
root.addBookmark(bookmark);
diff --git a/src/bookmarks/bookmarkstreemodel.h b/src/bookmarks/bookmarkstreemodel.h
index b312ab2d..2cb78770 100644
--- a/src/bookmarks/bookmarkstreemodel.h
+++ b/src/bookmarks/bookmarkstreemodel.h
@@ -43,10 +43,10 @@ class BtmItem
public:
BtmItem(const KBookmark &bm);
~BtmItem();
- QVariant data( int role = Qt::DisplayRole ) const;
+ QVariant data(int role = Qt::DisplayRole) const;
int row() const;
int childCount() const;
- BtmItem* child( int n );
+ BtmItem* child(int n);
BtmItem* parent() const;
void appendChild(BtmItem *child);
void clear();
@@ -78,10 +78,10 @@ public:
virtual QModelIndex parent(const QModelIndex &index) const;
virtual QVariant data(const QModelIndex &index, int role) const;
- virtual QStringList mimeTypes () const;
+ virtual QStringList mimeTypes() const;
virtual bool dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent);
- virtual Qt::DropActions supportedDropActions () const;
- virtual QMimeData *mimeData( const QModelIndexList & indexes ) const;
+ virtual Qt::DropActions supportedDropActions() const;
+ virtual QMimeData *mimeData(const QModelIndexList & indexes) const;
private slots:
void bookmarksChanged();
@@ -96,7 +96,7 @@ private:
void resetModel();
void setRoot(KBookmarkGroup bmg);
- void populate( BtmItem *node, KBookmarkGroup bmg);
+ void populate(BtmItem *node, KBookmarkGroup bmg);
KBookmark bookmarkForIndex(const QModelIndex index) const;
};
diff --git a/src/clicktoflash.cpp b/src/clicktoflash.cpp
index 76637975..a704aca9 100644
--- a/src/clicktoflash.cpp
+++ b/src/clicktoflash.cpp
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -43,12 +43,12 @@
ClickToFlash::ClickToFlash(QUrl pluginUrl, QWidget *parent)
- : QWidget(parent)
- , m_url(pluginUrl)
+ : QWidget(parent)
+ , m_url(pluginUrl)
{
QHBoxLayout *l = new QHBoxLayout(this);
setLayout(l);
-
+
QToolButton *button = new QToolButton(this);
button->setPopupMode(QToolButton::InstantPopup);
button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
@@ -60,12 +60,12 @@ ClickToFlash::ClickToFlash(QUrl pluginUrl, QWidget *parent)
void ClickToFlash::load()
-{
+{
QWidget *parent = parentWidget();
QWebView *view = 0;
- while (parent)
+ while (parent)
{
- if (QWebView *aView = qobject_cast<QWebView*>(parent))
+ if (QWebView *aView = qobject_cast<QWebView*>(parent))
{
view = aView;
break;
@@ -78,10 +78,10 @@ void ClickToFlash::load()
const QString selector = QLatin1String("%1[type=\"application/x-shockwave-flash\"]");
hide();
-
+
QList<QWebFrame*> frames;
frames.append(view->page()->mainFrame());
- while (!frames.isEmpty())
+ while (!frames.isEmpty())
{
QWebFrame *frame = frames.takeFirst();
QWebElement docElement = frame->documentElement();
@@ -89,10 +89,10 @@ void ClickToFlash::load()
QWebElementCollection elements;
elements.append(docElement.findAll(selector.arg(QLatin1String("object"))));
elements.append(docElement.findAll(selector.arg(QLatin1String("embed"))));
-
- foreach (QWebElement element, elements)
+
+ foreach(QWebElement element, elements)
{
- if( checkElement(element) )
+ if (checkElement(element))
{
kDebug() << "RETURNED TRUE ...........................";
QWebElement substitute = element.clone();
@@ -114,25 +114,25 @@ bool ClickToFlash::checkElement(QWebElement el)
QString checkString;
QString urlString;
-
- checkString = QUrl(el.attribute("src")).toString( QUrl::RemoveQuery );
- urlString = m_url.toString( QUrl::RemoveQuery );
-
- if( urlString.contains( checkString ) )
+
+ checkString = QUrl(el.attribute("src")).toString(QUrl::RemoveQuery);
+ urlString = m_url.toString(QUrl::RemoveQuery);
+
+ if (urlString.contains(checkString))
return true;
-
+
QWebElementCollection collec = el.findAll("*");
int i = 0;
- while( i < collec.count() )
+ while (i < collec.count())
{
QWebElement el = collec.at(i);
- checkString = QUrl(el.attribute("src")).toString( QUrl::RemoveQuery );
- urlString = m_url.toString( QUrl::RemoveQuery );
+ checkString = QUrl(el.attribute("src")).toString(QUrl::RemoveQuery);
+ urlString = m_url.toString(QUrl::RemoveQuery);
- if( urlString.contains( checkString ) )
+ if (urlString.contains(checkString))
return true;
-
+
i++;
}
diff --git a/src/clicktoflash.h b/src/clicktoflash.h
index 186b5836..f083dccc 100644
--- a/src/clicktoflash.h
+++ b/src/clicktoflash.h
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -44,19 +44,19 @@ class WebPluginFactory;
class REKONQ_TESTS_EXPORT ClickToFlash : public QWidget
{
Q_OBJECT
-
+
public:
explicit ClickToFlash(QUrl pluginUrl, QWidget *parent = 0);
signals:
void signalLoadClickToFlash(bool);
-
+
private slots:
void load();
-
+
private:
bool checkElement(QWebElement el);
-
+
/**
used to find the right QWebElement between the ones of the different plugins
*/
diff --git a/src/filterurljob.cpp b/src/filterurljob.cpp
index f94b7810..bc6118d7 100644
--- a/src/filterurljob.cpp
+++ b/src/filterurljob.cpp
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -33,9 +33,9 @@
FilterUrlJob::FilterUrlJob(WebView *view, const QString &urlString, QObject *parent)
- : Job(parent)
- , _view(view)
- , _urlString(urlString)
+ : Job(parent)
+ , _view(view)
+ , _urlString(urlString)
{
}
@@ -59,11 +59,11 @@ void FilterUrlJob::run()
KUriFilterData data(_urlString);
data.setCheckForExecutables(false); // if true, queries like "rekonq" or "dolphin" are considered as executables
- if(KUriFilter::self()->filterUri(data) && data.uriType() != KUriFilterData::Error)
+ if (KUriFilter::self()->filterUri(data) && data.uriType() != KUriFilterData::Error)
{
QString tempUrlString = data.uri().url();
_url = KUrl(tempUrlString);
}
else
- _url = QUrl::fromUserInput( _urlString );
+ _url = QUrl::fromUserInput(_urlString);
}
diff --git a/src/filterurljob.h b/src/filterurljob.h
index 9be058e3..85249fcc 100644
--- a/src/filterurljob.h
+++ b/src/filterurljob.h
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -49,10 +49,10 @@ public:
WebView *view();
KUrl url();
-
+
protected:
void run();
-
+
private:
WebView *_view;
QString _urlString;
diff --git a/src/findbar.cpp b/src/findbar.cpp
index 48a3c4e0..db97f87d 100644
--- a/src/findbar.cpp
+++ b/src/findbar.cpp
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -55,10 +55,10 @@ FindBar::FindBar(QWidget *parent)
, m_hideTimer(new QTimer(this))
, m_matchCase(new QCheckBox(i18n("&Match case"), this))
, m_highlightAll(new QCheckBox(i18n("&Highlight all"), this))
-{
+{
// mainwindow pointer
MainWindow *window = qobject_cast<MainWindow *>(parent);
-
+
QHBoxLayout *layout = new QHBoxLayout;
// cosmetic
@@ -73,7 +73,7 @@ FindBar::FindBar(QWidget *parent)
layout->addWidget(hideButton);
layout->setAlignment(hideButton, Qt::AlignLeft | Qt::AlignTop);
- // hide timer
+ // hide timer
connect(m_hideTimer, SIGNAL(timeout()), this, SLOT(hide()));
// label
@@ -94,7 +94,7 @@ FindBar::FindBar(QWidget *parent)
connect(findPrev, SIGNAL(clicked()), window, SLOT(findPrevious()));
layout->addWidget(findNext);
layout->addWidget(findPrev);
-
+
// Case sensitivity. Deliberately set so this is off by default.
m_matchCase->setCheckState(Qt::Unchecked);
m_matchCase->setTristate(false);
@@ -111,7 +111,7 @@ FindBar::FindBar(QWidget *parent)
layout->addStretch();
setLayout(layout);
-
+
// we start off hidden
hide();
}
@@ -143,14 +143,14 @@ bool FindBar::highlightAllState() const
void FindBar::show()
{
// show findbar if not visible
- if(isHidden())
+ if (isHidden())
{
QWidget::show();
emit searchString(m_lineEdit->text());
}
m_hideTimer->start(60000);
-
+
// set focus to findbar if user select showFindBar shortcut
m_lineEdit->setFocus();
m_lineEdit->selectAll();
@@ -165,7 +165,7 @@ void FindBar::notifyMatch(bool match)
{
p.setColor(QPalette::Base, QColor(KApplication::palette().color(QPalette::Active, QPalette::Base)));
}
- else
+ else
{
if (match)
{
diff --git a/src/findbar.h b/src/findbar.h
index 78615f9a..9426de49 100644
--- a/src/findbar.h
+++ b/src/findbar.h
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/history/autosaver.cpp b/src/history/autosaver.cpp
index 1bfd5c9e..a99021dc 100644
--- a/src/history/autosaver.cpp
+++ b/src/history/autosaver.cpp
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/history/autosaver.h b/src/history/autosaver.h
index c4c9045b..b3a74df4 100644
--- a/src/history/autosaver.h
+++ b/src/history/autosaver.h
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp
index 097f9ee2..8dc7e049 100644
--- a/src/history/historymanager.cpp
+++ b/src/history/historymanager.cpp
@@ -12,9 +12,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -63,17 +63,17 @@ static const unsigned int HISTORY_VERSION = 23;
HistoryManager::HistoryManager(QObject *parent)
- : QWebHistoryInterface(parent)
- , m_saveTimer(new AutoSaver(this))
- , m_historyLimit(30)
- , m_historyModel(0)
- , m_historyFilterModel(0)
- , m_historyTreeModel(0)
- , m_completion(new KCompletion)
+ : QWebHistoryInterface(parent)
+ , m_saveTimer(new AutoSaver(this))
+ , m_historyLimit(30)
+ , m_historyModel(0)
+ , m_historyFilterModel(0)
+ , m_historyTreeModel(0)
+ , m_completion(new KCompletion)
{
// take care of the completion object
- m_completion->setOrder( KCompletion::Weighted );
-
+ m_completion->setOrder(KCompletion::Weighted);
+
m_expiredTimer.setSingleShot(true);
connect(&m_expiredTimer, SIGNAL(timeout()), this, SLOT(checkForExpired()));
connect(this, SIGNAL(entryAdded(const HistoryItem &)), m_saveTimer, SLOT(changeOccurred()));
@@ -112,11 +112,11 @@ bool HistoryManager::historyContains(const QString &url) const
void HistoryManager::addHistoryEntry(const QString &url)
{
QUrl cleanUrl(url);
-
+
// don't store about: urls (home page related)
- if(cleanUrl.scheme() == QString("about"))
+ if (cleanUrl.scheme() == QString("about"))
return;
-
+
cleanUrl.setPassword(QString());
cleanUrl.setHost(cleanUrl.host().toLower());
HistoryItem item(cleanUrl.toString(), QDateTime::currentDateTime());
@@ -212,7 +212,7 @@ void HistoryManager::addHistoryEntry(const HistoryItem &item)
m_history.prepend(item);
emit entryAdded(item);
-
+
if (m_history.count() == 1)
checkForExpired();
}
@@ -254,7 +254,7 @@ void HistoryManager::removeHistoryEntry(const KUrl &url, const QString &title)
break;
}
}
-
+
// Remove item from completion object
QString _url = url.path();
_url.remove(QRegExp("^http://|/$"));
@@ -457,10 +457,10 @@ void HistoryManager::addDownload(const QString &srcUrl, const QString &destUrl)
{
QWebSettings *globalSettings = QWebSettings::globalSettings();
if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
- return;
+ return;
QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads");
QFile downloadFile(downloadFilePath);
- if ( !downloadFile.open(QFile::WriteOnly | QFile::Append) )
+ if (!downloadFile.open(QFile::WriteOnly | QFile::Append))
{
kDebug() << "azz...";
return;
@@ -476,17 +476,17 @@ void HistoryManager::addDownload(const QString &srcUrl, const QString &destUrl)
DownloadList HistoryManager::downloads()
{
DownloadList list;
-
+
QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads");
QFile downloadFile(downloadFilePath);
- if ( !downloadFile.open(QFile::ReadOnly) )
+ if (!downloadFile.open(QFile::ReadOnly))
{
kDebug() << "azz...";
return list;
}
-
+
QDataStream in(&downloadFile);
- while(!in.atEnd())
+ while (!in.atEnd())
{
QString srcUrl;
in >> srcUrl;
@@ -514,15 +514,15 @@ QString HistoryManager::titleForHistoryUrl(QString url)
QString title = "";
int i = 0;
- while (i< history().count() && title.isEmpty())
+ while (i < history().count() && title.isEmpty())
{
if (history().at(i).url == url)
{
- title = history().at(i).title;
+ title = history().at(i).title;
}
i++;
}
-
+
if (title.isEmpty())
{
title = url;
diff --git a/src/history/historymanager.h b/src/history/historymanager.h
index 9a844672..ba9a5cc5 100644
--- a/src/history/historymanager.h
+++ b/src/history/historymanager.h
@@ -12,9 +12,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -54,12 +54,12 @@ class HistoryItem
public:
HistoryItem() {}
explicit HistoryItem(const QString &u,
- const QDateTime &d = QDateTime(),
+ const QDateTime &d = QDateTime(),
const QString &t = QString()
)
: title(t)
- , url(u),
- dateTime(d)
+ , url(u),
+ dateTime(d)
{}
inline bool operator==(const HistoryItem &other) const
@@ -90,12 +90,12 @@ public:
explicit DownloadItem(const QString &srcUrl,
const QString &destUrl,
const QDateTime &d
- )
- : srcUrlString(srcUrl)
- , destUrlString(destUrl)
- , dateTime(d)
+ )
+ : srcUrlString(srcUrl)
+ , destUrlString(destUrl)
+ , dateTime(d)
{}
-
+
QString srcUrlString;
QString destUrlString;
QDateTime dateTime;
@@ -142,7 +142,7 @@ public:
void removeHistoryEntry(const KUrl &url, const QString &title = QString());
QString titleForHistoryUrl(QString url);
-
+
int historyLimit() const;
void setHistoryLimit(int limit);
@@ -162,7 +162,7 @@ public:
void addDownload(const QString &srcUrl, const QString &destUrl);
DownloadList downloads();
bool clearDownloadsHistory();
-
+
public slots:
void clear();
void loadSettings();
diff --git a/src/history/historymodels.cpp b/src/history/historymodels.cpp
index 736dbcd7..79235b1f 100644
--- a/src/history/historymodels.cpp
+++ b/src/history/historymodels.cpp
@@ -12,9 +12,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -119,7 +119,7 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const
case UrlRole:
return QUrl(item.url);
case Qt::UserRole:
- return KUrl(item.url);
+ return KUrl(item.url);
case UrlStringRole:
return item.url;
case Qt::DisplayRole:
@@ -148,7 +148,7 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const
}
case Qt::ToolTipRole:
QString tooltip = "";
- if(!item.title.isEmpty())
+ if (!item.title.isEmpty())
tooltip = item.title + "\n";
tooltip += item.dateTime.toString(Qt::SystemLocaleShortDate) + "\n" + item.url;
return tooltip;
diff --git a/src/history/historymodels.h b/src/history/historymodels.h
index c2b1ede1..0788ce9a 100644
--- a/src/history/historymodels.h
+++ b/src/history/historymodels.h
@@ -12,9 +12,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/history/historypanel.cpp b/src/history/historypanel.cpp
index 8c36dfa8..cc2909e7 100644
--- a/src/history/historypanel.cpp
+++ b/src/history/historypanel.cpp
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -52,8 +52,8 @@
HistoryPanel::HistoryPanel(const QString &title, QWidget *parent, Qt::WindowFlags flags)
- : QDockWidget(title, parent, flags)
- , m_treeView(new PanelTreeView(this))
+ : QDockWidget(title, parent, flags)
+ , m_treeView(new PanelTreeView(this))
{
setup();
setShown(ReKonfig::showHistoryPanel());
@@ -71,7 +71,7 @@ void HistoryPanel::setup()
{
setObjectName("historyPanel");
setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
-
+
QWidget *ui = new QWidget(this);
m_treeView->setUniformRowHeights(true);
@@ -166,24 +166,24 @@ void HistoryPanel::contextMenuGroup(const QPoint &pos)
void HistoryPanel::openAll()
{
QModelIndex index = m_treeView->currentIndex();
- if(!index.isValid())
+ if (!index.isValid())
return;
QList<KUrl> allChild;
- for(int i = 0; i < index.model()->rowCount(index); i++)
+ for (int i = 0; i < index.model()->rowCount(index); i++)
allChild << qVariantValue<KUrl>(index.child(i, 0).data(Qt::UserRole));
- if(allChild.length() > 8)
+ if (allChild.length() > 8)
{
- if( !(KMessageBox::warningContinueCancel(this,
- i18n("You are about to open %1 tabs.\nAre you sure ?",
- QString::number(allChild.length()))) == KMessageBox::Continue)
- )
+ if (!(KMessageBox::warningContinueCancel(this,
+ i18n("You are about to open %1 tabs.\nAre you sure ?",
+ QString::number(allChild.length()))) == KMessageBox::Continue)
+ )
return;
}
- for(int i = 0; i < allChild.length(); i++)
+ for (int i = 0; i < allChild.length(); i++)
emit openUrl(allChild.at(i).url(), Rekonq::SettingOpenTab);
}
diff --git a/src/history/historypanel.h b/src/history/historypanel.h
index a4dfaf64..bbfa1dc0 100644
--- a/src/history/historypanel.h
+++ b/src/history/historypanel.h
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -45,7 +45,7 @@ class QModelIndex;
class REKONQ_TESTS_EXPORT HistoryPanel : public QDockWidget
{
-Q_OBJECT
+ Q_OBJECT
public:
explicit HistoryPanel(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
diff --git a/src/main.cpp b/src/main.cpp
index 0be5a7ee..5551c55a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -41,7 +41,7 @@ static const char description[] =
I18N_NOOP("A lightweight Web Browser for KDE based on WebKit");
-extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
+extern "C" KDE_EXPORT int kdemain(int argc, char **argv)
{
KAboutData about("rekonq",
0,
@@ -84,8 +84,8 @@ extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
ki18n("(Tons of ) patches, testing, bugfixing"),
"ronny_scholz@web.de",
"");
-
- // --------------- about credits -----------------------------
+
+ // --------------- about credits -----------------------------
about.addCredit(ki18n("Domrachev Alexandr"),
ki18n("Developer"),
"alexandr.domrachev@gmail.com",
@@ -120,7 +120,7 @@ extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
ki18n("Handbook"),
"rohan16garg@gmail.com",
"");
-
+
about.addCredit(ki18n("Dario Freddi"),
ki18n("Patches, hints, first KWallet support implementation (not yet included)"),
"drf@kde.org",
@@ -130,7 +130,7 @@ extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
ki18n("first awesome bar implementation (wait next version and you'll see..)"),
"jondeandres@gmail.com",
"");
-
+
// Initialize command line args
KCmdLineArgs::init(argc, argv, &about);
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 21ee08d6..a11f7fb6 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -13,9 +13,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -66,11 +66,11 @@
MainView::MainView(MainWindow *parent)
- : KTabWidget(parent)
- , _bars(new QStackedWidget(this))
- , m_addTabButton(0)
- , m_currentTabIndex(0)
- , m_parentWindow(parent)
+ : KTabWidget(parent)
+ , _bars(new QStackedWidget(this))
+ , m_addTabButton(0)
+ , m_currentTabIndex(0)
+ , m_parentWindow(parent)
{
// setting tabbar
TabBar *tabBar = new TabBar(this);
@@ -79,27 +79,27 @@ MainView::MainView(MainWindow *parent)
// set mouse tracking for tab previews
setMouseTracking(true);
-
+
// loading pixmap path
m_loadingGitPath = KStandardDirs::locate("appdata" , "pics/loading.mng");
// connecting tabbar signals
- connect(tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)) );
- connect(tabBar, SIGNAL(mouseMiddleClick(int)), this, SLOT(closeTab(int)) );
- connect(tabBar, SIGNAL(newTabRequest()), this, SLOT(newTab()) );
-
- connect(tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int)) );
- connect(tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)) );
- connect(tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)) );
- connect(tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs()) );
- connect(tabBar, SIGNAL(detachTab(int)), this, SLOT(detachTab(int)) );
-
- connect(tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)) );
- connect(tabBar, SIGNAL(tabMoved(int, int)), this, SLOT(movedTab(int, int)) );
-
+ connect(tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)));
+ connect(tabBar, SIGNAL(mouseMiddleClick(int)), this, SLOT(closeTab(int)));
+ connect(tabBar, SIGNAL(newTabRequest()), this, SLOT(newTab()));
+
+ connect(tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int)));
+ connect(tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)));
+ connect(tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)));
+ connect(tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs()));
+ connect(tabBar, SIGNAL(detachTab(int)), this, SLOT(detachTab(int)));
+
+ connect(tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
+ connect(tabBar, SIGNAL(tabMoved(int, int)), this, SLOT(movedTab(int, int)));
+
// current page index changing
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
-
+
QTimer::singleShot(0, this, SLOT(postLaunch()));
}
@@ -112,8 +112,8 @@ MainView::~MainView()
void MainView::postLaunch()
{
// Session Manager
- connect (this, SIGNAL(tabsChanged()), Application::sessionManager(), SLOT(saveSession()));
-
+ connect(this, SIGNAL(tabsChanged()), Application::sessionManager(), SLOT(saveSession()));
+
m_addTabButton->setDefaultAction(m_parentWindow->actionByName("new_tab"));
m_addTabButton->setAutoRaise(true);
@@ -130,14 +130,14 @@ void MainView::updateTabButtonPosition()
if (tabBarWidth + m_addTabButton->width() > tabWidgetWidth)
{
- if(ButtonInCorner)
+ if (ButtonInCorner)
return;
setCornerWidget(m_addTabButton);
ButtonInCorner = true;
}
else
{
- if(ButtonInCorner)
+ if (ButtonInCorner)
{
setCornerWidget(0);
m_addTabButton->show();
@@ -145,9 +145,9 @@ void MainView::updateTabButtonPosition()
}
// detecting X position
- int newPosX = tabBarWidth;
+ int newPosX = tabBarWidth;
int tabWidthHint = tabBar()->tabSizeHint(0).width();
- if (tabWidthHint < sizeHint().width()/4)
+ if (tabWidthHint < sizeHint().width() / 4)
newPosX = tabWidgetWidth - m_addTabButton->width();
m_addTabButton->move(newPosX, 0);
@@ -163,8 +163,8 @@ QToolButton *MainView::addTabButton() const
TabBar *MainView::tabBar() const
{
- TabBar *tabBar = qobject_cast<TabBar *>( KTabWidget::tabBar() );
- return tabBar;
+ TabBar *tabBar = qobject_cast<TabBar *>(KTabWidget::tabBar());
+ return tabBar;
}
@@ -174,9 +174,9 @@ UrlBar *MainView::urlBar() const
}
-QWidget *MainView::urlBarWidget() const
-{
- return _bars;
+QWidget *MainView::urlBarWidget() const
+{
+ return _bars;
}
@@ -188,7 +188,7 @@ WebTab *MainView::currentWebTab() const
void MainView::updateTabBar()
{
- if( ReKonfig::alwaysShowTabBar() )
+ if (ReKonfig::alwaysShowTabBar())
{
if (!isTabBarHidden())
{
@@ -202,14 +202,14 @@ void MainView::updateTabBar()
return;
}
- if( tabBar()->count() == 1 )
+ if (tabBar()->count() == 1)
{
tabBar()->hide();
m_addTabButton->hide();
}
- else if( !isTabBarHidden() )
+ else if (!isTabBarHidden())
{
- if ( tabBar()->isHidden() )
+ if (tabBar()->isHidden())
{
tabBar()->show();
m_addTabButton->show();
@@ -264,43 +264,43 @@ void MainView::currentChanged(int index)
// retrieve the old webview (that where we move from)
WebTab *oldTab = this->webTab(m_currentTabIndex);
-
+
// set current index
m_currentTabIndex = index;
if (oldTab)
- {
+ {
// disconnecting webpage from mainview
disconnect(oldTab->page(), SIGNAL(statusBarMessage(const QString&)),
this, SIGNAL(showStatusBarMessage(const QString&)));
disconnect(oldTab->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
this, SIGNAL(linkHovered(const QString&)));
}
-
- connect(tab->page(), SIGNAL(statusBarMessage(const QString&)),
+
+ connect(tab->page(), SIGNAL(statusBarMessage(const QString&)),
this, SIGNAL(showStatusBarMessage(const QString&)));
- connect(tab->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
+ connect(tab->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
this, SIGNAL(linkHovered(const QString&)));
emit currentTitle(tab->view()->title());
_bars->setCurrentIndex(index);
-
+
// clean up "status bar"
- emit showStatusBarMessage( QString() );
+ emit showStatusBarMessage(QString());
// notify UI to eventually switch stop/reload button
int progr = tab->progress();
- if(progr == 0)
+ if (progr == 0)
emit browserTabLoading(false);
else
emit browserTabLoading(true);
-
+
// update zoom slider
- if(!Application::instance()->mainWindowList().isEmpty())
+ if (!Application::instance()->mainWindowList().isEmpty())
Application::instance()->mainWindow()->setZoomSliderFactor(tab->view()->zoomFactor());
// set focus to the current webview
- if(tab->url().scheme() == QL1S("about"))
+ if (tab->url().scheme() == QL1S("about"))
_bars->currentWidget()->setFocus();
else
tab->view()->setFocus();
@@ -309,8 +309,8 @@ void MainView::currentChanged(int index)
WebTab *MainView::webTab(int index) const
{
- WebTab *tab = qobject_cast<WebTab *>( this->widget(index) );
- if(tab)
+ WebTab *tab = qobject_cast<WebTab *>(this->widget(index));
+ if (tab)
{
return tab;
}
@@ -324,7 +324,7 @@ WebTab *MainView::newWebTab(bool focused, bool nearParent)
{
WebTab* tab = new WebTab(this);
UrlBar *bar = new UrlBar(tab);
-
+
// connecting webview with mainview
connect(tab->view(), SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted()));
connect(tab->view(), SIGNAL(loadFinished(bool)), this, SLOT(webViewLoadFinished(bool)));
@@ -335,7 +335,7 @@ WebTab *MainView::newWebTab(bool focused, bool nearParent)
// connecting webPage signals with mainview
connect(tab->view()->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested()));
connect(tab->view()->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *)));
-
+
if (nearParent)
{
insertTab(currentIndex() + 1, tab, i18n("(Untitled)"));
@@ -347,14 +347,14 @@ WebTab *MainView::newWebTab(bool focused, bool nearParent)
_bars->addWidget(bar);
}
updateTabBar();
-
+
if (focused)
{
setCurrentWidget(tab);
}
emit tabsChanged();
-
+
return tab;
}
@@ -363,16 +363,16 @@ void MainView::newTab()
{
WebView *w = newWebTab()->view();
- switch(ReKonfig::newTabsBehaviour())
+ switch (ReKonfig::newTabsBehaviour())
{
case 0: // new tab page
- w->load( KUrl("about:home") );
+ w->load(KUrl("about:home"));
break;
case 1: // blank page
urlBar()->clear();
break;
case 2: // homepage
- w->load( KUrl(ReKonfig::homePage()) );
+ w->load(KUrl(ReKonfig::homePage()));
break;
default:
break;
@@ -392,9 +392,9 @@ void MainView::reloadAllTabs()
void MainView::windowCloseRequested()
{
- WebPage *page = qobject_cast<WebPage *>( sender() );
- WebView *view = qobject_cast<WebView *>( page->view() );
- int index = indexOf( view->parentWidget() );
+ WebPage *page = qobject_cast<WebPage *>(sender());
+ WebView *view = qobject_cast<WebView *>(page->view());
+ int index = indexOf(view->parentWidget());
if (index >= 0)
{
@@ -438,10 +438,10 @@ void MainView::cloneTab(int index)
index = currentIndex();
if (index < 0 || index >= count())
return;
-
+
WebTab *tab = newWebTab();
KUrl url = webTab(index)->url();
-
+
// workaround against bug in webkit:
// only set url if it is not empty
// otherwise the current working directory will be used
@@ -459,15 +459,15 @@ void MainView::closeTab(int index, bool del)
if (count() == 1)
{
WebView *w = currentWebTab()->view();
- switch(ReKonfig::newTabsBehaviour())
+ switch (ReKonfig::newTabsBehaviour())
{
case 0: // new tab page
case 1: // blank page
- w->load( KUrl("about:home") );
+ w->load(KUrl("about:home"));
urlBar()->setFocus();
break;
case 2: // homepage
- w->load( KUrl(ReKonfig::homePage()) );
+ w->load(KUrl(ReKonfig::homePage()));
break;
default:
break;
@@ -487,16 +487,16 @@ void MainView::closeTab(int index, bool del)
if (tab->view()->isModified())
{
int risp = KMessageBox::warningContinueCancel(this,
- i18n("This tab contains changes that have not been submitted.\n"
- "Closing the tab will discard these changes.\n"
- "Do you really want to close this tab?\n"),
- i18n("Closing Modified Tab"), KGuiItem(i18n("Close &Tab"),"tab-close"), KStandardGuiItem::cancel());
+ i18n("This tab contains changes that have not been submitted.\n"
+ "Closing the tab will discard these changes.\n"
+ "Do you really want to close this tab?\n"),
+ i18n("Closing Modified Tab"), KGuiItem(i18n("Close &Tab"), "tab-close"), KStandardGuiItem::cancel());
if (risp != KMessageBox::Continue)
return;
}
// store close tab except homepage
- if (!tab->url().prettyUrl().startsWith( QLatin1String("about:") ) && !tab->url().isEmpty())
+ if (!tab->url().prettyUrl().startsWith(QLatin1String("about:")) && !tab->url().isEmpty())
{
QString title = tab->view()->title();
QString url = tab->url().prettyUrl();
@@ -510,21 +510,21 @@ void MainView::closeTab(int index, bool del)
QWidget *urlbar = _bars->widget(index);
_bars->removeWidget(urlbar);
-
- if(del)
+
+ if (del)
{
tab->deleteLater(); // tab is scheduled for deletion.
urlbar->deleteLater();
}
-
+
emit tabsChanged();
}
void MainView::webViewLoadStarted()
{
- WebView *view = qobject_cast<WebView *>( sender() );
- int index = indexOf( view->parentWidget() );
+ WebView *view = qobject_cast<WebView *>(sender());
+ int index = indexOf(view->parentWidget());
if (-1 != index)
{
QLabel *label = animatedLoading(index, true);
@@ -544,10 +544,10 @@ void MainView::webViewLoadStarted()
void MainView::webViewLoadFinished(bool ok)
{
- WebView *view = qobject_cast<WebView *>( sender() );
+ WebView *view = qobject_cast<WebView *>(sender());
int index = -1;
- if(view)
- index = indexOf( view->parentWidget() );
+ if (view)
+ index = indexOf(view->parentWidget());
if (-1 != index)
{
@@ -565,7 +565,7 @@ void MainView::webViewLoadFinished(bool ok)
{
return;
}
-
+
if (ok)
emit showStatusBarMessage(i18n("Done"), Rekonq::Success);
// else
@@ -575,8 +575,8 @@ void MainView::webViewLoadFinished(bool ok)
void MainView::webViewIconChanged()
{
- WebView *view = qobject_cast<WebView *>( sender() );
- int index = indexOf( view->parentWidget() );
+ WebView *view = qobject_cast<WebView *>(sender());
+ int index = indexOf(view->parentWidget());
if (-1 != index)
{
KIcon icon = Application::icon(view->url());
@@ -596,8 +596,8 @@ void MainView::webViewTitleChanged(const QString &title)
{
tabTitle = i18n("(Untitled)");
}
- WebView *view = qobject_cast<WebView *>( sender() );
- int index = indexOf( view->parentWidget() );
+ WebView *view = qobject_cast<WebView *>(sender());
+ int index = indexOf(view->parentWidget());
if (-1 != index)
{
setTabText(index, tabTitle);
@@ -612,8 +612,8 @@ void MainView::webViewTitleChanged(const QString &title)
void MainView::webViewUrlChanged(const QUrl &url)
{
- WebView *view = qobject_cast<WebView *>( sender() );
- int index = indexOf( view->parentWidget() );
+ WebView *view = qobject_cast<WebView *>(sender());
+ int index = indexOf(view->parentWidget());
if (-1 != index)
{
tabBar()->setTabData(index, url);
@@ -686,7 +686,7 @@ void MainView::detachTab(int index)
WebTab *tab = webTab(index);
KUrl u = tab->url();
kDebug() << u;
- if( u.scheme() == QL1S("about") )
+ if (u.scheme() == QL1S("about"))
{
closeTab(index);
Application::instance()->loadUrl(u, Rekonq::NewWindow);
@@ -694,11 +694,11 @@ void MainView::detachTab(int index)
else
{
QString label = tab->view()->title();
- QWidget *bar = _bars->widget(index);
+ QWidget *bar = _bars->widget(index);
closeTab(index, false);
-
+
MainWindow *w = Application::instance()->newMainWindow(false);
- w->mainView()->addTab(tab, Application::icon( u ), label);
+ w->mainView()->addTab(tab, Application::icon(u), label);
QStackedWidget *stack = qobject_cast<QStackedWidget *>(w->mainView()->urlBarWidget());
stack->insertWidget(0, bar);
w->mainView()->updateTabBar();
@@ -706,7 +706,7 @@ void MainView::detachTab(int index)
}
-void MainView::movedTab(int from,int to)
+void MainView::movedTab(int from, int to)
{
QWidget *bar = _bars->widget(from);
_bars->removeWidget(bar);
diff --git a/src/mainview.h b/src/mainview.h
index 367fcb13..1cd17348 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -13,9 +13,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -57,7 +57,7 @@ class UrlBar;
/**
- * This class represent rekonq Main View.
+ * This class represent rekonq Main View.
* It contains all WebViews and the url bar.
*
*/
@@ -83,15 +83,15 @@ public:
*
*/
void updateTabBar();
-
+
void setTabBarHidden(bool hide);
-
+
QToolButton *addTabButton() const;
/**
* This function creates a new empty tab
* with a webview inside
- * @param focused decide if you wannna give focus
+ * @param focused decide if you wannna give focus
* (or not) to this new tab (default true)
* @param nearParent decide if you wanna create new tab near current or not
* @return the webview embedded in the new tab
@@ -130,7 +130,7 @@ public slots:
void nextTab();
void previousTab();
void detachTab(int index = -1);
-
+
// WEB slot actions
void webReload();
void webStop();
@@ -147,7 +147,7 @@ private slots:
void windowCloseRequested();
void postLaunch();
- void movedTab(int,int);
+ void movedTab(int, int);
protected:
virtual void resizeEvent(QResizeEvent *event);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 6355e6d8..037457bc 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -97,19 +97,19 @@
MainWindow::MainWindow()
- : KMainWindow()
- , m_view( new MainView(this) )
- , m_findBar( new FindBar(this) )
- , m_historyPanel(0)
- , m_bookmarksPanel(0)
- , m_webInspectorPanel(0)
- , m_historyBackMenu(0)
- , m_encodingMenu( new KMenu(this) )
- , m_mainBar( new KToolBar( QString("MainToolBar"), this, Qt::TopToolBarArea, true, true, true) )
- , m_bmBar( new KToolBar( QString("BookmarkToolBar"), this, Qt::TopToolBarArea, true, false, true) )
- , m_popup( new KPassivePopup(this) )
- , m_hidePopup( new QTimer(this) )
- , m_ac( new KActionCollection(this) )
+ : KMainWindow()
+ , m_view(new MainView(this))
+ , m_findBar(new FindBar(this))
+ , m_historyPanel(0)
+ , m_bookmarksPanel(0)
+ , m_webInspectorPanel(0)
+ , m_historyBackMenu(0)
+ , m_encodingMenu(new KMenu(this))
+ , m_mainBar(new KToolBar(QString("MainToolBar"), this, Qt::TopToolBarArea, true, true, true))
+ , m_bmBar(new KToolBar(QString("BookmarkToolBar"), this, Qt::TopToolBarArea, true, false, true))
+ , m_popup(new KPassivePopup(this))
+ , m_hidePopup(new QTimer(this))
+ , m_ac(new KActionCollection(this))
{
// enable window size "auto-save"
setAutoSaveSettings();
@@ -148,7 +148,7 @@ MainWindow::MainWindow()
// setting popup notification
m_popup->setAutoDelete(false);
- connect(Application::instance(), SIGNAL(focusChanged(QWidget*,QWidget*)), m_popup, SLOT(hide()));
+ connect(Application::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), m_popup, SLOT(hide()));
m_popup->setFrameShape(QFrame::NoFrame);
m_popup->setLineWidth(0);
connect(m_hidePopup, SIGNAL(timeout()), m_popup, SLOT(hide()));
@@ -169,37 +169,37 @@ MainWindow::~MainWindow()
void MainWindow::setupToolbars()
{
// ============ Main ToolBar ================================
- m_mainBar->addAction( actionByName(KStandardAction::name(KStandardAction::Back)) );
- m_mainBar->addAction( actionByName(KStandardAction::name(KStandardAction::Forward)) );
+ m_mainBar->addAction(actionByName(KStandardAction::name(KStandardAction::Back)));
+ m_mainBar->addAction(actionByName(KStandardAction::name(KStandardAction::Forward)));
m_mainBar->addSeparator();
- m_mainBar->addAction( actionByName("stop_reload") );
- m_mainBar->addAction( actionByName(KStandardAction::name(KStandardAction::Home)) );
+ m_mainBar->addAction(actionByName("stop_reload"));
+ m_mainBar->addAction(actionByName(KStandardAction::name(KStandardAction::Home)));
// location bar
KAction *urlBarAction = new KAction(this);
urlBarAction->setDefaultWidget(m_view->urlBarWidget());
- m_mainBar->addAction( urlBarAction );
+ m_mainBar->addAction(urlBarAction);
+
+ m_mainBar->addAction(actionByName("bookmarksActionMenu"));
+ m_mainBar->addAction(actionByName("rekonq_tools"));
- m_mainBar->addAction( actionByName("bookmarksActionMenu") );
- m_mainBar->addAction( actionByName("rekonq_tools") );
-
m_mainBar->show(); // this just to fix reopening rekonq after fullscreen close
-
+
// =========== Bookmarks ToolBar ================================
m_bmBar->setAcceptDrops(true);
Application::bookmarkProvider()->setupBookmarkBar(m_bmBar);
- if(ReKonfig::firstExecution())
+ if (ReKonfig::firstExecution())
{
m_mainBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
-
+
m_bmBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
m_bmBar->setIconDimensions(16);
m_bmBar->hide();
-
+
KToolBar::setToolBarsEditable(false);
KToolBar::setToolBarsLocked(true);
-
+
ReKonfig::setFirstExecution(false);
}
}
@@ -209,7 +209,7 @@ void MainWindow::postLaunch()
{
// KActionCollection read settings
m_ac->readSettings();
-
+
// 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&)));
@@ -275,26 +275,26 @@ void MainWindow::setupActions()
a = KStandardAction::find(m_findBar, SLOT(show()), actionCollection());
KShortcut findShortcut = KStandardShortcut::find();
- findShortcut.setAlternate( Qt::Key_Slash );
- a->setShortcut( findShortcut );
+ findShortcut.setAlternate(Qt::Key_Slash);
+ a->setShortcut(findShortcut);
KStandardAction::findNext(this, SLOT(findNext()) , actionCollection());
KStandardAction::findPrev(this, SLOT(findPrevious()) , actionCollection());
-
+
a = KStandardAction::fullScreen(this, SLOT(viewFullScreen(bool)), this, actionCollection());
KShortcut fullScreenShortcut = KStandardShortcut::fullScreen();
- fullScreenShortcut.setAlternate( Qt::Key_F11 );
- a->setShortcut( fullScreenShortcut );
+ fullScreenShortcut.setAlternate(Qt::Key_F11);
+ a->setShortcut(fullScreenShortcut);
- a = actionCollection()->addAction( KStandardAction::Home );
+ a = actionCollection()->addAction(KStandardAction::Home);
connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(homePage(Qt::MouseButtons, Qt::KeyboardModifiers)));
KStandardAction::preferences(this, SLOT(preferences()), actionCollection());
a = KStandardAction::redisplay(m_view, SLOT(webReload()), actionCollection());
a->setText(i18n("Reload"));
KShortcut reloadShortcut = KStandardShortcut::reload();
- reloadShortcut.setAlternate( Qt::CTRL + Qt::Key_R );
- a->setShortcut( reloadShortcut );
+ reloadShortcut.setAlternate(Qt::CTRL + Qt::Key_R);
+ a->setShortcut(reloadShortcut);
a = new KAction(KIcon("process-stop"), i18n("&Stop"), this);
a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Period));
@@ -319,7 +319,7 @@ void MainWindow::setupActions()
a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Plus));
actionCollection()->addAction(QLatin1String("zoom_in"), a);
connect(a, SIGNAL(triggered(bool)), this, SLOT(zoomIn()));
-
+
a = new KAction(KIcon("zoom-original"), i18n("&Normal Zoom"), this);
a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_0));
actionCollection()->addAction(QLatin1String("zoom_normal"), a);
@@ -346,7 +346,7 @@ void MainWindow::setupActions()
connect(a, SIGNAL(triggered(bool)), this, SLOT(clearPrivateData()));
// ========================= History related actions ==============================
- a = actionCollection()->addAction( KStandardAction::Back );
+ a = actionCollection()->addAction(KStandardAction::Back);
connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(openPrevious(Qt::MouseButtons, Qt::KeyboardModifiers)));
m_historyBackMenu = new KMenu(this);
@@ -354,7 +354,7 @@ void MainWindow::setupActions()
connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowBackMenu()));
connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(openActionUrl(QAction *)));
- a = actionCollection()->addAction( KStandardAction::Forward );
+ a = actionCollection()->addAction(KStandardAction::Forward);
connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(openNext(Qt::MouseButtons, Qt::KeyboardModifiers)));
// ============================== General Tab Actions ====================================
@@ -364,8 +364,8 @@ void MainWindow::setupActions()
connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newTab()));
a = new KAction(KIcon("view-refresh"), i18n("Reload All Tabs"), this);
- actionCollection()->addAction( QLatin1String("reload_all_tabs"), a);
- connect(a, SIGNAL(triggered(bool)), m_view, SLOT(reloadAllTabs()) );
+ actionCollection()->addAction(QLatin1String("reload_all_tabs"), a);
+ connect(a, SIGNAL(triggered(bool)), m_view, SLOT(reloadAllTabs()));
a = new KAction(i18n("Show Next Tab"), this);
a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext());
@@ -384,32 +384,32 @@ void MainWindow::setupActions()
a = new KAction(KIcon("tab-duplicate"), i18n("Clone Tab"), this);
actionCollection()->addAction(QLatin1String("clone_tab"), a);
- connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(cloneTab()) );
+ connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(cloneTab()));
a = new KAction(KIcon("tab-close-other"), i18n("Close &Other Tabs"), this);
- actionCollection()->addAction( QLatin1String("close_other_tabs"), a);
- connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(closeOtherTabs()) );
+ actionCollection()->addAction(QLatin1String("close_other_tabs"), a);
+ connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(closeOtherTabs()));
a = new KAction(KIcon("view-refresh"), i18n("Reload Tab"), this);
- actionCollection()->addAction( QLatin1String("reload_tab"), a);
- connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(reloadTab()) );
+ actionCollection()->addAction(QLatin1String("reload_tab"), a);
+ connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(reloadTab()));
a = new KAction(KIcon("tab-detach"), i18n("Detach Tab"), this);
- actionCollection()->addAction( QLatin1String("detach_tab"), a);
- connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(detachTab()) );
-
-
+ actionCollection()->addAction(QLatin1String("detach_tab"), a);
+ connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(detachTab()));
+
+
// ----------------------- Bookmarks ToolBar Action --------------------------------------
QAction *qa;
-
+
qa = m_mainBar->toggleViewAction();
- qa->setText( i18n("Main Toolbar") );
- qa->setIcon( KIcon("bookmark-toolbar") );
+ qa->setText(i18n("Main Toolbar"));
+ qa->setIcon(KIcon("bookmark-toolbar"));
actionCollection()->addAction(QLatin1String("main_bar"), qa);
-
+
qa = m_bmBar->toggleViewAction();
- qa->setText( i18n("Bookmarks Toolbar") );
- qa->setIcon( KIcon("bookmark-toolbar") );
+ qa->setText(i18n("Bookmarks Toolbar"));
+ qa->setIcon(KIcon("bookmark-toolbar"));
actionCollection()->addAction(QLatin1String("bm_bar"), qa);
// Bookmark Menu
@@ -418,13 +418,13 @@ void MainWindow::setupActions()
bmMenu->setDelayed(false);
actionCollection()->addAction(QLatin1String("bookmarksActionMenu"), bmMenu);
-
+
// ---------------- Encodings -----------------------------------
- a = new KAction( KIcon("character-set"), i18n("Set Encoding"), this);
- actionCollection()->addAction( QLatin1String("encodings"), a);
+ a = new KAction(KIcon("character-set"), i18n("Set Encoding"), this);
+ actionCollection()->addAction(QLatin1String("encodings"), a);
a->setMenu(m_encodingMenu);
- connect(m_encodingMenu, SIGNAL(aboutToShow()), this, SLOT( populateEncodingMenu() ) );
- connect(m_encodingMenu, SIGNAL(triggered(QAction *)), this, SLOT( setEncoding(QAction *) ));
+ connect(m_encodingMenu, SIGNAL(aboutToShow()), this, SLOT(populateEncodingMenu()));
+ connect(m_encodingMenu, SIGNAL(triggered(QAction *)), this, SLOT(setEncoding(QAction *)));
}
@@ -437,29 +437,29 @@ void MainWindow::setupTools()
toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::SaveAs)));
toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Print)));
toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Find)));
-
+
// setup zoom widget
QWidget *zoomWidget = new QWidget(this);
-
+
QToolButton *zoomOut = new QToolButton(zoomWidget);
zoomOut->setDefaultAction(actionByName(QLatin1String("zoom_out")));
zoomOut->setAutoRaise(true);
-
+
m_zoomSlider = new QSlider(Qt::Horizontal, zoomWidget);
m_zoomSlider->setTracking(true);
m_zoomSlider->setRange(1, 19); // divide by 10 to obtain a qreal for zoomFactor()
m_zoomSlider->setValue(10);
m_zoomSlider->setPageStep(3);
connect(m_zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setZoomFactor(int)));
-
+
QToolButton *zoomIn = new QToolButton(zoomWidget);
zoomIn->setDefaultAction(actionByName(QLatin1String("zoom_in")));
zoomIn->setAutoRaise(true);
-
+
QToolButton *zoomNormal = new QToolButton(zoomWidget);
zoomNormal->setDefaultAction(actionByName(QLatin1String("zoom_normal")));
zoomNormal->setAutoRaise(true);
-
+
QHBoxLayout* zoomWidgetLayout = new QHBoxLayout(zoomWidget);
zoomWidgetLayout->setSpacing(0);
zoomWidgetLayout->setMargin(0);
@@ -467,11 +467,11 @@ void MainWindow::setupTools()
zoomWidgetLayout->addWidget(m_zoomSlider);
zoomWidgetLayout->addWidget(zoomIn);
zoomWidgetLayout->addWidget(zoomNormal);
-
+
QWidgetAction *zoomAction = new QWidgetAction(this);
zoomAction->setDefaultWidget(zoomWidget);
toolsMenu->addAction(zoomAction);
-
+
toolsMenu->addSeparator();
toolsMenu->addAction(actionByName(QLatin1String("private_browsing")));
@@ -494,7 +494,7 @@ void MainWindow::setupTools()
toolsMenu->addSeparator();
toolsMenu->addAction(actionByName(QLatin1String("encodings")));
-
+
helpMenu()->setIcon(KIcon("help-browser"));
toolsMenu->addAction(helpMenu()->menuAction());
toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Preferences)));
@@ -507,7 +507,7 @@ void MainWindow::setupTools()
void MainWindow::setupPanels()
{
KAction* a;
-
+
// STEP 1
// Setup history panel
m_historyPanel = new HistoryPanel(i18n("History Panel"), this);
@@ -519,7 +519,7 @@ void MainWindow::setupPanels()
// setup history panel action
a = (KAction *) m_historyPanel->toggleViewAction();
- a->setShortcut( KShortcut(Qt::CTRL + Qt::Key_H) );
+ a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_H));
a->setIcon(KIcon("view-history"));
actionCollection()->addAction(QLatin1String("show_history_panel"), a);
@@ -534,7 +534,7 @@ void MainWindow::setupPanels()
// setup bookmarks panel action
a = (KAction *) m_bookmarksPanel->toggleViewAction();
- a->setShortcut( KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B) );
+ a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B));
a->setIcon(KIcon("bookmarks-organize"));
actionCollection()->addAction(QLatin1String("show_bookmarks_panel"), a);
@@ -542,12 +542,12 @@ void MainWindow::setupPanels()
// Setup webinspector panel
m_webInspectorPanel = new WebInspectorPanel(i18n("Web Inspector"), this);
connect(mainView(), SIGNAL(currentChanged(int)), m_webInspectorPanel, SLOT(changeCurrentPage()));
-
+
a = new KAction(KIcon("tools-report-bug"), i18n("Web &Inspector"), this);
a->setCheckable(true);
actionCollection()->addAction(QLatin1String("web_inspector"), a);
connect(a, SIGNAL(triggered(bool)), m_webInspectorPanel, SLOT(toggle(bool)));
-
+
addDockWidget(Qt::BottomDockWidgetArea, m_webInspectorPanel);
m_webInspectorPanel->hide();
}
@@ -565,7 +565,7 @@ void MainWindow::fileSaveAs()
KUrl srcUrl = currentTab()->url();
QString name = srcUrl.fileName();
- if(name.isNull())
+ if (name.isNull())
{
name = srcUrl.host() + QString(".html");
}
@@ -611,9 +611,9 @@ void MainWindow::updateWindowTitle(const QString &title)
QWebSettings *settings = QWebSettings::globalSettings();
if (title.isEmpty())
{
- if(settings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
+ if (settings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
{
- setWindowTitle(i18nc("Window title when private browsing is activated", "rekonq (Private Browsing)"));
+ setWindowTitle(i18nc("Window title when private browsing is activated", "rekonq (Private Browsing)"));
}
else
{
@@ -622,9 +622,9 @@ void MainWindow::updateWindowTitle(const QString &title)
}
else
{
- if(settings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
+ if (settings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
{
- setWindowTitle(i18nc("window title, %1 = title of the active website", "%1 – rekonq (Private Browsing)", title) );
+ setWindowTitle(i18nc("window title, %1 = title of the active website", "%1 – rekonq (Private Browsing)", title));
}
else
{
@@ -638,7 +638,7 @@ void MainWindow::fileOpen()
{
QString filePath = KFileDialog::getOpenFileName(KUrl(),
i18n("*.html *.htm *.svg *.png *.gif *.svgz|Web Resources (*.html *.htm *.svg *.png *.gif *.svgz)\n"
- "*.*|All files (*.*)"),
+ "*.*|All files (*.*)"),
this,
i18n("Open Web Resource"));
@@ -655,7 +655,7 @@ void MainWindow::printRequested(QWebFrame *frame)
return;
QWebFrame *printFrame = 0;
- if(frame == 0)
+ if (frame == 0)
{
printFrame = currentTab()->page()->mainFrame();
}
@@ -702,7 +702,7 @@ void MainWindow::privateBrowsing(bool enable)
{
settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, false);
m_view->urlBar()->setPrivateMode(false);
-
+
m_lastSearch.clear();
m_view->reloadAllTabs();
}
@@ -714,7 +714,7 @@ void MainWindow::find(const QString & search)
if (!currentTab())
return;
m_lastSearch = search;
-
+
findNext();
}
@@ -723,7 +723,7 @@ void MainWindow::matchCaseUpdate()
{
if (!currentTab())
return;
-
+
currentTab()->view()->findText(m_lastSearch, QWebPage::FindBackward);
findNext();
}
@@ -735,17 +735,17 @@ void MainWindow::findNext()
return;
highlightAll();
-
- if(m_findBar->isHidden())
+
+ if (m_findBar->isHidden())
{
QPoint previous_position = currentTab()->view()->page()->currentFrame()->scrollPosition();
currentTab()->view()->page()->focusNextPrevChild(true);
currentTab()->view()->page()->currentFrame()->setScrollPosition(previous_position);
return;
}
-
+
highlightAll();
-
+
QWebPage::FindFlags options = QWebPage::FindWrapsAroundDocument;
if (m_findBar->matchCase())
options |= QWebPage::FindCaseSensitively;
@@ -753,7 +753,7 @@ void MainWindow::findNext()
bool found = currentTab()->view()->findText(m_lastSearch, options);
m_findBar->notifyMatch(found);
- if(!found)
+ if (!found)
{
QPoint previous_position = currentTab()->view()->page()->currentFrame()->scrollPosition();
currentTab()->view()->page()->focusNextPrevChild(true);
@@ -766,7 +766,7 @@ void MainWindow::findPrevious()
{
if (!currentTab())
return;
-
+
QWebPage::FindFlags options = QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument;
if (m_findBar->matchCase())
options |= QWebPage::FindCaseSensitively;
@@ -779,12 +779,12 @@ void MainWindow::highlightAll()
{
if (!currentTab())
return;
-
+
QWebPage::FindFlags options = QWebPage::HighlightAllOccurrences;
-
+
currentTab()->view()->findText("", options); //Clear an existing highlight
-
- if(m_findBar->highlightAllState() && !m_findBar->isHidden())
+
+ if (m_findBar->highlightAllState() && !m_findBar->isHidden())
{
if (m_findBar->matchCase())
options |= QWebPage::FindCaseSensitively;
@@ -811,7 +811,7 @@ void MainWindow::zoomOut()
void MainWindow::setZoomFactor(int factor)
{
- if(!currentTab())
+ if (!currentTab())
return;
currentTab()->view()->setZoomFactor(QVariant(factor).toReal() / 10);
}
@@ -845,10 +845,10 @@ void MainWindow::setWidgetsVisible(bool makeVisible)
historyPanelFlag = m_historyPanel->isHidden();
bookmarksPanelFlag = m_bookmarksPanel->isHidden();
}
-
- m_bmBar->hide();
+
+ m_bmBar->hide();
m_view->setTabBarHidden(true);
- m_historyPanel->hide();
+ m_historyPanel->hide();
m_bookmarksPanel->hide();
// hide main toolbar
@@ -867,7 +867,7 @@ void MainWindow::setWidgetsVisible(bool makeVisible)
m_historyPanel->show();
if (!bookmarksPanelFlag)
m_bookmarksPanel->show();
- }
+ }
}
@@ -901,10 +901,10 @@ void MainWindow::viewPageSource()
void MainWindow::homePage(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers)
{
- if(mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier)
- Application::instance()->loadUrl( KUrl(ReKonfig::homePage()), Rekonq::SettingOpenTab );
+ if (mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier)
+ Application::instance()->loadUrl(KUrl(ReKonfig::homePage()), Rekonq::SettingOpenTab);
else
- currentTab()->view()->load( QUrl(ReKonfig::homePage()) );
+ currentTab()->view()->load(QUrl(ReKonfig::homePage()));
}
@@ -950,7 +950,7 @@ void MainWindow::openPrevious(Qt::MouseButtons mouseButtons, Qt::KeyboardModifie
QWebHistory *history = currentTab()->view()->history();
if (history->canGoBack())
{
- if(mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier)
+ if (mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier)
{
Application::instance()->loadUrl(history->backItem().url(), Rekonq::SettingOpenTab);
}
@@ -958,10 +958,10 @@ void MainWindow::openPrevious(Qt::MouseButtons mouseButtons, Qt::KeyboardModifie
{
history->goToItem(history->backItem());
}
-
+
updateActions();
}
-
+
}
@@ -970,7 +970,7 @@ void MainWindow::openNext(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers k
QWebHistory *history = currentTab()->view()->history();
if (history->canGoForward())
{
- if(mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier)
+ if (mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier)
{
Application::instance()->loadUrl(history->forwardItem().url(), Rekonq::SettingOpenTab);
}
@@ -1040,7 +1040,7 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)
}
// deleting popus if empty msgs
- if(msg.isEmpty())
+ if (msg.isEmpty())
{
m_hidePopup->start(250);
return;
@@ -1049,7 +1049,7 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)
m_hidePopup->stop();
- switch(status)
+ switch (status)
{
case Rekonq::Info:
break;
@@ -1068,7 +1068,7 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)
// setting the popup
QLabel *label = new QLabel(msg);
m_popup->setView(label);
- QSize labelSize(label->fontMetrics().width(msg)+2*margin, label->fontMetrics().height()+2*margin);
+ QSize labelSize(label->fontMetrics().width(msg) + 2*margin, label->fontMetrics().height() + 2*margin);
if (labelSize.width() > width()) labelSize.setWidth(width());
m_popup->setFixedSize(labelSize);
m_popup->layout()->setAlignment(Qt::AlignTop);
@@ -1078,13 +1078,13 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)
WebTab *tab = m_view->currentWebTab();
// fix crash on window close
- if(!tab)
+ if (!tab)
return;
// fix crash on window close
- if(!tab->page())
+ if (!tab->page())
return;
-
+
bool scrollbarIsVisible = tab->page()->currentFrame()->scrollBarMaximum(Qt::Horizontal);
int scrollbarSize = 0;
if (scrollbarIsVisible)
@@ -1092,22 +1092,22 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)
//TODO: detect QStyle size
scrollbarSize = 17;
}
-
- QPoint webViewOrigin = tab->view()->mapToGlobal(QPoint(0,0));
+
+ QPoint webViewOrigin = tab->view()->mapToGlobal(QPoint(0, 0));
int bottomLeftY = webViewOrigin.y() + tab->page()->viewportSize().height() - labelSize.height() - scrollbarSize;
// setting popup in bottom-left position
int x = geometry().x();
int y = bottomLeftY;
- QPoint mousePos = tab->mapToGlobal( tab->view()->mousePos() );
- if( QRect( webViewOrigin.x() , bottomLeftY , labelSize.width() , labelSize.height() ).contains(mousePos) )
+ QPoint mousePos = tab->mapToGlobal(tab->view()->mousePos());
+ if (QRect(webViewOrigin.x() , bottomLeftY , labelSize.width() , labelSize.height()).contains(mousePos))
{
// setting popup above the mouse
y = bottomLeftY - labelSize.height();
}
- m_popup->show(QPoint(x,y));
+ m_popup->show(QPoint(x, y));
}
@@ -1116,7 +1116,7 @@ void MainWindow::clearPrivateData()
QPointer<KDialog> dialog = new KDialog(this);
dialog->setCaption(i18n("Clear Private Data"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
-
+
dialog->button(KDialog::Ok)->setIcon(KIcon("edit-clear"));
dialog->button(KDialog::Ok)->setText(i18n("Clear"));
@@ -1129,34 +1129,34 @@ void MainWindow::clearPrivateData()
if (dialog->result() == QDialog::Accepted)
{
- if(clearWidget.clearHistory->isChecked())
+ if (clearWidget.clearHistory->isChecked())
{
Application::historyManager()->clear();
}
-
- if(clearWidget.clearDownloads->isChecked())
+
+ if (clearWidget.clearDownloads->isChecked())
{
Application::historyManager()->clearDownloadsHistory();
}
-
- if(clearWidget.clearCookies->isChecked())
+
+ if (clearWidget.clearCookies->isChecked())
{
QDBusInterface kcookiejar("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer");
- QDBusReply<void> reply = kcookiejar.call( "deleteAllCookies" );
+ QDBusReply<void> reply = kcookiejar.call("deleteAllCookies");
}
- if(clearWidget.clearCachedPages->isChecked())
+ if (clearWidget.clearCachedPages->isChecked())
{
- KProcess::startDetached(KStandardDirs::findExe("kio_http_cache_cleaner"),
+ KProcess::startDetached(KStandardDirs::findExe("kio_http_cache_cleaner"),
QStringList(QLatin1String("--clear-all")));
}
- if(clearWidget.clearWebIcons->isChecked())
+ if (clearWidget.clearWebIcons->isChecked())
{
QWebSettings::clearIconDatabase();
}
- if(clearWidget.homePageThumbs->isChecked())
+ if (clearWidget.homePageThumbs->isChecked())
{
QString path = KStandardDirs::locateLocal("cache", QString("thumbs/rekonq"), true);
path.remove("rekonq");
@@ -1169,7 +1169,7 @@ void MainWindow::clearPrivateData()
}
}
}
-
+
dialog->deleteLater();
}
@@ -1184,17 +1184,17 @@ void MainWindow::aboutToShowBackMenu()
int offset = 0;
QList<QWebHistoryItem> historyList = history->backItems(8); //no more than 8 elements!
int listCount = historyList.count();
- if(pivot >= 8)
- offset = pivot - 8;
-
- for(int i = listCount - 1; i>=0; --i)
+ if (pivot >= 8)
+ offset = pivot - 8;
+
+ for (int i = listCount - 1; i >= 0; --i)
{
QWebHistoryItem item = historyList.at(i);
KAction *action = new KAction(this);
action->setData(i + offset);
- KIcon icon = Application::icon( item.url() );
- action->setIcon( icon );
- action->setText( item.title() );
+ KIcon icon = Application::icon(item.url());
+ action->setIcon(icon);
+ action->setText(item.title());
m_historyBackMenu->addAction(action);
}
}
@@ -1203,24 +1203,24 @@ void MainWindow::aboutToShowBackMenu()
void MainWindow::openActionUrl(QAction *action)
{
int index = action->data().toInt();
-
- QWebHistory *history = currentTab()->view()->history();
- if(!history->itemAt(index).isValid())
+
+ QWebHistory *history = currentTab()->view()->history();
+ if (!history->itemAt(index).isValid())
{
- kDebug() << "Invalid Index!: "<< index;
+ kDebug() << "Invalid Index!: " << index;
return;
}
- history->goToItem( history->itemAt(index) );
+ history->goToItem(history->itemAt(index));
}
-
+
void MainWindow::setEncoding(QAction *qa)
{
QString currentCodec = qa->text().toLatin1();
currentCodec = currentCodec.remove('&');
kDebug() << currentCodec;
- QWebSettings::globalSettings()->setDefaultTextEncoding( currentCodec );
+ QWebSettings::globalSettings()->setDefaultTextEncoding(currentCodec);
ReKonfig::setDefaultEncoding(currentCodec);
}
@@ -1234,10 +1234,10 @@ void MainWindow::populateEncodingMenu()
codecs << QString(b);
}
codecs.sort();
-
+
QString currentCodec = ReKonfig::defaultEncoding();
kDebug() << "Current Codec: " << currentCodec;
-
+
m_encodingMenu->clear();
Q_FOREACH(const QString &codec, codecs)
{
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 7129de80..24648aa8 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -75,7 +75,7 @@ public:
WebTab *currentTab() const;
QAction *actionByName(const QString name);
virtual QSize sizeHint() const;
- virtual KActionCollection *actionCollection () const;
+ virtual KActionCollection *actionCollection() const;
void setWidgetsVisible(bool makeFullScreen);
void setZoomSliderFactor(qreal factor);
@@ -85,7 +85,7 @@ private:
void setupTools();
void setupToolbars();
void setupPanels();
-
+
public slots:
void homePage(Qt::MouseButtons = Qt::LeftButton, Qt::KeyboardModifiers = Qt::NoModifier);
@@ -100,7 +100,7 @@ public slots:
void notifyMessage(const QString &msg, Rekonq::Notify status = Rekonq::Info);
void printRequested(QWebFrame *frame = 0);
-
+
signals:
// switching tabs
void ctrlTabPressed();
@@ -172,7 +172,7 @@ private:
KAction *m_stopReloadAction;
KMenu *m_historyBackMenu;
KMenu *m_encodingMenu;
-
+
KToolBar *m_mainBar;
KToolBar *m_bmBar;
diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp
index 15a71317..1d67301b 100644
--- a/src/networkaccessmanager.cpp
+++ b/src/networkaccessmanager.cpp
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -44,39 +44,39 @@
NetworkAccessManager::NetworkAccessManager(QObject *parent)
- : AccessManager(parent)
+ : AccessManager(parent)
{
QString c = KGlobal::locale()->country();
- if(c == QL1S("C"))
+ if (c == QL1S("C"))
c = QL1S("en_US");
- if(c != QL1S("en_US"))
- c.append( QL1S(", en_US") );
-
+ if (c != QL1S("en_US"))
+ c.append(QL1S(", en_US"));
+
_acceptLanguage = c.toLatin1();
}
QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
{
- WebPage *parentPage = qobject_cast<WebPage *>( parent() );
-
+ WebPage *parentPage = qobject_cast<WebPage *>(parent());
+
QNetworkReply *reply = 0;
-
+
QNetworkRequest req = request;
req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);
req.setRawHeader("Accept-Language", _acceptLanguage);
KIO::CacheControl cc = KProtocolManager::cacheControl();
- switch(cc)
+ switch (cc)
{
case KIO::CC_CacheOnly: // Fail request if not in cache.
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache);
break;
-
+
case KIO::CC_Refresh: // Always validate cached entry with remote site.
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork);
break;
-
+
case KIO::CC_Reload: // Always fetch from remote site
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
break;
@@ -87,14 +87,14 @@ QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkR
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache);
break;
}
-
- if( op == QNetworkAccessManager::GetOperation )
+
+ if (op == QNetworkAccessManager::GetOperation)
{
reply = Application::adblockManager()->block(req, parentPage);
if (reply)
return reply;
}
- return AccessManager::createRequest(op,req,outgoingData);
+ return AccessManager::createRequest(op, req, outgoingData);
}
diff --git a/src/networkaccessmanager.h b/src/networkaccessmanager.h
index cc7d800d..2a240bfa 100644
--- a/src/networkaccessmanager.h
+++ b/src/networkaccessmanager.h
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp
index 7f13647b..f0cee9e1 100644
--- a/src/newtabpage.cpp
+++ b/src/newtabpage.cpp
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -59,12 +59,12 @@
NewTabPage::NewTabPage(QWebFrame *frame)
- : QObject(frame)
- , m_root(frame->documentElement())
+ : QObject(frame)
+ , m_root(frame->documentElement())
{
QString htmlFilePath = KStandardDirs::locate("data", "rekonq/htmls/home.html");
- QString imagesPath = QString("file://") + KGlobal::dirs()->findResourceDir("data", "rekonq/pics/bg.png") + QString("rekonq/pics");
-
+ QString imagesPath = QString("file://") + KGlobal::dirs()->findResourceDir("data", "rekonq/pics/bg.png") + QString("rekonq/pics");
+
QFile file(htmlFilePath);
bool isOpened = file.open(QIODevice::ReadOnly);
if (!isOpened)
@@ -86,83 +86,83 @@ NewTabPage::~NewTabPage()
void NewTabPage::generate(const KUrl &url)
{
- if(KUrl("about:preview").isParentOf(url))
+ if (KUrl("about:preview").isParentOf(url))
{
- if(url.fileName() == QString("add"))
+ if (url.fileName() == QString("add"))
{
QStringList names = ReKonfig::previewNames();
QStringList urls = ReKonfig::previewUrls();
-
+
names.append("");
urls.append("");
-
+
ReKonfig::setPreviewNames(names);
ReKonfig::setPreviewUrls(urls);
-
+
// Why doesn't it work well ?
// m_root.appendInside(emptyPreview(names.length() - 1));
// Replacing with this :
generate(KUrl("about:favorites"));
return;
}
- if(url.directory() == QString("preview/remove"))
+ if (url.directory() == QString("preview/remove"))
{
removePreview(url.fileName().toInt());
return;
}
- if(url.directory() == QString("preview/modify"))
+ if (url.directory() == QString("preview/modify"))
{
int index = url.fileName().toInt();
Application::instance()->mainWindow()->currentTab()->createPreviewSelectorBar(index);
return;
}
}
- if(url.fileName() == QString("clear"))
+ if (url.fileName() == QString("clear"))
{
Application::instance()->mainWindow()->actionByName("clear_private_data")->trigger();
generate(QString("about:" + url.directory()));
return;
}
- if(url == KUrl("about:bookmarks/edit"))
- {
+ if (url == KUrl("about:bookmarks/edit"))
+ {
Application::bookmarkProvider()->bookmarkManager()->slotEditBookmarks();
return;
}
-
+
QWebPage *page = m_root.webFrame()->page();
page->mainFrame()->setHtml(m_html);
m_root = page->mainFrame()->documentElement().findFirst("#content");
-
+
browsingMenu(url);
-
+
QString title;
- if(url == KUrl("about:favorites"))
+ if (url == KUrl("about:favorites"))
{
favoritesPage();
title = i18n("Favorites");
}
- else if(url == KUrl("about:closedTabs"))
+ else if (url == KUrl("about:closedTabs"))
{
closedTabsPage();
title = i18n("Closed Tabs");
}
- else if(url == KUrl("about:history"))
+ else if (url == KUrl("about:history"))
{
historyPage();
title = i18n("History");
}
- else if(url == KUrl("about:bookmarks"))
+ else if (url == KUrl("about:bookmarks"))
{
bookmarksPage();
title = i18n("Bookmarks");
}
- else if(url == KUrl("about:downloads"))
+ else if (url == KUrl("about:downloads"))
{
downloadsPage();
title = i18n("Downloads");
}
-
+
m_root.document().findFirst("title").setPlainText(title);
}
@@ -170,38 +170,38 @@ void NewTabPage::generate(const KUrl &url)
void NewTabPage::favoritesPage()
{
m_root.addClass("favorites");
-
+
QWebElement add = markup(".link");
add.findFirst("a").setAttribute("href", "about:preview/add");
- add.findFirst("img").setAttribute("src" , QString("file:///" +
- KIconLoader::global()->iconPath("list-add", KIconLoader::Small || KIconLoader::SizeSmall)));
+ add.findFirst("img").setAttribute("src" , QString("file:///" +
+ KIconLoader::global()->iconPath("list-add", KIconLoader::Small || KIconLoader::SizeSmall)));
add.findFirst("span").appendInside(i18n("Add Preview"));
m_root.document().findFirst("#actions").appendInside(add);
-
+
QStringList names = ReKonfig::previewNames();
QStringList urls = ReKonfig::previewUrls();
-
- if(urls.isEmpty())
+
+ if (urls.isEmpty())
{
m_root.addClass("empty");
- m_root.setPlainText( i18n("You can add a preview by clicking the \"Add Preview\" button in the top-right corner of this page") );
+ m_root.setPlainText(i18n("You can add a preview by clicking the \"Add Preview\" button in the top-right corner of this page"));
return;
}
-
- for(int i=0; i < urls.count() ; ++i)
+
+ for (int i = 0; i < urls.count() ; ++i)
{
- KUrl url = KUrl( urls.at(i) );
+ KUrl url = KUrl(urls.at(i));
QWebElement prev;
-
- if(url.isEmpty())
+
+ if (url.isEmpty())
prev = emptyPreview(i);
- else if( !WebSnap::existsImage(url) )
+ else if (!WebSnap::existsImage(url))
prev = loadingPreview(i, url);
else
prev = validPreview(i, url, names.at(i));
-
+
setupPreview(prev, i);
-
+
m_root.appendInside(prev);
}
}
@@ -210,15 +210,15 @@ void NewTabPage::favoritesPage()
QWebElement NewTabPage::emptyPreview(int index)
{
QWebElement prev = markup(".thumbnail");
-
+
prev.findFirst(".preview img").setAttribute("src" , QString("file:///") +
- KIconLoader::global()->iconPath("insert-image", KIconLoader::Desktop));
+ KIconLoader::global()->iconPath("insert-image", KIconLoader::Desktop));
prev.findFirst("span a").setPlainText(i18n("Set a Preview..."));
prev.findFirst("a").setAttribute("href", QString("about:preview/modify/" + QVariant(index).toString()));
-
+
setupPreview(prev, index);
//hideControls(prev);
-
+
return prev;
}
@@ -226,12 +226,12 @@ QWebElement NewTabPage::emptyPreview(int index)
QWebElement NewTabPage::loadingPreview(int index, const KUrl &url)
{
QWebElement prev = markup(".thumbnail");
-
- prev.findFirst(".preview img").setAttribute("src" ,
- QString("file:///") + KStandardDirs::locate("appdata", "pics/busywidget.gif"));
+
+ prev.findFirst(".preview img").setAttribute("src" ,
+ QString("file:///") + KStandardDirs::locate("appdata", "pics/busywidget.gif"));
prev.findFirst("span a").setPlainText(i18n("Loading Preview..."));
prev.findFirst("a").setAttribute("href", url.toMimeDataString());
-
+
setupPreview(prev, index);
showControls(prev);
@@ -250,15 +250,15 @@ QWebElement NewTabPage::validPreview(int index, const KUrl &url, const QString &
QWebElement prev = markup(".thumbnail");
QString previewPath = QL1S("file://") + WebSnap::imagePathFromUrl(url);
QString iString = QVariant(index).toString();
-
- prev.findFirst(".preview img").setAttribute("src" , previewPath );
- prev.findFirst("a").setAttribute("href", url.toMimeDataString() ); // NOTE ?
- prev.findFirst("span a").setAttribute("href", url.toMimeDataString() ); // NOTE ?
- prev.findFirst("span a").setPlainText( checkTitle(title) );
-
+
+ prev.findFirst(".preview img").setAttribute("src" , previewPath);
+ prev.findFirst("a").setAttribute("href", url.toMimeDataString()); // NOTE ?
+ prev.findFirst("span a").setAttribute("href", url.toMimeDataString()); // NOTE ?
+ prev.findFirst("span a").setPlainText(checkTitle(title));
+
setupPreview(prev, index);
showControls(prev);
-
+
return prev;
}
@@ -280,15 +280,15 @@ void NewTabPage::showControls(QWebElement e)
void NewTabPage::setupPreview(QWebElement e, int index)
{
e.findFirst(".remove img").setAttribute("src", QString("file:///") +
- KIconLoader::global()->iconPath("edit-delete", KIconLoader::DefaultState));
+ KIconLoader::global()->iconPath("edit-delete", KIconLoader::DefaultState));
e.findFirst(".remove").setAttribute("title", "Remove favorite");
e.findFirst(".modify img").setAttribute("src", QString("file:///") +
- KIconLoader::global()->iconPath("insert-image", KIconLoader::DefaultState));
+ KIconLoader::global()->iconPath("insert-image", KIconLoader::DefaultState));
e.findFirst(".modify").setAttribute("title", "Set new favorite");
-
+
e.findFirst(".modify").setAttribute("href", QString("about:preview/modify/" + QVariant(index).toString()));
e.findFirst(".remove").setAttribute("href", QString("about:preview/remove/" + QVariant(index).toString()));
-
+
e.setAttribute("id", "preview" + QVariant(index).toString());
}
@@ -296,31 +296,31 @@ void NewTabPage::setupPreview(QWebElement e, int index)
void NewTabPage::snapFinished()
{
// Update page, but only if open
- if(m_root.document().findAll("#rekonq-newtabpage").count() == 0)
+ if (m_root.document().findAll("#rekonq-newtabpage").count() == 0)
return;
- if(m_root.findAll(".favorites").count() == 0 && m_root.findAll(".closedTabs").count() == 0)
+ if (m_root.findAll(".favorites").count() == 0 && m_root.findAll(".closedTabs").count() == 0)
return;
-
+
QStringList urls = ReKonfig::previewUrls();
QStringList names = ReKonfig::previewNames();
-
- for(int i = 0; i < urls.count(); i++)
+
+ for (int i = 0; i < urls.count(); i++)
{
- KUrl url = KUrl( urls.at(i) );
+ KUrl url = KUrl(urls.at(i));
QString title = names.at(i);
-
- if( WebSnap::existsImage(url) )
+
+ if (WebSnap::existsImage(url))
{
QWebElement prev = m_root.findFirst("#preview" + QVariant(i).toString());
- if( KUrl(prev.findFirst("a").attribute("href")) == url )
+ if (KUrl(prev.findFirst("a").attribute("href")) == url)
{
QWebElement newPrev = validPreview(i, url, title);
-
- if(m_root.findAll(".closedTabs").count() != 0)
+
+ if (m_root.findAll(".closedTabs").count() != 0)
hideControls(newPrev);
-
+
prev.replace(newPrev);
- }
+ }
}
}
}
@@ -330,13 +330,13 @@ void NewTabPage::removePreview(int index)
{
QStringList names = ReKonfig::previewNames();
QStringList urls = ReKonfig::previewUrls();
-
+
urls.removeAt(index);
names.removeAt(index);
-
+
ReKonfig::setPreviewNames(names);
ReKonfig::setPreviewUrls(urls);
-
+
generate(KUrl("about:favorites"));
ReKonfig::self()->writeConfig();
@@ -346,51 +346,51 @@ void NewTabPage::removePreview(int index)
void NewTabPage::browsingMenu(const KUrl &currentUrl)
{
QList<QWebElement> navItems;
-
+
KIconLoader *loader = KIconLoader::global();
-
+
QWebElement nav = markup(".link"); // Favorites
nav.findFirst("a").setAttribute("href", "about:favorites");
- nav.findFirst("img").setAttribute("src" , QString("file:///" +
- loader->iconPath("emblem-favorite", KIconLoader::Desktop ||KIconLoader::SizeSmall)));
+ nav.findFirst("img").setAttribute("src" , QString("file:///" +
+ loader->iconPath("emblem-favorite", KIconLoader::Desktop || KIconLoader::SizeSmall)));
nav.findFirst("span").appendInside(i18n("Favorites"));
navItems.append(nav);
-
+
nav = markup(".link"); // Closed Tabs
nav.findFirst("a").setAttribute("href", "about:closedTabs");
- nav.findFirst("img").setAttribute("src" , QString("file:///" +
- loader->iconPath("tab-close", KIconLoader::Desktop ||KIconLoader::SizeSmall)));
+ nav.findFirst("img").setAttribute("src" , QString("file:///" +
+ loader->iconPath("tab-close", KIconLoader::Desktop || KIconLoader::SizeSmall)));
nav.findFirst("span").appendInside(i18n("Closed Tabs"));
navItems.append(nav);
-
+
nav = markup(".link"); // Bookmarks
nav.findFirst("a").setAttribute("href", "about:bookmarks");
- nav.findFirst("img").setAttribute("src" , QString("file:///" +
- loader->iconPath("bookmarks", KIconLoader::Desktop ||KIconLoader::SizeSmall)));
+ nav.findFirst("img").setAttribute("src" , QString("file:///" +
+ loader->iconPath("bookmarks", KIconLoader::Desktop || KIconLoader::SizeSmall)));
nav.findFirst("span").appendInside(i18n("Bookmarks"));
navItems.append(nav);
-
+
nav = markup(".link"); // History
nav.findFirst("a").setAttribute("href", "about:history");
- nav.findFirst("img").setAttribute("src" , QString("file:///" +
- loader->iconPath("view-history", KIconLoader::Desktop ||KIconLoader::SizeSmall)));
+ nav.findFirst("img").setAttribute("src" , QString("file:///" +
+ loader->iconPath("view-history", KIconLoader::Desktop || KIconLoader::SizeSmall)));
nav.findFirst("span").appendInside(i18n("History"));
navItems.append(nav);
-
+
nav = markup(".link"); // Downloads
nav.findFirst("a").setAttribute("href", "about:downloads");
- nav.findFirst("img").setAttribute("src" , QString("file:///" +
- loader->iconPath("download", KIconLoader::Desktop ||KIconLoader::SizeSmall)));
+ nav.findFirst("img").setAttribute("src" , QString("file:///" +
+ loader->iconPath("download", KIconLoader::Desktop || KIconLoader::SizeSmall)));
nav.findFirst("span").appendInside(i18n("Downloads"));
navItems.append(nav);
-
+
QWebElement it;
foreach(it, navItems)
{
- if(it.findFirst("a").attribute("href") == currentUrl.toMimeDataString())
+ if (it.findFirst("a").attribute("href") == currentUrl.toMimeDataString())
+ it.addClass("current");
+ else if (currentUrl == "about:home" && it.findFirst("a").attribute("href") == "about:favorites")
it.addClass("current");
- else if(currentUrl == "about:home" && it.findFirst("a").attribute("href") == "about:favorites")
- it.addClass("current");
m_root.document().findFirst("#navigation").appendInside(it);
}
}
@@ -399,35 +399,35 @@ void NewTabPage::browsingMenu(const KUrl &currentUrl)
void NewTabPage::historyPage()
{
m_root.addClass("history");
-
+
QWebElement clearData = markup(".link");
clearData.findFirst("a").setAttribute("href", "about:history/clear");
QString iconPath = QString("file:///" + KIconLoader::global()->iconPath("edit-clear", KIconLoader::SizeSmall || KIconLoader::Small));
- clearData.findFirst("img").setAttribute("src" , iconPath );
+ clearData.findFirst("img").setAttribute("src" , iconPath);
clearData.findFirst("span").appendInside(i18n("Clear Private Data"));
m_root.document().findFirst("#actions").appendInside(clearData);
-
+
HistoryTreeModel *model = Application::historyManager()->historyTreeModel();
-
- if(model->rowCount() == 0)
+
+ if (model->rowCount() == 0)
{
m_root.addClass("empty");
m_root.setPlainText(i18n("Your browsing history is empty"));
return;
}
-
+
int i = 0;
do
{
- QModelIndex index = model->index(i, 0, QModelIndex() );
- if(model->hasChildren(index))
+ QModelIndex index = model->index(i, 0, QModelIndex());
+ if (model->hasChildren(index))
{
m_root.appendInside(markup("h3"));
m_root.lastChild().setPlainText(index.data().toString());
-
- for(int j=0; j< model->rowCount(index); ++j)
+
+ for (int j = 0; j < model->rowCount(index); ++j)
{
- QModelIndex son = model->index(j, 0, index );
+ QModelIndex son = model->index(j, 0, index);
m_root.appendInside(son.data(HistoryModel::DateTimeRole).toDateTime().toString("hh:mm"));
m_root.appendInside(" ");
m_root.appendInside(markup("a"));
@@ -438,21 +438,21 @@ void NewTabPage::historyPage()
}
i++;
}
- while( model->hasIndex( i , 0 , QModelIndex() ) );
+ while (model->hasIndex(i , 0 , QModelIndex()));
}
void NewTabPage::bookmarksPage()
{
m_root.addClass("bookmarks");
-
+
QWebElement editBookmarks = markup(".link");
editBookmarks.findFirst("a").setAttribute("href", "about:bookmarks/edit");
QString iconPath = QString("file:///" + KIconLoader::global()->iconPath("bookmarks-organize", KIconLoader::SizeSmall || KIconLoader::Small));
editBookmarks.findFirst("img").setAttribute("src" , iconPath);
editBookmarks.findFirst("span").appendInside(i18n("Edit Bookmarks"));
m_root.document().findFirst("#actions").appendInside(editBookmarks);
-
+
KBookmarkGroup bookGroup = Application::bookmarkProvider()->rootGroup();
if (bookGroup.isNull())
{
@@ -485,7 +485,7 @@ void NewTabPage::createBookItem(const KBookmark &bookmark, QWebElement parent)
bm = group.next(bm);
}
}
- else if(bookmark.isSeparator())
+ else if (bookmark.isSeparator())
{
parent.appendInside("<hr/>");
}
@@ -502,28 +502,28 @@ void NewTabPage::createBookItem(const KBookmark &bookmark, QWebElement parent)
void NewTabPage::closedTabsPage()
{
m_root.addClass("closedTabs");
-
+
QList<HistoryItem> links = Application::instance()->mainWindow()->mainView()->recentlyClosedTabs();
-
- if(links.isEmpty())
+
+ if (links.isEmpty())
{
m_root.addClass("empty");
m_root.setPlainText(i18n("There are no recently closed tabs"));
return;
}
-
- for(int i=0; i < links.count(); ++i)
+
+ for (int i = 0; i < links.count(); ++i)
{
HistoryItem item = links.at(i);
QWebElement prev;
-
- if(item.url.isEmpty())
+
+ if (item.url.isEmpty())
continue;
-
- prev = WebSnap::existsImage( KUrl(item.url) )
- ? validPreview(i, item.url, item.title)
- : loadingPreview(i, item.url);
-
+
+ prev = WebSnap::existsImage(KUrl(item.url))
+ ? validPreview(i, item.url, item.title)
+ : loadingPreview(i, item.url);
+
prev.setAttribute("id", "preview" + QVariant(i).toString());
hideControls(prev);
m_root.appendInside(prev);
@@ -534,7 +534,7 @@ void NewTabPage::closedTabsPage()
QString NewTabPage::checkTitle(const QString &title)
{
QString t(title);
- if(t.length() > 23)
+ if (t.length() > 23)
{
t.truncate(20);
t += "...";
@@ -546,53 +546,53 @@ QString NewTabPage::checkTitle(const QString &title)
void NewTabPage::downloadsPage()
{
m_root.addClass("downloads");
-
+
QWebElement clearData = markup(".link");
clearData.findFirst("a").setAttribute("href", "about:downloads/clear");
QString iconPath = QString("file:///" + KIconLoader::global()->iconPath("edit-clear", KIconLoader::SizeSmall || KIconLoader::Small));
- clearData.findFirst("img").setAttribute("src" , iconPath );
+ clearData.findFirst("img").setAttribute("src" , iconPath);
clearData.findFirst("span").appendInside(i18n("Clear Private Data"));
m_root.document().findFirst("#actions").appendInside(clearData);
DownloadList list = Application::historyManager()->downloads();
-
- if(list.isEmpty())
+
+ if (list.isEmpty())
{
m_root.addClass("empty");
m_root.setPlainText(i18n("There are no recently downloaded files to show"));
return;
}
-
+
foreach(const DownloadItem &item, list)
{
m_root.prependInside(markup("div"));
-
+
QWebElement div = m_root.firstChild();
div.addClass("download");
-
+
KUrl u = KUrl(item.destUrlString);
QString fName = u.fileName();
QString dir = QL1S("file://") + u.directory();
-
+
KIconLoader *loader = KIconLoader::global();
QString iconPath = "file://" + loader->iconPath(KMimeType::iconNameForUrl(u), KIconLoader::Desktop);
-
+
div.appendInside(markup("img"));
- div.lastChild().setAttribute("src", iconPath );
-
+ div.lastChild().setAttribute("src", iconPath);
+
div.appendInside("<strong>" + fName + "</strong>");
div.appendInside(" - ");
QString date = KGlobal::locale()->formatDateTime(item.dateTime, KLocale::FancyLongDate);
div.appendInside("<em>" + date + "</em>");
div.appendInside("<br/>");
-
+
div.appendInside(item.srcUrlString);
div.appendInside("<br/>");
div.appendInside(markup("a"));
div.lastChild().setAttribute("href" , dir);
div.lastChild().setPlainText("Browse dir");
-
+
/* TODO : make this link work
div.appendInside(" - ");
div.appendInside(markup("a"));
diff --git a/src/newtabpage.h b/src/newtabpage.h
index 3b63942e..3aaf1038 100644
--- a/src/newtabpage.h
+++ b/src/newtabpage.h
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -47,14 +47,14 @@ class WebPage;
class REKONQ_TESTS_EXPORT NewTabPage : public QObject
{
-Q_OBJECT
+ Q_OBJECT
public:
NewTabPage(QWebFrame *frame);
~NewTabPage();
/**
- * This method takes an about: url and loads
+ * This method takes an about: url and loads
* the corresponding part of the new tab page
*/
void generate(const KUrl &url = KUrl("about:home"));
@@ -64,7 +64,7 @@ public:
* and providing a real picture
*/
void snapFinished();
-
+
private:
// these are the "high-level" functions to build the new tab page.
// Basically, you call browsingMenu + one of the *Page methods
@@ -76,19 +76,19 @@ private:
void bookmarksPage();
void closedTabsPage();
void downloadsPage();
-
+
// --------------------------------------------------------------------------
// "low-level" functions
// we use these to create the pages over
-
+
// Previews handling
QWebElement emptyPreview(int index);
QWebElement loadingPreview(int index, const KUrl &url);
QWebElement validPreview(int index, const KUrl &url, const QString &title);
void removePreview(int index);
-
- /**
+
+ /**
* This function takes a QwebElement with the .thumbnail structure,
* hiding the "remove" and "modify" buttons
*
@@ -96,10 +96,10 @@ private:
void hideControls(QWebElement e);
void showControls(QWebElement e);
void setupPreview(QWebElement e, int index);
-
+
void createBookItem(const KBookmark &bookmark, QWebElement parent);
-
- /**
+
+ /**
* This function helps to get faster a new markup of one type,
* it isn't easy to create one with QWebElement.
*
@@ -107,13 +107,13 @@ private:
* It works for all elements defined here.
*
*/
- inline QWebElement markup(const QString &selector)
+ inline QWebElement markup(const QString &selector)
{
- return m_root.document().findFirst("#models > " + selector).clone();
+ return m_root.document().findFirst("#models > " + selector).clone();
}
-
+
QString checkTitle(const QString &title);
-
+
private:
QString m_html;
QWebElement m_root;
diff --git a/src/paneltreeview.cpp b/src/paneltreeview.cpp
index c13caf4d..d0d530fb 100644
--- a/src/paneltreeview.cpp
+++ b/src/paneltreeview.cpp
@@ -37,7 +37,7 @@
PanelTreeView::PanelTreeView(QWidget *parent)
- : QTreeView(parent)
+ : QTreeView(parent)
{
connect(this, SIGNAL(itemHovered(const QString &)), parent, SIGNAL(itemHovered(const QString &)));
connect(this, SIGNAL(openUrl(const KUrl &, Rekonq::OpenType)), parent, SIGNAL(openUrl(const KUrl &, Rekonq::OpenType)));
@@ -60,22 +60,22 @@ void PanelTreeView::mousePressEvent(QMouseEvent *event)
// A change of an item expansion is handle by mouseReleaseEvent()
// So toggle again the item
- if(expanded != isExpanded(index))
+ if (expanded != isExpanded(index))
setExpanded(index, !isExpanded(index));
-
- if(!index.isValid())
+
+ if (!index.isValid())
{
clearSelection();
setCurrentIndex(QModelIndex());
- if(event->button() == Qt::RightButton)
+ if (event->button() == Qt::RightButton)
emit contextMenuEmptyRequested(event->pos());
return;
}
- if(event->button() == Qt::RightButton)
+ if (event->button() == Qt::RightButton)
{
- if(model()->rowCount(index) == 0)
+ if (model()->rowCount(index) == 0)
{
// An empty group needs to be handle by the panels
emit contextMenuItemRequested(event->pos());
@@ -93,15 +93,15 @@ void PanelTreeView::mouseReleaseEvent(QMouseEvent *event)
QTreeView::mouseReleaseEvent(event);
const QModelIndex index = indexAt(event->pos());
- if(!index.isValid())
+ if (!index.isValid())
return;
- if(event->button() == Qt::MidButton || event->modifiers() == Qt::ControlModifier)
+ if (event->button() == Qt::MidButton || event->modifiers() == Qt::ControlModifier)
validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::SettingOpenTab);
- else if(event->button() == Qt::LeftButton)
+ else if (event->button() == Qt::LeftButton)
{
- if(model()->rowCount(index) == 0)
+ if (model()->rowCount(index) == 0)
validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)));
else
setExpanded(index, !isExpanded(index));
@@ -114,18 +114,18 @@ void PanelTreeView::keyPressEvent(QKeyEvent *event)
QTreeView::keyPressEvent(event);
QModelIndex index = currentIndex();
- if(!index.isValid())
+ if (!index.isValid())
return;
- if(event->key() == Qt::Key_Return)
+ if (event->key() == Qt::Key_Return)
{
- if(model()->rowCount(index) == 0)
+ if (model()->rowCount(index) == 0)
validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)));
else
setExpanded(index, !isExpanded(index));
}
- else if(event->key() == Qt::Key_Delete)
+ else if (event->key() == Qt::Key_Delete)
{
emit delKeyPressed();
}
@@ -135,7 +135,7 @@ void PanelTreeView::keyPressEvent(QKeyEvent *event)
void PanelTreeView::validOpenUrl(const KUrl &url, Rekonq::OpenType openType)
{
// To workaround a crash when the url is about:blank
- if(url.url() == "about:blank")
+ if (url.url() == "about:blank")
emit openUrl(KUrl("about:home"), openType);
else
emit openUrl(url, openType);
@@ -146,7 +146,7 @@ void PanelTreeView::mouseMoveEvent(QMouseEvent *event)
{
QTreeView::mouseMoveEvent(event);
const QModelIndex index = indexAt(event->pos());
- if(!index.isValid())
+ if (!index.isValid())
{
emit itemHovered("");
return;
@@ -158,7 +158,7 @@ void PanelTreeView::mouseMoveEvent(QMouseEvent *event)
void PanelTreeView::openInCurrentTab()
{
QModelIndex index = currentIndex();
- if(!index.isValid())
+ if (!index.isValid())
return;
validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)));
@@ -168,7 +168,7 @@ void PanelTreeView::openInCurrentTab()
void PanelTreeView::copyToClipboard()
{
QModelIndex index = currentIndex();
- if(!index.isValid())
+ if (!index.isValid())
return;
QClipboard *cb = QApplication::clipboard();
@@ -179,7 +179,7 @@ void PanelTreeView::copyToClipboard()
void PanelTreeView::openInNewTab()
{
QModelIndex index = currentIndex();
- if(!index.isValid())
+ if (!index.isValid())
return;
validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::SettingOpenTab);
@@ -189,8 +189,8 @@ void PanelTreeView::openInNewTab()
void PanelTreeView::openInNewWindow()
{
QModelIndex index = currentIndex();
- if(!index.isValid())
+ if (!index.isValid())
return;
- validOpenUrl( qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::NewWindow);
+ validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::NewWindow);
}
diff --git a/src/previewselectorbar.cpp b/src/previewselectorbar.cpp
index 924a5439..acf20312 100644
--- a/src/previewselectorbar.cpp
+++ b/src/previewselectorbar.cpp
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -54,24 +54,24 @@ PreviewSelectorBar::PreviewSelectorBar(int index, QWidget* parent)
{
m_label = new QLabel(i18n("Please open up the webpage you want to add as favorite"), this);
m_label->setWordWrap(true);
-
+
QToolButton *closeButton = new QToolButton(this);
closeButton->setAutoRaise(true);
closeButton->setIcon(KIcon("dialog-close"));
connect(closeButton, SIGNAL(clicked(bool)), this, SLOT(destroy()));
-
+
m_button = new QPushButton(KIcon("insert-image"), i18n("Set to This Page"), this);
m_button->setMaximumWidth(250);
connect(m_button, SIGNAL(clicked(bool)), this, SLOT(clicked()));
-
+
// layout
QHBoxLayout *layout = new QHBoxLayout(this);
layout->addWidget(closeButton);
layout->addWidget(m_label);
layout->addWidget(m_button);
-
+
layout->setContentsMargins(2, 0, 2, 0);
-
+
setLayout(layout);
}
@@ -83,8 +83,8 @@ PreviewSelectorBar::~PreviewSelectorBar()
void PreviewSelectorBar::verifyUrl()
{
-
- if(Application::instance()->mainWindow()->currentTab()->page()->mainFrame()->url().scheme() != "about")
+
+ if (Application::instance()->mainWindow()->currentTab()->page()->mainFrame()->url().scheme() != "about")
{
m_button->setEnabled(true);
m_button->setToolTip("");
@@ -108,7 +108,7 @@ void PreviewSelectorBar::loadFinished()
{
m_button->setEnabled(true);
m_button->setToolTip("");
-
+
verifyUrl();
}
@@ -116,28 +116,28 @@ void PreviewSelectorBar::loadFinished()
void PreviewSelectorBar::clicked()
{
WebPage *page = Application::instance()->mainWindow()->currentTab()->page();
-
- if(page)
+
+ if (page)
{
// this is done just lo let the render process being faster..
WebSnap::renderPreview(*page);
-
- KUrl url = page->mainFrame()->url();
+
+ KUrl url = page->mainFrame()->url();
QStringList names = ReKonfig::previewNames();
QStringList urls = ReKonfig::previewUrls();
-
+
urls.replace(m_previewIndex, url.toMimeDataString());
names.replace(m_previewIndex, page->mainFrame()->title());
-
+
ReKonfig::setPreviewNames(names);
ReKonfig::setPreviewUrls(urls);
-
+
ReKonfig::self()->writeConfig();
-
-
+
+
page->mainFrame()->load(KUrl("about:favorites"));
}
-
+
destroy();
}
diff --git a/src/previewselectorbar.h b/src/previewselectorbar.h
index bb9f26c4..bca016c1 100644
--- a/src/previewselectorbar.h
+++ b/src/previewselectorbar.h
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -40,27 +40,27 @@
class REKONQ_TESTS_EXPORT PreviewSelectorBar : public QWidget
{
-Q_OBJECT
+ Q_OBJECT
public:
PreviewSelectorBar(int index, QWidget *parent);
~PreviewSelectorBar();
-
+
private slots:
void clicked();
-
+
void loadProgress();
void loadFinished();
-
+
void verifyUrl();
-
+
void destroy();
-
-private:
+
+private:
QPushButton *m_button;
QLabel *m_label;
-
- int m_previewIndex;
+
+ int m_previewIndex;
};
#endif // PREVIEWSELECTORBAR_H
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
index 077807cb..dadd6d99 100644
--- a/src/protocolhandler.cpp
+++ b/src/protocolhandler.cpp
@@ -9,9 +9,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -68,9 +68,9 @@
ProtocolHandler::ProtocolHandler(QObject *parent)
- : QObject(parent)
- , _lister(0)
- , _frame(0)
+ : QObject(parent)
+ , _lister(0)
+ , _frame(0)
{
}
@@ -84,49 +84,49 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra
{
_url = request.url();
_frame = frame;
-
+
// "http(s)" (fast) handling
- if( _url.protocol() == QL1S("http") || _url.protocol() == QL1S("https") )
+ if (_url.protocol() == QL1S("http") || _url.protocol() == QL1S("https"))
return false;
// relative urls
- if(_url.isRelative())
+ if (_url.isRelative())
return false;
-
+
// javascript handling
- if( _url.protocol() == QL1S("javascript") )
+ if (_url.protocol() == QL1S("javascript"))
{
QString scriptSource = _url.authority();
QVariant result = frame->evaluateJavaScript(scriptSource);
return true;
}
-
+
// "mailto" handling
- if ( _url.protocol() == QL1S("mailto") )
+ if (_url.protocol() == QL1S("mailto"))
{
KToolInvocation::invokeMailer(_url);
return true;
}
// "abp" handling
- if ( _url.protocol() == QL1S("abp") )
+ if (_url.protocol() == QL1S("abp"))
{
abpHandling();
return true;
}
-
+
// "about" handling
- if ( _url.protocol() == QL1S("about") )
+ if (_url.protocol() == QL1S("about"))
{
// let webkit manage the about:blank url...
- if( _url == KUrl("about:blank") )
+ if (_url == KUrl("about:blank"))
{
return false;
}
-
- if( _url == KUrl("about:home") )
+
+ if (_url == KUrl("about:home"))
{
- switch(ReKonfig::newTabStartPage())
+ switch (ReKonfig::newTabStartPage())
{
case 0: // favorites
_url = KUrl("about:favorites");
@@ -151,7 +151,7 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra
p.generate(_url);
return true;
}
-
+
return false;
}
@@ -160,16 +160,16 @@ bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *fr
{
_url = request.url();
_frame = frame;
-
+
kDebug() << "URL PROTOCOL: " << _url;
-
+
// "http(s)" (fast) handling
- if( _url.protocol() == QL1S("http") || _url.protocol() == QL1S("https") )
+ if (_url.protocol() == QL1S("http") || _url.protocol() == QL1S("https"))
return false;
-
+
// "mailto" handling: It needs to be handled both here(mail links clicked)
// and in prehandling (mail url launched)
- if ( _url.protocol() == QL1S("mailto") )
+ if (_url.protocol() == QL1S("mailto"))
{
KToolInvocation::invokeMailer(_url);
return true;
@@ -180,27 +180,27 @@ bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *fr
// My idea is: webkit cannot handle in any way ftp. So we have surely to return true here.
// We start trying to guess what the url represent: it's a dir? show its contents (and download them).
// it's a file? download it. It's another thing? beat me, but I don't know what to do...
- if( _url.protocol() == QL1S("ftp") )
+ if (_url.protocol() == QL1S("ftp"))
{
KIO::StatJob *job = KIO::stat(_url);
- connect(job, SIGNAL(result(KJob*)), this, SLOT( slotMostLocalUrlResult(KJob*) ));
+ connect(job, SIGNAL(result(KJob*)), this, SLOT(slotMostLocalUrlResult(KJob*)));
return true;
}
-
+
// "file" handling. This is quite trivial :)
- if( _url.protocol() == QL1S("file") )
+ if (_url.protocol() == QL1S("file"))
{
- QFileInfo fileInfo( _url.path() );
- if(fileInfo.isDir())
+ QFileInfo fileInfo(_url.path());
+ if (fileInfo.isDir())
{
_lister = new KDirLister;
- connect( _lister, SIGNAL(newItems(const KFileItemList &)), this, SLOT(showResults(const KFileItemList &)));
+ connect(_lister, SIGNAL(newItems(const KFileItemList &)), this, SLOT(showResults(const KFileItemList &)));
_lister->openUrl(_url);
-
+
return true;
}
}
-
+
return false;
}
@@ -210,17 +210,17 @@ bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *fr
void ProtocolHandler::showResults(const KFileItemList &list)
{
- if(!_lister->rootItem().isNull() && _lister->rootItem().isReadable() && _lister->rootItem().isFile())
+ if (!_lister->rootItem().isNull() && _lister->rootItem().isReadable() && _lister->rootItem().isFile())
{
- emit downloadUrl( _lister->rootItem().url() );
+ emit downloadUrl(_lister->rootItem().url());
return;
}
-
+
QString html = dirHandling(list);
- _frame->setHtml( html, _url );
+ _frame->setHtml(html, _url);
Application::instance()->mainWindow()->currentTab()->setFocus();
- Application::historyManager()->addHistoryEntry( _url.prettyUrl() );
+ Application::historyManager()->addHistoryEntry(_url.prettyUrl());
delete _lister;
}
@@ -232,11 +232,11 @@ QString ProtocolHandler::dirHandling(const KFileItemList &list)
{
return QString("rekonq error, sorry :(");
}
-
+
// let me modify it..
KUrl rootUrl = _url;
-
- // display "rekonq info" page
+
+ // display "rekonq info" page
QString infoFilePath = KStandardDirs::locate("data", "rekonq/htmls/rekonqinfo.html");
QFile file(infoFilePath);
@@ -246,18 +246,18 @@ QString ProtocolHandler::dirHandling(const KFileItemList &list)
return QString("rekonq error, sorry :(");
}
- QString title = _url.prettyUrl();
+ QString title = _url.prettyUrl();
QString msg = i18nc("%1=an URL", "<h1>Index of %1</h1>", _url.prettyUrl());
- if(rootUrl.cd(".."))
+ if (rootUrl.cd(".."))
{
QString path = rootUrl.prettyUrl();
- QString uparrow = KIconLoader::global()->iconPath( "arrow-up", KIconLoader::Small );
+ QString uparrow = KIconLoader::global()->iconPath("arrow-up", KIconLoader::Small);
msg += "<img src=\"file://" + uparrow + "\" alt=\"up-arrow\" />";
msg += "<a href=\"" + path + "\">" + i18n("Up to higher level directory") + "</a><br /><br />";
}
-
+
msg += "<table width=\"100%\">";
msg += "<tr><th align=\"left\">" + i18n("Name") + "</th><th>" + i18n("Size") + "</th><th>" + i18n("Last Modified") + "</th></tr>";
@@ -265,43 +265,43 @@ QString ProtocolHandler::dirHandling(const KFileItemList &list)
{
msg += "<tr>";
QString fullPath = item.url().prettyUrl();
-
+
QString iconName = item.iconName();
- QString icon = QString("file://") + KIconLoader::global()->iconPath( iconName, KIconLoader::Small );
-
+ QString icon = QString("file://") + KIconLoader::global()->iconPath(iconName, KIconLoader::Small);
+
msg += "<td width=\"70%\">";
msg += "<img src=\"" + icon + "\" alt=\"" + iconName + "\" /> ";
msg += "<a href=\"" + fullPath + "\">" + item.name() + "</a>";
msg += "</td>";
-
+
msg += "<td align=\"right\">";
- if(item.isFile())
+ if (item.isFile())
{
- msg += QString::number( item.size()/1024 ) + " KB";
+ msg += QString::number(item.size() / 1024) + " KB";
}
msg += "</td>";
-
+
msg += "<td align=\"right\">";
msg += item.timeString();
msg += "</td>";
-
+
msg += "</tr>";
}
msg += "</table>";
-
-
+
+
QString html = QString(QL1S(file.readAll()))
- .arg(title)
- .arg(msg)
- ;
-
+ .arg(title)
+ .arg(msg)
+ ;
+
return html;
}
void ProtocolHandler::slotMostLocalUrlResult(KJob *job)
{
- if(job->error())
+ if (job->error())
{
// TODO
kDebug() << "error";
@@ -310,10 +310,10 @@ void ProtocolHandler::slotMostLocalUrlResult(KJob *job)
{
KIO::StatJob *statJob = static_cast<KIO::StatJob*>(job);
KIO::UDSEntry entry = statJob->statResult();
- if( entry.isDir() )
+ if (entry.isDir())
{
_lister = new KDirLister;
- connect( _lister, SIGNAL(newItems(const KFileItemList &)), this, SLOT(showResults(const KFileItemList &)));
+ connect(_lister, SIGNAL(newItems(const KFileItemList &)), this, SLOT(showResults(const KFileItemList &)));
_lister->openUrl(_url);
}
else
@@ -331,27 +331,27 @@ void ProtocolHandler::slotMostLocalUrlResult(KJob *job)
void ProtocolHandler::abpHandling()
{
kDebug() << _url;
-
+
QString path = _url.path();
- if( path != QL1S("subscribe") )
+ if (path != QL1S("subscribe"))
return;
-
- QMap<QString, QString> map = _url.queryItems( KUrl::CaseInsensitiveKeys );
-
- QString location = map.value( QL1S("location") );
+
+ QMap<QString, QString> map = _url.queryItems(KUrl::CaseInsensitiveKeys);
+
+ QString location = map.value(QL1S("location"));
kDebug() << location;
-
- QString title = map.value( QL1S("title") );
+
+ QString title = map.value(QL1S("title"));
kDebug() << title;
-
- QString requireslocation = map.value( QL1S("requireslocation") );
+
+ QString requireslocation = map.value(QL1S("requireslocation"));
kDebug() << requireslocation;
-
- QString requirestitle = map.value( QL1S("requirestitle") );
+
+ QString requirestitle = map.value(QL1S("requirestitle"));
kDebug() << requirestitle;
-
+
QString info;
- if( requirestitle.isEmpty() || requireslocation.isEmpty() )
+ if (requirestitle.isEmpty() || requireslocation.isEmpty())
{
info = title;
}
@@ -359,20 +359,20 @@ void ProtocolHandler::abpHandling()
{
info = i18n("\n %1,\n %2 (required by %3)\n", title, requirestitle, title);
}
-
- if ( KMessageBox::questionYesNo( 0,
- i18n("Do you want to add the following subscriptions to your adblock settings?\n") + info,
- i18n("Add automatic subscription to the adblock"),
- KGuiItem(i18n("Add")),
- KGuiItem(i18n("Discard"))
- )
- )
+
+ if (KMessageBox::questionYesNo(0,
+ i18n("Do you want to add the following subscriptions to your adblock settings?\n") + info,
+ i18n("Add automatic subscription to the adblock"),
+ KGuiItem(i18n("Add")),
+ KGuiItem(i18n("Discard"))
+ )
+ )
{
- if( !requireslocation.isEmpty() && !requirestitle.isEmpty() )
+ if (!requireslocation.isEmpty() && !requirestitle.isEmpty())
{
- Application::adblockManager()->addSubscription( requirestitle, requireslocation );
+ Application::adblockManager()->addSubscription(requirestitle, requireslocation);
}
- Application::adblockManager()->addSubscription( title, location );
+ Application::adblockManager()->addSubscription(title, location);
Application::adblockManager()->loadSettings(false);
}
}
diff --git a/src/protocolhandler.h b/src/protocolhandler.h
index f96b5735..9ecf4d06 100644
--- a/src/protocolhandler.h
+++ b/src/protocolhandler.h
@@ -9,9 +9,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -47,10 +47,10 @@ class KJob;
class REKONQ_TESTS_EXPORT ProtocolHandler : public QObject
{
-Q_OBJECT
+ Q_OBJECT
public:
- ProtocolHandler(QObject *parent = 0);
+ ProtocolHandler(QObject *parent = 0);
~ProtocolHandler();
/**
@@ -64,18 +64,18 @@ public:
* WebKit tried to
*/
bool postHandling(const QNetworkRequest &request, QWebFrame *frame);
-
+
signals:
void downloadUrl(const KUrl &);
-
+
private slots:
void showResults(const KFileItemList &);
void slotMostLocalUrlResult(KJob *);
-
+
private:
QString dirHandling(const KFileItemList &list);
void abpHandling();
-
+
KDirLister *_lister;
QWebFrame *_frame;
KUrl _url;
diff --git a/src/rekonqprivate_export.h b/src/rekonqprivate_export.h
index 8f996a1f..8ca98349 100644
--- a/src/rekonqprivate_export.h
+++ b/src/rekonqprivate_export.h
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -33,11 +33,11 @@
/* Classes from the rekonq application, which are exported only for unit tests */
#ifndef REKONQ_TESTS_EXPORT
- /* We are building this library */
- #define REKONQ_TESTS_EXPORT KDE_EXPORT
+/* We are building this library */
+#define REKONQ_TESTS_EXPORT KDE_EXPORT
#else
- /* We are using this library */
- #define REKONQ_TESTS_EXPORT KDE_IMPORT
+/* We are using this library */
+#define REKONQ_TESTS_EXPORT KDE_IMPORT
#endif
#endif // REKONQPRIVATE_EXPORT_H
diff --git a/src/searchengine.cpp b/src/searchengine.cpp
index 65f2a4e8..f258f976 100644
--- a/src/searchengine.cpp
+++ b/src/searchengine.cpp
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -41,7 +41,7 @@ QString SearchEngine::m_delimiter = "";
QString SearchEngine::delimiter()
{
- if (m_delimiter=="") loadDelimiter();
+ if (m_delimiter == "") loadDelimiter();
return m_delimiter;
}
@@ -58,14 +58,14 @@ KService::Ptr SearchEngine::m_defaultWS;
KService::Ptr SearchEngine::defaultWS()
-{
+{
if (!m_defaultWS) loadDefaultWS();
return m_defaultWS;
}
void SearchEngine::loadDefaultWS()
-{
+{
KConfig config("kuriikwsfilterrc"); //Share with konqueror
KConfigGroup cg = config.group("General");
QString d = cg.readEntry("DefaultSearchEngine", "google");
@@ -79,7 +79,7 @@ KService::Ptr SearchEngine::fromString(QString text)
int i = 0;
bool found = false;
KService::Ptr service;
- while(!found && i<providers.size())
+ while (!found && i < providers.size())
{
foreach(QString key, providers.at(i)->property("Keys").toStringList())
{
@@ -92,13 +92,13 @@ KService::Ptr SearchEngine::fromString(QString text)
}
i++;
}
-
+
return service;
}
QString SearchEngine::buildQuery(KService::Ptr engine, QString text)
-{
+{
QString query = engine->property("Query").toString();
query = query.replace("\\{@}", KUrl::toPercentEncoding(text));
return query;
@@ -122,7 +122,7 @@ void SearchEngine::loadFavorites()
QStringList f;
f << "wikipedia" << "google"; //defaults
f = cg.readEntry("FavoriteSearchEngines", f);
-
+
KService::List favorites;
KService::Ptr service;
foreach(QString e, f)
@@ -130,7 +130,7 @@ void SearchEngine::loadFavorites()
service = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(e));
if (service) favorites << service;
}
-
+
m_favorites = favorites;
}
@@ -139,28 +139,28 @@ KService::Ptr SearchEngine::defaultEngine()
{
int n = ReKonfig::searchEngine();
QString engine;
- switch(n)
+ switch (n)
{
- case 0:
- engine = QL1S("google");
- break;
- case 1:
- engine = QL1S("altavista");
- break;
- case 2:
- engine = QL1S("lycos");
- break;
- case 3:
- engine = QL1S("wikipedia");
- break;
- case 4:
- engine = QL1S("wolfram");
- break;
- default:
- engine = QL1S("google");
- break;
+ case 0:
+ engine = QL1S("google");
+ break;
+ case 1:
+ engine = QL1S("altavista");
+ break;
+ case 2:
+ engine = QL1S("lycos");
+ break;
+ case 3:
+ engine = QL1S("wikipedia");
+ break;
+ case 4:
+ engine = QL1S("wolfram");
+ break;
+ default:
+ engine = QL1S("google");
+ break;
}
-
+
return KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(engine));
}
diff --git a/src/searchengine.h b/src/searchengine.h
index 8cb09b6d..42107288 100644
--- a/src/searchengine.h
+++ b/src/searchengine.h
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -37,9 +37,9 @@
#include <QString>
class SearchEngine
-{
+{
public:
-
+
static QString delimiter();
static KService::Ptr defaultEngine();
static KService::List favorites();
@@ -50,7 +50,7 @@ public:
static void loadDelimiter();
static void loadFavorites();
static void loadDefaultWS();
-
+
private:
static QString m_delimiter;
static KService::List m_favorites;
diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp
index 9e1f7baf..4612952b 100644
--- a/src/sessionmanager.cpp
+++ b/src/sessionmanager.cpp
@@ -46,8 +46,8 @@
SessionManager::SessionManager(QObject *parent)
- : QObject(parent)
- , m_safe(true)
+ : QObject(parent)
+ , m_safe(true)
{
m_sessionFilePath = KStandardDirs::locateLocal("appdata" , "session");
}
@@ -60,7 +60,7 @@ SessionManager::~SessionManager()
void SessionManager::saveSession()
{
- if(!m_safe)
+ if (!m_safe)
return;
m_safe = false;
QFile sessionFile(m_sessionFilePath);
@@ -102,7 +102,7 @@ bool SessionManager::restoreSession()
do
{
line = in.readLine();
- if(line == QString("window"))
+ if (line == QString("window"))
{
line = in.readLine();
kDebug() << "New Window line: " << line;
@@ -114,7 +114,7 @@ bool SessionManager::restoreSession()
Application::instance()->loadUrl(line, Rekonq::NewCurrentTab);
}
}
- while(!line.isEmpty());
-
+ while (!line.isEmpty());
+
return true;
}
diff --git a/src/sessionmanager.h b/src/sessionmanager.h
index 613b050f..d6377d4b 100644
--- a/src/sessionmanager.h
+++ b/src/sessionmanager.h
@@ -48,7 +48,7 @@ public:
SessionManager(QObject *parent = 0);
~SessionManager();
bool restoreSession();
-
+
private slots:
void saveSession();
diff --git a/src/settings/adblockwidget.cpp b/src/settings/adblockwidget.cpp
index 2f431c1e..0d65c2de 100644
--- a/src/settings/adblockwidget.cpp
+++ b/src/settings/adblockwidget.cpp
@@ -43,64 +43,64 @@
AdBlockWidget::AdBlockWidget(QWidget *parent)
- : QWidget(parent)
- , _changed(false)
+ : QWidget(parent)
+ , _changed(false)
{
setupUi(this);
-
- hintLabel->setText( i18n("<qt>Filter expression (e.g. <tt>http://www.example.com/ad/*</tt>, <a href=\"filterhelp\">more information</a>):") );
- connect( hintLabel, SIGNAL(linkActivated(const QString &)), this, SLOT(slotInfoLinkActivated(const QString &)) );
-
+
+ hintLabel->setText(i18n("<qt>Filter expression (e.g. <tt>http://www.example.com/ad/*</tt>, <a href=\"filterhelp\">more information</a>):"));
+ connect(hintLabel, SIGNAL(linkActivated(const QString &)), this, SLOT(slotInfoLinkActivated(const QString &)));
+
listWidget->setSortingEnabled(true);
listWidget->setSelectionMode(QAbstractItemView::SingleSelection);
-
+
searchLine->setListWidget(listWidget);
-
- insertButton->setIcon( KIcon("list-add") );
- connect( insertButton, SIGNAL( clicked() ), this, SLOT( insertRule() ) );
-
- removeButton->setIcon( KIcon("list-remove") );
- connect( removeButton, SIGNAL( clicked() ), this, SLOT( removeRule() ) );
-
+
+ insertButton->setIcon(KIcon("list-add"));
+ connect(insertButton, SIGNAL(clicked()), this, SLOT(insertRule()));
+
+ removeButton->setIcon(KIcon("list-remove"));
+ connect(removeButton, SIGNAL(clicked()), this, SLOT(removeRule()));
+
load();
-
+
// emit changed signal
- connect( insertButton, SIGNAL( clicked() ), this, SLOT( hasChanged() ) );
- connect( removeButton, SIGNAL( clicked() ), this, SLOT( hasChanged() ) );
- connect( checkEnableAdblock, SIGNAL( stateChanged(int) ), this, SLOT( hasChanged() ) );
- connect( checkHideAds, SIGNAL( stateChanged(int) ), this, SLOT( hasChanged() ) );
- connect( spinBox, SIGNAL( valueChanged(int) ), this, SLOT( hasChanged() ) );
+ connect(insertButton, SIGNAL(clicked()), this, SLOT(hasChanged()));
+ connect(removeButton, SIGNAL(clicked()), this, SLOT(hasChanged()));
+ connect(checkEnableAdblock, SIGNAL(stateChanged(int)), this, SLOT(hasChanged()));
+ connect(checkHideAds, SIGNAL(stateChanged(int)), this, SLOT(hasChanged()));
+ connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(hasChanged()));
}
void AdBlockWidget::slotInfoLinkActivated(const QString &url)
{
Q_UNUSED(url)
-
+
QString hintHelpString = i18n("<qt><p>Enter an expression to filter. Filters can be defined as either:"
"<ul><li>a shell-style wildcard, e.g. <tt>http://www.example.com/ads*</tt>, the wildcards <tt>*?[]</tt> may be used</li>"
"<li>a full regular expression by surrounding the string with '<tt>/</tt>', e.g. <tt>/\\/(ad|banner)\\./</tt></li></ul>"
"<p>Any filter string can be preceded by '<tt>@@</tt>' to whitelist (allow) any matching URL, "
"which takes priority over any blacklist (blocking) filter.");
- QWhatsThis::showText( QCursor::pos(), hintHelpString );
+ QWhatsThis::showText(QCursor::pos(), hintHelpString);
}
void AdBlockWidget::insertRule()
{
QString rule = addFilterLineEdit->text();
- if(rule.isEmpty())
+ if (rule.isEmpty())
return;
-
- listWidget->addItem( rule );
+
+ listWidget->addItem(rule);
addFilterLineEdit->clear();
}
void AdBlockWidget::removeRule()
{
- listWidget->takeItem( listWidget->currentRow() );
+ listWidget->takeItem(listWidget->currentRow());
}
@@ -108,13 +108,13 @@ void AdBlockWidget::load()
{
bool isAdBlockEnabled = ReKonfig::adBlockEnabled();
checkEnableAdblock->setChecked(isAdBlockEnabled);
-
+
bool areImageFiltered = ReKonfig::hideAdsEnabled();
checkHideAds->setChecked(areImageFiltered);
-
+
int days = ReKonfig::updateInterval();
- spinBox->setValue( days );
-
+ spinBox->setValue(days);
+
QStringList subscriptions = ReKonfig::subscriptionTitles();
// load automatic rules
@@ -124,14 +124,14 @@ void AdBlockWidget::load()
subItem->setText(0, sub);
loadRules(subItem);
}
-
+
// load local rules
KSharedConfig::Ptr config = KGlobal::config();
- KConfigGroup localGroup( config, "rules" );
- QStringList rules = localGroup.readEntry( "local-rules" , QStringList() );
+ KConfigGroup localGroup(config, "rules");
+ QStringList rules = localGroup.readEntry("local-rules" , QStringList());
foreach(const QString &rule, rules)
{
- listWidget->addItem( rule );
+ listWidget->addItem(rule);
}
}
@@ -139,12 +139,12 @@ void AdBlockWidget::load()
void AdBlockWidget::loadRules(QTreeWidgetItem *item)
{
KSharedConfig::Ptr config = KGlobal::config();
- KConfigGroup localGroup( config, "rules" );
-
+ KConfigGroup localGroup(config, "rules");
+
QString str = item->text(0) + "-rules";
kDebug() << str;
- QStringList rules = localGroup.readEntry( str , QStringList() );
-
+ QStringList rules = localGroup.readEntry(str , QStringList());
+
foreach(const QString &rule, rules)
{
QTreeWidgetItem *subItem = new QTreeWidgetItem(item);
@@ -159,21 +159,21 @@ void AdBlockWidget::save()
// local rules
KSharedConfig::Ptr config = KGlobal::config();
- KConfigGroup localGroup( config , "rules" );
-
+ KConfigGroup localGroup(config , "rules");
+
QStringList localRules;
-
+
n = listWidget->count();
- for(int i = 0; i < n; ++i)
+ for (int i = 0; i < n; ++i)
{
QListWidgetItem *item = listWidget->item(i);
localRules << item->text();
}
- localGroup.writeEntry( "local-rules" , localRules );
+ localGroup.writeEntry("local-rules" , localRules);
- ReKonfig::setAdBlockEnabled( checkEnableAdblock->isChecked() );
- ReKonfig::setHideAdsEnabled( checkHideAds->isChecked() );
- ReKonfig::setUpdateInterval( spinBox->value() );
+ ReKonfig::setAdBlockEnabled(checkEnableAdblock->isChecked());
+ ReKonfig::setHideAdsEnabled(checkHideAds->isChecked());
+ ReKonfig::setUpdateInterval(spinBox->value());
_changed = false;
emit changed(false);
diff --git a/src/settings/adblockwidget.h b/src/settings/adblockwidget.h
index 7e641f3e..1ed9aaa6 100644
--- a/src/settings/adblockwidget.h
+++ b/src/settings/adblockwidget.h
@@ -38,20 +38,20 @@
class AdBlockWidget : public QWidget, private Ui::adblock
{
-Q_OBJECT
+ Q_OBJECT
public:
AdBlockWidget(QWidget *parent = 0);
-
+
void save();
bool changed();
-
+
signals:
void changed(bool);
-
+
private slots:
void hasChanged();
-
+
void slotInfoLinkActivated(const QString &);
void insertRule();
void removeRule();
diff --git a/src/settings/networkwidget.cpp b/src/settings/networkwidget.cpp
index 54f6e068..25e38c47 100644
--- a/src/settings/networkwidget.cpp
+++ b/src/settings/networkwidget.cpp
@@ -38,34 +38,34 @@
NetworkWidget::NetworkWidget(QWidget *parent)
- : QWidget(parent)
- , _cacheModule(0)
- , _cookiesModule(0)
- , _proxyModule(0)
- , _changed(false)
+ : QWidget(parent)
+ , _cacheModule(0)
+ , _cookiesModule(0)
+ , _proxyModule(0)
+ , _changed(false)
{
QVBoxLayout *l = new QVBoxLayout(this);
l->setMargin(0);
l->setSpacing(0);
-
+
KTabWidget *tabWidget = new KTabWidget(this);
l->addWidget(tabWidget);
- KCModuleInfo cacheInfo("cache.desktop");
- _cacheModule = new KCModuleProxy(cacheInfo,parent);
- tabWidget->addTab( _cacheModule, i18n(cacheInfo.moduleName().toLocal8Bit()) );
-
+ KCModuleInfo cacheInfo("cache.desktop");
+ _cacheModule = new KCModuleProxy(cacheInfo, parent);
+ tabWidget->addTab(_cacheModule, i18n(cacheInfo.moduleName().toLocal8Bit()));
+
KCModuleInfo cookiesInfo("cookies.desktop");
- _cookiesModule = new KCModuleProxy(cookiesInfo,parent);
- tabWidget->addTab( _cookiesModule, i18n(cookiesInfo.moduleName().toLocal8Bit()) );
-
- KCModuleInfo proxyInfo("proxy.desktop");
- _proxyModule = new KCModuleProxy(proxyInfo,parent);
- tabWidget->addTab( _proxyModule, i18n(proxyInfo.moduleName().toLocal8Bit()) );
-
- connect(_cacheModule, SIGNAL( changed(bool) ), this, SLOT( hasChanged() ) );
- connect(_cookiesModule, SIGNAL( changed(bool) ), this, SLOT( hasChanged() ) );
- connect(_proxyModule, SIGNAL( changed(bool) ), this, SLOT( hasChanged() ) );
+ _cookiesModule = new KCModuleProxy(cookiesInfo, parent);
+ tabWidget->addTab(_cookiesModule, i18n(cookiesInfo.moduleName().toLocal8Bit()));
+
+ KCModuleInfo proxyInfo("proxy.desktop");
+ _proxyModule = new KCModuleProxy(proxyInfo, parent);
+ tabWidget->addTab(_proxyModule, i18n(proxyInfo.moduleName().toLocal8Bit()));
+
+ connect(_cacheModule, SIGNAL(changed(bool)), this, SLOT(hasChanged()));
+ connect(_cookiesModule, SIGNAL(changed(bool)), this, SLOT(hasChanged()));
+ connect(_proxyModule, SIGNAL(changed(bool)), this, SLOT(hasChanged()));
}
diff --git a/src/settings/networkwidget.h b/src/settings/networkwidget.h
index efdd1807..6b7abffd 100644
--- a/src/settings/networkwidget.h
+++ b/src/settings/networkwidget.h
@@ -37,12 +37,12 @@
class NetworkWidget : public QWidget
{
-Q_OBJECT
+ Q_OBJECT
public:
NetworkWidget(QWidget *parent = 0);
~NetworkWidget();
-
+
void save();
bool changed();
@@ -51,7 +51,7 @@ signals:
private slots:
void hasChanged();
-
+
private:
KCModuleProxy *_cacheModule;
KCModuleProxy *_cookiesModule;
diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp
index d01b5809..d2d5c0d0 100644
--- a/src/settings/settingsdialog.cpp
+++ b/src/settings/settingsdialog.cpp
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -61,7 +61,7 @@
class Private
{
private:
-
+
Ui::general generalUi;
Ui::tabs tabsUi;
Ui::fonts fontsUi;
@@ -69,11 +69,11 @@ private:
AdBlockWidget *adBlockWidg;
NetworkWidget *networkWidg;
-
+
KCModuleProxy *ebrowsingModule;
KShortcutsEditor *shortcutsEditor;
-
+
Private(SettingsDialog *parent);
friend class SettingsDialog;
@@ -102,7 +102,7 @@ Private::Private(SettingsDialog *parent)
widget->layout()->setMargin(0);
pageItem = parent->addPage(widget , i18n("Fonts"));
pageItem->setIcon(KIcon("preferences-desktop-font"));
-
+
widget = new QWidget;
webkitUi.setupUi(widget);
widget->layout()->setMargin(0);
@@ -114,25 +114,25 @@ Private::Private(SettingsDialog *parent)
networkWidg = new NetworkWidget(parent);
networkWidg->layout()->setMargin(0);
pageItem = parent->addPage(networkWidg , i18n("Network"));
- pageItem->setIcon( KIcon("preferences-system-network") );
-
+ pageItem->setIcon(KIcon("preferences-system-network"));
+
adBlockWidg = new AdBlockWidget(parent);
adBlockWidg->layout()->setMargin(0);
pageItem = parent->addPage(adBlockWidg , i18n("Ad Block"));
- pageItem->setIcon( KIcon("preferences-web-browser-adblock") );
-
+ pageItem->setIcon(KIcon("preferences-web-browser-adblock"));
+
shortcutsEditor = new KShortcutsEditor(Application::instance()->mainWindow()->actionCollection(), parent);
pageItem = parent->addPage(shortcutsEditor , i18n("Shortcuts"));
pageItem->setIcon(KIcon("configure-shortcuts"));
KCModuleInfo ebrowsingInfo("ebrowsing.desktop");
- ebrowsingModule = new KCModuleProxy(ebrowsingInfo,parent);
+ ebrowsingModule = new KCModuleProxy(ebrowsingInfo, parent);
pageItem = parent->addPage(ebrowsingModule, i18n(ebrowsingInfo.moduleName().toLocal8Bit()));
pageItem->setIcon(KIcon(ebrowsingInfo.icon()));
// WARNING remember wheh changing here that the smallest netbooks
// have a 1024x576 resolution. So DON'T bother that limits!!
- parent->setMinimumSize(700,525);
+ parent->setMinimumSize(700, 525);
}
@@ -150,18 +150,18 @@ SettingsDialog::SettingsDialog(QWidget *parent)
readConfig();
connect(d->generalUi.setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage()));
-
+
// update buttons
connect(d->adBlockWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons()));
connect(d->networkWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons()));
connect(d->ebrowsingModule, SIGNAL(changed(bool)), this, SLOT(updateButtons()));
-
+
connect(d->shortcutsEditor, SIGNAL(keyChange()), this, SLOT(updateButtons()));
-
+
// save settings
connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings()));
connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings()));
-
+
setWebSettingsToolTips();
}
@@ -175,7 +175,7 @@ SettingsDialog::~SettingsDialog()
void SettingsDialog::setWebSettingsToolTips()
{
d->webkitUi.kcfg_autoLoadImages->setToolTip(i18n("Specifies whether images are automatically loaded in web pages."));
- d->webkitUi.kcfg_dnsPrefetch->setToolTip( i18n("Specifies whether WebKit will try to prefetch DNS entries to speed up browsing.") );
+ d->webkitUi.kcfg_dnsPrefetch->setToolTip(i18n("Specifies whether WebKit will try to prefetch DNS entries to speed up browsing."));
d->webkitUi.kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs."));
d->webkitUi.kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets."));
d->webkitUi.kcfg_pluginsEnabled->setToolTip(i18n("Enables support for plugins in web pages."));
@@ -203,7 +203,7 @@ void SettingsDialog::saveSettings()
{
if (!hasChanged())
return;
-
+
ReKonfig::self()->writeConfig();
d->ebrowsingModule->save();
d->shortcutsEditor->save();
@@ -212,8 +212,8 @@ void SettingsDialog::saveSettings()
SearchEngine::loadDefaultWS();
SearchEngine::loadDelimiter();
SearchEngine::loadFavorites();
-
-
+
+
updateButtons();
emit settingsChanged("ReKonfig");
}
@@ -221,12 +221,12 @@ void SettingsDialog::saveSettings()
bool SettingsDialog::hasChanged()
{
- return KConfigDialog::hasChanged()
- || d->adBlockWidg->changed()
- || d->networkWidg->changed()
- || d->ebrowsingModule->changed()
- || d->shortcutsEditor->isModified();
- ;
+ return KConfigDialog::hasChanged()
+ || d->adBlockWidg->changed()
+ || d->networkWidg->changed()
+ || d->ebrowsingModule->changed()
+ || d->shortcutsEditor->isModified();
+ ;
}
diff --git a/src/settings/settingsdialog.h b/src/settings/settingsdialog.h
index 54494a00..08d3c71b 100644
--- a/src/settings/settingsdialog.h
+++ b/src/settings/settingsdialog.h
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -47,7 +47,7 @@ class REKONQ_TESTS_EXPORT SettingsDialog : public KConfigDialog
public:
SettingsDialog(QWidget *parent = 0);
~SettingsDialog();
-
+
virtual bool hasChanged();
private:
diff --git a/src/sslinfodialog_p.h b/src/sslinfodialog_p.h
index 44d3ab7c..72f16791 100644
--- a/src/sslinfodialog_p.h
+++ b/src/sslinfodialog_p.h
@@ -44,9 +44,9 @@
* @see KSSL
* @short KDE SSL Information Dialog
*/
-class KDE_EXPORT KSslInfoDialog : public KDialog
+class KDE_EXPORT KSslInfoDialog : public KDialog
{
-Q_OBJECT
+ Q_OBJECT
public:
/**
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 7e10a196..a3023dac 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -13,9 +13,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -86,29 +86,29 @@ TabBar::~TabBar()
QSize TabBar::tabSizeHint(int index) const
{
MainView *view = qobject_cast<MainView *>(parent());
-
+
int buttonSize = view->addTabButton()->size().width();
int tabBarWidth = view->size().width() - buttonSize;
- int baseWidth = view->sizeHint().width()/BASE_WIDTH_DIVISOR;
- int minWidth = view->sizeHint().width()/MIN_WIDTH_DIVISOR;
+ int baseWidth = view->sizeHint().width() / BASE_WIDTH_DIVISOR;
+ int minWidth = view->sizeHint().width() / MIN_WIDTH_DIVISOR;
int w;
if (baseWidth*count() < tabBarWidth)
{
w = baseWidth;
}
- else
+ else
{
- if (count() > 0 && tabBarWidth/count() > minWidth)
+ if (count() > 0 && tabBarWidth / count() > minWidth)
{
- w = tabBarWidth/count();
+ w = tabBarWidth / count();
}
else
{
w = minWidth;
}
}
-
+
int h = KTabBar::tabSizeHint(index).height();
QSize ts = QSize(w, h);
@@ -149,37 +149,37 @@ void TabBar::detachTab()
void TabBar::showTabPreview(int tab)
{
MainView *mv = qobject_cast<MainView *>(parent());
-
+
WebTab *indexedTab = mv->webTab(tab);
WebTab *currentTab = mv->webTab(currentIndex());
// check if view && currentView exist before using them :)
- if(!currentTab || !indexedTab)
+ if (!currentTab || !indexedTab)
return;
-
+
int w = tabSizeHint(tab).width();
- int h = w * ( (0.0 + currentTab->height()) / currentTab->width() );
+ int h = w * ((0.0 + currentTab->height()) / currentTab->width());
//delete previous tab preview
delete m_previewPopup.data();
m_previewPopup.clear();
-
+
if (indexedTab->progress() != 0)
return;
-
+
m_previewPopup = new KPassivePopup(this);
m_previewPopup.data()->setFrameShape(QFrame::StyledPanel);
m_previewPopup.data()->setFrameShadow(QFrame::Plain);
m_previewPopup.data()->setFixedSize(w, h);
-
+
QLabel *l = new QLabel();
- l->setPixmap( WebSnap::renderPreview( *indexedTab->page(), w, h) );
-
+ l->setPixmap(WebSnap::renderPreview(*indexedTab->page(), w, h));
+
m_previewPopup.data()->setView(l);
m_previewPopup.data()->layout()->setAlignment(Qt::AlignTop);
m_previewPopup.data()->layout()->setMargin(0);
- QPoint pos( tabRect(tab).x() , tabRect(tab).y() + tabRect(tab).height());
+ QPoint pos(tabRect(tab).x() , tabRect(tab).y() + tabRect(tab).height());
m_previewPopup.data()->show(mapToGlobal(pos));
}
@@ -192,17 +192,17 @@ void TabBar::mouseMoveEvent(QMouseEvent *event)
MainView *view = qobject_cast<MainView *>(parent());
QTimer::singleShot(200, view->addTabButton(), SLOT(hide()));
}
-
+
if (ReKonfig::alwaysShowTabPreviews())
{
//Find the tab under the mouse
int i = 0;
int tabIndex = -1;
- while ( i<count()
- && tabIndex == -1
+ while (i < count()
+ && tabIndex == -1
)
{
- if (tabRect(i).contains(event->pos()))
+ if (tabRect(i).contains(event->pos()))
{
tabIndex = i;
}
@@ -210,10 +210,10 @@ void TabBar::mouseMoveEvent(QMouseEvent *event)
}
// if found and not the current tab then show tab preview
- if ( tabIndex != -1
- && tabIndex != currentIndex()
- && m_currentTabPreview != tabIndex
- && event->buttons() == Qt::NoButton
+ if (tabIndex != -1
+ && tabIndex != currentIndex()
+ && m_currentTabPreview != tabIndex
+ && event->buttons() == Qt::NoButton
)
{
showTabPreview(tabIndex);
@@ -223,7 +223,7 @@ void TabBar::mouseMoveEvent(QMouseEvent *event)
// if current tab or not found then hide previous tab preview
if (tabIndex == currentIndex() || tabIndex == -1)
{
- if ( !m_previewPopup.isNull() )
+ if (!m_previewPopup.isNull())
{
m_previewPopup.data()->hide();
}
@@ -240,7 +240,7 @@ void TabBar::leaveEvent(QEvent *event)
if (ReKonfig::alwaysShowTabPreviews())
{
//if leave tabwidget then hide previous tab preview
- if ( !m_previewPopup.isNull() )
+ if (!m_previewPopup.isNull())
{
m_previewPopup.data()->hide();
}
@@ -255,7 +255,7 @@ void TabBar::mousePressEvent(QMouseEvent *event)
{
if (ReKonfig::alwaysShowTabPreviews())
{
- if ( !m_previewPopup.isNull() )
+ if (!m_previewPopup.isNull())
{
m_previewPopup.data()->hide();
}
@@ -265,7 +265,7 @@ void TabBar::mousePressEvent(QMouseEvent *event)
// just close tab on middle mouse click
if (event->button() == Qt::MidButton)
return;
-
+
KTabBar::mousePressEvent(event);
}
@@ -278,16 +278,16 @@ void TabBar::contextMenu(int tab, const QPoint &pos)
MainWindow *mainWindow = Application::instance()->mainWindow();
menu.addAction(mainWindow->actionByName(QLatin1String("new_tab")));
- menu.addAction( mainWindow->actionByName("clone_tab") );
+ menu.addAction(mainWindow->actionByName("clone_tab"));
- if(count() > 1)
- menu.addAction( mainWindow->actionByName("detach_tab") );
+ if (count() > 1)
+ menu.addAction(mainWindow->actionByName("detach_tab"));
menu.addSeparator();
- menu.addAction( mainWindow->actionByName("close_tab") );
- menu.addAction( mainWindow->actionByName("close_other_tabs") );
+ menu.addAction(mainWindow->actionByName("close_tab"));
+ menu.addAction(mainWindow->actionByName("close_other_tabs"));
menu.addSeparator();
- menu.addAction( mainWindow->actionByName("reload_tab") );
- menu.addAction( mainWindow->actionByName("reload_all_tabs") );
+ menu.addAction(mainWindow->actionByName("reload_tab"));
+ menu.addAction(mainWindow->actionByName("reload_all_tabs"));
menu.exec(pos);
}
@@ -300,7 +300,7 @@ void TabBar::emptyAreaContextMenu(const QPoint &pos)
menu.addAction(mainWindow->actionByName(QLatin1String("new_tab")));
menu.addSeparator();
- menu.addAction( mainWindow->actionByName("reload_all_tabs") );
+ menu.addAction(mainWindow->actionByName("reload_all_tabs"));
menu.exec(pos);
}
@@ -310,7 +310,7 @@ void TabBar::mouseReleaseEvent(QMouseEvent *event)
{
MainView *mv = qobject_cast<MainView *>(parent());
QTimer::singleShot(200, mv->addTabButton(), SLOT(show()));
-
+
KTabBar::mouseReleaseEvent(event);
}
@@ -320,7 +320,7 @@ void TabBar::tabRemoved(int index)
Q_UNUSED(index)
if (ReKonfig::alwaysShowTabPreviews())
{
- if ( !m_previewPopup.isNull() )
+ if (!m_previewPopup.isNull())
{
m_previewPopup.data()->hide();
}
diff --git a/src/tabbar.h b/src/tabbar.h
index fd325b66..03ee4905 100644
--- a/src/tabbar.h
+++ b/src/tabbar.h
@@ -13,9 +13,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -74,28 +74,28 @@ protected:
* Added to fix tab dimension
*/
virtual QSize tabSizeHint(int index) const;
-
+
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void leaveEvent(QEvent *event);
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
virtual void tabRemoved(int);
-
+
private slots:
void cloneTab();
void closeTab();
void closeOtherTabs();
void reloadTab();
void detachTab();
-
+
void contextMenu(int, const QPoint &);
void emptyAreaContextMenu(const QPoint &);
private:
void showTabPreview(int tab);
-
+
friend class MainView;
-
+
/**
* the index in which we are seeing a Context menu
*/
diff --git a/src/tests/findbar_test.cpp b/src/tests/findbar_test.cpp
index a79f44a2..c9555441 100644
--- a/src/tests/findbar_test.cpp
+++ b/src/tests/findbar_test.cpp
@@ -31,11 +31,11 @@
class FindBarTest : public QObject
{
Q_OBJECT
-
+
public slots:
void initTestCase();
void cleanupTestCase();
-
+
private slots:
void matchCase();
void notifyMatch();
@@ -60,10 +60,10 @@ void FindBarTest::cleanupTestCase()
{
delete bar;
}
-
+
void FindBarTest::matchCase()
{
-
+
}
void FindBarTest::notifyMatch()
diff --git a/src/tests/mainview_test.cpp b/src/tests/mainview_test.cpp
index 596ac4e1..d32eb58f 100644
--- a/src/tests/mainview_test.cpp
+++ b/src/tests/mainview_test.cpp
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -47,31 +47,31 @@ public slots:
private slots:
void tabwidget_data();
void tabwidget();
-
+
void closeTab_data();
void closeTab();
-
+
void currentWebView_data();
void currentWebView();
-
+
void newTab_data();
void newTab();
-
+
void nextTab_data();
void nextTab();
-
+
void previousTab_data();
void previousTab();
-
+
void recentlyClosedTabs_data();
void recentlyClosedTabs();
-
+
void setCurrentTitle_data();
void setCurrentTitle(const QString &);
-
+
void showStatusBarMessage_data();
void showStatusBarMessage(const QString &);
-
+
void currentChanged_data();
void currentChanged();
@@ -108,13 +108,13 @@ void MainViewTest::tabwidget_data()
void MainViewTest::tabwidget()
{
QCOMPARE(view->currentIndex(), -1);
-
-// view->newTab();
-// QCOMPARE(view->currentIndex(), 1);
+
+// view->newTab();
+// QCOMPARE(view->currentIndex(), 1);
// view->newTab();
// view->nextTab();
// QCOMPARE(view->currentIndex(), 0);
-//
+//
// view->previousTab();
// QCOMPARE(view->currentIndex(), 0);
}
@@ -131,18 +131,18 @@ void MainViewTest::closeTab_data()
void MainViewTest::closeTab()
{
// QFETCH(int, index);
-//
+//
// QSignalSpy spy1(view, SIGNAL(linkHovered(const QString &)));
// QSignalSpy spy2(view, SIGNAL(setCurrentTitle(const QString &)));
// QSignalSpy spy3(view, SIGNAL(tabsChanged()));
// QSignalSpy spy4(view, SIGNAL(lastTabClosed()));
-//
+//
// view->newTab();
// view->closeTab(index);
// view->newTab();
// view->closeTab(index);
// view->newTab();
-//
+//
// QCOMPARE(spy1.count(), 0);
// QCOMPARE(spy2.count(), 2);
// QCOMPARE(spy3.count(), 0);
@@ -197,15 +197,15 @@ void MainViewTest::newTab_data()
void MainViewTest::newTab()
{
// QFETCH(int, foo);
-//
+//
// QSignalSpy spy0(view, SIGNAL(linkHovered(const QString &)));
// QSignalSpy spy1(view, SIGNAL(setCurrentTitle(const QString &)));
// QSignalSpy spy2(view, SIGNAL(showStatusBarMessage(const QString &)));
// QSignalSpy spy3(view, SIGNAL(tabsChanged()));
// QSignalSpy spy4(view, SIGNAL(lastTabClosed()));
-//
+//
// view->newTab();
-//
+//
// QCOMPARE(spy0.count(), 0);
// QCOMPARE(spy1.count(), 0);
// QCOMPARE(spy2.count(), 0);
diff --git a/src/tests/mainwindow_test.cpp b/src/tests/mainwindow_test.cpp
index d3ab6bef..af3a2aa2 100644
--- a/src/tests/mainwindow_test.cpp
+++ b/src/tests/mainwindow_test.cpp
@@ -32,11 +32,11 @@
class MainWindowTest : public QObject
{
Q_OBJECT
-
+
public slots:
void initTestCase();
void cleanupTestCase();
-
+
private slots:
@@ -61,5 +61,5 @@ void MainWindowTest::cleanupTestCase()
// -------------------------------------------
-QTEST_KDEMAIN(MainWindowTest,GUI)
+QTEST_KDEMAIN(MainWindowTest, GUI)
#include "mainwindow_test.moc"
diff --git a/src/tests/networkaccessmanager_test.cpp b/src/tests/networkaccessmanager_test.cpp
index ac6cf89e..28b05075 100644
--- a/src/tests/networkaccessmanager_test.cpp
+++ b/src/tests/networkaccessmanager_test.cpp
@@ -31,11 +31,11 @@
class NetworkAccessManagerTest : public QObject
{
Q_OBJECT
-
+
public slots:
void initTestCase();
void cleanupTestCase();
-
+
private slots:
private:
@@ -55,13 +55,13 @@ void NetworkAccessManagerTest::cleanupTestCase()
{
delete manager;
}
-
-
+
+
// -------------------------------------------
// -------------------------------------------
-QTEST_KDEMAIN(NetworkAccessManagerTest,GUI)
+QTEST_KDEMAIN(NetworkAccessManagerTest, GUI)
#include "networkaccessmanager_test.moc"
diff --git a/src/tests/protocolhandler_test.cpp b/src/tests/protocolhandler_test.cpp
index a3c78c2f..dbf33684 100644
--- a/src/tests/protocolhandler_test.cpp
+++ b/src/tests/protocolhandler_test.cpp
@@ -33,18 +33,18 @@
class ProtocolhandlerTest : public QObject
{
Q_OBJECT
-
+
public slots:
void initTestCase();
void cleanupTestCase();
-
+
private slots:
void preHandling_data();
void preHandling();
void postHandling_data();
void postHandling();
-
+
private:
ProtocolHandler *handler;
};
@@ -62,8 +62,8 @@ void ProtocolhandlerTest::cleanupTestCase()
{
delete handler;
}
-
-
+
+
// -------------------------------------------
@@ -71,7 +71,7 @@ void ProtocolhandlerTest::preHandling_data()
{
QTest::addColumn<QString>("urlString");
QTest::addColumn<bool>("result");
-
+
QTest::newRow("mailto") << "mailto:me@here.com" << true ;
QTest::newRow("relative") << "google.it" << false ;
QTest::newRow("javascript") << "javascript:alertbox('hello')" << true ;
@@ -84,15 +84,15 @@ void ProtocolhandlerTest::preHandling_data()
void ProtocolhandlerTest::preHandling()
{
- QFETCH( QString, urlString );
- QFETCH( bool , result );
-
+ QFETCH(QString, urlString);
+ QFETCH(bool , result);
+
QWebView *view = new QWebView;
QWebFrame *frame = view->page()->mainFrame();
-
- QNetworkRequest request = QNetworkRequest( QUrl(urlString) );
- QCOMPARE( handler->preHandling( request, frame ) , result );
+ QNetworkRequest request = QNetworkRequest(QUrl(urlString));
+
+ QCOMPARE(handler->preHandling(request, frame) , result);
}
@@ -100,7 +100,7 @@ void ProtocolhandlerTest::postHandling_data()
{
QTest::addColumn<QString>("urlString");
QTest::addColumn<bool>("result");
-
+
QTest::newRow("mailto") << "mailto:me@here.com" << true ;
QTest::newRow("relative") << "google.it" << false ;
QTest::newRow("javascript") << "javascript:alertbox('hello')" << false ;
@@ -113,18 +113,18 @@ void ProtocolhandlerTest::postHandling_data()
void ProtocolhandlerTest::postHandling()
{
- QFETCH( QString, urlString );
- QFETCH( bool , result );
-
+ QFETCH(QString, urlString);
+ QFETCH(bool , result);
+
QWebView *view = new QWebView;
QWebFrame *frame = view->page()->mainFrame();
-
- QNetworkRequest request = QNetworkRequest( QUrl(urlString) );
- QCOMPARE( handler->postHandling( request, frame ) , result );
+ QNetworkRequest request = QNetworkRequest(QUrl(urlString));
+
+ QCOMPARE(handler->postHandling(request, frame) , result);
}
-
+
// -------------------------------------------
-QTEST_KDEMAIN(ProtocolhandlerTest,GUI)
+QTEST_KDEMAIN(ProtocolhandlerTest, GUI)
#include "protocolhandler_test.moc"
diff --git a/src/tests/sessionmanager_test.cpp b/src/tests/sessionmanager_test.cpp
index e3e1b329..bb784219 100644
--- a/src/tests/sessionmanager_test.cpp
+++ b/src/tests/sessionmanager_test.cpp
@@ -32,11 +32,11 @@
class SessionManagerTest : public QObject
{
Q_OBJECT
-
+
public slots:
void initTestCase();
void cleanupTestCase();
-
+
private slots:
private:
@@ -57,13 +57,13 @@ void SessionManagerTest::cleanupTestCase()
{
delete sessman;
}
-
-
+
+
// -------------------------------------------
// -------------------------------------------
-QTEST_KDEMAIN(SessionManagerTest,GUI)
+QTEST_KDEMAIN(SessionManagerTest, GUI)
#include "sessionmanager_test.moc"
diff --git a/src/tests/tabbar_test.cpp b/src/tests/tabbar_test.cpp
index 560f2c9b..6df38657 100644
--- a/src/tests/tabbar_test.cpp
+++ b/src/tests/tabbar_test.cpp
@@ -35,23 +35,33 @@
class SubTabBar : public TabBar
{
public:
-
+
SubTabBar(QWidget *parent) : TabBar(parent) {};
QSize call_tabSizeHint(int index) const
- { return SubTabBar::tabSizeHint(index); }
-
+ {
+ return SubTabBar::tabSizeHint(index);
+ }
+
void call_mouseMoveEvent(QMouseEvent* event)
- { return SubTabBar::mouseMoveEvent(event); }
-
+ {
+ return SubTabBar::mouseMoveEvent(event);
+ }
+
void call_leaveEvent(QEvent* event)
- { return SubTabBar::leaveEvent(event); }
-
+ {
+ return SubTabBar::leaveEvent(event);
+ }
+
void call_mousePressEvent(QMouseEvent* event)
- { return SubTabBar::mousePressEvent(event); }
-
+ {
+ return SubTabBar::mousePressEvent(event);
+ }
+
void call_mouseReleaseEvent(QMouseEvent* event)
- { return SubTabBar::mouseReleaseEvent(event); }
+ {
+ return SubTabBar::mouseReleaseEvent(event);
+ }
};
@@ -65,14 +75,14 @@ class TabBarTest : public QObject
public slots:
void initTestCase();
void cleanupTestCase();
-
+
private slots:
void tabSizeHint_data();
void tabSizeHint();
-
+
void mousePress_data();
void mousePress();
-
+
private:
SubTabBar *_bar;
};
@@ -128,7 +138,7 @@ void TabBarTest::mousePress()
{
// QTest::mousePress(_bar, Qt::MidButton);
// // QCOMPARE(); ?
-//
+//
// QTest::mousePress(_bar, Qt::LeftButton);
// // QCOMPARE(); ?
}
diff --git a/src/tests/urlbar_test.cpp b/src/tests/urlbar_test.cpp
index 7a1fb40b..fc7c1718 100644
--- a/src/tests/urlbar_test.cpp
+++ b/src/tests/urlbar_test.cpp
@@ -35,11 +35,11 @@
class UrlBarTest : public QObject
{
Q_OBJECT
-
+
public slots:
void initTestCase();
void cleanupTestCase();
-
+
private slots:
private:
@@ -62,13 +62,13 @@ void UrlBarTest::cleanupTestCase()
delete bar;
delete tab;
}
-
-
+
+
// -------------------------------------------
// -------------------------------------------
-QTEST_KDEMAIN(UrlBarTest,GUI)
+QTEST_KDEMAIN(UrlBarTest, GUI)
#include "urlbar_test.moc"
diff --git a/src/tests/walletbar_test.cpp b/src/tests/walletbar_test.cpp
index ec9c3559..d4036981 100644
--- a/src/tests/walletbar_test.cpp
+++ b/src/tests/walletbar_test.cpp
@@ -31,11 +31,11 @@
class WalletBarTest : public QObject
{
Q_OBJECT
-
+
public slots:
void initTestCase();
void cleanupTestCase();
-
+
private slots:
private:
@@ -57,13 +57,13 @@ void WalletBarTest::cleanupTestCase()
{
delete bar;
}
-
-
+
+
// -------------------------------------------
// -------------------------------------------
-QTEST_KDEMAIN(WalletBarTest,GUI)
+QTEST_KDEMAIN(WalletBarTest, GUI)
#include "walletbar_test.moc"
diff --git a/src/tests/webpage_test.cpp b/src/tests/webpage_test.cpp
index 3051b8bf..c06ce7a5 100644
--- a/src/tests/webpage_test.cpp
+++ b/src/tests/webpage_test.cpp
@@ -34,11 +34,11 @@
class WebPageTest : public QObject
{
Q_OBJECT
-
+
public slots:
void initTestCase();
void cleanupTestCase();
-
+
private slots:
void manageNetworkErrors();
void downloadRequest();
@@ -46,9 +46,9 @@ private slots:
void createWindow();
void acceptNavigationRequest();
-
+
void handleUnsupportedContent();
-
+
void loadFinished();
private:
@@ -73,8 +73,8 @@ void WebPageTest::cleanupTestCase()
{
delete tab;
}
-
-
+
+
// -------------------------------------------
@@ -108,5 +108,5 @@ void WebPageTest::loadFinished()
// -------------------------------------------
-QTEST_KDEMAIN(WebPageTest,GUI)
+QTEST_KDEMAIN(WebPageTest, GUI)
#include "webpage_test.moc"
diff --git a/src/tests/websnap_test.cpp b/src/tests/websnap_test.cpp
index 53fc1d4f..1bfb440d 100644
--- a/src/tests/websnap_test.cpp
+++ b/src/tests/websnap_test.cpp
@@ -33,11 +33,11 @@ class WebSnapTest : public QObject
{
Q_OBJECT
-
+
public slots:
void initTestCase();
void cleanupTestCase();
-
+
private slots:
private:
@@ -57,13 +57,13 @@ void WebSnapTest::cleanupTestCase()
{
delete snap;
}
-
-
+
+
// -------------------------------------------
// -------------------------------------------
-QTEST_KDEMAIN(WebSnapTest,GUI)
+QTEST_KDEMAIN(WebSnapTest, GUI)
#include "websnap_test.moc"
diff --git a/src/tests/webtab_test.cpp b/src/tests/webtab_test.cpp
index 2c6edf35..0e5833b4 100644
--- a/src/tests/webtab_test.cpp
+++ b/src/tests/webtab_test.cpp
@@ -34,7 +34,7 @@
class WebTabTest : public QObject
{
Q_OBJECT
-
+
public slots:
void initTestCase();
void cleanupTestCase();
@@ -57,12 +57,12 @@ void WebTabTest::cleanupTestCase()
{
delete tab;
}
-
-
+
+
// -------------------------------------------
// -------------------------------------------
-QTEST_KDEMAIN(WebTabTest,GUI)
+QTEST_KDEMAIN(WebTabTest, GUI)
#include "webtab_test.moc"
diff --git a/src/tests/webview_test.cpp b/src/tests/webview_test.cpp
index 11d1a46c..7eb968c7 100644
--- a/src/tests/webview_test.cpp
+++ b/src/tests/webview_test.cpp
@@ -33,11 +33,11 @@
class WebViewTest : public QObject
{
Q_OBJECT
-
+
public slots:
void initTestCase();
void cleanupTestCase();
-
+
private slots:
private:
@@ -60,12 +60,12 @@ void WebViewTest::cleanupTestCase()
{
delete tab;
}
-
-
+
+
// -------------------------------------------
// -------------------------------------------
-QTEST_KDEMAIN(WebViewTest,GUI)
+QTEST_KDEMAIN(WebViewTest, GUI)
#include "webview_test.moc"
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
index e0027a92..84e8141a 100644
--- a/src/urlbar/completionwidget.cpp
+++ b/src/urlbar/completionwidget.cpp
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -51,10 +51,10 @@
CompletionWidget::CompletionWidget(QWidget *parent)
- : QFrame(parent, Qt::ToolTip)
- , _parent(parent)
- , _currentIndex(-1)
- , _searchEngine( SearchEngine::defaultEngine() )
+ : QFrame(parent, Qt::ToolTip)
+ , _parent(parent)
+ , _currentIndex(-1)
+ , _searchEngine(SearchEngine::defaultEngine())
{
setFrameStyle(QFrame::Panel);
setLayoutDirection(Qt::LeftToRight);
@@ -72,22 +72,22 @@ void CompletionWidget::insertSearchList(const UrlSearchList &list, const QString
foreach(UrlSearchItem item, _list)
{
ListItem *suggestion = ListItemFactory::create(item, text, this);
- suggestion->setBackgroundRole(i%2 ? QPalette::AlternateBase : QPalette::Base);
+ suggestion->setBackgroundRole(i % 2 ? QPalette::AlternateBase : QPalette::Base);
connect(suggestion, SIGNAL(itemClicked(ListItem *, Qt::MouseButton)), this, SLOT(itemChosen(ListItem *, Qt::MouseButton)));
connect(this, SIGNAL(nextItemSubChoice()), suggestion, SLOT(nextItemSubChoice()));
- suggestion->setObjectName( QString::number(i++) );
- layout()->addWidget( suggestion );
+ suggestion->setObjectName(QString::number(i++));
+ layout()->addWidget(suggestion);
}
}
void CompletionWidget::sizeAndPosition()
{
- setFixedWidth( _parent->width() );
+ setFixedWidth(_parent->width());
adjustSize();
-
+
// position
- QPoint p = _parent->mapToGlobal( QPoint(0,0) );
+ QPoint p = _parent->mapToGlobal(QPoint(0, 0));
move(p.x(), p.y() + _parent->height());
}
@@ -104,19 +104,19 @@ void CompletionWidget::popup()
void CompletionWidget::up()
{
// deactivate previous
- if(_currentIndex != -1)
+ if (_currentIndex != -1)
{
- ListItem *widget = findChild<ListItem *>( QString::number(_currentIndex) );
+ ListItem *widget = findChild<ListItem *>(QString::number(_currentIndex));
widget->deactivate();
}
- if(_currentIndex > 0)
+ if (_currentIndex > 0)
_currentIndex--;
else
- _currentIndex=layout()->count()-1;
+ _currentIndex = layout()->count() - 1;
// activate "new" current
- ListItem *widget = findChild<ListItem *>( QString::number(_currentIndex) );
+ ListItem *widget = findChild<ListItem *>(QString::number(_currentIndex));
widget->activate();
}
@@ -124,19 +124,19 @@ void CompletionWidget::up()
void CompletionWidget::down()
{
// deactivate previous
- if(_currentIndex != -1)
+ if (_currentIndex != -1)
{
- ListItem *widget = findChild<ListItem *>( QString::number(_currentIndex) );
+ ListItem *widget = findChild<ListItem *>(QString::number(_currentIndex));
widget->deactivate();
}
-
- if(_currentIndex < _list.count() -1)
+
+ if (_currentIndex < _list.count() - 1)
_currentIndex++;
else
- _currentIndex=0;
-
+ _currentIndex = 0;
+
// activate "new" current
- ListItem *widget = findChild<ListItem *>( QString::number(_currentIndex) );
+ ListItem *widget = findChild<ListItem *>(QString::number(_currentIndex));
widget->activate();
}
@@ -144,32 +144,32 @@ void CompletionWidget::down()
void CompletionWidget::clear()
{
QLayoutItem *child;
- while ((child = layout()->takeAt(0)) != 0)
+ while ((child = layout()->takeAt(0)) != 0)
{
- delete child->widget();
+ delete child->widget();
delete child;
}
_currentIndex = -1;
}
-bool CompletionWidget::eventFilter( QObject *o, QEvent *e )
+bool CompletionWidget::eventFilter(QObject *o, QEvent *e)
{
int type = e->type();
QWidget *wid = qobject_cast<QWidget*>(o);
-
- if (o == this)
+
+ if (o == this)
{
return false;
}
//hide conditions of the CompletionWidget
- 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)))
+ 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();
@@ -177,63 +177,63 @@ bool CompletionWidget::eventFilter( QObject *o, QEvent *e )
}
//actions on the CompletionWidget
- if (wid && wid->isAncestorOf(_parent) && isVisible())
+ if (wid && wid->isAncestorOf(_parent) && isVisible())
{
ListItem *child;
-
- if ( type == QEvent::KeyPress )
+
+ if (type == QEvent::KeyPress)
{
- QKeyEvent *ev = static_cast<QKeyEvent *>( e );
- switch ( ev->key() )
+ QKeyEvent *ev = static_cast<QKeyEvent *>(e);
+ switch (ev->key())
{
- case Qt::Key_Up:
- case Qt::Key_Backtab:
- if (ev->modifiers() == Qt::NoButton || (ev->modifiers() & Qt::ShiftModifier))
- {
- up();
- ev->accept();
- return true;
- }
- break;
-
- case Qt::Key_Down:
- case Qt::Key_Tab:
- if (ev->modifiers() == Qt::NoButton)
- {
- down();
- ev->accept();
- return true;
- }
- if (ev->modifiers() & Qt::ControlModifier)
- {
- emit nextItemSubChoice();
- ev->accept();
- return true;
- }
- break;
-
- case Qt::Key_Enter:
- case Qt::Key_Return:
- child = findChild<ListItem *>( QString::number(_currentIndex) );
- emit chosenUrl( child->url(), Rekonq::CurrentTab);
+ case Qt::Key_Up:
+ case Qt::Key_Backtab:
+ if (ev->modifiers() == Qt::NoButton || (ev->modifiers() & Qt::ShiftModifier))
+ {
+ up();
ev->accept();
- hide();
return true;
-
- case Qt::Key_Escape:
- hide();
+ }
+ break;
+
+ case Qt::Key_Down:
+ case Qt::Key_Tab:
+ if (ev->modifiers() == Qt::NoButton)
+ {
+ down();
+ ev->accept();
+ return true;
+ }
+ if (ev->modifiers() & Qt::ControlModifier)
+ {
+ emit nextItemSubChoice();
+ ev->accept();
return true;
+ }
+ break;
+
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ child = findChild<ListItem *>(QString::number(_currentIndex));
+ emit chosenUrl(child->url(), Rekonq::CurrentTab);
+ ev->accept();
+ hide();
+ return true;
+
+ case Qt::Key_Escape:
+ hide();
+ return true;
}
}
}
-
- return QFrame::eventFilter(o,e);
+
+ return QFrame::eventFilter(o, e);
}
-void CompletionWidget::setVisible( bool visible )
+void CompletionWidget::setVisible(bool visible)
{
- if (visible)
+ if (visible)
{
Application::instance()->installEventFilter(this);
}
@@ -241,7 +241,7 @@ void CompletionWidget::setVisible( bool visible )
{
Application::instance()->removeEventFilter(this);
}
-
+
QFrame::setVisible(visible);
}
@@ -249,21 +249,21 @@ void CompletionWidget::setVisible( bool visible )
void CompletionWidget::itemChosen(ListItem *item, Qt::MouseButton button)
{
- if(button == Qt::MidButton)
- emit chosenUrl( item->url(), Rekonq::NewCurrentTab);
+ if (button == Qt::MidButton)
+ emit chosenUrl(item->url(), Rekonq::NewCurrentTab);
else
- emit chosenUrl( item->url(), Rekonq::CurrentTab);
+ emit chosenUrl(item->url(), Rekonq::CurrentTab);
hide();
}
void CompletionWidget::suggestUrls(const QString &text)
-{
+{
QWidget *w = qobject_cast<QWidget *>(parent());
- if(!w->hasFocus())
+ if (!w->hasFocus())
return;
- if(text.isEmpty())
+ if (text.isEmpty())
{
hide();
return;
@@ -271,7 +271,7 @@ void CompletionWidget::suggestUrls(const QString &text)
UrlResolver res(text);
UrlSearchList list = res.orderedSearchItems();
- if(list.count() > 0)
+ if (list.count() > 0)
{
clear();
insertSearchList(list, text);
diff --git a/src/urlbar/completionwidget.h b/src/urlbar/completionwidget.h
index afd9b7e1..bb840c40 100644
--- a/src/urlbar/completionwidget.h
+++ b/src/urlbar/completionwidget.h
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -49,10 +49,16 @@ public:
virtual bool eventFilter(QObject *obj, QEvent *ev);
void setVisible(bool visible);
-
- KService::Ptr searchEngine() { return _searchEngine; };
- void setCurrentEngine(KService::Ptr engine) { _searchEngine = engine; };
-
+
+ KService::Ptr searchEngine()
+ {
+ return _searchEngine;
+ };
+ void setCurrentEngine(KService::Ptr engine)
+ {
+ _searchEngine = engine;
+ };
+
private slots:
void itemChosen(ListItem *item, Qt::MouseButton = Qt::LeftButton);
void suggestUrls(const QString &text);
@@ -60,7 +66,7 @@ private slots:
signals:
void chosenUrl(const KUrl &, Rekonq::OpenType);
void nextItemSubChoice();
-
+
private:
void insertSearchList(const UrlSearchList &list, const QString& text);
void popup();
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
index d69bdd03..d6d9e044 100644
--- a/src/urlbar/listitem.cpp
+++ b/src/urlbar/listitem.cpp
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -25,8 +25,8 @@
// Self Includes
-#include "listitem.h"
-#include "listitem.moc"
+#include "listitem.h"
+#include "listitem.moc"
// Auto Includes
#include "rekonq.h"
@@ -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)
{
setAutoFillBackground(true);
@@ -71,11 +71,11 @@ ListItem::ListItem(const UrlSearchItem &item, QWidget *parent)
QPalette p(palette());
p.setColor(QPalette::Base, Qt::white); // TODO: choose the correct color
-
- p.setColor(QPalette::AlternateBase, QColor(247,247,247)); // TODO: choose the correct color
+
+ p.setColor(QPalette::AlternateBase, QColor(247, 247, 247)); // TODO: choose the correct color
setPalette(p);
- deactivate();
+ deactivate();
}
@@ -103,14 +103,14 @@ void ListItem::deactivate()
void ListItem::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
-
- 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))
{
QPainter painter(this);
- m_option.rect=QRect(QPoint(),size());
+ m_option.rect = QRect(QPoint(), size());
style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &m_option, &painter, this);
}
-
+
QWidget::paintEvent(event);
}
@@ -154,16 +154,16 @@ void ListItem::nextItemSubChoice()
TypeIconLabel::TypeIconLabel(int type, QWidget *parent)
- : QLabel(parent)
+ : QLabel(parent)
{
setMinimumWidth(40);
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setMargin(0);
hLayout->setAlignment(Qt::AlignRight);
setLayout(hLayout);
-
+
if (type & UrlSearchItem::Search) hLayout->addWidget(getIcon("edit-find"));
- if (type & UrlSearchItem::Browse) hLayout->addWidget(getIcon("applications-internet"));
+ if (type & UrlSearchItem::Browse) hLayout->addWidget(getIcon("applications-internet"));
if (type & UrlSearchItem::Bookmark) hLayout->addWidget(getIcon("rating"));
if (type & UrlSearchItem::History) hLayout->addWidget(getIcon("view-history"));
}
@@ -172,7 +172,7 @@ TypeIconLabel::TypeIconLabel(int type, QWidget *parent)
QLabel *TypeIconLabel::getIcon(QString icon)
{
QLabel *iconLabel = new QLabel(this);
- iconLabel->setFixedSize(16,16);
+ iconLabel->setFixedSize(16, 16);
QPixmap pixmap = KIcon(icon).pixmap(16);
iconLabel->setPixmap(pixmap);
return iconLabel;
@@ -183,10 +183,10 @@ QLabel *TypeIconLabel::getIcon(QString icon)
IconLabel::IconLabel(const QString &icon, QWidget *parent)
- : QLabel(parent)
+ : QLabel(parent)
{
- QPixmap pixmapIcon = Application::icon( KUrl(icon) ).pixmap(16);
- setFixedSize(16,16);
+ QPixmap pixmapIcon = Application::icon(KUrl(icon)).pixmap(16);
+ setFixedSize(16, 16);
setPixmap(pixmapIcon);
}
@@ -195,7 +195,7 @@ IconLabel::IconLabel(const QString &icon, QWidget *parent)
TextLabel::TextLabel(const QString &text, const QString &textToPointOut, QWidget *parent)
- : QLabel(parent)
+ : QLabel(parent)
{
QString t = text;
if (!textToPointOut.isEmpty())
@@ -210,26 +210,26 @@ TextLabel::TextLabel(const QString &text, const QString &textToPointOut, QWidget
PreviewListItem::PreviewListItem(const UrlSearchItem &item, const QString &text, QWidget *parent)
- : ListItem(item, parent)
+ : ListItem(item, parent)
{
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setSpacing(4);
QLabel *previewLabelIcon = new QLabel(this);
- previewLabelIcon->setFixedSize(45,33);
+ previewLabelIcon->setFixedSize(45, 33);
new PreviewLabel(item.url.url(), 38, 29, previewLabelIcon);
IconLabel* icon = new IconLabel(item.url.url(), previewLabelIcon);
icon->move(27, 16);
hLayout->addWidget(previewLabelIcon);
-
- QVBoxLayout *vLayout = new QVBoxLayout;
+
+ QVBoxLayout *vLayout = new QVBoxLayout;
vLayout->setMargin(0);
- vLayout->addWidget( new TextLabel(item.title, text, this) );
- vLayout->addWidget( new TextLabel("<i>" + item.url.url() + "</i>", text, this) );
+ vLayout->addWidget(new TextLabel(item.title, text, this));
+ vLayout->addWidget(new TextLabel("<i>" + item.url.url() + "</i>", text, this));
hLayout->addLayout(vLayout);
-
- hLayout->addWidget( new TypeIconLabel(item.type, this) );
+
+ hLayout->addWidget(new TypeIconLabel(item.type, this));
setLayout(hLayout);
}
@@ -239,16 +239,16 @@ 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) );
+ preview.load(WebSnap::imagePathFromUrl(u));
setPixmap(preview.scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
}
}
@@ -258,39 +258,39 @@ PreviewLabel::PreviewLabel(const QString &url, int width, int height, QWidget *p
SearchListItem::SearchListItem(const UrlSearchItem &item, const QString &text, QWidget *parent)
- : ListItem(item, parent)
- , m_text(text)
+ : ListItem(item, parent)
+ , m_text(text)
{
KService::Ptr currentEngine = SearchEngine::defaultEngine();
-
+
QString query = text;
KService::Ptr engine = SearchEngine::fromString(text);
if (engine)
{
- query = query.remove(0, text.indexOf(SearchEngine::delimiter())+1);
+ query = query.remove(0, text.indexOf(SearchEngine::delimiter()) + 1);
}
else
{
engine = currentEngine;
}
-
+
m_url = SearchEngine::buildQuery(engine, query);
m_iconLabel = new IconLabel("edit-find", this); //TODO: get the default engine icon
- m_titleLabel = new TextLabel( searchItemTitle(engine->name(), query), QString(), this);
+ m_titleLabel = new TextLabel(searchItemTitle(engine->name(), query), QString(), this);
m_engineBar = new EngineBar(currentEngine, parent);
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setSpacing(4);
- hLayout->addWidget( m_iconLabel );
- hLayout->addWidget( m_titleLabel );
- hLayout->addWidget( new QLabel( i18n("Engines: "), this ) );
- hLayout->addWidget( m_engineBar );
- hLayout->addWidget( new TypeIconLabel(item.type, this) );
+ hLayout->addWidget(m_iconLabel);
+ hLayout->addWidget(m_titleLabel);
+ hLayout->addWidget(new QLabel(i18n("Engines: "), this));
+ hLayout->addWidget(m_engineBar);
+ hLayout->addWidget(new TypeIconLabel(item.type, this));
setLayout(hLayout);
-
+
connect(m_engineBar, SIGNAL(searchEngineChanged(KService::Ptr)), this, SLOT(changeSearchEngine(KService::Ptr)));
}
@@ -302,12 +302,12 @@ QString SearchListItem::searchItemTitle(QString engine, QString text)
void SearchListItem::changeSearchEngine(KService::Ptr engine)
{
- m_titleLabel->setText(searchItemTitle(engine->name(),m_text));
- m_iconLabel->setPixmap(Application::icon( KUrl(engine->property("Query").toString()) ).pixmap(16));
+ m_titleLabel->setText(searchItemTitle(engine->name(), m_text));
+ m_iconLabel->setPixmap(Application::icon(KUrl(engine->property("Query").toString())).pixmap(16));
m_url = SearchEngine::buildQuery(engine, m_text);
CompletionWidget *w = qobject_cast<CompletionWidget *>(parent());
- w->setCurrentEngine( engine );
+ w->setCurrentEngine(engine);
}
@@ -321,23 +321,23 @@ void SearchListItem::nextItemSubChoice()
EngineBar::EngineBar(KService::Ptr selectedEngine, QWidget *parent)
-: KToolBar(parent)
-{
- setIconSize(QSize(16,16));
+ : KToolBar(parent)
+{
+ setIconSize(QSize(16, 16));
setToolButtonStyle(Qt::ToolButtonIconOnly);
-
+
m_engineGroup = new QActionGroup(this);
m_engineGroup->setExclusive(true);
- m_engineGroup->addAction(newEngineAction(SearchEngine::defaultEngine(), selectedEngine));
+ m_engineGroup->addAction(newEngineAction(SearchEngine::defaultEngine(), selectedEngine));
foreach(KService::Ptr engine, SearchEngine::favorites())
{
- if(engine->desktopEntryName()!=SearchEngine::defaultEngine()->desktopEntryName())
+ if (engine->desktopEntryName() != SearchEngine::defaultEngine()->desktopEntryName())
{
m_engineGroup->addAction(newEngineAction(engine, selectedEngine));
}
}
-
+
addActions(m_engineGroup->actions());
}
@@ -347,7 +347,7 @@ KAction *EngineBar::newEngineAction(KService::Ptr engine, KService::Ptr selected
QString url = engine->property("Query").toString();
KAction *a = new KAction(Application::icon(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;
@@ -363,23 +363,23 @@ void EngineBar::changeSearchEngine()
void EngineBar::selectNextEngine()
{
- QList<QAction *> e = m_engineGroup->actions();
- int i = 0;
- while(i<e.count() && !e.at(i)->isChecked())
- {
- i++;
- }
-
- if (i+1 == e.count())
- {
- e.at(0)->setChecked(true);
- e.at(0)->trigger();
- }
- else
- {
- e.at(i+1)->setChecked(true);
- e.at(i+1)->trigger();
- }
+ QList<QAction *> e = m_engineGroup->actions();
+ int i = 0;
+ while (i < e.count() && !e.at(i)->isChecked())
+ {
+ i++;
+ }
+
+ if (i + 1 == e.count())
+ {
+ e.at(0)->setChecked(true);
+ e.at(0)->trigger();
+ }
+ else
+ {
+ e.at(i + 1)->setChecked(true);
+ e.at(i + 1)->trigger();
+ }
}
@@ -387,18 +387,18 @@ void EngineBar::selectNextEngine()
BrowseListItem::BrowseListItem(const UrlSearchItem &item, const QString &text, QWidget *parent)
- : ListItem(item, parent)
+ : ListItem(item, parent)
{
QString url = text;
-
+
kDebug() << text;
-
+
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setSpacing(4);
-
- hLayout->addWidget( new IconLabel(item.url.url(), this) );
- hLayout->addWidget( new TextLabel(item.url.url(), text, this) );
- hLayout->addWidget( new TypeIconLabel(item.type, this) );
+
+ hLayout->addWidget(new IconLabel(item.url.url(), this));
+ hLayout->addWidget(new TextLabel(item.url.url(), text, this));
+ hLayout->addWidget(new TypeIconLabel(item.type, this));
setLayout(hLayout);
}
@@ -410,14 +410,14 @@ BrowseListItem::BrowseListItem(const UrlSearchItem &item, const QString &text, Q
ListItem *ListItemFactory::create(const UrlSearchItem &item, const QString &text, QWidget *parent)
{
ListItem *newItem;
-
- if(item.type & UrlSearchItem::Browse)
+
+ if (item.type & UrlSearchItem::Browse)
{
newItem = new BrowseListItem(item, text, parent);
}
else
{
- if(item.type & UrlSearchItem::Search)
+ if (item.type & UrlSearchItem::Search)
{
newItem = new SearchListItem(item, text, parent);
}
@@ -426,6 +426,6 @@ ListItem *ListItemFactory::create(const UrlSearchItem &item, const QString &text
newItem = new PreviewListItem(item, text, parent);
}
}
-
+
return newItem;
}
diff --git a/src/urlbar/listitem.h b/src/urlbar/listitem.h
index c15ef3f9..7dc1af39 100644
--- a/src/urlbar/listitem.h
+++ b/src/urlbar/listitem.h
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -58,7 +58,7 @@ public:
void deactivate();
KUrl url();
-
+
public slots:
virtual void nextItemSubChoice();
@@ -66,14 +66,14 @@ signals:
void itemClicked(ListItem *item, Qt::MouseButton);
protected:
- virtual void paintEvent(QPaintEvent *event);
- virtual void enterEvent(QEvent *);
- virtual void leaveEvent(QEvent *);
- virtual void mousePressEvent(QMouseEvent *e);
+ virtual void paintEvent(QPaintEvent *event);
+ virtual void enterEvent(QEvent *);
+ virtual void leaveEvent(QEvent *);
+ virtual void mousePressEvent(QMouseEvent *e);
private:
- QStyleOptionViewItemV4 m_option;
-
+ QStyleOptionViewItemV4 m_option;
+
protected:
KUrl m_url;
};
@@ -85,7 +85,7 @@ protected:
class TypeIconLabel : public QLabel
{
Q_OBJECT
-
+
public:
TypeIconLabel(int type, QWidget *parent = 0);
@@ -112,7 +112,7 @@ public:
class TextLabel : public QLabel
{
Q_OBJECT
-
+
public:
TextLabel(const QString &text, const QString &textToPointOut = QString(), QWidget *parent = 0);
};
@@ -124,11 +124,11 @@ public:
class EngineBar : public KToolBar
{
Q_OBJECT
-
+
public:
EngineBar(KService::Ptr selectedEngine, QWidget *parent = 0);
void selectNextEngine();
-
+
signals:
void searchEngineChanged(KService::Ptr engine);
@@ -147,16 +147,16 @@ private:
class SearchListItem : public ListItem
{
Q_OBJECT
-
+
public:
SearchListItem(const UrlSearchItem &item, const QString &text, QWidget *parent = 0);
-
+
public slots:
virtual void nextItemSubChoice();
-
+
private slots:
void changeSearchEngine(KService::Ptr engine);
-
+
private:
QString searchItemTitle(QString engine, QString text);
@@ -174,7 +174,7 @@ private:
class PreviewListItem : public ListItem
{
Q_OBJECT
-
+
public:
PreviewListItem(const UrlSearchItem &item, const QString &text, QWidget *parent = 0);
};
@@ -186,7 +186,7 @@ public:
class PreviewLabel : public QLabel
{
Q_OBJECT
-
+
public:
PreviewLabel(const QString &url, int width, int height, QWidget *parent = 0);
};
@@ -198,7 +198,7 @@ public:
class BrowseListItem : public ListItem
{
Q_OBJECT
-
+
public:
BrowseListItem(const UrlSearchItem &item, const QString &text, QWidget *parent = 0);
};
diff --git a/src/urlbar/rsswidget.cpp b/src/urlbar/rsswidget.cpp
index 62275a84..5914b8c1 100644
--- a/src/urlbar/rsswidget.cpp
+++ b/src/urlbar/rsswidget.cpp
@@ -42,43 +42,43 @@
#include <KMessageBox>
-RSSWidget::RSSWidget(QMap< KUrl, QString > map, QWidget *parent)
+RSSWidget::RSSWidget(QMap< KUrl, QString > map, QWidget *parent)
: QFrame(parent, Qt::Popup)
, m_map(map)
{
setAttribute(Qt::WA_DeleteOnClose);
setFixedWidth(250);
setFrameStyle(Panel);
-
+
QFormLayout *layout = new QFormLayout(this);
setLayout(layout);
-
-
+
+
QLabel *agregator = new QLabel(this);
agregator->setText(i18n("Aggregator:"));
-
+
m_agregators = new KComboBox(this);
m_agregators->addItem(KIcon("application-rss+xml"), QString("Akregator"));
m_agregators->addItem(Application::icon(KUrl("http://google.com/reader")), i18n("Google Reader"));
-
+
layout->addRow(agregator, m_agregators);
-
-
+
+
QLabel *feed = new QLabel(this);
feed->setText(i18n("Feed:"));
-
+
m_feeds = new KComboBox(this);
foreach(QString title, m_map)
- m_feeds->addItem(title);
-
+ m_feeds->addItem(title);
+
layout->addRow(feed, m_feeds);
-
-
+
+
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
buttonBox->button(QDialogButtonBox::Ok)->setText(i18n("Add Feed"));
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accepted()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
-
+
layout->addWidget(buttonBox);
}
@@ -95,12 +95,12 @@ void RSSWidget::showAt(QPoint pos)
void RSSWidget::accepted()
{
QString url = m_map.key(m_feeds->currentText()).toMimeDataString();
-
- if(m_agregators->currentIndex() == 0)
+
+ if (m_agregators->currentIndex() == 0)
addWithAkregator(url);
else
addWithGoogleReader(url);
-
+
close();
}
@@ -115,15 +115,15 @@ void RSSWidget::addWithGoogleReader(QString url)
void RSSWidget::addWithAkregator(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 stream to akregator, Please add it manually :")
- + "<br /><br /> <a href=\"" + url + "\">" + url + "</a>"));
+ KMessageBox::error(0, QString(i18n("Could not add stream to akregator, Please add it manually :")
+ + "<br /><br /> <a href=\"" + url + "\">" + url + "</a>"));
}
}
// Akregator is not running
@@ -132,12 +132,12 @@ void RSSWidget::addWithAkregator(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>"));
+ 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/rsswidget.h b/src/urlbar/rsswidget.h
index 5c1ca736..253c20f2 100644
--- a/src/urlbar/rsswidget.h
+++ b/src/urlbar/rsswidget.h
@@ -31,22 +31,22 @@
class RSSWidget : public QFrame
{
Q_OBJECT
-
+
public:
// QMap< feedUrl, feedTitle>
RSSWidget(QMap<KUrl, QString> map, QWidget *parent);
-
+
void showAt(QPoint pos);
-
+
public slots:
void accepted();
-
+
private:
void addWithAkregator(QString url);
void addWithGoogleReader(QString url);
-
+
QMap<KUrl, QString> m_map;
-
+
KComboBox *m_agregators;
KComboBox *m_feeds;
};
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 90112600..34cbb9aa 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -13,9 +13,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -56,7 +56,7 @@
IconButton::IconButton(QWidget *parent)
- : QToolButton(parent)
+ : QToolButton(parent)
{
setToolButtonStyle(Qt::ToolButtonIconOnly);
setStyleSheet("IconButton { background-color:transparent; border: none; padding: 0px}");
@@ -72,13 +72,13 @@ void IconButton::mouseReleaseEvent(QMouseEvent* event)
UrlBar::UrlBar(QWidget *parent)
- : KLineEdit(parent)
- , _tab(0)
- , _privateMode(false)
- , _icon( new IconButton(this) )
+ : KLineEdit(parent)
+ , _tab(0)
+ , _privateMode(false)
+ , _icon(new IconButton(this))
{
// initial style
- setStyleSheet( QString("UrlBar { padding: 0 0 0 %1px;} ").arg(_icon->sizeHint().width()) );
+ setStyleSheet(QString("UrlBar { padding: 0 0 0 %1px;} ").arg(_icon->sizeHint().width()));
// cosmetic
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
@@ -87,25 +87,25 @@ UrlBar::UrlBar(QWidget *parent)
// doesn't show the clear button
setClearButtonShown(false);
-
+
// trap Key_Enter & Key_Return events, while emitting the returnPressed signal
setTrapReturnKey(true);
-
+
// insert decoded URLs
setUrlDropsEnabled(true);
// accept focus, via tabbing, clicking & wheeling
setFocusPolicy(Qt::WheelFocus);
-
+
// disable completion object (we have our own :) )
setCompletionObject(0);
-
+
_tab = qobject_cast<WebTab *>(parent);
-
+
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()));
-
+
// load typed urls
connect(this, SIGNAL(returnPressed(const QString &)), this, SLOT(loadTyped(const QString &)));
@@ -123,9 +123,9 @@ UrlBar::~UrlBar()
void UrlBar::setQUrl(const QUrl& url)
{
- if(url.scheme() == QL1S("about") )
+ if (url.scheme() == QL1S("about"))
{
- _icon->setIcon( KIcon("arrow-right") );
+ _icon->setIcon(KIcon("arrow-right"));
clear();
setFocus();
}
@@ -134,7 +134,7 @@ void UrlBar::setQUrl(const QUrl& url)
clearFocus();
KLineEdit::setUrl(url);
setCursorPosition(0);
- _icon->setIcon( Application::icon(url) );
+ _icon->setIcon(Application::icon(url));
}
}
@@ -142,7 +142,7 @@ void UrlBar::setQUrl(const QUrl& url)
void UrlBar::activated(const KUrl& url, Rekonq::OpenType type)
{
activateSuggestions(false);
-
+
clearFocus();
setUrl(url);
Application::instance()->loadUrl(url, type);
@@ -152,7 +152,7 @@ void UrlBar::activated(const KUrl& url, Rekonq::OpenType type)
void UrlBar::paintEvent(QPaintEvent *event)
{
QColor backgroundColor;
- if( _privateMode )
+ if (_privateMode)
{
backgroundColor = QColor(220, 220, 220); // light gray
}
@@ -160,43 +160,43 @@ void UrlBar::paintEvent(QPaintEvent *event)
{
backgroundColor = Application::palette().color(QPalette::Base);
}
-
+
// set background color of UrlBar
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 = QColor(255, 255, 171); // light yellow
}
p.setBrush(QPalette::Base, backgroundColor);
- }
- else
+ }
+ else
{
QColor loadingColor = QColor(116, 192, 250);
-
+
QLinearGradient gradient(0, 0, width(), 0);
gradient.setColorAt(0, loadingColor);
- gradient.setColorAt(((double)progr)/100, backgroundColor);
+ gradient.setColorAt(((double)progr) / 100, backgroundColor);
p.setBrush(QPalette::Base, gradient);
}
setPalette(p);
-
+
// you need this before our code to draw inside the line edit..
KLineEdit::paintEvent(event);
-
- if (text().isEmpty())
- {
+
+ if (text().isEmpty())
+ {
QStyleOptionFrame option;
initStyleOption(&option);
QRect textRect = style()->subElementRect(QStyle::SE_LineEditContents, &option, this);
QPainter painter(this);
painter.setPen(Qt::gray);
- painter.drawText( textRect,
- Qt::AlignCenter,
- i18n("Start typing here to search your bookmarks, history and the web...")
+ painter.drawText(textRect,
+ Qt::AlignCenter,
+ i18n("Start typing here to search your bookmarks, history and the web...")
);
}
}
@@ -207,7 +207,7 @@ void UrlBar::keyPressEvent(QKeyEvent *event)
// this handles the Modifiers + Return key combinations
QString currentText = text().trimmed();
if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
- && !currentText.startsWith(QLatin1String("http://"), Qt::CaseInsensitive))
+ && !currentText.startsWith(QLatin1String("http://"), Qt::CaseInsensitive))
{
QString append;
if (event->modifiers() == Qt::ControlModifier)
@@ -232,7 +232,7 @@ void UrlBar::keyPressEvent(QKeyEvent *event)
setText(url.toString());
}
}
-
+
if (event->key() == Qt::Key_Escape)
{
clearFocus();
@@ -246,7 +246,7 @@ void UrlBar::keyPressEvent(QKeyEvent *event)
void UrlBar::focusInEvent(QFocusEvent *event)
{
activateSuggestions(true);
-
+
KLineEdit::focusInEvent(event);
}
@@ -266,36 +266,36 @@ void UrlBar::dropEvent(QDropEvent *event)
void UrlBar::loadFinished()
{
- if(_tab->progress() != 0)
+ if (_tab->progress() != 0)
return;
-
- if(_tab->url().scheme() == QL1S("about") )
+
+ if (_tab->url().scheme() == QL1S("about"))
{
update();
return;
}
-
+
// show KGet downloads??
- if(ReKonfig::kgetList())
+ if (ReKonfig::kgetList())
{
IconButton *bt = addRightIcon(UrlBar::KGet);
connect(bt, SIGNAL(clicked(QPoint)), _tab->page(), SLOT(downloadAllContentsWithKGet()));
}
-
+
// 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()));
}
-
+
update();
}
@@ -308,9 +308,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());
@@ -337,31 +337,31 @@ void UrlBar::mouseDoubleClickEvent(QMouseEvent *)
IconButton *UrlBar::addRightIcon(UrlBar::icon ic)
{
IconButton *rightIcon = new IconButton(this);
-
- switch(ic)
+
+ switch (ic)
{
case UrlBar::KGet:
- rightIcon->setIcon( KIcon("download") );
- rightIcon->setToolTip( i18n("List all links with KGet") );
+ rightIcon->setIcon(KIcon("download"));
+ rightIcon->setToolTip(i18n("List all links with KGet"));
break;
case UrlBar::RSS:
- rightIcon->setIcon( KIcon("application-rss+xml") );
- rightIcon->setToolTip( i18n("List all available RSS feeds") );
+ rightIcon->setIcon(KIcon("application-rss+xml"));
+ rightIcon->setToolTip(i18n("List all available RSS feeds"));
break;
case UrlBar::SSL:
- rightIcon->setIcon( KIcon("object-locked") );
- rightIcon->setToolTip( i18n("Show SSL Infos") );
+ rightIcon->setIcon(KIcon("object-locked"));
+ rightIcon->setToolTip(i18n("Show SSL Infos"));
break;
default:
kDebug() << "ERROR.. default non extant case!!";
break;
}
-
+
_rightIconsList << rightIcon;
int iconsCount = _rightIconsList.count();
- rightIcon->move( width() - 23*iconsCount, 6);
+ rightIcon->move(width() - 23*iconsCount, 6);
rightIcon->show();
-
+
return rightIcon;
}
@@ -375,16 +375,16 @@ void UrlBar::clearRightIcons()
void UrlBar::resizeEvent(QResizeEvent *event)
{
- int newHeight = ( height() - 19 )/2;
- _icon->move(4, newHeight );
-
+ int newHeight = (height() - 19) / 2;
+ _icon->move(4, newHeight);
+
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);
diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h
index 91b38e23..2c1e7f23 100644
--- a/src/urlbar/urlbar.h
+++ b/src/urlbar/urlbar.h
@@ -13,9 +13,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -76,11 +76,11 @@ class REKONQ_TESTS_EXPORT UrlBar : public KLineEdit
public:
enum icon
- {
+ {
KGet = 0x00000001,
RSS = 0x00000010,
SSL = 0x00000100,
- };
+ };
explicit UrlBar(QWidget *parent = 0);
~UrlBar();
@@ -105,9 +105,9 @@ protected:
void resizeEvent(QResizeEvent *);
private:
- IconButton *addRightIcon(UrlBar::icon );
+ IconButton *addRightIcon(UrlBar::icon);
void activateSuggestions(bool);
-
+
QWeakPointer<CompletionWidget> _box;
WebTab *_tab;
bool _privateMode;
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp
index b53b6b42..d3683282 100644
--- a/src/urlbar/urlresolver.cpp
+++ b/src/urlbar/urlresolver.cpp
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -58,13 +58,13 @@
bool UrlSearchItem::operator==(UrlSearchItem i)
-{
- return url==i.url;
+{
+ return url == i.url;
}
UrlResolver::UrlResolver(const QString &typedUrl)
- : _typedString(typedUrl.trimmed())
+ : _typedString(typedUrl.trimmed())
{
}
@@ -72,61 +72,61 @@ UrlResolver::UrlResolver(const QString &typedUrl)
UrlSearchList UrlResolver::orderedSearchItems()
{
// NOTE: the logic here is : "we wanna suggest (at least) 9 elements"
- // so we have (more or less) 3 from first results (1 from QUrl Resolutions, 2 from
+ // so we have (more or less) 3 from first results (1 from QUrl Resolutions, 2 from
// default search engines).
// There are 6 remaining: if bookmarkResults + historyResults <= 6, catch all, else
// catch first 3 results from the two resulting lists :)
-
+
UrlSearchList list;
-
+
// if(isHttp())
// {
// list << qurlFromUserInputResolution();
// }
- list << qurlFromUserInputResolution();
+ list << qurlFromUserInputResolution();
list << webSearchesResolution();
if (_typedString.length() >= 2)
- {
+ {
int firstResults = list.count();
int checkPoint = 9 - firstResults;
-
+
UrlSearchList historyList = historyResolution();
int historyResults = historyList.count();
UrlSearchList bookmarksList = bookmarksResolution();
int bookmarkResults = bookmarksList.count();
- if(historyResults + bookmarkResults > checkPoint)
+ if (historyResults + bookmarkResults > checkPoint)
{
- historyList = historyList.mid(0,3);
- bookmarksList = bookmarksList.mid(0,3);
+ historyList = historyList.mid(0, 3);
+ bookmarksList = bookmarksList.mid(0, 3);
}
-
+
QList<UrlSearchItem> common;
-
- foreach (UrlSearchItem i, historyList)
+
+ foreach(UrlSearchItem i, historyList)
{
if (!bookmarksList.contains(i))
{
list << i;
}
- else
+ else
{
i.type |= UrlSearchItem::Bookmark;
common << i;
}
}
-
- foreach (UrlSearchItem i, common)
+
+ foreach(UrlSearchItem i, common)
{
- list << i;
+ list << i;
}
-
- foreach (UrlSearchItem i, bookmarksList)
+
+ foreach(UrlSearchItem i, bookmarksList)
{
- if (!common.contains(i))
+ if (!common.contains(i))
list << i;
}
}
@@ -138,23 +138,23 @@ UrlSearchList UrlResolver::orderedSearchItems()
bool UrlResolver::isHttp()
{
QString ipv4 = "^0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])"\
- "\\.0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])";
-
+ "\\.0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])";
+
QString ipv6 = "^([0-9a-fA-F]{4}|0)(\\:([0-9a-fA-F]{4}|0)){7}";
-
+
QString address = "[\\d\\w-.]+\\.(a[cdefgilmnoqrstuwz]|b[abdefghijmnorstvwyz]|"\
- "c[acdfghiklmnoruvxyz]|d[ejkmnoz]|e[ceghrst]|f[ijkmnor]|g[abdefghilmnpqrstuwy]|"\
- "h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|"\
- "m[acdghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eouw]|"\
- "s[abcdeghijklmnortuvyz]|t[cdfghjkmnoprtvwz]|u[augkmsyz]|v[aceginu]|w[fs]|"\
- "y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|mil|museum|name|net|org|"\
- "pro)";
-
- return _typedString.startsWith("http://")
- || _typedString.startsWith("https://")
- || (QRegExp(address, Qt::CaseInsensitive).indexIn(_typedString) != -1)
- || (QRegExp(ipv4, Qt::CaseInsensitive).indexIn(_typedString) != -1)
- || (QRegExp(ipv6, Qt::CaseInsensitive).indexIn(_typedString) != -1);
+ "c[acdfghiklmnoruvxyz]|d[ejkmnoz]|e[ceghrst]|f[ijkmnor]|g[abdefghilmnpqrstuwy]|"\
+ "h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|"\
+ "m[acdghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eouw]|"\
+ "s[abcdeghijklmnortuvyz]|t[cdfghjkmnoprtvwz]|u[augkmsyz]|v[aceginu]|w[fs]|"\
+ "y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|mil|museum|name|net|org|"\
+ "pro)";
+
+ return _typedString.startsWith("http://")
+ || _typedString.startsWith("https://")
+ || (QRegExp(address, Qt::CaseInsensitive).indexIn(_typedString) != -1)
+ || (QRegExp(ipv4, Qt::CaseInsensitive).indexIn(_typedString) != -1)
+ || (QRegExp(ipv6, Qt::CaseInsensitive).indexIn(_typedString) != -1);
}
@@ -168,7 +168,7 @@ UrlSearchList UrlResolver::qurlFromUserInputResolution()
UrlSearchList list;
QString url2 = _typedString;
QUrl urlFromUserInput = QUrl::fromUserInput(url2);
- if(urlFromUserInput.isValid())
+ if (urlFromUserInput.isValid())
{
QString gTitle = i18nc("Browse a website", "Browse");
UrlSearchItem gItem(UrlSearchItem::Browse, urlFromUserInput, gTitle);
@@ -190,7 +190,7 @@ UrlSearchList UrlResolver::webSearchesResolution()
UrlSearchList UrlResolver::historyResolution()
{
UrlSearchList list;
-
+
KCompletion *historyCompletion = Application::historyManager()->completionObject();
QStringList historyResults = historyCompletion->substringCompletion(_typedString);
Q_FOREACH(const QString &s, historyResults)
@@ -207,7 +207,7 @@ UrlSearchList UrlResolver::historyResolution()
UrlSearchList UrlResolver::bookmarksResolution()
{
UrlSearchList list;
-
+
KCompletion *bookmarkCompletion = Application::bookmarkProvider()->completionObject();
QStringList bookmarkResults = bookmarkCompletion->substringCompletion(_typedString);
Q_FOREACH(const QString &s, bookmarkResults)
diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h
index 5200a401..482f8809 100644
--- a/src/urlbar/urlresolver.h
+++ b/src/urlbar/urlresolver.h
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -38,21 +38,21 @@
class UrlSearchItem
{
public:
-
- enum types
- {
+
+ enum types
+ {
Search = 0x00000001,
Browse = 0x00000010,
History = 0x00000100,
Bookmark = 0x00001000,
- };
+ };
int type;
KUrl url;
QString title;
UrlSearchItem(const int &_type, const KUrl &_url, const QString &_title = QString())
- : type(_type), url(_url), title(_title)
+ : type(_type), url(_url), title(_title)
{};
bool operator==(UrlSearchItem i);
@@ -68,7 +68,7 @@ class UrlResolver
{
public:
UrlResolver(const QString &typedUrl);
-
+
UrlSearchList orderedSearchItems();
private:
diff --git a/src/walletbar.cpp b/src/walletbar.cpp
index 5b911585..292e48bd 100644
--- a/src/walletbar.cpp
+++ b/src/walletbar.cpp
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -43,8 +43,8 @@
WalletBar::WalletBar(QWidget *parent)
- : QWidget(parent)
- , m_label( new QLabel(this) )
+ : QWidget(parent)
+ , m_label(new QLabel(this))
{
m_label->setWordWrap(true);
@@ -60,15 +60,15 @@ WalletBar::WalletBar(QWidget *parent)
connect(rememberButton, SIGNAL(clicked()), this, SLOT(rememberData()));
connect(neverHereButton, SIGNAL(clicked()), this, SLOT(neverRememberData()));
connect(notNowButton, SIGNAL(clicked()), this, SLOT(notNowRememberData()));
-
+
// layout
QGridLayout *layout = new QGridLayout(this);
- layout->addWidget(closeButton,0,0);
- layout->addWidget(m_label,0,1);
- layout->addWidget(rememberButton,0,2);
- layout->addWidget(neverHereButton,0,3);
- layout->addWidget(notNowButton,0,4);
- layout->setColumnStretch(1,100);
+ layout->addWidget(closeButton, 0, 0);
+ layout->addWidget(m_label, 0, 1);
+ layout->addWidget(rememberButton, 0, 2);
+ layout->addWidget(neverHereButton, 0, 3);
+ layout->addWidget(notNowButton, 0, 4);
+ layout->setColumnStretch(1, 100);
setLayout(layout);
}
@@ -89,17 +89,17 @@ void WalletBar::rememberData()
void WalletBar::neverRememberData()
{
// add url to the blacklist
- QStringList list = ReKonfig::walletBlackList();
+ QStringList list = ReKonfig::walletBlackList();
list << m_url.toString();
- ReKonfig::setWalletBlackList( list );
-
+ ReKonfig::setWalletBlackList(list);
+
notNowRememberData();
}
void WalletBar::notNowRememberData()
{
- emit saveFormDataRejected (m_key);
+ emit saveFormDataRejected(m_key);
destroy();
}
@@ -116,7 +116,7 @@ void WalletBar::destroy()
void WalletBar::onSaveFormData(const QString &key, const QUrl &url)
{
- m_label->setText( i18n("Do you want rekonq to remember the password on %1?", url.host() ) );
+ m_label->setText(i18n("Do you want rekonq to remember the password on %1?", url.host()));
m_key = key;
m_url = url;
diff --git a/src/walletbar.h b/src/walletbar.h
index efb28a8f..14efb235 100644
--- a/src/walletbar.h
+++ b/src/walletbar.h
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -47,7 +47,7 @@ public:
~WalletBar();
private slots:
-
+
void rememberData();
void neverRememberData();
void notNowRememberData();
@@ -55,7 +55,7 @@ private slots:
public slots:
void onSaveFormData(const QString &, const QUrl &);
-signals:
+signals:
void saveFormDataAccepted(const QString &);
void saveFormDataRejected(const QString &);
diff --git a/src/webinspectorpanel.cpp b/src/webinspectorpanel.cpp
index 6f8e48a0..b260eb6b 100644
--- a/src/webinspectorpanel.cpp
+++ b/src/webinspectorpanel.cpp
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -41,23 +41,23 @@
#include <QWebInspector>
-WebInspectorPanel::WebInspectorPanel(QString title, QWidget *parent)
- : QDockWidget(title, parent)
+WebInspectorPanel::WebInspectorPanel(QString title, QWidget *parent)
+ : QDockWidget(title, parent)
{
setObjectName("webInspectorDock");
- setWidget( new QWebInspector(this) );
+ setWidget(new QWebInspector(this));
}
-
-void WebInspectorPanel::closeEvent(QCloseEvent *event)
-{
+
+void WebInspectorPanel::closeEvent(QCloseEvent *event)
+{
Q_UNUSED(event);
toggle(false);
}
MainWindow* WebInspectorPanel::mainWindow()
-{
+{
return qobject_cast< MainWindow* >(parentWidget());
}
@@ -79,8 +79,8 @@ void WebInspectorPanel::toggle(bool enable)
}
-void WebInspectorPanel::changeCurrentPage()
-{
+void WebInspectorPanel::changeCurrentPage()
+{
bool enable = mainWindow()->currentTab()->view()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled);
toggle(enable);
}
diff --git a/src/webinspectorpanel.h b/src/webinspectorpanel.h
index bb196b5c..581a54fa 100644
--- a/src/webinspectorpanel.h
+++ b/src/webinspectorpanel.h
@@ -10,9 +10,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -46,16 +46,16 @@ class REKONQ_TESTS_EXPORT WebInspectorPanel : public QDockWidget
Q_OBJECT
public:
WebInspectorPanel(QString title, QWidget *parent);
-
+
public slots:
void toggle(bool enable);
- void changeCurrentPage();
-
+ void changeCurrentPage();
+
protected:
virtual void closeEvent(QCloseEvent *event);
-
+
MainWindow *mainWindow();
-
+
};
#endif
diff --git a/src/webpage.cpp b/src/webpage.cpp
index ed2ca298..37a04abe 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -15,9 +15,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -104,7 +104,7 @@ static bool domainSchemeMatch(const QUrl& u1, const QUrl& u2)
WebPage::WebPage(QWidget *parent)
- : KWebPage(parent, KWalletIntegration)
+ : KWebPage(parent, KWalletIntegration)
{
// ----- handling unsupported content...
setForwardUnsupportedContent(true);
@@ -113,24 +113,24 @@ WebPage::WebPage(QWidget *parent)
// ----- rekonq Network Manager
NetworkAccessManager *manager = new NetworkAccessManager(this);
manager->setCache(0); // disable QtWebKit cache to just use KIO one..
-
+
// set cookieJar window ID..
if (parent && parent->window())
manager->setCookieJarWindowId(parent->window()->winId());
setNetworkAccessManager(manager);
-
+
// activate ssl warnings
setSessionMetaData("ssl_activate_warnings", "TRUE");
-
+
// Override the 'Accept' header sent by QtWebKit which favors XML over HTML!
// Setting the accept meta-data to null will force kio_http to use its own
// default settings for this header.
setSessionMetaData(QL1S("accept"), QString());
-
+
// ----- Web Plugin Factory
setPluginFactory(new WebPluginFactory(this));
-
+
// ----- last stuffs
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(manageNetworkErrors(QNetworkReply*)));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
@@ -149,59 +149,59 @@ WebPage::~WebPage()
bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
{
_loadingUrl = request.url();
-
+
KIO::AccessManager *manager = qobject_cast<KIO::AccessManager*>(networkAccessManager());
KIO::MetaData metaData = manager->requestMetaData();
-
+
// Get the SSL information sent, if any...
- if( metaData.contains(QL1S("ssl_in_use")) )
+ if (metaData.contains(QL1S("ssl_in_use")))
{
WebSslInfo info;
info.fromMetaData(metaData.toVariant());
info.setUrl(request.url());
_sslInfo = info;
}
-
- if(frame)
+
+ if (frame)
{
- if ( _protHandler.preHandling(request, frame) )
+ if (_protHandler.preHandling(request, frame))
{
return false;
}
-
- switch (type)
+
+ switch (type)
{
case QWebPage::NavigationTypeLinkClicked:
- if (_sslInfo.isValid() )
+ if (_sslInfo.isValid())
{
setRequestMetaData("ssl_was_in_use", "TRUE");
}
break;
-
+
case QWebPage::NavigationTypeFormSubmitted:
break;
-
+
case QWebPage::NavigationTypeFormResubmitted:
- if( KMessageBox::warningContinueCancel(view(),
- i18n("Are you sure you want to send your data again?"),
- i18n("Resend form data")
+ if (KMessageBox::warningContinueCancel(view(),
+ i18n("Are you sure you want to send your data again?"),
+ i18n("Resend form data")
)
- == KMessageBox::Cancel)
+ == KMessageBox::Cancel)
{
- return false;
+ return false;
}
break;
-
+
case QWebPage::NavigationTypeReload:
case QWebPage::NavigationTypeBackOrForward:
case QWebPage::NavigationTypeOther:
break;
-
+
default:
break;
- }
-
- if(frame == mainFrame())
+ }
+
+ if (frame == mainFrame())
{
setRequestMetaData("main_frame_request", "TRUE");
}
@@ -223,7 +223,7 @@ WebPage *WebPage::createWindow(QWebPage::WebWindowType type)
kDebug() << "Modal Dialog";
WebTab *w = 0;
- if(ReKonfig::openTabNoWindow())
+ if (ReKonfig::openTabNoWindow())
{
w = Application::instance()->mainWindow()->mainView()->newWebTab(!ReKonfig::openTabsBack(), ReKonfig::openTabsNearCurrent());
}
@@ -239,52 +239,52 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)
{
// NOTE
// This is probably needed just in ONE stupid case..
- if( _protHandler.postHandling(reply->request(), mainFrame()) )
+ if (_protHandler.postHandling(reply->request(), mainFrame()))
return;
-
+
if (reply->error() == QNetworkReply::NoError)
{
- const KUrl url( reply->url() );
+ const KUrl url(reply->url());
QString mimeType = reply->header(QNetworkRequest::ContentTypeHeader).toString();
KService::Ptr appService = KMimeTypeTrader::self()->preferredService(mimeType);
bool isLocal = url.isLocalFile();
-
- if( appService.isNull() ) // no service can handle this. We can just download it..
+
+ if (appService.isNull()) // no service can handle this. We can just download it..
{
kDebug() << "no service can handle this. We can just download it..";
-
- isLocal
- ? KMessageBox::sorry(view(), i18n("No service can handle this :(") )
- : downloadRequest( reply->request() );
-
+
+ isLocal
+ ? KMessageBox::sorry(view(), i18n("No service can handle this :("))
+ : downloadRequest(reply->request());
+
return;
}
- if(!isLocal)
+ if (!isLocal)
{
-
+
KParts::BrowserOpenOrSaveQuestion dlg(Application::instance()->mainWindow(), url, mimeType);
- switch ( dlg.askEmbedOrSave() )
+ switch (dlg.askEmbedOrSave())
{
- case KParts::BrowserOpenOrSaveQuestion::Save:
- kDebug() << "service handling: download!";
- downloadRequest( reply->request() );
- return;
-
- case KParts::BrowserOpenOrSaveQuestion::Cancel:
- return;
-
- default: // non extant case
- break;
+ case KParts::BrowserOpenOrSaveQuestion::Save:
+ kDebug() << "service handling: download!";
+ downloadRequest(reply->request());
+ return;
+
+ case KParts::BrowserOpenOrSaveQuestion::Cancel:
+ return;
+
+ default: // non extant case
+ break;
}
}
-
+
// case KParts::BrowserRun::Embed
-
- KService::List partServices = KMimeTypeTrader::self()->query( mimeType, QL1S("KParts/ReadOnlyPart") );
- if(partServices.count() > 0)
+
+ KService::List partServices = KMimeTypeTrader::self()->query(mimeType, QL1S("KParts/ReadOnlyPart"));
+ if (partServices.count() > 0)
{
// A part can handle this. Embed it!
QString html;
@@ -296,20 +296,20 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)
html += "<style type=\"text/css\">";
html += "* { border: 0; padding: 0; margin: 0; }";
html += "</style>";
- html += "</head>";
+ html += "</head>";
html += "<body>";
html += "<embed src=\"" + url.pathOrUrl() + "\" width=\"100%\" height=\"100%\" />";
html += "</body>";
html += "</html>";
-
+
mainFrame()->setHtml(html, url);
}
else
{
// No parts, just app services. Load it!
- KRun::run(*appService, url, 0);
+ KRun::run(*appService, url, 0);
}
-
+
return;
}
}
@@ -318,15 +318,15 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)
void WebPage::loadFinished(bool ok)
{
Q_UNUSED(ok);
-
+
Application::adblockManager()->applyHidingRules(this);
-
+
QStringList list = ReKonfig::walletBlackList();
-
+
// KWallet Integration
- if ( wallet()
- && !list.contains( mainFrame()->url().toString() )
- )
+ if (wallet()
+ && !list.contains(mainFrame()->url().toString())
+ )
{
wallet()->fillFormData(mainFrame());
}
@@ -339,23 +339,23 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)
QWebFrame* frame = qobject_cast<QWebFrame *>(reply->request().originatingObject());
const bool isMainFrameRequest = (frame == mainFrame());
-
- if ( isMainFrameRequest
- && _sslInfo.isValid()
- && !domainSchemeMatch(reply->url(), _sslInfo.url())
- )
+
+ if (isMainFrameRequest
+ && _sslInfo.isValid()
+ && !domainSchemeMatch(reply->url(), _sslInfo.url())
+ )
{
//kDebug() << "Reseting cached SSL info...";
_sslInfo = WebSslInfo();
}
-
- // NOTE: These are not all networkreply errors,
+
+ // NOTE: These are not all networkreply errors,
// but just that supported directly by KIO
- switch( reply->error() )
+ switch (reply->error())
{
-
+
case QNetworkReply::NoError: // no error. Simple :)
- if ( isMainFrameRequest && !_sslInfo.isValid() )
+ if (isMainFrameRequest && !_sslInfo.isValid())
{
// Obtain and set the SSL information if any...
_sslInfo.fromMetaData(reply->attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)));
@@ -368,9 +368,9 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)
break;
case QNetworkReply::UnknownNetworkError: // unknown network-related error detected
- if( _protHandler.postHandling(reply->request(), mainFrame()) )
+ if (_protHandler.postHandling(reply->request(), mainFrame()))
break;
-
+
case QNetworkReply::ConnectionRefusedError: // remote server refused connection
case QNetworkReply::HostNotFoundError: // invalid hostname
case QNetworkReply::TimeoutError: // connection time out
@@ -381,8 +381,8 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)
case QNetworkReply::ProtocolUnknownError: // Unknown protocol
case QNetworkReply::ProtocolInvalidOperationError: // requested operation is invalid for this protocol
- if(reply->url() == _loadingUrl)
- mainFrame()->setHtml( errorPage(reply), reply->url() );
+ if (reply->url() == _loadingUrl)
+ mainFrame()->setHtml(errorPage(reply), reply->url());
break;
default:
@@ -405,11 +405,11 @@ QString WebPage::errorPage(QNetworkReply *reply)
return QString("Couldn't open the rekonqinfo.html file");
}
- QString title = i18n("Error loading: %1", reply->url().path());
- QString urlString = reply->url().toString( QUrl::RemoveUserInfo | QUrl::RemoveQuery );
-
- QString iconPath = QString("file://") + KIconLoader::global()->iconPath( "dialog-warning" , KIconLoader::Small );
- iconPath.replace( QL1S("16"), QL1S("128") );
+ QString title = i18n("Error loading: %1", reply->url().path());
+ QString urlString = reply->url().toString(QUrl::RemoveUserInfo | QUrl::RemoveQuery);
+
+ QString iconPath = QString("file://") + KIconLoader::global()->iconPath("dialog-warning" , KIconLoader::Small);
+ iconPath.replace(QL1S("16"), QL1S("128"));
QString msg;
msg += "<table>";
@@ -417,9 +417,9 @@ QString WebPage::errorPage(QNetworkReply *reply)
msg += "<img src=\"" + iconPath + "\" />";
msg += "</td><td>";
msg += "<h1>" + reply->errorString() + "</h1>";
- msg += "<h2>" + i18nc("%1=an URL, e.g.'kde.org'", "When connecting to: <b>%1</b>", urlString ) + "</h2>";
+ msg += "<h2>" + i18nc("%1=an URL, e.g.'kde.org'", "When connecting to: <b>%1</b>", urlString) + "</h2>";
msg += "</td></tr></table>";
-
+
msg += "<ul><li>" + i18n("Check the address for errors such as <b>ww</b>.kde.org instead of <b>www</b>.kde.org");
msg += "</li><li>" + i18n("If the address is correct, try to check the network connection.") + "</li><li>" ;
msg += i18n("If your computer or network is protected by a firewall or proxy, make sure that rekonq is permitted to access the network.");
@@ -427,11 +427,11 @@ QString WebPage::errorPage(QNetworkReply *reply)
msg += "</li></ul><br/><br/>";
msg += "<input type=\"button\" id=\"reloadButton\" onClick=\"document.location.href='" + urlString + "';\" value=\"";
msg += i18n("Try Again") + "\" />";
-
+
QString html = QString(QLatin1String(file.readAll()))
- .arg(title)
- .arg(msg)
- ;
+ .arg(title)
+ .arg(msg)
+ ;
return html;
}
@@ -442,99 +442,99 @@ QString WebPage::errorPage(QNetworkReply *reply)
// feel free to let us know about :)
void WebPage::downloadRequest(const QNetworkRequest &request)
{
- KUrl destUrl;
- KUrl srcUrl (request.url());
- int result = KIO::R_OVERWRITE;
-
- do
- {
- destUrl = KFileDialog::getSaveFileName(srcUrl.fileName(), QString(), view());
-
- if (destUrl.isLocalFile())
- {
- QFileInfo finfo( destUrl.toLocalFile() );
- if ( finfo.exists() )
- {
- QDateTime now = QDateTime::currentDateTime();
- QPointer<KIO::RenameDialog> dlg = new KIO::RenameDialog( view(),
- i18n("Overwrite File?"),
- srcUrl,
- destUrl,
- KIO::RenameDialog_Mode(KIO::M_OVERWRITE | KIO::M_SKIP),
- -1,
- finfo.size(),
- now.toTime_t(),
- finfo.created().toTime_t(),
- now.toTime_t(),
- finfo.lastModified().toTime_t()
- );
+ KUrl destUrl;
+ KUrl srcUrl(request.url());
+ int result = KIO::R_OVERWRITE;
+
+ do
+ {
+ destUrl = KFileDialog::getSaveFileName(srcUrl.fileName(), QString(), view());
+
+ if (destUrl.isLocalFile())
+ {
+ QFileInfo finfo(destUrl.toLocalFile());
+ if (finfo.exists())
+ {
+ QDateTime now = QDateTime::currentDateTime();
+ QPointer<KIO::RenameDialog> dlg = new KIO::RenameDialog(view(),
+ i18n("Overwrite File?"),
+ srcUrl,
+ destUrl,
+ KIO::RenameDialog_Mode(KIO::M_OVERWRITE | KIO::M_SKIP),
+ -1,
+ finfo.size(),
+ now.toTime_t(),
+ finfo.created().toTime_t(),
+ now.toTime_t(),
+ finfo.lastModified().toTime_t()
+ );
result = dlg->exec();
- delete dlg;
- }
- }
- }
- while ( result == KIO::R_CANCEL && destUrl.isValid() );
-
- if ( result == KIO::R_OVERWRITE && destUrl.isValid() )
- {
+ delete dlg;
+ }
+ }
+ }
+ while (result == KIO::R_CANCEL && destUrl.isValid());
+
+ if (result == KIO::R_OVERWRITE && destUrl.isValid())
+ {
// now store data
// now, destUrl, srcUrl
- Application::historyManager()->addDownload( srcUrl.pathOrUrl() , destUrl.pathOrUrl() );
-
- if ( ReKonfig::kgetDownload() )
+ Application::historyManager()->addDownload(srcUrl.pathOrUrl() , destUrl.pathOrUrl());
+
+ if (ReKonfig::kgetDownload())
{
//KGet integration:
- if(!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kget"))
+ if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kget"))
{
KToolInvocation::kdeinitExecWait("kget");
}
QDBusInterface kget("org.kde.kget", "/KGet", "org.kde.kget.main");
- if( kget.isValid() )
+ if (kget.isValid())
{
kget.call("addTransfer", srcUrl.prettyUrl(), destUrl.prettyUrl(), true);
return;
}
}
-
+
// else, use KIO or fallback to it
- KIO::Job *job = KIO::file_copy(srcUrl, destUrl, -1, KIO::Overwrite);
- QVariant attr = request.attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData));
- if (attr.isValid() && attr.type() == QVariant::Map)
- job->setMetaData(KIO::MetaData(attr.toMap()));
-
- job->addMetaData(QL1S("MaxCacheSize"), QL1S("0")); // Don't store in http cache.
- job->addMetaData(QL1S("cache"), QL1S("cache")); // Use entry from cache if available.
+ KIO::Job *job = KIO::file_copy(srcUrl, destUrl, -1, KIO::Overwrite);
+ QVariant attr = request.attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData));
+ if (attr.isValid() && attr.type() == QVariant::Map)
+ job->setMetaData(KIO::MetaData(attr.toMap()));
+
+ job->addMetaData(QL1S("MaxCacheSize"), QL1S("0")); // Don't store in http cache.
+ job->addMetaData(QL1S("cache"), QL1S("cache")); // Use entry from cache if available.
job->uiDelegate()->setAutoErrorHandlingEnabled(true);
- }
+ }
}
void WebPage::downloadAllContentsWithKGet()
{
QSet<QString> contents;
- KUrl baseUrl( currentFrame()->url() );
+ KUrl baseUrl(currentFrame()->url());
KUrl relativeUrl;
QWebElementCollection images = mainFrame()->documentElement().findAll("img");
foreach(QWebElement img, images)
{
- relativeUrl.setEncodedUrl(img.attribute("src").toUtf8(),KUrl::TolerantMode);
+ relativeUrl.setEncodedUrl(img.attribute("src").toUtf8(), KUrl::TolerantMode);
contents << baseUrl.resolved(relativeUrl).toString();
}
-
+
QWebElementCollection links = mainFrame()->documentElement().findAll("a");
foreach(QWebElement link, links)
{
- relativeUrl.setEncodedUrl(link.attribute("href").toUtf8(),KUrl::TolerantMode);
+ relativeUrl.setEncodedUrl(link.attribute("href").toUtf8(), KUrl::TolerantMode);
contents << baseUrl.resolved(relativeUrl).toString();
}
-
- if(!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kget"))
+
+ if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kget"))
{
KToolInvocation::kdeinitExecWait("kget");
}
QDBusInterface kget("org.kde.kget", "/KGet", "org.kde.kget.main");
- if( kget.isValid() )
+ if (kget.isValid())
{
kget.call("importLinks", QVariant(contents.toList()));
}
@@ -543,37 +543,37 @@ void WebPage::downloadAllContentsWithKGet()
void WebPage::showSSLInfo()
{
- if (_sslInfo.isValid())
+ if (_sslInfo.isValid())
{
- QPointer<KSslInfoDialog> dlg = new KSslInfoDialog ( view() );
- dlg->setSslInfo( _sslInfo.certificateChain(),
- _sslInfo.peerAddress().toString(),
- mainFrame()->url().host(),
- _sslInfo.protocol(),
- _sslInfo.ciphers(),
- _sslInfo.usedChiperBits(),
- _sslInfo.supportedChiperBits(),
- KSslInfoDialog::errorsFromString( _sslInfo.certificateErrors() )
- );
+ QPointer<KSslInfoDialog> dlg = new KSslInfoDialog(view());
+ dlg->setSslInfo(_sslInfo.certificateChain(),
+ _sslInfo.peerAddress().toString(),
+ mainFrame()->url().host(),
+ _sslInfo.protocol(),
+ _sslInfo.ciphers(),
+ _sslInfo.usedChiperBits(),
+ _sslInfo.supportedChiperBits(),
+ KSslInfoDialog::errorsFromString(_sslInfo.certificateErrors())
+ );
dlg->exec();
delete dlg;
-
+
return;
}
-
- if( mainFrame()->url().scheme() == QL1S("https") )
+
+ if (mainFrame()->url().scheme() == QL1S("https"))
{
- KMessageBox::error( view(),
- i18n("The SSL information for this site appears to be corrupt."),
- i18nc("Secure Sockets Layer", "SSL")
- );
+ KMessageBox::error(view(),
+ i18n("The SSL information for this site appears to be corrupt."),
+ i18nc("Secure Sockets Layer", "SSL")
+ );
}
else
{
- KMessageBox::information( view(),
- i18n("This site doesn't contain SSL information."),
- i18nc("Secure Sockets Layer", "SSL")
+ KMessageBox::information(view(),
+ i18n("This site doesn't contain SSL information."),
+ i18nc("Secure Sockets Layer", "SSL")
);
}
}
@@ -583,9 +583,9 @@ void WebPage::showSSLInfo()
void WebPage::updateImage(bool ok)
{
- if(ok)
+ if (ok)
{
- NewTabPage p( mainFrame() );
+ NewTabPage p(mainFrame());
p.snapFinished();
}
}
diff --git a/src/webpage.h b/src/webpage.h
index cd86813c..3c9b51fe 100644
--- a/src/webpage.h
+++ b/src/webpage.h
@@ -15,9 +15,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -64,11 +64,11 @@ public slots:
protected:
WebPage *createWindow(WebWindowType type);
-
- virtual bool acceptNavigationRequest(QWebFrame *frame,
- const QNetworkRequest &request,
+
+ virtual bool acceptNavigationRequest(QWebFrame *frame,
+ const QNetworkRequest &request,
NavigationType type);
-
+
private slots:
void handleUnsupportedContent(QNetworkReply *reply);
void manageNetworkErrors(QNetworkReply *reply);
@@ -79,7 +79,7 @@ private slots:
private:
QString errorPage(QNetworkReply *);
QUrl _loadingUrl;
-
+
ProtocolHandler _protHandler;
WebSslInfo _sslInfo;
};
diff --git a/src/webpluginfactory.cpp b/src/webpluginfactory.cpp
index 79a36aa0..334403c3 100644
--- a/src/webpluginfactory.cpp
+++ b/src/webpluginfactory.cpp
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -40,8 +40,8 @@
WebPluginFactory::WebPluginFactory(QObject *parent)
- : KWebPluginFactory(parent)
- , _loadClickToFlash(false)
+ : KWebPluginFactory(parent)
+ , _loadClickToFlash(false)
{
connect(this, SIGNAL(signalLoadClickToFlash(bool)), SLOT(setLoadClickToFlash(bool)));
}
@@ -59,18 +59,18 @@ QObject *WebPluginFactory::create(const QString &mimeType,
const QStringList &argumentValues) const
{
kDebug() << "loading mimeType: " << mimeType;
-
- switch( ReKonfig::pluginsEnabled() )
+
+ switch (ReKonfig::pluginsEnabled())
{
case 0:
kDebug() << "No plugins found for" << mimeType << ". Falling back to KDEWebKit ones...";
return KWebPluginFactory::create(mimeType, url, argumentNames, argumentValues);
-
+
case 1:
- if( mimeType != QString("application/x-shockwave-flash") )
+ if (mimeType != QString("application/x-shockwave-flash"))
break;
-
- if( _loadClickToFlash )
+
+ if (_loadClickToFlash)
{
emit signalLoadClickToFlash(false);
return 0; //KWebPluginFactory::create(mimeType, url, argumentNames, argumentValues);
@@ -82,14 +82,14 @@ QObject *WebPluginFactory::create(const QString &mimeType,
return ctf;
}
break;
-
+
case 2:
return 0;
-
+
default:
kDebug() << "oh oh.. this should NEVER happen..";
break;
}
-
+
return KWebPluginFactory::create(mimeType, url, argumentNames, argumentValues);
}
diff --git a/src/webpluginfactory.h b/src/webpluginfactory.h
index 85122d56..f5de51d6 100644
--- a/src/webpluginfactory.h
+++ b/src/webpluginfactory.h
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -42,7 +42,7 @@
class REKONQ_TESTS_EXPORT WebPluginFactory : public KWebPluginFactory
{
-Q_OBJECT
+ Q_OBJECT
public:
WebPluginFactory(QObject *parent);
@@ -54,10 +54,10 @@ public:
signals:
void signalLoadClickToFlash(bool) const;
-
+
public slots:
void setLoadClickToFlash(bool load);
-
+
private:
/**
When true, force loading of next flash animation (don't show clicktoflash)
diff --git a/src/websnap.cpp b/src/websnap.cpp
index af52b592..6923e5d8 100644
--- a/src/websnap.cpp
+++ b/src/websnap.cpp
@@ -12,9 +12,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -47,54 +47,54 @@
WebSnap::WebSnap(const KUrl& url, QObject *parent)
- : QObject(parent)
- , m_url(url)
+ : QObject(parent)
+ , m_url(url)
{
// this to not register websnap history
m_page.settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
-
+
// this to not let this page open other windows
m_page.settings()->setAttribute(QWebSettings::PluginsEnabled, false);
m_page.settings()->setAttribute(QWebSettings::JavascriptEnabled, false);
connect(&m_page, SIGNAL(loadFinished(bool)), this, SLOT(saveResult(bool)));
-
+
QTimer::singleShot(0, this, SLOT(load()));
}
-
+
void WebSnap::load()
{
m_page.mainFrame()->load(m_url);
}
-// NOTE please, be careful modifying this.
+// NOTE please, be careful modifying this.
// You are playing with fire..
QPixmap WebSnap::renderPreview(const QWebPage &page, int w, int h)
{
// NOTE
// it seems no way to enable/disable scrollbars in new QtWebKit's
// and this is affecting tabbed browsing
-
+
// prepare page
QSize oldSize = page.viewportSize();
// page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
// page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
-
+
// find the best size
QSize size;
int width = page.mainFrame()->contentsSize().width();
- if (width < 640)
+ if (width < 640)
{
width = 640;
}
- size = QSize(width,width*((0.0+h)/w));
+ size = QSize(width, width * ((0.0 + h) / w));
page.setViewportSize(size);
-
+
// create the page image
QImage pageImage = QImage(size, QImage::Format_ARGB32_Premultiplied);
pageImage.fill(Qt::transparent);
-
+
// render it
QPainter p(&pageImage);
page.mainFrame()->render(&p);
@@ -105,24 +105,24 @@ QPixmap WebSnap::renderPreview(const QWebPage &page, int w, int h)
// page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAsNeeded);
// page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded);
page.setViewportSize(oldSize);
-
+
QPixmap pm = QPixmap::fromImage(pageImage);
- KUrl url( page.mainFrame()->url() );
+ KUrl url(page.mainFrame()->url());
kDebug() << "saving preview";
-
+
QString path = imagePathFromUrl(url);
- QFile::remove( path );
- pm.save( path );
-
+ QFile::remove(path);
+ pm.save(path);
+
return pm;
}
QString WebSnap::imagePathFromUrl(const KUrl &url)
{
- QUrl temp = QUrl( url.url() );
- QString name = temp.toString( QUrl::RemoveScheme | QUrl::RemoveUserInfo | QUrl::StripTrailingSlash );
-
+ QUrl temp = QUrl(url.url());
+ QString name = temp.toString(QUrl::RemoveScheme | QUrl::RemoveUserInfo | QUrl::StripTrailingSlash);
+
// TODO learn Regular Expressions :)
// and implement something better here..
name.remove('/');
@@ -133,29 +133,29 @@ QString WebSnap::imagePathFromUrl(const KUrl &url)
name.remove('?');
name.remove('=');
name.remove('+');
-
+
return KStandardDirs::locateLocal("cache", QString("thumbs/") + name + ".png", true);
}
void WebSnap::saveResult(bool ok)
{
- if (ok)
+ if (ok)
{
QPixmap image = renderPreview(m_page, WIDTH, HEIGHT);
- QString path = imagePathFromUrl( m_url);
- QFile::remove( path );
- image.save( path );
+ QString path = imagePathFromUrl(m_url);
+ QFile::remove(path);
+ image.save(path);
}
emit snapDone(ok);
kDebug() << "SAVE RESULTS: " << ok << " URL: " << m_url;
-
+
this->deleteLater();
}
bool WebSnap::existsImage(const KUrl &u)
{
- return QFile::exists( imagePathFromUrl(u) );
+ return QFile::exists(imagePathFromUrl(u));
}
diff --git a/src/websnap.h b/src/websnap.h
index c77c0dc8..b5629702 100644
--- a/src/websnap.h
+++ b/src/websnap.h
@@ -12,9 +12,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -46,7 +46,7 @@
/**
- * This class is used in many classes of rekonq to produce an image
+ * This class is used in many classes of rekonq to produce an image
* based on the site corresponding to the url passed as argument.
* It also cached the images to not retrieve them every time :)
*
@@ -73,7 +73,7 @@ public:
* @param parent the object parent
*/
WebSnap(const KUrl &url, QObject *parent = 0);
-
+
/**
* Snaps a pixmap of size w * h from a page and save it to cache
*
@@ -83,7 +83,7 @@ public:
*
* @return the pixmap snapped from the page
*/
- static QPixmap renderPreview(const QWebPage &page, int w = WIDTH, int h = HEIGHT);
+ static QPixmap renderPreview(const QWebPage &page, int w = WIDTH, int h = HEIGHT);
/**
* Guess the local path where the image for the url provided
@@ -94,21 +94,21 @@ public:
* @return the local path of the url snap
*/
static QString imagePathFromUrl(const KUrl &url);
-
+
/**
* Determines if a snap exists for that url
*
*/
static bool existsImage(const KUrl &url);
-
+
private slots:
void saveResult(bool ok = true);
void load();
signals:
void snapDone(bool ok);
-
+
private:
QWebPage m_page;
KUrl m_url;
diff --git a/src/websslinfo.cpp b/src/websslinfo.cpp
index ffc4918f..35112504 100644
--- a/src/websslinfo.cpp
+++ b/src/websslinfo.cpp
@@ -28,184 +28,187 @@
class WebSslInfo::WebSslInfoPrivate
{
public:
- WebSslInfoPrivate()
- : usedCipherBits(0), supportedCipherBits(0) {}
-
- QUrl url;
- QString ciphers;
- QString protocol;
- QString certErrors;
- QHostAddress peerAddress;
- QHostAddress parentAddress;
- QList<QSslCertificate> certificateChain;
-
- int usedCipherBits;
- int supportedCipherBits;
+ WebSslInfoPrivate()
+ : usedCipherBits(0), supportedCipherBits(0) {}
+
+ QUrl url;
+ QString ciphers;
+ QString protocol;
+ QString certErrors;
+ QHostAddress peerAddress;
+ QHostAddress parentAddress;
+ QList<QSslCertificate> certificateChain;
+
+ int usedCipherBits;
+ int supportedCipherBits;
};
WebSslInfo::WebSslInfo()
- :d(new WebSslInfo::WebSslInfoPrivate)
+ : d(new WebSslInfo::WebSslInfoPrivate)
{
}
WebSslInfo::WebSslInfo(const WebSslInfo& other)
- :d(new WebSslInfo::WebSslInfoPrivate)
+ : d(new WebSslInfo::WebSslInfoPrivate)
{
- *this = other;
+ *this = other;
}
WebSslInfo::~WebSslInfo()
{
- delete d;
- d = 0;
+ delete d;
+ d = 0;
}
bool WebSslInfo::isValid() const
{
- return !d->peerAddress.isNull();
+ return !d->peerAddress.isNull();
}
QUrl WebSslInfo::url() const
{
- return d->url;
+ return d->url;
}
QHostAddress WebSslInfo::parentAddress() const
{
- return d->parentAddress;
+ return d->parentAddress;
}
QHostAddress WebSslInfo::peerAddress() const
{
- return d->peerAddress;
+ return d->peerAddress;
}
QString WebSslInfo::protocol() const
{
- return d->protocol;
+ return d->protocol;
}
QString WebSslInfo::ciphers() const
{
- return d->ciphers;
+ return d->ciphers;
}
QString WebSslInfo::certificateErrors() const
{
- return d->certErrors;
+ return d->certErrors;
}
-int WebSslInfo::supportedChiperBits () const
+int WebSslInfo::supportedChiperBits() const
{
- return d->supportedCipherBits;
+ return d->supportedCipherBits;
}
-int WebSslInfo::usedChiperBits () const
+int WebSslInfo::usedChiperBits() const
{
- return d->usedCipherBits;
+ return d->usedCipherBits;
}
QList<QSslCertificate> WebSslInfo::certificateChain() const
{
- return d->certificateChain;
+ return d->certificateChain;
}
-WebSslInfo& WebSslInfo::operator=(const WebSslInfo& other)
+WebSslInfo& WebSslInfo::operator=(const WebSslInfo & other)
{
- d->ciphers = other.d->ciphers;
- d->protocol = other.d->protocol;
- d->certErrors = other.d->certErrors;
- d->peerAddress = other.d->peerAddress;
- d->parentAddress = other.d->parentAddress;
- d->certificateChain = other.d->certificateChain;
+ d->ciphers = other.d->ciphers;
+ d->protocol = other.d->protocol;
+ d->certErrors = other.d->certErrors;
+ d->peerAddress = other.d->peerAddress;
+ d->parentAddress = other.d->parentAddress;
+ d->certificateChain = other.d->certificateChain;
- d->usedCipherBits = other.d->usedCipherBits;
- d->supportedCipherBits = other.d->supportedCipherBits;
- d->url = other.d->url;
+ d->usedCipherBits = other.d->usedCipherBits;
+ d->supportedCipherBits = other.d->supportedCipherBits;
+ d->url = other.d->url;
- return *this;
+ return *this;
}
QVariant WebSslInfo::toMetaData() const
{
- if (isValid()) {
- QMap<QString, QVariant> data;
- data.insert("ssl_in_use", true);
- data.insert("ssl_peer_ip", d->peerAddress.toString());
- data.insert("ssl_parent_ip", d->parentAddress.toString());
- data.insert("ssl_protocol_version", d->protocol);
- data.insert("ssl_cipher", d->ciphers);
- data.insert("ssl_cert_errors", d->certErrors);
- data.insert("ssl_cipher_used_bits", d->usedCipherBits);
- data.insert("ssl_cipher_bits", d->supportedCipherBits);
- QByteArray certChain;
- Q_FOREACH(const QSslCertificate& cert, d->certificateChain)
+ if (isValid())
+ {
+ QMap<QString, QVariant> data;
+ data.insert("ssl_in_use", true);
+ data.insert("ssl_peer_ip", d->peerAddress.toString());
+ data.insert("ssl_parent_ip", d->parentAddress.toString());
+ data.insert("ssl_protocol_version", d->protocol);
+ data.insert("ssl_cipher", d->ciphers);
+ data.insert("ssl_cert_errors", d->certErrors);
+ data.insert("ssl_cipher_used_bits", d->usedCipherBits);
+ data.insert("ssl_cipher_bits", d->supportedCipherBits);
+ QByteArray certChain;
+ Q_FOREACH(const QSslCertificate& cert, d->certificateChain)
certChain += cert.toPem();
- data.insert("ssl_peer_chain", certChain);
- return data;
- }
+ data.insert("ssl_peer_chain", certChain);
+ return data;
+ }
- return QVariant();
+ return QVariant();
}
void WebSslInfo::fromMetaData(const QVariant& value)
{
- if (value.isValid() && value.type() == QVariant::Map) {
- QMap<QString,QVariant> metaData = value.toMap();
- if (metaData.value("ssl_in_use", false).toBool()) {
- setCertificateChain(metaData.value("ssl_peer_chain").toByteArray());
- setPeerAddress(metaData.value("ssl_peer_ip").toString());
- setParentAddress(metaData.value("ssl_parent_ip").toString());
- setProtocol(metaData.value("ssl_protocol_version").toString());
- setCiphers(metaData.value("ssl_cipher").toString());
- setCertificateErrors(metaData.value("ssl_cert_errors").toString());
- setUsedCipherBits(metaData.value("ssl_cipher_used_bits").toString());
- setSupportedCipherBits(metaData.value("ssl_cipher_bits").toString());
+ if (value.isValid() && value.type() == QVariant::Map)
+ {
+ QMap<QString, QVariant> metaData = value.toMap();
+ if (metaData.value("ssl_in_use", false).toBool())
+ {
+ setCertificateChain(metaData.value("ssl_peer_chain").toByteArray());
+ setPeerAddress(metaData.value("ssl_peer_ip").toString());
+ setParentAddress(metaData.value("ssl_parent_ip").toString());
+ setProtocol(metaData.value("ssl_protocol_version").toString());
+ setCiphers(metaData.value("ssl_cipher").toString());
+ setCertificateErrors(metaData.value("ssl_cert_errors").toString());
+ setUsedCipherBits(metaData.value("ssl_cipher_used_bits").toString());
+ setSupportedCipherBits(metaData.value("ssl_cipher_bits").toString());
+ }
}
- }
}
-void WebSslInfo::setUrl (const QUrl &url)
+void WebSslInfo::setUrl(const QUrl &url)
{
- d->url = url;
+ d->url = url;
}
void WebSslInfo::setPeerAddress(const QString& address)
{
- d->peerAddress = address;
+ d->peerAddress = address;
}
void WebSslInfo::setParentAddress(const QString& address)
{
- d->parentAddress = address;
+ d->parentAddress = address;
}
void WebSslInfo::setProtocol(const QString& protocol)
{
- d->protocol = protocol;
+ d->protocol = protocol;
}
void WebSslInfo::setCertificateChain(const QByteArray& chain)
{
- d->certificateChain = QSslCertificate::fromData(chain);
+ d->certificateChain = QSslCertificate::fromData(chain);
}
void WebSslInfo::setCiphers(const QString& ciphers)
{
- d->ciphers = ciphers;
+ d->ciphers = ciphers;
}
void WebSslInfo::setUsedCipherBits(const QString& bits)
{
- d->usedCipherBits = bits.toInt();
+ d->usedCipherBits = bits.toInt();
}
void WebSslInfo::setSupportedCipherBits(const QString& bits)
{
- d->supportedCipherBits = bits.toInt();
+ d->supportedCipherBits = bits.toInt();
}
void WebSslInfo::setCertificateErrors(const QString& certErrors)
{
- d->certErrors = certErrors;
+ d->certErrors = certErrors;
}
diff --git a/src/websslinfo.h b/src/websslinfo.h
index 433cf053..4ac708cc 100644
--- a/src/websslinfo.h
+++ b/src/websslinfo.h
@@ -34,40 +34,40 @@
class WebSslInfo
{
public:
- WebSslInfo();
- WebSslInfo(const WebSslInfo&);
- virtual ~WebSslInfo();
+ WebSslInfo();
+ WebSslInfo(const WebSslInfo&);
+ virtual ~WebSslInfo();
- bool isValid() const;
- QUrl url() const;
- QHostAddress peerAddress() const;
- QHostAddress parentAddress() const;
- QString ciphers() const;
- QString protocol() const;
- QString certificateErrors() const;
- int supportedChiperBits () const;
- int usedChiperBits () const;
- QList<QSslCertificate> certificateChain() const;
+ bool isValid() const;
+ QUrl url() const;
+ QHostAddress peerAddress() const;
+ QHostAddress parentAddress() const;
+ QString ciphers() const;
+ QString protocol() const;
+ QString certificateErrors() const;
+ int supportedChiperBits() const;
+ int usedChiperBits() const;
+ QList<QSslCertificate> certificateChain() const;
- QVariant toMetaData() const;
- void fromMetaData (const QVariant &);
+ QVariant toMetaData() const;
+ void fromMetaData(const QVariant &);
- void setUrl (const QUrl &url);
- WebSslInfo& operator = (const WebSslInfo&);
+ void setUrl(const QUrl &url);
+ WebSslInfo& operator = (const WebSslInfo&);
protected:
- void setCiphers(const QString& ciphers);
- void setProtocol(const QString& protocol);
- void setPeerAddress(const QString& address);
- void setParentAddress(const QString& address);
- void setCertificateChain(const QByteArray& chain);
- void setCertificateErrors(const QString& certErrors);
- void setUsedCipherBits(const QString& bits);
- void setSupportedCipherBits(const QString& bits);
+ void setCiphers(const QString& ciphers);
+ void setProtocol(const QString& protocol);
+ void setPeerAddress(const QString& address);
+ void setParentAddress(const QString& address);
+ void setCertificateChain(const QByteArray& chain);
+ void setCertificateErrors(const QString& certErrors);
+ void setUsedCipherBits(const QString& bits);
+ void setSupportedCipherBits(const QString& bits);
private:
- class WebSslInfoPrivate;
- WebSslInfoPrivate* d;
+ class WebSslInfoPrivate;
+ WebSslInfoPrivate* d;
};
#endif // WEBSSLINFO_H
diff --git a/src/webtab.cpp b/src/webtab.cpp
index 7687a957..1b0eef5e 100644
--- a/src/webtab.cpp
+++ b/src/webtab.cpp
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -66,8 +66,8 @@
WebTab::WebTab(QWidget *parent)
- : QWidget(parent)
- , m_progress(0)
+ : QWidget(parent)
+ , m_progress(0)
{
QVBoxLayout *l = new QVBoxLayout(this);
l->setMargin(0);
@@ -75,7 +75,7 @@ WebTab::WebTab(QWidget *parent)
QWidget *messageBar = new QWidget(this);
l->addWidget(messageBar);
- messageBar->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
+ messageBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
QVBoxLayout *l2 = new QVBoxLayout(messageBar);
l2->setMargin(0);
@@ -86,11 +86,11 @@ WebTab::WebTab(QWidget *parent)
view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// fix focus handling
- setFocusProxy( view );
+ setFocusProxy(view);
KWebWallet *wallet = view->page()->wallet();
-
- if(wallet)
+
+ if (wallet)
{
connect(wallet, SIGNAL(saveFormDataRequested(const QString &, const QUrl &)),
this, SLOT(createWalletBar(const QString &, const QUrl &)));
@@ -108,7 +108,7 @@ WebTab::~WebTab()
WebView *WebTab::view()
{
- WebView *view = qobject_cast<WebView *>( layout()->itemAt(1)->widget() );
+ WebView *view = qobject_cast<WebView *>(layout()->itemAt(1)->widget());
return view;
}
@@ -119,26 +119,26 @@ WebPage *WebTab::page()
}
-// TODO:
-// Import the "about" check and the one in protocolhandler
+// TODO:
+// Import the "about" check and the one in protocolhandler
// in some (static?) methods in NewTabPage
-KUrl WebTab::url()
+KUrl WebTab::url()
{
- KUrl u = KUrl( view()->url() );
- if( u.scheme() == QL1S("about") )
+ KUrl u = KUrl(view()->url());
+ if (u.scheme() == QL1S("about"))
{
QWebElement rootElement = page()->mainFrame()->documentElement();
- if( rootElement.document().findAll("#rekonq-newtabpage").count() == 0 )
+ if (rootElement.document().findAll("#rekonq-newtabpage").count() == 0)
return u;
- if( rootElement.findAll(".favorites").count() > 0 )
+ if (rootElement.findAll(".favorites").count() > 0)
return KUrl("about:favorites");
- if( rootElement.findAll(".closedTabs").count() > 0 )
+ if (rootElement.findAll(".closedTabs").count() > 0)
return KUrl("about:closedTabs");
- if( rootElement.findAll(".history").count() > 0 )
+ if (rootElement.findAll(".history").count() > 0)
return KUrl("about:history");
- if( rootElement.findAll(".bookmarks").count() > 0 )
+ if (rootElement.findAll(".bookmarks").count() > 0)
return KUrl("about:bookmarks");
- if( rootElement.findAll(".downloads").count() > 0 )
+ if (rootElement.findAll(".downloads").count() > 0)
return KUrl("about:downloads");
}
return u;
@@ -168,14 +168,14 @@ void WebTab::createWalletBar(const QString &key, const QUrl &url)
// check if the url is in the wallet blacklist
QString urlString = url.toString();
QStringList blackList = ReKonfig::walletBlackList();
- if( blackList.contains( urlString ) )
+ if (blackList.contains(urlString))
return;
-
+
KWebWallet *wallet = page()->wallet();
QWidget *messageBar = layout()->itemAt(0)->widget();
WalletBar *walletBar = new WalletBar(messageBar);
- walletBar->onSaveFormData(key,url);
+ walletBar->onSaveFormData(key, url);
messageBar->layout()->addWidget(walletBar);
connect(walletBar, SIGNAL(saveFormDataAccepted(const QString &)),
@@ -190,7 +190,7 @@ void WebTab::createPreviewSelectorBar(int index)
QWidget *messageBar = layout()->itemAt(0)->widget();
PreviewSelectorBar *bar = new PreviewSelectorBar(index, messageBar);
messageBar->layout()->addWidget(bar);
-
+
connect(page(), SIGNAL(loadStarted()), bar, SLOT(loadProgress()));
connect(page(), SIGNAL(loadProgress(int)), bar, SLOT(loadProgress()));
connect(page(), SIGNAL(loadFinished(bool)), bar, SLOT(loadFinished()));
@@ -202,9 +202,9 @@ bool WebTab::hasRSSInfo()
{
QWebElementCollection col = page()->mainFrame()->findAllElements("link[type=\"application/rss+xml\"]");
col.append(page()->mainFrame()->findAllElements("link[type=\"application/atom+xml\"]"));
- if(col.count() != 0)
+ if (col.count() != 0)
return true;
-
+
return false;
}
@@ -213,33 +213,33 @@ void WebTab::showRSSInfo(QPoint pos)
{
QWebElementCollection col = page()->mainFrame()->findAllElements("link[type=\"application/rss+xml\"]");
col.append(page()->mainFrame()->findAllElements("link[type=\"application/atom+xml\"]"));
-
+
QMap<KUrl, QString> map;
int i = 0;
foreach(QWebElement el, col)
{
QString urlString;
- if( el.attribute("href").startsWith( QL1S("http") ) )
+ if (el.attribute("href").startsWith(QL1S("http")))
urlString = el.attribute("href");
else
{
KUrl u = url();
// NOTE
- // cd() is probably better than setPath() here,
+ // cd() is probably better than setPath() here,
// for all those url sites just having a path
- if(u.cd( el.attribute("href") ))
- urlString = u.toMimeDataString();
+ if (u.cd(el.attribute("href")))
+ urlString = u.toMimeDataString();
}
-
+
QString title = el.attribute("title");
- if(title.isEmpty())
- title= el.attribute("href");
-
+ if (title.isEmpty())
+ title = el.attribute("href");
+
map.insert(KUrl(urlString), title);
-
+
i++;
}
-
- RSSWidget *widget = new RSSWidget(map, window());
+
+ RSSWidget *widget = new RSSWidget(map, window());
widget->showAt(pos);
}
diff --git a/src/webtab.h b/src/webtab.h
index e3a8258a..1f8aa204 100644
--- a/src/webtab.h
+++ b/src/webtab.h
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -59,14 +59,14 @@ public:
void createPreviewSelectorBar(int index);
bool hasRSSInfo();
-
+
private slots:
void updateProgress(int progress);
void loadFinished(bool);
void createWalletBar(const QString &, const QUrl &);
void showRSSInfo(QPoint pos);
-
+
private:
int m_progress;
};
diff --git a/src/webview.cpp b/src/webview.cpp
index 78fd2eaa..4d470a40 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -62,29 +62,29 @@
WebView::WebView(QWidget* parent)
- : KWebView(parent, false)
- , _mousePos( QPoint(0,0) )
- , _scrollTimer( new QTimer(this) )
- , _VScrollSpeed(0)
- , _HScrollSpeed(0)
- , _canEnableAutoScroll(true)
- , _isAutoScrollEnabled(false)
+ : KWebView(parent, false)
+ , _mousePos(QPoint(0, 0))
+ , _scrollTimer(new QTimer(this))
+ , _VScrollSpeed(0)
+ , _HScrollSpeed(0)
+ , _canEnableAutoScroll(true)
+ , _isAutoScrollEnabled(false)
{
WebPage *page = new WebPage(this);
setPage(page);
// download system
- connect(this, SIGNAL(linkShiftClicked(const KUrl &)),
+ connect(this, SIGNAL(linkShiftClicked(const KUrl &)),
page, SLOT(downloadUrl(const KUrl &)));
- connect(page, SIGNAL(downloadRequested(const QNetworkRequest &)),
+ connect(page, SIGNAL(downloadRequested(const QNetworkRequest &)),
page, SLOT(downloadRequest(const QNetworkRequest &)));
-
+
// middle click || ctrl + click signal
- connect(this, SIGNAL(linkMiddleOrCtrlClicked(const KUrl &)),
- this, SLOT(loadUrlInNewTab(const KUrl &)) );
+ connect(this, SIGNAL(linkMiddleOrCtrlClicked(const KUrl &)),
+ this, SLOT(loadUrlInNewTab(const KUrl &)));
// loadUrl signal
- connect(this, SIGNAL(loadUrl(const KUrl &, const Rekonq::OpenType &)),
+ connect(this, SIGNAL(loadUrl(const KUrl &, const Rekonq::OpenType &)),
Application::instance(), SLOT(loadUrl(const KUrl &, const Rekonq::OpenType &)));
// scrolling timer
@@ -96,13 +96,13 @@ WebView::WebView(QWidget* parent)
WebView::~WebView()
{
delete _scrollTimer;
- disconnect();
+ disconnect();
}
WebPage *WebView::page()
{
- WebPage *page = qobject_cast<WebPage *>( KWebView::page() );
+ WebPage *page = qobject_cast<WebPage *>(KWebView::page());
return page;
}
@@ -129,7 +129,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewWindow()));
menu.addAction(a);
- menu.addAction(pageAction(KWebPage::DownloadLinkToDisk));
+ menu.addAction(pageAction(KWebPage::DownloadLinkToDisk));
menu.addAction(pageAction(KWebPage::CopyLinkToClipboard));
menu.addSeparator();
}
@@ -142,10 +142,10 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
}
// is content selected) Add COPY
- if(result.isContentSelected())
+ if (result.isContentSelected())
{
a = pageAction(KWebPage::Copy);
- if(!result.linkUrl().isEmpty())
+ if (!result.linkUrl().isEmpty())
a->setText(i18n("Copy Text")); //for link
else
a->setText(i18n("Copy"));
@@ -153,23 +153,23 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
}
// is content editable? Add PASTE
- if(result.isContentEditable())
+ if (result.isContentEditable())
{
menu.addAction(pageAction(KWebPage::Paste));
}
// is content selected? Add SEARCH actions
- if(result.isContentSelected())
+ if (result.isContentSelected())
{
KActionMenu *searchMenu = new KActionMenu(KIcon("edit-find"), i18n("Search with"), this);
foreach(KService::Ptr engine, SearchEngine::favorites())
{
- a = new KAction(engine->name(), this);
- a->setIcon( Application::icon( SearchEngine::buildQuery(engine,"")) );
- a->setData(engine->entryPath());
- connect(a, SIGNAL(triggered(bool)), this, SLOT(search()));
- searchMenu->addAction(a);
+ a = new KAction(engine->name(), this);
+ a->setIcon(Application::icon(SearchEngine::buildQuery(engine, "")));
+ a->setData(engine->entryPath());
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(search()));
+ searchMenu->addAction(a);
}
if (!searchMenu->menu()->isEmpty())
@@ -178,7 +178,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
}
menu.addSeparator();
- // TODO Add translate, show translation
+ // TODO Add translate, show translation
}
// is an image?
@@ -186,7 +186,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
{
menu.addSeparator();
- // TODO remove copy_this_image action
+ // TODO remove copy_this_image action
a = new KAction(KIcon("view-media-visualization"), i18n("&View Image"), this);
a->setData(result.imageUrl());
connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(viewImage(Qt::MouseButtons, Qt::KeyboardModifiers)));
@@ -198,13 +198,13 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
}
// Open url text in new tab/window
- if(result.linkUrl().isEmpty())
+ if (result.linkUrl().isEmpty())
{
- QString text = selectedText();
- if (text.startsWith( QLatin1String("http://") )
- || text.startsWith( QLatin1String("https://") )
- || text.startsWith( QLatin1String("www.") )
+ QString text = selectedText();
+ if (text.startsWith(QLatin1String("http://"))
+ || text.startsWith(QLatin1String("https://"))
+ || text.startsWith(QLatin1String("www."))
)
{
QString truncatedURL = text;
@@ -237,23 +237,23 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
// navigation
QWebHistory *history = page()->history();
- if(history->canGoBack())
+ if (history->canGoBack())
{
menu.addAction(pageAction(KWebPage::Back));
}
- if(history->canGoForward())
+ if (history->canGoForward())
{
menu.addAction(pageAction(KWebPage::Forward));
}
menu.addAction(mainwindow->actionByName("view_redisplay"));
- if( result.pixmap().isNull() )
+ if (result.pixmap().isNull())
{
menu.addSeparator();
- menu.addAction(mainwindow->actionByName("new_tab"));
+ menu.addAction(mainwindow->actionByName("new_tab"));
menu.addAction(mainwindow->actionByName("new_window"));
menu.addSeparator();
@@ -263,14 +263,14 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
frameMenu->addAction(pageAction(KWebPage::OpenFrameInNewWindow));
- a = new KAction( KIcon("document-print-frame"), i18n("Print Frame"), this);
+ a = new KAction(KIcon("document-print-frame"), i18n("Print Frame"), this);
connect(a, SIGNAL(triggered()), this, SLOT(printFrame()));
frameMenu->addAction(a);
menu.addAction(frameMenu);
-
+
menu.addSeparator();
-
+
// Page Actions
menu.addAction(pageAction(KWebPage::SelectAll));
@@ -284,16 +284,16 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
}
menu.addAction(mainwindow->actionByName("page_source"));
-
- a = new KAction( KIcon("layer-visible-on"), i18n("Inspect Element"), this);
+
+ a = new KAction(KIcon("layer-visible-on"), i18n("Inspect Element"), this);
connect(a, SIGNAL(triggered(bool)), this, SLOT(inspect()));
menu.addAction(a);
-
+
a = Application::bookmarkProvider()->actionByName("rekonq_add_bookmark");
menu.addAction(a);
}
- if(mainwindow->isFullScreen())
+ if (mainwindow->isFullScreen())
{
menu.addSeparator();
menu.addAction(mainwindow->actionByName("fullscreen"));
@@ -306,7 +306,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
void WebView::mousePressEvent(QMouseEvent *event)
{
- if(_isAutoScrollEnabled)
+ if (_isAutoScrollEnabled)
{
setCursor(Qt::ArrowCursor);
_VScrollSpeed = 0;
@@ -315,30 +315,30 @@ void WebView::mousePressEvent(QMouseEvent *event)
_isAutoScrollEnabled = false;
return;
}
-
- QWebHitTestResult result = page()->mainFrame()->hitTestContent( event->pos() );
+
+ QWebHitTestResult result = page()->mainFrame()->hitTestContent(event->pos());
_canEnableAutoScroll = !result.isContentEditable() && result.linkUrl().isEmpty();
-
- switch(event->button())
+
+ switch (event->button())
{
- case Qt::XButton1:
+ case Qt::XButton1:
triggerPageAction(KWebPage::Back);
break;
-
- case Qt::XButton2:
+
+ case Qt::XButton2:
triggerPageAction(KWebPage::Forward);
break;
-
- case Qt::MidButton:
- if(_canEnableAutoScroll && !_isAutoScrollEnabled)
+
+ case Qt::MidButton:
+ if (_canEnableAutoScroll && !_isAutoScrollEnabled)
{
- setCursor( KIcon("transform-move").pixmap(32) );
+ setCursor(KIcon("transform-move").pixmap(32));
_clickPos = event->pos();
_isAutoScrollEnabled = true;
}
break;
-
- default:
+
+ default:
break;
};
KWebView::mousePressEvent(event);
@@ -348,27 +348,27 @@ void WebView::mousePressEvent(QMouseEvent *event)
void WebView::mouseMoveEvent(QMouseEvent *event)
{
_mousePos = event->pos();
-
- if(_isAutoScrollEnabled)
+
+ if (_isAutoScrollEnabled)
{
QPoint r = _mousePos - _clickPos;
_HScrollSpeed = r.x() / 2; // you are too fast..
_VScrollSpeed = r.y() / 2;
- if( !_scrollTimer->isActive() )
- _scrollTimer->start();
-
+ if (!_scrollTimer->isActive())
+ _scrollTimer->start();
+
return;
}
-
+
if (Application::instance()->mainWindow()->isFullScreen())
- {
- if (event->pos().y()>=0 && event->pos().y()<=4)
+ {
+ if (event->pos().y() >= 0 && event->pos().y() <= 4)
{
- Application::instance()->mainWindow()->setWidgetsVisible(true);
+ Application::instance()->mainWindow()->setWidgetsVisible(true);
}
else
{
- Application::instance()->mainWindow()->setWidgetsVisible(false);
+ Application::instance()->mainWindow()->setWidgetsVisible(false);
}
}
KWebView::mouseMoveEvent(event);
@@ -417,7 +417,7 @@ void WebView::openLinkInNewWindow()
{
KAction *a = qobject_cast<KAction*>(sender());
KUrl url(a->data().toUrl());
-
+
emit loadUrl(url, Rekonq::NewWindow);
}
@@ -426,80 +426,80 @@ void WebView::openLinkInNewTab()
{
KAction *a = qobject_cast<KAction*>(sender());
KUrl url(a->data().toUrl());
-
+
emit loadUrl(url, Rekonq::SettingOpenTab);
}
void WebView::keyPressEvent(QKeyEvent *event)
{
- if ( event->modifiers() == Qt::ControlModifier )
+ if (event->modifiers() == Qt::ControlModifier)
{
- if ( event->key() == Qt::Key_C )
+ if (event->key() == Qt::Key_C)
{
triggerPageAction(KWebPage::Copy);
return;
}
- if ( event->key() == Qt::Key_A )
+ if (event->key() == Qt::Key_A)
{
triggerPageAction(KWebPage::SelectAll);
return;
}
}
-
- if(!_canEnableAutoScroll)
+
+ if (!_canEnableAutoScroll)
{
KWebView::keyPressEvent(event);
return;
}
-
+
// Auto Scrolling
- if ( event->modifiers() == Qt::ShiftModifier )
+ if (event->modifiers() == Qt::ShiftModifier)
{
- if( event->key() == Qt::Key_Up )
+ if (event->key() == Qt::Key_Up)
{
_VScrollSpeed--;
- if( !_scrollTimer->isActive() )
+ if (!_scrollTimer->isActive())
_scrollTimer->start();
return;
}
-
- if( event->key() == Qt::Key_Down )
+
+ if (event->key() == Qt::Key_Down)
{
_VScrollSpeed++;
- if( !_scrollTimer->isActive() )
+ if (!_scrollTimer->isActive())
_scrollTimer->start();
return;
}
-
- if( event->key() == Qt::Key_Right )
+
+ if (event->key() == Qt::Key_Right)
{
_HScrollSpeed++;
- if( !_scrollTimer->isActive() )
+ if (!_scrollTimer->isActive())
_scrollTimer->start();
return;
}
-
- if( event->key() == Qt::Key_Left )
+
+ if (event->key() == Qt::Key_Left)
{
_HScrollSpeed--;
- if( !_scrollTimer->isActive() )
+ if (!_scrollTimer->isActive())
_scrollTimer->start();
return;
}
-
- if(_scrollTimer->isActive())
+
+ if (_scrollTimer->isActive())
{
_scrollTimer->stop();
}
else
{
- if(_VScrollSpeed || _HScrollSpeed)
+ if (_VScrollSpeed || _HScrollSpeed)
_scrollTimer->start();
}
}
-
+
KWebView::keyPressEvent(event);
}
@@ -507,7 +507,7 @@ void WebView::keyPressEvent(QKeyEvent *event)
void WebView::inspect()
{
QAction *a = Application::instance()->mainWindow()->actionByName("web_inspector");
- if(a && !a->isChecked())
+ if (a && !a->isChecked())
a->trigger();
pageAction(QWebPage::InspectElement)->trigger();
}
@@ -522,8 +522,8 @@ void WebView::loadUrlInNewTab(const KUrl &url)
void WebView::scrollFrameChanged()
{
// do the scrolling
- page()->currentFrame()->scroll( _HScrollSpeed, _VScrollSpeed );
-
+ page()->currentFrame()->scroll(_HScrollSpeed, _VScrollSpeed);
+
// check if we reached the end
int y = page()->currentFrame()->scrollPosition().y();
if (y == 0 || y == page()->currentFrame()->scrollBarMaximum(Qt::Vertical))
diff --git a/src/webview.h b/src/webview.h
index c6ca2688..533b762c 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -64,15 +64,15 @@ private slots:
void loadUrlInNewTab(const KUrl &);
void openLinkInNewWindow();
void openLinkInNewTab();
-
+
void viewImage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
void inspect();
void scrollFrameChanged();
-
+
signals:
void loadUrl(const KUrl &, const Rekonq::OpenType &);
-
+
private:
QPoint _mousePos;
QPoint _clickPos;