}
}
+void
+SolverSolution::db2trans()
+{
+ trans.clear();
+ packagedb db;
+
+ for (packagedb::packagecollection::iterator p = db.packages.begin ();
+ p != db.packages.end (); ++p)
+ {
+ packagemeta *pkg = p->second;
+ if (pkg->desired && pkg->picked()) // install/upgrade/reinstall
+ {
+ trans.push_back(SolverTransaction(pkg->desired, SolverTransaction::transInstall));
+ if (pkg->installed)
+ trans.push_back(SolverTransaction(pkg->installed, SolverTransaction::transErase));
+ }
+ else if (!pkg->desired && pkg->installed) // uninstall
+ trans.push_back(SolverTransaction(pkg->installed, SolverTransaction::transErase));
+
+ if (pkg->srcpicked())
+ {
+ if (pkg->desired)
+ trans.push_back(SolverTransaction(pkg->desired.sourcePackage(), SolverTransaction::transInstall));
+ else
+ trans.push_back(SolverTransaction(pkg->installed.sourcePackage(), SolverTransaction::transInstall));
+ }
+ }
+}
+
static
std::ostream &operator<<(std::ostream &stream,
SolverTransaction::transType type)
/* Reset package database to correspond to trans */
void trans2db() const;
+ /* Reset transaction list to correspond to package database */
+ void db2trans();
+
bool update(SolverTasks &tasks, bool update, bool use_test_packages, bool include_source);
std::string report() const;
if (!IsDlgButtonChecked (h, IDC_PREREQ_CHECK))
{
- return -1;
+ // breakage imminent! danger, danger
+ int res = MessageBox (h,
+ "We strongly recommend that you accept the default solutions. "
+ "Some packages may not work properly if you don't."
+ "\r\n\r\n"
+ "Are you sure you want to proceed?",
+ "WARNING - Unsolved Problems",
+ MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2);
+ if (res == IDNO)
+ return -1;
+ else
+ {
+ Log (LOG_PLAIN) <<
+ "NOTE! User refused the default solutions! "
+ "Expect some packages to give errors or not function at all." << endLog;
+ // Change the solver's transaction list to reflect the user's choices.
+ packagedb db;
+ db.solution.db2trans();
+ }
}
return whatNext();
return whatNext();
}
-bool
-PrereqPage::OnMessageCmd (int id, HWND hwndctl, UINT code)
-{
- if ((code == BN_CLICKED) && (id == IDC_PREREQ_CHECK))
- {
- GetOwner ()->SetButtons (PSWIZB_BACK | (IsButtonChecked (id) ? PSWIZB_NEXT : 0));
- return true;
- }
-
- return false;
-}
-
// ---------------------------------------------------------------------------
// implements class PrereqChecker
// ---------------------------------------------------------------------------
virtual long OnNext ();
virtual long OnBack ();
virtual long OnUnattended ();
- virtual bool OnMessageCmd (int id, HWND hwndctl, UINT code);
private:
long whatNext ();
};