From f3aadfead49f9ec17f04e0051d6d58f619c5092b Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Mon, 25 Dec 2017 14:04:20 -0500 Subject: [PATCH setup libsolv] Implement user option to report added dependencies Add a checkbox IDC_CHOOSE_REPORT to IDD_CHOOSE_DIALOG that determines the value of PrereqChecker::report_added_deps. Save the user's choice in a new user setting "report_user_deps". --- choose.cc | 14 ++++++++++++++ prereq.cc | 2 +- prereq.h | 2 ++ res.rc | 4 ++++ resource.h | 2 ++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/choose.cc b/choose.cc index ff57d85..d5e55b8 100644 --- a/choose.cc +++ b/choose.cc @@ -83,6 +83,7 @@ static ControlAdjuster::ControlInfo ChooserControlsInfo[] = { {IDC_CHOOSE_VIEWCAPTION, CP_LEFT, CP_TOP}, {IDC_CHOOSE_LIST, CP_STRETCH, CP_STRETCH}, {IDC_CHOOSE_HIDE, CP_LEFT, CP_BOTTOM}, + {IDC_CHOOSE_REPORT, CP_LEFT, CP_BOTTOM}, {0, CP_LEFT, CP_TOP} }; @@ -128,6 +129,8 @@ ChooserPage::~ChooserPage () } UserSettings::instance().set ("chooser_window_settings", toset); } + UserSettings::instance().set ("report_added_deps", + PrereqChecker::reportAddedDeps () ? "yes" : "no"); } void @@ -255,6 +258,13 @@ ChooserPage::OnInit () { CheckDlgButton (GetHWND (), IDC_CHOOSE_HIDE, BST_CHECKED); + const char *fg_ret = + UserSettings::instance().get ("report_added_deps"); + bool report_added_deps = !fg_ret || strcmp (fg_ret, "no" ) != 0; + PrereqChecker::setAddedDeps (report_added_deps); + CheckDlgButton (GetHWND (), IDC_CHOOSE_REPORT, + report_added_deps ? BST_CHECKED : BST_UNCHECKED); + /* Populate view dropdown list with choices */ HWND viewlist = GetDlgItem (IDC_CHOOSE_VIEW); SendMessage (viewlist, CB_RESETCONTENT, 0, 0); @@ -279,6 +289,7 @@ ChooserPage::OnInit () AddTooltip (IDC_CHOOSE_VIEW, IDS_VIEWBUTTON_TOOLTIP); AddTooltip (IDC_CHOOSE_HIDE, IDS_HIDEOBS_TOOLTIP); AddTooltip (IDC_CHOOSE_SEARCH_EDIT, IDS_SEARCH_TOOLTIP); + AddTooltip (IDC_CHOOSE_REPORT, IDS_REPORTDEPS_TOOLTIP); /* Set focus to search edittext control. */ PostMessage (GetHWND (), WM_NEXTDLGCTL, @@ -536,6 +547,9 @@ ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code) case IDC_CHOOSE_HIDE: chooser->setObsolete (!IsButtonChecked (id)); break; + case IDC_CHOOSE_REPORT: + PrereqChecker::setAddedDeps (IsButtonChecked (id)); + break; default: // Wasn't recognized or handled. return false; diff --git a/prereq.cc b/prereq.cc index 0c06a32..231e6dc 100644 --- a/prereq.cc +++ b/prereq.cc @@ -159,7 +159,7 @@ PrereqPage::OnUnattended () // instantiate the static members bool PrereqChecker::use_test_packages; -bool PrereqChecker::report_added_deps = true; +bool PrereqChecker::report_added_deps; static bool added_deps () diff --git a/prereq.h b/prereq.h index a14789a..c79d306 100644 --- a/prereq.h +++ b/prereq.h @@ -41,6 +41,8 @@ public: void getUnmetString (std::string &s); static void setTestPackages (bool t) { use_test_packages = t; }; + static void setAddedDeps (bool t) { report_added_deps = t; }; + static bool reportAddedDeps () { return report_added_deps; }; private: static bool use_test_packages; diff --git a/res.rc b/res.rc index ee4270a..7d0de79 100644 --- a/res.rc +++ b/res.rc @@ -363,6 +363,8 @@ BEGIN WS_VISIBLE, 7, 45, SETUP_STANDARD_DIALOG_W - 14, 122 CONTROL "&Hide obsolete packages", IDC_CHOOSE_HIDE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 167, 160, 14 + CONTROL "&Report added dependencies", IDC_CHOOSE_REPORT, + "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 167, 167, 160, 14 ICON IDI_CYGWIN, IDC_HEADICON, SETUP_HEADICON_X, 0, 21, 20 LTEXT "Select the packages you want setup to install.", IDC_CHOOSE_INST_TEXT, 21, 9, 239, 16, NOT WS_GROUP @@ -588,6 +590,8 @@ BEGIN "with names that begin with '_'. Such packages are usually empty " "placeholders for packages that have been removed or renamed, or are " "infrastructure packages that are handled automatically." + IDS_REPORTDEPS_TOOLTIP "If packages are added to satisfy dependencies, " + "pause to allow review of them." IDS_SIG_INVALID "Mirror Error: Setup.ini signature %s from %s failed to verify.\nPossible corrupt mirror? Setup.ini rejected." IDS_CRYPTO_ERROR "Internal Error: gcrypt library error %d %s" IDS_SEARCH_TOOLTIP "Search for this string in package names." diff --git a/resource.h b/resource.h index e385c9e..73cf06c 100644 --- a/resource.h +++ b/resource.h @@ -40,6 +40,7 @@ #define IDS_INSTALLEDB_VERSION 140 #define IDS_DOWNLOAD_INCOMPLETE_EXIT 141 #define IDS_TRUSTSYNC_TOOLTIP 142 +#define IDS_REPORTDEPS_TOOLTIP 143 // Dialogs @@ -180,3 +181,4 @@ #define IDC_DOWNLOAD_EDIT 594 #define IDC_CHOOSE_DO_SEARCH 595 #define IDC_CHOOSE_SYNC 596 +#define IDC_CHOOSE_REPORT 597 -- 2.15.1