]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/dialogs/AddBookmarkDialog.cpp
Focus the bookmark name when adding or editing bookmarks. https://redmine.stoutner...
[PrivacyBrowserPC.git] / src / dialogs / AddBookmarkDialog.cpp
index e69543e7ab51cb1e28a0e79b33df964af1d04d95..4c91c2c2138f7a84b9f445341bde5ad616f5be46 100644 (file)
@@ -45,7 +45,7 @@ AddBookmarkDialog::AddBookmarkDialog(const QString &bookmarkName, const QString
     addBookmarkDialogUi.setupUi(this);
 
     // Get handles for the widgets.
-    defaultFavoriteIconRadioButtonPointer = addBookmarkDialogUi.defaultFavoriteIconRadioButton;
+    websiteFavoriteIconRadioButtonPointer = addBookmarkDialogUi.websiteFavoriteIconRadioButton;
     customFavoriteIconRadioButtonPointer = addBookmarkDialogUi.customFavoriteIconRadioButton;
     parentFolderTreeWidgetPointer = addBookmarkDialogUi.parentFolderTreeWidget;
     bookmarkNameLineEditPointer = addBookmarkDialogUi.bookmarkNameLineEdit;
@@ -53,8 +53,9 @@ AddBookmarkDialog::AddBookmarkDialog(const QString &bookmarkName, const QString
     QPushButton *browseButtonPointer = addBookmarkDialogUi.browseButton;
     QDialogButtonBox *dialogButtonBoxPointer = addBookmarkDialogUi.dialogButtonBox;
 
-    // Set the default favorite icon.
-    defaultFavoriteIconRadioButtonPointer->setIcon(favoriteIcon);
+    // Set the icons.
+    websiteFavoriteIconRadioButtonPointer->setIcon(favoriteIcon);
+    customFavoriteIconRadioButtonPointer->setIcon(QIcon::fromTheme(QLatin1String("globe"), QIcon::fromTheme(QLatin1String("applications-internet"))));
 
     // Instantiate a folder helper.
     folderHelperPointer = new FolderHelper();
@@ -73,7 +74,7 @@ AddBookmarkDialog::AddBookmarkDialog(const QString &bookmarkName, const QString
 
     // Populate the bookmarks tree widget item.
     bookmarksTreeWidgetItemPointer->setText(folderHelperPointer->FOLDER_NAME_COLUMN, i18nc("The bookmarks root tree widget name", "Bookmarks"));
-    bookmarksTreeWidgetItemPointer->setIcon(folderHelperPointer->FOLDER_NAME_COLUMN, QIcon::fromTheme("bookmarks"));
+    bookmarksTreeWidgetItemPointer->setIcon(folderHelperPointer->FOLDER_NAME_COLUMN, QIcon::fromTheme(QLatin1String("bookmarks"), QIcon::fromTheme(QLatin1String("bookmark-new"))));
     bookmarksTreeWidgetItemPointer->setText(folderHelperPointer->FOLDER_ID_COLUMN, QLatin1String("0"));
 
     // Add the bookmarks tree widget item to the root of the tree.
@@ -93,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);
 
@@ -125,7 +128,7 @@ void AddBookmarkDialog::addBookmark()
     QTreeWidgetItem *selectedFolderPointer = selectedFoldersList.first();
 
     // Get the favorite icon.
-    QIcon favoriteIcon = defaultFavoriteIconRadioButtonPointer->isChecked() ? defaultFavoriteIconRadioButtonPointer->icon() : customFavoriteIconRadioButtonPointer->icon();
+    QIcon favoriteIcon = websiteFavoriteIconRadioButtonPointer->isChecked() ? websiteFavoriteIconRadioButtonPointer->icon() : customFavoriteIconRadioButtonPointer->icon();
 
     // Create a bookmark struct.
     BookmarkStruct *bookmarkStructPointer = new BookmarkStruct;