From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23227 invoked by alias); 22 Jan 2018 17:37:40 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 23214 invoked by uid 89); 22 Jan 2018 17:37:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*m:edu, views, tasks, exceptionh X-HELO: limerock01.mail.cornell.edu Received: from limerock01.mail.cornell.edu (HELO limerock01.mail.cornell.edu) (128.84.13.241) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 Jan 2018 17:37:38 +0000 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite3.serverfarm.cornell.edu [10.16.197.8]) by limerock01.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id w0MHbZqb006127; Mon, 22 Jan 2018 12:37:35 -0500 Received: from localhost.localdomain (50-192-26-108-static.hfc.comcastbusiness.net [50.192.26.108]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id w0MHbSjI002475 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 22 Jan 2018 12:37:34 -0500 From: Ken Brown To: cygwin-apps@cygwin.com Subject: [PATCH setup libsolv, v2] Let the user review added dependencies Date: Mon, 22 Jan 2018 17:37:00 -0000 Message-Id: <20180122173720.10584-1-kbrown@cornell.edu> X-PMX-Cornell-Gauge: Gauge=X X-PMX-CORNELL-AUTH-RESULTS: dkim-out=none; X-IsSubscribed: yes X-SW-Source: 2018-01/txt/msg00068.txt.bz2 If the solver found no problems but added packages to resolve dependencies, ask the user whether they want to review the added packages before proceeding. If they answer Yes, go back to the chooser with the 'Pending' view selected. The implementation adds several new members to the PrereqChecker class so that the latter can communicate with the chooser page. --- choose.cc | 3 +++ prereq.cc | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- prereq.h | 8 ++++++++ 3 files changed, 70 insertions(+), 9 deletions(-) diff --git a/choose.cc b/choose.cc index 1c79cca..846b169 100644 --- a/choose.cc +++ b/choose.cc @@ -286,6 +286,9 @@ ChooserPage::OnInit () /* Set focus to search edittext control. */ PostMessage (GetHWND (), WM_NEXTDLGCTL, (WPARAM) GetDlgItem (IDC_CHOOSE_SEARCH_EDIT), TRUE); + + /* Store the HWNDs that the PrereqChecker will need. */ + PrereqChecker::setChooserHWNDs (GetHWND (), viewlist); } void diff --git a/prereq.cc b/prereq.cc index effa7cc..7821d63 100644 --- a/prereq.cc +++ b/prereq.cc @@ -35,6 +35,7 @@ #include "msg.h" #include "Exception.h" #include "getopt++/BoolOption.h" +#include "PickView.h" // Sizing information. static ControlAdjuster::ControlInfo PrereqControlsInfo[] = { @@ -139,8 +140,8 @@ PrereqPage::whatNext () return IDD_INSTATUS; } -long -PrereqPage::OnBack () +static void +prepBack () { // Add reinstall tasks PrereqChecker p; @@ -149,7 +150,12 @@ PrereqPage::OnBack () // Reset the package database to correspond to the solver's solution packagedb db; db.solution.trans2db(); +} +long +PrereqPage::OnBack () +{ + prepBack (); return IDD_CHOOSE; } @@ -170,6 +176,7 @@ PrereqPage::OnUnattended () // instantiate the static members bool PrereqChecker::use_test_packages; SolverTasks PrereqChecker::q; +HWND PrereqChecker::hChooser, PrereqChecker::hChooseView; bool PrereqChecker::isMet () @@ -204,6 +211,15 @@ PrereqChecker::augment () db.solution.augmentTasks(q); } +void +PrereqChecker::setChooserView (PickView::views view) +{ + PostMessage (hChooseView, CB_SETCURSEL, (WPARAM)view, 0); + PostMessage (hChooser, WM_COMMAND, + MAKEWPARAM (IDC_CHOOSE_VIEW, CBN_SELCHANGE), + (LPARAM)hChooseView); +} + /* Formats problems and solutions as a string for display to the user. */ void PrereqChecker::getUnmetString (std::string &s) @@ -224,6 +240,23 @@ PrereqChecker::getUnmetString (std::string &s) // progress page glue // --------------------------------------------------------------------------- +static bool +added_deps () +{ + packagedb db; + const SolverTransactionList & trans = db.solution.transactions (); + for (SolverTransactionList::const_iterator i = trans.begin (); + i != trans.end (); i++) + if (i->type == SolverTransaction::transInstall) + { + packageversion pv = i->version; + packagemeta *pkg = db.findBinary (PackageSpecification (pv.Name ())); + if (!pkg->desired) + return true; + } + return false; +} + static int do_prereq_check_thread(HINSTANCE h, HWND owner) { @@ -232,17 +265,34 @@ do_prereq_check_thread(HINSTANCE h, HWND owner) if (p.isMet ()) { - p.finalize(); - - if (source == IDC_SOURCE_LOCALDIR) - Progress.SetActivateTask (WM_APP_START_INSTALL); // install + if (added_deps () && !unattended_mode + && MessageBox (owner, "Packages were added to resolve dependencies. " + "Do you want to review them before proceeding?" + "\r\n\r\n" + "Answering 'Yes' will take you back to the Package " + "Selection page, with the 'Pending' view selected.", + "Added Dependencies", + MB_YESNO | MB_DEFBUTTON2) == IDYES) + { + Progress.SetText1 ("Preparing package review..."); + prepBack (); + p.setChooserView (); + retval = IDD_CHOOSE; + } else - Progress.SetActivateTask (WM_APP_START_DOWNLOAD); // start download - retval = IDD_INSTATUS; + { + p.finalize(); + + if (source == IDC_SOURCE_LOCALDIR) + Progress.SetActivateTask (WM_APP_START_INSTALL); // install + else + Progress.SetActivateTask (WM_APP_START_DOWNLOAD); // start download + retval = IDD_INSTATUS; + } } else { - // rut-roh, some required things are not selected + // The solver reported problems. retval = IDD_PREREQ; } diff --git a/prereq.h b/prereq.h index 24e6de5..d60ef59 100644 --- a/prereq.h +++ b/prereq.h @@ -5,6 +5,8 @@ #include "proppage.h" #include "PackageTrust.h" #include "package_meta.h" +#include "win32.h" +#include "PickView.h" using namespace std; @@ -45,11 +47,17 @@ public: void augment (); + void setChooserView (PickView::views = PickView::views::PackagePending); + static void setTestPackages (bool t) { use_test_packages = t; }; + static void setChooserHWNDs (HWND hc, HWND hv) + { hChooser = hc; hChooseView = hv; }; + private: static bool use_test_packages; static SolverTasks q; + static HWND hChooser, hChooseView; }; #endif /* SETUP_PREREQ_H */ -- 2.15.1