From c896cc340d7e6e0878b3249c5792e6d88a12cf42 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 30 Apr 2010 11:23:37 +0200 Subject: A coding style round --- src/history/autosaver.cpp | 4 ++-- src/history/autosaver.h | 4 ++-- src/history/historymanager.cpp | 50 +++++++++++++++++++++--------------------- src/history/historymanager.h | 24 ++++++++++---------- src/history/historymodels.cpp | 8 +++---- src/history/historymodels.h | 4 ++-- src/history/historypanel.cpp | 26 +++++++++++----------- src/history/historypanel.h | 6 ++--- 8 files changed, 63 insertions(+), 63 deletions(-) (limited to 'src/history') 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 allChild; - for(int i = 0; i < index.model()->rowCount(index); i++) + for (int i = 0; i < index.model()->rowCount(index); i++) allChild << qVariantValue(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); -- cgit v1.2.1