From 2e3b899634155bbbedf6cce0e3156fa00d4a16e8 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Fri, 29 Dec 2023 16:30:25 -0700 Subject: [PATCH] Focus the bookmark name when adding or editing bookmarks. https://redmine.stoutner.com/issues/1096 --- src/dialogs/AddBookmarkDialog.cpp | 6 ++++-- src/dialogs/EditBookmarkDialog.cpp | 6 ++++-- src/dialogs/EditFolderDialog.cpp | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/dialogs/AddBookmarkDialog.cpp b/src/dialogs/AddBookmarkDialog.cpp index 9f977af..4c91c2c 100644 --- a/src/dialogs/AddBookmarkDialog.cpp +++ b/src/dialogs/AddBookmarkDialog.cpp @@ -94,10 +94,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); diff --git a/src/dialogs/EditBookmarkDialog.cpp b/src/dialogs/EditBookmarkDialog.cpp index 3a4d770..a0c0c77 100644 --- a/src/dialogs/EditBookmarkDialog.cpp +++ b/src/dialogs/EditBookmarkDialog.cpp @@ -96,10 +96,12 @@ EditBookmarkDialog::EditBookmarkDialog(const int databaseId, QIcon ¤tWebsi bookmarkNameLineEditPointer->setText(bookmarkStructPointer->name); bookmarkUrlLineEditPointer->setText(bookmarkStructPointer->url); - // 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(); + // Connect the buttons. connect(browseButtonPointer, SIGNAL(clicked()), this, SLOT(browse())); connect(dialogButtonBoxPointer, SIGNAL(accepted()), this, SLOT(save())); diff --git a/src/dialogs/EditFolderDialog.cpp b/src/dialogs/EditFolderDialog.cpp index eb2bdcf..4285444 100644 --- a/src/dialogs/EditFolderDialog.cpp +++ b/src/dialogs/EditFolderDialog.cpp @@ -93,8 +93,8 @@ EditFolderDialog::EditFolderDialog(const int databaseId, QIcon ¤tWebsiteFa // Populate the line edits. folderNameLineEditPointer->setText(bookmarkStructPointer->name); - // Scroll to the beginning of the line edits. - folderNameLineEditPointer->setCursorPosition(0); + // Focus the folder name line edit. + folderNameLineEditPointer->setFocus(); // Connect the buttons. connect(browseButtonPointer, SIGNAL(clicked()), this, SLOT(browse())); -- 2.45.2