diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/application.cpp | 59 | ||||
-rw-r--r-- | src/application.h | 37 | ||||
-rw-r--r-- | src/bookmarks/bookmarkcontextmenu.cpp | 11 | ||||
-rw-r--r-- | src/bookmarks/bookmarksmanager.cpp | 33 | ||||
-rw-r--r-- | src/bookmarks/bookmarksmanager.h | 6 | ||||
-rw-r--r-- | src/bookmarks/bookmarkspanel.cpp | 8 | ||||
-rw-r--r-- | src/bookmarks/bookmarkspanel.h | 4 | ||||
-rw-r--r-- | src/bookmarks/bookmarkstreemodel.cpp | 85 | ||||
-rw-r--r-- | src/bookmarks/bookmarkstreemodel.h | 4 | ||||
-rw-r--r-- | src/data/rekonq.desktop | 2 | ||||
-rw-r--r-- | src/history/historymanager.cpp | 95 | ||||
-rw-r--r-- | src/history/historymanager.h | 34 | ||||
-rw-r--r-- | src/mainwindow.cpp | 21 | ||||
-rw-r--r-- | src/newtabpage.cpp | 2 | ||||
-rw-r--r-- | src/protocolhandler.cpp | 17 | ||||
-rw-r--r-- | src/urlbar/urlresolver.cpp | 2 | ||||
-rw-r--r-- | src/webpage.cpp | 4 |
17 files changed, 242 insertions, 182 deletions
diff --git a/src/application.cpp b/src/application.cpp index 5b98fafa..07a3067b 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -548,3 +548,62 @@ void Application::updateConfiguration() defaultSettings = 0; } + + + + +void Application::addDownload(const QString &srcUrl, const QString &destUrl) +{ + QWebSettings *globalSettings = QWebSettings::globalSettings(); + if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) + return; + QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads"); + QFile downloadFile(downloadFilePath); + if (!downloadFile.open(QFile::WriteOnly | QFile::Append)) + { + kDebug() << "Unable to open download file (WRITE mode).."; + return; + } + QDataStream out(&downloadFile); + out << srcUrl; + out << destUrl; + out << QDateTime::currentDateTime(); + downloadFile.close(); +} + + +DownloadList Application::downloads() +{ + DownloadList list; + + QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads"); + QFile downloadFile(downloadFilePath); + if (!downloadFile.open(QFile::ReadOnly)) + { + kDebug() << "Unable to open download file (READ mode).."; + return list; + } + + QDataStream in(&downloadFile); + while (!in.atEnd()) + { + QString srcUrl; + in >> srcUrl; + QString destUrl; + in >> destUrl; + QDateTime dt; + in >> dt; + DownloadItem item(srcUrl, destUrl, dt); + list << item; + } + return list; +} + + +bool Application::clearDownloadsHistory() +{ + QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads"); + QFile downloadFile(downloadFilePath); + return downloadFile.remove(); +} + diff --git a/src/application.h b/src/application.h index 7b58ab18..18c99afb 100644 --- a/src/application.h +++ b/src/application.h @@ -56,6 +56,38 @@ class WebView; typedef QList< QWeakPointer<MainWindow> > MainWindowList; +// --------------------------------------------------------------------------------------------------------------- + + +#include <QDateTime> + + +class DownloadItem +{ +public: + DownloadItem() {} + explicit DownloadItem(const QString &srcUrl, + const QString &destUrl, + const QDateTime &d + ) + : srcUrlString(srcUrl) + , destUrlString(destUrl) + , dateTime(d) + {} + + QString srcUrlString; + QString destUrlString; + QDateTime dateTime; +}; + + +typedef QList<DownloadItem> DownloadList; + + +// --------------------------------------------------------------------------------------------------------------- + + + /** * */ @@ -80,6 +112,11 @@ public: static SessionManager *sessionManager(); static AdBlockManager *adblockManager(); + // DOWNLOADS MANAGEMENT METHODS + void addDownload(const QString &srcUrl, const QString &destUrl); + DownloadList downloads(); + bool clearDownloadsHistory(); + public slots: /** * Save application's configuration diff --git a/src/bookmarks/bookmarkcontextmenu.cpp b/src/bookmarks/bookmarkcontextmenu.cpp index b5df463c..dec4382f 100644 --- a/src/bookmarks/bookmarkcontextmenu.cpp +++ b/src/bookmarks/bookmarkcontextmenu.cpp @@ -212,6 +212,7 @@ void BookmarkContextMenu::copyToClipboard() void BookmarkContextMenu::deleteBookmark() { KBookmark bm = bookmark(); + KBookmarkGroup bmg = bm.parentGroup(); bool folder = bm.isGroup(); QString name = QString(bm.text()).replace("&&", "&"); @@ -226,8 +227,8 @@ void BookmarkContextMenu::deleteBookmark() ) return; - bm.parentGroup().deleteBookmark(bm); - manager()->emitChanged(); + bmg.deleteBookmark(bm); + manager()->emitChanged(bmg); } @@ -266,7 +267,7 @@ void BookmarkContextMenu::newBookmarkGroup() KBookmark newBk; newBk = dialog->createNewFolder("New folder", selected.parentGroup()); selected.parentGroup().moveBookmark(newBk, selected); - manager()->emitChanged(); + manager()->emitChanged(newBk.parentGroup()); } } else @@ -303,7 +304,7 @@ void BookmarkContextMenu::newSeparator() if (!selected.isNull()) parent.moveBookmark(newBk, selected); - manager()->emitChanged(); + manager()->emitChanged(newBk.parentGroup()); } @@ -328,6 +329,6 @@ void BookmarkContextMenu::bookmarkCurrentPage() parent.addBookmark(owner()->currentTitle(), KUrl(owner()->currentUrl()), "text-html"); } - manager()->emitChanged(); + manager()->emitChanged(parent); } diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index 954a633a..57a29907 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -234,7 +234,7 @@ void BookmarkMenu::addOpenFolderInTabs() if (!bookmark.isNull()) { action = new KAction(KIcon("tab-new"), i18n("Open Folder in Tabs"), this); - action->setHelpText(i18n("Open all bookmarks in this folder as a new tab.")); + action->setHelpText(i18n("Open all bookmarks in this folder as new tabs.")); connect(action, SIGNAL(triggered(bool)), this, SLOT(slotOpenFolderInTabs())); parentMenu()->addAction(action); } @@ -483,3 +483,34 @@ void BookmarkProvider::slotAddBookmark() parentBookmark.addBookmark(bookmarkOwner()->currentTitle(), bookmarkOwner()->currentUrl()); bookmarkManager()->emitChanged(); } + + +void BookmarkProvider::registerBookmarkPanel(BookmarksPanel *panel) +{ + if (panel && !m_bookmarkPanels.contains(panel)) + { + m_bookmarkPanels.append(panel); + connect(panel, SIGNAL(expansionChanged()), this, SLOT(slotPanelChanged())); + } +} + + +void BookmarkProvider::removeBookmarkPanel(BookmarksPanel *panel) +{ + m_bookmarkPanels.removeOne(panel); + + if (m_bookmarkPanels.isEmpty()) + { + Application::bookmarkProvider()->bookmarkManager()->emitChanged(); + } +} + + +void BookmarkProvider::slotPanelChanged() +{ + foreach (BookmarksPanel *panel, m_bookmarkPanels) + { + if (panel && panel != sender()) + panel->startLoadFoldedState(); + } +} diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h index 4be3a94b..0915e894 100644 --- a/src/bookmarks/bookmarksmanager.h +++ b/src/bookmarks/bookmarksmanager.h @@ -37,6 +37,7 @@ // Local Includes #include "application.h" #include "urlresolver.h" +#include "bookmarkspanel.h" // Qt Includes #include <QWidget> @@ -234,6 +235,9 @@ public: QString titleForBookmarkUrl(QString url); + void registerBookmarkPanel(BookmarksPanel *panel); + void removeBookmarkPanel(BookmarksPanel *panel); + signals: /** * @short This signal is emitted when an url has to be loaded @@ -263,6 +267,7 @@ public slots: private slots: void triggerBookmarkMenu(); void slotAddBookmark(); + void slotPanelChanged(); private: void fillBookmarkBar(KToolBar *toolBar); @@ -272,6 +277,7 @@ private: BookmarkOwner *m_owner; KActionCollection *m_actionCollection; QList<KToolBar*> m_bookmarkToolBars; + QList<BookmarksPanel*> m_bookmarkPanels; AwesomeUrlCompletion *m_completion; KActionMenu *_bookmarkActionMenu; diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp index 0dbb89c4..25aab516 100644 --- a/src/bookmarks/bookmarkspanel.cpp +++ b/src/bookmarks/bookmarkspanel.cpp @@ -126,7 +126,7 @@ void BookmarksPanel::setup() connect(m_treeView, SIGNAL(collapsed(const QModelIndex &)), this, SLOT(onCollapse(const QModelIndex &))); connect(m_treeView, SIGNAL(expanded(const QModelIndex &)), this, SLOT(onExpand(const QModelIndex &))); connect(search, SIGNAL(textChanged(const QString &)), proxy, SLOT(setFilterFixedString(const QString &))); - loadFoldedState(); + startLoadFoldedState(); _loaded = true; } @@ -152,7 +152,7 @@ void BookmarksPanel::onCollapse(const QModelIndex &index) KBookmark bookmark = bookmarkForIndex(index); bookmark.internalElement().setAttribute("folded", "yes"); - emit saveOnlyRequested(); + emit expansionChanged(); } @@ -163,11 +163,11 @@ void BookmarksPanel::onExpand(const QModelIndex &index) KBookmark bookmark = bookmarkForIndex(index); bookmark.internalElement().setAttribute("folded", "no"); - emit saveOnlyRequested(); + emit expansionChanged(); } -void BookmarksPanel::loadFoldedState() +void BookmarksPanel::startLoadFoldedState() { m_loadingState = true; loadFoldedState(QModelIndex()); diff --git a/src/bookmarks/bookmarkspanel.h b/src/bookmarks/bookmarkspanel.h index 3d2dc26b..d94f2b99 100644 --- a/src/bookmarks/bookmarkspanel.h +++ b/src/bookmarks/bookmarkspanel.h @@ -59,10 +59,11 @@ public: signals: void openUrl(const KUrl &, const Rekonq::OpenType &); void itemHovered(const QString &); - void saveOnlyRequested(); + void expansionChanged(); public slots: void showing(bool); + void startLoadFoldedState(); private slots: void contextMenu(const QPoint &pos); @@ -71,7 +72,6 @@ private slots: void onCollapse(const QModelIndex &index); void onExpand(const QModelIndex &index); void loadFoldedState(const QModelIndex &root); - void loadFoldedState(); private: void setup(); diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp index 82748ba3..b58b66e9 100644 --- a/src/bookmarks/bookmarkstreemodel.cpp +++ b/src/bookmarks/bookmarkstreemodel.cpp @@ -148,9 +148,8 @@ BookmarksTreeModel::BookmarksTreeModel(QObject *parent) , m_root(0) { resetModel(); - connect(this, SIGNAL(bookmarksUpdated()), parent, SLOT(loadFoldedState())); - connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString, QString)), this, SLOT(bookmarksChanged())); - connect(parent, SIGNAL(saveOnlyRequested()), this, SLOT(saveOnly())); + connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(const QString &, const QString &)), this, SLOT(bookmarksChanged(const QString &))); + connect(this, SIGNAL(bookmarksUpdated()), parent, SLOT(startLoadFoldedState())); } @@ -284,10 +283,37 @@ QVariant BookmarksTreeModel::data(const QModelIndex &index, int role) const } -void BookmarksTreeModel::bookmarksChanged() +void BookmarksTreeModel::bookmarksChanged(const QString &groupAddress) { - resetModel(); - emit bookmarksUpdated(); + if (groupAddress.isEmpty()) + { + resetModel(); + emit bookmarksUpdated(); + } + else + { + beginResetModel(); + BtmItem *node = m_root; + QModelIndex nodeIndex; + + QStringList indexChain( groupAddress.split( '/', QString::SkipEmptyParts) ); + foreach( const QString &sIndex, indexChain ) + { + bool ok; + int i = sIndex.toInt( &ok ); + if( !ok ) + break; + + if( i < 0 || i >= node->childCount() ) + break; + + node = node->child( i ); + nodeIndex = index( i, 0, nodeIndex ); + } + populate(node, Application::bookmarkProvider()->bookmarkManager()->findByAddress(groupAddress).toGroup()); + endResetModel(); + emit bookmarksUpdated(); + } } @@ -299,6 +325,7 @@ void BookmarksTreeModel::resetModel() void BookmarksTreeModel::setRoot(KBookmarkGroup bmg) { + beginResetModel(); delete m_root; m_root = new BtmItem(KBookmark()); @@ -306,7 +333,7 @@ void BookmarksTreeModel::setRoot(KBookmarkGroup bmg) return; populate(m_root, bmg); - reset(); + endResetModel(); } @@ -336,20 +363,6 @@ KBookmark BookmarksTreeModel::bookmarkForIndex(const QModelIndex &index) const } -void BookmarksTreeModel::saveOnly() -{ - disconnect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString, QString)), this, SLOT(bookmarksChanged())); - connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString, QString)), this, SLOT(reconnectManager())); - Application::bookmarkProvider()->bookmarkManager()->emitChanged(); -} - - -void BookmarksTreeModel::reconnectManager() -{ - connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString, QString)), this, SLOT(bookmarksChanged())); -} - - Qt::DropActions BookmarksTreeModel::supportedDropActions() const { return Qt::MoveAction; @@ -366,8 +379,8 @@ QMimeData* BookmarksTreeModel::mimeData(const QModelIndexList & indexes) const { QMimeData *mimeData = new QMimeData; - QByteArray addresse = bookmarkForIndex(indexes.first()).address().toLatin1(); - mimeData->setData("application/rekonq-bookmark", addresse); + QByteArray address = bookmarkForIndex(indexes.first()).address().toLatin1(); + mimeData->setData("application/rekonq-bookmark", address); bookmarkForIndex(indexes.first()).populateMimeData(mimeData); return mimeData; @@ -395,32 +408,16 @@ bool BookmarksTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction acti if (!destIndex.isValid()) { - if (!parent.isValid()) // Drop into a blank area - { - Application::bookmarkProvider()->rootGroup().deleteBookmark(bookmark); - Application::bookmarkProvider()->rootGroup().addBookmark(bookmark); - } - else // Drop at the last item of the group or directly on the main item of the group - { - root.deleteBookmark(bookmark); - root.addBookmark(bookmark); - } + root.deleteBookmark(bookmark); + root.addBookmark(bookmark); } - else + else if (row != 1) { - if (row == -1) - { - root.deleteBookmark(bookmark); - root.addBookmark(bookmark); - } - else // A classic drop - { - root.moveBookmark(bookmark, root.previous(dropDestBookmark)); - } + root.moveBookmark(bookmark, root.previous(dropDestBookmark)); } - Application::bookmarkProvider()->bookmarkManager()->emitChanged(root); + Application::bookmarkProvider()->bookmarkManager()->emitChanged(); } } return true; diff --git a/src/bookmarks/bookmarkstreemodel.h b/src/bookmarks/bookmarkstreemodel.h index 8dd0923c..c509840b 100644 --- a/src/bookmarks/bookmarkstreemodel.h +++ b/src/bookmarks/bookmarkstreemodel.h @@ -84,9 +84,7 @@ public: virtual QMimeData *mimeData(const QModelIndexList & indexes) const; private slots: - void bookmarksChanged(); - void saveOnly(); - void reconnectManager(); + void bookmarksChanged(const QString &groupAddress); signals: void bookmarksUpdated(); diff --git a/src/data/rekonq.desktop b/src/data/rekonq.desktop index f47dbf70..a45dfc20 100644 --- a/src/data/rekonq.desktop +++ b/src/data/rekonq.desktop @@ -11,6 +11,7 @@ Name[fr]=rekonq Name[ga]=rekonq Name[it]=rekonq Name[lt]=rekonq +Name[nb]=rekonq Name[nds]=Rekonq Name[nl]=rekonq Name[pl]=rekonq @@ -32,6 +33,7 @@ GenericName[en_GB]=WebKit KDE Browser GenericName[es]=Navegador WebKit para KDE GenericName[et]=KDE WebKiti veebibrauser GenericName[fr]=Navigateur Webkit pour KDE +GenericName[nb]=WebKit KDE Browser GenericName[nds]=KDE-Kieker för Nettbuukasten GenericName[nl]=Webkit KDE Browser GenericName[pt]=Navegador do KDE Usando o WebKit diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp index d531c189..13c3df24 100644 --- a/src/history/historymanager.cpp +++ b/src/history/historymanager.cpp @@ -119,6 +119,10 @@ bool HistoryManager::historyContains(const QString &url) const void HistoryManager::addHistoryEntry(const QString &url) { + QWebSettings *globalSettings = QWebSettings::globalSettings(); + if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) + return; + QUrl cleanUrl(url); // don't store about: urls (home page related) @@ -128,8 +132,13 @@ void HistoryManager::addHistoryEntry(const QString &url) cleanUrl.setPassword(QString()); cleanUrl.setHost(cleanUrl.host().toLower()); HistoryItem item(cleanUrl.toString(), QDateTime::currentDateTime()); - addHistoryEntry(item); + m_history.prepend(item); + emit entryAdded(item); + + if (m_history.count() == 1) + checkForExpired(); + // Add item to completion object QString _url(url); _url.remove(QRegExp("^http://|/$")); @@ -213,20 +222,6 @@ void HistoryManager::checkForExpired() } -void HistoryManager::addHistoryEntry(const HistoryItem &item) -{ - QWebSettings *globalSettings = QWebSettings::globalSettings(); - if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) - return; - - m_history.prepend(item); - emit entryAdded(item); - - if (m_history.count() == 1) - checkForExpired(); -} - - void HistoryManager::updateHistoryEntry(const KUrl &url, const QString &title) { for (int i = 0; i < m_history.count(); ++i) @@ -244,14 +239,6 @@ void HistoryManager::updateHistoryEntry(const KUrl &url, const QString &title) } -void HistoryManager::removeHistoryEntry(const HistoryItem &item) -{ - m_lastSavedUrl.clear(); - m_history.removeOne(item); - emit entryRemoved(item); -} - - void HistoryManager::removeHistoryEntry(const KUrl &url, const QString &title) { HistoryItem item; @@ -261,7 +248,9 @@ void HistoryManager::removeHistoryEntry(const KUrl &url, const QString &title) && (title.isEmpty() || title == m_history.at(i).title)) { item = m_history.at(i); - removeHistoryEntry(item); + m_lastSavedUrl.clear(); + m_history.removeOne(item); + emit entryRemoved(item); break; } } @@ -464,63 +453,7 @@ AwesomeUrlCompletion * HistoryManager::completionObject() const } -void HistoryManager::addDownload(const QString &srcUrl, const QString &destUrl) -{ - QWebSettings *globalSettings = QWebSettings::globalSettings(); - if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) - return; - QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads"); - QFile downloadFile(downloadFilePath); - if (!downloadFile.open(QFile::WriteOnly | QFile::Append)) - { - kDebug() << "Unable to open download file (WRITE mode).."; - return; - } - QDataStream out(&downloadFile); - out << srcUrl; - out << destUrl; - out << QDateTime::currentDateTime(); - downloadFile.close(); -} - - -DownloadList HistoryManager::downloads() -{ - DownloadList list; - - QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads"); - QFile downloadFile(downloadFilePath); - if (!downloadFile.open(QFile::ReadOnly)) - { - kDebug() << "Unable to open download file (READ mode).."; - return list; - } - - QDataStream in(&downloadFile); - while (!in.atEnd()) - { - QString srcUrl; - in >> srcUrl; - QString destUrl; - in >> destUrl; - QDateTime dt; - in >> dt; - DownloadItem item(srcUrl, destUrl, dt); - list << item; - } - return list; -} - - -bool HistoryManager::clearDownloadsHistory() -{ - QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads"); - QFile downloadFile(downloadFilePath); - return downloadFile.remove(); -} - - -QString HistoryManager::titleForHistoryUrl(QString url) +QString HistoryManager::titleForHistoryUrl(const QString &url) { return history().at(m_historyFilterModel->historyLocation(url)).title; } diff --git a/src/history/historymanager.h b/src/history/historymanager.h index 7b82579d..ce712919 100644 --- a/src/history/historymanager.h +++ b/src/history/historymanager.h @@ -84,30 +84,6 @@ public: // --------------------------------------------------------------------------------------------------------------- -class DownloadItem -{ -public: - DownloadItem() {} - explicit DownloadItem(const QString &srcUrl, - const QString &destUrl, - const QDateTime &d - ) - : srcUrlString(srcUrl) - , destUrlString(destUrl) - , dateTime(d) - {} - - QString srcUrlString; - QString destUrlString; - QDateTime dateTime; -}; - - -typedef QList<DownloadItem> DownloadList; - -// --------------------------------------------------------------------------------------------------------------- - - // Forward Declarations class AutoSaver; class HistoryModel; @@ -139,7 +115,7 @@ public: void updateHistoryEntry(const KUrl &url, const QString &title); void removeHistoryEntry(const KUrl &url, const QString &title = QString()); - QString titleForHistoryUrl(QString url); + QString titleForHistoryUrl(const QString &url); int historyLimit() const; void setHistoryLimit(int limit); @@ -157,10 +133,6 @@ public: */ AwesomeUrlCompletion *completionObject() const; - void addDownload(const QString &srcUrl, const QString &destUrl); - DownloadList downloads(); - bool clearDownloadsHistory(); - public slots: void clear(); void loadSettings(); @@ -169,10 +141,6 @@ private slots: void save(); void checkForExpired(); -protected: - void addHistoryEntry(const HistoryItem &item); - void removeHistoryEntry(const HistoryItem &item); - private: void load(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b27b7c81..55cc7a69 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -161,6 +161,7 @@ MainWindow::MainWindow() MainWindow::~MainWindow() { Application::bookmarkProvider()->removeToolBar(m_bmBar); + Application::bookmarkProvider()->removeBookmarkPanel(m_bookmarksPanel); Application::instance()->removeMainWindow(this); delete m_view; @@ -195,15 +196,20 @@ void MainWindow::setupToolbars() m_mainBar->addAction(actionByName(KStandardAction::name(KStandardAction::Forward))); m_mainBar->addSeparator(); m_mainBar->addAction(actionByName( QL1S("stop_reload") )); - m_mainBar->addAction(actionByName(KStandardAction::name(KStandardAction::Home))); +// m_mainBar->addAction(actionByName(KStandardAction::name(KStandardAction::Home))); // location bar KAction *urlBarAction = new KAction(this); urlBarAction->setDefaultWidget(m_view->widgetBar()); m_mainBar->addAction(urlBarAction); - m_mainBar->addAction(actionByName( QL1S("bookmarksActionMenu") )); +// m_mainBar->addAction(actionByName( QL1S("bookmarksActionMenu") )); + connect(actionByName(QL1S("bookmarksActionMenu")), SIGNAL(triggered()), + qobject_cast<QToolButton*>(m_mainBar->widgetForAction(actionByName(QL1S("bookmarksActionMenu")))), SLOT(showMenu())); + m_mainBar->addAction(actionByName( QL1S("rekonq_tools") )); + connect(actionByName(QL1S("rekonq_tools")), SIGNAL(triggered()), + qobject_cast<QToolButton*>(m_mainBar->widgetForAction(actionByName(QL1S("rekonq_tools")))), SLOT(showMenu())); m_mainBar->show(); // this just to fix reopening rekonq after fullscreen close @@ -217,7 +223,6 @@ void MainWindow::setupToolbars() m_bmBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); m_bmBar->setIconDimensions(16); - m_bmBar->hide(); KToolBar::setToolBarsEditable(false); KToolBar::setToolBarsLocked(true); @@ -447,6 +452,8 @@ void MainWindow::setupActions() KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(this); bmMenu->setIcon(KIcon("bookmarks")); bmMenu->setDelayed(false); + bmMenu->setShortcutConfigurable(true); + bmMenu->setShortcut( KShortcut(Qt::ALT + Qt::Key_B) ); actionCollection()->addAction(QL1S("bookmarksActionMenu"), bmMenu); @@ -464,7 +471,9 @@ void MainWindow::setupTools() kDebug() << "setup tools..."; KActionMenu *toolsMenu = new KActionMenu(KIcon("configure"), i18n("&Tools"), this); toolsMenu->setDelayed(false); - + toolsMenu->setShortcutConfigurable(true); + toolsMenu->setShortcut( KShortcut(Qt::ALT + Qt::Key_T) ); + toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Open))); toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::SaveAs))); toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Print))); @@ -566,6 +575,8 @@ void MainWindow::setupPanels() addDockWidget(Qt::LeftDockWidgetArea, m_bookmarksPanel); + Application::bookmarkProvider()->registerBookmarkPanel(m_bookmarksPanel); + // setup bookmarks panel action a = (KAction *) m_bookmarksPanel->toggleViewAction(); a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B)); @@ -1195,7 +1206,7 @@ void MainWindow::clearPrivateData() if (clearWidget.clearDownloads->isChecked()) { - Application::historyManager()->clearDownloadsHistory(); + Application::instance()->clearDownloadsHistory(); } if (clearWidget.clearCookies->isChecked()) diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp index cbdbe306..bbf6714e 100644 --- a/src/newtabpage.cpp +++ b/src/newtabpage.cpp @@ -549,7 +549,7 @@ void NewTabPage::downloadsPage() clearData.findFirst("span").appendInside(i18n("Clear Private Data")); m_root.document().findFirst("#actions").appendInside(clearData); - DownloadList list = Application::historyManager()->downloads(); + DownloadList list = Application::instance()->downloads(); if (list.isEmpty()) { diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp index 568aa400..1f84b420 100644 --- a/src/protocolhandler.cpp +++ b/src/protocolhandler.cpp @@ -53,6 +53,7 @@ #include <KJob> #include <kio/udsentry.h> #include <KMessageBox> +#include <kprocess.h> // Qt Includes #include <QLatin1String> @@ -118,6 +119,22 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra return true; } + // "apturl" handling + if (_url.protocol() == QL1S ("apt")) + { + //Declare apturl as QString + QString apturl="apturl"; + //We need to convert the url to QStringList to pass as a argument to apturl + QStringList host; + host << _url.url(); + + if ( KProcess::execute (apturl,host)==0) + return true; + else + return false; + + } + // "abp" handling if (_url.protocol() == QL1S("abp")) { diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index 1f4f9f9c..d457e1fb 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -68,7 +68,7 @@ UrlResolver::UrlResolver(const QString &typedUrl) { kDebug() << "browse regexp empty. Setting value.."; - QString protocol = "^(http://|https://|file://|ftp://|man:|info:)"; + QString protocol = "^(http://|https://|file://|ftp://|man:|info:|apt:)"; QString localhost = "^localhost"; diff --git a/src/webpage.cpp b/src/webpage.cpp index 939d7128..a63940b0 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -136,8 +136,8 @@ static bool downloadResource (const KUrl& srcUrl, const KIO::MetaData& metaData } while (result == KIO::R_CANCEL && destUrl.isValid()); - // Save download on history manager - Application::historyManager()->addDownload(srcUrl.pathOrUrl() , destUrl.pathOrUrl()); + // Save download history + Application::instance()->addDownload(srcUrl.pathOrUrl() , destUrl.pathOrUrl()); if (ReKonfig::kgetDownload()) { |