]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/dialogs/BookmarksDialog.cpp
Move the Settings Dialog to its own class. https://redmine.stoutner.com/issues/1151
[PrivacyBrowserPC.git] / src / dialogs / BookmarksDialog.cpp
index 0fa2b4f983f63721973139ad0b3f363d8265c789..683d24059e69be00037ca100c7c032036dfd2ece 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2023-2024 Soren Stoutner <soren@stoutner.com>.
  *
  * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
  *
@@ -34,8 +34,8 @@
 #include <QStandardItemModel>
 
 // Construct the class.
-BookmarksDialog::BookmarksDialog(QString currentWebsiteTitle, QString currentWebsiteUrl, QIcon currentWebsiteFavorieIcon) :
-                                 QDialog(nullptr), websiteFavoriteIcon(currentWebsiteFavorieIcon), websiteTitle(currentWebsiteTitle), websiteUrl(currentWebsiteUrl)
+BookmarksDialog::BookmarksDialog(QWidget *parentWidgetPointer, QIcon currentWebsiteFavorieIcon, QString currentWebsiteTitle, QString currentWebsiteUrl) :
+                                 QDialog(parentWidgetPointer), websiteFavoriteIcon(currentWebsiteFavorieIcon), websiteTitle(currentWebsiteTitle), websiteUrl(currentWebsiteUrl)
 {
     // Set the dialog window title.
     setWindowTitle(i18nc("The bookmarks dialog window title", "Bookmarks"));
@@ -301,7 +301,7 @@ void BookmarksDialog::selectSubfolderContents(const QModelIndex &parentModelInde
     }
 }
 
-void BookmarksDialog::showAddBookmarkDialog() const
+void BookmarksDialog::showAddBookmarkDialog()
 {
     // Return the most recently selected index.
     QModelIndex currentIndex = treeSelectionModelPointer->currentIndex();
@@ -322,7 +322,7 @@ void BookmarksDialog::showAddBookmarkDialog() const
     }
 
     // Instantiate an add bookmark dialog.
-    AddBookmarkDialog *addBookmarkDialogPointer = new AddBookmarkDialog(websiteTitle, websiteUrl, websiteFavoriteIcon, parentFolderId);
+    AddBookmarkDialog *addBookmarkDialogPointer = new AddBookmarkDialog(this, websiteTitle, websiteUrl, websiteFavoriteIcon, parentFolderId);
 
     // Update the displayed bookmarks when a new one is added.
     connect(addBookmarkDialogPointer, SIGNAL(bookmarkAdded()), this, SLOT(refreshBookmarks()));
@@ -331,7 +331,7 @@ void BookmarksDialog::showAddBookmarkDialog() const
     addBookmarkDialogPointer->show();
 }
 
-void BookmarksDialog::showAddFolderDialog() const
+void BookmarksDialog::showAddFolderDialog()
 {
     // Get the most recently selected index.
     QModelIndex currentIndex = treeSelectionModelPointer->currentIndex();
@@ -352,7 +352,7 @@ void BookmarksDialog::showAddFolderDialog() const
     }
 
     // Instantiate an add folder dialog.
-    AddFolderDialog *addFolderDialogPointer = new AddFolderDialog(websiteFavoriteIcon, parentFolderId);
+    AddFolderDialog *addFolderDialogPointer = new AddFolderDialog(this, websiteFavoriteIcon, parentFolderId);
 
     // Update the displayed bookmarks when a folder is added.
     connect(addFolderDialogPointer, SIGNAL(folderAdded()), this, SLOT(refreshBookmarks()));
@@ -370,7 +370,7 @@ void BookmarksDialog::showEditDialog()
     if (currentIndex.siblingAtColumn(IS_FOLDER_COLUMN).data().toInt() == 1)  // The selected item is a folder.
     {
         // Instantiate an edit folder dialog.
-        QDialog *editFolderDialogPointer = new EditFolderDialog(currentIndex.siblingAtColumn(DATABASE_ID_COLUMN).data().toInt(), websiteFavoriteIcon);
+        QDialog *editFolderDialogPointer = new EditFolderDialog(this, currentIndex.siblingAtColumn(DATABASE_ID_COLUMN).data().toInt(), websiteFavoriteIcon);
 
         // Show the dialog.
         editFolderDialogPointer->show();
@@ -381,7 +381,7 @@ void BookmarksDialog::showEditDialog()
     else  // The selected item is a bookmark.
     {
         // Instantiate an edit bookmark dialog.
-        QDialog *editBookmarkDialogPointer = new EditBookmarkDialog(currentIndex.siblingAtColumn(DATABASE_ID_COLUMN).data().toInt(), websiteFavoriteIcon);
+        QDialog *editBookmarkDialogPointer = new EditBookmarkDialog(this, currentIndex.siblingAtColumn(DATABASE_ID_COLUMN).data().toInt(), websiteFavoriteIcon);
 
         // Show the dialog.
         editBookmarkDialogPointer->show();