]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/dialogs/AddBookmarkDialog.cpp
Partial filter list implementation.
[PrivacyBrowserPC.git] / src / dialogs / AddBookmarkDialog.cpp
index 9f977afabdcfed2f8ece0e02b89499d5e4b01b40..041ca3d33df3db53b761d1ab9717c18936783b06 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>.
  *
@@ -30,7 +30,8 @@
 #include <QPushButton>
 
 // Construct the class.
-AddBookmarkDialog::AddBookmarkDialog(const QString &bookmarkName, const QString &bookmarkUrl, const QIcon &favoriteIcon, const double parentFolderId) : QDialog(nullptr)
+AddBookmarkDialog::AddBookmarkDialog(QWidget *parentWidgetPointer, const QString &bookmarkName, const QString &bookmarkUrl, const QIcon &favoriteIcon, const double parentFolderId) :
+                                     QDialog(parentWidgetPointer)
 {
     // Set the window title.
     setWindowTitle(i18nc("The add bookmark dialog window title.", "Add Bookmark"));
@@ -94,10 +95,12 @@ AddBookmarkDialog::AddBookmarkDialog(const QString &bookmarkName, const QString
     bookmarkNameLineEditPointer->setText(bookmarkName);
     bookmarkUrlLineEditPointer->setText(bookmarkUrl);
 
-    // Scroll to the beginning of the line edits.
-    bookmarkNameLineEditPointer->setCursorPosition(0);
+    // Scroll to the beginning of the bookmark URL line edit.
     bookmarkUrlLineEditPointer->setCursorPosition(0);
 
+    // Focus the bookmark name line edit.
+    bookmarkNameLineEditPointer->setFocus();
+
     // Add buttons to the dialog button box.
     addButtonPointer = dialogButtonBoxPointer->addButton(i18nc("The add bookmark button", "Add"), QDialogButtonBox::AcceptRole);
 
@@ -166,7 +169,7 @@ void AddBookmarkDialog::browse()
 
 void AddBookmarkDialog::updateUi()
 {
-    // Determine if both line edits are populated.
+    // Update the add button status
     if (bookmarkNameLineEditPointer->text().isEmpty() || bookmarkUrlLineEditPointer->text().isEmpty())  // At least one of the line edits is empty.
     {
         // Disable the add button.