X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=blobdiff_plain;f=src%2Fwindows%2FBrowserWindow.cpp;fp=src%2Fwindows%2FBrowserWindow.cpp;h=dda65d9c466a4cb97a382481cc62188d9904e51a;hp=c8c766da4e2586ead8fbfa4bf23f620cf0339f9e;hb=f18185adbdce9891be0cbd2197838441aaa5ed3e;hpb=7c6edb3608791950c6146ac242e2b6f493ca8e8c diff --git a/src/windows/BrowserWindow.cpp b/src/windows/BrowserWindow.cpp index c8c766d..dda65d9 100644 --- a/src/windows/BrowserWindow.cpp +++ b/src/windows/BrowserWindow.cpp @@ -73,7 +73,7 @@ BrowserWindow::BrowserWindow(bool firstWindow) : KXmlGuiWindow() QAction *backActionPointer = KStandardAction::back(this, SLOT(back()), actionCollectionPointer); QAction *forwardActionPointer = KStandardAction::forward(this, SLOT(forward()), actionCollectionPointer); KStandardAction::home(this, SLOT(home()), actionCollectionPointer); - KStandardAction::addBookmark(this, SLOT(addBookmark()), actionCollectionPointer); + KStandardAction::addBookmark(this, SLOT(showAddBookmarkDialog()), actionCollectionPointer); QAction *editBookmarksActionPointer = KStandardAction::editBookmarks(this, SLOT(editBookmarks()), actionCollectionPointer); KStandardAction::preferences(this, SLOT(showSettingsDialog()), actionCollectionPointer); KStandardAction::find(this, SLOT(showFindTextActions()), actionCollectionPointer); @@ -509,6 +509,12 @@ BrowserWindow::BrowserWindow(bool firstWindow) : KXmlGuiWindow() bookmarksMenuCurrentActionList = QList(); bookmarksToolBarCurrentActionList = QList(); + // Set the bookmarks toolbar context menu policy. + bookmarksToolBarPointer->setContextMenuPolicy(Qt::CustomContextMenu); + + // Show the custom bookmark context menu when requested. + connect(bookmarksToolBarPointer, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showBookmarkContextMenu(const QPoint&))); + // Populate the bookmarks. populateBookmarks(); @@ -525,15 +531,6 @@ BrowserWindow::BrowserWindow(bool firstWindow) : KXmlGuiWindow() tabWidgetPointer->loadInitialWebsite(); } -void BrowserWindow::addBookmark() const -{ - // Instantiate an add bookmark dialog. - AddBookmarkDialog *addBookmarkDialogPointer = new AddBookmarkDialog(tabWidgetPointer->getCurrentTabTitle(), tabWidgetPointer->getCurrentTabUrl(), tabWidgetPointer->getCurrentTabFavoritIcon()); - - // Show the dialog. - addBookmarkDialogPointer->show(); -} - void BrowserWindow::addOrEditDomainSettings() const { // Remove the focus from the URL line edit. @@ -598,7 +595,7 @@ void BrowserWindow::decrementZoom() void BrowserWindow::editBookmarks() const { // Instantiate an edit bookmarks dialog. - BookmarksDialog *bookmarksDialogPointer = new BookmarksDialog(); + BookmarksDialog *bookmarksDialogPointer = new BookmarksDialog(tabWidgetPointer->getCurrentTabFavoritIcon()); // Update the displayed bookmarks when edited. connect(bookmarksDialogPointer, SIGNAL(bookmarkUpdated()), this, SLOT(populateBookmarks())); @@ -868,6 +865,23 @@ void BrowserWindow::reloadAndBypassCache() const tabWidgetPointer->refresh(); } +void BrowserWindow::showAddBookmarkDialog() const +{ + // Instantiate an add bookmark dialog. + AddBookmarkDialog *addBookmarkDialogPointer = new AddBookmarkDialog(tabWidgetPointer->getCurrentTabTitle(), tabWidgetPointer->getCurrentTabUrl(), tabWidgetPointer->getCurrentTabFavoritIcon()); + + // Update the displayed bookmarks when a new one is added. + connect(addBookmarkDialogPointer, SIGNAL(bookmarkAdded()), this, SLOT(populateBookmarks())); + + // Show the dialog. + addBookmarkDialogPointer->show(); +} + +void BrowserWindow::showBookmarkContextMenu(const QPoint&) const +{ + qDebug() << "Show the bookmark context menu."; +} + void BrowserWindow::showCookiesDialog() { // Remove the focus from the URL line edit.