]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/windows/BrowserWindow.cpp
Add dragging and dropping of bookmarks.
[PrivacyBrowserPC.git] / src / windows / BrowserWindow.cpp
index c8c766da4e2586ead8fbfa4bf23f620cf0339f9e..dda65d9c466a4cb97a382481cc62188d9904e51a 100644 (file)
@@ -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<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();
 
@@ -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.