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);
bookmarksMenuCurrentActionList = QList<QAction*>();
bookmarksToolBarCurrentActionList = QList<QAction*>();
+ // 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();
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.
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()));
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.