From 2147abb0c02358b512925191d3e545574ec80e08 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 1 Nov 2008 13:04:26 +0100 Subject: Localizing strings.. --- CMakeLists.txt | 3 + src/CMakeLists.txt | 2 +- src/bookmarks.cpp | 162 ++-- src/browserapplication.cpp | 14 +- src/browserapplication.h | 6 +- src/browsermainwindow.cpp | 559 +++++++------- src/browsermainwindow.h | 83 +-- src/chasewidget.cpp | 138 ---- src/chasewidget.h | 81 -- src/cookiejar.cpp | 115 ++- src/data/addtab.png | Bin 469 -> 0 bytes src/data/browser.svg | 1598 ---------------------------------------- src/data/closetab.png | Bin 516 -> 0 bytes src/data/data.qrc | 11 - src/data/defaultbookmarks.xbel | 40 - src/data/defaulticon.png | Bin 1473 -> 0 bytes src/data/history.png | Bin 1527 -> 0 bytes src/data/loading.gif | Bin 847 -> 0 bytes src/downloadmanager.cpp | 130 ++-- src/downloadmanager.h | 61 +- src/history.cpp | 127 ++-- src/history.h | 71 +- src/htmls/htmls.qrc | 5 - src/htmls/notfound.html | 63 -- src/main.cpp | 2 +- src/networkaccessmanager.cpp | 88 +-- src/networkaccessmanager.h | 54 +- src/searchlineedit.cpp | 71 +- src/searchlineedit.h | 60 +- src/tabwidget.cpp | 104 ++- src/tabwidget.h | 56 +- src/toolbarsearch.cpp | 82 +-- src/toolbarsearch.h | 54 +- src/webview.cpp | 80 +- src/webview.h | 56 +- src/xbel.cpp | 67 +- src/xbel.h | 54 +- 37 files changed, 928 insertions(+), 3169 deletions(-) delete mode 100644 src/chasewidget.cpp delete mode 100644 src/chasewidget.h delete mode 100644 src/data/addtab.png delete mode 100644 src/data/browser.svg delete mode 100644 src/data/closetab.png delete mode 100644 src/data/data.qrc delete mode 100644 src/data/defaultbookmarks.xbel delete mode 100644 src/data/defaulticon.png delete mode 100644 src/data/history.png delete mode 100644 src/data/loading.gif delete mode 100644 src/htmls/htmls.qrc delete mode 100755 src/htmls/notfound.html diff --git a/CMakeLists.txt b/CMakeLists.txt index 78d320d6..f4de5473 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,3 +20,6 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ) ADD_SUBDIRECTORY( src ) +ADD_SUBDIRECTORY( icons ) +ADD_SUBDIRECTORY( data ) +ADD_SUBDIRECTORY( htmls ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 26283c2e..d10368f9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,6 @@ SET( rekonq_SRCS bookmarks.cpp browserapplication.cpp browsermainwindow.cpp - chasewidget.cpp cookiejar.cpp downloadmanager.cpp edittableview.cpp @@ -12,6 +11,7 @@ SET( rekonq_SRCS modelmenu.cpp networkaccessmanager.cpp searchlineedit.cpp +# searchbar.cpp settings.cpp squeezelabel.cpp tabwidget.cpp diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp index 9b47747d..7f432ba9 100644 --- a/src/bookmarks.cpp +++ b/src/bookmarks.cpp @@ -1,62 +1,44 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ - +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + + +// Local Includes #include "bookmarks.h" - #include "autosaver.h" #include "browserapplication.h" #include "history.h" #include "xbel.h" -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include +// Qt Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include #define BOOKMARKBAR "Bookmarks Bar" #define BOOKMARKMENU "Bookmarks Menu" @@ -101,8 +83,13 @@ void BookmarksManager::load() m_bookmarkRootNode = reader.read(bookmarkFile); if (reader.error() != QXmlStreamReader::NoError) { QMessageBox::warning(0, QLatin1String("Loading Bookmark"), - tr("Error when loading bookmarks on line %1, column %2:\n" - "%3").arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString())); + i18n("Error when loading bookmarks on line ") + + QString( (int) reader.lineNumber() ) + + i18n(", column ") + + QString( (int) reader.columnNumber() ) + + ":\n" + + reader.errorString() + ) ; } BookmarkNode *toolbar = 0; @@ -112,18 +99,18 @@ void BookmarksManager::load() BookmarkNode *node = m_bookmarkRootNode->children().at(i); if (node->type() == BookmarkNode::Folder) { // Automatically convert - if (node->title == tr("Toolbar Bookmarks") && !toolbar) { - node->title = tr(BOOKMARKBAR); + if (node->title == i18n("Toolbar Bookmarks") && !toolbar) { + node->title = i18n(BOOKMARKBAR); } - if (node->title == tr(BOOKMARKBAR) && !toolbar) { + if (node->title == i18n(BOOKMARKBAR) && !toolbar) { toolbar = node; } // Automatically convert - if (node->title == tr("Menu") && !menu) { - node->title = tr(BOOKMARKMENU); + if (node->title == i18n("Menu") && !menu) { + node->title = i18n(BOOKMARKMENU); } - if (node->title == tr(BOOKMARKMENU) && !menu) { + if (node->title == i18n(BOOKMARKMENU) && !menu) { menu = node; } } else { @@ -134,14 +121,14 @@ void BookmarksManager::load() Q_ASSERT(m_bookmarkRootNode->children().count() == 0); if (!toolbar) { toolbar = new BookmarkNode(BookmarkNode::Folder, m_bookmarkRootNode); - toolbar->title = tr(BOOKMARKBAR); + toolbar->title = i18n(BOOKMARKBAR); } else { m_bookmarkRootNode->add(toolbar); } if (!menu) { menu = new BookmarkNode(BookmarkNode::Folder, m_bookmarkRootNode); - menu->title = tr(BOOKMARKMENU); + menu->title = i18n(BOOKMARKMENU); } else { m_bookmarkRootNode->add(menu); } @@ -217,7 +204,7 @@ BookmarkNode *BookmarksManager::menu() for (int i = m_bookmarkRootNode->children().count() - 1; i >= 0; --i) { BookmarkNode *node = m_bookmarkRootNode->children().at(i); - if (node->title == tr(BOOKMARKMENU)) + if (node->title == i18n(BOOKMARKMENU)) return node; } Q_ASSERT(false); @@ -231,7 +218,7 @@ BookmarkNode *BookmarksManager::toolbar() for (int i = m_bookmarkRootNode->children().count() - 1; i >= 0; --i) { BookmarkNode *node = m_bookmarkRootNode->children().at(i); - if (node->title == tr(BOOKMARKBAR)) + if (node->title == i18n(BOOKMARKBAR)) return node; } Q_ASSERT(false); @@ -247,9 +234,9 @@ BookmarksModel *BookmarksManager::bookmarksModel() void BookmarksManager::importBookmarks() { - QString fileName = QFileDialog::getOpenFileName(0, tr("Open File"), + QString fileName = QFileDialog::getOpenFileName(0, i18n("Open File"), QString(), - tr("XBEL (*.xbel *.xml)")); + i18n("XBEL (*.xbel *.xml)")); if (fileName.isEmpty()) return; @@ -257,30 +244,30 @@ void BookmarksManager::importBookmarks() BookmarkNode *importRootNode = reader.read(fileName); if (reader.error() != QXmlStreamReader::NoError) { QMessageBox::warning(0, QLatin1String("Loading Bookmark"), - tr("Error when loading bookmarks on line %1, column %2:\n" - "%3").arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString())); + i18n("Error when loading bookmarks on line %1, column %2:\n %3", reader.lineNumber(), reader.columnNumber(), reader.errorString() ) + ); } importRootNode->setType(BookmarkNode::Folder); - importRootNode->title = (tr("Imported %1").arg(QDate::currentDate().toString(Qt::SystemLocaleShortDate))); + importRootNode->title = ( i18n("Imported ") + QDate::currentDate().toString(Qt::SystemLocaleShortDate) ); addBookmark(menu(), importRootNode); } void BookmarksManager::exportBookmarks() { - QString fileName = QFileDialog::getSaveFileName(0, tr("Save File"), - tr("%1 Bookmarks.xbel").arg(QCoreApplication::applicationName()), - tr("XBEL (*.xbel *.xml)")); + QString fileName = QFileDialog::getSaveFileName(0, i18n("Save File"), + QCoreApplication::applicationName() + i18n(" Bookmarks.xbel"), + i18n("XBEL (*.xbel *.xml)")); if (fileName.isEmpty()) return; XbelWriter writer; if (!writer.write(fileName, m_bookmarkRootNode)) - QMessageBox::critical(0, tr("Export error"), tr("error saving bookmarks")); + QMessageBox::critical(0, i18n("Export error"), i18n("error saving bookmarks")); } RemoveBookmarksCommand::RemoveBookmarksCommand(BookmarksManager *m_bookmarkManagaer, BookmarkNode *parent, int row) - : QUndoCommand(BookmarksManager::tr("Remove Bookmark")) + : QUndoCommand( i18n("Remove Bookmark") ) , m_row(row) , m_bookmarkManagaer(m_bookmarkManagaer) , m_node(parent->children().value(row)) @@ -314,7 +301,7 @@ InsertBookmarksCommand::InsertBookmarksCommand(BookmarksManager *m_bookmarkManag BookmarkNode *parent, BookmarkNode *node, int row) : RemoveBookmarksCommand(m_bookmarkManagaer, parent, row) { - setText(BookmarksManager::tr("Insert Bookmark")); + setText( i18n("Insert Bookmark") ); m_node = node; } @@ -328,10 +315,10 @@ ChangeBookmarkCommand::ChangeBookmarkCommand(BookmarksManager *m_bookmarkManagae { if (m_title) { m_oldValue = m_node->title; - setText(BookmarksManager::tr("Name Change")); + setText( i18n("Name Change") ); } else { m_oldValue = m_node->url; - setText(BookmarksManager::tr("Address Change")); + setText( i18n("Address Change") ); } } @@ -358,12 +345,9 @@ BookmarksModel::BookmarksModel(BookmarksManager *bookmarkManager, QObject *paren , m_endMacro(false) , m_bookmarksManager(bookmarkManager) { - connect(bookmarkManager, SIGNAL(entryAdded(BookmarkNode *)), - this, SLOT(entryAdded(BookmarkNode *))); - connect(bookmarkManager, SIGNAL(entryRemoved(BookmarkNode *, int, BookmarkNode *)), - this, SLOT(entryRemoved(BookmarkNode *, int, BookmarkNode *))); - connect(bookmarkManager, SIGNAL(entryChanged(BookmarkNode *)), - this, SLOT(entryChanged(BookmarkNode *))); + connect(bookmarkManager, SIGNAL(entryAdded(BookmarkNode *)), this, SLOT(entryAdded(BookmarkNode *))); + connect(bookmarkManager, SIGNAL(entryRemoved(BookmarkNode *, int, BookmarkNode *)), this, SLOT(entryRemoved(BookmarkNode *, int, BookmarkNode *))); + connect(bookmarkManager, SIGNAL(entryChanged(BookmarkNode *)), this, SLOT(entryChanged(BookmarkNode *))); } QModelIndex BookmarksModel::index(BookmarkNode *node) const @@ -426,8 +410,8 @@ QVariant BookmarksModel::headerData(int section, Qt::Orientation orientation, in { if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { switch (section) { - case 0: return tr("Title"); - case 1: return tr("Address"); + case 0: return i18n("Title"); + case 1: return i18n("Address"); } } return QAbstractItemModel::headerData(section, orientation, role); @@ -843,10 +827,10 @@ void BookmarksDialog::customContextMenuRequested(const QPoint &pos) QModelIndex index = tree->indexAt(pos); index = index.sibling(index.row(), 0); if (index.isValid() && !tree->model()->hasChildren(index)) { - menu.addAction(tr("Open"), this, SLOT(open())); + menu.addAction( i18n("Open"), this, SLOT(open())); menu.addSeparator(); } - menu.addAction(tr("Delete"), tree, SLOT(removeOne())); + menu.addAction( i18n("Delete"), tree, SLOT(removeOne())); menu.exec(QCursor::pos()); } @@ -869,12 +853,12 @@ void BookmarksDialog::newFolder() idx = m_proxyModel->mapToSource(idx); BookmarkNode *parent = m_bookmarksManager->bookmarksModel()->node(idx); BookmarkNode *node = new BookmarkNode(BookmarkNode::Folder); - node->title = tr("New Folder"); + node->title = i18n("New Folder"); m_bookmarksManager->addBookmark(parent, node, currentIndex.row() + 1); } BookmarksToolBar::BookmarksToolBar(BookmarksModel *model, QWidget *parent) - : QToolBar(tr("Bookmark"), parent) + : QToolBar( i18n("Bookmark"), parent) , m_bookmarksModel(model) { connect(this, SIGNAL(actionTriggered(QAction*)), this, SLOT(triggered(QAction*))); diff --git a/src/browserapplication.cpp b/src/browserapplication.cpp index 60e1d283..6d4e08fa 100644 --- a/src/browserapplication.cpp +++ b/src/browserapplication.cpp @@ -152,8 +152,7 @@ void BrowserApplication::quitBrowser() if (tabCount > 1) { int ret = QMessageBox::warning(mainWindow(), QString(), - tr("There are %1 windows and %2 tabs open\n" - "Do you want to quit anyway?").arg(m_mainWindows.count()).arg(tabCount), + i18n("There are ") + QString( m_mainWindows.count() ) + i18n(" windows and ") + QString(tabCount) + i18n("tabs open\n"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (ret == QMessageBox::No) @@ -461,12 +460,13 @@ BookmarksManager *BrowserApplication::bookmarksManager() -QIcon BrowserApplication::icon(const QUrl &url) const +KIcon BrowserApplication::icon(const QUrl &url) const { - QIcon icon = QWebSettings::iconForUrl(url); + KIcon icon = KIcon( QWebSettings::iconForUrl(url) ); if (!icon.isNull()) - return icon.pixmap(16, 16); + return icon; if (m_defaultIcon.isNull()) - m_defaultIcon = QIcon(QLatin1String(":defaulticon.png")); - return m_defaultIcon.pixmap(16, 16); + m_defaultIcon = KIcon("rekonq"); + return m_defaultIcon; } + diff --git a/src/browserapplication.h b/src/browserapplication.h index 73b908ce..801cdec5 100644 --- a/src/browserapplication.h +++ b/src/browserapplication.h @@ -23,10 +23,10 @@ #include #include +#include #include #include -#include QT_BEGIN_NAMESPACE class QLocalServer; @@ -52,7 +52,7 @@ public: bool isTheOnlyBrowser() const; BrowserMainWindow *mainWindow(); QList mainWindows(); - QIcon icon(const QUrl &url) const; + KIcon icon(const QUrl &url) const; void saveSession(); bool canRestoreSession() const; @@ -92,7 +92,7 @@ private: QList > m_mainWindows; QLocalServer *m_localServer; QByteArray m_lastSession; - mutable QIcon m_defaultIcon; + mutable KIcon m_defaultIcon; }; #endif // BROWSERAPPLICATION_H diff --git a/src/browsermainwindow.cpp b/src/browsermainwindow.cpp index 3d1617e4..450f90b5 100644 --- a/src/browsermainwindow.cpp +++ b/src/browsermainwindow.cpp @@ -1,46 +1,28 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + #include "browsermainwindow.h" #include "autosaver.h" #include "bookmarks.h" #include "browserapplication.h" -#include "chasewidget.h" #include "downloadmanager.h" #include "history.h" #include "settings.h" @@ -49,27 +31,29 @@ #include "ui_passworddialog.h" #include "webview.h" -#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include -#include -#include +#include -#include BrowserMainWindow::BrowserMainWindow(QWidget *parent, Qt::WindowFlags flags) - : QMainWindow(parent, flags) + : KMainWindow(parent, flags) , m_tabWidget(new TabWidget(this)) , m_autoSaver(new AutoSaver(this)) , m_historyBack(0) @@ -83,57 +67,34 @@ BrowserMainWindow::BrowserMainWindow(QWidget *parent, Qt::WindowFlags flags) setupToolBar(); QWidget *centralWidget = new QWidget(this); - BookmarksModel *boomarksModel = BrowserApplication::bookmarksManager()->bookmarksModel(); - m_bookmarksToolbar = new BookmarksToolBar(boomarksModel, this); - connect(m_bookmarksToolbar, SIGNAL(openUrl(const QUrl&)), - m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&))); - connect(m_bookmarksToolbar->toggleViewAction(), SIGNAL(toggled(bool)), - this, SLOT(updateBookmarksToolbarActionText(bool))); QVBoxLayout *layout = new QVBoxLayout; layout->setSpacing(0); layout->setMargin(0); #if defined(Q_WS_MAC) - layout->addWidget(m_bookmarksToolbar); layout->addWidget(new QWidget); // <- OS X tab widget style bug #else addToolBarBreak(); - addToolBar(m_bookmarksToolbar); #endif layout->addWidget(m_tabWidget); centralWidget->setLayout(layout); setCentralWidget(centralWidget); - connect(m_tabWidget, SIGNAL(loadPage(const QString &)), - this, SLOT(loadPage(const QString &))); - connect(m_tabWidget, SIGNAL(setCurrentTitle(const QString &)), - this, SLOT(slotUpdateWindowTitle(const QString &))); - connect(m_tabWidget, SIGNAL(showStatusBarMessage(const QString&)), - statusBar(), SLOT(showMessage(const QString&))); - connect(m_tabWidget, SIGNAL(linkHovered(const QString&)), - statusBar(), SLOT(showMessage(const QString&))); - connect(m_tabWidget, SIGNAL(loadProgress(int)), - this, SLOT(slotLoadProgress(int))); - connect(m_tabWidget, SIGNAL(tabsChanged()), - m_autoSaver, SLOT(changeOccurred())); - connect(m_tabWidget, SIGNAL(geometryChangeRequested(const QRect &)), - this, SLOT(geometryChangeRequested(const QRect &))); - connect(m_tabWidget, SIGNAL(printRequested(QWebFrame *)), - this, SLOT(printRequested(QWebFrame *))); - connect(m_tabWidget, SIGNAL(menuBarVisibilityChangeRequested(bool)), - menuBar(), SLOT(setVisible(bool))); - connect(m_tabWidget, SIGNAL(statusBarVisibilityChangeRequested(bool)), - statusBar(), SLOT(setVisible(bool))); - connect(m_tabWidget, SIGNAL(toolBarVisibilityChangeRequested(bool)), - m_navigationBar, SLOT(setVisible(bool))); - connect(m_tabWidget, SIGNAL(toolBarVisibilityChangeRequested(bool)), - m_bookmarksToolbar, SLOT(setVisible(bool))); + connect(m_tabWidget, SIGNAL(loadPage(const QString &)), this, SLOT(loadPage(const QString &))); + connect(m_tabWidget, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &))); + connect(m_tabWidget, SIGNAL(showStatusBarMessage(const QString&)), statusBar(), SLOT(showMessage(const QString&))); + connect(m_tabWidget, SIGNAL(linkHovered(const QString&)), statusBar(), SLOT(showMessage(const QString&))); + connect(m_tabWidget, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); + connect(m_tabWidget, SIGNAL(tabsChanged()), m_autoSaver, SLOT(changeOccurred())); + connect(m_tabWidget, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(geometryChangeRequested(const QRect &))); + connect(m_tabWidget, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *))); + connect(m_tabWidget, SIGNAL(menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT(setVisible(bool))); + connect(m_tabWidget, SIGNAL(statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT(setVisible(bool))); + connect(m_tabWidget, SIGNAL(toolBarVisibilityChangeRequested(bool)), m_navigationBar, SLOT(setVisible(bool))); #if defined(Q_WS_MAC) - connect(m_tabWidget, SIGNAL(lastTabClosed()), - this, SLOT(close())); + connect(m_tabWidget, SIGNAL(lastTabClosed()), this, SLOT(close())); #else - connect(m_tabWidget, SIGNAL(lastTabClosed()), - m_tabWidget, SLOT(newTab())); + connect(m_tabWidget, SIGNAL(lastTabClosed()), m_tabWidget, SLOT(newTab())); #endif slotUpdateWindowTitle(); @@ -144,12 +105,16 @@ BrowserMainWindow::BrowserMainWindow(QWidget *parent, Qt::WindowFlags flags) m_navigationBar->setIconSize(QSize(size, size)); } + + BrowserMainWindow::~BrowserMainWindow() { m_autoSaver->changeOccurred(); m_autoSaver->saveIfNeccessary(); } + + void BrowserMainWindow::loadDefaultState() { QSettings settings; @@ -159,6 +124,8 @@ void BrowserMainWindow::loadDefaultState() settings.endGroup(); } + + QSize BrowserMainWindow::sizeHint() const { QRect desktopRect = QApplication::desktop()->screenGeometry(); @@ -166,6 +133,8 @@ QSize BrowserMainWindow::sizeHint() const return size; } + + void BrowserMainWindow::save() { BrowserApplication::instance()->saveSession(); @@ -177,8 +146,12 @@ void BrowserMainWindow::save() settings.endGroup(); } + + static const qint32 BrowserMainWindowMagic = 0xba; + + QByteArray BrowserMainWindow::saveState(bool withTabs) const { int version = 2; @@ -190,8 +163,7 @@ QByteArray BrowserMainWindow::saveState(bool withTabs) const stream << size(); stream << !m_navigationBar->isHidden(); - stream << !m_bookmarksToolbar->isHidden(); - stream << !statusBar()->isHidden(); +// stream << !statusBar()->isHidden(); // FIXME strange error ???? if (withTabs) stream << tabWidget()->saveState(); else @@ -199,6 +171,8 @@ QByteArray BrowserMainWindow::saveState(bool withTabs) const return data; } + + bool BrowserMainWindow::restoreState(const QByteArray &state) { int version = 2; @@ -229,10 +203,6 @@ bool BrowserMainWindow::restoreState(const QByteArray &state) resize(size); m_navigationBar->setVisible(showToolbar); - updateToolbarActionText(showToolbar); - - m_bookmarksToolbar->setVisible(showBookmarksBar); - updateBookmarksToolbarActionText(showBookmarksBar); statusBar()->setVisible(showStatusbar); updateStatusbarActionText(showStatusbar); @@ -243,145 +213,140 @@ bool BrowserMainWindow::restoreState(const QByteArray &state) return true; } + + void BrowserMainWindow::setupMenu() { new QShortcut(QKeySequence(Qt::Key_F6), this, SLOT(slotSwapFocus())); - // File - QMenu *fileMenu = menuBar()->addMenu(tr("&File")); + // ------------------------------------------------------------- FILE -------------------------------------------------------------------------------------------------- + QMenu *fileMenu = menuBar()->addMenu( i18n("&File")); - fileMenu->addAction(tr("&New Window"), this, SLOT(slotFileNew()), QKeySequence::New); + fileMenu->addAction(i18n("&New Window"), this, SLOT(slotFileNew()), QKeySequence::New); fileMenu->addAction(m_tabWidget->newTabAction()); - fileMenu->addAction(tr("&Open File..."), this, SLOT(slotFileOpen()), QKeySequence::Open); - fileMenu->addAction(tr("Open &Location..."), this, - SLOT(slotSelectLineEdit()), QKeySequence(Qt::ControlModifier + Qt::Key_L)); + fileMenu->addAction(i18n("&Open File..."), this, SLOT(slotFileOpen()), QKeySequence::Open); + fileMenu->addAction(i18n("Open &Location..."), this, SLOT(slotSelectLineEdit()), QKeySequence(Qt::ControlModifier + Qt::Key_L)); fileMenu->addSeparator(); + fileMenu->addAction(m_tabWidget->closeTabAction()); fileMenu->addSeparator(); - fileMenu->addAction(tr("&Save As..."), this, - SLOT(slotFileSaveAs()), QKeySequence(QKeySequence::Save)); - fileMenu->addSeparator(); - BookmarksManager *bookmarksManager = BrowserApplication::bookmarksManager(); - fileMenu->addAction(tr("&Import Bookmarks..."), bookmarksManager, SLOT(importBookmarks())); - fileMenu->addAction(tr("&Export Bookmarks..."), bookmarksManager, SLOT(exportBookmarks())); + + fileMenu->addAction(i18n("&Save As..."), this, SLOT(slotFileSaveAs()), QKeySequence(QKeySequence::Save)); fileMenu->addSeparator(); - fileMenu->addAction(tr("P&rint Preview..."), this, SLOT(slotFilePrintPreview())); - fileMenu->addAction(tr("&Print..."), this, SLOT(slotFilePrint()), QKeySequence::Print); + + fileMenu->addAction(i18n("P&rint Preview..."), this, SLOT(slotFilePrintPreview())); + fileMenu->addAction(i18n("&Print..."), this, SLOT(slotFilePrint()), QKeySequence::Print); fileMenu->addSeparator(); - QAction *action = fileMenu->addAction(tr("Private &Browsing..."), this, SLOT(slotPrivateBrowsing())); + + QAction *action = fileMenu->addAction(i18n("Private &Browsing..."), this, SLOT(slotPrivateBrowsing())); action->setCheckable(true); fileMenu->addSeparator(); #if defined(Q_WS_MAC) - fileMenu->addAction(tr("&Quit"), BrowserApplication::instance(), SLOT(quitBrowser()), QKeySequence(Qt::CTRL | Qt::Key_Q)); + fileMenu->addAction( i18n("&Quit"), BrowserApplication::instance(), SLOT(quitBrowser()), QKeySequence(Qt::CTRL | Qt::Key_Q)); #else - fileMenu->addAction(tr("&Quit"), this, SLOT(close()), QKeySequence(Qt::CTRL | Qt::Key_Q)); + fileMenu->addAction( i18n("&Quit"), this, SLOT(close()), QKeySequence(Qt::CTRL | Qt::Key_Q)); #endif - // Edit - QMenu *editMenu = menuBar()->addMenu(tr("&Edit")); - QAction *m_undo = editMenu->addAction(tr("&Undo")); + // ------------------------------------------------------------- EDIT -------------------------------------------------------------------------------------------------- + QMenu *editMenu = menuBar()->addMenu(i18n("&Edit")); + + QAction *m_undo = editMenu->addAction(i18n("&Undo")); m_undo->setShortcuts(QKeySequence::Undo); m_tabWidget->addWebAction(m_undo, QWebPage::Undo); - QAction *m_redo = editMenu->addAction(tr("&Redo")); + + QAction *m_redo = editMenu->addAction(i18n("&Redo")); m_redo->setShortcuts(QKeySequence::Redo); m_tabWidget->addWebAction(m_redo, QWebPage::Redo); + editMenu->addSeparator(); - QAction *m_cut = editMenu->addAction(tr("Cu&t")); + + QAction *m_cut = editMenu->addAction(i18n("Cu&t")); m_cut->setShortcuts(QKeySequence::Cut); m_tabWidget->addWebAction(m_cut, QWebPage::Cut); - QAction *m_copy = editMenu->addAction(tr("&Copy")); + + QAction *m_copy = editMenu->addAction(i18n("&Copy")); m_copy->setShortcuts(QKeySequence::Copy); m_tabWidget->addWebAction(m_copy, QWebPage::Copy); - QAction *m_paste = editMenu->addAction(tr("&Paste")); + + QAction *m_paste = editMenu->addAction(i18n("&Paste")); m_paste->setShortcuts(QKeySequence::Paste); m_tabWidget->addWebAction(m_paste, QWebPage::Paste); + editMenu->addSeparator(); - QAction *m_find = editMenu->addAction(tr("&Find")); + QAction *m_find = editMenu->addAction(i18n("&Find")); m_find->setShortcuts(QKeySequence::Find); connect(m_find, SIGNAL(triggered()), this, SLOT(slotEditFind())); new QShortcut(QKeySequence(Qt::Key_Slash), this, SLOT(slotEditFind())); - QAction *m_findNext = editMenu->addAction(tr("&Find Next")); + QAction *m_findNext = editMenu->addAction( i18n("&Find Next")); m_findNext->setShortcuts(QKeySequence::FindNext); connect(m_findNext, SIGNAL(triggered()), this, SLOT(slotEditFindNext())); - QAction *m_findPrevious = editMenu->addAction(tr("&Find Previous")); + QAction *m_findPrevious = editMenu->addAction( i18n("&Find Previous")); m_findPrevious->setShortcuts(QKeySequence::FindPrevious); connect(m_findPrevious, SIGNAL(triggered()), this, SLOT(slotEditFindPrevious())); editMenu->addSeparator(); - editMenu->addAction(tr("&Preferences"), this, SLOT(slotPreferences()), tr("Ctrl+,")); + editMenu->addAction( i18n("&Preferences"), this, SLOT(slotPreferences()), i18n("Ctrl+,")); - // View - QMenu *viewMenu = menuBar()->addMenu(tr("&View")); - m_viewBookmarkBar = new QAction(this); - updateBookmarksToolbarActionText(true); - m_viewBookmarkBar->setShortcut(tr("Shift+Ctrl+B")); - connect(m_viewBookmarkBar, SIGNAL(triggered()), this, SLOT(slotViewBookmarksBar())); - viewMenu->addAction(m_viewBookmarkBar); + // ------------------------------------------------------------- VIEW ------------------------------------------------------------------------------------------------- + QMenu *viewMenu = menuBar()->addMenu( i18n("&View") ); - m_viewToolbar = new QAction(this); - updateToolbarActionText(true); - m_viewToolbar->setShortcut(tr("Ctrl+|")); - connect(m_viewToolbar, SIGNAL(triggered()), this, SLOT(slotViewToolbar())); - viewMenu->addAction(m_viewToolbar); - - m_viewStatusbar = new QAction(this); + m_viewStatusbar = new KAction(this); updateStatusbarActionText(true); - m_viewStatusbar->setShortcut(tr("Ctrl+/")); + m_viewStatusbar->setShortcut( i18n("Ctrl+/") ); connect(m_viewStatusbar, SIGNAL(triggered()), this, SLOT(slotViewStatusbar())); viewMenu->addAction(m_viewStatusbar); viewMenu->addSeparator(); - m_stop = viewMenu->addAction(tr("&Stop")); + m_stop = viewMenu->addAction( i18n("&Stop") ); QList shortcuts; shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Period)); shortcuts.append(Qt::Key_Escape); m_stop->setShortcuts(shortcuts); m_tabWidget->addWebAction(m_stop, QWebPage::Stop); - m_reload = viewMenu->addAction(tr("Reload Page")); + m_reload = viewMenu->addAction( i18n("Reload Page") ); m_reload->setShortcuts(QKeySequence::Refresh); m_tabWidget->addWebAction(m_reload, QWebPage::Reload); - viewMenu->addAction(tr("&Make Text Bigger"), this, SLOT(slotViewTextBigger()), QKeySequence(Qt::CTRL | Qt::Key_Plus)); - viewMenu->addAction(tr("&Make Text Normal"), this, SLOT(slotViewTextNormal()), QKeySequence(Qt::CTRL | Qt::Key_0)); - viewMenu->addAction(tr("&Make Text Smaller"), this, SLOT(slotViewTextSmaller()), QKeySequence(Qt::CTRL | Qt::Key_Minus)); + viewMenu->addAction( i18n("&Make Text Bigger"), this, SLOT(slotViewTextBigger()), QKeySequence(Qt::CTRL | Qt::Key_Plus)); + viewMenu->addAction( i18n("&Make Text Normal"), this, SLOT(slotViewTextNormal()), QKeySequence(Qt::CTRL | Qt::Key_0)); + viewMenu->addAction( i18n("&Make Text Smaller"), this, SLOT(slotViewTextSmaller()), QKeySequence(Qt::CTRL | Qt::Key_Minus)); viewMenu->addSeparator(); - viewMenu->addAction(tr("Page S&ource"), this, SLOT(slotViewPageSource()), tr("Ctrl+Alt+U")); - QAction *a = viewMenu->addAction(tr("&Full Screen"), this, SLOT(slotViewFullScreen(bool)), Qt::Key_F11); + viewMenu->addAction( i18n("Page S&ource"), this, SLOT(slotViewPageSource()), i18n("Ctrl+Alt+U")); + QAction *a = viewMenu->addAction( i18n("&Full Screen"), this, SLOT(slotViewFullScreen(bool)), Qt::Key_F11); a->setCheckable(true); - // History + + // ------------------------------------------------------------- HISTORY -------------------------------------------------------------------------------------------------- HistoryMenu *historyMenu = new HistoryMenu(this); - connect(historyMenu, SIGNAL(openUrl(const QUrl&)), - m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&))); - connect(historyMenu, SIGNAL(hovered(const QString&)), this, - SLOT(slotUpdateStatusbar(const QString&))); - historyMenu->setTitle(tr("Hi&story")); + connect(historyMenu, SIGNAL(openUrl(const QUrl&)), m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&))); + connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); + historyMenu->setTitle( i18n("Hi&story") ); menuBar()->addMenu(historyMenu); QList historyActions; - m_historyBack = new QAction(tr("Back"), this); + m_historyBack = new QAction( i18n("Back"), this); m_tabWidget->addWebAction(m_historyBack, QWebPage::Back); m_historyBack->setShortcuts(QKeySequence::Back); m_historyBack->setIconVisibleInMenu(false); - m_historyForward = new QAction(tr("Forward"), this); + m_historyForward = new QAction( i18n("Forward"), this); m_tabWidget->addWebAction(m_historyForward, QWebPage::Forward); m_historyForward->setShortcuts(QKeySequence::Forward); m_historyForward->setIconVisibleInMenu(false); - QAction *m_historyHome = new QAction(tr("Home"), this); + QAction *m_historyHome = new QAction( i18n("Home"), this); connect(m_historyHome, SIGNAL(triggered()), this, SLOT(slotHome())); m_historyHome->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_H)); - m_restoreLastSession = new QAction(tr("Restore Last Session"), this); + m_restoreLastSession = new QAction( i18n("Restore Last Session"), this); connect(m_restoreLastSession, SIGNAL(triggered()), BrowserApplication::instance(), SLOT(restoreLastSession())); m_restoreLastSession->setEnabled(BrowserApplication::instance()->canRestoreSession()); @@ -392,20 +357,24 @@ void BrowserMainWindow::setupMenu() historyActions.append(m_restoreLastSession); historyMenu->setInitialActions(historyActions); - // Bookmarks + // ------------------------------------------------------------- BOOKMARKS -------------------------------------------------------------------------------------------------- BookmarksMenu *bookmarksMenu = new BookmarksMenu(this); - connect(bookmarksMenu, SIGNAL(openUrl(const QUrl&)), - m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&))); - connect(bookmarksMenu, SIGNAL(hovered(const QString&)), - this, SLOT(slotUpdateStatusbar(const QString&))); - bookmarksMenu->setTitle(tr("&Bookmarks")); + connect(bookmarksMenu, SIGNAL(openUrl(const QUrl&)), m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&))); + connect(bookmarksMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); + bookmarksMenu->setTitle(i18n("&Bookmarks")); menuBar()->addMenu(bookmarksMenu); + // FIXME +// BookmarksManager *bookmarksManager = BrowserApplication::bookmarksManager(); +// bookmarksMenu->addAction(i18n("&Import Bookmarks..."), bookmarksManager, SLOT(importBookmarks())); +// bookmarksMenu->addAction(i18n("&Export Bookmarks..."), bookmarksManager, SLOT(exportBookmarks())); +// bookmarksMenu->addSeparator(); + QList bookmarksActions; - QAction *showAllBookmarksAction = new QAction(tr("Show All Bookmarks"), this); + QAction *showAllBookmarksAction = new QAction(i18n("Show All Bookmarks"), this); connect(showAllBookmarksAction, SIGNAL(triggered()), this, SLOT(slotShowBookmarksDialog())); - m_addBookmark = new QAction(QIcon(QLatin1String(":addbookmark.png")), tr("Add Bookmark..."), this); + m_addBookmark = new QAction( KIcon("bookmark-new"), i18n("Add Bookmark..."), this); m_addBookmark->setIconVisibleInMenu(false); connect(m_addBookmark, SIGNAL(triggered()), this, SLOT(slotAddBookmark())); @@ -415,73 +384,83 @@ void BrowserMainWindow::setupMenu() bookmarksActions.append(m_addBookmark); bookmarksMenu->setInitialActions(bookmarksActions); - // Window - m_windowMenu = menuBar()->addMenu(tr("&Window")); + // ------------------------------------------------------------- WINDOW -------------------------------------------------------------------------------------------------- + m_windowMenu = menuBar()->addMenu( i18n("&Window")); connect(m_windowMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowWindowMenu())); slotAboutToShowWindowMenu(); - QMenu *toolsMenu = menuBar()->addMenu(tr("&Tools")); - toolsMenu->addAction(tr("Web &Search"), this, SLOT(slotWebSearch()), QKeySequence(tr("Ctrl+K", "Web Search"))); + QMenu *toolsMenu = menuBar()->addMenu( i18n("&Tools")); + toolsMenu->addAction( i18n("Web &Search"), this, SLOT(slotWebSearch()), QKeySequence( tr("Ctrl+K", "Web Search"))); #ifndef Q_CC_MINGW - a = toolsMenu->addAction(tr("Enable Web &Inspector"), this, SLOT(slotToggleInspector(bool))); + a = toolsMenu->addAction( i18n("Enable Web &Inspector"), this, SLOT(slotToggleInspector(bool))); a->setCheckable(true); #endif - QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); - helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt())); - helpMenu->addAction(tr("About &Demo Browser"), this, SLOT(slotAboutApplication())); + QMenu *helpMenu = menuBar()->addMenu( i18n("&Help")); + helpMenu->addAction( i18n("About &Qt"), qApp, SLOT(aboutQt())); + helpMenu->addAction( i18n("About &reKonq"), this, SLOT(slotAboutApplication())); } + + + + void BrowserMainWindow::setupToolBar() { setUnifiedTitleAndToolBarOnMac(true); - m_navigationBar = addToolBar(tr("Navigation")); - connect(m_navigationBar->toggleViewAction(), SIGNAL(toggled(bool)), - this, SLOT(updateToolbarActionText(bool))); - m_historyBack->setIcon(style()->standardIcon(QStyle::SP_ArrowBack, 0, this)); + m_navigationBar = addToolBar(i18n("Navigation")); + connect(m_navigationBar->toggleViewAction(), SIGNAL(toggled(bool)), this, SLOT(updateToolbarActionText(bool))); + + m_historyBack->setIcon( KIcon("go-previous") ); m_historyBackMenu = new QMenu(this); m_historyBack->setMenu(m_historyBackMenu); - connect(m_historyBackMenu, SIGNAL(aboutToShow()), - this, SLOT(slotAboutToShowBackMenu())); - connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), - this, SLOT(slotOpenActionUrl(QAction *))); + connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowBackMenu())); + connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); m_navigationBar->addAction(m_historyBack); - m_historyForward->setIcon(style()->standardIcon(QStyle::SP_ArrowForward, 0, this)); - m_historyForwardMenu = new QMenu(this); - connect(m_historyForwardMenu, SIGNAL(aboutToShow()), - this, SLOT(slotAboutToShowForwardMenu())); - connect(m_historyForwardMenu, SIGNAL(triggered(QAction *)), - this, SLOT(slotOpenActionUrl(QAction *))); + m_historyForward->setIcon( KIcon("go-next") ); + m_historyForwardMenu = new QMenu(this); + connect(m_historyForwardMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowForwardMenu())); + connect(m_historyForwardMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); m_historyForward->setMenu(m_historyForwardMenu); m_navigationBar->addAction(m_historyForward); m_stopReload = new QAction(this); - m_reloadIcon = style()->standardIcon(QStyle::SP_BrowserReload); + m_reloadIcon = KIcon( "view-refresh" ); m_stopReload->setIcon(m_reloadIcon); - m_navigationBar->addAction(m_stopReload); + m_goHome = new QAction(this); + m_goHome->setIcon( KIcon( "go-home" ) ); + m_navigationBar->addAction(m_goHome); + connect(m_goHome, SIGNAL(triggered()), this, SLOT(slotHome())); + m_navigationBar->addWidget(m_tabWidget->lineEditStack()); m_toolbarSearch = new ToolbarSearch(m_navigationBar); m_navigationBar->addWidget(m_toolbarSearch); - connect(m_toolbarSearch, SIGNAL(search(const QUrl&)), SLOT(loadUrl(const QUrl&))); - m_chaseWidget = new ChaseWidget(this); - m_navigationBar->addWidget(m_chaseWidget); + // fixing toolbar movements + m_navigationBar->setFloatable( false ); + + connect(m_toolbarSearch, SIGNAL(search(const QUrl&)), SLOT(loadUrl(const QUrl&))); } + + + void BrowserMainWindow::slotShowBookmarksDialog() { BookmarksDialog *dialog = new BookmarksDialog(this); - connect(dialog, SIGNAL(openUrl(const QUrl&)), - m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&))); + connect(dialog, SIGNAL(openUrl(const QUrl&)), m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&))); dialog->show(); } + + + void BrowserMainWindow::slotAddBookmark() { WebView *webView = currentTab(); @@ -491,44 +470,14 @@ void BrowserMainWindow::slotAddBookmark() dialog.exec(); } -void BrowserMainWindow::slotViewToolbar() -{ - if (m_navigationBar->isVisible()) { - updateToolbarActionText(false); - m_navigationBar->close(); - } else { - updateToolbarActionText(true); - m_navigationBar->show(); - } - m_autoSaver->changeOccurred(); -} - -void BrowserMainWindow::slotViewBookmarksBar() -{ - if (m_bookmarksToolbar->isVisible()) { - updateBookmarksToolbarActionText(false); - m_bookmarksToolbar->close(); - } else { - updateBookmarksToolbarActionText(true); - m_bookmarksToolbar->show(); - } - m_autoSaver->changeOccurred(); -} void BrowserMainWindow::updateStatusbarActionText(bool visible) { - m_viewStatusbar->setText(!visible ? tr("Show Status Bar") : tr("Hide Status Bar")); + m_viewStatusbar->setText(!visible ? i18n("Show Status Bar") : i18n("Hide Status Bar")); } -void BrowserMainWindow::updateToolbarActionText(bool visible) -{ - m_viewToolbar->setText(!visible ? tr("Show Toolbar") : tr("Hide Toolbar")); -} -void BrowserMainWindow::updateBookmarksToolbarActionText(bool visible) -{ - m_viewBookmarkBar->setText(!visible ? tr("Show Bookmarks bar") : tr("Hide Bookmarks bar")); -} + void BrowserMainWindow::slotViewStatusbar() { @@ -542,6 +491,9 @@ void BrowserMainWindow::slotViewStatusbar() m_autoSaver->changeOccurred(); } + + + QUrl BrowserMainWindow::guessUrlFromString(const QString &string) { QString urlStr = string.trimmed(); @@ -582,62 +534,81 @@ QUrl BrowserMainWindow::guessUrlFromString(const QString &string) return url; } + + + void BrowserMainWindow::loadUrl(const QUrl &url) { loadPage(url.toString()); } + + + void BrowserMainWindow::slotDownloadManager() { BrowserApplication::downloadManager()->show(); } + + void BrowserMainWindow::slotSelectLineEdit() { m_tabWidget->currentLineEdit()->selectAll(); m_tabWidget->currentLineEdit()->setFocus(); } + + void BrowserMainWindow::slotFileSaveAs() { BrowserApplication::downloadManager()->download(currentTab()->url(), true); } + + + void BrowserMainWindow::slotPreferences() { SettingsDialog *s = new SettingsDialog(this); s->show(); } + + + void BrowserMainWindow::slotUpdateStatusbar(const QString &string) { statusBar()->showMessage(string, 2000); } + + + void BrowserMainWindow::slotUpdateWindowTitle(const QString &title) { if (title.isEmpty()) { - setWindowTitle(tr("Qt Demo Browser")); + setWindowTitle("reKonq"); } else { -#if defined(Q_WS_MAC) - setWindowTitle(title); -#else - setWindowTitle(tr("%1 - Qt Demo Browser", "Page title and Browser name").arg(title)); -#endif + setWindowTitle(title + " - reKonq"); } } + + + void BrowserMainWindow::slotAboutApplication() { - QMessageBox::about(this, tr("About"), tr( - "Version %1" - "

This demo demonstrates Qt's " - "webkit facilities in action, providing an example " - "browser for you to experiment with.

" + QMessageBox::about(this, i18n("About"), + i18n( + "

reKonq is a simple KDE dedicated browser" + "

webkit and Qt Demo Browser based." // FIXME go new line.. "

QtWebKit is based on the Open Source WebKit Project developed at http://webkit.org/." - ).arg(QCoreApplication::applicationVersion())); + )); } + + void BrowserMainWindow::slotFileNew() { BrowserApplication::instance()->newMainWindow(); @@ -645,10 +616,13 @@ void BrowserMainWindow::slotFileNew() mw->slotHome(); } + + + void BrowserMainWindow::slotFileOpen() { - QString file = QFileDialog::getOpenFileName(this, tr("Open Web Resource"), QString(), - tr("Web Resources (*.html *.htm *.svg *.png *.gif *.svgz);;All files (*.*)")); + QString file = QFileDialog::getOpenFileName(this, i18n("Open Web Resource"), QString(), + i18n("Web Resources (*.html *.htm *.svg *.png *.gif *.svgz);;All files (*.*)")); if (file.isEmpty()) return; @@ -656,6 +630,9 @@ void BrowserMainWindow::slotFileOpen() loadPage(file); } + + + void BrowserMainWindow::slotFilePrintPreview() { if (!currentTab()) @@ -666,6 +643,8 @@ void BrowserMainWindow::slotFilePrintPreview() dialog->exec(); } + + void BrowserMainWindow::slotFilePrint() { if (!currentTab()) @@ -673,30 +652,34 @@ void BrowserMainWindow::slotFilePrint() printRequested(currentTab()->page()->mainFrame()); } + + void BrowserMainWindow::printRequested(QWebFrame *frame) { QPrinter printer; QPrintDialog *dialog = new QPrintDialog(&printer, this); - dialog->setWindowTitle(tr("Print Document")); + dialog->setWindowTitle( i18n("Print Document") ); if (dialog->exec() != QDialog::Accepted) return; frame->print(&printer); } + + void BrowserMainWindow::slotPrivateBrowsing() { QWebSettings *settings = QWebSettings::globalSettings(); bool pb = settings->testAttribute(QWebSettings::PrivateBrowsingEnabled); if (!pb) { - QString title = tr("Are you sure you want to turn on private browsing?"); - QString text = tr("%1

When private browsing in turned on," + QString title = i18n("Are you sure you want to turn on private browsing?"); + QString text = "" + title + i18n("

When private browsing in turned on," " webpages are not added to the history," " items are automatically removed from the Downloads window," \ " new cookies are not stored, current cookies can't be accessed," \ " site icons wont be stored, session wont be saved, " \ " and searches are not addded to the pop-up menu in the Google search box." \ " Until you close the window, you can still click the Back and Forward buttons" \ - " to return to the webpages you have opened.").arg(title); + " to return to the webpages you have opened."); QMessageBox::StandardButton button = QMessageBox::question(this, QString(), text, QMessageBox::Ok | QMessageBox::Cancel, @@ -716,12 +699,14 @@ void BrowserMainWindow::slotPrivateBrowsing() } } + + void BrowserMainWindow::closeEvent(QCloseEvent *event) { if (m_tabWidget->count() > 1) { int ret = QMessageBox::warning(this, QString(), - tr("Are you sure you want to close the window?" - " There are %1 tab open").arg(m_tabWidget->count()), + i18n("Are you sure you want to close the window?" + " There are %1 tab open" , m_tabWidget->count() ) , QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (ret == QMessageBox::No) { @@ -733,21 +718,26 @@ void BrowserMainWindow::closeEvent(QCloseEvent *event) deleteLater(); } + + + void BrowserMainWindow::slotEditFind() { if (!currentTab()) return; bool ok; - QString search = QInputDialog::getText(this, tr("Find"), - tr("Text:"), QLineEdit::Normal, + QString search = QInputDialog::getText(this, i18n("Find"), + i18n("Text:"), QLineEdit::Normal, m_lastSearch, &ok); if (ok && !search.isEmpty()) { m_lastSearch = search; if (!currentTab()->findText(m_lastSearch)) - slotUpdateStatusbar(tr("\"%1\" not found.").arg(m_lastSearch)); + slotUpdateStatusbar( QString(m_lastSearch) + i18n(" not found.") ); } } + + void BrowserMainWindow::slotEditFindNext() { if (!currentTab() && !m_lastSearch.isEmpty()) @@ -755,6 +745,8 @@ void BrowserMainWindow::slotEditFindNext() currentTab()->findText(m_lastSearch); } + + void BrowserMainWindow::slotEditFindPrevious() { if (!currentTab() && !m_lastSearch.isEmpty()) @@ -762,6 +754,8 @@ void BrowserMainWindow::slotEditFindPrevious() currentTab()->findText(m_lastSearch, QWebPage::FindBackward); } + + void BrowserMainWindow::slotViewTextBigger() { if (!currentTab()) @@ -769,6 +763,8 @@ void BrowserMainWindow::slotViewTextBigger() currentTab()->setTextSizeMultiplier(currentTab()->textSizeMultiplier() + 0.1); } + + void BrowserMainWindow::slotViewTextNormal() { if (!currentTab()) @@ -776,6 +772,8 @@ void BrowserMainWindow::slotViewTextNormal() currentTab()->setTextSizeMultiplier(1.0); } + + void BrowserMainWindow::slotViewTextSmaller() { if (!currentTab()) @@ -783,6 +781,9 @@ void BrowserMainWindow::slotViewTextSmaller() currentTab()->setTextSizeMultiplier(currentTab()->textSizeMultiplier() - 0.1); } + + + void BrowserMainWindow::slotViewFullScreen(bool makeFullScreen) { if (makeFullScreen) { @@ -796,6 +797,9 @@ void BrowserMainWindow::slotViewFullScreen(bool makeFullScreen) } } + + + void BrowserMainWindow::slotViewPageSource() { if (!currentTab()) @@ -803,32 +807,40 @@ void BrowserMainWindow::slotViewPageSource() QString markup = currentTab()->page()->mainFrame()->toHtml(); QPlainTextEdit *view = new QPlainTextEdit(markup); - view->setWindowTitle(tr("Page Source of %1").arg(currentTab()->title())); + view->setWindowTitle( i18n("Page Source of ") + currentTab()->title() ); view->setMinimumWidth(640); view->setAttribute(Qt::WA_DeleteOnClose); view->show(); } + + void BrowserMainWindow::slotHome() { QSettings settings; settings.beginGroup(QLatin1String("MainWindow")); - QString home = settings.value(QLatin1String("home"), QLatin1String("http://www.trolltech.com/")).toString(); + QString home = settings.value(QLatin1String("home"), QLatin1String("http://www.kde.org/")).toString(); loadPage(home); } + + + void BrowserMainWindow::slotWebSearch() { m_toolbarSearch->lineEdit()->selectAll(); m_toolbarSearch->lineEdit()->setFocus(); } + + + void BrowserMainWindow::slotToggleInspector(bool enable) { QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, enable); if (enable) { - int result = QMessageBox::question(this, tr("Web Inspector"), - tr("The web inspector will only work correctly for pages that were loaded after enabling.\n" + int result = QMessageBox::question(this, 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?"), QMessageBox::Yes | QMessageBox::No); if (result == QMessageBox::Yes) { @@ -837,6 +849,9 @@ void BrowserMainWindow::slotToggleInspector(bool enable) } } + + + void BrowserMainWindow::slotSwapFocus() { if (currentTab()->hasFocus()) @@ -845,6 +860,8 @@ void BrowserMainWindow::slotSwapFocus() currentTab()->setFocus(); } + + void BrowserMainWindow::loadPage(const QString &page) { if (!currentTab() || page.isEmpty()) @@ -855,35 +872,43 @@ void BrowserMainWindow::loadPage(const QString &page) m_tabWidget->loadUrlInCurrentTab(url); } + + + TabWidget *BrowserMainWindow::tabWidget() const { return m_tabWidget; } + + WebView *BrowserMainWindow::currentTab() const { return m_tabWidget->currentWebView(); } + + void BrowserMainWindow::slotLoadProgress(int progress) { if (progress < 100 && progress > 0) { - m_chaseWidget->setAnimated(true); disconnect(m_stopReload, SIGNAL(triggered()), m_reload, SLOT(trigger())); if (m_stopIcon.isNull()) - m_stopIcon = style()->standardIcon(QStyle::SP_BrowserStop); + m_stopIcon = KIcon( style()->standardIcon(QStyle::SP_BrowserStop) ); m_stopReload->setIcon(m_stopIcon); connect(m_stopReload, SIGNAL(triggered()), m_stop, SLOT(trigger())); - m_stopReload->setToolTip(tr("Stop loading the current page")); + m_stopReload->setToolTip( i18n("Stop loading the current page") ); } else { - m_chaseWidget->setAnimated(false); disconnect(m_stopReload, SIGNAL(triggered()), m_stop, SLOT(trigger())); m_stopReload->setIcon(m_reloadIcon); connect(m_stopReload, SIGNAL(triggered()), m_reload, SLOT(trigger())); - m_stopReload->setToolTip(tr("Reload the current page")); + m_stopReload->setToolTip( i18n("Reload the current page") ); } } + + + void BrowserMainWindow::slotAboutToShowBackMenu() { m_historyBackMenu->clear(); @@ -893,7 +918,7 @@ void BrowserMainWindow::slotAboutToShowBackMenu() int historyCount = history->count(); for (int i = history->backItems(historyCount).count() - 1; i >= 0; --i) { QWebHistoryItem item = history->backItems(history->count()).at(i); - QAction *action = new QAction(this); + KAction *action = new KAction(this); action->setData(-1*(historyCount-i-1)); QIcon icon = BrowserApplication::instance()->icon(item.url()); action->setIcon(icon); @@ -902,6 +927,9 @@ void BrowserMainWindow::slotAboutToShowBackMenu() } } + + + void BrowserMainWindow::slotAboutToShowForwardMenu() { m_historyForwardMenu->clear(); @@ -920,13 +948,16 @@ void BrowserMainWindow::slotAboutToShowForwardMenu() } } + + + void BrowserMainWindow::slotAboutToShowWindowMenu() { m_windowMenu->clear(); m_windowMenu->addAction(m_tabWidget->nextTabAction()); m_windowMenu->addAction(m_tabWidget->previousTabAction()); m_windowMenu->addSeparator(); - m_windowMenu->addAction(tr("Downloads"), this, SLOT(slotDownloadManager()), QKeySequence(tr("Alt+Ctrl+L", "Download Manager"))); + m_windowMenu->addAction( i18n("Downloads"), this, SLOT(slotDownloadManager()), QKeySequence( tr("Alt+Ctrl+L", "Download Manager"))); m_windowMenu->addSeparator(); QList windows = BrowserApplication::instance()->mainWindows(); @@ -940,9 +971,12 @@ void BrowserMainWindow::slotAboutToShowWindowMenu() } } + + + void BrowserMainWindow::slotShowWindow() { - if (QAction *action = qobject_cast(sender())) { + if (KAction *action = qobject_cast(sender())) { QVariant v = action->data(); if (v.canConvert()) { int offset = qvariant_cast(v); @@ -953,6 +987,9 @@ void BrowserMainWindow::slotShowWindow() } } + + + void BrowserMainWindow::slotOpenActionUrl(QAction *action) { int offset = action->data().toInt(); @@ -963,7 +1000,11 @@ void BrowserMainWindow::slotOpenActionUrl(QAction *action) history->goToItem(history->forwardItems(history->count() - offset + 1).back()); // forward } + + + void BrowserMainWindow::geometryChangeRequested(const QRect &geometry) { setGeometry(geometry); } + diff --git a/src/browsermainwindow.h b/src/browsermainwindow.h index 17f87056..aba3d61d 100644 --- a/src/browsermainwindow.h +++ b/src/browsermainwindow.h @@ -1,50 +1,36 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + #ifndef BROWSERMAINWINDOW_H #define BROWSERMAINWINDOW_H -#include -#include -#include +#include +#include +#include +#include +#include + +#include class AutoSaver; -class BookmarksToolBar; -class ChaseWidget; +// class ChaseWidget; class QWebFrame; class TabWidget; class ToolbarSearch; @@ -55,7 +41,7 @@ class WebView; Handles the tab widget and all the actions */ -class BrowserMainWindow : public QMainWindow { +class BrowserMainWindow : public KMainWindow { Q_OBJECT public: @@ -101,8 +87,6 @@ private slots: void slotViewTextBigger(); void slotViewTextNormal(); void slotViewTextSmaller(); - void slotViewToolbar(); - void slotViewBookmarksBar(); void slotViewStatusbar(); void slotViewPageSource(); void slotViewFullScreen(bool enable); @@ -122,8 +106,6 @@ private slots: void printRequested(QWebFrame *frame); void geometryChangeRequested(const QRect &geometry); - void updateToolbarActionText(bool visible); - void updateBookmarksToolbarActionText(bool visible); private: void loadDefaultState(); @@ -134,8 +116,6 @@ private: private: QToolBar *m_navigationBar; ToolbarSearch *m_toolbarSearch; - BookmarksToolBar *m_bookmarksToolbar; - ChaseWidget *m_chaseWidget; TabWidget *m_tabWidget; AutoSaver *m_autoSaver; @@ -148,14 +128,13 @@ private: QAction *m_stop; QAction *m_reload; QAction *m_stopReload; - QAction *m_viewToolbar; - QAction *m_viewBookmarkBar; + QAction *m_goHome; QAction *m_viewStatusbar; QAction *m_restoreLastSession; QAction *m_addBookmark; - QIcon m_reloadIcon; - QIcon m_stopIcon; + KIcon m_reloadIcon; + KIcon m_stopIcon; QString m_lastSearch; }; diff --git a/src/chasewidget.cpp b/src/chasewidget.cpp deleted file mode 100644 index ea2b0f8e..00000000 --- a/src/chasewidget.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ - -#include "chasewidget.h" - -#include - -#include -#include -#include -#include -#include - -ChaseWidget::ChaseWidget(QWidget *parent, QPixmap pixmap, bool pixmapEnabled) - : QWidget(parent) - , m_segment(0) - , m_delay(100) - , m_step(40) - , m_timerId(-1) - , m_animated(false) - , m_pixmap(pixmap) - , m_pixmapEnabled(pixmapEnabled) -{ -} - -void ChaseWidget::setAnimated(bool value) -{ - if (m_animated == value) - return; - m_animated = value; - if (m_timerId != -1) { - killTimer(m_timerId); - m_timerId = -1; - } - if (m_animated) { - m_segment = 0; - m_timerId = startTimer(m_delay); - } - update(); -} - -void ChaseWidget::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event); - QPainter p(this); - if (m_pixmapEnabled && !m_pixmap.isNull()) { - p.drawPixmap(0, 0, m_pixmap); - return; - } - - const int extent = qMin(width() - 8, height() - 8); - const int displ = extent / 4; - const int ext = extent / 4 - 1; - - p.setRenderHint(QPainter::Antialiasing, true); - - if(m_animated) - p.setPen(Qt::gray); - else - p.setPen(QPen(palette().dark().color())); - - p.translate(width() / 2, height() / 2); // center - - for (int segment = 0; segment < segmentCount(); ++segment) { - p.rotate(QApplication::isRightToLeft() ? m_step : -m_step); - if(m_animated) - p.setBrush(colorForSegment(segment)); - else - p.setBrush(palette().background()); - p.drawEllipse(QRect(displ, -ext / 2, ext, ext)); - } -} - -QSize ChaseWidget::sizeHint() const -{ - return QSize(32, 32); -} - -void ChaseWidget::timerEvent(QTimerEvent *event) -{ - if (event->timerId() == m_timerId) { - ++m_segment; - update(); - } - QWidget::timerEvent(event); -} - -QColor ChaseWidget::colorForSegment(int seg) const -{ - int index = ((seg + m_segment) % segmentCount()); - int comp = qMax(0, 255 - (index * (255 / segmentCount()))); - return QColor(comp, comp, comp, 255); -} - -int ChaseWidget::segmentCount() const -{ - return 360 / m_step; -} - -void ChaseWidget::setPixmapEnabled(bool enable) -{ - m_pixmapEnabled = enable; -} - diff --git a/src/chasewidget.h b/src/chasewidget.h deleted file mode 100644 index ce5b2dae..00000000 --- a/src/chasewidget.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ - -#ifndef CHASEWIDGET_H -#define CHASEWIDGET_H - -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE -class QHideEvent; -class QShowEvent; -class QPaintEvent; -class QTimerEvent; -QT_END_NAMESPACE - -class ChaseWidget : public QWidget -{ - Q_OBJECT -public: - ChaseWidget(QWidget *parent = 0, QPixmap pixmap = QPixmap(), bool pixmapEnabled = false); - - void setAnimated(bool value); - void setPixmapEnabled(bool enable); - QSize sizeHint() const; - -protected: - void paintEvent(QPaintEvent *event); - void timerEvent(QTimerEvent *event); - -private: - int segmentCount() const; - QColor colorForSegment(int segment) const; - - int m_segment; - int m_delay; - int m_step; - int m_timerId; - bool m_animated; - QPixmap m_pixmap; - bool m_pixmapEnabled; -}; - -#endif diff --git a/src/cookiejar.cpp b/src/cookiejar.cpp index bed7258a..098506c9 100644 --- a/src/cookiejar.cpp +++ b/src/cookiejar.cpp @@ -1,62 +1,43 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ - +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + + +// Local Includes #include "cookiejar.h" - #include "autosaver.h" -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include +// Qt Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const unsigned int JAR_VERSION = 23; @@ -392,17 +373,17 @@ QVariant CookieModel::headerData(int section, Qt::Orientation orientation, int r switch (section) { case 0: - return tr("Website"); + return i18n("Website"); case 1: - return tr("Name"); + return i18n("Name"); case 2: - return tr("Path"); + return i18n("Path"); case 3: - return tr("Secure"); + return i18n("Secure"); case 4: - return tr("Expires"); + return i18n("Expires"); case 5: - return tr("Contents"); + return i18n("Contents"); default: return QVariant(); } @@ -547,9 +528,9 @@ QVariant CookieExceptionsModel::headerData(int section, Qt::Orientation orientat && role == Qt::DisplayRole) { switch (section) { case 0: - return tr("Website"); + return i18n("Website"); case 1: - return tr("Status"); + return i18n("Status"); } } return QAbstractTableModel::headerData(section, orientation, role); @@ -569,7 +550,7 @@ QVariant CookieExceptionsModel::data(const QModelIndex &index, int role) const case 0: return m_allowedCookies.at(row); case 1: - return tr("Allow"); + return i18n("Allow"); } } row = row - m_allowedCookies.count(); @@ -578,7 +559,7 @@ QVariant CookieExceptionsModel::data(const QModelIndex &index, int role) const case 0: return m_blockedCookies.at(row); case 1: - return tr("Block"); + return i18n("Block"); } } row = row - m_blockedCookies.count(); @@ -587,7 +568,7 @@ QVariant CookieExceptionsModel::data(const QModelIndex &index, int role) const case 0: return m_sessionCookies.at(row); case 1: - return tr("Allow For Session"); + return i18n("Allow For Session"); } } } diff --git a/src/data/addtab.png b/src/data/addtab.png deleted file mode 100644 index 20928fb4..00000000 Binary files a/src/data/addtab.png and /dev/null differ diff --git a/src/data/browser.svg b/src/data/browser.svg deleted file mode 100644 index c42af2bc..00000000 --- a/src/data/browser.svg +++ /dev/null @@ -1,1598 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/data/closetab.png b/src/data/closetab.png deleted file mode 100644 index ab9d669e..00000000 Binary files a/src/data/closetab.png and /dev/null differ diff --git a/src/data/data.qrc b/src/data/data.qrc deleted file mode 100644 index c7d0294c..00000000 --- a/src/data/data.qrc +++ /dev/null @@ -1,11 +0,0 @@ - - - addtab.png - closetab.png - history.png - browser.svg - defaultbookmarks.xbel - loading.gif - defaulticon.png - - diff --git a/src/data/defaultbookmarks.xbel b/src/data/defaultbookmarks.xbel deleted file mode 100644 index f1c9253d..00000000 --- a/src/data/defaultbookmarks.xbel +++ /dev/null @@ -1,40 +0,0 @@ - - - - - Bookmarks Bar - - Trolltech.com - - - WebKit.org - - - Qt Documentation - - - Qt Quarterly - - - Trolltech Labs - - - Qt Centre - - - Qt-Apps.org - - - qtnode - - - xkcd - - - - Bookmarks Menu - - reddit.com: what's new online! - - - diff --git a/src/data/defaulticon.png b/src/data/defaulticon.png deleted file mode 100644 index 01a0920c..00000000 Binary files a/src/data/defaulticon.png and /dev/null differ diff --git a/src/data/history.png b/src/data/history.png deleted file mode 100644 index 552a1cbd..00000000 Binary files a/src/data/history.png and /dev/null differ diff --git a/src/data/loading.gif b/src/data/loading.gif deleted file mode 100644 index c1545eb0..00000000 Binary files a/src/data/loading.gif and /dev/null differ diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index d8f19c5e..e3254cba 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -1,59 +1,41 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ - +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + + +// Local includes #include "downloadmanager.h" - #include "autosaver.h" #include "browserapplication.h" #include "networkaccessmanager.h" +// generic includes #include -#include -#include - -#include -#include -#include -#include - -#include - -#include +// Qt Includes +#include +#include +#include +#include +#include +#include +#include +#include /*! DownloadItem is a widget that is displayed in the download manager list. @@ -88,14 +70,10 @@ void DownloadItem::init() m_url = m_reply->url(); m_reply->setParent(this); connect(m_reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead())); - connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), - this, SLOT(error(QNetworkReply::NetworkError))); - connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)), - this, SLOT(downloadProgress(qint64, qint64))); - connect(m_reply, SIGNAL(metaDataChanged()), - this, SLOT(metaDataChanged())); - connect(m_reply, SIGNAL(finished()), - this, SLOT(finished())); + connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error(QNetworkReply::NetworkError))); + connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64))); + connect(m_reply, SIGNAL(metaDataChanged()), this, SLOT(metaDataChanged())); + connect(m_reply, SIGNAL(finished()), this, SLOT(finished())); // reset info downloadInfoLabel->clear(); @@ -123,10 +101,10 @@ void DownloadItem::getFileName() QString defaultFileName = saveFileName(downloadDirectory); QString fileName = defaultFileName; if (m_requestFileName) { - fileName = QFileDialog::getSaveFileName(this, tr("Save File"), defaultFileName); + fileName = QFileDialog::getSaveFileName(this, i18n("Save File"), defaultFileName); if (fileName.isEmpty()) { m_reply->close(); - fileNameLabel->setText(tr("Download canceled: %1").arg(QFileInfo(defaultFileName).fileName())); + fileNameLabel->setText( i18n("Download canceled: ") + QFileInfo(defaultFileName).fileName()); return; } } @@ -208,8 +186,7 @@ void DownloadItem::downloadReadyRead() if (!m_requestFileName) getFileName(); if (!m_output.open(QIODevice::WriteOnly)) { - downloadInfoLabel->setText(tr("Error opening save file: %1") - .arg(m_output.errorString())); + downloadInfoLabel->setText( i18n("Error opening save file: ") + m_output.errorString() ); stopButton->click(); emit statusChanged(); return; @@ -217,8 +194,7 @@ void DownloadItem::downloadReadyRead() emit statusChanged(); } if (-1 == m_output.write(m_reply->readAll())) { - downloadInfoLabel->setText(tr("Error saving: %1") - .arg(m_output.errorString())); + downloadInfoLabel->setText( i18n("Error saving: ") + m_output.errorString() ); stopButton->click(); } } @@ -226,7 +202,7 @@ void DownloadItem::downloadReadyRead() void DownloadItem::error(QNetworkReply::NetworkError) { qDebug() << "DownloadItem::error" << m_reply->errorString() << m_url; - downloadInfoLabel->setText(tr("Network Error: %1").arg(m_reply->errorString())); + downloadInfoLabel->setText( i18n("Network Error: ") + m_reply->errorString() ); tryAgainButton->setEnabled(true); tryAgainButton->setVisible(true); } @@ -260,10 +236,10 @@ void DownloadItem::updateInfoLabel() // update info label double speed = m_bytesReceived * 1000.0 / m_downloadTime.elapsed(); double timeRemaining = ((double)(bytesTotal - m_bytesReceived)) / speed; - QString timeRemainingString = tr("seconds"); + QString timeRemainingString = i18n("seconds"); if (timeRemaining > 60) { timeRemaining = timeRemaining / 60; - timeRemainingString = tr("minutes"); + timeRemainingString = i18n("minutes"); } timeRemaining = floor(timeRemaining); @@ -275,21 +251,13 @@ void DownloadItem::updateInfoLabel() if (running) { QString remaining; if (bytesTotal != 0) - remaining = tr("- %4 %5 remaining") - .arg(timeRemaining) - .arg(timeRemainingString); - info = QString(tr("%1 of %2 (%3/sec) %4")) - .arg(dataString(m_bytesReceived)) - .arg(bytesTotal == 0 ? tr("?") : dataString(bytesTotal)) - .arg(dataString((int)speed)) - .arg(remaining); + remaining = i18n("- %1 %2 remaining", timeRemaining, timeRemainingString ); + info = dataString(m_bytesReceived) + i18n("of") + bytesTotal == 0 ? "?" : dataString(bytesTotal) + "(" + dataString((int)speed) + "/sec)" + QString(remaining); } else { if (m_bytesReceived == bytesTotal) info = dataString(m_output.size()); else - info = tr("%1 of %2 - Stopped") - .arg(dataString(m_bytesReceived)) - .arg(dataString(bytesTotal)); + info = dataString(m_bytesReceived) + i18n("of") + dataString(bytesTotal) + i18n(" - Stopped"); } downloadInfoLabel->setText(info); } @@ -298,13 +266,13 @@ QString DownloadItem::dataString(int size) const { QString unit; if (size < 1024) { - unit = tr("bytes"); + unit = i18n("bytes"); } else if (size < 1024*1024) { size /= 1024; - unit = tr("kB"); + unit = i18n("kB"); } else { size /= 1024*1024; - unit = tr("MB"); + unit = i18n("MB"); } return QString(QLatin1String("%1 %2")).arg(size).arg(unit); } @@ -531,7 +499,7 @@ void DownloadManager::cleanup() void DownloadManager::updateItemCount() { int count = m_downloads.count(); - itemCount->setText(count == 1 ? tr("1 Download") : tr("%1 Downloads").arg(count)); + itemCount->setText(count == 1 ? i18n("1 Download") : QString(count) + i18n(" Downloads") ); } DownloadModel::DownloadModel(DownloadManager *downloadManager, QObject *parent) diff --git a/src/downloadmanager.h b/src/downloadmanager.h index 6f27622b..af33ea12 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -1,39 +1,22 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + #ifndef DOWNLOADMANAGER_H #define DOWNLOADMANAGER_H @@ -41,10 +24,10 @@ #include "ui_downloads.h" #include "ui_downloaditem.h" -#include +#include +#include +#include -#include -#include class DownloadItem : public QWidget, public Ui_DownloadItem { diff --git a/src/history.cpp b/src/history.cpp index fef1920c..985a03ac 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -1,64 +1,47 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + #include "history.h" #include "autosaver.h" #include "browserapplication.h" -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include -#include +#include -#include -#include -#include -#include +#include +#include +#include +#include -#include -#include +#include +#include -#include +#include static const unsigned int HISTORY_VERSION = 23; @@ -71,12 +54,9 @@ HistoryManager::HistoryManager(QObject *parent) , m_historyTreeModel(0) { m_expiredTimer.setSingleShot(true); - connect(&m_expiredTimer, SIGNAL(timeout()), - this, SLOT(checkForExpired())); - connect(this, SIGNAL(entryAdded(const HistoryItem &)), - m_saveTimer, SLOT(changeOccurred())); - connect(this, SIGNAL(entryRemoved(const HistoryItem &)), - m_saveTimer, SLOT(changeOccurred())); + connect(&m_expiredTimer, SIGNAL(timeout()), this, SLOT(checkForExpired())); + connect(this, SIGNAL(entryAdded(const HistoryItem &)), m_saveTimer, SLOT(changeOccurred())); + connect(this, SIGNAL(entryRemoved(const HistoryItem &)), m_saveTimer, SLOT(changeOccurred())); load(); m_historyModel = new HistoryModel(this, this); @@ -363,15 +343,10 @@ HistoryModel::HistoryModel(HistoryManager *history, QObject *parent) , m_history(history) { Q_ASSERT(m_history); - connect(m_history, SIGNAL(historyReset()), - this, SLOT(historyReset())); - connect(m_history, SIGNAL(entryRemoved(const HistoryItem &)), - this, SLOT(historyReset())); - - connect(m_history, SIGNAL(entryAdded(const HistoryItem &)), - this, SLOT(entryAdded())); - connect(m_history, SIGNAL(entryUpdated(int)), - this, SLOT(entryUpdated(int))); + connect(m_history, SIGNAL(historyReset()), this, SLOT(historyReset())); + connect(m_history, SIGNAL(entryRemoved(const HistoryItem &)), this, SLOT(historyReset())); + connect(m_history, SIGNAL(entryAdded(const HistoryItem &)), this, SLOT(entryAdded())); + connect(m_history, SIGNAL(entryUpdated(int)), this, SLOT(entryUpdated(int))); } void HistoryModel::historyReset() @@ -396,8 +371,8 @@ QVariant HistoryModel::headerData(int section, Qt::Orientation orientation, int if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { switch (section) { - case 0: return tr("Title"); - case 1: return tr("Address"); + case 0: return i18n("Title"); + case 1: return i18n("Address"); } } return QAbstractTableModel::headerData(section, orientation, role); @@ -623,11 +598,11 @@ void HistoryMenu::postPopulated() if (m_history->history().count() > 0) addSeparator(); - QAction *showAllAction = new QAction(tr("Show All History"), this); + QAction *showAllAction = new QAction( i18n("Show All History"), this); connect(showAllAction, SIGNAL(triggered()), this, SLOT(showHistoryDialog())); addAction(showAllAction); - QAction *clearAction = new QAction(tr("Clear History"), this); + QAction *clearAction = new QAction( i18n("Clear History"), this); connect(clearAction, SIGNAL(triggered()), m_history, SLOT(clear())); addAction(clearAction); } @@ -696,11 +671,11 @@ void HistoryDialog::customContextMenuRequested(const QPoint &pos) QModelIndex index = tree->indexAt(pos); index = index.sibling(index.row(), 0); if (index.isValid() && !tree->model()->hasChildren(index)) { - menu.addAction(tr("Open"), this, SLOT(open())); + menu.addAction( i18n("Open"), this, SLOT(open())); menu.addSeparator(); - menu.addAction(tr("Copy"), this, SLOT(copy())); + menu.addAction( i18n("Copy"), this, SLOT(copy())); } - menu.addAction(tr("Delete"), tree, SLOT(removeOne())); + menu.addAction( i18n("Delete"), tree, SLOT(removeOne())); menu.exec(QCursor::pos()); } @@ -1029,16 +1004,16 @@ QVariant HistoryTreeModel::data(const QModelIndex &index, int role) const QModelIndex idx = sourceModel()->index(offset, 0); QDate date = idx.data(HistoryModel::DateRole).toDate(); if (date == QDate::currentDate()) - return tr("Earlier Today"); + return i18n("Earlier Today"); return date.toString(QLatin1String("dddd, MMMM d, yyyy")); } if (index.column() == 1) { - return tr("%1 items").arg(rowCount(index.sibling(index.row(), 0))); + return QString(rowCount(index.sibling(index.row(), 0))) + i18n(" items") ; } } } if (role == Qt::DecorationRole && index.column() == 0 && !index.parent().isValid()) - return QIcon(QLatin1String(":history.png")); + return KIcon("view-history"); if (role == HistoryModel::DateRole && index.column() == 0 && index.internalId() == 0) { int offset = sourceDateRow(index.row()); QModelIndex idx = sourceModel()->index(offset, 0); diff --git a/src/history.h b/src/history.h index cda78a5a..1a4a0743 100644 --- a/src/history.h +++ b/src/history.h @@ -1,53 +1,36 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + #ifndef HISTORY_H #define HISTORY_H +// Local Includes #include "modelmenu.h" -#include -#include -#include -#include -#include - -#include - +// Qt Includes +#include +#include +#include +#include +#include +#include #include class HistoryItem diff --git a/src/htmls/htmls.qrc b/src/htmls/htmls.qrc deleted file mode 100644 index 03b256cc..00000000 --- a/src/htmls/htmls.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - notfound.html - - diff --git a/src/htmls/notfound.html b/src/htmls/notfound.html deleted file mode 100755 index b428a6a3..00000000 --- a/src/htmls/notfound.html +++ /dev/null @@ -1,63 +0,0 @@ - - -%1 - - - -

- -

%2

-

When connecting to: %3.

-
    -
  • Check the address for errors such as ww.trolltech.com - instead of www.trolltech.com
  • -
  • If the address is correct, try to check the network - connection.
  • -
  • If your computer or network is protected by a firewall or - proxy, make sure that the browser demo is permitted to access - the network.
  • -
-

-
- - diff --git a/src/main.cpp b/src/main.cpp index badfd296..d99226cf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,7 +41,7 @@ int main(int argc, char **argv) ); aboutData.addAuthor(ki18n("Andrea Diamantini"), ki18n("reKonq author"), "adjam7@gmail.com"); - aboutData.setProgramIconName("application-internet"); + aboutData.setProgramIconName("applications-internet"); KCmdLineArgs::init( argc, argv, &aboutData ); diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp index 8922c8c0..f09a39ab 100644 --- a/src/networkaccessmanager.cpp +++ b/src/networkaccessmanager.cpp @@ -1,58 +1,41 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ - +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + + +// Local Includes #include "networkaccessmanager.h" - #include "browserapplication.h" #include "browsermainwindow.h" #include "ui_passworddialog.h" #include "ui_proxy.h" -#include - -#include -#include -#include -#include +// Qt Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include -#include -#include -#include NetworkAccessManager::NetworkAccessManager(QObject *parent) : QNetworkAccessManager(parent) @@ -99,8 +82,7 @@ void NetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthent passwordDialog.iconLabel->setText(QString()); passwordDialog.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32)); - QString introMessage = tr("Enter username and password for \"%1\" at %2"); - introMessage = introMessage.arg(Qt::escape(reply->url().toString())).arg(Qt::escape(reply->url().toString())); + QString introMessage = i18n("Enter username and password for ") + Qt::escape(reply->url().toString()) + i18n(" at ") + Qt::escape(reply->url().toString()) + ""; passwordDialog.introLabel->setText(introMessage); passwordDialog.introLabel->setWordWrap(true); @@ -123,8 +105,7 @@ void NetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &prox proxyDialog.iconLabel->setText(QString()); proxyDialog.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32)); - QString introMessage = tr("Connect to proxy \"%1\" using:"); - introMessage = introMessage.arg(Qt::escape(proxy.hostName())); + QString introMessage = i18n("Connect to proxy ") + Qt::escape(proxy.hostName()) + i18n(" using:"); proxyDialog.introLabel->setText(introMessage); proxyDialog.introLabel->setWordWrap(true); @@ -144,8 +125,7 @@ void NetworkAccessManager::sslErrors(QNetworkReply *reply, const QListurl().toString()).arg(errors), + i18n("SSL Errors:\n\n") + reply->url().toString() + "\n\n" + QString(errors) + "\n\n", QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (ret == QMessageBox::Yes) diff --git a/src/networkaccessmanager.h b/src/networkaccessmanager.h index d49c7fa4..06fc6efd 100644 --- a/src/networkaccessmanager.h +++ b/src/networkaccessmanager.h @@ -1,39 +1,21 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ #ifndef NETWORKACCESSMANAGER_H #define NETWORKACCESSMANAGER_H diff --git a/src/searchlineedit.cpp b/src/searchlineedit.cpp index 97fdf726..16ba0ccd 100644 --- a/src/searchlineedit.cpp +++ b/src/searchlineedit.cpp @@ -1,53 +1,38 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ - +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + +// Local Includes #include "searchlineedit.h" -#include -#include -#include -#include -#include +// Qt Includes +#include +#include +#include +#include +#include + ClearButton::ClearButton(QWidget *parent) : QAbstractButton(parent) { setCursor(Qt::ArrowCursor); - setToolTip(tr("Clear")); + setToolTip( tr("Clear") ); setVisible(false); setFocusPolicy(Qt::NoFocus); } diff --git a/src/searchlineedit.h b/src/searchlineedit.h index 2f2a8362..d9f2aecb 100644 --- a/src/searchlineedit.h +++ b/src/searchlineedit.h @@ -1,47 +1,31 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ #ifndef SEARCHLINEEDIT_H #define SEARCHLINEEDIT_H +// Local Includes #include "urllineedit.h" -#include -#include +// Qt Includes +#include +#include QT_BEGIN_NAMESPACE class QMenu; diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp index f873ec6f..e775453b 100644 --- a/src/tabwidget.cpp +++ b/src/tabwidget.cpp @@ -1,39 +1,23 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + + #include "tabwidget.h" @@ -43,15 +27,15 @@ #include "urllineedit.h" #include "webview.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include @@ -87,32 +71,32 @@ void TabBar::selectTabAction() void TabBar::contextMenuRequested(const QPoint &position) { QMenu menu; - menu.addAction(tr("New &Tab"), this, SIGNAL(newTab()), QKeySequence::AddTab); + menu.addAction(i18n("New &Tab"), this, SIGNAL(newTab()), QKeySequence::AddTab); int index = tabAt(position); if (-1 != index) { - QAction *action = menu.addAction(tr("Clone Tab"), + QAction *action = menu.addAction(i18n("Clone Tab"), this, SLOT(cloneTab())); action->setData(index); menu.addSeparator(); - action = menu.addAction(tr("&Close Tab"), + action = menu.addAction(i18n("&Close Tab"), this, SLOT(closeTab()), QKeySequence::Close); action->setData(index); - action = menu.addAction(tr("Close &Other Tabs"), + action = menu.addAction(i18n("Close &Other Tabs"), this, SLOT(closeOtherTabs())); action->setData(index); menu.addSeparator(); - action = menu.addAction(tr("Reload Tab"), + action = menu.addAction(i18n("Reload Tab"), this, SLOT(reloadTab()), QKeySequence::Refresh); action->setData(index); } else { menu.addSeparator(); } - menu.addAction(tr("Reload All Tabs"), this, SIGNAL(reloadAllTabs())); + menu.addAction(i18n("Reload All Tabs"), this, SIGNAL(reloadAllTabs())); menu.exec(QCursor::pos()); } @@ -233,17 +217,17 @@ TabWidget::TabWidget(QWidget *parent) setTabBar(m_tabBar); // Actions - m_newTabAction = new QAction(QIcon(QLatin1String(":addtab.png")), tr("New &Tab"), this); + m_newTabAction = new QAction(KIcon("tab-new"), i18n("New &Tab"), this); m_newTabAction->setShortcuts(QKeySequence::AddTab); m_newTabAction->setIconVisibleInMenu(false); connect(m_newTabAction, SIGNAL(triggered()), this, SLOT(newTab())); - m_closeTabAction = new QAction(QIcon(QLatin1String(":closetab.png")), tr("&Close Tab"), this); + m_closeTabAction = new QAction(KIcon("tab-close"), i18n("&Close Tab"), this); m_closeTabAction->setShortcuts(QKeySequence::Close); m_closeTabAction->setIconVisibleInMenu(false); connect(m_closeTabAction, SIGNAL(triggered()), this, SLOT(closeTab())); - m_nextTabAction = new QAction(tr("Show Next Tab"), this); + m_nextTabAction = new QAction(i18n("Show Next Tab"), this); QList shortcuts; shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BraceRight)); shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_PageDown)); @@ -252,7 +236,7 @@ TabWidget::TabWidget(QWidget *parent) m_nextTabAction->setShortcuts(shortcuts); connect(m_nextTabAction, SIGNAL(triggered()), this, SLOT(nextTab())); - m_previousTabAction = new QAction(tr("Show Previous Tab"), this); + m_previousTabAction = new QAction(i18n("Show Previous Tab"), this); shortcuts.clear(); shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BraceLeft)); shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_PageUp)); @@ -266,7 +250,7 @@ TabWidget::TabWidget(QWidget *parent) this, SLOT(aboutToShowRecentTabsMenu())); connect(m_recentlyClosedTabsMenu, SIGNAL(triggered(QAction *)), this, SLOT(aboutToShowRecentTriggeredAction(QAction *))); - m_recentlyClosedTabsAction = new QAction(tr("Recently Closed Tabs"), this); + m_recentlyClosedTabsAction = new QAction(i18n("Recently Closed Tabs"), this); m_recentlyClosedTabsAction->setMenu(m_recentlyClosedTabsMenu); m_recentlyClosedTabsAction->setEnabled(false); @@ -465,7 +449,7 @@ WebView *TabWidget::newTab(bool makeCurrent) emptyWidget->setAutoFillBackground(true); disconnect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); - addTab(emptyWidget, tr("(Untitled)")); + addTab(emptyWidget, i18n("(Untitled)")); connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); return 0; @@ -496,7 +480,7 @@ WebView *TabWidget::newTab(bool makeCurrent) this, SIGNAL(statusBarVisibilityChangeRequested(bool))); connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SIGNAL(toolBarVisibilityChangeRequested(bool))); - addTab(webView, tr("(Untitled)")); + addTab(webView, i18n("(Untitled)")); if (makeCurrent) setCurrentWidget(webView); @@ -578,8 +562,8 @@ void TabWidget::closeTab(int index) if (tab->isModified()) { QMessageBox closeConfirmation(tab); closeConfirmation.setWindowFlags(Qt::Sheet); - closeConfirmation.setWindowTitle(tr("Do you really want to close this page?")); - closeConfirmation.setInformativeText(tr("You have modified this page and when closing it you would lose the modification.\n" + closeConfirmation.setWindowTitle(i18n("Do you really want to close this page?")); + closeConfirmation.setInformativeText(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")); closeConfirmation.setIcon(QMessageBox::Question); closeConfirmation.addButton(QMessageBox::Yes); diff --git a/src/tabwidget.h b/src/tabwidget.h index 1bdd56bf..89d87410 100644 --- a/src/tabwidget.h +++ b/src/tabwidget.h @@ -1,39 +1,23 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + + #ifndef TABWIDGET_H #define TABWIDGET_H diff --git a/src/toolbarsearch.cpp b/src/toolbarsearch.cpp index 16022fe0..26661386 100644 --- a/src/toolbarsearch.cpp +++ b/src/toolbarsearch.cpp @@ -1,51 +1,33 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ - +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + +// Local Includes #include "toolbarsearch.h" #include "autosaver.h" -#include -#include - -#include -#include -#include - -#include +// Qt Includes +#include +#include +#include +#include +#include +#include /* ToolbarSearch is a very basic search widget that also contains a small history. @@ -66,7 +48,7 @@ ToolbarSearch::ToolbarSearch(QWidget *parent) lineEdit()->setCompleter(completer); connect(lineEdit(), SIGNAL(returnPressed()), SLOT(searchNow())); - setInactiveText(tr("Google")); + setInactiveText("Google"); load(); } @@ -114,7 +96,7 @@ void ToolbarSearch::searchNow() url.addQueryItem(QLatin1String("q"), searchText); url.addQueryItem(QLatin1String("ie"), QLatin1String("UTF-8")); url.addQueryItem(QLatin1String("oe"), QLatin1String("UTF-8")); - url.addQueryItem(QLatin1String("client"), QLatin1String("qtdemobrowser")); + url.addQueryItem(QLatin1String("client"), QLatin1String("reKonq")); emit search(url); } @@ -125,18 +107,18 @@ void ToolbarSearch::aboutToShowMenu() m->clear(); QStringList list = m_stringListModel->stringList(); if (list.isEmpty()) { - m->addAction(tr("No Recent Searches")); + m->addAction( tr("No Recent Searches") ); return; } - QAction *recent = m->addAction(tr("Recent Searches")); + QAction *recent = m->addAction( tr("Recent Searches") ); recent->setEnabled(false); for (int i = 0; i < list.count(); ++i) { QString text = list.at(i); m->addAction(text)->setData(text); } m->addSeparator(); - m->addAction(tr("Clear Recent Searches"), this, SLOT(clear())); + m->addAction( tr("Clear Recent Searches"), this, SLOT(clear())); } void ToolbarSearch::triggeredMenuAction(QAction *action) diff --git a/src/toolbarsearch.h b/src/toolbarsearch.h index 9ecbf183..a9a20a1d 100644 --- a/src/toolbarsearch.h +++ b/src/toolbarsearch.h @@ -1,39 +1,21 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ #ifndef TOOLBARSEARCH_H #define TOOLBARSEARCH_H diff --git a/src/webview.cpp b/src/webview.cpp index 39cedd95..2d059194 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -1,39 +1,22 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + #include "browserapplication.h" #include "browsermainwindow.h" @@ -43,17 +26,17 @@ #include "tabwidget.h" #include "webview.h" -#include -#include -#include -#include - -#include +#include +#include -#include +#include +#include +#include +#include +#include +#include +#include -#include -#include WebPage::WebPage(QObject *parent) : QWebPage(parent) @@ -142,10 +125,11 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) return; } - QFile file(QLatin1String(":/notfound.html")); + QString myfilestr = KStandardDirs::locate("data", "rekonq/htmls/notfound.html"); + QFile file( myfilestr ); bool isOpened = file.open(QIODevice::ReadOnly); Q_ASSERT(isOpened); - QString title = tr("Error loading page: %1").arg(reply->url().toString()); + QString title = i18n("Error loading page: ") + reply->url().toString(); QString html = QString(QLatin1String(file.readAll())) .arg(title) .arg(reply->errorString()) @@ -204,7 +188,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) if (!r.linkUrl().isEmpty()) { QMenu menu(this); menu.addAction(pageAction(QWebPage::OpenLinkInNewWindow)); - menu.addAction(tr("Open in New Tab"), this, SLOT(openLinkInNewTab())); + menu.addAction(i18n("Open in New Tab"), this, SLOT(openLinkInNewTab())); menu.addSeparator(); menu.addAction(pageAction(QWebPage::DownloadLinkToDisk)); // Add link to bookmarks... diff --git a/src/webview.h b/src/webview.h index 73c9dafb..ea955a71 100644 --- a/src/webview.h +++ b/src/webview.h @@ -1,44 +1,26 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ #ifndef WEBVIEW_H #define WEBVIEW_H -#include +#include QT_BEGIN_NAMESPACE class QAuthenticator; diff --git a/src/xbel.cpp b/src/xbel.cpp index 3accd76d..788c6d03 100644 --- a/src/xbel.cpp +++ b/src/xbel.cpp @@ -1,43 +1,30 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ - +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ + +// Local Includes #include "xbel.h" -#include +// KDE Includes +#include + +// Qt Includes +#include BookmarkNode::BookmarkNode(BookmarkNode::Type type, BookmarkNode *parent) : expanded(false) @@ -137,7 +124,7 @@ BookmarkNode *XbelReader::read(QIODevice *device) && (version.isEmpty() || version == QLatin1String("1.0"))) { readXBEL(root); } else { - raiseError(QObject::tr("The file is not an XBEL version 1.0 file.")); + raiseError( i18n("The file is not an XBEL version 1.0 file.") ); } } } @@ -235,7 +222,7 @@ void XbelReader::readBookmarkNode(BookmarkNode *parent) } } if (bookmark->title.isEmpty()) - bookmark->title = QObject::tr("Unknown title"); + bookmark->title = i18n("Unknown title"); } void XbelReader::skipUnknownElement() diff --git a/src/xbel.h b/src/xbel.h index fdacd1b9..972bbf17 100644 --- a/src/xbel.h +++ b/src/xbel.h @@ -1,39 +1,21 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * ============================================================ */ #ifndef XBEL_H #define XBEL_H -- cgit v1.2.1