summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-04-29 11:24:11 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-04-29 11:24:11 +0200
commit82862fbd150afae0101757d1d6081e0e6ddf7baa (patch)
treec864003f3580d4eae365e3757c7a826ae3f6bfe7 /src
parentForgot to add it... ;) (diff)
downloadrekonq-82862fbd150afae0101757d1d6081e0e6ddf7baa.tar.xz
astyle
Diffstat (limited to 'src')
-rw-r--r--src/application.cpp10
-rw-r--r--src/application.h2
-rw-r--r--src/bookmarks.cpp34
-rw-r--r--src/bookmarks.h31
-rw-r--r--src/cookiejar.cpp3
-rw-r--r--src/download.cpp28
-rw-r--r--src/download.h29
-rw-r--r--src/findbar.cpp2
-rw-r--r--src/history.cpp4
-rw-r--r--src/lineedit.cpp6
-rw-r--r--src/lineedit.h10
-rw-r--r--src/main.cpp12
-rw-r--r--src/mainview.cpp66
-rw-r--r--src/mainview.h52
-rw-r--r--src/mainwindow.cpp79
-rw-r--r--src/mainwindow.h5
-rw-r--r--src/networkaccessmanager.cpp8
-rw-r--r--src/panelhistory.cpp10
-rw-r--r--src/panelhistory.h2
-rw-r--r--src/searchbar.cpp6
-rw-r--r--src/settings.cpp28
-rw-r--r--src/settings.h2
-rw-r--r--src/sidepanel.cpp6
-rw-r--r--src/sidepanel.h8
-rw-r--r--src/stackedurlbar.cpp12
-rw-r--r--src/stackedurlbar.h6
-rw-r--r--src/tabbar.cpp2
-rw-r--r--src/urlbar.cpp30
-rw-r--r--src/urlbar.h27
-rw-r--r--src/webview.cpp108
-rw-r--r--src/webview.h48
31 files changed, 366 insertions, 310 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 902c2946..03c0f442 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -57,7 +57,7 @@ QPointer<BookmarkProvider> Application::s_bookmarkProvider;
Application::Application()
- : KUniqueApplication()
+ : KUniqueApplication()
{
}
@@ -79,12 +79,12 @@ int Application::newInstance()
if (!m_mainWindow)
{
m_mainWindow = new MainWindow();
-
+
m_mainWindow->setObjectName("MainWindow");
setWindowIcon(KIcon("rekonq"));
-
+
m_mainWindow->show();
-
+
QTimer::singleShot(0, this, SLOT(postLaunch()));
}
@@ -177,7 +177,7 @@ HistoryManager *Application::historyManager()
DownloadManager *Application::downloadManager()
{
- if (!s_downloadManager)
+ if (!s_downloadManager)
{
s_downloadManager = new DownloadManager();
}
diff --git a/src/application.h b/src/application.h
index 271e31a9..10f18545 100644
--- a/src/application.h
+++ b/src/application.h
@@ -78,7 +78,7 @@ public slots:
* @see ReKonfig::self()->writeConfig();
*/
void slotSaveConfiguration() const;
-
+
private slots:
diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp
index 758ed1c0..c7f4da98 100644
--- a/src/bookmarks.cpp
+++ b/src/bookmarks.cpp
@@ -55,11 +55,11 @@ BookmarkOwner::BookmarkOwner(QObject *parent)
}
-void BookmarkOwner::openBookmark(const KBookmark & bookmark,
- Qt::MouseButtons mouseButtons,
+void BookmarkOwner::openBookmark(const KBookmark & bookmark,
+ Qt::MouseButtons mouseButtons,
Qt::KeyboardModifiers keyboardModifiers)
{
- Q_UNUSED(mouseButtons)
+ Q_UNUSED(mouseButtons)
Q_UNUSED(keyboardModifiers)
emit openUrl(bookmark.url());
@@ -83,7 +83,7 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bm)
QList<KUrl> urlList = bm.groupUrlList();
QList<KUrl>::iterator url;
Application* app = Application::instance();
- for(url = urlList.begin(); url != urlList.end(); ++url)
+ for (url = urlList.begin(); url != urlList.end(); ++url)
{
app->newWebView();
app->mainWindow()->loadUrl(*url);
@@ -98,11 +98,11 @@ BookmarkMenu::BookmarkMenu(KBookmarkManager *manager,
KBookmarkOwner *owner,
KMenu *menu,
KActionCollection* actionCollection)
- : KBookmarkMenu(manager, owner, menu, actionCollection)
-
+ : KBookmarkMenu(manager, owner, menu, actionCollection)
+
{
actionCollection->addAction(KStandardAction::AddBookmark,
- QLatin1String("add_bookmark_payload"),
+ QLatin1String("add_bookmark_payload"),
this, SLOT(slotAddBookmark()));
}
@@ -111,7 +111,7 @@ BookmarkMenu::~BookmarkMenu()
{
}
-
+
KMenu *BookmarkMenu::viewContextMenu(QAction *action)
{
return contextMenu(action);
@@ -129,7 +129,7 @@ void BookmarkMenu::slotAddBookmark()
manager()->emitChanged();
return;
}
-
+
KBookmarkMenu::slotAddBookmark();
}
@@ -164,12 +164,12 @@ BookmarkProvider::BookmarkProvider(QWidget *parent)
}
}
m_manager = KBookmarkManager::managerForExternalFile(bookfile.path());
- connect(m_manager, SIGNAL(changed(const QString &, const QString &)),
+ connect(m_manager, SIGNAL(changed(const QString &, const QString &)),
this, SLOT(slotBookmarksChanged(const QString &, const QString &)));
// setup menu
m_owner = new BookmarkOwner(this);
- connect(m_owner, SIGNAL(openUrl(const KUrl& )), this, SIGNAL(openUrl(const KUrl& )));
+ connect(m_owner, SIGNAL(openUrl(const KUrl&)), this, SIGNAL(openUrl(const KUrl&)));
m_bookmarkMenu = new BookmarkMenu(m_manager, m_owner, m_menu, m_actionCollection);
// setup toolbar
@@ -197,9 +197,9 @@ void BookmarkProvider::setupToolBar()
m_bookmarkToolBar->setContentsMargins(0, 0, 0, 0);
m_bookmarkToolBar->setMinimumHeight(16);
m_bookmarkToolBar->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(m_bookmarkToolBar, SIGNAL(customContextMenuRequested(const QPoint &)),
+ connect(m_bookmarkToolBar, SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(contextMenu(const QPoint &)));
-
+
slotBookmarksChanged("", "");
}
@@ -214,13 +214,13 @@ void BookmarkProvider::slotBookmarksChanged(const QString &group, const QString
kWarning() << "There is no bookmark toolbar";
return;
}
-
+
KActionCollection bookmarkCollection(this);
-
+
KBookmarkGroup toolBarGroup = m_manager->toolbar();
if (toolBarGroup.isNull())
return;
-
+
KBookmark bookmark = toolBarGroup.first();
while (!bookmark.isNull())
{
@@ -238,7 +238,7 @@ void BookmarkProvider::slotBookmarksChanged(const QString &group, const QString
QAction *BookmarkProvider::actionByName(const QString &name)
-{
+{
QAction *action = m_actionCollection->action(name);
if (action)
return action;
diff --git a/src/bookmarks.h b/src/bookmarks.h
index 7a6eee7f..d7213cb7 100644
--- a/src/bookmarks.h
+++ b/src/bookmarks.h
@@ -57,7 +57,7 @@ public:
* @param parent the pointer parent Bookmark provider. We need it
* to get pointer to MainWindow
*/
- BookmarkOwner(QObject *parent=0);
+ BookmarkOwner(QObject *parent = 0);
virtual ~BookmarkOwner() {}
/**
@@ -69,8 +69,8 @@ public:
* @param mouseButtons the mouse buttons clicked to select the bookmark
* @param keyboardModifiers the keyboard modifiers pushed when the bookmark was selected
*/
- virtual void openBookmark(const KBookmark &bookmark,
- Qt::MouseButtons mouseButtons,
+ virtual void openBookmark(const KBookmark &bookmark,
+ Qt::MouseButtons mouseButtons,
Qt::KeyboardModifiers keyboardModifiers);
@@ -93,7 +93,10 @@ public:
/**
* This function returns whether the owner supports tabs.
*/
- virtual bool supportsTabs() const { return true; }
+ virtual bool supportsTabs() const
+ {
+ return true;
+ }
/**
* Called if the user wants to open every bookmark in this folder in a new tab.
@@ -131,17 +134,17 @@ class BookmarkMenu : public KBookmarkMenu
Q_OBJECT
public:
- BookmarkMenu(KBookmarkManager* manager,
- KBookmarkOwner* owner,
- KMenu* menu,
+ BookmarkMenu(KBookmarkManager* manager,
+ KBookmarkOwner* owner,
+ KMenu* menu,
KActionCollection* actionCollection);
~BookmarkMenu();
-
+
virtual KMenu *viewContextMenu(QAction* action);
-
+
protected slots:
void slotAddBookmark();
-
+
};
@@ -168,9 +171,9 @@ public:
* @param parent The MainWindow to provide bookmarks objects
*
*/
- BookmarkProvider(QWidget* parent=0);
+ BookmarkProvider(QWidget* parent = 0);
~BookmarkProvider();
-
+
/**
* @short Get the Bookmarks Menu Action
* @return the Bookmarks Menu
@@ -209,12 +212,12 @@ public slots:
* @param point Point on whitch you want to open this menu
*/
void contextMenu(const QPoint &point);
-
+
/**
* @short Waits for signal that the group with the address has been modified by the caller.
* Waits for signal that the group (or any of its children) with the address
* @p groupAddress (e.g. "/4/5") has been modified by the caller @p caller.
- *
+ *
* @param group bookmark group adress
* @param caller caller that modified the bookmarks
* @see KBookmarkManager::changed
diff --git a/src/cookiejar.cpp b/src/cookiejar.cpp
index 079563e5..de7d7d7e 100644
--- a/src/cookiejar.cpp
+++ b/src/cookiejar.cpp
@@ -184,7 +184,8 @@ void CookieJar::save()
QString filepath = KStandardDirs::locateLocal("appdata", "cookies.ini");
QSettings cookieSettings(filepath, QSettings::IniFormat);
QList<QNetworkCookie> cookies = allCookies();
- for (int i = cookies.count() - 1; i >= 0; --i) {
+ for (int i = cookies.count() - 1; i >= 0; --i)
+ {
if (cookies.at(i).isSessionCookie())
cookies.removeAt(i);
}
diff --git a/src/download.cpp b/src/download.cpp
index e02b3565..9489b270 100644
--- a/src/download.cpp
+++ b/src/download.cpp
@@ -42,8 +42,8 @@
#include "mainwindow.h"
-DownloadManager::DownloadManager()
- : QObject()
+DownloadManager::DownloadManager()
+ : QObject()
{
}
@@ -68,17 +68,17 @@ void DownloadManager::newDownload(const KUrl &srcUrl, const KUrl &destUrl)
QString typeText = KMimeType::extractKnownExtension(srcUrl.fileName());
typeText += " (" + mimeType->name() + ")";
-
- int answer = KMessageBox::questionYesNoCancel( NULL,
- i18n("Download '%1'?\n""Type: %2", srcUrl.prettyUrl(), typeText ),
- i18n("Download '%1'...", srcUrl.fileName() ),
- KStandardGuiItem::save(),
- KStandardGuiItem::open(),
- KStandardGuiItem::cancel(),
- "showOpenSaveDownloadDialog"
+
+ int answer = KMessageBox::questionYesNoCancel(NULL,
+ i18n("Download '%1'?\n""Type: %2", srcUrl.prettyUrl(), typeText),
+ i18n("Download '%1'...", srcUrl.fileName()),
+ KStandardGuiItem::save(),
+ KStandardGuiItem::open(),
+ KStandardGuiItem::cancel(),
+ "showOpenSaveDownloadDialog"
);
- switch(answer)
+ switch (answer)
{
case KMessageBox::Cancel:
return;
@@ -108,7 +108,7 @@ void DownloadManager::newDownload(const KUrl &srcUrl, const KUrl &destUrl)
// if user canceled download than abort
if (destination.isEmpty())
return;
-
+
Download *download = new Download(srcUrl, destination, type);
connect(download, SIGNAL(downloadFinished(int)), this, SLOT(slotDownloadFinished(int)));
m_downloads.append(download);
@@ -127,7 +127,7 @@ KUrl DownloadManager::downloadDestination(const QString &filename)
if (destination.isEmpty())
destination = KGlobalSettings::downloadPath();
destination.addPath(filename);
-
+
if (!ReKonfig::downloadToDefaultDir())
{
destination = KFileDialog::getSaveUrl(destination);
@@ -177,7 +177,7 @@ Download::Download(const KUrl &srcUrl, const KUrl &destUrl, DownloadType type)
Q_ASSERT(!m_srcUrl.isEmpty());
Q_ASSERT(!m_destUrl.isEmpty());
kDebug() << "DownloadFile: " << m_srcUrl.url() << " to dest: " << m_destUrl.url();
-
+
m_copyJob = KIO::file_copy(m_srcUrl, m_destUrl);
connect(m_copyJob, SIGNAL(result(KJob *)), SLOT(slotResult(KJob *)));
}
diff --git a/src/download.h b/src/download.h
index 83a01b59..0ad01e69 100644
--- a/src/download.h
+++ b/src/download.h
@@ -38,7 +38,7 @@ class KJob;
namespace KIO
{
- class Job;
+class Job;
}
@@ -51,10 +51,10 @@ namespace KIO
class Download : public QObject
{
Q_OBJECT
-
+
public:
enum DownloadType { Save, Open };
-
+
/**
* Class constructor. This is the unique method we need to
* use this class. In fact Download class needs to know just
@@ -71,9 +71,18 @@ public:
*/
~Download();
- KUrl srcUrl() const { return m_srcUrl; }
- KUrl destUrl() const { return m_destUrl; }
- DownloadType type() const { return m_type; }
+ KUrl srcUrl() const
+ {
+ return m_srcUrl;
+ }
+ KUrl destUrl() const
+ {
+ return m_destUrl;
+ }
+ DownloadType type() const
+ {
+ return m_type;
+ }
void cancel();
signals:
@@ -98,11 +107,11 @@ private:
class DownloadManager : public QObject
{
Q_OBJECT
-
+
public:
DownloadManager();
~DownloadManager();
-
+
/**
* @short Creates new download job.
* This method lets you to download a file from a remote source url
@@ -115,13 +124,13 @@ public:
void newDownload(const KUrl &srcUrl, const KUrl &destUrl = KUrl());
const QList<Download *> &downloads() const;
-
+
public slots:
void slotDownloadFinished(int errorCode);
private:
KUrl downloadDestination(const QString &filename);
-
+
QList<Download *> m_downloads;
};
diff --git a/src/findbar.cpp b/src/findbar.cpp
index fdd1c3fc..11d890c1 100644
--- a/src/findbar.cpp
+++ b/src/findbar.cpp
@@ -114,7 +114,7 @@ void FindBar::showFindBar()
{
show();
}
- // set focus to findbar if user select showFindBar shortcut
+ // set focus to findbar if user select showFindBar shortcut
m_lineEdit->setFocus();
m_lineEdit->selectAll();
}
diff --git a/src/history.cpp b/src/history.cpp
index a59a4ce3..ee21a8f2 100644
--- a/src/history.cpp
+++ b/src/history.cpp
@@ -212,10 +212,10 @@ void HistoryManager::removeHistoryEntry(const HistoryItem &item)
void HistoryManager::removeHistoryEntry(const KUrl &url, const QString &title)
{
- for (int i = 0; i < m_history.count(); ++i)
+ for (int i = 0; i < m_history.count(); ++i)
{
if (url == m_history.at(i).url
- && (title.isEmpty() || title == m_history.at(i).title))
+ && (title.isEmpty() || title == m_history.at(i).title))
{
removeHistoryEntry(m_history.at(i));
break;
diff --git a/src/lineedit.cpp b/src/lineedit.cpp
index bef65d27..c9df7bfa 100644
--- a/src/lineedit.cpp
+++ b/src/lineedit.cpp
@@ -53,7 +53,7 @@ void LineEdit::keyPressEvent(QKeyEvent *event)
clearFocus();
event->accept();
}
-
+
KLineEdit::keyPressEvent(event);
}
@@ -67,7 +67,7 @@ void LineEdit::contextMenuEvent(QContextMenuEvent *event)
void LineEdit::focusInEvent(QFocusEvent *event)
{
selectAll();
-
+
KLineEdit::focusInEvent(event);
}
@@ -75,7 +75,7 @@ void LineEdit::focusInEvent(QFocusEvent *event)
void LineEdit::focusOutEvent(QFocusEvent *event)
{
KLineEdit::focusOutEvent(event);
-
+
// reset cursor state and deselect
setCursorPosition(0);
deselect();
diff --git a/src/lineedit.h b/src/lineedit.h
index 2bc22fd3..f1bd8f88 100644
--- a/src/lineedit.h
+++ b/src/lineedit.h
@@ -34,17 +34,17 @@ class QKeyEvent;
class LineEdit : public KLineEdit
{
-Q_OBJECT
+ Q_OBJECT
public:
explicit LineEdit(QWidget *parent = 0);
virtual ~LineEdit();
protected:
- virtual void keyPressEvent (QKeyEvent*);
- virtual void contextMenuEvent (QContextMenuEvent*);
- virtual void focusInEvent (QFocusEvent*);
- virtual void focusOutEvent (QFocusEvent*);
+ virtual void keyPressEvent(QKeyEvent*);
+ virtual void contextMenuEvent(QContextMenuEvent*);
+ virtual void focusInEvent(QFocusEvent*);
+ virtual void focusOutEvent(QFocusEvent*);
};
#endif // LINEEDIT_H
diff --git a/src/main.cpp b/src/main.cpp
index 80d94627..c6ffdb46 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -47,9 +47,9 @@ int main(int argc, char **argv)
);
// about authors
- about.addAuthor(ki18n("Andrea Diamantini"),
- ki18n("Project Lead, Developer, Italian translations"),
- "adjam7@gmail.com",
+ about.addAuthor(ki18n("Andrea Diamantini"),
+ ki18n("Project Lead, Developer, Italian translations"),
+ "adjam7@gmail.com",
"http://www.adjam.org");
about.addAuthor(ki18n("Domrachev Alexandr"),
@@ -57,9 +57,9 @@ int main(int argc, char **argv)
"alexandr.domrachev@gmail.com",
"");
-// about.addAuthor(ki18n("your name"),
-// ki18n("your role"),
-// "your mail",
+// about.addAuthor(ki18n("your name"),
+// ki18n("your role"),
+// "your mail",
// "your site");
// Initialize command line args
diff --git a/src/mainview.cpp b/src/mainview.cpp
index df42a340..274d15de 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -63,7 +63,7 @@ MainView::MainView(QWidget *parent)
{
// setting tabbar
setTabBar(m_tabBar);
-
+
// loading pixmap path
m_loadingGitPath = KStandardDirs::locate("appdata" , "pics/loading.gif");
@@ -73,7 +73,7 @@ MainView::MainView(QWidget *parent)
connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(slotCloseOtherTabs(int)));
connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(slotReloadTab(int)));
connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(slotReloadAllTabs()));
- connect(m_tabBar, SIGNAL(tabMoved(int,int)), this, SLOT(moveTab(int,int)));
+ connect(m_tabBar, SIGNAL(tabMoved(int, int)), this, SLOT(moveTab(int, int)));
// current page index changing
connect(this, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentChanged(int)));
@@ -102,7 +102,7 @@ void MainView::postLaunch()
void MainView::showTabBar()
{
- if ( ReKonfig::alwaysShowTabBar() )
+ if (ReKonfig::alwaysShowTabBar())
{
if (m_tabBar->isHidden())
{
@@ -245,12 +245,12 @@ void MainView::slotCurrentChanged(int index)
WebView *oldWebView = this->webView(m_urlBars->currentIndex());
if (oldWebView)
{
- disconnect(oldWebView, SIGNAL(statusBarMessage(const QString&)),
- this, SIGNAL(showStatusBarMessage(const QString&)));
- disconnect(oldWebView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
- this, SIGNAL(linkHovered(const QString&)));
- disconnect(oldWebView, SIGNAL(loadProgress(int)),
- this, SIGNAL(loadProgress(int)));
+ disconnect(oldWebView, SIGNAL(statusBarMessage(const QString&)),
+ this, SIGNAL(showStatusBarMessage(const QString&)));
+ disconnect(oldWebView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
+ this, SIGNAL(linkHovered(const QString&)));
+ disconnect(oldWebView, SIGNAL(loadProgress(int)),
+ this, SIGNAL(loadProgress(int)));
}
connect(webView, SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&)));
@@ -304,13 +304,13 @@ WebView *MainView::newWebView(bool makeCurrent)
m_urlBars->addUrlBar(urlBar);
WebView *webView = new WebView; // should be deleted on tab close
-
+
// connecting webview with urlbar
connect(webView, SIGNAL(loadProgress(int)), urlBar, SLOT(slotUpdateProgress(int)));
connect(webView, SIGNAL(loadFinished(bool)), urlBar, SLOT(slotLoadFinished(bool)));
connect(webView, SIGNAL(urlChanged(const QUrl &)), urlBar, SLOT(setUrl(const QUrl &)));
connect(webView, SIGNAL(iconChanged()), urlBar, SLOT(slotUpdateUrl()));
-
+
// connecting webview with mainview
connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted()));
connect(webView, SIGNAL(loadProgress(int)), this, SLOT(webViewLoadProgress(int)));
@@ -323,17 +323,17 @@ WebView *MainView::newWebView(bool makeCurrent)
connect(webView, SIGNAL(shiftCtrlTabPressed()), this, SLOT(previousTab()));
// connecting webPage signals with mainview
- connect(webView->page(), SIGNAL(windowCloseRequested()),
+ connect(webView->page(), SIGNAL(windowCloseRequested()),
this, SLOT(windowCloseRequested()));
- connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)),
+ connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)),
this, SIGNAL(geometryChangeRequested(const QRect &)));
connect(webView->page(), SIGNAL(printRequested(QWebFrame *)),
this, SIGNAL(printRequested(QWebFrame *)));
- connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)),
+ connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)),
this, SIGNAL(menuBarVisibilityChangeRequested(bool)));
- connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)),
+ connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)),
this, SIGNAL(statusBarVisibilityChangeRequested(bool)));
- connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)),
+ connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)),
this, SIGNAL(toolBarVisibilityChangeRequested(bool)));
addTab(webView, i18n("(Untitled)"));
@@ -427,7 +427,7 @@ void MainView::slotCloseTab(int index)
{
kWarning() << "Index: " << index;
// do nothing if just one tab is opened
- if( count() == 1 )
+ if (count() == 1)
return;
if (index < 0)
@@ -441,10 +441,10 @@ void MainView::slotCloseTab(int index)
if (tab->isModified())
{
int risp = KMessageBox::questionYesNo(this ,
- i18n("You have modified this page and when closing it you would lose the modification.\n"
- "Do you really want to close this page?\n"),
- i18n("Do you really want to close this page?")
- );
+ i18n("You have modified this page and when closing it you would lose the modification.\n"
+ "Do you really want to close this page?\n"),
+ i18n("Do you really want to close this page?")
+ );
if (risp == KMessageBox::No)
return;
}
@@ -499,7 +499,7 @@ void MainView::webViewLoadStarted()
}
if (index != currentIndex())
- return;
+ return;
emit showStatusBarMessage(i18n("Loading..."));
}
@@ -513,10 +513,10 @@ void MainView::webViewLoadProgress(int progress)
{
return;
}
-
+
double totalBytes = static_cast<double>(webView->webPage()->totalBytes() / 1024);
-
- QString message = i18n("Loading %1% (%2 %3)...", progress, totalBytes, QLatin1String("kB") );
+
+ QString message = i18n("Loading %1% (%2 %3)...", progress, totalBytes, QLatin1String("kB"));
emit showStatusBarMessage(message);
}
@@ -525,15 +525,15 @@ void MainView::webViewLoadFinished(bool ok)
{
WebView *webView = qobject_cast<WebView*>(sender());
int index = webViewIndex(webView);
-
- if (-1 != index)
+
+ if (-1 != index)
{
QLabel *label = animatedLoading(index, true);
QMovie *movie = label->movie();
- if(movie)
+ if (movie)
movie->stop();
}
-
+
webViewIconChanged();
// don't display messages for background tabs
@@ -541,7 +541,7 @@ void MainView::webViewLoadFinished(bool ok)
{
return;
}
-
+
if (ok)
emit showStatusBarMessage(i18n("Done"));
else
@@ -568,7 +568,7 @@ void MainView::webViewIconChanged()
void MainView::webViewTitleChanged(const QString &title)
{
QString tabTitle = title;
- if(title.isEmpty())
+ if (title.isEmpty())
{
tabTitle = i18n("(Untitled)");
}
@@ -622,7 +622,7 @@ void MainView::aboutToShowRecentTriggeredAction(QAction *action)
void MainView::loadUrl(const KUrl &url)
{
- if (url.isEmpty())
+ if (url.isEmpty())
return;
currentUrlBar()->setUrl(url.prettyUrl());
@@ -678,7 +678,7 @@ QLabel *MainView::animatedLoading(int index, bool addMovie)
return 0;
QLabel *label = qobject_cast<QLabel*>(m_tabBar->tabButton(index, QTabBar::LeftSide));
- if (!label)
+ if (!label)
{
label = new QLabel(this);
}
diff --git a/src/mainview.h b/src/mainview.h
index 89cb3553..64c25fc0 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -48,7 +48,7 @@ class UrlBar;
/**
- * This class represent rekonq Main View. It contains all WebViews and a stack widget
+ * This class represent rekonq Main View. It contains all WebViews and a stack widget
* of associated line edits.
*
*/
@@ -72,7 +72,7 @@ signals:
void showStatusBarMessage(const QString &message);
void linkHovered(const QString &link);
void loadProgress(int progress);
-
+
void geometryChangeRequested(const QRect &geometry);
void menuBarVisibilityChangeRequested(bool visible);
void statusBarVisibilityChangeRequested(bool visible);
@@ -81,19 +81,37 @@ signals:
public:
// void setupTabButtons();
-
+
UrlBar *urlBar(int index) const;
- UrlBar *currentUrlBar() const { return urlBar(-1); }
+ UrlBar *currentUrlBar() const
+ {
+ return urlBar(-1);
+ }
WebView *webView(int index) const;
QList<WebView *> tabs(); // ?
-
+
// inlines
- TabBar *tabBar() const { return m_tabBar; }
- StackedUrlBar *urlBarStack() const { return m_urlBars; }
- WebView *currentWebView() const { return webView(currentIndex()); }
- int webViewIndex(WebView *webView) const { return indexOf(webView); }
- KAction *recentlyClosedTabsAction() const { return m_recentlyClosedTabsAction; }
-
+ TabBar *tabBar() const
+ {
+ return m_tabBar;
+ }
+ StackedUrlBar *urlBarStack() const
+ {
+ return m_urlBars;
+ }
+ WebView *currentWebView() const
+ {
+ return webView(currentIndex());
+ }
+ int webViewIndex(WebView *webView) const
+ {
+ return indexOf(webView);
+ }
+ KAction *recentlyClosedTabsAction() const
+ {
+ return m_recentlyClosedTabsAction;
+ }
+
/**
* show and hide TabBar if user doesn't choose
* "Always Show TabBar" option
@@ -113,8 +131,8 @@ public slots:
WebView *newWebView(bool makeCurrent = true);
/**
- * Core browser slot. Load an url in a webview
- *
+ * Core browser slot. Load an url in a webview
+ *
* @param url The url to load
*/
void loadUrl(const KUrl &url);
@@ -152,7 +170,7 @@ private slots:
void windowCloseRequested();
/**
- * This functions move tab informations "from index to index"
+ * This functions move tab informations "from index to index"
*
* @param fromIndex the index from which we move
*
@@ -165,12 +183,12 @@ private slots:
private:
/**
- * This function creates (if not exists) and returns a QLabel
+ * This function creates (if not exists) and returns a QLabel
* with a loading QMovie.
- * Imported from Arora's code.
+ * Imported from Arora's code.
*
* @param index the tab index where inserting the animated label
- * @param addMovie creates or not a loading movie
+ * @param addMovie creates or not a loading movie
*
* @return animated label's pointer
*/
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 59196975..be2198bd 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -95,7 +95,7 @@ MainWindow::MainWindow()
// setting size policies
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-
+
// then, setup our actions
setupActions();
@@ -212,7 +212,7 @@ void MainWindow::setupActions()
// WEB Actions (NO KStandardActions..)
a = KStandardAction::redisplay(m_view, SLOT(slotWebReload()), actionCollection());
- a->setText( i18n("Reload") );
+ a->setText(i18n("Reload"));
KStandardAction::back(m_view, SLOT(slotWebBack()), actionCollection());
KStandardAction::forward(m_view, SLOT(slotWebForward()), actionCollection());
KStandardAction::undo(m_view, SLOT(slotWebUndo()), actionCollection());
@@ -233,7 +233,7 @@ void MainWindow::setupActions()
// ============== Custom Actions
a = new KAction(KIcon("document-open-remote"), i18n("Open Location"), this);
- a->setShortcut(Qt::CTRL+Qt::Key_L);
+ a->setShortcut(Qt::CTRL + Qt::Key_L);
actionCollection()->addAction(QLatin1String("open_location"), a);
connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotOpenLocation()));
@@ -312,9 +312,9 @@ void MainWindow::setupSidePanel()
m_sidePanel = new SidePanel(i18n("History"), this);
connect(m_sidePanel, SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&)));
connect(m_sidePanel, SIGNAL(destroyed()), Application::instance(), SLOT(slotSaveConfiguration()));
-
+
addDockWidget(Qt::LeftDockWidgetArea, m_sidePanel);
-
+
// setup side panel actions
KAction* a = new KAction(this);
a->setText(i18n("History"));
@@ -322,7 +322,7 @@ void MainWindow::setupSidePanel()
a->setChecked(ReKonfig::showSideBar());
a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_H));
actionCollection()->addAction(QLatin1String("show_history_panel"), a);
-
+
// connect to toogle action
connect(a, SIGNAL(triggered(bool)), m_sidePanel->toggleViewAction(), SLOT(trigger()));
}
@@ -537,7 +537,7 @@ void MainWindow::slotFilePrintPreview()
return;
QPrinter printer;
- KPrintPreview previewdlg( &printer, this );
+ KPrintPreview previewdlg(&printer, this);
currentTab()->print(&printer);
previewdlg.exec();
}
@@ -555,7 +555,7 @@ void MainWindow::printRequested(QWebFrame *frame)
{
QPrinter printer;
- QPrintDialog *dialog = KdePrint::createPrintDialog( &printer, this );
+ QPrintDialog *dialog = KdePrint::createPrintDialog(&printer, this);
if (dialog->exec() != QDialog::Accepted)
return;
frame->print(&printer);
@@ -617,7 +617,7 @@ void MainWindow::slotFindNext()
return;
QWebPage::FindFlags options;
- if(m_findBar->matchCase())
+ if (m_findBar->matchCase())
{
options = QWebPage::FindCaseSensitively | QWebPage::FindWrapsAroundDocument;
}
@@ -639,7 +639,7 @@ void MainWindow::slotFindPrevious()
return;
QWebPage::FindFlags options;
- if(m_findBar->matchCase())
+ if (m_findBar->matchCase())
{
options = QWebPage::FindCaseSensitively | QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument;
}
@@ -684,24 +684,21 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen)
// state flags
static bool menubarFlag;
static bool mainToolBarFlag;
- static bool locationBarFlag;
static bool bookmarksToolBarFlag;
static bool statusBarFlag;
static bool sidePanelFlag;
-
+
if (makeFullScreen == true)
{
// save current state
menubarFlag = menuBar()->isHidden();
mainToolBarFlag = toolBar("mainToolBar")->isHidden();
- locationBarFlag = toolBar("locationToolBar")->isHidden();
bookmarksToolBarFlag = toolBar("bookmarksToolBar")->isHidden();
statusBarFlag = statusBar()->isHidden();
sidePanelFlag = sidePanel()->isHidden();
-
+
menuBar()->hide();
toolBar("mainToolBar")->hide();
- toolBar("locationToolBar")->hide();
toolBar("bookmarksToolBar")->hide();
statusBar()->hide();
sidePanel()->hide();
@@ -712,8 +709,6 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen)
menuBar()->show();
if (!mainToolBarFlag)
toolBar("mainToolBar")->show();
- if (!locationBarFlag)
- toolBar("locationToolBar")->show();
if (!bookmarksToolBarFlag)
toolBar("bookmarksToolBar")->show();
if (!statusBarFlag)
@@ -740,12 +735,12 @@ void MainWindow::slotViewPageSource()
/// TODO: autochoose tempfile suffix
sourceFile.setSuffix(QString(".html"));
sourceFile.setAutoRemove(false);
-
+
if (sourceFile.open())
{
QDataStream stream(&sourceFile);
stream << currentTab()->page()->mainFrame()->toHtml().toUtf8();
-
+
url = KUrl();
url.setPath(sourceFile.fileName());
isTempFile = true;
@@ -767,10 +762,10 @@ void MainWindow::slotToggleInspector(bool enable)
if (enable)
{
int result = KMessageBox::questionYesNo(this,
- i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n"
- "Do you want to reload all pages?"),
- i18n("Web Inspector")
- );
+ i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n"
+ "Do you want to reload all pages?"),
+ i18n("Web Inspector")
+ );
if (result == KMessageBox::Yes)
{
@@ -879,7 +874,7 @@ void MainWindow::geometryChangeRequested(const QRect &geometry)
void MainWindow::slotShowMenubar(bool enable)
{
- if(enable)
+ if (enable)
menuBar()->show();
else
menuBar()->hide();
@@ -891,27 +886,27 @@ bool MainWindow::queryClose()
if (m_view->count() > 1)
{
- int answer = KMessageBox::questionYesNoCancel(
- this,
- i18n("Are you sure you want to close the window?\n" "You have %1 tab(s) open" , m_view->count()),
- i18n("Are you sure you want to close the window?"),
- KStandardGuiItem::quit(),
- KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")),
- KStandardGuiItem::cancel(),
- "confirmClosingMultipleTabs"
+ int answer = KMessageBox::questionYesNoCancel(
+ this,
+ i18n("Are you sure you want to close the window?\n" "You have %1 tab(s) open" , m_view->count()),
+ i18n("Are you sure you want to close the window?"),
+ KStandardGuiItem::quit(),
+ KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")),
+ KStandardGuiItem::cancel(),
+ "confirmClosingMultipleTabs"
);
- switch (answer)
+ switch (answer)
{
- case KMessageBox::Yes:
- // Quit
- return true;
- break;
- case KMessageBox::No:
- // Close only the current tab
- m_view->slotCloseTab();
- default:
- return false;
+ case KMessageBox::Yes:
+ // Quit
+ return true;
+ break;
+ case KMessageBox::No:
+ // Close only the current tab
+ m_view->slotCloseTab();
+ default:
+ return false;
}
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 045287cb..cdb7151d 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -73,7 +73,10 @@ private:
void setupHistoryMenu();
void setupToolBars();
void setupSidePanel();
- SidePanel *sidePanel() { return m_sidePanel; }
+ SidePanel *sidePanel()
+ {
+ return m_sidePanel;
+ }
public slots:
void slotHome();
diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp
index 311124e8..d92edbd6 100644
--- a/src/networkaccessmanager.cpp
+++ b/src/networkaccessmanager.cpp
@@ -97,8 +97,8 @@ void NetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthent
{
MainWindow *mainWindow = Application::instance()->mainWindow();
- KDialog dialog(mainWindow,Qt::Sheet);
- dialog.setButtons( KDialog::Ok | KDialog::Cancel );
+ KDialog dialog(mainWindow, Qt::Sheet);
+ dialog.setButtons(KDialog::Ok | KDialog::Cancel);
Ui::passwordWidget passwordWidget;
QWidget widget;
@@ -126,12 +126,12 @@ void NetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &prox
MainWindow *mainWindow = Application::instance()->mainWindow();
KDialog dialog(mainWindow, Qt::Sheet);
- dialog.setButtons( KDialog::Ok | KDialog::Cancel );
+ dialog.setButtons(KDialog::Ok | KDialog::Cancel);
Ui::proxyWidget proxyWdg;
QWidget widget;
proxyWdg.setupUi(&widget);
-
+
dialog.setMainWidget(&widget);
proxyWdg.iconLabel->setText(QString());
diff --git a/src/panelhistory.cpp b/src/panelhistory.cpp
index 57aa9281..72507663 100644
--- a/src/panelhistory.cpp
+++ b/src/panelhistory.cpp
@@ -35,9 +35,9 @@
PanelHistory::PanelHistory(QWidget *parent)
- : QWidget(parent)
- , m_historyTreeView(new QTreeView)
- , m_treeProxyModel(new TreeProxyModel(this))
+ : QWidget(parent)
+ , m_historyTreeView(new QTreeView)
+ , m_treeProxyModel(new TreeProxyModel(this))
{
m_historyTreeView->setUniformRowHeights(true);
m_historyTreeView->setSelectionBehavior(QAbstractItemView::SelectRows);
@@ -64,7 +64,7 @@ PanelHistory::PanelHistory(QWidget *parent)
//-
HistoryManager *historyManager = Application::historyManager();
QAbstractItemModel *model = historyManager->historyTreeModel();
-
+
m_treeProxyModel->setSourceModel(model);
m_historyTreeView->setModel(m_treeProxyModel);
m_historyTreeView->setExpanded(m_treeProxyModel->index(0, 0), true);
@@ -72,7 +72,7 @@ PanelHistory::PanelHistory(QWidget *parent)
QFontMetrics fm(font());
int header = fm.width(QLatin1Char('m')) * 40;
m_historyTreeView->header()->resizeSection(0, header);
-
+
connect(search, SIGNAL(textChanged(QString)), m_treeProxyModel, SLOT(setFilterFixedString(QString)));
connect(m_historyTreeView, SIGNAL(activated(const QModelIndex&)), this, SLOT(open()));
}
diff --git a/src/panelhistory.h b/src/panelhistory.h
index 927b0319..89759a84 100644
--- a/src/panelhistory.h
+++ b/src/panelhistory.h
@@ -49,7 +49,7 @@ private slots:
private:
QTreeView *m_historyTreeView;
TreeProxyModel *m_treeProxyModel;
-
+
};
#endif // PANELHISTORY_H
diff --git a/src/searchbar.cpp b/src/searchbar.cpp
index c9fef5c7..fad35748 100644
--- a/src/searchbar.cpp
+++ b/src/searchbar.cpp
@@ -36,9 +36,9 @@
SearchBar::SearchBar(QWidget *parent) :
- KLineEdit(parent)
- , m_networkAccessManager(new QNetworkAccessManager(this))
- , m_timer(new QTimer(this))
+ KLineEdit(parent)
+ , m_networkAccessManager(new QNetworkAccessManager(this))
+ , m_timer(new QTimer(this))
{
setMinimumWidth(180);
diff --git a/src/settings.cpp b/src/settings.cpp
index ac8d0f71..1e42413f 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -103,9 +103,9 @@ Private::Private(SettingsDialog *parent)
webkitUi.setupUi(widget);
widget->layout()->setMargin(0);
pageItem = parent->addPage(widget , i18n("Webkit"));
- QString webkitIconPath = KStandardDirs::locate("appdata", "pics/webkit-icon.png");
+ QString webkitIconPath = KStandardDirs::locate("appdata", "pics/webkit-icon.png");
kWarning() << webkitIconPath;
- KIcon webkitIcon = KIcon( QIcon(webkitIconPath) );
+ KIcon webkitIcon = KIcon(QIcon(webkitIconPath));
pageItem->setIcon(webkitIcon);
}
@@ -140,18 +140,18 @@ SettingsDialog::~SettingsDialog()
void SettingsDialog::setWebSettingsToolTips()
{
- d->webkitUi.kcfg_autoLoadImages->setToolTip(i18n("Specifies whether images are automatically loaded in web pages") );
- d->webkitUi.kcfg_javascriptEnabled->setToolTip(i18n("Enables the running of JavaScript programs.") );
- d->webkitUi.kcfg_javaEnabled->setToolTip(i18n("Enables Java applets.") );
- d->webkitUi.kcfg_pluginsEnabled->setToolTip(i18n("Enables plugins in web pages.") );
- d->webkitUi.kcfg_javascriptCanOpenWindows->setToolTip(i18n("Allows JavaScript programs to opening new windows.") );
- d->webkitUi.kcfg_javascriptCanAccessClipboard->setToolTip(i18n("Allows JavaScript programs to reading/writing to the clipboard.") );
- d->webkitUi.kcfg_linksIncludedInFocusChain->setToolTip(i18n("Includes hyperlinks in the keyboard focus chain.") );
- d->webkitUi.kcfg_zoomTextOnly->setToolTip(i18n("Applies the zoom factor on a frame to only the text or all content.") );
- d->webkitUi.kcfg_printElementBackgrounds->setToolTip(i18n("Draws also background color and images when the page is printed.") );
- d->webkitUi.kcfg_offlineStorageDatabaseEnabled->setToolTip(i18n("Support for the HTML 5 offline storage feature.") );
- d->webkitUi.kcfg_offlineWebApplicationCacheEnabled->setToolTip(i18n("Support for the HTML 5 web application cache feature.") );
- d->webkitUi.kcfg_localStorageDatabaseEnabled->setToolTip(i18n("Support for the HTML 5 local storage feature.") );
+ d->webkitUi.kcfg_autoLoadImages->setToolTip(i18n("Specifies whether images are automatically loaded in web pages"));
+ d->webkitUi.kcfg_javascriptEnabled->setToolTip(i18n("Enables the running of JavaScript programs."));
+ d->webkitUi.kcfg_javaEnabled->setToolTip(i18n("Enables Java applets."));
+ d->webkitUi.kcfg_pluginsEnabled->setToolTip(i18n("Enables plugins in web pages."));
+ d->webkitUi.kcfg_javascriptCanOpenWindows->setToolTip(i18n("Allows JavaScript programs to opening new windows."));
+ d->webkitUi.kcfg_javascriptCanAccessClipboard->setToolTip(i18n("Allows JavaScript programs to reading/writing to the clipboard."));
+ d->webkitUi.kcfg_linksIncludedInFocusChain->setToolTip(i18n("Includes hyperlinks in the keyboard focus chain."));
+ d->webkitUi.kcfg_zoomTextOnly->setToolTip(i18n("Applies the zoom factor on a frame to only the text or all content."));
+ d->webkitUi.kcfg_printElementBackgrounds->setToolTip(i18n("Draws also background color and images when the page is printed."));
+ d->webkitUi.kcfg_offlineStorageDatabaseEnabled->setToolTip(i18n("Support for the HTML 5 offline storage feature."));
+ d->webkitUi.kcfg_offlineWebApplicationCacheEnabled->setToolTip(i18n("Support for the HTML 5 web application cache feature."));
+ d->webkitUi.kcfg_localStorageDatabaseEnabled->setToolTip(i18n("Support for the HTML 5 local storage feature."));
}
diff --git a/src/settings.h b/src/settings.h
index 256019bf..26fd2d16 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -40,7 +40,7 @@ public:
private:
Private* const d;
-
+
void setWebSettingsToolTips();
private slots:
diff --git a/src/sidepanel.cpp b/src/sidepanel.cpp
index c4ba6c2a..0fab81c0 100644
--- a/src/sidepanel.cpp
+++ b/src/sidepanel.cpp
@@ -36,9 +36,9 @@ SidePanel::SidePanel(const QString &title, QWidget *parent, Qt::WindowFlags flag
setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
setShown(ReKonfig::showSideBar());
-
+
connect(m_panelHistory, SIGNAL(openUrl(const KUrl&)), this, SIGNAL(openUrl(const KUrl&)));
-
+
setWidget(m_panelHistory);
}
@@ -47,7 +47,7 @@ SidePanel::~SidePanel()
{
// Save side panel's state
ReKonfig::setShowSideBar(!isHidden());
-
+
delete m_panelHistory;
}
diff --git a/src/sidepanel.h b/src/sidepanel.h
index 12be5030..c0af7827 100644
--- a/src/sidepanel.h
+++ b/src/sidepanel.h
@@ -34,17 +34,17 @@ class SidePanel : public QDockWidget
{
Q_OBJECT
Q_DISABLE_COPY(SidePanel)
-
+
public:
explicit SidePanel(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
~SidePanel();
-
+
signals:
void openUrl(const KUrl &);
-
+
private:
PanelHistory *m_panelHistory;
-
+
};
#endif // SIDEPANEL_H
diff --git a/src/stackedurlbar.cpp b/src/stackedurlbar.cpp
index bd12ba2d..113c8769 100644
--- a/src/stackedurlbar.cpp
+++ b/src/stackedurlbar.cpp
@@ -67,7 +67,7 @@ UrlBar *StackedUrlBar::urlBar(int index)
void StackedUrlBar::addUrlBar(UrlBar* urlBar)
{
QStackedWidget::addWidget(urlBar);
-
+
// setup completion objects
urlBar->setCompletionObject(completion());
}
@@ -88,7 +88,7 @@ void StackedUrlBar::removeUrlBar(UrlBar* urlBar)
void StackedUrlBar::clear()
{
currentUrlBar()->clearHistory();
-
+
for (int i = 0; i < count(); ++i)
{
urlBar(i)->clear();
@@ -124,19 +124,19 @@ KCompletion *StackedUrlBar::completion()
int count = model->rowCount();
kDebug() << "...initialize history items" << count;
-
+
// change order to insertion to avoid confusion of the addItem method
// in weighted it expects format string:number and it thinks http it the whole string
m_completion->setOrder(KCompletion::Insertion);
- for(int i = 0; i < count; ++i)
+ for (int i = 0; i < count; ++i)
{
- QString item = model->data(model->index(i,0)).toString();
+ QString item = model->data(model->index(i, 0)).toString();
item.remove(QRegExp("^http://|/$"));
m_completion->addItem(item);
}
m_completion->setOrder(KCompletion::Weighted);
}
-
+
return m_completion;
}
diff --git a/src/stackedurlbar.h b/src/stackedurlbar.h
index 35b97656..d3aea16f 100644
--- a/src/stackedurlbar.h
+++ b/src/stackedurlbar.h
@@ -33,7 +33,7 @@ class UrlBar;
class StackedUrlBar : public QStackedWidget
{
Q_OBJECT
-
+
public:
StackedUrlBar(QWidget *parent = 0);
~StackedUrlBar();
@@ -52,10 +52,10 @@ public:
public slots:
void clear();
-
+
private:
Q_DISABLE_COPY(StackedUrlBar)
-
+
KCompletion *m_completion;
HistoryCompletionModel *m_completionModel;
};
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index f11ea688..be1b05fd 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -72,7 +72,7 @@ QSize TabBar::tabSizeHint(int index) const
int n = count();
- if(n > 6)
+ if (n > 6)
{
w = s.width() / 5;
}
diff --git a/src/urlbar.cpp b/src/urlbar.cpp
index 6b77e5d3..29eaed70 100644
--- a/src/urlbar.cpp
+++ b/src/urlbar.cpp
@@ -51,20 +51,20 @@ UrlBar::UrlBar(QWidget *parent)
setUrlDropsEnabled(true);
setAutoDeleteCompletionObject(true);
setMinimumWidth(180);
-
+
setTrapReturnKey(true);
-
+
setupLineEdit();
-
+
// add every item to history
connect(this, SIGNAL(returnPressed(const QString&)), SLOT(slotActivated(const QString&)));
connect(completionBox(), SIGNAL(activated(const QString&)), SLOT(slotActivated(const QString&)));
-
+
connect(this, SIGNAL(cleared()), SLOT(slotCleared()));
// setup completion box
completionBox()->setTabHandling(true); // Konqueror bug #167135
-
+
// set dropdown list background
QPalette p = view()->palette();
p.setColor(QPalette::Base, palette().color(QPalette::Base));
@@ -86,19 +86,19 @@ void UrlBar::setupLineEdit()
QPalette p = m_lineEdit->palette();
p.setColor(QPalette::Base, Qt::transparent);
m_lineEdit->setPalette(p);
-
+
if (!s_defaultBaseColor.isValid())
{
s_defaultBaseColor = palette().color(QPalette::Base);
}
-
+
setLineEdit(m_lineEdit);
-
+
// Make the lineedit consume the Qt::Key_Enter event...
lineEdit()->setTrapReturnKey(true);
-
+
lineEdit()->setHandleSignals(true);
-
+
// clear the URL bar
lineEdit()->clear();
}
@@ -108,7 +108,7 @@ void UrlBar::setUrl(const QUrl& url)
{
if (url.isEmpty())
return;
-
+
m_currentUrl = url;
slotUpdateUrl();
}
@@ -141,7 +141,7 @@ inline void UrlBar::slotActivated(const QString& url)
{
if (url.isEmpty())
return;
-
+
setUrl(url);
Application::historyManager()->addHistoryEntry(url);
@@ -179,7 +179,7 @@ void UrlBar::paintEvent(QPaintEvent *event)
QPalette p = palette();
p.setColor(QPalette::Base, s_defaultBaseColor);
setPalette(p);
-
+
KHistoryComboBox::paintEvent(event);
if (!hasFocus())
@@ -197,7 +197,7 @@ void UrlBar::paintEvent(QPaintEvent *event)
}
painter.setBrush(generateGradient(loadingColor, height()));
painter.setPen(Qt::transparent);
-
+
QRect backgroundRect = lineEdit()->frameGeometry();
int mid = backgroundRect.width() / 100 * m_progress;
QRect progressRect(backgroundRect.x(), backgroundRect.y(), mid, backgroundRect.height());
@@ -211,7 +211,7 @@ void UrlBar::focusOutEvent(QFocusEvent *event)
{
// set back last loaded url in case user cleared it
setUrl(m_currentUrl);
-
+
KHistoryComboBox::focusOutEvent(event);
}
diff --git a/src/urlbar.h b/src/urlbar.h
index 4cef5157..236792bd 100644
--- a/src/urlbar.h
+++ b/src/urlbar.h
@@ -46,11 +46,17 @@ class UrlBar : public KHistoryComboBox
Q_OBJECT
public:
- UrlBar(QWidget *parent=0);
+ UrlBar(QWidget *parent = 0);
~UrlBar();
- void selectAll() const { lineEdit()->selectAll(); }
- KUrl url() const { return m_currentUrl; }
+ void selectAll() const
+ {
+ lineEdit()->selectAll();
+ }
+ KUrl url() const
+ {
+ return m_currentUrl;
+ }
QSize sizeHint() const;
@@ -66,22 +72,25 @@ private slots:
void slotLoadFinished(bool);
void slotCleared();
void slotUpdateUrl();
-
+
protected:
virtual void paintEvent(QPaintEvent *event);
virtual void focusOutEvent(QFocusEvent *event);
private:
void setupLineEdit();
-
- KLineEdit *lineEdit() const { return m_lineEdit; }
-
+
+ KLineEdit *lineEdit() const
+ {
+ return m_lineEdit;
+ }
+
static QLinearGradient generateGradient(const QColor &color, int height);
-
+
static QColor s_defaultBaseColor;
LineEdit *m_lineEdit;
-
+
QIcon m_currentIcon;
KUrl m_currentUrl;
int m_progress;
diff --git a/src/webview.cpp b/src/webview.cpp
index 1320f38a..5f42112b 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -73,7 +73,7 @@ WebPage::~WebPage()
bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
{
QString scheme = request.url().scheme();
- if (scheme == QLatin1String("mailto") )
+ if (scheme == QLatin1String("mailto"))
{
KToolInvocation::invokeMailer(request.url());
return false;
@@ -81,13 +81,13 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
WebView *webView;
- switch(type)
+ switch (type)
{
- // user clicked on a link or pressed return on a focused link.
+ // user clicked on a link or pressed return on a focused link.
case QWebPage::NavigationTypeLinkClicked:
- if(m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton)
+ if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton)
{
webView = Application::instance()->newWebView();
webView->setFocus();
@@ -105,7 +105,7 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
else
{
// if frame doesn't exists (perhaps) we are pointing to a blank target..
- if(!frame)
+ if (!frame)
{
webView = Application::instance()->newWebView();
webView->setFocus();
@@ -115,43 +115,43 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
}
break;
- // user activated a submit button for an HTML form.
+ // user activated a submit button for an HTML form.
case QWebPage::NavigationTypeFormSubmitted:
break;
- // Navigation to a previously shown document in the back or forward history is requested.
+ // Navigation to a previously shown document in the back or forward history is requested.
case QWebPage::NavigationTypeBackOrForward:
break;
- // user activated the reload action.
+ // user activated the reload action.
case QWebPage::NavigationTypeReload:
- #if QT_VERSION <= 040500
- // HACK Ported from Arora
- // A short term hack until QtWebKit can get a reload without cache QAction
- // *FYI* currently type is never NavigationTypeReload
- // See: https://bugs.webkit.org/show_bug.cgi?id=24283
- if (qApp->keyboardModifiers() & Qt::ShiftModifier)
- {
- QNetworkRequest newRequest(request);
- newRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute,
- QNetworkRequest::AlwaysNetwork);
- mainFrame()->load(request);
- return false;
- }
- #endif
+#if QT_VERSION <= 040500
+ // HACK Ported from Arora
+ // A short term hack until QtWebKit can get a reload without cache QAction
+ // *FYI* currently type is never NavigationTypeReload
+ // See: https://bugs.webkit.org/show_bug.cgi?id=24283
+ if (qApp->keyboardModifiers() & Qt::ShiftModifier)
+ {
+ QNetworkRequest newRequest(request);
+ newRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute,
+ QNetworkRequest::AlwaysNetwork);
+ mainFrame()->load(request);
+ return false;
+ }
+#endif
break;
- // An HTML form was submitted a second time.
+ // An HTML form was submitted a second time.
case QWebPage::NavigationTypeFormResubmitted:
break;
- // A navigation to another document using a method not listed above.
+ // A navigation to another document using a method not listed above.
case QWebPage::NavigationTypeOther:
break;
- // should be nothing..
+ // should be nothing..
default:
break;
}
@@ -300,55 +300,55 @@ WebView::WebView(QWidget* parent)
KActionCollection* WebView::webActions()
{
- if(!s_webActionCollection)
+ if (!s_webActionCollection)
{
s_webActionCollection = new KActionCollection(this);
QAction *a;
a = new KAction(KIcon("tab-new"), i18n("Open Link in New &Tab"), this);
- connect(a, SIGNAL(triggered()), this, SLOT(openLinkInNewTab()) );
- s_webActionCollection->addAction( QLatin1String("open_link_in_new_tab"), a);
-
+ connect(a, SIGNAL(triggered()), this, SLOT(openLinkInNewTab()));
+ s_webActionCollection->addAction(QLatin1String("open_link_in_new_tab"), a);
+
a = pageAction(QWebPage::Cut);
a->setIcon(KIcon("edit-cut"));
a->setText(i18n("Cu&t"));
- s_webActionCollection->addAction( QLatin1String("edit_cut"), a);
-
+ s_webActionCollection->addAction(QLatin1String("edit_cut"), a);
+
a = pageAction(QWebPage::Copy);
a->setIcon(KIcon("edit-copy"));
a->setText(i18n("&Copy"));
- s_webActionCollection->addAction( QLatin1String("edit_copy"), a );
-
+ s_webActionCollection->addAction(QLatin1String("edit_copy"), a);
+
a = pageAction(QWebPage::Paste);
a->setIcon(KIcon("edit-paste"));
a->setText(i18n("&Paste"));
- s_webActionCollection->addAction( QLatin1String("edit_paste"), a );
-
+ s_webActionCollection->addAction(QLatin1String("edit_paste"), a);
+
a = pageAction(QWebPage::DownloadImageToDisk);
a->setIcon(KIcon("folder-image"));
a->setText(i18n("&Save Image As..."));
- s_webActionCollection->addAction( QLatin1String("save_image_as"), a );
-
+ s_webActionCollection->addAction(QLatin1String("save_image_as"), a);
+
a = pageAction(QWebPage::CopyImageToClipboard);
a->setIcon(KIcon("insert-image"));
a->setText(i18n("&Copy This Image"));
- s_webActionCollection->addAction( QLatin1String("copy_this_image"), a);
+ s_webActionCollection->addAction(QLatin1String("copy_this_image"), a);
a = pageAction(QWebPage::DownloadLinkToDisk);
a->setIcon(KIcon("folder-downloads"));
a->setText(i18n("&Save Link As..."));
- s_webActionCollection->addAction( QLatin1String("save_link_as"), a);
-
+ s_webActionCollection->addAction(QLatin1String("save_link_as"), a);
+
a = pageAction(QWebPage::CopyLinkToClipboard);
a->setIcon(KIcon("insert-link"));
a->setText(i18n("&Copy Link Location"));
- s_webActionCollection->addAction( QLatin1String("copy_link_location"), a);
+ s_webActionCollection->addAction(QLatin1String("copy_link_location"), a);
a = pageAction(QWebPage::InspectElement);
a->setIcon(KIcon("tools-report-bug"));
a->setText(i18n("&Inspect Element"));
- s_webActionCollection->addAction( QLatin1String("inspect_element"), a);
+ s_webActionCollection->addAction(QLatin1String("inspect_element"), a);
}
return s_webActionCollection;
@@ -359,16 +359,16 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
{
QWebHitTestResult result = page()->mainFrame()->hitTestContent(event->pos());
MainWindow *mainwindow = Application::instance()->mainWindow();
-
+
QAction *addBookmarkAction = Application::bookmarkProvider()->actionByName("add_bookmark_payload");
addBookmarkAction->setText(i18n("Bookmark This Page"));
addBookmarkAction->setData(QVariant());
KMenu menu(this);
-
+
bool linkIsEmpty = result.linkUrl().isEmpty();
if (!linkIsEmpty)
{
- menu.addAction( webActions()->action("open_link_in_new_tab") );
+ menu.addAction(webActions()->action("open_link_in_new_tab"));
}
else
{
@@ -379,7 +379,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled))
{
- menu.addAction( webActions()->action("inspect_element") );
+ menu.addAction(webActions()->action("inspect_element"));
menu.addSeparator();
}
@@ -389,17 +389,17 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
if (result.isContentSelected() && result.isContentEditable())
{
- menu.addAction( webActions()->action("edit_cut") );
+ menu.addAction(webActions()->action("edit_cut"));
}
if (result.isContentSelected())
{
- menu.addAction( webActions()->action("edit_copy") );
+ menu.addAction(webActions()->action("edit_copy"));
}
if (result.isContentEditable())
{
- menu.addAction( webActions()->action("edit_paste") );
+ menu.addAction(webActions()->action("edit_paste"));
}
if (!linkIsEmpty)
@@ -408,16 +408,16 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
if (!result.pixmap().isNull())
{
// TODO Add "View Image"
- menu.addAction( webActions()->action("save_image_as") );
- menu.addAction( webActions()->action("copy_this_image") );
+ menu.addAction(webActions()->action("save_image_as"));
+ menu.addAction(webActions()->action("copy_this_image"));
}
- menu.addAction( webActions()->action("save_link_as") );
- menu.addAction( webActions()->action("copy_link_location") );
+ menu.addAction(webActions()->action("save_link_as"));
+ menu.addAction(webActions()->action("copy_link_location"));
addBookmarkAction->setData(result.linkUrl());
addBookmarkAction->setText(i18n("&Bookmark This Link"));
}
menu.addSeparator();
-
+
menu.addAction(addBookmarkAction);
menu.exec(mapToGlobal(event->pos()));
}
diff --git a/src/webview.h b/src/webview.h
index 0a46f1e5..11f04571 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -56,14 +56,14 @@ public:
~WebPage();
protected:
- bool acceptNavigationRequest(QWebFrame *frame,
- const QNetworkRequest &request,
+ bool acceptNavigationRequest(QWebFrame *frame,
+ const QNetworkRequest &request,
NavigationType type);
-
+
QWebPage *createWindow(QWebPage::WebWindowType type);
- QObject *createPlugin(const QString &classId,
- const QUrl &url,
- const QStringList &paramNames,
+ QObject *createPlugin(const QString &classId,
+ const QUrl &url,
+ const QStringList &paramNames,
const QStringList &paramValues);
private slots:
@@ -92,14 +92,26 @@ class WebView : public QWebView
public:
WebView(QWidget *parent = 0);
-
+
KActionCollection* webActions();
// inline
- WebPage *webPage() const { return m_page; }
- KUrl url() const { return KUrl(QWebView::url()); }
- QString lastStatusBarText() const { return m_statusBarText; }
- int progress() const { return m_progress; }
+ WebPage *webPage() const
+ {
+ return m_page;
+ }
+ KUrl url() const
+ {
+ return KUrl(QWebView::url());
+ }
+ QString lastStatusBarText() const
+ {
+ return m_statusBarText;
+ }
+ int progress() const
+ {
+ return m_progress;
+ }
signals:
// switching tabs
@@ -119,17 +131,23 @@ protected:
void keyPressEvent(QKeyEvent *event);
private slots:
- void setProgress(int progress) { m_progress = progress; }
+ void setProgress(int progress)
+ {
+ m_progress = progress;
+ }
void loadFinished();
- void setStatusBarText(const QString &string) { m_statusBarText = string; }
+ void setStatusBarText(const QString &string)
+ {
+ m_statusBarText = string;
+ }
void downloadRequested(const QNetworkRequest &request);
void openLinkInNewTab();
private:
static KActionCollection* s_webActionCollection;
-
+
WebPage *m_page;
-
+
int m_progress;
QString m_statusBarText;
};