diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/application.cpp | 3 | ||||
-rw-r--r-- | src/bookmarks/bookmarkcontextmenu.cpp | 4 | ||||
-rw-r--r-- | src/bookmarks/bookmarksmanager.cpp | 155 | ||||
-rw-r--r-- | src/bookmarks/bookmarksmanager.h | 48 | ||||
-rw-r--r-- | src/bookmarks/bookmarkspanel.cpp | 4 | ||||
-rw-r--r-- | src/data/rekonq.desktop | 7 | ||||
-rw-r--r-- | src/mainview.cpp | 4 | ||||
-rw-r--r-- | src/mainwindow.cpp | 60 | ||||
-rw-r--r-- | src/mainwindow.h | 7 | ||||
-rw-r--r-- | src/rekonqui.rc | 4 | ||||
-rw-r--r-- | src/sessionmanager.cpp | 4 | ||||
-rw-r--r-- | src/webpage.cpp | 4 |
12 files changed, 221 insertions, 83 deletions
diff --git a/src/application.cpp b/src/application.cpp index 07a3067b..71693a7a 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -550,8 +550,6 @@ void Application::updateConfiguration() } - - void Application::addDownload(const QString &srcUrl, const QString &destUrl) { QWebSettings *globalSettings = QWebSettings::globalSettings(); @@ -606,4 +604,3 @@ bool Application::clearDownloadsHistory() QFile downloadFile(downloadFilePath); return downloadFile.remove(); } - diff --git a/src/bookmarks/bookmarkcontextmenu.cpp b/src/bookmarks/bookmarkcontextmenu.cpp index dec4382f..e731d982 100644 --- a/src/bookmarks/bookmarkcontextmenu.cpp +++ b/src/bookmarks/bookmarkcontextmenu.cpp @@ -222,7 +222,9 @@ void BookmarkContextMenu::deleteBookmark() : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", name), folder ? i18n("Bookmark Folder Deletion") : i18n("Bookmark Deletion"), - KStandardGuiItem::del()) + KStandardGuiItem::del(), + KStandardGuiItem::cancel(), + "bookmarkDeletition_askAgain") != KMessageBox::Continue ) return; diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index 7f07cf48..792baaeb 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -103,7 +103,11 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bookmark) i18ncp("%1=Number of tabs. Value is always >=8", "You are about to open %1 tabs.\nAre you sure?", "You are about to open %1 tabs.\nAre you sure?", - urlList.length()) + urlList.length()), + "", + KStandardGuiItem::cont(), + KStandardGuiItem::cancel(), + "openFolderInTabs_askAgain" ) == KMessageBox::Continue) ) return; @@ -142,7 +146,6 @@ BookmarkMenu::BookmarkMenu(KBookmarkManager *manager, KActionCollection* actionCollection) : KBookmarkMenu(manager, owner, menu, actionCollection) { - refill(); } @@ -152,7 +155,6 @@ BookmarkMenu::BookmarkMenu(KBookmarkManager *manager, const QString &parentAddress) : KBookmarkMenu(manager, owner, parentMenu, parentAddress) { - refill(); } @@ -176,7 +178,8 @@ QAction * BookmarkMenu::actionForBookmark(const KBookmark &bookmark) if (bookmark.isGroup()) { KBookmarkActionMenu *actionMenu = new KBookmarkActionMenu(bookmark, this); - new BookmarkMenu(manager(), owner(), actionMenu->menu(), bookmark.address()); + BookmarkMenu *menu = new BookmarkMenu(manager(), owner(), actionMenu->menu(), bookmark.address()); + connect(actionMenu, SIGNAL(hovered()), menu, SLOT(slotAboutToShow())); return actionMenu; } else if (bookmark.isSeparator()) @@ -185,7 +188,9 @@ QAction * BookmarkMenu::actionForBookmark(const KBookmark &bookmark) } else { - return new KBookmarkAction(bookmark, owner(), this); + KBookmarkAction *action = new KBookmarkAction(bookmark, owner(), this); + connect(action, SIGNAL(hovered()), this, SLOT(actionHovered())); + return action; } } @@ -240,9 +245,97 @@ void BookmarkMenu::addOpenFolderInTabs() } +void BookmarkMenu::actionHovered() +{ + KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(sender()); + if (action) + Application::instance()->mainWindow()->notifyMessage(action->bookmark().url().url()); +} + + // ------------------------------------------------------------------------------------------------------ +BookmarkToolBar::BookmarkToolBar( const QString &objectName, + QMainWindow *parentWindow, + Qt::ToolBarArea area, + bool newLine, + bool isMainToolBar, + bool readConfig + ) + : KToolBar(objectName, parentWindow, area, newLine, isMainToolBar, readConfig) + , m_filled(false) + , m_currentMenu(0) +{ + connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString,QString)), this, SLOT(hideMenu())); +} + + +BookmarkToolBar::~BookmarkToolBar() +{ +} + + +void BookmarkToolBar::setVisible(bool visible) +{ + if (visible && !m_filled) + { + m_filled = true; + Application::bookmarkProvider()->fillBookmarkBar(this); + } + KToolBar::setVisible(visible); +} + + +void BookmarkToolBar::menuDisplayed() +{ + qApp->installEventFilter(this); + m_currentMenu = qobject_cast<KMenu*>(sender()); +} + + +void BookmarkToolBar::menuHidden() +{ + qApp->removeEventFilter(this); + m_currentMenu = 0; +} + + +void BookmarkToolBar::hideMenu() +{ + if(m_currentMenu) + m_currentMenu->hide(); +} + + +bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event) +{ + // To switch root folders as in a menubar + if (event->type() == QEvent::MouseMove && m_currentMenu) + { + KBookmarkActionMenu* act = dynamic_cast<KBookmarkActionMenu *>(this->actionAt(this->mapFromGlobal(QCursor::pos()))); + if (act && act->menu() != m_currentMenu) + { + m_currentMenu->hide(); + QPoint pos = mapToGlobal(widgetForAction(act)->pos()); + act->menu()->popup(QPoint(pos.x(), pos.y() + widgetForAction(act)->height())); + } + } + return KToolBar::eventFilter(watched, event); +} + + +void BookmarkToolBar::actionHovered() +{ + KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(sender()); + if (action) + Application::instance()->mainWindow()->notifyMessage(action->bookmark().url().url()); +} + +// ------------------------------------------------------------------------------------------------------ + + + BookmarkProvider::BookmarkProvider(QObject *parent) : QObject(parent) , m_manager(0) @@ -293,19 +386,20 @@ BookmarkProvider::~BookmarkProvider() } -void BookmarkProvider::setupBookmarkBar(KToolBar *toolbar) +void BookmarkProvider::setupBookmarkBar(BookmarkToolBar *toolbar) { - KToolBar *bookmarkToolBar = toolbar; - m_bookmarkToolBars.append(bookmarkToolBar); - bookmarkToolBar->setContextMenuPolicy(Qt::CustomContextMenu); - connect(bookmarkToolBar, SIGNAL(customContextMenuRequested(const QPoint &)), - this, SLOT(contextMenu(const QPoint &))); - + kDebug() << "new bookmark bar..."; + + m_bookmarkToolBars.append(toolbar); + toolbar->setContextMenuPolicy(Qt::CustomContextMenu); + connect(toolbar, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenu(const QPoint &))); + slotBookmarksChanged("", ""); + kDebug() << "new bookmark bar... DONE!"; } -void BookmarkProvider::removeToolBar(KToolBar *toolbar) +void BookmarkProvider::removeToolBar(BookmarkToolBar *toolbar) { m_bookmarkToolBars.removeOne(toolbar); } @@ -316,7 +410,7 @@ void BookmarkProvider::slotBookmarksChanged(const QString &group, const QString Q_UNUSED(group) Q_UNUSED(caller) - foreach(KToolBar *bookmarkToolBar, m_bookmarkToolBars) + foreach(BookmarkToolBar *bookmarkToolBar, m_bookmarkToolBars) { if (bookmarkToolBar) { @@ -356,12 +450,15 @@ void BookmarkProvider::contextMenu(const QPoint &point) KActionMenu* BookmarkProvider::bookmarkActionMenu(QWidget *parent) { + kDebug() << "new Bookmarks Menu..."; + KMenu *menu = new KMenu(parent); _bookmarkActionMenu = new KActionMenu(parent); _bookmarkActionMenu->setMenu(menu); _bookmarkActionMenu->setText(i18n("&Bookmarks")); - connect(menu, SIGNAL(aboutToShow()), this, SLOT(triggerBookmarkMenu())); - + new BookmarkMenu(m_manager, m_owner, menu, m_actionCollection); + + kDebug() << "new Bookmarks Menu...DONE"; return _bookmarkActionMenu; } @@ -376,21 +473,7 @@ KAction* BookmarkProvider::bookmarkToolBarAction(KToolBar *t) } -void BookmarkProvider::triggerBookmarkMenu() -{ - kDebug() << "triggering Bookmarks Menu..."; - KMenu *menu = qobject_cast<KMenu *>(sender()); - - if(menu->actions().count() == 0) - { - kDebug() << "new Bookmarks Menu..."; - new BookmarkMenu(m_manager, m_owner, menu, m_actionCollection); - kDebug() << "new Bookmarks Menu...DONE"; - } -} - - -void BookmarkProvider::fillBookmarkBar(KToolBar *toolBar) +void BookmarkProvider::fillBookmarkBar(BookmarkToolBar *toolBar) { KBookmarkGroup root = m_manager->toolbar(); if (root.isNull()) @@ -403,7 +486,8 @@ void BookmarkProvider::fillBookmarkBar(KToolBar *toolBar) KBookmarkActionMenu *menuAction = new KBookmarkActionMenu(bookmark.toGroup(), this); menuAction->setDelayed(false); new BookmarkMenu(bookmarkManager(), bookmarkOwner(), menuAction->menu(), bookmark.address()); - + connect(menuAction->menu(), SIGNAL(aboutToShow()), toolBar, SLOT(menuDisplayed())); + connect(menuAction->menu(), SIGNAL(aboutToHide()), toolBar, SLOT(menuHidden())); toolBar->addAction(menuAction); } @@ -414,9 +498,10 @@ void BookmarkProvider::fillBookmarkBar(KToolBar *toolBar) else { - KBookmarkAction* a = new KBookmarkAction(bookmark, m_owner, this); - a->setIconText(a->iconText().replace('&', "&&")); - toolBar->addAction(a); + KBookmarkAction* action = new KBookmarkAction(bookmark, m_owner, this); + action->setIconText(action->iconText().replace('&', "&&")); + connect(action, SIGNAL(hovered()), toolBar, SLOT(actionHovered())); + toolBar->addAction(action); } } } diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h index fd2cfcdc..72ea1c3c 100644 --- a/src/bookmarks/bookmarksmanager.h +++ b/src/bookmarks/bookmarksmanager.h @@ -161,6 +161,9 @@ protected: virtual void refill(); virtual QAction* actionForBookmark(const KBookmark &bookmark); +private slots: + void actionHovered(); + private: void addOpenFolderInTabs(); @@ -169,7 +172,41 @@ private: // ------------------------------------------------------------------------------ +#include <KToolBar> + +class BookmarkToolBar : public KToolBar +{ + Q_OBJECT + +public: +BookmarkToolBar(const QString &objectName, + QMainWindow *parentWindow, + Qt::ToolBarArea area, + bool newLine = false, + bool isMainToolBar = false, + bool readConfig = true); +~BookmarkToolBar(); + +virtual void setVisible(bool visible); + +protected: + bool eventFilter(QObject *watched, QEvent *event); +private slots: + void actionHovered(); + void menuDisplayed(); + void menuHidden(); + void hideMenu(); + +private: + bool m_filled; + KMenu *m_currentMenu; +}; + + +// ------------------------------------------------------------------------------ + + /** * This class represent the interface to rekonq bookmarks system. * All rekonq needs (Bookmarks Menu, Bookmarks Toolbar) is provided @@ -205,9 +242,9 @@ public: /** * @short set the Bookmarks Toolbar Action */ - void setupBookmarkBar(KToolBar *); + void setupBookmarkBar(BookmarkToolBar *); - void removeToolBar(KToolBar*); + void removeToolBar(BookmarkToolBar *); /** * @short Get action by name @@ -259,20 +296,19 @@ public slots: * @see KBookmarkManager::changed */ void slotBookmarksChanged(const QString &group, const QString &caller); - + void fillBookmarkBar(BookmarkToolBar *toolBar); + private slots: - void triggerBookmarkMenu(); void slotAddBookmark(); void slotPanelChanged(); private: - void fillBookmarkBar(KToolBar *toolBar); QList<KBookmark> find(QList<KBookmark> list, const KBookmark &bookmark, QString text); KBookmarkManager *m_manager; BookmarkOwner *m_owner; KActionCollection *m_actionCollection; - QList<KToolBar*> m_bookmarkToolBars; + QList<BookmarkToolBar *> m_bookmarkToolBars; QList<BookmarksPanel*> m_bookmarkPanels; KActionMenu *_bookmarkActionMenu; diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp index 19db148b..5e11601a 100644 --- a/src/bookmarks/bookmarkspanel.cpp +++ b/src/bookmarks/bookmarkspanel.cpp @@ -227,7 +227,9 @@ void BookmarksPanel::deleteBookmark() : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", bm.text()), folder ? i18n("Bookmark Folder Deletion") : i18n("Bookmark Deletion"), - KStandardGuiItem::del()) + KStandardGuiItem::del(), + KStandardGuiItem::cancel(), + "bookmarkDeletition_askAgain") != KMessageBox::Continue ) return; diff --git a/src/data/rekonq.desktop b/src/data/rekonq.desktop index 413054bd..64ab8421 100644 --- a/src/data/rekonq.desktop +++ b/src/data/rekonq.desktop @@ -29,6 +29,13 @@ Name[x-test]=xxrekonqxx Name[zh_CN]=rekonq Name[zh_TW]=rekonq GenericName=Web Browser +GenericName[da]=Webbrowser +GenericName[es]=Navegador web +GenericName[fr]=Navigateur web +GenericName[pt]=Navegador Web +GenericName[pt_BR]=Navegador Web +GenericName[sv]=Webbläsare +GenericName[uk]=Переглядач Інтернету GenericName[x-test]=xxWeb Browserxx Icon=rekonq Type=Application diff --git a/src/mainview.cpp b/src/mainview.cpp index 0de4ea40..1965e321 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -494,7 +494,9 @@ void MainView::closeTab(int index, bool del) return; } - if (!tab->url().isEmpty()) + if (!tab->url().isEmpty() + && !QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled) + ) { QString title = tab->view()->title(); QString url = tab->url().prettyUrl(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8d0f28a7..9207f6ec 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -103,8 +103,7 @@ MainWindow::MainWindow() , m_analyzerPanel(0) , m_historyBackMenu(0) , m_encodingMenu(new KMenu(this)) -// , m_mainBar(new KToolBar(QString("MainToolBar"), this, Qt::TopToolBarArea, true, true, true)) -// , m_bmBar(new KToolBar(QString("BookmarkToolBar"), this, Qt::TopToolBarArea, true, false, true)) + , m_bookmarksBar(new BookmarkToolBar(QString("BookmarkToolBar"), this, Qt::TopToolBarArea, true, false, true)) , m_popup(new KPassivePopup(this)) , m_hidePopup(new QTimer(this)) { @@ -150,27 +149,6 @@ MainWindow::MainWindow() // no more status bar.. setStatusBar(0); - KToolBar *mainBar = toolBar("mainToolBar"); - - QToolButton *bookmarksButton = qobject_cast<QToolButton*>(mainBar->widgetForAction(actionByName( QL1S("bookmarksActionMenu") ))); - if(bookmarksButton) - { - connect(actionByName(QL1S("bookmarksActionMenu")), SIGNAL(triggered()), bookmarksButton, SLOT(showMenu())); - } - - QToolButton *toolsButton = qobject_cast<QToolButton*>(mainBar->widgetForAction(actionByName( QL1S("rekonq_tools") ))); - if(toolsButton) - { - connect(actionByName(QL1S("rekonq_tools")), SIGNAL(triggered()), toolsButton, SLOT(showMenu())); - } - - // setting popup notification - m_popup->setAutoDelete(false); - connect(Application::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), m_popup, SLOT(hide())); - m_popup->setFrameShape(QFrame::NoFrame); - m_popup->setLineWidth(0); - connect(m_hidePopup, SIGNAL(timeout()), m_popup, SLOT(hide())); - QTimer::singleShot(0, this, SLOT(postLaunch())); kDebug() << "MainWindow ctor...DONE"; @@ -179,8 +157,7 @@ MainWindow::MainWindow() MainWindow::~MainWindow() { - KToolBar *bookBar = toolBar("bookmarksToolBar"); - Application::bookmarkProvider()->removeToolBar(bookBar); + Application::bookmarkProvider()->removeToolBar(m_bookmarksBar); Application::bookmarkProvider()->removeBookmarkPanel(m_bookmarksPanel); Application::instance()->removeMainWindow(this); @@ -195,6 +172,8 @@ MainWindow::~MainWindow() delete m_historyBackMenu; delete m_encodingMenu; + delete m_bookmarksBar; + delete m_zoomSlider; delete m_popup; @@ -210,27 +189,46 @@ void MainWindow::setupToolbars() // location bar a = new KAction(i18n("Location Bar"), this); - a->setShortcut(KShortcut(Qt::Key_F6)); a->setDefaultWidget(m_view->widgetBar()); actionCollection()->addAction( QL1S("url_bar"), a); KToolBar *mainBar = toolBar("mainToolBar"); - KToolBar *bookBar = toolBar("bookmarksToolBar"); - + // bookmarks bar - KAction *bookmarkBarAction = Application::bookmarkProvider()->bookmarkToolBarAction(bookBar); + KAction *bookmarkBarAction = Application::bookmarkProvider()->bookmarkToolBarAction(m_bookmarksBar); a = actionCollection()->addAction( QL1S("bookmarks_bar"), bookmarkBarAction); mainBar->show(); // this just to fix reopening rekonq after fullscreen close // =========== Bookmarks ToolBar ================================ - bookBar->setAcceptDrops(true); - Application::bookmarkProvider()->setupBookmarkBar(bookBar); + m_bookmarksBar->setAcceptDrops(true); + Application::bookmarkProvider()->setupBookmarkBar(m_bookmarksBar); } void MainWindow::postLaunch() { + KToolBar *mainBar = toolBar("mainToolBar"); + + QToolButton *bookmarksButton = qobject_cast<QToolButton*>(mainBar->widgetForAction(actionByName( QL1S("bookmarksActionMenu") ))); + if(bookmarksButton) + { + connect(actionByName(QL1S("bookmarksActionMenu")), SIGNAL(triggered()), bookmarksButton, SLOT(showMenu())); + } + + QToolButton *toolsButton = qobject_cast<QToolButton*>(mainBar->widgetForAction(actionByName( QL1S("rekonq_tools") ))); + if(toolsButton) + { + connect(actionByName(QL1S("rekonq_tools")), SIGNAL(triggered()), toolsButton, SLOT(showMenu())); + } + + // setting popup notification + m_popup->setAutoDelete(false); + connect(Application::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), m_popup, SLOT(hide())); + m_popup->setFrameShape(QFrame::NoFrame); + m_popup->setLineWidth(0); + connect(m_hidePopup, SIGNAL(timeout()), m_popup, SLOT(hide())); + // notification system connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), this, SLOT(notifyMessage(const QString&, Rekonq::Notify))); connect(m_view, SIGNAL(linkHovered(const QString&)), this, SLOT(notifyMessage(const QString&))); diff --git a/src/mainwindow.h b/src/mainwindow.h index 1ec79a4b..96fe0f2d 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -34,6 +34,9 @@ // Rekonq Includes #include "rekonq_defines.h" +// Local Includes +#include "bookmarksmanager.h" + // KDE Includes #include <KXmlGuiWindow> #include <KActionCollection> @@ -172,11 +175,13 @@ private: BookmarksPanel *m_bookmarksPanel; WebInspectorPanel *m_webInspectorPanel; NetworkAnalyzerPanel *m_analyzerPanel; - + KAction *m_stopReloadAction; KMenu *m_historyBackMenu; KMenu *m_encodingMenu; + BookmarkToolBar *m_bookmarksBar; + QSlider *m_zoomSlider; QString m_lastSearch; diff --git a/src/rekonqui.rc b/src/rekonqui.rc index d4d5d289..e89e3b15 100644 --- a/src/rekonqui.rc +++ b/src/rekonqui.rc @@ -91,8 +91,8 @@ <Action name="rekonq_tools" /> </ToolBar> -<!-- ============ Bookmarks ToolBar =========== --> -<ToolBar name="bookmarksToolBar" fullWidth="true" iconText="icontextright" iconSize="16" newline="true" noEdit="true"> +<!-- ============ Bookmarks ToolBar =========== --> +<ToolBar name="bookmarksToolBar" fullWidth="true" iconText="icontextright" iconSize="16" newline="true" hidden="true" noEdit="true"> <text>Bookmark Toolbar</text> <Action noEdit="true" name="bookmarks_bar" /> </ToolBar> diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp index 8832878b..fbab2d82 100644 --- a/src/sessionmanager.cpp +++ b/src/sessionmanager.cpp @@ -64,6 +64,10 @@ void SessionManager::saveSession() if (!m_safe) return; m_safe = false; + + if( QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled) ) + return; + QFile sessionFile(m_sessionFilePath); if (!sessionFile.open(QFile::WriteOnly | QFile::Truncate)) { diff --git a/src/webpage.cpp b/src/webpage.cpp index a63940b0..ea2add6d 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -577,8 +577,8 @@ QString WebPage::errorPage(QNetworkReply *reply) return QString("Couldn't open the rekonqinfo.html file"); } - QString title = i18n("Error loading: %1", reply->url().toString()); - QString urlString = reply->url().toString(QUrl::RemoveUserInfo | QUrl::RemoveQuery); + QString title = i18n("There was a problem while loading the page"); + QString urlString = reply->url().toString(QUrl::RemoveUserInfo | QUrl::RemoveQuery | QUrl::RemovePath); QString iconPath = QString("file://") + KIconLoader::global()->iconPath("dialog-warning" , KIconLoader::Small); iconPath.replace(QL1S("16"), QL1S("128")); |